geneseed 5.0.4 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/SHIPPED.md +1 -1
  3. package/docs/concepts/exclusions.md +1 -1
  4. package/docs/concepts/factories.md +67 -15
  5. package/docs/concepts/loop-gates.md +5 -2
  6. package/docs/concepts/shared-tier.md +14 -0
  7. package/docs/extending.md +1 -1
  8. package/docs/guides/migrate.md +1 -1
  9. package/docs/guides/run-a-factory.md +41 -13
  10. package/docs/guides/upgrade-to-5.md +2 -2
  11. package/docs/reference/factory-actions.md +7 -7
  12. package/docs/web-ui.md +18 -6
  13. package/harness.config.json +1 -1
  14. package/js/README.md +2 -1
  15. package/js/build/args.mjs +34 -14
  16. package/js/build/emit-claude.mjs +3 -0
  17. package/js/build/emit-opencode.mjs +4 -0
  18. package/js/build/retired-skills.mjs +158 -0
  19. package/js/build/source.mjs +31 -11
  20. package/js/cli-table.json +29 -3
  21. package/js/factory/cli.mjs +49 -8
  22. package/js/factory/graph.mjs +72 -8
  23. package/js/factory/state.mjs +109 -27
  24. package/js/hosts/done-checks.mjs +3 -2
  25. package/js/hosts/memory-files.mjs +4 -2
  26. package/js/loop/catalog.mjs +16 -10
  27. package/js/loop/cli.mjs +16 -10
  28. package/js/maintain/migrate.mjs +39 -25
  29. package/js/web/daemon.mjs +69 -14
  30. package/js/web/handler.mjs +22 -9
  31. package/package.json +1 -1
  32. package/src/bricks/checks.md +62 -0
  33. package/src/bricks/intake.md +15 -6
  34. package/src/bricks/merge-gate.md +17 -8
  35. package/src/bricks/retro.md +8 -3
  36. package/src/bricks/review-panel.md +43 -0
  37. package/src/bricks/spec.md +20 -6
  38. package/src/factories/analysis-to-build.json +25 -7
  39. package/src/factories/bug-report-to-fix.json +25 -7
  40. package/src/factories/issue-to-pr.json +29 -11
  41. package/src/skills/factory-forge.md +23 -5
  42. package/src/skills/factory.md +95 -25
  43. package/src/skills/loop.md +3 -2
  44. package/themes/_TEMPLATE.json +1 -1
  45. package/web/dist/assets/{Activity-BaoxwVFH.js → Activity-CpkBwpu7.js} +1 -1
  46. package/web/dist/assets/{ActivityDetail-C_bFD0rW.js → ActivityDetail-DTPziZWM.js} +1 -1
  47. package/web/dist/assets/{Bonsai-B01lLf0m.js → Bonsai-hiG_gGNU.js} +1 -1
  48. package/web/dist/assets/{CopyButton-Bc66KPyA.js → CopyButton-DUIUfNp6.js} +1 -1
  49. package/web/dist/assets/{Dashboard-X7GZzGJp.js → Dashboard-Dnw6EyX7.js} +2 -2
  50. package/web/dist/assets/{Docs-LRYVnGLG.js → Docs-BEET_l16.js} +1 -1
  51. package/web/dist/assets/Factories-D6KXkfWw.js +1 -0
  52. package/web/dist/assets/{GreenhouseView-CfWR2-sX.js → GreenhouseView-BKxy5apE.js} +1 -1
  53. package/web/dist/assets/{Installs-nfFHnovH.js → Installs-CnFVlVD0.js} +1 -1
  54. package/web/dist/assets/{JournalView-lpOHcHKK.js → JournalView-ChFitHjo.js} +1 -1
  55. package/web/dist/assets/{Kits-Bw5EQl_i.js → Kits-CcR-OlwQ.js} +1 -1
  56. package/web/dist/assets/{Laws-CnZJ0wjZ.js → Laws-B1s5idOg.js} +1 -1
  57. package/web/dist/assets/LibRows-BZgdbI1l.js +1 -0
  58. package/web/dist/assets/Library-x6TkkEVF.js +3 -0
  59. package/web/dist/assets/{Loops-ZaHC5MVl.js → Loops-BH93KKxn.js} +1 -1
  60. package/web/dist/assets/{OperatorHudView-CggG0_sK.js → OperatorHudView-BO0aIKPL.js} +1 -1
  61. package/web/dist/assets/{Personal-BObvlb70.js → Personal-CE_0Vhh0.js} +1 -1
  62. package/web/dist/assets/{Settings-BFfPMPc9.js → Settings-CbpZvVN_.js} +1 -1
  63. package/web/dist/assets/{Tabs-B594Pad_.js → Tabs-C2oW7oEj.js} +1 -1
  64. package/web/dist/assets/{index-DsLmKHw0.js → index-BQwOmbor.js} +2 -2
  65. package/web/dist/assets/{index-DvPjphz0.css → index-CuIop_pO.css} +1 -1
  66. package/web/dist/index.html +2 -2
  67. package/web/dist/assets/Factories-ARenKBiP.js +0 -1
  68. package/web/dist/assets/LibRows-Hqvf1beK.js +0 -1
  69. package/web/dist/assets/Library-JaSsp6Yr.js +0 -3
@@ -11,13 +11,13 @@
11
11
  <!-- The brand sprout as an inline SVG favicon (no extra asset to serve). -->
12
12
  <link rel="icon" type="image/svg+xml"
13
13
  href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.5v-9' stroke='%233AD4C4' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3Cpath d='M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z' fill='%233AD4C4'/%3E%3Cpath d='M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z' fill='%233AD4C4' opacity='.42'/%3E%3C/svg%3E" />
14
- <script type="module" crossorigin src="/assets/index-DsLmKHw0.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-BQwOmbor.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/react-C1iE8mnY.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/api-DLDVY3K-.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/motion-RlUl1osO.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/sections-CtFz7HFH.js">
20
- <link rel="stylesheet" crossorigin href="/assets/index-DvPjphz0.css">
20
+ <link rel="stylesheet" crossorigin href="/assets/index-CuIop_pO.css">
21
21
  </head>
22
22
  <body>
23
23
  <div id="root"></div>
@@ -1 +0,0 @@
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-DLDVY3K-.js";import{Et as i,Ot as a,Q as o,Z as s,at as c,it as l,kt as u,rt as d,vt as f}from"./index-DsLmKHw0.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./usePoll-o8ul-Sog.js";import{a as h,i as ee,n as g,o as _,s as v}from"./LibRows-Hqvf1beK.js";import{t as y}from"./CopyButton-Bc66KPyA.js";import{a as b,c as x,n as S,o as C,s as w}from"./ActiveLoops-BTHIaRhn.js";var T=e(t(),1),E=24,D=48,te=16,ne=92,re=8,ie=16,O=22,k=14,ae=14,A=15,j=7.2,M=440,N={brick:{w:200,h:48},fork:{w:200,h:48},lane:{w:150,h:56},close:{w:96,h:34},stop:{w:76,h:34}},P=`loop:`,oe=new Set([`$close`,`$stop`,`$lane`]),F=(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 se(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}function ce(e){let t=new Set(Array.isArray(e.stages)?e.stages:[]),n=(e.cycles||[]).filter(e=>Array.isArray(e?.nodes)),r=e=>n.some(t=>t.nodes[0]===e.to&&t.nodes.includes(e.from)),i=new Map;for(let n of e.edges||[])t.has(n?.from)&&t.has(n?.to)&&!r(n)&&(i.has(n.from)||i.set(n.from,[]),i.get(n.from).includes(n.to)||i.get(n.from).push(n.to));return new Map([...i].filter(([,e])=>e.length>1))}function le(e,t){let n=ce(e);for(let r of[...Array.isArray(t)?t:[]].reverse()){if(!n.has(r?.stage)||!r.outcome)continue;let t=(e.edges||[]).find(e=>e.from===r.stage&&e.on===r.outcome);if(t&&n.get(r.stage).includes(t.to))return t.to}return null}function ue(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=I(e,t,n.loops||[],a,r,n.lane);if(o.width<=r||a===i.at(-1))return o}}function I(e,t,n,r,i,a){let o=Array.isArray(e.stages)?e.stages:[],s=new Set(o),c=(Array.isArray(e.edges)?e.edges:[]).filter(e=>typeof e?.from==`string`&&typeof e?.to==`string`&&s.has(e.from)&&(s.has(e.to)||oe.has(e.to))),l=(Array.isArray(e.cycles)?e.cycles:[]).filter(e=>Array.isArray(e?.nodes)),u=new Map(t.map(e=>[e.name,e])),d=new Map(n.map(e=>[e.name,e.graph])),f=ce(e),p=new Set([...f.values()].flat()),m=e=>se(l,e.from,e.to,p),h=new Map(s.has(e.start)?[[e.start,0]]:[]),ee=c.filter(e=>s.has(e.to)&&!m(e));for(let e=0;e<o.length;e++){let e=!1;for(let t of ee){if(!h.has(t.from))continue;let n=h.get(t.from)+1;h.get(t.to)>=n||(h.set(t.to,n),e=!0)}if(!e)break}let g=Math.max(-1,...h.values());for(let e of o)h.has(e)||h.set(e,++g);let _=g+1,v=[];for(let e of o)(v[h.get(e)]||=[]).push(e);let y=e=>v[h.get(e)].length>1,b=r.rails?E:ie,S=r.rails?te:re,C=i===1/0?1/0:i-2*b,T=Math.max(N.brick.w,Math.min(M,C)),le=()=>Math.max(N.lane.w,Math.min(240,C-28)),ue=e=>r.rails?N.lane.w:Math.max(ne,Math.min(N.lane.w,Math.floor((C-S*(e-1))/e))),I=o.map(e=>{let n=y(e),r=e.startsWith(P)?e.slice(5):null,i=r?`loop`:f.has(e)?`fork`:`brick`,a=n?{w:ue(v[h.get(e)].length),h:N.lane.h}:{...N[i]||N.brick};if(i===`loop`&&!n){let e=d.get(r)?x(d.get(r),t):null,n=e?e.height/e.width:.8;a={w:T,h:Math.round(36+(T-16)*n)}}return{id:e,kind:i,...a,rank:h.get(e),lane:n,stacked:!1,loop:r,human:i===`brick`||i===`fork`?w(u.get(e)):null,tags:[]}}),L=new Map(I.map(e=>[e.id,e])),de=c.some(e=>e.to===`$close`);if(de){let e={id:`$close`,kind:`close`,...N.close,rank:_,tags:[]};I.push(e),L.set(`$close`,e),v[_]=[`$close`]}let fe=e=>{let t=null;for(let n of f.keys())h.get(n)<h.get(e)&&(!t||h.get(n)>h.get(t))&&(t=n);return t},R=new Map;for(let e of c){let t=`${e.from}\u0000${e.to}`;if(R.has(t))R.get(t).on.push(e.on);else{let n=m(e),r=e.to===`$lane`?f.get(fe(e.from))?.[0]:e.to;if(e.to!==`$stop`&&!L.has(r))continue;let i=e.to===`$stop`?0:L.get(r).rank-h.get(e.from),a=e.to===`$stop`?`stop`:n?`back`:i===1?`flow`:`skip`;R.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 z=[...R.values()],B=z.filter(e=>e.kind===`back`||e.kind===`skip`),pe=z.filter(e=>e.kind===`stop`&&y(e.from)),me=r.rails?pe:[...B,...z.filter(e=>e.kind===`stop`&&!y(e.from)),...pe];for(let e of me)L.get(e.from).tags.push({kind:e.kind,on:e.on,to:e.to,cycle:e.cycle});let he=(e,t)=>e.kind===`back`?F(t.cycleDef):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,ge=e=>Math.max(0,...e.tags.map(t=>he(t,z.find(n=>n.from===e.id&&n.to===t.to)).length*j)),V=v.map(e=>(e||[]).map(e=>L.get(e))),H=e=>e.reduce((e,t)=>e+t.w,0)+S*(e.length-1),U=V.map(e=>r.stack&&e.length>1&&H(e)>C);V.forEach((e,t)=>{if(U[t])for(let t of e)Object.assign(t,{stacked:!0,w:le()})});let W=(e,t)=>U[t]?Math.max(...e.map(e=>e.w))+28:H(e),G=Math.max(N.brick.w,...V.map((e,t)=>e.length?W(e,t):0)),K=E,q=[];V.forEach((e,t)=>{if(!e.length)return;let n=(G-W(e,t))/2;if(U[t]){for(let t of e)Object.assign(t,{x:(G-t.w)/2,y:K}),K+=t.h+t.tags.length*A+O;K-=O}else{for(let t of e)Object.assign(t,{x:n,y:K}),n+=t.w+S;K+=Math.max(...e.map(e=>e.h)),K+=Math.max(0,...e.map(e=>e.tags.length))*A}q[t]=K+D/2,K+=D});let _e=K-D,J=r.rails?B.sort((e,t)=>Math.abs(t.span)-Math.abs(e.span)):[],Y=e=>28+e*ae,ve=e=>e.back?F(e.cycleDef):e.on.join(` · `),X=J.length?Y(J.length-1)+12:b;J.forEach((e,t)=>{X=Math.max(X,Y(t)+8+ve(e).length*j-L.get(e.from).x)});for(let e of I)e.x+=X;let Z=r.rails?z.filter(e=>e.kind===`stop`&&!y(e.from)):[],Q=X+G+24;for(let e of Z){let t=L.get(e.from);Q=Math.max(Q,t.x+t.w+10+e.on.join(` · `).length*j)}let ye=Math.max(0,...I.filter(e=>e.tags.length).map(e=>e.x+e.w/2+6+ge(e))),be=Math.max(X+G,ye)+b;if(Z.length){Q=Math.max(Q,ye+10);let e=de?L.get(`$close`).y:_e-N.stop.h,t={id:`$stop`,kind:`stop`,...N.stop,x:Q-N.stop.w/2,y:e,rank:_,tags:[]};I.push(t),L.set(`$stop`,t),be=Q+N.stop.w/2+E}let xe=e=>e.x+e.w/2,$=e=>e.y+e.h/2,Se=e=>e.y+e.h,Ce=e=>e.x-k,we=e=>e.x+e.w+k,Te=new Map;for(let e of z)e.kind===`flow`&&Te.set(e.target,(Te.get(e.target)||0)+1);let Ee=new Map,De=z.map(e=>{let t=L.get(e.from),n=e.to===`$lane`&&L.get(a)?.stacked&&f.get(fe(e.from))?.includes(a)?L.get(a):L.get(e.target),r={from:e.from,to:e.to,on:e.on,kind:e.kind,back:e.back,cycle:e.cycle};if(e.kind===`stop`){if(!Z.includes(e))return{...r,path:null};let n=L.get(`$stop`);return{...r,path:`M${t.x+t.w},${$(t)} H${Q} V${n.y}`,lx:t.x+t.w+6,ly:$(t)-6,anchor:`start`}}if(e.kind===`back`||e.kind===`skip`){let i=J.indexOf(e);if(i<0)return{...r,path:null};let a=Ee.get(n.id)||0;Ee.set(n.id,a+1);let o=$(n)+(a%2?1:-1)*Math.ceil(a/2)*10;return{...r,path:`M${t.x},${$(t)} H${Y(i)} V${o} H${n.x}`,lx:Y(i)+6,ly:$(t)-6,anchor:`start`}}let i=q[t.rank],o=t.stacked?`M${t.x+t.w},${$(t)} H${we(t)} V${i}`:`M${xe(t)},${Se(t)} V${i}`,s=n.stacked?` H${Ce(n)} V${$(n)} H${n.x}`:` H${xe(n)} V${n.y}`,c=e.on.length===1&&e.on[0]===`pass`,l=(Te.get(n.id)||0)>1?{lx:t.stacked?we(t)+4:xe(t)+6,ly:t.stacked?$(t)-4:Se(t)+13}:n.stacked?{lx:n.x,ly:n.y-5}:{lx:xe(n)+6,ly:n.y-8};return{...r,path:o+s,...l,anchor:`start`,plain:c}});return{width:Math.ceil(be),height:Math.ceil(_e+E),mode:r.rails?`rails`:`tags`,stacked:U.some(Boolean),nodes:I,edges:De}}var L=n(),de=20;function fe({factory:e,bricks:t=[],loops:n=[],onSelect:r,highlight:i,child:a,counters:o,lane:s,history:c}){let l=(0,T.useRef)(null),[u,d]=(0,T.useState)(0);(0,T.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>d(t=>Math.abs(e.clientWidth-t)>de?e.clientWidth:t);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let f=s===void 0?le(e,c):s,p=ue(e,t,{width:u,loops:n,lane:f}),m=new Map(n.map(e=>[e.name,e.graph])),h=new Map((e.cycles||[]).map(e=>[e.name,e])),ee=new Set(p.nodes.filter(e=>e.kind===`fork`).map(e=>e.id)),g=e=>e.kind===`back`?F(h.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()}`:``}`,v=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},y=e=>{let t=e.id===i,n=`${_(e)}${e.id===f?`, the lane taken`:``}`;return r?{role:`button`,tabIndex:0,"aria-label":n,onClick:v(e.id),onKeyDown:v(e.id)}:{role:`img`,"aria-label":`${n}${t?`, current stage`:``}`}},x=e=>`fg-node ${e.kind}${e.lane?` lane`:``}${e.id===i?` current`:``}${e.id===f?` taken`:``}`,S=e=>f&&(e.to===f||e.from===f),w=e=>e.tags.map((t,n)=>(0,L.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,L.jsxs)(`div`,{className:`fg-wrap`,ref:l,children:[(0,L.jsxs)(`svg`,{className:`fgraph`,"data-mode":`${p.mode}${p.stacked?` stacked`:``}`,style:{"--fg-w":`${p.width}px`},viewBox:`0 0 ${p.width} ${p.height}`,role:`group`,"aria-label":`${e.name} factory: ${(e.stages||[]).join(`, `)}`,children:[(0,L.jsx)(`defs`,{children:[`flow`,`back`,`stop`].map(e=>(0,L.jsx)(`marker`,{id:`fg-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,L.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`fg-head-${e}`})},e))}),p.edges.map(e=>{if(!e.path)return null;let t=e.kind===`skip`?`flow`:e.kind,n=e.back?F(h.get(e.cycle),o):e.kind===`flow`&&e.plain?``:e.on.join(` · `);return(0,L.jsxs)(`g`,{children:[(0,L.jsx)(`path`,{d:e.path,className:`fg-edge ${e.kind}${S(e)&&e.kind===`flow`?` taken`:``}`,markerEnd:`url(#fg-arrow-${t})`}),n?(0,L.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`fg-lbl ${e.kind}${e.kind===`flow`&&ee.has(e.from)?` fork`:``}`,children:n}):null]},`${e.from}>${e.to}`)}),p.nodes.map(e=>{if(e.kind===`close`||e.kind===`stop`)return(0,L.jsxs)(`g`,{className:`fg-${e.kind}`,role:`img`,"aria-label":e.kind,children:[(0,L.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.h/2}),(0,L.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+4,textAnchor:`middle`,children:e.kind})]},e.id);let n=e.id===i?`step`:void 0;if(e.lane||e.kind===`brick`||e.kind===`fork`){let t=a&&e.id===i?a:null,r=e.lane?t?`at ${t.node}`:e.kind===`loop`?`whole loop`:`no loop`:null;return(0,L.jsxs)(`g`,{children:[(0,L.jsxs)(`g`,{className:x(e),"aria-current":n,...y(e),children:[e.lane?(0,L.jsx)(`title`,{children:e.id}):null,(0,L.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:`10`}),(0,L.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+(r?-2:4),textAnchor:`middle`,children:e.lane&&e.loop?e.loop:e.id}),r?(0,L.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,L.jsx)(b,{x:e.x+e.w-4,y:e.y+4,label:e.human}):null]}),w(e)]},e.id)}let r=a&&e.id===i?a:null,o=r?.graph||(e.loop?m.get(e.loop):null);return(0,L.jsxs)(`g`,{children:[(0,L.jsxs)(`g`,{className:x(e),"aria-current":n,...y(e),children:[(0,L.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:`14`}),(0,L.jsx)(`text`,{x:e.x+12,y:e.y+20,className:`fg-title`,children:e.id})]}),o?(0,L.jsx)(`foreignObject`,{x:e.x+8,y:e.y+28,width:e.w-16,height:e.h-34,children:(0,L.jsx)(`div`,{className:`fg-ring`,children:(0,L.jsx)(C,{graph:o,bricks:t,highlight:r?.node})})}):(0,L.jsx)(`text`,{x:e.x+12,y:e.y+48,className:`fg-sub`,children:`not in this install's catalogue`}),w(e)]},e.id)})]}),(0,L.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,L.jsxs)(`li`,{children:[(0,L.jsx)(`span`,{className:`fg-key ${e}`,"aria-hidden":`true`}),t]},e))})]})}var R=encodeURIComponent,z=5e3,B=a.factories.map(e=>[e,u[e]]),pe={project:`Project`,global:`Global`,shipped:`Shipped`},me={templates:`Origins`,active:`Statuses`},he=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]],ge=e=>!!e.graph,V=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r}))),H=e=>V(e.map(e=>({...e,desc:e.description})),e=>e.origin,Object.entries(pe)),U=e=>V(e.map(e=>({...e,name:e.root,desc:e.factory})),e=>e.status,he),W=(e,t)=>(0,L.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),G={templates:e=>W(``,e.origin),active:e=>W(S[e.status],e.status)},K=fe;function q({factory:e,counters:t}){return e.cycles?.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h3`,{className:`loop-h2`,children:`Routes back`}),(0,L.jsx)(`ul`,{className:`fac-cycles`,"aria-label":`Cycles`,children:e.cycles.map(e=>(0,L.jsxs)(`li`,{children:[(0,L.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 _e({f:e,bricks:t,loops:n}){let r=`geneseed factory init --factory ${e.name} --title "<title>" --requirement "<requirement>"`;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`reader-tags`,children:[(0,L.jsx)(`span`,{className:`tag acc`,children:`Factory`}),W(``,e.origin)]}),(0,L.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,L.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,L.jsxs)(`p`,{className:`mono dim reader-src`,children:[`factories/`,e.name,`.json · `,e.origin]}),(0,L.jsx)(`hr`,{className:`hr`}),(0,L.jsx)(K,{factory:e.factory,bricks:t,loops:n}),(0,L.jsx)(q,{factory:e.factory}),(0,L.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`fac-start-h`,children:[(0,L.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,L.jsx)(`h3`,{id:`fac-start-h`,className:`loop-kicker`,children:`Start it in a worktree`}),(0,L.jsx)(y,{text:r,label:`Copy command`})]}),(0,L.jsx)(`pre`,{className:`mono`,children:r})]}),e.factory.rules?.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,L.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every stage follows`,children:e.factory.rules.map(e=>(0,L.jsx)(`li`,{children:e},e))})]}):null]})}function J({run:e,bricks:t,loops:n}){let r=e.tasks;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`reader-tags`,children:[(0,L.jsx)(`span`,{className:`tag acc`,children:`Factory run`}),(0,L.jsx)(`span`,{className:`tag${S[e.status]?` ${S[e.status]}`:``}`,children:e.status})]}),(0,L.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,L.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.factory,` · `,e.branch,` · `,e.root]}),ge(e)?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`p`,{className:`reader-lede`,children:[`At `,e.stage,` · `,e.transitions,` transitions`,r?` · task ${r.index} / ${r.count}`:``,e.loop?` · loop at ${e.loop.node}, iteration ${e.loop.iteration}`:``]}),e.awaiting?(0,L.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,L.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind??`you`,e.awaiting.stage?` at ${e.awaiting.stage} (${e.awaiting.outcome})`:``]}),` `,`— Answer in the agent's session.`]}):null,e.reason?(0,L.jsx)(`p`,{className:`panel-note`,children:e.reason}):null,(0,L.jsx)(`hr`,{className:`hr`}),(0,L.jsx)(K,{factory:e.graph,bricks:t,loops:n,highlight:e.stage,child:e.loop,counters:e.counters,lane:e.lane,history:e.history}),(0,L.jsx)(q,{factory:e.graph,counters:e.counters})]}):(0,L.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 Y({problems:e}){if(!e?.length)return null;let t=e.length;return(0,L.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,L.jsxs)(`b`,{className:`t-warn`,children:[t,` factory `,t===1?`problem`:`problems`,`: these factories cannot run as they are`]}),(0,L.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,L.jsx)(`li`,{className:`mono`,children:e},e))})]})}var ve={templates:{title:`No factories`,body:(0,L.jsxs)(L.Fragment,{children:[`Add one under `,(0,L.jsx)(`code`,{className:`mono`,children:`.geneseed/factories/`}),` in the repo.`]})},active:{title:`No runs yet`,body:(0,L.jsxs)(L.Fragment,{children:[`Start one with `,(0,L.jsx)(`code`,{className:`mono`,children:`geneseed factory init`}),` in a worktree, or ask the agent to run a factory. It shows up here while it runs.`]})}},X={templates:(0,L.jsxs)(L.Fragment,{children:[`A factory carries one work item through bricks and loops to an open PR.`,` `,(0,L.jsx)(`a`,{href:`#/docs/factories`,children:`How factories work →`})]}),active:(0,L.jsxs)(L.Fragment,{children:[`Factory runs registered on this machine, read from their FACTORY.md.`,` `,(0,L.jsx)(`a`,{href:`#/docs/run-a-factory`,children:`Run a factory →`})]})};function Z(){let[e,t]=(0,T.useState)(null),[n,i]=(0,T.useState)(null);return m(e=>r.activeFactories().then(n=>e()&&(t(n),i(null)),t=>e()&&i(t.message)),z,[]),{runs:e?.factories??null,error:n}}function Q({tab:e=`templates`,item:t,dataRev:n}){let a=o(n),[u,m]=s(`factories`,a),{data:y,error:b}=i(()=>r.factories(f(u)),[n,u?.id??``],`factories`),{runs:x,error:S}=Z(),[C,w]=(0,T.useState)(``),[E,D]=(0,T.useState)(`all`),[te,ne]=(0,T.useState)(e);e!==te&&(ne(e),w(``),D(`all`));let re=y?.bricks||[],ie=y?.loops||[],O=e===`active`?x&&U(x):y&&H(y.factories),k=O||[],ae=v(k),A=E===`all`?k:k.filter(e=>e.group===E),j=C.trim(),M=h(A,j),N=!!(t&&O&&!k.some(e=>e.name===t)),P=N?null:k.find(e=>e.name===t)||e===`active`&&k.find(ge)||k[0]||null,oe={templates:y?.factories.length,active:x?.length},F=B.find(([t])=>t===e)[1],se=e===`active`?S:b;return(0,L.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,L.jsx)(c,{className:`page-pick`,installs:a,value:u,onChange:m}),(0,L.jsx)(d,{error:se,style:{margin:`0 0 var(--sp-3)`}}),(0,L.jsx)(Y,{problems:y?.problems}),(0,L.jsxs)(`div`,{className:`library`,children:[(0,L.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Factories sections`,children:[(0,L.jsxs)(`div`,{className:`lib-title`,children:[(0,L.jsx)(`h1`,{className:`h`,children:`Factories`}),(0,L.jsx)(`span`,{className:`dim`,children:`Work items, carried to a PR`})]}),(0,L.jsx)(`p`,{className:`panel-note lib-lede`,children:X[e]}),(0,L.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:B.map(([t,n])=>(0,L.jsxs)(T.Fragment,{children:[(0,L.jsxs)(`a`,{href:`#/factories/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,L.jsx)(`span`,{className:`mono dim`,children:oe[t]??``})]}),e===t&&(0,L.jsx)(_,{label:me[t],total:k.length,cats:ae,cat:E,onChange:D})]},t))})]}),(0,L.jsx)(ee,{label:F,count:j?`${M.length} of ${A.length}`:O?A.length:``,q:C,onQ:w,matched:M.length,inView:[e,t],current:P?.name,sections:B.map(([t,n])=>({key:t,label:n,n:oe[t],href:`#/factories/${t}`,on:e===t})),cats:ae,cat:E,total:k.length,onCat:D,catLabel:me[e],children:O?k.length===0?(0,L.jsx)(p,{title:ve[e].title,children:ve[e].body}):(0,L.jsx)(g,{rows:M,activeName:P?.name,hrefOf:t=>`#/factories/${e}/${R(t.name)}`,pills:G[e]}):se?null:(0,L.jsx)(l,{})}),(0,L.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:N?(0,L.jsx)(p,{title:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/factories/${e}`,label:`All ${F.toLowerCase()} →`}}):P?e===`active`?(0,L.jsx)(J,{run:P,bricks:re,loops:ie}):(0,L.jsx)(_e,{f:P,bricks:re,loops:ie},P.name):e===`active`&&O?(0,L.jsx)(p,{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{Q as default,H as factoryRows,U as runRows};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{bt as r}from"./index-DsLmKHw0.js";import{t as i}from"./FilterInput-qGKNSlxv.js";var a=e(t(),1),o=n(),s={experimental:{label:`experimental`,cls:`warn`,icon:`flask`,hint:`Shipped, but not yet confirmed by real use.`},deprecated:{label:`deprecated`,cls:`bad`,icon:`clear`,hint:`On its way out — look for the replacement before building on it.`},personal:{label:`personal`,cls:``,icon:`profile`,hint:`Yours — present in this install, not shipped or versioned by Geneseed.`},unknown:{label:`no status`,cls:``,icon:`about`,hint:`Not listed in registry.json.`}};function c({status:e,withHint:t=!1,compact:n=!1}){let i=s[e];if(!i)return null;if(n)return(0,o.jsxs)(`span`,{className:`badge status-icon ${i.cls}`,title:`${i.label}: ${i.hint}`,children:[(0,o.jsx)(r,{name:i.icon}),(0,o.jsx)(`span`,{className:`sr-only`,children:i.label})]});let a=(0,o.jsxs)(`span`,{className:`badge ${i.cls}`,title:t?void 0:i.hint,children:[(0,o.jsx)(`span`,{className:`dot`}),i.label]});return t?(0,o.jsxs)(o.Fragment,{children:[a,(0,o.jsx)(`span`,{className:`dim`,children:i.hint})]}):a}function l({items:e}){return Object.keys(s).filter(t=>e.some(e=>e.status===t)).map(e=>(0,o.jsxs)(`span`,{title:s[e].hint,children:[(0,o.jsx)(`span`,{className:`badge status-icon ${s[e].cls}`,"aria-hidden":`true`,children:(0,o.jsx)(r,{name:s[e].icon})}),s[e].label]},e))}function u({label:e,total:t,cats:n,cat:r,onChange:i}){if(n.length<=1)return null;let a=[{key:`all`,label:`All`,n:t,c:`var(--text-3)`},...n];return(0,o.jsxs)(`div`,{className:`rail-cats`,children:[(0,o.jsx)(`ul`,{"aria-label":e,children:a.map(({key:e,label:t,n,c:a})=>(0,o.jsx)(`li`,{children:(0,o.jsxs)(`button`,{type:`button`,className:r===e?`on`:``,"aria-pressed":r===e,style:{"--cc":a},onClick:()=>i(e),children:[(0,o.jsx)(`span`,{className:`cdot`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`rc-name`,children:t}),(0,o.jsx)(`span`,{className:`mono dim`,children:n})]})},e))}),(0,o.jsx)(`div`,{className:`rail-mix`,"aria-hidden":`true`,children:n.map(({key:e,n:t,c:n})=>(0,o.jsx)(`span`,{className:r===`all`||r===e?``:`dim`,style:{"--cc":n,flexGrow:t}},e))})]})}function d(e){let t=[],n=new Map;for(let r of e)n.has(r.group)||t.push(r.group),n.set(r.group,(n.get(r.group)||0)+1);return t.map(e=>({key:e,label:e,n:n.get(e),c:`var(--accent)`}))}var f=({name:e})=>(0,o.jsxs)(`span`,{className:`tag acc`,title:`Ships with the ${e} kit`,children:[`kit: `,e]}),p=()=>(0,o.jsx)(`span`,{className:`tag acc`,title:`Every agent inherits this agent's root file`,children:`base`});function m(e,t){let n=(t||``).trim().toLowerCase();return n?e.filter(e=>`${e.title||``} ${e.name||``} ${e.desc||``}`.toLowerCase().includes(n)):e}function h({label:e,count:t,extra:n,tools:r,toolsCompact:s,q:c,onQ:l,matched:d,inView:f,current:p,sections:m,cats:h,cat:g,onCat:_,total:S,catLabel:C,children:w}){let T=x(f),E=T.list,D=b([...f,E]),O=(0,a.useId)(),k=(0,a.useRef)(null);(0,a.useLayoutEffect)(()=>y(D.current));let[A,j]=(0,a.useState)(``),M=(0,a.useRef)(!0);return(0,a.useEffect)(()=>{M.current?M.current=!1:j(D.current?.querySelector(`.lib-row.on`)?.dataset.title||``)},f),(0,o.jsxs)(`section`,{className:`lib-list`,"aria-label":e,onKeyDown:e=>{e.key===`ArrowDown`&&e.target.classList?.contains(`lib-filter`)&&(e.preventDefault(),D.current?.querySelector(`.lib-row`)?.focus())},"data-open":E,children:[(0,o.jsxs)(`div`,{className:`lib-list-head`,children:[(0,o.jsxs)(`b`,{children:[e,` `,(0,o.jsx)(`span`,{className:`mono dim`,children:t})]}),n]}),(0,o.jsxs)(`div`,{className:`lib-toolbar`,children:[m?(0,o.jsx)(`nav`,{className:`lib-seg`,"aria-label":`Sections`,children:m.map(e=>(0,o.jsxs)(`a`,{href:e.href,className:e.on?`on`:``,"aria-current":e.on?`page`:void 0,onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||T.setList(!0)},children:[e.label,(0,o.jsx)(`span`,{className:`mono`,children:e.n??``})]},e.key))}):null,(0,o.jsxs)(`div`,{className:`lib-toolbar-filter`,children:[(0,o.jsx)(i,{value:c,onChange:l,placeholder:`Filter ${e.toLowerCase()}`,label:`Filter ${e}`}),r?(0,o.jsx)(`div`,{className:`lib-tools`,children:r}):null,s?(0,o.jsx)(`div`,{className:`lib-tools-compact`,children:s}):null]}),h?.length>1?(0,o.jsx)(`div`,{className:`lib-chips`,children:(0,o.jsx)(u,{label:C,total:S,cats:h,cat:g,onChange:_})}):null]}),(0,o.jsxs)(`div`,{className:`lib-picker`,children:[(0,o.jsxs)(`button`,{ref:k,type:`button`,className:`lib-list-toggle`,"aria-expanded":E,"aria-controls":O,onClick:()=>T.setList(e=>!e),children:[(0,o.jsx)(`span`,{className:`dim lib-pick-n`,children:d===void 0?``:`${d} ${e.toLowerCase()}`}),(0,o.jsx)(`b`,{children:p}),(0,o.jsx)(`span`,{className:`dim lib-pick-hint`,children:E?`close`:`change`}),(0,o.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,o.jsxs)(`div`,{className:`lib-rows`,id:O,ref:D,onKeyDown:v,onFocus:e=>y(e.currentTarget),onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||e.target.closest?.(`.lib-row`)&&T.pick()},children:[w,c.trim()&&d===0&&(0,o.jsxs)(`div`,{className:`empty`,style:{padding:32},children:[(0,o.jsx)(`div`,{className:`big`,children:`No matches`}),`Nothing in `,e.toLowerCase(),` matches “`,c.trim(),`”.`]})]})]}),(0,o.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:A?`${A} opened`:``})]})}function g({item:e,isOpen:t,href:n,children:r}){return(0,o.jsxs)(`a`,{className:`lib-row${t?` on`:``}`,href:n,"aria-current":t?`true`:void 0,"data-title":e.title||e.name,"data-pinned":e.base?`true`:void 0,children:[(0,o.jsxs)(`span`,{className:`lr-name`,children:[e.title||e.name,(0,o.jsx)(c,{status:e.status,compact:!0}),e.kit?(0,o.jsx)(f,{name:e.kit}):null,e.base?(0,o.jsx)(p,{}):null,r]}),e.desc?(0,o.jsx)(`span`,{className:`lr-desc`,children:e.desc}):null,e.meta?(0,o.jsx)(`span`,{className:`lr-meta mono`,children:e.meta}):null]})}function _({rows:e,activeName:t,hrefOf:n,pills:r}){let i=null,a=[];for(let s of e)s.group&&s.group!==i&&(i=s.group,a.push((0,o.jsxs)(`div`,{className:`lib-group`,children:[s.groupC?(0,o.jsx)(`span`,{className:`cdot`,style:{"--cc":s.groupC},"aria-hidden":`true`}):null,s.group]},`g-${s.group}`))),a.push((0,o.jsx)(g,{item:s,isOpen:t===s.name,href:n(s),children:r?.(s)},s.name));return a}function v(e){let t=[...e.currentTarget.querySelectorAll(`.lib-row`)],n=t.indexOf(document.activeElement);if(n===-1)return;let r={ArrowDown:Math.min(n+1,t.length-1),ArrowUp:Math.max(n-1,0),Home:0,End:t.length-1}[e.key];r!==void 0&&(e.preventDefault(),t[r].focus())}function y(e){if(!e)return;let t=[...e.querySelectorAll(`.lib-row`)],n=t.find(e=>e===document.activeElement)||e.querySelector(`.lib-row.on`)||t[0];for(let e of t)e.tabIndex=e===n?0:-1}function b(e){let t=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=t.current,n=e?.querySelector(`.lib-row.on`);if(!n||!e)return;let r=n.offsetTop;r>=e.scrollTop&&r+n.clientHeight<=e.scrollTop+e.clientHeight||(e.scrollTop=Math.max(0,r-e.clientHeight/2+n.clientHeight/2))},e),t}function x([e,t]){let[n,r]=(0,a.useState)(!t),[i,o]=(0,a.useState)([e,t]),[s,c]=(0,a.useState)(!1);return(i[0]!==e||i[1]!==t)&&(o([e,t]),r(s||!t),c(!1)),{list:n,setList:r,pick:()=>c(!0)}}export{m as a,c,h as i,l,_ as n,u as o,f as r,d as s,p as t};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-0ORz7tAc.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/AgentGlyph-k6o3gCM1.js"])))=>i.map(i=>d[i]);
2
- 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-DLDVY3K-.js";import{o as i}from"./motion-RlUl1osO.js";import{n as a,t as o}from"./sections-CtFz7HFH.js";import{At as s,Et as c,K as l,Q as u,T as d,U as f,_t as p,bt as m,ct as ee,it as h,mt as g,ot as te,pt as _,rt as ne,st as re,t as v,w as y}from"./index-DsLmKHw0.js";import{t as ie}from"./EmptyState-CY5Pm2xy.js";import{a as ae,c as oe,i as se,l as ce,n as le,o as ue,r as de,t as fe}from"./LibRows-Hqvf1beK.js";var b=e(t(),1),x=n();function pe({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,x.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function me({entries:e}){return e.length?(0,x.jsxs)(`table`,{className:`mf-entries`,children:[(0,x.jsx)(`thead`,{className:`sr-only`,children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{scope:`col`,children:`Path`}),(0,x.jsx)(`th`,{scope:`col`,children:`Load`}),(0,x.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,x.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,x.jsx)(`td`,{className:`mf-load-cell`,children:(0,x.jsx)(pe,{load:e.load})}),(0,x.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function he({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,x.jsxs)(`div`,{className:`mf-vault`,children:[(0,x.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,x.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,x.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,x.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,x.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,x.jsxs)(`span`,{className:`mf-role`,children:[(0,x.jsx)(m,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,x.jsxs)(`span`,{className:`mf-role`,children:[(0,x.jsx)(m,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,x.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,x.jsx)(m,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,x.jsx)(me,{entries:t})]})}function S({body:e}){let[t,n]=(0,b.useState)(!1),r=(0,b.useId)();return e?(0,x.jsxs)(`div`,{className:`mf-raw`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,x.jsx)(m,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,x.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function ge({manifest:e,body:t,name:n}){if(!e)return(0,x.jsx)(`pre`,{className:`mf-raw-pre`,children:(t||``).replace(/^```json\n|\n```$/g,``)});if(e.kind===`wiki`){let n=e.wikis||[];return n.length?(0,x.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,x.jsx)(he,{wiki:e},e.name||t)),(0,x.jsx)(S,{body:t})]}):(0,x.jsxs)(`div`,{className:`mf-empty`,children:[(0,x.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,x.jsxs)(`p`,{children:[`A wiki is your machine-wide knowledge base — an Obsidian vault or any folder of linked markdown the agent reads from and writes back to. Declare one in`,` `,(0,x.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,x.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,x.jsx)(S,{body:t})]})}let r=e.context||[];return r.length?(0,x.jsxs)(`div`,{className:`mf-doc`,children:[(0,x.jsx)(me,{entries:r}),(0,x.jsx)(S,{body:t})]}):(0,x.jsxs)(`div`,{className:`mf-empty`,children:[(0,x.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,x.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,x.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,x.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,x.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,x.jsx)(S,{body:t})]})}var C=e=>e>=1e3?`${(e/1e3).toFixed(+(e<1e4))}k`:String(e),w=e=>Math.round(e/4),T=[{key:`root`,label:`Constitution`,tone:`accent`,has:e=>e.source===`root`},{key:`catalogue`,label:`Catalogues`,tone:`muted`,has:e=>e.source===`catalogue`},{key:`agent`,label:`This agent`,tone:`warn`,has:e=>e.source!==`root`&&e.source!==`catalogue`}],_e=[[`dictate`,`Dictates`],[`doctrine`,`Doctrines`],[`user`,`User rules`]],E={"not-wired":`not wired, re-emit this install`,"no-event":`not delivered on this host`};function ve(e,t){if(!e||!t)return``;let n=(e,t)=>e.blocks.filter(e=>e.chars>0&&!t.blocks.some(t=>t.id===e.id)),r=e=>e.id===`session-files`?`session files`:e.label.replace(/^.* spec$/,`spec`);return[...n(e,t).map(e=>`+ ${r(e)} ${C(e.chars)}`),...n(t,e).map(e=>`− ${r(e)} ${C(e.chars)}`)].join(`, `)}var D=e=>e.kind===`user`?`#/personal/rules`:`#/item/law/${encodeURIComponent(e.id)}`,O=e=>`${e.layer??``}${e.id}`;function k({label:e,n:t,children:n}){return(0,x.jsxs)(`li`,{children:[(0,x.jsx)(`span`,{children:e}),n,(0,x.jsx)(`span`,{className:`mono`,children:C(t)})]})}function ye({loadout:e,base:t,error:n,install:r}){let[i,a]=(0,b.useState)(!1);if(n)return(0,x.jsx)(`p`,{className:`sub`,children:`Loadout not measured for this install.`});if(!e)return null;let o=e=>e.reduce((e,t)=>e+t.chars,0),s=o(e.blocks),c=ve(e,t),l=T.map(t=>{let n=e.blocks.filter(t.has);return{...t,blocks:n,n:o(n)}}),[u,d,p]=l,m=Math.max(1,...u.blocks.map(e=>e.chars)),ee=e.blocks.find(e=>e.id===`user-rules`),h=ee?E[ee.delivery]:void 0,g=e.rules||[],te=g.filter(e=>!(h&&e.kind===`user`)),_=g.filter(e=>e.citedBySpec),ne=[];for(let e of g){let t=e.kind===`dictate`?`Dictates`:e.kind===`user`?`User rules`:e.id.split(`.`)[0],n=ne.find(e=>e.name===t);n?n.n+=1:ne.push({name:t,n:1,user:e.kind===`user`})}let re=_e.map(([e,t])=>[t,te.filter(t=>t.kind===e).length]).filter(([,e])=>e>0);return(0,x.jsxs)(`section`,{className:`loadout`,"aria-label":`Loadout`,children:[(0,x.jsxs)(`header`,{className:`loadout-head`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`h3`,{className:`loadout-eyebrow mono`,children:[`Loadout · `,r||e.host]}),(0,x.jsxs)(`p`,{className:`loadout-total`,children:[(0,x.jsx)(`strong`,{children:C(w(s))}),(0,x.jsxs)(`span`,{className:`dim`,children:[`tokens at start · `,C(s),` chars`]})]})]}),c?(0,x.jsxs)(`div`,{className:`loadout-delta`,children:[(0,x.jsxs)(`span`,{className:`dim`,children:[`Against the `,t?.noun||`Primary agent`]}),(0,x.jsx)(`ul`,{children:c.split(`, `).map(e=>(0,x.jsx)(`li`,{className:`mono loadout-pill${e.startsWith(`+`)?` is-plus`:``}`,children:e},e))})]}):null]}),(0,x.jsxs)(`div`,{className:`loadout-bar`,children:[(0,x.jsx)(f,{label:`Loadout`,legend:!1,parts:l.map(e=>({key:e.key,label:e.label,n:e.n,tone:e.tone}))}),(0,x.jsx)(`ul`,{className:`loadout-groups`,"aria-hidden":`true`,children:l.map(e=>e.n>0?(0,x.jsxs)(`li`,{style:{flexGrow:e.n},children:[(0,x.jsx)(`span`,{children:e.label}),` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[C(e.n),` · `,Math.round(e.n/s*100),`%`]})]},e.key):null)})]}),(0,x.jsxs)(`details`,{className:`loadout-card`,open:e.agent===`primary`,children:[(0,x.jsxs)(`summary`,{children:[(0,x.jsx)(`i`,{className:`tone-accent`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`Constitution`}),(0,x.jsx)(`span`,{className:`dim`,children:`root file, loaded by the host`}),(0,x.jsxs)(`span`,{className:`mono dim loadout-sum`,children:[C(u.n),` · ≈ `,C(w(u.n)),` tok`]})]}),(0,x.jsx)(`ul`,{className:`loadout-root`,children:u.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars,children:(0,x.jsx)(`span`,{className:`loadout-mini`,"aria-hidden":`true`,children:(0,x.jsx)(`span`,{style:{width:`${Math.max(4,e.chars/m*100)}%`}})})},e.id))})]}),(0,x.jsxs)(`div`,{className:`loadout-pair`,children:[(0,x.jsxs)(`div`,{className:`loadout-card`,children:[(0,x.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,x.jsx)(`i`,{className:`tone-muted`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`Catalogues`}),(0,x.jsx)(`span`,{className:`mono dim loadout-sum`,children:C(d.n)})]}),(0,x.jsx)(`ul`,{className:`loadout-list`,children:d.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars},e.id))}),(0,x.jsx)(`p`,{className:`dim loadout-note`,children:`Listed by the host, not by Geneseed.`})]}),(0,x.jsxs)(`div`,{className:`loadout-card is-own`,children:[(0,x.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,x.jsx)(`i`,{className:`tone-warn`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`This agent`}),(0,x.jsx)(`span`,{className:`mono dim loadout-sum`,children:C(p.n)})]}),(0,x.jsx)(`ul`,{className:`loadout-list`,children:p.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars,children:e.id===`user-rules`?(0,x.jsx)(`span`,{className:`loadout-pill${h?` is-plus`:``}`,children:h||`injected at sub-agent start`}):null},e.id))})]})]}),(0,x.jsxs)(`section`,{className:`loadout-rules`,"aria-label":`Rules it follows`,children:[(0,x.jsxs)(`div`,{className:`loadout-rules-h`,children:[(0,x.jsxs)(`h4`,{className:`loadout-eyebrow mono`,children:[`Rules it follows · `,te.length]}),(0,x.jsx)(`span`,{className:`dim`,children:re.map(([e,t])=>`${t} ${e}`).join(` · `)})]}),_.length?(0,x.jsxs)(`div`,{className:`loadout-cited`,children:[(0,x.jsx)(`span`,{className:`loadout-cited-h`,children:`Cited by its spec`}),_.map(e=>(0,x.jsxs)(`a`,{href:D(e),children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` · `,e.title]},O(e)))]}):null,(0,x.jsx)(`ul`,{className:`loadout-packs`,children:ne.map(e=>e.user&&h?(0,x.jsxs)(`li`,{className:`is-muted`,children:[(0,x.jsx)(`span`,{children:`User rules`}),` `,(0,x.jsx)(`span`,{className:`mono`,children:e.n}),` `,(0,x.jsx)(`span`,{className:`dim`,children:h})]},e.name):(0,x.jsx)(`li`,{children:(0,x.jsxs)(`a`,{href:e.user?`#/personal/rules`:`#/laws`,children:[(0,x.jsx)(`span`,{children:e.name}),` `,(0,x.jsx)(`span`,{className:`mono dim`,children:e.n})]})},e.name))}),g.length?(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":i,onClick:()=>a(e=>!e),children:i?`Show fewer`:`Show all ${g.length}${h?` listed`:``} rules`}):null,i?_e.map(([e,t])=>{let n=g.filter(t=>t.kind===e),r=h&&e===`user`;return n.length?(0,x.jsxs)(`div`,{className:r?`is-muted`:void 0,children:[(0,x.jsxs)(`h5`,{className:`reader-when-h`,children:[t,` `,(0,x.jsx)(`span`,{className:`mono dim`,children:n.length}),r?(0,x.jsxs)(`span`,{className:`dim`,children:[` · `,h]}):null]}),(0,x.jsx)(`ul`,{children:n.map(e=>(0,x.jsxs)(`li`,{children:[r?(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}):(0,x.jsxs)(`a`,{href:D(e),children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}),e.layer&&e.layer!==`install`?(0,x.jsxs)(`span`,{className:`dim`,children:[` (`,e.layer,`)`]}):null]},O(e)))})]},e):null}):null]}),(0,x.jsxs)(`p`,{className:`dim loadout-foot`,children:[`Not counted: `,e.notCounted.join(`; `),`. Tokens are chars ÷ 4.`]})]})}function be({label:e,options:t,value:n,onChange:r}){let[i,a]=(0,b.useState)(!1),o=(0,b.useRef)(null),s=(0,b.useId)(),c=t.find(e=>e.key===n)||t[0],l=()=>a(!1);return(0,b.useEffect)(()=>{i&&document.getElementById(s)?.querySelector(`[aria-pressed="true"]`)?.focus()},[i,s]),(0,x.jsxs)(`span`,{className:`drop-menu`,children:[(0,x.jsxs)(`button`,{ref:o,type:`button`,className:`drop-menu-btn`,"aria-label":`${e}: ${c.label}`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-controls":i?s:void 0,onClick:()=>a(e=>!e),children:[c.label,(0,x.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,x.jsx)(re,{open:i,onClose:l,anchorRef:o,label:e,className:`drop-menu-pop`,children:(0,x.jsx)(`div`,{id:s,className:`drop-menu-list`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(document.activeElement);e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()},onBlur:e=>{let t=e.relatedTarget;t&&t!==o.current&&!e.currentTarget.closest(`.popover`)?.contains(t)&&l()},children:t.map(e=>(0,x.jsx)(`button`,{type:`button`,"aria-pressed":e.key===c.key,onClick:()=>{r(e.key),l()},children:e.label},e.key))})})]})}function xe({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,x.jsxs)(`div`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`stat-label`,children:e}),(0,x.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,x.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var Se=(0,b.lazy)(()=>v(()=>import(`./Markdown-0ORz7tAc.js`).then(e=>e.n),__vite__mapDeps([0,1,2]))),Ce=(0,b.lazy)(()=>v(()=>import(`./AgentGlyph-k6o3gCM1.js`),__vite__mapDeps([3,1,2]))),we={skills:`skill`,agents:`agent`},Te=`:primary`,Ee=(e,t)=>`${t?e/t*100:0}%`,De=e=>e.split(`:`).slice(0,2).join(` `),Oe=e=>e.split(`/`).map((e,t)=>(0,x.jsxs)(b.Fragment,{children:[t?`/`:null,t?(0,x.jsx)(`wbr`,{}):null,e]},t)),A=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},ke=e=>p(A(e));function Ae(e,t){return e===`memory`?`memory/${t}`:e===`notebook`?`notebook/${t}`:e===`wiki`?`geneseed-wiki.jsonc`:e===`config`?t:e===`skills`?`skills/${t}/SKILL.md`:`${e}/${t}.md`}function je({section:e,source:t}){return(0,x.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,x.jsx)(m,{name:a[e].icon,className:`glyph`}),(0,x.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,x.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var Me=e=>e.replace(/\s+/g,` `).trim(),Ne=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Pe(e,t){let n=e.replace(/\r\n/g,`
3
- `),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=Ne(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?Me(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?Me(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=Ne(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function Fe({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,x.jsx)(`div`,{className:`lib-stats`,children:(0,x.jsx)(xe,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(De))].join(`, `),i=t.days_counted>=30?`in the last 30 days`:`since ${t.since}`,a=Math.max(1,...e.per_day),o=[e.last?`last used ${e.last}`:null,i,r?`on ${r}`:null].filter(Boolean).join(` · `);return(0,x.jsx)(`div`,{className:`lib-stats`,children:(0,x.jsx)(xe,{label:`Used`,value:e.n,delta:o,children:(0,x.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,x.jsx)(`i`,{className:t===29?`today`:``,style:{height:Ee(e,a)}},t))})})})}function Ie(e){let t=/\s*\bUse when:\s*/i.exec(e||``);if(!t)return{lede:e||``,when:``};let n=e.slice(t.index+t[0].length).trim();return{lede:e.slice(0,t.index).trim(),when:n&&n[0].toUpperCase()+n.slice(1)}}var Le={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},Re=(e,t)=>t||(e&&o.includes(e)?e:o[0]),ze=encodeURIComponent;function Be(e){let t=e=>y[e.klass]?e.klass:`personal`,n=d.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:y[n].label,groupC:y[n].c})));return{rows:n,cats:d.map(e=>({key:e,label:y[e].label,c:y[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ve(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function j({overview:e,section:t,selected:n,dataRev:i,lock:d,base:f,onRulesChanged:p,onCountsChanged:m}){let re=ee(),[v,pe]=(0,b.useState)(()=>Re(t,d)),[me,he]=(0,b.useState)(``),[S,C]=(0,b.useState)(`all`),[w,T]=(0,b.useState)(`all`),[_e,E]=(0,b.useState)(``),[ve,D]=(0,b.useState)(null),[O,k]=(0,b.useState)(null),[xe,De]=(0,b.useState)(t);if(t!==xe){De(t),E(``);let e=Re(t,d);e!==v&&(pe(e),he(``),C(`all`),T(`all`))}let[Me,Ne]=(0,b.useState)(n);n!==Me&&(Ne(n),E(``));let{data:j,error:He,reload:Ue}=c(()=>r.catalog(v),[v,i],`catalog`),We=d?null:we[v]||null,Ge=We!==null,{data:M}=c(()=>Ge?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[Ge,i],`usage`,{revalidate:!0}),N=Ge&&!!M?.enabled&&Array.isArray(M.names),Ke=(0,b.useMemo)(()=>new Map((Array.isArray(M?.names)?M.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[M]),qe=e=>N&&Ke.get(`${We}\u0000${e}`)||null,Je=e=>{let t=qe(e.name);return!t||t.n===0&&!t.last},Ye=M?.since?`No call since ${M.since}`:`No call recorded yet`,P=j?.section===v,F=P&&j?.items||[],Xe=!P&&!He,[Ze,...Qe]=P&&j.sharedInstalls||[],I=e=>e===Ze?`shared`:ke(e),L=v===`skills`,$e=L?Be(F):null,R=L?$e.rows:v===`memory`?Ve(F):F,z=n||R[0]?.name||null,B=v===`agents`&&!d,V=B&&z===`:primary`,{data:et}=c(()=>B?Promise.resolve().then(()=>r.loadout()).catch(()=>null):Promise.resolve(null),[B,i],`loadout-primary`),tt=B?{name:Te,type:`agent`,base:!0,title:et?.noun||`Primary agent`,desc:`The main agent of the session. Every agent inherits its root file.`}:null,nt=V?tt:z?F.find(e=>e.name===z):null,rt=nt?.type||a[v].type,H=O?.sec===v&&O?.name===z?O.key:null,{data:it,error:U}=c(()=>!z||V?Promise.resolve(null):H?r.item(rt,z,A(H)):r.item(rt,z),[v,z,rt,H,i,V]),W=U?null:it,at=W&&W.name===z&&(!H||W.install===H)?W:null,ot=e=>q&&e?.install?` in ${I(e.install)}`:``,G=V?null:H||W?.install||null,st=B&&z&&(V||W&&W.name===z),{data:ct,error:lt}=c(()=>st?V?r.loadout().then(e=>({own:e,base:null})):Promise.all([r.loadout(z,G?A(G):void 0),r.loadout(void 0,G?A(G):void 0).catch(()=>null)]).then(([e,t])=>({own:e,base:t})):Promise.resolve(null),[st,z,G,i]),ut=_e||He||U,dt=z?{name:z,title:W?.title||z,desc:W?.desc||``}:null,K=nt||dt,ft=t=>t===v&&P?F.length:e?.counts?.[t]??``,pt=u(i),mt=G||pt?.[0]?.id,ht=mt?ke(mt):void 0,q=new Set(F.flatMap(e=>e.installs||[])).size>1,gt=g([...(pt||[]).map(e=>e.id),...F.flatMap(e=>e.installs||[])],Qe),J=L?R.filter(e=>S===`all`||e.cat===S):R,_t=N?J.filter(Je).length:0,vt=e=>e.status===`experimental`,yt=J.filter(vt).length,Y=[[`all`,`All`,J.length],...N?[[`used`,`Used`,J.length-_t],[`unused`,`Not used yet`,_t,Ye]]:[],...yt?[[`experimental`,`Experimental`,yt,`Shipped, not yet confirmed by real use`]]:[]],X=Y.some(([e])=>e===w)?w:`all`,bt=X===`all`?J:X===`experimental`?J.filter(vt):J.filter(e=>Je(e)===(X===`unused`)),xt=N?Math.max(0,...F.map(e=>qe(e.name)?.n||0)):0,St=L?1/0:50,Z=me.trim().toLowerCase(),Q=Z?ae(bt,Z):bt.slice(0,St),Ct=!Z&&S===`all`&&X===`all`&&z&&!Q.some(e=>e.name===z)?[...Q,...R.filter(e=>e.name===z)]:Q,wt=e=>f?`${f}/${ze(e.name)}`:`#/item/${e.type||a[v].type}/${ze(e.name)}`,Tt=async()=>{let e=at;if(!e)return;let t=e.name;if(await re(`Forget the memory fact "${t}"${ot(e)}? It leaves the index and moves to memory/archive/ (geneseed memory rm --archived --purge deletes it for good).`,{title:`Forget this fact?`,confirmLabel:`Forget`,tone:`danger`})){E(``);try{await r.memoryDelete(t,e.install?A(e.install):void 0)}catch(e){E(`Could not forget "${t}": ${e.message}`);return}s(f||`#/personal/memory`),Ue(),m?.()}},Et=async()=>{let e=at;if(!e)return;let t=e.name;if(await re(`Promote "${t}"${ot(e)} into a standing rule? It is appended to user-rules.md as a trial rule (a month of probation), and the memory fact moves to memory/archive/ so the lesson isn't loaded twice.`,{title:`Promote to a rule?`,confirmLabel:`Promote`})){E(``);try{let n=e.install?A(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),l(),p?.(),m?.(),s(`#/personal/rules`)}catch(e){E(`Could not promote: ${e.message}`),Ue()}}},Dt=W?.body?Pe(W.body,W.desc||K?.desc):null,Ot=W?.title||K?.title||K?.name,kt=Ot===K?.name&&Dt?.title?Dt.title:Ot,At=P&&F.length===0,jt=W?.status||K?.status,Mt=v===`skills`?y[nt?.klass]:null,Nt=a[v].label,{lede:Pt,when:Ft}=Ie(W?.desc||K?.desc||``),$=K&&!V?W?.source||K.source||(U?null:Ae(v,K.name)):null,It=async()=>{try{await navigator.clipboard.writeText($),D({src:$,ok:!0})}catch{D({src:$,ok:!1})}};return(0,x.jsxs)(`div`,{className:`lib-wrap`,children:[(0,x.jsx)(ne,{error:ut,style:{margin:`0 0 var(--sp-3)`}}),(0,x.jsxs)(`div`,{className:`library lib-dossier${d?` locked`:``}${N?` uses`:``}`,children:[d?null:(0,x.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,x.jsxs)(`div`,{className:`lib-title`,children:[(0,x.jsx)(`h1`,{className:`h`,children:`Library`}),(0,x.jsx)(`span`,{className:`dim`,children:`What the agent knows`}),N&&M.since?(0,x.jsxs)(`span`,{className:`mono dim lib-title-since`,children:[`calls since `,M.since]}):null]}),(0,x.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,x.jsxs)(b.Fragment,{children:[(0,x.jsxs)(`a`,{href:`#/section/${e}`,className:v===e?`on`:``,"aria-current":v===e?`page`:void 0,children:[a[e].label,(0,x.jsx)(`span`,{className:`mono dim`,children:ft(e)})]}),e===v&&L&&P&&(0,x.jsx)(ue,{label:`Skill types`,total:F.length,cats:$e.cats,cat:S,onChange:C})]},e))})]}),(0,x.jsxs)(se,{label:Nt,count:P?Z?`${Q.length} of ${bt.length}`:bt.length:``,q:me,onQ:he,matched:Q.length,inView:[v,n],current:K?kt:void 0,sections:d?void 0:o.map(e=>({key:e,label:a[e].label,n:ft(e),href:`#/section/${e}`,on:v===e})),cats:L&&P?$e.cats:null,cat:S,total:F.length,onCat:C,catLabel:`Skill types`,extra:(0,x.jsxs)(x.Fragment,{children:[N&&M.since?(0,x.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,M.since]}):null,(0,x.jsxs)(`span`,{className:`lib-legend mono`,children:[q?gt.map((e,t)=>(0,x.jsxs)(`span`,{className:`lk-install`,title:A(e).path,children:[(0,x.jsx)(`i`,{className:`lr-dot`,style:_(t),"aria-hidden":`true`}),I(e)]},e)):null,(0,x.jsx)(ce,{items:F})]})]}),toolsCompact:P&&Y.length>1?(0,x.jsx)(be,{label:`Show`,options:Y.map(([e,t])=>({key:e,label:e===`all`?`All uses`:t})),value:X,onChange:T}):void 0,tools:P&&Y.length>1?(0,x.jsx)(te,{"aria-label":`Show`,children:Y.map(([e,t,n,r])=>(0,x.jsxs)(`button`,{type:`button`,className:X===e?`on`:``,"aria-pressed":X===e,title:r,onClick:()=>T(e),children:[t,` `,(0,x.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[Xe?(0,x.jsx)(h,{}):null,(0,x.jsx)(le,{rows:tt&&P?[tt,...Ct]:Ct,activeName:K?.name,hrefOf:wt,pills:N||q?e=>{let t=qe(e.name)?.n||0,n=q?(0,x.jsx)(`span`,{className:`lr-dots`,children:gt.map((t,n)=>e.installs?.includes(t)?(0,x.jsx)(`span`,{className:`lr-dot lr-install`,style:_(n),title:`${I(t)} — ${A(t).path}`,children:(0,x.jsx)(`span`,{className:`sr-only`,children:I(t)})},t):(0,x.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return N?(0,x.jsxs)(x.Fragment,{children:[n,(0,x.jsxs)(`span`,{className:`lr-use`,children:[(0,x.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,x.jsx)(`i`,{style:{width:Ee(t,xt)}})}),(0,x.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,x.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!Z&&F.length>St&&(0,x.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,St,` of `,F.length,`; type to search the rest.`]}),At&&(v===`wiki`?(0,x.jsxs)(ie,{title:`No wiki entries`,action:(0,x.jsx)(`a`,{href:`#/section/config`,children:`Open the setup files`}),docs:{href:`#/docs/wiki`,label:`How to configure a wiki →`},children:[`Declare a wiki in `,(0,x.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,x.jsx)(ie,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,x.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:K?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:Nt.replace(/s$/,``)}),V?(0,x.jsx)(fe,{}):null,Mt?(0,x.jsx)(`span`,{className:`tag`,children:Mt.label}):null,W?.kit??K.kit?(0,x.jsx)(de,{name:W?.kit??K.kit}):null,(0,x.jsx)(oe,{status:jt,withHint:!0}),$?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`mono dim reader-src`,children:Oe($)}),(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:It,children:ve?.src===$?ve.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,x.jsxs)(`div`,{className:`reader-head`,children:[(0,x.jsx)(`h2`,{className:`reader-title`,children:kt}),v===`agents`&&!V?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(Ce,{name:K.name})}):null]}),(0,x.jsxs)(`div`,{className:`reader-intro${N?` with-stats`:``}`,children:[(0,x.jsxs)(`div`,{className:`reader-intro-text`,children:[Pt?(0,x.jsx)(`p`,{className:`reader-lede`,children:Pt}):null,Ft?(0,x.jsxs)(`section`,{className:`reader-when`,children:[(0,x.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,x.jsx)(`p`,{children:Ft})]}):null]}),N?(0,x.jsx)(Fe,{u:qe(K.name),usage:M,noCall:Ye}):null]}),v===`memory`&&at&&K.name!==`MEMORY`&&K.name!==`README`&&(0,x.jsxs)(`div`,{className:`row gap-8`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Et,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Tt,children:`Forget this fact`})]}),W?.installs?.length>1&&W.installs.includes(W.install)?(0,x.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,x.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,x.jsx)(`select`,{className:`sel`,"aria-label":`Install`,value:H||W.install,onChange:e=>k({sec:v,name:z,key:e.target.value}),children:W.installs.map(e=>(0,x.jsx)(`option`,{value:e,title:A(e).path,children:I(e)},e))}),(0,x.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,x.jsx)(`hr`,{className:`hr`}),B?(0,x.jsx)(ye,{loadout:ct?.own,base:ct?.base,error:lt,install:ht}):null,V?null:U?(0,x.jsxs)(`p`,{className:`sub`,children:[`No `,Nt.replace(/s$/,``).toLowerCase(),` named `,(0,x.jsx)(`em`,{children:K.name}),` could be read in this install.`]}):K?.kind===`manifest`||W?.manifest!==void 0?W?(0,x.jsx)(ge,{manifest:W.manifest,body:W.body,name:K.name}):(0,x.jsx)(h,{}):W?.body?(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(Se,{body:Dt.body,links:W.links||[]})})}):W===null&&z?(0,x.jsx)(h,{}):(0,x.jsx)(je,{section:v,source:Ae(v,K.name)}),Le[v]?(0,x.jsx)(`div`,{className:`reader-links`,children:(0,x.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${Le[v]}`,children:[`About `,Nt.toLowerCase(),` in Docs`]})}):null]}):Xe?(0,x.jsx)(h,{}):null})]})]})}export{Te as PRIMARY,Pe as bodyHead,j as default,Ve as groupMemory,ke as installLabel,A as installOfKey,Be as splitSkills,Ie as splitWhen};