geneseed 4.30.1 → 4.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/SHIPPED.md +1 -1
  3. package/docs/concepts/footprint.md +1 -1
  4. package/docs/reference/plugin-activity.md +1 -1
  5. package/docs/web-ui.md +70 -21
  6. package/harness.config.json +1 -1
  7. package/js/README.md +3 -3
  8. package/js/web/actions.mjs +13 -23
  9. package/js/web/activity.mjs +139 -23
  10. package/js/web/api.mjs +29 -11
  11. package/js/web/catalog.mjs +108 -23
  12. package/js/web/handler.mjs +4 -3
  13. package/js/web/routes.mjs +47 -14
  14. package/js/web/server.mjs +14 -13
  15. package/js/web/state.mjs +36 -15
  16. package/js/web/usage-api.mjs +7 -3
  17. package/package.json +1 -1
  18. package/web/dist/assets/Activity-B7cFtS00.js +1 -0
  19. package/web/dist/assets/ActivityDetail-C-GbMmuW.js +1 -0
  20. package/web/dist/assets/{Bonsai-CN4rRAHc.js → Bonsai-_YyexVC5.js} +1 -1
  21. package/web/dist/assets/{CopyButton-CYljsnLo.js → CopyButton-IXnXzH4Y.js} +1 -1
  22. package/web/dist/assets/{Dashboard-DkUm4XMu.js → Dashboard-sCfEjowQ.js} +2 -2
  23. package/web/dist/assets/{Docs-DE04qOKj.js → Docs-w3Y7M5Ts.js} +2 -2
  24. package/web/dist/assets/{GreenhouseView-DPwhFO_j.js → GreenhouseView-BWWbMKmg.js} +1 -1
  25. package/web/dist/assets/Installs-CnkdJ-VA.js +3 -0
  26. package/web/dist/assets/{JournalView-DQlDC-7i.js → JournalView-C7bPD3fZ.js} +1 -1
  27. package/web/dist/assets/{KitApply-BN2Az7dc.js → KitApply-CQQbnThf.js} +1 -1
  28. package/web/dist/assets/{Kits-C9qVd466.js → Kits-aj07N7mT.js} +1 -1
  29. package/web/dist/assets/Laws-DZ38nl_H.js +3 -0
  30. package/web/dist/assets/Library-QCGXPV5h.js +2 -0
  31. package/web/dist/assets/Loops-C5u7fQOR.js +2 -0
  32. package/web/dist/assets/{OperatorHudView-CLN6Qn25.js → OperatorHudView-Blu1lqiZ.js} +1 -1
  33. package/web/dist/assets/Personal-ox_MktWO.js +2 -0
  34. package/web/dist/assets/Tabs-CIPyMAX-.js +1 -0
  35. package/web/dist/assets/api-BxjLd7Qd.js +1 -0
  36. package/web/dist/assets/index-0GCxkY7m.css +1 -0
  37. package/web/dist/assets/index-CzDi9JpF.js +3 -0
  38. package/web/dist/index.html +3 -3
  39. package/web/dist/assets/Activity-C8pQvnos.js +0 -1
  40. package/web/dist/assets/ActivityDetail-D_8Bx-QO.js +0 -1
  41. package/web/dist/assets/Installs-DmPzD4BW.js +0 -3
  42. package/web/dist/assets/Laws-T2wbwMmB.js +0 -3
  43. package/web/dist/assets/Library-t3KocV0-.js +0 -2
  44. package/web/dist/assets/Loops-6lNY-9uR.js +0 -2
  45. package/web/dist/assets/Personal-xjoSqCzr.js +0 -2
  46. package/web/dist/assets/Tabs-DaExAgql.js +0 -1
  47. package/web/dist/assets/api-LvBC0CnK.js +0 -1
  48. package/web/dist/assets/index-DhNNxhfg.js +0 -3
  49. package/web/dist/assets/index-XTGBLKQr.css +0 -1
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-sCfEjowQ.js","assets/rolldown-runtime-hePW80VL.js","assets/react-DlYQp10C.js","assets/api-BxjLd7Qd.js","assets/motion-CXaUMNkg.js","assets/sections-ChwaobfW.js","assets/Activity-B7cFtS00.js","assets/EmptyState-1sPNleqv.js","assets/Bonsai-_YyexVC5.js","assets/usePoll-bDFN-Hr6.js","assets/ActivityDetail-C-GbMmuW.js","assets/Library-QCGXPV5h.js","assets/RailCats-BuJD4Jou.js","assets/FilterInput-CZREvrjX.js","assets/Markdown-DpmmtW2Y.js","assets/Kits-aj07N7mT.js","assets/KitApply-CQQbnThf.js","assets/DataTable-BWbUx4bY.js","assets/Loops-C5u7fQOR.js","assets/CopyButton-IXnXzH4Y.js","assets/Laws-DZ38nl_H.js","assets/Personal-ox_MktWO.js","assets/Tabs-CIPyMAX-.js","assets/Installs-CnkdJ-VA.js","assets/Docs-w3Y7M5Ts.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n,r,t as i}from"./react-DlYQp10C.js";import{t as a}from"./api-BxjLd7Qd.js";import{A as o,C as s,D as c,E as l,F as u,G as d,H as f,I as p,L as m,O as h,P as g,T as _,U as v,_ as y,b,d as x,f as S,i as C,j as w,l as T,n as E,o as D,r as O,s as k,t as A,u as j,v as ee,z as te}from"./motion-CXaUMNkg.js";import{i as M,n as N,r as P}from"./sections-ChwaobfW.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ne=(e,t)=>{if(m(t,`<`)){let n=t[1]===`<`,r=e._tail,i=r?r._offset+r._delay:0;return n?i:i+r.duration}},re=(e,t)=>{let n=e.iterationDuration;if(n===1e-11&&(n=0),w(t))return n;if(h(+t))return+t;let r=t,i=e?e.labels:null,a=!c(i),o=ne(e,r),s=!w(o),l=v.exec(r);if(l){let e=l[0],t=r.split(e),c=a&&t[0]?i[t[0]]:n,u=s?o:a?c:n,d=+t[1];return ee(u,d,e[0])}return s?o:a?w(i[r])?n:i[r]:n},F=(e=0,t=1,n=0)=>{let r=10**n;return Math.floor((Math.random()*(t-e+1/r)+e)*r)/r},I=0,ie=(e,t=0,n=1,r=0)=>{let i=e===void 0?I++:e;return(e=t,a=n,o=r)=>{i+=1831565813,i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61);let s=10**o;return Math.floor((((i^i>>>14)>>>0)/4294967296*(a-e+1/s)+e)*s)/s}},ae=(e,t=F)=>{let n=e.length,r,i;for(;n;)i=t(0,--n),r=e[n],e[n]=e[i],e[i]=r;return e},oe=(e,t={})=>{let n=[],r=0,i,a=null,c=t.from,f=t.reversed,m=t.ease,v=!w(m),x=v&&!w(m.ease)?m.ease:v?j(m):null,C=t.grid,T=C===!0,E=t.axis,D=t.total,O=w(c)||c===0||c===`first`,k=c===`center`,A=c===`last`,ee=c===`random`,te=_(c),M=_(e),N=t.use,P=g(M?e[0]:e),ne=M?g(e[1]):0,I=d.exec((M?e[1]:e)+``),oe=t.start||0+(M?P:0),L=t.seed,se=!w(L)&&L!==!1?ie(L===!0?0:L):F,R=t.jitter,ce=!w(R),le=_(R),z=le?R[0]:R||0,B=le?R[1]:R||0,V=O?0:h(c)?c:0;return(e,d,m,g,_)=>{let[v]=S(e),O=w(D)?m.length:D,j=w(N)?!1:l(N)?N(v,d,O):y(v,N),F=h(j)||o(j)&&h(+j)?+j:d,ie=F>=0&&F<O?F:d;if(k&&(V=(O-1)/2),A&&(V=O-1),!n.length){if(T){let e=!0,t=!1,r=1/0,i=1/0,a=1/0,o=-1/0,s=-1/0,u=-1/0,d=[],f=[],g=[];for(let n=0;n<O;n++){let c=m[n],p=0,_=0,v=0,y=!1;if(c&&l(c.getBoundingClientRect)){let e=c.getBoundingClientRect();p=e.left+e.width/2,_=e.top+e.height/2,y=!0}else{let e=c;e&&h(e.x)&&h(e.y)&&(p=e.x,_=e.y,h(e.z)&&(v=e.z,t=!0),y=!0)}if(!y){e=!1;break}d.push(p),f.push(_),g.push(v),p<r&&(r=p),_<i&&(i=_),v<a&&(a=v),p>o&&(o=p),_>s&&(s=_),v>u&&(u=v)}if(e){let e=d[0],l=f[0],m=g[0];te?(e=r+c[0]*(o-r),l=i+c[1]*(s-i),m=t?a+(c.length>=3?c[2]:.5)*(u-a):0):k?(e=(r+o)/2,l=(i+s)/2,m=(a+u)/2):A?(e=d[O-1],l=f[O-1],m=g[O-1]):h(c)&&(e=d[c],l=f[c],m=g[c]);for(let r=0;r<O;r++){let i=e-d[r],a=l-f[r],o=m-g[r],s=p(i*i+a*a+(t?o*o:0));E===`x`&&(s=-i),E===`y`&&(s=-a),E===`z`&&(s=-o),n.push(s)}let _=1/0;for(let e=0;e<O;e++){let t=b(n[e]);t>0&&t<_&&(_=t)}if(_>0&&_<1/0)for(let e=0;e<O;e++)n[e]=n[e]/_}else for(let e=0;e<O;e++)n.push(b(V-e))}else for(let e=0;e<O;e++)if(!C)n.push(b(V-e));else{let t=C.length,r=C[0]*C[1],i,a,o;te?(i=c[0]*(C[0]-1),a=c[1]*(C[1]-1),o=t===3?(c.length>=3?c[2]:.5)*(C[2]-1):0):k?(i=(C[0]-1)/2,a=(C[1]-1)/2,o=t===3?(C[2]-1)/2:0):(i=V%C[0],a=s(V/C[0])%C[1],o=t===3?s(V/r):0);let l=e%C[0],u=s(e/C[0])%C[1],d=t===3?s(e/r):0,f=i-l,m=a-u,h=o-d,g=p(f*f+m*m+(t===3?h*h:0));E===`x`&&(g=-f),E===`y`&&(g=-m),E===`z`&&(g=-h),n.push(g)}r=n[0];for(let e=1;e<O;e++)n[e]>r&&(r=n[e]);if(x||f)for(let e=0;e<O;e++){let t=n[e];x&&(t=x(t/r)*r),f&&(t=E?-t:b(r-t)),n[e]=t}if(ce){a=Array(O);for(let e=0;e<O;e++)a[e]=se(-1,1,4)}ee&&(n=ae(n,se))}let L=M?(ne-P)/r:P;w(i)&&(i=_?re(_,w(t.start)?_.iterationDuration:oe):oe);let R=i+(L*u(n[ie],2)||0);if(ce){let e=r?n[ie]/r:0,t=z+(B-z)*e;R+=a[ie]*t}return t.modifier&&(R=t.modifier(R)),I&&(R=`${R}${I[2]}`),R}},L=e=>{let t=1;if(e&&e.getCTM){let n=e.getCTM();n&&(t=(p(n.a*n.a+n.b*n.b)+p(n.c*n.c+n.d*n.d))/2)}return t},se=(e,t,n)=>{let r=te,i=getComputedStyle(e),a=i.strokeLinecap,o=i.vectorEffect===`non-scaling-stroke`?e:null,s=a,c=new Proxy(e,{get(e,t){let n=e[t];return t===f?e:t===`setAttribute`?(...t)=>{if(t[0]===`draw`){let n=t[1].split(` `),i=+n[0],c=+n[1],l=L(o),u=i*-r*l,d=c*r*l+u,f=r*l+(i===0&&c===1||i===1&&c===0?0:10*l)-d;if(a!==`butt`){let t=i===c?`butt`:a;s!==t&&(e.style.strokeLinecap=`${t}`,s=t)}e.setAttribute(`stroke-dashoffset`,`${u}`),e.setAttribute(`stroke-dasharray`,`${d} ${f}`)}return Reflect.apply(n,e,t)}:l(n)?(...t)=>Reflect.apply(n,e,t):n}});return e.getAttribute(`pathLength`)!==`${r}`&&(e.setAttribute(`pathLength`,`${r}`),c.setAttribute(`draw`,`${t} ${n}`)),c},R=(e,t=0,n=0)=>x(e).map(e=>se(e,t,n)),ce=r(),le=n(),z=e(t(),1),B={overview:`Overview`,laws:`Constitution`,library:`Library`,kits:`Kits`,loops:`Loops`,personal:`Personal`,installs:`Installs`,docs:`Docs`,activity:`Activity`},V={loops:[`templates`,`bricks`,`active`],personal:[`rules`,`profile`,`memory`,`notebook`],installs:[`hosts`,`kits`,`edits`,`doctor`,`server`]},ue={templates:`Templates`,bricks:`Bricks`,active:`Active`,rules:`Rules`,profile:`Profile`,memory:`Memory`,notebook:`Notebook`,hosts:`Hosts`,kits:`Kits`,edits:`Local edits`,doctor:`Doctor`,server:`Server`},de={dashboard:[`overview`],constitution:[`laws`],rules:[`personal`,`rules`],profile:[`personal`,`profile`],harness:[`installs`,`hosts`],harnesses:[`installs`,`hosts`],themes:[`installs`,`hosts`],diff:[`installs`,`edits`],doctor:[`installs`,`doctor`],settings:[`installs`,`server`],about:[`installs`,`server`]},fe=(e,t)=>t!==void 0&&Object.hasOwn(e,t),pe=(e,t)=>V[e].includes(t)?t:V[e][0];function me(e){let t=(e||`#/`).slice(2).split(`/`).filter(Boolean),[n,r,i]=t,a=e=>{try{return decodeURIComponent(e||``)}catch{return e||``}};if(n===`section`||n===`item`){let e=n===`item`&&fe(M,r)?M[r]:r,t=n===`item`?a(i):void 0;return{page:e===`laws`?`laws`:`library`,section:e,item:t}}if(n===`docs`)return{page:`docs`,item:a(t.slice(1).join(`/`))};if(n===`kits`)return r?{page:`kits`,item:a(r)}:{page:`kits`};if(n===`activity`&&r)return{page:`activity`,item:a(r)};if(n===`skills`||n===`agents`)return{page:`library`,section:n};if(fe(V,n)){let e=pe(n,r);return i&&e===r?{page:n,tab:e,item:a(i)}:{page:n,tab:e}}if(fe(de,n)){let[e,t]=de[n];return t?{page:e,tab:t}:{page:e}}return{page:fe(B,n)?n:`overview`}}var he=new Set;function ge(e){return he.add(e),()=>he.delete(e)}function _e(){let e=()=>me(typeof window<`u`?window.location.hash:``),[t,n]=(0,z.useState)(e);(0,z.useEffect)(()=>{let t=window.location.hash,r=()=>{let r=window.location.hash;if(r!==t){for(let e of he)if(e({from:t,to:r})===!1){window.history.replaceState(window.history.state,``,t||`#/`);return}t=r,n(e())}};return window.addEventListener(`hashchange`,r),()=>window.removeEventListener(`hashchange`,r)},[]);let r=(0,z.useRef)(!1);return(0,z.useEffect)(()=>{if(document.title=`${B[t.page]} · Geneseed`,!r.current){r.current=!0;return}let e=document.getElementById(`main`);e?.focus();for(let t of[e,document.scrollingElement||document.documentElement])t&&(t.scrollTop=0)},[t.page]),t}var ve=e=>{window.location.hash=e},ye={red:`#FF5C57`,green:`#4ED888`,yellow:`#E8B53D`,blue:`#5B8CFF`,magenta:`#C77DFF`,cyan:`#3AD4C4`,white:`#E9EFEA`},be={red:`#C53A36`,green:`#2FA864`,yellow:`#B8862A`,blue:`#3C66D8`,magenta:`#9A52D6`,cyan:`#2BA89B`,white:`#AEB8B0`},xe=e=>ye[e]||ye.cyan,Se={red:`#A92F2B`,green:`#1E7A47`,yellow:`#8A6414`,blue:`#2F55C0`,magenta:`#7E3FB8`,cyan:`#15766C`,white:`#465A51`};function Ce(e,t,n){if(!e)return;let r=n===`light`,i=r?be[t]||be.cyan:xe(t);r&&t===`white`&&(i=`#566B62`);let a=r?Se[t]||Se.cyan:i;Ve(e,Le(i,be[t]||be.cyan,Oe,a,r),r)}var we={cultivar:{dark:`#3AD4C4`,light:`#127E73`,ink:`#06100D`},operator:{dark:`#E8A23B`,light:`#8F5E10`,ink:`#1A1306`},matrix:{dark:`#19E37C`,light:`#0B7A47`,ink:`#04140C`},atlas:{dark:`#8FD694`,light:`#1C8450`,ink:`#14200F`}};function Te(e,t,n){let r=we[t];if(!e||!r)return!1;let i=n===`light`,a=i?r.light:r.dark;return Ve(e,Le(a,r.light,r.ink,a,i),i),!0}var Ee={dark:{worst:`#232A31`,soft:[`#14181D`,`#1B2026`,`#11151A`,`#171C22`,`#0B1116`,`#121A21`,`#1C1A12`,`#211E15`]},light:{worst:`#EBE6D8`,soft:[`#FBFDFC`,`#F3F6F6`,`#F4F6F8`,`#E9F4ED`,`#FCFAF4`,`#F6F2E7`]}},De=.13,Oe=`#06100D`,ke=e=>{let t=e.replace(`#`,``);return[0,2,4].map(e=>parseInt(t.slice(e,e+2),16))},Ae=e=>`#`+e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``).toUpperCase(),je=e=>{let[t,n,r]=ke(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},Me=(e,t)=>{let[n,r]=[je(e),je(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)},Ne=(e,t,n)=>{let r=ke(e),i=ke(t);return Ae(r.map((e,t)=>e+(i[t]-e)*n))},Pe=(e,t,n,r)=>{let i=e=>Math.min(...[].concat(t).map(t=>Me(e,t))),a=e;for(let t=.05;i(a)<n&&t<=1.0001;t+=.05)a=Ne(e,r,t);return a},Fe=e=>{let[t,n,r]=ke(e).map(e=>e/255),i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a;if(o===0)return{h:0,s:0};let s=o/(1-Math.abs(i+a-1));return{h:((i===t?(n-r)/o%6:i===n?(r-t)/o+2:(t-n)/o+4)*60+360)%360,s}},Ie=(e,t)=>{let n=Math.abs(e-t)%360;return n>180?360-n:n};function Le(e,t,n,r,i){let a=i?`#000000`:`#FFFFFF`,o=e=>Me(e,n)>=Me(e,`#FFFFFF`)?n:`#FFFFFF`,s=Me(e,o(e))>=4.5?e:Pe(e,i?`#FFFFFF`:n,4.5,a),c=i?Ee.light:Ee.dark,l=[c.worst,...c.soft.map(e=>Ne(e,s,De))];return{accent:s,accent2:t,ink:o(s),text:Pe(r,l,4.5,a)}}var Re=39,ze={dark:[`#FF8A4C`,`#FF8A4C`],light:[`#B4441F`,`#9B3A1B`]};function Be(e,t,n){let[r,i]=n?ze.light:ze.dark,{h:a,s:o}=Fe(t),s=Ie(a,Re);o>=.15&&s<=29&&Ie(a,Fe(r).h)>s?(e.style.setProperty(`--warn`,r),e.style.setProperty(`--warn-text`,i)):(e.style.removeProperty(`--warn`),e.style.removeProperty(`--warn-text`))}function Ve(e,t,n){e.style.setProperty(`--accent`,t.accent),e.style.setProperty(`--accent-2`,t.accent2),e.style.setProperty(`--accent-ink`,t.ink),e.style.setProperty(`--accent-text`,t.text),Be(e,t.accent,n)}var He=e=>typeof e==`string`&&/^#[0-9a-fA-F]{6}$/.test(e);function Ue(e,t){let n=t===`light`,r=n?Ee.light:Ee.dark,i=n?`#000000`:`#FFFFFF`,a=Pe(e,r.worst,3,i);return Le(a,Pe(a,r.worst,4.5,i),Oe,a,n)}function We(e,t,n){return!e||!He(t)?!1:(Ve(e,Ue(t,n),n===`light`),!0)}function H(e,t){let[n,r]=(0,z.useState)(()=>{try{return t(localStorage.getItem(e))}catch{return t(null)}});return[n,(0,z.useCallback)(t=>r(n=>{let r=typeof t==`function`?t(n):t;try{localStorage.setItem(e,r)}catch{}return r}),[e])]}var Ge=`geneseed-mode`;function Ke(){let[e,t]=H(Ge,e=>e===`light`?`light`:`dark`);return[e,()=>t(e=>e===`light`?`dark`:`light`)]}var qe=`geneseed-flavour`,Je=[{id:`cultivar`,short:`Cultivar`,name:`Cultivar Evolved`,tagline:`The calm default — cool teal ink, geometric sans, soft flat cards lit by one quiet shadow.`},{id:`operator`,short:`Operator`,name:`Operator HUD`,tagline:`Amber phosphor on cool charcoal — all-mono, zero-radius instrument readout.`},{id:`matrix`,short:`Matrix`,name:`Matrix`,tagline:`Acid-green order-book terminal on pure black — all Space Mono, square 2px, a faint code-grid.`},{id:`atlas`,short:`Atlas`,name:`Atlas`,tagline:`The field journal — loam dark, sage ink, the codex as a living map.`}],Ye=new Set(Je.map(e=>e.id)),Xe={a:`cultivar`,b:`atlas`,c:`operator`,d:`cultivar`,e:`matrix`,f:`cultivar`,g:`cultivar`,z:`cultivar`,cb:`matrix`,cm:`cultivar`,greenhouse:`atlas`,heirloom:`cultivar`,aurora:`cultivar`,perspective:`cultivar`,sequencer:`cultivar`,cobalt:`matrix`,cosmic:`cultivar`,neon:`matrix`};function Ze(){return H(qe,Qe)}function Qe(e){return Ye.has(e)?e:Xe[e]||`cultivar`}var $e=1e3,et=e=>new Promise(t=>setTimeout(t,e));async function tt(){try{return(await a.ping()).pid??null}catch{return null}}async function nt(e=0,t=null){await et(e);for(let e=0;e<30;e++){let e=await tt();if(e!==null&&e!==t)break;await et($e)}window.location.reload()}async function rt(){let e=await tt();try{await a.restart()}catch(e){if(e.status)throw e}await nt($e,e)}var it=`geneseed-accent`,at=[{id:`curated`,short:`Curated`,tagline:`Each theme's own signature colour.`}],ot=[[`cyan`,`Cyan`],[`blue`,`Blue`],[`magenta`,`Violet`],[`yellow`,`Amber`],[`green`,`Green`]].map(([e,t])=>({id:`custom:${e}`,name:e,short:t,hex:xe(e),tagline:`${t}, whatever the voice, until the skin changes.`})),st=[...at,...ot],ct=new Set(st.map(e=>e.id)),lt=e=>{let t=typeof e==`string`&&e.startsWith(`hex:`)?e.slice(4):null;return He(t)?t.toUpperCase():null},ut=e=>e&&(ct.has(e)||lt(e))?e:`curated`,dt=e=>ot.find(t=>t.id===e)?.name??null,ft=e=>{let t=lt(e);return t?`Your own colour, ${t}.`:st.find(t=>t.id===e)?.tagline??``};function pt(){return H(it,ut)}var mt=`geneseed-layout`,ht=[{id:`overview`,short:`Overview`,tagline:`Every install, what needs you, cost, usage and gates.`},{id:`cultivar`,short:`Cultivar`,tagline:`Hero, KPIs & genome grid.`},{id:`greenhouse`,short:`Greenhouse`,tagline:`Ring, tiles & mix donut.`},{id:`operator`,short:`Operator`,tagline:`Dense terminal readout.`},{id:`journal`,short:`Journal`,tagline:`Growth rings & the constitution map.`}],gt=new Set(ht.map(e=>e.id));function _t(e){return e&&gt.has(e)?e:`overview`}function vt(){return H(mt,_t)}function yt(e){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(null),[o,s]=(0,z.useState)([]),c=()=>a.overview().then(e=>{n(e),i(null)}).catch(t=>{i(t?.body?.message||t?.message||String(t)),e?.(t)});return(0,z.useEffect)(()=>{c()},[]),(0,z.useEffect)(()=>{a.themes().then(e=>s(e.themes)).catch(()=>{})},[]),{overview:t,error:r,themes:o,reload:c}}var bt=600;function xt({onFinish:e,onError:t}={}){let[n,r]=(0,z.useState)([]),[i,o]=(0,z.useState)(null),[s,c]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{a.jobs().then(({jobs:e})=>{if(!e.length)return;r(e.map(e=>({id:e.id,action:e.action,status:e.status,output:e.output||``,duration:e.duration,started:e.started})));let t=e.find(e=>e.status===`running`);t&&(o(t.id),c(!0))}).catch(()=>{})},[]),(0,z.useEffect)(()=>{if(!i)return;let t=n.find(e=>e.id===i),s=t?.action===`update`||!!t?.restarts,c=null;s&&tt().then(e=>c=e);let l=setInterval(async()=>{if(!document.hidden)try{let t=await a.job(i);if(r(e=>{let n=e.findIndex(e=>e.id===i);if(n===-1)return e;let r=e[n],a=t.output||``;if(r.output===a&&r.status===t.status&&r.duration===t.duration)return e;let o=e.slice();return o[n]={...r,output:a,status:t.status,duration:t.duration},o}),t.status!==`running`){if(clearInterval(l),o(null),s&&t.status===`done`){nt(2e3,c);return}e?.(t.status)}}catch{if(!s)return;clearInterval(l),nt(0,c)}},bt);return()=>clearInterval(l)},[i]),{runs:n,activeId:i,consoleOpen:s,setConsoleOpen:c,runAction:async(e,n,i)=>{try{let{job_id:t,restarts:s}=await a.action(e,n,i),l=n?.emit||i?.host,u=e===`build`&&n?.theme?`build (${n.theme}${l?` · ${l}`:``})`:e;return r(e=>[...e,{id:t,action:u,status:`running`,output:``,started:Date.now()/1e3,restarts:!!s}]),o(t),c(!0),t}catch(e){t?.(e)}},cancelJob:e=>a.cancelJob(e).catch(e=>t?.(e)),clearRuns:()=>r([])}}var U=new Map,St=new Map;function Ct(e){for(let t of U.keys())t.startsWith(`${e}|`)&&U.delete(t)}function W(e,t=[],n=null,{revalidate:r=!1}={}){let i=n===null?null:`${n}|${t.join(``)}`,[a,o]=(0,z.useState)(()=>i!==null&&U.has(i)?U.get(i):null),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(()=>!(i!==null&&U.has(i))),d=(0,z.useRef)(e),f=(0,z.useRef)(i);(0,z.useLayoutEffect)(()=>{d.current=e,f.current=i});let p=(0,z.useRef)(0),m=(0,z.useCallback)(()=>{let e=++p.current,t=()=>e===p.current;u(!0),c(``);let n=f.current;return Promise.resolve(d.current()).then(e=>{if(t()&&(o(e),n!==null)){U.set(n,e);for(let t of St.get(n)||[])t(e)}}).catch(e=>{t()&&c(e.message)}).finally(()=>{t()&&u(!1)})},t);return(0,z.useEffect)(()=>{let e=f.current;return e!==null&&(St.has(e)||St.set(e,new Set),St.get(e).add(o)),e!==null&&U.has(e)&&(p.current++,o(U.get(e)),c(``),u(!1),!r)||m(),()=>St.get(e)?.delete(o)},[m]),{data:a,error:s,loading:l,reload:m,setData:o}}var wt=[{id:`opencode`,label:`OpenCode`,deployAdds:`.opencode/ + AGENT.md`,removeProject:`.opencode/ + AGENT.md + the bundle`,removeGlobal:`~/.config/opencode's AGENT.md, agents, skills, plugins + the opencode.json entry`},{id:`claude`,label:`Claude Code`,deployAdds:`.claude/ + CLAUDE.md`,removeProject:`.claude/ + the CLAUDE.md block`,removeGlobal:`~/.claude's agents/skills + the CLAUDE.md block + settings hooks`},{id:`bob`,label:`BOB (IBM)`,deployAdds:`.bob/ + AGENTS.md`,removeProject:`.bob/ + the AGENTS.md block`,removeGlobal:`~/.bob's agents/skills + the AGENTS.md block + settings hooks`},{id:`openclaude`,label:`OpenClaude`,deployAdds:`.openclaude/ + its CLAUDE.md`,removeProject:`.openclaude/ + its CLAUDE.md block`,removeGlobal:`~/.openclaude's agents/skills + the CLAUDE.md block + settings hooks`}],Tt=e=>wt.find(t=>t.id===e)||wt[0],Et=(e,t)=>t===`project`?Tt(e).removeProject:Tt(e).removeGlobal,Dt=e=>String(e||``).replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Ot=e=>e.scope===`global`?Tt(e.host).label:Dt(e.path),kt=e=>e.scope===`global`?`${e.host} · global`:`${Dt(e.path)} · ${e.host}`,At=e=>{let t=(e||[]).filter(e=>e.state===`active`);return[...t.filter(e=>e.default),...t.filter(e=>!e.default)]},jt=e=>e?{host:e.host,path:e.path}:void 0;function Mt(e){let{data:t,loading:n}=W(()=>Promise.resolve().then(()=>a.installs()).catch(()=>null),[e],`installs`);return n&&!t?null:At(t?.installs)}var Nt=e=>`geneseed-install-${e}`;function Pt(e,t){try{localStorage.setItem(Nt(e),t)}catch{}}function Ft(e){try{let t=localStorage.getItem(Nt(e))||``;return localStorage.removeItem(Nt(e)),t}catch{return``}}function It(e,t){let[n,r]=H(Nt(e),e=>e||null);return[(t||[]).find(e=>e.id===n)||t?.[0]||null,e=>r(e.id)]}var Lt=60,Rt=3600,zt=86400,Bt={seconds:90,minutes:5400,hours:36*Rt};function Vt(e){let t=Math.max(0,Date.now()/1e3-e);return t<Bt.seconds?`${Math.round(t)}s`:t<Bt.minutes?`${Math.round(t/Lt)}m`:t<Bt.hours?`${Math.round(t/Rt)}h`:`${Math.round(t/zt)}d`}var G={deployed:.4,doctorClean:.25,doctorMinor:.15,doctorMinorMax:2,doctorFail:.05,versionSynced:.2,diskClean:.15},Ht={warn:G.deployed+G.doctorClean,bad:G.deployed};function Ut(e,t,n){if(!e)return 0;let r=e.doctor?.problems?.length??99,i=e.doctor?.ok?G.doctorClean:r<=G.doctorMinorMax?G.doctorMinor:G.doctorFail,a=t&&t.installed_fp&&t.installed_fp===t.source_fp,o=(e.deployed?G.deployed:0)+i+(a?G.versionSynced:0)+(e.diff&&e.diff.missing===0?G.diskClean:0);return Math.min(o,Ht[n]??1)}var Wt=e=>Math.max(...P.map(t=>e?.[t]??0),1),Gt=e=>(e?.edited??0)+(e?.added??0),K=e=>Gt(e)+(e?.missing??0),Kt=e=>(e?.laws??0)+(e?.doctrines?.rules??0),q=i(),qt={dashboard:`M3 13h7V3H3v10Zm0 8h7v-6H3v6Zm11 0h7V11h-7v10Zm0-18v6h7V3h-7Z`,library:`M4 5h10v14H4zM16 7h4v12h-4M7 9h4M7 12h4`,loop:`M19.5 9A8 8 0 1 1 15 4.6M15 1.5l.2 3.3-3.2.8`,graph:`M6 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM7.5 14.5l8-8M16.7 15.2L8.8 16.6`,changes:`M4 6h10M4 12h7M4 18h12M17 4l3 3-3 3M20 7h-6`,doctor:`M12 3v6m0 0a4 4 0 0 1-4 4H7a3 3 0 0 0-3 3v2m8-9a4 4 0 0 0 4 4h1a3 3 0 0 1 3 3v2M12 3a1.5 1.5 0 1 0 0-.01`,themes:`M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.2 0-1 .8-1.5 1.7-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8-9-8Z`,settings:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm8-3a8 8 0 0 0-.1-1.3l2-1.6-2-3.4-2.4 1a8 8 0 0 0-2.2-1.3L15 2H9l-.3 2.6a8 8 0 0 0-2.2 1.3l-2.4-1-2 3.4 2 1.6A8 8 0 0 0 4 12c0 .4 0 .9.1 1.3l-2 1.6 2 3.4 2.4-1a8 8 0 0 0 2.2 1.3L9 22h6l.3-2.6a8 8 0 0 0 2.2-1.3l2.4 1 2-3.4-2-1.6c.1-.4.1-.9.1-1.3Z`,search:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3`,chevron:`M9 6l6 6-6 6`,x:`M6 6l12 12M18 6L6 18`,menu:`M4 7h16M4 12h16M4 17h16`,play:`M7 5v14l11-7L7 5Z`,clear:`M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14`,download:`M12 3v12m0 0l-4-4m4 4l4-4M4 19h16`,refresh:`M21 12a9 9 0 1 1-3-6.7M21 4v5h-5`,folder:`M3 7a2 2 0 0 1 2-2h3.5l2 2H19a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z`,build:`M14 3l-1 4 4-1 3 3-4 1 1 4-3 3-1-4-4 1-3-3 4-1-1-4 3-3 5 0Z`,arrow:`M5 12h14M13 6l6 6-6 6`,external:`M14 5h5v5M19 5l-8 8M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6`,copy:`M9 9h11v11H9zM5 15H4V4h11v1`,check:`M5 12.5l4.5 4.5L19 7`,spark:`M12 3v3m0 12v3m9-9h-3M6 12H3m13.5-6.5-2 2m-7 7-2 2m11 0-2-2m-7-7-2-2`,activity:`M3 12h4l2.5-7 5 14 2.5-7H21`,agent:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8`,kit:`M21 8l-9-5-9 5v8l9 5 9-5V8ZM3 8l9 5 9-5M12 13v8`,layers:`M12 3l9 5-9 5-9-5 9-5ZM3 13l9 5 9-5M3 17l9 5 9-5`,sun:`M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6 4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z`,moon:`M21 12.8A8.5 8.5 0 1 1 11.2 3a6.5 6.5 0 0 0 9.8 9.8Z`,power:`M12 3v9M7.5 6.5a7 7 0 1 0 9 0`,docs:`M5 4h9l5 5v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1ZM14 4v5h5M8 12h7M8 16h7`,skill:`M21.7 6.6a5 5 0 0 1-6.6 6.6l-7.4 7.4a2 2 0 1 1-2.8-2.8l7.4-7.4a5 5 0 0 1 6.6-6.6l-2.6 2.6a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0Z`,law:`M12 3v18M5 6h14M8 21h8M6 6l-3 6h6zM3 12a3 3 0 0 1 6 0M18 6l-3 6h6zM15 12a3 3 0 0 1 6 0`,rule:`M7 3h10a1 1 0 0 1 1 1v17l-6-3.5L6 21V4a1 1 0 0 1 1-1ZM9.5 9.5l1.8 1.8 3.4-3.6`,profile:`M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM5 20a7 7 0 0 1 14 0`,notebook:`M7 4h11v16H7zM4 8h3M4 12h3M4 16h3M11 9h5M11 13h5M11 17h3`,about:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 11v6M12 7.6h.01`,github:`M12 2a10 10 0 0 0-3.2 19.5c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.5 2.3 1.1 2.9.8.1-.6.3-1.1.6-1.3-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.7 1a9.4 9.4 0 0 1 5 0c1.9-1.3 2.7-1 2.7-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.8v2.6c0 .3.2.6.7.5A10 10 0 0 0 12 2Z`};function J({name:e,className:t=`glyph`,style:n}){return(0,q.jsx)(`svg`,{className:t,style:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:qt[e]||``})})}function Jt({className:e=`sprout`}){return(0,q.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,q.jsx)(`path`,{d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,q.jsx)(`path`,{d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,q.jsx)(`path`,{d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,q.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})}var Yt=[{hash:`#/`,page:`overview`,label:`Overview`,icon:`dashboard`},{hash:`#/laws`,page:`laws`,label:`Constitution`,icon:`law`,count:e=>e?.counts?(e.counts.ontology??0)+(e.counts.laws??0)+(e.counts.doctrines?.rules??0):null},{hash:`#/library`,page:`library`,label:`Library`,icon:`library`,count:e=>e?.counts?[`skills`,`agents`,`memory`,`notebook`,`wiki`,`config`].reduce((t,n)=>t+(e.counts[n]??0),0):null},{hash:`#/kits`,page:`kits`,label:`Kits`,icon:`kit`},{hash:`#/loops`,page:`loops`,label:`Loops`,icon:`loop`,count:e=>e?.counts?.loops??null},{hash:`#/personal`,page:`personal`,label:`Personal`,icon:`profile`},{hash:`#/installs`,page:`installs`,label:`Installs`,icon:`layers`,count:(e,t)=>t?`${t.filter(e=>e.state===`active`).length}/${t.length}`:null}],Xt=[{hash:`#/docs`,page:`docs`,label:`Docs`,icon:`docs`},{hash:`#/activity`,page:`activity`,label:`Activity`,icon:`activity`}];function Zt({n:e,lit:t,count:n,onNavigate:r}){return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{className:`sb-item${t?` on`:``}`,href:e.hash,"aria-current":t?`page`:void 0,onClick:()=>r?.(),children:[(0,q.jsx)(J,{name:e.icon}),(0,q.jsx)(`span`,{className:`sb-label`,children:e.label}),n==null?null:(0,q.jsx)(`span`,{className:`sb-count`,children:n})]})})}function Qt({overview:e,onOpenVoice:t,tag:n}){if(!e)return null;let r=e.doctor,i=K(e.diff);return(0,q.jsxs)(`section`,{className:`sb-vitals`,"aria-label":n?`Install vitals, ${n}`:`Install vitals`,children:[n?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`install`}),(0,q.jsx)(`b`,{className:`mono`,children:n})]}):null,(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`doctor`}),(0,q.jsx)(`b`,{className:r?r.ok?`good`:`bad`:``,children:r?r.ok?`clean`:`${r.problems.length} to fix`:`not run`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`drift`}),(0,q.jsx)(`b`,{className:i?`warn`:``,children:e.diff?i:`n/a`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`built`}),(0,q.jsx)(`b`,{title:e.build_time||void 0,children:e.build_epoch?`${Vt(e.build_epoch)} ago`:`never`})]}),(0,q.jsxs)(`button`,{type:`button`,className:`sb-voice`,onClick:t,title:`Switch voice`,"aria-haspopup":`dialog`,children:[(0,q.jsxs)(`span`,{className:`sb-voice-name`,children:[(0,q.jsx)(`i`,{className:`sb-voice-swatch`,"aria-hidden":`true`}),`Voice · `,e.theme||`none`,n?` · ${n}`:``]}),(0,q.jsx)(J,{name:`chevron`})]})]})}function $t({route:e,overview:t,installs:n,onOpenVoice:r,onNavigate:i}){let a=At(n).length>1&&t?.install?kt(t.install):null;return(0,q.jsxs)(`nav`,{className:`sidebar`,id:`rail-nav`,"aria-label":`Console`,tabIndex:-1,children:[(0,q.jsxs)(`button`,{type:`button`,className:`sb-brand`,onClick:()=>{ve(`#/`),i?.()},"aria-label":`Geneseed, go to the overview`,children:[(0,q.jsx)(`span`,{className:`sb-mark`,children:(0,q.jsx)(Jt,{})}),(0,q.jsxs)(`span`,{className:`sb-brand-text`,children:[(0,q.jsx)(`span`,{className:`sb-name`,children:`Geneseed`}),(0,q.jsx)(`span`,{className:`sb-ver`,children:[t?.version&&`v${t.version}`,t?.theme,a].filter(Boolean).join(` · `)})]})]}),(0,q.jsx)(`ul`,{className:`sb-list`,children:[...Yt,...Xt].map(r=>(0,q.jsx)(Zt,{n:r,lit:e.page===r.page,count:r.count?.(t,n),onNavigate:i},r.page))}),(0,q.jsx)(`div`,{className:`sb-spacer`}),t?(0,q.jsx)(`button`,{type:`button`,className:`sb-voice-rail`,"aria-label":`Switch voice, now ${t.theme||`none`}`,title:`Switch voice`,onClick:r,children:(0,q.jsx)(J,{name:`spark`})}):null,(0,q.jsx)(Qt,{overview:t,onOpenVoice:r,tag:a})]})}var en=[`overview`,`laws`,`library`,`installs`];function tn({route:e,navOpen:t,onMore:n}){return(0,q.jsxs)(`nav`,{className:`tabbar`,"aria-label":`Console pages`,children:[Yt.filter(e=>en.includes(e.page)).map(t=>(0,q.jsxs)(`a`,{href:t.hash,className:e.page===t.page?`on`:``,"aria-current":e.page===t.page?`page`:void 0,children:[(0,q.jsx)(J,{name:t.icon}),t.label]},t.page)),(0,q.jsxs)(`button`,{type:`button`,className:`tab-more${en.includes(e.page)?``:` on`}`,"aria-controls":`rail-nav`,"aria-expanded":!!t,onClick:n,children:[(0,q.jsx)(J,{name:`menu`}),`More`]})]})}var nn=`geneseed-harness`,rn=wt.map(({id:e,label:t})=>({id:e,label:t}));function an(e=`opencode`){let[t,n]=H(nn,e=>rn.some(t=>t.id===e)?e:null);return[t??e,n]}function on(e){let t=String(e||``);return wt.find(e=>t.startsWith(e.id))?.id||`opencode`}var sn=Object.entries(B).flatMap(([e,t])=>(V[e]||[``]).map(n=>{let r=n?t+` / `+ue[n]:t;return{kind:`Pages`,sortKey:-1,title:r,desc:``,hay:r.toLowerCase(),route:e===`overview`?`#/`:`#/`+e+(n?`/`+n:``)}}));function cn(e=0){let[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(``),o=(0,z.useRef)(null),[s]=an(),c=`${e}|${s}`,[l,u]=(0,z.useState)(c);return l!==c&&(u(c),n(null)),(0,z.useEffect)(()=>{o.current=null},[c]),{index:t,error:r,prime:(0,z.useCallback)(()=>{if(t||o.current)return o.current;let e=(async()=>{let e=[],t=[`laws`,`skills`,...P],r=await Promise.all(t.map(async e=>{try{return{sec:e,items:(await a.catalog(e))?.items||[]}}catch{return{sec:e,items:[]}}}));for(let{sec:n,items:i}of r){let r=N[n];for(let a of i){let i=a.title||a.name;e.push({kind:r.label,sortKey:t.indexOf(n),title:i,desc:a.desc||``,hay:`${i} ${a.desc||``} ${a.name||``}`.toLowerCase(),route:`#/item/${r.type}/${encodeURIComponent(a.name)}`})}}try{let t=await a.mcp(),n=new Set;for(let r of t?.targets||[])for(let t of r.servers||[]){if(n.has(t.name))continue;n.add(t.name);let r=t.label||t.name;e.push({kind:`MCP servers`,sortKey:100,title:r,desc:t.desc||``,hay:`${r} ${t.desc||``} ${t.name||``} mcp`.toLowerCase(),route:`#/installs/hosts`})}}catch{}try{let t=await a.docs(s);for(let n of t?.groups||[])for(let t of n.pages||[])e.push({kind:`Docs`,sortKey:110,title:t.title,desc:n.label,hay:`${t.title||``} ${t.id||``} ${n.label||``} ${t.section||``} ${t.description||``}`.toLowerCase(),route:`#/docs/${encodeURIComponent(t.id)}`})}catch{}return n(e),o.current=null,e})().catch(e=>(o.current=null,i(e.message||String(e)),[]));return o.current=e,e},[t,s])}}function ln({open:e,title:t,children:n,confirmLabel:r,tone:i,onConfirm:a,onClose:o}){let s=(0,z.useRef)(null),c=(0,z.useRef)(null),l=(0,z.useRef)(null),u=(0,z.useId)(),d=i===`danger`;return(0,z.useEffect)(()=>{let t=s.current;t&&(e&&!t.open&&(typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``)),e&&(d?c:l).current?.focus(),!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e,d]),(0,q.jsxs)(`dialog`,{ref:s,className:`confirm`,"aria-labelledby":`${u}-title`,"aria-describedby":`${u}-body`,onCancel:o,onClose:o,children:[(0,q.jsx)(`h3`,{className:`confirm-title`,id:`${u}-title`,children:t}),(0,q.jsx)(`div`,{className:`confirm-body`,id:`${u}-body`,children:n}),(0,q.jsxs)(`div`,{className:`confirm-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:o,ref:c,children:`Cancel`}),(0,q.jsx)(`button`,{type:`button`,className:d?`btn danger`:`btn`,onClick:a,ref:l,children:r||`Confirm`})]})]})}var un=(0,z.createContext)(null),dn=()=>{throw Error(`useConfirm() needs a <ConfirmProvider> above it`)};function fn(){return(0,z.useContext)(un)||dn}function pn({children:e}){let[t,n]=(0,z.useState)(null),r=(0,z.useRef)(null),i=e=>{let t=r.current;r.current=null,n(null),t?.(e)},a=(0,z.useCallback)((e,t={})=>new Promise(i=>{r.current?.(!1),r.current=i,n({msg:e,...t})}),[]);return(0,q.jsxs)(un.Provider,{value:a,children:[e,(0,q.jsx)(ln,{open:!!t,title:t?.title||`Are you sure?`,confirmLabel:t?.confirmLabel,tone:t?.tone,onConfirm:()=>i(!0),onClose:()=>i(!1),children:t?.msg})]})}var mn=24;function hn(e,t){let n=e.title.toLowerCase();return n.startsWith(t)?0:n.includes(t)?1:e.hay.includes(t)?2:-1}function gn(e,t){let n=t.toLowerCase().trim();if(!e)return[];if(!n)return e.filter(e=>e.sortKey<0).sort((e,t)=>e.sortKey-t.sortKey);let r=[];for(let t of e){let e=hn(t,n);e>=0&&r.push({e:t,s:e})}r.sort((e,t)=>e.e.sortKey-t.e.sortKey||e.s-t.s||e.e.title.localeCompare(t.e.title));let i=r.map(e=>e.e),a=i.filter(e=>e.sortKey>=0).slice(0,mn);return i.filter(e=>e.sortKey<0).concat(a)}function _n(e,t){let n=t.trim().toLowerCase(),r=n?e.toLowerCase().indexOf(n):-1;return r<0?e:(0,q.jsxs)(q.Fragment,{children:[e.slice(0,r),(0,q.jsx)(`mark`,{className:`spot-hit`,children:e.slice(r,r+n.length)}),e.slice(r+n.length)]})}function vn({query:e,index:t,loading:n,error:r,active:i,onActive:a,onPick:o}){let s=(0,z.useMemo)(()=>gn(t,e),[t,e]),c=(0,z.useRef)(null),l=s.length>0;(0,z.useLayoutEffect)(()=>{let e=c.current?.querySelectorAll(`[data-spot-row]`);if(!l||!e?.length||!E())return;let t=T(e,{opacity:[0,1],translateY:[-4,0],duration:220,delay:oe(18),ease:`outQuart`});return O(t,220+18*e.length)},[l]),(0,z.useEffect)(()=>{i>=s.length&&a(0)},[s,i,a]),(0,z.useEffect)(()=>{(c.current?.querySelector(`[data-spot-row="${i}"]`))?.scrollIntoView({block:`nearest`})},[i]);let u=[],d=null;s.forEach((e,t)=>{(!d||d.kind!==e.kind)&&(d={kind:e.kind,rows:[]},u.push(d)),d.rows.push({entry:e,index:t})});let f=!!e.trim();return(0,q.jsxs)(`div`,{className:`spotlight`,ref:c,id:`spotlight-list`,role:`listbox`,"aria-label":`Search results`,children:[u.map(t=>(0,q.jsxs)(`div`,{className:`spot-group`,role:`group`,"aria-label":t.kind,children:[(0,q.jsx)(`div`,{className:`spot-group-head`,"aria-hidden":`true`,children:t.kind}),t.rows.map(({entry:t,index:n})=>(0,q.jsxs)(`div`,{id:`spot-opt-${n}`,"data-spot-row":n,role:`option`,"aria-selected":n===i,className:`spot-row ${n===i?`on`:``}`,onMouseDown:e=>{e.preventDefault(),o(t)},onMouseEnter:()=>a(n),children:[(0,q.jsx)(`div`,{className:`spot-title`,children:_n(t.title,e)}),t.desc?(0,q.jsx)(`div`,{className:`spot-desc`,children:t.desc}):null]},`${t.route||t.title}-${n}`))]},`${t.kind}-${t.rows[0].index}`)),f&&r&&(0,q.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`Could not load the search index — `,r]}),f&&n&&!r&&(0,q.jsx)(`div`,{className:`spot-empty`,role:`presentation`,children:`Loading…`}),f&&!n&&!r&&s.length===0&&(0,q.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`No matches for “`,e,`”.`]})]})}function yn({actions:e=[],dataRev:t}){let n=(0,z.useRef)(null),r=(0,z.useRef)(null),i=(0,z.useRef)(null),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(``),[l,u]=(0,z.useState)(0),{index:d,error:f,prime:p}=cn(t),m=fn(),h=()=>{o(!0),p()},g=()=>{let e=n.current;e?.open&&(typeof e.close==`function`?e.close():e.removeAttribute(`open`)),o(!1),c(``),u(0),i.current?.focus()};(0,z.useEffect)(()=>{let e=n.current;a&&e&&!e.open&&(typeof e.showModal==`function`?e.showModal():e.setAttribute(`open`,``),r.current?.focus())},[a]),(0,z.useEffect)(()=>{let e=e=>{((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`k`||e.key===`/`&&!e.target.closest(`input, textarea, select`))&&(e.preventDefault(),o(!0),p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]);let _=(0,z.useMemo)(()=>[...e.map(e=>({sortKey:-2,...e})),...sn,...d||[]],[e,d]),v=a?gn(_,s):[],y=l<v.length?`spot-opt-${l}`:void 0,b=async e=>{if(g(),!e.run)return ve(e.route);let t=e.confirm;(!t||await m(t.msg,{title:t.title,confirmLabel:t.confirmLabel,tone:t.tone}))&&e.run()};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`tb-cmdk`,ref:i,"aria-haspopup":`dialog`,onClick:h,title:`Press / to open, or Ctrl-K / ⌘K from inside any field`,children:[(0,q.jsx)(J,{name:`search`,className:`mag glyph`}),(0,q.jsx)(`span`,{className:`tb-cmdk-label`,children:`Search or run…`}),(0,q.jsx)(`kbd`,{className:`tb-cmdk-key`,children:`Ctrl K`})]}),(0,q.jsx)(`dialog`,{ref:n,className:`palette`,"aria-label":`Search or run`,onCancel:e=>{e.preventDefault(),g()},onClose:()=>a&&g(),onClick:e=>e.target===n.current&&g(),children:a&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`palette-head`,children:[(0,q.jsx)(J,{name:`search`,className:`mag glyph`}),(0,q.jsx)(`input`,{ref:r,role:`combobox`,"aria-label":`Search or run`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":`spotlight-list`,"aria-activedescendant":y,value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,Math.max(v.length-1,0)));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){let t=v[l];t&&(e.preventDefault(),b(t))}else e.key===`Escape`&&(e.preventDefault(),s?(c(``),u(0)):g())},placeholder:`Search or run…`}),(0,q.jsx)(`kbd`,{className:`palette-key`,children:`Esc`})]}),(0,q.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v.length?`${v.length} results`:`no matches`}),(0,q.jsx)(vn,{query:s,index:_,loading:!d,error:d?``:f,active:l,onActive:u,onPick:b}),(0,q.jsxs)(`div`,{className:`palette-foot`,children:[(0,q.jsx)(`span`,{children:`↑↓ move`}),(0,q.jsx)(`span`,{children:`↵ open`}),(0,q.jsx)(`span`,{children:`actions that write always ask first`})]})]})})]})}var bn=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function xn({open:e,onClose:t,anchorRef:n,label:r,className:i,children:a}){let o=(0,z.useRef)(null);return(0,z.useEffect)(()=>{if(!e)return;let r=o.current,i=n?.current;(r.querySelector(bn)||r).focus();let a=e=>{e.key===`Escape`&&t()},s=e=>{r.contains(e.target)||i?.contains(e.target)||t()};return document.addEventListener(`keydown`,a),document.addEventListener(`mousedown`,s),()=>{document.removeEventListener(`keydown`,a),document.removeEventListener(`mousedown`,s);let e=document.activeElement;(!e||e===document.body||r.contains(e))&&i?.focus()}},[e]),e?(0,q.jsx)(`div`,{ref:o,className:i?`popover ${i}`:`popover`,role:`dialog`,"aria-label":r,tabIndex:-1,children:a}):null}function Sn({children:e,...t}){let n=D(`button.on`);return(0,q.jsxs)(`div`,{className:`seg`,role:`group`,ref:n,...t,children:[(0,q.jsx)(`span`,{className:`glide`,"aria-hidden":`true`}),e]})}function Cn({value:e,onChange:t,labelledBy:n}){let r=lt(e);return(0,q.jsxs)(`div`,{className:`accent-picker`,role:`group`,"aria-labelledby":n,children:[at.map(n=>(0,q.jsx)(`button`,{type:`button`,className:`accent-src${e===n.id?` on`:``}`,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id)),(0,q.jsxs)(`div`,{className:`accent-swatches`,children:[ot.map(n=>(0,q.jsx)(`button`,{type:`button`,className:`accent-swatch${e===n.id?` on`:``}`,style:{"--sw":n.hex},"aria-pressed":e===n.id,"aria-label":`${n.short} accent`,title:n.short,onClick:()=>t(n.id)},n.id)),(0,q.jsx)(`label`,{className:`accent-swatch accent-custom${r?` on picked`:``}`,style:r?{"--sw":r}:void 0,title:r?`Your colour, ${r}`:`Pick any colour`,children:(0,q.jsx)(`input`,{type:`color`,"aria-label":`Custom accent colour`,value:(r||`#3AD4C4`).toLowerCase(),onChange:e=>t(`hex:${e.target.value.toUpperCase()}`)})})]})]})}function wn({flavour:e,onFlavour:t,accentMode:n,onAccentMode:r,layout:i,onLayout:a,onClose:o,anchorRef:s}){let c=(e,t,n,r,i)=>(0,q.jsxs)(`div`,{className:`ap-group`,children:[(0,q.jsx)(`span`,{className:`ap-label`,id:e,children:t}),(0,q.jsx)(Sn,{"aria-labelledby":e,children:n.map(e=>(0,q.jsx)(`button`,{type:`button`,className:r===e.id?`on`:``,"aria-pressed":r===e.id,title:e.tagline,onClick:()=>i(e.id),children:e.short},e.id))})]});return(0,ce.createPortal)((0,q.jsxs)(xn,{open:!0,onClose:o,anchorRef:s,label:`Appearance`,className:`appearance-pop`,children:[c(`ap-skin`,`Skin`,Je,e,t),(0,q.jsxs)(`div`,{className:`ap-group`,children:[(0,q.jsx)(`span`,{className:`ap-label`,id:`ap-accent`,children:`Accent`}),(0,q.jsx)(Cn,{value:n,onChange:r,labelledBy:`ap-accent`})]}),c(`ap-view`,`Overview view`,ht,i,a)]}),document.querySelector(`.app`)||document.body)}function Tn({route:e,navOpen:t,onToggleNav:n,actions:r,mode:i,onToggleMode:a,appearance:o,dataRev:s}){let[c,l]=(0,z.useState)(!1),u=(0,z.useRef)(null),d=e.tab&&ue[e.tab];return(0,q.jsxs)(`header`,{className:`topbar`,children:[(0,q.jsx)(`button`,{type:`button`,className:`tb-menu iconbtn`,onClick:n,"aria-label":t?`Close navigation`:`Open navigation`,"aria-expanded":!!t,"aria-controls":`rail-nav`,children:(0,q.jsx)(J,{name:t?`x`:`menu`})}),(0,q.jsx)(`nav`,{className:`crumbs`,"aria-label":`Breadcrumb`,children:(0,q.jsxs)(`ol`,{children:[(0,q.jsx)(`li`,{children:d?(0,q.jsx)(`a`,{href:e.page===`overview`?`#/`:`#/${e.page}`,children:B[e.page]}):(0,q.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:B[e.page]})}),d?(0,q.jsx)(`li`,{children:(0,q.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:d})}):null]})}),(0,q.jsx)(`div`,{className:`topbar-spacer`}),(0,q.jsx)(yn,{actions:r,dataRev:s}),(0,q.jsx)(`button`,{type:`button`,className:`iconbtn`,ref:u,"aria-label":`Appearance`,title:`Appearance`,"aria-expanded":c,onClick:()=>l(e=>!e),children:(0,q.jsx)(J,{name:`themes`})}),c?(0,q.jsx)(wn,{...o,anchorRef:u,onClose:()=>l(!1)}):null,(0,q.jsx)(`button`,{type:`button`,className:`iconbtn`,title:i===`light`?`Switch to dark`:`Switch to light`,"aria-label":i===`light`?`Switch to dark mode`:`Switch to light mode`,onClick:a,children:(0,q.jsx)(J,{name:i===`light`?`moon`:`sun`})})]})}function En({installs:e,value:t,onChange:n,label:r,className:i=``}){return!t||!e||e.length<2?null:(0,q.jsxs)(`label`,{className:`install-pick ${i}`.trim(),children:[(0,q.jsx)(`span`,{className:`dim`,children:r}),(0,q.jsx)(`select`,{className:`sel mono`,"aria-label":r,value:t.id,onChange:t=>n(e.find(e=>e.id===t.target.value)),children:e.map(e=>(0,q.jsx)(`option`,{value:e.id,children:kt(e)},e.id))})]})}function Dn({unreadable:e}){return e?(0,q.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:`Install list unreadable — showing the default install.`}):null}function On({themes:e,current:t,onPick:n,onClose:r,installs:i,install:a,onInstall:o,ready:s=!0}){let c=fn(),l=(0,z.useRef)(null);return(0,z.useEffect)(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,z.useEffect)(()=>{l.current?.querySelector(`button.pop-item`)?.focus()},[]),(0,q.jsxs)(`div`,{className:`pop`,ref:l,role:`dialog`,"aria-label":`Switch voice`,children:[(0,q.jsx)(`div`,{className:`tick`,style:{padding:`4px 10px 8px`},children:`Switch voice`}),(0,q.jsx)(En,{installs:i,value:a,onChange:o,label:`Rebuild:`}),e.map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":e.name===t,disabled:!s,className:`pop-item ${e.name===t?`on`:``}`,onClick:async()=>{r(),await c(`Rebuild ${a?kt(a):`the deployed harness`} in the “${e.name}” voice? It rebuilds in place, non-destructive.`,{title:`Switch voice?`,confirmLabel:`Rebuild`})&&n(e.name)},children:(0,q.jsx)(`span`,{className:`pn`,children:e.name})},e.name))]})}var kn=3500;function An({toast:e,onClose:t}){let[n,r]=(0,z.useState)(null),i=!!e&&e.kind!==`err`&&n!==e;(0,z.useEffect)(()=>{if(!i)return;let e=setTimeout(t,kn);return()=>clearTimeout(e)},[e,i]);let a=()=>r(e),o=()=>r(null);return(0,q.jsx)(`div`,{className:`toast-region`,"aria-live":e?.kind===`err`?void 0:`polite`,children:e&&(0,q.jsxs)(`div`,{className:`toast ${e.kind}`,role:e.kind===`err`?`alert`:void 0,onMouseEnter:a,onMouseLeave:e=>{e.currentTarget.contains(document.activeElement)||o()},onFocus:a,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||o()},children:[(0,q.jsx)(`div`,{children:e.msg}),(0,q.jsx)(`div`,{style:{marginTop:8},children:(0,q.jsx)(`button`,{className:`btn ghost`,onClick:t,children:`Dismiss`})})]})})}function jn({runs:e,open:t,onToggle:n,onClear:r,onCancel:i,busy:a,finish:o}){let s=(0,z.useRef)(null),c=(0,z.useRef)(null);(0,z.useEffect)(()=>{let e=c.current;o&&e&&(e.classList.remove(`flash-ok`,`flash-bad`),e.offsetWidth,e.classList.add(o.status===`done`?`flash-ok`:`flash-bad`))},[o]);let l=e.length?e[e.length-1].output.length:0;return(0,z.useEffect)(()=>{let e=s.current;e&&t&&(e.scrollTop=e.scrollHeight)},[e.length,l,t]),(0,q.jsxs)(`div`,{className:`console`,style:{height:`42vh`,transform:t?`none`:`translateY(calc(42vh - 42px))`},children:[(0,q.jsxs)(`div`,{className:`console-head`,ref:c,onClick:n,onAnimationEnd:e=>{e.target===e.currentTarget&&e.currentTarget.classList.remove(`flash-ok`,`flash-bad`)},children:[a&&(0,q.jsx)(`span`,{className:`console-progress`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`ttl`,children:[(0,q.jsx)(`span`,{className:`live ${a?`on`:``}`}),`terminal`]}),(0,q.jsx)(`span`,{className:`count`,children:e.length}),(0,q.jsxs)(`div`,{className:`right`,onClick:e=>e.stopPropagation(),children:[(0,q.jsx)(`button`,{className:`iconbtn`,title:`Clear`,"aria-label":`Clear run history`,onClick:r,disabled:!e.length,children:(0,q.jsx)(J,{name:`clear`})}),(0,q.jsx)(`button`,{className:`iconbtn`,title:t?`Collapse`:`Expand`,"aria-label":t?`Collapse console`:`Expand console`,"aria-expanded":t,onClick:n,children:(0,q.jsx)(J,{name:`chevron`,className:`glyph`,style:{transform:t?`rotate(90deg)`:`rotate(-90deg)`}})})]})]}),t&&(0,q.jsxs)(`div`,{className:`console-body`,ref:s,children:[e.length===0&&(0,q.jsx)(`div`,{className:`console-empty`,children:`No commands run yet. Actions you trigger stream here.`}),e.map(e=>(0,q.jsxs)(`div`,{className:`run`,children:[(0,q.jsxs)(`div`,{className:`run-head`,children:[(0,q.jsx)(`span`,{className:`pr`,children:`$`}),(0,q.jsx)(`span`,{className:`act`,children:e.action}),(0,q.jsx)(`span`,{className:`st ${e.status}`,children:e.status===`running`?`…running`:`${e.status===`done`?`✓ done`:`✗ failed`}${e.duration?` · ${e.duration}s`:``}`}),e.status===`running`&&i&&(0,q.jsx)(`button`,{className:`iconbtn run-cancel`,title:`Cancel this run`,"aria-label":`Cancel the ${e.action} run`,onClick:()=>i(e.id),children:(0,q.jsx)(J,{name:`x`})})]}),e.output&&(0,q.jsx)(`pre`,{className:`run-out`,children:e.output})]},e.id))]})]})}var Mn=550,Nn=`gs-splash-seen`,Pn=8e3;function Fn(){try{if(window.localStorage.getItem(Nn))return 0;window.localStorage.setItem(Nn,`1`)}catch{}return Mn}function In({ready:e,onDone:t}){let[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(!1);(0,z.useEffect)(()=>{let e=setTimeout(()=>r(!0),Fn());return()=>clearTimeout(e)},[]);let[o,s]=(0,z.useState)(!1);(0,z.useEffect)(()=>{if(e)return;let t=setTimeout(()=>s(!0),Pn);return()=>clearTimeout(t)},[e]),e&&n&&!i&&a(!0),(0,z.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>t?.(),700);return()=>clearTimeout(e)},[i]);let c=o&&!i;return(0,q.jsxs)(`div`,{className:`boot-splash${i?` fading`:``}`,"aria-hidden":c?void 0:`true`,onAnimationEnd:e=>{e.animationName===`splashOut`&&t?.()},children:[(0,q.jsxs)(`div`,{className:`boot-dial`,"aria-hidden":`true`,children:[(0,q.jsxs)(`svg`,{className:`boot-ring`,viewBox:`0 0 172 172`,children:[(0,q.jsx)(`circle`,{cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--surface-3)`,strokeWidth:`9`}),(0,q.jsx)(`circle`,{cx:`86`,cy:`86`,r:`50`,fill:`none`,stroke:`var(--line-2)`,strokeWidth:`8`,strokeDasharray:`1.2 5.3`,opacity:`.7`}),(0,q.jsx)(`circle`,{className:`boot-progress`,cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`9`,strokeLinecap:`round`})]}),(0,q.jsxs)(`svg`,{className:`boot-sprout`,viewBox:`0 0 24 24`,children:[(0,q.jsx)(`path`,{className:`bs-stem`,d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,q.jsx)(`path`,{className:`bs-leaf bs-leaf-main`,d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,q.jsx)(`path`,{className:`bs-leaf bs-leaf-back`,d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,q.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})]}),c?(0,q.jsxs)(`div`,{className:`boot-status`,role:`alert`,children:[(0,q.jsx)(`span`,{children:`The server is not answering.`}),` `,(0,q.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>window.location.reload(),children:`Retry`})]}):(0,q.jsxs)(`div`,{className:`boot-status`,children:[(0,q.jsx)(`span`,{children:`germinating harness`}),(0,q.jsx)(`span`,{className:`boot-caret`})]})]})}function Ln({label:e=`Loading…`}){return(0,q.jsxs)(`div`,{className:`loading`,role:`status`,children:[e,(0,q.jsxs)(`div`,{className:`skel`,"aria-hidden":`true`,children:[(0,q.jsx)(`div`,{className:`skel-bar`}),(0,q.jsx)(`div`,{className:`skel-bar`}),(0,q.jsx)(`div`,{className:`skel-bar`})]})]})}function Rn({error:e,style:t,onRetry:n,role:r=`alert`}){return e?n?(0,q.jsxs)(`div`,{className:`error-state`,role:r,style:t,children:[(0,q.jsx)(`p`,{className:`badge bad`,children:e}),(0,q.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:n,children:`Retry`})]}):(0,q.jsx)(`p`,{className:`badge bad`,role:r,style:t,children:e}):null}function zn(){let[e,t]=(0,z.useState)(!1),[n,r]=(0,z.useState)(null);return(0,q.jsxs)(`div`,{className:`stale-banner`,role:`alert`,children:[(0,q.jsx)(`span`,{children:n||`This console is running code from before your last upgrade.`}),(0,q.jsx)(`button`,{className:`btn sm`,onClick:async()=>{t(!0),r(null);try{await rt()}catch(e){r(e.message),t(!1)}},disabled:e,children:e?`Restarting…`:`Restart`})]})}var Bn=/dynamically imported module|Importing a module script failed|Unable to preload CSS/i,Vn=e=>Bn.test(e?.message||``),Hn=class extends z.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=Vn(e);return(0,q.jsxs)(`div`,{role:t?void 0:`alert`,children:[(0,q.jsx)(Rn,{error:e.message||String(e),role:null}),t?(0,q.jsx)(zn,{}):(0,q.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>this.setState({error:null}),children:`Retry`})]})}},Un=(0,z.createContext)(null),Wn=e=>[...e].sort().join(`,`),Gn=e=>[...e.values()].some(e=>!e.applied&&Wn(e.value)!==e.base);function Kn(e,t){let[n,r]=(0,z.useState)(()=>({kits:new Map,rules:new Map})),[i,a]=(0,z.useState)(null),[o,s]=(0,z.useState)(t);if(o!==t&&(s(t),i&&t)){let e=t.status===`done`?{applied:!0}:{failed:!0};r(t=>{let n=t[i.kind].get(i.key);return n?{...t,[i.kind]:new Map(t[i.kind]).set(i.key,{...n,...e})}:t}),a(null)}let c=Gn(n.kits)||Gn(n.rules);return(0,z.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[c]),{get:(e,t)=>n[e].get(t),put:(e,t,n,i)=>r(r=>{let a=new Map(r[e]);return Wn(n)===i?a.delete(t):a.set(t,{value:n,base:i}),{...r,[e]:a}}),drop:(e,t)=>r(n=>{let r=new Map(n[e]);return r.delete(t),{...n,[e]:r}}),prune:(0,z.useCallback)((e,t)=>r(n=>{let r=[...n[e]].filter(([e,n])=>t(e,n)).map(([e])=>e);if(!r.length)return n;let i=new Map(n[e]);return r.forEach(e=>i.delete(e)),{...n,[e]:i}}),[]),startApply:(e,t)=>{a({kind:e,key:t}),r(n=>{let r=n[e].get(t);return r?.failed?{...n,[e]:new Map(n[e]).set(t,{value:r.value,base:r.base})}:n})},running:(t,n)=>!!e&&i?.kind===t&&i?.key===n,busy:!!e}}function qn({activeId:e,finish:t,children:n}){let r=Kn(e,t);return(0,q.jsx)(Un.Provider,{value:r,children:n})}function Jn(){let e=Kn(null,null);return(0,z.useContext)(Un)||e}function Yn({eyebrow:e,title:t,sub:n,primary:r,actions:i,crumbs:a}){return(0,q.jsxs)(`div`,{className:`page-head`,children:[(0,q.jsxs)(`div`,{children:[a?.length?(0,q.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`page-crumbs`,children:(0,q.jsx)(`ol`,{children:a.map((e,t)=>(0,q.jsx)(`li`,{children:t===a.length-1?(0,q.jsx)(`span`,{"aria-current":`page`,children:e.label}):e.href?(0,q.jsx)(`a`,{href:e.href,children:e.label}):e.label},t))})}):null,e?(0,q.jsx)(`div`,{className:`eyebrow`,children:e}):null,(0,q.jsx)(`h1`,{className:`h`,children:t}),n?(0,q.jsx)(`p`,{className:`sub`,children:n}):null]}),r||i?(0,q.jsxs)(`div`,{className:`page-actions`,children:[i,r]}):null]})}var Xn=e=>!!e&&!e.endsWith(`-global`);function Zn({onAction:e}){let{data:t,error:n}=W(()=>a.themes(),[]),[r,i]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,l]=(0,z.useState)(``),[u,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1);if(n)return(0,q.jsx)(Rn,{error:n});if(!t)return(0,q.jsx)(Ln,{});let m=r||t.current?.theme||`neutral`,h=(t.emits||[]).filter(e=>e.name!==`files`),g=t.emits?.some(e=>e.name===`opencode-global`),_=o||(g?`opencode-global`:t.current?.emit||h[0]?.name||``),v=i,y=s,b=Xn(_);return(0,q.jsxs)(`div`,{className:`narrow-lg`,children:[(0,q.jsx)(`div`,{className:`head-row mb-18`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`h`,children:`Deploy your harness`}),(0,q.jsx)(`p`,{className:`sub`,children:`Geneseed isn't implanted on this machine yet. Pick a voice and an install mode, then deploy. The graft runs in the console below, and this dashboard lights up when it lands.`})]})}),(0,q.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,q.jsx)(`div`,{className:`card-head`,children:(0,q.jsx)(`h3`,{children:`1 · Choose a voice`})}),(0,q.jsx)(`div`,{className:`row wrap gap-10`,children:t.themes.map(e=>(0,q.jsx)(`button`,{className:`btn ${e.name===m?`soft`:`ghost`}`,onClick:()=>v(e.name),title:e.blurb||e.tagline||e.name,children:(0,q.jsx)(`span`,{style:{textTransform:`capitalize`},children:e.name})},e.name))})]}),(0,q.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,q.jsx)(`div`,{className:`card-head`,children:(0,q.jsx)(`h3`,{children:`2 · Install mode`})}),(0,q.jsxs)(`p`,{className:`sub mb-16`,children:[`A `,(0,q.jsx)(`code`,{children:`-global`}),` mode deploys once to that tool's global config, so every repo on this machine inherits the harness (recommended). A project mode installs into the repository folder you choose.`]}),(0,q.jsxs)(`label`,{className:`stack`,style:{gap:6,maxWidth:360},children:[(0,q.jsx)(`span`,{className:`tick`,children:`Mode`}),(0,q.jsx)(`select`,{className:`sel`,value:_,onChange:e=>y(e.target.value),children:h.map(e=>(0,q.jsxs)(`option`,{value:e.name,children:[e.name,e.desc?` · ${e.desc}`:``]},e.name))})]}),b&&(0,q.jsxs)(`div`,{className:`row gap-10`,style:{maxWidth:560,marginTop:12},children:[(0,q.jsx)(`input`,{className:`inp`,style:{flex:1},type:`text`,placeholder:`/path/to/project, or click Browse…`,value:c,onChange:e=>l(e.target.value),"aria-label":`Project folder to install into`}),(0,q.jsx)(`button`,{className:`btn ghost sm`,disabled:f,onClick:async()=>{p(!0),d(``);try{let e=await a.pickFolder();e.path?l(e.path):e.error&&d(e.error)}catch(e){d(e.message)}finally{p(!1)}},children:f?`Choosing…`:`Browse…`})]}),u&&(0,q.jsx)(`p`,{className:`sub`,style:{marginTop:12},children:u})]}),(0,q.jsxs)(`button`,{className:`btn btn-grid`,disabled:!m||!_||b&&!c.trim(),onClick:()=>{if(!b)return e(`build`,{theme:m,emit:_});let t=c.trim();return t?(d(``),e(`deploy`,{host:_,path:t,theme:m})):d(`Choose or type the project folder to install into.`)},children:[(0,q.jsx)(J,{name:`build`}),`Deploy harness`]})]})}var Qn=(e,t)=>W(()=>a.rules(t).catch(()=>null),t?[e,t.host,t.path]:[e],`rules`,{revalidate:!0}),$n=()=>Ct(`rules`);function er({segments:e,value:t,max:n,size:r=120,stroke:i=12,label:a,sweepMs:o=650}){let s=n>0?n:0,c=e||[{key:`v`,label:a,n:Math.min(Math.max(t||0,0),s),tone:`accent`}],l=e?c.reduce((e,t)=>e+t.n,0):s,u=e?c.map(e=>`${e.label}: ${e.n} of ${l}`).join(`, `):`${c[0].n} of ${l}`,d=r/2-i/2,f=r/2,p=e=>[f+d*Math.cos(e),f+d*Math.sin(e)],m=[],h=0;for(let e of c)m.push(h),h+=e.n;let g=(0,z.useRef)(null),_=c.map(e=>e.n).join(`,`);return(0,z.useLayoutEffect)(()=>{let e=g.current?.querySelectorAll(`path.ring-arc`);if(!o||!e?.length||!E())return;let t=c.map(e=>e.n/l).filter(e=>e>0),n=t.map((e,n)=>t.slice(0,n).reduce((e,t)=>e+t,0)),r=R(e);k(r,{draw:`0 0`});let i=T(r,{draw:[`0 0`,`0 1`],duration:(e,n)=>Math.max(o*t[n],60),delay:(e,t)=>o*n[t],ease:`linear`});return O(i,o)},[_,o]),(0,q.jsxs)(`svg`,{className:`ring`,width:r,height:r,viewBox:`0 0 ${r} ${r}`,role:`img`,"aria-label":a?`${a}: ${u}`:u,children:[(0,q.jsx)(`circle`,{className:`ring-track`,cx:f,cy:f,r:d,fill:`none`,strokeWidth:i}),(0,q.jsx)(`g`,{ref:g,children:l>0?c.map((e,t)=>{let n=e.n/l;if(!(n>0))return null;let r=m[t]/l*2*Math.PI-Math.PI/2,a=r+n*2*Math.PI,[o,s]=p(r),[c,u]=p(a),h=n>=.9999?`M ${o} ${s} A ${d} ${d} 0 1 1 ${2*f-o} ${2*f-s} A ${d} ${d} 0 1 1 ${o} ${s}`:`M ${o} ${s} A ${d} ${d} 0 ${+(n>.5)} 1 ${c} ${u}`;return(0,q.jsx)(`path`,{className:`ring-arc tone-${e.tone||`muted`}`,d:h,fill:`none`,strokeWidth:i,children:(0,q.jsxs)(`title`,{children:[e.label,`: `,e.n]})},e.key)}):null})]})}var tr=500;function nr({parts:e,total:t,label:n,legend:r=!0}){let i=e.reduce((e,t)=>e+t.n,0),a=t??i,o=e=>a>0?`${e/a*100}%`:`0%`,s=e.map(e=>`${e.label}: ${e.n} of ${a}`).join(`, `),c=(0,z.useRef)(null),l=e.map(e=>e.n).join(`,`)+`/${a}`;return(0,z.useLayoutEffect)(()=>{if(c.current&&E())return k(c.current,{scaleX:0}),O(T(c.current,{scaleX:[0,1],duration:tr,ease:`outExpo`}),tr)},[l]),(0,q.jsxs)(`div`,{className:`stackbar-box`,children:[(0,q.jsx)(`div`,{className:`stackbar sweep`,role:`img`,"aria-label":n?`${n}: ${s}`:s,ref:c,children:e.map(e=>e.n>0?(0,q.jsx)(`span`,{className:`tone-${e.tone||`muted`}`,style:{width:o(e.n)},title:`${e.label}: ${e.n}`},e.key):null)}),r&&(0,q.jsx)(`ul`,{className:`stackbar-legend`,"aria-hidden":`true`,children:e.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`i`,{className:`tone-${e.tone||`muted`}`}),e.label,` `,(0,q.jsx)(`span`,{className:`mono`,children:e.n})]},e.key))})]})}function rr({value:e,max:t,label:n=`value`,tone:r=`accent`}){let i=t>0?t:0;return(0,q.jsx)(nr,{parts:[{key:`v`,label:n,n:Math.min(Math.max(e||0,0),i),tone:r}],total:i,legend:!1})}var ir=864e5;function ar(e,t=10,n=`today`){let r=Array(t).fill(0).map((e,r)=>({t:r===t-1?n:`${t-1-r}d`,v:0})),i=e=>new Date(e).setHours(0,0,0,0),a=i(Date.now());for(let n of e){let e=n.started||n.finished||n.created||n.ts;if(!e)continue;let o=typeof e==`string`?Date.parse(e):e*1e3;if(!Number.isFinite(o))continue;let s=Math.round((a-i(o))/ir);s<0||s>=t||(r[t-1-s].v+=1)}return r}var or=(e,t)=>[...e||[]].sort((e,t)=>(t.started||0)-(e.started||0)).slice(0,t),sr=[`--emit`,`--theme`,`--scope`],cr={done:`✓`,failed:`✗`};function lr(e){let t=(e.output||``).split(`
3
+ `).find(e=>e.startsWith(`$ `))||``,n=t.split(/\s+/),r=[];return n.forEach((e,t)=>{let[i,a]=e.split(`=`),o=a||n[t+1];sr.includes(i)&&o&&!o.startsWith(`--`)&&r.push(o)}),{verb:(e.action||`run`).split(/[\s(]/)[0],scope:r.join(` · `),result:cr[e.status]||`…`,duration:e.duration?`${e.duration}s`:`—`,command:t}}var ur={busy:{cls:`acc`,label:`working`,accent:`var(--accent)`},"waiting-input":{cls:`warn`,label:`your move`,accent:`var(--warn)`},blocked:{cls:`bad`,label:`blocked`,accent:`var(--bad)`},idle:{cls:``,label:`idle`,accent:`var(--line)`}},dr={cls:``,label:`ended`};function fr(e){if(!e)return``;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||e}var pr=e=>e?e<1e3?String(e):e<1e5?(e/1e3).toFixed(1)+`k`:e<1e6?(e/1e3).toFixed(0)+`k`:(e/1e6).toFixed(1)+`M`:`0`;function mr(e){if(e=Math.max(0,Math.floor(e)),e<60)return`${e}s`;let t=Math.floor(e/60);return t<60?`${t}m ${e%60}s`:`${Math.floor(t/60)}h ${t%60}m`}function hr({startedAt:e}){let[t,n]=(0,z.useState)(()=>Date.now()/1e3);return(0,z.useEffect)(()=>{let e=setInterval(()=>n(Date.now()/1e3),1e3);return()=>clearInterval(e)},[]),mr(t-e)}function gr({done:e,total:t}){let n=Math.min(t,10),r=Math.min(n,Math.round(e/t*n));return(0,q.jsxs)(`span`,{className:`act-todo`,children:[(0,q.jsx)(`span`,{className:`on`,children:`●`.repeat(r)}),(0,q.jsx)(`span`,{className:`dim`,children:`○`.repeat(n-r)})]})}var _r=e=>e.ended?null:e.turn_started_at,vr=e=>!!(e.tokens>0||e.cost>0||_r(e)||e.files?.count>0);function yr({s:e,heading:t,id:n,children:r}){let i=e.ended?dr:ur[e.status]||ur.idle,a=e.files,o=vr(e),s=e=>n?`${n}-${e}`:void 0;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`row between wrap gap-12`,children:[t?(0,q.jsxs)(`div`,{className:`row gap-10 act-min`,children:[(0,q.jsx)(`span`,{className:`feed-dot act-dot ${e.ended?``:i.cls||`acc`}`}),(0,q.jsxs)(`div`,{className:`act-min`,children:[(0,q.jsx)(`h2`,{className:`act-title`,id:s(`t`),children:t}),e.cwd&&(0,q.jsx)(`div`,{className:`dim mono act-cwd`,title:e.cwd,children:e.cwd})]})]}):null,(0,q.jsxs)(`div`,{className:`row gap-8 act-fixed`,children:[e.model&&(0,q.jsx)(`span`,{className:`badge mono`,title:`model`,children:e.model}),e.agent&&(0,q.jsx)(`span`,{className:`badge`,children:e.agent}),(0,q.jsxs)(`span`,{className:`badge ${i.cls}`,id:s(`st`),children:[(0,q.jsx)(`span`,{className:`dot`}),i.label]}),r]})]}),e.phase&&(0,q.jsxs)(`div`,{className:`row gap-8 act-phase`,children:[(0,q.jsx)(J,{name:`activity`}),(0,q.jsx)(`span`,{className:`act-ell`,children:e.phase})]}),o&&(0,q.jsxs)(`div`,{className:`row wrap act-counters`,id:s(`c`),children:[e.tokens>0&&(0,q.jsxs)(`span`,{children:[pr(e.tokens),` tok`]}),e.cost>0&&(0,q.jsxs)(`span`,{children:[`$`,e.cost.toFixed(2)]}),_r(e)?(0,q.jsx)(`span`,{children:(0,q.jsx)(hr,{startedAt:e.turn_started_at})}):null,a&&a.count>0&&(0,q.jsxs)(`span`,{children:[a.count,` file`,a.count===1?``:`s`,` `,(0,q.jsxs)(`span`,{className:`t-good`,children:[`+`,a.additions]}),` `,(0,q.jsxs)(`span`,{className:`t-bad`,children:[`−`,a.deletions]})]})]}),(e.error||e.blocked_on)&&(0,q.jsx)(`div`,{className:`act-err-row`,children:(0,q.jsx)(`span`,{className:`badge bad act-ell`,title:e.error||e.blocked_on,children:e.error||e.blocked_on})})]})}var br=e=>e?.status===`blocked`||e?.status===`waiting-input`,xr=864e5,Sr=e=>new Date(e).toISOString().slice(0,10),Cr=(e,t)=>new Date(`${e}T00:00:00Z`).toLocaleDateString(`en-GB`,{...t,timeZone:`UTC`}),wr=e=>Cr(e,{day:`numeric`,month:`short`});function Tr(e,t=Date.now()){let n=Cr(e,{weekday:`long`,day:`numeric`,month:`long`}),r=e===Sr(t)?`Today`:e===Sr(t-xr)?`Yesterday`:``;return r?`${r} · ${n}`:n}function Er(e,{now:t=Date.now(),days:n=14,cap:r}={}){let i=(e||[]).filter(e=>Number.isFinite(e.started)),a={};for(let e of i){let t=Sr(e.started*1e3);a[t]=(a[t]||0)+1}let o=i.length?Sr(Math.min(...i.map(e=>e.started))*1e3):null,s=i.filter(e=>e.status!==`running`).length,c=typeof r!=`number`||s>=r;return Array.from({length:n},(e,r)=>{let i=Sr(t-(n-1-r)*xr);return{key:i,n:a[i]||0,nodata:c&&(o===null||i<o)}})}var Dr=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Or(e,t,n,r=Date.now()){let i={},a=e=>i[e]||={key:e,runs:[],asks:[]};for(let t of or(e,(e||[]).length))Number.isFinite(t.started)&&a(Sr(t.started*1e3)).runs.push(t);return(n||[]).forEach((e,n)=>{for(let r of t||[])r.per_day?.[n]>0&&a(e).asks.push([r.name,r.per_day[n]])}),Object.values(i).sort((e,t)=>e.key<t.key?1:-1).map(({key:e,runs:t,asks:n})=>{n.sort((e,t)=>t[1]-e[1]);let i=n.reduce((e,t)=>e+t[1],0),a=n.map(([e,t],n)=>`${e}${n?``:` asked`} ${t}×`).join(`, `),o=[t.length&&Dr(t.length,`run`),i&&Dr(i,`gate ask`)];return{key:e,title:Tr(e,r),sum:o.filter(Boolean).join(` · `),runs:t,gate:i?{title:a,n:i}:null}})}var kr=500;function Ar({vals:e,i:t,sweep:n=!1}){let r=(0,z.useRef)(null),i=e.join(`,`);(0,z.useLayoutEffect)(()=>{if(n&&r.current&&E())return k(r.current,{strokeDasharray:1,strokeDashoffset:1}),O(T(r.current,{strokeDashoffset:[1,0],duration:kr,ease:`outExpo`}),kr)},[i,n]);let a=Math.max(1,...e),o=96/(e.length-1),s=e.map((e,t)=>`${(t*o).toFixed(1)},${(20-e/a*17).toFixed(1)}`),[c,l]=s[s.length-1].split(`,`);return(0,q.jsxs)(`svg`,{className:`spark`,viewBox:`0 0 96 22`,"aria-hidden":`true`,style:{"--i":t},children:[(0,q.jsx)(`polyline`,{points:`0,21 96,21`,className:`spk-base`}),(0,q.jsx)(`polygon`,{className:`spk-area`,points:`0,21 ${s.join(` `)} 96,21`}),(0,q.jsx)(`polyline`,{className:`spk-line`,pathLength:`1`,points:s.join(` `),ref:r}),(0,q.jsx)(`circle`,{className:`spk-end`,cx:c,cy:l,r:`2.4`})]})}function jr(e,t){let n=(0,z.useRef)(null);return(0,z.useLayoutEffect)(()=>{let e=n.current?[...n.current.querySelectorAll(`[data-sweep]`)]:[];if(e.length&&E())return k(e,{[t]:0}),O(T(e,{[t]:[0,1],duration:kr,ease:`outExpo`}),kr)},[e,t]),n}var Y={security:`oklch(0.74 0.085 45)`,verify:`oklch(0.78 0.075 200)`,process:`oklch(0.76 0.075 150)`,craft:`oklch(0.78 0.085 95)`,context:`oklch(0.74 0.08 280)`,comms:`oklch(0.76 0.085 345)`},Mr={security:{label:`Security`,c:Y.security},verify:{label:`Verification`,c:Y.verify},process:{label:`Process`,c:Y.process},craft:{label:`Craft`,c:Y.craft},context:{label:`Context`,c:Y.context},comms:{label:`Communication`,c:Y.comms}},Nr={craft:Y.craft,rigor:Y.verify,ops:Y.process,process:Y.security,comms:Y.comms},Pr=e=>Nr[e]||`var(--text-3)`,Fr={design:{label:`Design`,c:Y.context},build:{label:`Build`,c:Y.craft},review:{label:`Review`,c:Y.security},ship:{label:`Ship`,c:Y.process},understand:{label:`Understand`,c:Y.verify},learn:{label:`Learn`,c:Y.comms},harness:{label:`Harness`,c:`oklch(0.76 0.07 250)`},personal:{label:`Personal`,c:`oklch(0.72 0.025 250)`}},Ir=Object.keys(Fr);function Lr(e){let t=String(e||``),n=/\(retired\)\s*$/i.test(t);t=t.replace(/\s*\(retired\)\s*$/i,``),t=t.replace(/^(?:Rule\s+[IVXLCDM\d]+|Doctrine\s+[a-z]+\s+\d+)\s*[—-]\s*/i,``);let r=t.indexOf(` · `);return r===-1?{latin:``,name:t.trim(),retired:n}:{latin:t.slice(0,r).trim(),name:t.slice(r+3).trim(),retired:n}}var Rr=[[10,`X`],[9,`IX`],[5,`V`],[4,`IV`],[1,`I`]],zr=e=>{let t=``;for(let[n,r]of Rr)for(;e>=n;)t+=r,e-=n;return t};function Br(e){let t=/^([a-z]+)-(\d+)$/.exec(String(e));return t?t[1]===`law`?zr(Number(t[2])):`${t[1]}.${t[2]}`:String(e)}var Vr=new Set([`I`,`III`,`IV`,`process.1`,`process.5`,`rigor.5`,`ops.2`]),Hr={I:{key:`secretsGate`,label:`Secrets gate`},III:{key:`doneGate`,label:`Done gate`},IV:{key:`deletionGate`,label:`Deletion gate`}},Ur={I:{arm:`Writes that would carry a credential-shaped string are refused again.`,off:`A write carrying a credential-shaped string (on OpenCode, also a write to a key file) stops being refused. Rule I’s text still binds the agent; protected checks, real data loss and commit/push consent stay gated.`},III:{arm:`A turn that edited files cannot end before the project’s declared checks pass.`,off:`A turn that edited files may end without the checks in .geneseed/done-checks.txt passing. Rule III’s text still binds the agent; every other gate stays.`},IV:{arm:`Commands that would lose data nothing else holds ask again.`,off:`Commands that would really lose data — discarding uncommitted work, deleting an unpushed branch, removing untracked files — stop asking. Rule IV’s text still binds the agent; secrets, root-wide scans and commit/push consent stay gated.`}},Wr=[{key:`invariants`,source:`{{LAWS}}`,against:`—`},{key:`yours`,source:`user-rules.md`,against:`may tighten a {{LAW}}, never repeal one`},{key:`ethos`,source:`{{ONTOLOGY}}`,against:`never against a user rule`},{key:`doctrines`,source:`{{DOCTRINES}}`,against:`may tighten, never repeal`}],Gr=[{source:`mode`,label:`Mode`,against:`binds how work runs`},{source:`PROFILE.md, posture, theme`,label:`Profile, posture, theme`,against:`inform only; never bind`}],Kr=(e,t={})=>Hr[e]&&t?.[Hr[e].key]===!1?`Gate off`:Vr.has(e)?`Hook gate`:`Instruction`;function qr(e){let t={};for(let n of e||[]){let e=Fr[n.klass]?n.klass:`personal`,r=t[e]||(t[e]={key:e,label:Fr[e].label,ok:0,exp:0});n.status===`experimental`?r.exp+=1:r.ok+=1}let n=Ir.filter(e=>t[e]).map(e=>({...t[e],n:t[e].ok+t[e].exp}));return{rows:n,total:n.reduce((e,t)=>e+t.n,0),experimental:n.reduce((e,t)=>e+t.exp,0),max:Math.max(1,...n.map(e=>e.n))}}var X=(e,t,n=t+`s`)=>`${e} ${e===1?t:n}`;function Jr({overview:e,setup:t,rules:n,activity:r,profile:i,skills:a,laws:o}){let s=[],c=e?.doctor;c&&!c.ok&&s.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${X(c.problems.length,`problem`)}`,detail:c.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});let l=e?.diff,u=K(l);u&&s.push({id:`drift`,tag:`Drift`,tone:`warn`,title:`${X(u,`file`)} drifted from the source`,detail:`${l.edited} edited, ${l.added} added, ${l.missing} missing`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`}),i?.seeded&&s.push({id:`profile`,tag:`Profile`,tone:`warn`,title:`Profile is still the seeded template`,detail:`every section holds placeholder text`,where:`personal/profile`,verb:`Fill in`,href:`#/personal/profile`});let d=n?.exists?n.stats:null;d&&d.rules===0&&s.push({id:`rules`,tag:`Rules`,tone:``,title:`No standing rules yet`,detail:`0 of ${d.max_rules} · ${d.tokens} of ${d.max_tokens} tokens`,where:`personal/rules`,verb:`Write a rule`,href:`#/personal/rules`});let f=Object.entries(t?.gates?.asks||{}).sort((e,t)=>t[1]-e[1]);if(f.length){let[e,n]=f[0],r=Br(e),i=(o?.items||[]).find(e=>e.name===r),a=i?Lr(i.title).name:r;s.push({id:`gates`,tag:`Gates`,tone:``,title:`${a} asked ${X(n,`time`)}`,detail:`${n} of ${t.gates.total} gate asks`,where:r,verb:`Review`,href:`#/item/law/${encodeURIComponent(r)}`})}if(a){let{rows:e,experimental:t}=qr(a.items);t&&s.push({id:`skills`,tag:`Skills`,tone:``,title:`${X(t,`skill`)} still experimental`,detail:e.filter(e=>e.exp).sort((e,t)=>t.exp-e.exp).map(e=>`${e.label.toLowerCase()} ${e.exp}`).join(`, `),where:`library/skills`,verb:`Triage`,href:`#/skills`})}return t&&t.facts===0&&s.push({id:`memory`,tag:`Memory`,tone:``,title:`Memory holds no facts`,detail:`MEMORY.md is an empty index`,where:`library/memory`,verb:`Open`,href:`#/section/memory`}),r&&r.enabled===!1&&s.push({id:`activity`,tag:`Activity`,tone:``,title:`Session tracking is off`,detail:`no per-session trace is kept`,where:`activity`,verb:`Turn on`,href:`#/activity`}),s}var Yr=e=>K(e.drift),Xr=e=>e.drift?.stale??0;function Zr(e){let t=t=>new Set((e?.never||[]).filter(e=>e.kind===t).map(e=>e.name)).size;return{skills:t(`skill`),agents:t(`agent`)}}function Qr(e){let t=e?.installs||[],n=t.filter(e=>e.state===`active`),r=t.length-n.length,i=n.filter(e=>e.verdict===`behind`).length,a=n.reduce((e,t)=>e+Yr(t),0),o=n.reduce((e,t)=>e+Xr(t),0),s=e?.doctor,c=s&&!s.ok?`bad`:i||a||o?`warn`:`good`,l={good:`Harness healthy.`,warn:`Harness needs a look.`,bad:`Harness has problems.`}[c],u=[X(n.length,`active install`)+(r?`, ${r} disabled`:``),s?s.ok?`doctor clean`:`doctor found ${X(s.problems.length,`problem`)}`:`doctor not run yet`,i?`${X(i,`install`)} behind source`:`all in step with source`,a?`${X(a,`file`)} hand-edited`:`no hand edits`];return o&&u.push(`${X(o,`file`)} behind source`),{tone:c,head:l,facts:u}}var $r=[[`carrier`,`Root file`],[`skills`,`Skill list`],[`agents`,`Agent list`],[`context`,`Session files`]],ei=e=>e?e.carrier+e.skills+e.agents+e.context:0,ti=e=>e.state===`active`&&(e.verdict===`behind`||K(e.drift)>0||(e.drift?.stale??0)>0),Z=e=>`≈${(e/4/1e3).toFixed(1)}k`,ni=e=>`${e.host} · ${e.scope}`,ri=e=>({id:e.id,host:e.host,path:e.path,label:ni(e)});function ii({fleet:e,usage:t,defaultLabel:n=null,...r}){let i=[],a=e?.doctor;a&&!a.ok&&i.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${X(a.problems.length,`problem`)}`,detail:a.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});for(let t of(e?.installs||[]).filter(e=>e.state===`active`)){if(t.verdict===`behind`){let e=t.built_epoch?`built ${Vt(t.built_epoch)} ago`:`never built`,n=Xr(t);i.push({id:`behind:${t.id}`,tag:`Behind`,tone:`warn`,title:`${ni(t)} is behind its source`,detail:n?`${e} · ${X(n,`file`)} behind`:e,where:t.host,verb:`Rebuild`,act:`rebuild`,installs:[ri(t)]})}let e=Yr(t);e&&i.push({id:`drift:${t.id}`,tag:`Drift`,tone:`warn`,title:`${ni(t)}: ${X(e,`file`)} edited by hand`,detail:`${t.drift.edited} edited, ${t.drift.added} added, ${t.drift.missing} missing`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`})}if(t&&t.days_counted>=30&&t.never?.length){let{skills:e,agents:n}=Zr(t);i.push({id:`usage`,tag:`Usage`,tone:``,sugg:!0,title:`${X(e,`skill`)} never fired in 30 days`,detail:`${X(n,`agent`)} too`,where:`library/skills`,verb:`Triage`,href:`#/skills`})}let o=(e?.installs||[]).filter(e=>e.state===`active`);for(let e of o.filter(e=>e.facts===0))i.push({id:`memory:${e.id}`,tag:`Memory`,tone:``,sugg:!0,title:`${ni(e)}: memory holds no facts`,detail:`no durable lesson recorded yet`,where:`personal/memory`,verb:`Open`,href:`#/personal/memory`});let s=Jr({...r,overview:r.overview&&{...r.overview,doctor:null,diff:null},setup:o.some(e=>e.facts!=null)&&r.setup?{...r.setup,facts:null}:r.setup}),c=new Set([`profile`,`rules`]);for(let e of s){let t=n&&c.has(e.id)?{title:`${n}: ${e.title}`}:{};i.push({...e,...t,sugg:!0})}return i}function ai(e,t){return(e?.rules||[]).map(e=>{let n=Br(e.rule),r=(t?.items||[]).find(e=>e.name===n);return{...e,name:r?Lr(r.title).name:e.rule===`wiki`?`Wiki guard`:n}})}var oi=e=>(e||[]).filter(e=>e.state===`active`&&e.cost);function si(e){let t=oi(e).filter(e=>e.cost.ceiling>0&&Number.isFinite(e.cost.carrier)),n=e=>e.cost.carrier/e.cost.ceiling,r=t.reduce((e,t)=>!e||n(t)>n(e)?t:e,null);if(!r)return null;let{carrier:i,ceiling:a}=r.cost;return{label:`${r.host} · ${r.scope}`,carrier:i,ceiling:a,pct:Math.round(n(r)*100)}}function ci(e){let t=oi(e);if(!t.length)return null;let n=t.reduce((e,t)=>ei(t.cost)>ei(e.cost)?t:e),r=t.map(e=>ei(e.cost));return{min:Math.min(...r),max:Math.max(...r),top:n}}var li=e=>(e?.per_day||[]).reduce((e,t)=>e+t,0);function ui(e,t){let n=ai(e,t),r=n.reduce((e,t)=>e+t.n,0),i=n.reduce((e,t)=>!e||t.n>e.n?t:e,null),a=[];for(let e of n)(e.per_day||[]).forEach((e,t)=>{a[t]=(a[t]||0)+e});return{total:r,top:i?{name:i.name,n:i.n}:null,perDay:a}}var Q=e=>e.catch(()=>null),di=(e,t)=>`${t?Math.min(100,e/t*100):0}%`,fi=36e5,pi=5e3;function mi({update:e,onAction:t,canFill:n=!0}){if(!e)return null;let r=e.install??(e.git?`git`:`npm-global`),i=r===`git`&&typeof e.behind==`number`?e.behind:null,a=i===null?e.latest===null?(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · `,e.checking?`checking…`:`update check unavailable`]}):e.available?(0,q.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current,` `,(0,q.jsxs)(`span`,{className:`ver-new`,children:[e.latest,` available`]})]}):(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current,` · latest`]}):i>0?(0,q.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current??``,` `,(0,q.jsxs)(`span`,{className:`ver-new`,children:[i,` commit`,i===1?``:`s`,` to pull`]})]}):(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · up to date`]});if(r===`other`)return!e.available||!e.command?a:(0,q.jsxs)(q.Fragment,{children:[a,(0,q.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,q.jsx)(`code`,{className:`mono`,children:e.command})]})]});if(r!==`git`&&!e.available)return a;let o=i===null?!!e.available:i>0;return(0,q.jsxs)(q.Fragment,{children:[a,(0,q.jsx)(`button`,{type:`button`,className:o&&n?`btn`:`btn ghost`,title:r===`git`?i===0?`Nothing to pull: up to date with upstream. Pulls and rebuilds every install anyway.`:`git pull, then rebuild every install`:`npm install -g geneseed@latest, then rebuild every install`,onClick:()=>t(`update`),children:`Update`})]})}var hi={good:`M8 12.5l2.7 2.7L16 9.5M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`,warn:`M12 3 22 20H2zM12 10v4M12 17v.5`,bad:`M9 9l6 6M15 9l-6 6M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`};function gi({tone:e}){return(0,q.jsx)(`svg`,{className:`health-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:hi[e]||hi.warn})})}function _i({fleet:e,error:t,behind:n,onAction:r,onRebuild:i}){let a=(0,q.jsx)(`button`,{type:`button`,className:`btn ghost ldg-doctor`,onClick:()=>r(`doctor`),children:`Run doctor`});if(!e)return t?(0,q.jsxs)(`section`,{className:`health unknown`,"aria-labelledby":`ldg-health`,children:[(0,q.jsx)(gi,{tone:`warn`}),(0,q.jsx)(`div`,{className:`health-text`,role:`status`,children:(0,q.jsx)(`h2`,{id:`ldg-health`,children:`Status unknown`})}),(0,q.jsx)(`div`,{className:`health-acts`,children:a})]}):(0,q.jsx)(`div`,{className:`health unknown`,"aria-busy":`true`});let o=Qr(e),s=[...o.facts,...e.version?[`Source is ${e.version}`]:[]];return(0,q.jsxs)(`section`,{className:`health ${o.tone}`,"aria-labelledby":`ldg-health`,children:[(0,q.jsx)(gi,{tone:o.tone}),(0,q.jsxs)(`div`,{className:`health-text`,role:`status`,children:[(0,q.jsx)(`h2`,{id:`ldg-health`,children:o.head}),(0,q.jsxs)(`p`,{className:`health-facts`,children:[s.join(` · `),`.`]})]}),(0,q.jsxs)(`div`,{className:`health-acts`,children:[a,n.length?(0,q.jsxs)(`button`,{type:`button`,className:`btn`,title:`Rebuilds ${n.map(e=>e.label).join(`, `)}`,onClick:()=>i(n),children:[`Rebuild all behind (`,n.length,`)`]}):null]})]})}function vi({chars:e}){let t=C(e);return(0,q.jsxs)(`span`,{className:`mono`,children:[Z(t??e),` tok`]})}var yi=e=>Math.round(e/4),bi={carrier:`accent`,skills:`skill`,agents:`agent`,context:`context`},xi=e=>$r.map(([t,n])=>({key:t,label:n,n:yi(e[t]),tone:bi[t]})),Si=e=>`${e.host} · ${e.scope}`;function Ci({cost:e,i:t}){let n=2*Math.PI*14,r=e.ceiling?Math.min(1,e.carrier/e.ceiling):0;return(0,q.jsxs)(`svg`,{className:`ldg-ring`,viewBox:`0 0 36 36`,"aria-hidden":`true`,children:[(0,q.jsx)(`circle`,{className:`bg`,cx:`18`,cy:`18`,r:14}),(0,q.jsx)(`circle`,{className:`fg`+(e.ceiling&&e.carrier>e.ceiling?` over`:``),cx:`18`,cy:`18`,r:14,strokeDasharray:n.toFixed(2),strokeDashoffset:(n*(1-r)).toFixed(2),style:{"--circ":n.toFixed(2),"--i":t}})]})}function wi({id:e,title:t,aside:n,className:r=``,children:i}){return(0,q.jsxs)(`section`,{className:`panel ldg-kpi ${r}`,"aria-labelledby":e,children:[(0,q.jsxs)(`div`,{className:`ldg-kpi-head`,children:[(0,q.jsx)(`h3`,{id:e,children:t}),n]}),i]})}function Ti({installs:e}){let t=si(e);return(0,q.jsx)(wi,{id:`ldg-k-root`,title:`Root file vs ceiling`,className:`ldg-kpi-root`,children:t?(0,q.jsxs)(`div`,{className:`ldg-kpi-ring`,children:[(0,q.jsxs)(`span`,{className:`ldg-ringbox`,children:[(0,q.jsx)(er,{value:yi(t.carrier),max:yi(t.ceiling),segments:t.pct>100?[{key:`v`,label:`root file`,n:yi(t.carrier),tone:`bad`}]:void 0,size:64,stroke:7,label:`Worst root file: ${t.label}, ${t.pct} percent of its ceiling`}),(0,q.jsxs)(`span`,{className:`mono ldg-ring-pct`,"aria-hidden":`true`,children:[t.pct,`%`]})]}),(0,q.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Z(t.carrier)} / ${Z(t.ceiling)} tokens`}),(0,q.jsx)(`span`,{className:`dim`,children:t.label})]})]}):(0,q.jsx)(`p`,{className:`dim`,children:`No root file to measure.`})})}function Ei({installs:e}){let t=ci(e),n=t&&(Z(t.min)===Z(t.max)?Z(t.max):`${Z(t.min)} – ${Z(t.max)}`);return(0,q.jsx)(wi,{id:`ldg-k-cost`,title:`Loaded every turn`,className:`ldg-kpi-cost`,children:t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Z(ei(t.top.cost))} tokens`}),(0,q.jsx)(`span`,{className:`dim`,children:Si(t.top)})]}),(0,q.jsx)(nr,{parts:xi(t.top.cost),label:`Loaded every turn, ${Si(t.top)}`}),(0,q.jsx)(`span`,{className:`dim ldg-kpi-cap`,children:`All installs: ${n} tokens`})]}):(0,q.jsx)(`p`,{className:`dim`,children:`No install has a root file to measure.`})})}function Di({usage:e}){let t=e?.enabled?e.days_counted<30&&e.since?`since ${e.since}`:`30 days`:null;return(0,q.jsx)(wi,{id:`ldg-k-calls`,title:`Skill and agent calls`,className:`ldg-kpi-calls`,aside:t?(0,q.jsx)(`span`,{className:`mono dim ldg-kpi-aside`,children:t}):null,children:e?e.enabled?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:(0,q.jsx)(A,{value:li(e)})}),e.per_day?.length>1?(0,q.jsx)(Ar,{vals:e.per_day,i:0}):null]}):(0,q.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`}):(0,q.jsx)(`p`,{className:`dim`,children:`Usage could not be read.`})})}function Oi({gates:e,laws:t}){let n=ui(e,t);return(0,q.jsx)(wi,{id:`ldg-k-gates`,title:`Gate asks · 30 days`,className:`ldg-kpi-gates`,aside:(0,q.jsx)(`a`,{className:`ldg-kpi-aside`,href:`#/laws`,"aria-label":`Open the Constitution`,children:`Constitution →`}),children:e?n.total?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`ldg-kpi-line`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:n.total}),` `,(0,q.jsx)(`span`,{className:`dim`,children:`· ${n.top.name} ${n.top.n}`})]}),n.perDay.length>1?(0,q.jsx)(Ar,{vals:n.perDay,i:1}):null]}):(0,q.jsx)(`p`,{className:`dim`,children:`No gate asked in 30 days.`}):(0,q.jsx)(`p`,{className:`dim`,children:`Gate activity could not be read.`})})}var ki=6;function Ai({i:e}){if(!e.diffable)return(0,q.jsx)(`span`,{className:`dim`,title:`Drift is only checked for global installs`,children:`not checkable`});let t=K(e.drift),n=e.drift?.stale??0;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-syncbar`,children:(0,q.jsx)(nr,{parts:[{key:`stale`,label:`Behind source`,n,tone:`warn`},{key:`edited`,label:`Edited by hand`,n:t,tone:`bad`}],label:`Sync with source, ${Si(e)}`,legend:!1})}),t?(0,q.jsxs)(`span`,{className:`mono t-bad`,children:[t,` edited`]}):e.drift?.linked?(0,q.jsxs)(`span`,{className:`mono dim`,title:`Yours: links Geneseed leaves alone`,children:[e.drift.linked,` linked`]}):(0,q.jsx)(`span`,{className:`mono dim`,children:`none`}),n?(0,q.jsxs)(`div`,{className:`mono dim ldg-sub`,children:[n,` file`,n===1?``:`s`,` behind`]}):null]})}function ji(e){if(!e.diffable)return`Not checkable: drift is only checked for global installs.`;let t=e.drift||{},n=[t.stale?`${t.stale} behind`:null,t.edited?`${t.edited} edited`:null,t.added?`${t.added} added`:null,t.missing?`${t.missing} missing`:null,t.linked?`${t.linked} linked (yours)`:null].filter(Boolean);return n.length?n.join(` · `):`Nothing differs.`}function Mi({i:e,n:t,onRebuild:n,onOpen:r,busy:i}){let[a,o]=(0,z.useState)(!1),s=Si(e),c=(0,q.jsxs)(`td`,{className:`ldg-where`,children:[i?(0,q.jsx)(`span`,{className:`console-progress`,role:`progressbar`,"aria-label":`Rebuilding ${s}`}):null,(0,q.jsxs)(`div`,{className:`ldg-who`,children:[ti(e)?(0,q.jsx)(`svg`,{className:`ldg-glyph ${K(e.drift)?`bad`:`warn`}`,viewBox:`0 0 10 10`,role:`img`,"aria-label":K(e.drift)?`edited by hand`:`needs a rebuild`,children:(0,q.jsx)(`path`,{d:`M5 1 9 9H1z`,fill:`currentColor`})}):null,e.state===`active`&&e.cost?(0,q.jsx)(`span`,{className:`ldg-phone-ring`,"aria-hidden":`true`,children:(0,q.jsx)(Ci,{cost:e.cost,i:t})}):null,(0,q.jsxs)(`div`,{className:`ldg-name`,children:[(0,q.jsx)(`span`,{className:`ldg-host`,children:e.host}),` `,(0,q.jsx)(`span`,{className:`dim`,children:e.scope}),(0,q.jsx)(`div`,{className:`mono dim ldg-path`,children:e.path})]})]})]});if(e.state!==`active`)return(0,q.jsxs)(`tr`,{className:`ldg-off`,children:[c,(0,q.jsx)(`td`,{className:`ldg-build`,children:(0,q.jsx)(`span`,{className:`pill off`,children:`disabled`})}),(0,q.jsx)(`td`,{className:`ldg-sync`}),(0,q.jsx)(`td`,{className:`ldg-root`}),(0,q.jsx)(`td`,{className:`ldg-total`}),(0,q.jsx)(`td`,{className:`ldg-act`,children:(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`})})]});let l={synced:(0,q.jsx)(`span`,{className:`pill good`,children:`in step`}),behind:(0,q.jsx)(`span`,{className:`pill warn`,children:`behind source`}),unknown:(0,q.jsx)(`span`,{className:`pill off`,children:`not checked`})}[e.verdict],u=ei(e.cost),d=e.cost?.ceiling?Math.round(e.cost.carrier/e.cost.ceiling*100):null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`tr`,{className:a?`ldg-open`:``,children:[c,(0,q.jsxs)(`td`,{className:`ldg-build`,children:[l,(0,q.jsx)(`div`,{className:`mono dim ldg-sub`,children:e.built_epoch?`built ${Vt(e.built_epoch)} ago`:`never built`})]}),(0,q.jsx)(`td`,{className:`ldg-sync`,children:(0,q.jsx)(Ai,{i:e})}),(0,q.jsx)(`td`,{className:`ldg-root`,children:e.cost?d===null?(0,q.jsx)(`span`,{className:`dim`,children:`no ceiling`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-rootbar`,children:(0,q.jsx)(rr,{value:yi(e.cost.carrier),max:yi(e.cost.ceiling),label:`Root file, ${s}`,tone:d>100?`bad`:`accent`})}),(0,q.jsx)(`span`,{className:`mono dim ldg-sub`,children:`${Z(e.cost.carrier)} / ${Z(e.cost.ceiling)} · ${d}%`})]}):(0,q.jsx)(`span`,{className:`dim`,children:`not measured`})}),(0,q.jsx)(`td`,{className:`ldg-total`,children:e.cost?(0,q.jsx)(vi,{chars:u}):null}),(0,q.jsxs)(`td`,{className:`ldg-act`,children:[ti(e)?(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Rebuild ${s}`,title:`Rebuilds ${s} only`,onClick:()=>n([ri(e)]),children:`Rebuild`}):(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`}),(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm ldg-toggle`,"aria-label":`Details for ${s}`,"aria-expanded":a,"aria-controls":a?`ldg-detail-${e.id}`:void 0,onClick:()=>o(e=>!e),children:(0,q.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:a?`M6 15l6-6 6 6`:`M6 9l6 6 6-6`})})})]})]}),a?(0,q.jsx)(`tr`,{className:`ldg-detail`,id:`ldg-detail-${e.id}`,children:(0,q.jsx)(`td`,{colSpan:ki,children:(0,q.jsxs)(`div`,{className:`ldg-detail-grid`,children:[(0,q.jsxs)(`div`,{className:`ldg-detail-col`,children:[e.cost?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-lbl`,children:`What rides every turn · ${Z(u)} tokens`}),(0,q.jsx)(nr,{parts:xi(e.cost),label:s})]}):(0,q.jsx)(`span`,{className:`dim`,children:`Always-on cost not measured.`}),(0,q.jsx)(`span`,{className:`dim`,children:[`Voice ${e.theme}`,`${e.footprint} footprint`,e.posture&&`${e.posture} posture`,e.mode&&`${e.mode} mode`,e.facts!=null&&`${e.facts} memory fact${e.facts===1?``:`s`}`].filter(Boolean).join(` · `)})]}),(0,q.jsxs)(`div`,{className:`ldg-detail-col`,children:[(0,q.jsx)(`span`,{className:`ldg-lbl`,children:`Differs from source`}),(0,q.jsx)(`span`,{className:`muted`,children:ji(e)}),e.diffable?(0,q.jsx)(`span`,{children:(0,q.jsx)(`a`,{className:`btn ghost sm`,href:`#/installs/edits`,"aria-label":`View diff for ${s}`,onClick:()=>Pt(`edits`,e.id),children:`View diff`})}):null]})]})})}):null]})}function Ni({rows:e,onAction:t,onRebuild:n}){let r=e.filter(e=>!e.sugg).length;return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-needs`,children:[(0,q.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,q.jsx)(`h2`,{id:`ldg-needs`,children:`Needs you`}),(0,q.jsxs)(`span`,{className:`mono dim`,children:[r,` problem`,r===1?``:`s`,`, `,e.length-r,` suggestion`,e.length-r===1?``:`s`]})]}),e.length?(0,q.jsx)(`ul`,{className:`needs`,children:e.map(e=>(0,q.jsxs)(`li`,{className:e.sugg?`sugg`:``,children:[(0,q.jsx)(`span`,{className:`tag ${e.tone}`,children:e.tag}),(0,q.jsxs)(`span`,{className:`needs-what`,children:[(0,q.jsx)(`b`,{children:e.title}),e.detail?(0,q.jsxs)(`span`,{className:`dim`,children:[` · `,e.detail]}):null]}),(0,q.jsx)(`span`,{className:`mono dim needs-where`,children:e.where}),e.act?(0,q.jsx)(`button`,{type:`button`,className:`needs-verb linkish`,"aria-label":`${e.verb}: ${e.title}`,onClick:()=>e.installs?n(e.installs):t(e.act),children:e.verb}):(0,q.jsx)(`a`,{className:`needs-verb`,href:e.href,"aria-label":`${e.verb}: ${e.title}`,children:e.verb})]},e.id))}):(0,q.jsx)(`p`,{className:`needs-empty`,children:`Nothing needs you.`})]})}function Pi({usage:e}){let t=(0,q.jsxs)(`div`,{className:`panel-head`,children:[(0,q.jsx)(`h2`,{id:`ldg-usage`,children:`What fires`}),(0,q.jsx)(`span`,{className:`mono dim`,children:`skills and agents, 30 d`})]});if(!e)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`dim`,children:`Usage could not be read.`})]});if(!e.enabled)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`})]});if(e.days_counted<30)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`muted`,children:e.since?(0,q.jsxs)(q.Fragment,{children:[`Counting since `,(0,q.jsx)(`b`,{children:e.since}),`, `,e.days_counted,` of 30 days`]}):`No skill or agent call counted yet`}),(0,q.jsx)(`div`,{className:`daytrack`,"aria-hidden":`true`,children:Array.from({length:30},(t,n)=>(0,q.jsx)(`i`,{className:n<e.days_counted?`on`:``},n))}),(0,q.jsx)(`p`,{className:`dim chart-foot`,children:`Rankings and the never-fired count appear once 30 days are counted, so a new install is not told every skill is unused.`})]});let n=e.rows.slice(0,7),r=Math.max(1,...n.map(e=>e.n));return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`ul`,{className:`ubars`,children:n.map((e,t)=>(0,q.jsxs)(`li`,{className:e.kind,children:[(0,q.jsxs)(`span`,{className:`ub-name`,children:[e.name,` `,(0,q.jsx)(`span`,{className:`dim`,children:e.kind})]}),(0,q.jsx)(`span`,{className:`ub-trk`,children:(0,q.jsx)(`i`,{style:{width:di(e.n,r),"--i":t}})}),(0,q.jsx)(`span`,{className:`mono`,children:e.n})]},`${e.install}:${e.kind}:${e.name}`))}),e.never.length?(0,q.jsxs)(`div`,{className:`ub-never`,children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`b`,{children:Zr(e).skills}),` skills never fired`]}),(0,q.jsx)(`a`,{className:`needs-verb`,href:`#/skills`,children:`Triage`})]}):null]})}function Fi({overview:e,setup:t,runs:n,onAction:r,dataRev:i,banner:o,view:s}){let c=fn(),[l,u]=(0,z.useState)({}),{data:d,error:f,reload:p}=W(()=>a.fleet(),[i]),{data:m}=W(()=>Q(a.usage()),[i]),{data:h}=W(()=>Q(a.gates()),[i]),g=(0,z.useRef)(null),{data:_,reload:v}=W(()=>Q(a.update()).then(e=>(e?g.current=e:g.current?.checking&&(g.current={...g.current,checking:!1}),g.current)),[i]);(0,z.useEffect)(()=>{let e=setInterval(v,fi),t=()=>{document.visibilityState===`visible`&&v()};return document.addEventListener(`visibilitychange`,t),()=>{clearInterval(e),document.removeEventListener(`visibilitychange`,t)}},[v]);let y=!!_?.checking;(0,z.useEffect)(()=>{if(!y)return;let e=setTimeout(v,pi);return()=>clearTimeout(e)},[y,_,v]);let{data:b}=Qn(i),{data:x}=W(()=>Q(a.activity()),[i]),{data:S}=W(()=>Q(a.profile()),[i]),{data:C}=W(()=>Q(a.catalog(`skills`)),[i],`catalog:skills`),{data:w}=W(()=>Q(a.catalog(`laws`)),[i],`catalog:laws`),T=d?.installs||[],E=e=>{Pt(`hosts`,e.id),window.location.hash=`#/installs/hosts`},D=Mt(i),O=ii({defaultLabel:D?.length>1?Si(D[0]):null,fleet:d,usage:m,overview:e,setup:t,rules:b,activity:x,profile:S,skills:C,laws:w}),k=T.filter(ti).map(ri),A=async e=>{let t=e.map(e=>e.label);if(!await c(`Rebuild ${t.join(`, `)}? Each is re-rendered from source with its own settings.`,{title:e.length===1?`Rebuild ${t[0]}?`:`Rebuild ${e.length} installs?`,confirmLabel:`Rebuild`}))return;let n=await r(`rebuild`,{installs:e.map(({host:e,path:t})=>({host:e,path:t}))});n&&u(t=>({...t,[n]:e.map(e=>e.id)}))},j=new Set(Object.entries(l).filter(([e])=>n?.find(t=>t.id===e)?.status===`running`).flatMap(([,e])=>e));return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Yn,{eyebrow:d?`${T.length} harness${T.length===1?``:`es`} installed on this machine`:null,title:`Overview`,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(mi,{update:_,onAction:r,canFill:!k.length}),s]})}),o,(0,q.jsxs)(`div`,{className:`ov-stack ldg`,children:[(0,q.jsx)(_i,{fleet:d,error:f,behind:k,onAction:r,onRebuild:A}),(0,q.jsxs)(`div`,{className:`ldg-kpis`,role:`group`,"aria-labelledby":`ldg-kpis-h`,children:[(0,q.jsx)(`h2`,{id:`ldg-kpis-h`,className:`sr-only`,children:`Key figures`}),(0,q.jsx)(Ti,{installs:T}),(0,q.jsx)(Ei,{installs:T}),(0,q.jsx)(Di,{usage:m}),(0,q.jsx)(Oi,{gates:h,laws:w})]}),(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-fleet`,children:[(0,q.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,q.jsx)(`h2`,{id:`ldg-fleet`,children:`Installed harnesses`}),d?.source_fp?(0,q.jsxs)(`span`,{className:`mono dim`,children:[`source `,d.source_fp]}):null]}),f&&d?(0,q.jsxs)(`p`,{className:`dim`,role:`status`,children:[`Could not refresh the installs — showing the last read.`,` `,(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:p,children:`Retry`})]}):null,(0,q.jsx)(`div`,{className:`ldg-scroll`,children:(0,q.jsxs)(`table`,{className:`ldg-fleet`,children:[(0,q.jsx)(`caption`,{className:`sr-only`,children:`Installs`}),(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{scope:`col`,children:`Install`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-build`,children:`Build`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-sync`,children:`Sync with source`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-root`,children:`Root file · ceiling`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-total`,children:`Always-on`}),(0,q.jsx)(`th`,{scope:`col`,children:(0,q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,q.jsxs)(`tbody`,{children:[f&&!d?(0,q.jsx)(`tr`,{children:(0,q.jsxs)(`td`,{colSpan:ki,children:[(0,q.jsx)(`span`,{className:`dim`,role:`status`,children:`Could not read the installs`}),` `,(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:p,children:`Retry`})]})}):null,T.map((e,t)=>(0,q.jsx)(Mi,{i:e,n:t,onRebuild:A,onOpen:E,busy:j.has(e.id)},e.id))]})]})})]}),(0,q.jsxs)(`div`,{className:`ldg-bottom`,children:[(0,q.jsx)(Ni,{rows:O,onAction:r,onRebuild:A}),(0,q.jsx)(Pi,{usage:m})]})]})]})}var Ii=`geneseed-understand-seen`,Li=`understand`;function Ri(){try{let e=JSON.parse(localStorage.getItem(Ii));return Array.isArray(e)?e:[]}catch{return[]}}function zi(e){let t=Ri();if(t.includes(e))return t;let n=[...t,e];try{localStorage.setItem(Ii,JSON.stringify(n))}catch{}return n}function Bi(e,t){let n=e?.groups||[],r=n.findIndex(e=>e.id===Li),i=n[r]?.pages||[],a=i.findIndex(e=>e.id===t);if(a<0)return{prev:null,next:null};let o=n.slice(r+1).find(e=>e.pages.length);return{prev:i[a-1]||null,next:i[a+1]||o?.pages[0]||null}}function Vi(e,t){for(let n of e?.groups||[]){let e=n.pages.find(e=>e.id===t);if(e)return{part:n,section:e.section||`General`,page:e}}return{part:null,section:null,page:null}}function Hi(e,t){let{part:n,section:r}=Vi(e,t);if(!n)return{prev:null,next:null};if(n.id===`understand`)return Bi(e,t);let i=n.pages.filter(e=>(e.section||`General`)===r),a=i.findIndex(e=>e.id===t);return{prev:i[a-1]||null,next:i[a+1]||null}}var Ui=e=>`#/docs/`+encodeURIComponent(e);function Wi({pages:e,seen:t}){let n=e.filter(e=>t.includes(e.id)).length;return(0,q.jsx)(`div`,{className:`track-prog`,role:`progressbar`,"aria-label":`Pages read`,"aria-valuemin":0,"aria-valuemax":e.length,"aria-valuenow":n,children:(0,q.jsx)(`i`,{style:{width:`${n/(e.length||1)*100}%`}})})}function Gi({menu:e,pageId:t}){let{prev:n,next:r}=Hi(e,t);return!n&&!r?null:(0,q.jsxs)(`nav`,{className:`track-bar`,"aria-label":`Pages`,children:[n?(0,q.jsxs)(`a`,{className:`track-card`,href:Ui(n.id),children:[(0,q.jsx)(`span`,{className:`track-card-lbl`,"aria-hidden":`true`,children:`Previous`}),(0,q.jsxs)(`span`,{className:`track-card-title`,children:[`← `,n.title]})]}):(0,q.jsx)(`span`,{}),r&&(0,q.jsxs)(`a`,{className:`track-card next`,href:Ui(r.id),children:[(0,q.jsx)(`span`,{className:`track-card-lbl`,"aria-hidden":`true`,children:`Next`}),(0,q.jsxs)(`span`,{className:`track-card-title`,children:[`Next: `,r.title,` →`]})]})]})}var Ki=`modulepreload`,qi=function(e){return`/`+e},Ji={},Yi=function(e){return e.pathname.endsWith(`.css`)},Xi=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=qi(t,n);let r=s(t),i=Yi(r);return Xi(Ji,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ki,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Zi=`geneseed-newhere-dismissed`,Qi=(0,z.lazy)(()=>$(()=>import(`./Dashboard-sCfEjowQ.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5])));function $i({harness:e}){let[t,n]=(0,z.useState)(()=>!!localStorage.getItem(Zi)),{data:r}=W(()=>t?Promise.resolve(null):a.docs(e).catch(()=>null),[t,e]),i=r?.groups?.find(e=>e.id===`understand`)?.pages||[],o=Ri(),s=i.findIndex(e=>!o.includes(e.id));if(t||!i.length||s<0)return null;let c=i.filter(e=>o.includes(e.id)).length;return(0,q.jsxs)(`section`,{className:`newhere`,"aria-label":`New here?`,children:[(0,q.jsxs)(`div`,{className:`newhere-body`,children:[(0,q.jsx)(`b`,{children:`New here? Understand your harness.`}),(0,q.jsxs)(`p`,{children:[i.length,` short pages: what a harness is, what was installed, what changes in your day, and what is guaranteed.`]}),(0,q.jsx)(`div`,{className:`newhere-dots`,"aria-label":`${c} of ${i.length} read`,children:i.map(e=>(0,q.jsx)(`i`,{className:o.includes(e.id)?`f`:``},e.id))})]}),(0,q.jsx)(`a`,{className:`btn ghost`,href:`#/docs/${encodeURIComponent(i[s].id)}`,children:c?`Continue · step ${s+1}`:`Start`}),(0,q.jsx)(`button`,{type:`button`,className:`newhere-x`,onClick:()=>{localStorage.setItem(Zi,`1`),n(!0)},title:`Dismiss for good`,"aria-label":`Dismiss`,children:`×`})]})}function ea({layout:e,onLayout:t}){return(0,q.jsx)(Sn,{"aria-label":`View`,children:ht.map(n=>(0,q.jsx)(`button`,{type:`button`,className:e===n.id?`on`:``,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id))})}function ta({overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c=`overview`,onLayout:l,dataRev:u}){let{data:d,loading:f}=W(()=>Promise.resolve().then(()=>a.installs()).catch(()=>null),[u],`installs`);if(!e)return t?(0,q.jsx)(Rn,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,q.jsx)(Ln,{});if(f&&!d)return(0,q.jsx)(Ln,{});if(!(d?d.installs?.some(e=>e.state===`active`):e.deployed))return(0,q.jsx)(Zn,{onAction:s});let p=(0,q.jsx)($i,{harness:on(e.emit)}),m=l?(0,q.jsx)(ea,{layout:c,onLayout:l}):null;return c===`overview`?(0,q.jsx)(Fi,{overview:e,setup:i,runs:o,onAction:s,onRetry:n,dataRev:u,view:m,banner:(0,q.jsxs)(q.Fragment,{children:[e.daemon_stale?(0,q.jsx)(zn,{}):null,p]})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Yn,{title:`Overview`,sub:[e.install&&`${e.install.host} · ${e.install.scope}`,e.theme&&`${e.theme} voice`,e.footprint&&`${e.footprint} footprint`,e.target].filter(Boolean).join(` · `),primary:(0,q.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s(`build-all`),children:`Rebuild`}),actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>s(`update`),children:`Update`}),(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>s(`doctor`),children:`Run doctor`}),m]})}),p,(0,q.jsx)(z.Suspense,{fallback:(0,q.jsx)(Ln,{}),children:(0,q.jsx)(Qi,{overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c,dataRev:u})})]})}var na=(0,z.lazy)(()=>$(()=>import(`./Activity-B7cFtS00.js`),__vite__mapDeps([6,1,2,3,4,7,8,9]))),ra=(0,z.lazy)(()=>$(()=>import(`./ActivityDetail-C-GbMmuW.js`),__vite__mapDeps([10,1,2,3,7,8,9]))),ia=(0,z.lazy)(()=>$(()=>import(`./Library-QCGXPV5h.js`),__vite__mapDeps([11,1,2,3,4,5,7,12,13,14]))),aa=(0,z.lazy)(()=>$(()=>import(`./Kits-aj07N7mT.js`),__vite__mapDeps([15,1,2,3,7,14,16,17]))),oa=(0,z.lazy)(()=>$(()=>import(`./Loops-C5u7fQOR.js`),__vite__mapDeps([18,1,2,3,7,9,12,13,19,14,17]))),sa=(0,z.lazy)(()=>$(()=>import(`./Laws-DZ38nl_H.js`),__vite__mapDeps([20,1,2,3,7,13,14]))),ca=(0,z.lazy)(()=>$(()=>import(`./Personal-ox_MktWO.js`),__vite__mapDeps([21,1,2,3,7,14,22,11,4,5,12,13]))),la=(0,z.lazy)(()=>$(()=>import(`./Installs-CnkdJ-VA.js`),__vite__mapDeps([23,1,2,3,4,7,22,16]))),ua=(0,z.lazy)(()=>$(()=>import(`./Docs-w3Y7M5Ts.js`),__vite__mapDeps([24,1,2,3,4,7,12,13,19,14])));function da(){let e=_e(),[t,n]=(0,z.useState)(null),[r,i]=(0,z.useState)(!1),[o,s]=Ke(),[c,l]=Ze(),[u,d]=pt(),f=e=>{if(e===c)return;let t=()=>{l(e),d(`curated`)};if(!document.startViewTransition||!E())return t();document.startViewTransition(()=>(0,ce.flushSync)(t))},[p,m]=vt(),[h,g]=(0,z.useState)(()=>{try{return!window.sessionStorage.getItem(`gs-booted`)}catch{return!0}}),[_,v]=(0,z.useState)(!1),y=(0,z.useRef)(null),b=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!_)return;let e=e=>{e.key===`Escape`&&v(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_]),(0,z.useEffect)(()=>{if(!_)return;let e=b.current,t=document.activeElement;return e&&(e.inert=!0),document.getElementById(`rail-nav`)?.focus(),()=>{e&&(e.inert=!1),t instanceof HTMLElement&&t.focus()}},[_]);let x=e=>n({kind:e?.body?.kind||`err`,msg:e?.body?.message||e.message}),{overview:S,error:C,themes:w,reload:T}=yt(x),[D,O]=(0,z.useState)(0),k=()=>{T(),O(e=>e+1)},[A,j]=(0,z.useState)(null),{runs:ee,activeId:te,consoleOpen:M,setConsoleOpen:N,runAction:P,cancelJob:ne,clearRuns:re}=xt({onFinish:e=>{k(),j({status:e,at:Date.now()})},onError:x}),{data:F}=W(()=>a.setup().catch(()=>null),[D],`setup`),{data:I,loading:ie}=W(()=>a.installs().catch(()=>null),[D],`installs`),ae=I?.installs||null,oe=At(ae),[L,se]=It(`voice`,oe),R=ee[ee.length-1],le=R?R.status===`running`?`${R.action} running`:`${R.action} ${R.status}`:``;(0,z.useEffect)(()=>{let e=y.current;if(e){if(!We(e,lt(u),o)){let t=dt(u);t?Ce(e,t,o):Te(e,c,o)}document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,getComputedStyle(e).getPropertyValue(`--bg`).trim())}},[o,u,c]);let B=[{title:`Rebuild all`,desc:`Re-emit every install`,run:()=>P(`build-all`),confirm:{msg:`Rebuild every install from the current sources?`,title:`Rebuild all?`,confirmLabel:`Rebuild all`}},{title:`Update`,desc:`Pull the latest Geneseed; the server restarts after`,run:()=>P(`update`),confirm:{msg:`Update Geneseed? The server restarts when the update ends.`,title:`Update Geneseed?`,confirmLabel:`Update`}},{title:`Run doctor`,desc:`Read-only health check`,run:()=>P(`doctor`)},{title:`Restart server`,desc:`Restart the local Geneseed server`,run:()=>rt().catch(x),confirm:{msg:`Restart the local Geneseed server? The console reconnects in a moment.`,title:`Restart the server?`,confirmLabel:`Restart`}},{title:o===`light`?`Switch to dark mode`:`Switch to light mode`,desc:`Appearance`,run:s},...Je.filter(e=>e.id!==c).map(e=>({title:`Flavour: ${e.name}`,desc:e.tagline,run:()=>f(e.id)}))].map(e=>({kind:`Actions`,hay:`${e.title} ${e.desc}`.toLowerCase(),...e})),V={flavour:c,onFlavour:f,accentMode:u,onAccentMode:d,layout:p,onLayout:m};return(0,q.jsx)(`div`,{className:`app fl-${c} ${o===`light`?`light`:``}${_?` nav-open`:``}`,ref:y,children:(0,q.jsxs)(pn,{children:[(0,q.jsx)(`div`,{className:`atmos`,"aria-hidden":`true`}),(0,q.jsx)(`a`,{className:`skip-link`,href:`#main`,onClick:e=>{e.preventDefault(),document.getElementById(`main`)?.focus()},children:`Skip to content`}),(0,q.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:le}),_&&(0,q.jsx)(`button`,{type:`button`,className:`nav-scrim`,"aria-label":`Close navigation`,onClick:()=>v(!1)}),(0,q.jsx)($t,{route:e,overview:S,installs:ae,onOpenVoice:()=>i(e=>!e),onNavigate:()=>v(!1)}),r&&(0,q.jsx)(On,{themes:w,current:L?L.theme:S?.theme,installs:oe,install:L,ready:!ie||!!I,onInstall:se,onPick:e=>{i(!1),P(`build`,{theme:e},jt(L))},onClose:()=>i(!1)}),(0,q.jsxs)(`div`,{className:`col`,ref:b,children:[(0,q.jsx)(Tn,{route:e,navOpen:_,onToggleNav:()=>v(e=>!e),actions:B,mode:o,onToggleMode:s,appearance:V,dataRev:D}),(0,q.jsx)(`main`,{className:`page`,id:`main`,tabIndex:-1,children:(0,q.jsxs)(`div`,{className:[`library`,`kits`,`loops`,`docs`].includes(e.page)?`pad pad-wide`:`pad`,children:[(0,q.jsx)(Dn,{unreadable:!ie&&!I}),(0,q.jsx)(qn,{activeId:te,finish:A,children:(0,q.jsx)(Hn,{children:(0,q.jsx)(z.Suspense,{fallback:(0,q.jsx)(Ln,{}),children:{overview:()=>(0,q.jsx)(ta,{overview:S,overviewError:C,onRetry:T,themes:w,setup:F,runs:ee,onAction:P,layout:p,onLayout:m,dataRev:D}),laws:()=>(0,q.jsx)(sa,{selected:e.item,overview:S,setup:F,onAction:P,dataRev:D}),library:()=>(0,q.jsx)(ia,{overview:S,section:e.section,selected:e.item,dataRev:D}),kits:()=>(0,q.jsx)(aa,{item:e.item,onAction:P,dataRev:D}),loops:()=>(0,q.jsx)(oa,{tab:e.tab,item:e.item,dataRev:D}),personal:()=>(0,q.jsx)(ca,{tab:e.tab,item:e.item,setup:F,dataRev:D}),installs:()=>(0,q.jsx)(la,{tab:e.tab,overview:S,setup:F,themes:w,onAction:P,onMutated:k,dataRev:D,appearance:V}),activity:()=>e.item?(0,q.jsx)(ra,{sid:e.item},e.item):(0,q.jsx)(na,{}),docs:()=>(0,q.jsx)(ua,{page:e.item,onAction:P,overview:S})}[e.page]?.()})},e.page)})]})}),(0,q.jsx)(tn,{route:e,navOpen:_,onMore:()=>v(!0)}),(0,q.jsx)(jn,{runs:ee,open:M,busy:!!te,finish:A,onToggle:()=>N(e=>!e),onClear:re,onCancel:ne})]}),(0,q.jsx)(An,{toast:t,onClose:()=>n(null)}),h&&(0,q.jsx)(In,{ready:!!S||!!C,onDone:()=>{try{window.sessionStorage.setItem(`gs-booted`,`1`)}catch{}g(!1)}})]})})}(0,le.createRoot)(document.getElementById(`root`)).render((0,q.jsx)(da,{})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).catch(()=>{})});export{fn as $,vr as A,oe as At,er as B,ur as C,rt as Ct,fr as D,ve as Dt,gr as E,ue as Et,ar as F,Wn as G,Qn as H,lr as I,Rn as J,Jn as K,or as L,Er as M,wr as N,pr as O,ge as Ot,jr as P,Sn as Q,rr as R,Pr as S,ft as St,Ar as T,V as Tt,Zn as U,$n as V,Yn as W,En as X,Ln as Y,Cn as Z,Lr as _,kt as _t,Ui as a,Gt as at,Fr as b,W as bt,Ri as c,Vt as ct,Ur as d,Ft as dt,rn as et,Hr as f,It as ft,Br as g,Ot as gt,Kr as h,Tt as ht,Wi as i,K as it,br as j,re as jt,Or as k,R as kt,Qr as l,Kt as lt,Gr as m,wt as mt,Gi as n,an as nt,zi as o,Wt as ot,Wr as p,Mt as pt,zn as q,Li as r,J as rt,Vi as s,Ut as st,$ as t,on as tt,ai as u,Pt as ut,Mr as v,jt as vt,yr as w,Je as wt,Ir as x,ht as xt,Nr as y,Et as yt,nr as z};
@@ -11,13 +11,13 @@
11
11
  <!-- The brand sprout as an inline SVG favicon (no extra asset to serve). -->
12
12
  <link rel="icon" type="image/svg+xml"
13
13
  href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.5v-9' stroke='%233AD4C4' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3Cpath d='M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z' fill='%233AD4C4'/%3E%3Cpath d='M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z' fill='%233AD4C4' opacity='.42'/%3E%3C/svg%3E" />
14
- <script type="module" crossorigin src="/assets/index-DhNNxhfg.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-CzDi9JpF.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-hePW80VL.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/react-DlYQp10C.js">
17
- <link rel="modulepreload" crossorigin href="/assets/api-LvBC0CnK.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/api-BxjLd7Qd.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/motion-CXaUMNkg.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/sections-ChwaobfW.js">
20
- <link rel="stylesheet" crossorigin href="/assets/index-XTGBLKQr.css">
20
+ <link rel="stylesheet" crossorigin href="/assets/index-0GCxkY7m.css">
21
21
  </head>
22
22
  <body>
23
23
  <div id="root"></div>
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{a as i}from"./motion-CXaUMNkg.js";import{A as a,C as o,D as s,E as c,I as l,J as u,M as d,N as f,P as p,T as m,W as ee,Y as te,Z as ne,dt as h,j as g,k as re,ot as _,pt as v,u as y,w as b}from"./index-DhNNxhfg.js";import{t as x}from"./EmptyState-1sPNleqv.js";import{a as S,c as C,d as w,i as T,l as E,n as D,o as O,r as k,s as A,t as j,u as M}from"./Bonsai-CN4rRAHc.js";import{t as ie}from"./usePoll-bDFN-Hr6.js";var N=e(t(),1),P=n(),F=4,I=56*F,L=24,R=165,z=188,B=e=>{let t=O(e);return t==null?null:Math.round(t*100)};function V(e,t,n){let r=o[e.status]||o.idle,i=t.pads.filter(e=>e.key!=null),a=t.pads.reduce((e,t)=>e+t.files.length,0)+t.fallen.reduce((e,t)=>e+t.files.length,0),c=B(e);return[`${e.title||s(e.cwd)||e.session_id}, ${e.host||`unknown host`}, ${r.label}${e.phase?`, ${e.phase}`:``}`,`${e.turns||0} turns${c==null?``:`, context ${c} %`}${e.compactions?`, ${e.compactions} compactions`:``}`,i.length?`${i.length} sub-agent${i.length===1?``:`s`} running: ${i.map(e=>`${e.type||`agent`} (${e.files.length} file${e.files.length===1?``:`s`})`).join(`, `)}`:``,t.fallen.length?`${t.fallen.length} finished`:``,`${a} file${a===1?``:`s`} changed`,n.length?`shares ${n.length} file${n.length===1?``:`s`} with another session`:``,e.error?`error: ${e.error}`:``].filter(Boolean).join(`. `)}function H({s:e,t,mine:n}){let r=B(e);return(0,P.jsxs)(`div`,{className:`card gd-card`,children:[(0,P.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`dt`,{children:`model`}),(0,P.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,P.jsx)(`dt`,{children:`turns`}),(0,P.jsx)(`dd`,{children:e.turns||0}),(0,P.jsx)(`dt`,{children:`context`}),(0,P.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,P.jsx)(`dt`,{children:`compactions`}),(0,P.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,P.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,P.jsxs)(`div`,{className:`act-xs ${e.kind===`same-worktree`?`t-bad`:`t-warn`}`,children:[`same file`,e.kind===`same-worktree`?``:`, other worktree`,`: `,e.path]},`${e.kind}:${e.path}`))]})}function U({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let c=w(e,n),l=(0,N.useMemo)(()=>A(e,{sakura:n}),[c]),u=o[e.status]||o.idle,d=Array.isArray(e.loops)?e.loops[0]:null,f=e.status!==`idle`,p=e.session_id,m=(0,N.useCallback)(e=>a(p,e),[a,p]);return(0,P.jsxs)(`a`,{className:`gd-tree${g(e)?` gd-needs`:``}`,href:`#/activity/${encodeURIComponent(e.session_id)}`,"aria-label":V(e,l,r),"data-sid":e.session_id,onMouseEnter:e=>a(p,null,G(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(p,null,G(e.currentTarget)),onBlur:()=>a(null,null),children:[(0,P.jsxs)(`div`,{className:`gd-label`,children:[(0,P.jsxs)(`div`,{className:`act-ell`,children:[(0,P.jsx)(`span`,{className:`mono dim`,children:e.host||`?`}),` ·`,` `,e.title||s(e.cwd)||e.session_id]}),(0,P.jsxs)(`div`,{className:`row gap-8 gd-sub`,children:[(0,P.jsx)(`span`,{className:`badge ${u.cls}`,children:u.label}),t&&(0,P.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),d&&(0,P.jsxs)(`span`,{className:`badge`,children:[`↻ `,d.title,d.iteration==null?``:` ${d.iteration}`]}),e.attribution===!1&&(0,P.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`}),e.phase&&(0,P.jsx)(`span`,{className:`dim act-ell`,children:e.phase})]})]}),(0,P.jsx)(k,{t:l,pad:i,swaying:f,onPad:m,px:F})]})}function W({pairs:e,count:t}){if(!e.length)return null;let n=t*I+(t-1)*L,r=e=>e*(I+L)+I/2;return(0,P.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*F+20,"aria-hidden":`true`,children:e.map(({a:e,b:t,kind:n})=>{let[i,a]=e<t?[e,t]:[t,e],o=`gd-thread ${n===`same-worktree`?`red`:`amber`}`;if(a-i===1){let e=r(i)+30,t=r(a)-30,n=(e+t)/2;return(0,P.jsxs)(`g`,{className:o,children:[(0,P.jsx)(`path`,{d:`M${e} ${R} C${n} 179 ${n} 159 ${t} 169`}),(0,P.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${R}`})]},`${i}-${a}`)}return(0,P.jsx)(`g`,{className:o,children:(0,P.jsx)(`path`,{d:`M${r(i)} ${z} Q${(r(i)+r(a))/2} 222 ${r(a)} ${z}`})},`${i}-${a}`)})})}var G=e=>e.offsetLeft-(e.parentElement?.scrollLeft||0);function ae({sessions:e,collisions:t}){let[n,r]=(0,N.useState)(T),[i,a]=(0,N.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(D,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=S(C(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>E(e,s);return(0,P.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,P.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,P.jsxs)(`span`,{className:`dim act-sm`,children:[e.length,` tree`,e.length===1?``:`s`,` · `,c.length,` `,c.length===1?`shelf`:`shelves`,` · hover a tree, or one of its pads, for its details`]}),(0,P.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Sakura`})]}),l.length>0&&(0,P.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,P.jsxs)(`button`,{type:`button`,className:`chip-f`,"aria-expanded":!1,onClick:()=>a(t=>new Set(t).add(e.key)),children:[e.name,` · `,e.trees.length]},e.key))}),c.filter(e=>!e.collapsed).map(e=>(0,P.jsx)(K,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function K({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,N.useState)({sid:null,pad:null,x:0}),o=(0,N.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=e.trees.find(e=>e.s.session_id===i.sid)?.s,c=s?A(s,{sakura:t}):null,l=c&&i.pad!=null?c.pads[i.pad]:null;return(0,P.jsxs)(`section`,{className:`gd-shelf`,"aria-label":`${e.name} shelf`,children:[(0,P.jsxs)(`h3`,{className:`act-lbl gd-shelf-h`,children:[e.name,` `,(0,P.jsxs)(`span`,{className:`dim`,children:[`· `,e.trees.length]})]}),(0,P.jsxs)(`div`,{className:`gd-row`,children:[e.trees.map(({s:e,worktree:n})=>(0,P.jsx)(U,{s:e,worktree:n,sakura:t,mine:r(e.session_id),pad:e.session_id===i.sid?i.pad:null,onHover:o},e.session_id)),(0,P.jsx)(W,{pairs:M(e.trees,n),count:e.trees.length})]}),s&&(0,P.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:l?(0,P.jsx)(j,{pad:l}):(0,P.jsx)(H,{s,t:c,mine:r(s.session_id)})})]})}var q=e=>e.catch(()=>null);function J({s:e}){let t=(0,N.useId)(),n=e.todos,r=a(e);return(0,P.jsxs)(`a`,{className:`card pad-md act-card`,href:`#/activity/${encodeURIComponent(e.session_id)}`,"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,P.jsx)(b,{s:e,id:t,heading:e.title||s(e.cwd)||e.session_id,children:(0,P.jsx)(_,{name:`chevron`,className:`glyph act-chev`})}),n&&n.total>0&&(0,P.jsx)(`div`,{className:`act-foot`,children:(0,P.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,P.jsx)(c,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,P.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,h(e.updated_at),` ago`]})]})}var Y={blocked:`is blocked`,"waiting-input":`waits for your answer`};function oe(e,t){if(!Array.isArray(t))return``;let n=t.filter(g),r=e.current;return e.current=new Set(n.map(e=>`${e.session_id}:${e.status}`)),r?n.filter(e=>!r.has(`${e.session_id}:${e.status}`)).map(e=>`${e.title||s(e.cwd)||e.session_id} ${Y[e.status]}`).join(`. `):``}var X=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function se(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:X.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function ce(e){let t=new URLSearchParams;e.f!==`all`&&t.set(`f`,e.f),e.v===`list`&&t.set(`v`,`list`),e.host&&t.set(`host`,e.host),e.project&&t.set(`project`,e.project);let n=t.toString();window.history.replaceState(null,``,`#/activity${n?`?${n}`:``}`)}function le({enabled:e,onToggle:t}){return(0,P.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,P.jsx)(_,{name:`activity`,className:`glyph act-fixed`}),(0,P.jsxs)(`div`,{className:`act-grow`,children:[(0,P.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,P.jsx)(`p`,{className:`dim act-sm act-track-p`,children:`Runs and gate asks below come from the job log and the gate ledger. Turn tracking on to see what each session is doing now.`})]}),(0,P.jsxs)(`div`,{className:`row gap-10 act-fixed act-sm`,children:[(0,P.jsx)(`span`,{id:`act-track-l`,children:`Track live sessions`}),(0,P.jsx)(`div`,{className:`sw-toggle${e?` on`:``}`,role:`switch`,"aria-checked":e,"aria-labelledby":`act-track-l`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.key===` `&&e.preventDefault(),t())}})]})]})}function ue({jobs:e,loading:t}){let n=typeof e?.cap==`number`?e.cap:void 0,r=d(e?.jobs,{days:14,cap:n}),i=p(r.map(e=>e.nodata?`-`:e.n).join(`,`),`scaleY`),a=Math.max(1,...r.map(e=>e.n)),o=r.reduce((e,t)=>e+t.n,0),s=r.find(e=>!e.nodata),c=r.some(e=>e.nodata),l=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${f(e.key)}`).join(`, `)||`none`}.`+(c?s?` Days before ${f(s.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,P.jsxs)(`div`,{className:`act-stat-head`,children:[(0,P.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,P.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,P.jsx)(`p`,{className:`dim act-sm`,children:`Reading the job log…`}):e?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":l,ref:i,children:r.map(e=>e.nodata?(0,P.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,P.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${f(e.key)}: ${e.n}`},e.key):(0,P.jsx)(`i`,{className:`zero`},e.key))}),(0,P.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,P.jsx)(`span`,{children:f(r[0].key)}),(0,P.jsx)(`span`,{children:f(r[7].key)}),(0,P.jsx)(`span`,{children:`today`})]}),c&&(0,P.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,P.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function de({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,P.jsxs)(`div`,{className:`act-stat-head`,children:[(0,P.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,P.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,P.jsx)(`p`,{className:`dim act-sm`,children:`Reading the gate ledger…`}):e.length?(0,P.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,P.jsxs)(`li`,{children:[(0,P.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,P.jsx)(m,{vals:e.per_day,i:t,sweep:!0}),(0,P.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,P.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var Z={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function fe({job:e,longest:t}){let n=l(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=Z[e.status]||[``,e.status||`…`],o=e.status===`running`?`Still running`:r?`Took ${r} second${r===1?``:`s`}`:`No duration`,s=e.started?new Date(e.started*1e3).toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`}):`—`;return(0,P.jsxs)(`li`,{className:`act-row`,children:[(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:s}),(0,P.jsx)(_,{name:`play`,className:`glyph act-glyph`}),(0,P.jsxs)(`span`,{className:`act-what`,children:[(0,P.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,P.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,P.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":o,children:(0,P.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,P.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function pe({gate:e}){return(0,P.jsxs)(`li`,{className:`act-row gate`,children:[(0,P.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,P.jsx)(_,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,P.jsxs)(`span`,{className:`act-what`,children:[(0,P.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,P.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,P.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var Q=5,$=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function me(){let[e,t]=(0,N.useState)(null),[n,a]=(0,N.useState)(``),[o,c]=(0,N.useState)(se),[l,d]=(0,N.useState)(!1),[f,m]=(0,N.useState)(``),h=(0,N.useRef)(null),_=e=>{let t={...o,...e};c(t),ce(t)};ie(e=>r.activity().then(n=>{if(e()){t(n),a(``);let e=oe(h,n?.activity);e&&m(t=>t===e?e+`\xA0`:e)}},t=>{e()&&a(t.message)}),2e3,[]);let b=v(()=>q(r.jobs()),[]),S=v(()=>q(r.gates()),[]),C=v(()=>q(r.catalog(`laws`)),[]),w=!e||e.enabled!==!1,T=[...e?.activity||[]].sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),E=i(),D=w&&e?T.filter(g).length:null,O=new Set(T.map(e=>e.session_id)),k=(e?.ended||[]).filter(e=>!O.has(e.session_id)),A=$([...T,...k].map(e=>e.host),o.host),j=$([...T,...k].map(e=>s(e.cwd)),o.project),M=o.host&&o.project?`host or project`:o.host?`host`:o.project?`project`:``,F=e=>(!o.host||e.host===o.host)&&(!o.project||s(e.cwd)===o.project),I=T.filter(e=>F(e)&&(o.f!==`needs`||g(e))),L=o.f===`all`||o.f===`needs`,R=o.f===`all`&&w?k.filter(F):[],z=l?R:R.slice(0,Q),B=!M&&(o.f===`all`||o.f===`runs`),V=!M&&(o.f===`all`||o.f===`gates`),H=b.data?.jobs||[],U=y(S.data,C.data),W=re(H,U,S.data?.days).map(e=>({...e,runs:B?e.runs:[],gate:V?e.gate:null})).filter(e=>e.runs.length||e.gate),G=Math.max(0,...H.map(e=>e.duration||0)),K=p(W.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),Y=async()=>{let e=!w;try{let n=await r.activityToggle(e);if(n.ok===!1){a(n.error||`Could not change tracking`);return}t(e=>({...e||{},enabled:n.enabled,activity:n.enabled&&e?.activity||[],ended:n.enabled&&e?.ended||[]})),a(``)}catch(e){a(e.message)}},Z=(e,t,n)=>(0,P.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,P.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,P.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:o[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>_({[e]:t.target.value}),children:[(0,P.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))]})]});return(0,P.jsxs)(`div`,{className:`page-fill`,children:[(0,P.jsx)(ee,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,P.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:f}),n&&(0,P.jsx)(`div`,{className:`act-gap`,children:(0,P.jsx)(u,{error:n})}),e&&(0,P.jsx)(le,{enabled:w,onToggle:Y}),(0,P.jsxs)(`div`,{className:`act-today`,children:[(0,P.jsx)(ue,{jobs:b.data,loading:b.loading}),(0,P.jsx)(de,{rows:U,gates:S.data,loading:S.loading}),(0,P.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,P.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),(0,P.jsxs)(`span`,{className:`act-big act-wait`,children:[D??`—`,` `,(0,P.jsx)(`span`,{className:`dim act-sm`,children:`sessions`})]}),(0,P.jsx)(`p`,{className:`dim act-sm`,children:w?`A session that waits on an approval or on your answer counts here.`:`Turn tracking on to count the sessions that wait on you.`})]})]}),(0,P.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,P.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:X.map(([e,t])=>(0,P.jsxs)(`button`,{type:`button`,className:o.f===e?`chip-f on`:`chip-f`,"aria-pressed":o.f===e,onClick:()=>_({f:e}),children:[t,e===`needs`&&D>0?(0,P.jsxs)(`span`,{className:`mono`,children:[` `,D]}):null]},e))}),Z(`host`,`Host`,A),Z(`project`,`Project`,j),(0,P.jsx)(ne,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,P.jsx)(`button`,{type:`button`,className:o.v===e?`on`:``,"aria-pressed":o.v===e,onClick:()=>_({v:e}),children:t},e))})]}),M&&o.f!==`needs`&&(0,P.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,M,`; showing sessions only.`]}),L&&(e?!w&&o.f!==`needs`?null:I.length===0?o.f===`needs`?(0,P.jsx)(x,{title:`Nothing waits on you`}):(0,P.jsxs)(x,{title:`No active sessions`,children:[`Run `,(0,P.jsx)(`code`,{children:`opencode`}),` and the sessions it spins up appear here.`]}):o.v===`garden`?(0,P.jsx)(ae,{sessions:I,collisions:e.collisions}):(0,P.jsx)(`div`,{className:`stack gap-12 act-live`,ref:E,children:I.map(e=>(0,P.jsx)(`div`,{"data-flip":e.session_id,children:(0,P.jsx)(J,{s:e})},e.session_id))}):(0,P.jsx)(te,{label:`Reading live sessions…`})),R.length>0&&(0,P.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,P.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),z.map(e=>(0,P.jsx)(`div`,{children:(0,P.jsx)(J,{s:e})},e.session_id)),R.length>Q&&(0,P.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":l,onClick:()=>d(e=>!e),children:l?`Show fewer`:`Show all ${R.length}`})]}),o.f!==`needs`&&(0,P.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:K,children:W.map(e=>(0,P.jsxs)(`section`,{className:`card act-day`,children:[(0,P.jsxs)(`h3`,{className:`act-day-h`,children:[(0,P.jsx)(`span`,{children:e.title}),(0,P.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,P.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,P.jsx)(fe,{job:e,longest:G},e.id)),e.gate&&(0,P.jsx)(pe,{gate:e.gate})]})]},e.key))})]})}export{me as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{D as i,J as a,O as o,W as s,Y as c,dt as l,j as u,ot as d,w as f}from"./index-DhNNxhfg.js";import{t as p}from"./EmptyState-1sPNleqv.js";import{d as m,i as h,o as g,r as _,s as v,t as y}from"./Bonsai-CN4rRAHc.js";import{t as b}from"./usePoll-bDFN-Hr6.js";var x=e(t(),1),S=n();function C(e){return e.kind===`tool`?e.status===`error`?`bad`:e.status===`completed`?`ok`:`acc`:{retry:`warn`,error:`bad`,subtask:`acc`,text:`acc`}[e.kind]||``}function w({rec:e}){let t=e.who===`you`,n=[];t||(e.kind===`tool`&&e.ms!=null&&n.push(`${(e.ms/1e3).toFixed(1)}s`),e.kind===`step`&&(e.tokens&&n.push(`${o(e.tokens)} tok`),e.cost&&n.push(`$${e.cost.toFixed(2)}`)),e.kind===`subtask`&&e.agent&&n.unshift(e.agent));let r=!t&&(e.kind===`text`||e.kind===`thinking`||e.kind===`step`),i=t?e.text:e.label||e.snippet||e.kind;return(0,S.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,S.jsx)(`span`,{className:`badge act-who ${t?``:`acc`}`,children:t?`you`:`agent`}),(0,S.jsxs)(`div`,{className:`act-grow act-sm`,children:[!t&&(0,S.jsx)(`span`,{className:`feed-dot act-inline-dot ${C(e)||`acc`}`}),e.kind===`thinking`&&(0,S.jsx)(`span`,{className:`dim`,children:`thinking: `}),r?(0,S.jsx)(`span`,{className:`dim`,children:i}):t?i:(0,S.jsx)(`b`,{children:i}),e.error&&(0,S.jsxs)(`span`,{className:`dim`,children:[`: `,e.error]})]}),n.length>0&&(0,S.jsx)(`span`,{className:`dim mono act-xs act-fixed`,children:n.join(` · `)}),e.t?(0,S.jsx)(`time`,{className:`mono dim act-xs act-fixed`,dateTime:new Date(e.t).toISOString(),title:`${l(e.t/1e3)} ago`,children:new Date(e.t).toTimeString().slice(0,8)}):null]})}function T({turns:e}){return!e||e.length===0?(0,S.jsx)(`div`,{className:`dim act-sm`,children:`No conversation captured yet.`}):(0,S.jsx)(`div`,{className:`stack gap-12`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,S.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,S.jsx)(`span`,{className:`badge act-who ${n?``:`acc`}`,children:n?`you`:`agent`}),(0,S.jsx)(`div`,{className:`act-min act-sm${n?``:` muted`}`,children:e.text})]},t)})})}var E=5;function D({s:e}){let[t]=(0,x.useState)(h),[n,r]=(0,x.useState)(null),i=!!e.ended,a=i?{...e,status:u(e)?`busy`:e.status,error:null}:e,o=m(a,t),s=(0,x.useMemo)(()=>v(a,{sakura:t}),[o]),c=(0,x.useCallback)(e=>r(e),[]),l=g(e),d=Number(e.turns)||0,f=Number(e.compactions)||0,p=[`${d} turn${d===1?``:`s`}`,`context ${l==null?`unknown`:`${Math.round(l*100)} %`}`,`${f} compaction${f===1?``:`s`}`,`sub-agents: ${s.pads.filter(e=>e.key!=null).length} ${i?`unfinished`:`running`}, ${s.fallen.length} finished`].join(` · `),b=n==null?null:s.pads[n];return(0,S.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!i&&u(e)?` gd-needs`:``}`,children:[(0,S.jsx)(_,{t:s,pad:n,swaying:!i&&e.status!==`idle`,onPad:c,px:E,label:`Bonsai of this session${i?`, ended`:``}: ${p}`}),(0,S.jsxs)(`div`,{className:`stack gap-8 act-min`,children:[i&&(0,S.jsx)(`span`,{className:`dim act-xs`,children:`ended`}),(0,S.jsx)(`div`,{className:`dim act-sm`,children:p}),b?(0,S.jsx)(y,{pad:b}):(0,S.jsx)(`div`,{className:`dim act-xs`,children:`Hover a pad for the files it changed.`})]})]})}function O({sid:e}){let[t,n]=(0,x.useState)(null),[o,u]=(0,x.useState)(``),[m,h]=(0,x.useState)(!1),[g,_]=(0,x.useState)(!1),v=(0,x.useId)();b(t=>m?void 0:r.activityDetail(e).then(e=>{t()&&(n(e),u(``),h(!1))},e=>{t()&&(e.status===404?h(!0):u(e.message))}),2e3,[e,m]);let y=(0,S.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,S.jsx)(d,{name:`arrow`}),` Activity`]});if(m)return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,(0,S.jsx)(p,{title:`Session ended`,action:(0,S.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!t)return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,o?(0,S.jsx)(a,{error:o}):(0,S.jsx)(c,{label:`Loading session…`})]});let C=t.session,E=C.files,O=C.todos,k=!!(E&&E.items&&E.items.length>0),A=!!(O&&O.items&&O.items.length>0),j=t.conversation||[],M=t.timeline||[],N=[...j.filter(e=>e.role===`user`).map(e=>({who:`you`,text:e.text,t:e.t||0})),...M.map(e=>({...e,who:`agent`}))].sort((e,t)=>(e.t||0)-(t.t||0));return(0,S.jsxs)(`div`,{className:`page-fill`,children:[y,(0,S.jsx)(s,{title:C.title||i(C.cwd)||C.session_id,sub:C.cwd?(0,S.jsx)(`span`,{className:`mono act-cwd`,title:C.cwd,children:C.cwd}):null}),o&&(0,S.jsx)(`div`,{className:`act-gap`,children:(0,S.jsx)(a,{error:o})}),(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(f,{s:C}),(0,S.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,l(C.updated_at),` ago`]})]}),(0,S.jsx)(D,{s:C}),(k||A)&&(0,S.jsxs)(`div`,{className:`grid gap-12 act-panels${k&&A?` two`:``}`,children:[k&&(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(`div`,{className:`card-head`,children:(0,S.jsxs)(`h2`,{children:[`Files touched `,(0,S.jsxs)(`span`,{className:`dim`,children:[`(`,E.count,`)`]})]})}),(0,S.jsx)(`div`,{className:`stack act-list`,children:E.items.map(e=>(0,S.jsxs)(`div`,{className:`row between gap-12 act-sm`,children:[(0,S.jsx)(`span`,{className:`mono act-ell act-grow`,title:e.file,children:e.file}),(0,S.jsxs)(`span`,{className:`act-fixed`,children:[(0,S.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions]}),` `,(0,S.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions]})]})]},e.file))})]}),A&&(0,S.jsxs)(`div`,{className:`card pad-md`,children:[(0,S.jsx)(`div`,{className:`card-head`,children:(0,S.jsxs)(`h2`,{children:[`Plan`,` `,(0,S.jsxs)(`span`,{className:`dim`,children:[`(`,O.done,`/`,O.total,`)`]})]})}),(0,S.jsx)(`div`,{className:`stack act-list`,children:O.items.map((e,t)=>(0,S.jsxs)(`div`,{className:`row gap-8 act-sm`,children:[(0,S.jsx)(`span`,{className:`feed-dot ${e.status===`completed`?`ok`:e.status===`in_progress`?`acc`:``}`}),(0,S.jsx)(`span`,{className:e.status===`completed`?`act-done`:void 0,children:e.content})]},t))})]})]}),(0,S.jsxs)(`div`,{className:`card pad-md act-mt`,children:[(0,S.jsxs)(`div`,{className:`card-head act-tl-head`,children:[(0,S.jsx)(`h2`,{children:`Timeline`}),M.length>0&&(0,S.jsx)(`button`,{className:`btn ghost sm`,"aria-expanded":g,"aria-controls":v,onClick:()=>_(e=>!e),children:g?`Show conversation`:`Show full stream (${N.length})`})]}),(0,S.jsx)(`div`,{id:v,children:g?(0,S.jsx)(`div`,{className:`stack gap-12`,children:N.map((e,t)=>(0,S.jsx)(w,{rec:e},t))}):(0,S.jsx)(T,{turns:j})})]})]})}export{D as SessionTree,O as default};
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{n as i}from"./motion-CXaUMNkg.js";import{J as a,Q as o,W as s,X as c,Y as l,Z as u,_t as d,at as f,ct as p,dt as m,gt as h,ht as g,it as _,mt as v,nt as y,ot as b,pt as x,rt as S,st as C,yt as w,z as T}from"./index-DhNNxhfg.js";import{t as E}from"./EmptyState-1sPNleqv.js";import{t as D}from"./Tabs-DaExAgql.js";import{c as O,i as k,l as A,n as j,o as M,s as N,t as P}from"./KitApply-BN2Az7dc.js";var F=e(t(),1),I=n();function ee({host:e,theme:t,options:n,onAction:i,onClose:a,onNote:o}){let[s,c]=(0,F.useState)({path:``,host:e,theme:t,footprint:`lean`,posture:`peer`,mode:`direct`,trust:`balanced`}),[l,u]=(0,F.useState)(!1),[d,f]=(0,F.useState)(``),p=(e,t)=>c(n=>({...n,[e]:t})),m=async()=>{u(!0),o(``);try{let e=await r.pickFolder();e.path?(p(`path`,e.path),f(``)):e.error&&o(e.error)}catch(e){o(e.message)}finally{u(!1)}},h=async()=>{let e=s.path.trim();if(!e){f(`Choose or type a folder to deploy into.`);return}f(``),o(``),await i?.(`deploy`,{host:s.host,path:e,theme:s.theme,footprint:s.footprint,posture:s.posture,mode:s.mode,trust:s.trust})&&a()};return(0,I.jsxs)(`div`,{className:`deploy-pop`,children:[(0,I.jsxs)(`div`,{className:`dp-row`,children:[(0,I.jsx)(`input`,{className:`inp dp-path`,type:`text`,placeholder:`/path/to/project, or click Browse…`,value:s.path,onChange:e=>{p(`path`,e.target.value),f(``)},onKeyDown:e=>e.key===`Enter`&&h(),"aria-label":`Folder to deploy into`,"aria-invalid":d?!0:void 0,"aria-describedby":d?`dp-path-err`:void 0}),(0,I.jsx)(`button`,{className:`btn ghost sm`,disabled:l,onClick:m,children:l?`Choosing…`:`Browse…`})]}),d?(0,I.jsx)(`p`,{id:`dp-path-err`,className:`tag bad note`,role:`alert`,children:d}):null,(0,I.jsxs)(`div`,{className:`dp-row`,children:[(0,I.jsxs)(`label`,{className:`dp-field`,children:[(0,I.jsx)(`span`,{children:`Deploy as`}),(0,I.jsx)(`select`,{className:`sel`,"aria-label":`host for the new harness`,value:s.host,onChange:e=>p(`host`,e.target.value),children:y.map(e=>(0,I.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,I.jsx)(O,{value:s,options:n,onChange:p,who:`the new harness`}),(0,I.jsx)(`button`,{className:`btn ghost sm`,onClick:h,children:`Deploy`}),(0,I.jsx)(`button`,{className:`btn ghost sm`,onClick:a,children:`Cancel`})]}),(0,I.jsxs)(`p`,{className:`sub dp-note`,children:[`Adds a per-repo harness (`,(0,I.jsx)(`code`,{children:S(s.host).deployAdds}),`) into the folder, non-destructively. It’s then tracked here even after you leave its directory.`]})]})}function L(){let{data:e,error:t,reload:n}=x(()=>r.excludes(),[]),[i,a]=(0,F.useState)(!1),[o,s]=(0,F.useState)([]),c=async(e,t)=>{a(!0);try{let n=await r.excludeMutate(e,t);s(n.messages||[])}catch(e){s(e.body?.messages||[e.message])}finally{a(!1),n()}};return t||!e?.installs?.length?null:(0,I.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,I.jsx)(`div`,{className:`card-head`,children:(0,I.jsx)(`h3`,{children:`Excluded folders`})}),(0,I.jsx)(`p`,{className:`sub mb-16`,children:`Sovereign repos: inside these folders every global harness goes dormant — hooks stay silent and the global preamble is not loaded.`}),(e.excludes||[]).map(e=>(0,I.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,I.jsx)(`code`,{children:e.path}),(0,I.jsx)(`span`,{className:`mono muted`,children:e.hosts.map(e=>S(e).label).join(`, `)}),(0,I.jsx)(`button`,{className:`btn ghost sm`,disabled:i,"aria-label":`Stop excluding ${e.path}`,onClick:()=>c(`remove`,e.path),children:`Remove`})]},e.path)),(0,I.jsxs)(`button`,{className:`btn ghost sm`,disabled:i,onClick:async()=>{a(!0);try{let e=await r.pickFolder();e.path?await c(`add`,e.path):e.error&&s([e.error])}catch(e){s([e.message])}finally{a(!1)}},children:[(0,I.jsx)(b,{name:`folder`}),` Exclude a folder…`]}),o.map((e,t)=>(0,I.jsx)(`p`,{className:`sub`,children:e},t))]})}function R({targets:e,onReveal:t}){let n=e.flatMap(e=>e.servers);return(0,I.jsxs)(`div`,{className:`ip-block`,children:[(0,I.jsxs)(`span`,{className:`ip-label`,children:[`MCP servers `,(0,I.jsx)(`span`,{className:`mono dim`,children:n.length})]}),e.map(e=>(0,I.jsxs)(`div`,{className:`mcp-target`,children:[(0,I.jsxs)(`div`,{className:`mt-head`,children:[(0,I.jsx)(`code`,{title:e.path,children:e.label}),e.exists?(0,I.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>t(e),"aria-label":`Open the folder holding ${e.label}`,title:`Open the folder holding ${e.path} to edit it`,children:`Open folder`}):null]}),e.exists?e.servers.length?e.servers.map(e=>(0,I.jsxs)(`div`,{className:`mcp-row`,children:[(0,I.jsx)(`span`,{className:`mono`,children:e.name}),(0,I.jsx)(`span`,{className:`tag ${e.state===`enabled`?`ok`:`warn`}`,children:e.state===`enabled`?`Enabled`:`Disabled`})]},e.name)):(0,I.jsx)(`p`,{className:`sub`,children:`None configured in this file.`}):(0,I.jsxs)(`p`,{className:`sub`,children:[`No MCP file yet (it would be `,(0,I.jsx)(`code`,{children:e.path}),`).`]})]},e.path))]})}var z={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`],absent:[`Not installed`,``]};function te({inst:e,targets:t,choice:n,unchanged:r,options:i,onPick:a,canAct:o,busy:s,memory:c,onMemory:l,onApply:u,onToggleInstall:d,onRemove:f,onRevealMcp:p}){let m=`${S(e.host).label} · ${e.scope}`,[h,g]=z[e.state]||z.absent,v=e.state===`active`,y=e.state===`absent`;return(0,I.jsxs)(`aside`,{className:`install-panel`,"aria-label":`${m} install`,children:[(0,I.jsx)(`span`,{className:`ip-eyebrow`,children:`Selected install`}),(0,I.jsxs)(`div`,{className:`ip-head`,children:[(0,I.jsx)(`h2`,{children:_(e)}),(0,I.jsx)(`span`,{className:`tag ${g}`,children:h})]}),(0,I.jsx)(`span`,{className:`ip-kind`,children:e.scope===`global`?`Global install`:`Per-project install · ${S(e.host).label}`}),(0,I.jsx)(`code`,{className:`ip-path`,children:e.path}),y?(0,I.jsxs)(`p`,{className:`sub`,children:[`Install Geneseed here as `,(0,I.jsx)(`strong`,{children:S(e.host).label}),`. Files are added non-destructively; deactivate or uninstall later.`]}):null,(v||y)&&o?(0,I.jsx)(`div`,{className:`ip-picks`,children:(0,I.jsx)(O,{value:n,options:i,onChange:a,who:m})}):null,v&&t.length?(0,I.jsx)(R,{targets:t,onReveal:p}):null,v&&e.scope===`global`?(0,I.jsx)(L,{}):null,y?null:(0,I.jsxs)(`label`,{className:`ip-switch`,children:[(0,I.jsx)(A,{on:v,disabled:s,label:`activate ${m}`,onToggle:d}),(0,I.jsx)(`span`,{children:v?`Active: loads in every session`:`Disabled: files moved aside`})]}),(0,I.jsx)(`div`,{className:`ip-spacer`}),o?(0,I.jsxs)(`div`,{className:`ip-actions`,children:[y?(0,I.jsx)(`button`,{type:`button`,className:`btn`,onClick:u,children:`Install`}):v?(0,I.jsx)(`button`,{type:`button`,className:`btn`,disabled:r,onClick:u,children:`Apply and rebuild`}):null,y?null:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`label`,{className:`field`,children:[(0,I.jsx)(`span`,{children:`On uninstall, memory and notebook`}),(0,I.jsxs)(`select`,{className:`sel`,value:c,onChange:e=>l(e.target.value),children:[(0,I.jsx)(`option`,{value:`keep`,children:`keep in place`}),(0,I.jsx)(`option`,{value:`archive`,children:`archive aside`}),(0,I.jsx)(`option`,{value:`delete`,children:`delete too`})]})]}),(0,I.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,"aria-label":`remove ${m} from ${e.path}`,disabled:s,onClick:f,children:`Uninstall…`})]})]}):null]})}var B=(e,t)=>`${e} ${t}`,ne=[`claude`,`bob`,`openclaude`],V={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},H=/[\\/]\.claude[\\/]worktrees[\\/]/,U=e=>e.scope===`project`&&H.test(e.path);function re(e,t){let n=e.drift?.stale??0,r={behind:`Behind ${t||`source`}`+(n?` · ${n} file${n===1?``:`s`}`:``),synced:`In sync`,unknown:`Not checked`}[e.verdict],i=e.diffable?p(e.drift):0;return i?`${r} · ${i} edited`:r}function W({inst:e,fleet:t,version:n,onEdits:r}){if(t===void 0)return(0,I.jsx)(`span`,{className:`dim`,children:`…`});if(!t)return(0,I.jsx)(`span`,{className:`dim`,children:`—`});let i=t.drift?.stale??0,a=t.diffable?p(t.drift):0;return(0,I.jsxs)(`div`,{className:`sync-cell`,children:[t.diffable&&i+a>0?(0,I.jsx)(T,{label:`Sync with source of ${_(e)}`,parts:[{key:`stale`,label:`behind source`,n:i,tone:`warn`},{key:`edited`,label:`edited by hand`,n:a,tone:`bad`}]}):null,(0,I.jsx)(`span`,{className:`dim`,children:re(t,n)}),t.diffable?null:(0,I.jsxs)(`span`,{className:`dim`,title:`Drift is only checked for global installs`,children:[` `,`· not checkable`]}),a?(0,I.jsxs)(I.Fragment,{children:[` `,(0,I.jsx)(`a`,{href:`#/installs/edits`,onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e)},children:`Local edits`})]}):null]})}function ie({rows:e,project:t,currentId:n,onPick:r,label:i,fleet:a,onEdits:o}){let s=e=>a===void 0?void 0:a?.installs?.find(t=>t.id===e.id)||null;return(0,I.jsx)(`div`,{className:`tbl-scroll`,children:(0,I.jsxs)(`table`,{className:`tbl hosts-tbl`,"aria-label":i,children:[(0,I.jsx)(`thead`,{children:(0,I.jsxs)(`tr`,{children:[(0,I.jsx)(`th`,{scope:`col`,children:t?`Project`:`Host`}),(0,I.jsx)(`th`,{scope:`col`,children:t?`Host`:`Path`}),(0,I.jsx)(`th`,{scope:`col`,children:`Voice`}),(0,I.jsx)(`th`,{scope:`col`,children:`Footprint`}),(0,I.jsx)(`th`,{scope:`col`,children:`State`}),(0,I.jsx)(`th`,{scope:`col`,children:`Sync with source`}),(0,I.jsx)(`th`,{scope:`col`,children:(0,I.jsx)(`span`,{className:`sr-only`,children:`Selected`})})]})}),(0,I.jsx)(`tbody`,{children:e.map(e=>{let[i,c]=V[e.state]||[`Not installed`,``],l=n===e.id,u=e.state===`absent`;return(0,I.jsxs)(`tr`,{className:`pickable${l?` on`:``}${u?` quiet`:``}`,onClick:()=>r(e.id),children:[(0,I.jsx)(`td`,{children:(0,I.jsx)(`button`,{type:`button`,className:`row-pick`,"aria-pressed":l,title:e.path,onClick:()=>r(e.id),children:_(e)})}),t?(0,I.jsx)(`td`,{children:S(e.host).label}):(0,I.jsx)(`td`,{className:`mono path-cell`,title:e.path,children:e.path}),(0,I.jsx)(`td`,{children:u?``:e.theme||``}),(0,I.jsx)(`td`,{children:u?``:e.footprint||``}),(0,I.jsxs)(`td`,{children:[(0,I.jsx)(`span`,{className:`tag ${c}`,children:i}),U(e)?(0,I.jsxs)(I.Fragment,{children:[` `,(0,I.jsx)(`span`,{className:`tag warn`,title:`Inside a .claude/worktrees folder: likely a finished worktree. Remove it from its panel.`,children:`Worktree leftover`})]}):null]}),(0,I.jsx)(`td`,{children:(0,I.jsx)(W,{inst:e,fleet:s(e),version:a?.version,onEdits:o})}),(0,I.jsx)(`td`,{className:`pick-mark`,children:l?`Editing ›`:``})]},e.id)})})]})})}function ae({themes:e,current:t}){if(!e.length||!t)return null;let n=[...e].sort((e,n)=>e.name===t?-1:+(n.name===t));return(0,I.jsxs)(`details`,{className:`panel voice-ref`,children:[(0,I.jsxs)(`summary`,{children:[(0,I.jsx)(`span`,{className:`vr-title`,children:`Voices`}),(0,I.jsxs)(`span`,{className:`mono dim`,children:[e.length,` to choose from, set per install`]})]}),(0,I.jsx)(`div`,{className:`vr-list`,children:n.map(e=>(0,I.jsxs)(`div`,{className:`voice-row${e.name===t?` current`:``}`,children:[(0,I.jsx)(`span`,{className:`vr-name`,children:e.name}),(0,I.jsx)(`span`,{className:`vr-desc`,children:e.tagline?`“${e.tagline}”`:e.blurb})]},e.name))})]})}function oe({setup:e,overview:t}){if(!e)return null;let n=e.installed_fp&&e.installed_fp===e.source_fp;return(0,I.jsxs)(`section`,{className:`panel`,"aria-labelledby":`checkout-h`,children:[(0,I.jsxs)(`div`,{className:`panel-head`,children:[(0,I.jsx)(`h2`,{id:`checkout-h`,children:`This checkout`}),(0,I.jsx)(`span`,{className:`mono ${n?`t-good`:`t-warn`}`,children:e.version_verdict})]}),(0,I.jsxs)(`dl`,{className:`kv-grid`,children:[(0,I.jsx)(`dt`,{children:`Source`}),(0,I.jsx)(`dd`,{className:`mono`,children:e.root}),(0,I.jsx)(`dt`,{children:`Version`}),(0,I.jsx)(`dd`,{className:`mono`,children:t?.version||`unknown`}),(0,I.jsx)(`dt`,{children:`Fingerprint`}),(0,I.jsx)(`dd`,{className:`mono`,children:e.source_fp})]})]})}function G({onAction:e,themes:t=[],currentTheme:n,overview:i,setup:s,dataRev:c,onMutated:u}){let d=o(),{data:p,error:m,reload:h}=x(()=>r.installs(),[c]),{data:g,error:v,reload:y}=x(()=>r.mcp(),[c]),{data:C,error:w}=x(()=>r.fleet(),[c]),T=w?null:C??void 0,[D,O]=(0,F.useState)(null),[k,A]=(0,F.useState)(``),[j,M]=(0,F.useState)({}),[P,L]=(0,F.useState)(!1),[R,z]=(0,F.useState)({id:``,value:`keep`}),V=e=>R.id===e?.id?R.value:`keep`,[H,U]=(0,F.useState)(``),re=(0,F.useMemo)(()=>{let e={};for(let t of g?.targets||[]){let n=B(t.host||`opencode`,t.root);(e[n]||(e[n]=[])).push(t)}return e},[g]);if(m||v)return(0,I.jsx)(a,{error:m||v,onRetry:()=>{h(),y()}});if(!p||!g)return(0,I.jsx)(l,{});let W={active:0,disabled:1,absent:2},G=[...p.installs].sort((e,t)=>(e.scope===`global`?0:1)-(t.scope===`global`?0:1)||(W[e.state]??3)-(W[t.state]??3)),K=G.find(e=>e.id===H)||G.find(e=>e.selected)||G.find(e=>e.state===`active`)||G[0],q=e=>{let t=j[e.id]||{};return{theme:t.theme||e.theme||n||`neutral`,footprint:t.footprint||e.state!==`absent`&&e.footprint||`lean`,posture:t.posture||e.posture||`peer`,mode:t.mode||e.mode||`direct`,trust:t.trust||e.trust||`balanced`}},se=(e,t,n)=>M(r=>({...r,[e.id]:{...r[e.id],[t]:n}})),ce=e=>{let t=q(e);return t.theme===e.theme&&t.footprint===(e.footprint||`lean`)&&t.posture===(e.posture||`peer`)&&t.mode===(e.mode||`direct`)&&t.trust===(e.trust||`balanced`)},J={theme:t.map(e=>e.name),footprint:N,posture:p.postures||[],mode:p.modes||[],trust:p.trusts||[]},le=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o}=q(t),s=S(t.host).label,c=`${r} footprint, ${i} posture, ${a} mode, ${o} loop trust`,l=t.state===`absent`?`Install Geneseed for ${s} into ${t.path} with the “${n}” voice (${c})? Files are added non-destructively (your own config is left untouched); deactivate or uninstall later.`:`Rebuild this ${s} install (voice “${n}”, ${c})? It rebuilds in place, non-destructive.`;await d(l,{title:t.state===`absent`?`Install Geneseed?`:`Rebuild this install?`,confirmLabel:t.state===`absent`?`Install`:`Rebuild`})&&e?.(`install`,{host:t.host,scope:t.scope,path:t.path,theme:n,footprint:r,posture:i,mode:a,trust:o})},ue=async e=>{if(e.state!==`active`||await d(`Deactivate this install? Files are moved aside, not deleted; reactivate any time.`,{title:`Deactivate this install?`,confirmLabel:`Deactivate`})){A(e.id),O(null);try{let t=await r.installToggle(e.host,e.path,e.state===`active`?`deactivate`:`activate`);if(!t.ok){let e=Array.isArray(t.failed)?t.failed.join(`, `):``;O({text:t.error||e&&`unrestored: ${e}`||`action failed`,tone:`bad`});return}u?.()}catch(e){O({text:e.message,tone:`bad`})}finally{A(``)}}},Y=(e,t)=>{let n=e.path.includes(`\\`)&&!e.path.includes(`/`)?`\\`:`/`,r=e.path.replace(/[\\/]+$/,``);return`${e.scope===`project`&&ne.includes(e.host)?`${r}${n}.${e.host}`:r}${n}${t}`},de=async e=>{let t=V(e),n=e.scope===`project`?` and de-lists it`:`; the row stays, marked “not installed”`,i=t===`delete`?`, and permanently deletes ${Y(e,`memory`)} and ${Y(e,`notebook`)}`:t===`archive`?`; memory and notebook are archived aside`:`; memory and notebook stay in place`;if(await d(`Uninstall ${S(e.host).label} · ${e.scope}? It deletes ${f(e.host,e.scope)}${n}${i}. This can’t be undone.`,{title:e.scope===`project`?`Remove this harness?`:`Remove the global install?`,confirmLabel:t===`delete`?`Remove and delete memory`:`Remove`,tone:`danger`})){A(e.id),O(null);try{let n=await r.installRemove(e.host,e.path,t);if(!n.ok){O({text:n.error||`remove failed`,tone:`bad`});return}z({id:``,value:`keep`}),n.kept?.length&&O({text:`Removed. Kept ${n.kept.length} file(s) you edited: ${n.kept.join(`, `)} — they are yours now (the CLI geneseed uninstall --force deletes edited files too).`,tone:`ok`}),u?.()}catch(e){O({text:e.message,tone:`bad`})}finally{A(``)}}},fe=async e=>{O(null);try{let t=await r.mcpReveal(e.path);O({text:`Opening ${t.dir}. If no window appeared, open that folder by hand.`,tone:``})}catch(e){O({text:e.message,tone:`bad`})}},pe=async()=>{let t=G.filter(e=>e.state===`active`).map(e=>`${_(e)} · ${e.scope}`);await d(`Rebuild every active install: ${t.join(`, `)||`none`}? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&e(`build-all`)},me=G.find(e=>e.selected)?.host||G.find(e=>e.state===`active`)?.host||G[0]?.host||`opencode`,X=G.filter(e=>e.scope===`global`),Z=G.filter(e=>e.scope!==`global`),Q=e=>{U(e)},$=async e=>{if(!e.selected){try{await r.selectView(e.host,e.path)}catch{}u?.()}window.location.hash=`#/installs/edits`};return(0,I.jsxs)(`div`,{className:`hosts`,children:[(0,I.jsxs)(`div`,{className:`hosts-main`,children:[(0,I.jsxs)(`div`,{className:`toolbar`,children:[(0,I.jsxs)(`span`,{className:`dim`,children:[G.filter(e=>e.state===`active`).length,` active of `,G.length,` `,`detected.`]}),e?(0,I.jsx)(`div`,{className:`row gap-8`,children:(0,I.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:pe,children:[(0,I.jsx)(b,{name:`refresh`}),` Rebuild all`]})}):null]}),D?.tone===`bad`?(0,I.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:D.text}):D?(0,I.jsx)(`p`,{className:`tag ${D.tone===`ok`?`ok `:``}note`,role:`status`,children:D.text}):null,(0,I.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-global`,children:[(0,I.jsx)(`div`,{className:`inst-head`,children:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{id:`inst-global`,children:`Global installs`}),(0,I.jsx)(`p`,{className:`dim`,children:`One per tool. Loaded in every folder, except excluded ones.`})]})}),(0,I.jsx)(ie,{rows:X,currentId:K?.id,onPick:Q,label:`Global installs`,fleet:T,onEdits:$})]}),(0,I.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-project`,children:[(0,I.jsxs)(`div`,{className:`inst-head`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{id:`inst-project`,children:`Per-project installs`}),(0,I.jsx)(`p`,{className:`dim`,children:`A repo with its own harness. Inside it, only that harness loads.`})]}),e?(0,I.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>L(e=>!e),children:[(0,I.jsx)(b,{name:`folder`}),` Deploy to a repo…`]}):null]}),P?(0,I.jsx)(`div`,{className:`inst-deploy`,children:(0,I.jsx)(ee,{host:me,theme:n||`neutral`,options:J,onAction:e,onClose:()=>L(!1),onNote:e=>O(e?{text:e,tone:`bad`}:null)})}):null,Z.length?(0,I.jsx)(ie,{rows:Z,project:!0,currentId:K?.id,onPick:Q,label:`Per-project installs`,fleet:T,onEdits:$}):(0,I.jsx)(E,{children:`No repo has its own harness yet. Deploy one to give a project its own rules and voice.`})]}),(0,I.jsx)(oe,{setup:s,overview:i}),(0,I.jsx)(ae,{themes:t,current:i?.theme})]}),K?(0,I.jsx)(te,{inst:K,targets:re[B(K.host,K.path)]||[],choice:q(K),unchanged:ce(K),options:J,onPick:(e,t)=>se(K,e,t),canAct:!!e,busy:k===K.id,memory:V(K),onMemory:e=>z({id:K.id,value:e}),onApply:()=>le(K),onToggleInstall:()=>ue(K),onRemove:()=>de(K),onRevealMcp:fe},K.id):null]})}function K({onAction:e,dataRev:t}){let{data:n,error:i}=x(()=>r.kits(),[t]),o=M(n,e);return i||n?.error?(0,I.jsx)(a,{error:i||n.error}):n?n.installs.length?n.kits.length?(0,I.jsx)(`div`,{className:`kits-tab`,children:n.installs.map(e=>{let t=k(e),r=o.setOf(e),i=`${e.host} · ${e.scope}`;return(0,I.jsxs)(`section`,{className:`panel flush`,"aria-label":i,children:[(0,I.jsxs)(`div`,{className:`inst-head`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{children:i}),(0,I.jsx)(`p`,{className:`dim mono`,children:e.path})]}),(0,I.jsx)(j,{row:e})]}),t&&(0,I.jsx)(`p`,{className:`kit-lock`,children:e.reason||e.error}),(0,I.jsx)(`ul`,{className:`kit-list`,children:n.kits.map(n=>(0,I.jsxs)(`li`,{className:`kit-row`,children:[(0,I.jsxs)(`div`,{className:`kit-main`,children:[(0,I.jsx)(`a`,{className:`kit-name`,href:`#/kits/${encodeURIComponent(n.name)}`,children:n.name}),n.description?(0,I.jsx)(`span`,{className:`kit-desc`,children:n.description}):null,(0,I.jsxs)(`span`,{className:`mono dim`,children:[(n.skills||[]).length,` skills · `,(n.agents||[]).length,` agents`]})]}),(0,I.jsx)(A,{on:r.has(n.name),disabled:t||o.running(e),label:`${n.name} for ${i}`,onToggle:()=>o.toggle(e,n.name)})]},n.name))}),Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,I.jsxs)(`p`,{className:`kit-kept mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e)),(0,I.jsx)(P,{row:e,stage:o})]},e.id)})}):(0,I.jsx)(`div`,{className:`empty inst-empty`,children:`This Geneseed ships no kit.`}):(0,I.jsx)(`div`,{className:`empty inst-empty`,children:`No install yet.`}):(0,I.jsx)(l,{})}function q(e){return e.startsWith(`@@`)||e.startsWith(`+++`)||e.startsWith(`---`)?`hunk`:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`}var se=300;function ce({onMutated:e,onAction:t,dataRev:n,overview:i}){let s=o(),{data:c,error:u,reload:d}=x(()=>r.diff(),[n]),[f,p]=(0,F.useState)(!1),[m,h]=(0,F.useState)(``),[g,_]=(0,F.useState)(()=>new Set),[v,y]=(0,F.useState)(()=>new Set),[S,C]=(0,F.useState)(null);if(c&&c!==S){C(c),_(new Set);let e=c.files.reduce((e,t)=>e+t.diff.length,0);y(new Set(e<=se?c.files.map(e=>e.rel):[]))}let w=e=>_(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),T=()=>_(e=>e.size===k.length?new Set:new Set(k.map(e=>e.rel))),D=()=>t?.(`export`),O=async()=>{let t=[...g],n=t.filter(e=>c.files.find(t=>t.rel===e)?.status===`added`),i=n.length?`Restoring will DELETE ${n.length} deployed-only file(s):\n${n.join(`
2
- `)}\n\n`:``;if(await s(`${i}Discard local edits and restore ${t.length} file(s) from source?`,{title:`Restore from source?`,confirmLabel:`Restore`,tone:`danger`})){p(!0);try{let n=await r.restore(t),i=n.errors.length?` · ${n.errors.length} error(s): ${n.errors.join(`; `)}`:``;h(`Restored ${n.restored.length}, archived ${n.deleted.length}${i}`),await d(),e?.()}catch(e){h(e.message)}finally{p(!1)}}};if(u)return(0,I.jsx)(a,{error:u,onRetry:d});if(!c)return(0,I.jsx)(l,{});if(!c.deployed)return(0,I.jsx)(E,{title:`No deployed harness`,children:`Nothing to diff against.`});if(!c.diffable)return(0,I.jsx)(E,{title:`No drift check for this install`,docs:{href:`#/installs/hosts`,label:`Pick a global install in Hosts`},children:`The drift check covers global installs only.`});let k=c.files.filter(e=>e.status!==`linked`&&e.status!==`stale`),A=c.files.filter(e=>e.status===`linked`),j=c.files.filter(e=>e.status===`stale`),M=k.filter(e=>e.status===`edited`).length,N=k.filter(e=>e.status===`added`).length,P=k.filter(e=>e.status===`missing`).length,ee=e=>y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`h`,children:`Local edits`}),c.target?(0,I.jsxs)(`p`,{className:`sub`,children:[`Comparing `,(0,I.jsx)(`code`,{children:c.target}),c.theme?` (${c.theme} voice)`:``,` with source`,` `,i?.version||`unknown`,`.`]}):null,M>0?(0,I.jsx)(`p`,{className:`sub`,children:`The agent refines its own deployed files in place. A rebuild keeps an edited file, which then stops receiving source updates — export it, then Restore to take the new source.`}):N+P>0?(0,I.jsx)(`p`,{className:`sub`,children:`These files differ from the source: added in the install, or missing from it.`}):null]}),(0,I.jsxs)(`div`,{className:`row gap-10`,children:[(0,I.jsxs)(`button`,{className:`btn ghost danger-line`,disabled:f||g.size===0,onClick:O,children:[`Restore`,g.size?` (${g.size})`:``]}),(0,I.jsxs)(`button`,{className:`btn`,disabled:f,onClick:D,children:[(0,I.jsx)(b,{name:`download`}),`Export improvements`]})]})]}),m?(0,I.jsx)(`p`,{className:`sub mb-14`,children:m}):null,A.length?(0,I.jsxs)(`p`,{className:`sub dim mb-14`,title:A.map(e=>e.rel).join(`
3
- `),children:[A.length,` linked — yours, left alone`]}):null,k.length===0&&j.length===0?(0,I.jsx)(E,{title:`In sync`,children:`Deployed harness matches source.`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`row between mb-14`,children:[(0,I.jsxs)(`div`,{className:`row gap-10`,children:[(0,I.jsxs)(`span`,{className:`badge warn`,children:[(0,I.jsx)(`span`,{className:`dot`}),M,` edited`]}),(0,I.jsxs)(`span`,{className:`badge`,children:[(0,I.jsx)(`span`,{className:`dot`}),N,` added`]}),P>0&&(0,I.jsxs)(`span`,{className:`badge bad`,children:[(0,I.jsx)(`span`,{className:`dot`}),P,` missing`]}),j.length>0&&(0,I.jsxs)(`span`,{className:`badge`,children:[(0,I.jsx)(`span`,{className:`dot`}),j.length,` behind`]})]}),(0,I.jsxs)(`div`,{className:`row gap-10`,children:[(0,I.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>y(new Set(c.files.map(e=>e.rel))),children:`Expand all`}),(0,I.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>y(new Set),children:`Collapse all`}),k.length?(0,I.jsxs)(`label`,{className:`row gap-8 dim sel-all`,children:[(0,I.jsx)(`input`,{type:`checkbox`,checked:g.size===k.length,onChange:T}),`Select all`]}):null]})]}),(0,I.jsx)(`div`,{className:`stack gap-12`,children:k.map(e=>L(e,!0))}),j.length?(0,I.jsxs)(`div`,{className:`stack gap-12 diff-behind`,children:[(0,I.jsx)(`h3`,{children:`Behind source`}),(0,I.jsxs)(`div`,{className:`row between`,children:[(0,I.jsx)(`p`,{className:`sub`,children:`This install is built from older source — rebuild to bring these files up to date.`}),(0,I.jsx)(`button`,{className:`btn ghost`,disabled:f,onClick:()=>t?.(`build-all`),"aria-label":`Rebuild all installs`,children:`Rebuild`})]}),j.map(e=>L(e,!1))]}):null]})]});function L(e,t){let n=v.has(e.rel),r=e.status===`stale`||e.status===`added`?``:e.status===`missing`?`bad`:`warn`;return(0,I.jsxs)(`div`,{className:`card diff-file${n?` open`:``}`,children:[(0,I.jsxs)(`div`,{className:`diff-head`,children:[t?(0,I.jsx)(`input`,{type:`checkbox`,className:`chk`,checked:g.has(e.rel),onChange:()=>w(e.rel),onClick:e=>e.stopPropagation(),"aria-label":`Select ${e.rel}`}):null,(0,I.jsx)(`span`,{className:`fname`,children:e.rel}),(0,I.jsxs)(`span`,{className:`badge ${r}`,children:[(0,I.jsx)(`span`,{className:`dot`}),e.status===`stale`?`behind source`:e.status]}),(0,I.jsxs)(`span`,{className:`dim mono diff-lines`,children:[e.diff.length,` lines`]}),(0,I.jsx)(`button`,{className:`iconbtn`,onClick:()=>ee(e.rel),"aria-label":n?`Collapse ${e.rel}`:`Expand ${e.rel}`,"aria-expanded":n,children:(0,I.jsx)(b,{name:`chevron`})})]}),n&&(0,I.jsx)(`div`,{className:`diff-body`,children:e.diff.map((e,t)=>(0,I.jsx)(`div`,{className:`diff-line ${q(e)}`,children:e},t))})]},e.rel)}}function J({group:e,i:t}){let n=e.problems.length===0,[r,i]=(0,F.useState)(!n);return(0,I.jsxs)(`div`,{className:`card check rise ${n?``:`bad`} ${r?`open`:``}`,style:{"--i":t*.6},children:[(0,I.jsxs)(`button`,{className:`check-head`,onClick:()=>i(e=>!e),disabled:n,"aria-expanded":n?void 0:r,children:[(0,I.jsx)(`span`,{className:`feed-dot ${n?`ok`:`bad`}`}),(0,I.jsx)(`h3`,{children:e.label}),(0,I.jsxs)(`span`,{className:`badge ${n?`ok`:`bad`}`,children:[(0,I.jsx)(`span`,{className:`dot`}),n?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`]}),!n&&(0,I.jsx)(b,{name:`chevron`,className:`chev glyph`})]}),!n&&r&&(0,I.jsx)(`div`,{className:`check-body`,children:e.problems.map(e=>(0,I.jsxs)(`div`,{className:`problem`,children:[(0,I.jsx)(`span`,{className:`x`,children:`✕`}),(0,I.jsx)(`span`,{children:e})]},e))})]})}function le({dataRev:e}){let t=(0,F.useRef)(!1),{data:n,error:i,reload:o,setData:s}=x(()=>{let e=t.current;return t.current=!1,r.doctor(e)},[e]),c=()=>{t.current=!0,s(null),o()};if(i)return(0,I.jsx)(a,{error:i,onRetry:o});let u=n?n.groups.filter(e=>e.problems.length):[],d=n?n.groups.filter(e=>!e.problems.length):[];return(0,I.jsxs)(`div`,{className:`page-fill`,children:[(0,I.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`h`,children:`Doctor`}),(0,I.jsx)(`p`,{className:`sub`,children:`Every check builds each theme in a sandbox and validates the result: token resolution, link integrity, parity, and drift.`})]}),(0,I.jsxs)(`button`,{className:`btn`,onClick:c,disabled:!n,children:[(0,I.jsx)(b,{name:`refresh`}),n?`Re-run checks`:`Running…`]})]}),n?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`div`,{className:`card pad-md mb-16 doc-summary`,children:(0,I.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,I.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,I.jsxs)(`span`,{className:`dim mono`,children:[`validated `,n.themes.length,` theme`,n.themes.length===1?``:`s`]}),n.checked_at?(0,I.jsxs)(`span`,{className:`dim mono`,title:n.checked_at,children:[`checked `,n.checked_at.slice(11)]}):null,n.themes.map(e=>(0,I.jsx)(`span`,{className:`badge cap`,children:e},e))]}),n.ok?(0,I.jsxs)(`span`,{className:`badge ok`,children:[(0,I.jsx)(`span`,{className:`dot`}),`all clean`]}):(0,I.jsxs)(`span`,{className:`badge bad`,children:[(0,I.jsx)(`span`,{className:`dot`}),n.problems.length,` problem`,n.problems.length===1?``:`s`]})]})}),(0,I.jsxs)(`div`,{className:`stack gap-12`,children:[u.map((e,t)=>(0,I.jsx)(J,{group:e,i:t},e.label)),d.length?(0,I.jsxs)(`details`,{className:`check-fold`,children:[(0,I.jsxs)(`summary`,{children:[d.length,` clean check`,d.length===1?``:`s`]}),(0,I.jsx)(`div`,{className:`stack gap-12`,children:d.map((e,t)=>(0,I.jsx)(J,{group:e,i:u.length+t},e.label))})]}):null]})]}):(0,I.jsx)(l,{label:`Running every check (builds each theme in a sandbox)…`})]})}function ue(){let e=o(),[t,n]=(0,F.useState)(!1),[i,s]=(0,F.useState)(null);return t?(0,I.jsxs)(`p`,{className:`sub`,children:[`Server stopped. You can close this tab and reopen any time with `,(0,I.jsx)(`code`,{children:`geneseed web`}),`.`]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a,{error:i}),(0,I.jsxs)(`button`,{className:`btn ghost danger-line`,onClick:async()=>{if(await e(`Stop the local Geneseed server? The console goes offline until you start it again.`,{title:`Stop the server?`,confirmLabel:`Stop server`,tone:`danger`})){s(null);try{await r.shutdown()}catch(e){if(e.status)return s(e.message)}n(!0)}},children:[(0,I.jsx)(b,{name:`x`}),`Stop server`]})]})}function Y(){let e=o(),[t,n]=(0,F.useState)(!1),[r,i]=(0,F.useState)(null);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(a,{error:r}),(0,I.jsxs)(`button`,{className:`btn ghost`,onClick:async()=>{if(await e(`Restart the local Geneseed server? The console reconnects in a moment.`,{title:`Restart the server?`,confirmLabel:`Restart`})){n(!0),i(null);try{await h()}catch(e){i(e.message),n(!1)}}},disabled:t,children:[(0,I.jsx)(b,{name:`refresh`}),t?`Restarting…`:`Restart server`]})]})}var de=`https://github.com/Arylmera/Geneseed`,fe=`https://github.com/Arylmera`,pe=[[`appearance`,`Appearance`],[`machine`,`Machine`],[`server`,`Server`],[`about`,`About`],[`danger`,`Danger zone`]],me=[`Host check`,`token on writes`,`framing refused`,`cross-site GET refused`];function X({k:e,help:t,children:n,control:r}){return(0,I.jsxs)(`div`,{className:`sheet-row`,children:[(0,I.jsxs)(`span`,{className:`sheet-k`,children:[e,t?(0,I.jsx)(`span`,{className:`sheet-h sub`,children:t}):null]}),(0,I.jsx)(`div`,{className:`sheet-v`,children:n}),(0,I.jsx)(`div`,{className:`sheet-c`,children:r})]})}function Z({id:e,title:t,head:n,className:r=``,children:i}){return(0,I.jsxs)(`section`,{id:`set-${e}`,className:`card sheet-sec ${r}`,"aria-labelledby":`${e}-h`,children:[(0,I.jsxs)(`div`,{className:`card-head`,children:[(0,I.jsx)(`h3`,{id:`${e}-h`,children:t}),n]}),i]})}function Q({stale:e}){let t=e=>document.getElementById(`set-${e}`)?.scrollIntoView?.({behavior:i()?`smooth`:`auto`,block:`start`});return(0,I.jsx)(`nav`,{className:`sheet-index`,"aria-label":`On this page`,children:pe.map(([n,r])=>(0,I.jsxs)(`button`,{type:`button`,className:n===`danger`?`t-bad`:``,onClick:()=>t(n),children:[r,n===`server`&&(0,I.jsx)(`span`,{className:`sheet-dot ${e?`warn`:`good`}`,"aria-hidden":`true`})]},n))})}function $({version:e}){let[t,n]=(0,F.useState)(de),[i,a]=(0,F.useState)(!0);(0,F.useEffect)(()=>{Promise.resolve(r.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),a(!!e.repo_is_github))}).catch(()=>{})},[]);let o=(e,t)=>(0,I.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,I.jsx)(b,{name:`external`})]});return(0,I.jsxs)(Z,{id:`about`,title:`About`,children:[(0,I.jsx)(X,{k:`Version`,control:i?o(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,I.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),i?(0,I.jsx)(X,{k:`Credits`,control:o(t+`#-credits`,`Credits`),children:(0,I.jsx)(`span`,{className:`sub`,children:`Skills and agents adapted from other projects, with their licences`})}):null,(0,I.jsx)(X,{k:`Geneseed`,help:`MIT-licensed`,control:(0,I.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,I.jsxs)(`a`,{className:`btn ghost`,href:t,target:`_blank`,rel:`noreferrer`,children:[(0,I.jsx)(b,{name:`github`}),i?`Source on GitHub`:`Source repo`]}),i&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,I.jsx)(b,{name:`external`}),`Issues`]}),(0,I.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,I.jsx)(b,{name:`external`}),`MIT License`]})]})]}),children:(0,I.jsx)(`span`,{className:`sub`,children:`A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent. One canonical source, many voices.`})}),(0,I.jsx)(X,{k:`Creator`,control:(0,I.jsxs)(`a`,{className:`btn ghost`,href:fe,target:`_blank`,rel:`noreferrer`,children:[(0,I.jsx)(b,{name:`github`}),`@Arylmera on GitHub`]}),children:(0,I.jsxs)(`span`,{className:`sub`,children:[`Built by `,(0,I.jsx)(`strong`,{children:`Guillaume Lemer`}),`. It started as a personal, Obsidian-vault-grown agent operating system and was distilled into the repo you are running. If you find it useful, a star on the repo or an issue with feedback is the best way to help shape what comes next.`]})})]})}function he({overview:e,onAction:t,flavour:n,onFlavour:i,accentMode:a,onAccentMode:s,layout:l,onLayout:f}){let p=o(),h=e?.install,y=e?.footprint,x=e?.server,C=e?.daemon_stale,[T,E]=(0,F.useState)(null);(0,F.useEffect)(()=>{Promise.resolve(r.update?.()).then(e=>E(e||null)).catch(()=>{})},[]);let D=T?T.install??(T.git?`git`:`npm-global`):null,O=D===`git`?`Update (git pull + rebuild)`:D===`npm-global`?`Update (npm install -g + rebuild)`:`Update`,k=async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await r.installs();e=t.filter(e=>e.state===`active`).map(e=>`${_(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await p(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},A=x?.autostart===!0?`On · login script`:x?.autostart===!1?`Off`:`unknown`;return(0,I.jsxs)(`div`,{className:`narrow-lg`,children:[(0,I.jsx)(`div`,{className:`head-row mb-18`,children:(0,I.jsxs)(`div`,{children:[(0,I.jsx)(`h2`,{className:`h`,children:w.server}),(0,I.jsx)(`p`,{className:`sub`,children:`Console appearance, this copy of Geneseed, the local server, and about. Each install is managed on the Hosts tab.`})]})}),(0,I.jsxs)(`div`,{className:`sheet`,children:[(0,I.jsx)(Q,{stale:C}),(0,I.jsxs)(`div`,{className:`sheet-body`,children:[(0,I.jsxs)(Z,{id:`appearance`,title:`Appearance`,children:[n&&i&&(0,I.jsxs)(X,{k:(0,I.jsx)(`span`,{id:`dir-skin-label`,children:`Skin`}),help:`Colours and fonts of the console`,children:[(0,I.jsx)(u,{"aria-labelledby":`dir-skin-label`,children:d.map(e=>(0,I.jsx)(`button`,{className:n===e.id?`on`:``,onClick:()=>i(e.id),"aria-pressed":n===e.id,title:e.tagline,children:e.short},e.id))}),(0,I.jsx)(`span`,{className:`dir-layout-note sub`,role:`status`,"aria-live":`polite`,children:d.find(e=>e.id===n)?.tagline??``})]}),a&&s&&(0,I.jsxs)(X,{k:(0,I.jsx)(`span`,{id:`dir-accent-label`,children:`Accent`}),help:`Live, saved in this browser`,children:[(0,I.jsx)(c,{value:a,onChange:s,labelledBy:`dir-accent-label`}),(0,I.jsx)(`span`,{className:`dir-layout-note sub`,role:`status`,"aria-live":`polite`,children:g(a)})]}),l&&f&&(0,I.jsxs)(X,{k:(0,I.jsx)(`span`,{id:`dir-layout-label`,children:`Overview view`}),help:`The Overview, or one of the older dashboards`,children:[(0,I.jsx)(u,{"aria-labelledby":`dir-layout-label`,children:v.map(e=>(0,I.jsx)(`button`,{className:l===e.id?`on`:``,onClick:()=>f(e.id),"aria-pressed":l===e.id,title:e.tagline,children:e.short},e.id))}),(0,I.jsx)(`span`,{className:`dir-layout-note sub`,role:`status`,"aria-live":`polite`,children:v.find(e=>e.id===l)?.tagline??``})]})]}),(0,I.jsxs)(Z,{id:`machine`,title:`Machine`,children:[(0,I.jsx)(X,{k:`Geneseed`,help:`This copy of the source`,control:D===`other`?T.command?(0,I.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,I.jsx)(`code`,{className:`mono`,children:T.command})]}):null:(0,I.jsxs)(`button`,{className:`btn`,onClick:k,children:[(0,I.jsx)(b,{name:`download`}),O]}),children:(0,I.jsx)(`span`,{className:`mono`,children:e?.version||`unknown`})}),(0,I.jsx)(X,{k:`Command on PATH`,help:`Run geneseed from any folder`,control:(0,I.jsxs)(`button`,{className:`btn ghost`,onClick:()=>t(`link`),children:[(0,I.jsx)(b,{name:`external`}),`Add to PATH`]})}),h&&y&&(0,I.jsxs)(X,{k:`Harness footprint`,help:(0,I.jsxs)(I.Fragment,{children:[`For `,S(h.host).label,` · `,h.scope,`; every Rule stays in force.`,` `,(0,I.jsx)(`a`,{href:`#/docs/footprint`,children:`Learn more →`})]}),control:(0,I.jsx)(`a`,{href:`#/installs/hosts`,children:`Change it on Hosts →`}),children:[(0,I.jsx)(`span`,{className:`mono`,children:y}),(0,I.jsx)(`span`,{className:`dir-layout-note sub`,children:y===`lean`?`Lean: terse rule lines + a pointer to the full law file (~40% smaller, lighter context per turn).`:`Full: every Rule’s complete text and rationale inlined (maximum guidance, largest context).`})]})]}),(0,I.jsxs)(Z,{id:`server`,title:`Server`,className:`sheet-live`,head:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`span`,{className:`pill good`,children:`running`}),(0,I.jsxs)(`span`,{className:`mono dim`,children:[`127.0.0.1:`,window.location.port||`80`,x?` · pid ${x.pid} · up ${m(x.started)}`:``]})]}),children:[(0,I.jsx)(X,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,I.jsx)(Y,{}),children:C?(0,I.jsx)(`span`,{className:`pill warn`,children:`disk has newer code → Restart`}):(0,I.jsx)(`span`,{className:`pill good`,children:`matches disk`})}),(0,I.jsx)(X,{k:`Start at login`,help:`A login script you set up by hand (install guide)`,children:(0,I.jsx)(`span`,{className:`sub`,children:A})}),(0,I.jsx)(X,{k:`Guards`,help:`What stops another page from driving the console`,children:(0,I.jsx)(`span`,{className:`row wrap gap-8`,children:me.map(e=>(0,I.jsx)(`span`,{className:`pill good`,children:e},e))})})]}),(0,I.jsx)($,{version:e?.version}),(0,I.jsxs)(Z,{id:`danger`,title:`Danger zone`,className:`danger-zone`,children:[(0,I.jsx)(X,{k:`Stop the server`,help:`The console goes offline until you run geneseed web`,control:(0,I.jsx)(ue,{})}),(0,I.jsx)(X,{k:`The geneseed command`,help:`Installs keep working; only the command goes`,control:(0,I.jsx)(`button`,{className:`btn ghost danger-line`,onClick:()=>t(`unlink`),children:`Remove from PATH`})}),(0,I.jsx)(X,{k:`Uninstall a harness`,children:(0,I.jsxs)(`span`,{className:`sub`,children:[`Each install has its own Uninstall in `,(0,I.jsx)(`a`,{href:`#/installs/hosts`,children:`Hosts`}),`, bound to its host and path.`]})})]})]})]})]})}function ge({tab:e=`hosts`,overview:t,setup:n,themes:r,onAction:i,onMutated:a,dataRev:o,appearance:c={}}){let l=t?.doctor,u=t?.diff,d={edits:u?C(u):null,doctor:l?l.ok?`clean`:l.problems.length:null};return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(s,{title:`Installs`,sub:`Where the harness lives on this machine, and how each copy is built.`}),(0,I.jsx)(D,{page:`installs`,current:e,badges:d,label:`Installs`}),e===`hosts`&&(0,I.jsx)(G,{onAction:i,themes:r,currentTheme:t?.theme,overview:t,setup:n,dataRev:o,onMutated:a}),e===`kits`&&(0,I.jsx)(K,{onAction:i,dataRev:o}),e===`edits`&&(0,I.jsx)(ce,{onMutated:a,onAction:i,dataRev:o,overview:t}),e===`doctor`&&(0,I.jsx)(le,{dataRev:o}),e===`server`&&(0,I.jsx)(he,{overview:t,onAction:i,...c})]})}export{ge as default};
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{G as i,H as a,J as o,K as s,Q as c,R as l,W as u,Y as d,Z as f,_ as p,bt as m,d as h,f as g,g as _,h as v,m as ee,p as y,pt as b,v as te,y as x}from"./index-DhNNxhfg.js";import{t as ne}from"./EmptyState-1sPNleqv.js";import{t as S}from"./FilterInput-CZREvrjX.js";import{t as C}from"./Markdown-DpmmtW2Y.js";var w=e(t(),1);function re({items:e,packs:t,install:n,canApply:r,onAction:a,gateArmed:o}){let l=c(),u=e.filter(e=>e.tier===`doctrine`&&e.active!==!1).map(e=>e.name),d=u.join(`,`),f=s(),p=n?`${n.host}:${n.scope}:${n.path}`:``,m=i(u),{prune:h}=f,g=e.length>0;(0,w.useEffect)(()=>{g&&h(`rules`,(e,t)=>e===p&&t.base!==m)},[g,p,m,h]);let _=f.get(`rules`,p),v=_&&_.base===m?_.value:u,ee=e=>f.put(`rules`,p,e(v),m),y=e=>v.includes(e),b=e=>ee(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),te=e=>e.rules.some(e=>y(e.addr)),x=e=>{let t=e.rules.map(e=>e.addr),n=e.rules.every(e=>y(e.addr));ee(e=>n?e.filter(e=>!t.includes(e)):[...new Set([...e,...t])])},ne=e=>{let t=e.rules.filter(e=>y(e.addr)).length;return t?e.active?`${t} of ${e.rules.length} active`:`staged on · ${t} of ${e.rules.length}`:e.active?`staged off`:`not built in`},S=t.flatMap(e=>e.rules.map(e=>e.addr)),C=S.filter(y),re=C.join(`,`)!==d,T=`process.5`,E=u.includes(T)&&!v.includes(T);return{deployedRules:u,isOn:y,toggleRule:b,packOn:te,togglePack:x,packState:ne,allRules:S,pickedRules:C,dirty:re,losingConsent:E,applyPacks:async()=>{if(!r||!re)return;let e=t.filter(e=>e.rules.some(e=>y(e.addr))).map(e=>e.pack),i=t.filter(t=>e.includes(t.pack)).flatMap(e=>e.rules.filter(e=>!y(e.addr)).map(e=>e.addr)),s=E?`
2
-
3
- process 5 carries commit/push consent. Dropping it also removes the git-gate hook, so commits and pushes stop being confirmed at the tool boundary. `+(o?`(Real data loss stays gated: that is Rule IV’s, not the pack’s.)`:`(Rule IV’s deletion gate is off on this install, so real data loss is not asked about either.)`):``,c=C.length?`${C.length} of ${S.length} doctrine rules`:`no doctrine rules`;await l(`Rebuild ${n.host} · ${n.scope} with ${c}? It rebuilds in place, non-destructive.${s}`,{title:`Rebuild with these rules?`,confirmLabel:`Rebuild`})&&await a(`install`,{...n,doctrines:e,excludeRules:i})&&f.startApply(`rules`,p)},revert:()=>f.drop(`rules`,p)}}var T=n();function E({addr:e,isOpen:t,onToggle:n,className:i,style:a,head:s,label:c,rev:l,toggleCol:u=null,renderBody:d,srcLine:f}){let p=(0,w.useId)(),{data:m,error:h,reload:g}=b(()=>t?r.item(`law`,e):Promise.resolve(null),[t,e,l],`law-item`),_=t&&(0,T.jsxs)(`div`,{className:`law-expand`,id:p,children:[h?(0,T.jsx)(o,{error:h,onRetry:g}):m?d(m):(0,T.jsx)(`p`,{className:`dim`,children:`Loading…`}),(0,T.jsx)(`div`,{className:`law-srcline`,children:f})]}),v={type:`button`,onClick:n,"aria-expanded":t,"aria-controls":p,"aria-label":c};return u?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`div`,{className:i,style:a,"data-addr":e,children:[(0,T.jsx)(`button`,{className:`law-disclosure`,...v,children:s}),(0,T.jsx)(`span`,{className:`toggle-col`,children:u})]}),_]}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`button`,{className:i,style:a,"data-addr":e,...v,children:s}),_]})}function D({law:e,isOpen:t,onToggle:n,rev:r,toggleCol:i=null}){let a=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`span`,{className:`law-no`,children:[(0,T.jsx)(`span`,{className:`x`,"aria-hidden":`true`,children:`›`}),e.no]}),(0,T.jsxs)(`span`,{className:`law-name`,children:[(0,T.jsx)(`span`,{children:e.name}),e.ess?(0,T.jsx)(`span`,{className:`law-princ`,children:e.ess}):null,e.asks?(0,T.jsx)(`span`,{className:`law-asks mono`,children:e.asks}):null]}),(0,T.jsx)(`span`,{className:`law-latin`,children:e.latin}),(0,T.jsx)(`span`,{className:`law-status ${e.statusTone}`,children:e.status}),(0,T.jsx)(`span`,{className:`law-enf${e.enf===`Hook gate`?` hook`:e.enf===`Gate off`?` gate-off`:``}`,children:e.enf})]});return(0,T.jsx)(E,{addr:e.addr,isOpen:t,onToggle:n,className:`law-row${i?` has-toggle`:``}${t?` on`:``}${e.off?` law-off`:``}`,style:{"--cc":e.c},head:a,label:`${e.no?e.no+` `:``}${e.name}, ${e.status}, ${e.enf}`,rev:r,toggleCol:i,renderBody:t=>(0,T.jsx)(C,{body:t.body||e.ess,links:t.links}),srcLine:`$ geneseed law ${e.addr} · ${e.src}`})}var ie=[`invariants`,`doctrines`];function ae({tiers:e,current:t,onPick:n}){return(0,T.jsx)(`div`,{className:`tier-strip`,children:e.map((e,r)=>{let i=(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(`span`,{className:`tier-head`,children:[(0,T.jsxs)(`span`,{className:`tier-k mono`,children:[`RANK `,r+1]}),e.pill?(0,T.jsx)(`span`,{className:`badge tier-pill ${e.pill[1]}`,children:e.pill[0]}):null]}),(0,T.jsxs)(`span`,{className:`tier-top`,children:[(0,T.jsx)(`span`,{className:`tier-name`,children:e.name}),(0,T.jsx)(`span`,{className:`tier-n mono`,children:e.n})]}),(0,T.jsx)(`span`,{className:`tier-bar`,"aria-hidden":`true`,children:(0,T.jsx)(`span`,{style:{width:`${Math.round(e.fill*100)}%`}})}),(0,T.jsx)(`span`,{className:`tier-sub`,children:e.sub}),(0,T.jsx)(`span`,{className:`tier-sub tier-rule`,children:e.rule})]}),a=`tier${t===e.key?` on`:``}`;return e.href?(0,T.jsx)(`a`,{className:`tier`,href:e.href,children:i},e.key):n&&ie.includes(e.key)?(0,T.jsx)(`button`,{type:`button`,className:a,"aria-pressed":t===e.key,onClick:()=>n(t===e.key?`all`:e.key),children:i},e.key):(0,T.jsx)(`div`,{className:a,children:i},e.key)})})}function oe({gates:e,byAddr:t,onJump:n,disarmed:r=()=>!1}){let i=Object.entries(e?.asks||{}).map(([e,t])=>[e,t,r(_(e))]).sort((e,t)=>e[2]-t[2]||t[1]-e[1]),a=Math.max(1,...i.map(([,e])=>e));return(0,T.jsxs)(`section`,{className:`panel`,"aria-labelledby":`gate-asks`,children:[(0,T.jsxs)(`div`,{className:`panel-head`,children:[(0,T.jsx)(`h2`,{id:`gate-asks`,children:`Gate asks`}),(0,T.jsxs)(`span`,{className:`mono dim`,children:[e?.total??0,` in ledger`]})]}),i.length?(0,T.jsx)(`ul`,{className:`gate-list`,children:i.map(([e,r,i])=>{let o=_(e),s=t[o]?.name||o;return(0,T.jsxs)(`li`,{children:[(0,T.jsx)(`button`,{type:`button`,className:`gate-row`,onClick:()=>n(o),children:(0,T.jsxs)(`span`,{className:`gate-top`,children:[(0,T.jsx)(`span`,{className:`gate-name${i?` dim`:``}`,children:s}),(0,T.jsx)(`span`,{className:`mono dim`,children:o}),i&&(0,T.jsx)(`span`,{className:`mono off`,children:`off`}),(0,T.jsx)(`span`,{className:`mono gate-n`,children:r})]})}),(0,T.jsx)(l,{value:r,max:a,label:`${s} asks`,tone:i?`accent`:`warn`})]},e)})}):(0,T.jsx)(`p`,{className:`sub`,children:`No gate has asked yet.`}),(0,T.jsx)(`p`,{className:`panel-note`,children:e?.standing_down?.length?`Standing down: ${e.standing_down.join(`, `)}.`:`None standing down.`})]})}function se({packs:e,sel:t,canApply:n,install:r,gateArmed:i}){let{isOn:a,packOn:o,togglePack:s,dirty:c,losingConsent:u}=t,d=Math.max(1,...e.map(e=>e.rules.length));return(0,T.jsxs)(`section`,{className:`panel`,"aria-labelledby":`doc-packs`,children:[(0,T.jsxs)(`div`,{className:`panel-head`,children:[(0,T.jsx)(`h2`,{id:`doc-packs`,children:`Doctrine packs`}),(0,T.jsxs)(`span`,{className:`mono dim`,children:[e.filter(o).length,`/`,e.length,` on`]})]}),e.length?(0,T.jsx)(`ul`,{className:`pack-list`,children:e.map(e=>{let t=e.rules.filter(e=>a(e.addr)).length;return(0,T.jsxs)(`li`,{className:o(e)?``:`off`,children:[(0,T.jsx)(`span`,{className:`pl-name`,title:e.desc,children:e.title}),(0,T.jsx)(l,{value:t,max:d,label:`${e.title} rules on`}),(0,T.jsx)(`span`,{className:`mono pl-n`,children:t}),n?(0,T.jsx)(`button`,{type:`button`,className:`sw-toggle${o(e)?` on`:``}${t&&t<e.rules.length?` mixed`:``}`,role:`checkbox`,"aria-checked":e.rules.length&&t===e.rules.length?`true`:t?`mixed`:`false`,"aria-label":`${e.title} pack`,onClick:()=>s(e)}):null]},e.pack)})}):(0,T.jsx)(`p`,{className:`sub`,children:`This install predates the three-tier constitution.`}),n&&e.length>0&&(0,T.jsxs)(T.Fragment,{children:[u&&(0,T.jsxs)(`p`,{className:`pack-warn`,role:`status`,"aria-live":`polite`,children:[`Dropping `,(0,T.jsx)(`b`,{children:`process 5`}),` also removes the commit/push consent gate:`,` `,(0,T.jsx)(`code`,{children:`git commit`}),` and `,(0,T.jsx)(`code`,{children:`git push`}),` stop being confirmed at the tool boundary.`,` `,i?`Real data loss stays gated by Rule IV.`:`Rule IV’s deletion gate is off on this install too.`]}),(0,T.jsx)(`p`,{className:`panel-note`,role:`status`,"aria-live":`polite`,children:c?`Not applied yet. Apply rebuilds ${r.host} · ${r.scope} once, with every change together.`:`Matches the deployed install. Changing a pack rebuilds it.`})]})]})}function ce(e){let t=[];for(let n of e){if(n.tier!==`doctrine`)continue;let e=t.find(e=>e.pack===n.pack);e||(e={pack:n.pack,title:n.packTitle||n.pack,desc:n.packDesc||``,active:n.packActive!==!1,rules:[]},t.push(e));let r=p(n.title);e.rules.push({addr:n.name,no:`${n.pack} ${n.name.split(`.`)[1]||``}`,name:r.name,latin:r.latin,ess:n.summary||``,enf:v(n.name),c:x[n.pack]||`var(--text-3)`,src:`doctrines/${n.pack}.md`})}return t}function le({selected:e,overview:t,setup:n,onAction:i,dataRev:s}){let C=c(),{data:E,error:ie}=b(()=>r.catalog(`laws`),[s],`catalog:laws`),{data:le}=a(s),[O,k]=(0,w.useState)(`all`),[A,ue]=(0,w.useState)(``),[j,M]=(0,w.useState)(`all`),[de,fe]=(0,w.useState)(()=>new Set),N=e||null,pe=e=>m(N===e?`#/laws`:`#/item/law/${encodeURIComponent(e)}`),[me,he]=(0,w.useState)(0),P=(0,w.useRef)(null);(0,w.useEffect)(()=>{if(!e)return;let t=requestAnimationFrame(()=>{let t=document.querySelector(`[data-addr="${CSS.escape(e)}"]`);if(!t)return;let n=P.current===e;P.current=null;let r=t.getBoundingClientRect();if(n||r.top<80||r.bottom>window.innerHeight){let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;t.scrollIntoView?.({block:`center`,behavior:e?`auto`:`smooth`})}n&&(t.classList.remove(`law-flash`),t.offsetWidth,t.classList.add(`law-flash`))});return()=>cancelAnimationFrame(t)},[e,me,E]);let F=E?.items||[],I=ce(F),L=e=>t?.install?.[g[e].key]!==!1,ge=L(`IV`),R=t?.install,z=!!(R&&i),B=re({items:F,packs:I,install:R,canApply:z,onAction:i,gateArmed:ge}),{deployedRules:V,isOn:H,toggleRule:_e,packOn:ve,packState:ye,allRules:U}=B;if(ie)return(0,T.jsx)(o,{error:ie});if(!E)return(0,T.jsx)(d,{});let W={ontology:E.nouns?.ontology||`Ethos`,law:E.nouns?.law||`Dictate`,laws:E.nouns?.laws||`Dictates`,doctrines:E.nouns?.doctrines||`Doctrines`},G=F.filter(e=>e.tier===`ontology`).map(e=>({addr:e.name,no:``,name:e.title,latin:``,ess:``,status:`Always`,statusTone:`ok`,enf:`Instruction`,c:`var(--text-3)`,src:`ontology/universal.md`})),K=F.filter(e=>(e.tier??`invariant`)===`invariant`).map(e=>{let n=e.klass&&te[e.klass]?e.klass:`craft`,r=p(e.title);return{addr:e.name,no:e.name,name:r.name,latin:r.latin,ess:e.summary||``,retired:r.retired,status:r.retired?`Retired`:`Active`,statusTone:r.retired?``:`ok`,enf:r.retired?`None`:v(e.name,t?.install),cat:n,c:te[n].c,off:r.retired,src:`laws/universal.md`}}),be=e=>{let t=H(e.addr),n=V.includes(e.addr),r=t===n?t?`Active`:`Off`:t?`Staged on`:`Staged off`;return{...e,off:!t,status:r,statusTone:t?`ok`:t===n?``:`warn`}},xe=I.filter(e=>e.active).flatMap(e=>e.rules.filter(e=>!V.includes(e.addr)).map(e=>e.addr)),Se=async e=>{if(!z)return;let{key:t,label:n}=g[e],r=n.toLowerCase(),a=!L(e),o=`${R.host} · ${R.scope}`,s=B.dirty?` Your staged doctrine changes are not part of this rebuild; they stay staged.`:``;await C((a?`Re-arm the ${r} on ${o}? ${h[e].arm} It rebuilds in place, non-destructive.`:`Switch the ${r} off on ${o}? ${h[e].off} It rebuilds in place, non-destructive.`)+s,{title:a?`Re-arm the ${r}?`:`Switch the ${r} off?`,confirmLabel:a?`Re-arm`:`Switch off`})&&i(`install`,{...R,[t]:a})},Ce=e=>String(e.addr).includes(`.`)&&H(e.addr)!==V.includes(e.addr),q=(e,t=j)=>t===`all`||(t===`gated`?e.enf===`Hook gate`&&(!String(e.addr).includes(`.`)||V.includes(e.addr)):Ce(e)),J=A.trim().toLowerCase(),Y=e=>q(e)&&(!J||`${e.addr} ${e.name} ${e.latin} ${e.ess}`.toLowerCase().includes(J)),we=e=>{let t=je[e],n=String(e).includes(`.`);(n&&O===`invariants`||!n&&O===`doctrines`)&&k(`all`),t&&!q(t)&&M(`all`),t&&!Y(t)&&ue(``),P.current=e,he(e=>e+1),m(`#/item/law/${encodeURIComponent(e)}`)},X={};for(let[e,t]of Object.entries(n?.gates?.asks||{}))X[_(e)]=t;let Te=e=>X[e.addr]?{...e,asks:`${X[e.addr]} ask${X[e.addr]===1?``:`s`}`}:e,Z=K.filter(e=>!e.retired).length,Q=V.length,Ee=Object.keys(g).filter(e=>K.some(t=>t.addr===e)&&!L(e)).length,De=U.length-Q,$=le?.stats,Oe={ethos:{name:W.ontology,n:G.length,fill:1,sub:`${G.length} sections`,pill:[`always`,`ok`]},invariants:{name:W.laws,n:Z,fill:K.length?Z/K.length:0,sub:K.length>Z?`${Z} active · ${K.length-Z} retired`:`${Z} active`,pill:Ee?[`${Ee} gate${Ee===1?``:`s`} off`,`warn`]:[`always`,`ok`]},doctrines:{name:W.doctrines,n:Q,fill:U.length?Q/U.length:0,sub:`${Q} rules · ${I.filter(e=>e.active).length} of ${I.length} packs`,pill:De>0?[`${De} excluded`,`warn`]:[`all on`,`ok`]},yours:{name:`Your rules`,n:$?.rules??0,fill:$?.max_rules?$.rules/$.max_rules:0,sub:$?`${$.rules} of ${$.max_rules} · ${$.tokens}/${$.max_tokens} tok`:`user-rules.md`,href:`#/personal/rules`,pill:[`yours`,``]}},ke=e=>{if(e===`—`)return`Nothing outranks them.`;let t=e.replace(`{{LAW}}`,W.law);return`${t[0].toUpperCase()}${t.slice(1)}.`},Ae=y.map(e=>({key:e.key,...Oe[e.key],rule:ke(e.against)})),je=Object.fromEntries([...K,...I.flatMap(e=>e.rules)].map(e=>[e.addr,e])),Me=[[`all`,`All`,K.length+U.length],[`invariants`,W.laws,K.length],[`doctrines`,W.doctrines,U.length]],Ne=O===`all`||O===`invariants`,Pe=O===`all`||O===`doctrines`,Fe=[...Ne?K:[],...Pe?I.flatMap(e=>e.rules):[]],Ie=[[`gated`,`Gated`,Fe.filter(e=>q(e,`gated`)).length],[`changed`,`Changed`,Fe.filter(e=>q(e,`changed`)).length]],Le=e=>String(e).includes(`.`)?String(e).split(`.`)[0]:null,Re=e=>j!==`changed`&&de.has(e)&&Le(N)!==e,ze=e=>{let t=Re(e);fe(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&Le(N)===e&&m(`#/laws`)},Be=I.flatMap(e=>e.rules.filter(Ce).map(e=>({...e,plus:H(e.addr)}))),Ve=z&&I.length>0&&B.dirty,He=()=>{M(`changed`),O===`invariants`&&k(`all`),ue(``)},Ue=(e,t)=>(0,T.jsxs)(`div`,{className:`band-head`,role:`presentation`,children:[(0,T.jsx)(`h2`,{className:`tier-h`,children:e}),(0,T.jsx)(`span`,{className:`mono dim`,children:t})]}),We=K.filter(Y),Ge=(Ne?We.length:0)+(Pe?I.reduce((e,t)=>e+t.rules.filter(Y).length,0):0);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(u,{eyebrow:R?[t?.theme,R.footprint&&`${R.footprint} footprint`,R.host,R.scope].filter(Boolean).join(` · `):null,title:`Constitution`,sub:`What the agent follows on every turn. Ranked: a lower rank may tighten a higher one, never repeal it. Open any rule to read its canonical text.`,actions:(0,T.jsx)(S,{className:`law-filter`,value:A,onChange:ue,placeholder:`Filter rules`,label:`Filter rules`})}),(0,T.jsxs)(`section`,{className:`ladder`,"aria-labelledby":`ladder-h`,children:[(0,T.jsx)(`h2`,{id:`ladder-h`,className:`eyebrow`,children:`Precedence`}),(0,T.jsx)(ae,{tiers:Ae,current:O,onPick:k}),(0,T.jsx)(`div`,{className:`ladder-tail`,children:ee.map((e,t)=>(0,T.jsxs)(`span`,{className:`ladder-low`,children:[(0,T.jsxs)(`span`,{className:`mono tier-k`,children:[`RANK `,y.length+t+1]}),` `,e.label,` —`,` `,e.against]},e.source))})]}),(0,T.jsxs)(`div`,{className:`split`,children:[(0,T.jsxs)(`section`,{className:`panel flush law-wrap${z?` with-toggle`:``}`,"aria-label":`Rules`,children:[G.length>0&&(0,T.jsxs)(T.Fragment,{children:[Ue(W.ontology,`ontology/universal.md`),G.map(e=>(0,T.jsx)(D,{law:e,rev:s,isOpen:N===e.addr,onToggle:()=>pe(e.addr)},e.addr))]}),(0,T.jsxs)(`div`,{className:`law-toolbar`,children:[(0,T.jsx)(f,{"aria-label":`Show`,children:Me.map(([e,t,n])=>(0,T.jsxs)(`button`,{type:`button`,className:O===e?`on`:``,"aria-pressed":O===e,onClick:()=>k(e),children:[t,` `,(0,T.jsx)(`span`,{className:`mono`,children:n})]},e))}),(0,T.jsx)(f,{"aria-label":`Narrow`,children:Ie.map(([e,t,n])=>(0,T.jsxs)(`button`,{type:`button`,className:j===e?`on`:``,"aria-pressed":j===e,onClick:()=>M(j===e?`all`:e),children:[t,` `,(0,T.jsx)(`span`,{className:`mono`,children:n})]},e))})]}),(0,T.jsxs)(`div`,{className:`law-rowhead`,children:[(0,T.jsx)(`span`,{children:`No.`}),(0,T.jsx)(`span`,{children:`Rule`}),(0,T.jsx)(`span`,{children:`Latin name`}),(0,T.jsx)(`span`,{children:`Status`}),(0,T.jsx)(`span`,{children:`Enforced by`})]}),Ne&&We.length>0&&(0,T.jsxs)(T.Fragment,{children:[Ue(W.laws,`laws/universal.md`),We.map(e=>(0,T.jsx)(D,{law:Te(e),rev:s,isOpen:N===e.addr,onToggle:()=>pe(e.addr),toggleCol:!z||e.retired?null:g[e.addr]?(0,T.jsx)(`button`,{type:`button`,className:`sw-toggle${L(e.addr)?` on`:``}`,role:`switch`,"aria-checked":L(e.addr),"aria-label":g[e.addr].label,onClick:()=>Se(e.addr)}):(0,T.jsx)(`span`,{className:`no-gate`,title:`Enforced by its text alone: no hook gate`,children:`no gate`})},e.addr))]}),Pe&&I.map(e=>{let t=e.rules.filter(Y);if(!t.length)return null;let n=Re(e.pack),r=e.rules.filter(e=>H(e.addr)).length;return(0,T.jsxs)(`div`,{className:`pack-wrap${ve(e)?``:` pack-off`}`,children:[(0,T.jsxs)(`div`,{className:`band-head pack-head`,children:[(0,T.jsx)(`h2`,{className:`tier-h`,style:{"--cc":x[e.pack]},children:(0,T.jsx)(`button`,{type:`button`,className:`pack-fold`,"aria-expanded":!n,onClick:()=>ze(e.pack),children:e.title})}),(0,T.jsx)(`span`,{className:`mono dim`,children:e.pack}),(0,T.jsx)(`span`,{className:`pack-desc dim`,children:e.desc}),(0,T.jsx)(`span`,{className:`pack-fill`,children:(0,T.jsx)(l,{value:r,max:e.rules.length,label:`${e.title} rules switched on`})}),(0,T.jsx)(`span`,{className:`pack-state mono`,children:ye(e)})]}),!e.active&&!z&&(0,T.jsxs)(`div`,{className:`pack-enable`,children:[`$ geneseed-build --doctrines`,` `,I.filter(t=>t.active||t.pack===e.pack).map(e=>e.pack).join(`,`),xe.length>0&&` --exclude-rules ${xe.join(`,`)}`]}),!n&&t.map(e=>(0,T.jsx)(D,{law:Te(be(e)),rev:s,isOpen:N===e.addr,onToggle:()=>pe(e.addr),toggleCol:z?(0,T.jsx)(`button`,{type:`button`,className:`sw-toggle${H(e.addr)?` on`:``}`,role:`switch`,"aria-checked":H(e.addr),"aria-label":`${e.name} rule`,onClick:()=>_e(e.addr)}):null},e.addr))]},e.pack)}),Ge===0&&(0,T.jsx)(ne,{title:J||j!==`all`?`No matching rules`:`Nothing in this tier`,children:J?(0,T.jsxs)(T.Fragment,{children:[`Nothing matches “`,A.trim(),`”.`]}):j===`all`?(0,T.jsx)(T.Fragment,{children:`This install predates the tier.`}):(0,T.jsxs)(T.Fragment,{children:[`No `,j,` rule in this tier.`]})})]}),(0,T.jsxs)(`aside`,{className:`aside-stack`,children:[(0,T.jsx)(se,{packs:I,sel:B,canApply:z,install:R,gateArmed:ge}),(0,T.jsx)(oe,{gates:n?.gates,byAddr:je,onJump:we,disarmed:e=>!!g[e]&&!L(e)})]})]}),Ve&&(0,T.jsxs)(`div`,{className:`law-bar`,role:`region`,"aria-label":`Unapplied changes`,children:[(0,T.jsxs)(`span`,{className:`law-bar-n`,children:[Be.length,` unapplied change`,Be.length===1?``:`s`]}),(0,T.jsx)(`span`,{className:`law-bar-list`,children:Be.map(e=>(0,T.jsxs)(`span`,{className:`badge ${e.plus?`ok`:`warn`}`,children:[e.plus?`+`:`−`,` `,e.no,` `,e.name]},e.addr))}),(0,T.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:He,children:`Review changes`}),(0,T.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{M(`all`),B.revert()},children:`Revert`}),(0,T.jsxs)(`button`,{type:`button`,className:`btn`,onClick:B.applyPacks,children:[`Apply (`,B.pickedRules.length,`/`,U.length,` rules)`]})]})]})}export{le as default};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{i}from"./motion-CXaUMNkg.js";import{n as a,t as o}from"./sections-ChwaobfW.js";import{J as s,Q as ee,V as te,Z as ne,b as c,bt as re,ot as l,pt as u,x as d}from"./index-DhNNxhfg.js";import{t as f}from"./EmptyState-1sPNleqv.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as le}from"./RailCats-BuJD4Jou.js";import{t as ue}from"./Markdown-DpmmtW2Y.js";var p=e(t(),1),m=n();function de({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,m.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function h({entries:e}){return e.length?(0,m.jsxs)(`table`,{className:`mf-entries`,children:[(0,m.jsx)(`thead`,{className:`sr-only`,children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{scope:`col`,children:`Path`}),(0,m.jsx)(`th`,{scope:`col`,children:`Load`}),(0,m.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,m.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,m.jsx)(`td`,{className:`mf-load-cell`,children:(0,m.jsx)(de,{load:e.load})}),(0,m.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function g({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,m.jsxs)(`div`,{className:`mf-vault`,children:[(0,m.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,m.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,m.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,m.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,m.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,m.jsxs)(`span`,{className:`mf-role`,children:[(0,m.jsx)(l,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,m.jsxs)(`span`,{className:`mf-role`,children:[(0,m.jsx)(l,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,m.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,m.jsx)(l,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,m.jsx)(h,{entries:t})]})}function _({body:e}){let[t,n]=(0,p.useState)(!1),r=(0,p.useId)();return e?(0,m.jsxs)(`div`,{className:`mf-raw`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,m.jsx)(l,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,m.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function fe({manifest:e,body:t,name:n}){if(!e)return(0,m.jsx)(`pre`,{className:`mf-raw-pre`,children:(t||``).replace(/^```json\n|\n```$/g,``)});if(e.kind===`wiki`){let n=e.wikis||[];return n.length?(0,m.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,m.jsx)(g,{wiki:e},e.name||t)),(0,m.jsx)(_,{body:t})]}):(0,m.jsxs)(`div`,{className:`mf-empty`,children:[(0,m.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,m.jsxs)(`p`,{children:[`A wiki is your machine-wide knowledge base — an Obsidian vault or any folder of linked markdown the agent reads from and writes back to. Declare one in`,` `,(0,m.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,m.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,m.jsx)(_,{body:t})]})}let r=e.context||[];return r.length?(0,m.jsxs)(`div`,{className:`mf-doc`,children:[(0,m.jsx)(h,{entries:r}),(0,m.jsx)(_,{body:t})]}):(0,m.jsxs)(`div`,{className:`mf-empty`,children:[(0,m.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,m.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,m.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,m.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,m.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,m.jsx)(_,{body:t})]})}var v={fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},y={advocate:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M16 50h14M23 50V14`}),(0,m.jsx)(`path`,{className:`ag-wave ag-f`,d:`M23 15h20l-5 7.5 5 7.5H23z`}),(0,m.jsx)(`path`,{className:`ag-call`,d:`M47 38a6 6 0 0 1 0 8M51 35a11 11 0 0 1 0 14`})]}),architect:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{x:`14`,y:`14`,width:`36`,height:`32`,rx:`2`,opacity:`.3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M20 40V22h12v9h12v9z`}),(0,m.jsx)(`path`,{className:`ag-draw ag-late`,pathLength:`100`,d:`M32 31v9`}),(0,m.jsx)(`path`,{d:`M14 52h36M14 50v4M50 50v4`,opacity:`.5`})]}),developer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-f`,x:`10`,y:`14`,width:`44`,height:`36`,rx:`4`}),(0,m.jsx)(`path`,{d:`M10 22h44`,opacity:`.5`}),(0,m.jsx)(`circle`,{cx:`15`,cy:`18`,r:`1`}),(0,m.jsx)(`circle`,{cx:`19`,cy:`18`,r:`1`}),(0,m.jsx)(`path`,{className:`ag-nudge-l`,d:`M24 30l-6 6 6 6`}),(0,m.jsx)(`path`,{className:`ag-nudge-r`,d:`M40 30l6 6-6 6`}),(0,m.jsx)(`path`,{className:`ag-blink`,d:`M30 42h5`})]}),"devops-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M32 32c-5-9-18-9-18 0s13 9 18 0c5-9 18-9 18 0s-13 9-18 0z`,opacity:`.3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M32 32c-5-9-18-9-18 0s13 9 18 0c5-9 18-9 18 0s-13 9-18 0z`}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`3`})]}),"docker-expert":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`14`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`27`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`40`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`20`,y:`25`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`34`,y:`25`,width:`10`,height:`9`}),(0,m.jsx)(`path`,{d:`M8 52c5 0 5-3 10-3s5 3 10 3 5-3 10-3 5 3 10 3 5-3 10-3`,opacity:`.5`})]}),docs:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M16 10h22l8 8v36H16z`}),(0,m.jsx)(`path`,{d:`M38 10v8h8`,opacity:`.5`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M21 26h18`}),(0,m.jsx)(`path`,{className:`ag-draw ag-late`,pathLength:`100`,d:`M21 33h18`}),(0,m.jsx)(`path`,{className:`ag-draw ag-later`,pathLength:`100`,d:`M21 40h11`}),(0,m.jsx)(`g`,{className:`ag-write`,children:(0,m.jsx)(`path`,{d:`M40 44l12-20 3 2-12 20-4 1z`})})]}),empiricist:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 12v40h40`,opacity:`.5`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`18`,y:`36`,width:`6`,height:`14`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`29`,y:`28`,width:`6`,height:`22`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`40`,y:`20`,width:`6`,height:`30`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M16 34l12-8 10 3 12-14`})]}),explorer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`18`,opacity:`.5`}),(0,m.jsx)(`path`,{d:`M32 10v4M32 50v4M10 32h4M50 32h4`}),(0,m.jsxs)(`g`,{className:`ag-search`,children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 18l5 14h-10z`}),(0,m.jsx)(`path`,{d:`M32 18l5 14-5 14-5-14z`})]}),(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`2`})]}),framer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`g`,{className:`ag-frame`,children:(0,m.jsx)(`path`,{d:`M12 22V12h10M42 12h10v10M52 42v10H42M22 52H12V42`})}),(0,m.jsx)(`circle`,{className:`ag-pulse`,cx:`32`,cy:`32`,r:`7`,opacity:`.6`}),(0,m.jsx)(`path`,{d:`M32 22v6M32 36v6M22 32h6M36 32h6`,opacity:`.6`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`1.5`})]}),historian:(0,m.jsxs)(`g`,{className:`ag-turn`,children:[(0,m.jsx)(`path`,{d:`M20 12h24M20 52h24`}),(0,m.jsx)(`path`,{d:`M22 12c0 12 20 12 20 20s-20 8-20 20M42 12c0 12-20 12-20 20s20 8 20 20`}),(0,m.jsx)(`path`,{className:`ag-drain ag-f`,d:`M25 17h14c-1 6-5 9-7 11-2-2-6-5-7-11z`}),(0,m.jsx)(`path`,{className:`ag-fill ag-f`,d:`M24 49h16c-1-5-5-8-8-9-3 1-7 4-8 9z`})]}),operator:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 42a20 20 0 0 1 40 0`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M40 24a20 20 0 0 1 12 18`,strokeWidth:`4`,opacity:`.7`}),(0,m.jsx)(`path`,{d:`M16 30l3 2M32 22v4M48 30l-3 2`,opacity:`.6`}),(0,m.jsx)(`g`,{className:`ag-gauge`,children:(0,m.jsx)(`path`,{d:`M32 42l10-13`})}),(0,m.jsx)(`circle`,{cx:`32`,cy:`42`,r:`3`}),(0,m.jsx)(`path`,{d:`M22 50h20`,opacity:`.5`})]}),pragmatist:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M32 14v36M22 50h20`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`14`,r:`2`}),(0,m.jsxs)(`g`,{className:`ag-tilt`,children:[(0,m.jsx)(`path`,{d:`M14 18h36`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M14 18l-5 12h10zM50 18l-5 12h10z`})]})]}),"kubernetes-specialist":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`16`}),(0,m.jsx)(`path`,{d:`M32 8v13M32 43v13M8 32h13M43 32h13M15 15l9 9M40 40l9 9M49 15l-9 9M24 40l-9 9`,opacity:`.6`}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`5`})]}),"memory-curator":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`17`,y:`16`,width:`14`,height:`20`,rx:`1`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`25`,y:`12`,width:`14`,height:`24`,rx:`1`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`33`,y:`18`,width:`14`,height:`18`,rx:`1`}),(0,m.jsx)(`path`,{d:`M12 32h40v16a2 2 0 0 1-2 2H14a2 2 0 0 1-2-2z`}),(0,m.jsx)(`path`,{d:`M26 40h12`,opacity:`.6`})]}),researcher:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`34`,r:`16`}),(0,m.jsx)(`path`,{d:`M14 34h32M30 18c-6 5-6 27 0 32`,opacity:`.5`}),(0,m.jsx)(`ellipse`,{className:`ag-spin`,cx:`30`,cy:`34`,rx:`7`,ry:`16`}),(0,m.jsx)(`g`,{className:`ag-orbit`,children:(0,m.jsx)(`circle`,{cx:`50`,cy:`14`,r:`3`})})]}),reviewer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 18h30M12 26h40M12 34h24M12 42h34`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-mark`,d:`M42 30l3 3 6-6`}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`22`,cy:`30`,r:`9`}),(0,m.jsx)(`path`,{d:`M29 37l8 8`,strokeWidth:`3`})]})]}),performance:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M26 10h8M30 10v6M44 18l3-3`}),(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`34`,r:`18`}),(0,m.jsx)(`path`,{d:`M30 19v3M45 34h-3M30 49v-3M15 34h3`,opacity:`.6`}),(0,m.jsx)(`g`,{className:`ag-orbit`,children:(0,m.jsx)(`path`,{d:`M30 34V22`})}),(0,m.jsx)(`circle`,{cx:`30`,cy:`34`,r:`2`})]}),security:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-ripple`,d:`M32 8l18 6v13c0 12-8 21-18 26-10-5-18-14-18-26V14z`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 8l18 6v13c0 12-8 21-18 26-10-5-18-14-18-26V14z`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M24 31l6 6 11-11`})]}),skeptic:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M12 14h40v28H30l-10 8v-8h-8z`}),(0,m.jsxs)(`g`,{className:`ag-lean`,children:[(0,m.jsx)(`path`,{d:`M27 23a5 5 0 1 1 7 4.5c-1.5.8-2 2-2 3.5v1`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`36`,r:`1.2`})]})]}),"spring-boot-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M22 20a16 16 0 1 0 20 0`}),(0,m.jsx)(`path`,{className:`ag-pulse`,d:`M32 12v18`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M32 50c0-8 5-12 13-12 0 8-5 12-13 12z`})]}),"spring-reviewer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 18h26M12 26h18M12 34h22M12 42h14`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M42 28c0-8 4-12 11-12 0 8-4 12-11 12z`}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`24`,cy:`32`,r:`9`}),(0,m.jsx)(`path`,{d:`M31 39l8 8`,strokeWidth:`3`})]})]}),"spring-security":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-ripple`,d:`M22 28v-6a10 10 0 0 1 20 0v6`}),(0,m.jsx)(`path`,{d:`M22 28v-6a10 10 0 0 1 20 0v6`}),(0,m.jsx)(`rect`,{className:`ag-f`,x:`16`,y:`28`,width:`32`,height:`24`,rx:`4`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`38`,r:`3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M32 41v6`})]}),"react-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`g`,{className:`ag-spin`,children:[(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`}),(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`,transform:`rotate(60 32 32)`}),(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`,transform:`rotate(120 32 32)`})]}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`4`})]}),"react-reviewer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`g`,{opacity:`.4`,children:[(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`}),(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`,transform:`rotate(60 30 30)`}),(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`,transform:`rotate(120 30 30)`})]}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`30`,r:`8`}),(0,m.jsx)(`path`,{d:`M36 36l9 9`,strokeWidth:`3`})]})]}),steward:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 52h40`,opacity:`.5`}),(0,m.jsx)(`path`,{d:`M22 52c2-3 6-4 10-4s8 1 10 4`,opacity:`.4`}),(0,m.jsxs)(`g`,{className:`ag-grow`,children:[(0,m.jsx)(`path`,{d:`M32 50V26`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M32 32c0-9 6-14 15-14 0 9-6 14-15 14z`}),(0,m.jsx)(`path`,{className:`ag-sway ag-late ag-f`,d:`M32 38c0-7-5-11-12-11 0 7 5 11 12 11z`})]})]}),tester:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M26 10h12M28 10v14L15 48a3 3 0 0 0 2.6 4.5h28.8A3 3 0 0 0 49 48L36 24V10`}),(0,m.jsx)(`path`,{className:`ag-f ag-slosh`,d:`M20 40h24l4.5 8.5H15.5z`}),(0,m.jsx)(`circle`,{className:`ag-bubble`,cx:`28`,cy:`44`,r:`2`}),(0,m.jsx)(`circle`,{className:`ag-bubble ag-late`,cx:`35`,cy:`46`,r:`1.5`}),(0,m.jsx)(`circle`,{className:`ag-bubble ag-later`,cx:`31`,cy:`42`,r:`1`})]}),"user-advocate":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`24`,cy:`20`,r:`6`}),(0,m.jsx)(`path`,{d:`M12 50c0-9 5-15 12-15 4 0 7 1.5 9 4`}),(0,m.jsx)(`path`,{className:`ag-beat ag-f`,d:`M44 52s-10-6-10-12.5a5 5 0 0 1 10-1.5 5 5 0 0 1 10 1.5C54 46 44 52 44 52z`}),(0,m.jsx)(`path`,{className:`ag-twinkle`,d:`M48 22v4M46 24h4`})]}),visionary:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`g`,{className:`ag-rays`,opacity:`.5`,children:(0,m.jsx)(`path`,{d:`M32 6v6M32 52v6M6 32h6M52 32h6M13.6 13.6l4.2 4.2M46.2 46.2l4.2 4.2M13.6 50.4l4.2-4.2M46.2 17.8l4.2-4.2`})}),(0,m.jsx)(`path`,{className:`ag-f ag-pulse`,d:`M32 16l4.7 10.4 11.3 1.2-8.5 7.6 2.4 11.1L32 40.6l-9.9 5.7 2.4-11.1-8.5-7.6 11.3-1.2z`}),(0,m.jsx)(`path`,{className:`ag-twinkle`,d:`M50 8v6M47 11h6`})]})},b=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 12l17 10v20L32 52 15 42V22z`}),(0,m.jsx)(`circle`,{className:`ag-pulse`,cx:`32`,cy:`32`,r:`6`})]});function pe({name:e,size:t=64}){return(0,m.jsxs)(`svg`,{className:`agent-glyph`,viewBox:`0 0 64 64`,width:t,height:t,"aria-hidden":`true`,...v,children:[(0,m.jsx)(`circle`,{className:`ag-disc`,cx:`32`,cy:`32`,r:`31`}),(0,m.jsx)(`circle`,{className:`ag-ring`,cx:`32`,cy:`32`,r:`31`,strokeWidth:`1`,strokeDasharray:`2 7`}),y[e]||b]})}function x({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,m.jsxs)(`div`,{className:`stat`,children:[(0,m.jsx)(`div`,{className:`stat-label`,children:e}),(0,m.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,m.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var me={skills:`skill`,agents:`agent`},he=(e,t)=>`${t?e/t*100:0}%`,S=e=>e.split(`:`).slice(0,2).join(` `);function C(e,t){return e===`memory`?`memory/${t}`:e===`notebook`?`notebook/${t}`:e===`wiki`?`geneseed-wiki.jsonc`:e===`config`?t:e===`skills`?`skills/${t}/SKILL.md`:`${e}/${t}.md`}function ge({section:e,source:t}){return(0,m.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,m.jsx)(l,{name:a[e].icon,className:`glyph`}),(0,m.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,m.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var w=e=>e.replace(/\s+/g,` `).trim(),T=e=>e.replace(/^(?:[ \t]*\n)+/,``);function _e(e,t){let n=e.replace(/\r\n/g,`
2
- `),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=T(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?w(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?w(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=T(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function ve({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,m.jsx)(`div`,{className:`lib-stats`,children:(0,m.jsx)(x,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(S))].join(`, `),i=t.days_counted>=30?`in the last 30 days`:`since ${t.since}`,a=Math.max(1,...e.per_day),o=[e.last?`last used ${e.last}`:null,i,r?`on ${r}`:null].filter(Boolean).join(` · `);return(0,m.jsx)(`div`,{className:`lib-stats`,children:(0,m.jsx)(x,{label:`Used`,value:e.n,delta:o,children:(0,m.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,m.jsx)(`i`,{className:t===29?`today`:``,style:{height:he(e,a)}},t))})})})}function E(e){let t=/\s*\bUse when:\s*/i.exec(e||``);if(!t)return{lede:e||``,when:``};let n=e.slice(t.index+t[0].length).trim();return{lede:e.slice(0,t.index).trim(),when:n&&n[0].toUpperCase()+n.slice(1)}}var ye={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},be=(e,t)=>t||(e&&o.includes(e)?e:o[0]),xe=encodeURIComponent;function Se(e){let t=e=>c[e.klass]?e.klass:`personal`,n=d.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:c[n].label,groupC:c[n].c})));return{rows:n,cats:d.map(e=>({key:e,label:c[e].label,c:c[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ce(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function D({overview:e,section:t,selected:n,dataRev:i,lock:l,base:d,onRulesChanged:de}){let h=ee(),[g,_]=(0,p.useState)(()=>be(t,l)),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(`all`),[S,w]=(0,p.useState)(`all`),[T,D]=(0,p.useState)(``),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)(t);if(t!==Ee){De(t),D(``);let e=be(t,l);e!==g&&(_(e),y(``),x(`all`),w(`all`))}let[Oe,ke]=(0,p.useState)(n);n!==Oe&&(ke(n),D(``));let{data:O,error:Ae,reload:je}=u(()=>r.catalog(g),[g,i],`catalog`),k=l?null:me[g]||null,A=k!==null,{data:j}=u(()=>A?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[A,i],`usage`,{revalidate:!0}),M=A&&!!j?.enabled&&Array.isArray(j.names),Me=(0,p.useMemo)(()=>new Map((Array.isArray(j?.names)?j.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[j]),N=e=>M&&Me.get(`${k}\u0000${e}`)||null,P=e=>{let t=N(e.name);return!t||t.n===0&&!t.last},Ne=j?.since?`No call since ${j.since}`:`No call recorded yet`,F=O?.section===g&&O?.items||[],I=g===`skills`,Pe=I?Se(F):null,L=I?Pe.rows:g===`memory`?Ce(F):F,R=n||L[0]?.name||null,z=R?F.find(e=>e.name===R):null,Fe=z?.type||a[g].type,{data:Ie,error:B}=u(()=>R?r.item(Fe,R):Promise.resolve(null),[g,R,Fe,i]),V=B?null:Ie,Le=T||Ae||B,Re=R?{name:R,title:V?.title||R,desc:V?.desc||``}:null,H=z||Re,ze=e?.counts||{},U=I?L.filter(e=>b===`all`||e.cat===b):L,Be=M?U.filter(P).length:0,Ve=e=>e.status===`experimental`,W=U.filter(Ve).length,G=[[`all`,`All`,U.length],...M?[[`used`,`Used`,U.length-Be],[`unused`,`Not used yet`,Be,Ne]]:[],...W?[[`experimental`,`Experimental`,W,`Shipped, not yet confirmed by real use`]]:[]],K=G.some(([e])=>e===S)?S:`all`,q=K===`all`?U:K===`experimental`?U.filter(Ve):U.filter(e=>P(e)===(K===`unused`)),He=M?Math.max(0,...F.map(e=>N(e.name)?.n||0)):0,J=I?1/0:50,Y=v.trim().toLowerCase(),X=Y?oe(q,Y):q.slice(0,J),Ue=!Y&&b===`all`&&K===`all`&&R&&!X.some(e=>e.name===R)?[...X,...L.filter(e=>e.name===R)]:X,We=e=>d?`${d}/${xe(e.name)}`:`#/item/${e.type||a[g].type}/${xe(e.name)}`,Ge=async()=>{let e=H?.name;if(e&&await h(`Forget the memory fact "${e}"? It leaves the index and moves to memory/archive/ (geneseed memory rm --archived --purge deletes it for good).`,{title:`Forget this fact?`,confirmLabel:`Forget`,tone:`danger`})){D(``);try{await r.memoryDelete(e)}catch(t){D(`Could not forget "${e}": ${t.message}`);return}re(d||`#/section/memory`),je()}},Ke=async()=>{let e=H?.name;if(e&&await h(`Promote "${e}" into a standing rule? It is appended to user-rules.md as a trial rule (a month of probation), and the memory fact moves to memory/archive/ so the lesson isn't loaded twice.`,{title:`Promote to a rule?`,confirmLabel:`Promote`})){D(``);try{let t=await r.rules();await r.rulesPromote({name:e,fingerprint:t.fingerprint,delete_memory:!0}),te(),de?.(),re(`#/personal/rules`)}catch(e){D(`Could not promote: ${e.message}`),je()}}},Z=V?.body?_e(V.body,V.desc||H?.desc):null,qe=V?.title||H?.title||H?.name,Je=qe===H?.name&&Z?.title?Z.title:qe,Ye=O?.section===g&&F.length===0,Xe=V?.status||H?.status,Ze=g===`skills`?c[z?.klass]:null,Q=a[g].label,{lede:Qe,when:$e}=E(V?.desc||H?.desc||``),$=H?V?.source||H.source||(B?null:C(g,H.name)):null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(s,{error:Le,style:{margin:`0 0 var(--sp-3)`}}),(0,m.jsxs)(`div`,{className:`library lib-dossier${l?` locked`:``}${M?` uses`:``}`,children:[l?null:(0,m.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,m.jsxs)(`div`,{className:`lib-title`,children:[(0,m.jsx)(`h1`,{className:`h`,children:`Library`}),(0,m.jsx)(`span`,{className:`dim`,children:`What the agent knows`})]}),(0,m.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,m.jsxs)(p.Fragment,{children:[(0,m.jsxs)(`a`,{href:`#/section/${e}`,className:g===e?`on`:``,"aria-current":g===e?`page`:void 0,children:[a[e].label,(0,m.jsx)(`span`,{className:`mono dim`,children:ze[e]??``})]}),e===g&&I&&(0,m.jsx)(le,{label:`Skill types`,total:F.length,cats:Pe.cats,cat:b,onChange:x})]},e))})]}),(0,m.jsxs)(ie,{label:Q,count:Y?`${X.length} of ${q.length}`:q.length,q:v,onQ:y,matched:X.length,inView:[g,n],extra:M&&j.since?(0,m.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,j.since]}):null,tools:G.length>1?(0,m.jsx)(ne,{"aria-label":`Show`,children:G.map(([e,t,n,r])=>(0,m.jsxs)(`button`,{type:`button`,className:K===e?`on`:``,"aria-pressed":K===e,title:r,onClick:()=>w(e),children:[t,` `,(0,m.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[(0,m.jsx)(se,{rows:Ue,activeName:H?.name,hrefOf:We,pills:M?e=>{let t=N(e.name)?.n||0;return(0,m.jsxs)(`span`,{className:`lr-use`,children:[(0,m.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,m.jsx)(`i`,{style:{width:he(t,He)}})}),(0,m.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,m.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})}:void 0}),!Y&&F.length>J&&(0,m.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,J,` of `,F.length,`; type to search the rest.`]}),Ye&&(g===`wiki`?(0,m.jsxs)(f,{title:`No wiki entries`,action:(0,m.jsx)(`a`,{href:`#/section/config`,children:`Open the setup files`}),docs:{href:`#/docs/wiki`,label:`How to configure a wiki →`},children:[`Declare a wiki in `,(0,m.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,m.jsx)(f,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,m.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:H?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`reader-tags`,children:[(0,m.jsx)(`span`,{className:`tag acc`,children:Q.replace(/s$/,``)}),Ze?(0,m.jsx)(`span`,{className:`tag`,children:Ze.label}):null,V?.kit??H.kit?(0,m.jsx)(ae,{name:V?.kit??H.kit}):null,(0,m.jsx)(ce,{status:Xe,withHint:!0}),$?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`mono dim reader-src`,children:$}),(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),Te({src:$,ok:!0})}catch{Te({src:$,ok:!1})}},children:we?.src===$?we.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,m.jsxs)(`div`,{className:`reader-head`,children:[(0,m.jsx)(`h2`,{className:`reader-title`,children:Je}),g===`agents`?(0,m.jsx)(pe,{name:H.name}):null]}),(0,m.jsxs)(`div`,{className:`reader-intro${M?` with-stats`:``}`,children:[(0,m.jsxs)(`div`,{className:`reader-intro-text`,children:[Qe?(0,m.jsx)(`p`,{className:`reader-lede`,children:Qe}):null,$e?(0,m.jsxs)(`section`,{className:`reader-when`,children:[(0,m.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,m.jsx)(`p`,{children:$e})]}):null]}),M?(0,m.jsx)(ve,{u:N(H.name),usage:j,noCall:Ne}):null]}),g===`memory`&&H.name!==`MEMORY`&&H.name!==`README`&&(0,m.jsxs)(`div`,{className:`row gap-8`,children:[(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Ke,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Ge,children:`Forget this fact`})]}),(0,m.jsx)(`hr`,{className:`hr`}),B?(0,m.jsxs)(`p`,{className:`sub`,children:[`No `,Q.replace(/s$/,``).toLowerCase(),` named `,(0,m.jsx)(`em`,{children:H.name}),` could be read in this install.`]}):H?.kind===`manifest`||V?.manifest!==void 0?V?(0,m.jsx)(fe,{manifest:V.manifest,body:V.body,name:H.name}):(0,m.jsx)(`p`,{className:`sub`,children:`Loading…`}):V?.body?(0,m.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,m.jsx)(ue,{body:Z.body,links:V.links||[]})}):V===null&&R?(0,m.jsx)(`p`,{className:`sub`,children:`Loading…`}):(0,m.jsx)(ge,{section:g,source:C(g,H.name)}),ye[g]?(0,m.jsx)(`div`,{className:`reader-links`,children:(0,m.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${ye[g]}`,children:[`About `,Q.toLowerCase(),` in Docs`]})}):null]}):Ye?null:(0,m.jsx)(f,{title:`Select an entry`,children:`Pick something from the list to read it.`})})]})]})}export{_e as bodyHead,D as default,Ce as groupMemory,Se as splitSkills,E as splitWhen};