geneseed 6.0.0 → 6.0.2

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 (46) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/SHIPPED.md +1 -1
  3. package/docs/concepts/agents.md +3 -1
  4. package/harness.config.json +1 -1
  5. package/js/README.md +2 -0
  6. package/js/build/emit-claude.mjs +2 -2
  7. package/js/build/emit-opencode.mjs +4 -2
  8. package/js/build/source.mjs +1 -1
  9. package/js/cli-table.json +1 -1
  10. package/js/hosts/native.mjs +62 -26
  11. package/js/hosts/opencode.mjs +3 -2
  12. package/js/inspect/checks-build.mjs +2 -2
  13. package/js/web/agent-models-api.mjs +207 -0
  14. package/js/web/api.mjs +3 -0
  15. package/js/web/model-catalog.mjs +324 -0
  16. package/js/web/routes.mjs +7 -1
  17. package/package.json +1 -1
  18. package/web/dist/assets/{ActiveLoops-DOJCPPPc.js → ActiveLoops-BWkImeYa.js} +1 -1
  19. package/web/dist/assets/{Activity-bUSPM3Dl.js → Activity-DJlPhk8q.js} +1 -1
  20. package/web/dist/assets/{ActivityDetail-AHRoXeFN.js → ActivityDetail-Dk7UPnE_.js} +1 -1
  21. package/web/dist/assets/{Bonsai-B5XY9pid.js → Bonsai-Bry-kOFb.js} +1 -1
  22. package/web/dist/assets/{CopyButton-C0wwRR9H.js → CopyButton-Cnnvjgkg.js} +1 -1
  23. package/web/dist/assets/{Dashboard-DPAA96EI.js → Dashboard-CWhh_GSc.js} +2 -2
  24. package/web/dist/assets/{Docs-CpGDq165.js → Docs-BJ23-fIx.js} +1 -1
  25. package/web/dist/assets/{Factories-cNhETa5Q.js → Factories-CjsIACyi.js} +1 -1
  26. package/web/dist/assets/{GreenhouseView-DO3ADmT9.js → GreenhouseView-VL_ZKJUR.js} +1 -1
  27. package/web/dist/assets/Installs-qcfOZNzF.js +3 -0
  28. package/web/dist/assets/{JournalView--W-Lw_V9.js → JournalView-KrmFUC-X.js} +1 -1
  29. package/web/dist/assets/{Kits-ChfehxY6.js → Kits-DDSerkJk.js} +1 -1
  30. package/web/dist/assets/{Laws-CNxYmV36.js → Laws-DDffPs6O.js} +1 -1
  31. package/web/dist/assets/{LibRows-CiPvsRYB.js → LibRows-QsUBjOF7.js} +1 -1
  32. package/web/dist/assets/Library-DzT3Mebh.js +3 -0
  33. package/web/dist/assets/{Loops-DAblKkyq.js → Loops-CjsX3brz.js} +1 -1
  34. package/web/dist/assets/Models-DPrAv3FG.js +1 -0
  35. package/web/dist/assets/{OperatorHudView-QtSaSyYm.js → OperatorHudView-Bdupodlc.js} +1 -1
  36. package/web/dist/assets/{Personal-DxSGv638.js → Personal-D-dpCUU5.js} +1 -1
  37. package/web/dist/assets/{Settings-CgTbhvRv.js → Settings-Dz33_Sys.js} +1 -1
  38. package/web/dist/assets/{Tabs-Cf4X1hdz.js → Tabs-qY40S34V.js} +1 -1
  39. package/web/dist/assets/api-C8nMUU1i.js +1 -0
  40. package/web/dist/assets/{index-B_pTwZra.js → index-BhT94v2q.js} +3 -3
  41. package/web/dist/assets/index-DcusoHzF.css +1 -0
  42. package/web/dist/index.html +3 -3
  43. package/web/dist/assets/Installs-D3dDyq10.js +0 -3
  44. package/web/dist/assets/Library-BxQvbwVU.js +0 -3
  45. package/web/dist/assets/api-CZ-x0iWG.js +0 -1
  46. package/web/dist/assets/index-CzfImiYb.css +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{ft as r}from"./index-B_pTwZra.js";var i=e(t(),1),a=e=>{let t=2166136261;for(let n of String(e))t=Math.imul(t^n.charCodeAt(0),16777619);return t>>>0},o=e=>()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296},s=e=>Math.max(0,Math.min(1,e)),c={claude:[`#8E4A33`,`#C46A4C`,`#E3906F`],bob:[`#173F8C`,`#2A5CC0`,`#6A96E8`],opencode:[`#5E6670`,`#98A2AD`,`#C8D0D8`],openclaude:[`#2F1F55`,`#4E3484`,`#8A6CC8`]},l={live:[`#16393D`,`#1F5A55`,`#2C7D55`,`#5DA845`,`#A8D23E`],sakura:[`#16393D`,`#6E2A55`,`#B83C80`,`#E9649F`,`#FFB0D2`],done:[`#5A2E14`,`#8A4A1C`,`#B8702A`,`#DB9A3E`,`#F2C46A`],idle:[`#2E3236`,`#44494E`,`#5E646A`,`#7C8288`,`#A2A7AC`]},u={developer:[`#123A3F`,`#1A5A5E`,`#24806F`,`#3FB08A`,`#8EE6C2`],explorer:[`#2C3A12`,`#4A6418`,`#6E9424`,`#9CC23A`,`#DDF07A`],reviewer:[`#16283F`,`#1F3E66`,`#2E5E92`,`#4A86C4`,`#9AC8F0`],tester:[`#3A3012`,`#5E4C18`,`#8A6E22`,`#B8952E`,`#EAD27A`]},d=[`#4E2E1C`,`#7A4A2E`,`#A2683F`,`#C78A5A`],f=[`#34312F`,`#4F4A46`,`#6B6560`,`#8A847E`],p=[`#3E8E41`,`#5FB14F`],m=[`#4A4F54`,`#62686E`],h=`#FFF6E0`,g=[`#E3C24A`,`#C9A23A`],_=[`#9BDD6A`,`#D8F59A`],v={"!":`#E8B04A`,x:`#FF6F69`},y=12;function b(e){let t=String(e||``).toLowerCase();return/implement|develop/.test(t)?`developer`:/explor/.test(t)?`explorer`:/review/.test(t)?`reviewer`:/test/.test(t)?`tester`:null}var x=e=>e?.status===`blocked`||e?.status===`waiting-input`;function S(e){return Array.isArray(e.files_all)?e.files_all.filter(e=>e&&typeof e==`object`):(Array.isArray(e.files?.items)?e.files.items:[]).filter(e=>e&&typeof e==`object`).map(e=>({file:e.file??null,path:e.path??null,additions:e.additions??0,deletions:e.deletions??0,by:e.by??null}))}var C=e=>e==null||e===``?NaN:Number(e);function w(e){let t=C(e?.context?.used),n=C(e?.context?.window);return Number.isFinite(t)&&Number.isFinite(n)&&n>0?s(t/n):null}function T(e){let t=S(e),n=(Array.isArray(e.agents)?e.agents:[]).filter(e=>e&&typeof e==`object`).map((e,t)=>({key:e.id??`#${t}`,id:e.id??null,type:e.type||null,running:e.status!==`done`,files:[]})),r=new Map(n.map(e=>[e.key,e])),i=[],a=e.attribution!==!1;for(let e of t){if(!a||e.by==null){i.push(e);continue}let t=r.get(e.by);t||(t={key:e.by,id:e.by,type:`agent`,running:!0,files:[]},n.push(t),r.set(e.by,t)),t.files.push(e)}let o=w(e),l=o!=null,u=l?C(e.context.used):NaN,d=l?o:.5,f=Math.max(0,Math.floor(Number(e.compactions)||0)),p=C(e.context_at_compaction),m=f===0?1:l&&Number.isFinite(p)&&p>0?s(u/p):0;return{id:String(e.session_id??``),host:c[e.host]?e.host:`claude`,idle:e.status===`idle`,bubble:x(e)?`!`:e.error?`x`:null,turns:Math.max(0,Number(e.turns)||0),ctx:d,compactions:f,compacted:f>0&&m<1,regrow:m,crown:i,agents:n}}function E(e,t=!1){let n=T(e);return JSON.stringify([n.id,n.host,n.idle,n.bubble,n.turns,Math.round(n.ctx*100),n.compactions,Math.round(n.regrow*100),n.crown.length,n.agents.map(e=>[e.key,e.type,e.running,e.files.length]),!!t])}function D(e,{sakura:t=!1}={}){let n=T(e),{id:r,idle:i}=n,s=Math.min(1,Math.log1p(n.turns)/Math.log1p(40)),x=.55+.45*s,S=o(a(r)),C=Array.from({length:56},()=>Array(56).fill(null)),w=Array.from({length:56},()=>Array(56).fill(-1)),E=-1,D=(e,t,n)=>{e=Math.round(e),t=Math.round(t),e>=0&&e<56&&t>=0&&t<56&&(C[t][e]=n,w[t][e]=E)},O=i?f:d,k=i?m:p,A=i?l.idle:t?l.sakura:l.live,j=Math.round(41-(9+18*s)),M=1+S()*2+3*s,N=S()*Math.PI*2,P=.9+S()*.6,F=e=>28+M*Math.sin(e*Math.PI*P+N)-M*Math.sin(N);for(let e=41;e>=j;e--){let t=(41-e)/(41-j),n=F(t),r=3+4.5*s-(1.5+3.5*s)*t;for(let t=Math.floor(n-r/2);t<=Math.ceil(n+r/2);t++){let i=(t-(n-r/2))/r;D(t,e,i<.25?O[3]:i>.75?O[0]:S()<.15?O[1]:O[2])}}for(let e=-6;e<=6;e++)D(28+e,41,Math.abs(e)>4?O[1]:O[2]),Math.abs(e)<=5&&D(28+e,40,Math.abs(e)>3?O[1]:O[2]);let I=[],L=(e,t,n,i,s,c)=>{n*=1.15,e=Math.max(n+2,Math.min(53-n,e));let l=o(a(`${r}:pad:${c}`)),u=n*.72;t=Math.max(t,u+6);for(let r=0;r<6;r++){let r=-Math.PI*(.15+.7*l()),i=n*(.4+.5*l());for(let n=0;n<i;n++)D(e+Math.cos(r)*n,t+u*.5+Math.sin(r)*n*.8,O[0])}let d=Math.round(10+n*1.6),f=[];for(let r=0;r<d;r++){let r=l()*Math.PI*2,i=Math.sqrt(l());f.push([e+Math.cos(r)*i*n,t+Math.sin(r)*i*u,1.8+l()*2.2])}f.sort((e,t)=>t[1]-e[1]);for(let[e,n,r]of f){let a=Math.max(0,Math.min(4,Math.round(4*(1-(n-(t-u))/(2*u))+(l()-.5))));for(let t=Math.floor(n-r);t<=n+r;t++)for(let o=Math.floor(e-r);o<=e+r;o++){if(((o-e)**2+(t-n)**2)/(r*r)>1+(l()-.5)*.5)continue;let s=o-e+(t-n)<-r*.3?1:t-n>r*.5?-1:0;D(o,t,i[Math.max(0,Math.min(4,a+s))])}}let p=o(a(`${r}:bloom:${c}`));for(let r=0;r<Math.min(s,y);r++)D(e+(p()*2-1)*n*.8,t-p()*u*.9,h);return{rx:n,cy:t}},R=o(a(`${r}:side`))()<.5?-1:1,z=[];n.agents.forEach((e,t)=>{let c=.25+.55*(t/Math.max(1,n.agents.length-1)),l=Math.round(41-c*(41-j)),d=F(c);if(!e.running){let t=(3+4.5*s-(1.5+3.5*s)*c)/2;E=-1,D(d+R*(t+1),l,O[3]),D(d+R*(t+2),l-1,O[2]),z.push({agentId:e.id,type:e.type,files:e.files}),R=-R;return}let f=Math.round((12+Math.floor(o(a(`${r}:branch:${e.key}`))()*4))*x);E=-1;for(let e=0;e<=f;e++){let t=d+R*e,n=l-e*.45;D(t,n,O[e<f/2?1:2]),D(t,n+1,O[0]),e<f*.6&&D(t,n+2,O[0])}let p=i?null:b(e.type),m=p?u[p]:A;E=I.length,I.push({agentId:e.id,key:e.key,type:e.type,family:p,files:e.files,bbox:null}),L(d+R*f,l-f*.45-2,(8+Math.min(e.files.length,6)*.6)*x,m,e.files.length,e.key),R=-R});let B=I.length;I.push({agentId:null,key:null,type:null,family:null,files:n.crown,bbox:null}),E=B;let V=(4+7*n.ctx+Math.min(n.crown.length,6)*.5)*x*1.35,{rx:H,cy:U}=L(F(1),j-3,V,A,n.crown.length,`crown`);if(n.ctx>.8&&!n.compacted){let e=o(a(`${r}:yellow`));for(let t=0;t<56;t++)for(let n=0;n<56;n++)w[t][n]===B&&C[t][n]!==h&&t<U-H*.2&&e()<.55&&(C[t][n]=e()<.5?g[0]:g[1])}if(n.compacted){let e=o(a(`${r}:shoots`)),t=Math.round(U-H*.15-n.regrow*H*.5);for(let e=0;e<Math.max(0,t);e++)for(let t=0;t<56;t++)w[e][t]===B&&(C[e][t]=null,w[e][t]=-1);if(t>=0&&t<56)for(let r=0;r<56;r++){if(w[t][r]!==B||e()>=.12+n.regrow*.5)continue;let i=1+Math.floor(e()*(1+n.regrow*3));for(let e=1;e<=i;e++)D(r,t-e,e===i?_[1]:_[0])}}E=-1;let W=o(a(`${r}:fallen`));z.forEach((e,t)=>D(16+(t*7+Math.floor(W()*4))%24,40,l.done[2+t%2]));for(let e=0;e<Math.min(n.compactions,6);e++)D(15+e*2,42,h);let[G,K,q]=c[n.host];for(let e=42;e<=46;e++){let t=e<=43?0:Math.floor((e-43)*.45)+2;for(let n=13+t;n<=42-t;n++){if(e===42&&C[e][n]===h)continue;let r=K;e<=43?r=e===42?q:G:(e===46||n===13+t||n===42-t)&&(r=G),D(n,e,r)}}let J=o(a(`${r}:moss`));for(let e=15;e<=40;e++)D(e,41,J()<.5?k[0]:k[1]),J()<.35&&D(e,40,k[0]);for(let e=16;e<=39;e++)D(e,47,`#00000055`);if(n.bubble){let e=v[n.bubble];for(let t=3;t<10;t++)for(let n=40;n<47;n++)D(n,t,t===3||t===9||n===40||n===46?e:`#14191F`);if(D(41,10,e),n.bubble===`!`){for(let t=5;t<=6;t++)D(43,t,e);D(43,8,e)}else for(let[t,n]of[[2,2],[4,2],[3,3],[2,4],[4,4]])D(40+t,3+n,e)}let Y=[],X=I.map(()=>null);for(let e=0;e<56;e++){let t=0;for(;t<56;){let n=C[e][t],r=w[e][t];if(!n){t++;continue}let i=t;for(;i+1<56&&C[e][i+1]===n&&w[e][i+1]===r;)i++;if(Y.push({x:t,y:e,w:i-t+1,c:n,p:r}),r>=0){let n=X[r]||={x0:t,y0:e,x1:i,y1:e};n.x0=Math.min(n.x0,t),n.x1=Math.max(n.x1,i),n.y1=e}t=i+1}}return I.forEach((e,t)=>{let n=X[t];e.bbox=n?{x:n.x0,y:n.y0,w:n.x1-n.x0+1,h:n.y1-n.y0+1}:null}),{width:56,height:56,runs:Y,pads:I,bubble:n.bubble,fallen:z}}var O=e=>{if(!e)return``;let t=String(e).replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||String(e)},k=e=>e?String(e).replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase():``;function A(e){let t=new Map;for(let n of e||[]){let e=n.repo||n.root,r=n.repo_key||(e?k(e):n.cwd?`cwd:${k(n.cwd)}`:`outside a repo`),i=O(e||n.cwd)||`outside a repo`;t.has(r)||t.set(r,{key:r,name:i,trees:[]});let a=n.root&&e&&k(n.root)!==k(e)?O(n.root):null;t.get(r).trees.push({s:n,worktree:a})}let n=(e,t)=>e<t?-1:+(e>t),r=[...t.values()];for(let e of r)e.trees.sort((e,t)=>n(e.worktree||``,t.worktree||``)||n(String(e.s.session_id),String(t.s.session_id)));return r.sort((e,t)=>n(e.name.toLowerCase(),t.name.toLowerCase())||n(e.key,t.key))}var j=e=>e.key??(e.install?`${e.install}\0${e.session_id}`:String(e.session_id)),M=e=>j({key:e.key??void 0,install:e.install,session_id:e.sid}),N=(e,t)=>String(e).split(/[\\/]+/).filter(Boolean).slice(-t).join(`/`),P=e=>r(e.host).label;function F(e){let t=e||[],n=e=>n=>t.filter(t=>e(t)===e(n)).length,r=n(e=>e.host),i=n(e=>`${e.host} ${e.scope}`),a=new Map(t.map(e=>[e.install,r(e)<2?P(e):i(e)<2||e.scope===`global`?`${P(e)} · ${e.scope}`:`${P(e)} · ${O(e.path)}`])),o=()=>t.filter(e=>t.some(t=>t!==e&&a.get(t.install)===a.get(e.install)));for(let e=2,t=o();t.length;e++,t=o()){for(let n of t){let t=String(n.path).split(/[\\/]+/).filter(Boolean).length;a.set(n.install,`${P(n)} · ${e>t?n.path:N(n.path,e)}`)}if(e>64)break}return a}var I=(e,t)=>`#/activity/${encodeURIComponent(e)}`+(t?`?${new URLSearchParams({host:t.host,path:t.path})}`:``);function L(e,t){let n=String(e).indexOf(`?`),r=new URLSearchParams(String(t||``).split(`?`)[1]||``),i=r.get(`host`),a=r.get(`path`);return{sid:n<0?e:String(e).slice(0,n),install:i&&a?{host:i,path:a}:void 0}}function R(e,t){let n=new Map((t||[]).map(e=>[e.install,e])),i=F(t);return(e||[]).map(e=>{let t=n.get(e.install);return{...e,host:t?.host??e.host,chip:i.get(e.install)??(e.host?r(e.host).label:null),href:I(e.session_id,t)}})}var z=(e,t)=>new Set((e.writers||[]).filter(e=>M(e)===t).map(e=>k(e.root)));function B(e,t,n){let r=z(e,t);for(let t of z(e,n))if(r.has(t))return`same-worktree`;return`cross-worktree`}var V=e=>[...new Set((e.writers||[]).map(M))];function H(e,t){let n=new Map(e.map((e,t)=>[j(e.s),t])),r=new Map;for(let e of t||[]){let t=V(e).filter(e=>n.has(e));for(let i=0;i<t.length;i++)for(let a=i+1;a<t.length;a++){let o=n.get(t[i]),s=n.get(t[a]),c=o<s?`${o}-${s}`:`${s}-${o}`,l=B(e,t[i],t[a]);r.has(c)&&l!==`same-worktree`||r.set(c,{a:o,b:s,kind:l})}}return[...r.values()]}function U(e,t){let n=[];for(let r of t||[]){let t=V(r).filter(t=>t!==e);if(!t.length||!V(r).includes(e))continue;let i=t.some(t=>B(r,e,t)===`same-worktree`);n.push({path:r.path,kind:i?`same-worktree`:`cross-worktree`})}return n}var W=e=>e?.status===`busy`||x(e);function G(e,t=10){let n=e.map(e=>({...e,collapsed:!1})),r=n.reduce((e,t)=>e+t.trees.length,0);if(r<=t)return n;let i=n.length,a=n.filter(e=>!e.trees.some(e=>W(e.s))).sort((e,t)=>t.trees.length-e.trees.length||(e.key<t.key?-1:1));for(let e of a){if(r<=t||i<=1)break;e.collapsed=!0,r-=e.trees.length,i--}return n}var K=n(),q=12,J=10,Y=`geneseed-garden-sakura`;function X(){try{return window.localStorage.getItem(Y)===`1`}catch{return!1}}var Z=e=>e.key==null?`the session`:e.type||`agent`,Q=e=>e.path||e.file||`?`;function $({pad:e}){let t=e.files.slice(0,q);return(0,K.jsxs)(`div`,{className:`card gd-card`,children:[(0,K.jsxs)(`div`,{className:`act-lbl`,children:[Z(e),` · `,e.files.length,` file`,e.files.length===1?``:`s`]}),(0,K.jsx)(`ul`,{className:`gd-files`,children:t.map((e,t)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mono act-ell`,children:Q(e)}),(0,K.jsxs)(`span`,{className:`mono act-xs`,children:[(0,K.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions??0]}),` `,(0,K.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions??0]})]})]},`${Q(e)}:${t}`))}),e.files.length>t.length&&(0,K.jsxs)(`div`,{className:`dim act-xs`,children:[`+`,e.files.length-t.length,` more`]})]})}var ee=e=>e?`${Z(e)}: ${e.files.length} file${e.files.length===1?``:`s`}`:``;function te(e,t,n,r){let i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];e.key===`Escape`&&n!=null&&r(null),i&&t&&(e.preventDefault(),r(n==null?i>0?0:t-1:(n+i+t)%t))}var ne=(0,i.memo)(function({t:e,pad:t,swaying:n,onPad:r,px:a,label:o}){let s=(0,i.useMemo)(()=>{let t=new Map;for(let n of e.runs)t.has(n.p)||t.set(n.p,[]),t.get(n.p).push(n);return[...t.entries()]},[e]),c=(0,i.useRef)(null),l=e=>{let[t,n]=[c.current,e.changedTouches?.[0]];return!!t&&!!n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>J};return(0,K.jsx)(`svg`,{onTouchStart:e=>{let t=e.touches?.[0];c.current=t?{x:t.clientX,y:t.clientY}:null},className:`gd-svg${t==null?``:` gd-dimming`}`,viewBox:`0 0 56 56`,width:56*a,height:56*a,shapeRendering:`crispEdges`,"data-bubble":e.bubble||void 0,...o?{role:`img`,"aria-label":o}:{"aria-hidden":`true`},children:s.map(([i,a])=>(0,K.jsx)(`g`,{"data-p":i,className:[i===t&&`gd-hot`,n&&i>=0&&e.pads[i].key!=null&&`gd-sway`].filter(Boolean).join(` `)||void 0,onMouseEnter:i>=0?()=>r(i):void 0,onMouseLeave:i>=0?()=>r(null):void 0,onTouchEnd:i>=0?e=>{l(e)||(e.cancelable&&e.preventDefault(),r(i===t?null:i))}:void 0,children:a.map(e=>(0,K.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:1,fill:e.c},`${e.x},${e.y}`))},i))})});export{H as _,ee as a,G as c,L as d,D as f,U as g,R as h,te as i,w as l,F as m,Y as n,X as o,A as p,ne as r,j as s,$ as t,I as u,E as v};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{ft as r}from"./index-BhT94v2q.js";var i=e(t(),1),a=e=>{let t=2166136261;for(let n of String(e))t=Math.imul(t^n.charCodeAt(0),16777619);return t>>>0},o=e=>()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296},s=e=>Math.max(0,Math.min(1,e)),c={claude:[`#8E4A33`,`#C46A4C`,`#E3906F`],bob:[`#173F8C`,`#2A5CC0`,`#6A96E8`],opencode:[`#5E6670`,`#98A2AD`,`#C8D0D8`],openclaude:[`#2F1F55`,`#4E3484`,`#8A6CC8`]},l={live:[`#16393D`,`#1F5A55`,`#2C7D55`,`#5DA845`,`#A8D23E`],sakura:[`#16393D`,`#6E2A55`,`#B83C80`,`#E9649F`,`#FFB0D2`],done:[`#5A2E14`,`#8A4A1C`,`#B8702A`,`#DB9A3E`,`#F2C46A`],idle:[`#2E3236`,`#44494E`,`#5E646A`,`#7C8288`,`#A2A7AC`]},u={developer:[`#123A3F`,`#1A5A5E`,`#24806F`,`#3FB08A`,`#8EE6C2`],explorer:[`#2C3A12`,`#4A6418`,`#6E9424`,`#9CC23A`,`#DDF07A`],reviewer:[`#16283F`,`#1F3E66`,`#2E5E92`,`#4A86C4`,`#9AC8F0`],tester:[`#3A3012`,`#5E4C18`,`#8A6E22`,`#B8952E`,`#EAD27A`]},d=[`#4E2E1C`,`#7A4A2E`,`#A2683F`,`#C78A5A`],f=[`#34312F`,`#4F4A46`,`#6B6560`,`#8A847E`],p=[`#3E8E41`,`#5FB14F`],m=[`#4A4F54`,`#62686E`],h=`#FFF6E0`,g=[`#E3C24A`,`#C9A23A`],_=[`#9BDD6A`,`#D8F59A`],v={"!":`#E8B04A`,x:`#FF6F69`},y=12;function b(e){let t=String(e||``).toLowerCase();return/implement|develop/.test(t)?`developer`:/explor/.test(t)?`explorer`:/review/.test(t)?`reviewer`:/test/.test(t)?`tester`:null}var x=e=>e?.status===`blocked`||e?.status===`waiting-input`;function S(e){return Array.isArray(e.files_all)?e.files_all.filter(e=>e&&typeof e==`object`):(Array.isArray(e.files?.items)?e.files.items:[]).filter(e=>e&&typeof e==`object`).map(e=>({file:e.file??null,path:e.path??null,additions:e.additions??0,deletions:e.deletions??0,by:e.by??null}))}var C=e=>e==null||e===``?NaN:Number(e);function w(e){let t=C(e?.context?.used),n=C(e?.context?.window);return Number.isFinite(t)&&Number.isFinite(n)&&n>0?s(t/n):null}function T(e){let t=S(e),n=(Array.isArray(e.agents)?e.agents:[]).filter(e=>e&&typeof e==`object`).map((e,t)=>({key:e.id??`#${t}`,id:e.id??null,type:e.type||null,running:e.status!==`done`,files:[]})),r=new Map(n.map(e=>[e.key,e])),i=[],a=e.attribution!==!1;for(let e of t){if(!a||e.by==null){i.push(e);continue}let t=r.get(e.by);t||(t={key:e.by,id:e.by,type:`agent`,running:!0,files:[]},n.push(t),r.set(e.by,t)),t.files.push(e)}let o=w(e),l=o!=null,u=l?C(e.context.used):NaN,d=l?o:.5,f=Math.max(0,Math.floor(Number(e.compactions)||0)),p=C(e.context_at_compaction),m=f===0?1:l&&Number.isFinite(p)&&p>0?s(u/p):0;return{id:String(e.session_id??``),host:c[e.host]?e.host:`claude`,idle:e.status===`idle`,bubble:x(e)?`!`:e.error?`x`:null,turns:Math.max(0,Number(e.turns)||0),ctx:d,compactions:f,compacted:f>0&&m<1,regrow:m,crown:i,agents:n}}function E(e,t=!1){let n=T(e);return JSON.stringify([n.id,n.host,n.idle,n.bubble,n.turns,Math.round(n.ctx*100),n.compactions,Math.round(n.regrow*100),n.crown.length,n.agents.map(e=>[e.key,e.type,e.running,e.files.length]),!!t])}function D(e,{sakura:t=!1}={}){let n=T(e),{id:r,idle:i}=n,s=Math.min(1,Math.log1p(n.turns)/Math.log1p(40)),x=.55+.45*s,S=o(a(r)),C=Array.from({length:56},()=>Array(56).fill(null)),w=Array.from({length:56},()=>Array(56).fill(-1)),E=-1,D=(e,t,n)=>{e=Math.round(e),t=Math.round(t),e>=0&&e<56&&t>=0&&t<56&&(C[t][e]=n,w[t][e]=E)},O=i?f:d,k=i?m:p,A=i?l.idle:t?l.sakura:l.live,j=Math.round(41-(9+18*s)),M=1+S()*2+3*s,N=S()*Math.PI*2,P=.9+S()*.6,F=e=>28+M*Math.sin(e*Math.PI*P+N)-M*Math.sin(N);for(let e=41;e>=j;e--){let t=(41-e)/(41-j),n=F(t),r=3+4.5*s-(1.5+3.5*s)*t;for(let t=Math.floor(n-r/2);t<=Math.ceil(n+r/2);t++){let i=(t-(n-r/2))/r;D(t,e,i<.25?O[3]:i>.75?O[0]:S()<.15?O[1]:O[2])}}for(let e=-6;e<=6;e++)D(28+e,41,Math.abs(e)>4?O[1]:O[2]),Math.abs(e)<=5&&D(28+e,40,Math.abs(e)>3?O[1]:O[2]);let I=[],L=(e,t,n,i,s,c)=>{n*=1.15,e=Math.max(n+2,Math.min(53-n,e));let l=o(a(`${r}:pad:${c}`)),u=n*.72;t=Math.max(t,u+6);for(let r=0;r<6;r++){let r=-Math.PI*(.15+.7*l()),i=n*(.4+.5*l());for(let n=0;n<i;n++)D(e+Math.cos(r)*n,t+u*.5+Math.sin(r)*n*.8,O[0])}let d=Math.round(10+n*1.6),f=[];for(let r=0;r<d;r++){let r=l()*Math.PI*2,i=Math.sqrt(l());f.push([e+Math.cos(r)*i*n,t+Math.sin(r)*i*u,1.8+l()*2.2])}f.sort((e,t)=>t[1]-e[1]);for(let[e,n,r]of f){let a=Math.max(0,Math.min(4,Math.round(4*(1-(n-(t-u))/(2*u))+(l()-.5))));for(let t=Math.floor(n-r);t<=n+r;t++)for(let o=Math.floor(e-r);o<=e+r;o++){if(((o-e)**2+(t-n)**2)/(r*r)>1+(l()-.5)*.5)continue;let s=o-e+(t-n)<-r*.3?1:t-n>r*.5?-1:0;D(o,t,i[Math.max(0,Math.min(4,a+s))])}}let p=o(a(`${r}:bloom:${c}`));for(let r=0;r<Math.min(s,y);r++)D(e+(p()*2-1)*n*.8,t-p()*u*.9,h);return{rx:n,cy:t}},R=o(a(`${r}:side`))()<.5?-1:1,z=[];n.agents.forEach((e,t)=>{let c=.25+.55*(t/Math.max(1,n.agents.length-1)),l=Math.round(41-c*(41-j)),d=F(c);if(!e.running){let t=(3+4.5*s-(1.5+3.5*s)*c)/2;E=-1,D(d+R*(t+1),l,O[3]),D(d+R*(t+2),l-1,O[2]),z.push({agentId:e.id,type:e.type,files:e.files}),R=-R;return}let f=Math.round((12+Math.floor(o(a(`${r}:branch:${e.key}`))()*4))*x);E=-1;for(let e=0;e<=f;e++){let t=d+R*e,n=l-e*.45;D(t,n,O[e<f/2?1:2]),D(t,n+1,O[0]),e<f*.6&&D(t,n+2,O[0])}let p=i?null:b(e.type),m=p?u[p]:A;E=I.length,I.push({agentId:e.id,key:e.key,type:e.type,family:p,files:e.files,bbox:null}),L(d+R*f,l-f*.45-2,(8+Math.min(e.files.length,6)*.6)*x,m,e.files.length,e.key),R=-R});let B=I.length;I.push({agentId:null,key:null,type:null,family:null,files:n.crown,bbox:null}),E=B;let V=(4+7*n.ctx+Math.min(n.crown.length,6)*.5)*x*1.35,{rx:H,cy:U}=L(F(1),j-3,V,A,n.crown.length,`crown`);if(n.ctx>.8&&!n.compacted){let e=o(a(`${r}:yellow`));for(let t=0;t<56;t++)for(let n=0;n<56;n++)w[t][n]===B&&C[t][n]!==h&&t<U-H*.2&&e()<.55&&(C[t][n]=e()<.5?g[0]:g[1])}if(n.compacted){let e=o(a(`${r}:shoots`)),t=Math.round(U-H*.15-n.regrow*H*.5);for(let e=0;e<Math.max(0,t);e++)for(let t=0;t<56;t++)w[e][t]===B&&(C[e][t]=null,w[e][t]=-1);if(t>=0&&t<56)for(let r=0;r<56;r++){if(w[t][r]!==B||e()>=.12+n.regrow*.5)continue;let i=1+Math.floor(e()*(1+n.regrow*3));for(let e=1;e<=i;e++)D(r,t-e,e===i?_[1]:_[0])}}E=-1;let W=o(a(`${r}:fallen`));z.forEach((e,t)=>D(16+(t*7+Math.floor(W()*4))%24,40,l.done[2+t%2]));for(let e=0;e<Math.min(n.compactions,6);e++)D(15+e*2,42,h);let[G,K,q]=c[n.host];for(let e=42;e<=46;e++){let t=e<=43?0:Math.floor((e-43)*.45)+2;for(let n=13+t;n<=42-t;n++){if(e===42&&C[e][n]===h)continue;let r=K;e<=43?r=e===42?q:G:(e===46||n===13+t||n===42-t)&&(r=G),D(n,e,r)}}let J=o(a(`${r}:moss`));for(let e=15;e<=40;e++)D(e,41,J()<.5?k[0]:k[1]),J()<.35&&D(e,40,k[0]);for(let e=16;e<=39;e++)D(e,47,`#00000055`);if(n.bubble){let e=v[n.bubble];for(let t=3;t<10;t++)for(let n=40;n<47;n++)D(n,t,t===3||t===9||n===40||n===46?e:`#14191F`);if(D(41,10,e),n.bubble===`!`){for(let t=5;t<=6;t++)D(43,t,e);D(43,8,e)}else for(let[t,n]of[[2,2],[4,2],[3,3],[2,4],[4,4]])D(40+t,3+n,e)}let Y=[],X=I.map(()=>null);for(let e=0;e<56;e++){let t=0;for(;t<56;){let n=C[e][t],r=w[e][t];if(!n){t++;continue}let i=t;for(;i+1<56&&C[e][i+1]===n&&w[e][i+1]===r;)i++;if(Y.push({x:t,y:e,w:i-t+1,c:n,p:r}),r>=0){let n=X[r]||={x0:t,y0:e,x1:i,y1:e};n.x0=Math.min(n.x0,t),n.x1=Math.max(n.x1,i),n.y1=e}t=i+1}}return I.forEach((e,t)=>{let n=X[t];e.bbox=n?{x:n.x0,y:n.y0,w:n.x1-n.x0+1,h:n.y1-n.y0+1}:null}),{width:56,height:56,runs:Y,pads:I,bubble:n.bubble,fallen:z}}var O=e=>{if(!e)return``;let t=String(e).replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||String(e)},k=e=>e?String(e).replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase():``;function A(e){let t=new Map;for(let n of e||[]){let e=n.repo||n.root,r=n.repo_key||(e?k(e):n.cwd?`cwd:${k(n.cwd)}`:`outside a repo`),i=O(e||n.cwd)||`outside a repo`;t.has(r)||t.set(r,{key:r,name:i,trees:[]});let a=n.root&&e&&k(n.root)!==k(e)?O(n.root):null;t.get(r).trees.push({s:n,worktree:a})}let n=(e,t)=>e<t?-1:+(e>t),r=[...t.values()];for(let e of r)e.trees.sort((e,t)=>n(e.worktree||``,t.worktree||``)||n(String(e.s.session_id),String(t.s.session_id)));return r.sort((e,t)=>n(e.name.toLowerCase(),t.name.toLowerCase())||n(e.key,t.key))}var j=e=>e.key??(e.install?`${e.install}\0${e.session_id}`:String(e.session_id)),M=e=>j({key:e.key??void 0,install:e.install,session_id:e.sid}),N=(e,t)=>String(e).split(/[\\/]+/).filter(Boolean).slice(-t).join(`/`),P=e=>r(e.host).label;function F(e){let t=e||[],n=e=>n=>t.filter(t=>e(t)===e(n)).length,r=n(e=>e.host),i=n(e=>`${e.host} ${e.scope}`),a=new Map(t.map(e=>[e.install,r(e)<2?P(e):i(e)<2||e.scope===`global`?`${P(e)} · ${e.scope}`:`${P(e)} · ${O(e.path)}`])),o=()=>t.filter(e=>t.some(t=>t!==e&&a.get(t.install)===a.get(e.install)));for(let e=2,t=o();t.length;e++,t=o()){for(let n of t){let t=String(n.path).split(/[\\/]+/).filter(Boolean).length;a.set(n.install,`${P(n)} · ${e>t?n.path:N(n.path,e)}`)}if(e>64)break}return a}var I=(e,t)=>`#/activity/${encodeURIComponent(e)}`+(t?`?${new URLSearchParams({host:t.host,path:t.path})}`:``);function L(e,t){let n=String(e).indexOf(`?`),r=new URLSearchParams(String(t||``).split(`?`)[1]||``),i=r.get(`host`),a=r.get(`path`);return{sid:n<0?e:String(e).slice(0,n),install:i&&a?{host:i,path:a}:void 0}}function R(e,t){let n=new Map((t||[]).map(e=>[e.install,e])),i=F(t);return(e||[]).map(e=>{let t=n.get(e.install);return{...e,host:t?.host??e.host,chip:i.get(e.install)??(e.host?r(e.host).label:null),href:I(e.session_id,t)}})}var z=(e,t)=>new Set((e.writers||[]).filter(e=>M(e)===t).map(e=>k(e.root)));function B(e,t,n){let r=z(e,t);for(let t of z(e,n))if(r.has(t))return`same-worktree`;return`cross-worktree`}var V=e=>[...new Set((e.writers||[]).map(M))];function H(e,t){let n=new Map(e.map((e,t)=>[j(e.s),t])),r=new Map;for(let e of t||[]){let t=V(e).filter(e=>n.has(e));for(let i=0;i<t.length;i++)for(let a=i+1;a<t.length;a++){let o=n.get(t[i]),s=n.get(t[a]),c=o<s?`${o}-${s}`:`${s}-${o}`,l=B(e,t[i],t[a]);r.has(c)&&l!==`same-worktree`||r.set(c,{a:o,b:s,kind:l})}}return[...r.values()]}function U(e,t){let n=[];for(let r of t||[]){let t=V(r).filter(t=>t!==e);if(!t.length||!V(r).includes(e))continue;let i=t.some(t=>B(r,e,t)===`same-worktree`);n.push({path:r.path,kind:i?`same-worktree`:`cross-worktree`})}return n}var W=e=>e?.status===`busy`||x(e);function G(e,t=10){let n=e.map(e=>({...e,collapsed:!1})),r=n.reduce((e,t)=>e+t.trees.length,0);if(r<=t)return n;let i=n.length,a=n.filter(e=>!e.trees.some(e=>W(e.s))).sort((e,t)=>t.trees.length-e.trees.length||(e.key<t.key?-1:1));for(let e of a){if(r<=t||i<=1)break;e.collapsed=!0,r-=e.trees.length,i--}return n}var K=n(),q=12,J=10,Y=`geneseed-garden-sakura`;function X(){try{return window.localStorage.getItem(Y)===`1`}catch{return!1}}var Z=e=>e.key==null?`the session`:e.type||`agent`,Q=e=>e.path||e.file||`?`;function $({pad:e}){let t=e.files.slice(0,q);return(0,K.jsxs)(`div`,{className:`card gd-card`,children:[(0,K.jsxs)(`div`,{className:`act-lbl`,children:[Z(e),` · `,e.files.length,` file`,e.files.length===1?``:`s`]}),(0,K.jsx)(`ul`,{className:`gd-files`,children:t.map((e,t)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mono act-ell`,children:Q(e)}),(0,K.jsxs)(`span`,{className:`mono act-xs`,children:[(0,K.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions??0]}),` `,(0,K.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions??0]})]})]},`${Q(e)}:${t}`))}),e.files.length>t.length&&(0,K.jsxs)(`div`,{className:`dim act-xs`,children:[`+`,e.files.length-t.length,` more`]})]})}var ee=e=>e?`${Z(e)}: ${e.files.length} file${e.files.length===1?``:`s`}`:``;function te(e,t,n,r){let i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];e.key===`Escape`&&n!=null&&r(null),i&&t&&(e.preventDefault(),r(n==null?i>0?0:t-1:(n+i+t)%t))}var ne=(0,i.memo)(function({t:e,pad:t,swaying:n,onPad:r,px:a,label:o}){let s=(0,i.useMemo)(()=>{let t=new Map;for(let n of e.runs)t.has(n.p)||t.set(n.p,[]),t.get(n.p).push(n);return[...t.entries()]},[e]),c=(0,i.useRef)(null),l=e=>{let[t,n]=[c.current,e.changedTouches?.[0]];return!!t&&!!n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>J};return(0,K.jsx)(`svg`,{onTouchStart:e=>{let t=e.touches?.[0];c.current=t?{x:t.clientX,y:t.clientY}:null},className:`gd-svg${t==null?``:` gd-dimming`}`,viewBox:`0 0 56 56`,width:56*a,height:56*a,shapeRendering:`crispEdges`,"data-bubble":e.bubble||void 0,...o?{role:`img`,"aria-label":o}:{"aria-hidden":`true`},children:s.map(([i,a])=>(0,K.jsx)(`g`,{"data-p":i,className:[i===t&&`gd-hot`,n&&i>=0&&e.pads[i].key!=null&&`gd-sway`].filter(Boolean).join(` `)||void 0,onMouseEnter:i>=0?()=>r(i):void 0,onMouseLeave:i>=0?()=>r(null):void 0,onTouchEnd:i>=0?e=>{l(e)||(e.cancelable&&e.preventDefault(),r(i===t?null:i))}:void 0,children:a.map(e=>(0,K.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:1,fill:e.c},`${e.x},${e.y}`))},i))})});export{H as _,ee as a,G as c,L as d,D as f,U as g,R as h,te as i,w as l,F as m,Y as n,X as o,A as p,ne as r,j as s,$ as t,I as u,E as v};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{_t as r}from"./index-B_pTwZra.js";var i=e(t(),1),a=n(),o=1200;function s({text:e,label:t,title:n,className:s=`btn ghost sm`}){let[c,l]=(0,i.useState)(null),u=(0,i.useRef)(null),d=(0,i.useRef)(!1);(0,i.useEffect)(()=>(d.current=!1,()=>{d.current=!0,clearTimeout(u.current)}),[]);let f=e=>{d.current||(l(e),clearTimeout(u.current),u.current=setTimeout(()=>l(null),o))};return(0,a.jsxs)(`button`,{type:`button`,className:s,onClick:async()=>{try{await navigator.clipboard.writeText(e),f(`ok`)}catch{f(`fail`)}},"aria-label":t,title:n,children:[(0,a.jsx)(r,{name:c===`ok`?`check`:c===`fail`?`x`:`copy`}),c===`ok`?`Copied`:c===`fail`?`Copy failed`:`Copy`]})}export{s as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{_t as r}from"./index-BhT94v2q.js";var i=e(t(),1),a=n(),o=1200;function s({text:e,label:t,title:n,className:s=`btn ghost sm`}){let[c,l]=(0,i.useState)(null),u=(0,i.useRef)(null),d=(0,i.useRef)(!1);(0,i.useEffect)(()=>(d.current=!1,()=>{d.current=!0,clearTimeout(u.current)}),[]);let f=e=>{d.current||(l(e),clearTimeout(u.current),u.current=setTimeout(()=>l(null),o))};return(0,a.jsxs)(`button`,{type:`button`,className:s,onClick:async()=>{try{await navigator.clipboard.writeText(e),f(`ok`)}catch{f(`fail`)}},"aria-label":t,title:n,children:[(0,a.jsx)(r,{name:c===`ok`?`check`:c===`fail`?`x`:`copy`}),c===`ok`?`Copied`:c===`fail`?`Copy failed`:`Copy`]})}export{s as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GreenhouseView-DO3ADmT9.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/index-B_pTwZra.js","assets/api-CZ-x0iWG.js","assets/motion-RlUl1osO.js","assets/sections-CtFz7HFH.js","assets/index-CzfImiYb.css","assets/OperatorHudView-QtSaSyYm.js","assets/JournalView--W-Lw_V9.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-CZ-x0iWG.js";import{n as a,r as o}from"./sections-CtFz7HFH.js";import{$ as s,L as c,Ot as l,R as u,St as d,V as f,X as p,_t as m,a as h,bt as g,et as _,rt as v,t as y,tt as b,vt as x,wt as S,xt as C}from"./index-B_pTwZra.js";import{o as w,t as T}from"./motion-RlUl1osO.js";var E=t(n(),1),D={neutral:`Loaded & ready`,imperial:`The Codex in force`,military:`The unit stands ready`,cyberpunk:`Jacked in`,wizard:`Wards in place`,pirate:`The crew stands ready`,gamer:`Game loaded`,sports:`The squad takes the field`,biker:`The crew rolls out`,commentator:`Lights out, away we go`,verstappen:`Setup's in`,joker:`Mic check`,mean:`Rules are up`,marvin:`Online. Reluctantly.`},O=(e,t)=>e.deployed?t===void 0||t===`good`?D[e.theme]||`Loaded & ready`:`Deployed`:`Not deployed`,k=r(),A={done:`ok`,failed:`bad`},j={done:(0,k.jsx)(`path`,{d:`M5 12l5 5L20 7`}),failed:(0,k.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})},M=e=>typeof e==`number`&&Number.isFinite(e);function ee(e){let t=[];for(let n of e){let e=c(n),r=`${e.verb}\u0000${e.scope}\u0000${n.status}`,i=t[t.length-1];i&&i.key===r?(i.jobs.push(n),i.durations.push(M(n.duration)?n.duration:null),n.started&&(i.oldest=n.started)):t.push({key:r,id:n.id,verb:e.verb,scope:e.scope,status:n.status,jobs:[n],command:e.command,newest:n.started||null,oldest:n.started||null,durations:[M(n.duration)?n.duration:null]})}return t}function N(e){if(!e.newest)return`—`;let t=d(e.newest),n=e.oldest?d(e.oldest):t;return n===t?`${t} ago`:`${n} – ${t} ago`}function P({jobs:e,max:t,empty:n}){if(!e||e.length===0)return n??null;let r=u(e,t),i=Math.max(0,...r.map(e=>M(e.duration)?e.duration:0))||1,a=ee(r),o=Math.max(...a.map(e=>e.jobs.length));return(0,k.jsx)(`ul`,{className:`run-chips`,children:a.map(e=>{let t=e.durations.filter(M),n=e.jobs.length,r=e.status||`running`;return(0,k.jsxs)(`li`,{className:`run-chip ${A[e.status]||`acc`}`,title:e.command||void 0,children:[(0,k.jsx)(`svg`,{className:`run-chip-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:j[e.status]||(0,k.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`,stroke:`none`})}),(0,k.jsx)(`span`,{className:`sr-only`,children:r}),(0,k.jsxs)(`span`,{className:`run-chip-main`,children:[(0,k.jsxs)(`span`,{className:`run-chip-head`,children:[(0,k.jsx)(`b`,{children:e.verb}),n>1&&(0,k.jsxs)(`span`,{className:`run-chip-times`,children:[`×`,n]})]}),(0,k.jsx)(`span`,{className:`run-chip-sub`,children:[e.scope,N(e)].filter(Boolean).join(` · `)})]}),t.length?(0,k.jsx)(`span`,{className:`run-chip-bars`,role:`img`,"aria-label":`Durations: ${t.join(`, `)} seconds`,children:t.map((e,t)=>(0,k.jsx)(`i`,{style:{width:`${e/i/o*100}%`}},t))}):(0,k.jsx)(`span`,{className:`run-chip-bars`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`run-chip-dur`,children:t.length?n>1?`≤ ${Math.max(...t)} s`:`${t[0]} s`:`—`})]},e.id)})})}var F={good:`ok`,warn:`warn`,bad:`bad`,unknown:``};function I({verdict:e}){return e?(0,k.jsxs)(`span`,{className:`badge ${F[e.tone]}`,role:`status`,style:{alignSelf:`flex-start`},children:[(0,k.jsx)(`span`,{className:`dot`}),e.head]}):null}function L({overview:e,dataRev:t}){let{data:n}=S(()=>Promise.resolve().then(()=>i.catalog(`laws`)),[t],`catalog:laws`),r=x(e.diff),a=e.counts||{},o=[{key:`agents`,label:`Agents`,hash:`#/agents`},{key:`skills`,label:`Skills`,hash:`#/skills`},{key:`laws`,label:n?.nouns?.laws||`Dictates`,hash:`#/laws`}];return(0,k.jsxs)(`div`,{className:`card kpiband rise mb-16`,children:[o.map(e=>{let t=a[e.key];return(0,k.jsxs)(`a`,{className:`kseg`,href:e.hash,title:`Open ${e.label}`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(t===0?` zero`:``),children:t==null?`—`:(0,k.jsx)(T,{value:t})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:e.label})]},e.key)}),(0,k.jsx)(`div`,{className:`kseg-spacer`}),(0,k.jsxs)(`button`,{className:`kseg`+(r>0?` hot`:``),onClick:()=>l(`#/diff`),title:`Open changes`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(r===0?` zero`:``),children:(0,k.jsx)(T,{value:r})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:`Local edits`}),r>0&&(0,k.jsx)(`span`,{className:`delta up`,children:`▲`})]})]})}function R({overview:e}){return(0,k.jsx)(`div`,{className:`genome`,children:o.map((t,n)=>{let r=a[t],i=e.counts?.[t];return(0,k.jsxs)(`a`,{className:`card gcell rise`,style:{"--i":n},href:`#/section/`+t,children:[(0,k.jsxs)(`div`,{className:`gtop`,children:[(0,k.jsx)(`span`,{className:`gname`,children:r.label}),(0,k.jsx)(m,{name:r.icon,className:`gicon`})]}),(0,k.jsx)(`div`,{className:`gcount`+(i===0?` zero`:``),children:i==null?`—`:(0,k.jsx)(T,{value:i})}),(0,k.jsx)(`div`,{className:`gdesc`,children:r.desc})]},t)})})}function z({jobs:e}){if(!e||e.length===0)return(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})});let t={done:`ok`,running:`acc`,failed:`bad`},n=u(e,8);return(0,k.jsx)(`div`,{className:`feed`,children:n.map(e=>(0,k.jsxs)(`div`,{className:`feed-row`,children:[(0,k.jsx)(`span`,{className:`feed-dot ${t[e.status]||`ok`}`}),(0,k.jsx)(`span`,{className:`feed-txt`,children:(0,k.jsx)(`b`,{children:e.action})}),(0,k.jsxs)(`span`,{className:`feed-when`,children:[d(e.started),` ago`]})]},e.id))})}function B({value:e}){let t=w(e,1100)??0,n=Math.round(t*100);return(0,k.jsxs)(`div`,{className:`ring-box`,children:[(0,k.jsx)(f,{value:n,max:100,label:`germination`,size:232,stroke:10,sweepMs:0}),(0,k.jsxs)(`div`,{className:`ring-center`,children:[(0,k.jsxs)(`div`,{className:`pct`,children:[n,(0,k.jsx)(`span`,{className:`pct-unit`,children:`%`})]}),(0,k.jsx)(`div`,{className:`lbl`,children:`germination`})]})]})}function V({overview:e,sigil:t,setup:n,jobs:r,lens:i,dataRev:a}){let s=O(e,i?.tone),c=C(e,n,i?.tone);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-lg rise mb-16`,children:(0,k.jsxs)(`div`,{className:`hero`,children:[(0,k.jsx)(B,{value:c}),(0,k.jsxs)(`div`,{className:`hero-facts`,children:[(0,k.jsx)(`div`,{className:`ttl`,children:s}),(0,k.jsx)(I,{verdict:i?.verdict}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`p`,{className:`sub`,children:[`One source rendered into `,(0,k.jsx)(`code`,{children:e.target}),`. Every repo on this machine inherits it.`]}),(0,k.jsxs)(`div`,{className:`hero-chips`,children:[(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`voice`}),(0,k.jsx)(`span`,{className:`cv t-cap`,children:e.theme})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`mode`}),(0,k.jsx)(`span`,{className:`cv`,children:e.emit})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`footprint`}),(0,k.jsx)(`span`,{className:`cv`,children:e.footprint})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`built`}),(0,k.jsx)(`span`,{className:`cv`,children:e.build_time||`unknown`})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`fp`}),(0,k.jsx)(`span`,{className:`cv`,children:n?.installed_fp||`—`})]})]})]})]})}),(0,k.jsx)(L,{overview:e,dataRev:a}),(0,k.jsxs)(`div`,{className:`grid split-status`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Capability genome`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[o.length,` sections`]})})]}),(0,k.jsx)(R,{overview:e})]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Recent activity`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`badge acc`,children:[(0,k.jsx)(`span`,{className:`dot`}),`live`]})})]}),(0,k.jsx)(z,{jobs:r})]})]})]})}function H({k:e,overview:t,max:n}){let r=a[e],i=t.counts?.[e]??0;return(0,k.jsxs)(`div`,{className:`strand`,children:[(0,k.jsxs)(`span`,{className:`strand-name`,children:[(0,k.jsx)(`span`,{className:`strand-dot`}),(0,k.jsx)(`a`,{href:`#/section/`+e,className:`strand-link stretch-link`,children:r.label})]}),(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${i/n*100}%`}})}),(0,k.jsx)(`span`,{className:`strand-val`,children:i})]})}function U(e){return e?e.includes(`in sync`)?{label:`in sync`,tone:`ok`}:e.includes(`no Geneseed install`)?{label:`not installed`,tone:``}:{label:`behind source`,tone:`warn`}:null}function W({overview:e,sigil:t,setup:n,jobs:r,lens:i}){let a=g(e.counts),s=n?.version_verdict||``,c=U(s),l=x(e.diff),u=[[`Source`,`src/, the canonical genetic material`,n?.source_fp||`—`,!0],[`Render`,`geneseed build → ${e.emit}`,e.theme+` voice`,!0],[`Deployed`,e.target,`inherited by every repo`,!1]];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`mb-16`,children:(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{position:`relative`,overflow:`hidden`},children:[(0,k.jsx)(`h2`,{className:`h`,style:{fontSize:22,margin:`0 0 18px`},children:`Gene-seed lineage`}),(0,k.jsxs)(`div`,{className:`lineage-track`,children:[(0,k.jsx)(`div`,{className:`spine`}),u.map(([e,t,n,r],i)=>(0,k.jsxs)(`div`,{className:`lineage-step`,children:[(0,k.jsx)(`span`,{className:`node ${r?`on`:``}`}),(0,k.jsx)(`div`,{className:`lt`,children:e}),(0,k.jsx)(`div`,{className:`ld`,children:t}),(0,k.jsx)(`div`,{className:`ltag`,children:n})]},i))]}),(0,k.jsx)(`hr`,{className:`hr`}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,style:{marginBottom:14},children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,k.jsx)(I,{verdict:i?.verdict}),c&&(0,k.jsxs)(`span`,{className:`badge ${c.tone}`,title:s,children:[(0,k.jsx)(`span`,{className:`dot`}),c.label]}),(0,k.jsxs)(`span`,{className:`badge`,children:[(0,k.jsx)(`span`,{className:`dot`}),l,` local edits`]})]})]})}),(0,k.jsxs)(`div`,{className:`grid split-even`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Genome strand`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsx)(`span`,{className:`tick`,children:`by volume`})})]}),o.map(t=>(0,k.jsx)(H,{k:t,overview:e,max:a},t))]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Recent activity`})}),(0,k.jsx)(z,{jobs:r})]})]})]})}function G({overview:e,setup:t,jobs:n,lens:r}){let i=o.reduce((t,n)=>t+(e.counts?.[n]??0),0),s=g(e.counts),c=e.doctor?.ok,l=e.doctor?.problems?.length??0,u=x(e.diff);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-md rise mb-16`,children:(0,k.jsx)(`div`,{className:`row wrap between gap-16`,children:(0,k.jsxs)(`div`,{className:`row`,style:{gap:20,flexWrap:`wrap`},children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`status`}),(0,k.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:[(0,k.jsxs)(`span`,{className:`badge ${e.deployed?`ok`:`warn`}`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.deployed?`deployed`:`not deployed`]}),(0,k.jsx)(I,{verdict:r?.verdict})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`voice`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6,textTransform:`capitalize`},children:e.theme})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`mode`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6},children:e.emit})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`fingerprint`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6,color:`var(--accent-text)`},children:t?.installed_fp||`—`})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`doctor`}),(0,k.jsx)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:c?(0,k.jsxs)(`span`,{className:`badge ok`,children:[(0,k.jsx)(`span`,{className:`dot`}),`clean`]}):(0,k.jsxs)(`span`,{className:`badge warn`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.doctor===null?`checking`:`${l} issue${l===1?``:`s`}`]})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`edits`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6},children:u})]})]})})}),(0,k.jsxs)(`div`,{className:`grid split-operator`,children:[(0,k.jsxs)(`div`,{className:`card rise`,style:{"--i":1},children:[(0,k.jsxs)(`div`,{className:`card-head pad-lg`,style:{padding:`18px 20px 0`,marginBottom:14},children:[(0,k.jsx)(`h3`,{children:`Sections`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[i,` entries total`]})})]}),(0,k.jsxs)(`table`,{className:`tbl`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsxs)(`tr`,{children:[(0,k.jsx)(`th`,{children:`Section`}),(0,k.jsx)(`th`,{children:`Detail`}),(0,k.jsx)(`th`,{style:{width:130},children:`Share`}),(0,k.jsx)(`th`,{className:`num`,children:`Count`})]})}),(0,k.jsx)(`tbody`,{children:o.map(t=>{let n=a[t],r=e.counts?.[t]??0;return(0,k.jsxs)(`tr`,{className:`clickable`,children:[(0,k.jsx)(`td`,{className:`name`,children:(0,k.jsx)(`a`,{href:`#/section/`+t,className:`stretch-link`,children:n.label})}),(0,k.jsx)(`td`,{className:`muted`,children:n.desc}),(0,k.jsx)(`td`,{children:(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${r/s*100}%`}})})}),(0,k.jsx)(`td`,{className:`num`,children:r})]},t)})})]})]}),(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{"--i":2},children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Run log`})}),(0,k.jsx)(P,{jobs:n,max:8,empty:(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})})})]})]})]})}var K=Symbol(`failed`),q=e=>Promise.resolve().then(e).catch(()=>K);function J({dataRev:e,needDoctor:t}){let n=S(()=>q(()=>i.fleet()),[e]),r=S(()=>t?q(()=>i.doctor()):Promise.resolve(null),[t,e]),a=n.data,o=a==null?`loading`:a===K?`failed`:`ok`,s=o===`ok`?a:null,c=s?h(s):null,l=r.data,u=t?l==null?`loading`:l===K?`failed`:`ok`:`idle`;return{fleet:s,fleetState:o,verdict:c,tone:o===`failed`?`failed`:c?.tone,doctor:{state:u,data:u===`ok`?r.data:null}}}var Y=e({default:()=>$}),X=(0,E.lazy)(()=>y(()=>import(`./GreenhouseView-DO3ADmT9.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Z=(0,E.lazy)(()=>y(()=>import(`./OperatorHudView-QtSaSyYm.js`),__vite__mapDeps([8,1,2,3,4,5,6,7]))),Q=(0,E.lazy)(()=>y(()=>import(`./JournalView--W-Lw_V9.js`),__vite__mapDeps([9,1,2,3,4,5,6,7])));function $({overview:e,overviewError:t,onRetry:n,themes:r,setup:a,runs:o,onAction:c,layout:l=`genome`,dataRev:u}){let d=l,[f,m]=(0,E.useState)(`status`),[h,g]=(0,E.useState)(d);h!==d&&(g(d),m(`status`));let y=e&&r.find(t=>t.name===e.theme)?.sigil||``,x=J({dataRev:u,needDoctor:d===`greenhouse`||d===`hud`}),{data:C}=S(()=>d===`journal`?i.recent().catch(()=>null):Promise.resolve(null),[d,u]);if(!e)return t?(0,k.jsx)(_,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,k.jsx)(b,{});let w=e.daemon_stale?(0,k.jsx)(s,{}):null;return e.deployed?(0,k.jsxs)(k.Fragment,{children:[w,(0,k.jsx)(`div`,{className:`head-row`,children:(0,k.jsx)(v,{"aria-label":`Dashboard view`,children:[[`status`,`Status`],[`lineage`,`Lineage`],[`readout`,`Readout`]].map(([e,t])=>(0,k.jsx)(`button`,{className:f===e?`on`:``,onClick:()=>m(e),"aria-pressed":f===e,children:t},e))})}),(0,k.jsxs)(`div`,{className:`view-in`,children:[f===`status`&&d===`genome`&&(0,k.jsx)(V,{overview:e,sigil:y,setup:a,jobs:o,lens:x,dataRev:u}),f===`status`&&d===`greenhouse`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(X,{overview:e,sigil:y,jobs:o,lens:x,onAction:c})}),f===`status`&&d===`hud`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(Z,{overview:e,jobs:o,lens:x})}),f===`status`&&d===`journal`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(Q,{overview:e,recent:C,lens:x,dataRev:u})}),f===`lineage`&&(0,k.jsx)(W,{overview:e,sigil:y,setup:a,jobs:o,lens:x}),f===`readout`&&(0,k.jsx)(G,{overview:e,setup:a,jobs:o,lens:x})]},f)]}):(0,k.jsxs)(k.Fragment,{children:[w,(0,k.jsx)(p,{onAction:c})]})}export{$ as default,O as i,I as n,P as r,Y as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GreenhouseView-VL_ZKJUR.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/index-BhT94v2q.js","assets/api-C8nMUU1i.js","assets/motion-RlUl1osO.js","assets/sections-CtFz7HFH.js","assets/index-DcusoHzF.css","assets/OperatorHudView-Bdupodlc.js","assets/JournalView-KrmFUC-X.js"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-C8nMUU1i.js";import{n as a,r as o}from"./sections-CtFz7HFH.js";import{$ as s,L as c,Ot as l,R as u,St as d,V as f,X as p,_t as m,a as h,bt as g,et as _,rt as v,t as y,tt as b,vt as x,wt as S,xt as C}from"./index-BhT94v2q.js";import{o as w,t as T}from"./motion-RlUl1osO.js";var E=t(n(),1),D={neutral:`Loaded & ready`,imperial:`The Codex in force`,military:`The unit stands ready`,cyberpunk:`Jacked in`,wizard:`Wards in place`,pirate:`The crew stands ready`,gamer:`Game loaded`,sports:`The squad takes the field`,biker:`The crew rolls out`,commentator:`Lights out, away we go`,verstappen:`Setup's in`,joker:`Mic check`,mean:`Rules are up`,marvin:`Online. Reluctantly.`},O=(e,t)=>e.deployed?t===void 0||t===`good`?D[e.theme]||`Loaded & ready`:`Deployed`:`Not deployed`,k=r(),A={done:`ok`,failed:`bad`},j={done:(0,k.jsx)(`path`,{d:`M5 12l5 5L20 7`}),failed:(0,k.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})},M=e=>typeof e==`number`&&Number.isFinite(e);function ee(e){let t=[];for(let n of e){let e=c(n),r=`${e.verb}\u0000${e.scope}\u0000${n.status}`,i=t[t.length-1];i&&i.key===r?(i.jobs.push(n),i.durations.push(M(n.duration)?n.duration:null),n.started&&(i.oldest=n.started)):t.push({key:r,id:n.id,verb:e.verb,scope:e.scope,status:n.status,jobs:[n],command:e.command,newest:n.started||null,oldest:n.started||null,durations:[M(n.duration)?n.duration:null]})}return t}function N(e){if(!e.newest)return`—`;let t=d(e.newest),n=e.oldest?d(e.oldest):t;return n===t?`${t} ago`:`${n} – ${t} ago`}function P({jobs:e,max:t,empty:n}){if(!e||e.length===0)return n??null;let r=u(e,t),i=Math.max(0,...r.map(e=>M(e.duration)?e.duration:0))||1,a=ee(r),o=Math.max(...a.map(e=>e.jobs.length));return(0,k.jsx)(`ul`,{className:`run-chips`,children:a.map(e=>{let t=e.durations.filter(M),n=e.jobs.length,r=e.status||`running`;return(0,k.jsxs)(`li`,{className:`run-chip ${A[e.status]||`acc`}`,title:e.command||void 0,children:[(0,k.jsx)(`svg`,{className:`run-chip-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:j[e.status]||(0,k.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`,stroke:`none`})}),(0,k.jsx)(`span`,{className:`sr-only`,children:r}),(0,k.jsxs)(`span`,{className:`run-chip-main`,children:[(0,k.jsxs)(`span`,{className:`run-chip-head`,children:[(0,k.jsx)(`b`,{children:e.verb}),n>1&&(0,k.jsxs)(`span`,{className:`run-chip-times`,children:[`×`,n]})]}),(0,k.jsx)(`span`,{className:`run-chip-sub`,children:[e.scope,N(e)].filter(Boolean).join(` · `)})]}),t.length?(0,k.jsx)(`span`,{className:`run-chip-bars`,role:`img`,"aria-label":`Durations: ${t.join(`, `)} seconds`,children:t.map((e,t)=>(0,k.jsx)(`i`,{style:{width:`${e/i/o*100}%`}},t))}):(0,k.jsx)(`span`,{className:`run-chip-bars`,"aria-hidden":`true`}),(0,k.jsx)(`span`,{className:`run-chip-dur`,children:t.length?n>1?`≤ ${Math.max(...t)} s`:`${t[0]} s`:`—`})]},e.id)})})}var F={good:`ok`,warn:`warn`,bad:`bad`,unknown:``};function I({verdict:e}){return e?(0,k.jsxs)(`span`,{className:`badge ${F[e.tone]}`,role:`status`,style:{alignSelf:`flex-start`},children:[(0,k.jsx)(`span`,{className:`dot`}),e.head]}):null}function L({overview:e,dataRev:t}){let{data:n}=S(()=>Promise.resolve().then(()=>i.catalog(`laws`)),[t],`catalog:laws`),r=x(e.diff),a=e.counts||{},o=[{key:`agents`,label:`Agents`,hash:`#/agents`},{key:`skills`,label:`Skills`,hash:`#/skills`},{key:`laws`,label:n?.nouns?.laws||`Dictates`,hash:`#/laws`}];return(0,k.jsxs)(`div`,{className:`card kpiband rise mb-16`,children:[o.map(e=>{let t=a[e.key];return(0,k.jsxs)(`a`,{className:`kseg`,href:e.hash,title:`Open ${e.label}`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(t===0?` zero`:``),children:t==null?`—`:(0,k.jsx)(T,{value:t})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:e.label})]},e.key)}),(0,k.jsx)(`div`,{className:`kseg-spacer`}),(0,k.jsxs)(`button`,{className:`kseg`+(r>0?` hot`:``),onClick:()=>l(`#/diff`),title:`Open changes`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(r===0?` zero`:``),children:(0,k.jsx)(T,{value:r})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:`Local edits`}),r>0&&(0,k.jsx)(`span`,{className:`delta up`,children:`▲`})]})]})}function R({overview:e}){return(0,k.jsx)(`div`,{className:`genome`,children:o.map((t,n)=>{let r=a[t],i=e.counts?.[t];return(0,k.jsxs)(`a`,{className:`card gcell rise`,style:{"--i":n},href:`#/section/`+t,children:[(0,k.jsxs)(`div`,{className:`gtop`,children:[(0,k.jsx)(`span`,{className:`gname`,children:r.label}),(0,k.jsx)(m,{name:r.icon,className:`gicon`})]}),(0,k.jsx)(`div`,{className:`gcount`+(i===0?` zero`:``),children:i==null?`—`:(0,k.jsx)(T,{value:i})}),(0,k.jsx)(`div`,{className:`gdesc`,children:r.desc})]},t)})})}function z({jobs:e}){if(!e||e.length===0)return(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})});let t={done:`ok`,running:`acc`,failed:`bad`},n=u(e,8);return(0,k.jsx)(`div`,{className:`feed`,children:n.map(e=>(0,k.jsxs)(`div`,{className:`feed-row`,children:[(0,k.jsx)(`span`,{className:`feed-dot ${t[e.status]||`ok`}`}),(0,k.jsx)(`span`,{className:`feed-txt`,children:(0,k.jsx)(`b`,{children:e.action})}),(0,k.jsxs)(`span`,{className:`feed-when`,children:[d(e.started),` ago`]})]},e.id))})}function B({value:e}){let t=w(e,1100)??0,n=Math.round(t*100);return(0,k.jsxs)(`div`,{className:`ring-box`,children:[(0,k.jsx)(f,{value:n,max:100,label:`germination`,size:232,stroke:10,sweepMs:0}),(0,k.jsxs)(`div`,{className:`ring-center`,children:[(0,k.jsxs)(`div`,{className:`pct`,children:[n,(0,k.jsx)(`span`,{className:`pct-unit`,children:`%`})]}),(0,k.jsx)(`div`,{className:`lbl`,children:`germination`})]})]})}function V({overview:e,sigil:t,setup:n,jobs:r,lens:i,dataRev:a}){let s=O(e,i?.tone),c=C(e,n,i?.tone);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-lg rise mb-16`,children:(0,k.jsxs)(`div`,{className:`hero`,children:[(0,k.jsx)(B,{value:c}),(0,k.jsxs)(`div`,{className:`hero-facts`,children:[(0,k.jsx)(`div`,{className:`ttl`,children:s}),(0,k.jsx)(I,{verdict:i?.verdict}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`p`,{className:`sub`,children:[`One source rendered into `,(0,k.jsx)(`code`,{children:e.target}),`. Every repo on this machine inherits it.`]}),(0,k.jsxs)(`div`,{className:`hero-chips`,children:[(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`voice`}),(0,k.jsx)(`span`,{className:`cv t-cap`,children:e.theme})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`mode`}),(0,k.jsx)(`span`,{className:`cv`,children:e.emit})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`footprint`}),(0,k.jsx)(`span`,{className:`cv`,children:e.footprint})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`built`}),(0,k.jsx)(`span`,{className:`cv`,children:e.build_time||`unknown`})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`fp`}),(0,k.jsx)(`span`,{className:`cv`,children:n?.installed_fp||`—`})]})]})]})]})}),(0,k.jsx)(L,{overview:e,dataRev:a}),(0,k.jsxs)(`div`,{className:`grid split-status`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Capability genome`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[o.length,` sections`]})})]}),(0,k.jsx)(R,{overview:e})]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Recent activity`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`badge acc`,children:[(0,k.jsx)(`span`,{className:`dot`}),`live`]})})]}),(0,k.jsx)(z,{jobs:r})]})]})]})}function H({k:e,overview:t,max:n}){let r=a[e],i=t.counts?.[e]??0;return(0,k.jsxs)(`div`,{className:`strand`,children:[(0,k.jsxs)(`span`,{className:`strand-name`,children:[(0,k.jsx)(`span`,{className:`strand-dot`}),(0,k.jsx)(`a`,{href:`#/section/`+e,className:`strand-link stretch-link`,children:r.label})]}),(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${i/n*100}%`}})}),(0,k.jsx)(`span`,{className:`strand-val`,children:i})]})}function U(e){return e?e.includes(`in sync`)?{label:`in sync`,tone:`ok`}:e.includes(`no Geneseed install`)?{label:`not installed`,tone:``}:{label:`behind source`,tone:`warn`}:null}function W({overview:e,sigil:t,setup:n,jobs:r,lens:i}){let a=g(e.counts),s=n?.version_verdict||``,c=U(s),l=x(e.diff),u=[[`Source`,`src/, the canonical genetic material`,n?.source_fp||`—`,!0],[`Render`,`geneseed build → ${e.emit}`,e.theme+` voice`,!0],[`Deployed`,e.target,`inherited by every repo`,!1]];return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`mb-16`,children:(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{position:`relative`,overflow:`hidden`},children:[(0,k.jsx)(`h2`,{className:`h`,style:{fontSize:22,margin:`0 0 18px`},children:`Gene-seed lineage`}),(0,k.jsxs)(`div`,{className:`lineage-track`,children:[(0,k.jsx)(`div`,{className:`spine`}),u.map(([e,t,n,r],i)=>(0,k.jsxs)(`div`,{className:`lineage-step`,children:[(0,k.jsx)(`span`,{className:`node ${r?`on`:``}`}),(0,k.jsx)(`div`,{className:`lt`,children:e}),(0,k.jsx)(`div`,{className:`ld`,children:t}),(0,k.jsx)(`div`,{className:`ltag`,children:n})]},i))]}),(0,k.jsx)(`hr`,{className:`hr`}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,style:{marginBottom:14},children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,k.jsx)(I,{verdict:i?.verdict}),c&&(0,k.jsxs)(`span`,{className:`badge ${c.tone}`,title:s,children:[(0,k.jsx)(`span`,{className:`dot`}),c.label]}),(0,k.jsxs)(`span`,{className:`badge`,children:[(0,k.jsx)(`span`,{className:`dot`}),l,` local edits`]})]})]})}),(0,k.jsxs)(`div`,{className:`grid split-even`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Genome strand`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsx)(`span`,{className:`tick`,children:`by volume`})})]}),o.map(t=>(0,k.jsx)(H,{k:t,overview:e,max:a},t))]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Recent activity`})}),(0,k.jsx)(z,{jobs:r})]})]})]})}function G({overview:e,setup:t,jobs:n,lens:r}){let i=o.reduce((t,n)=>t+(e.counts?.[n]??0),0),s=g(e.counts),c=e.doctor?.ok,l=e.doctor?.problems?.length??0,u=x(e.diff);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-md rise mb-16`,children:(0,k.jsx)(`div`,{className:`row wrap between gap-16`,children:(0,k.jsxs)(`div`,{className:`row`,style:{gap:20,flexWrap:`wrap`},children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`status`}),(0,k.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:[(0,k.jsxs)(`span`,{className:`badge ${e.deployed?`ok`:`warn`}`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.deployed?`deployed`:`not deployed`]}),(0,k.jsx)(I,{verdict:r?.verdict})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`voice`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6,textTransform:`capitalize`},children:e.theme})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`mode`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6},children:e.emit})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`fingerprint`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6,color:`var(--accent-text)`},children:t?.installed_fp||`—`})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`doctor`}),(0,k.jsx)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:c?(0,k.jsxs)(`span`,{className:`badge ok`,children:[(0,k.jsx)(`span`,{className:`dot`}),`clean`]}):(0,k.jsxs)(`span`,{className:`badge warn`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.doctor===null?`checking`:`${l} issue${l===1?``:`s`}`]})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`edits`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6},children:u})]})]})})}),(0,k.jsxs)(`div`,{className:`grid split-operator`,children:[(0,k.jsxs)(`div`,{className:`card rise`,style:{"--i":1},children:[(0,k.jsxs)(`div`,{className:`card-head pad-lg`,style:{padding:`18px 20px 0`,marginBottom:14},children:[(0,k.jsx)(`h3`,{children:`Sections`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[i,` entries total`]})})]}),(0,k.jsxs)(`table`,{className:`tbl`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsxs)(`tr`,{children:[(0,k.jsx)(`th`,{children:`Section`}),(0,k.jsx)(`th`,{children:`Detail`}),(0,k.jsx)(`th`,{style:{width:130},children:`Share`}),(0,k.jsx)(`th`,{className:`num`,children:`Count`})]})}),(0,k.jsx)(`tbody`,{children:o.map(t=>{let n=a[t],r=e.counts?.[t]??0;return(0,k.jsxs)(`tr`,{className:`clickable`,children:[(0,k.jsx)(`td`,{className:`name`,children:(0,k.jsx)(`a`,{href:`#/section/`+t,className:`stretch-link`,children:n.label})}),(0,k.jsx)(`td`,{className:`muted`,children:n.desc}),(0,k.jsx)(`td`,{children:(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${r/s*100}%`}})})}),(0,k.jsx)(`td`,{className:`num`,children:r})]},t)})})]})]}),(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{"--i":2},children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Run log`})}),(0,k.jsx)(P,{jobs:n,max:8,empty:(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})})})]})]})]})}var K=Symbol(`failed`),q=e=>Promise.resolve().then(e).catch(()=>K);function J({dataRev:e,needDoctor:t}){let n=S(()=>q(()=>i.fleet()),[e]),r=S(()=>t?q(()=>i.doctor()):Promise.resolve(null),[t,e]),a=n.data,o=a==null?`loading`:a===K?`failed`:`ok`,s=o===`ok`?a:null,c=s?h(s):null,l=r.data,u=t?l==null?`loading`:l===K?`failed`:`ok`:`idle`;return{fleet:s,fleetState:o,verdict:c,tone:o===`failed`?`failed`:c?.tone,doctor:{state:u,data:u===`ok`?r.data:null}}}var Y=e({default:()=>$}),X=(0,E.lazy)(()=>y(()=>import(`./GreenhouseView-VL_ZKJUR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Z=(0,E.lazy)(()=>y(()=>import(`./OperatorHudView-Bdupodlc.js`),__vite__mapDeps([8,1,2,3,4,5,6,7]))),Q=(0,E.lazy)(()=>y(()=>import(`./JournalView-KrmFUC-X.js`),__vite__mapDeps([9,1,2,3,4,5,6,7])));function $({overview:e,overviewError:t,onRetry:n,themes:r,setup:a,runs:o,onAction:c,layout:l=`genome`,dataRev:u}){let d=l,[f,m]=(0,E.useState)(`status`),[h,g]=(0,E.useState)(d);h!==d&&(g(d),m(`status`));let y=e&&r.find(t=>t.name===e.theme)?.sigil||``,x=J({dataRev:u,needDoctor:d===`greenhouse`||d===`hud`}),{data:C}=S(()=>d===`journal`?i.recent().catch(()=>null):Promise.resolve(null),[d,u]);if(!e)return t?(0,k.jsx)(_,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,k.jsx)(b,{});let w=e.daemon_stale?(0,k.jsx)(s,{}):null;return e.deployed?(0,k.jsxs)(k.Fragment,{children:[w,(0,k.jsx)(`div`,{className:`head-row`,children:(0,k.jsx)(v,{"aria-label":`Dashboard view`,children:[[`status`,`Status`],[`lineage`,`Lineage`],[`readout`,`Readout`]].map(([e,t])=>(0,k.jsx)(`button`,{className:f===e?`on`:``,onClick:()=>m(e),"aria-pressed":f===e,children:t},e))})}),(0,k.jsxs)(`div`,{className:`view-in`,children:[f===`status`&&d===`genome`&&(0,k.jsx)(V,{overview:e,sigil:y,setup:a,jobs:o,lens:x,dataRev:u}),f===`status`&&d===`greenhouse`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(X,{overview:e,sigil:y,jobs:o,lens:x,onAction:c})}),f===`status`&&d===`hud`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(Z,{overview:e,jobs:o,lens:x})}),f===`status`&&d===`journal`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(Q,{overview:e,recent:C,lens:x,dataRev:u})}),f===`lineage`&&(0,k.jsx)(W,{overview:e,sigil:y,setup:a,jobs:o,lens:x}),f===`readout`&&(0,k.jsx)(G,{overview:e,setup:a,jobs:o,lens:x})]},f)]}):(0,k.jsxs)(k.Fragment,{children:[w,(0,k.jsx)(p,{onAction:c})]})}export{$ as default,O as i,I as n,P as r,Y as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-CZ-x0iWG.js";import{H as a,Ot as o,_t as s,ct as c,et as l,i as u,n as d,ot as f,r as p,rt as ee,st as te,tt as m,wt as h}from"./index-B_pTwZra.js";import{t as g}from"./EmptyState-CY5Pm2xy.js";import{a as _,i as ne,n as re,o as ie,s as ae}from"./LibRows-CiPvsRYB.js";import{t as v}from"./CopyButton-C0wwRR9H.js";import{a as y,i as b,r as x}from"./Markdown-CxkA7940.js";import{i as S}from"./motion-RlUl1osO.js";var C=e(t(),1),w=n();function T(e,t=0){let n=String(e).toLowerCase().trim().replace(/[^a-z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``);return n&&/^[a-z]/.test(n)?n:`h-${t}-${n||`section`}`}function E(e){let t=[],n=[],r=`before`;for(let i of(e||``).split(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-C8nMUU1i.js";import{H as a,Ot as o,_t as s,ct as c,et as l,i as u,n as d,ot as f,r as p,rt as ee,st as te,tt as m,wt as h}from"./index-BhT94v2q.js";import{t as g}from"./EmptyState-CY5Pm2xy.js";import{a as _,i as ne,n as re,o as ie,s as ae}from"./LibRows-QsUBjOF7.js";import{t as v}from"./CopyButton-Cnnvjgkg.js";import{a as y,i as b,r as x}from"./Markdown-CxkA7940.js";import{i as S}from"./motion-RlUl1osO.js";var C=e(t(),1),w=n();function T(e,t=0){let n=String(e).toLowerCase().trim().replace(/[^a-z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``);return n&&/^[a-z]/.test(n)?n:`h-${t}-${n||`section`}`}function E(e){let t=[],n=[],r=`before`;for(let i of(e||``).split(`
2
2
  `))r===`before`&&/^\|\s*piece\s*\|/i.test(i)?r=`map`:r===`map`&&!i.trimStart().startsWith(`|`)&&(r=`after`),r===`before`?t.push(i):r===`after`&&n.push(i);return[t.join(`
3
3
  `),n.join(`
4
4
  `)]}function D(e){let t=[...e.querySelectorAll(`h2, h3, h4, h5, h6`)],n=e=>Number(e.tagName[1]),r=t.length?Math.min(...t.map(n))-2:0;if(!(r<=0))for(let e of t){let t=document.createElement(`h${n(e)-r}`);for(let n of e.attributes)t.setAttribute(n.name,n.value);t.append(...e.childNodes),e.replaceWith(t)}}function O(e,t){let n=document.createElement(`template`);return n.innerHTML=e,D(n.content),n.content.querySelectorAll(`h1, h2, h3`).forEach(e=>{e.tagName!==`H1`&&(t.idx+=1);let n=e.id||T(e.textContent||``,t.idx),r=n;for(let e=2;t.ids.has(r);e++)r=`${n}-${e}`;t.ids.add(r),e.id=r,e.tagName!==`H1`&&t.toc.push({level:Number(e.tagName[1]),title:(e.textContent||``).trim(),id:r})}),n.content.querySelectorAll(`table`).forEach(e=>{let t=document.createElement(`div`);t.className=`table-scroll`,t.setAttribute(`tabindex`,`0`),t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,`Table`),e.replaceWith(t),t.appendChild(e)}),n.innerHTML}function k(e){let t={ids:new Set,idx:0,toc:[]},n=n=>O(x(n,e?.links),t);if(e?.rows){let[r,i]=E(e.body);return{before:n(r),after:n(i),toc:t.toc}}return{html:n(e?.body),toc:t.toc}}var A=r(),j={"opencode-global":[`install-opencode`,`Global (recommended)`],opencode:[`install-opencode`,`Per repo`],"claude-global":[`install-claude-code`],claude:[`install-claude-code`],"openclaude-global":[`install-openclaude`],openclaude:[`install-openclaude`],"bob-global":[`install-bob`],bob:[`install-bob`],files:[`install-agent-md`]},M=`you already know this`,N=e=>Math.max(1,Math.ceil((e||``).split(/\s+/).filter(Boolean).length/200));function P(e){return e.querySelectorAll(`pre`).forEach(e=>{if(e.parentElement?.classList.contains(`docs-code`))return;let t=document.createElement(`figure`);t.className=`docs-code`;let n=document.createElement(`figcaption`),r=e.querySelector(`code`)?.className.match(/(?:^|\s)language-(\S+)/)?.[1];if(r){let e=document.createElement(`span`);e.className=`mono`,e.textContent=r,n.append(e)}e.replaceWith(t),t.append(n,e)}),[...e.querySelectorAll(`figure.docs-code > figcaption`)]}var F=e=>(e.parentElement?.querySelector(`pre`)?.textContent||``).replace(/\n+$/,``),I=40,L=e=>{let t=e.split(`
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,mt as u,nt as ee,tt as d,wt as f}from"./index-B_pTwZra.js";import{n as p,t as m}from"./usePoll-D5c_qIFZ.js";import{t as h}from"./EmptyState-CY5Pm2xy.js";import{t as g}from"./CopyButton-C0wwRR9H.js";import{t as _}from"./DataTable-b9zTShqJ.js";import{a as v,n as y,s as b}from"./ActiveLoops-DOJCPPPc.js";import{a as x,i as te,n as ne,o as S,s as C}from"./LibRows-CiPvsRYB.js";var w=e(t(),1),T=24,E=48,re=16,ie=92,ae=8,oe=16,D=22,O=14,se=14,k=15,ce=4,A=7.2,j={brick:{w:200,h:48},fork:{w:200,h:48},loop:{w:200,h:56},lane:{w:150,h:56},close:{w:96,h:34},stop:{w:76,h:34}},M=`loop:`,le=new Set([`$close`,`$stop`,`$lane`]),N=(e,t)=>{if(!e?.name)return`↺ route back`;let n=t?`${t[e.name]??0} / ${e.max??`?`}`:`max ${e.max??`?`}`;return`↺ ${e.name} · ${n}`};function ue(e,t,n,r){let i=null;for(let a of e)Array.isArray(a?.nodes)&&a.nodes[0]===n&&(a.nodes.includes(t)||a.nodes.includes(`$lane`)&&r.has(t))&&(!i||a.nodes.length<i.nodes.length)&&(i=a);return i}var de=new Set([`pass`,`fail`,`error`,`none`,`needs-info`,`reject`]);function fe(e,t=[]){let n=new Set(Array.isArray(e.stages)?e.stages:[]),r=(e.cycles||[]).filter(e=>Array.isArray(e?.nodes)),i=e=>r.some(t=>t.nodes[0]===e.to&&t.nodes.includes(e.from)),a=new Map((Array.isArray(t)?t:[]).map(e=>[e?.name,e])),o=(e.edges||[]).filter(e=>n.has(e?.from)),s=e=>(a.has(e)?a.get(e)?.outcomes||[]:o.filter(t=>t.from===e).map(e=>e.on)).some(e=>!de.has(e)),c=new Map;for(let e of o)n.has(e.to)&&!i(e)&&!e.from.startsWith(M)&&s(e.from)&&(c.has(e.from)||c.set(e.from,[]),c.get(e.from).includes(e.to)||c.get(e.from).push(e.to));return c}function P(e,t,n=[]){let r=fe(e,n);for(let n of[...Array.isArray(t)?t:[]].reverse()){if(!r.has(n?.stage)||!n.outcome)continue;let t=(e.edges||[]).find(e=>e.from===n.stage&&e.on===n.outcome);if(t&&r.get(n.stage).includes(t.to))return t.to}return null}function F(e,t=[],n={}){let r=n.width>0?Math.floor(n.width):1/0,i=[{rails:!0,stack:!1},{rails:!1,stack:!1},{rails:!0,stack:!0},{rails:!1,stack:!0}];for(let a of i){let o=pe(e,t,a,r,n.lane);if(o.width<=r||a===i.at(-1))return o}}function pe(e,t,n,r,i){let a=Array.isArray(e.stages)?e.stages:[],o=new Set(a),s=(Array.isArray(e.edges)?e.edges:[]).filter(e=>typeof e?.from==`string`&&typeof e?.to==`string`&&o.has(e.from)&&(o.has(e.to)||le.has(e.to))),c=(Array.isArray(e.cycles)?e.cycles:[]).filter(e=>Array.isArray(e?.nodes)),l=new Map(t.map(e=>[e.name,e])),u=fe(e,t),ee=new Set([...u.values()].flat()),d=e=>ue(c,e.from,e.to,ee),f=new Map(o.has(e.start)?[[e.start,0]]:[]),p=s.filter(e=>o.has(e.to)&&!d(e));for(let e=0;e<a.length;e++){let e=!1;for(let t of p){if(!f.has(t.from))continue;let n=f.get(t.from)+1;f.get(t.to)>=n||(f.set(t.to,n),e=!0)}if(!e)break}let m=Math.max(-1,...f.values());for(let e of a)f.has(e)||f.set(e,++m);let h=m+1,g=[];for(let e of a)(g[f.get(e)]||=[]).push(e);let _=e=>g[f.get(e)].length>1,v=n.rails?T:oe,y=n.rails?re:ae,x=r===1/0?1/0:r-2*v,te=()=>Math.max(j.lane.w,Math.min(240,x-28)),ne=e=>n.rails?j.lane.w:Math.max(ie,Math.min(j.lane.w,Math.floor((x-y*(e-1))/e))),S=a.map(e=>{let t=_(e),n=e.startsWith(M)?e.slice(5):null,r=n?`loop`:u.has(e)?`fork`:`brick`;return{id:e,kind:r,...t?{w:ne(g[f.get(e)].length),h:j.lane.h}:{...j[r]||j.brick},rank:f.get(e),lane:t,stacked:!1,loop:n,human:r===`brick`||r===`fork`?b(l.get(e)):null,tags:[]}}),C=new Map(S.map(e=>[e.id,e])),w=s.some(e=>e.to===`$close`);if(w){let e={id:`$close`,kind:`close`,...j.close,rank:h,tags:[]};S.push(e),C.set(`$close`,e),g[h]=[`$close`]}let de=e=>{let t=null;for(let n of u.keys())f.get(n)<f.get(e)&&(!t||f.get(n)>f.get(t))&&(t=n);return t},P=new Map;for(let e of s){let t=`${e.from}\u0000${e.to}`;if(P.has(t))P.get(t).on.push(e.on);else{let n=d(e),r=e.to===`$lane`?u.get(de(e.from))?.[0]:e.to;if(e.to!==`$stop`&&!C.has(r))continue;let i=e.to===`$stop`?0:C.get(r).rank-f.get(e.from),a=e.to===`$stop`?`stop`:n?`back`:i===1?`flow`:`skip`;P.set(t,{from:e.from,to:e.to,target:r,on:[e.on],kind:a,back:!!n,cycle:n?.name??null,cycleDef:n,span:i})}}let F=[...P.values()],pe=F.filter(e=>e.kind===`back`||e.kind===`skip`),I=F.filter(e=>e.kind===`stop`&&_(e.from)),me=n.rails?I:[...pe,...F.filter(e=>e.kind===`stop`&&!_(e.from)),...I];for(let e of me)C.get(e.from).tags.push({kind:e.kind,on:e.on,to:e.to,cycle:e.cycle});let he=(e,t)=>e.kind===`back`?N(t.cycleDef):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,ge=e=>Math.max(0,...e.tags.map(t=>he(t,F.find(n=>n.from===e.id&&n.to===t.to)).length*A)),L=g.map(e=>(e||[]).map(e=>C.get(e))),R=e=>e.reduce((e,t)=>e+t.w,0)+y*(e.length-1),z=L.map(e=>n.stack&&e.length>1&&R(e)>x);L.forEach((e,t)=>{if(z[t])for(let t of e)Object.assign(t,{stacked:!0,w:te()})});let B=(e,t)=>z[t]?Math.max(...e.map(e=>e.w))+28:R(e),V=Math.max(j.brick.w,...L.map((e,t)=>e.length?B(e,t):0)),H=T,U=[];L.forEach((e,t)=>{if(!e.length)return;let n=(V-B(e,t))/2;if(z[t]){for(let t of e)Object.assign(t,{x:(V-t.w)/2,y:H}),H+=t.h+t.tags.length*k+D;H-=D}else{for(let t of e)Object.assign(t,{x:n,y:H}),n+=t.w+y;H+=Math.max(...e.map(e=>e.h)),H+=Math.max(0,...e.map(e=>e.tags.length))*k}U[t]=H+E/2,H+=E});let W=H-E,G=n.rails?pe.sort((e,t)=>Math.abs(t.span)-Math.abs(e.span)):[],K=e=>28+e*se,q=e=>e.back?N(e.cycleDef):e.on.join(` · `),J=G.length?K(G.length-1)+12:v;G.forEach((e,t)=>{J=Math.max(J,K(t)+8+q(e).length*A-C.get(e.from).x)});for(let e of S)e.x+=J;let Y=n.rails?F.filter(e=>e.kind===`stop`&&!_(e.from)):[],X=J+V+24;for(let e of Y){let t=C.get(e.from);X=Math.max(X,t.x+t.w+10+e.on.join(` · `).length*A)}let _e=Math.max(0,...S.filter(e=>e.tags.length).map(e=>e.x+e.w/2+6+ge(e))),Z=Math.max(J+V,_e)+v;if(Y.length){X=Math.max(X,_e+10);let e=w?C.get(`$close`).y:W-j.stop.h,t={id:`$stop`,kind:`stop`,...j.stop,x:X-j.stop.w/2,y:e,rank:h,tags:[]};S.push(t),C.set(`$stop`,t),Z=X+j.stop.w/2+T}let Q=e=>e.x+e.w/2,$=e=>e.y+e.h/2,ve=e=>e.y+e.h,ye=e=>e.x-O,be=e=>e.x+e.w+O,xe=new Map;for(let e of F)e.kind===`flow`&&xe.set(e.target,(xe.get(e.target)||0)+1);let Se=e=>e.to===`$lane`&&C.get(i)?.stacked&&u.get(de(e.from))?.includes(i)?C.get(i):C.get(e.target),Ce=new Map;for(let e of G){let t=Se(e).id;Ce.set(t,(Ce.get(t)||0)+1)}let we=new Map,Te=F.map(e=>{let t=C.get(e.from),n=Se(e),r={from:e.from,to:e.to,on:e.on,kind:e.kind,back:e.back,cycle:e.cycle};if(e.kind===`stop`){if(!Y.includes(e))return{...r,path:null};let n=C.get(`$stop`);return{...r,path:`M${t.x+t.w},${$(t)} H${X} V${n.y}`,lx:t.x+t.w+6,ly:$(t)-6,anchor:`start`}}if(e.kind===`back`||e.kind===`skip`){let i=G.indexOf(e);if(i<0)return{...r,path:null};let a=we.get(n.id)||0;we.set(n.id,a+1);let o=Math.ceil((Ce.get(n.id)-1)/2),s=o?Math.min(10,(n.h/2-ce)/o):10,c=$(n)+(a%2?1:-1)*Math.ceil(a/2)*s;return{...r,path:`M${t.x},${$(t)} H${K(i)} V${c} H${n.x}`,lx:K(i)+6,ly:$(t)-6,anchor:`start`}}let i=U[t.rank],a=t.stacked?`M${t.x+t.w},${$(t)} H${be(t)} V${i}`:`M${Q(t)},${ve(t)} V${i}`,o=n.stacked?` H${ye(n)} V${$(n)} H${n.x}`:` H${Q(n)} V${n.y}`,s=e.on.length===1&&e.on[0]===`pass`,c=(xe.get(n.id)||0)>1?{lx:t.stacked?be(t)+4:Q(t)+6,ly:t.stacked?$(t)-4:ve(t)+13}:n.stacked?{lx:n.x,ly:n.y-5}:{lx:Q(n)+6,ly:n.y-8};return{...r,path:a+o,...c,anchor:`start`,plain:s}});return{width:Math.ceil(Z),height:Math.ceil(W+T),mode:n.rails?`rails`:`tags`,stacked:z.some(Boolean),nodes:S,edges:Te}}var I=n(),me=20;function he({factory:e,bricks:t=[],loops:n=[],onSelect:r,highlight:i,child:a,counters:o,lane:s,history:c}){let l=(0,w.useRef)(null),[u,ee]=(0,w.useState)(0);(0,w.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>ee(t=>Math.abs(e.clientWidth-t)>me?e.clientWidth:t);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let d=s===void 0?P(e,c,t):s,f=F(e,t,{width:u,lane:d}),p=new Set(n.map(e=>e.name)),m=new Map((e.cycles||[]).map(e=>[e.name,e])),h=new Set(f.nodes.filter(e=>e.kind===`fork`).map(e=>e.id)),g=e=>e.kind===`back`?N(m.get(e.cycle),o):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,_=e=>e.kind===`loop`?`${e.id} stage, the ${e.loop} loop`:`${e.id} ${e.kind===`fork`?`fork`:`brick`}${e.human?`, ${e.human.toLowerCase()}`:``}`,y=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},b=e=>{let t=e.id===i,n=`${_(e)}${e.id===d?`, the lane taken`:``}`,o=t&&a&&(e.loop||e.lane)?`, at ${a.node}`:``;return r?{role:`button`,tabIndex:0,"aria-label":`${n}${o}`,onClick:y(e.id),onKeyDown:y(e.id)}:{role:`img`,"aria-label":`${n}${t?`, current stage`:``}${o}`}},x=e=>`fg-node ${e.kind}${e.lane?` lane`:``}${e.id===i?` current`:``}${e.id===d?` taken`:``}`,te=e=>d&&(e.to===d||e.from===d),ne=e=>e.tags.map((t,n)=>(0,I.jsx)(`text`,{x:e.x+e.w/2+6,y:e.y+e.h+12+n*15,className:`fg-lbl fg-tag ${t.kind}`,children:g(t)},`${t.kind}${t.to}`));return(0,I.jsxs)(`div`,{className:`fg-wrap`,ref:l,children:[(0,I.jsxs)(`svg`,{className:`fgraph`,"data-mode":`${f.mode}${f.stacked?` stacked`:``}`,style:{"--fg-w":`${f.width}px`},viewBox:`0 0 ${f.width} ${f.height}`,role:`group`,"aria-label":`${e.name} factory: ${(e.stages||[]).join(`, `)}`,children:[(0,I.jsx)(`defs`,{children:[`flow`,`back`,`stop`].map(e=>(0,I.jsx)(`marker`,{id:`fg-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,I.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`fg-head-${e}`})},e))}),f.edges.map(e=>{if(!e.path)return null;let t=e.kind===`skip`?`flow`:e.kind,n=e.back?N(m.get(e.cycle),o):e.kind===`flow`&&e.plain?``:e.on.join(` · `);return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`path`,{d:e.path,className:`fg-edge ${e.kind}${te(e)&&e.kind===`flow`?` taken`:``}`,markerEnd:`url(#fg-arrow-${t})`}),n?(0,I.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`fg-lbl ${e.kind}${e.kind===`flow`&&h.has(e.from)?` fork`:``}`,children:n}):null]},`${e.from}>${e.to}`)}),f.nodes.map(e=>{if(e.kind===`close`||e.kind===`stop`)return(0,I.jsxs)(`g`,{className:`fg-${e.kind}`,role:`img`,"aria-label":e.kind,children:[(0,I.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.h/2}),(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+4,textAnchor:`middle`,children:e.kind})]},e.id);let t=e.id===i?`step`:void 0,n=a&&e.id===i?a:null,r=n&&(e.loop||e.lane)?`at ${n.node}`:e.loop?p.has(e.loop)?`whole loop`:`not in catalogue`:e.lane?`no loop`:null;return(0,I.jsxs)(`g`,{children:[(0,I.jsxs)(`g`,{className:x(e),"aria-current":t,...b(e),children:[e.lane||e.loop?(0,I.jsx)(`title`,{children:e.id}):null,(0,I.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:`10`}),(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+(r?-2:4),textAnchor:`middle`,children:e.loop||e.id}),r?(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+14,textAnchor:`middle`,className:`fg-sub`,children:r}):null,e.human?(0,I.jsx)(v,{x:e.x+e.w-4,y:e.y+4,label:e.human}):null]}),ne(e)]},e.id)})]}),(0,I.jsx)(`ul`,{className:`fg-legend`,"aria-label":`Graph legend`,children:[[`brick`,`brick`],[`loop`,`whole loop (test · fix · verify)`],[`fork`,`fork`],[`back`,`route back, bounded by its max`],[`stop`,`fail → stop`]].map(([e,t])=>(0,I.jsxs)(`li`,{children:[(0,I.jsx)(`span`,{className:`fg-key ${e}`,"aria-hidden":`true`}),t]},e))})]})}var ge=encodeURIComponent,L=5e3,R=a.factories.map(e=>[e,i[e]]),z={project:`Project`,global:`Global`,shipped:`Shipped`},B={templates:`Origins`,active:`Statuses`},V=[[`wait`,`Waits for you`,[`awaiting`,`unreadable`]],[`run`,`Running`,[`running`]],[`end`,`Ended`,[`stopped`,`done`,`finished`]]],H=V.flatMap(([,e,t])=>t.map(t=>[t,e])),U=e=>!!e.graph,W=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r}))),G=e=>W(e.map(e=>({...e,desc:e.description})),e=>e.origin,Object.entries(z)),K=e=>W(e.map(e=>({...e,name:e.root,desc:e.factory,meta:U(e)?Y(e).join(` · `):void 0})),e=>e.status,H);function q(e){if(e==null)return`unknown`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.round(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${String(n%60).padStart(2,`0`)} min`}var J=e=>`${e.slice(0,16).replace(`T`,` `)} UTC`;function Y(e){if(e.status===`unreadable`)return[`Its FACTORY.md cannot be read.`];if(e.status===`finished`)return[`Its FACTORY.md is gone: the run closed.`];let t=e.tasks,n=e.metrics;return[e.awaiting?`${e.awaiting.stage} · ${e.awaiting.outcome}`:e.status===`stopped`?`stopped: ${e.reason}`:e.status===`done`?`closed`:e.stage,t?`task ${t.index}/${t.count}`:null,n?`work ${q(n.workMs)}`:null,n?.openWaitMs==null?null:`waiting ${q(n.openWaitMs)}`,...(e.graph?.cycles||[]).filter(t=>e.counters?.[t.name]>0).map(t=>`${t.name} ${e.counters[t.name]}/${t.max}`)].filter(Boolean)}function X({runs:e}){return(0,I.jsx)(`section`,{className:`fac-board`,"aria-label":`Runs board`,children:V.map(([t,n,r])=>{let i=e.filter(e=>r.includes(e.status));return(0,I.jsxs)(`div`,{className:`fac-col ${t}`,role:`group`,"aria-label":n,children:[(0,I.jsxs)(`h3`,{className:`loop-kicker`,children:[n,` `,(0,I.jsx)(`span`,{className:`mono dim`,children:i.length})]}),i.length?(0,I.jsx)(`ul`,{children:i.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`a`,{className:`fac-card`,href:`#/factories/active/${ge(e.root)}`,children:[(0,I.jsx)(`b`,{children:e.title}),(0,I.jsx)(`span`,{className:`mono`,children:e.factory}),(0,I.jsx)(`span`,{children:Y(e).join(` · `)})]})},e.root))}):(0,I.jsx)(`p`,{className:`panel-note`,children:`None.`})]},t)})})}function _e({run:e}){if(!e.history?.length)return null;let t=e.metrics,n=e.history.map((e,n)=>({i:n,h:e,e:t?.entries?.[n]||{}}));return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Timeline`}),(0,I.jsx)(_,{caption:`Run history`,captionHidden:!0,rowKey:e=>e.i,rows:n,columns:[{key:`stage`,label:`Stage`,render:e=>e.h.stage},{key:`result`,label:`Result`,render:e=>e.h.verdict?`you answered ${e.h.verdict}`:(0,I.jsxs)(I.Fragment,{children:[e.h.outcome,` `,e.e.rework?(0,I.jsx)(`span`,{className:`tag warn`,children:`rework`}):null]})},{key:`at`,label:`Time`,render:e=>typeof e.h.at==`string`?(0,I.jsx)(`time`,{dateTime:e.h.at,children:J(e.h.at)}):`unknown`},{key:`ms`,label:`Duration`,render:e=>`${q(e.e.ms)}${e.e.wait?` waiting`:``}`}]}),t?(0,I.jsxs)(`p`,{className:`panel-note fac-totals`,children:[`Work `,q(t.workMs),` · waited `,q(t.waitMs),t.openWaitMs==null?``:` · waiting ${q(t.openWaitMs)}`,` · tokens`,` `,t.tokens??`unknown`]}):null]})}var Z=(e,t)=>(0,I.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),Q={templates:e=>Z(``,e.origin),active:e=>Z(y[e.status],e.status)},$=he;function ve({factory:e,counters:t}){return e.cycles?.length?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Routes back`}),(0,I.jsx)(`ul`,{className:`fac-cycles`,"aria-label":`Cycles`,children:e.cycles.map(e=>(0,I.jsxs)(`li`,{children:[(0,I.jsx)(`b`,{children:e.name}),`: `,e.nodes.join(` → `),` —`,` `,t?`lap ${t[e.name]??0} of ${e.max}`:`${e.max} laps at most`]},e.name))})]}):null}function ye({f:e,bricks:t,loops:n}){let r=`Run the ${e.name} factory on <issue URL, file or request>`,i=[`git worktree add ../<repo>-factory-<slug> -b loop/factory-<slug>`,`cd ../<repo>-factory-<slug>`,`geneseed factory init --factory ${e.name} --title "<title>" --requirement "<requirement>" --input "<issue URL, file path or pasted text>"`].join(` && `);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`reader-tags`,children:[(0,I.jsx)(`span`,{className:`tag acc`,children:`Factory`}),Z(``,e.origin)]}),(0,I.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,I.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,I.jsxs)(`p`,{className:`mono dim reader-src`,children:[`factories/`,e.name,`.json · `,e.origin]}),(0,I.jsx)(`hr`,{className:`hr`}),(0,I.jsx)($,{factory:e.factory,bricks:t,loops:n}),(0,I.jsx)(ve,{factory:e.factory}),(0,I.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`fac-start-h`,children:[(0,I.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,I.jsx)(`h3`,{id:`fac-start-h`,className:`loop-kicker`,children:`Start it: ask the agent`}),(0,I.jsx)(g,{text:r,label:`Copy request`})]}),(0,I.jsx)(`pre`,{className:`mono`,children:r}),(0,I.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,I.jsx)(`h3`,{className:`loop-kicker`,children:`Or by hand, in a new worktree`}),(0,I.jsx)(g,{text:i,label:`Copy command`})]}),(0,I.jsx)(`pre`,{className:`mono`,children:i})]}),(0,I.jsxs)(`p`,{className:`panel-note`,children:[(0,I.jsx)(`code`,{className:`mono`,children:`init`}),` only registers the run: an agent then drives`,` `,(0,I.jsx)(`code`,{className:`mono`,children:`geneseed factory next`}),` and `,(0,I.jsx)(`code`,{className:`mono`,children:`record`}),`.`]}),e.factory.rules?.length?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,I.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every stage follows`,children:e.factory.rules.map(e=>(0,I.jsx)(`li`,{children:e},e))})]}):null]})}function be({run:e,bricks:t,loops:n,from:r}){let i=e.tasks;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`panel-note`,children:(0,I.jsx)(`a`,{href:`#/factories/active`,children:`← All runs`})}),(0,I.jsxs)(`div`,{className:`reader-tags`,children:[(0,I.jsx)(`span`,{className:`tag acc`,children:`Factory run`}),(0,I.jsx)(`span`,{className:`tag${y[e.status]?` ${y[e.status]}`:``}`,children:e.status})]}),(0,I.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,I.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.factory,` · `,e.branch,` · `,e.root]}),U(e)?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`reader-lede`,children:[`At `,e.stage,` · `,e.transitions,` transitions`,i?` · task ${i.index} / ${i.count}`:``,e.loop?` · loop at ${e.loop.node}, iteration ${e.loop.iteration}`:``]}),e.awaiting?(0,I.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,I.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind??`you`,e.awaiting.stage?` at ${e.awaiting.stage} (${e.awaiting.outcome})`:``]}),` `,`— Answer in the agent's session.`,e.awaiting.note?(0,I.jsxs)(I.Fragment,{children:[` `,`Its note: `,(0,I.jsx)(`code`,{className:`mono`,children:e.awaiting.note})]}):null]}):null,e.reason?(0,I.jsx)(`p`,{className:`panel-note`,children:e.reason}):null,(0,I.jsx)(`hr`,{className:`hr`}),(0,I.jsx)($,{factory:e.graph,bricks:t,loops:n,highlight:e.stage,child:e.loop,counters:e.counters,lane:e.lane,history:e.history}),(0,I.jsx)(ve,{factory:e.graph,counters:e.counters}),(0,I.jsx)(_e,{run:e}),(0,I.jsxs)(`p`,{className:`panel-note`,children:[`Bricks and loops drawn from the catalogue of `,r||`the default install`,`, which the run’s project may not share.`]})]}):(0,I.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its FACTORY.md cannot be read, so there is no state to show.`:`Its FACTORY.md is gone: the run closed and its state went with it.`})]})}function xe({problems:e}){if(!e?.length)return null;let t=e.length;return(0,I.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,I.jsxs)(`b`,{className:`t-warn`,children:[t,` factory `,t===1?`problem`:`problems`,`: these factories cannot run as they are`]}),(0,I.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,I.jsx)(`li`,{className:`mono`,children:e},e))})]})}var Se={templates:{title:`No factories`,body:(0,I.jsxs)(I.Fragment,{children:[`Add one under `,(0,I.jsx)(`code`,{className:`mono`,children:`.geneseed/factories/`}),` in the repo.`]})},active:{title:`No runs yet`,body:(0,I.jsxs)(I.Fragment,{children:[`Ask the agent to run a factory, or start one by hand in a worktree with`,` `,(0,I.jsx)(`code`,{className:`mono`,children:`geneseed factory init`}),`. It shows up here while it runs.`]})}},Ce={templates:(0,I.jsxs)(I.Fragment,{children:[`A factory carries one work item through bricks and loops to an open PR.`,` `,(0,I.jsx)(`a`,{href:`#/docs/factories`,children:`How factories work →`})]}),active:(0,I.jsxs)(I.Fragment,{children:[`Factory runs registered on this machine, read from their FACTORY.md: the ones that wait for you first. A card opens its timeline. `,(0,I.jsx)(`a`,{href:`#/docs/run-a-factory`,children:`Run a factory →`})]})};function we(){let[e,t]=(0,w.useState)(null),[n,i]=(0,w.useState)(null);return p(e=>r.activeFactories().then(n=>e()&&(t(m(n)),i(null)),t=>e()&&i(t.message)),L,[]),{runs:e?e.factories||[]:null,error:n}}function Te({tab:e=`templates`,item:t,dataRev:n}){let i=s(n),[a,p]=o(`factories`,i),{data:m,error:g}=f(()=>r.factories(l(a)),[n,a?.id??``],`factories`),{runs:_,error:v}=we(),[y,b]=(0,w.useState)(``),[T,E]=(0,w.useState)(`all`),[re,ie]=(0,w.useState)(e);e!==re&&(ie(e),b(``),E(`all`));let ae=m?.bricks||[],oe=m?.loops||[],D=e===`active`?_&&K(_):m&&G(m.factories||[]),O=D||[],se=C(O),k=T===`all`?O:O.filter(e=>e.group===T),ce=y.trim(),A=x(k,ce),j=!!(t&&D&&!O.some(e=>e.name===t)),M=j?null:O.find(e=>e.name===t)||(e===`active`?null:O[0])||null,le={templates:m?.factories?.length,active:_?.length},N=R.find(([t])=>t===e)[1],ue=e===`active`?v:g;return(0,I.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,I.jsx)(ee,{className:`page-pick`,installs:i,value:a,onChange:p}),(0,I.jsx)(c,{error:ue,style:{margin:`0 0 var(--sp-3)`}}),(0,I.jsx)(xe,{problems:m?.problems}),(0,I.jsxs)(`div`,{className:`library`,children:[(0,I.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Factories sections`,children:[(0,I.jsxs)(`div`,{className:`lib-title`,children:[(0,I.jsx)(`h1`,{className:`h`,children:`Factories`}),(0,I.jsx)(`span`,{className:`dim`,children:`Work items, carried to a PR`})]}),(0,I.jsx)(`p`,{className:`panel-note lib-lede`,children:Ce[e]}),(0,I.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:R.map(([t,n])=>(0,I.jsxs)(w.Fragment,{children:[(0,I.jsxs)(`a`,{href:`#/factories/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,I.jsx)(`span`,{className:`mono dim`,children:le[t]??``})]}),e===t&&(0,I.jsx)(S,{label:B[t],total:O.length,cats:se,cat:T,onChange:E})]},t))})]}),(0,I.jsx)(te,{label:N,count:ce?`${A.length} of ${k.length}`:D?k.length:``,q:y,onQ:b,matched:A.length,inView:[e,t],current:M?M.title||M.name:void 0,sections:R.map(([t,n])=>({key:t,label:n,n:le[t],href:`#/factories/${t}`,on:e===t})),cats:se,cat:T,total:O.length,onCat:E,catLabel:B[e],children:D?O.length===0?(0,I.jsx)(h,{title:Se[e].title,children:Se[e].body}):(0,I.jsx)(ne,{rows:A,activeName:M?.name,hrefOf:t=>`#/factories/${e}/${ge(t.name)}`,pills:Q[e]}):ue?null:(0,I.jsx)(d,{})}),(0,I.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:j?(0,I.jsx)(h,{title:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/factories/${e}`,label:`All ${N.toLowerCase()} →`}}):M?e===`active`?(0,I.jsx)(be,{run:M,bricks:ae,loops:oe,from:a?u(a):null}):(0,I.jsx)(ye,{f:M,bricks:ae,loops:oe},M.name):e===`active`&&D&&O.length?(0,I.jsx)(X,{runs:A}):e===`active`&&D?(0,I.jsx)(h,{title:`What is a factory?`,docs:{href:`#/docs/factories`,label:`How factories work →`},children:`A factory runs stages, bricks and whole loops, until the work is an open PR.`}):null})]})]})}export{V as COLUMNS,Y as cardFacts,Te as default,G as factoryRows,q as fmtMs,K as runRows};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C8nMUU1i.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,mt as u,nt as ee,tt as d,wt as f}from"./index-BhT94v2q.js";import{n as p,t as m}from"./usePoll-D5c_qIFZ.js";import{t as h}from"./EmptyState-CY5Pm2xy.js";import{t as g}from"./CopyButton-Cnnvjgkg.js";import{t as _}from"./DataTable-b9zTShqJ.js";import{a as v,n as y,s as b}from"./ActiveLoops-BWkImeYa.js";import{a as x,i as te,n as ne,o as S,s as C}from"./LibRows-QsUBjOF7.js";var w=e(t(),1),T=24,E=48,re=16,ie=92,ae=8,oe=16,D=22,O=14,se=14,k=15,ce=4,A=7.2,j={brick:{w:200,h:48},fork:{w:200,h:48},loop:{w:200,h:56},lane:{w:150,h:56},close:{w:96,h:34},stop:{w:76,h:34}},M=`loop:`,le=new Set([`$close`,`$stop`,`$lane`]),N=(e,t)=>{if(!e?.name)return`↺ route back`;let n=t?`${t[e.name]??0} / ${e.max??`?`}`:`max ${e.max??`?`}`;return`↺ ${e.name} · ${n}`};function ue(e,t,n,r){let i=null;for(let a of e)Array.isArray(a?.nodes)&&a.nodes[0]===n&&(a.nodes.includes(t)||a.nodes.includes(`$lane`)&&r.has(t))&&(!i||a.nodes.length<i.nodes.length)&&(i=a);return i}var de=new Set([`pass`,`fail`,`error`,`none`,`needs-info`,`reject`]);function fe(e,t=[]){let n=new Set(Array.isArray(e.stages)?e.stages:[]),r=(e.cycles||[]).filter(e=>Array.isArray(e?.nodes)),i=e=>r.some(t=>t.nodes[0]===e.to&&t.nodes.includes(e.from)),a=new Map((Array.isArray(t)?t:[]).map(e=>[e?.name,e])),o=(e.edges||[]).filter(e=>n.has(e?.from)),s=e=>(a.has(e)?a.get(e)?.outcomes||[]:o.filter(t=>t.from===e).map(e=>e.on)).some(e=>!de.has(e)),c=new Map;for(let e of o)n.has(e.to)&&!i(e)&&!e.from.startsWith(M)&&s(e.from)&&(c.has(e.from)||c.set(e.from,[]),c.get(e.from).includes(e.to)||c.get(e.from).push(e.to));return c}function P(e,t,n=[]){let r=fe(e,n);for(let n of[...Array.isArray(t)?t:[]].reverse()){if(!r.has(n?.stage)||!n.outcome)continue;let t=(e.edges||[]).find(e=>e.from===n.stage&&e.on===n.outcome);if(t&&r.get(n.stage).includes(t.to))return t.to}return null}function F(e,t=[],n={}){let r=n.width>0?Math.floor(n.width):1/0,i=[{rails:!0,stack:!1},{rails:!1,stack:!1},{rails:!0,stack:!0},{rails:!1,stack:!0}];for(let a of i){let o=pe(e,t,a,r,n.lane);if(o.width<=r||a===i.at(-1))return o}}function pe(e,t,n,r,i){let a=Array.isArray(e.stages)?e.stages:[],o=new Set(a),s=(Array.isArray(e.edges)?e.edges:[]).filter(e=>typeof e?.from==`string`&&typeof e?.to==`string`&&o.has(e.from)&&(o.has(e.to)||le.has(e.to))),c=(Array.isArray(e.cycles)?e.cycles:[]).filter(e=>Array.isArray(e?.nodes)),l=new Map(t.map(e=>[e.name,e])),u=fe(e,t),ee=new Set([...u.values()].flat()),d=e=>ue(c,e.from,e.to,ee),f=new Map(o.has(e.start)?[[e.start,0]]:[]),p=s.filter(e=>o.has(e.to)&&!d(e));for(let e=0;e<a.length;e++){let e=!1;for(let t of p){if(!f.has(t.from))continue;let n=f.get(t.from)+1;f.get(t.to)>=n||(f.set(t.to,n),e=!0)}if(!e)break}let m=Math.max(-1,...f.values());for(let e of a)f.has(e)||f.set(e,++m);let h=m+1,g=[];for(let e of a)(g[f.get(e)]||=[]).push(e);let _=e=>g[f.get(e)].length>1,v=n.rails?T:oe,y=n.rails?re:ae,x=r===1/0?1/0:r-2*v,te=()=>Math.max(j.lane.w,Math.min(240,x-28)),ne=e=>n.rails?j.lane.w:Math.max(ie,Math.min(j.lane.w,Math.floor((x-y*(e-1))/e))),S=a.map(e=>{let t=_(e),n=e.startsWith(M)?e.slice(5):null,r=n?`loop`:u.has(e)?`fork`:`brick`;return{id:e,kind:r,...t?{w:ne(g[f.get(e)].length),h:j.lane.h}:{...j[r]||j.brick},rank:f.get(e),lane:t,stacked:!1,loop:n,human:r===`brick`||r===`fork`?b(l.get(e)):null,tags:[]}}),C=new Map(S.map(e=>[e.id,e])),w=s.some(e=>e.to===`$close`);if(w){let e={id:`$close`,kind:`close`,...j.close,rank:h,tags:[]};S.push(e),C.set(`$close`,e),g[h]=[`$close`]}let de=e=>{let t=null;for(let n of u.keys())f.get(n)<f.get(e)&&(!t||f.get(n)>f.get(t))&&(t=n);return t},P=new Map;for(let e of s){let t=`${e.from}\u0000${e.to}`;if(P.has(t))P.get(t).on.push(e.on);else{let n=d(e),r=e.to===`$lane`?u.get(de(e.from))?.[0]:e.to;if(e.to!==`$stop`&&!C.has(r))continue;let i=e.to===`$stop`?0:C.get(r).rank-f.get(e.from),a=e.to===`$stop`?`stop`:n?`back`:i===1?`flow`:`skip`;P.set(t,{from:e.from,to:e.to,target:r,on:[e.on],kind:a,back:!!n,cycle:n?.name??null,cycleDef:n,span:i})}}let F=[...P.values()],pe=F.filter(e=>e.kind===`back`||e.kind===`skip`),I=F.filter(e=>e.kind===`stop`&&_(e.from)),me=n.rails?I:[...pe,...F.filter(e=>e.kind===`stop`&&!_(e.from)),...I];for(let e of me)C.get(e.from).tags.push({kind:e.kind,on:e.on,to:e.to,cycle:e.cycle});let he=(e,t)=>e.kind===`back`?N(t.cycleDef):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,ge=e=>Math.max(0,...e.tags.map(t=>he(t,F.find(n=>n.from===e.id&&n.to===t.to)).length*A)),L=g.map(e=>(e||[]).map(e=>C.get(e))),R=e=>e.reduce((e,t)=>e+t.w,0)+y*(e.length-1),z=L.map(e=>n.stack&&e.length>1&&R(e)>x);L.forEach((e,t)=>{if(z[t])for(let t of e)Object.assign(t,{stacked:!0,w:te()})});let B=(e,t)=>z[t]?Math.max(...e.map(e=>e.w))+28:R(e),V=Math.max(j.brick.w,...L.map((e,t)=>e.length?B(e,t):0)),H=T,U=[];L.forEach((e,t)=>{if(!e.length)return;let n=(V-B(e,t))/2;if(z[t]){for(let t of e)Object.assign(t,{x:(V-t.w)/2,y:H}),H+=t.h+t.tags.length*k+D;H-=D}else{for(let t of e)Object.assign(t,{x:n,y:H}),n+=t.w+y;H+=Math.max(...e.map(e=>e.h)),H+=Math.max(0,...e.map(e=>e.tags.length))*k}U[t]=H+E/2,H+=E});let W=H-E,G=n.rails?pe.sort((e,t)=>Math.abs(t.span)-Math.abs(e.span)):[],K=e=>28+e*se,q=e=>e.back?N(e.cycleDef):e.on.join(` · `),J=G.length?K(G.length-1)+12:v;G.forEach((e,t)=>{J=Math.max(J,K(t)+8+q(e).length*A-C.get(e.from).x)});for(let e of S)e.x+=J;let Y=n.rails?F.filter(e=>e.kind===`stop`&&!_(e.from)):[],X=J+V+24;for(let e of Y){let t=C.get(e.from);X=Math.max(X,t.x+t.w+10+e.on.join(` · `).length*A)}let _e=Math.max(0,...S.filter(e=>e.tags.length).map(e=>e.x+e.w/2+6+ge(e))),Z=Math.max(J+V,_e)+v;if(Y.length){X=Math.max(X,_e+10);let e=w?C.get(`$close`).y:W-j.stop.h,t={id:`$stop`,kind:`stop`,...j.stop,x:X-j.stop.w/2,y:e,rank:h,tags:[]};S.push(t),C.set(`$stop`,t),Z=X+j.stop.w/2+T}let Q=e=>e.x+e.w/2,$=e=>e.y+e.h/2,ve=e=>e.y+e.h,ye=e=>e.x-O,be=e=>e.x+e.w+O,xe=new Map;for(let e of F)e.kind===`flow`&&xe.set(e.target,(xe.get(e.target)||0)+1);let Se=e=>e.to===`$lane`&&C.get(i)?.stacked&&u.get(de(e.from))?.includes(i)?C.get(i):C.get(e.target),Ce=new Map;for(let e of G){let t=Se(e).id;Ce.set(t,(Ce.get(t)||0)+1)}let we=new Map,Te=F.map(e=>{let t=C.get(e.from),n=Se(e),r={from:e.from,to:e.to,on:e.on,kind:e.kind,back:e.back,cycle:e.cycle};if(e.kind===`stop`){if(!Y.includes(e))return{...r,path:null};let n=C.get(`$stop`);return{...r,path:`M${t.x+t.w},${$(t)} H${X} V${n.y}`,lx:t.x+t.w+6,ly:$(t)-6,anchor:`start`}}if(e.kind===`back`||e.kind===`skip`){let i=G.indexOf(e);if(i<0)return{...r,path:null};let a=we.get(n.id)||0;we.set(n.id,a+1);let o=Math.ceil((Ce.get(n.id)-1)/2),s=o?Math.min(10,(n.h/2-ce)/o):10,c=$(n)+(a%2?1:-1)*Math.ceil(a/2)*s;return{...r,path:`M${t.x},${$(t)} H${K(i)} V${c} H${n.x}`,lx:K(i)+6,ly:$(t)-6,anchor:`start`}}let i=U[t.rank],a=t.stacked?`M${t.x+t.w},${$(t)} H${be(t)} V${i}`:`M${Q(t)},${ve(t)} V${i}`,o=n.stacked?` H${ye(n)} V${$(n)} H${n.x}`:` H${Q(n)} V${n.y}`,s=e.on.length===1&&e.on[0]===`pass`,c=(xe.get(n.id)||0)>1?{lx:t.stacked?be(t)+4:Q(t)+6,ly:t.stacked?$(t)-4:ve(t)+13}:n.stacked?{lx:n.x,ly:n.y-5}:{lx:Q(n)+6,ly:n.y-8};return{...r,path:a+o,...c,anchor:`start`,plain:s}});return{width:Math.ceil(Z),height:Math.ceil(W+T),mode:n.rails?`rails`:`tags`,stacked:z.some(Boolean),nodes:S,edges:Te}}var I=n(),me=20;function he({factory:e,bricks:t=[],loops:n=[],onSelect:r,highlight:i,child:a,counters:o,lane:s,history:c}){let l=(0,w.useRef)(null),[u,ee]=(0,w.useState)(0);(0,w.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>ee(t=>Math.abs(e.clientWidth-t)>me?e.clientWidth:t);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let d=s===void 0?P(e,c,t):s,f=F(e,t,{width:u,lane:d}),p=new Set(n.map(e=>e.name)),m=new Map((e.cycles||[]).map(e=>[e.name,e])),h=new Set(f.nodes.filter(e=>e.kind===`fork`).map(e=>e.id)),g=e=>e.kind===`back`?N(m.get(e.cycle),o):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,_=e=>e.kind===`loop`?`${e.id} stage, the ${e.loop} loop`:`${e.id} ${e.kind===`fork`?`fork`:`brick`}${e.human?`, ${e.human.toLowerCase()}`:``}`,y=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},b=e=>{let t=e.id===i,n=`${_(e)}${e.id===d?`, the lane taken`:``}`,o=t&&a&&(e.loop||e.lane)?`, at ${a.node}`:``;return r?{role:`button`,tabIndex:0,"aria-label":`${n}${o}`,onClick:y(e.id),onKeyDown:y(e.id)}:{role:`img`,"aria-label":`${n}${t?`, current stage`:``}${o}`}},x=e=>`fg-node ${e.kind}${e.lane?` lane`:``}${e.id===i?` current`:``}${e.id===d?` taken`:``}`,te=e=>d&&(e.to===d||e.from===d),ne=e=>e.tags.map((t,n)=>(0,I.jsx)(`text`,{x:e.x+e.w/2+6,y:e.y+e.h+12+n*15,className:`fg-lbl fg-tag ${t.kind}`,children:g(t)},`${t.kind}${t.to}`));return(0,I.jsxs)(`div`,{className:`fg-wrap`,ref:l,children:[(0,I.jsxs)(`svg`,{className:`fgraph`,"data-mode":`${f.mode}${f.stacked?` stacked`:``}`,style:{"--fg-w":`${f.width}px`},viewBox:`0 0 ${f.width} ${f.height}`,role:`group`,"aria-label":`${e.name} factory: ${(e.stages||[]).join(`, `)}`,children:[(0,I.jsx)(`defs`,{children:[`flow`,`back`,`stop`].map(e=>(0,I.jsx)(`marker`,{id:`fg-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,I.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`fg-head-${e}`})},e))}),f.edges.map(e=>{if(!e.path)return null;let t=e.kind===`skip`?`flow`:e.kind,n=e.back?N(m.get(e.cycle),o):e.kind===`flow`&&e.plain?``:e.on.join(` · `);return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`path`,{d:e.path,className:`fg-edge ${e.kind}${te(e)&&e.kind===`flow`?` taken`:``}`,markerEnd:`url(#fg-arrow-${t})`}),n?(0,I.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`fg-lbl ${e.kind}${e.kind===`flow`&&h.has(e.from)?` fork`:``}`,children:n}):null]},`${e.from}>${e.to}`)}),f.nodes.map(e=>{if(e.kind===`close`||e.kind===`stop`)return(0,I.jsxs)(`g`,{className:`fg-${e.kind}`,role:`img`,"aria-label":e.kind,children:[(0,I.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.h/2}),(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+4,textAnchor:`middle`,children:e.kind})]},e.id);let t=e.id===i?`step`:void 0,n=a&&e.id===i?a:null,r=n&&(e.loop||e.lane)?`at ${n.node}`:e.loop?p.has(e.loop)?`whole loop`:`not in catalogue`:e.lane?`no loop`:null;return(0,I.jsxs)(`g`,{children:[(0,I.jsxs)(`g`,{className:x(e),"aria-current":t,...b(e),children:[e.lane||e.loop?(0,I.jsx)(`title`,{children:e.id}):null,(0,I.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:`10`}),(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+(r?-2:4),textAnchor:`middle`,children:e.loop||e.id}),r?(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+14,textAnchor:`middle`,className:`fg-sub`,children:r}):null,e.human?(0,I.jsx)(v,{x:e.x+e.w-4,y:e.y+4,label:e.human}):null]}),ne(e)]},e.id)})]}),(0,I.jsx)(`ul`,{className:`fg-legend`,"aria-label":`Graph legend`,children:[[`brick`,`brick`],[`loop`,`whole loop (test · fix · verify)`],[`fork`,`fork`],[`back`,`route back, bounded by its max`],[`stop`,`fail → stop`]].map(([e,t])=>(0,I.jsxs)(`li`,{children:[(0,I.jsx)(`span`,{className:`fg-key ${e}`,"aria-hidden":`true`}),t]},e))})]})}var ge=encodeURIComponent,L=5e3,R=a.factories.map(e=>[e,i[e]]),z={project:`Project`,global:`Global`,shipped:`Shipped`},B={templates:`Origins`,active:`Statuses`},V=[[`wait`,`Waits for you`,[`awaiting`,`unreadable`]],[`run`,`Running`,[`running`]],[`end`,`Ended`,[`stopped`,`done`,`finished`]]],H=V.flatMap(([,e,t])=>t.map(t=>[t,e])),U=e=>!!e.graph,W=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r}))),G=e=>W(e.map(e=>({...e,desc:e.description})),e=>e.origin,Object.entries(z)),K=e=>W(e.map(e=>({...e,name:e.root,desc:e.factory,meta:U(e)?Y(e).join(` · `):void 0})),e=>e.status,H);function q(e){if(e==null)return`unknown`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.round(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${String(n%60).padStart(2,`0`)} min`}var J=e=>`${e.slice(0,16).replace(`T`,` `)} UTC`;function Y(e){if(e.status===`unreadable`)return[`Its FACTORY.md cannot be read.`];if(e.status===`finished`)return[`Its FACTORY.md is gone: the run closed.`];let t=e.tasks,n=e.metrics;return[e.awaiting?`${e.awaiting.stage} · ${e.awaiting.outcome}`:e.status===`stopped`?`stopped: ${e.reason}`:e.status===`done`?`closed`:e.stage,t?`task ${t.index}/${t.count}`:null,n?`work ${q(n.workMs)}`:null,n?.openWaitMs==null?null:`waiting ${q(n.openWaitMs)}`,...(e.graph?.cycles||[]).filter(t=>e.counters?.[t.name]>0).map(t=>`${t.name} ${e.counters[t.name]}/${t.max}`)].filter(Boolean)}function X({runs:e}){return(0,I.jsx)(`section`,{className:`fac-board`,"aria-label":`Runs board`,children:V.map(([t,n,r])=>{let i=e.filter(e=>r.includes(e.status));return(0,I.jsxs)(`div`,{className:`fac-col ${t}`,role:`group`,"aria-label":n,children:[(0,I.jsxs)(`h3`,{className:`loop-kicker`,children:[n,` `,(0,I.jsx)(`span`,{className:`mono dim`,children:i.length})]}),i.length?(0,I.jsx)(`ul`,{children:i.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`a`,{className:`fac-card`,href:`#/factories/active/${ge(e.root)}`,children:[(0,I.jsx)(`b`,{children:e.title}),(0,I.jsx)(`span`,{className:`mono`,children:e.factory}),(0,I.jsx)(`span`,{children:Y(e).join(` · `)})]})},e.root))}):(0,I.jsx)(`p`,{className:`panel-note`,children:`None.`})]},t)})})}function _e({run:e}){if(!e.history?.length)return null;let t=e.metrics,n=e.history.map((e,n)=>({i:n,h:e,e:t?.entries?.[n]||{}}));return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Timeline`}),(0,I.jsx)(_,{caption:`Run history`,captionHidden:!0,rowKey:e=>e.i,rows:n,columns:[{key:`stage`,label:`Stage`,render:e=>e.h.stage},{key:`result`,label:`Result`,render:e=>e.h.verdict?`you answered ${e.h.verdict}`:(0,I.jsxs)(I.Fragment,{children:[e.h.outcome,` `,e.e.rework?(0,I.jsx)(`span`,{className:`tag warn`,children:`rework`}):null]})},{key:`at`,label:`Time`,render:e=>typeof e.h.at==`string`?(0,I.jsx)(`time`,{dateTime:e.h.at,children:J(e.h.at)}):`unknown`},{key:`ms`,label:`Duration`,render:e=>`${q(e.e.ms)}${e.e.wait?` waiting`:``}`}]}),t?(0,I.jsxs)(`p`,{className:`panel-note fac-totals`,children:[`Work `,q(t.workMs),` · waited `,q(t.waitMs),t.openWaitMs==null?``:` · waiting ${q(t.openWaitMs)}`,` · tokens`,` `,t.tokens??`unknown`]}):null]})}var Z=(e,t)=>(0,I.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),Q={templates:e=>Z(``,e.origin),active:e=>Z(y[e.status],e.status)},$=he;function ve({factory:e,counters:t}){return e.cycles?.length?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Routes back`}),(0,I.jsx)(`ul`,{className:`fac-cycles`,"aria-label":`Cycles`,children:e.cycles.map(e=>(0,I.jsxs)(`li`,{children:[(0,I.jsx)(`b`,{children:e.name}),`: `,e.nodes.join(` → `),` —`,` `,t?`lap ${t[e.name]??0} of ${e.max}`:`${e.max} laps at most`]},e.name))})]}):null}function ye({f:e,bricks:t,loops:n}){let r=`Run the ${e.name} factory on <issue URL, file or request>`,i=[`git worktree add ../<repo>-factory-<slug> -b loop/factory-<slug>`,`cd ../<repo>-factory-<slug>`,`geneseed factory init --factory ${e.name} --title "<title>" --requirement "<requirement>" --input "<issue URL, file path or pasted text>"`].join(` && `);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`reader-tags`,children:[(0,I.jsx)(`span`,{className:`tag acc`,children:`Factory`}),Z(``,e.origin)]}),(0,I.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,I.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,I.jsxs)(`p`,{className:`mono dim reader-src`,children:[`factories/`,e.name,`.json · `,e.origin]}),(0,I.jsx)(`hr`,{className:`hr`}),(0,I.jsx)($,{factory:e.factory,bricks:t,loops:n}),(0,I.jsx)(ve,{factory:e.factory}),(0,I.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`fac-start-h`,children:[(0,I.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,I.jsx)(`h3`,{id:`fac-start-h`,className:`loop-kicker`,children:`Start it: ask the agent`}),(0,I.jsx)(g,{text:r,label:`Copy request`})]}),(0,I.jsx)(`pre`,{className:`mono`,children:r}),(0,I.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,I.jsx)(`h3`,{className:`loop-kicker`,children:`Or by hand, in a new worktree`}),(0,I.jsx)(g,{text:i,label:`Copy command`})]}),(0,I.jsx)(`pre`,{className:`mono`,children:i})]}),(0,I.jsxs)(`p`,{className:`panel-note`,children:[(0,I.jsx)(`code`,{className:`mono`,children:`init`}),` only registers the run: an agent then drives`,` `,(0,I.jsx)(`code`,{className:`mono`,children:`geneseed factory next`}),` and `,(0,I.jsx)(`code`,{className:`mono`,children:`record`}),`.`]}),e.factory.rules?.length?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,I.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every stage follows`,children:e.factory.rules.map(e=>(0,I.jsx)(`li`,{children:e},e))})]}):null]})}function be({run:e,bricks:t,loops:n,from:r}){let i=e.tasks;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`panel-note`,children:(0,I.jsx)(`a`,{href:`#/factories/active`,children:`← All runs`})}),(0,I.jsxs)(`div`,{className:`reader-tags`,children:[(0,I.jsx)(`span`,{className:`tag acc`,children:`Factory run`}),(0,I.jsx)(`span`,{className:`tag${y[e.status]?` ${y[e.status]}`:``}`,children:e.status})]}),(0,I.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,I.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.factory,` · `,e.branch,` · `,e.root]}),U(e)?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`reader-lede`,children:[`At `,e.stage,` · `,e.transitions,` transitions`,i?` · task ${i.index} / ${i.count}`:``,e.loop?` · loop at ${e.loop.node}, iteration ${e.loop.iteration}`:``]}),e.awaiting?(0,I.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,I.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind??`you`,e.awaiting.stage?` at ${e.awaiting.stage} (${e.awaiting.outcome})`:``]}),` `,`— Answer in the agent's session.`,e.awaiting.note?(0,I.jsxs)(I.Fragment,{children:[` `,`Its note: `,(0,I.jsx)(`code`,{className:`mono`,children:e.awaiting.note})]}):null]}):null,e.reason?(0,I.jsx)(`p`,{className:`panel-note`,children:e.reason}):null,(0,I.jsx)(`hr`,{className:`hr`}),(0,I.jsx)($,{factory:e.graph,bricks:t,loops:n,highlight:e.stage,child:e.loop,counters:e.counters,lane:e.lane,history:e.history}),(0,I.jsx)(ve,{factory:e.graph,counters:e.counters}),(0,I.jsx)(_e,{run:e}),(0,I.jsxs)(`p`,{className:`panel-note`,children:[`Bricks and loops drawn from the catalogue of `,r||`the default install`,`, which the run’s project may not share.`]})]}):(0,I.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its FACTORY.md cannot be read, so there is no state to show.`:`Its FACTORY.md is gone: the run closed and its state went with it.`})]})}function xe({problems:e}){if(!e?.length)return null;let t=e.length;return(0,I.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,I.jsxs)(`b`,{className:`t-warn`,children:[t,` factory `,t===1?`problem`:`problems`,`: these factories cannot run as they are`]}),(0,I.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,I.jsx)(`li`,{className:`mono`,children:e},e))})]})}var Se={templates:{title:`No factories`,body:(0,I.jsxs)(I.Fragment,{children:[`Add one under `,(0,I.jsx)(`code`,{className:`mono`,children:`.geneseed/factories/`}),` in the repo.`]})},active:{title:`No runs yet`,body:(0,I.jsxs)(I.Fragment,{children:[`Ask the agent to run a factory, or start one by hand in a worktree with`,` `,(0,I.jsx)(`code`,{className:`mono`,children:`geneseed factory init`}),`. It shows up here while it runs.`]})}},Ce={templates:(0,I.jsxs)(I.Fragment,{children:[`A factory carries one work item through bricks and loops to an open PR.`,` `,(0,I.jsx)(`a`,{href:`#/docs/factories`,children:`How factories work →`})]}),active:(0,I.jsxs)(I.Fragment,{children:[`Factory runs registered on this machine, read from their FACTORY.md: the ones that wait for you first. A card opens its timeline. `,(0,I.jsx)(`a`,{href:`#/docs/run-a-factory`,children:`Run a factory →`})]})};function we(){let[e,t]=(0,w.useState)(null),[n,i]=(0,w.useState)(null);return p(e=>r.activeFactories().then(n=>e()&&(t(m(n)),i(null)),t=>e()&&i(t.message)),L,[]),{runs:e?e.factories||[]:null,error:n}}function Te({tab:e=`templates`,item:t,dataRev:n}){let i=s(n),[a,p]=o(`factories`,i),{data:m,error:g}=f(()=>r.factories(l(a)),[n,a?.id??``],`factories`),{runs:_,error:v}=we(),[y,b]=(0,w.useState)(``),[T,E]=(0,w.useState)(`all`),[re,ie]=(0,w.useState)(e);e!==re&&(ie(e),b(``),E(`all`));let ae=m?.bricks||[],oe=m?.loops||[],D=e===`active`?_&&K(_):m&&G(m.factories||[]),O=D||[],se=C(O),k=T===`all`?O:O.filter(e=>e.group===T),ce=y.trim(),A=x(k,ce),j=!!(t&&D&&!O.some(e=>e.name===t)),M=j?null:O.find(e=>e.name===t)||(e===`active`?null:O[0])||null,le={templates:m?.factories?.length,active:_?.length},N=R.find(([t])=>t===e)[1],ue=e===`active`?v:g;return(0,I.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,I.jsx)(ee,{className:`page-pick`,installs:i,value:a,onChange:p}),(0,I.jsx)(c,{error:ue,style:{margin:`0 0 var(--sp-3)`}}),(0,I.jsx)(xe,{problems:m?.problems}),(0,I.jsxs)(`div`,{className:`library`,children:[(0,I.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Factories sections`,children:[(0,I.jsxs)(`div`,{className:`lib-title`,children:[(0,I.jsx)(`h1`,{className:`h`,children:`Factories`}),(0,I.jsx)(`span`,{className:`dim`,children:`Work items, carried to a PR`})]}),(0,I.jsx)(`p`,{className:`panel-note lib-lede`,children:Ce[e]}),(0,I.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:R.map(([t,n])=>(0,I.jsxs)(w.Fragment,{children:[(0,I.jsxs)(`a`,{href:`#/factories/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,I.jsx)(`span`,{className:`mono dim`,children:le[t]??``})]}),e===t&&(0,I.jsx)(S,{label:B[t],total:O.length,cats:se,cat:T,onChange:E})]},t))})]}),(0,I.jsx)(te,{label:N,count:ce?`${A.length} of ${k.length}`:D?k.length:``,q:y,onQ:b,matched:A.length,inView:[e,t],current:M?M.title||M.name:void 0,sections:R.map(([t,n])=>({key:t,label:n,n:le[t],href:`#/factories/${t}`,on:e===t})),cats:se,cat:T,total:O.length,onCat:E,catLabel:B[e],children:D?O.length===0?(0,I.jsx)(h,{title:Se[e].title,children:Se[e].body}):(0,I.jsx)(ne,{rows:A,activeName:M?.name,hrefOf:t=>`#/factories/${e}/${ge(t.name)}`,pills:Q[e]}):ue?null:(0,I.jsx)(d,{})}),(0,I.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:j?(0,I.jsx)(h,{title:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/factories/${e}`,label:`All ${N.toLowerCase()} →`}}):M?e===`active`?(0,I.jsx)(be,{run:M,bricks:ae,loops:oe,from:a?u(a):null}):(0,I.jsx)(ye,{f:M,bricks:ae,loops:oe},M.name):e===`active`&&D&&O.length?(0,I.jsx)(X,{runs:A}):e===`active`&&D?(0,I.jsx)(h,{title:`What is a factory?`,docs:{href:`#/docs/factories`,label:`How factories work →`},children:`A factory runs stages, bricks and whole loops, until the work is an open PR.`}):null})]})]})}export{V as COLUMNS,Y as cardFacts,Te as default,G as factoryRows,q as fmtMs,K as runRows};
@@ -1 +1 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,R as r,V as i,_t as a,vt as o}from"./index-B_pTwZra.js";import{i as s,n as c,r as l}from"./Dashboard-DPAA96EI.js";import{n as u,r as d}from"./sections-CtFz7HFH.js";import{n as f,t as p}from"./motion-RlUl1osO.js";e();var m=t(),h=12,g=Array.from({length:7},(e,t)=>`var(--cat-${t})`),_=f[9];function v({segments:e,size:t=186,stroke:n=26,caption:r=`capabilities`}){let a=e.reduce((e,t)=>e+t.n,0);return(0,m.jsxs)(`div`,{className:`ring-box`,children:[(0,m.jsx)(i,{segments:e,size:t,stroke:n,label:r,sweepMs:_}),(0,m.jsxs)(`div`,{className:`ring-center`,children:[(0,m.jsx)(`div`,{className:`donut-c-num`,children:(0,m.jsx)(p,{value:a,duration:_})}),(0,m.jsx)(`div`,{className:`donut-c-cap`,children:r})]})]})}function y(e){if(e.length<2)return e.length?`M${e[0][0]},${e[0][1]}`:``;let t=`M${e[0][0]},${e[0][1]}`;for(let n=0;n<e.length-1;n++){let r=e[n-1]||e[n],i=e[n],a=e[n+1],o=e[n+2]||a,s=i[0]+(a[0]-r[0])/6,c=i[1]+(a[1]-r[1])/6,l=a[0]-(o[0]-i[0])/6,u=a[1]-(o[1]-i[1])/6;t+=` C${s},${c} ${l},${u} ${a[0]},${a[1]}`}return t}function b({data:e,height:t=156,accent:n}){if(!e.length)return null;let r=t,i=Math.max(...e.map(e=>e.v),1)+1,a=e.length>1?588/(e.length-1):588,o=e.map((e,t)=>[6+t*a,r-6-e.v/i*(r-14-6)]),s=y(o),c=o[o.length-1],l=o[0],u=`${s} L${c[0]},${r} L${l[0]},${r} Z`;return(0,m.jsxs)(`svg`,{viewBox:`0 0 600 ${r}`,preserveAspectRatio:`none`,style:{width:`100%`,height:t,display:`block`,overflow:`visible`},children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`b-grad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0`,style:{stopColor:n},stopOpacity:`.28`}),(0,m.jsx)(`stop`,{offset:`1`,style:{stopColor:n},stopOpacity:`0`})]})}),(0,m.jsx)(`path`,{d:u,fill:`url(#b-grad)`}),(0,m.jsx)(`path`,{d:s,fill:`none`,style:{stroke:n},strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),(0,m.jsx)(`circle`,{cx:c[0],cy:c[1],r:`3.5`,style:{fill:n},vectorEffect:`non-scaling-stroke`})]})}function x({label:e,value:t,sub:n,color:r,icon:i}){return(0,m.jsxs)(`div`,{className:`b-tile`,children:[(0,m.jsx)(`span`,{className:`b-tile-ic`,style:{background:`color-mix(in srgb, ${r} 18%, transparent)`,color:r},children:(0,m.jsx)(a,{name:i})}),(0,m.jsxs)(`div`,{className:`b-tile-body`,children:[(0,m.jsx)(`div`,{className:`b-tile-val`+(t===0?` zero`:``),children:t}),(0,m.jsx)(`div`,{className:`b-tile-label`,children:e})]}),(0,m.jsx)(`div`,{className:`b-tile-sub`,children:n})]})}function S({overview:e,sigil:t,jobs:i,lens:f,onAction:_}){let y=e.counts||{},S=f?.doctor?.state||`loading`,C=f?.doctor?.data?.groups||[],w=S===`ok`,T=C.filter(e=>e.problems.length===0).length,E=C.length,D=s(e,f?.tone),O=r(i,h),k=o(e.diff),A=d.filter(e=>(y[e]||0)>0).map((e,t)=>({key:e,label:u[e].label,n:y[e]||0,tone:`cat`+t%g.length,color:g[t%g.length]})),j=A.reduce((e,t)=>e+t.n,0),M=n(i||[],10),N=M.reduce((e,t)=>e+t.v,0);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`b-greet`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`eyebrow`,children:`your harness`}),(0,m.jsx)(`h2`,{className:`h b-h`,children:D}),(0,m.jsx)(c,{verdict:f?.verdict}),(0,m.jsx)(`p`,{className:`sub`,children:t||`A friendly read of every layer growing in your harness.`})]})}),(0,m.jsxs)(`div`,{className:`grid b-hero-grid mb-16`,children:[(0,m.jsxs)(`div`,{className:`card b-hero`,children:[(0,m.jsx)(`div`,{className:`b-hero-ring`,children:(0,m.jsx)(v,{segments:[{key:`pass`,label:`pass`,n:T,tone:`good`},{key:`attention`,label:`attention`,n:Math.max(E-T,0),tone:`warn`}],size:168,stroke:20,caption:`checks`})}),(0,m.jsxs)(`div`,{className:`b-hero-side`,children:[(0,m.jsx)(`h3`,{className:`b-hero-title`,children:w?`${T} of ${E} checks pass`:S===`failed`?`Doctor did not answer`:`Checking…`}),S===`failed`&&(0,m.jsxs)(`button`,{className:`btn ghost b-hero-retry`,onClick:()=>_(`doctor`),children:[(0,m.jsx)(a,{name:`doctor`}),`Retry doctor`]}),(0,m.jsxs)(`p`,{className:`sub`,children:[`One source, rendered into `,(0,m.jsx)(`code`,{children:e.target}),` and inherited by every repo on this machine.`]}),w&&(0,m.jsx)(`ul`,{className:`b-hero-checks`,children:C.map(e=>{let t=e.problems.length===0;return(0,m.jsxs)(`li`,{className:`b-hcheck ${t?`ok`:`bad`}`,title:t?`clean`:e.problems.join(`; `),children:[(0,m.jsx)(`span`,{className:`b-hcheck-mark`,children:t?`✓`:`!`}),(0,m.jsx)(`span`,{className:`b-hcheck-label`,children:e.label})]},e.label)})}),(0,m.jsxs)(`div`,{className:`b-chips`,children:[(0,m.jsxs)(`span`,{className:`b-chip`,children:[(0,m.jsx)(`b`,{className:`t-cap`,children:e.theme}),` voice`]}),(0,m.jsx)(`span`,{className:`b-chip`,children:(0,m.jsx)(`b`,{children:e.emit})}),(0,m.jsxs)(`span`,{className:`b-chip`,children:[`built `,(0,m.jsx)(`b`,{children:e.build_time||`unknown`})]})]})]})]}),(0,m.jsxs)(`div`,{className:`b-tiles`,children:[(0,m.jsx)(x,{label:`Agents`,value:y.agents??`—`,sub:`specialists`,color:g[0],icon:`layers`}),(0,m.jsx)(x,{label:`Skills`,value:y.skills??`—`,sub:`workflows`,color:g[1],icon:`skill`}),(0,m.jsx)(x,{label:`Dictates`,value:y.laws??`—`,sub:y.doctrines?`${y.doctrines.active}/${y.doctrines.total} packs · ${y.doctrines.rules} rules`:`all upheld`,color:g[2],icon:`law`}),(0,m.jsx)(x,{label:`Local edits`,value:k,sub:`files`,color:g[3],icon:`changes`})]})]}),(0,m.jsxs)(`div`,{className:`grid split-even mb-16`,children:[(0,m.jsxs)(`div`,{className:`card pad-lg b-mix-card`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Capability mix`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[j,` total`]})})]}),(0,m.jsxs)(`div`,{className:`b-mix`,children:[(0,m.jsx)(v,{segments:A,size:186,stroke:26}),(0,m.jsx)(`div`,{className:`b-legend`,children:A.map(e=>(0,m.jsxs)(`div`,{className:`b-leg-row`,children:[(0,m.jsx)(`span`,{className:`b-leg-dot`,style:{background:e.color}}),(0,m.jsx)(`span`,{className:`b-leg-name`,children:e.label}),(0,m.jsx)(`span`,{className:`b-leg-bar`,children:(0,m.jsx)(`i`,{style:{width:`${e.n/j*100}%`,background:e.color}})}),(0,m.jsx)(`span`,{className:`b-leg-val`,children:e.n})]},e.label))})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent runs`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`badge ok`,children:[(0,m.jsx)(`span`,{className:`dot`}),`job log`]})})]}),(0,m.jsxs)(`div`,{className:`b-stat-lead`,children:[(0,m.jsx)(`span`,{className:`b-stat-big`,children:(0,m.jsx)(p,{value:N})}),(0,m.jsxs)(`span`,{className:`b-stat-cap`,children:[`runs in the last 10 days`,w&&E>0&&` · ${T}/${E} checks pass now`]})]}),(0,m.jsx)(b,{data:M,accent:g[0],height:156})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent activity`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[`last `,O.length,` runs`]})})]}),(0,m.jsx)(l,{jobs:i,max:h,empty:(0,m.jsx)(`p`,{className:`sub`,children:`No runs yet. Trigger an action to populate this.`})})]})]})}export{S as default};
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,R as r,V as i,_t as a,vt as o}from"./index-BhT94v2q.js";import{i as s,n as c,r as l}from"./Dashboard-CWhh_GSc.js";import{n as u,r as d}from"./sections-CtFz7HFH.js";import{n as f,t as p}from"./motion-RlUl1osO.js";e();var m=t(),h=12,g=Array.from({length:7},(e,t)=>`var(--cat-${t})`),_=f[9];function v({segments:e,size:t=186,stroke:n=26,caption:r=`capabilities`}){let a=e.reduce((e,t)=>e+t.n,0);return(0,m.jsxs)(`div`,{className:`ring-box`,children:[(0,m.jsx)(i,{segments:e,size:t,stroke:n,label:r,sweepMs:_}),(0,m.jsxs)(`div`,{className:`ring-center`,children:[(0,m.jsx)(`div`,{className:`donut-c-num`,children:(0,m.jsx)(p,{value:a,duration:_})}),(0,m.jsx)(`div`,{className:`donut-c-cap`,children:r})]})]})}function y(e){if(e.length<2)return e.length?`M${e[0][0]},${e[0][1]}`:``;let t=`M${e[0][0]},${e[0][1]}`;for(let n=0;n<e.length-1;n++){let r=e[n-1]||e[n],i=e[n],a=e[n+1],o=e[n+2]||a,s=i[0]+(a[0]-r[0])/6,c=i[1]+(a[1]-r[1])/6,l=a[0]-(o[0]-i[0])/6,u=a[1]-(o[1]-i[1])/6;t+=` C${s},${c} ${l},${u} ${a[0]},${a[1]}`}return t}function b({data:e,height:t=156,accent:n}){if(!e.length)return null;let r=t,i=Math.max(...e.map(e=>e.v),1)+1,a=e.length>1?588/(e.length-1):588,o=e.map((e,t)=>[6+t*a,r-6-e.v/i*(r-14-6)]),s=y(o),c=o[o.length-1],l=o[0],u=`${s} L${c[0]},${r} L${l[0]},${r} Z`;return(0,m.jsxs)(`svg`,{viewBox:`0 0 600 ${r}`,preserveAspectRatio:`none`,style:{width:`100%`,height:t,display:`block`,overflow:`visible`},children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`b-grad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0`,style:{stopColor:n},stopOpacity:`.28`}),(0,m.jsx)(`stop`,{offset:`1`,style:{stopColor:n},stopOpacity:`0`})]})}),(0,m.jsx)(`path`,{d:u,fill:`url(#b-grad)`}),(0,m.jsx)(`path`,{d:s,fill:`none`,style:{stroke:n},strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),(0,m.jsx)(`circle`,{cx:c[0],cy:c[1],r:`3.5`,style:{fill:n},vectorEffect:`non-scaling-stroke`})]})}function x({label:e,value:t,sub:n,color:r,icon:i}){return(0,m.jsxs)(`div`,{className:`b-tile`,children:[(0,m.jsx)(`span`,{className:`b-tile-ic`,style:{background:`color-mix(in srgb, ${r} 18%, transparent)`,color:r},children:(0,m.jsx)(a,{name:i})}),(0,m.jsxs)(`div`,{className:`b-tile-body`,children:[(0,m.jsx)(`div`,{className:`b-tile-val`+(t===0?` zero`:``),children:t}),(0,m.jsx)(`div`,{className:`b-tile-label`,children:e})]}),(0,m.jsx)(`div`,{className:`b-tile-sub`,children:n})]})}function S({overview:e,sigil:t,jobs:i,lens:f,onAction:_}){let y=e.counts||{},S=f?.doctor?.state||`loading`,C=f?.doctor?.data?.groups||[],w=S===`ok`,T=C.filter(e=>e.problems.length===0).length,E=C.length,D=s(e,f?.tone),O=r(i,h),k=o(e.diff),A=d.filter(e=>(y[e]||0)>0).map((e,t)=>({key:e,label:u[e].label,n:y[e]||0,tone:`cat`+t%g.length,color:g[t%g.length]})),j=A.reduce((e,t)=>e+t.n,0),M=n(i||[],10),N=M.reduce((e,t)=>e+t.v,0);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`b-greet`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`eyebrow`,children:`your harness`}),(0,m.jsx)(`h2`,{className:`h b-h`,children:D}),(0,m.jsx)(c,{verdict:f?.verdict}),(0,m.jsx)(`p`,{className:`sub`,children:t||`A friendly read of every layer growing in your harness.`})]})}),(0,m.jsxs)(`div`,{className:`grid b-hero-grid mb-16`,children:[(0,m.jsxs)(`div`,{className:`card b-hero`,children:[(0,m.jsx)(`div`,{className:`b-hero-ring`,children:(0,m.jsx)(v,{segments:[{key:`pass`,label:`pass`,n:T,tone:`good`},{key:`attention`,label:`attention`,n:Math.max(E-T,0),tone:`warn`}],size:168,stroke:20,caption:`checks`})}),(0,m.jsxs)(`div`,{className:`b-hero-side`,children:[(0,m.jsx)(`h3`,{className:`b-hero-title`,children:w?`${T} of ${E} checks pass`:S===`failed`?`Doctor did not answer`:`Checking…`}),S===`failed`&&(0,m.jsxs)(`button`,{className:`btn ghost b-hero-retry`,onClick:()=>_(`doctor`),children:[(0,m.jsx)(a,{name:`doctor`}),`Retry doctor`]}),(0,m.jsxs)(`p`,{className:`sub`,children:[`One source, rendered into `,(0,m.jsx)(`code`,{children:e.target}),` and inherited by every repo on this machine.`]}),w&&(0,m.jsx)(`ul`,{className:`b-hero-checks`,children:C.map(e=>{let t=e.problems.length===0;return(0,m.jsxs)(`li`,{className:`b-hcheck ${t?`ok`:`bad`}`,title:t?`clean`:e.problems.join(`; `),children:[(0,m.jsx)(`span`,{className:`b-hcheck-mark`,children:t?`✓`:`!`}),(0,m.jsx)(`span`,{className:`b-hcheck-label`,children:e.label})]},e.label)})}),(0,m.jsxs)(`div`,{className:`b-chips`,children:[(0,m.jsxs)(`span`,{className:`b-chip`,children:[(0,m.jsx)(`b`,{className:`t-cap`,children:e.theme}),` voice`]}),(0,m.jsx)(`span`,{className:`b-chip`,children:(0,m.jsx)(`b`,{children:e.emit})}),(0,m.jsxs)(`span`,{className:`b-chip`,children:[`built `,(0,m.jsx)(`b`,{children:e.build_time||`unknown`})]})]})]})]}),(0,m.jsxs)(`div`,{className:`b-tiles`,children:[(0,m.jsx)(x,{label:`Agents`,value:y.agents??`—`,sub:`specialists`,color:g[0],icon:`layers`}),(0,m.jsx)(x,{label:`Skills`,value:y.skills??`—`,sub:`workflows`,color:g[1],icon:`skill`}),(0,m.jsx)(x,{label:`Dictates`,value:y.laws??`—`,sub:y.doctrines?`${y.doctrines.active}/${y.doctrines.total} packs · ${y.doctrines.rules} rules`:`all upheld`,color:g[2],icon:`law`}),(0,m.jsx)(x,{label:`Local edits`,value:k,sub:`files`,color:g[3],icon:`changes`})]})]}),(0,m.jsxs)(`div`,{className:`grid split-even mb-16`,children:[(0,m.jsxs)(`div`,{className:`card pad-lg b-mix-card`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Capability mix`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[j,` total`]})})]}),(0,m.jsxs)(`div`,{className:`b-mix`,children:[(0,m.jsx)(v,{segments:A,size:186,stroke:26}),(0,m.jsx)(`div`,{className:`b-legend`,children:A.map(e=>(0,m.jsxs)(`div`,{className:`b-leg-row`,children:[(0,m.jsx)(`span`,{className:`b-leg-dot`,style:{background:e.color}}),(0,m.jsx)(`span`,{className:`b-leg-name`,children:e.label}),(0,m.jsx)(`span`,{className:`b-leg-bar`,children:(0,m.jsx)(`i`,{style:{width:`${e.n/j*100}%`,background:e.color}})}),(0,m.jsx)(`span`,{className:`b-leg-val`,children:e.n})]},e.label))})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent runs`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`badge ok`,children:[(0,m.jsx)(`span`,{className:`dot`}),`job log`]})})]}),(0,m.jsxs)(`div`,{className:`b-stat-lead`,children:[(0,m.jsx)(`span`,{className:`b-stat-big`,children:(0,m.jsx)(p,{value:N})}),(0,m.jsxs)(`span`,{className:`b-stat-cap`,children:[`runs in the last 10 days`,w&&E>0&&` · ${T}/${E} checks pass now`]})]}),(0,m.jsx)(b,{data:M,accent:g[0],height:156})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent activity`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[`last `,O.length,` runs`]})})]}),(0,m.jsx)(l,{jobs:i,max:h,empty:(0,m.jsx)(`p`,{className:`sub`,children:`No runs yet. Trigger an action to populate this.`})})]})]})}export{S as default};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./Tabs-qY40S34V.js";import{B as i,G as a,H as o,J as s,K as c,Y as l,_t as u,at as d,et as f,ft as p,gt as m,ht as h,lt as g,nt as _,pt as v,rt as y,tt as b,vt as x,wt as S,yt as C}from"./index-BhT94v2q.js";import{t as w}from"./api-C8nMUU1i.js";import{t as T}from"./EmptyState-CY5Pm2xy.js";import{i as E,n as D,r as O,t as k}from"./controls-CK7qHA8H.js";var A=e(t(),1),j=n();function ee({host:e,theme:t,options:n,onAction:r,onClose:i,onNote:a}){let[o,s]=(0,A.useState)({path:``,host:e,theme:t,footprint:`lean`,posture:`peer`,mode:`direct`,trust:`balanced`}),[c,l]=(0,A.useState)(!1),[u,d]=(0,A.useState)(``),f=(e,t)=>s(n=>({...n,[e]:t})),m=async()=>{l(!0),a(``);try{let e=await w.pickFolder();e.path?(f(`path`,e.path),d(``)):e.error&&a(e.error)}catch(e){a(e.message)}finally{l(!1)}},h=async()=>{let e=o.path.trim();e?(d(``),a(``),await r?.(`deploy`,{host:o.host,path:e,theme:o.theme,footprint:o.footprint,posture:o.posture,mode:o.mode,trust:o.trust})&&i()):d(`Choose or type a folder to deploy into.`)};return(0,j.jsxs)(`div`,{className:`deploy-pop`,children:[(0,j.jsxs)(`div`,{className:`dp-row`,children:[(0,j.jsx)(`input`,{className:`inp dp-path`,type:`text`,placeholder:`/path/to/project, or click Browse…`,value:o.path,onChange:e=>{f(`path`,e.target.value),d(``)},onKeyDown:e=>e.key===`Enter`&&h(),"aria-label":`Folder to deploy into`,"aria-invalid":u?!0:void 0,"aria-describedby":u?`dp-path-err`:void 0}),(0,j.jsx)(`button`,{className:`btn ghost sm`,disabled:c,onClick:m,children:c?`Choosing…`:`Browse…`})]}),u?(0,j.jsx)(`p`,{id:`dp-path-err`,className:`tag bad note`,role:`alert`,children:u}):null,(0,j.jsxs)(`div`,{className:`dp-row`,children:[(0,j.jsxs)(`label`,{className:`dp-field`,children:[(0,j.jsx)(`span`,{children:`Deploy as`}),(0,j.jsx)(`select`,{className:`sel`,"aria-label":`host for the new install`,value:o.host,onChange:e=>f(`host`,e.target.value),children:g.map(e=>(0,j.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,j.jsx)(D,{value:o,options:n,onChange:f,who:`the new install`}),(0,j.jsx)(`button`,{className:`btn ghost sm`,onClick:h,children:`Deploy`}),(0,j.jsx)(`button`,{className:`btn ghost sm`,onClick:i,children:`Cancel`})]}),(0,j.jsxs)(`p`,{className:`sub dp-note`,children:[`Adds a per-repo harness (`,(0,j.jsx)(`code`,{children:p(o.host).deployAdds}),`) into the folder, non-destructively. It’s then tracked here even after you leave its directory.`]})]})}function M(){let{data:e,error:t,reload:n}=S(()=>w.excludes(),[]),[r,i]=(0,A.useState)(!1),[a,o]=(0,A.useState)([]),s=async(e,t)=>{i(!0);try{let n=await w.excludeMutate(e,t);o(n.messages||[])}catch(e){o(e.body?.messages||[e.message])}finally{i(!1),n()}};return t||!e?.installs?.length?null:(0,j.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,j.jsx)(`div`,{className:`card-head`,children:(0,j.jsx)(`h3`,{children:`Excluded folders`})}),(0,j.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,j.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,j.jsx)(`code`,{children:e.path}),(0,j.jsx)(`span`,{className:`mono muted`,children:e.hosts.map(e=>p(e).label).join(`, `)}),(0,j.jsx)(`button`,{className:`btn ghost sm`,disabled:r,"aria-label":`Stop excluding ${e.path}`,onClick:()=>s(`remove`,e.path),children:`Remove`})]},e.path)),(0,j.jsxs)(`button`,{className:`btn ghost sm`,disabled:r,onClick:async()=>{i(!0);try{let e=await w.pickFolder();e.path?await s(`add`,e.path):e.error&&o([e.error])}catch(e){o([e.message])}finally{i(!1)}},children:[(0,j.jsx)(u,{name:`folder`}),` Exclude a folder…`]}),a.map((e,t)=>(0,j.jsx)(`p`,{className:`sub`,children:e},t))]})}var N=`This project sees your machine-wide rules, profile and memory map, so what you taught one tool or repo applies here too.`,P=`About 1 500 tokens at every session start, growing with your rules. The hook budget is fixed at 9 000 characters, and the tier loads before this project's docs, so a large tier can push them down to a lazy listing.`,F=[`200k`,`1m`],I={"200k":`For a 200k-token model: each skill description is cut to 80 characters and the listing budget is 1.3% of the window, so every skill keeps its description.`,"1m":`For a 1M-token model: each skill description is cut to 120 characters, at the default budget of 1% of the window.`},L=[`claude`,`opencode`,`openclaude`];function te({targets:e,onReveal:t}){let n=e.flatMap(e=>e.servers);return(0,j.jsxs)(`div`,{className:`ip-block`,children:[(0,j.jsxs)(`span`,{className:`ip-label`,children:[`MCP servers `,(0,j.jsx)(`span`,{className:`mono dim`,children:n.length})]}),e.map(e=>(0,j.jsxs)(`div`,{className:`mcp-target`,children:[(0,j.jsxs)(`div`,{className:`mt-head`,children:[(0,j.jsx)(`code`,{title:e.path,children:e.label}),e.exists?(0,j.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,j.jsxs)(`div`,{className:`mcp-row`,children:[(0,j.jsx)(`span`,{className:`mono`,children:e.name}),(0,j.jsx)(`span`,{className:`tag ${e.state===`enabled`?`ok`:`warn`}`,children:e.state===`enabled`?`Enabled`:`Disabled`})]},e.name)):(0,j.jsx)(`p`,{className:`sub`,children:`None configured in this file.`}):(0,j.jsxs)(`p`,{className:`sub`,children:[`No MCP file yet (it would be `,(0,j.jsx)(`code`,{children:e.path}),`).`]})]},e.path))]})}var R=6;function z({leftovers:e}){let t=e?.kept||[],n=e?.stale||[],r=[...t,...n];return r.length?(0,j.jsxs)(`div`,{className:`ip-block ip-leftovers`,role:`group`,"aria-label":`Files a rebuild keeps`,children:[(0,j.jsxs)(`span`,{className:`ip-label`,children:[`Not Geneseed’s copy `,(0,j.jsx)(`span`,{className:`mono dim`,children:r.length})]}),t.length?(0,j.jsxs)(`p`,{className:`sub`,children:[t.length===1?`This file is yours`:`These files are yours`,` where Geneseed ships its own: you edited a shipped file, or had one under the same name. A rebuild keeps`,` `,t.length===1?`it`:`them`,`.`]}):null,n.length?(0,j.jsxs)(`p`,{className:`sub`,children:[n.length===1?`One retired skill was`:`${n.length} retired skills were`,` `,`left by an older version. A rebuild leaves `,n.length===1?`it`:`them`,` in place.`]}):null,(0,j.jsxs)(`ul`,{className:`ip-files`,children:[r.slice(0,R).map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(`code`,{title:e,children:e})},e)),r.length>R?(0,j.jsxs)(`li`,{className:`dim`,children:[`and `,r.length-R,` more`]}):null]}),(0,j.jsxs)(`p`,{className:`sub`,children:[(0,j.jsx)(`strong`,{children:`Force rebuild…`}),` below replaces them with Geneseed’s copies. Skills and agents under your own names, memory, notebook, rules and profile are never touched. To keep a file of yours for good, exclude that skill instead.`]})]}):null}function B({stranded:e,canAct:t,busy:n,onPrune:r}){let i=e?.keys||[];return i.length?(0,j.jsxs)(`div`,{className:`ip-block ip-leftovers`,role:`group`,"aria-label":`Stranded permission gates`,children:[(0,j.jsxs)(`span`,{className:`ip-label`,children:[`Stranded gates `,(0,j.jsx)(`span`,{className:`mono dim`,children:i.length})]}),(0,j.jsxs)(`p`,{className:`sub`,children:[`These `,(0,j.jsx)(`code`,{children:`permission.bash`}),` entries in `,(0,j.jsx)(`code`,{children:`opencode.json`}),` still ask, but the rule behind them is off in this install. Geneseed has no record that it wrote them, so a rebuild leaves them.`]}),(0,j.jsxs)(`ul`,{className:`ip-files`,children:[i.slice(0,R).map(e=>(0,j.jsx)(`li`,{children:(0,j.jsx)(`code`,{title:e,children:e})},e)),i.length>R?(0,j.jsxs)(`li`,{className:`dim`,children:[`and `,i.length-R,` more`]}):null]}),e.commented?(0,j.jsx)(`p`,{className:`sub`,children:`This file has comments, so Geneseed does not rewrite it: delete these entries by hand.`}):t?(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:n,onClick:r,children:`Remove stranded gates…`}):null,(0,j.jsx)(`p`,{className:`sub`,children:`An entry you changed yourself is kept.`})]}):null}var V={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`],absent:[`Not installed`,``]};function ne({inst:e,targets:t,choice:n,unchanged:r,options:i,onPick:o,canAct:s,busy:c,memory:l,onMemory:u,onApply:d,onToggleInstall:f,onRemove:m,onRevealMcp:h,onForce:g,onPrune:_,profileMatches:y,onSaveProfile:b}){let x=`${p(e.host).label} · ${e.scope}`,[S,C]=V[e.state]||V.absent,w=e.state===`active`,T=e.state===`absent`;return(0,j.jsxs)(`aside`,{className:`install-panel`,"aria-label":`${x} install`,children:[(0,j.jsx)(`span`,{className:`ip-eyebrow`,children:`Selected install`}),(0,j.jsxs)(`div`,{className:`ip-head`,children:[(0,j.jsx)(`h2`,{children:v(e)}),(0,j.jsx)(`span`,{className:`tag ${C}`,children:S})]}),(0,j.jsx)(`span`,{className:`ip-kind`,children:e.scope===`global`?`Global install`:`Per-project install · ${p(e.host).label}`}),(0,j.jsx)(`code`,{className:`ip-path`,children:e.path}),w&&y?.length?(0,j.jsxs)(`div`,{className:`row gap-8 wrap`,"aria-label":`Profile`,children:[(0,j.jsx)(`span`,{className:`ip-label`,children:`Profile`}),y.map(e=>(0,j.jsxs)(`span`,{className:`tag acc`,children:[`matches `,e]},e))]}):null,T?(0,j.jsxs)(`p`,{className:`sub`,children:[`Install Geneseed here as `,(0,j.jsx)(`strong`,{children:p(e.host).label}),`. Files are added non-destructively; deactivate or uninstall later.`]}):null,(w||T)&&s?(0,j.jsxs)(`div`,{className:`ip-picks`,children:[(0,j.jsx)(D,{value:n,options:i,onChange:o,who:x}),(0,j.jsxs)(`p`,{className:`sub`,children:[n.footprint===`lean`?`Lean footprint: terse rule lines and a pointer to the full file, about 40% smaller.`:`Full footprint: every rule’s complete text inline, the largest context.`,` `,`Every rule stays in force. `,(0,j.jsx)(`a`,{href:`#/docs/footprint`,children:`Learn more →`})]})]}):null,(w||T)&&s&&e.host===`claude`?(0,j.jsxs)(`div`,{className:`ip-block`,children:[(0,j.jsxs)(`label`,{className:`dp-field`,children:[(0,j.jsx)(`span`,{children:`Context window`}),(0,j.jsx)(O,{label:`context window for ${x}`,value:n.contextWindow||`200k`,options:F,onChange:e=>o(`contextWindow`,e)})]}),(0,j.jsx)(`p`,{className:`sub`,children:I[n.contextWindow||`200k`]})]}):null,w&&L.includes(e.host)?(0,j.jsx)(`div`,{className:`ip-block`,children:(0,j.jsxs)(`p`,{className:`sub`,"data-testid":`models-line`,children:[`Models: routing `,e.tiers||`off`,` · `,e.pins||0,` pin`,e.pins===1?``:`s`,` — `,(0,j.jsx)(`a`,{href:`#/models`,onClick:()=>a(`models`,e.id),children:`Open Models →`})]})}):null,(w||T)&&s&&e.scope!==`global`?(0,j.jsxs)(`div`,{className:`ip-block`,children:[(0,j.jsxs)(`label`,{className:`ip-switch`,children:[(0,j.jsx)(E,{on:!!n.sharedTier,label:`shared tier for ${x}`,onToggle:()=>o(`sharedTier`,!n.sharedTier)}),(0,j.jsx)(`span`,{children:`Read the machine-wide shared tier`})]}),(0,j.jsxs)(`p`,{className:`sub`,children:[(0,j.jsx)(`strong`,{children:`Benefit:`}),` `,N]}),(0,j.jsxs)(`p`,{className:`sub`,children:[(0,j.jsx)(`strong`,{children:`Cost:`}),` `,P]})]}):null,w?(0,j.jsx)(z,{leftovers:e.leftovers}):null,w?(0,j.jsx)(B,{stranded:e.strandedGates,canAct:s,busy:c,onPrune:_}):null,w&&t.length?(0,j.jsx)(te,{targets:t,onReveal:h}):null,w&&e.scope===`global`?(0,j.jsx)(M,{}):null,T?null:(0,j.jsxs)(`label`,{className:`ip-switch`,children:[(0,j.jsx)(E,{on:w,disabled:c,label:`activate ${x}`,onToggle:f}),(0,j.jsx)(`span`,{children:w?`Active: loads in every session`:`Disabled: files moved aside`})]}),(0,j.jsx)(`div`,{className:`ip-spacer`}),s?(0,j.jsxs)(`div`,{className:`ip-actions`,children:[T?(0,j.jsx)(`button`,{type:`button`,className:`btn`,onClick:d,children:`Install`}):w?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{type:`button`,className:`btn`,disabled:r,onClick:d,children:`Apply and rebuild`}),b?(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:b,children:`Save as profile…`}):null,(0,j.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,disabled:c,onClick:g,children:`Force rebuild…`})]}):null,T?null:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{children:`On uninstall, memory and notebook`}),(0,j.jsxs)(`select`,{className:`sel`,value:l,onChange:e=>u(e.target.value),children:[(0,j.jsx)(`option`,{value:`keep`,children:`keep in place`}),(0,j.jsx)(`option`,{value:`archive`,children:`archive aside`}),(0,j.jsx)(`option`,{value:`delete`,children:`delete too`})]})]}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,"aria-label":`remove ${x} from ${e.path}`,disabled:c,onClick:m,children:`Uninstall…`})]})]}):null]})}var re={secretsGate:`secrets`,doneGate:`done`,deletionGate:`deletion`,ownershipGate:`ownership`,externalGate:`external`,testNote:`test note`,ownBranchPass:`own-branch pass`},H=e=>re[e]||e,U=e=>p(e).label,W=e=>`${U(e.host)} · ${e.scope===`global`?`global`:e.path}`,G=e=>e.startsWith(`gates.`)||/-gate$|consent|test-note/.test(e);function ie(e){if(!e)return null;try{let t=JSON.parse(e)?.save;return t&&typeof t.host==`string`&&typeof t.path==`string`?t:null}catch{return null}}var ae=e=>`#/installs/profiles/${encodeURIComponent(JSON.stringify({save:{host:e.host,path:e.path}}))}`;function K(e){let t=(e.gatesOff||[]).map(H);return t.length?t.length===1&&t[0]===`ownership`?{text:`All on, except ownership`,warn:!1}:{text:`Off: ${t.join(`, `)}`,warn:!0}:{text:`All on`,warn:!1}}function q({p:e,canAct:t,onApply:n}){let r=(0,j.jsxs)(`div`,{className:`panel-head prof-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h3`,{children:e.name}),e.description?(0,j.jsx)(`p`,{className:`sub`,children:e.description}):null]}),(0,j.jsx)(`span`,{className:`tag ${e.source===`personal`?`acc`:``}`,children:e.source===`personal`?`Personal`:`Shipped`})]});if(e.error)return(0,j.jsxs)(`article`,{className:`panel prof-card`,"aria-label":`profile ${e.name}`,children:[r,(0,j.jsx)(`p`,{className:`tag bad note`,children:e.error}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`File`}),(0,j.jsx)(`code`,{className:`v`,children:e.file})]})]});let i=e.profile,a=K(e);return(0,j.jsxs)(`article`,{className:`panel prof-card`,"aria-label":`profile ${e.name}`,children:[r,(0,j.jsxs)(`div`,{className:`prof-kv`,children:[(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`Hosts`}),(0,j.jsx)(`span`,{className:`v row gap-8 wrap`,children:i.hosts.map(e=>(0,j.jsx)(`span`,{className:`tag human`,children:U(e)},e))})]}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`Settings`}),(0,j.jsx)(`span`,{className:`v`,children:[i.theme,i.footprint,i.posture,i.mode,i.trust].join(` · `)})]}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`Gates`}),(0,j.jsx)(`span`,{className:`v`,children:a.warn?(0,j.jsxs)(`span`,{className:`tag warn note`,children:[`! `,a.text]}):a.text})]}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`Followed by`}),(0,j.jsx)(`span`,{className:`v`,children:e.matches?.length?e.matches.map(W).join(`, `):`No install`})]}),(0,j.jsxs)(`div`,{className:`kv`,children:[(0,j.jsx)(`span`,{className:`k`,children:`File`}),(0,j.jsx)(`code`,{className:`v`,children:e.file})]})]}),t?(0,j.jsx)(`div`,{className:`row gap-8`,children:(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>n(e.name),children:`Apply…`})}):null]})}function J(e,t){if(!e.present)return`not on this machine`;let n=t===`global`?`global install`:`project install`;return e.state===`active`?`${n} · active`:e.state===`disabled`?`${n} · disabled`:t===`global`?`no global install yet`:`no install in this folder`}var Y=e=>e.present&&!e.refused;function oe(e){return e.present?e.refused?[{text:e.refused,tone:`warn`}]:e.state===`active`?e.changes.length?e.changes.map(e=>({text:`${e.name} ${e.from} → ${e.to}`,tone:G(e.name)?`warn`:``})):[{text:`Already matches — rebuild only`,tone:`dim`}]:[{text:`New install`,tone:`dim`}]:[{text:`Install ${U(e.host)}, then apply again`,tone:`dim`}]}function se({name:e,onAction:t,onClose:n}){let[r,i]=(0,A.useState)(`global`),[a,o]=(0,A.useState)(``),[s,c]=(0,A.useState)(``),[l,u]=(0,A.useState)({}),[d,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(``),g=r===`project`?s:null,_=JSON.stringify([e,r,g]),{data:v,error:x,loading:C}=S(()=>r===`project`&&!s?Promise.resolve(null):w.profiles(e,g).then(e=>({...e,askedFor:_})),[e,r,s]),T=!C&&v?.askedFor===_?v.preview:null,E=T?.rows||[],D=E.filter(e=>Y(e)&&!l[e.host]),O=T&&!T.error&&T.name===e&&T.scope===r&&(r===`global`||T.project),k=e=>{c(e.trim()),u({})},ee=async()=>{p(!0),h(``);try{let e=await w.pickFolder();e.path?(o(e.path),k(e.path)):e.error&&h(e.error)}catch(e){h(e.message)}finally{p(!1)}},M=async()=>{await t?.(`profile-apply`,{name:e,hosts:D.map(e=>e.host),...r===`project`?{project:T.project}:{}})&&n()},N=E.filter(e=>e.layering&&!l[e.host]&&Y(e));return(0,j.jsxs)(`section`,{className:`panel prof-dialog`,"aria-label":`Apply profile`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsxs)(`h2`,{children:[`Apply `,(0,j.jsx)(`span`,{className:`mono`,children:e})]}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Close`,onClick:n,children:`✕`})]}),(0,j.jsxs)(`fieldset`,{className:`prof-field`,children:[(0,j.jsx)(`legend`,{className:`ip-label`,children:`Where`}),(0,j.jsxs)(y,{"aria-label":`Where to apply`,children:[(0,j.jsx)(`button`,{type:`button`,className:r===`global`?`on`:``,"aria-pressed":r===`global`,onClick:()=>{i(`global`),u({})},children:`Global — every project on this machine`}),(0,j.jsx)(`button`,{type:`button`,className:r===`project`?`on`:``,"aria-pressed":r===`project`,onClick:()=>{i(`project`),u({})},children:`One project`})]}),r===`project`?(0,j.jsxs)(`div`,{className:`dp-row`,children:[(0,j.jsx)(`input`,{className:`inp dp-path`,type:`text`,placeholder:`/path/to/project, or click Browse…`,"aria-label":`Project folder`,value:a,onChange:e=>o(e.target.value),onBlur:()=>k(a),onKeyDown:e=>e.key===`Enter`&&k(a)}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:d,onClick:ee,children:d?`Choosing…`:`Browse…`})]}):null]}),m?(0,j.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:m}):null,(0,j.jsx)(f,{error:x}),T?.error?(0,j.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:T.error}):null,C?(0,j.jsx)(b,{}):null,O?(0,j.jsxs)(`div`,{className:`prof-hosts`,role:`group`,"aria-label":`Hosts`,children:[(0,j.jsx)(`span`,{className:`ip-label`,children:`Hosts — the profile’s hosts are ticked; a host this machine lacks is shown, not offered`}),E.map(e=>(0,j.jsxs)(`div`,{className:`prof-host${e.present?``:` missing`}`,children:[(0,j.jsxs)(`label`,{className:`row gap-8`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:Y(e)&&!l[e.host],disabled:!Y(e),onChange:()=>u(t=>({...t,[e.host]:!t[e.host]}))}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:U(e.host)}),` `,(0,j.jsx)(`span`,{className:`dim`,children:J(e,r)})]})]}),(0,j.jsx)(`div`,{className:`prof-changes`,children:oe(e).map(e=>(0,j.jsx)(`span`,{className:e.tone===`warn`?`warn-text`:e.tone,children:e.text},e.text))})]},e.host))]}):null,O&&r===`project`?(0,j.jsxs)(`p`,{className:`sub`,children:[`Project scope: the build writes into `,(0,j.jsx)(`code`,{children:T.project}),` for each ticked host. The profile’s `,(0,j.jsx)(`code`,{children:`sharedTier`}),` applies here only; a global apply ignores it.`]}):null,O&&N.length?N.map(e=>(0,j.jsxs)(`p`,{className:`tag warn note`,role:`note`,children:[`A global `,U(e.host),` install is active (`,e.layering.root,`): both root files load in this project. Global gates that still run there:`,` `,e.layering.gates.length?e.layering.gates.join(`, `):`none`,`.`,` `,(0,j.jsx)(`a`,{href:`#/docs/exclusions`,children:`Why →`})]},e.host)):null,(0,j.jsxs)(`div`,{className:`row gap-8`,children:[(0,j.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!O||!D.length,onClick:M,children:[`Apply to `,D.length,` `,D.length===1?`host`:`hosts`]}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:n,children:`Cancel`}),(0,j.jsx)(`span`,{className:`dim`,children:`Runs as a background job; its log reports each host.`})]})]})}function X({data:e,initial:t,onAction:n,onClose:r}){let i=e.installs||[],a=e=>`${e.host}|${e.path}`,o=t?i.find(e=>a(e)===a(t)):i[0],[s,c]=(0,A.useState)(o?a(o):``),[l,u]=(0,A.useState)(``),[d,f]=(0,A.useState)(`personal`),[p,m]=(0,A.useState)(!1),h=i.find(e=>a(e)===s),g=(h?.diff||[]).filter(e=>e.key!==`hosts`);return(0,j.jsxs)(`section`,{className:`panel prof-dialog`,"aria-label":`Save as profile`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{children:`Save an install as profile`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Close`,onClick:r,children:`✕`})]}),i.length?(0,j.jsxs)(j.Fragment,{children:[t&&!o?(0,j.jsx)(`p`,{className:`tag warn note`,role:`status`,children:`The install you chose is no longer active here. Pick one below.`}):null,(0,j.jsxs)(`div`,{className:`dp-row`,children:[(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{children:`From install`}),(0,j.jsxs)(`select`,{className:`sel`,value:s,onChange:e=>c(e.target.value),children:[s?null:(0,j.jsx)(`option`,{value:``,children:`Pick an install…`}),i.map(e=>(0,j.jsx)(`option`,{value:a(e),children:W(e)},a(e)))]})]}),(0,j.jsxs)(`label`,{className:`field`,children:[(0,j.jsx)(`span`,{children:`Name`}),(0,j.jsx)(`input`,{className:`inp`,type:`text`,value:l,placeholder:`my-profile`,onChange:e=>u(e.target.value)})]})]}),(0,j.jsxs)(`fieldset`,{className:`prof-field`,children:[(0,j.jsx)(`legend`,{className:`ip-label`,children:`Save to`}),(0,j.jsxs)(`label`,{className:`row gap-8`,children:[(0,j.jsx)(`input`,{type:`radio`,name:`prof-dest`,checked:d===`personal`,onChange:()=>f(`personal`)}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`Personal`}),` — `,(0,j.jsx)(`code`,{children:e.personalDir}),`, beside your memory and rules. Survives updates, never shipped.`]})]}),(0,j.jsxs)(`label`,{className:`row gap-8`,children:[(0,j.jsx)(`input`,{type:`radio`,name:`prof-dest`,checked:d===`shipped`,disabled:!e.shippedWritable,onChange:()=>f(`shipped`)}),(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`strong`,{children:`Shipped`}),` — `,(0,j.jsx)(`code`,{children:`profiles/`}),` in this clone, for everyone. Commit and open a pull request to share it.`,e.shippedWritable?``:` Disabled: this copy is not a git clone.`]})]}),(0,j.jsxs)(`label`,{className:`row gap-8`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:p,onChange:()=>m(e=>!e)}),(0,j.jsx)(`span`,{children:`Replace a profile of this name in the same place`})]})]}),(0,j.jsxs)(`div`,{className:`prof-changes`,"aria-label":`Differs from ${e.base}`,children:[(0,j.jsxs)(`span`,{children:[`Differs from `,(0,j.jsx)(`strong`,{children:e.base}),g.length?``:`: nothing`]}),g.map(t=>(0,j.jsx)(`span`,{className:G(t.key)?`warn-text`:``,children:G(t.key)?`! gate ${H(t.key.slice(6))}: ${t.now} (${e.base}: ${t.base})`:`${t.key} ${t.now} (${e.base}: ${t.base})`},t.key))]}),(0,j.jsxs)(`div`,{className:`row gap-8`,children:[(0,j.jsx)(`button`,{type:`button`,className:`btn`,disabled:!h||!l.trim(),onClick:async()=>{await n?.(`profile-save`,{name:l.trim(),from:{host:h.host,path:h.path},...d===`shipped`?{shipped:!0}:{},...p?{force:!0}:{}})&&r()},children:`Save profile`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:r,children:`Cancel`})]})]}):(0,j.jsx)(T,{children:`No active install to save. Install one on the Hosts tab first.`})]})}function ce({onAction:e,dataRev:t,item:n}){let r=ie(n),{data:i,error:a,loading:o,reload:s}=S(()=>w.profiles(),[t],`profiles`),[c,l]=(0,A.useState)(r?{kind:`save`,from:r}:null);if(a)return(0,j.jsx)(f,{error:a,onRetry:s});if(o&&!i)return(0,j.jsx)(b,{});let u=i?.profiles||[],d=!!e;return(0,j.jsxs)(`div`,{className:`profiles`,children:[(0,j.jsxs)(`div`,{className:`inst-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{children:`Profiles`}),(0,j.jsx)(`p`,{className:`dim`,children:`A profile is a named set of build settings and the hosts it targets. Apply it globally or to one project.`})]}),d?(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>l({kind:`save`,from:null}),children:`Save an install as profile…`}):null]}),u.length?(0,j.jsx)(`div`,{className:`prof-grid`,children:u.map(e=>(0,j.jsx)(q,{p:e,canAct:d,onApply:e=>l({kind:`apply`,name:e})},`${e.source}:${e.name}`))}):(0,j.jsx)(T,{children:`No profile yet. Save an install as one to start.`}),c?.kind===`apply`?(0,j.jsx)(se,{name:c.name,onAction:e,onClose:()=>l(null)},c.name):null,c?.kind===`save`&&i?(0,j.jsx)(X,{data:i,initial:c.from,onAction:e,onClose:()=>l(null)}):null]})}function le({dataRev:e}){let{data:t,error:n,reload:r}=S(()=>w.migratePreview(),[e]);return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`preview-h`,children:[(0,j.jsx)(`div`,{className:`panel-head`,children:(0,j.jsx)(`h2`,{id:`preview-h`,children:`Next rebuild`})}),n?(0,j.jsx)(f,{error:n,onRetry:r}):t?(0,j.jsxs)(j.Fragment,{children:[t.folds.length?(0,j.jsx)(`ul`,{className:`preview-list`,children:t.folds.map(e=>(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`b`,{className:`mono`,children:e.host}),` `,e.summary||`nothing to fold`,e.failed.map(e=>(0,j.jsxs)(`div`,{className:`t-warn`,children:[`The fold would stop at `,e]},e))]},e.host))}):(0,j.jsx)(`p`,{className:`dim`,children:`No global install to fold.`}),t.orphans.length?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`h3`,{children:`Orphans`}),(0,j.jsx)(`p`,{className:`dim`,children:`No manifest owns these. An earlier build may have written them, or they may be yours. Nothing moves them: if one is not yours, move it by hand.`}),(0,j.jsx)(`ul`,{className:`preview-list mono`,children:t.orphans.map(e=>(0,j.jsx)(`li`,{children:e},e))})]}):null]}):(0,j.jsx)(b,{})]})}var ue=(e,t)=>`${e} ${t}`,de=[`claude`,`bob`,`openclaude`],Z={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},Q=/[\\/]\.claude[\\/]worktrees[\\/]/,fe=e=>e.scope===`project`&&Q.test(e.path);function pe(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?x(e.drift):0,a=e.diffable?C(e.drift):0;return r+(i?` · ${i} edited`:``)+(a?` · ${a} kept`:``)}function me({inst:e,fleet:t,version:n,onEdits:r}){if(t===void 0)return(0,j.jsx)(`span`,{className:`dim`,children:`…`});if(!t)return(0,j.jsx)(`span`,{className:`dim`,children:`—`});let a=t.drift?.stale??0,o=t.diffable?x(t.drift):0,s=t.diffable?C(t.drift):0;return(0,j.jsxs)(`div`,{className:`sync-cell`,children:[t.diffable&&a+o+s>0?(0,j.jsx)(i,{label:`Sync with source of ${v(e)}`,parts:[{key:`stale`,label:`behind source`,n:a,tone:`warn`},{key:`edited`,label:`local edits`,n:o,tone:`bad`},...s?[{key:`kept`,label:`kept edits`,n:s,tone:`muted`}]:[]]}):null,(0,j.jsx)(`span`,{className:`dim`,children:pe(t,n)}),t.diffable?null:(0,j.jsxs)(`span`,{className:`dim`,title:`Local edits are only checked for global installs`,children:[` `,`· not checkable`]}),o||s?(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`a`,{href:`#/installs/edits`,onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e)},children:`Local edits`})]}):null]})}function he({rows:e,project:t,currentId:n,onPick:r,label:i,fleet:a,onEdits:o,onDefault:s,busyKey:c}){let l=e=>a===void 0?void 0:a?.installs?.find(t=>t.id===e.id)||null;return(0,j.jsx)(`div`,{className:`tbl-scroll`,children:(0,j.jsxs)(`table`,{className:`tbl hosts-tbl`,"aria-label":i,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{children:[(0,j.jsx)(`th`,{scope:`col`,children:t?`Project`:`Host`}),(0,j.jsx)(`th`,{scope:`col`,children:`State`}),(0,j.jsx)(`th`,{scope:`col`,children:`Sync with source`}),(0,j.jsx)(`th`,{scope:`col`,children:(0,j.jsx)(`span`,{className:`sr-only`,children:`Selected`})})]})}),(0,j.jsx)(`tbody`,{children:e.map(e=>{let[i,u]=Z[e.state]||[`Not installed`,``],d=n===e.id,f=e.state===`absent`;return(0,j.jsxs)(`tr`,{className:`pickable${d?` on`:``}${f?` quiet`:``}`,onClick:()=>r(e.id),children:[(0,j.jsxs)(`td`,{children:[(0,j.jsx)(`button`,{type:`button`,className:`row-pick`,"aria-pressed":d,title:e.path,onClick:()=>r(e.id),children:v(e)}),(0,j.jsx)(`div`,{className:`mono path-cell`,title:e.path,children:t?p(e.host).label:e.path})]}),(0,j.jsxs)(`td`,{children:[(0,j.jsx)(`span`,{className:`tag ${u}`,children:i}),e.default?(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`span`,{className:`tag`,title:`A page that names no install reads this one, and pickers start on it`,children:`Default`})]}):e.state===`active`&&s?(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Make ${v(e)} the default install`,disabled:c===e.id,onClick:t=>{t.stopPropagation(),s(e)},children:`Make default`})]}):null,fe(e)?(0,j.jsxs)(j.Fragment,{children:[` `,(0,j.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,j.jsx)(`td`,{children:(0,j.jsx)(me,{inst:e,fleet:l(e),version:a?.version,onEdits:o})}),(0,j.jsx)(`td`,{className:`pick-mark`,children:d?`Editing ›`:``})]},e.id)})})]})})}function ge({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,j.jsxs)(`details`,{className:`panel voice-ref`,children:[(0,j.jsxs)(`summary`,{children:[(0,j.jsx)(`span`,{className:`vr-title`,children:`Voices`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e.length,` to choose from, set per install`]})]}),(0,j.jsx)(`div`,{className:`vr-list`,children:n.map(e=>(0,j.jsxs)(`div`,{className:`voice-row${e.name===t?` current`:``}`,children:[(0,j.jsx)(`span`,{className:`vr-name`,children:e.name}),(0,j.jsx)(`span`,{className:`vr-desc`,children:e.tagline?`“${e.tagline}”`:e.blurb})]},e.name))})]})}function _e({setup:e,overview:t}){if(!e)return null;let n=e.installed_fp&&e.installed_fp===e.source_fp;return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`checkout-h`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`checkout-h`,children:`This checkout`}),(0,j.jsx)(`span`,{className:`mono ${n?`t-good`:`t-warn`}`,children:n?`in sync`:e.version_verdict})]}),(0,j.jsxs)(`dl`,{className:`kv-grid`,children:[(0,j.jsx)(`dt`,{children:`Source`}),(0,j.jsx)(`dd`,{className:`mono`,children:e.root}),(0,j.jsx)(`dt`,{children:`Version`}),(0,j.jsx)(`dd`,{className:`mono`,children:t?.version||`unknown`}),(0,j.jsx)(`dt`,{children:`Fingerprint`}),(0,j.jsx)(`dd`,{className:`mono`,children:e.source_fp})]})]})}function $({onAction:e,themes:t=[],currentTheme:n,overview:r,setup:i,dataRev:o,onMutated:s}){let l=d(),{data:h,error:g,reload:_}=S(()=>w.installs(),[o]),{data:y,error:x,reload:C}=S(()=>w.mcp(),[o]),{data:E,error:D}=S(()=>w.fleet(),[o]),{data:O}=S(()=>w.profiles(),[o],`profiles`),M=D?null:E??void 0,[N,P]=(0,A.useState)(null),[F,I]=(0,A.useState)(``),[L,te]=(0,A.useState)({}),[R,z]=(0,A.useState)(!1),[B,V]=(0,A.useState)(!1),[re,H]=(0,A.useState)({id:``,value:`keep`}),U=e=>re.id===e?.id?re.value:`keep`,[W,G]=(0,A.useState)(()=>c(`hosts`)),ie=(0,A.useMemo)(()=>{let e={};for(let t of y?.targets||[]){let n=ue(t.host||`opencode`,t.root);(e[n]||(e[n]=[])).push(t)}return e},[y]);if(g||x)return(0,j.jsx)(f,{error:g||x,onRetry:()=>{_(),C()}});if(!h||!y)return(0,j.jsx)(b,{});let K={active:0,disabled:1,absent:2},q=[...h.installs].sort((e,t)=>(e.scope===`global`?0:1)-(t.scope===`global`?0:1)||(K[e.state]??3)-(K[t.state]??3)),J=q.find(e=>e.id===W)||q.find(e=>e.default)||q.find(e=>e.state===`active`)||q[0],Y=e=>{let t=L[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`,sharedTier:t.sharedTier??!!e.sharedTier,contextWindow:t.contextWindow||e.contextWindow||`200k`,tiers:t.tiers||e.tiers||`off`}},oe=(e,t,n)=>te(r=>({...r,[e.id]:{...r[e.id],[t]:n}})),se=e=>{let t=Y(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`)&&(e.scope===`global`||t.sharedTier===!!e.sharedTier)&&t.contextWindow===(e.contextWindow||`200k`)&&t.tiers===(e.tiers||`off`)},X={theme:t.map(e=>e.name),footprint:k,posture:h.postures||[],mode:h.modes||[],trust:h.trusts||[]},ce=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o,sharedTier:s,contextWindow:c,tiers:u}=Y(t),d=p(t.host).label,f=`${r} footprint, ${i} posture, ${a} mode, ${o} loop trust${u===`auto`||t.tiers===`auto`?`, model tiers ${u}`:``}`,m=t.state===`absent`?`Install Geneseed for ${d} into ${t.path} with the “${n}” voice (${f})? Files are added non-destructively (your own config is left untouched); deactivate or uninstall later.`:`Rebuild this ${d} install (voice “${n}”, ${f})? It rebuilds in place, non-destructive.`;await l(m,{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,contextWindow:c,tiers:u,...t.scope===`global`?{}:{sharedTier:s}})},Z=(t,n)=>{let{theme:r,footprint:i,posture:a,mode:o,trust:s,sharedTier:c,contextWindow:l,tiers:u}=Y(t);e?.(`install`,{host:t.host,scope:t.scope,path:t.path,theme:r,footprint:i,posture:a,mode:o,trust:s,contextWindow:l,tiers:u,...t.scope===`global`?{}:{sharedTier:c},...n})},Q=e=>e.slice(0,8).join(`, `)+(e.length>8?`, and ${e.length-8} more`:``),fe=async e=>{let t=e.leftovers?.kept||[],n=e.leftovers?.stale||[],r=t.length||n.length?(t.length?`Replace with Geneseed’s copy: ${Q(t)}. Your version of each is overwritten. `:``)+(n.length?`Remove: ${Q(n)}. `:``)+`Nothing else is touched.`:`No file of yours is recorded here. A forced rebuild overwrites any file it finds at a path Geneseed ships, and removes retired leftovers. Skills and agents under your own names, memory, notebook, rules and profile are never touched.`;await l(r,{title:`Force rebuild this install?`,confirmLabel:`Force rebuild`,tone:`danger`})&&Z(e,{force:!0})},pe=async e=>{let t=e.strandedGates?.keys||[];await l(`Remove from opencode.json: ${Q(t)}. Their rule is off in this install. An entry you changed yourself is kept; nothing else is touched.`,{title:`Remove stranded gates?`,confirmLabel:`Remove and rebuild`})&&Z(e,{pruneGates:!0})},me=async e=>{if(e.state!==`active`||await l(`Deactivate this install? Files are moved aside, not deleted; reactivate any time.`,{title:`Deactivate this install?`,confirmLabel:`Deactivate`})){I(e.id),P(null);try{let t=await w.installToggle(e.host,e.path,e.state===`active`?`deactivate`:`activate`);if(!t.ok){let e=Array.isArray(t.failed)?t.failed.join(`, `):``;P({text:t.error||e&&`unrestored: ${e}`||`action failed`,tone:`bad`});return}s?.()}catch(e){P({text:e.message,tone:`bad`})}finally{I(``)}}},$=async e=>{I(e.id),P(null);try{await w.setDefaultInstall(e.host,e.path),s?.()}catch(e){P({text:e.message,tone:`bad`})}finally{I(``)}},ve=(e,t)=>{let n=e.path.includes(`\\`)&&!e.path.includes(`/`)?`\\`:`/`,r=e.path.replace(/[\\/]+$/,``);return`${e.scope===`project`&&de.includes(e.host)?`${r}${n}.${e.host}`:r}${n}${t}`},ye=async e=>{let t=U(e),n=e.scope===`project`?` and de-lists it`:`; the row stays, marked “not installed”`,r=t===`delete`?`, and permanently deletes ${ve(e,`memory`)} and ${ve(e,`notebook`)}`:t===`archive`?`; memory and notebook are archived aside`:`; memory and notebook stay in place`;if(await l(`Uninstall ${p(e.host).label} · ${e.scope}? It deletes ${m(e.host,e.scope)}${n}${r}. This can’t be undone.`,{title:e.scope===`project`?`Remove this install?`:`Remove the global install?`,confirmLabel:t===`delete`?`Remove and delete memory`:`Remove`,tone:`danger`})){I(e.id),P(null);try{let n=await w.installRemove(e.host,e.path,t);if(!n.ok){P({text:n.error||`remove failed`,tone:`bad`});return}H({id:``,value:`keep`}),n.kept?.length&&P({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`}),s?.()}catch(e){P({text:e.message,tone:`bad`})}finally{I(``)}}},be=async e=>{P(null);try{let t=await w.mcpReveal(e.path);P({text:`Opening ${t.dir}. If no window appeared, open that folder by hand.`,tone:``})}catch(e){P({text:e.message,tone:`bad`})}},xe=async()=>{let t=q.filter(e=>e.state===`active`).map(e=>`${v(e)} · ${e.scope}`);await l(`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`)},Se=q.find(e=>e.default)?.host||q.find(e=>e.state===`active`)?.host||q[0]?.host||`opencode`,Ce=q.filter(e=>e.scope===`global`),we=q.filter(e=>e.scope!==`global`),Te=e=>{G(e)},Ee=e=>{a(`edits`,e.id),window.location.hash=`#/installs/edits`};return(0,j.jsxs)(`div`,{className:`hosts`,children:[(0,j.jsxs)(`div`,{className:`hosts-main`,children:[(0,j.jsxs)(`div`,{className:`toolbar`,children:[(0,j.jsxs)(`span`,{className:`dim`,children:[q.filter(e=>e.state!==`absent`).length,` installed.`]}),(0,j.jsxs)(`div`,{className:`row gap-8`,children:[(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,"aria-expanded":B,onClick:()=>V(e=>!e),children:`Preview next rebuild`}),e?(0,j.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:xe,children:[(0,j.jsx)(u,{name:`refresh`}),` Rebuild all`]}):null]})]}),B?(0,j.jsx)(le,{dataRev:o}):null,N?.tone===`bad`?(0,j.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:N.text}):N?(0,j.jsx)(`p`,{className:`tag ${N.tone===`ok`?`ok `:``}note`,role:`status`,children:N.text}):null,(0,j.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-global`,children:[(0,j.jsx)(`div`,{className:`inst-head`,children:(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{id:`inst-global`,children:`Global installs`}),(0,j.jsx)(`p`,{className:`dim`,children:`One per tool. Loaded in every folder, except excluded ones.`})]})}),(0,j.jsx)(he,{rows:Ce,currentId:J?.id,onPick:Te,label:`Global installs`,fleet:M,onEdits:Ee,onDefault:e?$:void 0,busyKey:F})]}),(0,j.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-project`,children:[(0,j.jsxs)(`div`,{className:`inst-head`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{id:`inst-project`,children:`Per-project installs`}),(0,j.jsx)(`p`,{className:`dim`,children:`A repo with its own install. Inside it, only that install loads.`})]}),e?(0,j.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>z(e=>!e),children:[(0,j.jsx)(u,{name:`folder`}),` Deploy to a repo…`]}):null]}),R?(0,j.jsx)(`div`,{className:`inst-deploy`,children:(0,j.jsx)(ee,{host:Se,theme:n||`neutral`,options:X,onAction:e,onClose:()=>z(!1),onNote:e=>P(e?{text:e,tone:`bad`}:null)})}):null,we.length?(0,j.jsx)(he,{rows:we,project:!0,currentId:J?.id,onPick:Te,label:`Per-project installs`,fleet:M,onEdits:Ee,onDefault:e?$:void 0,busyKey:F}):(0,j.jsx)(T,{children:`No repo has its own install yet. Deploy one to give a project its own rules and voice.`})]}),(0,j.jsx)(_e,{setup:i,overview:r}),(0,j.jsx)(ge,{themes:t,current:r?.theme})]}),J?(0,j.jsx)(ne,{inst:J,targets:ie[ue(J.host,J.path)]||[],choice:Y(J),unchanged:se(J),options:X,onPick:(e,t)=>oe(J,e,t),canAct:!!e,busy:F===J.id,memory:U(J),onMemory:e=>H({id:J.id,value:e}),onApply:()=>ce(J),onToggleInstall:()=>me(J),onRemove:()=>ye(J),onRevealMcp:be,onForce:()=>fe(J),onPrune:()=>pe(J),profileMatches:O?.installs?.find(e=>e.host===J.host&&e.path===J.path)?.matches,onSaveProfile:e?()=>{window.location.hash=ae(J)}:void 0},J.id):null]})}function ve(e){return e.startsWith(`@@`)||e.startsWith(`+++`)||e.startsWith(`---`)?`hunk`:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`}var ye=300;function be(e){let t=l(e.dataRev),[n,r]=s(`edits`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,j.jsx)(b,{}):(0,j.jsx)(xe,{install:n,...e},n?.id||``)]})}function xe({install:e,onMutated:t,onAction:n,dataRev:r,overview:i}){let a=d(),{data:o,error:s,reload:c}=S(()=>w.diff(h(e)),[r]),[l,p]=(0,A.useState)(!1),[m,g]=(0,A.useState)(``),[_,v]=(0,A.useState)(()=>new Set),[y,x]=(0,A.useState)(()=>new Set),[C,E]=(0,A.useState)(null);if(o&&o!==C){E(o),v(new Set);let e=o.files.reduce((e,t)=>e+t.diff.length,0);x(new Set(e<=ye?o.files.map(e=>e.rel):[]))}let D=e=>v(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),O=()=>v(e=>e.size===M.length?new Set:new Set(M.map(e=>e.rel))),k=()=>n?.(`export`),ee=async()=>{let n=[..._],r=n.filter(e=>o.files.find(t=>t.rel===e)?.status===`added`),i=r.length?`Restoring will DELETE ${r.length} deployed-only file(s):\n${r.join(`
2
+ `)}\n\n`:``;if(await a(`${i}Discard local edits and restore ${n.length} file(s) from source?`,{title:`Restore from source?`,confirmLabel:`Restore`,tone:`danger`})){p(!0);try{let r=await w.restore(n,h(e)),i=r.errors.length?` · ${r.errors.length} error(s): ${r.errors.join(`; `)}`:``;g(`Restored ${r.restored.length}, archived ${r.deleted.length}${i}`),await c(),t?.()}catch(e){g(e.message)}finally{p(!1)}}};if(s)return(0,j.jsx)(f,{error:s,onRetry:c});if(!o)return(0,j.jsx)(b,{});if(!o.deployed)return(0,j.jsx)(T,{title:`Nothing installed here`,children:`Nothing to compare.`});if(!o.diffable)return(0,j.jsx)(T,{title:`No local-edit check for this install`,docs:{href:`#/installs/hosts`,label:`See every install in Hosts`},children:`Local edits are only checked for global installs. Pick a global install above.`});let M=o.files.filter(e=>e.status!==`linked`&&e.status!==`stale`),N=o.files.filter(e=>e.status===`linked`),P=o.files.filter(e=>e.status===`stale`),F=M.filter(e=>e.status===`edited`).length,I=M.filter(e=>e.status===`added`).length,L=M.filter(e=>e.status===`missing`).length,te=e=>x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`h`,children:`Local edits`}),o.target?(0,j.jsxs)(`p`,{className:`sub`,children:[`Comparing `,(0,j.jsx)(`code`,{children:o.target}),o.theme?` (${o.theme} voice)`:``,` with source`,` `,i?.version||`unknown`,`.`]}):null,F>0?(0,j.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.`}):I+L>0?(0,j.jsx)(`p`,{className:`sub`,children:`These files differ from the source: added in the install, or missing from it.`}):null]}),(0,j.jsxs)(`div`,{className:`row gap-10`,children:[(0,j.jsxs)(`button`,{className:`btn ghost danger-line`,disabled:l||_.size===0,onClick:ee,children:[`Restore`,_.size?` (${_.size})`:``]}),(0,j.jsxs)(`button`,{className:`btn`,disabled:l,onClick:k,children:[(0,j.jsx)(u,{name:`download`}),`Export improvements`]})]})]}),m?(0,j.jsx)(`p`,{className:`sub mb-14`,children:m}):null,N.length?(0,j.jsxs)(`p`,{className:`sub dim mb-14`,title:N.map(e=>e.rel).join(`
3
+ `),children:[N.length,` linked — yours, left alone`]}):null,M.length===0&&P.length===0?(0,j.jsx)(T,{title:`In sync`,children:`This install matches its source.`}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`row between mb-14`,children:[(0,j.jsxs)(`div`,{className:`row gap-10`,children:[(0,j.jsxs)(`span`,{className:`badge warn`,children:[(0,j.jsx)(`span`,{className:`dot`}),F,` edited`]}),(0,j.jsxs)(`span`,{className:`badge`,children:[(0,j.jsx)(`span`,{className:`dot`}),I,` added`]}),L>0&&(0,j.jsxs)(`span`,{className:`badge bad`,children:[(0,j.jsx)(`span`,{className:`dot`}),L,` missing`]}),P.length>0&&(0,j.jsxs)(`span`,{className:`badge`,children:[(0,j.jsx)(`span`,{className:`dot`}),P.length,` behind`]})]}),(0,j.jsxs)(`div`,{className:`row gap-10`,children:[(0,j.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>x(new Set(o.files.map(e=>e.rel))),children:`Expand all`}),(0,j.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>x(new Set),children:`Collapse all`}),M.length?(0,j.jsxs)(`label`,{className:`row gap-8 dim sel-all`,children:[(0,j.jsx)(`input`,{type:`checkbox`,checked:_.size===M.length,onChange:O}),`Select all`]}):null]})]}),(0,j.jsx)(`div`,{className:`stack gap-12`,children:M.map(e=>R(e,!0))}),P.length?(0,j.jsxs)(`div`,{className:`stack gap-12 diff-behind`,children:[(0,j.jsx)(`h3`,{children:`Behind source`}),(0,j.jsxs)(`div`,{className:`row between`,children:[(0,j.jsx)(`p`,{className:`sub`,children:`This install is built from older source. Rebuild to bring these files in sync.`}),(0,j.jsx)(`button`,{className:`btn ghost`,disabled:l,onClick:()=>n?.(`build-all`),"aria-label":`Rebuild all installs`,children:`Rebuild`})]}),P.map(e=>R(e,!1))]}):null]})]});function R(e,t){let n=y.has(e.rel),r=e.status===`edited`&&e.diverged===!1,i=r&&e.rel.endsWith(`.md`),a=e.status===`stale`||e.status===`added`?``:e.status===`missing`?`bad`:i?`warn`:r?``:`warn`,o=r?`source unchanged`:e.status===`stale`?`behind source`:e.status;return(0,j.jsxs)(`div`,{className:`card diff-file${n?` open`:``}`,children:[(0,j.jsxs)(`div`,{className:`diff-head`,children:[t?(0,j.jsx)(`input`,{type:`checkbox`,className:`chk`,checked:_.has(e.rel),onChange:()=>D(e.rel),onClick:e=>e.stopPropagation(),"aria-label":`Select ${e.rel}`}):null,(0,j.jsx)(`span`,{className:`fname`,children:e.rel}),(0,j.jsxs)(`span`,{className:`badge ${a}`,children:[(0,j.jsx)(`span`,{className:`dot`}),o]}),(0,j.jsxs)(`span`,{className:`dim mono diff-lines`,children:[e.diff.length,` lines`]}),(0,j.jsx)(`button`,{className:`iconbtn`,onClick:()=>te(e.rel),"aria-label":n?`Collapse ${e.rel}`:`Expand ${e.rel}`,"aria-expanded":n,children:(0,j.jsx)(u,{name:`chevron`})})]}),n&&(0,j.jsx)(`div`,{className:`diff-body`,children:e.diff.map((e,t)=>(0,j.jsx)(`div`,{className:`diff-line ${ve(e)}`,children:e},t))})]},e.rel)}}function Se({group:e,i:t}){let n=e.problems.length===0,[r,i]=(0,A.useState)(!n);return(0,j.jsxs)(`div`,{className:`card check rise ${n?``:`bad`} ${r?`open`:``}`,style:{"--i":t*.6},children:[(0,j.jsxs)(`button`,{className:`check-head`,onClick:()=>i(e=>!e),disabled:n,"aria-expanded":n?void 0:r,children:[(0,j.jsx)(`span`,{className:`feed-dot ${n?`ok`:`bad`}`}),(0,j.jsx)(`h3`,{children:e.label}),(0,j.jsxs)(`span`,{className:`badge ${n?`ok`:`bad`}`,children:[(0,j.jsx)(`span`,{className:`dot`}),n?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`]}),!n&&(0,j.jsx)(u,{name:`chevron`,className:`chev glyph`})]}),!n&&r&&(0,j.jsx)(`div`,{className:`check-body`,children:e.problems.map(e=>(0,j.jsxs)(`div`,{className:`problem`,children:[(0,j.jsx)(`span`,{className:`x`,children:`✕`}),(0,j.jsx)(`span`,{children:e})]},e))})]})}function Ce({dataRev:e}){let t=l(e),[n,r]=s(`doctor`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(_,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,j.jsx)(b,{}):(0,j.jsx)(we,{install:n,dataRev:e},n?.id||``)]})}function we({install:e,dataRev:t}){let n=(0,A.useRef)(!1),{data:r,error:i,reload:a,setData:o}=S(()=>{let t=n.current;return n.current=!1,w.doctor(t,h(e))},[t]),s=()=>{n.current=!0,o(null),a()};if(i)return(0,j.jsx)(f,{error:i,onRetry:a});let c=r?r.groups.filter(e=>e.problems.length):[],l=r?r.groups.filter(e=>!e.problems.length):[];return(0,j.jsxs)(`div`,{className:`page-fill`,children:[(0,j.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h2`,{className:`h`,children:`Doctor`}),(0,j.jsx)(`p`,{className:`sub`,children:`Builds this install’s voice in a sandbox and validates the result: token resolution, link integrity, and parity.`})]}),(0,j.jsxs)(`button`,{className:`btn`,onClick:s,disabled:!r,children:[(0,j.jsx)(u,{name:`refresh`}),r?`Run doctor`:`Running…`]})]}),r?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`div`,{className:`card pad-md mb-16 doc-summary`,children:(0,j.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,j.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,j.jsxs)(`span`,{className:`dim mono`,children:[`validated `,r.themes.length,` voice`,r.themes.length===1?``:`s`]}),r.checked_at?(0,j.jsxs)(`span`,{className:`dim mono`,title:r.checked_at,children:[`checked `,r.checked_at.slice(11)]}):null,r.themes.map(e=>(0,j.jsx)(`span`,{className:`badge cap`,children:e},e))]}),r.ok?(0,j.jsxs)(`span`,{className:`badge ok`,children:[(0,j.jsx)(`span`,{className:`dot`}),`all clean`]}):(0,j.jsxs)(`span`,{className:`badge bad`,children:[(0,j.jsx)(`span`,{className:`dot`}),r.problems.length,` problem`,r.problems.length===1?``:`s`]})]})}),(0,j.jsxs)(`div`,{className:`stack gap-12`,children:[c.map((e,t)=>(0,j.jsx)(Se,{group:e,i:t},e.label)),l.length?(0,j.jsxs)(`details`,{className:`check-fold`,children:[(0,j.jsxs)(`summary`,{children:[l.length,` clean check`,l.length===1?``:`s`]}),(0,j.jsx)(`div`,{className:`stack gap-12`,children:l.map((e,t)=>(0,j.jsx)(Se,{group:e,i:c.length+t},e.label))})]}):null]})]}):(0,j.jsx)(b,{label:`Running every check (builds this install’s voice in a sandbox)…`})]})}function Te({tab:e=`hosts`,item:t,overview:n,setup:i,themes:a,onAction:s,onMutated:c,dataRev:l}){return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(o,{title:`Installs`,sub:`Where the harness lives on this machine, and how each copy is built.`}),(0,j.jsx)(r,{page:`installs`,current:e,label:`Installs`}),e===`hosts`&&(0,j.jsx)($,{onAction:s,themes:a,currentTheme:n?.theme,overview:n,setup:i,dataRev:l,onMutated:c}),e===`profiles`&&(0,j.jsx)(ce,{onAction:s,dataRev:l,item:t}),e===`edits`&&(0,j.jsx)(be,{onMutated:c,onAction:s,dataRev:l,overview:n}),e===`doctor`&&(0,j.jsx)(Ce,{dataRev:l})]})}export{Te as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{At as r,C as i,Ct as a,Mt as o,Ot as s,St as c,jt as l,wt as u}from"./index-B_pTwZra.js";import{n as d}from"./sections-CtFz7HFH.js";import{A as f,B as p,C as m,E as h,F as g,H as _,K as v,M as y,N as b,O as x,P as S,U as C,_ as w,a as T,d as ee,f as E,g as D,h as O,i as k,j as A,l as j,n as M,p as N,r as P,u as F,v as I,w as L,x as R}from"./motion-RlUl1osO.js";import{t as z}from"./api-CZ-x0iWG.js";import{n as B}from"./Dashboard-DPAA96EI.js";function V(e){return L((e.iterationDuration+e._loopDelay)*e.iterationCount-e._loopDelay)||1e-11}function H(e,t,n,r,i,a){let o=f(e.duration)&&e.duration<=1e-11?n-C:n;t.composition&&I(t,o,1,1,v.AUTO);let s=r?new F(r,e,t,o,!1,i,a):new O(e,t,o);return t.composition&&s.init(!0),m(t,s),h(t,e=>{let n=e._offset+e._delay+e.duration;n>t.iterationDuration&&(t.iterationDuration=n)}),t.duration=V(t),t}var U=0,W=class extends O{constructor(e={}){super(e,null,0),++U,this.id=b(e.id)?U:e.id,this.duration=0,this.labels={};let t=e.defaults,n=p.defaults;this.defaults=t?S(t,n):n,this.composition=R(e.composition,!0),this.onRender=e.onRender||n.onRender;let r=R(e.playbackEase,n.playbackEase);this._ease=r?E(r):null,this.iterationDuration=0}add(e,t,n){let r=A(t),i=A(e);if(r||i){if(this._hasChildren=!0,r){let r=t,i=p.editor&&p.editor.addTimelineChild,a=n&&n.type===`Stagger`&&p.editor,s=x(n)?n:null;if(s||a){let t=N(e),a=this.duration,c=this.iterationDuration,l=r.id,u=0,d=t.length,f=i?i(e,r,this.id,n,d):null,m=s||p.editor.resolveStagger(n.defaultValue);t.forEach(e=>{let n={...f||r};this.duration=a,this.iterationDuration=c,b(l)||(n.id=l+`-`+u);let i=o(this,m(e,u,t,null,this));H(n,this,i,e,u,t),u++})}else{let t=i?i(e,r,this.id,n):r,a=n&&n.type?n.defaultValue:n;H(t,this,o(this,a),e)}}else H(e,this,o(this,t));return this.composition&&this.init(!0),this}}sync(e,t){if(b(e)||e&&b(e.pause))return this;e.pause();let n=+(e.effect?e.effect.getTiming().duration:e.duration);!b(e)&&!b(e.persist)&&(e.persist=!0);let r=p.editor,i=r&&r.addTimelineChild;r&&r.addTimelineSync&&(t=r.addTimelineSync(e,t,this.id),r.addTimelineChild=null);let a=this.add(e,{currentTime:[0,n],duration:n,delay:0,ease:`linear`,playbackEase:`linear`},t);return r&&(r.addTimelineChild=i),a}set(e,t,n){return b(t)?this:(t.duration=C,t.composition=_.replace,this.add(e,t,n))}call(e,t){return b(e)||e&&!x(e)?this:(p.editor&&p.editor.addTimelineCall&&(t=p.editor.addTimelineCall(e,t,this.id)),this.add({duration:0,delay:0,onComplete:()=>e(this)},t))}label(e,t){return b(e)||e&&!y(e)||(p.editor&&p.editor.addTimelineLabel&&(t=p.editor.addTimelineLabel(e,t,this.id)),this.labels[e]=o(this,t)),this}remove(e,t){return D(N(e),this,t),this}stretch(e){let t=this.duration;if(t===g(e))return this;let n=e/t,r=this.labels;h(this,e=>e.stretch(e.duration*n));for(let e in r)r[e]*=n;return super.stretch(e)}refresh(){return h(this,e=>{e.refresh&&e.refresh()}),this}revert(){return super.revert(),h(this,e=>e.revert,!0),w(this)}then(e){return super.then(e)}},G=e=>p.editor?p.editor.addTimeline(e):new W(e).init(),K=e(t(),1),q=n(),J=.62,te=(e,t)=>String(e).length*t*J;function Y(e,t){let n=0;for(let t of e){if(t.t===``||t.t==null)continue;let e=te(t.t,t.size)/2;n=Math.max(n,Math.hypot(e,t.dy-t.size*.75),Math.hypot(e,t.dy+t.size*.25))}return Math.ceil(n+t)}function X(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=r/a,s=i/a,c=e.x+o*e.r,l=e.y+s*e.r,u=t.x-o*t.r,d=t.y-s*t.r,f=n*a,p=e=>e.toFixed(1);return`M${p(c)} ${p(l)} C${p(c+o*a*.3-s*f)} ${p(l+s*a*.3+o*f)} ${p(u-o*a*.3-s*f)} ${p(d-s*a*.3+o*f)} ${p(u)} ${p(d)}`}var Z=!1,Q=!1,ne=M[8]+M[7];function $({hash:e,label:t,part:n,children:r}){return(0,q.jsx)(`g`,{className:`cm-node`,"data-cm":n,role:`button`,tabIndex:0,"aria-label":t,onClick:()=>s(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),s(e))},children:r})}function re({overview:e,dataRev:t}){let{data:n}=u(()=>z.catalog(`laws`),[t],`catalog:laws`),o=n?.items??null,s=n?.nouns?.ontology||`Ethos`,c=n?.nouns?.laws||`Dictates`,d=n?.nouns?.doctrines||`Doctrines`,f=(0,K.useRef)(null),p=(0,K.useRef)(!0),m=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=f.current;if(!e||Z||!k())return;Z=!0;let t=t=>[...e.querySelectorAll(t)],n=t(`[data-cm="hub"]`),i=t(`[data-cm="sat"]`),a=t(`[data-cm="gov"]`),o=t(`.cm-edge-gov`),s=t(`.cm-note, .cm-govern-label`),c=r(t(`.cm-edge`));j([...n,...i,...a],{opacity:0,scale:.7}),j([...o,...s],{opacity:0}),j(c,{draw:`0 0`});let u=G({autoplay:!1,defaults:{ease:P}}).add(n,{opacity:1,scale:1,duration:M[7]},0).add(c,{draw:`0 1`,duration:M[7],delay:l(M[1])},M[3]).add(i,{opacity:1,scale:1,duration:M[7],delay:l(M[1])},M[5]).add(o,{opacity:1,duration:M[6],delay:l(M[1])},M[7]).add(a,{opacity:1,scale:1,duration:M[7],delay:l(M[1])},M[8]).add(s,{opacity:1,duration:M[6]},M[8]);p.current=!1;let d=()=>u.complete(),h=()=>{u.play(),d=T(u,ne),p.current=!0,m.current?.()};if(typeof IntersectionObserver>`u`)return h(),()=>d();let g=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(g.disconnect(),h())},{threshold:.33});return g.observe(e),()=>{g.disconnect(),p.current=!0,d()}},[]);let h=e?.counts||{},g=a(h),_=[];for(let e of(o||[]).filter(e=>e.tier===`doctrine`)){let t=_.find(t=>t.id===e.pack);t||_.push(t={id:e.pack,n:0}),t.n+=1}let v=e?.footprint===`lean`?`lean — first line only`:`full text inlined`,y={x:330,y:165,r:Y([{t:`Constitution`,size:17,dy:-12},{t:`${g} rules`,size:10,dy:8},{t:v,size:8.5,dy:24}],12)},b={x:126,y:95,r:Y([{t:s,size:12.5,dy:-7},{t:`${h.ontology??0} sections`,size:10,dy:10}],11)},x={x:560,y:78,r:Y([{t:c,size:12.5,dy:-6},{t:`${h.laws??0}`,size:13,dy:12}],11)},S={x:560,y:252,r:Y([{t:d,size:12.5,dy:-6},{t:`${h.doctrines?.rules??0}`,size:13,dy:12}],11)},C=(e,t,n,r)=>({x:e,y:t,label:n,count:r,r:Y([{t:n,size:10.5,dy:-2},{t:`${r}`,size:9,dy:10}],9)}),w=[{...C(812,52,`Skills`,h.skills??0),hash:`#/skills`,from:x},{...C(820,126,`Agents`,h.agents??0),hash:`#/agents`,from:x},{...C(816,232,`Memory`,h.memory??0),hash:`#/personal/memory`,from:S},{...C(812,300,`Wiki`,h.wiki??0),hash:`#/section/wiki`,from:S}],E={rx:122,ry:68,from:212,to:112},D=_.map((e,t)=>{let n=(_.length===1?(E.from+E.to)/2:E.from+(E.to-E.from)*t/(_.length-1))*Math.PI/180;return{...e,x:S.x+E.rx*Math.cos(n),y:S.y+E.ry*Math.sin(n),r:Y([{t:e.id,size:7.5,dy:-2},{t:`${e.on}`,size:7.5,dy:8}],4)}}),O=D.length;return(0,K.useLayoutEffect)(()=>{let e=f.current;if(!e||!O||Q||!k())return;Q=!0;let t=[...e.querySelectorAll(`.cm-mini > g`)];j(t,{opacity:0,scale:.5});let n=()=>j(t,{opacity:1,scale:1}),r=()=>{m.current=null;let e=ee(t,{opacity:1,scale:1,duration:M[7],delay:l(M[1],{start:M[7]}),ease:P});n=T(e,M[7]+M[1]*O+M[7])};return p.current?r():m.current=r,()=>{m.current=null,n()}},[O]),(0,q.jsxs)(`svg`,{ref:f,className:`cmap`,viewBox:`0 0 940 350`,role:`group`,"aria-label":`The constitution map`,children:[(0,q.jsx)(`path`,{d:X(y,b,.05),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(y,x,-.07),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(y,S,.07),className:`cm-edge`}),w.map(e=>(0,q.jsx)(`path`,{d:X(e.from,e,.03),className:`cm-edge-gov`},`e-${e.label}`)),(0,q.jsxs)($,{hash:`#/laws`,part:`hub`,label:`Constitution: ${g} rules`,children:[(0,q.jsx)(`circle`,{cx:y.x,cy:y.y,r:y.r,className:`cm-hub-disc`}),(0,q.jsx)(`text`,{x:y.x,y:y.y-12,textAnchor:`middle`,className:`cm-hub-name`,children:`Constitution`}),(0,q.jsxs)(`text`,{x:y.x,y:y.y+8,textAnchor:`middle`,className:`cm-hub-num`,children:[g,` rules`]}),(0,q.jsx)(`text`,{x:y.x,y:y.y+24,textAnchor:`middle`,className:`cm-note`,children:v})]}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${s}: ${h.ontology??0} sections`,children:[(0,q.jsx)(`circle`,{cx:b.x,cy:b.y,r:b.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:b.x,y:b.y-7,textAnchor:`middle`,className:`cm-sat-name`,children:s}),(0,q.jsxs)(`text`,{x:b.x,y:b.y+10,textAnchor:`middle`,className:`cm-sat-num`,children:[h.ontology??0,` sections`]})]}),(0,q.jsx)(`text`,{x:b.x,y:b.y+b.r+16,textAnchor:`middle`,className:`cm-note`,children:`how it thinks, not a rule`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${c}: ${h.laws??0}, never broken`,children:[(0,q.jsx)(`circle`,{cx:x.x,cy:x.y,r:x.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:x.x,y:x.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:c}),(0,q.jsx)(`text`,{x:x.x,y:x.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:h.laws??0})]}),(0,q.jsx)(`text`,{x:x.x,y:x.y+x.r+16,textAnchor:`middle`,className:`cm-note`,children:`never broken`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${d}: ${h.doctrines?.rules??0} rules`,children:[(0,q.jsx)(`circle`,{cx:S.x,cy:S.y,r:S.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:S.x,y:S.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:d}),(0,q.jsx)(`text`,{x:S.x,y:S.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:h.doctrines?.rules??0})]}),(0,q.jsx)(`text`,{x:S.x+22,y:S.y+S.r+20,className:`cm-note`,children:h.doctrines?`${h.doctrines.active}/${h.doctrines.total} packs built in`:`packs chosen at build`}),(0,q.jsx)(`g`,{className:`cm-mini`,children:D.map(e=>(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-pack-disc`,style:{stroke:i(e.id)}}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-pack-id`,children:e.id}),(0,q.jsx)(`text`,{x:e.x,y:e.y+8,textAnchor:`middle`,style:{fill:i(e.id)},children:e.n})]},e.id))}),(0,q.jsx)(`text`,{x:866,y:16,textAnchor:`middle`,className:`cm-govern-label`,children:`GOVERNS THE HARNESS`}),w.map(e=>(0,q.jsxs)($,{hash:e.hash,part:`gov`,label:`${e.label}: ${e.count}`,children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-gov-disc`}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-gov-name`,children:e.label}),(0,q.jsx)(`text`,{x:e.x,y:e.y+10,textAnchor:`middle`,className:`cm-gov-num`,children:e.count})]},e.label)),(0,q.jsx)(`text`,{x:b.x,y:228,textAnchor:`middle`,className:`cm-note`,children:`tap any node to open its ledger`})]})}function ie({counts:e}){let t=[{label:d.skills.label,n:e.skills??0,hash:`#/skills`},{label:`Rules`,n:a(e),hash:`#/laws`},{label:d.agents.label,n:e.agents??0,hash:`#/agents`},{label:d.memory.label,n:e.memory??0,hash:`#/personal/memory`},{label:d.notebook.label,n:e.notebook??0,hash:`#/personal/notebook`},{label:d.wiki.label,n:e.wiki??0,hash:`#/section/wiki`},{label:d.config.label,n:e.config??0,hash:`#/section/config`}],n=Math.max(...t.map(e=>e.n),1);return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Growth rings`}),(0,q.jsx)(`span`,{className:`tick right`,children:`by section`})]}),t.map(e=>(0,q.jsxs)(`button`,{className:`jr-ring`,onClick:()=>s(e.hash),children:[(0,q.jsx)(`span`,{className:`jr-ring-label`,children:e.label}),(0,q.jsx)(`span`,{className:`jr-ring-track`,children:(0,q.jsx)(`span`,{className:`jr-ring-fill`,style:{width:`${e.n/n*100}%`}})}),(0,q.jsx)(`span`,{className:`jr-ring-num`,children:e.n})]},e.label))]})}function ae({recent:e,buildEpoch:t}){let n=e?.items||[],r=e?.skipped||[];return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Freshly grown`}),(0,q.jsx)(`span`,{className:`tick right`,children:`newest`})]}),e?n.length===0?(0,q.jsx)(`p`,{className:`sub`,children:`Nothing here carries a date yet.`}):n.slice(0,5).map(e=>(0,q.jsxs)(`button`,{className:`jr-fresh`,onClick:()=>s(`#/item/${e.type}/${encodeURIComponent(e.name)}`),children:[(0,q.jsx)(`span`,{className:`jr-fresh-kind`,children:e.section}),(0,q.jsx)(`span`,{className:`jr-fresh-name`,children:e.title}),(0,q.jsx)(`span`,{className:`jr-fresh-when`,children:c(e.mtime)})]},`${e.section}:${e.name}`)):(0,q.jsx)(`p`,{className:`sub`,children:`Reading the shelves…`}),r.length>0&&(0,q.jsxs)(`p`,{className:`sub jr-skipped`,children:[`Not dated: `,r.join(`, `),` — too many files to stat on every load.`]}),(0,q.jsxs)(`p`,{className:`jr-care`,children:[t?`Last built ✓ ${c(t)}`:`Never built here`,` ·`,` `,(0,q.jsx)(`button`,{className:`jr-go`,onClick:()=>s(`#/activity`),children:`log →`})]})]})}function oe({overview:e,recent:t,lens:n,dataRev:r}){let i=e?.counts||{};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`jr-head`,children:(0,q.jsx)(B,{verdict:n?.verdict})}),(0,q.jsxs)(`div`,{className:`jr-row2`,children:[(0,q.jsx)(ie,{counts:i}),(0,q.jsx)(ae,{recent:t,buildEpoch:e?.build_epoch})]}),(0,q.jsxs)(`div`,{className:`card pad-lg jr-map`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`The Constitution — and the harness it governs`}),(0,q.jsx)(`button`,{className:`jr-go right`,onClick:()=>s(`#/laws`),children:`open →`})]}),(0,q.jsx)(re,{overview:e,dataRev:r})]})]})}export{oe as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{At as r,C as i,Ct as a,Mt as o,Ot as s,St as c,jt as l,wt as u}from"./index-BhT94v2q.js";import{n as d}from"./sections-CtFz7HFH.js";import{A as f,B as p,C as m,E as h,F as g,H as _,K as v,M as y,N as b,O as x,P as S,U as C,_ as w,a as T,d as ee,f as E,g as D,h as O,i as k,j as A,l as j,n as M,p as N,r as P,u as F,v as I,w as L,x as R}from"./motion-RlUl1osO.js";import{t as z}from"./api-C8nMUU1i.js";import{n as B}from"./Dashboard-CWhh_GSc.js";function V(e){return L((e.iterationDuration+e._loopDelay)*e.iterationCount-e._loopDelay)||1e-11}function H(e,t,n,r,i,a){let o=f(e.duration)&&e.duration<=1e-11?n-C:n;t.composition&&I(t,o,1,1,v.AUTO);let s=r?new F(r,e,t,o,!1,i,a):new O(e,t,o);return t.composition&&s.init(!0),m(t,s),h(t,e=>{let n=e._offset+e._delay+e.duration;n>t.iterationDuration&&(t.iterationDuration=n)}),t.duration=V(t),t}var U=0,W=class extends O{constructor(e={}){super(e,null,0),++U,this.id=b(e.id)?U:e.id,this.duration=0,this.labels={};let t=e.defaults,n=p.defaults;this.defaults=t?S(t,n):n,this.composition=R(e.composition,!0),this.onRender=e.onRender||n.onRender;let r=R(e.playbackEase,n.playbackEase);this._ease=r?E(r):null,this.iterationDuration=0}add(e,t,n){let r=A(t),i=A(e);if(r||i){if(this._hasChildren=!0,r){let r=t,i=p.editor&&p.editor.addTimelineChild,a=n&&n.type===`Stagger`&&p.editor,s=x(n)?n:null;if(s||a){let t=N(e),a=this.duration,c=this.iterationDuration,l=r.id,u=0,d=t.length,f=i?i(e,r,this.id,n,d):null,m=s||p.editor.resolveStagger(n.defaultValue);t.forEach(e=>{let n={...f||r};this.duration=a,this.iterationDuration=c,b(l)||(n.id=l+`-`+u);let i=o(this,m(e,u,t,null,this));H(n,this,i,e,u,t),u++})}else{let t=i?i(e,r,this.id,n):r,a=n&&n.type?n.defaultValue:n;H(t,this,o(this,a),e)}}else H(e,this,o(this,t));return this.composition&&this.init(!0),this}}sync(e,t){if(b(e)||e&&b(e.pause))return this;e.pause();let n=+(e.effect?e.effect.getTiming().duration:e.duration);!b(e)&&!b(e.persist)&&(e.persist=!0);let r=p.editor,i=r&&r.addTimelineChild;r&&r.addTimelineSync&&(t=r.addTimelineSync(e,t,this.id),r.addTimelineChild=null);let a=this.add(e,{currentTime:[0,n],duration:n,delay:0,ease:`linear`,playbackEase:`linear`},t);return r&&(r.addTimelineChild=i),a}set(e,t,n){return b(t)?this:(t.duration=C,t.composition=_.replace,this.add(e,t,n))}call(e,t){return b(e)||e&&!x(e)?this:(p.editor&&p.editor.addTimelineCall&&(t=p.editor.addTimelineCall(e,t,this.id)),this.add({duration:0,delay:0,onComplete:()=>e(this)},t))}label(e,t){return b(e)||e&&!y(e)||(p.editor&&p.editor.addTimelineLabel&&(t=p.editor.addTimelineLabel(e,t,this.id)),this.labels[e]=o(this,t)),this}remove(e,t){return D(N(e),this,t),this}stretch(e){let t=this.duration;if(t===g(e))return this;let n=e/t,r=this.labels;h(this,e=>e.stretch(e.duration*n));for(let e in r)r[e]*=n;return super.stretch(e)}refresh(){return h(this,e=>{e.refresh&&e.refresh()}),this}revert(){return super.revert(),h(this,e=>e.revert,!0),w(this)}then(e){return super.then(e)}},G=e=>p.editor?p.editor.addTimeline(e):new W(e).init(),K=e(t(),1),q=n(),J=.62,te=(e,t)=>String(e).length*t*J;function Y(e,t){let n=0;for(let t of e){if(t.t===``||t.t==null)continue;let e=te(t.t,t.size)/2;n=Math.max(n,Math.hypot(e,t.dy-t.size*.75),Math.hypot(e,t.dy+t.size*.25))}return Math.ceil(n+t)}function X(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=r/a,s=i/a,c=e.x+o*e.r,l=e.y+s*e.r,u=t.x-o*t.r,d=t.y-s*t.r,f=n*a,p=e=>e.toFixed(1);return`M${p(c)} ${p(l)} C${p(c+o*a*.3-s*f)} ${p(l+s*a*.3+o*f)} ${p(u-o*a*.3-s*f)} ${p(d-s*a*.3+o*f)} ${p(u)} ${p(d)}`}var Z=!1,Q=!1,ne=M[8]+M[7];function $({hash:e,label:t,part:n,children:r}){return(0,q.jsx)(`g`,{className:`cm-node`,"data-cm":n,role:`button`,tabIndex:0,"aria-label":t,onClick:()=>s(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),s(e))},children:r})}function re({overview:e,dataRev:t}){let{data:n}=u(()=>z.catalog(`laws`),[t],`catalog:laws`),o=n?.items??null,s=n?.nouns?.ontology||`Ethos`,c=n?.nouns?.laws||`Dictates`,d=n?.nouns?.doctrines||`Doctrines`,f=(0,K.useRef)(null),p=(0,K.useRef)(!0),m=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=f.current;if(!e||Z||!k())return;Z=!0;let t=t=>[...e.querySelectorAll(t)],n=t(`[data-cm="hub"]`),i=t(`[data-cm="sat"]`),a=t(`[data-cm="gov"]`),o=t(`.cm-edge-gov`),s=t(`.cm-note, .cm-govern-label`),c=r(t(`.cm-edge`));j([...n,...i,...a],{opacity:0,scale:.7}),j([...o,...s],{opacity:0}),j(c,{draw:`0 0`});let u=G({autoplay:!1,defaults:{ease:P}}).add(n,{opacity:1,scale:1,duration:M[7]},0).add(c,{draw:`0 1`,duration:M[7],delay:l(M[1])},M[3]).add(i,{opacity:1,scale:1,duration:M[7],delay:l(M[1])},M[5]).add(o,{opacity:1,duration:M[6],delay:l(M[1])},M[7]).add(a,{opacity:1,scale:1,duration:M[7],delay:l(M[1])},M[8]).add(s,{opacity:1,duration:M[6]},M[8]);p.current=!1;let d=()=>u.complete(),h=()=>{u.play(),d=T(u,ne),p.current=!0,m.current?.()};if(typeof IntersectionObserver>`u`)return h(),()=>d();let g=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(g.disconnect(),h())},{threshold:.33});return g.observe(e),()=>{g.disconnect(),p.current=!0,d()}},[]);let h=e?.counts||{},g=a(h),_=[];for(let e of(o||[]).filter(e=>e.tier===`doctrine`)){let t=_.find(t=>t.id===e.pack);t||_.push(t={id:e.pack,n:0}),t.n+=1}let v=e?.footprint===`lean`?`lean — first line only`:`full text inlined`,y={x:330,y:165,r:Y([{t:`Constitution`,size:17,dy:-12},{t:`${g} rules`,size:10,dy:8},{t:v,size:8.5,dy:24}],12)},b={x:126,y:95,r:Y([{t:s,size:12.5,dy:-7},{t:`${h.ontology??0} sections`,size:10,dy:10}],11)},x={x:560,y:78,r:Y([{t:c,size:12.5,dy:-6},{t:`${h.laws??0}`,size:13,dy:12}],11)},S={x:560,y:252,r:Y([{t:d,size:12.5,dy:-6},{t:`${h.doctrines?.rules??0}`,size:13,dy:12}],11)},C=(e,t,n,r)=>({x:e,y:t,label:n,count:r,r:Y([{t:n,size:10.5,dy:-2},{t:`${r}`,size:9,dy:10}],9)}),w=[{...C(812,52,`Skills`,h.skills??0),hash:`#/skills`,from:x},{...C(820,126,`Agents`,h.agents??0),hash:`#/agents`,from:x},{...C(816,232,`Memory`,h.memory??0),hash:`#/personal/memory`,from:S},{...C(812,300,`Wiki`,h.wiki??0),hash:`#/section/wiki`,from:S}],E={rx:122,ry:68,from:212,to:112},D=_.map((e,t)=>{let n=(_.length===1?(E.from+E.to)/2:E.from+(E.to-E.from)*t/(_.length-1))*Math.PI/180;return{...e,x:S.x+E.rx*Math.cos(n),y:S.y+E.ry*Math.sin(n),r:Y([{t:e.id,size:7.5,dy:-2},{t:`${e.on}`,size:7.5,dy:8}],4)}}),O=D.length;return(0,K.useLayoutEffect)(()=>{let e=f.current;if(!e||!O||Q||!k())return;Q=!0;let t=[...e.querySelectorAll(`.cm-mini > g`)];j(t,{opacity:0,scale:.5});let n=()=>j(t,{opacity:1,scale:1}),r=()=>{m.current=null;let e=ee(t,{opacity:1,scale:1,duration:M[7],delay:l(M[1],{start:M[7]}),ease:P});n=T(e,M[7]+M[1]*O+M[7])};return p.current?r():m.current=r,()=>{m.current=null,n()}},[O]),(0,q.jsxs)(`svg`,{ref:f,className:`cmap`,viewBox:`0 0 940 350`,role:`group`,"aria-label":`The constitution map`,children:[(0,q.jsx)(`path`,{d:X(y,b,.05),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(y,x,-.07),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(y,S,.07),className:`cm-edge`}),w.map(e=>(0,q.jsx)(`path`,{d:X(e.from,e,.03),className:`cm-edge-gov`},`e-${e.label}`)),(0,q.jsxs)($,{hash:`#/laws`,part:`hub`,label:`Constitution: ${g} rules`,children:[(0,q.jsx)(`circle`,{cx:y.x,cy:y.y,r:y.r,className:`cm-hub-disc`}),(0,q.jsx)(`text`,{x:y.x,y:y.y-12,textAnchor:`middle`,className:`cm-hub-name`,children:`Constitution`}),(0,q.jsxs)(`text`,{x:y.x,y:y.y+8,textAnchor:`middle`,className:`cm-hub-num`,children:[g,` rules`]}),(0,q.jsx)(`text`,{x:y.x,y:y.y+24,textAnchor:`middle`,className:`cm-note`,children:v})]}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${s}: ${h.ontology??0} sections`,children:[(0,q.jsx)(`circle`,{cx:b.x,cy:b.y,r:b.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:b.x,y:b.y-7,textAnchor:`middle`,className:`cm-sat-name`,children:s}),(0,q.jsxs)(`text`,{x:b.x,y:b.y+10,textAnchor:`middle`,className:`cm-sat-num`,children:[h.ontology??0,` sections`]})]}),(0,q.jsx)(`text`,{x:b.x,y:b.y+b.r+16,textAnchor:`middle`,className:`cm-note`,children:`how it thinks, not a rule`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${c}: ${h.laws??0}, never broken`,children:[(0,q.jsx)(`circle`,{cx:x.x,cy:x.y,r:x.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:x.x,y:x.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:c}),(0,q.jsx)(`text`,{x:x.x,y:x.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:h.laws??0})]}),(0,q.jsx)(`text`,{x:x.x,y:x.y+x.r+16,textAnchor:`middle`,className:`cm-note`,children:`never broken`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${d}: ${h.doctrines?.rules??0} rules`,children:[(0,q.jsx)(`circle`,{cx:S.x,cy:S.y,r:S.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:S.x,y:S.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:d}),(0,q.jsx)(`text`,{x:S.x,y:S.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:h.doctrines?.rules??0})]}),(0,q.jsx)(`text`,{x:S.x+22,y:S.y+S.r+20,className:`cm-note`,children:h.doctrines?`${h.doctrines.active}/${h.doctrines.total} packs built in`:`packs chosen at build`}),(0,q.jsx)(`g`,{className:`cm-mini`,children:D.map(e=>(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-pack-disc`,style:{stroke:i(e.id)}}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-pack-id`,children:e.id}),(0,q.jsx)(`text`,{x:e.x,y:e.y+8,textAnchor:`middle`,style:{fill:i(e.id)},children:e.n})]},e.id))}),(0,q.jsx)(`text`,{x:866,y:16,textAnchor:`middle`,className:`cm-govern-label`,children:`GOVERNS THE HARNESS`}),w.map(e=>(0,q.jsxs)($,{hash:e.hash,part:`gov`,label:`${e.label}: ${e.count}`,children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-gov-disc`}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-gov-name`,children:e.label}),(0,q.jsx)(`text`,{x:e.x,y:e.y+10,textAnchor:`middle`,className:`cm-gov-num`,children:e.count})]},e.label)),(0,q.jsx)(`text`,{x:b.x,y:228,textAnchor:`middle`,className:`cm-note`,children:`tap any node to open its ledger`})]})}function ie({counts:e}){let t=[{label:d.skills.label,n:e.skills??0,hash:`#/skills`},{label:`Rules`,n:a(e),hash:`#/laws`},{label:d.agents.label,n:e.agents??0,hash:`#/agents`},{label:d.memory.label,n:e.memory??0,hash:`#/personal/memory`},{label:d.notebook.label,n:e.notebook??0,hash:`#/personal/notebook`},{label:d.wiki.label,n:e.wiki??0,hash:`#/section/wiki`},{label:d.config.label,n:e.config??0,hash:`#/section/config`}],n=Math.max(...t.map(e=>e.n),1);return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Growth rings`}),(0,q.jsx)(`span`,{className:`tick right`,children:`by section`})]}),t.map(e=>(0,q.jsxs)(`button`,{className:`jr-ring`,onClick:()=>s(e.hash),children:[(0,q.jsx)(`span`,{className:`jr-ring-label`,children:e.label}),(0,q.jsx)(`span`,{className:`jr-ring-track`,children:(0,q.jsx)(`span`,{className:`jr-ring-fill`,style:{width:`${e.n/n*100}%`}})}),(0,q.jsx)(`span`,{className:`jr-ring-num`,children:e.n})]},e.label))]})}function ae({recent:e,buildEpoch:t}){let n=e?.items||[],r=e?.skipped||[];return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Freshly grown`}),(0,q.jsx)(`span`,{className:`tick right`,children:`newest`})]}),e?n.length===0?(0,q.jsx)(`p`,{className:`sub`,children:`Nothing here carries a date yet.`}):n.slice(0,5).map(e=>(0,q.jsxs)(`button`,{className:`jr-fresh`,onClick:()=>s(`#/item/${e.type}/${encodeURIComponent(e.name)}`),children:[(0,q.jsx)(`span`,{className:`jr-fresh-kind`,children:e.section}),(0,q.jsx)(`span`,{className:`jr-fresh-name`,children:e.title}),(0,q.jsx)(`span`,{className:`jr-fresh-when`,children:c(e.mtime)})]},`${e.section}:${e.name}`)):(0,q.jsx)(`p`,{className:`sub`,children:`Reading the shelves…`}),r.length>0&&(0,q.jsxs)(`p`,{className:`sub jr-skipped`,children:[`Not dated: `,r.join(`, `),` — too many files to stat on every load.`]}),(0,q.jsxs)(`p`,{className:`jr-care`,children:[t?`Last built ✓ ${c(t)}`:`Never built here`,` ·`,` `,(0,q.jsx)(`button`,{className:`jr-go`,onClick:()=>s(`#/activity`),children:`log →`})]})]})}function oe({overview:e,recent:t,lens:n,dataRev:r}){let i=e?.counts||{};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`jr-head`,children:(0,q.jsx)(B,{verdict:n?.verdict})}),(0,q.jsxs)(`div`,{className:`jr-row2`,children:[(0,q.jsx)(ie,{counts:i}),(0,q.jsx)(ae,{recent:t,buildEpoch:e?.build_epoch})]}),(0,q.jsxs)(`div`,{className:`card pad-lg jr-map`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`The Constitution — and the harness it governs`}),(0,q.jsx)(`button`,{className:`jr-go right`,onClick:()=>s(`#/laws`),children:`open →`})]}),(0,q.jsx)(re,{overview:e,dataRev:r})]})]})}export{oe as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{H as i,Q as a,Z as o,at as s,et as c,mt as l,tt as u,wt as d,z as f}from"./index-B_pTwZra.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./Markdown-CxkA7940.js";import{t as h}from"./DataTable-b9zTShqJ.js";import{i as g}from"./controls-CK7qHA8H.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=s(),r=a(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===o(v(e))?t:null},{prune:c}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,o(v(e))]));c(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,c]);let u=e=>i(e)?.value??new Set(v(e)),d=(e,t)=>{let n=new Set(u(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,o(v(e)))},f=e=>{let t=u(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:u,toggle:d,change:f,apply:async e=>{let i=[...u(e)],a=`Rebuild ${l(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${l(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=l(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(g,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(m,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=l;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let a=e.credits||[],o=e.skills||[],s=e.agents||[],c=t.map(t=>({row:t,...F(n,t,e.name)})),l=c.filter(t=>v(t.row).includes(e.name)).length,u=c.filter(e=>e.staged).length,d=A(l,t.length),p=`on in ${l} of ${N(t.length,`install`)}${u?` · ${u} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${u?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(a.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(f,{value:o.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:o.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(f,{value:s.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length})]}),o.length?(0,x.jsx)(j,{type:`skill`,names:o,listed:r?.skills,offNote:d}):null,s.length?(0,x.jsx)(j,{type:`agent`,names:s,listed:r?.agents,offNote:d}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[a.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,a.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":c.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:c.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(g,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(h,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:a,error:o}=d(()=>r.kits(),[n]),s=b(a,t),{data:l}=d(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=a?.kits||[],m=a?.installs||[],h=o||a?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(c,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:m,stage:s,listed:l})}):(0,x.jsxs)(p,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(u,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{eyebrow:a?`${N(f.length,`kit`)} · ${N(m.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(c,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?f.length===0?h?null:(0,x.jsx)(p,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:m,stage:s,listed:l,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:m,stage:s}),m.length?(0,x.jsx)(R,{installs:m,stage:s}):null]}):h?null:(0,x.jsx)(u,{})]})}export{z as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C8nMUU1i.js";import{H as i,Q as a,Z as o,at as s,et as c,mt as l,tt as u,wt as d,z as f}from"./index-BhT94v2q.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./Markdown-CxkA7940.js";import{t as h}from"./DataTable-b9zTShqJ.js";import{i as g}from"./controls-CK7qHA8H.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=s(),r=a(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===o(v(e))?t:null},{prune:c}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,o(v(e))]));c(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,c]);let u=e=>i(e)?.value??new Set(v(e)),d=(e,t)=>{let n=new Set(u(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,o(v(e)))},f=e=>{let t=u(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:u,toggle:d,change:f,apply:async e=>{let i=[...u(e)],a=`Rebuild ${l(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${l(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=l(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(g,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(m,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=l;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let a=e.credits||[],o=e.skills||[],s=e.agents||[],c=t.map(t=>({row:t,...F(n,t,e.name)})),l=c.filter(t=>v(t.row).includes(e.name)).length,u=c.filter(e=>e.staged).length,d=A(l,t.length),p=`on in ${l} of ${N(t.length,`install`)}${u?` · ${u} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${u?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(a.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(f,{value:o.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:o.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(f,{value:s.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length})]}),o.length?(0,x.jsx)(j,{type:`skill`,names:o,listed:r?.skills,offNote:d}):null,s.length?(0,x.jsx)(j,{type:`agent`,names:s,listed:r?.agents,offNote:d}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[a.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,a.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":c.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:c.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(g,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(h,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:a,error:o}=d(()=>r.kits(),[n]),s=b(a,t),{data:l}=d(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=a?.kits||[],m=a?.installs||[],h=o||a?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(c,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:m,stage:s,listed:l})}):(0,x.jsxs)(p,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(u,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{eyebrow:a?`${N(f.length,`kit`)} · ${N(m.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(c,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?f.length===0?h?null:(0,x.jsx)(p,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:m,stage:s,listed:l,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:m,stage:s}),m.length?(0,x.jsx)(R,{installs:m,stage:s}):null]}):h?null:(0,x.jsx)(u,{})]})}export{z as default};