geneseed 4.30.1 → 4.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/SHIPPED.md +1 -1
  3. package/docs/concepts/footprint.md +1 -1
  4. package/docs/reference/plugin-activity.md +1 -1
  5. package/docs/web-ui.md +70 -21
  6. package/harness.config.json +1 -1
  7. package/js/README.md +3 -3
  8. package/js/web/actions.mjs +13 -23
  9. package/js/web/activity.mjs +139 -23
  10. package/js/web/api.mjs +29 -11
  11. package/js/web/catalog.mjs +108 -23
  12. package/js/web/handler.mjs +4 -3
  13. package/js/web/routes.mjs +47 -14
  14. package/js/web/server.mjs +14 -13
  15. package/js/web/state.mjs +36 -15
  16. package/js/web/usage-api.mjs +7 -3
  17. package/package.json +1 -1
  18. package/web/dist/assets/Activity-B7cFtS00.js +1 -0
  19. package/web/dist/assets/ActivityDetail-C-GbMmuW.js +1 -0
  20. package/web/dist/assets/{Bonsai-CN4rRAHc.js → Bonsai-_YyexVC5.js} +1 -1
  21. package/web/dist/assets/{CopyButton-CYljsnLo.js → CopyButton-IXnXzH4Y.js} +1 -1
  22. package/web/dist/assets/{Dashboard-DkUm4XMu.js → Dashboard-sCfEjowQ.js} +2 -2
  23. package/web/dist/assets/{Docs-DE04qOKj.js → Docs-w3Y7M5Ts.js} +2 -2
  24. package/web/dist/assets/{GreenhouseView-DPwhFO_j.js → GreenhouseView-BWWbMKmg.js} +1 -1
  25. package/web/dist/assets/Installs-CnkdJ-VA.js +3 -0
  26. package/web/dist/assets/{JournalView-DQlDC-7i.js → JournalView-C7bPD3fZ.js} +1 -1
  27. package/web/dist/assets/{KitApply-BN2Az7dc.js → KitApply-CQQbnThf.js} +1 -1
  28. package/web/dist/assets/{Kits-C9qVd466.js → Kits-aj07N7mT.js} +1 -1
  29. package/web/dist/assets/Laws-DZ38nl_H.js +3 -0
  30. package/web/dist/assets/Library-QCGXPV5h.js +2 -0
  31. package/web/dist/assets/Loops-C5u7fQOR.js +2 -0
  32. package/web/dist/assets/{OperatorHudView-CLN6Qn25.js → OperatorHudView-Blu1lqiZ.js} +1 -1
  33. package/web/dist/assets/Personal-ox_MktWO.js +2 -0
  34. package/web/dist/assets/Tabs-CIPyMAX-.js +1 -0
  35. package/web/dist/assets/api-BxjLd7Qd.js +1 -0
  36. package/web/dist/assets/index-0GCxkY7m.css +1 -0
  37. package/web/dist/assets/index-CzDi9JpF.js +3 -0
  38. package/web/dist/index.html +3 -3
  39. package/web/dist/assets/Activity-C8pQvnos.js +0 -1
  40. package/web/dist/assets/ActivityDetail-D_8Bx-QO.js +0 -1
  41. package/web/dist/assets/Installs-DmPzD4BW.js +0 -3
  42. package/web/dist/assets/Laws-T2wbwMmB.js +0 -3
  43. package/web/dist/assets/Library-t3KocV0-.js +0 -2
  44. package/web/dist/assets/Loops-6lNY-9uR.js +0 -2
  45. package/web/dist/assets/Personal-xjoSqCzr.js +0 -2
  46. package/web/dist/assets/Tabs-DaExAgql.js +0 -1
  47. package/web/dist/assets/api-LvBC0CnK.js +0 -1
  48. package/web/dist/assets/index-DhNNxhfg.js +0 -3
  49. package/web/dist/assets/index-XTGBLKQr.css +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{J as i,R as a,W as o,Y as s,pt as c}from"./index-DhNNxhfg.js";import{t as l}from"./EmptyState-1sPNleqv.js";import{t as u}from"./Markdown-DpmmtW2Y.js";import{a as d,i as f,l as p,n as m,o as h,r as g,t as _}from"./KitApply-BN2Az7dc.js";import{t as v}from"./DataTable-BWbUx4bY.js";var y=e(t(),1),b=n(),x=encodeURIComponent,S=e=>(e||``).split(/\s+/).filter(Boolean).length,C=e=>[...new Set(e.filter(Boolean))],w=e=>(e||``).slice(0,7),T=(e,t)=>e?`Not in the install the topbar views; on in ${e} of ${O(t,`install`)}`:`Installed when this kit is on`,E=({type:e,names:t,listed:n,offNote:r=T(0)})=>t.length?(0,b.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,b.jsx)(`li`,{children:n?.has(t)?(0,b.jsx)(`a`,{href:`#/item/${e}/${x(t)}`,children:t}):(0,b.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,b.jsx)(`p`,{className:`panel-note`,children:`None.`});function D({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=T(t.filter(t=>d(t).includes(e.name)).length,t.length);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`reader-tags`,children:[(0,b.jsx)(`span`,{className:`tag acc`,children:`Kit`}),C(i.map(e=>e.license)).map(e=>(0,b.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,b.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,b.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,b.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,b.jsx)(`hr`,{className:`hr`}),(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,b.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=f(t),i=`${t.host} · ${t.scope}`;return(0,b.jsxs)(`li`,{className:`kit-install`,children:[(0,b.jsxs)(`div`,{className:`kit-row`,children:[(0,b.jsxs)(`div`,{className:`kit-main`,children:[(0,b.jsx)(`b`,{children:i}),(0,b.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,b.jsx)(m,{row:t}),(0,b.jsx)(p,{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,b.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,b.jsx)(_,{row:t,stage:n})]},t.id)})}):(0,b.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,b.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{children:e.author||e.repo}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,b.jsxs)(`span`,{className:`mono dim`,children:[`@ `,w(e.commit)]}):null,e.compareUrl?(0,b.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${w(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,b.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,b.jsx)(E,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,b.jsx)(E,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,b.jsxs)(`span`,{className:`mono dim`,children:[S(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,b.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,b.jsx)(u,{body:e.rules})})]}):null,e.banned?.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,b.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var O=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,k=e=>`${e.host} · ${e.scope}`;function A(e,t,n){let r=d(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 j({kit:e,installs:t,stage:n,listed:r,max:i}){let o=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...A(n,t,e.name)})),u=l.filter(t=>d(t.row).includes(e.name)).length,f=l.filter(e=>e.staged).length,p=T(u,t.length),m=`on in ${u} of ${O(t.length,`install`)}${f?` · ${f} staged`:``}`;return(0,b.jsxs)(`article`,{className:`kit-card${f?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,b.jsxs)(`header`,{className:`kit-card-head`,children:[(0,b.jsxs)(`div`,{className:`kit-main`,children:[(0,b.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,b.jsx)(`a`,{className:`kit-name`,href:`#/kits/${x(e.name)}`,children:e.name})}),e.description?(0,b.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),C(o.map(e=>e.license)).map(e=>(0,b.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,b.jsxs)(`div`,{className:`kit-counts`,children:[(0,b.jsx)(`span`,{children:`Skills`}),(0,b.jsx)(a,{value:s.length,max:i,label:`Skills`}),(0,b.jsx)(`span`,{className:`mono`,children:s.length}),(0,b.jsx)(`span`,{children:`Agents`}),(0,b.jsx)(a,{value:c.length,max:i,label:`Agents`}),(0,b.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,b.jsx)(E,{type:`skill`,names:s,listed:r?.skills,offNote:p}):null,c.length?(0,b.jsx)(E,{type:`agent`,names:c,listed:r?.agents,offNote:p}):null,(0,b.jsxs)(`footer`,{className:`kit-card-foot`,children:[o.length?(0,b.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,o.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t?`, `:null,(0,b.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,b.jsx)(`span`,{}),t.length?(0,b.jsxs)(`span`,{className:`kit-where`,children:[(0,b.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${k(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,b.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${k(e.row)}: ${e.note}`},e.row.id))}),(0,b.jsx)(`span`,{className:`mono dim`,children:m})]}):null]})]})}function M({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,b.jsxs)(`div`,{className:`kit-main`,children:[(0,b.jsx)(`b`,{children:k(e)}),(0,b.jsx)(`span`,{className:`mono dim`,children:e.path}),f(e)?(0,b.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=A(n,t,e.name);return(0,b.jsxs)(`span`,{className:`kit-cell`,children:[(0,b.jsx)(p,{on:r.now,disabled:f(t)||n.running(t),label:`${e.name} for ${k(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,b.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,b.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,b.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,b.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,b.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,b.jsx)(`span`,{className:`dim`,children:`Each row describes that install, not the one selected in the topbar.`})]}),t.length?(0,b.jsx)(v,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,b.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function N({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,b.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,b.jsx)(`b`,{children:a?`${O(a,`change`)} on ${O(r.length,`install`)}`:`No staged changes`}),i?(0,b.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[k(i),`: `,g(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,b.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,b.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${k(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,b.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${k(i)}`:`Apply and rebuild kits`,disabled:!i||f(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 P({item:e,onAction:t,dataRev:n}){let{data:a,error:u}=c(()=>r.kits(),[n]),d=h(a,t),{data:f}=c(()=>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]),p=a?.kits||[],m=a?.installs||[],g=u||a?.error;if(e){let t=p.find(t=>t.name===e);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,b.jsx)(i,{error:g,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,b.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,b.jsx)(D,{kit:t,installs:m,stage:d,listed:f})}):(0,b.jsxs)(l,{title:`No such kit`,action:(0,b.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):g?null:(0,b.jsx)(s,{})]})}let _=Math.max(1,...p.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o,{eyebrow:a?`${O(p.length,`kit`)} · ${O(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,b.jsx)(i,{error:g,style:{margin:`0 0 var(--sp-3)`}}),a?p.length===0?g?null:(0,b.jsx)(l,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,b.jsxs)(`div`,{className:`kit-page-body`,children:[(0,b.jsx)(`div`,{className:`kit-gallery`,children:p.map(e=>(0,b.jsx)(j,{kit:e,installs:m,stage:d,listed:f,max:_},e.name))}),(0,b.jsx)(M,{kits:p,installs:m,stage:d}),m.length?(0,b.jsx)(N,{installs:m,stage:d}):null]}):g?null:(0,b.jsx)(s,{})]})}export{P as default};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BxjLd7Qd.js";import{J as i,R as a,W as o,Y as s,bt as c}from"./index-CzDi9JpF.js";import{t as l}from"./EmptyState-1sPNleqv.js";import{t as u}from"./Markdown-DpmmtW2Y.js";import{a as d,i as f,l as p,n as m,o as h,r as g,t as _}from"./KitApply-CQQbnThf.js";import{t as v}from"./DataTable-BWbUx4bY.js";var y=e(t(),1),b=n(),x=encodeURIComponent,S=e=>(e||``).split(/\s+/).filter(Boolean).length,C=e=>[...new Set(e.filter(Boolean))],w=e=>(e||``).slice(0,7),T=(e,t)=>e?`Not in the install the topbar views; on in ${e} of ${O(t,`install`)}`:`Installed when this kit is on`,E=({type:e,names:t,listed:n,offNote:r=T(0)})=>t.length?(0,b.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,b.jsx)(`li`,{children:n?.has(t)?(0,b.jsx)(`a`,{href:`#/item/${e}/${x(t)}`,children:t}):(0,b.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,b.jsx)(`p`,{className:`panel-note`,children:`None.`});function D({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=T(t.filter(t=>d(t).includes(e.name)).length,t.length);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`reader-tags`,children:[(0,b.jsx)(`span`,{className:`tag acc`,children:`Kit`}),C(i.map(e=>e.license)).map(e=>(0,b.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,b.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,b.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,b.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,b.jsx)(`hr`,{className:`hr`}),(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,b.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=f(t),i=`${t.host} · ${t.scope}`;return(0,b.jsxs)(`li`,{className:`kit-install`,children:[(0,b.jsxs)(`div`,{className:`kit-row`,children:[(0,b.jsxs)(`div`,{className:`kit-main`,children:[(0,b.jsx)(`b`,{children:i}),(0,b.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,b.jsx)(m,{row:t}),(0,b.jsx)(p,{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,b.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,b.jsx)(_,{row:t,stage:n})]},t.id)})}):(0,b.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,b.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,b.jsxs)(y.Fragment,{children:[(0,b.jsx)(`dt`,{children:e.author||e.repo}),(0,b.jsxs)(`dd`,{children:[(0,b.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,b.jsxs)(`span`,{className:`mono dim`,children:[`@ `,w(e.commit)]}):null,e.compareUrl?(0,b.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${w(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,b.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,b.jsx)(E,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,b.jsx)(E,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,b.jsxs)(`span`,{className:`mono dim`,children:[S(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,b.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,b.jsx)(u,{body:e.rules})})]}):null,e.banned?.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,b.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,b.jsx)(`li`,{children:(0,b.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var O=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,k=e=>`${e.host} · ${e.scope}`;function A(e,t,n){let r=d(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 j({kit:e,installs:t,stage:n,listed:r,max:i}){let o=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...A(n,t,e.name)})),u=l.filter(t=>d(t.row).includes(e.name)).length,f=l.filter(e=>e.staged).length,p=T(u,t.length),m=`on in ${u} of ${O(t.length,`install`)}${f?` · ${f} staged`:``}`;return(0,b.jsxs)(`article`,{className:`kit-card${f?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,b.jsxs)(`header`,{className:`kit-card-head`,children:[(0,b.jsxs)(`div`,{className:`kit-main`,children:[(0,b.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,b.jsx)(`a`,{className:`kit-name`,href:`#/kits/${x(e.name)}`,children:e.name})}),e.description?(0,b.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),C(o.map(e=>e.license)).map(e=>(0,b.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,b.jsxs)(`div`,{className:`kit-counts`,children:[(0,b.jsx)(`span`,{children:`Skills`}),(0,b.jsx)(a,{value:s.length,max:i,label:`Skills`}),(0,b.jsx)(`span`,{className:`mono`,children:s.length}),(0,b.jsx)(`span`,{children:`Agents`}),(0,b.jsx)(a,{value:c.length,max:i,label:`Agents`}),(0,b.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,b.jsx)(E,{type:`skill`,names:s,listed:r?.skills,offNote:p}):null,c.length?(0,b.jsx)(E,{type:`agent`,names:c,listed:r?.agents,offNote:p}):null,(0,b.jsxs)(`footer`,{className:`kit-card-foot`,children:[o.length?(0,b.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,o.map((e,t)=>(0,b.jsxs)(y.Fragment,{children:[t?`, `:null,(0,b.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,b.jsx)(`span`,{}),t.length?(0,b.jsxs)(`span`,{className:`kit-where`,children:[(0,b.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${k(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,b.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${k(e.row)}: ${e.note}`},e.row.id))}),(0,b.jsx)(`span`,{className:`mono dim`,children:m})]}):null]})]})}function M({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,b.jsxs)(`div`,{className:`kit-main`,children:[(0,b.jsx)(`b`,{children:k(e)}),(0,b.jsx)(`span`,{className:`mono dim`,children:e.path}),f(e)?(0,b.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=A(n,t,e.name);return(0,b.jsxs)(`span`,{className:`kit-cell`,children:[(0,b.jsx)(p,{on:r.now,disabled:f(t)||n.running(t),label:`${e.name} for ${k(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,b.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,b.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,b.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,b.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,b.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,b.jsx)(`span`,{className:`dim`,children:`Each row describes that install, not the one selected in the topbar.`})]}),t.length?(0,b.jsx)(v,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,b.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function N({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,b.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,b.jsx)(`b`,{children:a?`${O(a,`change`)} on ${O(r.length,`install`)}`:`No staged changes`}),i?(0,b.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[k(i),`: `,g(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,b.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,b.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${k(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,b.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${k(i)}`:`Apply and rebuild kits`,disabled:!i||f(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 P({item:e,onAction:t,dataRev:n}){let{data:a,error:u}=c(()=>r.kits(),[n]),d=h(a,t),{data:f}=c(()=>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]),p=a?.kits||[],m=a?.installs||[],g=u||a?.error;if(e){let t=p.find(t=>t.name===e);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,b.jsx)(i,{error:g,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,b.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,b.jsx)(D,{kit:t,installs:m,stage:d,listed:f})}):(0,b.jsxs)(l,{title:`No such kit`,action:(0,b.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):g?null:(0,b.jsx)(s,{})]})}let _=Math.max(1,...p.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o,{eyebrow:a?`${O(p.length,`kit`)} · ${O(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,b.jsx)(i,{error:g,style:{margin:`0 0 var(--sp-3)`}}),a?p.length===0?g?null:(0,b.jsx)(l,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,b.jsxs)(`div`,{className:`kit-page-body`,children:[(0,b.jsx)(`div`,{className:`kit-gallery`,children:p.map(e=>(0,b.jsx)(j,{kit:e,installs:m,stage:d,listed:f,max:_},e.name))}),(0,b.jsx)(M,{kits:p,installs:m,stage:d}),m.length?(0,b.jsx)(N,{installs:m,stage:d}):null]}):g?null:(0,b.jsx)(s,{})]})}export{P as default};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BxjLd7Qd.js";import{$ as i,Dt as a,G as o,H as s,J as c,K as l,Q as u,R as d,W as f,X as p,Y as m,_ as h,bt as g,d as _,f as v,ft as y,g as b,h as ee,m as te,p as ne,pt as x,v as S,vt as C,y as w}from"./index-CzDi9JpF.js";import{t as re}from"./EmptyState-1sPNleqv.js";import{t as ie}from"./FilterInput-CZREvrjX.js";import{t as ae}from"./Markdown-DpmmtW2Y.js";var T=e(t(),1);function oe({items:e,packs:t,install:n,canApply:r,onAction:a,gateArmed:s}){let c=i(),u=e.filter(e=>e.tier===`doctrine`&&e.active!==!1).map(e=>e.name),d=u.join(`,`),f=l(),p=n?`${n.host}:${n.scope}:${n.path}`:``,m=o(u),{prune:h}=f,g=e.length>0;(0,T.useEffect)(()=>{g&&h(`rules`,(e,t)=>e===p&&t.base!==m)},[g,p,m,h]);let _=f.get(`rules`,p),v=_&&_.base===m?_.value:u,y=e=>f.put(`rules`,p,e(v),m),b=e=>v.includes(e),ee=e=>y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),te=e=>e.rules.some(e=>b(e.addr)),ne=e=>{let t=e.rules.map(e=>e.addr),n=e.rules.every(e=>b(e.addr));y(e=>n?e.filter(e=>!t.includes(e)):[...new Set([...e,...t])])},x=e=>{let t=e.rules.filter(e=>b(e.addr)).length;return t?e.active?`${t} of ${e.rules.length} active`:`staged on · ${t} of ${e.rules.length}`:e.active?`staged off`:`not built in`},S=t.flatMap(e=>e.rules.map(e=>e.addr)),C=S.filter(b),w=C.join(`,`)!==d,re=`process.5`,ie=u.includes(re)&&!v.includes(re);return{deployedRules:u,isOn:b,toggleRule:ee,packOn:te,togglePack:ne,packState:x,allRules:S,pickedRules:C,dirty:w,losingConsent:ie,applyPacks:async()=>{if(!r||!w)return;let e=t.filter(e=>e.rules.some(e=>b(e.addr))).map(e=>e.pack),i=t.filter(t=>e.includes(t.pack)).flatMap(e=>e.rules.filter(e=>!b(e.addr)).map(e=>e.addr)),o=ie?`
2
+
3
+ process 5 carries commit/push consent. Dropping it also removes the git-gate hook, so commits and pushes stop being confirmed at the tool boundary. `+(s?`(Real data loss stays gated: that is Rule IV’s, not the pack’s.)`:`(Rule IV’s deletion gate is off on this install, so real data loss is not asked about either.)`):``,l=C.length?`${C.length} of ${S.length} doctrine rules`:`no doctrine rules`;await c(`Rebuild ${n.host} · ${n.scope} with ${l}? It rebuilds in place, non-destructive.${o}`,{title:`Rebuild with these rules?`,confirmLabel:`Rebuild`})&&await a(`install`,{...n,doctrines:e,excludeRules:i})&&f.startApply(`rules`,p)},revert:()=>f.drop(`rules`,p)}}var E=n();function D({addr:e,isOpen:t,onToggle:n,className:i,style:a,head:o,label:s,rev:l,toggleCol:u=null,renderBody:d,srcLine:f}){let p=(0,T.useId)(),{data:m,error:h,reload:_}=g(()=>t?r.item(`law`,e):Promise.resolve(null),[t,e,l],`law-item`),v=t&&(0,E.jsxs)(`div`,{className:`law-expand`,id:p,children:[h?(0,E.jsx)(c,{error:h,onRetry:_}):m?d(m):(0,E.jsx)(`p`,{className:`dim`,children:`Loading…`}),(0,E.jsx)(`div`,{className:`law-srcline`,children:f})]}),y={type:`button`,onClick:n,"aria-expanded":t,"aria-controls":p,"aria-label":s};return u?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:i,style:a,"data-addr":e,children:[(0,E.jsx)(`button`,{className:`law-disclosure`,...y,children:o}),(0,E.jsx)(`span`,{className:`toggle-col`,children:u})]}),v]}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`button`,{className:i,style:a,"data-addr":e,...y,children:o}),v]})}function se({law:e,isOpen:t,onToggle:n,rev:r,toggleCol:i=null}){let a=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`span`,{className:`law-no`,children:[(0,E.jsx)(`span`,{className:`x`,"aria-hidden":`true`,children:`›`}),e.no]}),(0,E.jsxs)(`span`,{className:`law-name`,children:[(0,E.jsx)(`span`,{children:e.name}),e.ess?(0,E.jsx)(`span`,{className:`law-princ`,children:e.ess}):null,e.asks?(0,E.jsx)(`span`,{className:`law-asks mono`,children:e.asks}):null]}),(0,E.jsx)(`span`,{className:`law-latin`,children:e.latin}),(0,E.jsx)(`span`,{className:`law-status ${e.statusTone}`,children:e.status}),(0,E.jsx)(`span`,{className:`law-enf${e.enf===`Hook gate`?` hook`:e.enf===`Gate off`?` gate-off`:``}`,children:e.enf})]});return(0,E.jsx)(D,{addr:e.addr,isOpen:t,onToggle:n,className:`law-row${i?` has-toggle`:``}${t?` on`:``}${e.off?` law-off`:``}`,style:{"--cc":e.c},head:a,label:`${e.no?e.no+` `:``}${e.name}, ${e.status}, ${e.enf}`,rev:r,toggleCol:i,renderBody:t=>(0,E.jsx)(ae,{body:t.body||e.ess,links:t.links}),srcLine:`$ geneseed law ${e.addr} · ${e.src}`})}var O=[`invariants`,`doctrines`];function ce({tiers:e,current:t,onPick:n}){return(0,E.jsx)(`div`,{className:`tier-strip`,children:e.map((e,r)=>{let i=(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`span`,{className:`tier-head`,children:[(0,E.jsxs)(`span`,{className:`tier-k mono`,children:[`RANK `,r+1]}),e.pill?(0,E.jsx)(`span`,{className:`badge tier-pill ${e.pill[1]}`,children:e.pill[0]}):null]}),(0,E.jsxs)(`span`,{className:`tier-top`,children:[(0,E.jsx)(`span`,{className:`tier-name`,children:e.name}),(0,E.jsx)(`span`,{className:`tier-n mono`,children:e.n})]}),(0,E.jsx)(`span`,{className:`tier-bar`,"aria-hidden":`true`,children:(0,E.jsx)(`span`,{style:{width:`${Math.round(e.fill*100)}%`}})}),(0,E.jsx)(`span`,{className:`tier-sub`,children:e.sub}),(0,E.jsx)(`span`,{className:`tier-sub tier-rule`,children:e.rule})]}),a=`tier${t===e.key?` on`:``}`;return e.href?(0,E.jsx)(`a`,{className:`tier`,href:e.href,children:i},e.key):n&&O.includes(e.key)?(0,E.jsx)(`button`,{type:`button`,className:a,"aria-pressed":t===e.key,onClick:()=>n(t===e.key?`all`:e.key),children:i},e.key):(0,E.jsx)(`div`,{className:a,children:i},e.key)})})}function le({gates:e,byAddr:t,onJump:n,disarmed:r=()=>!1,install:i=null}){let a=i?`off · ${i.host} ${i.scope}`:`off`,o=Object.entries(e?.asks||{}).map(([e,t])=>[e,t,r(b(e))]).sort((e,t)=>e[2]-t[2]||t[1]-e[1]),s=Math.max(1,...o.map(([,e])=>e));return(0,E.jsxs)(`section`,{className:`panel`,"aria-labelledby":`gate-asks`,children:[(0,E.jsxs)(`div`,{className:`panel-head`,children:[(0,E.jsx)(`h2`,{id:`gate-asks`,children:`Gate asks`}),(0,E.jsxs)(`span`,{className:`mono dim`,children:[e?.total??0,` in ledger`]})]}),o.length?(0,E.jsx)(`ul`,{className:`gate-list`,children:o.map(([e,r,i])=>{let o=b(e),c=t[o]?.name||o;return(0,E.jsxs)(`li`,{children:[(0,E.jsx)(`button`,{type:`button`,className:`gate-row`,onClick:()=>n(o),children:(0,E.jsxs)(`span`,{className:`gate-top`,children:[(0,E.jsx)(`span`,{className:`gate-name${i?` dim`:``}`,children:c}),(0,E.jsx)(`span`,{className:`mono dim`,children:o}),i&&(0,E.jsx)(`span`,{className:`mono off`,children:a}),(0,E.jsx)(`span`,{className:`mono gate-n`,children:r})]})}),(0,E.jsx)(d,{value:r,max:s,label:`${c} asks`,tone:i?`accent`:`warn`})]},e)})}):(0,E.jsx)(`p`,{className:`sub`,children:`No gate has asked yet.`}),(0,E.jsx)(`p`,{className:`panel-note`,children:e?.standing_down?.length?`Standing down: ${e.standing_down.join(`, `)}.`:`None standing down.`})]})}function ue({packs:e,sel:t,canApply:n,install:r,gateArmed:i}){let{isOn:a,packOn:o,togglePack:s,dirty:c,losingConsent:l}=t,u=Math.max(1,...e.map(e=>e.rules.length));return(0,E.jsxs)(`section`,{className:`panel`,"aria-labelledby":`doc-packs`,children:[(0,E.jsxs)(`div`,{className:`panel-head`,children:[(0,E.jsx)(`h2`,{id:`doc-packs`,children:`Doctrine packs`}),(0,E.jsxs)(`span`,{className:`mono dim`,children:[e.filter(o).length,`/`,e.length,` on`]})]}),e.length?(0,E.jsx)(`ul`,{className:`pack-list`,children:e.map(e=>{let t=e.rules.filter(e=>a(e.addr)).length;return(0,E.jsxs)(`li`,{className:o(e)?``:`off`,children:[(0,E.jsx)(`span`,{className:`pl-name`,title:e.desc,children:e.title}),(0,E.jsx)(d,{value:t,max:u,label:`${e.title} rules on`}),(0,E.jsx)(`span`,{className:`mono pl-n`,children:t}),n?(0,E.jsx)(`button`,{type:`button`,className:`sw-toggle${o(e)?` on`:``}${t&&t<e.rules.length?` mixed`:``}`,role:`checkbox`,"aria-checked":e.rules.length&&t===e.rules.length?`true`:t?`mixed`:`false`,"aria-label":`${e.title} pack`,onClick:()=>s(e)}):null]},e.pack)})}):(0,E.jsx)(`p`,{className:`sub`,children:`This install predates the three-tier constitution.`}),n&&e.length>0&&(0,E.jsxs)(E.Fragment,{children:[l&&(0,E.jsxs)(`p`,{className:`pack-warn`,role:`status`,"aria-live":`polite`,children:[`Dropping `,(0,E.jsx)(`b`,{children:`process 5`}),` also removes the commit/push consent gate:`,` `,(0,E.jsx)(`code`,{children:`git commit`}),` and `,(0,E.jsx)(`code`,{children:`git push`}),` stop being confirmed at the tool boundary.`,` `,i?`Real data loss stays gated by Rule IV.`:`Rule IV’s deletion gate is off on this install too.`]}),(0,E.jsx)(`p`,{className:`panel-note`,role:`status`,"aria-live":`polite`,children:c?`Not applied yet. Apply rebuilds ${r.host} · ${r.scope} once, with every change together.`:`Matches the deployed install. Changing a pack rebuilds it.`})]})]})}function de(e){let t=[];for(let n of e){if(n.tier!==`doctrine`)continue;let e=t.find(e=>e.pack===n.pack);e||(e={pack:n.pack,title:n.packTitle||n.pack,desc:n.packDesc||``,active:n.packActive!==!1,rules:[]},t.push(e));let r=h(n.title);e.rules.push({addr:n.name,no:`${n.pack} ${n.name.split(`.`)[1]||``}`,name:r.name,latin:r.latin,ess:n.summary||``,enf:ee(n.name),c:w[n.pack]||`var(--text-3)`,src:`doctrines/${n.pack}.md`})}return t}function k(e){let t=x(e.dataRev),[n,i]=y(`laws`,t),{data:a}=g(()=>n?r.overview(C(n)).catch(()=>null):Promise.resolve(null),[n?.id??``,e.dataRev]),o=n&&a?.install?.host===n.host&&a.install.path===n.path?a:null,s=n?o:e.overview,c=t!==null&&(!n||o!==null);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(p,{className:`page-pick`,installs:t,value:n,onChange:i,label:`Constitution of:`}),(0,E.jsx)(A,{...e,overview:s,pair:C(n),onAction:c?e.onAction:void 0},n?.id??`none`)]})}function A({selected:e,overview:t,setup:n,onAction:o,dataRev:l,pair:p}){let y=i(),{data:x,error:C}=g(()=>r.catalog(`laws`,p),p?[l,p.host,p.path]:[l],`catalog:laws`),{data:ae}=s(l,p),[D,O]=(0,T.useState)(`all`),[k,A]=(0,T.useState)(``),[j,M]=(0,T.useState)(`all`),[fe,pe]=(0,T.useState)(()=>new Set),N=e||null,P=e=>a(N===e?`#/laws`:`#/item/law/${encodeURIComponent(e)}`),[me,he]=(0,T.useState)(0),ge=(0,T.useRef)(null);(0,T.useEffect)(()=>{if(!e)return;let t=requestAnimationFrame(()=>{let t=document.querySelector(`[data-addr="${CSS.escape(e)}"]`);if(!t)return;let n=ge.current===e;ge.current=null;let r=t.getBoundingClientRect();if(n||r.top<80||r.bottom>window.innerHeight){let e=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;t.scrollIntoView?.({block:`center`,behavior:e?`auto`:`smooth`})}n&&(t.classList.remove(`law-flash`),t.offsetWidth,t.classList.add(`law-flash`))});return()=>cancelAnimationFrame(t)},[e,me,x]);let F=x?.items||[],I=de(F),L=e=>t?.install?.[v[e].key]!==!1,_e=L(`IV`),R=t?.install,z=!!(R&&o),B=oe({items:F,packs:I,install:R,canApply:z,onAction:o,gateArmed:_e}),{deployedRules:V,isOn:H,toggleRule:ve,packOn:ye,packState:be,allRules:U}=B;if(C)return(0,E.jsx)(c,{error:C});if(!x)return(0,E.jsx)(m,{});let W={ontology:x.nouns?.ontology||`Ethos`,law:x.nouns?.law||`Dictate`,laws:x.nouns?.laws||`Dictates`,doctrines:x.nouns?.doctrines||`Doctrines`},G=F.filter(e=>e.tier===`ontology`).map(e=>({addr:e.name,no:``,name:e.title,latin:``,ess:``,status:`Always`,statusTone:`ok`,enf:`Instruction`,c:`var(--text-3)`,src:`ontology/universal.md`})),K=F.filter(e=>(e.tier??`invariant`)===`invariant`).map(e=>{let n=e.klass&&S[e.klass]?e.klass:`craft`,r=h(e.title);return{addr:e.name,no:e.name,name:r.name,latin:r.latin,ess:e.summary||``,retired:r.retired,status:r.retired?`Retired`:`Active`,statusTone:r.retired?``:`ok`,enf:r.retired?`None`:ee(e.name,t?.install),cat:n,c:S[n].c,off:r.retired,src:`laws/universal.md`}}),xe=e=>{let t=H(e.addr),n=V.includes(e.addr),r=t===n?t?`Active`:`Off`:t?`Staged on`:`Staged off`;return{...e,off:!t,status:r,statusTone:t?`ok`:t===n?``:`warn`}},Se=I.filter(e=>e.active).flatMap(e=>e.rules.filter(e=>!V.includes(e.addr)).map(e=>e.addr)),Ce=async e=>{if(!z)return;let{key:t,label:n}=v[e],r=n.toLowerCase(),i=!L(e),a=`${R.host} · ${R.scope}`,s=B.dirty?` Your staged doctrine changes are not part of this rebuild; they stay staged.`:``;await y((i?`Re-arm the ${r} on ${a}? ${_[e].arm} It rebuilds in place, non-destructive.`:`Switch the ${r} off on ${a}? ${_[e].off} It rebuilds in place, non-destructive.`)+s,{title:i?`Re-arm the ${r}?`:`Switch the ${r} off?`,confirmLabel:i?`Re-arm`:`Switch off`})&&o(`install`,{...R,[t]:i})},we=e=>String(e.addr).includes(`.`)&&H(e.addr)!==V.includes(e.addr),q=(e,t=j)=>t===`all`||(t===`gated`?e.enf===`Hook gate`&&(!String(e.addr).includes(`.`)||V.includes(e.addr)):we(e)),J=k.trim().toLowerCase(),Y=e=>q(e)&&(!J||`${e.addr} ${e.name} ${e.latin} ${e.ess}`.toLowerCase().includes(J)),Te=e=>{let t=Me[e],n=String(e).includes(`.`);(n&&D===`invariants`||!n&&D===`doctrines`)&&O(`all`),t&&!q(t)&&M(`all`),t&&!Y(t)&&A(``),ge.current=e,he(e=>e+1),a(`#/item/law/${encodeURIComponent(e)}`)},X={};for(let[e,t]of Object.entries(n?.gates?.asks||{}))X[b(e)]=t;let Ee=e=>X[e.addr]?{...e,asks:`${X[e.addr]} ask${X[e.addr]===1?``:`s`}`}:e,Z=K.filter(e=>!e.retired).length,Q=V.length,De=Object.keys(v).filter(e=>K.some(t=>t.addr===e)&&!L(e)).length,Oe=U.length-Q,$=ae?.stats,ke={ethos:{name:W.ontology,n:G.length,fill:1,sub:`${G.length} sections`,pill:[`always`,`ok`]},invariants:{name:W.laws,n:Z,fill:K.length?Z/K.length:0,sub:K.length>Z?`${Z} active · ${K.length-Z} retired`:`${Z} active`,pill:De?[`${De} gate${De===1?``:`s`} off`,`warn`]:[`always`,`ok`]},doctrines:{name:W.doctrines,n:Q,fill:U.length?Q/U.length:0,sub:`${Q} rules · ${I.filter(e=>e.active).length} of ${I.length} packs`,pill:Oe>0?[`${Oe} excluded`,`warn`]:[`all on`,`ok`]},yours:{name:`Your rules`,n:$?.rules??0,fill:$?.max_rules?$.rules/$.max_rules:0,sub:$?`${$.rules} of ${$.max_rules} · ${$.tokens}/${$.max_tokens} tok`:`user-rules.md`,href:`#/personal/rules`,pill:[`yours`,``]}},Ae=e=>{if(e===`—`)return`Nothing outranks them.`;let t=e.replace(`{{LAW}}`,W.law);return`${t[0].toUpperCase()}${t.slice(1)}.`},je=ne.map(e=>({key:e.key,...ke[e.key],rule:Ae(e.against)})),Me=Object.fromEntries([...K,...I.flatMap(e=>e.rules)].map(e=>[e.addr,e])),Ne=[[`all`,`All`,K.length+U.length],[`invariants`,W.laws,K.length],[`doctrines`,W.doctrines,U.length]],Pe=D===`all`||D===`invariants`,Fe=D===`all`||D===`doctrines`,Ie=[...Pe?K:[],...Fe?I.flatMap(e=>e.rules):[]],Le=[[`gated`,`Gated`,Ie.filter(e=>q(e,`gated`)).length],[`changed`,`Changed`,Ie.filter(e=>q(e,`changed`)).length]],Re=e=>String(e).includes(`.`)?String(e).split(`.`)[0]:null,ze=e=>j!==`changed`&&fe.has(e)&&Re(N)!==e,Be=e=>{let t=ze(e);pe(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&Re(N)===e&&a(`#/laws`)},Ve=I.flatMap(e=>e.rules.filter(we).map(e=>({...e,plus:H(e.addr)}))),He=z&&I.length>0&&B.dirty,Ue=()=>{M(`changed`),D===`invariants`&&O(`all`),A(``)},We=(e,t)=>(0,E.jsxs)(`div`,{className:`band-head`,role:`presentation`,children:[(0,E.jsx)(`h2`,{className:`tier-h`,children:e}),(0,E.jsx)(`span`,{className:`mono dim`,children:t})]}),Ge=K.filter(Y),Ke=(Pe?Ge.length:0)+(Fe?I.reduce((e,t)=>e+t.rules.filter(Y).length,0):0);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(f,{eyebrow:R?[t?.theme,R.footprint&&`${R.footprint} footprint`,R.host,R.scope].filter(Boolean).join(` · `):null,title:`Constitution`,sub:`What the agent follows on every turn. Ranked: a lower rank may tighten a higher one, never repeal it. Open any rule to read its canonical text.`,actions:(0,E.jsx)(ie,{className:`law-filter`,value:k,onChange:A,placeholder:`Filter rules`,label:`Filter rules`})}),(0,E.jsxs)(`section`,{className:`ladder`,"aria-labelledby":`ladder-h`,children:[(0,E.jsx)(`h2`,{id:`ladder-h`,className:`eyebrow`,children:`Precedence`}),(0,E.jsx)(ce,{tiers:je,current:D,onPick:O}),(0,E.jsx)(`div`,{className:`ladder-tail`,children:te.map((e,t)=>(0,E.jsxs)(`span`,{className:`ladder-low`,children:[(0,E.jsxs)(`span`,{className:`mono tier-k`,children:[`RANK `,ne.length+t+1]}),` `,e.label,` —`,` `,e.against]},e.source))})]}),(0,E.jsxs)(`div`,{className:`split`,children:[(0,E.jsxs)(`section`,{className:`panel flush law-wrap${z?` with-toggle`:``}`,"aria-label":`Rules`,children:[G.length>0&&(0,E.jsxs)(E.Fragment,{children:[We(W.ontology,`ontology/universal.md`),G.map(e=>(0,E.jsx)(se,{law:e,rev:l,isOpen:N===e.addr,onToggle:()=>P(e.addr)},e.addr))]}),(0,E.jsxs)(`div`,{className:`law-toolbar`,children:[(0,E.jsx)(u,{"aria-label":`Show`,children:Ne.map(([e,t,n])=>(0,E.jsxs)(`button`,{type:`button`,className:D===e?`on`:``,"aria-pressed":D===e,onClick:()=>O(e),children:[t,` `,(0,E.jsx)(`span`,{className:`mono`,children:n})]},e))}),(0,E.jsx)(u,{"aria-label":`Narrow`,children:Le.map(([e,t,n])=>(0,E.jsxs)(`button`,{type:`button`,className:j===e?`on`:``,"aria-pressed":j===e,onClick:()=>M(j===e?`all`:e),children:[t,` `,(0,E.jsx)(`span`,{className:`mono`,children:n})]},e))})]}),(0,E.jsxs)(`div`,{className:`law-rowhead`,children:[(0,E.jsx)(`span`,{children:`No.`}),(0,E.jsx)(`span`,{children:`Rule`}),(0,E.jsx)(`span`,{children:`Latin name`}),(0,E.jsx)(`span`,{children:`Status`}),(0,E.jsx)(`span`,{children:`Enforced by`})]}),Pe&&Ge.length>0&&(0,E.jsxs)(E.Fragment,{children:[We(W.laws,`laws/universal.md`),Ge.map(e=>(0,E.jsx)(se,{law:Ee(e),rev:l,isOpen:N===e.addr,onToggle:()=>P(e.addr),toggleCol:!z||e.retired?null:v[e.addr]?(0,E.jsx)(`button`,{type:`button`,className:`sw-toggle${L(e.addr)?` on`:``}`,role:`switch`,"aria-checked":L(e.addr),"aria-label":v[e.addr].label,onClick:()=>Ce(e.addr)}):(0,E.jsx)(`span`,{className:`no-gate`,title:`Enforced by its text alone: no hook gate`,children:`no gate`})},e.addr))]}),Fe&&I.map(e=>{let t=e.rules.filter(Y);if(!t.length)return null;let n=ze(e.pack),r=e.rules.filter(e=>H(e.addr)).length;return(0,E.jsxs)(`div`,{className:`pack-wrap${ye(e)?``:` pack-off`}`,children:[(0,E.jsxs)(`div`,{className:`band-head pack-head`,children:[(0,E.jsx)(`h2`,{className:`tier-h`,style:{"--cc":w[e.pack]},children:(0,E.jsx)(`button`,{type:`button`,className:`pack-fold`,"aria-expanded":!n,onClick:()=>Be(e.pack),children:e.title})}),(0,E.jsx)(`span`,{className:`mono dim`,children:e.pack}),(0,E.jsx)(`span`,{className:`pack-desc dim`,children:e.desc}),(0,E.jsx)(`span`,{className:`pack-fill`,children:(0,E.jsx)(d,{value:r,max:e.rules.length,label:`${e.title} rules switched on`})}),(0,E.jsx)(`span`,{className:`pack-state mono`,children:be(e)})]}),!e.active&&!z&&(0,E.jsxs)(`div`,{className:`pack-enable`,children:[`$ geneseed-build --doctrines`,` `,I.filter(t=>t.active||t.pack===e.pack).map(e=>e.pack).join(`,`),Se.length>0&&` --exclude-rules ${Se.join(`,`)}`]}),!n&&t.map(e=>(0,E.jsx)(se,{law:Ee(xe(e)),rev:l,isOpen:N===e.addr,onToggle:()=>P(e.addr),toggleCol:z?(0,E.jsx)(`button`,{type:`button`,className:`sw-toggle${H(e.addr)?` on`:``}`,role:`switch`,"aria-checked":H(e.addr),"aria-label":`${e.name} rule`,onClick:()=>ve(e.addr)}):null},e.addr))]},e.pack)}),Ke===0&&(0,E.jsx)(re,{title:J||j!==`all`?`No matching rules`:`Nothing in this tier`,children:J?(0,E.jsxs)(E.Fragment,{children:[`Nothing matches “`,k.trim(),`”.`]}):j===`all`?(0,E.jsx)(E.Fragment,{children:`This install predates the tier.`}):(0,E.jsxs)(E.Fragment,{children:[`No `,j,` rule in this tier.`]})})]}),(0,E.jsxs)(`aside`,{className:`aside-stack`,children:[(0,E.jsx)(ue,{packs:I,sel:B,canApply:z,install:R,gateArmed:_e}),(0,E.jsx)(le,{gates:n?.gates,byAddr:Me,onJump:Te,disarmed:e=>!!v[e]&&!L(e),install:t?.install})]})]}),He&&(0,E.jsxs)(`div`,{className:`law-bar`,role:`region`,"aria-label":`Unapplied changes`,children:[(0,E.jsxs)(`span`,{className:`law-bar-n`,children:[Ve.length,` unapplied change`,Ve.length===1?``:`s`]}),(0,E.jsx)(`span`,{className:`law-bar-list`,children:Ve.map(e=>(0,E.jsxs)(`span`,{className:`badge ${e.plus?`ok`:`warn`}`,children:[e.plus?`+`:`−`,` `,e.no,` `,e.name]},e.addr))}),(0,E.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:Ue,children:`Review changes`}),(0,E.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{M(`all`),B.revert()},children:`Revert`}),(0,E.jsxs)(`button`,{type:`button`,className:`btn`,onClick:B.applyPacks,children:[`Apply (`,B.pickedRules.length,`/`,U.length,` rules)`]})]})]})}export{k as default};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BxjLd7Qd.js";import{i}from"./motion-CXaUMNkg.js";import{n as a,t as o}from"./sections-ChwaobfW.js";import{$ as s,Dt as ee,J as te,Q as ne,V as re,_t as ie,b as c,bt as l,pt as ae,rt as u,x as d}from"./index-CzDi9JpF.js";import{t as f}from"./EmptyState-1sPNleqv.js";import{a as oe,i as se,o as ce,r as le,s as ue,t as de}from"./RailCats-BuJD4Jou.js";import{t as fe}from"./Markdown-DpmmtW2Y.js";var p=e(t(),1),m=n();function pe({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,m.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function h({entries:e}){return e.length?(0,m.jsxs)(`table`,{className:`mf-entries`,children:[(0,m.jsx)(`thead`,{className:`sr-only`,children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{scope:`col`,children:`Path`}),(0,m.jsx)(`th`,{scope:`col`,children:`Load`}),(0,m.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,m.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,m.jsx)(`td`,{className:`mf-load-cell`,children:(0,m.jsx)(pe,{load:e.load})}),(0,m.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function g({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,m.jsxs)(`div`,{className:`mf-vault`,children:[(0,m.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,m.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,m.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,m.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,m.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,m.jsxs)(`span`,{className:`mf-role`,children:[(0,m.jsx)(u,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,m.jsxs)(`span`,{className:`mf-role`,children:[(0,m.jsx)(u,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,m.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,m.jsx)(u,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,m.jsx)(h,{entries:t})]})}function _({body:e}){let[t,n]=(0,p.useState)(!1),r=(0,p.useId)();return e?(0,m.jsxs)(`div`,{className:`mf-raw`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,m.jsx)(u,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,m.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function me({manifest:e,body:t,name:n}){if(!e)return(0,m.jsx)(`pre`,{className:`mf-raw-pre`,children:(t||``).replace(/^```json\n|\n```$/g,``)});if(e.kind===`wiki`){let n=e.wikis||[];return n.length?(0,m.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,m.jsx)(g,{wiki:e},e.name||t)),(0,m.jsx)(_,{body:t})]}):(0,m.jsxs)(`div`,{className:`mf-empty`,children:[(0,m.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,m.jsxs)(`p`,{children:[`A wiki is your machine-wide knowledge base — an Obsidian vault or any folder of linked markdown the agent reads from and writes back to. Declare one in`,` `,(0,m.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,m.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,m.jsx)(_,{body:t})]})}let r=e.context||[];return r.length?(0,m.jsxs)(`div`,{className:`mf-doc`,children:[(0,m.jsx)(h,{entries:r}),(0,m.jsx)(_,{body:t})]}):(0,m.jsxs)(`div`,{className:`mf-empty`,children:[(0,m.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,m.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,m.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,m.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,m.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,m.jsx)(_,{body:t})]})}var he={fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},v={advocate:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M16 50h14M23 50V14`}),(0,m.jsx)(`path`,{className:`ag-wave ag-f`,d:`M23 15h20l-5 7.5 5 7.5H23z`}),(0,m.jsx)(`path`,{className:`ag-call`,d:`M47 38a6 6 0 0 1 0 8M51 35a11 11 0 0 1 0 14`})]}),architect:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{x:`14`,y:`14`,width:`36`,height:`32`,rx:`2`,opacity:`.3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M20 40V22h12v9h12v9z`}),(0,m.jsx)(`path`,{className:`ag-draw ag-late`,pathLength:`100`,d:`M32 31v9`}),(0,m.jsx)(`path`,{d:`M14 52h36M14 50v4M50 50v4`,opacity:`.5`})]}),developer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-f`,x:`10`,y:`14`,width:`44`,height:`36`,rx:`4`}),(0,m.jsx)(`path`,{d:`M10 22h44`,opacity:`.5`}),(0,m.jsx)(`circle`,{cx:`15`,cy:`18`,r:`1`}),(0,m.jsx)(`circle`,{cx:`19`,cy:`18`,r:`1`}),(0,m.jsx)(`path`,{className:`ag-nudge-l`,d:`M24 30l-6 6 6 6`}),(0,m.jsx)(`path`,{className:`ag-nudge-r`,d:`M40 30l6 6-6 6`}),(0,m.jsx)(`path`,{className:`ag-blink`,d:`M30 42h5`})]}),"devops-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M32 32c-5-9-18-9-18 0s13 9 18 0c5-9 18-9 18 0s-13 9-18 0z`,opacity:`.3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M32 32c-5-9-18-9-18 0s13 9 18 0c5-9 18-9 18 0s-13 9-18 0z`}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`3`})]}),"docker-expert":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`14`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`27`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`40`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`20`,y:`25`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`34`,y:`25`,width:`10`,height:`9`}),(0,m.jsx)(`path`,{d:`M8 52c5 0 5-3 10-3s5 3 10 3 5-3 10-3 5 3 10 3 5-3 10-3`,opacity:`.5`})]}),docs:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M16 10h22l8 8v36H16z`}),(0,m.jsx)(`path`,{d:`M38 10v8h8`,opacity:`.5`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M21 26h18`}),(0,m.jsx)(`path`,{className:`ag-draw ag-late`,pathLength:`100`,d:`M21 33h18`}),(0,m.jsx)(`path`,{className:`ag-draw ag-later`,pathLength:`100`,d:`M21 40h11`}),(0,m.jsx)(`g`,{className:`ag-write`,children:(0,m.jsx)(`path`,{d:`M40 44l12-20 3 2-12 20-4 1z`})})]}),empiricist:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 12v40h40`,opacity:`.5`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`18`,y:`36`,width:`6`,height:`14`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`29`,y:`28`,width:`6`,height:`22`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`40`,y:`20`,width:`6`,height:`30`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M16 34l12-8 10 3 12-14`})]}),explorer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`18`,opacity:`.5`}),(0,m.jsx)(`path`,{d:`M32 10v4M32 50v4M10 32h4M50 32h4`}),(0,m.jsxs)(`g`,{className:`ag-search`,children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 18l5 14h-10z`}),(0,m.jsx)(`path`,{d:`M32 18l5 14-5 14-5-14z`})]}),(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`2`})]}),framer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`g`,{className:`ag-frame`,children:(0,m.jsx)(`path`,{d:`M12 22V12h10M42 12h10v10M52 42v10H42M22 52H12V42`})}),(0,m.jsx)(`circle`,{className:`ag-pulse`,cx:`32`,cy:`32`,r:`7`,opacity:`.6`}),(0,m.jsx)(`path`,{d:`M32 22v6M32 36v6M22 32h6M36 32h6`,opacity:`.6`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`1.5`})]}),historian:(0,m.jsxs)(`g`,{className:`ag-turn`,children:[(0,m.jsx)(`path`,{d:`M20 12h24M20 52h24`}),(0,m.jsx)(`path`,{d:`M22 12c0 12 20 12 20 20s-20 8-20 20M42 12c0 12-20 12-20 20s20 8 20 20`}),(0,m.jsx)(`path`,{className:`ag-drain ag-f`,d:`M25 17h14c-1 6-5 9-7 11-2-2-6-5-7-11z`}),(0,m.jsx)(`path`,{className:`ag-fill ag-f`,d:`M24 49h16c-1-5-5-8-8-9-3 1-7 4-8 9z`})]}),operator:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 42a20 20 0 0 1 40 0`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M40 24a20 20 0 0 1 12 18`,strokeWidth:`4`,opacity:`.7`}),(0,m.jsx)(`path`,{d:`M16 30l3 2M32 22v4M48 30l-3 2`,opacity:`.6`}),(0,m.jsx)(`g`,{className:`ag-gauge`,children:(0,m.jsx)(`path`,{d:`M32 42l10-13`})}),(0,m.jsx)(`circle`,{cx:`32`,cy:`42`,r:`3`}),(0,m.jsx)(`path`,{d:`M22 50h20`,opacity:`.5`})]}),pragmatist:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M32 14v36M22 50h20`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`14`,r:`2`}),(0,m.jsxs)(`g`,{className:`ag-tilt`,children:[(0,m.jsx)(`path`,{d:`M14 18h36`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M14 18l-5 12h10zM50 18l-5 12h10z`})]})]}),"kubernetes-specialist":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`16`}),(0,m.jsx)(`path`,{d:`M32 8v13M32 43v13M8 32h13M43 32h13M15 15l9 9M40 40l9 9M49 15l-9 9M24 40l-9 9`,opacity:`.6`}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`5`})]}),"memory-curator":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`17`,y:`16`,width:`14`,height:`20`,rx:`1`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`25`,y:`12`,width:`14`,height:`24`,rx:`1`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`33`,y:`18`,width:`14`,height:`18`,rx:`1`}),(0,m.jsx)(`path`,{d:`M12 32h40v16a2 2 0 0 1-2 2H14a2 2 0 0 1-2-2z`}),(0,m.jsx)(`path`,{d:`M26 40h12`,opacity:`.6`})]}),researcher:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`34`,r:`16`}),(0,m.jsx)(`path`,{d:`M14 34h32M30 18c-6 5-6 27 0 32`,opacity:`.5`}),(0,m.jsx)(`ellipse`,{className:`ag-spin`,cx:`30`,cy:`34`,rx:`7`,ry:`16`}),(0,m.jsx)(`g`,{className:`ag-orbit`,children:(0,m.jsx)(`circle`,{cx:`50`,cy:`14`,r:`3`})})]}),reviewer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 18h30M12 26h40M12 34h24M12 42h34`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-mark`,d:`M42 30l3 3 6-6`}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`22`,cy:`30`,r:`9`}),(0,m.jsx)(`path`,{d:`M29 37l8 8`,strokeWidth:`3`})]})]}),performance:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M26 10h8M30 10v6M44 18l3-3`}),(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`34`,r:`18`}),(0,m.jsx)(`path`,{d:`M30 19v3M45 34h-3M30 49v-3M15 34h3`,opacity:`.6`}),(0,m.jsx)(`g`,{className:`ag-orbit`,children:(0,m.jsx)(`path`,{d:`M30 34V22`})}),(0,m.jsx)(`circle`,{cx:`30`,cy:`34`,r:`2`})]}),security:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-ripple`,d:`M32 8l18 6v13c0 12-8 21-18 26-10-5-18-14-18-26V14z`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 8l18 6v13c0 12-8 21-18 26-10-5-18-14-18-26V14z`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M24 31l6 6 11-11`})]}),skeptic:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M12 14h40v28H30l-10 8v-8h-8z`}),(0,m.jsxs)(`g`,{className:`ag-lean`,children:[(0,m.jsx)(`path`,{d:`M27 23a5 5 0 1 1 7 4.5c-1.5.8-2 2-2 3.5v1`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`36`,r:`1.2`})]})]}),"spring-boot-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M22 20a16 16 0 1 0 20 0`}),(0,m.jsx)(`path`,{className:`ag-pulse`,d:`M32 12v18`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M32 50c0-8 5-12 13-12 0 8-5 12-13 12z`})]}),"spring-reviewer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 18h26M12 26h18M12 34h22M12 42h14`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M42 28c0-8 4-12 11-12 0 8-4 12-11 12z`}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`24`,cy:`32`,r:`9`}),(0,m.jsx)(`path`,{d:`M31 39l8 8`,strokeWidth:`3`})]})]}),"spring-security":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-ripple`,d:`M22 28v-6a10 10 0 0 1 20 0v6`}),(0,m.jsx)(`path`,{d:`M22 28v-6a10 10 0 0 1 20 0v6`}),(0,m.jsx)(`rect`,{className:`ag-f`,x:`16`,y:`28`,width:`32`,height:`24`,rx:`4`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`38`,r:`3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M32 41v6`})]}),"react-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`g`,{className:`ag-spin`,children:[(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`}),(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`,transform:`rotate(60 32 32)`}),(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`,transform:`rotate(120 32 32)`})]}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`4`})]}),"react-reviewer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`g`,{opacity:`.4`,children:[(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`}),(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`,transform:`rotate(60 30 30)`}),(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`,transform:`rotate(120 30 30)`})]}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`30`,r:`8`}),(0,m.jsx)(`path`,{d:`M36 36l9 9`,strokeWidth:`3`})]})]}),steward:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 52h40`,opacity:`.5`}),(0,m.jsx)(`path`,{d:`M22 52c2-3 6-4 10-4s8 1 10 4`,opacity:`.4`}),(0,m.jsxs)(`g`,{className:`ag-grow`,children:[(0,m.jsx)(`path`,{d:`M32 50V26`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M32 32c0-9 6-14 15-14 0 9-6 14-15 14z`}),(0,m.jsx)(`path`,{className:`ag-sway ag-late ag-f`,d:`M32 38c0-7-5-11-12-11 0 7 5 11 12 11z`})]})]}),tester:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M26 10h12M28 10v14L15 48a3 3 0 0 0 2.6 4.5h28.8A3 3 0 0 0 49 48L36 24V10`}),(0,m.jsx)(`path`,{className:`ag-f ag-slosh`,d:`M20 40h24l4.5 8.5H15.5z`}),(0,m.jsx)(`circle`,{className:`ag-bubble`,cx:`28`,cy:`44`,r:`2`}),(0,m.jsx)(`circle`,{className:`ag-bubble ag-late`,cx:`35`,cy:`46`,r:`1.5`}),(0,m.jsx)(`circle`,{className:`ag-bubble ag-later`,cx:`31`,cy:`42`,r:`1`})]}),"user-advocate":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`24`,cy:`20`,r:`6`}),(0,m.jsx)(`path`,{d:`M12 50c0-9 5-15 12-15 4 0 7 1.5 9 4`}),(0,m.jsx)(`path`,{className:`ag-beat ag-f`,d:`M44 52s-10-6-10-12.5a5 5 0 0 1 10-1.5 5 5 0 0 1 10 1.5C54 46 44 52 44 52z`}),(0,m.jsx)(`path`,{className:`ag-twinkle`,d:`M48 22v4M46 24h4`})]}),visionary:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`g`,{className:`ag-rays`,opacity:`.5`,children:(0,m.jsx)(`path`,{d:`M32 6v6M32 52v6M6 32h6M52 32h6M13.6 13.6l4.2 4.2M46.2 46.2l4.2 4.2M13.6 50.4l4.2-4.2M46.2 17.8l4.2-4.2`})}),(0,m.jsx)(`path`,{className:`ag-f ag-pulse`,d:`M32 16l4.7 10.4 11.3 1.2-8.5 7.6 2.4 11.1L32 40.6l-9.9 5.7 2.4-11.1-8.5-7.6 11.3-1.2z`}),(0,m.jsx)(`path`,{className:`ag-twinkle`,d:`M50 8v6M47 11h6`})]})},y=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 12l17 10v20L32 52 15 42V22z`}),(0,m.jsx)(`circle`,{className:`ag-pulse`,cx:`32`,cy:`32`,r:`6`})]});function ge({name:e,size:t=64}){return(0,m.jsxs)(`svg`,{className:`agent-glyph`,viewBox:`0 0 64 64`,width:t,height:t,"aria-hidden":`true`,...he,children:[(0,m.jsx)(`circle`,{className:`ag-disc`,cx:`32`,cy:`32`,r:`31`}),(0,m.jsx)(`circle`,{className:`ag-ring`,cx:`32`,cy:`32`,r:`31`,strokeWidth:`1`,strokeDasharray:`2 7`}),v[e]||y]})}function b({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,m.jsxs)(`div`,{className:`stat`,children:[(0,m.jsx)(`div`,{className:`stat-label`,children:e}),(0,m.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,m.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var _e={skills:`skill`,agents:`agent`},x=[`skills`,`agents`,`memory`,`notebook`],S=new Set([`MEMORY`,`NOTEBOOK`,`README`]),ve=e=>e.filter(e=>!S.has(String(e.name).toUpperCase())).length,ye=(e,t)=>`${t?e/t*100:0}%`,C=e=>e.split(`:`).slice(0,2).join(` `),w=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},T=e=>ie(w(e));function be(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 xe({section:e,source:t}){return(0,m.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,m.jsx)(u,{name:a[e].icon,className:`glyph`}),(0,m.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,m.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var Se=e=>e.replace(/\s+/g,` `).trim(),E=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Ce(e,t){let n=e.replace(/\r\n/g,`
2
+ `),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=E(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?Se(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?Se(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=E(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function we({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,m.jsx)(`div`,{className:`lib-stats`,children:(0,m.jsx)(b,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(C))].join(`, `),i=t.days_counted>=30?`in the last 30 days`:`since ${t.since}`,a=Math.max(1,...e.per_day),o=[e.last?`last used ${e.last}`:null,i,r?`on ${r}`:null].filter(Boolean).join(` · `);return(0,m.jsx)(`div`,{className:`lib-stats`,children:(0,m.jsx)(b,{label:`Used`,value:e.n,delta:o,children:(0,m.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,m.jsx)(`i`,{className:t===29?`today`:``,style:{height:ye(e,a)}},t))})})})}function Te(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 Ee={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},De=(e,t)=>t||(e&&o.includes(e)?e:o[0]),Oe=encodeURIComponent;function ke(e){let t=e=>c[e.klass]?e.klass:`personal`,n=d.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:c[n].label,groupC:c[n].c})));return{rows:n,cats:d.map(e=>({key:e,label:c[e].label,c:c[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ae(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function D({overview:e,section:t,selected:n,dataRev:i,lock:u,base:d,onRulesChanged:pe}){let h=s(),[g,_]=(0,p.useState)(()=>De(t,u)),[he,v]=(0,p.useState)(``),[y,b]=(0,p.useState)(`all`),[S,C]=(0,p.useState)(`all`),[Se,E]=(0,p.useState)(``),[D,je]=(0,p.useState)(null),[O,Me]=(0,p.useState)(null),[Ne,Pe]=(0,p.useState)(t);if(t!==Ne){Pe(t),E(``);let e=De(t,u);e!==g&&(_(e),v(``),b(`all`),C(`all`))}let[Fe,Ie]=(0,p.useState)(n);n!==Fe&&(Ie(n),E(``));let{data:k,error:Le,reload:Re}=l(()=>r.catalog(g),[g,i],`catalog`),A=u?null:_e[g]||null,ze=A!==null||g===`memory`||g===`notebook`,{data:Be}=l(()=>u?Promise.resolve(null):Promise.all(x.map(e=>r.catalog(e))).catch(()=>null),[u,i]),j=A!==null,{data:M}=l(()=>j?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[j,i],`usage`,{revalidate:!0}),N=j&&!!M?.enabled&&Array.isArray(M.names),Ve=(0,p.useMemo)(()=>new Map((Array.isArray(M?.names)?M.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[M]),P=e=>N&&Ve.get(`${A}\u0000${e}`)||null,He=e=>{let t=P(e.name);return!t||t.n===0&&!t.last},Ue=M?.since?`No call since ${M.since}`:`No call recorded yet`,F=k?.section===g&&k?.items||[],I=g===`skills`,We=I?ke(F):null,L=I?We.rows:g===`memory`?Ae(F):F,R=n||L[0]?.name||null,z=R?F.find(e=>e.name===R):null,B=z?.type||a[g].type,V=O?.sec===g&&O?.name===R?O.key:null,{data:Ge,error:H}=l(()=>R?V?r.item(B,R,w(V)):r.item(B,R):Promise.resolve(null),[g,R,B,V,i]),U=H?null:Ge,W=U&&U.name===R&&(!V||U.install===V)?U:null,Ke=e=>K&&e?.install?` in ${T(e.install)}`:``,qe=Se||Le||H,Je=R?{name:R,title:U?.title||R,desc:U?.desc||``}:null,G=z||Je,Ye=e?.counts||{},Xe=e=>{if(!x.includes(e))return Ye[e]??``;if(e===g&&k?.section===g)return ve(F);let t=Be?.find(t=>t?.section===e)?.items;return t?ve(t):``},Ze=ae(i),Qe=Ze?.length>1?`of ${ie(Ze[0])}`:null,K=ze&&new Set(F.flatMap(e=>e.installs||[])).size>1,q=I?L.filter(e=>y===`all`||e.cat===y):L,$e=N?q.filter(He).length:0,et=e=>e.status===`experimental`,tt=q.filter(et).length,nt=[[`all`,`All`,q.length],...N?[[`used`,`Used`,q.length-$e],[`unused`,`Not used yet`,$e,Ue]]:[],...tt?[[`experimental`,`Experimental`,tt,`Shipped, not yet confirmed by real use`]]:[]],J=nt.some(([e])=>e===S)?S:`all`,Y=J===`all`?q:J===`experimental`?q.filter(et):q.filter(e=>He(e)===(J===`unused`)),rt=N?Math.max(0,...F.map(e=>P(e.name)?.n||0)):0,it=I?1/0:50,X=he.trim().toLowerCase(),Z=X?ce(Y,X):Y.slice(0,it),at=!X&&y===`all`&&J===`all`&&R&&!Z.some(e=>e.name===R)?[...Z,...L.filter(e=>e.name===R)]:Z,ot=e=>d?`${d}/${Oe(e.name)}`:`#/item/${e.type||a[g].type}/${Oe(e.name)}`,st=async()=>{let e=W;if(!e)return;let t=e.name;if(await h(`Forget the memory fact "${t}"${Ke(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?w(e.install):void 0)}catch(e){E(`Could not forget "${t}": ${e.message}`);return}ee(d||`#/section/memory`),Re()}},ct=async()=>{let e=W;if(!e)return;let t=e.name;if(await h(`Promote "${t}"${Ke(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?w(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),re(),pe?.(),ee(`#/personal/rules`)}catch(e){E(`Could not promote: ${e.message}`),Re()}}},lt=U?.body?Ce(U.body,U.desc||G?.desc):null,ut=U?.title||G?.title||G?.name,dt=ut===G?.name&&lt?.title?lt.title:ut,ft=k?.section===g&&F.length===0,pt=U?.status||G?.status,mt=g===`skills`?c[z?.klass]:null,Q=a[g].label,{lede:ht,when:gt}=Te(U?.desc||G?.desc||``),$=G?U?.source||G.source||(H?null:be(g,G.name)):null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(te,{error:qe,style:{margin:`0 0 var(--sp-3)`}}),(0,m.jsxs)(`div`,{className:`library lib-dossier${u?` locked`:``}${N?` uses`:``}`,children:[u?null:(0,m.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,m.jsxs)(`div`,{className:`lib-title`,children:[(0,m.jsx)(`h1`,{className:`h`,children:`Library`}),(0,m.jsx)(`span`,{className:`dim`,children:`What the agent knows`})]}),(0,m.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,m.jsxs)(p.Fragment,{children:[(0,m.jsxs)(`a`,{href:`#/section/${e}`,className:g===e?`on`:``,"aria-current":g===e?`page`:void 0,children:[a[e].label,(0,m.jsx)(`span`,{className:`mono dim`,children:Xe(e)})]}),e===g&&I&&(0,m.jsx)(de,{label:`Skill types`,total:F.length,cats:We.cats,cat:y,onChange:b})]},e))})]}),(0,m.jsxs)(oe,{label:Q,count:X?`${Z.length} of ${Y.length}`:Y.length,q:he,onQ:v,matched:Z.length,inView:[g,n],extra:N&&M.since?(0,m.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,M.since]}):!x.includes(g)&&g!==`laws`&&Qe?(0,m.jsx)(`span`,{className:`mono dim lib-since`,children:Qe}):null,tools:nt.length>1?(0,m.jsx)(ne,{"aria-label":`Show`,children:nt.map(([e,t,n,r])=>(0,m.jsxs)(`button`,{type:`button`,className:J===e?`on`:``,"aria-pressed":J===e,title:r,onClick:()=>C(e),children:[t,` `,(0,m.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[(0,m.jsx)(le,{rows:at,activeName:G?.name,hrefOf:ot,pills:N||K?e=>{let t=P(e.name)?.n||0,n=K?(e.installs||[]).map(e=>(0,m.jsx)(`span`,{className:`tag mono lr-install`,title:w(e).path,children:T(e)},e)):null;return N?(0,m.jsxs)(m.Fragment,{children:[n,(0,m.jsxs)(`span`,{className:`lr-use`,children:[(0,m.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,m.jsx)(`i`,{style:{width:ye(t,rt)}})}),(0,m.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,m.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!X&&F.length>it&&(0,m.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,it,` of `,F.length,`; type to search the rest.`]}),ft&&(g===`wiki`?(0,m.jsxs)(f,{title:`No wiki entries`,action:(0,m.jsx)(`a`,{href:`#/section/config`,children:`Open the setup files`}),docs:{href:`#/docs/wiki`,label:`How to configure a wiki →`},children:[`Declare a wiki in `,(0,m.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,m.jsx)(f,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,m.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:G?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`reader-tags`,children:[(0,m.jsx)(`span`,{className:`tag acc`,children:Q.replace(/s$/,``)}),mt?(0,m.jsx)(`span`,{className:`tag`,children:mt.label}):null,U?.kit??G.kit?(0,m.jsx)(se,{name:U?.kit??G.kit}):null,(0,m.jsx)(ue,{status:pt,withHint:!0}),$?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`mono dim reader-src`,children:$}),(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),je({src:$,ok:!0})}catch{je({src:$,ok:!1})}},children:D?.src===$?D.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,m.jsxs)(`div`,{className:`reader-head`,children:[(0,m.jsx)(`h2`,{className:`reader-title`,children:dt}),g===`agents`?(0,m.jsx)(ge,{name:G.name}):null]}),(0,m.jsxs)(`div`,{className:`reader-intro${N?` with-stats`:``}`,children:[(0,m.jsxs)(`div`,{className:`reader-intro-text`,children:[ht?(0,m.jsx)(`p`,{className:`reader-lede`,children:ht}):null,gt?(0,m.jsxs)(`section`,{className:`reader-when`,children:[(0,m.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,m.jsx)(`p`,{children:gt})]}):null]}),N?(0,m.jsx)(we,{u:P(G.name),usage:M,noCall:Ue}):null]}),g===`memory`&&W&&G.name!==`MEMORY`&&G.name!==`README`&&(0,m.jsxs)(`div`,{className:`row gap-8`,children:[(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:ct,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:st,children:`Forget this fact`})]}),U?.installs?.length>1&&U.installs.includes(U.install)?(0,m.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,m.jsx)(`span`,{className:`dim`,children:`Viewing copy from:`}),(0,m.jsx)(`select`,{className:`sel`,value:V||U.install,onChange:e=>Me({sec:g,name:R,key:e.target.value}),children:U.installs.map(e=>(0,m.jsx)(`option`,{value:e,title:w(e).path,children:T(e)},e))}),(0,m.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,m.jsx)(`hr`,{className:`hr`}),H?(0,m.jsxs)(`p`,{className:`sub`,children:[`No `,Q.replace(/s$/,``).toLowerCase(),` named `,(0,m.jsx)(`em`,{children:G.name}),` could be read in this install.`]}):G?.kind===`manifest`||U?.manifest!==void 0?U?(0,m.jsx)(me,{manifest:U.manifest,body:U.body,name:G.name}):(0,m.jsx)(`p`,{className:`sub`,children:`Loading…`}):U?.body?(0,m.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,m.jsx)(fe,{body:lt.body,links:U.links||[]})}):U===null&&R?(0,m.jsx)(`p`,{className:`sub`,children:`Loading…`}):(0,m.jsx)(xe,{section:g,source:be(g,G.name)}),Ee[g]?(0,m.jsx)(`div`,{className:`reader-links`,children:(0,m.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${Ee[g]}`,children:[`About `,Q.toLowerCase(),` in Docs`]})}):null]}):ft?null:(0,m.jsx)(f,{title:`Select an entry`,children:`Pick something from the list to read it.`})})]})]})}export{Ce as bodyHead,D as default,Ae as groupMemory,T as installLabel,w as installOfKey,ke as splitSkills,Te as splitWhen};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BxjLd7Qd.js";import{Et as i,J as a,Tt as o,X as s,Y as c,bt as l,ft as u,pt as d,vt as f}from"./index-CzDi9JpF.js";import{t as p}from"./EmptyState-1sPNleqv.js";import{t as m}from"./usePoll-bDFN-Hr6.js";import{a as h,n as g,o as _,r as v,t as y}from"./RailCats-BuJD4Jou.js";import{t as b}from"./CopyButton-IXnXzH4Y.js";import{t as x}from"./Markdown-DpmmtW2Y.js";import{t as S}from"./DataTable-BWbUx4bY.js";var C=e(t(),1),w={x:260,y:190},T=110,E=28,D=14,O=44,k=e=>e*Math.PI/180,A=e=>Math.round(e*10)/10,j=(e,t=T,n=w)=>({x:A(n.x+t*Math.cos(k(e))),y:A(n.y+t*Math.sin(k(e)))}),M=e=>e/T*(180/Math.PI)+3,N=(e,t,n,r=0)=>`M${t.x},${t.y} A${e},${e} 0 ${r} 1 ${n.x},${n.y}`,P=A(j(205).x-6),F=e=>e.length*6.4,I=e=>({x:e.x-F(e.name)/2,y:e.y-7,w:F(e.name),h:14}),L=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,R=(e,t)=>e.some((n,r)=>[...e.slice(r+1),...t.filter(e=>!e.gate)].some(e=>L(I(n),I(e))));function z(e){return e?.gate===`human`?e.gateOn?.length?`Human gate on ${e.gateOn.join(`, `)}`:`Human gate`:null}function B(e,t=[]){let n=V(e,t,0);if(n.mode!==`ring`)return n;let r=Math.min(...n.entry.map(e=>e.y-30),...n.nodes.map(e=>e.y-e.r-12),...n.inner.map(e=>e.cy-e.r-12),...n.exit?[n.exit.y-24]:[]);return r<0?V(e,t,Math.ceil(-r)):n}function V(e,t,n){let r={x:w.x,y:w.y+n},i=(e,t=T)=>j(e,t,r),a=e=>t.find(t=>t.name===e),o=e=>a(e)?.effect??null,s=e=>z(a(e)),c=e.loops||[],l=c.find(e=>e.iteration);if(!l||l.nodes.length>8)return H(e,o,s);let u=Math.max(...e.nodes.map(e=>c.filter(t=>t.nodes.includes(e)).length)),d=c.filter(e=>e!==l);if(u>3||d.some(e=>!e.nodes.every(e=>l.nodes.includes(e))))return H(e,o,s);let f=l.nodes[0],p=new Set(e.edges.filter(e=>e.to===f).map(e=>e.from)),m=new Map;for(let e of[...d].sort((e,t)=>e.nodes.length-t.nodes.length))for(let t of e.nodes.slice(1))t!==f&&!p.has(t)&&!m.has(t)&&m.set(t,e);let h=l.nodes.filter(e=>!m.has(e));if(h.length<2||d.some(e=>m.has(e.nodes[0])))return H(e,o,s);let g=360/h.length,_=h.map((e,t)=>({name:e,a:-90+t*g,r:E})),v=_.findIndex(e=>o(e.name)===`mutate`);v>=0&&_.splice(v,0,{name:`validate`,a:_[v].a-g/2,r:D,gate:!0});let y=_.map(e=>({name:e.name,...i(e.a),r:e.r,effect:e.gate?null:o(e.name),gate:!!e.gate,inner:!1,human:e.gate?null:s(e.name)})),b=_.map((e,t)=>{let n=_[(t+1)%_.length],r=(t+1===_.length?n.a+360:n.a)-M(n.r)-2,a=e.a+M(e.r);return{d:N(T,i(a),i(r),+(r-a>180)),kind:`ring`}}),x=[],S=new Map;for(let e of d)S.set(e.nodes[0],[...S.get(e.nodes[0])||[],e]);for(let[e,t]of S){let n=_.find(t=>t.name===e),r=i(n.a),a=t.length>1;t.sort((e,t)=>e.nodes.length-t.nodes.length).forEach((e,t)=>{let c=i(n.a+(a?t?18:-18:0),T+(a?54:44)),l=Math.atan2(c.y-r.y,c.x-r.x)*(180/Math.PI),u=e.nodes.filter(t=>m.get(t)===e),d=e=>u.map((t,n)=>({name:t,...j(l+(n-(u.length-1)/2)*e,O,c)})),f=105;for(;f<150&&R(d(f),y);)f+=5;d(f).forEach(({name:e,...t})=>{y.push({name:e,...t,r:E,effect:o(e),gate:!1,inner:!0,human:s(e)})});let p=l+180;b.push({d:N(O,j(p+42,O,c),j(p+138,O,c)),kind:`inner`}),b.push({d:N(O,j(p+222,O,c),j(p+318,O,c)),kind:`inner`});let h=`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)} · max ${e.max}`,g={lx:c.x,ly:c.y+O+20,anchor:`middle`};if(a){let e=c.x>=w.x,t=Math.max(O,...u.map(e=>{let t=y.find(t=>t.name===e);return Math.abs(t.x-c.x)+E}));g={lx:A(c.x+(e?t+8:-t-8)),ly:A(c.y+4),anchor:e?`start`:`end`}}x.push({loop:e.name,cx:c.x,cy:c.y,r:O,label:h,...g})})}let C=i(205).y,k=e.nodes.filter(e=>!l.nodes.includes(e)),P=k.map((e,t)=>({name:e,x:40,y:A(C-44*(k.length-1-t)),human:s(e)})),I=e.edges.find(e=>e.to===`$close`)?.from,L=y.find(e=>e.name===I),B=L?{from:I,x:L.x+200,y:L.y-30,d:`M${L.x+E},${L.y-6} C${L.x+90},${L.y-40} ${L.x+170},${L.y-40} ${L.x+200},${L.y-30}`}:null,V=Math.max(540,...y.map(e=>e.x+e.r+8),...B?[B.x+6+F(`close`)+8]:[],...x.map(e=>e.cx+e.r+8),...x.map(e=>e.anchor===`start`?e.lx+F(e.label)+8:e.lx+F(e.label)/2+8)),U=Math.max(300,...y.map(e=>e.y+e.r+12),...x.map(e=>Math.max(e.cy+e.r,e.ly)+12));return{mode:`ring`,width:Math.ceil(V),height:Math.ceil(U),center:{x:r.x,y:r.y,r:T},nodes:y,arcs:b,inner:x,entry:P,exit:B}}function H(e,t,n){let r=e.loops||[],i=e=>36+16*r.filter(t=>t!==e&&t.nodes.every(t=>e.nodes.includes(t))).length,a=Math.max(E,...r.map(i))+30,o=new Map(e.nodes.map((e,t)=>[e,60+t*100])),s=e.nodes.map(e=>({name:e,x:o.get(e),y:a,r:E,effect:t(e),gate:!1,inner:!1,human:n(e)})),c=e.nodes.slice(1).map((t,n)=>({d:`M${o.get(e.nodes[n])+E},${a} L${o.get(t)-E-4},${a}`,kind:`flow`})),l=r.map(e=>{let t=i(e),n=Math.min(...e.nodes.map(e=>o.get(e))),r=Math.max(...e.nodes.map(e=>o.get(e))),s={x:n-t,y:a-t,w:r-n+2*t,h:2*t};return c.push({d:`M${r},${s.y+s.h} L${n+4},${s.y+s.h}`,kind:`flow`}),{loop:e.name,label:`${e.name} · max ${e.max}`,box:s}});return{mode:`flow`,width:60+e.nodes.length*100,height:2*a,center:null,nodes:s,arcs:c,inner:l,entry:[],exit:null}}var U=n();function W({x:e,y:t,label:n}){return(0,U.jsxs)(`g`,{className:`lr-human`,children:[(0,U.jsx)(`title`,{children:n}),(0,U.jsx)(`circle`,{cx:e,cy:t,r:`9`}),(0,U.jsx)(`circle`,{cx:e,cy:t-2.4,r:`2.6`,className:`lr-human-fig`}),(0,U.jsx)(`path`,{d:`M${e-4.6},${t+5.6} a4.6,4.6 0 0 1 9.2,0 Z`,className:`lr-human-fig`})]})}function ee({graph:e,bricks:t,onSelect:n,highlight:r}){let i=B(e,t),a=(e.loops||[]).find(e=>e.iteration),o=e=>`${e.name} brick${e.human?`, ${e.human.toLowerCase()}`:``}`,s=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n?.(e))};return(0,U.jsxs)(`svg`,{className:`loop-ring`,viewBox:`0 0 ${i.width} ${i.height}`,role:`group`,"aria-label":`${e.name} loop: ${e.nodes.join(`, `)}`,children:[(0,U.jsx)(`defs`,{children:[`ring`,`inner`,`flow`].map(e=>(0,U.jsx)(`marker`,{id:`lr-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,U.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`lr-head-${e}`})},e))}),i.mode===`ring`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,className:`lr-inner`}),(0,U.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.mode===`flow`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`rect`,{x:e.box.x,y:e.box.y,width:e.box.w,height:e.box.h,rx:`14`,className:`lr-box`}),(0,U.jsx)(`text`,{x:e.box.x+10,y:e.box.y-6,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.arcs.map((e,t)=>(0,U.jsx)(`path`,{d:e.d,className:`lr-${e.kind}`,markerEnd:`url(#lr-arrow-${e.kind})`},t)),i.entry.length>0&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:`M40,${i.entry.at(-1).y} L${P},${i.entry.at(-1).y}`,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),i.entry.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:e.x,y:e.y-10,className:`lr-lbl`,children:e.name}),(0,U.jsx)(`text`,{x:e.x,y:e.y+18,className:`lr-sub`,children:`setup · 1×`}),e.human?(0,U.jsx)(W,{x:e.x-14,y:e.y-14,label:e.human}):null]},e.name))]}),i.nodes.map(e=>e.gate?(0,U.jsxs)(`g`,{className:`lr-gate`,children:[(0,U.jsx)(`title`,{children:`validate — the engine scores the change before the first mutate step`}),(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+5,textAnchor:`middle`,children:`⛨`}),(0,U.jsx)(`text`,{x:e.x+20,y:e.y-10,className:`lr-sub lr-warn`,children:`validate`})]},e.name):(0,U.jsxs)(`g`,{className:`lr-node${e.inner?` inner`:``}${e.effect===`mutate`?` mutate`:``}${e.name===r?` current`:``}`,"aria-current":e.name===r?`step`:void 0,...n?{role:`button`,tabIndex:0,"aria-label":o(e),onClick:s(e.name),onKeyDown:s(e.name)}:{role:`img`,"aria-label":`${o(e)}${e.name===r?`, current step`:``}`},children:[(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+4,textAnchor:`middle`,children:e.name}),e.human?(0,U.jsx)(W,{x:e.x+e.r*.74,y:e.y-e.r*.74,label:e.human}):null]},e.name)),i.exit&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:i.exit.d,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),(0,U.jsx)(`text`,{x:i.exit.x+6,y:i.exit.y+4,className:`lr-lbl`,children:`close`}),(0,U.jsx)(`text`,{x:i.exit.x-90,y:i.exit.y-10,textAnchor:`middle`,className:`lr-sub`,children:`done`})]}),i.center&&a&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:i.center.x,y:i.center.y-4,textAnchor:`middle`,className:`lr-title`,children:e.name}),(0,U.jsxs)(`text`,{x:i.center.x,y:i.center.y+16,textAnchor:`middle`,className:`lr-sub lr-acc`,children:[`iterations · max `,a.max]})]})]})}var te=5e3,ne=[`prudent`,`balanced`,`aggressive`],G={running:`acc`,awaiting:`warn`,unreadable:`bad`},K=e=>!!e.graph;function re(){let[e,t]=(0,C.useState)(null),[n,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(0);return m(e=>r.activeLoops().then(n=>e()&&(t(n),i(null)),t=>e()&&i(t.message)),te,[s]),{loops:e?.loops??null,error:a||n,onPreset:(e,t)=>(o(null),r.setLoopPreset(e,t).then(()=>c(e=>e+1),e=>o(e.message)))}}var q=e=>({key:e,label:e,align:`right`,render:t=>(0,U.jsx)(`span`,{className:`num`,children:t[e]})}),ie=[q(`iteration`),{key:`intent`,label:`intent`},q(`declared`),q(`actual`),{key:`decision`,label:`decision`},{key:`tests`,label:`tests`}];function ae({history:e}){return e.length?(0,U.jsx)(`div`,{className:`loop-history`,children:(0,U.jsx)(S,{caption:`Iterations`,captionHidden:!0,columns:ie,rows:e,rowKey:e=>e.iteration})}):(0,U.jsx)(`p`,{className:`panel-note`,children:`No iteration finished yet.`})}function oe({loop:e,bricks:t,onPreset:n}){let r=K(e)?(e.graph.loops||[]).find(e=>e.iteration):null,[i,a]=(0,C.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Active loop`}),(0,U.jsx)(`span`,{className:`tag${G[e.status]?` ${G[e.status]}`:``}`,children:e.status})]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.branch,` · `,e.root]}),K(e)?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`reader-lede`,children:[`Iteration `,e.iteration,r?` / ${r.max}`:``,` · at `,e.node]}),e.awaiting?(0,U.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,U.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind,e.awaiting.kind===`gate`?` at ${e.awaiting.node}`:``]}),` `,`— Answer in the agent's session.`]}):null,(0,U.jsxs)(`label`,{className:`panel-note loop-run-preset`,children:[`preset`,(0,U.jsx)(`select`,{className:`sel`,"aria-label":`Preset for ${e.title}`,value:e.preset,disabled:i,onChange:t=>{a(!0),Promise.resolve(n(e.root,t.target.value)).finally(()=>a(!1))},children:ne.map(e=>(0,U.jsx)(`option`,{children:e},e))})]}),(0,U.jsx)(`a`,{href:`#/docs/loop-risk`,children:`What presets mean →`}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`loop-graph`,children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,highlight:e.node})}),(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Iterations`}),(0,U.jsx)(ae,{history:e.history})]}):(0,U.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its LOOP.md cannot be read, so there is no state to show.`:`Its LOOP.md is gone: the loop closed and its state went with it.`})]})}var J=encodeURIComponent,Y=o.loops.map(e=>[e,i[e]]),X={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},se={project:`Project`,global:`Global`,shipped:`Shipped`},ce={templates:`Categories`,bricks:`Origins`,active:`Statuses`},le=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function Z(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var Q=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function ue(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return Q(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>X[e.graph.category]?e.graph.category:`other`,[...Object.entries(X),[`other`,`Other`]])}function de(e,t){return Q(e.map(e=>({...e,desc:e.description,override:Z(t,e.name)})),e=>e.origin,Object.entries(se))}function fe(e){return Q(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,le)}var $=(e,t)=>(0,U.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),pe={templates:e=>e.human?$(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?$(`warn`,`mutate`):null,z(e)?$(`human`,`human gate`):null,e.override?$(`acc`,e.override):null,e.available===!1?$(`bad`,`unavailable`):null],active:e=>$(G[e.status],e.status)};function me({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:(0,U.jsx)(`a`,{href:`#/loops/bricks/${J(e)}`,children:e})}),$(t.effect===`mutate`?`warn`:``,t.effect),(0,U.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,U.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),z(t)?$(`human`,z(t).toLowerCase()):null,n?$(`acc`,n):null]}):(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:e}),(0,U.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function he(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function ge({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,C.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=he(e.graph),c=B(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>K(t)&&t.graph.name===e.name).length;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Template`}),X[e.graph.category]?$(``,X[e.graph.category]):null,e.human?$(`human`,`human gate`):null]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsxs)(`figure`,{className:`loop-console`,children:[(0,U.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:l?void 0:{"--loop-w":`${c.width}px`},children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:`smooth`,block:`nearest`})}})}),(0,U.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,U.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,U.jsx)(`ol`,{children:s.map(([e,t])=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,U.jsxs)(`span`,{className:`loop-legend`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,U.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,U.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,U.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,U.jsx)(b,{text:u,label:`Copy command`})]}),(0,U.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,U.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,U.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,U.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,U.jsx)(`li`,{children:e},e))})]}):null,(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,U.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,U.jsx)(me,{name:e,brick:o.get(e),override:Z(n,e),on:i===e},e))})]})}function _e(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
2
+ `)}\n---\n${e.body}`}function ve({b:e}){let[t,n]=(0,C.useState)(!1),r=[[`effect`,$(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,U.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>$(``,e))],[`gate`,z(e)?$(`human`,z(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,U.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Brick`}),pe.bricks(e)]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,U.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,U.jsxs)(C.Fragment,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e))}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,U.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,U.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:_e(e)}):(0,U.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,U.jsx)(x,{body:e.body})})]})}function ye({problems:e}){if(!e?.length)return null;let t=e.length;return(0,U.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,U.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,U.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,U.jsx)(`li`,{className:`mono`,children:e},e))})]})}var be={templates:{title:`No templates`,body:(0,U.jsxs)(U.Fragment,{children:[`Add one under `,(0,U.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,U.jsxs)(U.Fragment,{children:[`Add one under `,(0,U.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,U.jsxs)(U.Fragment,{children:[`Start one with `,(0,U.jsx)(`code`,{className:`mono`,children:`geneseed loop init`}),` in a worktree, or ask the agent to run a loop. It shows up here while it runs.`]})}},xe={templates:(0,U.jsxs)(U.Fragment,{children:[`A template wires bricks into a loop. `,(0,U.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,U.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,U.jsxs)(U.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,U.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,U.jsxs)(U.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,U.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function Se({tab:e=`templates`,item:t,dataRev:n}){let i=d(n),[o,m]=u(`loops`,i),{data:b,error:x}=l(()=>r.loops(f(o)),[n,o?.id??``],`loops`),S=re(),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(`all`),[O,k]=(0,C.useState)(e);e!==O&&(k(e),T(``),D(`all`));let A=b?.bricks||[],j=e===`active`?S.loops&&fe(S.loops):b&&(e===`bricks`?de(b.bricks,b.overridden):ue(b.templates,b.bricks)),M=j||[],N=g(M),P=E===`all`?M:M.filter(e=>e.group===E),F=w.trim(),I=_(P,F),L=!!(t&&j&&!M.some(e=>e.name===t)),R=L?null:M.find(e=>e.name===t)||e===`active`&&M.find(K)||M[0]||null,z={templates:b?.templates.length,bricks:b?.bricks.length,active:S.loops?.length},B=Y.find(([t])=>t===e)[1],V=e===`active`?S.error:x;return(0,U.jsxs)(U.Fragment,{children:[e===`active`?null:(0,U.jsx)(s,{className:`page-pick`,installs:i,value:o,onChange:m,label:`Templates and bricks of:`}),(0,U.jsx)(a,{error:V,style:{margin:`0 0 var(--sp-3)`}}),(0,U.jsx)(ye,{problems:b?.problems}),(0,U.jsxs)(`div`,{className:`library`,children:[(0,U.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,U.jsxs)(`div`,{className:`lib-title`,children:[(0,U.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,U.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,U.jsx)(`p`,{className:`panel-note lib-lede`,children:xe[e]}),(0,U.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:Y.map(([t,n])=>(0,U.jsxs)(C.Fragment,{children:[(0,U.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,U.jsx)(`span`,{className:`mono dim`,children:z[t]??``})]}),e===t&&(0,U.jsx)(y,{label:ce[t],total:M.length,cats:N,cat:E,onChange:D})]},t))})]}),(0,U.jsx)(h,{label:B,count:F?`${I.length} of ${P.length}`:j?P.length:``,q:w,onQ:T,matched:I.length,inView:[e,t],children:j?M.length===0?(0,U.jsx)(p,{title:be[e].title,children:be[e].body}):(0,U.jsx)(v,{rows:I,activeName:R?.name,hrefOf:t=>`#/loops/${e}/${J(t.name)}`,pills:pe[e]}):V?null:(0,U.jsx)(c,{})}),(0,U.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:L?(0,U.jsx)(p,{title:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${B.toLowerCase()} →`}}):R?e===`active`?(0,U.jsx)(oe,{loop:R,bricks:A,onPreset:S.onPreset}):e===`bricks`?(0,U.jsx)(ve,{b:R}):(0,U.jsx)(ge,{t:R,bricks:A,overridden:b.overridden,runs:S.loops},R.name):e===`active`&&j?(0,U.jsx)(p,{title:`What is a loop?`,docs:{href:`#/docs/loops`,label:`How loops work →`},children:`A loop runs bricks in a ring until its gate passes.`}):null})]})]})}export{fe as activeRows,de as brickRows,_e as brickSource,Se as default,he as howItRuns,ue as templateRows};
@@ -1 +1 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{n,r}from"./sections-ChwaobfW.js";import{F as i,ct as a}from"./index-DhNNxhfg.js";import{n as o,r as s}from"./Dashboard-DkUm4XMu.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=r.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...r.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=i(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=a(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS READOUT`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:r.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:n[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:n[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
1
+ import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{n,r}from"./sections-ChwaobfW.js";import{F as i,at as a}from"./index-CzDi9JpF.js";import{n as o,r as s}from"./Dashboard-sCfEjowQ.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=r.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...r.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=i(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=a(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS READOUT`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:r.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:n[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:n[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BxjLd7Qd.js";import{$ as i,Dt as a,H as o,J as s,Ot as c,Q as l,R as u,W as d,X as f,Y as p,_t as m,bt as h,pt as g,vt as _}from"./index-CzDi9JpF.js";import{t as v}from"./EmptyState-1sPNleqv.js";import{t as y}from"./Markdown-DpmmtW2Y.js";import{t as b}from"./Tabs-CIPyMAX-.js";import x,{installLabel as S}from"./Library-QCGXPV5h.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=i(),[r,o]=(0,C.useState)(null),[s,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(s),g=(0,C.useRef)(!1),_=e=>{o(e),l(e)},v=()=>o(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=c(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),o(null),a(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:o,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:u,notice:f,setNotice:p,save:async(e,{conflict:n}={})=>{d(!0),p(``);try{return await e(m)||!0}catch(e){e.status===409?p(n??T):p(e.message);return}finally{d(!1),t()}}}}var D=n(),O={title:``,body:``,scope:`project`,trial_until:``},k=[`project`,`global`],ee=e=>e===`user`?`global`:e,A=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,j=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),M=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function N({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(A).some(j)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),k.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function ne({rule:e,tag:t,isOpen:n,onToggle:r,onEdit:i,onDelete:a,onGraduate:o}){let s=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${n?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:r,"aria-expanded":n,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`})]}),n&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${s}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:i,"aria-label":`Edit R${e.id}${s}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Retire R${e.id}${s}`,children:`Retire`})]})]})]})}function P({onChanged:e,dataRev:t}){let n=i(),[a,o]=(0,C.useState)(0),c=g(t),l=c===null?null:c.length?c:[null],u=l?l.map(e=>e?.id??``).join(`|`):null,{data:d,error:y}=h(()=>l?Promise.allSettled(l.map(e=>r.rules(_(e)))).then(e=>{if(e.every(e=>e.status===`rejected`))throw e[0].reason;return{sets:e.flatMap((e,t)=>e.status===`fulfilled`?[{inst:l[t],data:e.value}]:[]),failed:e.flatMap((e,t)=>e.status===`rejected`?[l[t]]:[])}}):Promise.resolve(null),[a,u]),b=d?.sets,[x,S]=(0,C.useState)(null),w=()=>o(e=>e+1),T=E({data:null,reload:w}),{draft:k,busy:A,notice:j}=T,P=(0,C.useRef)(null),[F,I]=(0,C.useState)(0),L=e=>{P.current=e,I(e=>e+1)},R=(0,C.useRef)(null),z=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=P.current;if(P.current=null,e===null)return;let t=[...z.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?R.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[F]),y)return(0,D.jsx)(s,{error:y,onRetry:w});if(!b)return(0,D.jsx)(p,{});let B=l.length>1,V=e=>e?.id??``,H=b.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${V(e)}#${t.id}`}))),U=b.filter(e=>e.data.exists).map(e=>e.inst),W=U.length>0,G=k?.target,K=G!==void 0&&G!==`new`&&!H.some(e=>e.key===G&&e.title===k.title0),q=G===`new`||K,J=k?.to!==void 0&&!U.some(e=>V(e)===k.to),Y=J?null:U.find(e=>V(e)===k?.to)??U[0]??null,re=J?(0,D.jsx)(`p`,{className:`sub rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):U.length>1?(0,D.jsx)(f,{installs:U,value:Y,onChange:e=>T.setDraft({...k,to:e.id}),label:`Write to:`}):B&&Y?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Write to:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:m(Y)})]}):null,X=async(t,n,i)=>{let a=b.find(e=>V(e.inst)===V(n))?.data.fingerprint||``,o=await T.save(()=>r.rulesMutate({...t,fingerprint:a},_(n)),{conflict:i?M:te});return o&&i&&T.close(),e?.(),o},Z=e=>T.setDraft({...k,form:e}),Q=async(e,t,n)=>{await X(e,t,!0)&&L(n)},$=async e=>{await T.discard()&&L(e)},ie=async e=>{await n(`Retire rule R${e.id} — “${e.title}”${B?` from ${m(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await X({op:`delete`,id:e.id},e.inst)&&k===null&&L(`add`)},ae=async e=>{await X({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&L(e.key)},oe=b.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>B?`${m(e)}: ${t}`:t));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`eyebrow`,children:`governance · yours`}),(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub`,children:[`Your own standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),` beside the deployed AGENT.md`,B?` of each install, each rule tagged with its install`:``,`. The agent obeys them with the same force as the Laws — they may tighten a Law, never repeal one — and no update ever touches the file. Keep the set small: every rule is loaded every session.`]})]}),W&&k===null&&(0,D.jsx)(`button`,{className:`btn`,ref:R,onClick:()=>T.open({target:`new`,title0:``,form:O}),children:`Add rule`})]}),j?(0,D.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:j}):null,d.failed.length?(0,D.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,d.failed.map(e=>e?m(e):`the default install`).join(`, `),`.`]}):null,oe.map(e=>(0,D.jsxs)(`p`,{className:`sub rule-notice`,children:[`format warning: `,e]},e)),q&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),K?(0,D.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Rule R`,k.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(N,{value:k.form,onChange:Z,busy:A,writeTo:re,onCancel:()=>$(`add`),onSave:e=>!J&&U.length&&Q({op:`add`,...e},Y,`add`)})]}),W?H.length===0&&!q?(0,D.jsx)(v,{title:`No rules yet`,children:`The file is seeded and loaded every session — it is just empty. Add your first standing rule here, ask the agent for one in-session (the rule skill), or promote a recurring memory fact from the Library.`}):(0,D.jsx)(`div`,{className:`card rules-list`,ref:z,children:H.map(e=>!K&&G===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(N,{value:k.form,onChange:Z,busy:A,onCancel:()=>$(e.key),onSave:t=>Q({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(ne,{rule:e,tag:B?m(e.inst):null,isOpen:x===e.key,onToggle:()=>S(x===e.key?null:e.key),onEdit:()=>{S(e.key),T.open({target:e.key,no:e.id,to:V(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:ee(e.scope),trial_until:e.trial_until}})},onDelete:()=>ie(e),onGraduate:()=>ae(e)},e.key))}):(0,D.jsxs)(v,{title:`No user-rules.md here yet`,children:[`The build seeds it beside AGENT.md — run a build/update from the Dashboard (or`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`) and it appears, ready for your rules.`]})]})}var F=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`;function I({onChanged:e,dataRev:t}){let n=g(t);if(n===null)return(0,D.jsx)(p,{});let r=n.length?n:[null],i=r.length>1;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,children:`identity · yours`}),(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),` beside the deployed AGENT.md`,i?` of each install`:``,`. Unlike`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`, it is identity, not rules — it colours how the agent works but never binds (precedence is Laws, then rules, then this). Seeded once, never overwritten by an update. Prefer not to write it by hand? Ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]})]}),r.map(t=>(0,D.jsx)(L,{install:t,tag:i?m(t):null,onChanged:e},t?.id??``))]})}function L({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:c,setData:u}=h(()=>r.profile(_(e)),[]),d=E({data:i,reload:c}),{draft:f,dirty:m,busy:g,notice:b}=d,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||d.open(i.text||``)),o&&!i)return(0,D.jsx)(p,{});if(a)return(0,D.jsx)(s,{error:a,onRetry:c});let w=f!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile of ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(l,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:d.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||d.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!m||g,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:f,fingerprint:t},_(e)),{conflict:F});t&&(u(e=>({...e,text:f,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:g?`Saving…`:`Save`})]})]}),b?(0,D.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:b}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:f,onChange:e=>d.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(v,{title:`This is still the template`,action:(0,D.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>d.open(T),children:`Edit it here`}),children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(y,{body:T})})]}):(0,D.jsxs)(v,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var R=(e,t)=>`${e} ${t}${e===1?``:`s`}`,z=new Set([`MEMORY`,`NOTEBOOK`,`README`]),B=e=>e?(e.items||[]).filter(e=>!z.has(String(e.name).toUpperCase())).length:null;function V({rules:e,profile:t,facts:n,notes:r,tag:i}){let a=e?.exists?e.stats:null;if(!a)return null;let o=Math.round(Math.max(a.rules/a.max_rules,a.tokens/a.max_tokens)*100),[s,c]=o>=100?[`bad`,`over budget: a bloated rule set dilutes the rules that matter`]:o>=70?[`warn`,`getting heavy; consider merging or pruning`]:[`accent`,a.rules?`${a.rules} rules in ${a.lines} lines.`:`All of it is the file’s preamble; no rule text yet.`],l=[{k:`Profile`,v:t?.seeded?`template`:t?.exists?`written`:`missing`,warn:!!t?.seeded},{k:`Rules`,v:`${a.rules}/${a.max_rules}`},{k:`Memory`,v:n==null?`n/a`:R(n,`fact`)},{k:`Notebook`,v:r==null?`n/a`:R(r,`note`)}];return(0,D.jsxs)(`div`,{className:`card-row`,children:[(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-budget`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pc-budget`,children:`Rule budget`}),(0,D.jsxs)(`span`,{className:`mono dim`,children:[a.rules,` of `,a.max_rules,i?` · ${i}`:``]})]}),(0,D.jsx)(`div`,{className:`slots`,style:{"--slots":a.max_rules},role:`img`,"aria-label":`${a.rules} of ${a.max_rules} rule slots used`,children:Array.from({length:a.max_rules},(e,t)=>(0,D.jsx)(`span`,{className:t<a.rules?`used`:``},t))}),(0,D.jsxs)(`p`,{className:`big-num`,children:[(0,D.jsx)(`span`,{className:`mono`,children:a.tokens}),` `,(0,D.jsxs)(`span`,{className:`dim`,children:[`/ `,a.max_tokens.toLocaleString(`en-US`),` tokens, every turn`]})]}),(0,D.jsx)(u,{value:a.tokens,max:a.max_tokens,label:`tokens`,tone:s}),(0,D.jsx)(`p`,{className:`panel-note`,children:c})]}),(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-known`,children:[(0,D.jsx)(`div`,{className:`panel-head`,children:(0,D.jsx)(`h2`,{id:`pc-known`,children:`What the agent knows about you`})}),(0,D.jsx)(`ul`,{className:`hbars`,children:l.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.k}),(0,D.jsx)(`span`,{className:`mono hb-n${e.warn?` warn`:``}`,children:e.v})]},e.k))}),i?(0,D.jsxs)(`p`,{className:`panel-note`,children:[`Profile and rules of `,i,`; memory and notebook across every install.`]}):null]})]})}var H=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,U=e=>String(e||``).split(`
2
+ `).map(e=>H.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function W({topics:e,install:t}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:R(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:R(e.n,`fact`)})]},e.topic))})]}):null}var G={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function K({tab:e=`rules`,item:t,dataRev:n}){let i=e=>Promise.resolve(e).catch(()=>null),{data:a,reload:s}=o(n),c=g(n),l=c?.length>1?m(c[0]):null,{data:u,reload:f}=h(()=>i(r.profile()),[n]),{data:p,reload:_}=h(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:y}=h(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),S=B(p),{data:C}=h(()=>e===`memory`?i(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,S]),w=B(y),T={memory:S,notebook:w},E={rules:a?.stats?.rules,profile:u?.seeded?`template`:null,memory:S,notebook:w},O=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`}),(0,D.jsx)(b,{page:`personal`,current:e,badges:E,label:`Personal files`}),e===`rules`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(V,{rules:a,profile:u,facts:S,notes:w,tag:l}),(0,D.jsx)(P,{onChanged:s,dataRev:n})]}),e===`profile`&&(0,D.jsx)(I,{onChanged:f,dataRev:n}),O&&T[e]===0&&!t?(0,D.jsx)(v,{title:G[e].title,action:G[e].action,children:G[e].body}):O?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(W,{topics:U(C?.body),install:C?.install}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onRulesChanged:()=>{s(),_()}},e)]}):null]})}export{K as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{Et as n,Tt as r}from"./index-CzDi9JpF.js";e();var i=t();function a({page:e,current:t,badges:a={},label:o}){return(0,i.jsx)(`nav`,{className:`tabs`,"aria-label":o,children:r[e].map(r=>(0,i.jsxs)(`a`,{href:`#/${e}/${r}`,className:t===r?`on`:``,"aria-current":t===r?`page`:void 0,children:[n[r],a[r]==null?null:a[r]?.of?(0,i.jsxs)(`span`,{className:`tab-badge`,title:`for ${a[r].of}`,children:[a[r].v,(0,i.jsxs)(`span`,{className:`sr-only`,children:[` for `,a[r].of]})]}):(0,i.jsx)(`span`,{className:`tab-badge`,children:a[r]?.v??a[r]})]},r))})}export{a as t};
@@ -0,0 +1 @@
1
+ var e=typeof window<`u`?window.__GENESEED_TOKEN__:``;async function t(e){let t=await e.json().catch(()=>({})),n=e.status===403&&t.error===`forbidden`?`the web server restarted since this page loaded — reload the page, then re-apply your edit`:t.error||t.message||e.statusText,r=Error(n);return r.status=e.status,r.body=t,r}async function n(e){let n=await fetch(e);if(!n.ok)throw await t(n);return n.json()}async function r(n,r={}){let i=await fetch(n,{method:`POST`,headers:{"X-Geneseed-Token":e||``,"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok)throw await t(i);return i.json()}var i=e=>{if(e==null)return!1;if(typeof e.host==`string`&&typeof e.path==`string`)return!0;throw Error(`an install needs both host and path`)},a=(e,t)=>{if(!i(t))return e;let n=new URLSearchParams({host:t.host,path:t.path});return`${e}${e.includes(`?`)?`&`:`?`}${n}`},o=(e,t)=>{let n=e??{};if(!i(t))return n;if(`host`in n||`path`in n)throw Error(`this body already has host or path`);return{...n,host:t.host,path:t.path}},s=e=>{try{return e()}catch(e){return Promise.reject(e)}},c=(e,t)=>s(()=>n(a(e,t))),l=(e,t,n)=>s(()=>r(e,o(t,n))),u=e=>c(`/api/overview`,e),d=()=>n(`/api/fleet`),f=()=>n(`/api/kits`),p=()=>n(`/api/usage`),m=()=>n(`/api/gates`),h=()=>n(`/api/update`),g=e=>c(`/api/recent`,e),_=()=>n(`/api/activity`),v=(e,t)=>c(`/api/activity/`+encodeURIComponent(e),t),y=(e,t)=>l(`/api/activity`,{enabled:e},t),b=e=>c(`/api/setup`,e),x=(e=!1,t)=>c(e?`/api/doctor?fresh=1`:`/api/doctor`,t),S=e=>c(`/api/themes`,e),C=(e,t)=>c(`/api/catalog/${e}`,t),w=(e,t,n)=>c(`/api/item/${e}/${encodeURIComponent(t)}`,n),T=(e,t)=>l(`/api/memory/delete`,{name:e},t),E=e=>c(`/api/diff`,e),D=(e,t)=>l(`/api/actions/restore`,{files:e},t),O=409,k=e=>n(`/api/jobs/${e}`),A=()=>n(`/api/jobs`),j=e=>r(`/api/jobs/${e}/cancel`),M=new Set([`build`,`restore`]);async function N(e,t,n){let i=t||{},a=`/api/actions/${e}`;try{return await(M.has(e)?l(a,i,n):r(a,i))}catch(e){throw e.status===O&&e.body?.error===`busy`?Error(`An action is already running.`,{cause:e}):e}}var P=e=>c(`/api/loops`,e),F=()=>n(`/api/loops/active`),I=(e,t)=>r(`/api/loops/preset`,{root:e,preset:t}),L=()=>n(`/api/mcp`),R=e=>r(`/api/reveal`,{path:e}),z=()=>n(`/api/installs`),B=(e,t,n)=>r(`/api/install`,{host:e,path:t,action:n}),V=(e,t,n)=>r(`/api/install`,{host:e,path:t,action:`remove`,memory:n}),H=()=>r(`/api/pick-folder`,{}),U=()=>n(`/api/ping`),W=()=>r(`/api/shutdown`),G=()=>r(`/api/restart`),K=e=>e?`?harness=${encodeURIComponent(e)}`:``,q={fleet:d,kits:f,usage:p,gates:m,update:h,loops:P,activeLoops:F,setLoopPreset:I,overview:u,recent:g,activity:_,activityDetail:v,activityToggle:y,setup:b,doctor:x,themes:S,catalog:C,item:w,memoryDelete:T,diff:E,restore:D,job:k,jobs:A,cancelJob:j,action:N,mcp:L,mcpReveal:R,installs:z,installToggle:B,installRemove:V,pickFolder:H,ping:U,shutdown:W,restart:G,docs:(e,t)=>c(`/api/docs${K(e)}`,t),docsPage:(e,t,n)=>c(`/api/docs/page/${encodeURIComponent(e)}${K(t)}`,n),rules:e=>c(`/api/rules`,e),rulesMutate:(e,t)=>l(`/api/rules`,e,t),rulesPromote:(e,t)=>l(`/api/rules/promote`,e,t),profile:e=>c(`/api/profile`,e),profileSave:(e,t)=>l(`/api/profile`,e,t),excludes:()=>n(`/api/excludes`),excludeMutate:(e,t)=>r(`/api/excludes`,{action:e,path:t})};export{q as t};