geneseed 6.0.2 → 6.0.3

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 (63) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/SHIPPED.md +1 -1
  3. package/adapters/opencode/plugins/geneseed-context.js +53 -10
  4. package/adapters/opencode/plugins/geneseed-learn.js +11 -4
  5. package/docs/web-ui.md +25 -0
  6. package/harness.config.json +1 -1
  7. package/js/build/bundle.mjs +2 -11
  8. package/js/build/fold.mjs +3 -20
  9. package/js/build/stubs.mjs +42 -5
  10. package/js/hosts/hooks-context.mjs +65 -9
  11. package/js/hosts/memory-files.mjs +166 -13
  12. package/js/inspect/doctor.mjs +2 -0
  13. package/js/inspect/status.mjs +4 -1
  14. package/js/maintain/memory.mjs +2 -2
  15. package/js/web/catalog.mjs +5 -3
  16. package/package.json +1 -1
  17. package/src/agents/memory-curator.md +1 -1
  18. package/src/memory/README.md +24 -5
  19. package/src/skills/rule/approve.md +3 -1
  20. package/src/skills/rule/consolidate.md +1 -1
  21. package/web/dist/assets/ActiveLoops-paFbiZyt.js +1 -0
  22. package/web/dist/assets/Activity-IAxWF2wK.js +1 -0
  23. package/web/dist/assets/ActivityDetail-CtC2DLvh.js +1 -0
  24. package/web/dist/assets/{Bonsai-Bry-kOFb.js → Bonsai-BoKo68Kw.js} +1 -1
  25. package/web/dist/assets/{CopyButton-Cnnvjgkg.js → CopyButton-C0VTiqmb.js} +1 -1
  26. package/web/dist/assets/Dashboard-CRGCp2cV.js +2 -0
  27. package/web/dist/assets/{Docs-BJ23-fIx.js → Docs-DwOwzaD6.js} +2 -2
  28. package/web/dist/assets/Factories-DxHD2T-1.js +1 -0
  29. package/web/dist/assets/{GreenhouseView-VL_ZKJUR.js → GreenhouseView-D5VOmhmR.js} +1 -1
  30. package/web/dist/assets/Installs-B5hFSUeN.js +3 -0
  31. package/web/dist/assets/JournalView-gUSGysTm.js +1 -0
  32. package/web/dist/assets/{Kits-DDSerkJk.js → Kits-DYQvykZ0.js} +1 -1
  33. package/web/dist/assets/Laws-UVk0uojS.js +4 -0
  34. package/web/dist/assets/{LibRows-QsUBjOF7.js → LibRows-CwK63kjB.js} +1 -1
  35. package/web/dist/assets/Library-DdzyrwUK.js +3 -0
  36. package/web/dist/assets/Loops-yHga7xdr.js +2 -0
  37. package/web/dist/assets/Models-DAgkQ4CE.js +1 -0
  38. package/web/dist/assets/{OperatorHudView-Bdupodlc.js → OperatorHudView-D1lQF-ZY.js} +1 -1
  39. package/web/dist/assets/Personal-DjhIfa9v.js +2 -0
  40. package/web/dist/assets/Settings-Brgec4M0.js +1 -0
  41. package/web/dist/assets/Tabs-BHjxciOL.js +1 -0
  42. package/web/dist/assets/index-BILaKHbH.js +6 -0
  43. package/web/dist/assets/index-BfyZCNu7.css +1 -0
  44. package/web/dist/assets/router-1EhRJy1C.js +1 -0
  45. package/web/dist/assets/useLocalStorage-54tkqXN7.js +1 -0
  46. package/web/dist/index.html +4 -2
  47. package/web/dist/assets/ActiveLoops-BWkImeYa.js +0 -1
  48. package/web/dist/assets/Activity-DJlPhk8q.js +0 -1
  49. package/web/dist/assets/ActivityDetail-Dk7UPnE_.js +0 -1
  50. package/web/dist/assets/Dashboard-CWhh_GSc.js +0 -2
  51. package/web/dist/assets/Factories-CjsIACyi.js +0 -1
  52. package/web/dist/assets/Installs-qcfOZNzF.js +0 -3
  53. package/web/dist/assets/JournalView-KrmFUC-X.js +0 -1
  54. package/web/dist/assets/Laws-DDffPs6O.js +0 -4
  55. package/web/dist/assets/Library-DzT3Mebh.js +0 -3
  56. package/web/dist/assets/Loops-CjsX3brz.js +0 -2
  57. package/web/dist/assets/Models-DPrAv3FG.js +0 -1
  58. package/web/dist/assets/Personal-D-dpCUU5.js +0 -2
  59. package/web/dist/assets/Settings-Dz33_Sys.js +0 -1
  60. package/web/dist/assets/Tabs-qY40S34V.js +0 -1
  61. package/web/dist/assets/index-BhT94v2q.js +0 -6
  62. package/web/dist/assets/index-DcusoHzF.css +0 -1
  63. package/web/dist/assets/usePoll-D5c_qIFZ.js +0 -1
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-CxkA7940.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/AgentGlyph-k6o3gCM1.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C8nMUU1i.js";import{i}from"./router-1EhRJy1C.js";import{At as a,B as o,Ct as s,G as c,S as l,St as ee,U as te,Y as u,at as d,dt as f,et as ne,ft as re,ht as p,it as m,ot as h,t as g,tt as _,x as v}from"./index-BILaKHbH.js";import{n as y,t as b}from"./sections-CtFz7HFH.js";import{a as ie,c as ae,i as oe,l as se,n as ce,o as le,r as ue,t as de}from"./LibRows-CwK63kjB.js";import{t as fe}from"./EmptyState-CY5Pm2xy.js";import{o as x}from"./motion-RlUl1osO.js";var S=e(t(),1),C=n();function w({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,C.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function pe({entries:e}){return e.length?(0,C.jsxs)(`table`,{className:`mf-entries`,children:[(0,C.jsx)(`thead`,{className:`sr-only`,children:(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`th`,{scope:`col`,children:`Path`}),(0,C.jsx)(`th`,{scope:`col`,children:`Load`}),(0,C.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,C.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,C.jsx)(`td`,{className:`mf-load-cell`,children:(0,C.jsx)(w,{load:e.load})}),(0,C.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function me({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,C.jsxs)(`div`,{className:`mf-vault`,children:[(0,C.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,C.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,C.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,C.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,C.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,C.jsxs)(`span`,{className:`mf-role`,children:[(0,C.jsx)(s,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,C.jsxs)(`span`,{className:`mf-role`,children:[(0,C.jsx)(s,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,C.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,C.jsx)(s,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,C.jsx)(pe,{entries:t})]})}function T({body:e}){let[t,n]=(0,S.useState)(!1),r=(0,S.useId)();return e?(0,C.jsxs)(`div`,{className:`mf-raw`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,C.jsx)(s,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,C.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function he({manifest:e,body:t,name:n}){if(!e)return(0,C.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,C.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,C.jsx)(me,{wiki:e},e.name||t)),(0,C.jsx)(T,{body:t})]}):(0,C.jsxs)(`div`,{className:`mf-empty`,children:[(0,C.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,C.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,C.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,C.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,C.jsx)(T,{body:t})]})}let r=e.context||[];return r.length?(0,C.jsxs)(`div`,{className:`mf-doc`,children:[(0,C.jsx)(pe,{entries:r}),(0,C.jsx)(T,{body:t})]}):(0,C.jsxs)(`div`,{className:`mf-empty`,children:[(0,C.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,C.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,C.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,C.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,C.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,C.jsx)(T,{body:t})]})}function ge({name:e,install:t,installId:n}){let{data:i,error:o}=a(()=>Promise.resolve().then(()=>r.agentModels(t,{light:!0})),[e,t?.host,t?.path]),s=i?.agents?.find(t=>t.name===e);return o||!i?.claude||!s?null:(0,C.jsxs)(`p`,{className:`sub agent-model`,"data-testid":`agent-model-line`,children:[s.tier?`${s.tier} tier`:`not tiered`,` · runs on `,s.model?(0,C.jsx)(`code`,{children:s.model}):`your session model`,` — `,(0,C.jsx)(`a`,{href:`#/models`,onClick:()=>n&&c(`models`,n),children:`Change on Models →`})]})}var E=e=>e>=1e3?`${(e/1e3).toFixed(+(e<1e4))}k`:String(e),D=e=>Math.round(e/4),_e=[{key:`root`,label:`Constitution`,tone:`accent`,has:e=>e.source===`root`},{key:`catalogue`,label:`Catalogues`,tone:`muted`,has:e=>e.source===`catalogue`},{key:`agent`,label:`This agent`,tone:`warn`,has:e=>e.source!==`root`&&e.source!==`catalogue`}],O=[[`dictate`,`Dictates`],[`doctrine`,`Doctrines`],[`user`,`User rules`]],ve={"not-wired":`not wired, re-emit this install`,"no-event":`not delivered on this host`};function k(e,t){if(!e||!t)return``;let n=(e,t)=>e.blocks.filter(e=>e.chars>0&&!t.blocks.some(t=>t.id===e.id)),r=e=>e.id===`session-files`?`session files`:e.label.replace(/^.* spec$/,`spec`);return[...n(e,t).map(e=>`+ ${r(e)} ${E(e.chars)}`),...n(t,e).map(e=>`− ${r(e)} ${E(e.chars)}`)].join(`, `)}var ye=e=>e.kind===`user`?`#/personal/rules`:`#/item/law/${encodeURIComponent(e.id)}`,be=e=>`${e.layer??``}${e.id}`;function A({label:e,n:t,children:n}){return(0,C.jsxs)(`li`,{children:[(0,C.jsx)(`span`,{children:e}),n,(0,C.jsx)(`span`,{className:`mono`,children:E(t)})]})}function xe({loadout:e,base:t,error:n,install:r}){let[i,a]=(0,S.useState)(!1),[s,c]=(0,S.useState)(e?.agent);if(e?.agent!==s&&(c(e?.agent),a(!1)),n)return(0,C.jsx)(`p`,{className:`sub`,children:`Loadout not measured for this install.`});if(!e)return null;let l=e=>e.reduce((e,t)=>e+t.chars,0),ee=l(e.blocks),te=k(e,t),u=_e.map(t=>{let n=e.blocks.filter(t.has);return{...t,blocks:n,n:l(n)}}),[d,f,ne]=u,re=Math.max(1,...d.blocks.map(e=>e.chars)),p=e.blocks.find(e=>e.id===`user-rules`),m=p?ve[p.delivery]:void 0,h=e.rules||[],g=h.filter(e=>!(m&&e.kind===`user`)),_=h.filter(e=>e.citedBySpec),v=[];for(let e of h){let t=e.kind===`dictate`?`Dictates`:e.kind===`user`?`User rules`:e.id.split(`.`)[0],n=v.find(e=>e.name===t);n?n.n+=1:v.push({name:t,n:1,user:e.kind===`user`})}let y=O.map(([e,t])=>[t,g.filter(t=>t.kind===e).length]).filter(([,e])=>e>0);return(0,C.jsxs)(`section`,{className:`loadout`,"aria-label":`Loadout`,children:[(0,C.jsxs)(`header`,{className:`loadout-head`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`h3`,{className:`loadout-eyebrow mono`,children:[`Loadout · `,r||e.host]}),(0,C.jsxs)(`p`,{className:`loadout-total`,children:[(0,C.jsx)(`strong`,{children:E(D(ee))}),(0,C.jsxs)(`span`,{className:`dim`,children:[`tokens at start · `,E(ee),` chars`]})]})]}),te?(0,C.jsxs)(`div`,{className:`loadout-delta`,children:[(0,C.jsxs)(`span`,{className:`dim`,children:[`Against the `,t?.noun||`Primary agent`]}),(0,C.jsx)(`ul`,{children:te.split(`, `).map(e=>(0,C.jsx)(`li`,{className:`mono loadout-pill${e.startsWith(`+`)?` is-plus`:``}`,children:e},e))})]}):null]}),(0,C.jsxs)(`div`,{className:`loadout-bar`,children:[(0,C.jsx)(o,{label:`Loadout`,legend:!1,parts:u.map(e=>({key:e.key,label:e.label,n:e.n,tone:e.tone}))}),(0,C.jsx)(`ul`,{className:`loadout-groups`,"aria-hidden":`true`,children:u.map(e=>e.n>0?(0,C.jsxs)(`li`,{style:{flexGrow:e.n},children:[(0,C.jsx)(`span`,{children:e.label}),` `,(0,C.jsxs)(`span`,{className:`mono dim`,children:[E(e.n),` · `,Math.round(e.n/ee*100),`%`]})]},e.key):null)})]}),(0,C.jsxs)(`details`,{className:`loadout-card`,open:e.agent===`primary`,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsx)(`i`,{className:`tone-accent`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`Constitution`}),(0,C.jsx)(`span`,{className:`dim`,children:`root file, loaded by the host`}),(0,C.jsxs)(`span`,{className:`mono dim loadout-sum`,children:[E(d.n),` · ≈ `,E(D(d.n)),` tok`]})]}),(0,C.jsx)(`ul`,{className:`loadout-root`,children:d.blocks.map(e=>(0,C.jsx)(A,{label:e.label,n:e.chars,children:(0,C.jsx)(`span`,{className:`loadout-mini`,"aria-hidden":`true`,children:(0,C.jsx)(`span`,{style:{width:`${Math.max(4,e.chars/re*100)}%`}})})},e.id))})]}),(0,C.jsxs)(`div`,{className:`loadout-pair`,children:[(0,C.jsxs)(`div`,{className:`loadout-card`,children:[(0,C.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,C.jsx)(`i`,{className:`tone-muted`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`Catalogues`}),(0,C.jsx)(`span`,{className:`mono dim loadout-sum`,children:E(f.n)})]}),(0,C.jsx)(`ul`,{className:`loadout-list`,children:f.blocks.map(e=>(0,C.jsx)(A,{label:e.label,n:e.chars},e.id))}),(0,C.jsx)(`p`,{className:`dim loadout-note`,children:`Listed by the host, not by Geneseed.`})]}),(0,C.jsxs)(`div`,{className:`loadout-card is-own`,children:[(0,C.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,C.jsx)(`i`,{className:`tone-warn`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`This agent`}),(0,C.jsx)(`span`,{className:`mono dim loadout-sum`,children:E(ne.n)})]}),(0,C.jsx)(`ul`,{className:`loadout-list`,children:ne.blocks.map(e=>(0,C.jsx)(A,{label:e.label,n:e.chars,children:e.id===`user-rules`?(0,C.jsx)(`span`,{className:`loadout-pill${m?` is-plus`:``}`,children:m||`injected at sub-agent start`}):null},e.id))})]})]}),(0,C.jsxs)(`section`,{className:`loadout-rules`,"aria-label":`Rules it follows`,children:[(0,C.jsxs)(`div`,{className:`loadout-rules-h`,children:[(0,C.jsxs)(`h4`,{className:`loadout-eyebrow mono`,children:[`Rules it follows · `,g.length]}),(0,C.jsx)(`span`,{className:`dim`,children:y.map(([e,t])=>`${t} ${e}`).join(` · `)})]}),_.length?(0,C.jsxs)(`div`,{className:`loadout-cited`,children:[(0,C.jsx)(`span`,{className:`loadout-cited-h`,children:`Cited by its spec`}),_.map(e=>(0,C.jsxs)(`a`,{href:ye(e),children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` · `,e.title]},be(e)))]}):null,(0,C.jsx)(`ul`,{className:`loadout-packs`,children:v.map(e=>e.user&&m?(0,C.jsxs)(`li`,{className:`is-muted`,children:[(0,C.jsx)(`span`,{children:`User rules`}),` `,(0,C.jsx)(`span`,{className:`mono`,children:e.n}),` `,(0,C.jsx)(`span`,{className:`dim`,children:m})]},e.name):(0,C.jsx)(`li`,{children:(0,C.jsxs)(`a`,{href:e.user?`#/personal/rules`:`#/laws`,children:[(0,C.jsx)(`span`,{children:e.name}),` `,(0,C.jsx)(`span`,{className:`mono dim`,children:e.n})]})},e.name))}),h.length?(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":i,onClick:()=>a(e=>!e),children:i?`Show fewer`:`Show all ${h.length}${m?` listed`:``} rules`}):null,i?O.map(([e,t])=>{let n=h.filter(t=>t.kind===e),r=m&&e===`user`;return n.length?(0,C.jsxs)(`div`,{className:r?`is-muted`:void 0,children:[(0,C.jsxs)(`h5`,{className:`reader-when-h`,children:[t,` `,(0,C.jsx)(`span`,{className:`mono dim`,children:n.length}),r?(0,C.jsxs)(`span`,{className:`dim`,children:[` · `,m]}):null]}),(0,C.jsx)(`ul`,{children:n.map(e=>(0,C.jsxs)(`li`,{children:[r?(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}):(0,C.jsxs)(`a`,{href:ye(e),children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}),e.layer&&e.layer!==`install`?(0,C.jsxs)(`span`,{className:`dim`,children:[` (`,e.layer,`)`]}):null]},be(e)))})]},e):null}):null]}),(0,C.jsxs)(`p`,{className:`dim loadout-foot`,children:[`Not counted: `,e.notCounted.join(`; `),`. Tokens are chars ÷ 4.`]})]})}function Se({label:e,options:t,value:n,onChange:r}){let[i,a]=(0,S.useState)(!1),o=(0,S.useRef)(null),s=(0,S.useId)(),c=t.find(e=>e.key===n)||t[0],l=()=>a(!1);return(0,S.useEffect)(()=>{i&&document.getElementById(s)?.querySelector(`[aria-pressed="true"]`)?.focus()},[i,s]),(0,C.jsxs)(`span`,{className:`drop-menu`,children:[(0,C.jsxs)(`button`,{ref:o,type:`button`,className:`drop-menu-btn`,"aria-label":`${e}: ${c.label}`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-controls":i?s:void 0,onClick:()=>a(e=>!e),children:[c.label,(0,C.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,C.jsx)(d,{open:i,onClose:l,anchorRef:o,label:e,className:`drop-menu-pop`,children:(0,C.jsx)(`div`,{id:s,className:`drop-menu-list`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(document.activeElement);e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()},children:t.map(e=>(0,C.jsx)(`button`,{type:`button`,"aria-pressed":e.key===c.key,onClick:()=>{r(e.key),l()},children:e.label},e.key))})})]})}function Ce({label:e,value:t,delta:n,children:r}){let i=x(Number.isInteger(t)?t:null);return(0,C.jsxs)(`div`,{className:`stat`,children:[(0,C.jsx)(`div`,{className:`stat-label`,children:e}),(0,C.jsx)(`div`,{className:`stat-value mono`,children:i===null?t:Math.round(i)}),n==null?null:(0,C.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var we=(0,S.lazy)(()=>g(()=>import(`./Markdown-CxkA7940.js`).then(e=>e.n),__vite__mapDeps([0,1,2]))),Te=(0,S.lazy)(()=>g(()=>import(`./AgentGlyph-k6o3gCM1.js`),__vite__mapDeps([3,1,2]))),Ee={skills:`skill`,agents:`agent`},De=`:primary`,Oe=(e,t)=>`${t?e/t*100:0}%`,ke=e=>e.split(`:`).slice(0,2).join(` `),Ae=e=>e.split(`/`).map((e,t)=>(0,C.jsxs)(S.Fragment,{children:[t?`/`:null,t?(0,C.jsx)(`wbr`,{}):null,e]},t)),j=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},je=e=>p(j(e));function Me(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 Ne({section:e,source:t}){return(0,C.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,C.jsx)(s,{name:y[e].icon,className:`glyph`}),(0,C.jsxs)(`span`,{children:[`This entry is part of the `,y[e].label.toLowerCase(),` convention; see`,` `,(0,C.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var Pe=e=>e.replace(/\s+/g,` `).trim(),Fe=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Ie(e,t){let n=e.replace(/\r\n/g,`
3
+ `),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=Fe(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?Pe(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?Pe(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=Fe(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function Le({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,C.jsx)(`div`,{className:`lib-stats`,children:(0,C.jsx)(Ce,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(ke))].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,C.jsx)(`div`,{className:`lib-stats`,children:(0,C.jsx)(Ce,{label:`Used`,value:e.n,delta:o,children:(0,C.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,C.jsx)(`i`,{className:t===29?`today`:``,style:{height:Oe(e,a)}},t))})})})}function Re(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 ze={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},Be=(e,t,n=b)=>t||(e&&b.includes(e)?e:n[0]??b[0]),Ve=encodeURIComponent;function He(e){let t=e=>v[e.klass]?e.klass:`personal`,n=l.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:v[n].label,groupC:v[n].c})));return{rows:n,cats:l.map(e=>({key:e,label:v[e].label,c:v[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ue(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 We({overview:e,section:t,selected:n,dataRev:o,lock:s,base:c,onRulesChanged:l,onCountsChanged:d}){let p=h(),{canSee:g}=ee(),x=b.filter(e=>g(`section:library/${e}`)),[w,pe]=(0,S.useState)(()=>Be(t,s,x)),[me,T]=(0,S.useState)(``),[E,D]=(0,S.useState)(`all`),[_e,O]=(0,S.useState)(`all`),[ve,k]=(0,S.useState)(``),[ye,be]=(0,S.useState)(null),[A,Ce]=(0,S.useState)(null),[ke,Pe]=(0,S.useState)(t);if(t!==ke){Pe(t),k(``);let e=Be(t,s,x);e!==w&&(pe(e),T(``),D(`all`),O(`all`))}let[Fe,We]=(0,S.useState)(n);n!==Fe&&(We(n),k(``));let{data:Ge,error:Ke,reload:qe}=a(()=>r.catalog(w),[w,o],`catalog`),Je=s?null:Ee[w]||null,Ye=Je!==null,{data:M}=a(()=>Ye?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[Ye,o],`usage`,{revalidate:!0}),N=Ye&&!!M?.enabled&&Array.isArray(M.names),Xe=(0,S.useMemo)(()=>new Map((Array.isArray(M?.names)?M.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[M]),P=e=>N&&Xe.get(`${Je}\u0000${e}`)||null,Ze=e=>{let t=P(e.name);return!t||t.n===0&&!t.last},Qe=M?.since?`No call since ${M.since}`:`No call recorded yet`,F=Ge?.section===w,I=F&&Ge?.items||[],$e=!F&&!Ke,[et,...tt]=F&&Ge.sharedInstalls||[],L=e=>e===et?`shared`:je(e),R=w===`skills`,nt=R?He(I):null,z=R?nt.rows:w===`memory`?Ue(I):I,B=n||z[0]?.name||null,V=w===`agents`&&!s,H=V&&B===`:primary`,{data:rt,error:it}=a(()=>V?Promise.resolve().then(()=>r.loadout()):Promise.resolve(null),[V,o],`loadout-primary`,{revalidate:!0}),at=V?{name:De,type:`agent`,base:!0,title:!it&&rt?.noun||`Primary agent`,desc:`The main agent of the session. Every agent inherits its root file.`}:null,ot=H?at:B?I.find(e=>e.name===B):null,st=ot?.type||y[w].type,U=A?.sec===w&&A?.name===B?A.key:null,{data:ct,error:lt}=a(()=>!B||H?Promise.resolve(null):U?r.item(st,B,j(U)):r.item(st,B),[w,B,st,U,o,H]),W=lt?null:ct,ut=W&&W.name===B&&(!U||W.install===U)?W:null,dt=e=>Ct&&e?.install?` in ${L(e.install)}`:``,G=H?null:U||W?.install||null,ft=V&&B&&!H&&W&&W.name===B,{data:pt,error:mt}=a(()=>ft?Promise.all([r.loadout(B,G?j(G):void 0),r.loadout(void 0,G?j(G):void 0).catch(()=>null)]).then(([e,t])=>({own:e,base:t})):Promise.resolve(null),[ft,B,G,o]),ht=H?{own:it?null:rt,base:null}:pt,gt=H?it:mt,_t=ve||Ke||lt,vt=B?{name:B,title:W?.title||B,desc:W?.desc||``}:null,K=ot||vt,yt=t=>t===w&&F?I.length:e?.counts?.[t]??``,bt=u(o),xt=G||bt?.[0]?.id,St=xt?je(xt):void 0,Ct=new Set(I.flatMap(e=>e.installs||[])).size>1,wt=re([...(bt||[]).map(e=>e.id),...I.flatMap(e=>e.installs||[])],tt),q=R?z.filter(e=>E===`all`||e.cat===E):z,Tt=N?q.filter(Ze).length:0,Et=e=>e.status===`experimental`,Dt=q.filter(Et).length,J=[[`all`,`All`,q.length],...N?[[`used`,`Used`,q.length-Tt],[`unused`,`Not used yet`,Tt,Qe]]:[],...Dt?[[`experimental`,`Experimental`,Dt,`Shipped, not yet confirmed by real use`]]:[]],Y=J.some(([e])=>e===_e)?_e:`all`,Ot=Y===`all`?q:Y===`experimental`?q.filter(Et):q.filter(e=>Ze(e)===(Y===`unused`)),kt=N?Math.max(0,...I.map(e=>P(e.name)?.n||0)):0,At=R?1/0:50,X=me.trim().toLowerCase(),Z=X?ie(Ot,X):Ot.slice(0,At),jt=!X&&E===`all`&&Y===`all`&&B&&!Z.some(e=>e.name===B)?[...Z,...z.filter(e=>e.name===B)]:Z,Mt=at&&F&&E===`all`&&Y===`all`?ie([at],X):[],Nt=Mt.length+Z.length,Pt=[...Mt,...jt],Ft=e=>c?`${c}/${Ve(e.name)}`:`#/item/${e.type||y[w].type}/${Ve(e.name)}`,It=async()=>{let e=ut;if(!e)return;let t=e.name;if(await p(`Forget the memory fact "${t}"${dt(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`})){k(``);try{await r.memoryDelete(t,e.install?j(e.install):void 0)}catch(e){k(`Could not forget "${t}": ${e.message}`);return}i(c||`#/personal/memory`),qe(),d?.()}},Lt=async()=>{let e=ut;if(!e)return;let t=e.name;if(await p(`Promote "${t}"${dt(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`})){k(``);try{let n=e.install?j(e.install):void 0,a=await r.rules(n);await r.rulesPromote({name:t,fingerprint:a.fingerprint,delete_memory:!0},n),te(),l?.(),d?.(),i(`#/personal/rules`)}catch(e){k(`Could not promote: ${e.message}`),qe()}}},Rt=W?.body?Ie(W.body,W.desc||K?.desc):null,zt=W?.title||K?.title||K?.name,Bt=zt===K?.name&&Rt?.title?Rt.title:zt,Vt=F&&I.length===0,Ht=W?.status||K?.status,Ut=w===`skills`?v[ot?.klass]:null,Q=y[w].label,{lede:Wt,when:Gt}=Re(W?.desc||K?.desc||``),$=K&&!H?W?.source||K.source||(lt?null:Me(w,K.name)):null,Kt=async()=>{try{await navigator.clipboard.writeText($),be({src:$,ok:!0})}catch{be({src:$,ok:!1})}},qt=b.filter(e=>e===w||x.includes(e));return(0,C.jsxs)(`div`,{className:`lib-wrap`,children:[(0,C.jsx)(ne,{error:_t,style:{margin:`0 0 var(--sp-3)`}}),(0,C.jsxs)(`div`,{className:`library lib-dossier${s?` locked`:``}${N?` uses`:``}`,children:[s?null:(0,C.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,C.jsxs)(`div`,{className:`lib-title`,children:[(0,C.jsx)(`h1`,{className:`h`,children:`Library`}),(0,C.jsx)(`span`,{className:`dim`,children:`What the agent knows`}),N&&M.since?(0,C.jsxs)(`span`,{className:`mono dim lib-title-since`,children:[`calls since `,M.since]}):null]}),(0,C.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:qt.map(e=>(0,C.jsxs)(S.Fragment,{children:[(0,C.jsxs)(`a`,{href:`#/section/${e}`,className:w===e?`on`:``,"aria-current":w===e?`page`:void 0,children:[y[e].label,(0,C.jsx)(`span`,{className:`mono dim`,children:yt(e)})]}),e===w&&R&&F&&(0,C.jsx)(le,{label:`Skill types`,total:I.length,cats:nt.cats,cat:E,onChange:D})]},e))})]}),(0,C.jsxs)(oe,{label:Q,count:F?X?`${Z.length} of ${Ot.length}`:Ot.length:``,q:me,onQ:T,matched:Nt,inView:[w,n],current:K?Bt:void 0,sections:s?void 0:qt.map(e=>({key:e,label:y[e].label,n:yt(e),href:`#/section/${e}`,on:w===e})),cats:R&&F?nt.cats:null,cat:E,total:I.length,onCat:D,catLabel:`Skill types`,extra:(0,C.jsxs)(C.Fragment,{children:[N&&M.since?(0,C.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,M.since]}):null,(0,C.jsxs)(`span`,{className:`lib-legend mono`,children:[Ct?wt.map((e,t)=>(0,C.jsxs)(`span`,{className:`lk-install`,title:j(e).path,children:[(0,C.jsx)(`i`,{className:`lr-dot`,style:f(t),"aria-hidden":`true`}),L(e)]},e)):null,(0,C.jsx)(se,{items:I})]})]}),toolsCompact:F&&J.length>1?(0,C.jsx)(Se,{label:`Show`,options:J.map(([e,t])=>({key:e,label:e===`all`?`All uses`:t})),value:Y,onChange:O}):void 0,tools:F&&J.length>1?(0,C.jsx)(m,{"aria-label":`Show`,children:J.map(([e,t,n,r])=>(0,C.jsxs)(`button`,{type:`button`,className:Y===e?`on`:``,"aria-pressed":Y===e,title:r,onClick:()=>O(e),children:[t,` `,(0,C.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[$e?(0,C.jsx)(_,{}):null,(0,C.jsx)(ce,{rows:Pt,activeName:K?.name,hrefOf:Ft,pills:N||Ct?e=>{let t=P(e.name)?.n||0,n=Ct?(0,C.jsx)(`span`,{className:`lr-dots`,children:wt.map((t,n)=>e.installs?.includes(t)?(0,C.jsx)(`span`,{className:`lr-dot lr-install`,style:f(n),title:`${L(t)} — ${j(t).path}`,children:(0,C.jsx)(`span`,{className:`sr-only`,children:L(t)})},t):(0,C.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return N?(0,C.jsxs)(C.Fragment,{children:[n,(0,C.jsxs)(`span`,{className:`lr-use`,children:[(0,C.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,C.jsx)(`i`,{style:{width:Oe(t,kt)}})}),(0,C.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,C.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!X&&I.length>At&&(0,C.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,At,` of `,I.length,`; type to search the rest.`]}),Vt&&(w===`wiki`?(0,C.jsxs)(fe,{title:`No wiki entries`,action:(0,C.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,C.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,C.jsx)(fe,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,C.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:K?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`reader-tags`,children:[(0,C.jsx)(`span`,{className:`tag acc`,children:Q.replace(/s$/,``)}),H?(0,C.jsx)(de,{}):null,Ut?(0,C.jsx)(`span`,{className:`tag`,children:Ut.label}):null,W?.kit??K.kit?(0,C.jsx)(ue,{name:W?.kit??K.kit}):null,(0,C.jsx)(ae,{status:Ht,withHint:!0}),$?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`mono dim reader-src`,children:Ae($)}),(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Kt,children:ye?.src===$?ye.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,C.jsxs)(`div`,{className:`reader-head`,children:[(0,C.jsx)(`h2`,{className:`reader-title`,children:Bt}),w===`agents`&&!H?(0,C.jsx)(S.Suspense,{fallback:null,children:(0,C.jsx)(Te,{name:K.name})}):null]}),(0,C.jsxs)(`div`,{className:`reader-intro${N?` with-stats`:``}`,children:[(0,C.jsxs)(`div`,{className:`reader-intro-text`,children:[Wt?(0,C.jsx)(`p`,{className:`reader-lede`,children:Wt}):null,Gt?(0,C.jsxs)(`section`,{className:`reader-when`,children:[(0,C.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,C.jsx)(`p`,{children:Gt})]}):null]}),N?(0,C.jsx)(Le,{u:P(K.name),usage:M,noCall:Qe}):null]}),w===`memory`&&ut&&K.name!==`MEMORY`&&K.name!==`README`&&(0,C.jsxs)(`div`,{className:`row gap-8`,children:[(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Lt,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:It,children:`Forget this fact`})]}),W?.installs?.length>1&&W.installs.includes(W.install)?(0,C.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,C.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,C.jsx)(`select`,{className:`sel`,"aria-label":`Install`,value:U||W.install,onChange:e=>Ce({sec:w,name:B,key:e.target.value}),children:W.installs.map(e=>(0,C.jsx)(`option`,{value:e,title:j(e).path,children:L(e)},e))}),(0,C.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,C.jsx)(`hr`,{className:`hr`}),ft?(0,C.jsx)(ge,{name:B,install:G?j(G):void 0,installId:xt}):null,V?(0,C.jsx)(xe,{loadout:ht?.own,base:ht?.base,error:gt,install:St}):null,H?null:lt?(0,C.jsxs)(`p`,{className:`sub`,children:[`No `,Q.replace(/s$/,``).toLowerCase(),` named `,(0,C.jsx)(`em`,{children:K.name}),` could be read in this install.`]}):K?.kind===`manifest`||W?.manifest!==void 0?W?(0,C.jsx)(he,{manifest:W.manifest,body:W.body,name:K.name}):(0,C.jsx)(_,{}):W?.body?(0,C.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,C.jsx)(S.Suspense,{fallback:null,children:(0,C.jsx)(we,{body:Rt.body,links:W.links||[]})})}):W===null&&B?(0,C.jsx)(_,{}):(0,C.jsx)(Ne,{section:w,source:Me(w,K.name)}),ze[w]?(0,C.jsx)(`div`,{className:`reader-links`,children:(0,C.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${ze[w]}`,children:[`About `,Q.toLowerCase(),` in Docs`]})}):null]}):$e?(0,C.jsx)(_,{}):null})]})]})}export{De as PRIMARY,Ie as bodyHead,We as default,Ue as groupMemory,je as installLabel,j as installOfKey,Be as resolveSec,He as splitSkills,Re as splitWhen};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C8nMUU1i.js";import{At as i,J as a,Y as o,et as s,gt as c,nt as l,tt as u,yt as d}from"./index-BILaKHbH.js";import{t as f}from"./EmptyState-CY5Pm2xy.js";import{t as p}from"./CopyButton-C0VTiqmb.js";import{a as m,n as h,o as g,r as _,s as v,t as y}from"./ActiveLoops-paFbiZyt.js";import{t as b}from"./Markdown-CxkA7940.js";import{a as x,i as S,n as ee,o as te,s as C}from"./LibRows-CwK63kjB.js";import{i as w}from"./motion-RlUl1osO.js";import{n as T,r as E}from"./router-1EhRJy1C.js";var D=e(t(),1),O=n(),k=encodeURIComponent,A=T.loops.map(e=>[e,E[e]]),j={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},M={project:`Project`,global:`Global`,shipped:`Shipped`},N={templates:`Categories`,bricks:`Origins`,active:`Statuses`},P=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function F(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var I=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function L(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return I(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>j[e.graph.category]?e.graph.category:`other`,[...Object.entries(j),[`other`,`Other`]])}function R(e,t){return I(e.map(e=>({...e,desc:e.description,override:F(t,e.name)})),e=>e.origin,Object.entries(M))}function z(e){return I(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,P)}var B=(e,t)=>(0,O.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),V={templates:e=>e.human?B(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?B(`warn`,`mutate`):null,g(e)?B(`human`,`human gate`):null,e.override?B(`acc`,e.override):null,e.available===!1?B(`bad`,`unavailable`):null],active:e=>B(h[e.status],e.status)};function H({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,O.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,O.jsx)(`b`,{children:(0,O.jsx)(`a`,{href:`#/loops/bricks/${k(e)}`,children:e})}),B(t.effect===`mutate`?`warn`:``,t.effect),(0,O.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,O.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),g(t)?B(`human`,g(t).toLowerCase()):null,n?B(`acc`,n):null]}):(0,O.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,O.jsx)(`b`,{children:e}),(0,O.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function U(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 W({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,D.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=U(e.graph),c=v(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>_(t)&&t.graph.name===e.name).length;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`reader-tags`,children:[(0,O.jsx)(`span`,{className:`tag acc`,children:`Template`}),j[e.graph.category]?B(``,j[e.graph.category]):null,e.human?B(`human`,`human gate`):null]}),(0,O.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,O.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,O.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,O.jsx)(`hr`,{className:`hr`}),(0,O.jsxs)(`figure`,{className:`loop-console`,children:[(0,O.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${c.width}px`},children:(0,O.jsx)(m,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:w()?`smooth`:`auto`,block:`nearest`})}})}),(0,O.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,O.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,O.jsx)(`ol`,{children:s.map(([e,t])=>(0,O.jsxs)(`li`,{children:[(0,O.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,O.jsxs)(`span`,{className:`loop-legend`,children:[(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,O.jsxs)(`span`,{children:[(0,O.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,O.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,O.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,O.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,O.jsx)(p,{text:u,label:`Copy command`})]}),(0,O.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,O.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,O.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,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,O.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,O.jsx)(`li`,{children:e},e))})]}):null,(0,O.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,O.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,O.jsx)(H,{name:e,brick:o.get(e),override:F(n,e),on:i===e},e))})]})}function G(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 K({b:e}){let[t,n]=(0,D.useState)(!1),r=[[`effect`,B(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,O.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>B(``,e))],[`gate`,g(e)?B(`human`,g(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,O.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`reader-tags`,children:[(0,O.jsx)(`span`,{className:`tag acc`,children:`Brick`}),V.bricks(e)]}),(0,O.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,O.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,O.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,O.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,O.jsxs)(D.Fragment,{children:[(0,O.jsx)(`dt`,{children:e}),(0,O.jsx)(`dd`,{children:t})]},e))}),(0,O.jsx)(`hr`,{className:`hr`}),(0,O.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,O.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,O.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:G(e)}):(0,O.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,O.jsx)(b,{body:e.body})})]})}function ne({problems:e}){if(!e?.length)return null;let t=e.length;return(0,O.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,O.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,O.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,O.jsx)(`li`,{className:`mono`,children:e},e))})]})}var q={templates:{title:`No templates`,body:(0,O.jsxs)(O.Fragment,{children:[`Add one under `,(0,O.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,O.jsxs)(O.Fragment,{children:[`Add one under `,(0,O.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,O.jsxs)(O.Fragment,{children:[`Start one with `,(0,O.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.`]})}},re={templates:(0,O.jsxs)(O.Fragment,{children:[`A template wires bricks into a loop. `,(0,O.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,O.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,O.jsxs)(O.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,O.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,O.jsxs)(O.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,O.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function J({tab:e=`templates`,item:t,dataRev:n}){let p=o(n),[m,h]=a(`loops`,p),{data:g,error:v}=i(()=>r.loops(c(m)),[n,m?.id??``],`loops`),b=d(),[w,T]=(0,D.useState)(``),[E,j]=(0,D.useState)(`all`),[M,P]=(0,D.useState)(e);e!==M&&(P(e),T(``),j(`all`));let F=g?.bricks||[],I=e===`active`?b.loops&&z(b.loops):g&&(e===`bricks`?R(g.bricks,g.overridden):L(g.templates,g.bricks)),B=I||[],H=C(B),U=E===`all`?B:B.filter(e=>e.group===E),G=w.trim(),J=x(U,G),Y=!!(t&&I&&!B.some(e=>e.name===t)),X=Y?null:B.find(e=>e.name===t)||e===`active`&&B.find(_)||B[0]||null,Z={templates:g?.templates.length,bricks:g?.bricks.length,active:b.loops?.length},Q=A.find(([t])=>t===e)[1],$=e===`active`?b.error:v;return(0,O.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,O.jsx)(l,{className:`page-pick`,installs:p,value:m,onChange:h}),(0,O.jsx)(s,{error:$,style:{margin:`0 0 var(--sp-3)`}}),(0,O.jsx)(ne,{problems:g?.problems}),(0,O.jsxs)(`div`,{className:`library`,children:[(0,O.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,O.jsxs)(`div`,{className:`lib-title`,children:[(0,O.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,O.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,O.jsx)(`p`,{className:`panel-note lib-lede`,children:re[e]}),(0,O.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:A.map(([t,n])=>(0,O.jsxs)(D.Fragment,{children:[(0,O.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,O.jsx)(`span`,{className:`mono dim`,children:Z[t]??``})]}),e===t&&(0,O.jsx)(te,{label:N[t],total:B.length,cats:H,cat:E,onChange:j})]},t))})]}),(0,O.jsx)(S,{label:Q,count:G?`${J.length} of ${U.length}`:I?U.length:``,q:w,onQ:T,matched:J.length,inView:[e,t],current:X?.name,sections:A.map(([t,n])=>({key:t,label:n,n:Z[t],href:`#/loops/${t}`,on:e===t})),cats:H,cat:E,total:B.length,onCat:j,catLabel:N[e],children:I?B.length===0?(0,O.jsx)(f,{title:q[e].title,children:q[e].body}):(0,O.jsx)(ee,{rows:J,activeName:X?.name,hrefOf:t=>`#/loops/${e}/${k(t.name)}`,pills:V[e]}):$?null:(0,O.jsx)(u,{})}),(0,O.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:Y?(0,O.jsx)(f,{title:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${Q.toLowerCase()} →`}}):X?e===`active`?(0,O.jsx)(y,{loop:X,bricks:F,onPreset:b.onPreset}):e===`bricks`?(0,O.jsx)(K,{b:X}):(0,O.jsx)(W,{t:X,bricks:F,overridden:g.overridden,runs:b.loops},X.name):e===`active`&&I?(0,O.jsx)(f,{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{z as activeRows,R as brickRows,G as brickSource,J as default,U as howItRuns,L as templateRows};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C8nMUU1i.js";import{At as i,H as a,J as o,Y as s,et as c,gt as l,ht as u,it as d,nt as f,ot as p,pt as m,tt as h}from"./index-BILaKHbH.js";var g=e(t(),1);function _(e,t){return e===`pin`?`pin`:e===`map`?`tiers map`:e==="default"?`tier default`:t===`auto`?`session model`:`routing off`}var ee=(e,t)=>!t||t===`inherit`||e.some(e=>e.id===t&&e.provider!==`in-use`);function te(e,t){return Object.hasOwn(e.map||{},t)?e.map[t]:e.defaults?.[t]??``}var v=e=>`${e.id} ${e.name} ${e.providerName} ${e.note||``}`.toLowerCase();function y(e,t){let n=(t||``).trim().toLowerCase(),r=[];for(let t of e.groups||[]){let i=(e.models||[]).filter(e=>e.provider===t.provider&&e.source===t.source),a=n?i.filter(e=>v(e).includes(n)):i;(!n||a.length)&&r.push({...t,rows:a})}return r}function b(e){return typeof e==`number`?e>=1e6?`${+(e/1e6).toFixed(1)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e):``}function x(e){if(!e)return``;let t=e=>e==null?`?`:`$${+e.toFixed(2)}`;return`${t(e.input)} in / ${t(e.output)} out per 1M`}var S=n();function ne({open:e,title:t,data:n,current:r,onPick:i,onClose:a}){let o=(0,g.useRef)(null),s=(0,g.useId)(),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)(r&&r!==`inherit`?r:``);(0,g.useEffect)(()=>{let t=o.current;t&&(e&&!t.open&&(typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``)),!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e]);let f=(e,t)=>t.id===r&&!(e.provider===`in-use`&&t.detected),p=e?y(n,c):[],m=u.trim();return(0,S.jsxs)(`dialog`,{ref:o,className:`confirm model-picker`,"aria-labelledby":`${s}-title`,onCancel:a,onClose:a,children:[(0,S.jsx)(`h3`,{className:`confirm-title`,id:`${s}-title`,children:t}),(0,S.jsx)(`input`,{className:`inp mp-search`,type:`search`,"aria-label":`Search models`,placeholder:`Search models`,value:c,onChange:e=>l(e.target.value)}),(0,S.jsxs)(`div`,{className:`mp-list`,children:[p.map(e=>(0,S.jsxs)(`section`,{className:`mp-group`,"aria-label":e.providerName,children:[(0,S.jsxs)(`header`,{className:`mp-head`,children:[(0,S.jsx)(`span`,{className:`mp-name`,children:e.providerName}),(0,S.jsx)(`span`,{className:`dim`,children:e.note}),e.available===!1?(0,S.jsx)(`span`,{className:`tag warn`,children:e.reason||`unavailable`}):null]}),e.rows.map(t=>(0,S.jsxs)(`button`,{type:`button`,className:`mp-row${f(e,t)?` on`:``}`,disabled:t.available===!1,"aria-pressed":f(e,t),onClick:()=>i(t.id),title:t.available===!1?t.reason:void 0,children:[(0,S.jsxs)(`span`,{className:`mp-id`,children:[t.id===`inherit`?`Session model (inherit)`:t.name===t.id?t.id:t.name,t.id!==`inherit`&&t.name!==t.id?(0,S.jsxs)(`span`,{className:`dim mono`,children:[` `,t.id]}):null]}),(0,S.jsxs)(`span`,{className:`mp-meta`,children:[t.id===`inherit`?null:(0,S.jsx)(`span`,{className:`tag ${t.local?`ok`:``}`,children:t.local?`local`:`remote`}),t.context?(0,S.jsxs)(`span`,{className:`tag`,children:[b(t.context),` ctx`]}):null,t.cost?(0,S.jsx)(`span`,{className:`tag`,children:x(t.cost)}):null,t.reasoning?(0,S.jsx)(`span`,{className:`tag acc`,children:`reasoning`}):null,t.variants?.length?(0,S.jsxs)(`span`,{className:`tag`,children:[`variants: `,t.variants.join(`, `)]}):null,t.detected===!1?(0,S.jsx)(`span`,{className:`tag warn`,children:`not detected`}):null,t.available===!1?(0,S.jsx)(`span`,{className:`tag warn`,children:t.reason||`unavailable`}):null]})]},`${e.provider}|${t.id}`))]},`${e.provider}|${e.source}|${e.note}`)),e&&!p.some(e=>e.rows.length)&&c?(0,S.jsxs)(`p`,{className:`sub`,children:[`No model matches “`,c,`”.`]}):null]}),(0,S.jsxs)(`form`,{className:`mp-custom`,onSubmit:e=>{e.preventDefault(),m&&i(m)},children:[(0,S.jsxs)(`label`,{className:`mp-custom-label`,children:[(0,S.jsx)(`span`,{className:`dim`,children:`Custom…`}),(0,S.jsx)(`input`,{className:`inp`,type:`text`,"aria-label":`Custom model id`,placeholder:`provider/model, or the id as the host knows it`,value:u,onChange:e=>d(e.target.value)})]}),(0,S.jsx)(`button`,{type:`submit`,className:`btn ghost sm`,disabled:!m,children:`Use this id`})]}),(0,S.jsx)(`div`,{className:`confirm-actions`,children:(0,S.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:a,children:`Cancel`})})]})}var re=[[`standard`,`Standard`],[`light`,`Light`]],ie={strong:`acc`,standard:``,light:`ok`},C={strong:0,standard:1,light:2},w=[`off`,`auto`];function T({dataRev:e,onAction:t}){let n=p(),v=s(e),[y,b]=o(`models`,v),{data:x,error:T,setData:E,reload:D}=i(()=>Promise.resolve().then(()=>r.agentModels(l(y))),[e,y?.id??``]),[O,k]=(0,g.useState)({}),[A,j]=(0,g.useState)({}),[M,N]=(0,g.useState)(null),[P,F]=(0,g.useState)(null),[I,L]=(0,g.useState)(!1),[R,z]=(0,g.useState)(``),[B,V]=(0,g.useState)(!1),[H,U]=(0,g.useState)(!1),[ae,oe]=(0,g.useState)(y?.id);y?.id!==ae&&(oe(y?.id),k({}),j({}),N(null),U(!1),z(``));let W=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(f,{className:`page-pick`,installs:v,value:y,onChange:b}),(0,S.jsx)(a,{title:`Models`,sub:`The model each sub-agent runs on, per install. Strong agents always use your session model.`})]});if(v!==null&&v.length===0)return(0,S.jsxs)(`div`,{className:`lib-wrap`,children:[W,(0,S.jsxs)(`p`,{className:`sub`,"data-testid":`models-no-install`,children:[`No Geneseed install is active, so there is no agent model to set.`,` `,(0,S.jsx)(`a`,{href:`#/installs`,children:`Install one on Installs →`})]})]});if(T)return(0,S.jsxs)(`div`,{className:`lib-wrap`,children:[W,(0,S.jsx)(c,{error:T})]});if(!x||!y)return(0,S.jsxs)(`div`,{className:`lib-wrap`,children:[W,(0,S.jsx)(h,{})]});let G=m(x.host).label;if(!x.claude)return(0,S.jsxs)(`div`,{className:`lib-wrap`,children:[W,(0,S.jsxs)(`p`,{className:`sub`,children:[G,` takes no per-agent model, so there is nothing to set here for`,` `,u(y),`.`]})]});let K=x.file?.problem,q=M??x.tiers,J=x.models||[],Y=e=>O[e]!==void 0,X=e=>Y(e)?O[e]===null?x.defaults?.[e]??``:O[e]:te(x,e),se=e=>A[e.name]===void 0?e.pin:A[e.name],Z=Object.keys(O).length+Object.keys(A).length,ce=I?[...x.agents].sort((e,t)=>(C[e.tier]??9)-(C[t.tier]??9)||e.name.localeCompare(t.name)):x.agents,Q=e=>{if(!e)return`Session model`;let t=J.find(t=>t.id===e&&t.provider!==`in-use`);return t&&t.name!==t.id?`${t.name} (${e})`:e},$=e=>ee(J,e)?null:(0,S.jsx)(`span`,{className:`tag warn`,children:`not detected`}),le=e=>{let{kind:t,key:n}=P;if(F(null),U(!1),t===`tier`){let t=e===`inherit`?``:e;k(e=>({...e,[n]:t===(x.defaults?.[n]??void 0)?null:t}))}else j(t=>({...t,[n]:e===`inherit`?null:e}))},ue=async()=>{V(!0),z(``);try{let e=await r.agentModelsSave({tiers:O,agents:A},l(y));E({...x,...e}),D(),k({}),j({}),U(!0)}catch(e){z(e.message)}finally{V(!1)}},de=async()=>{await n(`Rebuild this ${G} install with model routing ${q}? The models are written into the agent files; it rebuilds in place, non-destructive.`,{title:`Rebuild this install?`,confirmLabel:`Rebuild`})&&t?.(`install`,{host:y.host,scope:y.scope,path:y.path,tiers:q})},fe=P?P.kind===`tier`?X(P.key)||`inherit`:(A[P.key]===void 0?x.agents.find(e=>e.name===P.key)?.pin:A[P.key])||`inherit`:null;return(0,S.jsxs)(`div`,{className:`lib-wrap models-page`,children:[W,(0,S.jsx)(c,{error:R,style:{margin:`0 0 var(--sp-3)`}}),K?(0,S.jsxs)(`p`,{className:`sub tiers-warn`,role:`alert`,children:[K,`.`]}):null,x.warnings.map(e=>(0,S.jsx)(`p`,{className:`sub tiers-warn`,role:`note`,children:e},e)),(0,S.jsxs)(`div`,{className:`panel models-routing`,children:[(0,S.jsxs)(`div`,{className:`panel-head`,children:[(0,S.jsx)(`h2`,{children:`Routing`}),(0,S.jsx)(d,{"aria-label":`Model routing for ${u(y)}`,children:w.map(e=>(0,S.jsx)(`button`,{type:`button`,className:q===e?`on`:``,"aria-pressed":q===e,onClick:()=>{N(e===x.tiers?null:e),U(!1)},children:e},e))})]}),(0,S.jsxs)(`p`,{className:`panel-note`,children:[q===`auto`?`Agents run on the model of their tier, unless you pin one. Applied at the next rebuild.`:`Every agent runs on your session model, unless you pin one.`,M===null?``:` Not rebuilt yet.`]})]}),(0,S.jsxs)(`div`,{className:`panel models-tiers`,role:`group`,"aria-label":`Models by tier`,children:[(0,S.jsx)(`div`,{className:`panel-head`,children:(0,S.jsx)(`h2`,{children:`Tiers`})}),(0,S.jsxs)(`div`,{className:`models-tier-row`,children:[(0,S.jsx)(`span`,{children:`Strong`}),(0,S.jsx)(`span`,{className:`dim`,children:`session model, always`})]}),re.map(([e,t])=>{let n=X(e);return(0,S.jsxs)(`div`,{className:`models-tier-row`,children:[(0,S.jsx)(`span`,{children:t}),(0,S.jsx)(`button`,{type:`button`,className:`btn ghost sm models-model`,disabled:!!K||B,"aria-label":`${t} tier model: ${Q(n)}. Change`,onClick:()=>F({kind:`tier`,key:e}),children:Q(n)}),$(n),Y(e)?(0,S.jsx)(`span`,{className:`tag acc`,children:`unsaved`}):null]},e)}),(0,S.jsx)(`p`,{className:`panel-note`,children:Object.keys(x.defaults||{}).length?`Host defaults: ${Object.entries(x.defaults).map(([e,t])=>`${e} ${t}`).join(`, `)}.`:`${G} has no default model for a tier: a tier routes once you pick one.`})]}),(0,S.jsx)(`div`,{className:`panel flush models-agents`,children:(0,S.jsxs)(`table`,{className:`ldg`,"aria-label":`Agents`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`th`,{scope:`col`,children:`Agent`}),(0,S.jsx)(`th`,{scope:`col`,"aria-sort":I?`ascending`:`none`,children:(0,S.jsxs)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>L(e=>!e),children:[`Tier`,I?` ▲`:``]})}),(0,S.jsx)(`th`,{scope:`col`,children:`Runs on`}),(0,S.jsx)(`th`,{scope:`col`,children:`Because`}),(0,S.jsx)(`th`,{scope:`col`,children:`Pin`})]})}),(0,S.jsx)(`tbody`,{children:ce.map(e=>{let t=se(e);return(0,S.jsxs)(`tr`,{children:[(0,S.jsx)(`td`,{className:`mono`,children:e.name}),(0,S.jsx)(`td`,{children:e.tier?(0,S.jsx)(`span`,{className:`tag ${ie[e.tier]??``}`,children:e.tier}):(0,S.jsx)(`span`,{className:`tag`,title:`No Geneseed source: not tiered`,children:`not tiered`})}),(0,S.jsx)(`td`,{className:`mono`,children:e.model?Q(e.model):(0,S.jsx)(`span`,{className:`dim`,children:`session model`})}),(0,S.jsx)(`td`,{className:`dim`,children:_(e.from,x.tiers)}),(0,S.jsx)(`td`,{children:(0,S.jsxs)(`span`,{className:`row gap-8 wrap`,children:[(0,S.jsx)(`button`,{type:`button`,className:`btn ghost sm models-model`,disabled:!!K||B,"aria-label":`Pin a model for ${e.name}`,onClick:()=>F({kind:`pin`,key:e.name}),children:t?Q(t):`No pin`}),t?$(t):null,A[e.name]===void 0?null:(0,S.jsx)(`span`,{className:`tag acc`,children:`unsaved`}),t?(0,S.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:!!K||B,"aria-label":`Clear the pin of ${e.name}`,onClick:()=>{j(t=>({...t,[e.name]:null})),U(!1)},children:`Clear`}):null]})})]},e.name)})})]})}),(0,S.jsxs)(`div`,{className:`models-foot row gap-8 wrap`,children:[(0,S.jsx)(`span`,{className:`sub`,role:`status`,children:Z?`${Z} unsaved change${Z===1?``:`s`}`:H?`Saved. The agent files change at the next rebuild.`:`No unsaved changes.`}),(0,S.jsx)(`button`,{type:`button`,className:`btn`,disabled:!Z||!!K||B,onClick:ue,children:`Save`}),(0,S.jsx)(`button`,{type:`button`,className:`btn ghost`,disabled:Z>0||B,onClick:de,children:`Rebuild…`})]}),(0,S.jsx)(ne,{open:!!P,title:P?P.kind===`tier`?`${P.key} tier model`:`Model for ${P.key}`:``,data:x,current:fe,onPick:le,onClose:()=>F(null)},P?`${P.kind}:${P.key}`:`closed`)]})}export{T as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,vt as r}from"./index-BhT94v2q.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{n as o,r as s}from"./Dashboard-CWhh_GSc.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||{},_=a.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...a.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=n(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=r(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`}),(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:a.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:i[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:i[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-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,wt as r}from"./index-BILaKHbH.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{n as o,r as s}from"./Dashboard-CRGCp2cV.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||{},_=a.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...a.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=n(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=r(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`}),(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:a.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:i[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:i[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-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C8nMUU1i.js";import{At as i,H as a,W as o,Y as s,et as c,gt as l,ht as u,it as d,nt as f,ot as p,q as m,tt as h}from"./index-BILaKHbH.js";import{t as g}from"./Tabs-BHjxciOL.js";import{t as _}from"./EmptyState-CY5Pm2xy.js";import{a as v,i as y}from"./router-1EhRJy1C.js";import{t as b}from"./Markdown-CxkA7940.js";import x,{installLabel as S}from"./Library-DdzyrwUK.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=p(),[r,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(!1),[l,u]=(0,C.useState)(``),d=e?.fingerprint||``,f=r!==null&&JSON.stringify(r)!==JSON.stringify(a),m=(0,C.useRef)(!1),h=e=>{i(e),o(e)},g=()=>i(null);return(0,C.useEffect)(()=>{if(!f)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=v(({to:e})=>(m.current||(m.current=!0,w(n).then(n=>{n&&(t(),i(null),y(e))}).finally(()=>{m.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[f,n]),{draft:r,setDraft:i,open:h,close:g,discard:async()=>f&&!await w(n)?!1:(g(),!0),dirty:f,busy:s,notice:l,setNotice:u,save:async(e,{conflict:n}={})=>{c(!0),u(``);try{return await e(d)||!0}catch(e){e.status===409?u(n??T):u(e.message);return}finally{c(!1),t()}}}}var D=n(),O=(e,t)=>`${e} ${t}${e===1?``:`s`}`,k=e=>`≈${e.toLocaleString(`en-US`)} tokens`,ee={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({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(M).some(N)?`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 sub-wide 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)`}),A.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 re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"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}),j(e.scope)===n?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}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:k(e.tokens)})]}),r&&(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:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var F=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function I({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ie({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(I,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${F(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:F(e,r)},r))}):null]})]},e.key??r))})]}):null}function L({onChanged:e,dataRev:t,onAction:n}){let i=p(),{targets:a,sets:o,failed:s,reason:d,reload:g}=m(r.rules,t),[v,y]=(0,C.useState)(null),b=E({data:null,reload:g}),{draft:x,busy:S,notice:w}=b,[T,A]=(0,C.useState)(``),[M,N]=(0,C.useState)(null),F=(0,C.useRef)(null),[I,L]=(0,C.useState)(0),R=e=>{F.current=e,L(e=>e+1)},z=(0,C.useRef)(null),B=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=F.current;if(F.current=null,e===null)return;let t=[...B.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?z.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[I]),o&&!o.length&&d)return(0,D.jsx)(c,{error:d,onRetry:g});if(!o)return(0,D.jsx)(h,{});let V=a.length>1,H=e=>e?.id??``,U=e=>e?.shared?`shared`:u(e),W=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${H(e)}#${t.id}`}))),G=o.filter(e=>e.data.exists).map(e=>e.inst),K=G.length>0,q=x?.target,J=q!==void 0&&q!==`new`&&!W.some(e=>e.key===q&&e.title===x.title0),Y=q===`new`||J,X=x?.to!==void 0&&!G.some(e=>H(e)===x.to),Z=X?null:G.find(e=>H(e)===x?.to)??G[0]??null,ae=X?(0,D.jsx)(`p`,{className:`sub sub-wide 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.`}):G.length>1?(0,D.jsx)(f,{installs:G,value:Z,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:U}):V&&Z?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:U(Z)})]}):null,Q=async(t,n,i)=>{let a=o.find(e=>H(e.inst)===H(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},l(n)),{conflict:i?te:ne});return s&&i&&b.close(),e?.(),s},$=e=>b.setDraft({...x,form:e}),oe=async(e,t,n)=>{await Q(e,t,!0)&&R(n)},se=async e=>{await b.discard()&&R(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${V?` from ${U(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Q({op:`delete`,id:e.id},e.inst)&&x===null&&R(`add`)},le=async e=>{await Q({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&R(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){A(t.key),N(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},l(t.inst));N({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{A(``),g(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>V?`${U(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!J&&q===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)(P,{value:x.form,onChange:$,busy:S,onCancel:()=>se(e.key),onSave:t=>oe({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:V?U(e.inst):null,usual:ge(e.inst),isOpen:v===e.key,onToggle:()=>y(v===e.key?null:e.key),onEdit:()=>{y(e.key),b.open({target:e.key,no:e.id,to:H(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),K&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:z,onClick:()=>b.open({target:`new`,title0:``,form:ee}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?u(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),M?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,M.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,M.cleared.length?` Cleared: ${M.cleared.join(`, `)}.`:``,` `,M.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ie,{drafts:me,deciding:T,onDecide:de}),Y&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),J?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.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)(P,{value:x.form,onChange:$,busy:S,writeTo:ae,onCancel:()=>se(`add`),onSave:e=>!X&&G.length&&oe({op:`add`,...e},Z,`add`)})]}),K?W.length===0&&!Y?(0,D.jsx)(_,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:B,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":V?U(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[V?(0,D.jsx)(`b`,{className:`mono`,children:U(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[O(t.rules.length,`rule`),` · `,k(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:W.filter(t=>t.inst===e).map(_e)}):null]},H(e)))}):(0,D.jsxs)(_,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var R=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,z=e=>e?.id??``;function B({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=m(r.profile,t);if(!i)return(0,D.jsx)(h,{});let o=new Set(a.map(z)),s=new Set([...i.map(e=>z(e.inst)),...o]),c=n.filter(e=>s.has(z(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(z(e))?`shared`:u(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),c.map(({install:t,tag:n})=>(0,D.jsx)(V,{install:t,tag:n,onChanged:e},z(t)))]})}function V({install:e,tag:t,onChanged:n}){let{data:a,error:o,loading:s,reload:u,setData:f}=i(()=>r.profile(l(e)),[]),p=E({data:a,reload:u}),{draft:m,dirty:g,busy:v,notice:y}=p,[x,S]=(0,C.useState)(!1);if(a&&!x&&(S(!0),(a.text||``).trim()||p.open(a.text||``)),s&&!a)return(0,D.jsx)(h,{});if(o)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(c,{error:o,onRetry:u})]});let w=m!==null,T=a?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${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)(d,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:p.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||p.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!g||v,onClick:async()=>{let t=await p.save(t=>r.profileSave({text:m,fingerprint:t},l(e)),{conflict:R});t&&(f(e=>({...e,text:m,seeded:!1,fingerprint:t.fingerprint||``})),p.setNotice(`Saved.`),p.close(),n?.())},children:v?`Saving…`:`Save`})]})]}),y?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:y}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:m,onChange:e=>p.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[a?.seeded?(0,D.jsxs)(_,{title:`This is still the template`,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)(b,{body:T})})]}):(0,D.jsxs)(_,{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 H=(e,t)=>`${e} ${t}${e===1?``:`s`}`,U=e=>e?(e.items||[]).length:null,W=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,G=e=>String(e||``).split(`
2
+ `).map(e=>W.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function K({topics:e,install:t,shared:n}){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&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:H(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:H(e.n,`fact`)})]},e.topic))})]}):null}var q={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 J({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:c,onAction:l}){let u=e=>Promise.resolve(e).catch(()=>null),d=s(n),{reload:f}=o(n),{data:p,error:m,reload:h}=i(()=>r.profile(),[n]),{data:v,reload:y}=i(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:b}=i(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),S=U(v),{data:C}=i(()=>e===`memory`?u(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,S]),w=U(b),T={memory:S,notebook:w},E={profile:m?`read failed`:p?.seeded?`template`:null,memory:S,notebook:w},O=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(a,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`+(d?.some(e=>e.shared)?` Global installs share one copy of the rules, profile and memory; a project install keeps its own.`:``)}),(0,D.jsx)(g,{page:`personal`,current:e,badges:E,label:`Personal files`}),e===`rules`&&(0,D.jsx)(L,{onChanged:f,dataRev:n,onAction:l}),e===`profile`&&(0,D.jsx)(B,{onChanged:h,dataRev:n}),O&&T[e]===0&&!t?(0,D.jsx)(_,{title:q[e].title,action:q[e].action,children:q[e].body}):O?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(K,{topics:G(C?.body),install:C?.install,shared:C?.shared}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onCountsChanged:c,onRulesChanged:()=>{f(),y()}},e)]}):null]})}export{J as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{Ct as r,H as i,Ot as a,St as o,et as s,jt as c,mt as l,ot as u,rt as d}from"./index-BILaKHbH.js";import{t as f}from"./api-C8nMUU1i.js";import{i as p}from"./motion-RlUl1osO.js";var m=e(t(),1),h=n();function g(){let e=u(),[t,n]=(0,m.useState)(!1),[i,a]=(0,m.useState)(null);return t?(0,h.jsxs)(`p`,{className:`sub`,children:[`Server stopped. You can close this tab and reopen any time with `,(0,h.jsx)(`code`,{children:`geneseed web`}),`.`]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{error:i}),(0,h.jsxs)(`button`,{className:`btn ghost danger-line`,onClick:async()=>{if(await e(`Stop the local Geneseed server? The console goes offline until you start it again.`,{title:`Stop the server?`,confirmLabel:`Stop server`,tone:`danger`})){a(null);try{await f.shutdown()}catch(e){if(e.status)return a(e.message)}n(!0)}},children:[(0,h.jsx)(r,{name:`x`}),`Stop server`]})]})}function _(){let e=u(),[t,n]=(0,m.useState)(!1),[i,a]=(0,m.useState)(null);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{error:i}),(0,h.jsxs)(`button`,{className:`btn ghost`,onClick:async()=>{if(await e(`Restart the local Geneseed server? The console reconnects in a moment.`,{title:`Restart the server?`,confirmLabel:`Restart`})){n(!0),a(null);try{await c()}catch(e){a(e.message),n(!1)}}},disabled:t,children:[(0,h.jsx)(r,{name:`refresh`}),t?`Restarting…`:`Restart server`]})]})}var v=`https://github.com/Arylmera/Geneseed`,y=`https://github.com/Arylmera`,b=[[`machine`,`Machine`],[`server`,`Server`],[`about`,`About`],[`danger`,`Danger zone`]],x=[`Host check`,`token on writes`,`framing refused`,`cross-site GET refused`];function S({k:e,kid:t,help:n,children:r,control:i}){return(0,h.jsxs)(`div`,{className:`sheet-row`,children:[(0,h.jsxs)(`span`,{className:`sheet-k`,children:[t?(0,h.jsx)(`span`,{id:t,children:e}):e,n?(0,h.jsx)(`span`,{className:`sheet-h sub`,children:n}):null]}),(0,h.jsx)(`div`,{className:`sheet-v`,children:r}),(0,h.jsx)(`div`,{className:`sheet-c`,children:i})]})}function C({id:e,title:t,head:n,className:r=``,children:i}){return(0,h.jsxs)(`section`,{id:`set-${e}`,className:`card pad-md sheet-sec ${r}`,"aria-labelledby":`${e}-h`,children:[(0,h.jsxs)(`div`,{className:`card-head`,children:[(0,h.jsx)(`h3`,{id:`${e}-h`,children:t}),n]}),i]})}function w({stale:e,ids:t}){let n=e=>document.getElementById(`set-${e}`)?.scrollIntoView?.({behavior:p()?`smooth`:`auto`,block:`start`});return(0,h.jsx)(`nav`,{className:`sheet-index`,"aria-label":`On this page`,children:b.filter(([e])=>t.includes(e)).map(([t,r])=>(0,h.jsxs)(`button`,{type:`button`,className:t===`danger`?`t-bad`:``,onClick:()=>n(t),children:[r,t===`server`&&(0,h.jsx)(`span`,{className:`sheet-dot ${e?`warn`:`good`}`,"aria-hidden":`true`})]},t))})}function T({version:e}){let[t,n]=(0,m.useState)(v),[i,a]=(0,m.useState)(!0);(0,m.useEffect)(()=>{Promise.resolve(f.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),a(!!e.repo_is_github))}).catch(()=>{})},[]);let o=(e,t)=>(0,h.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,h.jsx)(r,{name:`external`})]});return(0,h.jsxs)(C,{id:`about`,title:`About`,children:[(0,h.jsx)(S,{k:`Version`,control:i?o(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,h.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),i?(0,h.jsx)(S,{k:`Credits`,control:o(t+`#-credits`,`Credits`),children:(0,h.jsx)(`span`,{className:`sub`,children:`Skills and agents adapted from other projects, with their licences`})}):null,(0,h.jsx)(S,{k:`Geneseed`,help:`MIT-licensed`,control:(0,h.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,h.jsxs)(`a`,{className:`btn ghost`,href:t,target:`_blank`,rel:`noreferrer`,children:[(0,h.jsx)(r,{name:`github`}),i?`Source on GitHub`:`Source repo`]}),i&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,h.jsx)(r,{name:`external`}),`Issues`]}),(0,h.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,h.jsx)(r,{name:`external`}),`MIT License`]})]})]}),children:(0,h.jsx)(`span`,{className:`sub`,children:`A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent. One canonical source, many voices.`})}),(0,h.jsx)(S,{k:`Creator`,control:(0,h.jsxs)(`a`,{className:`btn ghost`,href:y,target:`_blank`,rel:`noreferrer`,children:[(0,h.jsx)(r,{name:`github`}),`@Arylmera on GitHub`]}),children:(0,h.jsxs)(`span`,{className:`sub`,children:[`Built by `,(0,h.jsx)(`strong`,{children:`Guillaume Lemer`}),`. It started as a personal, Obsidian-vault-grown agent operating system and was distilled into the repo you are running. If you find it useful, a star on the repo or an issue with feedback is the best way to help shape what comes next.`]})})]})}var E={absent:`Off`,ours:`On · written by Geneseed`,stale:`On · points at another copy or Node`,hand:`On · set up by hand`};function D({initial:e}){let t=u(),[n,r]=(0,m.useState)(void 0),[i,a]=(0,m.useState)(null),[o,c]=(0,m.useState)(!1),l=n===void 0?e:n,d=async e=>{let n=e===`install`;if(await t(n?`Write ${l.file}? It starts the web console from ${l.root} at each login (hidden, no browser).`+(l.file.endsWith(`.plist`)?` It loads at your next login.`:``)+(l.transient?` Warning: that copy is an agent worktree or an npx cache, which can be deleted; the login item then fails.`:``):`Delete ${l.file}? The console no longer starts at login.`,n?{title:`Start at login?`,confirmLabel:l.state===`stale`?`Update`:`Write file`}:{title:`Stop starting at login?`,confirmLabel:`Delete file`,tone:`danger`})){c(!0),a(null);try{r((await f.autostart(e)).autostart)}catch(e){a(e.message),e.body?.autostart&&r(e.body.autostart)}finally{c(!1)}}},p=l?.state,g=p===`absent`||p===`stale`?(0,h.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>d(`install`),children:p===`stale`?`Update`:`Turn on`}):p===`ours`?(0,h.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>d(`remove`),children:`Remove`}):p===`hand`?(0,h.jsx)(`a`,{href:`#/docs/autostart`,children:`Install guide →`}):null;return(0,h.jsx)(S,{k:`Start at login`,help:l?l.file:l===null?`No login launcher on this system`:`A login launcher`,control:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{error:i}),g]}),children:(0,h.jsx)(`span`,{className:`sub`,children:l===null?`not available`:E[p]??`unknown`})})}function O({overview:e,onAction:t}){let n=u(),{canSee:s}=o(),c=b.map(([e])=>e).filter(e=>s(`section:settings/${e}`)),p=e?.server,v=e?.daemon_stale,[y,E]=(0,m.useState)(null);(0,m.useEffect)(()=>{Promise.resolve(f.update?.()).then(e=>E(e||null)).catch(()=>{})},[]);let O=y?y.install??(y.git?`git`:`npm-global`):null,k=O===`git`?`Update (git pull + rebuild)`:O===`npm-global`?`Update (npm install -g + rebuild)`:`Update`;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(i,{title:`Settings`,sub:`This copy of Geneseed and the local server.`}),(0,h.jsxs)(`div`,{className:`sheet`,children:[(0,h.jsx)(w,{stale:v,ids:c}),(0,h.jsxs)(`div`,{className:`sheet-body`,children:[(0,h.jsxs)(C,{id:`machine`,title:`Machine`,children:[(0,h.jsx)(S,{k:`Geneseed`,help:`This copy of the source`,control:O===`other`?y.command?(0,h.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,h.jsx)(`code`,{className:`mono`,children:y.command})]}):null:y?.behind===!1?(0,h.jsx)(`span`,{className:`dim`,children:`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`}):(0,h.jsxs)(`button`,{className:`btn`,onClick:async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await f.installs();e=t.filter(e=>e.state===`active`).map(e=>`${l(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await n(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},children:[(0,h.jsx)(r,{name:`download`}),k]}),children:(0,h.jsx)(`span`,{className:`mono`,children:e?.version||`unknown`})}),(0,h.jsx)(S,{k:`View level`,kid:`set-view-level`,help:`How much of the console to show. Hidden parts keep working.`,control:(0,h.jsx)(d,{labelledBy:`set-view-level`})}),(0,h.jsx)(S,{k:`Command on PATH`,help:`Run geneseed from any folder`,control:(0,h.jsxs)(`button`,{className:`btn ghost`,onClick:()=>t(`link`),children:[(0,h.jsx)(r,{name:`external`}),`Add to PATH`]})})]}),(0,h.jsxs)(C,{id:`server`,title:`Server`,className:`sheet-live`,head:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{className:`pill good`,children:`running`}),(0,h.jsxs)(`span`,{className:`mono dim`,children:[`127.0.0.1:`,window.location.port||`80`,p?` · pid ${p.pid} · up ${a(p.started)}`:``]})]}),children:[(0,h.jsx)(S,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,h.jsx)(_,{}),children:v?(0,h.jsx)(`span`,{className:`pill warn`,children:`disk has newer code → Restart`}):(0,h.jsx)(`span`,{className:`pill good`,children:`matches disk`})}),(0,h.jsx)(D,{initial:p?.autostart}),(0,h.jsx)(S,{k:`Guards`,help:`What stops another page from driving the console`,children:(0,h.jsx)(`span`,{className:`row wrap gap-8`,children:x.map(e=>(0,h.jsx)(`span`,{className:`pill good`,children:e},e))})})]}),(0,h.jsx)(T,{version:e?.version}),c.includes(`danger`)&&(0,h.jsxs)(C,{id:`danger`,title:`Danger zone`,className:`danger-zone`,children:[(0,h.jsx)(S,{k:`Stop the server`,help:`The console goes offline until you run geneseed web`,control:(0,h.jsx)(g,{})}),(0,h.jsx)(S,{k:`The geneseed command`,help:`Installs keep working; only the command goes`,control:(0,h.jsx)(`button`,{className:`btn ghost danger-line`,onClick:()=>t(`unlink`),children:`Remove from PATH`})}),(0,h.jsx)(S,{k:`Uninstall`,children:(0,h.jsxs)(`span`,{className:`sub`,children:[`Each install has its own Uninstall in `,(0,h.jsx)(`a`,{href:`#/installs/hosts`,children:`Hosts`}),`, bound to its host and path.`]})})]})]})]})]})}export{b as SECTIONS,O as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,r}from"./router-1EhRJy1C.js";import{St as i}from"./index-BILaKHbH.js";e();var a=t();function o({page:e,current:t,badges:o={},label:s}){let{canSee:c}=i();return(0,a.jsx)(`nav`,{className:`tabs`,"aria-label":s,children:n[e].filter(n=>n===t||c(`tab:${e}/${n}`)).map(n=>(0,a.jsxs)(`a`,{href:`#/${e}/${n}`,className:t===n?`on`:``,"aria-current":t===n?`page`:void 0,children:[r[n],o[n]==null?null:(0,a.jsx)(`span`,{className:`tab-badge`,children:o[n]})]},n))})}export{o as t};
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-CRGCp2cV.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/api-C8nMUU1i.js","assets/sections-CtFz7HFH.js","assets/motion-RlUl1osO.js","assets/router-1EhRJy1C.js","assets/Activity-IAxWF2wK.js","assets/EmptyState-CY5Pm2xy.js","assets/Bonsai-BoKo68Kw.js","assets/ActivityDetail-CtC2DLvh.js","assets/Library-DdzyrwUK.js","assets/LibRows-CwK63kjB.js","assets/FilterInput-qGKNSlxv.js","assets/Models-DAgkQ4CE.js","assets/Kits-DYQvykZ0.js","assets/Markdown-CxkA7940.js","assets/DataTable-b9zTShqJ.js","assets/controls-CK7qHA8H.js","assets/Loops-yHga7xdr.js","assets/CopyButton-C0VTiqmb.js","assets/ActiveLoops-paFbiZyt.js","assets/Factories-DxHD2T-1.js","assets/Laws-UVk0uojS.js","assets/Personal-DjhIfa9v.js","assets/Tabs-BHjxciOL.js","assets/Installs-B5hFSUeN.js","assets/Settings-Brgec4M0.js","assets/Docs-DwOwzaD6.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,n,r,t as i}from"./react-C1iE8mnY.js";import{t as a}from"./api-C8nMUU1i.js";import{A as o,D as s,G as c,I as l,L as u,M as d,N as f,O as p,R as m,S as h,T as g,V as _,W as v,a as y,b,c as x,d as S,f as C,i as w,k as ee,l as T,m as te,n as E,o as ne,p as D,q as O,r as k,t as A,y as j,z as M}from"./motion-RlUl1osO.js";import{i as N,n as P,o as F,r as re,s as I,t as ie}from"./router-1EhRJy1C.js";import{t as L}from"./useLocalStorage-54tkqXN7.js";import{n as ae,r as oe,t as se}from"./sections-CtFz7HFH.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ce=(e,t)=>{if(M(t,`<`)){let n=t[1]===`<`,r=e._tail,i=r?r._offset+r._delay:0;return n?i:i+r.duration}},le=(e,t)=>{let n=e.iterationDuration;if(n===1e-11&&(n=0),f(t))return n;if(o(+t))return+t;let r=t,i=e?e.labels:null,a=!ee(i),s=ce(e,r),l=!f(s),u=c.exec(r);if(u){let e=u[0],t=r.split(e),o=a&&t[0]?i[t[0]]:n,c=l?s:a?o:n,d=+t[1];return b(c,d,e[0])}return l?s:a?f(i[r])?n:i[r]:n},R=(e=0,t=1,n=0)=>{let r=10**n;return Math.floor((Math.random()*(t-e+1/r)+e)*r)/r},z=0,ue=(e,t=0,n=1,r=0)=>{let i=e===void 0?z++:e;return(e=t,a=n,o=r)=>{i+=1831565813,i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61);let s=10**o;return Math.floor((((i^i>>>14)>>>0)/4294967296*(a-e+1/s)+e)*s)/s}},de=(e,t=R)=>{let n=e.length,r,i;for(;n;)i=t(0,--n),r=e[n],e[n]=e[i],e[i]=r;return e},fe=(e,t={})=>{let n=[],r=0,i,a=null,c=t.from,_=t.reversed,v=t.ease,y=!f(v),b=y&&!f(v.ease)?v.ease:y?C(v):null,x=t.grid,S=x===!0,w=t.axis,ee=t.total,T=f(c)||c===0||c===`first`,E=c===`center`,ne=c===`last`,D=c===`random`,k=s(c),A=s(e),M=t.use,N=l(A?e[0]:e),P=A?l(e[1]):0,F=O.exec((A?e[1]:e)+``),re=t.start||0+(A?N:0),I=t.seed,ie=!f(I)&&I!==!1?ue(I===!0?0:I):R,L=t.jitter,ae=!f(L),oe=s(L),se=oe?L[0]:L||0,ce=oe?L[1]:L||0,z=T?0:o(c)?c:0;return(e,s,l,v,y)=>{let[C]=te(e),T=f(ee)?l.length:ee,O=f(M)?!1:p(M)?M(C,s,T):j(C,M),I=o(O)||d(O)&&o(+O)?+O:s,L=I>=0&&I<T?I:s;if(E&&(z=(T-1)/2),ne&&(z=T-1),!n.length){if(S){let e=!0,t=!1,r=1/0,i=1/0,a=1/0,s=-1/0,u=-1/0,d=-1/0,f=[],g=[],_=[];for(let n=0;n<T;n++){let c=l[n],m=0,h=0,v=0,y=!1;if(c&&p(c.getBoundingClientRect)){let e=c.getBoundingClientRect();m=e.left+e.width/2,h=e.top+e.height/2,y=!0}else{let e=c;e&&o(e.x)&&o(e.y)&&(m=e.x,h=e.y,o(e.z)&&(v=e.z,t=!0),y=!0)}if(!y){e=!1;break}f.push(m),g.push(h),_.push(v),m<r&&(r=m),h<i&&(i=h),v<a&&(a=v),m>s&&(s=m),h>u&&(u=h),v>d&&(d=v)}if(e){let e=f[0],l=g[0],p=_[0];k?(e=r+c[0]*(s-r),l=i+c[1]*(u-i),p=t?a+(c.length>=3?c[2]:.5)*(d-a):0):E?(e=(r+s)/2,l=(i+u)/2,p=(a+d)/2):ne?(e=f[T-1],l=g[T-1],p=_[T-1]):o(c)&&(e=f[c],l=g[c],p=_[c]);for(let r=0;r<T;r++){let i=e-f[r],a=l-g[r],o=p-_[r],s=m(i*i+a*a+(t?o*o:0));w===`x`&&(s=-i),w===`y`&&(s=-a),w===`z`&&(s=-o),n.push(s)}let v=1/0;for(let e=0;e<T;e++){let t=h(n[e]);t>0&&t<v&&(v=t)}if(v>0&&v<1/0)for(let e=0;e<T;e++)n[e]=n[e]/v}else for(let e=0;e<T;e++)n.push(h(z-e))}else for(let e=0;e<T;e++)if(!x)n.push(h(z-e));else{let t=x.length,r=x[0]*x[1],i,a,o;k?(i=c[0]*(x[0]-1),a=c[1]*(x[1]-1),o=t===3?(c.length>=3?c[2]:.5)*(x[2]-1):0):E?(i=(x[0]-1)/2,a=(x[1]-1)/2,o=t===3?(x[2]-1)/2:0):(i=z%x[0],a=g(z/x[0])%x[1],o=t===3?g(z/r):0);let s=e%x[0],l=g(e/x[0])%x[1],u=t===3?g(e/r):0,d=i-s,f=a-l,p=o-u,h=m(d*d+f*f+(t===3?p*p:0));w===`x`&&(h=-d),w===`y`&&(h=-f),w===`z`&&(h=-p),n.push(h)}r=n[0];for(let e=1;e<T;e++)n[e]>r&&(r=n[e]);if(b||_)for(let e=0;e<T;e++){let t=n[e];b&&(t=b(t/r)*r),_&&(t=w?-t:h(r-t)),n[e]=t}if(ae){a=Array(T);for(let e=0;e<T;e++)a[e]=ie(-1,1,4)}D&&(n=de(n,ie))}let oe=A?(P-N)/r:N;f(i)&&(i=y?le(y,f(t.start)?y.iterationDuration:re):re);let R=i+(oe*u(n[L],2)||0);if(ae){let e=r?n[L]/r:0,t=se+(ce-se)*e;R+=a[L]*t}return t.modifier&&(R=t.modifier(R)),F&&(R=`${R}${F[2]}`),R}},pe=e=>{let t=1;if(e&&e.getCTM){let n=e.getCTM();n&&(t=(m(n.a*n.a+n.b*n.b)+m(n.c*n.c+n.d*n.d))/2)}return t},me=(e,t,n)=>{let r=_,i=getComputedStyle(e),a=i.strokeLinecap,o=i.vectorEffect===`non-scaling-stroke`?e:null,s=a,c=new Proxy(e,{get(e,t){let n=e[t];return t===v?e:t===`setAttribute`?(...t)=>{if(t[0]===`draw`){let n=t[1].split(` `),i=+n[0],c=+n[1],l=pe(o),u=i*-r*l,d=c*r*l+u,f=r*l+(i===0&&c===1||i===1&&c===0?0:10*l)-d;if(a!==`butt`){let t=i===c?`butt`:a;s!==t&&(e.style.strokeLinecap=`${t}`,s=t)}e.setAttribute(`stroke-dashoffset`,`${u}`),e.setAttribute(`stroke-dasharray`,`${d} ${f}`)}return Reflect.apply(n,e,t)}:p(n)?(...t)=>Reflect.apply(n,e,t):n}});return e.getAttribute(`pathLength`)!==`${r}`&&(e.setAttribute(`pathLength`,`${r}`),c.setAttribute(`draw`,`${t} ${n}`)),c},he=(e,t=0,n=0)=>D(e).map(e=>me(e,t,n)),B=e(t(),1),ge=r(),_e=n(),ve={red:`#FF5C57`,green:`#4ED888`,yellow:`#E8B53D`,blue:`#5B8CFF`,magenta:`#C77DFF`,cyan:`#3AD4C4`,white:`#E9EFEA`},ye={red:`#C53A36`,green:`#2FA864`,yellow:`#B8862A`,blue:`#3C66D8`,magenta:`#9A52D6`,cyan:`#2BA89B`,white:`#AEB8B0`},be=e=>ve[e]||ve.cyan,xe={red:`#A92F2B`,green:`#1E7A47`,yellow:`#8A6414`,blue:`#2F55C0`,magenta:`#7E3FB8`,cyan:`#15766C`,white:`#465A51`};function Se(e,t,n){if(!e)return;let r=n===`light`,i=r?ye[t]||ye.cyan:be(t);r&&t===`white`&&(i=`#566B62`);let a=r?xe[t]||xe.cyan:i;Be(e,Ie(i,ye[t]||ye.cyan,De,a,r),r)}var Ce={cultivar:{dark:`#3AD4C4`,light:`#127E73`,ink:`#06100D`},operator:{dark:`#E8A23B`,light:`#8F5E10`,ink:`#1A1306`},matrix:{dark:`#19E37C`,light:`#0B7A47`,ink:`#04140C`},atlas:{dark:`#8FD694`,light:`#1C8450`,ink:`#14200F`}};function we(e,t,n){let r=Ce[t];if(!e||!r)return!1;let i=n===`light`,a=i?r.light:r.dark;return Be(e,Ie(a,r.light,r.ink,a,i),i),!0}var Te={dark:{worst:`#232A31`,soft:[`#14181D`,`#1B2026`,`#11151A`,`#171C22`,`#0B1116`,`#121A21`,`#1C1A12`,`#211E15`]},light:{worst:`#EBE6D8`,soft:[`#FBFDFC`,`#F3F6F6`,`#F4F6F8`,`#E9F4ED`,`#FCFAF4`,`#F6F2E7`]}},Ee=.13,De=`#06100D`,Oe=e=>{let t=e.replace(`#`,``);return[0,2,4].map(e=>parseInt(t.slice(e,e+2),16))},ke=e=>`#`+e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``).toUpperCase(),Ae=e=>{let[t,n,r]=Oe(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},je=(e,t)=>{let[n,r]=[Ae(e),Ae(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)},Me=(e,t,n)=>{let r=Oe(e),i=Oe(t);return ke(r.map((e,t)=>e+(i[t]-e)*n))},Ne=(e,t,n,r)=>{let i=e=>Math.min(...[].concat(t).map(t=>je(e,t))),a=e;for(let t=.05;i(a)<n&&t<=1.0001;t+=.05)a=Me(e,r,t);return a},Pe=e=>{let[t,n,r]=Oe(e).map(e=>e/255),i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a;if(o===0)return{h:0,s:0};let s=o/(1-Math.abs(i+a-1));return{h:((i===t?(n-r)/o%6:i===n?(r-t)/o+2:(t-n)/o+4)*60+360)%360,s}},Fe=(e,t)=>{let n=Math.abs(e-t)%360;return n>180?360-n:n};function Ie(e,t,n,r,i){let a=i?`#000000`:`#FFFFFF`,o=e=>je(e,n)>=je(e,`#FFFFFF`)?n:`#FFFFFF`,s=je(e,o(e))>=4.5?e:Ne(e,i?`#FFFFFF`:n,4.5,a),c=i?Te.light:Te.dark,l=[c.worst,...c.soft.map(e=>Me(e,s,Ee))];return{accent:s,accent2:t,ink:o(s),text:Ne(r,l,4.5,a)}}var Le=39,Re={dark:[`#FF8A4C`,`#FF8A4C`],light:[`#B4441F`,`#9B3A1B`]};function ze(e,t,n){let[r,i]=n?Re.light:Re.dark,{h:a,s:o}=Pe(t),s=Fe(a,Le);o>=.15&&s<=29&&Fe(a,Pe(r).h)>s?(e.style.setProperty(`--warn`,r),e.style.setProperty(`--warn-text`,i)):(e.style.removeProperty(`--warn`),e.style.removeProperty(`--warn-text`))}function Be(e,t,n){e.style.setProperty(`--accent`,t.accent),e.style.setProperty(`--accent-2`,t.accent2),e.style.setProperty(`--accent-ink`,t.ink),e.style.setProperty(`--accent-text`,t.text),ze(e,t.accent,n)}var Ve=e=>typeof e==`string`&&/^#[0-9a-fA-F]{6}$/.test(e);function He(e,t){let n=t===`light`,r=n?Te.light:Te.dark,i=n?`#000000`:`#FFFFFF`,a=Ne(e,r.worst,3,i);return Ie(a,Ne(a,r.worst,4.5,i),De,a,n)}function Ue(e,t,n){return!e||!Ve(t)?!1:(Be(e,He(t,n),n===`light`),!0)}var We=`geneseed-mode`;function Ge(){let[e,t]=L(We,e=>e===`light`?`light`:`dark`);return[e,()=>t(e=>e===`light`?`dark`:`light`)]}var Ke=`geneseed-flavour`,qe=[{id:`cultivar`,short:`Cultivar`,name:`Cultivar Evolved`,tagline:`The calm default — cool teal ink, geometric sans, soft flat cards lit by one quiet shadow.`},{id:`operator`,short:`Operator`,name:`Operator HUD`,tagline:`Amber phosphor on cool charcoal — all-mono, zero-radius instrument readout.`},{id:`matrix`,short:`Matrix`,name:`Matrix`,tagline:`Acid-green order-book terminal on pure black — all Space Mono, square 2px, a faint code-grid.`},{id:`atlas`,short:`Atlas`,name:`Atlas`,tagline:`The field journal — loam dark, sage ink, the codex as a living map.`}],Je=new Set(qe.map(e=>e.id)),Ye={a:`cultivar`,b:`atlas`,c:`operator`,d:`cultivar`,e:`matrix`,f:`cultivar`,g:`cultivar`,z:`cultivar`,cb:`matrix`,cm:`cultivar`,greenhouse:`atlas`,heirloom:`cultivar`,aurora:`cultivar`,perspective:`cultivar`,sequencer:`cultivar`,cobalt:`matrix`,cosmic:`cultivar`,neon:`matrix`};function Xe(){return L(Ke,Ze)}function Ze(e){return Je.has(e)?e:Ye[e]||`cultivar`}var Qe=()=>window.location.reload(),$e=1e3,et=e=>new Promise(t=>setTimeout(t,e));async function tt(){try{return(await a.ping()).pid??null}catch{return null}}async function nt(e=0,t=null){await et(e);for(let e=0;e<30;e++){let e=await tt();if(e!==null&&e!==t)break;await et($e)}Qe()}async function rt(){let e=await tt();try{await a.restart()}catch(e){if(e.status)throw e}await nt($e,e)}var it=`geneseed-accent`,at=[{id:`curated`,short:`Curated`,tagline:`Each skin's own signature colour.`}],ot=[[`cyan`,`Cyan`],[`blue`,`Blue`],[`magenta`,`Violet`],[`yellow`,`Amber`],[`green`,`Green`]].map(([e,t])=>({id:`custom:${e}`,name:e,short:t,hex:be(e),tagline:`${t}, whatever the voice, until the skin changes.`})),st=[...at,...ot],ct=new Set(st.map(e=>e.id)),lt=e=>{let t=typeof e==`string`&&e.startsWith(`hex:`)?e.slice(4):null;return Ve(t)?t.toUpperCase():null},ut=e=>e&&(ct.has(e)||lt(e))?e:`curated`,dt=e=>ot.find(t=>t.id===e)?.name??null,ft=e=>{let t=lt(e);return t?`Your own colour, ${t}.`:st.find(t=>t.id===e)?.tagline??``};function pt(){return L(it,ut)}var mt=`geneseed-layout`,ht=[{id:`overview`,short:`Overview`,tagline:`Every install, what needs you, cost, usage and gates.`},{id:`genome`,short:`Genome`,tagline:`Hero, KPIs & genome grid.`},{id:`greenhouse`,short:`Greenhouse`,tagline:`Ring, tiles & mix donut.`},{id:`hud`,short:`HUD`,tagline:`Dense instrument panel & check matrix.`},{id:`journal`,short:`Journal`,tagline:`Growth rings & the constitution map.`}],gt=new Set(ht.map(e=>e.id)),_t={cultivar:`genome`,operator:`hud`};function vt(e){return Object.hasOwn(_t,e??``)?_t[e]:e&&gt.has(e)?e:`overview`}function yt(){return L(mt,vt)}var bt=1500;function xt(e,t){let[n,r]=(0,B.useState)(null),[i,o]=(0,B.useState)(null),[s,c]=(0,B.useState)([]),[l,u]=(0,B.useState)(0),d=()=>a.overview().then(e=>{r(e),o(null)}),f=()=>d().catch(t=>{o(t?.body?.message||t?.message||String(t)),e?.(t)}),p=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{if(n?.doctor===null){p.current=!0;let e=setTimeout(()=>d().catch(()=>u(e=>e+1)),bt);return()=>clearTimeout(e)}p.current&&(p.current=!1,t?.())},[n,l]),(0,B.useEffect)(()=>{f()},[]),(0,B.useEffect)(()=>{a.themes().then(e=>c(e.themes)).catch(()=>{})},[]),{overview:n,error:i,themes:s,reload:f}}var St=600;function Ct({onFinish:e,onError:t}={}){let[n,r]=(0,B.useState)([]),[i,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{a.jobs().then(({jobs:e})=>{if(!e.length)return;r(e.map(e=>({id:e.id,action:e.action,status:e.status,output:e.output||``,duration:e.duration,started:e.started})));let t=e.find(e=>e.status===`running`);t&&(o(t.id),c(!0))}).catch(()=>{})},[]),(0,B.useEffect)(()=>{if(!i)return;let t=n.find(e=>e.id===i),s=t?.action===`update`||!!t?.restarts,c=null;s&&tt().then(e=>c=e);let l=setInterval(async()=>{if(!document.hidden)try{let t=await a.job(i);if(r(e=>{let n=e.findIndex(e=>e.id===i);if(n===-1)return e;let r=e[n],a=t.output||``;if(r.output===a&&r.status===t.status&&r.duration===t.duration)return e;let o=e.slice();return o[n]={...r,output:a,status:t.status,duration:t.duration},o}),t.status!==`running`){if(clearInterval(l),o(null),s&&t.status===`done`){nt(2e3,c);return}e?.(t.status)}}catch{if(!s)return;clearInterval(l),nt(0,c)}},St);return()=>clearInterval(l)},[i]),{runs:n,activeId:i,consoleOpen:s,setConsoleOpen:c,runAction:async(e,n,i)=>{try{let{job_id:t,restarts:s}=await a.action(e,n,i),l=n?.emit||i?.host,u=e===`build`&&n?.theme?`build (${n.theme}${l?` · ${l}`:``})`:e;return r(e=>[...e,{id:t,action:u,status:`running`,output:``,started:Date.now()/1e3,restarts:!!s}]),o(t),c(!0),t}catch(e){t?.(e)}},cancelJob:e=>a.cancelJob(e).catch(e=>t?.(e)),clearRuns:()=>r([])}}var V=new Map,wt=new Map,Tt=new Map;function Et(e){for(let t of[V,Tt])for(let n of t.keys())n.startsWith(`${e}|`)&&t.delete(n)}function H(e,t=[],n=null,{revalidate:r=!1}={}){let i=n===null?null:`${n}|${t.join(``)}`,[a,o]=(0,B.useState)(()=>i!==null&&V.has(i)?V.get(i):null),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(()=>!(i!==null&&V.has(i))),d=(0,B.useRef)(e),f=(0,B.useRef)(i);(0,B.useLayoutEffect)(()=>{d.current=e,f.current=i});let p=(0,B.useRef)(0),m=(0,B.useCallback)(e=>{let t=++p.current,n=()=>t===p.current;u(!0),c(``);let r=f.current,i=e?Tt.get(r):void 0;if(!i&&(i=Promise.resolve(d.current()),r!==null)){let e=i,t=()=>{Tt.get(r)===e&&Tt.delete(r)};Tt.set(r,e),e.then(t,t)}return i.then(e=>{if(n()&&(o(e),r!==null)){V.set(r,e);for(let t of wt.get(r)||[])t(e)}}).catch(e=>{n()&&c(e.message)}).finally(()=>{n()&&u(!1)})},t),h=(0,B.useCallback)(()=>m(!1),[m]);return(0,B.useEffect)(()=>{let e=f.current;return e!==null&&(wt.has(e)||wt.set(e,new Set),wt.get(e).add(o)),e!==null&&V.has(e)&&(p.current++,o(V.get(e)),c(``),u(!1),!r)||m(!0),()=>wt.get(e)?.delete(o)},[m]),{data:a,error:s,loading:l,reload:h,setData:o}}var Dt=60,Ot=3600,kt=86400,At={seconds:90,minutes:5400,hours:36*Ot};function jt(e){let t=Math.max(0,Date.now()/1e3-e);return t<At.seconds?`${Math.round(t)}s`:t<At.minutes?`${Math.round(t/Dt)}m`:t<At.hours?`${Math.round(t/Ot)}h`:`${Math.round(t/kt)}d`}var U={deployed:.4,doctorClean:.25,doctorMinor:.15,doctorMinorMax:2,doctorFail:.05,versionSynced:.2,diskClean:.15},Mt={warn:U.deployed+U.doctorClean,bad:U.deployed};function Nt(e,t,n){if(!e)return 0;let r=e.doctor?.problems?.length??(e.doctor===null?0:99),i=e.doctor?.ok?U.doctorClean:r<=U.doctorMinorMax?U.doctorMinor:U.doctorFail,a=t&&t.installed_fp&&t.installed_fp===t.source_fp,o=(e.deployed?U.deployed:0)+i+(a?U.versionSynced:0)+(e.diff&&e.diff.missing===0?U.diskClean:0);return Math.min(o,Mt[n]??1)}var Pt=e=>Math.max(...oe.map(t=>e?.[t]??0),1),Ft=e=>e?.kept??0,It=e=>(e?.edited??0)+(e?.added??0)-Ft(e),Lt=e=>It(e)+(e?.missing??0),Rt=e=>(e?.laws??0)+(e?.doctrines?.rules??0),zt=e=>se.reduce((t,n)=>t+(e?.[n]??0),0),W=i(),Bt={dashboard:`M3 13h7V3H3v10Zm0 8h7v-6H3v6Zm11 0h7V11h-7v10Zm0-18v6h7V3h-7Z`,library:`M4 5h10v14H4zM16 7h4v12h-4M7 9h4M7 12h4`,loop:`M19.5 9A8 8 0 1 1 15 4.6M15 1.5l.2 3.3-3.2.8`,graph:`M6 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM7.5 14.5l8-8M16.7 15.2L8.8 16.6`,changes:`M4 6h10M4 12h7M4 18h12M17 4l3 3-3 3M20 7h-6`,doctor:`M12 3v6m0 0a4 4 0 0 1-4 4H7a3 3 0 0 0-3 3v2m8-9a4 4 0 0 0 4 4h1a3 3 0 0 1 3 3v2M12 3a1.5 1.5 0 1 0 0-.01`,themes:`M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.2 0-1 .8-1.5 1.7-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8-9-8Z`,settings:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm8-3a8 8 0 0 0-.1-1.3l2-1.6-2-3.4-2.4 1a8 8 0 0 0-2.2-1.3L15 2H9l-.3 2.6a8 8 0 0 0-2.2 1.3l-2.4-1-2 3.4 2 1.6A8 8 0 0 0 4 12c0 .4 0 .9.1 1.3l-2 1.6 2 3.4 2.4-1a8 8 0 0 0 2.2 1.3L9 22h6l.3-2.6a8 8 0 0 0 2.2-1.3l2.4 1 2-3.4-2-1.6c.1-.4.1-.9.1-1.3Z`,search:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3`,chevron:`M9 6l6 6-6 6`,x:`M6 6l12 12M18 6L6 18`,menu:`M4 7h16M4 12h16M4 17h16`,play:`M7 5v14l11-7L7 5Z`,clear:`M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14`,download:`M12 3v12m0 0l-4-4m4 4l4-4M4 19h16`,refresh:`M21 12a9 9 0 1 1-3-6.7M21 4v5h-5`,folder:`M3 7a2 2 0 0 1 2-2h3.5l2 2H19a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z`,build:`M14 3l-1 4 4-1 3 3-4 1 1 4-3 3-1-4-4 1-3-3 4-1-1-4 3-3 5 0Z`,arrow:`M5 12h14M13 6l6 6-6 6`,external:`M14 5h5v5M19 5l-8 8M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6`,copy:`M9 9h11v11H9zM5 15H4V4h11v1`,check:`M5 12.5l4.5 4.5L19 7`,flask:`M9 3h6M10 3v6l-5.4 9.2A1.9 1.9 0 0 0 6.2 21h11.6a1.9 1.9 0 0 0 1.6-2.8L14 9V3M7.5 15h9`,spark:`M12 3v3m0 12v3m9-9h-3M6 12H3m13.5-6.5-2 2m-7 7-2 2m11 0-2-2m-7-7-2-2`,activity:`M3 12h4l2.5-7 5 14 2.5-7H21`,agent:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8`,kit:`M21 8l-9-5-9 5v8l9 5 9-5V8ZM3 8l9 5 9-5M12 13v8`,layers:`M12 3l9 5-9 5-9-5 9-5ZM3 13l9 5 9-5M3 17l9 5 9-5`,sun:`M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6 4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z`,moon:`M21 12.8A8.5 8.5 0 1 1 11.2 3a6.5 6.5 0 0 0 9.8 9.8Z`,power:`M12 3v9M7.5 6.5a7 7 0 1 0 9 0`,docs:`M5 4h9l5 5v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1ZM14 4v5h5M8 12h7M8 16h7`,skill:`M21.7 6.6a5 5 0 0 1-6.6 6.6l-7.4 7.4a2 2 0 1 1-2.8-2.8l7.4-7.4a5 5 0 0 1 6.6-6.6l-2.6 2.6a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0Z`,law:`M12 3v18M5 6h14M8 21h8M6 6l-3 6h6zM3 12a3 3 0 0 1 6 0M18 6l-3 6h6zM15 12a3 3 0 0 1 6 0`,rule:`M7 3h10a1 1 0 0 1 1 1v17l-6-3.5L6 21V4a1 1 0 0 1 1-1ZM9.5 9.5l1.8 1.8 3.4-3.6`,profile:`M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM5 20a7 7 0 0 1 14 0`,notebook:`M7 4h11v16H7zM4 8h3M4 12h3M4 16h3M11 9h5M11 13h5M11 17h3`,about:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 11v6M12 7.6h.01`,github:`M12 2a10 10 0 0 0-3.2 19.5c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.5 2.3 1.1 2.9.8.1-.6.3-1.1.6-1.3-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.7 1a9.4 9.4 0 0 1 5 0c1.9-1.3 2.7-1 2.7-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.8v2.6c0 .3.2.6.7.5A10 10 0 0 0 12 2Z`};function G({name:e,className:t=`glyph`,style:n}){return(0,W.jsx)(`svg`,{className:t,style:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,W.jsx)(`path`,{d:Bt[e]||``})})}function Vt({className:e=`sprout`}){return(0,W.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,W.jsx)(`path`,{d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,W.jsx)(`path`,{d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})}var K=[{id:`essentials`,label:`Essentials`,rank:1},{id:`standard`,label:`Standard`,rank:2},{id:`power`,label:`Power`,rank:3}],Ht=Object.fromEntries(K.map(e=>[e.id,e.rank])),Ut=e=>Object.hasOwn(Ht,e)?Ht[e]:1,Wt=(e,t)=>t.map(t=>[t,e]),Gt=Object.fromEntries([...Wt(`essentials`,[`page:overview`,`page:library`,`page:installs`,`page:personal`,`page:docs`,`page:settings`,`tab:personal/rules`,`tab:personal/profile`,`tab:installs/hosts`,`tab:installs/doctor`,`section:library/skills`,`section:library/agents`,`section:settings/machine`,`section:settings/server`,`section:settings/about`]),...Wt(`standard`,[`page:kits`,`page:activity`,`page:laws`,`tab:personal/memory`,`tab:installs/profiles`]),...Wt(`power`,[`page:models`,`page:loops`,`page:factories`,`tab:loops/templates`,`tab:loops/bricks`,`tab:loops/active`,`tab:factories/templates`,`tab:factories/active`,`tab:personal/notebook`,`tab:installs/edits`,`section:library/wiki`,`section:library/config`,`section:settings/danger`])]);function Kt(e,t){return!Object.hasOwn(Gt,e)||Ut(Gt[e])<=Ut(t)}function qt({page:e,tab:t,section:n}={}){let r=[`page:${e}`];t&&r.push(`tab:${e}/${t}`),e===`library`&&n&&r.push(`section:library/${n}`);let i=K[0];for(let e of r){let t=K.find(t=>t.id===Gt[e]);t&&t.rank>i.rank&&(i=t)}return i.id}var Jt=e=>qt(F(e)),Yt=e=>K.some(t=>t.id===e)?e:`essentials`,Xt=(0,B.createContext)({level:`power`,setLevel:()=>{},canSee:e=>Kt(e,`power`),rank:3});function Zt({children:e}){let[t,n]=L(`geneseed-view-level`,Yt),r=(0,B.useMemo)(()=>({level:t,setLevel:n,canSee:e=>Kt(e,t),rank:Ut(t)}),[t,n]);return(0,W.jsx)(Xt.Provider,{value:r,children:e})}var q=()=>(0,B.useContext)(Xt),Qt=new WeakMap,$t=e=>t=>{let n=JSON.stringify(e);return typeof t==`object`&&t&&Qt.get(t)===n?t:(typeof e==`object`&&e&&Qt.set(e,n),e)};function en(e,t,n){(0,B.useEffect)(()=>{let n=!0,r=()=>n,i=()=>{document.hidden||e(r)};e(r);let a=setInterval(i,t);return document.addEventListener(`visibilitychange`,i),()=>{n=!1,clearInterval(a),document.removeEventListener(`visibilitychange`,i)}},n)}var tn=5e3;function nn(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)(null),[i,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(0);return en(e=>a.activeLoops().then(n=>e()&&(t($t(n)),r(null)),t=>e()&&r(t.message)),tn,[s]),{loops:e?.loops??null,error:i||n,onPreset:(e,t)=>(o(null),a.setLoopPreset(e,t).then(()=>c(e=>e+1),e=>o(e.message)))}}var rn=5e3;function an(){let[e,t]=(0,B.useState)(null),[n,r]=(0,B.useState)(null);return en(e=>a.activeFactories().then(n=>e()&&(t($t(n)),r(null)),t=>e()&&r(t.message)),rn,[]),{runs:e?e.factories||[]:null,error:n}}var on=e=>e.status===`running`||e.status===`awaiting`,sn=e=>e?e.filter(on).length:0,cn=e=>K.find(t=>t.id===qt({page:e})).label;function ln({n:e,noun:t,href:n,page:r}){return e?(0,W.jsx)(`a`,{className:`sb-live`,href:n,children:`${e} ${t}${e===1?``:`s`} running · ${cn(r)}`}):null}function un(){let{loops:e}=nn();return(0,W.jsx)(ln,{n:sn(e),noun:`loop`,href:`#/loops/active`,page:`loops`})}function dn(){let{runs:e}=an();return(0,W.jsx)(ln,{n:sn(e),noun:`factory run`,href:`#/factories/active`,page:`factories`})}function fn(){let{canSee:e}=q(),t=!e(`page:loops`),n=!e(`page:factories`);return!t&&!n?null:(0,W.jsxs)(`div`,{className:`sb-live-foot`,role:`status`,children:[t?(0,W.jsx)(un,{}):null,n?(0,W.jsx)(dn,{}):null]})}var pn=[{group:`core`,hash:`#/`,page:`overview`,label:`Overview`,icon:`dashboard`},{group:`govern`,hash:`#/laws`,page:`laws`,label:`Constitution`,icon:`law`,count:e=>e?.counts?Rt(e.counts):null},{group:`build`,hash:`#/library`,page:`library`,label:`Library`,icon:`library`,count:e=>e?.counts?zt(e.counts):null},{group:`build`,hash:`#/models`,page:`models`,label:`Models`,icon:`agent`},{group:`build`,hash:`#/kits`,page:`kits`,label:`Kits`,icon:`kit`},{group:`build`,hash:`#/loops`,page:`loops`,label:`Loops`,icon:`loop`,countTitle:`Templates across every install`,count:e=>e?.counts?.loops??null},{group:`build`,hash:`#/factories`,page:`factories`,label:`Factories`,icon:`build`},{group:`govern`,hash:`#/personal`,page:`personal`,label:`Personal`,icon:`profile`},{group:`run`,hash:`#/installs`,page:`installs`,label:`Installs`,icon:`layers`,count:(e,t)=>t?t.filter(e=>e.state!==`absent`).length:null}],mn=[{group:`help`,hash:`#/docs`,page:`docs`,label:`Docs`,icon:`docs`},{group:`run`,hash:`#/activity`,page:`activity`,label:`Activity`,icon:`activity`},{group:`help`,hash:`#/settings`,page:`settings`,label:`Settings`,icon:`settings`}],hn=[{id:`core`,title:null},{id:`govern`,title:`Govern`},{id:`build`,title:`Build`},{id:`run`,title:`Run`},{id:`help`,title:`Help`}],gn=[...pn,...mn],_n=`geneseed-rail`;function vn({n:e,lit:t,count:n,collapsed:r,onNavigate:i}){return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`a`,{className:`sb-item${t?` on`:``}`,href:e.hash,"aria-current":t?`page`:void 0,title:r?e.label:void 0,"aria-label":r?n==null?e.label:`${e.label}, ${n}`:void 0,onClick:()=>i?.(),children:[(0,W.jsx)(`span`,{className:`sb-chip`,"aria-hidden":`true`,children:(0,W.jsx)(G,{name:e.icon})}),(0,W.jsx)(`span`,{className:`sb-label`,children:e.label}),n==null?null:(0,W.jsx)(`span`,{className:`sb-count`,title:e.countTitle,children:n})]})})}function yn({route:e,overview:t,installs:n,onNavigate:r}){let[i,a]=L(_n,e=>e===`collapsed`?`collapsed`:`open`),o=i===`collapsed`,{canSee:s}=q(),c=t=>s(`page:${t.page}`)||e.page===t.page,l=()=>a(o?`open`:`collapsed`),u=o?`Expand the sidebar`:`Collapse the sidebar`;return(0,W.jsxs)(`nav`,{className:`sidebar${o?` collapsed`:``}`,id:`rail-nav`,"aria-label":`Console`,tabIndex:-1,children:[(0,W.jsxs)(`div`,{className:`sb-head`,children:[(0,W.jsx)(`button`,{type:`button`,className:`sb-collapse`,onClick:l,"aria-label":u,title:u,"aria-expanded":!o,children:(0,W.jsx)(G,{name:`chevron`})}),(0,W.jsxs)(`button`,{type:`button`,className:`sb-brand`,onClick:()=>{N(`#/`),r?.()},"aria-label":`Geneseed, go to the overview`,children:[(0,W.jsx)(`span`,{className:`sb-mark`,children:(0,W.jsx)(Vt,{})}),(0,W.jsxs)(`span`,{className:`sb-brand-text`,children:[(0,W.jsx)(`span`,{className:`sb-name`,children:`Geneseed`}),(0,W.jsx)(`span`,{className:`sb-ver`,children:[t?.version&&`v${t.version}`,t?.theme].filter(Boolean).join(` · `)})]})]})]}),hn.filter(e=>gn.some(t=>t.group===e.id&&c(t))).map(i=>(0,W.jsxs)(`div`,{className:`sb-group sb-${i.id}`,role:`group`,"aria-labelledby":i.title?`sb-g-${i.id}`:void 0,"aria-label":i.title?void 0:`Overview`,children:[i.title?(0,W.jsxs)(`div`,{className:`sb-group-title`,id:`sb-g-${i.id}`,children:[(0,W.jsx)(`i`,{"aria-hidden":`true`}),i.title]}):null,(0,W.jsx)(`ul`,{className:`sb-list`,children:gn.filter(e=>e.group===i.id&&c(e)).map(i=>(0,W.jsx)(vn,{n:i,lit:e.page===i.page,count:i.count?.(t,n),collapsed:o,onNavigate:r},i.page))})]},i.id)),(0,W.jsx)(fn,{})]})}var bn=[`overview`,`laws`,`library`,`installs`];function xn({route:e,navOpen:t,onMore:n}){let{canSee:r}=q();return(0,W.jsxs)(`nav`,{className:`tabbar`,"aria-label":`Console pages`,children:[pn.filter(t=>bn.includes(t.page)&&(r(`page:${t.page}`)||e.page===t.page)).map(t=>(0,W.jsxs)(`a`,{href:t.hash,className:e.page===t.page?`on`:``,"aria-current":e.page===t.page?`page`:void 0,children:[(0,W.jsx)(G,{name:t.icon}),t.label]},t.page)),(0,W.jsxs)(`button`,{type:`button`,className:`tab-more${bn.includes(e.page)?``:` on`}`,"aria-controls":`rail-nav`,"aria-expanded":!!t,onClick:n,children:[(0,W.jsx)(G,{name:`menu`}),`More`]})]})}var Sn=[{id:`opencode`,label:`OpenCode`,deployAdds:`.opencode/ + AGENT.md`,removeProject:`.opencode/ + AGENT.md + the bundle`,removeGlobal:`~/.config/opencode's AGENT.md, agents, skills, plugins + the opencode.json entry`},{id:`claude`,label:`Claude Code`,deployAdds:`.claude/ + CLAUDE.md`,removeProject:`.claude/ + the CLAUDE.md block`,removeGlobal:`~/.claude's agents/skills + the CLAUDE.md block + settings hooks`},{id:`bob`,label:`BOB (IBM)`,deployAdds:`.bob/ + AGENTS.md`,removeProject:`.bob/ + the AGENTS.md block`,removeGlobal:`~/.bob's agents/skills + the AGENTS.md block + settings hooks`},{id:`openclaude`,label:`OpenClaude`,deployAdds:`.openclaude/ + its CLAUDE.md`,removeProject:`.openclaude/ + its CLAUDE.md block`,removeGlobal:`~/.openclaude's agents/skills + the CLAUDE.md block + settings hooks`}],Cn=e=>Sn.find(t=>t.id===e)||Sn[0],wn=(e,t)=>t===`project`?Cn(e).removeProject:Cn(e).removeGlobal,Tn=e=>String(e||``).replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,En=e=>e.scope===`global`?Cn(e.host).label:Tn(e.path),Dn=e=>{let t=Cn(e.host).label;return e.scope===`global`?`${t} · global`:`${Tn(e.path)} · ${t}`},On=e=>({"--cc":`var(--cat-${e*2%7})`}),kn=(e,t=[])=>[...new Set(e)].filter(e=>!t.includes(e)),An=e=>{let t=(e||[]).filter(e=>e.state===`active`);return[...t.filter(e=>e.default),...t.filter(e=>!e.default)]},jn=e=>e?{host:e.host,path:e.path}:void 0,Mn=`geneseed-harness`,Nn=Sn.map(({id:e,label:t})=>({id:e,label:t}));function Pn(e=`opencode`){let[t,n]=L(Mn,e=>Nn.some(t=>t.id===e)?e:null);return[t??e,n]}function Fn(e){let t=String(e||``);return Sn.find(e=>t.startsWith(e.id))?.id||`opencode`}var In=Object.entries(ie).flatMap(([e,t])=>(P[e]||[``]).map(n=>{let r=n?t+` / `+re[n]:t;return{kind:`Pages`,sortKey:-1,title:r,desc:``,hay:r.toLowerCase(),route:e===`overview`?`#/`:`#/`+e+(n?`/`+n:``)}}));function Ln(e=0){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),o=(0,B.useRef)(null),[s]=Pn(),c=`${e}|${s}`,[l,u]=(0,B.useState)(c);return l!==c&&(u(c),n(null)),(0,B.useEffect)(()=>{o.current=null},[c]),{index:t,error:r,prime:(0,B.useCallback)(()=>{if(t||o.current)return o.current;let e=(async()=>{let e=[],t=[`laws`,`skills`,...oe],r=await Promise.all(t.map(async e=>{try{return{sec:e,items:(await a.catalog(e))?.items||[]}}catch{return{sec:e,items:[]}}}));for(let{sec:n,items:i}of r){let r=ae[n];for(let a of i){let i=a.title||a.name;e.push({kind:r.label,sortKey:t.indexOf(n),title:i,desc:a.desc||``,hay:`${i} ${a.desc||``} ${a.name||``}`.toLowerCase(),route:`#/item/${r.type}/${encodeURIComponent(a.name)}`})}}try{let t=await a.mcp(),n=new Set;for(let r of t?.targets||[])for(let t of r.servers||[]){if(n.has(t.name))continue;n.add(t.name);let r=t.label||t.name;e.push({kind:`MCP servers`,sortKey:100,title:r,desc:t.desc||``,hay:`${r} ${t.desc||``} ${t.name||``} mcp`.toLowerCase(),route:`#/installs/hosts`})}}catch{}try{let t=await a.docs(s);for(let n of t?.groups||[])for(let t of n.pages||[])e.push({kind:`Docs`,sortKey:110,title:t.title,desc:n.label,hay:`${t.title||``} ${t.id||``} ${n.label||``} ${t.section||``} ${t.description||``}`.toLowerCase(),route:`#/docs/${encodeURIComponent(t.id)}`})}catch{}return n(e),o.current=null,e})().catch(e=>(o.current=null,i(e.message||String(e)),[]));return o.current=e,e},[t,s])}}function Rn({open:e,title:t,children:n,confirmLabel:r,tone:i,onConfirm:a,onClose:o}){let s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useId)(),d=i===`danger`;return(0,B.useEffect)(()=>{let t=s.current;t&&(e&&!t.open&&(typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``)),e&&(d?c:l).current?.focus(),!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e,d]),(0,W.jsxs)(`dialog`,{ref:s,className:`confirm`,"aria-labelledby":`${u}-title`,"aria-describedby":`${u}-body`,onCancel:o,onClose:o,children:[(0,W.jsx)(`h3`,{className:`confirm-title`,id:`${u}-title`,children:t}),(0,W.jsx)(`div`,{className:`confirm-body`,id:`${u}-body`,children:n}),(0,W.jsxs)(`div`,{className:`confirm-actions`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:o,ref:c,children:`Cancel`}),(0,W.jsx)(`button`,{type:`button`,className:d?`btn danger`:`btn`,onClick:a,ref:l,children:r||`Confirm`})]})]})}var zn=(0,B.createContext)(null),Bn=()=>{throw Error(`useConfirm() needs a <ConfirmProvider> above it`)};function Vn(){return(0,B.useContext)(zn)||Bn}function Hn({children:e}){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),a=(0,B.useRef)(null),o=e=>{let t=a.current;a.current=null,n(null),t?.(e)},s=(0,B.useCallback)((e,t={})=>new Promise(r=>{a.current?.(!1),a.current=r,i(!!t.check?.checked),n({msg:e,...t})}),[]);return(0,W.jsxs)(zn.Provider,{value:s,children:[e,(0,W.jsxs)(Rn,{open:!!t,title:t?.title||`Are you sure?`,confirmLabel:t?.confirmLabel,tone:t?.tone,onConfirm:()=>o(!t?.check||{checked:r}),onClose:()=>o(!1),children:[t?.msg,t?.check?(0,W.jsxs)(`label`,{className:`confirm-check`,children:[(0,W.jsx)(`input`,{type:`checkbox`,checked:r,onChange:e=>i(e.target.checked)}),t.check.label]}):null]})]})}var Un=24;function Wn(e,t){let n=e.title.toLowerCase();return n.startsWith(t)?0:n.includes(t)?1:e.hay.includes(t)?2:-1}function Gn(e,t){let n=t.toLowerCase().trim();if(!e)return[];if(!n)return e.filter(e=>e.sortKey<0).sort((e,t)=>e.sortKey-t.sortKey);let r=[];for(let t of e){let e=Wn(t,n);e>=0&&r.push({e:t,s:e})}r.sort((e,t)=>e.e.sortKey-t.e.sortKey||e.s-t.s||e.e.title.localeCompare(t.e.title));let i=r.map(e=>e.e),a=i.filter(e=>e.sortKey>=0).slice(0,Un);return i.filter(e=>e.sortKey<0).concat(a)}function Kn(e,t){let n=t.trim().toLowerCase(),r=n?e.toLowerCase().indexOf(n):-1;return r<0?e:(0,W.jsxs)(W.Fragment,{children:[e.slice(0,r),(0,W.jsx)(`mark`,{className:`spot-hit`,children:e.slice(r,r+n.length)}),e.slice(r+n.length)]})}function qn({query:e,index:t,loading:n,error:r,active:i,onActive:a,onPick:o}){let s=(0,B.useMemo)(()=>Gn(t,e),[t,e]),c=(0,B.useRef)(null),{rank:l}=q(),u=e=>{if(!e.route)return null;let t=Jt(e.route);return Ut(t)>l?K.find(e=>e.id===t).label:null},d=s.length>0;(0,B.useLayoutEffect)(()=>{let e=c.current?.querySelectorAll(`[data-spot-row]`);if(!d||!e?.length||!w())return;let t=S(e,{opacity:[0,1],translateY:[-4,0],duration:E[4],delay:fe(E[0]),ease:k});return y(t,E[4]+E[0]*e.length)},[d]),(0,B.useEffect)(()=>{i>=s.length&&a(0)},[s,i,a]),(0,B.useEffect)(()=>{(c.current?.querySelector(`[data-spot-row="${i}"]`))?.scrollIntoView({block:`nearest`})},[i]);let f=[],p=null;s.forEach((e,t)=>{p&&p.kind===e.kind||(p={kind:e.kind,rows:[]},f.push(p)),p.rows.push({entry:e,index:t})});let m=!!e.trim();return(0,W.jsxs)(`div`,{className:`spotlight`,ref:c,id:`spotlight-list`,role:`listbox`,"aria-label":`Search results`,children:[f.map(t=>(0,W.jsxs)(`div`,{className:`spot-group`,role:`group`,"aria-label":t.kind,children:[(0,W.jsx)(`div`,{className:`spot-group-head`,"aria-hidden":`true`,children:t.kind}),t.rows.map(({entry:t,index:n})=>(0,W.jsxs)(`div`,{id:`spot-opt-${n}`,"data-spot-row":n,role:`option`,"aria-selected":n===i,className:`spot-row ${n===i?`on`:``}`,onMouseDown:e=>{e.preventDefault(),o(t)},onMouseEnter:()=>a(n),children:[(0,W.jsxs)(`div`,{className:`spot-title`,children:[Kn(t.title,e),u(t)?(0,W.jsx)(`span`,{className:`tag spot-level`,children:u(t)}):null]}),t.desc?(0,W.jsx)(`div`,{className:`spot-desc`,children:t.desc}):null]},`${t.route||t.title}-${n}`))]},`${t.kind}-${t.rows[0].index}`)),m&&r&&(0,W.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`Could not load the search index — `,r]}),m&&n&&!r&&(0,W.jsx)(`div`,{className:`spot-empty`,role:`presentation`,children:`Loading…`}),m&&!n&&!r&&s.length===0&&(0,W.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`No matches for “`,e,`”.`]})]})}function Jn({actions:e=[],dataRev:t}){let n=(0,B.useRef)(null),r=(0,B.useRef)(null),i=(0,B.useRef)(null),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(0),{index:d,error:f,prime:p}=Ln(t),m=Vn(),h=()=>{o(!0),p()},g=()=>{let e=n.current;e?.open&&(typeof e.close==`function`?e.close():e.removeAttribute(`open`)),o(!1),c(``),u(0),i.current?.focus()};(0,B.useEffect)(()=>{let e=n.current;a&&e&&!e.open&&(typeof e.showModal==`function`?e.showModal():e.setAttribute(`open`,``),r.current?.focus())},[a]),(0,B.useEffect)(()=>{let e=e=>{((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`k`||e.key===`/`&&!e.target.closest(`input, textarea, select`))&&(e.preventDefault(),o(!0),p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]);let _=(0,B.useMemo)(()=>[...e.map(e=>({sortKey:-2,...e})),...In,...d||[]],[e,d]),v=a?Gn(_,s):[],y=l<v.length?`spot-opt-${l}`:void 0,b=async e=>{if(g(),!e.run)return N(e.route);let t=e.confirm;(!t||await m(t.msg,{title:t.title,confirmLabel:t.confirmLabel,tone:t.tone}))&&e.run()};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`button`,{type:`button`,className:`tb-cmdk`,ref:i,"aria-haspopup":`dialog`,onClick:h,title:`Press / to open, or Ctrl-K / ⌘K from inside any field`,children:[(0,W.jsx)(G,{name:`search`,className:`mag glyph`}),(0,W.jsx)(`span`,{className:`tb-cmdk-label`,children:`Search or run…`}),(0,W.jsx)(`kbd`,{className:`tb-cmdk-key`,children:`Ctrl K`})]}),(0,W.jsx)(`dialog`,{ref:n,className:`palette`,"aria-label":`Search or run`,onCancel:e=>{e.preventDefault(),g()},onClose:()=>a&&g(),onClick:e=>e.target===n.current&&g(),children:a&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`palette-head`,children:[(0,W.jsx)(G,{name:`search`,className:`mag glyph`}),(0,W.jsx)(`input`,{ref:r,role:`combobox`,"aria-label":`Search or run`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":`spotlight-list`,"aria-activedescendant":y,value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,Math.max(v.length-1,0)));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){let t=v[l];t&&(e.preventDefault(),b(t))}else e.key===`Escape`&&(e.preventDefault(),s?(c(``),u(0)):g())},placeholder:`Search or run…`}),(0,W.jsx)(`kbd`,{className:`palette-key`,children:`Esc`})]}),(0,W.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v.length?`${v.length} results`:`no matches`}),(0,W.jsx)(qn,{query:s,index:_,loading:!d,error:d?``:f,active:l,onActive:u,onPick:b}),(0,W.jsxs)(`div`,{className:`palette-foot`,children:[(0,W.jsx)(`span`,{children:`↑↓ move`}),(0,W.jsx)(`span`,{children:`↵ open`}),(0,W.jsx)(`span`,{children:`actions that write always ask first`})]})]})})]})}var Yn=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function Xn({open:e,onClose:t,anchorRef:n,label:r,className:i,children:a}){let o=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!e)return;let r=o.current,i=n?.current;(r.querySelector(Yn)||r).focus();let a=e=>{e.key===`Escape`&&t()},s=e=>{r.contains(e.target)||i?.contains(e.target)||t()};return document.addEventListener(`keydown`,a),document.addEventListener(`mousedown`,s),()=>{document.removeEventListener(`keydown`,a),document.removeEventListener(`mousedown`,s);let e=document.activeElement;(!e||e===document.body||r.contains(e))&&i?.focus()}},[e]),e?(0,W.jsx)(`div`,{ref:o,className:i?`popover ${i}`:`popover`,role:`dialog`,"aria-label":r,tabIndex:-1,onBlur:e=>{let r=e.relatedTarget;!r||o.current?.contains(r)||n?.current?.contains(r)||t()},children:a}):null}function Zn({children:e,...t}){let n=x(`button.on`);return(0,W.jsxs)(`div`,{className:`seg`,role:`group`,ref:n,...t,children:[(0,W.jsx)(`span`,{className:`glide`,"aria-hidden":`true`}),e]})}function Qn({value:e,onChange:t,labelledBy:n}){let r=lt(e);return(0,W.jsxs)(`div`,{className:`accent-picker`,role:`group`,"aria-labelledby":n,children:[at.map(n=>(0,W.jsx)(`button`,{type:`button`,className:`accent-src${e===n.id?` on`:``}`,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id)),(0,W.jsxs)(`div`,{className:`accent-swatches`,children:[ot.map(n=>(0,W.jsx)(`button`,{type:`button`,className:`accent-swatch${e===n.id?` on`:``}`,style:{"--sw":n.hex},"aria-pressed":e===n.id,"aria-label":`${n.short} accent`,title:n.short,onClick:()=>t(n.id)},n.id)),(0,W.jsx)(`label`,{className:`accent-swatch accent-custom${r?` on picked`:``}`,style:r?{"--sw":r}:void 0,title:r?`Your colour, ${r}`:`Pick any colour`,children:(0,W.jsx)(`input`,{type:`color`,"aria-label":`Custom accent colour`,value:(r||`#3AD4C4`).toLowerCase(),onChange:e=>t(`hex:${e.target.value.toUpperCase()}`)})})]})]})}function $n({labelledBy:e}){let{level:t,setLevel:n}=q();return(0,W.jsx)(Zn,{"aria-labelledby":e,children:K.map(e=>(0,W.jsx)(`button`,{type:`button`,className:t===e.id?`on`:``,"aria-pressed":t===e.id,onClick:()=>n(e.id),children:e.label},e.id))})}function er({flavour:e,onFlavour:t,accentMode:n,onAccentMode:r,onClose:i,anchorRef:a}){return(0,ge.createPortal)((0,W.jsxs)(Xn,{open:!0,onClose:i,anchorRef:a,label:`Appearance`,className:`appearance-pop`,children:[(0,W.jsxs)(`div`,{className:`ap-group`,children:[(0,W.jsx)(`span`,{className:`ap-label`,id:`ap-skin`,children:`Skin`}),(0,W.jsx)(Zn,{"aria-labelledby":`ap-skin`,children:qe.map(n=>(0,W.jsx)(`button`,{type:`button`,className:e===n.id?`on`:``,"aria-pressed":e===n.id,onClick:()=>t(n.id),children:n.short},n.id))}),(0,W.jsx)(`span`,{className:`ap-note`,role:`status`,"aria-live":`polite`,children:qe.find(t=>t.id===e)?.tagline})]}),(0,W.jsxs)(`div`,{className:`ap-group`,children:[(0,W.jsx)(`span`,{className:`ap-label`,id:`ap-accent`,children:`Accent`}),(0,W.jsx)(Qn,{value:n,onChange:r,labelledBy:`ap-accent`}),(0,W.jsx)(`span`,{className:`ap-note`,role:`status`,"aria-live":`polite`,children:ft(n)})]}),(0,W.jsxs)(`div`,{className:`ap-group`,children:[(0,W.jsx)(`span`,{className:`ap-label`,id:`ap-view`,children:`View`}),(0,W.jsx)($n,{labelledBy:`ap-view`}),(0,W.jsx)(`span`,{className:`ap-note`,role:`status`,"aria-live":`polite`,children:`Hidden parts keep working.`})]})]}),document.querySelector(`.app`)||document.body)}function tr({route:e,navOpen:t,onToggleNav:n,actions:r,mode:i,onToggleMode:a,appearance:o,dataRev:s}){let[c,l]=(0,B.useState)(!1),u=(0,B.useRef)(null),d=e.tab&&re[e.tab];return(0,W.jsxs)(`header`,{className:`topbar`,children:[(0,W.jsx)(`button`,{type:`button`,className:`tb-menu iconbtn`,onClick:n,"aria-label":t?`Close navigation`:`Open navigation`,"aria-expanded":!!t,"aria-controls":`rail-nav`,children:(0,W.jsx)(G,{name:t?`x`:`menu`})}),(0,W.jsx)(`nav`,{className:`crumbs`,"aria-label":`Breadcrumb`,children:(0,W.jsxs)(`ol`,{children:[(0,W.jsx)(`li`,{children:d?(0,W.jsx)(`a`,{href:e.page===`overview`?`#/`:`#/${e.page}`,children:ie[e.page]}):(0,W.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:ie[e.page]})}),d?(0,W.jsx)(`li`,{children:(0,W.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:d})}):null]})}),(0,W.jsx)(`div`,{className:`topbar-spacer`}),(0,W.jsx)(Jn,{actions:r,dataRev:s}),(0,W.jsx)(`button`,{type:`button`,className:`iconbtn`,ref:u,"aria-label":`Appearance`,title:`Appearance`,"aria-expanded":c,onClick:()=>l(e=>!e),children:(0,W.jsx)(G,{name:`themes`})}),c?(0,W.jsx)(er,{...o,anchorRef:u,onClose:()=>l(!1)}):null,(0,W.jsx)(`button`,{type:`button`,className:`iconbtn`,title:i===`light`?`Switch to dark`:`Switch to light`,"aria-label":i===`light`?`Switch to dark mode`:`Switch to light mode`,onClick:a,children:(0,W.jsx)(G,{name:i===`light`?`moon`:`sun`})})]})}function nr({installs:e,value:t,onChange:n,className:r=``,tagOf:i=Dn,label:a=`Install`}){return!t||!e||e.length<2?null:(0,W.jsxs)(`label`,{className:`install-pick ${r}`.trim(),children:[(0,W.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,W.jsx)(`select`,{className:`sel mono`,"aria-label":a,value:t.id,onChange:t=>n(e.find(e=>e.id===t.target.value)),children:e.map(e=>(0,W.jsx)(`option`,{value:e.id,children:i(e)},e.id))})]})}function rr({unreadable:e}){return e?(0,W.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:`Install list unreadable — showing the default install.`}):null}var ir=3500;function ar({toast:e,onClose:t}){let[n,r]=(0,B.useState)(null),i=!!e&&e.kind!==`err`&&n!==e;(0,B.useEffect)(()=>{if(!i)return;let e=setTimeout(t,ir);return()=>clearTimeout(e)},[e,i]);let a=()=>r(e),o=()=>r(null);return(0,W.jsx)(`div`,{className:`toast-region`,"aria-live":e?.kind===`err`?void 0:`polite`,children:e&&(0,W.jsxs)(`div`,{className:`toast ${e.kind}`,role:e.kind===`err`?`alert`:void 0,onMouseEnter:a,onMouseLeave:e=>{e.currentTarget.contains(document.activeElement)||o()},onFocus:a,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||o()},children:[(0,W.jsx)(`div`,{children:e.msg}),(0,W.jsx)(`div`,{style:{marginTop:8},children:(0,W.jsx)(`button`,{className:`btn ghost`,onClick:t,children:`Dismiss`})})]})})}var or=e=>Sn.find(t=>t.id===e)?.label??e;function sr(e){let t=/^([a-z]+?)(?:-(global))?$/.exec(e);return t?`${or(t[1])} · ${t[2]||`project`}`:e}var cr={upgrade:`Update the source`,"rebuild-all":`Rebuild every install`,doctor:`Run the doctor`,diff:`Export local edits`,link:`Link the CLI`,unlink:`Unlink the CLI`};function lr(e){let t;return(t=/geneseed-cli\.mjs\s+(\S+)/.exec(e))?{title:cr[t[1]]||`Run ${t[1]}`,container:t[1]===`rebuild-all`}:/build-driver\.mjs\b/.test(e)?(t=/--emit\s+(\S+)/.exec(e),{title:t?`Build ${sr(t[1])}`:`Build the bundle`}):/npm(\.cmd)?\s+install\b/i.test(e)?{title:`Install the npm package`}:{title:`Run a step`}}var ur=/^\[(?:geneseed|rebuild-all|upgrade)\]\s*(?:WARN\b:?|⚠️)\s*/u,dr=/^(?:\[rebuild-all\] FAILED |\[rebuild-all\] \d+\/\d+ install\(s\) failed|\[rebuild-all\] not started:|\[web\] ✗ |\[web\] job crashed|\[web\] cancelled by user|\[geneseed\]\[E-[A-Z]+\] ✗|\[geneseed\] ✗)/,fr=/^\[geneseed\] (refused \S+: it is a link)/,pr=/^\[rebuild-all\] ([a-z]+):([a-z]+) \((.*)\): theme=/,mr=/^\[geneseed\] ([a-z]+(?:-global)?) -> .+?: (\d+ subagents, \d+ skills)/,hr=/^\[geneseed\] (\d+) new commit\(s\) upstream/,gr=/^\[geneseed\] already up to date\./,_r=/^\[rebuild-all\] rebuilt (\d+) install\(s\)\./,vr=/^\[rebuild-all\] WARN /,yr=/restarts? itself after this job/,br=/^\[geneseed\] ✓ (?:upgrade|update) complete\./,xr=/skipping the (\d+) remaining step\(s\)/;function Sr(e){let t=e.replace(ur,``),n=t.replace(/"[^"]*"(?:,\s*"[^"]*")+/g,e=>`${e.match(/"[^"]*"/g).length} entries`),r=n.indexOf(` — `),i=r===-1?n:n.slice(0,r),a=r===-1?``:n.slice(r+3),o=a.search(/\.(\s|$)/);return o!==-1&&(a=a.slice(0,o+1)),i.length>96&&(i=`${i.slice(0,95).replace(/\s+\S*$/,``)}…`),a&&=a[0].toUpperCase()+a.slice(1),{title:i,body:a,text:t}}function Cr(e,t,n={}){return{title:e,detail:``,raw:t==null?[]:[t],lines:[],warnings:[],notices:[],errors:[],...n}}var wr=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function Tr(e=``,t=`done`){let n=e?e.replace(/\n$/,``).split(`
3
+ `):[],r=[],i=[],a=null,o=null,s=!1,c=null,l=null,u=!1,d=[],f=e=>{a&&a.container&&a.raw.length===1&&!a.lines.length&&(r.pop(),e.raw.unshift(...a.raw)),r.push(e),a=e};for(let e of n){let t;if(t=/^\$ (.+)$/.exec(e)){let{title:n,container:r}=lr(t[1]);f(Cr(n,e,{container:!!r}))}else(t=pr.exec(e))?f(Cr(`Rebuild ${or(t[1])} · ${t[2]}`,e)):a?(a.raw.push(e),vr.test(e)?d.push(Sr(e)):ur.test(e)?a.warnings.push(Sr(e)):dr.test(e)?(a.errors.push(e),(t=xr.exec(e))&&(a.skippedSteps=Number(t[1]))):(t=fr.exec(e))?a.notices.push({title:t[1],text:e}):(t=mr.exec(e))?(a.detail=a.detail||t[2],l||=t[1]):(t=hr.exec(e))?(o=Number(t[1]),a.detail=wr(o,`new commit`)):gr.test(e)?(s=!0,a.detail=`already up to date`):(t=_r.exec(e))?c=Number(t[1]):yr.test(e)?u=!0:br.test(e)||e.trim()&&a.lines.push(e)):i.push(e)}if(t===`failed`&&!r.some(e=>e.errors.length)){r.length||r.push(Cr(`Run`,null));let e=[...n].reverse().find(e=>e.trim())||`the job failed without output`;r[r.length-1].failLine=e}r.forEach((e,n)=>{e.state=e.errors.length||e.failLine?`failed`:t===`running`&&n===r.length-1?`running`:e.warnings.length?`warn`:e.notices.length?`skipped`:`done`,e.stateText={failed:`Failed`,running:`Running`,warn:wr(e.warnings.length,`warning`),skipped:`${e.notices.length} skipped`,done:`Done`}[e.state],delete e.container}),u&&r.length&&(r[r.length-1].title+=`, restart web`);let p=[];return o===null?s&&p.push(`up to date`):p.push(wr(o,`new commit`)),c===null?l&&p.push(l):p.push(wr(c,`install`)),{phases:r,other:i,runWarnings:d,failed:r.some(e=>e.state===`failed`),warnings:r.reduce((e,t)=>e+t.warnings.length,d.length),notices:r.reduce((e,t)=>e+t.notices.length,0),detail:p.join(` · `),restart:u}}function Er(e){if(e==null)return``;if(e<60)return`${e}s`;let t=Math.floor(e/60);return`${t}m ${Math.round(e-t*60)}s`}function Dr(e,t){return e===`running`?`running`:e===`failed`||t.failed?`failed`:t.warnings?`warn`:`done`}var Or={running:`Running`,failed:`Failed`,done:`Done`,warn:`Done`},kr={running:`running`,failed:`✗`,warn:`⚠`},Ar=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function jr({runs:e,open:t,onToggle:n,onClear:r,onCancel:i,busy:a,finish:o}){let s=(0,B.useRef)(null),c=(0,B.useRef)(null),[l,u]=(0,B.useState)({id:null,at:0}),[d,f]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=c.current;o&&e&&(e.classList.remove(`flash-ok`,`flash-bad`),e.offsetWidth,e.classList.add(o.status===`done`?`flash-ok`:`flash-bad`))},[o]);let p=(0,B.useMemo)(()=>e.map(e=>Tr(e.output,e.status)),[e]),m=l.at===e.length?l.id:null,h=m===null?-1:e.findIndex(e=>e.id===m),g=h===-1?e.length-1:h,_=e[g],v=p[g],y=_?_.output.length:0;return(0,B.useEffect)(()=>{s.current&&(s.current.scrollTop=0)},[_?.id]),(0,B.useEffect)(()=>{let e=s.current;e&&t&&_?.status===`running`&&(e.scrollTop=e.scrollHeight)},[y,t,_?.status]),(0,W.jsxs)(`div`,{className:`console`,style:{height:`42vh`,transform:t?`none`:`translateY(calc(42vh - 42px))`},children:[(0,W.jsxs)(`div`,{className:`console-head`,ref:c,onClick:n,onAnimationEnd:e=>{e.target===e.currentTarget&&e.currentTarget.classList.remove(`flash-ok`,`flash-bad`)},children:[a&&(0,W.jsx)(`span`,{className:`console-progress`,"aria-hidden":`true`}),(0,W.jsxs)(`span`,{className:`ttl`,children:[(0,W.jsx)(`span`,{className:`live ${a?`on`:``}`}),`terminal`]}),(0,W.jsx)(`span`,{className:`count`,children:e.length}),(0,W.jsxs)(`div`,{className:`right`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(`button`,{className:`iconbtn`,title:`Clear`,"aria-label":`Clear run history`,onClick:r,disabled:!e.length,children:(0,W.jsx)(G,{name:`clear`})}),(0,W.jsx)(`button`,{className:`iconbtn`,title:t?`Collapse`:`Expand`,"aria-label":t?`Collapse console`:`Expand console`,"aria-expanded":t,onClick:n,children:(0,W.jsx)(G,{name:`chevron`,className:`glyph`,style:{transform:t?`rotate(90deg)`:`rotate(-90deg)`}})})]})]}),t&&(e.length===0?(0,W.jsx)(`div`,{className:`console-body`,children:(0,W.jsx)(`div`,{className:`console-empty`,children:`No commands run yet. Actions you trigger stream here.`})}):(0,W.jsxs)(`div`,{className:`console-body cx`,children:[(0,W.jsx)(`ul`,{className:`cx-runs`,"aria-label":`Runs`,children:e.map((t,n)=>{let r=Dr(t.status,p[n]);return(0,W.jsx)(`li`,{children:(0,W.jsxs)(`button`,{className:`cx-run${n===g?` on`:``}`,"aria-current":n===g?`true`:void 0,onClick:()=>u({id:t.id,at:e.length}),children:[(0,W.jsx)(`span`,{className:`cx-dot ${r}`,"aria-hidden":`true`}),(0,W.jsxs)(`span`,{className:`cx-run-main`,children:[(0,W.jsx)(`span`,{className:`cx-run-act`,children:t.action}),p[n].detail&&(0,W.jsx)(`span`,{className:`cx-run-sub`,title:p[n].detail,children:p[n].detail})]}),(0,W.jsxs)(`span`,{className:`cx-run-dur`,children:[kr[r]&&(0,W.jsx)(`span`,{className:`cx-mark ${r}`,"aria-hidden":`true`,children:kr[r]}),t.status===`running`?``:Er(t.duration)]}),(0,W.jsxs)(`span`,{className:`sr-only`,children:[Or[r],r===`warn`?` with warnings`:``]})]})},t.id)}).reverse()}),(0,W.jsx)(`section`,{className:`cx-detail`,ref:s,"aria-label":`Run ${_.action}`,children:(0,W.jsx)(Mr,{run:_,view:v,showLog:d===_.id,onLog:()=>f(e=>e===_.id?null:_.id),onCancel:i})})]}))]})}function Mr({run:e,view:t,showLog:n,onLog:r,onCancel:i}){let a=Dr(e.status,t),o=[e.status===`running`?`running`:Er(e.duration),Ar(t.warnings,`warning`),Ar(t.notices,`notice`)].filter(Boolean);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`header`,{className:`cx-head`,children:[(0,W.jsx)(`h3`,{className:`cx-title`,children:e.action}),(0,W.jsx)(`span`,{className:`cx-pill ${a}`,children:Or[a]}),e.status===`running`&&i&&(0,W.jsx)(`button`,{className:`iconbtn run-cancel`,title:`Cancel this run`,"aria-label":`Cancel the ${e.action} run`,onClick:()=>i(e.id),children:(0,W.jsx)(G,{name:`x`})}),(0,W.jsx)(`button`,{className:`cx-logbtn`,"aria-pressed":n,onClick:r,children:`Full log`})]}),(0,W.jsx)(`p`,{className:`cx-sum`,children:o.join(` · `)}),n?(0,W.jsx)(`pre`,{className:`run-out`,children:e.output}):(0,W.jsxs)(W.Fragment,{children:[t.phases.length===0&&!t.other.length&&(0,W.jsx)(`div`,{className:`console-empty`,children:e.status===`running`?`Waiting for output…`:`No output`}),(0,W.jsx)(`ol`,{className:`cx-phases`,children:t.phases.map((e,t)=>(0,W.jsx)(Pr,{n:t+1,p:e},t))}),t.runWarnings.length>0&&(0,W.jsxs)(`div`,{className:`cx-other`,children:[(0,W.jsx)(`div`,{className:`cx-ph-title`,children:`Run warnings`}),t.runWarnings.map((e,t)=>(0,W.jsx)(Nr,{w:e},t))]}),t.other.length>0&&(0,W.jsx)(Fr,{lines:t.other})]})]})}function Nr({w:e}){return(0,W.jsxs)(`div`,{className:`cx-warn`,children:[(0,W.jsx)(`b`,{children:e.title}),e.body&&(0,W.jsx)(`p`,{children:e.body}),e.text!==e.title&&(0,W.jsxs)(`details`,{children:[(0,W.jsx)(`summary`,{children:`Full text`}),(0,W.jsx)(`p`,{className:`cx-warn-full`,children:e.text})]})]})}function Pr({n:e,p:t}){return(0,W.jsxs)(`li`,{className:`cx-phase ${t.state}`,children:[(0,W.jsx)(`span`,{className:`cx-num`,"aria-hidden":`true`,children:e}),(0,W.jsxs)(`div`,{className:`cx-ph`,children:[(0,W.jsxs)(`div`,{className:`cx-ph-head`,children:[(0,W.jsx)(`span`,{className:`cx-ph-title`,children:t.title}),(0,W.jsx)(`span`,{className:`cx-ph-state`,children:t.stateText})]}),t.detail&&(0,W.jsx)(`div`,{className:`cx-ph-detail`,children:t.detail}),t.errors.map((e,t)=>(0,W.jsx)(`div`,{className:`cx-err`,children:e},`e${t}`)),t.failLine&&(0,W.jsx)(`div`,{className:`cx-err`,children:t.failLine}),t.warnings.map((e,t)=>(0,W.jsx)(Nr,{w:e},`w${t}`)),t.notices.map((e,t)=>(0,W.jsx)(`div`,{className:`cx-note`,title:e.text,children:e.title},`n${t}`)),t.lines.length>0&&(0,W.jsx)(`pre`,{className:`cx-lines`,children:t.lines.join(`
4
+ `)})]})]})}function Fr({lines:e}){return(0,W.jsxs)(`div`,{className:`cx-other`,children:[(0,W.jsx)(`div`,{className:`cx-ph-title`,children:`Other output`}),(0,W.jsx)(`pre`,{className:`cx-lines`,children:e.join(`
5
+ `)})]})}var Ir=550,Lr=`gs-splash-seen`,Rr=8e3;function zr(){try{if(window.localStorage.getItem(Lr))return 0;window.localStorage.setItem(Lr,`1`)}catch{}return Ir}function Br({ready:e,onDone:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=setTimeout(()=>r(!0),zr());return()=>clearTimeout(e)},[]);let[o,s]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(e)return;let t=setTimeout(()=>s(!0),Rr);return()=>clearTimeout(t)},[e]),e&&n&&!i&&a(!0),(0,B.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>t?.(),E[9]);return()=>clearTimeout(e)},[i]);let c=o&&!i;return(0,W.jsxs)(`div`,{className:`boot-splash${i?` fading`:``}`,"aria-hidden":c?void 0:`true`,onAnimationEnd:e=>{e.animationName===`splashOut`&&t?.()},children:[(0,W.jsxs)(`div`,{className:`boot-dial`,"aria-hidden":`true`,children:[(0,W.jsxs)(`svg`,{className:`boot-ring`,viewBox:`0 0 172 172`,children:[(0,W.jsx)(`circle`,{cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--surface-3)`,strokeWidth:`9`}),(0,W.jsx)(`circle`,{cx:`86`,cy:`86`,r:`50`,fill:`none`,stroke:`var(--line-2)`,strokeWidth:`8`,strokeDasharray:`1.2 5.3`,opacity:`.7`}),(0,W.jsx)(`circle`,{className:`boot-progress`,cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`9`,strokeLinecap:`round`})]}),(0,W.jsxs)(`svg`,{className:`boot-sprout`,viewBox:`0 0 24 24`,children:[(0,W.jsx)(`path`,{className:`bs-stem`,d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,W.jsx)(`path`,{className:`bs-leaf bs-leaf-main`,d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,W.jsx)(`path`,{className:`bs-leaf bs-leaf-back`,d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})]}),c?(0,W.jsxs)(`div`,{className:`boot-status`,role:`alert`,children:[(0,W.jsx)(`span`,{children:`The server is not answering.`}),` `,(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:Qe,children:`Retry`})]}):(0,W.jsxs)(`div`,{className:`boot-status`,children:[(0,W.jsx)(`span`,{children:`germinating harness`}),(0,W.jsx)(`span`,{className:`boot-caret`})]})]})}function J({label:e=`Loading…`}){return(0,W.jsxs)(`div`,{className:`loading`,role:`status`,children:[e,(0,W.jsxs)(`div`,{className:`skel`,"aria-hidden":`true`,children:[(0,W.jsx)(`div`,{className:`skel-bar`}),(0,W.jsx)(`div`,{className:`skel-bar`}),(0,W.jsx)(`div`,{className:`skel-bar`})]})]})}function Vr({error:e,style:t,onRetry:n,role:r=`alert`}){return e?n?(0,W.jsxs)(`div`,{className:`error-state`,role:r,style:t,children:[(0,W.jsx)(`p`,{className:`badge bad`,children:e}),(0,W.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:n,children:`Retry`})]}):(0,W.jsx)(`p`,{className:`badge bad`,role:r,style:t,children:e}):null}function Hr(){let[e,t]=(0,B.useState)(!1),[n,r]=(0,B.useState)(null);return(0,W.jsxs)(`div`,{className:`stale-banner`,role:`alert`,children:[(0,W.jsx)(`span`,{children:n||`This console is running code from before your last upgrade.`}),(0,W.jsx)(`button`,{className:`btn sm`,onClick:async()=>{t(!0),r(null);try{await rt()}catch(e){r(e.message),t(!1)}},disabled:e,children:e?`Restarting…`:`Restart`})]})}var Ur=/dynamically imported module|Importing a module script failed|Unable to preload CSS/i,Wr=e=>Ur.test(e?.message||``),Gr=class extends B.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=Wr(e);return(0,W.jsxs)(`div`,{role:t?void 0:`alert`,children:[(0,W.jsx)(Vr,{error:e.message||String(e),role:null}),t?(0,W.jsx)(Hr,{}):(0,W.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>this.setState({error:null}),children:`Retry`})]})}};function Kr({route:e}){let{rank:t,setLevel:n}=q(),r=qt(e);if(Ut(r)<=t)return null;let{label:i}=K.find(e=>e.id===r);return(0,W.jsxs)(`div`,{className:`level-banner`,role:`status`,children:[(0,W.jsxs)(`span`,{children:[`This is a `,i,` view.`]}),(0,W.jsxs)(`button`,{className:`btn sm`,onClick:()=>n(r),children:[`Show `,i,` views always`]})]})}var qr=(0,B.createContext)(null),Jr=e=>[...e].sort().join(`,`),Yr=e=>[...e.values()].some(e=>!e.applied&&Jr(e.value)!==e.base);function Xr(e,t){let[n,r]=(0,B.useState)(()=>({kits:new Map,rules:new Map})),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(t);if(o!==t&&(s(t),i&&t)){let e=t.status===`done`?{applied:!0}:{failed:!0};r(t=>{let n=t[i.kind].get(i.key);return n?{...t,[i.kind]:new Map(t[i.kind]).set(i.key,{...n,...e})}:t}),a(null)}let c=Yr(n.kits)||Yr(n.rules);return(0,B.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[c]),{get:(e,t)=>n[e].get(t),put:(e,t,n,i)=>r(r=>{let a=new Map(r[e]);return Jr(n)===i?a.delete(t):a.set(t,{value:n,base:i}),{...r,[e]:a}}),drop:(e,t)=>r(n=>{let r=new Map(n[e]);return r.delete(t),{...n,[e]:r}}),prune:(0,B.useCallback)((e,t)=>r(n=>{let r=[...n[e]].filter(([e,n])=>t(e,n)).map(([e])=>e);if(!r.length)return n;let i=new Map(n[e]);return r.forEach(e=>i.delete(e)),{...n,[e]:i}}),[]),startApply:(e,t)=>{a({kind:e,key:t}),r(n=>{let r=n[e].get(t);return r?{...n,[e]:new Map(n[e]).set(t,{value:r.value,base:r.base,sent:!0})}:n})},fail:(e,t)=>r(n=>{let r=n[e].get(t);return r?{...n,[e]:new Map(n[e]).set(t,{value:r.value,base:r.base,failed:!0})}:n}),running:(t,n)=>!!e&&i?.kind===t&&i?.key===n,busy:!!e}}function Zr({activeId:e,finish:t,children:n}){let r=Xr(e,t);return(0,W.jsx)(qr.Provider,{value:r,children:n})}function Qr(){let e=Xr(null,null);return(0,B.useContext)(qr)||e}var $r=e=>!!e&&!e.endsWith(`-global`);function ei({onAction:e}){let{data:t,error:n}=H(()=>a.themes(),[]),[r,i]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(!1);if(n)return(0,W.jsx)(Vr,{error:n});if(!t)return(0,W.jsx)(J,{});let m=r||t.current?.theme||`neutral`,h=(t.emits||[]).filter(e=>e.name!==`files`),g=t.emits?.some(e=>e.name===`opencode-global`),_=o||(g?`opencode-global`:t.current?.emit||h[0]?.name||``),v=i,y=s,b=$r(_);return(0,W.jsxs)(`div`,{className:`narrow-lg`,children:[(0,W.jsx)(`div`,{className:`head-row mb-18`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h1`,{className:`h`,children:`Deploy your harness`}),(0,W.jsx)(`p`,{className:`sub`,children:`Geneseed isn't implanted on this machine yet. Pick a voice and an install mode, then deploy. The graft runs in the console below, and this dashboard lights up when it lands.`})]})}),(0,W.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,W.jsx)(`div`,{className:`card-head`,children:(0,W.jsx)(`h3`,{children:`1 · Choose a voice`})}),(0,W.jsx)(`div`,{className:`row wrap gap-10`,children:t.themes.map(e=>(0,W.jsx)(`button`,{className:`btn ${e.name===m?`soft`:`ghost`}`,onClick:()=>v(e.name),title:e.blurb||e.tagline||e.name,children:(0,W.jsx)(`span`,{style:{textTransform:`capitalize`},children:e.name})},e.name))})]}),(0,W.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,W.jsx)(`div`,{className:`card-head`,children:(0,W.jsx)(`h3`,{children:`2 · Install mode`})}),(0,W.jsxs)(`p`,{className:`sub mb-16`,children:[`A `,(0,W.jsx)(`code`,{children:`-global`}),` mode deploys once to that tool's global config, so every repo on this machine inherits the harness (recommended). A project mode installs into the repository folder you choose.`]}),(0,W.jsxs)(`label`,{className:`stack`,style:{gap:6,maxWidth:360},children:[(0,W.jsx)(`span`,{className:`tick`,children:`Mode`}),(0,W.jsx)(`select`,{className:`sel`,value:_,onChange:e=>y(e.target.value),children:h.map(e=>(0,W.jsxs)(`option`,{value:e.name,children:[e.name,e.desc?` · ${e.desc}`:``]},e.name))})]}),b&&(0,W.jsxs)(`div`,{className:`row gap-10`,style:{maxWidth:560,marginTop:12},children:[(0,W.jsx)(`input`,{className:`inp`,style:{flex:1},type:`text`,placeholder:`/path/to/project, or click Browse…`,value:c,onChange:e=>l(e.target.value),"aria-label":`Project folder to install into`}),(0,W.jsx)(`button`,{className:`btn ghost sm`,disabled:f,onClick:async()=>{p(!0),d(``);try{let e=await a.pickFolder();e.path?l(e.path):e.error&&d(e.error)}catch(e){d(e.message)}finally{p(!1)}},children:f?`Choosing…`:`Browse…`})]}),u&&(0,W.jsx)(`p`,{className:`sub`,style:{marginTop:12},children:u})]}),(0,W.jsxs)(`button`,{className:`btn btn-grid`,disabled:!m||!_||b&&!c.trim(),onClick:()=>{if(!b)return e(`build`,{theme:m,emit:_});let t=c.trim();return t?(d(``),e(`deploy`,{host:_,path:t,theme:m})):d(`Choose or type the project folder to install into.`)},children:[(0,W.jsx)(G,{name:`build`}),`Deploy harness`]})]})}function ti(e){return H(()=>Promise.resolve().then(()=>a.installs()).catch(()=>null),[e],`installs`)}function ni(e){let{data:t,loading:n}=ti(e);return n&&!t?null:An(t?.installs)}var ri=e=>`geneseed-install-${e}`;function ii(e,t){try{localStorage.setItem(ri(e),t)}catch{}}function ai(e){try{let t=localStorage.getItem(ri(e))||``;return localStorage.removeItem(ri(e)),t}catch{return``}}function oi(e,t){let[n,r]=L(ri(e),e=>e||null);return[(t||[]).find(e=>e.id===n)||t?.[0]||null,e=>r(e.id)]}function si(e,t){let{data:n,loading:r}=ti(t),[i,a]=(0,B.useState)(null);n&&n!==i&&a(n);let o=n??i,s=r&&!o?null:An(o?.installs),c=s===null?null:s.length?s:[null],{data:l,reload:u}=H(()=>c?Promise.allSettled(c.map(t=>e(jn(t)))).then(e=>{let t=e.flatMap((e,t)=>e.status===`fulfilled`?[{inst:c[t],data:e.value}]:[]),n=t.map(e=>e.data.path);return{sets:t.filter((e,t)=>n.indexOf(e.data.path)===t),failed:c.filter((t,n)=>e[n].status===`rejected`),reason:e.find(e=>e.status===`rejected`)?.reason??null}}):Promise.resolve(null),[t,c?c.map(e=>e?.id??``).join(`|`):null]);return{targets:c,sets:l?.sets??null,failed:l?.failed??[],reason:l?.reason,reload:u}}var ci=(e,t)=>H(()=>a.rules(t).catch(()=>null),t?[e,t.host,t.path]:[e],`rules`,{revalidate:!0}),li=()=>Et(`rules`);function ui({eyebrow:e,title:t,sub:n,primary:r,actions:i,crumbs:a}){return(0,W.jsxs)(`div`,{className:`page-head`,children:[(0,W.jsxs)(`div`,{children:[a?.length?(0,W.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`page-crumbs`,children:(0,W.jsx)(`ol`,{children:a.map((e,t)=>(0,W.jsx)(`li`,{children:t===a.length-1?(0,W.jsx)(`span`,{"aria-current":`page`,children:e.label}):e.href?(0,W.jsx)(`a`,{href:e.href,children:e.label}):e.label},t))})}):null,e?(0,W.jsx)(`div`,{className:`eyebrow`,children:e}):null,(0,W.jsx)(`h1`,{className:`h`,children:t}),n?(0,W.jsx)(`p`,{className:`sub`,children:n}):null]}),r||i?(0,W.jsxs)(`div`,{className:`page-actions`,children:[i,r]}):null]})}function di({segments:e,value:t,max:n,size:r=120,stroke:i=12,label:a,sweepMs:o=E[9]}){let s=n>0?n:0,c=e||[{key:`v`,label:a,n:Math.min(Math.max(t||0,0),s),tone:`accent`}],l=e?c.reduce((e,t)=>e+t.n,0):s,u=e?c.map(e=>`${e.label}: ${e.n} of ${l}`).join(`, `):`${c[0].n} of ${l}`,d=r/2-i/2,f=r/2,p=e=>[f+d*Math.cos(e),f+d*Math.sin(e)],m=[],h=0;for(let e of c)m.push(h),h+=e.n;let g=(0,B.useRef)(null),_=c.map(e=>e.n).join(`,`);return(0,B.useLayoutEffect)(()=>{let e=g.current?.querySelectorAll(`path.ring-arc`);if(!o||!e?.length||!w())return;let t=c.map(e=>e.n/l).filter(e=>e>0),n=t.map((e,n)=>t.slice(0,n).reduce((e,t)=>e+t,0)),r=he(e);T(r,{draw:`0 0`});let i=S(r,{draw:[`0 0`,`0 1`],duration:(e,n)=>Math.max(o*t[n],E[1]),delay:(e,t)=>o*n[t],ease:`linear`});return y(i,o)},[_,o]),(0,W.jsxs)(`svg`,{className:`ring`,width:r,height:r,viewBox:`0 0 ${r} ${r}`,role:`img`,"aria-label":a?`${a}: ${u}`:u,children:[(0,W.jsx)(`circle`,{className:`ring-track`,cx:f,cy:f,r:d,fill:`none`,strokeWidth:i}),(0,W.jsx)(`g`,{ref:g,children:l>0?c.map((e,t)=>{let n=e.n/l;if(!(n>0))return null;let r=m[t]/l*2*Math.PI-Math.PI/2,a=r+n*2*Math.PI,[o,s]=p(r),[c,u]=p(a),h=n>=.9999?`M ${o} ${s} A ${d} ${d} 0 1 1 ${2*f-o} ${2*f-s} A ${d} ${d} 0 1 1 ${o} ${s}`:`M ${o} ${s} A ${d} ${d} 0 ${+(n>.5)} 1 ${c} ${u}`;return(0,W.jsx)(`path`,{className:`ring-arc tone-${e.tone||`muted`}`,d:h,fill:`none`,strokeWidth:i,children:(0,W.jsxs)(`title`,{children:[e.label,`: `,e.n]})},e.key)}):null})]})}var fi=E[8];function pi({parts:e,total:t,label:n,legend:r=!0}){let i=e.reduce((e,t)=>e+t.n,0),a=t??i,o=e=>a>0?`${e/a*100}%`:`0%`,s=e.map(e=>`${e.label}: ${e.n} of ${a}`).join(`, `),c=(0,B.useRef)(null),l=e.map(e=>e.n).join(`,`)+`/${a}`;return(0,B.useLayoutEffect)(()=>{if(c.current&&w())return T(c.current,{scaleX:0}),y(S(c.current,{scaleX:[0,1],duration:fi,ease:k}),fi)},[l]),(0,W.jsxs)(`div`,{className:`stackbar-box`,children:[(0,W.jsx)(`div`,{className:`stackbar sweep`,role:`img`,"aria-label":n?`${n}: ${s}`:s,ref:c,children:e.map(e=>e.n>0?(0,W.jsx)(`span`,{className:`tone-${e.tone||`muted`}`,style:{width:o(e.n)},title:`${e.label}: ${e.n}`},e.key):null)}),r&&(0,W.jsx)(`ul`,{className:`stackbar-legend`,"aria-hidden":`true`,children:e.map(e=>(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`i`,{className:`tone-${e.tone||`muted`}`}),e.label,` `,(0,W.jsx)(`span`,{className:`mono`,children:e.n})]},e.key))})]})}function mi({value:e,max:t,label:n=`value`,tone:r=`accent`}){let i=t>0?t:0;return(0,W.jsx)(pi,{parts:[{key:`v`,label:n,n:Math.min(Math.max(e||0,0),i),tone:r}],total:i,legend:!1})}var hi=864e5;function gi(e,t=10,n=`today`){let r=Array(t).fill(0).map((e,r)=>({t:r===t-1?n:`${t-1-r}d`,v:0})),i=e=>new Date(e).setHours(0,0,0,0),a=i(Date.now());for(let n of e){let e=n.started||n.finished||n.created||n.ts;if(!e)continue;let o=typeof e==`string`?Date.parse(e):e*1e3;if(!Number.isFinite(o))continue;let s=Math.round((a-i(o))/hi);s<0||s>=t||(r[t-1-s].v+=1)}return r}var _i=(e,t)=>[...e||[]].sort((e,t)=>(t.started||0)-(e.started||0)).slice(0,t),vi=[`--emit`,`--theme`,`--scope`],yi={done:`✓`,failed:`✗`};function bi(e){let t=(e.output||``).split(`
6
+ `).find(e=>e.startsWith(`$ `))||``,n=t.split(/\s+/),r=[];return n.forEach((e,t)=>{let[i,a]=e.split(`=`),o=a||n[t+1];vi.includes(i)&&o&&!o.startsWith(`--`)&&r.push(o)}),{verb:(e.action||`run`).split(/[\s(]/)[0],scope:r.join(` · `),result:yi[e.status]||`…`,duration:e.duration?`${e.duration}s`:`—`,command:t}}var xi={busy:{cls:`acc`,label:`working`,accent:`var(--accent)`},"waiting-input":{cls:`warn`,label:`your move`,accent:`var(--warn)`},blocked:{cls:`bad`,label:`blocked`,accent:`var(--bad)`},idle:{cls:``,label:`idle`,accent:`var(--line)`}},Si={cls:``,label:`ended`};function Ci(e){if(!e)return``;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||e}var wi=e=>e?e<1e3?String(e):e<1e5?(e/1e3).toFixed(1)+`k`:e<1e6?(e/1e3).toFixed(0)+`k`:(e/1e6).toFixed(1)+`M`:`0`;function Ti(e){if(e=Math.max(0,Math.floor(e)),e<60)return`${e}s`;let t=Math.floor(e/60);return t<60?`${t}m ${e%60}s`:`${Math.floor(t/60)}h ${t%60}m`}function Ei({startedAt:e}){let[t,n]=(0,B.useState)(()=>Date.now()/1e3);return(0,B.useEffect)(()=>{let e=setInterval(()=>n(Date.now()/1e3),1e3);return()=>clearInterval(e)},[]),Ti(t-e)}function Di({done:e,total:t}){let n=Math.min(t,10),r=Math.min(n,Math.round(e/t*n));return(0,W.jsxs)(`span`,{className:`act-todo`,children:[(0,W.jsx)(`span`,{className:`on`,children:`●`.repeat(r)}),(0,W.jsx)(`span`,{className:`dim`,children:`○`.repeat(n-r)})]})}var Oi=e=>e.ended?null:e.turn_started_at,ki=e=>!!(e.tokens>0||e.cost>0||Oi(e)||e.files?.count>0);function Ai({s:e,heading:t,id:n,children:r}){let i=e.ended?Si:xi[e.status]||xi.idle,a=e.files,o=ki(e),s=e=>n?`${n}-${e}`:void 0;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`row between wrap gap-12`,children:[t?(0,W.jsxs)(`div`,{className:`row gap-10 act-min`,children:[(0,W.jsx)(`span`,{className:`feed-dot act-dot ${e.ended?``:i.cls||`acc`}`}),(0,W.jsxs)(`div`,{className:`act-min`,children:[(0,W.jsx)(`h2`,{className:`act-title`,id:s(`t`),children:t}),e.cwd&&(0,W.jsx)(`div`,{className:`dim mono act-cwd`,title:e.cwd,children:e.cwd})]})]}):null,(0,W.jsxs)(`div`,{className:`row gap-8 act-fixed`,children:[e.model&&(0,W.jsx)(`span`,{className:`badge mono`,title:`model`,children:e.model}),e.agent&&(0,W.jsx)(`span`,{className:`badge`,children:e.agent}),(0,W.jsxs)(`span`,{className:`badge ${i.cls}`,id:s(`st`),children:[(0,W.jsx)(`span`,{className:`dot`}),i.label]}),r]})]}),e.phase&&(0,W.jsxs)(`div`,{className:`row gap-8 act-phase`,children:[(0,W.jsx)(G,{name:`activity`}),(0,W.jsx)(`span`,{className:`act-ell`,title:e.phase,children:e.phase})]}),o&&(0,W.jsxs)(`div`,{className:`row wrap act-counters`,id:s(`c`),children:[e.tokens>0&&(0,W.jsxs)(`span`,{children:[wi(e.tokens),` tok`]}),e.cost>0&&(0,W.jsxs)(`span`,{children:[`$`,e.cost.toFixed(2)]}),Oi(e)?(0,W.jsx)(`span`,{children:(0,W.jsx)(Ei,{startedAt:e.turn_started_at})}):null,a&&a.count>0&&(0,W.jsxs)(`span`,{children:[a.count,` file`,a.count===1?``:`s`,` `,(0,W.jsxs)(`span`,{className:`t-good`,children:[`+`,a.additions]}),` `,(0,W.jsxs)(`span`,{className:`t-bad`,children:[`−`,a.deletions]})]})]}),(e.error||e.blocked_on)&&(0,W.jsx)(`div`,{className:`act-err-row`,children:(0,W.jsx)(`span`,{className:`badge bad act-ell`,title:e.error||e.blocked_on,children:e.error||e.blocked_on})})]})}var ji=e=>e?.status===`blocked`||e?.status===`waiting-input`,Mi=864e5,Ni=e=>new Date(e).toISOString().slice(0,10),Pi=(e,t)=>new Date(`${e}T00:00:00Z`).toLocaleDateString(`en-GB`,{...t,timeZone:`UTC`}),Fi=e=>Pi(e,{day:`numeric`,month:`short`});function Ii(e,t=Date.now()){let n=Pi(e,{weekday:`long`,day:`numeric`,month:`long`}),r=e===Ni(t)?`Today`:e===Ni(t-Mi)?`Yesterday`:``;return r?`${r} · ${n}`:n}function Li(e,{now:t=Date.now(),days:n=14,cap:r}={}){let i=(e||[]).filter(e=>Number.isFinite(e.started)),a={};for(let e of i){let t=Ni(e.started*1e3);a[t]=(a[t]||0)+1}let o=i.length?Ni(Math.min(...i.map(e=>e.started))*1e3):null,s=i.filter(e=>e.status!==`running`).length,c=typeof r!=`number`||s>=r;return Array.from({length:n},(e,r)=>{let i=Ni(t-(n-1-r)*Mi);return{key:i,n:a[i]||0,nodata:c&&(o===null||i<o)}})}var Ri=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function zi(e,t,n,r=Date.now()){let i={},a=e=>i[e]||={key:e,runs:[],asks:[]};for(let t of _i(e,(e||[]).length))Number.isFinite(t.started)&&a(Ni(t.started*1e3)).runs.push(t);return(n||[]).forEach((e,n)=>{for(let r of t||[])r.per_day?.[n]>0&&a(e).asks.push([r.name,r.per_day[n]])}),Object.values(i).sort((e,t)=>e.key<t.key?1:-1).map(({key:e,runs:t,asks:n})=>{n.sort((e,t)=>t[1]-e[1]);let i=n.reduce((e,t)=>e+t[1],0),a=n.map(([e,t],n)=>`${e}${n?``:` asked`} ${t}×`).join(`, `),o=[t.length&&Ri(t.length,`run`),i&&Ri(i,`gate ask`)];return{key:e,title:Ii(e,r),sum:o.filter(Boolean).join(` · `),runs:t,gate:i?{title:a,n:i}:null}})}var Bi=E[8];function Vi({vals:e,i:t,sweep:n=!1,fill:r=!1}){let i=(0,B.useRef)(null),a=e.join(`,`);(0,B.useLayoutEffect)(()=>{if(n&&i.current&&w())return T(i.current,{strokeDasharray:1,strokeDashoffset:1}),y(S(i.current,{strokeDashoffset:[1,0],duration:Bi,ease:k}),Bi)},[a,n]);let o=Math.max(1,...e),s=96/(e.length-1),c=e.map((e,t)=>`${(t*s).toFixed(1)},${(20-e/o*17).toFixed(1)}`),[l,u]=c[c.length-1].split(`,`),d=(0,W.jsxs)(`svg`,{className:`spark`,viewBox:`0 0 96 22`,preserveAspectRatio:r?`none`:void 0,"aria-hidden":`true`,style:{"--i":t},children:[(0,W.jsx)(`polyline`,{points:`0,21 96,21`,className:`spk-base`}),(0,W.jsx)(`polygon`,{className:`spk-area`,points:`0,21 ${c.join(` `)} 96,21`}),(0,W.jsx)(`polyline`,{className:`spk-line`,pathLength:`1`,points:c.join(` `),ref:i}),r?null:(0,W.jsx)(`circle`,{className:`spk-end`,cx:l,cy:u,r:`2.4`})]});return r?(0,W.jsxs)(`span`,{className:`spark-fill`,style:{"--i":t},children:[d,(0,W.jsx)(`i`,{className:`spk-end`,"aria-hidden":`true`,style:{top:`${u/22*100}%`}})]}):d}function Hi(e,t){let n=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let e=n.current?[...n.current.querySelectorAll(`[data-sweep]`)]:[];if(e.length&&w())return T(e,{[t]:0}),y(S(e,{[t]:[0,1],duration:Bi,ease:k}),Bi)},[e,t]),n}var Y={security:`oklch(0.74 0.085 45)`,verify:`oklch(0.78 0.075 200)`,process:`oklch(0.76 0.075 150)`,craft:`oklch(0.78 0.085 95)`,context:`oklch(0.74 0.08 280)`,comms:`oklch(0.76 0.085 345)`},Ui={security:{label:`Security`,c:Y.security},verify:{label:`Verification`,c:Y.verify},process:{label:`Process`,c:Y.process},craft:{label:`Craft`,c:Y.craft},context:{label:`Context`,c:Y.context},comms:{label:`Communication`,c:Y.comms}},Wi={craft:Y.craft,rigor:Y.verify,ops:Y.process,process:Y.security,comms:Y.comms},Gi=e=>Wi[e]||`var(--text-3)`,Ki={design:{label:`Design`,c:Y.context},build:{label:`Build`,c:Y.craft},review:{label:`Review`,c:Y.security},ship:{label:`Ship`,c:Y.process},understand:{label:`Understand`,c:Y.verify},learn:{label:`Learn`,c:Y.comms},harness:{label:`Harness`,c:`oklch(0.76 0.07 250)`},personal:{label:`Custom`,c:`oklch(0.72 0.025 250)`}},qi=Object.keys(Ki);function Ji(e){let t=String(e||``),n=/\(retired\)\s*$/i.test(t);t=t.replace(/\s*\(retired\)\s*$/i,``),t=t.replace(/^(?:Rule\s+[IVXLCDM\d]+|Doctrine\s+[a-z]+\s+\d+)\s*[—-]\s*/i,``);let r=t.indexOf(` · `);return r===-1?{latin:``,name:t.trim(),retired:n}:{latin:t.slice(0,r).trim(),name:t.slice(r+3).trim(),retired:n}}var Yi=[[10,`X`],[9,`IX`],[5,`V`],[4,`IV`],[1,`I`]],Xi=e=>{let t=``;for(let[n,r]of Yi)for(;e>=n;)t+=r,e-=n;return t};function Zi(e){let t=/^([a-z]+)-(\d+)$/.exec(String(e));return t?t[1]===`law`?Xi(Number(t[2])):`${t[1]}.${t[2]}`:String(e)}function Qi(e){if(ea[e])return ea[e].label;let t=/^([a-z]+)\.(\d+)$/.exec(e);return t?`${t[1][0].toUpperCase()}${t[1].slice(1)} rule ${t[2]}`:/^[IVXLC]+$/.test(e)?`Rule ${e}`:e}var $i=new Set([`I`,`III`,`IV`,`process.1`,`process.5`,`rigor.5`,`ops.2`]),ea={I:{key:`secretsGate`,label:`Secrets gate`},III:{key:`doneGate`,label:`Done gate`},IV:{key:`deletionGate`,label:`Deletion gate`},VIII:{key:`testNote`,label:`Test note`},ownership:{key:`ownershipGate`,label:`Ownership gate`},"rigor.5":{key:`externalGate`,label:`External gate`}},ta=new Set([`process.1`,`process.5`,`ops.2`]),na={addr:`process.5`,key:`ownBranchPass`,label:`Strict consent`,desc:`Ask before every commit and push, your own branch included.`,on:`Every commit and push asks again, on your own branch too.`,off:`Commits and pushes on your own branch pass again; the main branch still asks.`},ra=new Set([...$i].filter(e=>e.includes(`.`)&&!ta.has(e)&&!ea[e])),ia={I:{arm:`Writes that would carry a credential-shaped string are refused again.`,off:`A write carrying a credential-shaped string (on OpenCode, also a write to a key file) stops being refused. Rule I’s text still binds the agent; protected checks, real data loss and commit/push consent stay gated.`},III:{arm:`A turn that edited files cannot end before the checks in a non-empty .geneseed/done-checks.txt pass. With no such file, inferred checks only warn.`,off:`A turn that edited files may end without its checks passing, listed or inferred, and the session’s done-gate line goes. Rule III’s text still binds the agent; every other gate stays.`},IV:{arm:`Commands that would lose data nothing else holds ask again.`,off:`Commands that would really lose data — discarding uncommitted work, deleting an unpushed branch, removing untracked files — stop asking. Rule IV’s text still binds the agent; secrets, root-wide scans and commit/push consent stay gated.`},VIII:{arm:`A write that weakens a test gets a note again, when it happens and when the turn ends.`,off:`A write that adds a skip marker or drops an assertion gets no note, when it happens or when the turn ends. Rule VIII’s text still binds the agent; the done checks and every other gate stay. Run geneseed rebuild-all first: an older hook shim refuses the new flag, and every gate on that hook goes silent.`},ownership:{desc:`Stops the first write in an undecided application, once per session.`,arm:`The first write in an undecided application stops once again.`,off:`The first write in an undecided application is no longer stopped, the setup proposal leaves the install’s AGENT.md, and no decline reminder prints. A repo with mode: on still runs its checkpoints, and the Credo section still binds.`},"rigor.5":{arm:`Writes to a protected check or a gate’s own configuration ask again.`,off:`Writes to a protected check or a gate’s own configuration stop asking. The agent can then edit hook settings and AGENT.md gate markers unasked, so every other gate holds only while it leaves its wiring alone. OpenCode’s own permission.edit keys still ask. The rule’s text is not touched: excluding it is the rule’s own switch. Run geneseed rebuild-all first: an older hook shim refuses the new flag, and every gate on that hook goes silent.`}},aa={I:{on:`A file write (Write, Edit, NotebookEdit) whose new text holds a credential-shaped string: an AWS access key, a GitHub, Anthropic or Slack token, a private-key block. Files named .env* are exempt.`,hosts:`Claude Code and OpenClaude ask you. Bob refuses the write. OpenCode refuses it, and also refuses a write to a key file, such as *.pem, *.key, id_rsa, .ssh/ or .npmrc; on .env* it only warns.`,blind:`Text written by a shell command is not scanned, and other token formats pass.`,off:`The scan stops on every host, OpenCode’s key-file block too. Rule I’s text still binds.`},III:{on:`The end of a turn that edited files under the git root with a file-write tool. It reads the turn’s shell calls in the transcript and never runs a check itself.`,hosts:`Claude Code and OpenClaude: with checks listed in .geneseed/done-checks.txt, the turn cannot end until each one ran unpiped and passed after the last edit (one block per turn). With no list, checks are inferred from the manifests and only warn. OpenCode 1: a reminder on the next request. OpenCode 2 and Bob: not judged.`,blind:`A shell edit (sed -i, a redirect) is no edit here. A check that is piped, masked (|| true) or spelled another way (npx vitest) reads as not run.`,off:`No check at turn end, no done-gate line at start, and no weakened-test line at turn end; learning still runs. Rule III’s text still binds.`},IV:{on:`A shell command that would lose data nothing else holds, judged against the repo’s state: a protected branch deleted or force-pushed, an unpushed branch deleted, reset --hard over unpushed commits, uncommitted work discarded, a stash dropped, the reflog pruned, files git cannot restore removed. Also rm -rf of /, a drive or ~, mkfs, dd over a disk, format, a fork bomb.`,hosts:`Claude Code and OpenClaude ask you. Bob and OpenCode’s guard refuse. OpenCode’s own prompt also asks on git reflog expire, git gc --prune, and a force push or delete of main or master.`,blind:`It reads git, the rm family, find -delete, mkfs, dd and format: a script that deletes files itself passes. When it cannot tell (a glob, a $variable, sh -c, xargs), it asks rather than passes.`,off:`The real-loss check and OpenCode’s Rule IV prompt keys stop. The rm -rf / class still asks (refused on Bob and OpenCode). Rule IV’s text still binds.`},VIII:{on:`A file write to a test file that adds a skip marker (.skip(, xit(, xfail, @Disabled, @Ignore, pytest.mark.skip, t.Skip() or removes an assertion line and adds no other.`,hosts:`Advisory on every host: it asks nothing and blocks nothing. Claude Code and OpenClaude: a note to the agent at the edit, and a line to you at turn end. Bob: a hook-log line. OpenCode: one reminder on the next request, which the done gate’s switch also silences.`,blind:`Shell edits, and an assertion that is loosened in place rather than removed.`,off:`No note at the edit or at turn end. Rule VIII’s text still binds; the done checks stay.`},ownership:{on:`The first file write of a session in an application repo (a git root with a build manifest) whose root AGENTS.md has no ## Ownership section. Writes to AGENTS.md or .geneseed/ pass.`,hosts:`Every host refuses that write once and gives the reason to the agent, which asks you to set ownership up or skip; the next write passes. Bob uses exit 2. On Claude Code, OpenClaude and OpenCode a sub-agent never triggers it.`,blind:`Shell writes.`,off:`No first-write stop and no setup proposal. A repo with mode: on still runs its checkpoints, and the Credo section still binds.`},"process.1":{on:`A write to a rule store, user-rules.md or user-rules.draft.md, by a file tool or a parsed shell write. A hardlinked file always asks. Memory writes (MEMORY.md, memory/) pass.`,hosts:`Claude Code and OpenClaude ask you. Bob refuses a file-tool write and only warns on a shell write. OpenCode asks with its own prompt; the guard refuses what the host cannot prompt for, and OpenCode 1 refuses a parsed shell write.`,blind:`bash -c, interpreters, scripts and variables. The change report at turn end still lists store changes made outside an approved write, memory writes included.`,off:`Excluding this rule, or the process pack, is the switch: its hook goes with its text on every host, OpenCode’s permission.edit keys on the rule files too. The change report still lists rule-file changes.`},"process.5":{on:`A git commit or push onto the main branch (main, master, the remote’s default), a forced push, a bare git push, or a form the gate cannot read. Under strict consent, every commit and push.`,hosts:`Claude Code and OpenClaude ask you; commits and plain pushes on your own branch pass. OpenCode asks for every commit and push with its own prompt (its globs cannot see the branch), and allows a push of HEAD to loop/*. Bob only logs a warning; the command runs.`,blind:`A commit or push made by another program, a script or an alias.`,off:`Excluding this rule, or the process pack, is the switch: commits and pushes stop asking (Bob still logs its warning). The data-loss checks stay.`},"rigor.5":{on:`A write to a path in the project’s .geneseed/protected-checks.txt, to .geneseed/done-checks.txt, or to a gate’s own configuration: hook settings, excludes.json, AGENT.md gate markers, the manifest, any opencode.json(c), the hook shim. Parsed shell writes too (>, tee, sed -i, cp, mv, rm, the PowerShell writers).`,hosts:`Claude Code and OpenClaude ask you. Bob refuses the write; a hook settings.json only when it changes Geneseed’s own entries. OpenCode asks through its permission.edit keys; its guard refuses a protected check, the other hosts’ Geneseed files, and a shell write to any of them.`,blind:`bash -c, pwsh -c, interpreters, scripts, variables and globs: run the same checks in CI.`,off:`Every ask and refusal above stops, except OpenCode’s own permission.edit keys. Excluding the text on this page switches this gate off too; --exclude-rules rigor.5 alone leaves the hook asking.`},"ops.2":{on:`A recursive scan rooted at a filesystem root: find /, du /, grep -r or rg at /, /c or C:\\, Get-ChildItem C:\\ -Recurse.`,hosts:`Claude Code and OpenClaude ask you. Bob and OpenCode refuse it.`,blind:`A deeper path, ls / without -R, a quoted argument, the remote half of ssh, and a scan made by any other program.`,off:`Excluding this rule, or the ops pack, is the switch: a root scan stops asking on every host. The data-loss checks stay.`}},oa=[{key:`invariants`,source:`{{LAWS}}`,against:`—`},{key:`yours`,source:`user-rules.md`,against:`may tighten a {{LAW}}, never repeal one`},{key:`ethos`,source:`{{ONTOLOGY}}`,against:`never against a user rule`},{key:`doctrines`,source:`{{DOCTRINES}}`,against:`may tighten, never repeal`}],sa=[{source:`mode`,label:`Mode`,against:`binds how work runs`},{source:`PROFILE.md, posture, theme`,label:`Profile, posture, voice`,against:`inform only; never bind`}],ca=(e,t={})=>ea[e]?t?.[ea[e].key]===!1?`Gate off`:`Hook gate`:$i.has(e)?`Hook gate`:`Instruction`;function la(e){let t={};for(let n of e||[]){let e=Ki[n.klass]?n.klass:`personal`,r=t[e]||(t[e]={key:e,label:Ki[e].label,ok:0,exp:0});n.status===`experimental`?r.exp+=1:r.ok+=1}let n=qi.filter(e=>t[e]).map(e=>({...t[e],n:t[e].ok+t[e].exp}));return{rows:n,total:n.reduce((e,t)=>e+t.n,0),experimental:n.reduce((e,t)=>e+t.exp,0),max:Math.max(1,...n.map(e=>e.n))}}var X=(e,t,n=t+`s`)=>`${e} ${e===1?t:n}`;function ua({overview:e,setup:t,rules:n,activity:r,profile:i,skills:a,laws:o}){let s=[],c=e?.doctor;c&&!c.ok&&s.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${X(c.problems.length,`problem`)}`,detail:c.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});let l=e?.diff,u=pa(`drift`,l,``);u&&s.push(u),i?.seeded&&s.push({id:`profile`,tag:`Profile`,tone:`warn`,title:`Profile is still the seeded template`,detail:`every section holds placeholder text`,where:`personal/profile`,verb:`Fill in`,href:`#/personal/profile`});let d=n?.exists?n.stats:null;d&&d.rules===0&&s.push({id:`rules`,tag:`Rules`,tone:``,title:`No standing rules yet`,detail:`≈${d.tokens.toLocaleString(`en-US`)} tokens, the file's header alone`,where:`personal/rules`,verb:`Write a rule`,href:`#/personal/rules`});let f=Object.entries(t?.gates?.asks||{}).sort((e,t)=>t[1]-e[1]);if(f.length){let[e,n]=f[0],r=Zi(e),i=(o?.items||[]).find(e=>e.name===r),a=i?Ji(i.title).name:Qi(r);s.push({id:`gates`,tag:`Gates`,tone:``,title:`${a} asked ${X(n,`time`)}`,detail:`${n} of ${t.gates.total} gate asks`,where:`constitution`,verb:`Review`,href:`#/item/law/${encodeURIComponent(r)}`})}if(a){let{rows:e,experimental:t}=la(a.items);t&&s.push({id:`skills`,tag:`Skills`,tone:``,title:`${X(t,`skill`)} still experimental`,detail:e.filter(e=>e.exp).sort((e,t)=>t.exp-e.exp).map(e=>`${e.label.toLowerCase()} ${e.exp}`).join(`, `),where:`library/skills`,verb:`Triage`,href:`#/skills`})}return t&&t.facts===0&&s.push({id:`memory`,tag:`Memory`,tone:``,title:`Memory holds no facts`,detail:`MEMORY.md is an empty index`,where:`personal/memory`,verb:`Open`,href:`#/personal/memory`}),r&&r.enabled===!1&&s.push({id:`activity`,tag:`Activity`,tone:``,title:`Session tracking is off`,detail:`no per-session trace is kept`,where:`activity`,verb:`Turn on`,href:`#/activity`}),s}var da=e=>Lt(e.drift),fa=e=>Ft(e.drift);function pa(e,t,n){let r=Lt(t),i=Ft(t),a={id:e,tag:`Local edits`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`};return r?{...a,tone:`warn`,title:`${n}${X(r,`local edit`)}`,detail:`${t.edited-i} edited, ${t.added} added, ${t.missing} missing`+(i?`, ${i} kept`:``)}:i?{...a,tone:``,sugg:!0,title:`${n}${X(i,`kept edit`)}`,detail:`edited in place, source unchanged — nothing missed`}:null}var ma=e=>e.drift?.stale??0;function ha(e){let t=t=>new Set((e?.never||[]).filter(e=>e.kind===t).map(e=>e.name)).size;return{skills:t(`skill`),agents:t(`agent`)}}function ga(e){let t=e?.installs||[],n=t.filter(e=>e.state===`active`),r=t.length-n.length,i=n.filter(e=>e.verdict===`behind`).length,a=n.reduce((e,t)=>e+da(t),0),o=n.reduce((e,t)=>e+ma(t),0),s=n.reduce((e,t)=>e+fa(t),0),c=e?.doctor,l=c&&!c.ok?`bad`:i||a||o?`warn`:c?`good`:`unknown`,u={good:`Installs healthy.`,unknown:`Checking the installs.`,warn:`Installs need a look.`,bad:`Installs have problems.`}[l],d=[X(n.length,`active install`)+(r?`, ${r} disabled`:``),c?c.ok?`doctor clean`:`doctor found ${X(c.problems.length,`problem`)}`:`doctor still running`,i?`${X(i,`install`)} behind source`:`all in sync with source`,(a?X(a,`local edit`):`no local edits`)+(s?`, ${X(s,`kept edit`)}`:``)];return o&&d.push(`${X(o,`file`)} behind source`),{tone:l,head:u,facts:d}}var _a=[[`carrier`,`Root file`],[`skills`,`Skill list`],[`agents`,`Agent list`],[`context`,`Session files`]],va=e=>e?e.carrier+e.skills+e.agents+e.context:0,ya=e=>e.state===`active`&&(e.verdict===`behind`||Lt(e.drift)>0||(e.drift?.stale??0)>0),Z=e=>`≈${(e/4/1e3).toFixed(1)}k`,ba=Dn,xa=.85;function Sa(e){let t=({chars:e,budget:t,cut:n})=>e+(n?t:0),n=(e||[]).filter(e=>e.session_start).reduce((e,n)=>!e||t(n.session_start)>t(e.session_start)?n:e,null);if(!n)return null;let{chars:r,budget:i,cut:a}=n.session_start;return{install:n,size:`${(r/1e3).toFixed(1)} / ${i/1e3} KB`,cut:a,near:a||r/i>=xa}}var Ca=e=>({id:e.id,host:e.host,path:e.path,label:ba(e)});function wa({fleet:e,usage:t,defaultLabel:n=null,...r}){let i=[],a=e?.doctor;a&&!a.ok&&i.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${X(a.problems.length,`problem`)}`,detail:a.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});for(let t of(e?.installs||[]).filter(e=>e.state===`active`)){if(t.verdict===`behind`){let e=t.built_epoch?`built ${jt(t.built_epoch)} ago`:`never built`,n=ma(t);i.push({id:`behind:${t.id}`,tag:`Behind`,tone:`warn`,title:`${ba(t)} is behind its source`,detail:n?`${e} · ${X(n,`file`)} behind`:e,where:Cn(t.host).label,verb:`Rebuild`,act:`rebuild`,installs:[Ca(t)]})}let e=pa(`drift:${t.id}`,t.drift,`${ba(t)}: `);e&&i.push(e)}if(t&&t.days_counted>=30&&t.never?.length){let{skills:e,agents:n}=ha(t);i.push({id:`usage`,tag:`Usage`,tone:``,sugg:!0,title:`${X(e,`skill`)} never fired in 30 days`,detail:`${X(n,`agent`)} too`,where:`library/skills`,verb:`Triage`,href:`#/skills`})}let o=Sa(e?.installs);if(o?.near){let e=o.cut?`were cut to fit the session-start budget`:`are near the session-start budget`;i.push({id:`session-start`,tag:`Session`,tone:`warn`,sugg:!0,title:o.install.shared?`Session files ${e}`:`${ba(o.install)}: session files ${e}`,detail:`${o.size} · without project context`,where:`personal`,verb:`Trim`,href:`#/personal`})}let s=(e?.installs||[]).filter(e=>e.state===`active`);s.some(e=>e.shared&&e.facts===0)&&i.push({id:`memory:shared`,tag:`Memory`,tone:``,sugg:!0,title:`Memory holds no facts`,detail:`no durable lesson recorded yet`,where:`personal/memory`,verb:`Open`,href:`#/personal/memory`});for(let e of s.filter(e=>!e.shared&&e.facts===0))i.push({id:`memory:${e.id}`,tag:`Memory`,tone:``,sugg:!0,title:`${ba(e)}: memory holds no facts`,detail:`no durable lesson recorded yet`,where:`personal/memory`,verb:`Open`,href:`#/personal/memory`});let c=ua({...r,overview:r.overview&&{...r.overview,doctor:null,diff:null},setup:s.some(e=>e.facts!=null)&&r.setup?{...r.setup,facts:null}:r.setup}),l=new Set([`profile`,`rules`]);for(let e of c){let t=n&&l.has(e.id)&&!r[e.id]?.shared?{title:`${n}: ${e.title}`}:{};i.push({...e,...t,sugg:!0})}return i}function Ta(e,t){return(e?.rules||[]).map(e=>{let n=Zi(e.rule),r=(t?.items||[]).find(e=>e.name===n);return{...e,name:r?Ji(r.title).name:e.rule===`wiki`?`Wiki guard`:Qi(n)}})}var Ea=e=>(e||[]).filter(e=>e.state===`active`&&e.cost);function Da(e){let t=Ea(e).filter(e=>e.cost.ceiling>0&&Number.isFinite(e.cost.carrier)),n=e=>e.cost.carrier/e.cost.ceiling,r=t.reduce((e,t)=>!e||n(t)>n(e)?t:e,null);if(!r)return null;let{carrier:i,ceiling:a}=r.cost;return{label:Dn(r),carrier:i,ceiling:a,pct:Math.round(n(r)*100)}}function Oa(e){let t=Ea(e);if(!t.length)return null;let n=t.reduce((e,t)=>va(t.cost)>va(e.cost)?t:e),r=t.map(e=>va(e.cost));return{min:Math.min(...r),max:Math.max(...r),top:n}}var ka=e=>(e?.per_day||[]).reduce((e,t)=>e+t,0);function Aa(e,t){let n=Ta(e,t),r=n.reduce((e,t)=>e+t.n,0),i=n.reduce((e,t)=>!e||t.n>e.n?t:e,null),a=[];for(let e of n)(e.per_day||[]).forEach((e,t)=>{a[t]=(a[t]||0)+e});return{total:r,top:i?{name:i.name,n:i.n}:null,perDay:a}}var ja=e=>e.catch(()=>null),Ma=e=>e.loading&&!e.data,Na=e=>!e.loading&&!e.data,Pa=e=>{let t=e.currentTarget.closest(`section`);t&&(t.setAttribute(`tabindex`,`-1`),t.focus())};function Fa({what:e,read:t,retry:n=!0}){let r=t.error?`${e} could not be read: ${t.error}`:`${e} could not be read.`;return n?(0,W.jsxs)(`div`,{className:`error-state`,children:[(0,W.jsx)(Vr,{error:r}),(0,W.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Retry: ${e.toLowerCase()}`,onClick:e=>{Pa(e),t.reload()},children:`Retry`})]}):(0,W.jsx)(Vr,{error:r,role:null})}var Ia=e=>Promise.resolve().then(e),La=(e,t)=>`${t?Math.min(100,e/t*100):0}%`,Ra=36e5,za=5e3,Ba=`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`;function Va({update:e,onAction:t,canFill:n=!0}){if(!e)return null;let r=e.install??(e.git?`git`:`npm-global`),i=r===`git`&&typeof e.behind==`number`?e.behind:null,a=r===`git`&&e.behind===null&&e.checking,o=i===null?e.latest===null||a?(0,W.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · `,e.checking?`checking…`:`update check unavailable`]}):e.available?(0,W.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current,` `,(0,W.jsxs)(`span`,{className:`ver-new`,children:[e.latest,` available`]})]}):(0,W.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current,` · latest`]}):i>0?(0,W.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current??``,` `,(0,W.jsxs)(`span`,{className:`ver-new`,children:[i,` commit`,i===1?``:`s`,` to pull`]})]}):(0,W.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · latest`]});if(r===`other`)return!e.available||!e.command?o:(0,W.jsxs)(W.Fragment,{children:[o,(0,W.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,W.jsx)(`code`,{className:`mono`,children:e.command})]})]});if(e.behind===!1&&e.available)return(0,W.jsx)(`span`,{title:Ba,children:o});if(a||e.behind===!1||r!==`git`&&!e.available)return o;let s=i===null?!!e.available:i>0;return(0,W.jsxs)(W.Fragment,{children:[o,(0,W.jsx)(`button`,{type:`button`,className:s&&n?`btn`:`btn ghost`,title:r===`git`?i===0?`Nothing to pull: this is the latest. Pulls and rebuilds every install anyway.`:`git pull, then rebuild every install`:`npm install -g geneseed@latest, then rebuild every install`,onClick:()=>t(`update`),children:`Update`})]})}var Ha={good:`M8 12.5l2.7 2.7L16 9.5M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`,warn:`M12 3 22 20H2zM12 10v4M12 17v.5`,bad:`M9 9l6 6M15 9l-6 6M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`,unknown:`M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`};function Ua({tone:e}){return(0,W.jsx)(`svg`,{className:`health-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,W.jsx)(`path`,{d:Ha[e]||Ha.warn})})}function Wa({fleet:e,error:t,behind:n,onAction:r,onRebuild:i}){let a=(0,W.jsx)(`button`,{type:`button`,className:`btn ghost ldg-doctor`,onClick:()=>r(`doctor`),children:`Run doctor`});if(!e)return t?(0,W.jsxs)(`section`,{className:`health unknown`,"aria-labelledby":`ldg-health`,children:[(0,W.jsx)(Ua,{tone:`warn`}),(0,W.jsx)(`div`,{className:`health-text`,role:`status`,children:(0,W.jsx)(`h2`,{id:`ldg-health`,children:`Status unknown`})}),(0,W.jsx)(`div`,{className:`health-acts`,children:a})]}):(0,W.jsx)(`div`,{className:`health unknown`,"aria-busy":`true`,children:(0,W.jsx)(J,{label:`Reading the installs…`})});let o=ga(e),s=[...o.facts,...e.version?[`Source is ${e.version}`]:[]];return(0,W.jsxs)(`section`,{className:`health ${o.tone}`,"aria-labelledby":`ldg-health`,children:[(0,W.jsx)(Ua,{tone:o.tone}),(0,W.jsxs)(`div`,{className:`health-text`,role:`status`,children:[(0,W.jsx)(`h2`,{id:`ldg-health`,children:o.head}),(0,W.jsxs)(`p`,{className:`health-facts`,children:[s.join(` · `),`.`]})]}),(0,W.jsxs)(`div`,{className:`health-acts`,children:[a,n.length?(0,W.jsxs)(`button`,{type:`button`,className:`btn`,title:`Rebuilds ${n.map(e=>e.label).join(`, `)}`,onClick:()=>i(n),children:[`Rebuild all behind (`,n.length,`)`]}):null]})]})}function Ga({chars:e}){let t=ne(e);return(0,W.jsxs)(`span`,{className:`mono`,children:[Z(t??e),` tok`]})}var Q=e=>Math.round(e/4),Ka={carrier:`accent`,skills:`skill`,agents:`agent`,context:`context`},qa=e=>_a.map(([t,n])=>({key:t,label:n,n:Q(e[t]),tone:Ka[t]})),Ja=Dn;function Ya({cost:e,i:t}){let n=2*Math.PI*14,r=e.ceiling?Math.min(1,e.carrier/e.ceiling):0;return(0,W.jsxs)(`svg`,{className:`ldg-ring`,viewBox:`0 0 36 36`,"aria-hidden":`true`,children:[(0,W.jsx)(`circle`,{className:`bg`,cx:`18`,cy:`18`,r:14}),(0,W.jsx)(`circle`,{className:`fg`+(e.ceiling&&e.carrier>e.ceiling?` over`:``),cx:`18`,cy:`18`,r:14,strokeDasharray:n.toFixed(2),strokeDashoffset:(n*(1-r)).toFixed(2),style:{"--circ":n.toFixed(2),"--i":t}})]})}function Xa({id:e,title:t,aside:n,className:r=``,children:i}){return(0,W.jsxs)(`section`,{className:`panel ldg-kpi ${r}`,"aria-labelledby":e,children:[(0,W.jsxs)(`div`,{className:`ldg-kpi-head`,children:[(0,W.jsx)(`h3`,{id:e,children:t}),n]}),i]})}var Za=(0,W.jsx)(`p`,{className:`dim`,children:`The installs could not be read.`});function Qa({installs:e,pending:t,failed:n}){let r=Da(e);return(0,W.jsx)(Xa,{id:`ldg-k-root`,title:`Root file vs ceiling`,className:`ldg-kpi-root`,children:t?(0,W.jsx)(J,{}):n?Za:r?(0,W.jsxs)(`div`,{className:`ldg-kpi-ring`,children:[(0,W.jsxs)(`span`,{className:`ldg-ringbox`,children:[(0,W.jsx)(di,{value:Q(r.carrier),max:Q(r.ceiling),segments:r.pct>100?[{key:`v`,label:`root file`,n:Q(r.carrier),tone:`bad`}]:void 0,size:104,stroke:10,label:`Worst root file: ${r.label}, ${r.pct} percent of its ceiling`}),(0,W.jsxs)(`span`,{className:`mono ldg-ring-pct`,"aria-hidden":`true`,children:[r.pct,`%`]})]}),(0,W.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,W.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Z(r.carrier)} tokens`}),(0,W.jsx)(`span`,{className:`dim`,children:`of ${Z(r.ceiling)} ceiling`}),(0,W.jsx)(`span`,{className:`dim`,title:r.label,children:`Highest install`})]})]}):(0,W.jsx)(`p`,{className:`dim`,children:`No root file to measure.`})})}function $a({installs:e,pending:t,failed:n}){let r=Oa(e),i=Sa(e),a=r&&(Z(r.min)===Z(r.max)?Z(r.max):`${Z(r.min)} – ${Z(r.max)}`);return(0,W.jsx)(Xa,{id:`ldg-k-cost`,title:`Loaded every turn`,className:`ldg-kpi-cost`,children:t?(0,W.jsx)(J,{}):n?Za:r?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,W.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Z(va(r.top.cost))} tokens`}),(0,W.jsx)(`span`,{className:`dim`,title:Ja(r.top),children:`Highest install`})]}),(0,W.jsx)(pi,{parts:qa(r.top.cost),label:`Loaded every turn, ${Ja(r.top)}`}),(0,W.jsx)(`span`,{className:`dim ldg-kpi-cap`,children:`All installs: ${a} tokens`}),i?(0,W.jsx)(`span`,{className:`ldg-kpi-cap ${i.near?`t-warn`:`dim`}`,children:`Session start · ${i.size} · without project context`}):null]}):(0,W.jsx)(`p`,{className:`dim`,children:`No install has a root file to measure.`})})}function eo({usage:e,read:t,pending:n}){let r=e?.enabled?e.days_counted<30&&e.since?`since ${e.since}`:`30 days`:null;return(0,W.jsx)(Xa,{id:`ldg-k-calls`,title:`Skill and agent calls`,className:`ldg-kpi-calls`,aside:r?(0,W.jsx)(`span`,{className:`mono dim ldg-kpi-aside`,children:r}):null,children:n?(0,W.jsx)(J,{}):e?e.enabled?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:(0,W.jsx)(A,{value:ka(e)})}),e.per_day?.length>1?(0,W.jsx)(Vi,{vals:e.per_day,i:0,fill:!0}):null]}):(0,W.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`}):(0,W.jsx)(Fa,{what:`Usage`,read:t})})}function to({gates:e,laws:t,read:n,pending:r}){let i=Aa(e,t);return(0,W.jsx)(Xa,{id:`ldg-k-gates`,title:`Gate asks · 30 days`,className:`ldg-kpi-gates`,aside:(0,W.jsx)(`a`,{className:`ldg-kpi-aside`,href:`#/laws`,"aria-label":`Open the Constitution`,children:`Constitution →`}),children:r?(0,W.jsx)(J,{}):e?i.total?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`span`,{className:`ldg-kpi-line`,children:[(0,W.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:i.total}),` `,(0,W.jsx)(`span`,{className:`dim`,children:`· ${i.top.name} ${i.top.n}`})]}),i.perDay.length>1?(0,W.jsx)(Vi,{vals:i.perDay,i:1,fill:!0}):null]}):(0,W.jsx)(`p`,{className:`dim`,children:`No gate asked in 30 days.`}):(0,W.jsx)(Fa,{what:`Gate activity`,read:n})})}var no=6;function ro({i:e}){if(!e.diffable)return(0,W.jsx)(`span`,{className:`dim`,title:`Local edits are only checked for global installs`,children:`not checkable`});let t=Lt(e.drift),n=e.drift?.stale??0,r=Ft(e.drift);return(0,W.jsxs)(W.Fragment,{children:[n||t||r?(0,W.jsx)(`span`,{className:`ldg-syncbar`,children:(0,W.jsx)(pi,{parts:[{key:`stale`,label:`Behind source`,n,tone:`warn`},{key:`edited`,label:`Local edits`,n:t,tone:`bad`},...r?[{key:`kept`,label:`Kept edits`,n:r,tone:`muted`}]:[]],label:`Sync with source, ${Ja(e)}`,legend:!1})}):null,t?(0,W.jsxs)(`span`,{className:`mono t-bad`,children:[t,` edited`]}):r?(0,W.jsxs)(`span`,{className:`mono dim`,title:`Edited in place; the source is unchanged, so nothing is missed`,children:[r,` kept`]}):e.drift?.linked?(0,W.jsxs)(`span`,{className:`mono dim`,title:`Yours: links Geneseed leaves alone`,children:[e.drift.linked,` linked by you`]}):n?null:(0,W.jsx)(`span`,{className:`mono dim`,children:`No edits`}),n?(0,W.jsxs)(`div`,{className:`mono dim ldg-sub`,children:[n,` file`,n===1?``:`s`,` behind`]}):null]})}function io(e){if(!e.diffable)return`Not checkable: local edits are only checked for global installs.`;let t=e.drift||{},n=[t.stale?`${t.stale} behind`:null,t.edited-(t.kept??0)?`${t.edited-(t.kept??0)} edited`:null,t.kept?`${t.kept} kept (source unchanged)`:null,t.added?`${t.added} added`:null,t.missing?`${t.missing} missing`:null,t.linked?`${t.linked} linked (yours)`:null].filter(Boolean);return n.length?n.join(` · `):`Nothing differs.`}function ao({i:e,n:t,onRebuild:n,onOpen:r,busy:i}){let[a,o]=(0,B.useState)(!1),s=Ja(e),c=(0,W.jsxs)(`td`,{className:`ldg-where`,children:[i?(0,W.jsx)(`span`,{className:`console-progress`,role:`progressbar`,"aria-label":`Rebuilding ${s}`}):null,(0,W.jsxs)(`div`,{className:`ldg-who`,children:[ya(e)?(0,W.jsx)(`svg`,{className:`ldg-glyph ${Lt(e.drift)?`bad`:`warn`}`,viewBox:`0 0 10 10`,role:`img`,"aria-label":Lt(e.drift)?`local edits`:`needs a rebuild`,children:(0,W.jsx)(`path`,{d:`M5 1 9 9H1z`,fill:`currentColor`})}):null,e.state===`active`&&e.cost?(0,W.jsx)(`span`,{className:`ldg-phone-ring`,"aria-hidden":`true`,children:(0,W.jsx)(Ya,{cost:e.cost,i:t})}):null,(0,W.jsxs)(`div`,{className:`ldg-name`,children:[(0,W.jsx)(`span`,{className:`ldg-host`,children:Cn(e.host).label}),` `,(0,W.jsx)(`span`,{className:`dim`,children:e.scope}),(0,W.jsx)(`div`,{className:`mono dim ldg-path`,title:e.path,children:e.path})]})]})]});if(e.state!==`active`)return(0,W.jsxs)(`tr`,{className:`ldg-off`,children:[c,(0,W.jsx)(`td`,{className:`ldg-build`,children:(0,W.jsx)(`span`,{className:`pill off`,children:`disabled`})}),(0,W.jsx)(`td`,{className:`ldg-sync`}),(0,W.jsx)(`td`,{className:`ldg-root`}),(0,W.jsx)(`td`,{className:`ldg-total`}),(0,W.jsx)(`td`,{className:`ldg-act`,children:(0,W.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`})})]});let l={synced:(0,W.jsx)(`span`,{className:`pill good`,children:`in sync`}),behind:(0,W.jsx)(`span`,{className:`pill warn`,children:`behind source`}),unknown:(0,W.jsx)(`span`,{className:`pill off`,children:`not checked`})}[e.verdict],u=va(e.cost),d=e.cost?.ceiling?Math.round(e.cost.carrier/e.cost.ceiling*100):null,f=e.cost?.skillCeiling?Math.round(e.cost.skills/e.cost.skillCeiling*100):null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`tr`,{className:a?`ldg-open`:``,children:[c,(0,W.jsxs)(`td`,{className:`ldg-build`,children:[l,(0,W.jsx)(`div`,{className:`mono dim ldg-sub`,children:e.built_epoch?`built ${jt(e.built_epoch)} ago`:`never built`})]}),(0,W.jsx)(`td`,{className:`ldg-sync`,children:(0,W.jsx)(ro,{i:e})}),(0,W.jsx)(`td`,{className:`ldg-root`,children:e.cost?d===null?(0,W.jsx)(`span`,{className:`dim`,children:`no ceiling`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`ldg-rootbar`,children:(0,W.jsx)(mi,{value:Q(e.cost.carrier),max:Q(e.cost.ceiling),label:`Root file, ${s}`,tone:d>100?`bad`:`accent`})}),(0,W.jsx)(`span`,{className:`mono dim ldg-sub`,children:`${Z(e.cost.carrier)} / ${Z(e.cost.ceiling)} · ${d}%`})]}):(0,W.jsx)(`span`,{className:`dim`,children:`not measured`})}),(0,W.jsx)(`td`,{className:`ldg-total`,children:e.cost?(0,W.jsx)(Ga,{chars:u}):null}),(0,W.jsxs)(`td`,{className:`ldg-act`,children:[ya(e)?(0,W.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Rebuild ${s}`,title:`Rebuilds ${s} only`,onClick:()=>n([Ca(e)]),children:`Rebuild`}):(0,W.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`}),(0,W.jsx)(`button`,{type:`button`,className:`btn ghost sm ldg-toggle`,"aria-label":`Details for ${s}`,"aria-expanded":a,"aria-controls":a?`ldg-detail-${e.id}`:void 0,onClick:()=>o(e=>!e),children:(0,W.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,"aria-hidden":`true`,children:(0,W.jsx)(`path`,{d:a?`M6 15l6-6 6 6`:`M6 9l6 6 6-6`})})})]})]}),a?(0,W.jsx)(`tr`,{className:`ldg-detail`,id:`ldg-detail-${e.id}`,children:(0,W.jsx)(`td`,{colSpan:no,children:(0,W.jsxs)(`div`,{className:`ldg-detail-grid`,children:[(0,W.jsxs)(`div`,{className:`ldg-detail-col`,children:[e.cost?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`ldg-lbl`,children:`What rides every turn · ${Z(u)} tokens`}),(0,W.jsx)(pi,{parts:qa(e.cost),label:s}),f===null?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`ldg-rootbar`,children:(0,W.jsx)(mi,{value:Q(e.cost.skills),max:Q(e.cost.skillCeiling),label:`Skill list, ${s}`,tone:f>100?`bad`:`skill`})}),(0,W.jsx)(`span`,{className:`mono dim ldg-sub`,children:`Skill list · ${Z(e.cost.skills)} / ${Z(e.cost.skillCeiling)} ceiling · ${f}%`})]})]}):(0,W.jsx)(`span`,{className:`dim`,children:`Always-on cost not measured.`}),(0,W.jsx)(`span`,{className:`dim`,children:[`Voice ${e.theme}`,`${e.footprint} footprint`,e.posture&&`${e.posture} posture`,e.mode&&`${e.mode} mode`].filter(Boolean).join(` · `)})]}),(0,W.jsxs)(`div`,{className:`ldg-detail-col`,children:[(0,W.jsx)(`span`,{className:`ldg-lbl`,children:`Differs from source`}),(0,W.jsx)(`span`,{className:`muted`,children:io(e)}),e.diffable?(0,W.jsx)(`span`,{children:(0,W.jsx)(`a`,{className:`btn ghost sm`,href:`#/installs/edits`,"aria-label":`View diff for ${s}`,onClick:()=>ii(`edits`,e.id),children:`View diff`})}):null]})]})})}):null]})}function oo({rows:e,pending:t,partial:n,onRetry:r,onAction:i,onRebuild:a}){let o=e.filter(e=>!e.sugg).length;return t?(0,W.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-needs`,children:[(0,W.jsx)(`div`,{className:`panel-head panel-head-rule`,children:(0,W.jsx)(`h2`,{id:`ldg-needs`,children:`Needs you`})}),(0,W.jsx)(J,{})]}):(0,W.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-needs`,children:[(0,W.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,W.jsx)(`h2`,{id:`ldg-needs`,children:`Needs you`}),(0,W.jsxs)(`span`,{className:`mono dim`,children:[o,` problem`,o===1?``:`s`,`, `,e.length-o,` suggestion`,e.length-o===1?``:`s`]})]}),e.length?(0,W.jsx)(`ul`,{className:`needs`,children:e.map(e=>(0,W.jsxs)(`li`,{className:e.sugg?`sugg`:``,children:[(0,W.jsx)(`span`,{className:`tag ${e.tone}`,children:e.tag}),(0,W.jsxs)(`span`,{className:`needs-what`,children:[(0,W.jsx)(`b`,{children:e.title}),e.detail?(0,W.jsxs)(`span`,{className:`dim`,children:[` · `,e.detail]}):null]}),(0,W.jsx)(`span`,{className:`mono dim needs-where`,title:e.where,children:e.where}),e.act?(0,W.jsx)(`button`,{type:`button`,className:`needs-verb linkish`,"aria-label":`${e.verb}: ${e.title}`,onClick:()=>e.installs?a(e.installs):i(e.act),children:e.verb}):(0,W.jsx)(`a`,{className:`needs-verb`,href:e.href,"aria-label":`${e.verb}: ${e.title}`,children:e.verb})]},e.id))}):n?null:(0,W.jsx)(`p`,{className:`needs-empty`,children:`Nothing needs you.`}),n?(0,W.jsxs)(`p`,{className:`dim`,children:[`Some reads failed, so this list may be incomplete.`,` `,(0,W.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Retry: the failed reads`,onClick:e=>{Pa(e),r()},children:`Retry`})]}):null]})}function so({usage:e,read:t,pending:n}){let r=(0,W.jsxs)(`div`,{className:`panel-head`,children:[(0,W.jsx)(`h2`,{id:`ldg-usage`,children:`What fires`}),(0,W.jsx)(`span`,{className:`mono dim`,children:`skills and agents, 30 d`})]});if(!e)return(0,W.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[r,n?(0,W.jsx)(J,{}):(0,W.jsx)(Fa,{what:`Usage`,read:t,retry:!1})]});if(!e.enabled)return(0,W.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[r,(0,W.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`})]});if(e.days_counted<30)return(0,W.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[r,(0,W.jsx)(`p`,{className:`muted`,children:e.since?(0,W.jsxs)(W.Fragment,{children:[`Counting since `,(0,W.jsx)(`b`,{children:e.since}),`, `,e.days_counted,` of 30 days`]}):`No skill or agent call counted yet`}),(0,W.jsx)(`div`,{className:`daytrack`,"aria-hidden":`true`,children:Array.from({length:30},(t,n)=>(0,W.jsx)(`i`,{className:n<e.days_counted?`on`:``},n))}),(0,W.jsx)(`p`,{className:`dim chart-foot`,children:`Rankings and the never-fired count appear once 30 days are counted, so a new install is not told every skill is unused.`})]});let i=e.rows.slice(0,7),a=Math.max(1,...i.map(e=>e.n));return(0,W.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[r,(0,W.jsx)(`ul`,{className:`ubars`,children:i.map((e,t)=>(0,W.jsxs)(`li`,{className:e.kind,children:[(0,W.jsxs)(`span`,{className:`ub-name`,title:`${e.name} ${e.kind}`,children:[e.name,` `,(0,W.jsx)(`span`,{className:`dim`,children:e.kind})]}),(0,W.jsx)(`span`,{className:`ub-trk`,children:(0,W.jsx)(`i`,{style:{width:La(e.n,a),"--i":t}})}),(0,W.jsx)(`span`,{className:`mono`,children:e.n})]},`${e.install}:${e.kind}:${e.name}`))}),e.never.length?(0,W.jsxs)(`div`,{className:`ub-never`,children:[(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`b`,{children:ha(e).skills}),` skills never fired`]}),(0,W.jsx)(`a`,{className:`needs-verb`,href:`#/skills`,children:`Triage`})]}):null]})}function co({count:e,canFill:t,onAction:n,view:r,dataRev:i}){let o=(0,B.useRef)(null),{data:s,reload:c}=H(()=>ja(a.update()).then(e=>(e?o.current=e:o.current?.checking&&(o.current={...o.current,checking:!1}),o.current)),[i]);(0,B.useEffect)(()=>{let e=setInterval(c,Ra),t=()=>{document.visibilityState===`visible`&&c()};return document.addEventListener(`visibilitychange`,t),()=>{clearInterval(e),document.removeEventListener(`visibilitychange`,t)}},[c]);let l=!!s?.checking;return(0,B.useEffect)(()=>{if(!l)return;let e=setTimeout(c,za);return()=>clearTimeout(e)},[l,s,c]),(0,W.jsx)(ui,{title:`Overview`,sub:e===null?null:`${e} install${e===1?``:`s`} on this machine`,actions:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Va,{update:s,onAction:n,canFill:t}),r]})})}function lo({overview:e,setup:t,runs:n,onAction:r,dataRev:i,banner:o,view:s}){let c=Vn(),[l,u]=(0,B.useState)({}),d=H(()=>a.fleet(),[i]),{data:f,error:p,reload:m}=d,h=H(()=>a.usage(),[i]),g=H(()=>a.gates(),[i]),{data:_}=h,{data:v}=g,y=ci(i),b=H(()=>a.activity(),[i]),x=H(()=>a.profile(),[i]),S=H(()=>Ia(()=>a.catalog(`skills`)),[i],`catalog:skills`),C=H(()=>Ia(()=>a.catalog(`laws`)),[i],`catalog:laws`),{data:w}=y,{data:ee}=b,{data:T}=x,{data:te}=S,{data:E}=C,ne=Ma(d),D=[d,h,y,b,x,S,C],O=D.some(Ma),k=Na(d),A=f?.installs||[],j=e=>{ii(`hosts`,e.id),window.location.hash=`#/installs/hosts`},M=ni(i),N=wa({defaultLabel:M?.length>1?Ja(M[0]):null,fleet:f,usage:_,overview:e,setup:t,rules:w,activity:ee,profile:T,skills:te,laws:E}),P=A.filter(ya).map(Ca),F=async e=>{let t=e.map(e=>e.label);if(!await c(`Rebuild ${t.join(`, `)}? Each is re-rendered from source with its own settings.`,{title:e.length===1?`Rebuild ${t[0]}?`:`Rebuild ${e.length} installs?`,confirmLabel:`Rebuild`}))return;let n=await r(`rebuild`,{installs:e.map(({host:e,path:t})=>({host:e,path:t}))});n&&u(t=>({...t,[n]:e.map(e=>e.id)}))},re=new Set(Object.entries(l).filter(([e])=>n?.find(t=>t.id===e)?.status===`running`).flatMap(([,e])=>e));return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(co,{count:f?A.length:null,canFill:!P.length,onAction:r,view:s,dataRev:i}),o,(0,W.jsxs)(`div`,{className:`ov-stack ldg`,children:[(0,W.jsx)(Wa,{fleet:f,error:p,behind:P,onAction:r,onRebuild:F}),(0,W.jsxs)(`div`,{className:`ldg-kpis`,role:`group`,"aria-labelledby":`ldg-kpis-h`,children:[(0,W.jsx)(`h2`,{id:`ldg-kpis-h`,className:`sr-only`,children:`Key figures`}),(0,W.jsx)(Qa,{installs:A,pending:ne,failed:k}),(0,W.jsx)($a,{installs:A,pending:ne,failed:k}),(0,W.jsx)(eo,{usage:_,read:h,pending:Ma(h)}),(0,W.jsx)(to,{gates:v,laws:E,read:g,pending:Ma(g)})]}),(0,W.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-fleet`,children:[(0,W.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,W.jsx)(`h2`,{id:`ldg-fleet`,children:`Installs`}),f?.source_fp?(0,W.jsxs)(`span`,{className:`mono dim`,children:[`source `,f.source_fp]}):null]}),p&&f?(0,W.jsxs)(`p`,{className:`dim`,role:`status`,children:[`Could not refresh the installs — showing the last read.`,` `,(0,W.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:m,children:`Retry`})]}):null,(0,W.jsx)(`div`,{className:`ldg-scroll`,children:(0,W.jsxs)(`table`,{className:`ldg-fleet`,children:[(0,W.jsx)(`caption`,{className:`sr-only`,children:`Installs`}),(0,W.jsx)(`thead`,{children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{scope:`col`,children:`Install`}),(0,W.jsx)(`th`,{scope:`col`,className:`ldg-build`,children:`Build`}),(0,W.jsx)(`th`,{scope:`col`,className:`ldg-sync`,children:`Sync with source`}),(0,W.jsx)(`th`,{scope:`col`,className:`ldg-root`,children:`Root file · ceiling`}),(0,W.jsx)(`th`,{scope:`col`,className:`ldg-total`,children:`Always-on`}),(0,W.jsx)(`th`,{scope:`col`,children:(0,W.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,W.jsxs)(`tbody`,{children:[p&&!f?(0,W.jsx)(`tr`,{children:(0,W.jsxs)(`td`,{colSpan:no,children:[(0,W.jsx)(`span`,{className:`dim`,role:`status`,children:`Could not read the installs`}),` `,(0,W.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:m,children:`Retry`})]})}):null,ne?(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:no,children:(0,W.jsx)(J,{})})}):null,A.map((e,t)=>(0,W.jsx)(ao,{i:e,n:t,onRebuild:F,onOpen:j,busy:re.has(e.id)},e.id))]})]})})]}),(0,W.jsxs)(`div`,{className:`ldg-bottom`,children:[(0,W.jsx)(oo,{rows:N,pending:O,partial:D.some(Na),onRetry:()=>D.filter(Na).forEach(e=>e.reload()),onAction:r,onRebuild:F}),(0,W.jsx)(so,{usage:_,read:h,pending:Ma(h)})]})]})]})}var uo=`geneseed-understand-seen`,fo=`understand`;function po(){try{let e=JSON.parse(localStorage.getItem(uo));return Array.isArray(e)?e:[]}catch{return[]}}var mo=`modulepreload`,ho=function(e){return`/`+e},go={},_o=function(e){return e.pathname.endsWith(`.css`)},vo=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=ho(t,n);let r=s(t),i=_o(r);return vo(go,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:mo,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},yo=`geneseed-newhere-dismissed`,bo=(0,B.lazy)(()=>$(()=>import(`./Dashboard-CRGCp2cV.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5,6])));function xo({harness:e}){let[t,n]=(0,B.useState)(()=>!!localStorage.getItem(yo)),{data:r}=H(()=>t?Promise.resolve(null):a.docs(e).catch(()=>null),[t,e]),{level:i}=q(),o=r?.groups?.find(e=>e.id===`understand`)?.pages||[],s=po(),c=o.findIndex(e=>!s.includes(e.id));if(t||!o.length||c<0)return null;let l=o.filter(e=>s.includes(e.id)).length;return(0,W.jsxs)(`section`,{className:`newhere`,"aria-label":`New here?`,children:[(0,W.jsxs)(`div`,{className:`newhere-body`,children:[(0,W.jsx)(`b`,{children:`New here? Understand your harness.`}),(0,W.jsxs)(`p`,{children:[o.length,` short pages: what a harness is, what was installed, what changes in your day, and what is guaranteed.`]}),i===`power`?null:(0,W.jsxs)(`p`,{className:`newhere-level`,children:[`Showing the `,K.find(e=>e.id===i)?.label,` view — more in Appearance.`]}),l?(0,W.jsx)(`div`,{className:`newhere-dots`,"aria-label":`${l} of ${o.length} read`,children:o.map(e=>(0,W.jsx)(`i`,{className:s.includes(e.id)?`f`:``},e.id))}):null]}),(0,W.jsx)(`a`,{className:`btn ghost`,href:`#/docs/${encodeURIComponent(o[c].id)}`,children:l?`Continue · step ${c+1}`:`Start`}),(0,W.jsx)(`button`,{type:`button`,className:`newhere-x`,onClick:()=>{localStorage.setItem(yo,`1`),n(!0)},title:`Dismiss for good`,"aria-label":`Dismiss`,children:`×`})]})}function So({layout:e,onLayout:t}){return(0,W.jsx)(Zn,{"aria-label":`View`,children:ht.map(n=>(0,W.jsx)(`button`,{type:`button`,className:e===n.id?`on`:``,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id))})}function Co({overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c=`overview`,onLayout:l,dataRev:u}){let{data:d,loading:f}=H(()=>Promise.resolve().then(()=>a.installs()).catch(()=>null),[u],`installs`);if(!e)return t?(0,W.jsx)(Vr,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,W.jsx)(J,{});if(!(d?d.installs?.some(e=>e.state===`active`):e.deployed))return f&&!d?(0,W.jsx)(J,{}):(0,W.jsx)(ei,{onAction:s});let p=(0,W.jsx)(xo,{harness:Fn(e.emit)}),m=l?(0,W.jsx)(So,{layout:c,onLayout:l}):null;return c===`overview`?(0,W.jsx)(lo,{overview:e,setup:i,runs:o,onAction:s,onRetry:n,dataRev:u,view:m,banner:(0,W.jsxs)(W.Fragment,{children:[e.daemon_stale?(0,W.jsx)(Hr,{}):null,p]})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(co,{count:d?d.installs.filter(e=>e.state!==`absent`).length:null,canFill:!1,onAction:s,view:m,dataRev:u}),p,(0,W.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,W.jsx)(`p`,{className:`sub`,children:[e.install&&Dn(e.install),e.theme&&`${e.theme} voice`,e.footprint&&`${e.footprint} footprint`,e.target,`counts cover every install`].filter(Boolean).join(` · `)}),(0,W.jsxs)(`div`,{className:`row gap-10`,children:[(0,W.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>s(`doctor`),children:`Run doctor`}),(0,W.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s(`build-all`),children:`Rebuild`})]})]}),(0,W.jsx)(B.Suspense,{fallback:(0,W.jsx)(J,{}),children:(0,W.jsx)(bo,{overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c,dataRev:u})})]})}var wo=(0,B.lazy)(()=>$(()=>import(`./Activity-IAxWF2wK.js`),__vite__mapDeps([7,1,2,3,8,9,5]))),To=(0,B.lazy)(()=>$(()=>import(`./ActivityDetail-CtC2DLvh.js`),__vite__mapDeps([10,1,2,3,9,8]))),Eo=(0,B.lazy)(()=>$(()=>import(`./Library-DdzyrwUK.js`),__vite__mapDeps([11,1,2,3,6,4,12,13,8,5]))),Do=(0,B.lazy)(()=>$(()=>import(`./Models-DAgkQ4CE.js`),__vite__mapDeps([14,1,2,3]))),Oo=(0,B.lazy)(()=>$(()=>import(`./Kits-DYQvykZ0.js`),__vite__mapDeps([15,1,2,3,8,16,17,18]))),ko=(0,B.lazy)(()=>$(()=>import(`./Loops-yHga7xdr.js`),__vite__mapDeps([19,1,2,3,8,20,21,17,16,12,13,5,6,4]))),Ao=(0,B.lazy)(()=>$(()=>import(`./Factories-DxHD2T-1.js`),__vite__mapDeps([22,1,2,3,8,20,17,21,12,13,6,4]))),jo=(0,B.lazy)(()=>$(()=>import(`./Laws-UVk0uojS.js`),__vite__mapDeps([23,1,2,3,6,4,8,13,16]))),Mo=(0,B.lazy)(()=>$(()=>import(`./Personal-DjhIfa9v.js`),__vite__mapDeps([24,1,2,3,25,6,4,8,16,11,12,13,5]))),No=(0,B.lazy)(()=>$(()=>import(`./Installs-B5hFSUeN.js`),__vite__mapDeps([26,1,2,25,6,4,3,8,18]))),Po=(0,B.lazy)(()=>$(()=>import(`./Settings-Brgec4M0.js`),__vite__mapDeps([27,1,2,3,5]))),Fo=(0,B.lazy)(()=>$(()=>import(`./Docs-DwOwzaD6.js`),__vite__mapDeps([28,1,2,3,8,12,13,6,4,20,16,5])));function Io(){let e=I(),[t,n]=(0,B.useState)(null),[r,i]=Ge(),[o,s]=Xe(),[c,l]=pt(),u=e=>{if(e===o)return;let t=()=>{s(e),l(`curated`)};if(!document.startViewTransition||!w())return t();document.startViewTransition(()=>(0,ge.flushSync)(t))},[d,f]=yt(),[p,m]=(0,B.useState)(()=>{try{return!window.sessionStorage.getItem(`gs-booted`)}catch{return!0}}),[h,g]=(0,B.useState)(!1),_=(0,B.useRef)(null),v=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!h)return;let e=e=>{e.key===`Escape`&&g(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[h]),(0,B.useEffect)(()=>{if(!h)return;let e=v.current,t=document.activeElement;return e&&(e.inert=!0),document.getElementById(`rail-nav`)?.focus(),()=>{e&&(e.inert=!1),t instanceof HTMLElement&&t.focus()}},[h]);let y=e=>n({kind:e?.body?.kind||`err`,msg:e?.body?.message||e.message}),[b,x]=(0,B.useState)(0),{overview:S,error:C,themes:ee,reload:T}=xt(y,()=>x(e=>e+1)),te=()=>{T(),x(e=>e+1)},[E,ne]=(0,B.useState)(null),{runs:D,activeId:O,consoleOpen:k,setConsoleOpen:A,runAction:j,cancelJob:M,clearRuns:N}=Ct({onFinish:e=>{te(),ne({status:e,at:Date.now()})},onError:y}),{data:P}=H(()=>a.setup().catch(()=>null),[b],`setup`),{data:F,loading:re}=H(()=>a.installs().catch(()=>null),[b],`installs`),ie=F?.installs||null,L=D[D.length-1],ae=L?L.status===`running`?`${L.action} running`:`${L.action} ${L.status}`:``;(0,B.useEffect)(()=>{let e=_.current;if(e){if(!Ue(e,lt(c),r)){let t=dt(c);t?Se(e,t,r):we(e,o,r)}document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,getComputedStyle(e).getPropertyValue(`--bg`).trim())}},[r,c,o]);let oe=[{title:`Rebuild all`,desc:`Re-emit every install`,run:()=>j(`build-all`),confirm:{msg:`Rebuild every install from the current sources?`,title:`Rebuild all?`,confirmLabel:`Rebuild all`}},{title:`Update`,desc:`Pull the latest Geneseed; the server restarts after`,run:()=>j(`update`),confirm:{msg:`Update Geneseed? The server restarts when the update ends.`,title:`Update Geneseed?`,confirmLabel:`Update`}},{title:`Run doctor`,desc:`Read-only health check`,run:()=>j(`doctor`)},{title:`Restart server`,desc:`Restart the local Geneseed server`,run:()=>rt().catch(y),confirm:{msg:`Restart the local Geneseed server? The console reconnects in a moment.`,title:`Restart the server?`,confirmLabel:`Restart`}},{title:r===`light`?`Switch to dark mode`:`Switch to light mode`,desc:`Appearance`,run:i},...qe.filter(e=>e.id!==o).map(e=>({title:`Skin: ${e.name}`,desc:e.tagline,run:()=>u(e.id)}))].map(e=>({kind:`Actions`,hay:`${e.title} ${e.desc}`.toLowerCase(),...e})),se={flavour:o,onFlavour:u,accentMode:c,onAccentMode:l};return(0,W.jsx)(`div`,{className:`app fl-${o} ${r===`light`?`light`:``}${h?` nav-open`:``}`,ref:_,children:(0,W.jsxs)(Hn,{children:[(0,W.jsx)(`div`,{className:`atmos`,"aria-hidden":`true`}),(0,W.jsx)(`a`,{className:`skip-link`,href:`#main`,onClick:e=>{e.preventDefault(),document.getElementById(`main`)?.focus()},children:`Skip to content`}),(0,W.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:ae}),h&&(0,W.jsx)(`button`,{type:`button`,className:`nav-scrim`,"aria-label":`Close navigation`,onClick:()=>g(!1)}),(0,W.jsx)(yn,{route:e,overview:S,installs:ie,onNavigate:()=>g(!1)}),(0,W.jsxs)(`div`,{className:`col`,ref:v,children:[(0,W.jsx)(tr,{route:e,navOpen:h,onToggleNav:()=>g(e=>!e),actions:oe,mode:r,onToggleMode:i,appearance:se,dataRev:b}),(0,W.jsx)(`main`,{className:`page`,id:`main`,tabIndex:-1,children:(0,W.jsxs)(`div`,{className:[`library`,`kits`,`loops`,`factories`,`docs`].includes(e.page)?`pad pad-wide`:`pad`,children:[(0,W.jsx)(rr,{unreadable:!re&&!F}),(0,W.jsxs)(Zr,{activeId:O,finish:E,children:[(0,W.jsx)(Kr,{route:e}),(0,W.jsx)(Gr,{children:(0,W.jsx)(B.Suspense,{fallback:(0,W.jsx)(J,{}),children:{overview:()=>(0,W.jsx)(Co,{overview:S,overviewError:C,onRetry:T,themes:ee,setup:P,runs:D,onAction:j,layout:d,onLayout:f,dataRev:b}),laws:()=>(0,W.jsx)(jo,{selected:e.item,overview:S,setup:P,onAction:j,dataRev:b}),library:()=>(0,W.jsx)(Eo,{overview:S,section:e.section,selected:e.item,dataRev:b,onCountsChanged:T}),models:()=>(0,W.jsx)(Do,{dataRev:b,onAction:j}),kits:()=>(0,W.jsx)(Oo,{item:e.item,onAction:j,dataRev:b}),loops:()=>(0,W.jsx)(ko,{tab:e.tab,item:e.item,dataRev:b}),factories:()=>(0,W.jsx)(Ao,{tab:e.tab,item:e.item,dataRev:b}),personal:()=>(0,W.jsx)(Mo,{tab:e.tab,item:e.item,setup:P,dataRev:b,onAction:j,onCountsChanged:T}),installs:()=>(0,W.jsx)(No,{tab:e.tab,item:e.item,overview:S,setup:P,themes:ee,onAction:j,onMutated:te,dataRev:b}),settings:()=>(0,W.jsx)(Po,{overview:S,onAction:j}),activity:()=>e.item?(0,W.jsx)(To,{sid:e.item},e.item):(0,W.jsx)(wo,{}),docs:()=>(0,W.jsx)(Fo,{page:e.item,onAction:j,overview:S})}[e.page]?.()})},e.page)]})]})}),(0,W.jsx)(xn,{route:e,navOpen:h,onMore:()=>g(!0)}),(0,W.jsx)(jr,{runs:D,open:k,busy:!!O,finish:E,onToggle:()=>A(e=>!e),onClear:N,onCancel:M})]}),(0,W.jsx)(ar,{toast:t,onClose:()=>n(null)}),p&&(0,W.jsx)(Br,{ready:!!S||!!C,onDone:()=>{try{window.sessionStorage.setItem(`gs-booted`,`1`)}catch{}m(!1)}})]})})}(0,_e.createRoot)(document.getElementById(`root`)).render((0,W.jsx)(Zt,{children:(0,W.jsx)(Io,{})})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).catch(()=>{})});export{Hr as $,zi as A,H as At,pi as B,Gi as C,G as Ct,Di as D,Nt as Dt,Vi as E,Pt as Et,Hi as F,ii as G,ui as H,gi as I,oi as J,ai as K,bi as L,ji as M,he as Mt,Li as N,fe as Nt,Ci as O,jt as Ot,Fi as P,le as Pt,Qr as Q,_i as R,qi as S,q as St,Ai as T,Ft as Tt,li as U,di as V,ci as W,ei as X,ni as Y,Jr as Z,Qi as _,wn as _t,ga as a,Xn as at,Wi as b,$t as bt,na as c,Fn as ct,ea as d,On as dt,Vr as et,oa as f,kn as ft,Zi as g,jn as gt,ca as h,Dn as ht,po as i,Zn as it,ki as j,rt as jt,wi as k,Rt as kt,ia as l,Pn as lt,ta as m,En as mt,uo as n,nr as nt,Ta as o,Vn as ot,sa as p,Cn as pt,si as q,fo as r,$n as rt,ra as s,Nn as st,$ as t,J as tt,aa as u,Sn as ut,Ji as v,an as vt,xi as w,It as wt,Ki as x,en as xt,Ui as y,nn as yt,mi as z};