geneseed 5.0.3 → 5.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +3 -3
  3. package/SHIPPED.md +2 -2
  4. package/adapters/claude-code/README.md +5 -1
  5. package/adapters/openclaude/README.md +3 -1
  6. package/adapters/opencode/plugins/geneseed-workflow.js +1 -1
  7. package/adapters/opencode/workflows/_runtime.js +1 -1
  8. package/bin/geneseed-cli.mjs +3 -0
  9. package/bin/geneseed-hook.mjs +10 -2
  10. package/docs/PRD.md +1 -1
  11. package/docs/README.md +4 -1
  12. package/docs/concepts/enforcement-table.md +1 -1
  13. package/docs/concepts/exclusions.md +1 -1
  14. package/docs/concepts/factories.md +203 -0
  15. package/docs/concepts/hooks.md +1 -1
  16. package/docs/concepts/host-matrix.md +1 -0
  17. package/docs/concepts/loop-gates.md +6 -0
  18. package/docs/concepts/loops.md +1 -0
  19. package/docs/concepts/rules.md +1 -1
  20. package/docs/concepts/shared-tier.md +14 -0
  21. package/docs/extending.md +5 -1
  22. package/docs/guides/autostart.md +2 -0
  23. package/docs/guides/migrate.md +1 -1
  24. package/docs/guides/run-a-factory.md +116 -0
  25. package/docs/guides/set-up-ownership.md +1 -0
  26. package/docs/guides/upgrade-to-5.md +2 -2
  27. package/docs/reference/factory-actions.md +22 -0
  28. package/docs/reference/loop-actions.md +1 -1
  29. package/docs/reference/plugin-activity.md +1 -1
  30. package/docs/web-ui.md +47 -2
  31. package/harness.config.json +1 -1
  32. package/js/README.md +21 -2
  33. package/js/build/args.mjs +44 -12
  34. package/js/build/emit-claude.mjs +3 -0
  35. package/js/build/emit-opencode.mjs +4 -0
  36. package/js/build/retired-skills.mjs +158 -0
  37. package/js/build/source.mjs +41 -2
  38. package/js/cli-table.json +193 -3
  39. package/js/factory/cli.mjs +194 -0
  40. package/js/factory/graph.mjs +309 -0
  41. package/js/factory/registry.mjs +71 -0
  42. package/js/factory/state.mjs +511 -0
  43. package/js/hosts/activity.mjs +3 -3
  44. package/js/hosts/done-checks.mjs +3 -2
  45. package/js/hosts/geneseed-dir.mjs +1 -1
  46. package/js/hosts/gitref.mjs +21 -0
  47. package/js/hosts/hooks-context.mjs +63 -9
  48. package/js/hosts/hooks-prims.mjs +1 -1
  49. package/js/hosts/memory-files.mjs +4 -2
  50. package/js/hosts/settings.mjs +5 -4
  51. package/js/inspect/checks-authoring.mjs +11 -1
  52. package/js/inspect/cost.mjs +91 -5
  53. package/js/inspect/doctor.mjs +2 -1
  54. package/js/inspect/inventory.mjs +1 -1
  55. package/js/loop/catalog.mjs +30 -12
  56. package/js/loop/cli.mjs +27 -15
  57. package/js/loop/graph.mjs +13 -4
  58. package/js/loop/registry.mjs +65 -28
  59. package/js/loop/state.mjs +18 -8
  60. package/js/maintain/migrate.mjs +39 -25
  61. package/js/web/api.mjs +43 -1
  62. package/js/web/catalog.mjs +38 -2
  63. package/js/web/daemon.mjs +191 -6
  64. package/js/web/handler.mjs +27 -5
  65. package/js/web/routes.mjs +10 -3
  66. package/js/web/server.mjs +4 -1
  67. package/package.json +1 -1
  68. package/registry.json +14 -0
  69. package/src/AGENT.md.tmpl +5 -7
  70. package/src/bricks/checks.md +62 -0
  71. package/src/bricks/docs-update.md +5 -0
  72. package/src/bricks/holdout-write.md +23 -0
  73. package/src/bricks/holdout.md +25 -0
  74. package/src/bricks/intake.md +27 -0
  75. package/src/bricks/merge-gate.md +31 -0
  76. package/src/bricks/pr-open.md +21 -0
  77. package/src/bricks/retro.md +22 -0
  78. package/src/bricks/review-panel.md +43 -0
  79. package/src/bricks/spec.md +20 -6
  80. package/src/bricks/test.md +4 -1
  81. package/src/bricks/triage.md +19 -0
  82. package/src/doctrines/comms.md +29 -41
  83. package/src/doctrines/craft.md +3 -10
  84. package/src/doctrines/ops.md +4 -15
  85. package/src/doctrines/rigor.md +1 -5
  86. package/src/factories/analysis-to-build.json +52 -0
  87. package/src/factories/bug-report-to-fix.json +50 -0
  88. package/src/factories/issue-to-pr.json +67 -0
  89. package/src/skills/_checkpoints.md +1 -0
  90. package/src/skills/adhd.md +1 -1
  91. package/src/skills/factory-forge.md +115 -0
  92. package/src/skills/factory.md +196 -0
  93. package/src/skills/loop.md +3 -2
  94. package/src/skills/parallel-agents.md +1 -1
  95. package/src/skills/workflow.md +2 -1
  96. package/themes/_TEMPLATE.json +4 -2
  97. package/themes/biker.json +4 -2
  98. package/themes/commentator.json +4 -2
  99. package/themes/cyberpunk.json +4 -2
  100. package/themes/gamer.json +4 -2
  101. package/themes/imperial.json +4 -2
  102. package/themes/joker.json +4 -2
  103. package/themes/marvin.json +4 -2
  104. package/themes/mean.json +4 -2
  105. package/themes/military.json +4 -2
  106. package/themes/neutral.json +4 -2
  107. package/themes/pirate.json +4 -2
  108. package/themes/sports.json +4 -2
  109. package/themes/verstappen.json +4 -2
  110. package/themes/wizard.json +4 -2
  111. package/web/dist/assets/ActiveLoops-BTHIaRhn.js +1 -0
  112. package/web/dist/assets/{Activity-Ck_Xffpo.js → Activity-CpkBwpu7.js} +1 -1
  113. package/web/dist/assets/{ActivityDetail-CBxVS4mU.js → ActivityDetail-DTPziZWM.js} +1 -1
  114. package/web/dist/assets/{Bonsai-BlOwsvW6.js → Bonsai-hiG_gGNU.js} +1 -1
  115. package/web/dist/assets/{CopyButton-DFMOIGbe.js → CopyButton-DUIUfNp6.js} +1 -1
  116. package/web/dist/assets/Dashboard-Dnw6EyX7.js +2 -0
  117. package/web/dist/assets/{Docs-D_2Jt6gU.js → Docs-BEET_l16.js} +2 -2
  118. package/web/dist/assets/Factories-D6KXkfWw.js +1 -0
  119. package/web/dist/assets/{GreenhouseView-WalcX5bp.js → GreenhouseView-BKxy5apE.js} +1 -1
  120. package/web/dist/assets/{Installs-UGiPDMDt.js → Installs-CnFVlVD0.js} +3 -3
  121. package/web/dist/assets/{JournalView-CZtXQz-v.js → JournalView-ChFitHjo.js} +1 -1
  122. package/web/dist/assets/{Kits-XQHsazCN.js → Kits-CcR-OlwQ.js} +1 -1
  123. package/web/dist/assets/Laws-B1s5idOg.js +4 -0
  124. package/web/dist/assets/LibRows-BZgdbI1l.js +1 -0
  125. package/web/dist/assets/Library-x6TkkEVF.js +3 -0
  126. package/web/dist/assets/Loops-BH93KKxn.js +2 -0
  127. package/web/dist/assets/{OperatorHudView-CeDw5qMB.js → OperatorHudView-BO0aIKPL.js} +1 -1
  128. package/web/dist/assets/{Personal-PVmGA2-M.js → Personal-CE_0Vhh0.js} +2 -2
  129. package/web/dist/assets/{Settings-DWuxwh4i.js → Settings-CbpZvVN_.js} +1 -1
  130. package/web/dist/assets/{Tabs-d2RIRAKT.js → Tabs-C2oW7oEj.js} +1 -1
  131. package/web/dist/assets/api-DLDVY3K-.js +1 -0
  132. package/web/dist/assets/{index-BNttaGQb.js → index-BQwOmbor.js} +3 -3
  133. package/web/dist/assets/index-CuIop_pO.css +1 -0
  134. package/web/dist/index.html +3 -3
  135. package/web/dist/assets/Dashboard-BUdUTjbB.js +0 -2
  136. package/web/dist/assets/Laws-B6A55S-2.js +0 -4
  137. package/web/dist/assets/Library-D7L0Wdbh.js +0 -3
  138. package/web/dist/assets/Loops-C0loS73u.js +0 -2
  139. package/web/dist/assets/RailCats-BGZnJ6fa.js +0 -1
  140. package/web/dist/assets/api-BMFDSXoB.js +0 -1
  141. package/web/dist/assets/index-BEI5ugYQ.css +0 -1
@@ -1,5 +1,5 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-BMFDSXoB.js";import{i as a}from"./motion-RlUl1osO.js";import{G as o,Tt as s,a as c,c as l,ct as u,i as ee,it as d,kt as f,lt as p,n as te,o as m,ot as h,r as g,rt as _,s as ne,ut as re,yt as v}from"./index-BNttaGQb.js";import{a as y,i as b,r as x}from"./Markdown-0ORz7tAc.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{a as C,n as ie,o as w,r as ae,t as oe}from"./RailCats-BGZnJ6fa.js";import{t as T}from"./CopyButton-DFMOIGbe.js";var E=e(t(),1),D=n();function O(e,t=0){let n=String(e).toLowerCase().trim().replace(/[^a-z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``);return n&&/^[a-z]/.test(n)?n:`h-${t}-${n||`section`}`}function k(e){let t=[],n=[],r=`before`;for(let i of(e||``).split(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-DLDVY3K-.js";import{i as a}from"./motion-RlUl1osO.js";import{At as o,Et as s,G as c,a as l,bt as u,c as d,dt as f,i as ee,it as p,lt as te,n as ne,o as m,ot as h,r as g,rt as _,s as v,ut as re}from"./index-BQwOmbor.js";import{a as y,i as b,r as x}from"./Markdown-0ORz7tAc.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{a as ie,i as C,n as w,o as ae,s as oe}from"./LibRows-BZgdbI1l.js";import{t as T}from"./CopyButton-DUIUfNp6.js";var E=e(t(),1),D=n();function O(e,t=0){let n=String(e).toLowerCase().trim().replace(/[^a-z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``);return n&&/^[a-z]/.test(n)?n:`h-${t}-${n||`section`}`}function k(e){let t=[],n=[],r=`before`;for(let i of(e||``).split(`
2
2
  `))r===`before`&&/^\|\s*piece\s*\|/i.test(i)?r=`map`:r===`map`&&!i.trimStart().startsWith(`|`)&&(r=`after`),r===`before`?t.push(i):r===`after`&&n.push(i);return[t.join(`
3
3
  `),n.join(`
4
4
  `)]}function A(e){let t=[...e.querySelectorAll(`h2, h3, h4, h5, h6`)],n=e=>Number(e.tagName[1]),r=t.length?Math.min(...t.map(n))-2:0;if(!(r<=0))for(let e of t){let t=document.createElement(`h${n(e)-r}`);for(let n of e.attributes)t.setAttribute(n.name,n.value);t.append(...e.childNodes),e.replaceWith(t)}}function j(e,t){let n=document.createElement(`template`);return n.innerHTML=e,A(n.content),n.content.querySelectorAll(`h1, h2, h3`).forEach(e=>{e.tagName!==`H1`&&(t.idx+=1);let n=e.id||O(e.textContent||``,t.idx),r=n;for(let e=2;t.ids.has(r);e++)r=`${n}-${e}`;t.ids.add(r),e.id=r,e.tagName!==`H1`&&t.toc.push({level:Number(e.tagName[1]),title:(e.textContent||``).trim(),id:r})}),n.content.querySelectorAll(`table`).forEach(e=>{let t=document.createElement(`div`);t.className=`table-scroll`,t.setAttribute(`tabindex`,`0`),t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,`Table`),e.replaceWith(t),t.appendChild(e)}),n.innerHTML}function M(e){let t={ids:new Set,idx:0,toc:[]},n=n=>j(x(n,e?.links),t);if(e?.rows){let[r,i]=k(e.body);return{before:n(r),after:n(i),toc:t.toc}}return{html:n(e?.body),toc:t.toc}}var N=r(),P={"opencode-global":[`install-opencode`,`Global (recommended)`],opencode:[`install-opencode`,`Per repo`],"claude-global":[`install-claude-code`],claude:[`install-claude-code`],"openclaude-global":[`install-openclaude`],openclaude:[`install-openclaude`],"bob-global":[`install-bob`],bob:[`install-bob`],files:[`install-agent-md`]},F=`you already know this`,I=e=>Math.max(1,Math.ceil((e||``).split(/\s+/).filter(Boolean).length/200));function L(e){return e.querySelectorAll(`pre`).forEach(e=>{if(e.parentElement?.classList.contains(`docs-code`))return;let t=document.createElement(`figure`);t.className=`docs-code`;let n=document.createElement(`figcaption`),r=e.querySelector(`code`)?.className.match(/(?:^|\s)language-(\S+)/)?.[1];if(r){let e=document.createElement(`span`);e.className=`mono`,e.textContent=r,n.append(e)}e.replaceWith(t),t.append(n,e)}),[...e.querySelectorAll(`figure.docs-code > figcaption`)]}var R=e=>(e.parentElement?.querySelector(`pre`)?.textContent||``).replace(/\n+$/,``),z=40,B=e=>{let t=e.split(`
5
- `)[0].trim();return t?`Copy `+(t.length>z?t.slice(0,39)+`…`:t):`Copy code`};function V({page:e,overview:t,onAction:n,section:r,description:i}){let a=(0,E.useRef)(null),[s,c]=(0,E.useState)([]),l=(0,E.useMemo)(()=>M({body:e.body,links:e.links}).html,[e.body,e.links]);(0,E.useEffect)(()=>{let e=a.current;e&&(e.querySelectorAll(`blockquote`).forEach(e=>{(e.querySelector(`strong`)?.textContent||``).toLowerCase().startsWith(F)&&e.classList.add(`analogy`)}),c(L(e)))},[l]),(0,E.useEffect)(()=>{let e=a.current;if(!e)return;let t=e=>{let t=e.target.closest(`a[href]`);if(!t)return;let n=t.getAttribute(`href`);n&&n.startsWith(`#/`)&&(e.preventDefault(),f(n))};return e.addEventListener(`click`,t),()=>e.removeEventListener(`click`,t)},[l]),(0,E.useEffect)(()=>{let n=a.current;if(!n)return;n.querySelectorAll(`.docs-here`).forEach(e=>e.classList.remove(`docs-here`));let[r,i]=P[t?.emit]||[];if(!r)return;let o=null;e.id===`install`?o=n.querySelector(`a[href="#/docs/${r}"]`)?.closest(`li`):e.id===r&&i&&(o=[...n.querySelectorAll(`h2`)].find(e=>O(e.textContent||``)===O(i))),o?.classList.add(`docs-here`)},[l,e.id,t?.emit]);let u=[];return e.id===`install`&&(u.push({label:`Run doctor`,action:`doctor`}),u.push({label:`Rebuild`,action:`build`})),e.id===`verify`&&u.push({label:`Run doctor`,action:`doctor`}),e.id===`upgrade`&&u.push({label:`Update`,action:`update`}),(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(o,{eyebrow:r&&`${r} · ${I(e.body)} min read`,title:e.title,sub:i,actions:u.length>0&&u.map(e=>e.hash?(0,N.jsx)(`a`,{className:`btn ghost sm`,href:e.hash,children:e.label},e.label):(0,N.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>n&&n(e.action),children:e.label},e.label))}),e.source&&(0,N.jsx)(`div`,{className:`doc-meta`,children:(0,N.jsxs)(`span`,{className:`badge`,children:[(0,N.jsx)(`span`,{className:`dot`}),e.source]})}),(0,N.jsx)(`div`,{className:`markdown`,ref:a,dangerouslySetInnerHTML:{__html:l}}),s.map((e,t)=>{let n=R(e);return(0,D.createPortal)((0,N.jsx)(T,{text:n,label:B(n)}),e,t)}),e.link&&(0,N.jsx)(`div`,{className:`doc-link`,children:(0,N.jsx)(`a`,{className:`btn soft sm`,href:e.link.hash,children:e.link.label})})]})}var H=e=>`cmd-`+String(e).replace(/[^\w-]+/g,`-`);function U({a:e,kind:t}){let n=t===`positional`?e.dest:e.names.join(`, `),r=[];return e.metavar&&r.push(e.metavar),e.choices&&r.push(`{${e.choices.join(`|`)}}`),e.default!==null&&e.default!==void 0&&e.default!==``&&!e.is_flag&&r.push(`default: ${e.default}`),e.required&&r.push(`required`),(0,N.jsxs)(`div`,{className:`cli-arg`,children:[(0,N.jsx)(`code`,{className:`cli-arg-name`,children:n}),r.length>0&&(0,N.jsxs)(`code`,{className:`cli-arg-meta`,children:[` `,r.join(` · `)]}),e.help&&(0,N.jsx)(`div`,{className:`cli-arg-help`,children:e.help})]})}function W({cmd:e,prog:t}){let n=[t,e.name];for(let t of e.positionals||[]){let e=(t.metavar||t.dest||``).toUpperCase();n.push(t.required?e:`[${e}]`)}(e.options||[]).length&&n.push(`[OPTIONS]`);let r=n.join(` `);return(0,N.jsxs)(`div`,{className:`card pad-md mb-12 cli-card`,children:[(0,N.jsxs)(`div`,{className:`row wrap between cli-head`,children:[(0,N.jsxs)(`div`,{className:`stack gap-4`,children:[(0,N.jsx)(`h2`,{id:H(e.name),children:(0,N.jsx)(`code`,{children:e.name})}),e.help&&(0,N.jsx)(`p`,{className:`sub`,children:e.help})]}),(0,N.jsx)(T,{text:`${t} ${e.name}`,label:`Copy ${t} ${e.name}`,title:`Copy ${t} ${e.name}`})]}),(0,N.jsx)(`pre`,{className:`cli-syn`,children:r}),(e.positionals||[]).length>0&&(0,N.jsxs)(`div`,{className:`cli-block`,children:[(0,N.jsx)(`div`,{className:`cli-block-head`,children:`Arguments`}),e.positionals.map(e=>(0,N.jsx)(U,{a:e,kind:`positional`},e.dest))]}),(e.options||[]).length>0&&(0,N.jsxs)(`div`,{className:`cli-block`,children:[(0,N.jsx)(`div`,{className:`cli-block-head`,children:`Options`}),e.options.map(e=>(0,N.jsx)(U,{a:e,kind:`option`},e.names.join(`,`)))]})]})}function G({page:e}){let t=e.prog||`geneseed`,n=e.commands||[];return(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(o,{title:e.title,sub:(0,N.jsxs)(N.Fragment,{children:[`Every subcommand of `,(0,N.jsx)(`code`,{children:t}),`. Generated from the parser at request time (the same one `,(0,N.jsx)(`code`,{children:`geneseed`}),` actually parses), so this page cannot fall behind.`]})}),(0,N.jsx)(`div`,{children:n.map(e=>(0,N.jsx)(W,{cmd:e,prog:t},e.name))})]})}function K({page:e}){let t=e.rows||[],n=e.theme||`neutral`;return(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(o,{title:e.title,sub:(0,N.jsxs)(N.Fragment,{children:[`Geneseed's invented vocabulary, decoded. Left: the neutral, plain-English term. Right: the word the `,(0,N.jsx)(`code`,{className:`cap`,children:n}),` voice actually uses. Last: the developer idea it maps to.`]})}),(0,N.jsx)(`div`,{className:`card pad-md`,children:(0,N.jsxs)(`table`,{className:`glossary-table`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`th`,{children:`Concept`}),(0,N.jsx)(`th`,{children:`Neutral term`}),(0,N.jsxs)(`th`,{children:[`In `,n]}),(0,N.jsx)(`th`,{children:`Meaning`}),(0,N.jsx)(`th`,{children:`In dev terms`})]})}),(0,N.jsx)(`tbody`,{children:t.map(e=>(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`td`,{children:(0,N.jsx)(`strong`,{children:e.label})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`code`,{children:e.neutral||`—`})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`code`,{children:e.themed||e.neutral||`—`})}),(0,N.jsx)(`td`,{className:`dim`,children:e.desc}),(0,N.jsx)(`td`,{className:`dim`,children:e.analogy||`—`})]},e.label))})]})})]})}var q={enforced:`ok`,automatic:`ok`,asked:`warn`,"on demand":`warn`},J=({text:e})=>(0,N.jsx)(`span`,{dangerouslySetInnerHTML:{__html:b(y.parseInline(e||``))}}),Y=({kind:e})=>(0,N.jsx)(`span`,{className:`tag ${q[e]||``}`,children:e});function se({page:e,overview:t,onAction:n,section:r,description:i}){let[a,s]=(0,E.useState)(0),{before:c,after:l}=(0,E.useMemo)(()=>M(e),[e]);if(!e.rows)return(0,N.jsx)(V,{page:e,overview:t,onAction:n,section:r,description:i});let u=e.rows[a]||e.rows[0];return(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(o,{eyebrow:r&&`${r} · ${I(e.body)} min read`,title:e.title,sub:i}),(0,N.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:c}}),(0,N.jsxs)(`div`,{className:`docs-map`,children:[(0,N.jsx)(`ul`,{className:`map-tree`,"aria-label":`Pieces`,children:e.rows.map((e,t)=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`button`,{className:`map-node ${t===a?`on`:``}`,"aria-pressed":t===a,onClick:()=>s(t),children:[(0,N.jsx)(`span`,{className:`map-piece`,children:(0,N.jsx)(J,{text:e.piece})}),(0,N.jsx)(Y,{kind:e.kind}),(0,N.jsx)(`span`,{className:`mono dim map-cost`,children:(0,N.jsx)(J,{text:e.cost})})]})},t))}),u&&(0,N.jsxs)(`div`,{className:`card pad-md map-detail`,"aria-live":`polite`,children:[(0,N.jsx)(`h2`,{children:(0,N.jsx)(J,{text:u.piece})}),(0,N.jsx)(Y,{kind:u.kind}),(0,N.jsxs)(`dl`,{children:[(0,N.jsx)(`dt`,{children:`Does`}),(0,N.jsx)(`dd`,{children:(0,N.jsx)(J,{text:u.does})}),(0,N.jsx)(`dt`,{children:`Costs`}),(0,N.jsx)(`dd`,{children:(0,N.jsx)(J,{text:u.cost})}),(0,N.jsx)(`dt`,{children:`Turn it off`}),(0,N.jsx)(`dd`,{children:(0,N.jsx)(J,{text:u.off})})]})]})]}),l.trim()&&(0,N.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:l}})]})}function ce(){let e=document.getElementById(`main`);return e&&e.scrollHeight>e.clientHeight?e:document.scrollingElement||document.documentElement}function le(e){return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,e,{capture:!0})}var X=e=>(0,E.useSyncExternalStore)(le,e,()=>null),ue=5,de=96,fe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function pe(e,t){let n=e||``,r=[];for(let e of t||[])if([...new Set([e.themed,e.neutral,e.label].filter(Boolean))].some(e=>RegExp(`(?<![\\w-])${fe(e)}s?(?![\\w-])`,`i`).test(n))&&r.push(e),r.length===ue)break;return r}var me=e=>{let t=document.getElementById(e);t&&(t.setAttribute(`tabindex`,`-1`),t.scrollIntoView({behavior:a()?`smooth`:`auto`}),t.focus({preventScroll:!0}))};function he({page:e,glossaryRows:t}){let n=e?.body,r=(0,E.useMemo)(()=>e?.kind===`cli`?(e.commands||[]).map(e=>({id:H(e.name),title:e.name,level:2})):M(e).toc,[e]),i=(0,E.useMemo)(()=>pe(n,t),[n,t]),a=X(()=>{let e=null;for(let t of r){let n=document.getElementById(t.id)?.getBoundingClientRect().top;n!=null&&n<=de&&(e=t.id)}return e});return!r.length&&!i.length?null:(0,N.jsxs)(`aside`,{className:`docs-margin`,children:[r.length>0&&(0,N.jsxs)(`nav`,{className:`docs-toc`,"aria-label":`On this page`,children:[(0,N.jsx)(`div`,{className:`docs-toc-head`,children:`On this page`}),(0,N.jsx)(`ul`,{children:r.map(e=>(0,N.jsx)(`li`,{className:`lvl-${e.level}`,children:(0,N.jsx)(`a`,{href:`#${e.id}`,"aria-current":a===e.id?`location`:void 0,onClick:t=>{t.preventDefault(),me(e.id)},children:e.title})},e.id))})]}),i.length>0&&(0,N.jsxs)(`div`,{className:`docs-gloss`,children:[(0,N.jsx)(`div`,{className:`docs-toc-head`,children:`Terms on this page`}),i.map(e=>(0,N.jsxs)(`div`,{className:`docs-gloss-card`,children:[(0,N.jsx)(`b`,{children:e.themed||e.neutral||e.label}),(0,N.jsx)(`p`,{children:e.desc})]},e.label))]})]})}function ge({page:e,overview:t}){let n=e.version||{},r=[...t?[[`Version`,t.version]]:[],[`Voice`,e.theme],[`Install mode`,e.emit],[`Deployed`,e.deployed?`yes`:`no`],[`Target`,(0,N.jsx)(`code`,{children:e.target},`t`)],[`Source root`,(0,N.jsx)(`code`,{children:e.root},`r`)],[`Installed build`,(0,N.jsx)(`code`,{children:n.installed_fp||`(none)`},`i`)],[`Source build`,(0,N.jsx)(`code`,{children:n.source_fp||`—`},`s`)],[`Match?`,n.verdict?(0,N.jsx)(`span`,{dangerouslySetInnerHTML:{__html:b(y.parseInline(n.verdict))}},`m`):`—`],[`License`,e.license]];return(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(o,{title:e.title,sub:`Live snapshot of the install behind this UI, plus where to go next.`}),(0,N.jsx)(`div`,{className:`card pad-md mb-18`,children:r.map(([e,t])=>(0,N.jsxs)(`div`,{className:`kv`,children:[(0,N.jsx)(`span`,{className:`k`,children:e}),(0,N.jsx)(`span`,{className:`v`,children:t??`—`})]},e))}),(0,N.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,N.jsxs)(`a`,{className:`btn ghost`,href:e.repo,target:`_blank`,rel:`noreferrer`,children:[(0,N.jsx)(v,{name:`external`}),e.repo_is_github?`GitHub repo`:`Source repo`]}),e.repo_is_github&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`a`,{className:`btn ghost`,href:`${e.repo}/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,N.jsx)(v,{name:`external`}),`File an issue`]}),(0,N.jsxs)(`a`,{className:`btn ghost`,href:`${e.repo}/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,N.jsx)(v,{name:`external`}),`License`]})]})]})]})}function Z(e){return e?.groups?.[0]?.pages?.[0]?.id||``}function _e({data:e,error:t,overview:n,onAction:r,place:i}){if(t)return(0,N.jsx)(_,{error:t,style:{margin:18}});if(!e)return(0,N.jsx)(d,{label:`Loading page…`});switch(e.kind){case`markdown`:case`concept`:return(0,N.jsx)(V,{page:e,overview:n,onAction:r,section:i.section,description:i.page?.description});case`map`:return(0,N.jsx)(se,{page:e,overview:n,onAction:r,section:i.section,description:i.page?.description});case`cli`:return(0,N.jsx)(G,{page:e});case`glossary`:return(0,N.jsx)(K,{page:e});case`about`:return(0,N.jsx)(ge,{page:e,overview:n});default:return(0,N.jsx)(S,{title:`Unknown page kind`,children:e.kind})}}function ve(){let e=ce(),t=e.scrollHeight-e.clientHeight;return t>0?Math.min(100,Math.max(0,e.scrollTop/t*100)):0}function ye(){let e=X(ve);return(0,N.jsx)(`div`,{className:`docs-progress`,"aria-hidden":`true`,children:(0,N.jsx)(`i`,{style:{width:`${e}%`}})})}function Q(e){return(e?.pages||[]).map(e=>({name:e.id,title:e.title,desc:e.description||``,group:e.section||`General`,groupC:`var(--accent)`}))}var $=`(max-width: 720px)`;function be(){return(0,E.useSyncExternalStore)(e=>{let t=window.matchMedia?.($);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},()=>!!window.matchMedia?.($).matches)}function xe({page:e,overview:t,onAction:n}){let r=be(),[a,o]=re(p(t?.emit)),{data:f,error:v}=s(()=>i.docs(`all`),[]),y=e||Z(f),b=ne(f,y),x=b.page?.hosts,S=!x?.length||x.includes(a)?a:x[0],T=u.filter(e=>!x||x.includes(e.id)),{data:D,error:O,loading:k}=s(()=>y&&(f||v)?i.docsPage(y,S):Promise.resolve(null),[y,S,!!(f||v)]),{data:A}=s(()=>i.docsPage(`glossary`,S).catch(()=>null),[S],`docs:glossary`);(0,E.useEffect)(()=>{if(f&&y&&!f.groups.some(e=>e.pages.some(e=>e.id===y))){let e=Z(f);e&&e!==y&&window.location.replace(c(e))}},[f,y]),(0,E.useEffect)(()=>{let e=document.scrollingElement||document.documentElement;for(let t of[document.getElementById(`main`),e])t&&(t.scrollTop=0)},[y]);let j=b.part||f?.groups?.[0]||null,M=j?.id===g;(0,E.useEffect)(()=>{M&&D?.id===y&&m(y)},[M,D,y]);let P=M?[...l(),y]:[],[F,I]=(0,E.useState)(``),[L,R]=(0,E.useState)(`all`),[z,B]=(0,E.useState)(j?.id);j?.id!==z&&(B(j?.id),I(``),R(`all`));let V=Q(j),H=ie(V),U=L===`all`?V:V.filter(e=>e.group===L),W=w(U,F);if(v)return(0,N.jsx)(_,{error:v});let G=(0,N.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Docs parts`,children:[(0,N.jsxs)(`div`,{className:`lib-title`,children:[(0,N.jsx)(`p`,{className:`h`,children:`Docs`}),(0,N.jsx)(`span`,{className:`dim`,children:`How it works, and how to use it`})]}),b.page?.varies&&T.length>1?(0,N.jsx)(h,{"aria-label":`Host`,children:T.map(e=>(0,N.jsx)(`button`,{className:S===e.id?`on`:``,onClick:()=>o(e.id),"aria-pressed":S===e.id,children:e.label},e.id))}):null,(0,N.jsx)(`nav`,{className:`kind-list`,"aria-label":`Parts`,children:(f?.groups||[]).map(e=>(0,N.jsxs)(E.Fragment,{children:[(0,N.jsxs)(`a`,{href:e.pages[0]?c(e.pages[0].id):`#/docs`,className:j?.id===e.id?`on`:``,"aria-current":j?.id===e.id?`page`:void 0,children:[e.label,(0,N.jsx)(`span`,{className:`mono dim`,children:e.pages.length})]}),j?.id===e.id&&(0,N.jsx)(oe,{label:`Sections`,total:V.length,cats:H,cat:L,onChange:R})]},e.id))})]},`kinds`),K=(0,N.jsx)(C,{label:j?.label||`Docs`,count:F.trim()?`${W.length} of ${U.length}`:U.length||``,extra:M&&(0,N.jsx)(ee,{pages:j.pages,seen:P}),q:F,onQ:I,matched:W.length,inView:[j?.id,y],children:f?(0,N.jsx)(ae,{rows:W,activeName:y,hrefOf:e=>c(e.name),pills:M?e=>P.includes(e.name)&&e.name!==y?(0,N.jsx)(`span`,{className:`docs-read-mark`,role:`img`,"aria-label":`, read`,children:`✓`}):null:void 0}):(0,N.jsx)(d,{label:`Loading docs…`})},`list`),q=!k&&(0,N.jsx)(he,{page:D,glossaryRows:A?.rows}),J=(0,N.jsxs)(`article`,{className:`lib-reader docs-reader`,"aria-label":b.page?.title||`Page`,children:[(0,N.jsx)(ye,{}),b.page&&(0,N.jsxs)(`nav`,{className:`docs-crumbs mono`,"aria-label":`Breadcrumb`,children:[(0,N.jsx)(`a`,{href:c(b.part.pages[0].id),children:b.part.label}),(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),(0,N.jsx)(`a`,{href:c(b.part.pages.find(e=>(e.section||`General`)===b.section).id),children:b.section}),(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),(0,N.jsx)(`span`,{"aria-current":`page`,children:b.page.title})]}),(0,N.jsxs)(`div`,{className:`docs-read`,children:[r?q:null,(0,N.jsxs)(`div`,{className:`docs-article`,children:[(0,N.jsx)(_e,{data:k?null:D,error:O,overview:t,onAction:n,place:b},`${y}|${S}`),!k&&(0,N.jsx)(te,{menu:f,pageId:y})]}),r?null:q]})]},`reader`);return(0,N.jsx)(`div`,{className:`docs-wrap`,children:(0,N.jsx)(`div`,{className:`library docs-lib`,children:r?[J,G,K]:[G,K,J]})})}export{xe as default,Q as docRows};
5
+ `)[0].trim();return t?`Copy `+(t.length>z?t.slice(0,39)+`…`:t):`Copy code`};function V({page:e,overview:t,onAction:n,section:r,description:i}){let a=(0,E.useRef)(null),[s,l]=(0,E.useState)([]),u=(0,E.useMemo)(()=>M({body:e.body,links:e.links}).html,[e.body,e.links]);(0,E.useEffect)(()=>{let e=a.current;e&&(e.querySelectorAll(`blockquote`).forEach(e=>{(e.querySelector(`strong`)?.textContent||``).toLowerCase().startsWith(F)&&e.classList.add(`analogy`)}),l(L(e)))},[u]),(0,E.useEffect)(()=>{let e=a.current;if(!e)return;let t=e=>{let t=e.target.closest(`a[href]`);if(!t)return;let n=t.getAttribute(`href`);n&&n.startsWith(`#/`)&&(e.preventDefault(),o(n))};return e.addEventListener(`click`,t),()=>e.removeEventListener(`click`,t)},[u]),(0,E.useEffect)(()=>{let n=a.current;if(!n)return;n.querySelectorAll(`.docs-here`).forEach(e=>e.classList.remove(`docs-here`));let[r,i]=P[t?.emit]||[];if(!r)return;let o=null;e.id===`install`?o=n.querySelector(`a[href="#/docs/${r}"]`)?.closest(`li`):e.id===r&&i&&(o=[...n.querySelectorAll(`h2`)].find(e=>O(e.textContent||``)===O(i))),o?.classList.add(`docs-here`)},[u,e.id,t?.emit]);let d=[];return e.id===`install`&&(d.push({label:`Run doctor`,action:`doctor`}),d.push({label:`Rebuild`,action:`build`})),e.id===`verify`&&d.push({label:`Run doctor`,action:`doctor`}),e.id===`upgrade`&&d.push({label:`Update`,action:`update`}),(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(c,{eyebrow:r&&`${r} · ${I(e.body)} min read`,title:e.title,sub:i,actions:d.length>0&&d.map(e=>e.hash?(0,N.jsx)(`a`,{className:`btn ghost sm`,href:e.hash,children:e.label},e.label):(0,N.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>n&&n(e.action),children:e.label},e.label))}),e.source&&(0,N.jsx)(`div`,{className:`doc-meta`,children:(0,N.jsxs)(`span`,{className:`badge`,children:[(0,N.jsx)(`span`,{className:`dot`}),e.source]})}),(0,N.jsx)(`div`,{className:`markdown`,ref:a,dangerouslySetInnerHTML:{__html:u}}),s.map((e,t)=>{let n=R(e);return(0,D.createPortal)((0,N.jsx)(T,{text:n,label:B(n)}),e,t)}),e.link&&(0,N.jsx)(`div`,{className:`doc-link`,children:(0,N.jsx)(`a`,{className:`btn soft sm`,href:e.link.hash,children:e.link.label})})]})}var H=e=>`cmd-`+String(e).replace(/[^\w-]+/g,`-`);function U({a:e,kind:t}){let n=t===`positional`?e.dest:e.names.join(`, `),r=[];return e.metavar&&r.push(e.metavar),e.choices&&r.push(`{${e.choices.join(`|`)}}`),e.default!==null&&e.default!==void 0&&e.default!==``&&!e.is_flag&&r.push(`default: ${e.default}`),e.required&&r.push(`required`),(0,N.jsxs)(`div`,{className:`cli-arg`,children:[(0,N.jsx)(`code`,{className:`cli-arg-name`,children:n}),r.length>0&&(0,N.jsxs)(`code`,{className:`cli-arg-meta`,children:[` `,r.join(` · `)]}),e.help&&(0,N.jsx)(`div`,{className:`cli-arg-help`,children:e.help})]})}function W({cmd:e,prog:t}){let n=[t,e.name];for(let t of e.positionals||[]){let e=(t.metavar||t.dest||``).toUpperCase();n.push(t.required?e:`[${e}]`)}(e.options||[]).length&&n.push(`[OPTIONS]`);let r=n.join(` `);return(0,N.jsxs)(`div`,{className:`card pad-md mb-12 cli-card`,children:[(0,N.jsxs)(`div`,{className:`row wrap between cli-head`,children:[(0,N.jsxs)(`div`,{className:`stack gap-4`,children:[(0,N.jsx)(`h2`,{id:H(e.name),children:(0,N.jsx)(`code`,{children:e.name})}),e.help&&(0,N.jsx)(`p`,{className:`sub`,children:e.help})]}),(0,N.jsx)(T,{text:`${t} ${e.name}`,label:`Copy ${t} ${e.name}`,title:`Copy ${t} ${e.name}`})]}),(0,N.jsx)(`pre`,{className:`cli-syn`,children:r}),(e.positionals||[]).length>0&&(0,N.jsxs)(`div`,{className:`cli-block`,children:[(0,N.jsx)(`div`,{className:`cli-block-head`,children:`Arguments`}),e.positionals.map(e=>(0,N.jsx)(U,{a:e,kind:`positional`},e.dest))]}),(e.options||[]).length>0&&(0,N.jsxs)(`div`,{className:`cli-block`,children:[(0,N.jsx)(`div`,{className:`cli-block-head`,children:`Options`}),e.options.map(e=>(0,N.jsx)(U,{a:e,kind:`option`},e.names.join(`,`)))]})]})}function G({page:e}){let t=e.prog||`geneseed`,n=e.commands||[];return(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(c,{title:e.title,sub:(0,N.jsxs)(N.Fragment,{children:[`Every subcommand of `,(0,N.jsx)(`code`,{children:t}),`. Generated from the parser at request time (the same one `,(0,N.jsx)(`code`,{children:`geneseed`}),` actually parses), so this page cannot fall behind.`]})}),(0,N.jsx)(`div`,{children:n.map(e=>(0,N.jsx)(W,{cmd:e,prog:t},e.name))})]})}function K({page:e}){let t=e.rows||[],n=e.theme||`neutral`;return(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(c,{title:e.title,sub:(0,N.jsxs)(N.Fragment,{children:[`Geneseed's invented vocabulary, decoded. Left: the neutral, plain-English term. Right: the word the `,(0,N.jsx)(`code`,{className:`cap`,children:n}),` voice actually uses. Last: the developer idea it maps to.`]})}),(0,N.jsx)(`div`,{className:`card pad-md`,children:(0,N.jsxs)(`table`,{className:`glossary-table`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`th`,{children:`Concept`}),(0,N.jsx)(`th`,{children:`Neutral term`}),(0,N.jsxs)(`th`,{children:[`In `,n]}),(0,N.jsx)(`th`,{children:`Meaning`}),(0,N.jsx)(`th`,{children:`In dev terms`})]})}),(0,N.jsx)(`tbody`,{children:t.map(e=>(0,N.jsxs)(`tr`,{children:[(0,N.jsx)(`td`,{children:(0,N.jsx)(`strong`,{children:e.label})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`code`,{children:e.neutral||`—`})}),(0,N.jsx)(`td`,{children:(0,N.jsx)(`code`,{children:e.themed||e.neutral||`—`})}),(0,N.jsx)(`td`,{className:`dim`,children:e.desc}),(0,N.jsx)(`td`,{className:`dim`,children:e.analogy||`—`})]},e.label))})]})})]})}var q={enforced:`ok`,automatic:`ok`,asked:`warn`,"on demand":`warn`},J=({text:e})=>(0,N.jsx)(`span`,{dangerouslySetInnerHTML:{__html:b(y.parseInline(e||``))}}),Y=({kind:e})=>(0,N.jsx)(`span`,{className:`tag ${q[e]||``}`,children:e});function se({page:e,overview:t,onAction:n,section:r,description:i}){let[a,o]=(0,E.useState)(0),{before:s,after:l}=(0,E.useMemo)(()=>M(e),[e]);if(!e.rows)return(0,N.jsx)(V,{page:e,overview:t,onAction:n,section:r,description:i});let u=e.rows[a]||e.rows[0];return(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(c,{eyebrow:r&&`${r} · ${I(e.body)} min read`,title:e.title,sub:i}),(0,N.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:s}}),(0,N.jsxs)(`div`,{className:`docs-map`,children:[(0,N.jsx)(`ul`,{className:`map-tree`,"aria-label":`Pieces`,children:e.rows.map((e,t)=>(0,N.jsx)(`li`,{children:(0,N.jsxs)(`button`,{className:`map-node ${t===a?`on`:``}`,"aria-pressed":t===a,onClick:()=>o(t),children:[(0,N.jsx)(`span`,{className:`map-piece`,children:(0,N.jsx)(J,{text:e.piece})}),(0,N.jsx)(Y,{kind:e.kind}),(0,N.jsx)(`span`,{className:`mono dim map-cost`,children:(0,N.jsx)(J,{text:e.cost})})]})},t))}),u&&(0,N.jsxs)(`div`,{className:`card pad-md map-detail`,"aria-live":`polite`,children:[(0,N.jsx)(`h2`,{children:(0,N.jsx)(J,{text:u.piece})}),(0,N.jsx)(Y,{kind:u.kind}),(0,N.jsxs)(`dl`,{children:[(0,N.jsx)(`dt`,{children:`Does`}),(0,N.jsx)(`dd`,{children:(0,N.jsx)(J,{text:u.does})}),(0,N.jsx)(`dt`,{children:`Costs`}),(0,N.jsx)(`dd`,{children:(0,N.jsx)(J,{text:u.cost})}),(0,N.jsx)(`dt`,{children:`Turn it off`}),(0,N.jsx)(`dd`,{children:(0,N.jsx)(J,{text:u.off})})]})]})]}),l.trim()&&(0,N.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:l}})]})}function ce(){let e=document.getElementById(`main`);return e&&e.scrollHeight>e.clientHeight?e:document.scrollingElement||document.documentElement}function le(e){return document.addEventListener(`scroll`,e,{capture:!0,passive:!0}),()=>document.removeEventListener(`scroll`,e,{capture:!0})}var X=e=>(0,E.useSyncExternalStore)(le,e,()=>null),ue=5,de=96,fe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);function pe(e,t){let n=e||``,r=[];for(let e of t||[])if([...new Set([e.themed,e.neutral,e.label].filter(Boolean))].some(e=>RegExp(`(?<![\\w-])${fe(e)}s?(?![\\w-])`,`i`).test(n))&&r.push(e),r.length===ue)break;return r}var me=e=>{let t=document.getElementById(e);t&&(t.setAttribute(`tabindex`,`-1`),t.scrollIntoView({behavior:a()?`smooth`:`auto`}),t.focus({preventScroll:!0}))};function he({page:e,glossaryRows:t}){let n=e?.body,r=(0,E.useMemo)(()=>e?.kind===`cli`?(e.commands||[]).map(e=>({id:H(e.name),title:e.name,level:2})):M(e).toc,[e]),i=(0,E.useMemo)(()=>pe(n,t),[n,t]),a=X(()=>{let e=null;for(let t of r){let n=document.getElementById(t.id)?.getBoundingClientRect().top;n!=null&&n<=de&&(e=t.id)}return e});return!r.length&&!i.length?null:(0,N.jsxs)(`aside`,{className:`docs-margin`,children:[r.length>0&&(0,N.jsxs)(`nav`,{className:`docs-toc`,"aria-label":`On this page`,children:[(0,N.jsx)(`div`,{className:`docs-toc-head`,children:`On this page`}),(0,N.jsx)(`ul`,{children:r.map(e=>(0,N.jsx)(`li`,{className:`lvl-${e.level}`,children:(0,N.jsx)(`a`,{href:`#${e.id}`,"aria-current":a===e.id?`location`:void 0,onClick:t=>{t.preventDefault(),me(e.id)},children:e.title})},e.id))})]}),i.length>0&&(0,N.jsxs)(`div`,{className:`docs-gloss`,children:[(0,N.jsx)(`div`,{className:`docs-toc-head`,children:`Terms on this page`}),i.map(e=>(0,N.jsxs)(`div`,{className:`docs-gloss-card`,children:[(0,N.jsx)(`b`,{children:e.themed||e.neutral||e.label}),(0,N.jsx)(`p`,{children:e.desc})]},e.label))]})]})}function ge({page:e,overview:t}){let n=e.version||{},r=[...t?[[`Version`,t.version]]:[],[`Voice`,e.theme],[`Install mode`,e.emit],[`Deployed`,e.deployed?`yes`:`no`],[`Target`,(0,N.jsx)(`code`,{children:e.target},`t`)],[`Source root`,(0,N.jsx)(`code`,{children:e.root},`r`)],[`Installed build`,(0,N.jsx)(`code`,{children:n.installed_fp||`(none)`},`i`)],[`Source build`,(0,N.jsx)(`code`,{children:n.source_fp||`—`},`s`)],[`Match?`,n.verdict?(0,N.jsx)(`span`,{dangerouslySetInnerHTML:{__html:b(y.parseInline(n.verdict))}},`m`):`—`],[`License`,e.license]];return(0,N.jsxs)(`div`,{className:`detail-doc`,children:[(0,N.jsx)(c,{title:e.title,sub:`Live snapshot of the install behind this UI, plus where to go next.`}),(0,N.jsx)(`div`,{className:`card pad-md mb-18`,children:r.map(([e,t])=>(0,N.jsxs)(`div`,{className:`kv`,children:[(0,N.jsx)(`span`,{className:`k`,children:e}),(0,N.jsx)(`span`,{className:`v`,children:t??`—`})]},e))}),(0,N.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,N.jsxs)(`a`,{className:`btn ghost`,href:e.repo,target:`_blank`,rel:`noreferrer`,children:[(0,N.jsx)(u,{name:`external`}),e.repo_is_github?`GitHub repo`:`Source repo`]}),e.repo_is_github&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(`a`,{className:`btn ghost`,href:`${e.repo}/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,N.jsx)(u,{name:`external`}),`File an issue`]}),(0,N.jsxs)(`a`,{className:`btn ghost`,href:`${e.repo}/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,N.jsx)(u,{name:`external`}),`License`]})]})]})]})}function Z(e){return e?.groups?.[0]?.pages?.[0]?.id||``}function _e({data:e,error:t,overview:n,onAction:r,place:i}){if(t)return(0,N.jsx)(_,{error:t,style:{margin:18}});if(!e)return(0,N.jsx)(p,{label:`Loading page…`});switch(e.kind){case`markdown`:case`concept`:return(0,N.jsx)(V,{page:e,overview:n,onAction:r,section:i.section,description:i.page?.description});case`map`:return(0,N.jsx)(se,{page:e,overview:n,onAction:r,section:i.section,description:i.page?.description});case`cli`:return(0,N.jsx)(G,{page:e});case`glossary`:return(0,N.jsx)(K,{page:e});case`about`:return(0,N.jsx)(ge,{page:e,overview:n});default:return(0,N.jsx)(S,{title:`Unknown page kind`,children:e.kind})}}function ve(){let e=ce(),t=e.scrollHeight-e.clientHeight;return t>0?Math.min(100,Math.max(0,e.scrollTop/t*100)):0}function ye(){let e=X(ve);return(0,N.jsx)(`div`,{className:`docs-progress`,"aria-hidden":`true`,children:(0,N.jsx)(`i`,{style:{width:`${e}%`}})})}function Q(e){return(e?.pages||[]).map(e=>({name:e.id,title:e.title,desc:e.description||``,group:e.section||`General`,groupC:`var(--accent)`}))}var $=`(max-width: 720px)`;function be(){return(0,E.useSyncExternalStore)(e=>{let t=window.matchMedia?.($);return t?.addEventListener(`change`,e),()=>t?.removeEventListener(`change`,e)},()=>!!window.matchMedia?.($).matches)}function xe({page:e,overview:t,onAction:n}){let r=be(),[a,o]=f(re(t?.emit)),{data:c,error:u}=s(()=>i.docs(`all`),[]),y=e||Z(c),b=v(c,y),x=b.page?.hosts,S=!x?.length||x.includes(a)?a:x[0],T=te.filter(e=>!x||x.includes(e.id)),{data:D,error:O,loading:k}=s(()=>y&&(c||u)?i.docsPage(y,S):Promise.resolve(null),[y,S,!!(c||u)]),{data:A}=s(()=>i.docsPage(`glossary`,S).catch(()=>null),[S],`docs:glossary`);(0,E.useEffect)(()=>{if(c&&y&&!c.groups.some(e=>e.pages.some(e=>e.id===y))){let e=Z(c);e&&e!==y&&window.location.replace(l(e))}},[c,y]),(0,E.useEffect)(()=>{let e=document.scrollingElement||document.documentElement;for(let t of[document.getElementById(`main`),e])t&&(t.scrollTop=0)},[y]);let j=b.part||c?.groups?.[0]||null,M=j?.id===g;(0,E.useEffect)(()=>{M&&D?.id===y&&m(y)},[M,D,y]);let P=M?[...d(),y]:[],[F,I]=(0,E.useState)(``),[L,R]=(0,E.useState)(`all`),[z,B]=(0,E.useState)(j?.id);j?.id!==z&&(B(j?.id),I(``),R(`all`));let V=Q(j),H=oe(V),U=L===`all`?V:V.filter(e=>e.group===L),W=ie(U,F);if(u)return(0,N.jsx)(_,{error:u});let G=(0,N.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Docs parts`,children:[(0,N.jsxs)(`div`,{className:`lib-title`,children:[(0,N.jsx)(`p`,{className:`h`,children:`Docs`}),(0,N.jsx)(`span`,{className:`dim`,children:`How it works, and how to use it`})]}),b.page?.varies&&T.length>1?(0,N.jsx)(h,{"aria-label":`Host`,children:T.map(e=>(0,N.jsx)(`button`,{className:S===e.id?`on`:``,onClick:()=>o(e.id),"aria-pressed":S===e.id,children:e.label},e.id))}):null,(0,N.jsx)(`nav`,{className:`kind-list`,"aria-label":`Parts`,children:(c?.groups||[]).map(e=>(0,N.jsxs)(E.Fragment,{children:[(0,N.jsxs)(`a`,{href:e.pages[0]?l(e.pages[0].id):`#/docs`,className:j?.id===e.id?`on`:``,"aria-current":j?.id===e.id?`page`:void 0,children:[e.label,(0,N.jsx)(`span`,{className:`mono dim`,children:e.pages.length})]}),j?.id===e.id&&(0,N.jsx)(ae,{label:`Sections`,total:V.length,cats:H,cat:L,onChange:R})]},e.id))})]},`kinds`),K=(0,N.jsx)(C,{label:j?.label||`Docs`,count:F.trim()?`${W.length} of ${U.length}`:U.length||``,extra:M&&(0,N.jsx)(ee,{pages:j.pages,seen:P}),q:F,onQ:I,matched:W.length,inView:[j?.id,y],children:c?(0,N.jsx)(w,{rows:W,activeName:y,hrefOf:e=>l(e.name),pills:M?e=>P.includes(e.name)&&e.name!==y?(0,N.jsx)(`span`,{className:`docs-read-mark`,role:`img`,"aria-label":`, read`,children:`✓`}):null:void 0}):(0,N.jsx)(p,{label:`Loading docs…`})},`list`),q=!k&&(0,N.jsx)(he,{page:D,glossaryRows:A?.rows}),J=(0,N.jsxs)(`article`,{className:`lib-reader docs-reader`,"aria-label":b.page?.title||`Page`,children:[(0,N.jsx)(ye,{}),b.page&&(0,N.jsxs)(`nav`,{className:`docs-crumbs mono`,"aria-label":`Breadcrumb`,children:[(0,N.jsx)(`a`,{href:l(b.part.pages[0].id),children:b.part.label}),(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),(0,N.jsx)(`a`,{href:l(b.part.pages.find(e=>(e.section||`General`)===b.section).id),children:b.section}),(0,N.jsx)(`span`,{"aria-hidden":`true`,children:`›`}),(0,N.jsx)(`span`,{"aria-current":`page`,children:b.page.title})]}),(0,N.jsxs)(`div`,{className:`docs-read`,children:[r?q:null,(0,N.jsxs)(`div`,{className:`docs-article`,children:[(0,N.jsx)(_e,{data:k?null:D,error:O,overview:t,onAction:n,place:b},`${y}|${S}`),!k&&(0,N.jsx)(ne,{menu:c,pageId:y})]}),r?null:q]})]},`reader`);return(0,N.jsx)(`div`,{className:`docs-wrap`,children:(0,N.jsx)(`div`,{className:`library docs-lib`,children:r?[J,G,K]:[G,K,J]})})}export{xe as default,Q as docRows};
@@ -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-DLDVY3K-.js";import{Et as i,Ot as a,Q as o,Z as s,_t as c,at as l,it as u,kt as d,rt as f,vt as p}from"./index-BQwOmbor.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{t as h}from"./usePoll-o8ul-Sog.js";import{a as g,i as _,n as v,o as y,s as b}from"./LibRows-BZgdbI1l.js";import{t as x}from"./CopyButton-DUIUfNp6.js";import{a as ee,n as S,s as te}from"./ActiveLoops-BTHIaRhn.js";var C=e(t(),1),w=24,T=48,E=16,D=92,ne=8,re=16,O=22,ie=14,k=14,A=15,ae=4,j=7.2,M={brick:{w:200,h:48},fork:{w:200,h:48},loop:{w:200,h:56},lane:{w:150,h:56},close:{w:96,h:34},stop:{w:76,h:34}},N=`loop:`,oe=new Set([`$close`,`$stop`,`$lane`]),P=(e,t)=>{if(!e?.name)return`↺ route back`;let n=t?`${t[e.name]??0} / ${e.max??`?`}`:`max ${e.max??`?`}`;return`↺ ${e.name} · ${n}`};function se(e,t,n,r){let i=null;for(let a of e)Array.isArray(a?.nodes)&&a.nodes[0]===n&&(a.nodes.includes(t)||a.nodes.includes(`$lane`)&&r.has(t))&&(!i||a.nodes.length<i.nodes.length)&&(i=a);return i}var F=new Set([`pass`,`fail`,`error`,`none`,`needs-info`]);function I(e,t=[]){let n=new Set(Array.isArray(e.stages)?e.stages:[]),r=(e.cycles||[]).filter(e=>Array.isArray(e?.nodes)),i=e=>r.some(t=>t.nodes[0]===e.to&&t.nodes.includes(e.from)),a=new Map((Array.isArray(t)?t:[]).map(e=>[e?.name,e])),o=(e.edges||[]).filter(e=>n.has(e?.from)),s=e=>(a.has(e)?a.get(e)?.outcomes||[]:o.filter(t=>t.from===e).map(e=>e.on)).some(e=>!F.has(e)),c=new Map;for(let e of o)n.has(e.to)&&!i(e)&&!e.from.startsWith(N)&&s(e.from)&&(c.has(e.from)||c.set(e.from,[]),c.get(e.from).includes(e.to)||c.get(e.from).push(e.to));return c}function ce(e,t,n=[]){let r=I(e,n);for(let n of[...Array.isArray(t)?t:[]].reverse()){if(!r.has(n?.stage)||!n.outcome)continue;let t=(e.edges||[]).find(e=>e.from===n.stage&&e.on===n.outcome);if(t&&r.get(n.stage).includes(t.to))return t.to}return null}function le(e,t=[],n={}){let r=n.width>0?Math.floor(n.width):1/0,i=[{rails:!0,stack:!1},{rails:!1,stack:!1},{rails:!0,stack:!0},{rails:!1,stack:!0}];for(let a of i){let o=L(e,t,a,r,n.lane);if(o.width<=r||a===i.at(-1))return o}}function L(e,t,n,r,i){let a=Array.isArray(e.stages)?e.stages:[],o=new Set(a),s=(Array.isArray(e.edges)?e.edges:[]).filter(e=>typeof e?.from==`string`&&typeof e?.to==`string`&&o.has(e.from)&&(o.has(e.to)||oe.has(e.to))),c=(Array.isArray(e.cycles)?e.cycles:[]).filter(e=>Array.isArray(e?.nodes)),l=new Map(t.map(e=>[e.name,e])),u=I(e,t),d=new Set([...u.values()].flat()),f=e=>se(c,e.from,e.to,d),p=new Map(o.has(e.start)?[[e.start,0]]:[]),m=s.filter(e=>o.has(e.to)&&!f(e));for(let e=0;e<a.length;e++){let e=!1;for(let t of m){if(!p.has(t.from))continue;let n=p.get(t.from)+1;p.get(t.to)>=n||(p.set(t.to,n),e=!0)}if(!e)break}let h=Math.max(-1,...p.values());for(let e of a)p.has(e)||p.set(e,++h);let g=h+1,_=[];for(let e of a)(_[p.get(e)]||=[]).push(e);let v=e=>_[p.get(e)].length>1,y=n.rails?w:re,b=n.rails?E:ne,x=r===1/0?1/0:r-2*y,ee=()=>Math.max(M.lane.w,Math.min(240,x-28)),S=e=>n.rails?M.lane.w:Math.max(D,Math.min(M.lane.w,Math.floor((x-b*(e-1))/e))),C=a.map(e=>{let t=v(e),n=e.startsWith(N)?e.slice(5):null,r=n?`loop`:u.has(e)?`fork`:`brick`;return{id:e,kind:r,...t?{w:S(_[p.get(e)].length),h:M.lane.h}:{...M[r]||M.brick},rank:p.get(e),lane:t,stacked:!1,loop:n,human:r===`brick`||r===`fork`?te(l.get(e)):null,tags:[]}}),F=new Map(C.map(e=>[e.id,e])),ce=s.some(e=>e.to===`$close`);if(ce){let e={id:`$close`,kind:`close`,...M.close,rank:g,tags:[]};C.push(e),F.set(`$close`,e),_[g]=[`$close`]}let le=e=>{let t=null;for(let n of u.keys())p.get(n)<p.get(e)&&(!t||p.get(n)>p.get(t))&&(t=n);return t},L=new Map;for(let e of s){let t=`${e.from}\u0000${e.to}`;if(L.has(t))L.get(t).on.push(e.on);else{let n=f(e),r=e.to===`$lane`?u.get(le(e.from))?.[0]:e.to;if(e.to!==`$stop`&&!F.has(r))continue;let i=e.to===`$stop`?0:F.get(r).rank-p.get(e.from),a=e.to===`$stop`?`stop`:n?`back`:i===1?`flow`:`skip`;L.set(t,{from:e.from,to:e.to,target:r,on:[e.on],kind:a,back:!!n,cycle:n?.name??null,cycleDef:n,span:i})}}let R=[...L.values()],ue=R.filter(e=>e.kind===`back`||e.kind===`skip`),de=R.filter(e=>e.kind===`stop`&&v(e.from)),fe=n.rails?de:[...ue,...R.filter(e=>e.kind===`stop`&&!v(e.from)),...de];for(let e of fe)F.get(e.from).tags.push({kind:e.kind,on:e.on,to:e.to,cycle:e.cycle});let pe=(e,t)=>e.kind===`back`?P(t.cycleDef):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,z=e=>Math.max(0,...e.tags.map(t=>pe(t,R.find(n=>n.from===e.id&&n.to===t.to)).length*j)),B=_.map(e=>(e||[]).map(e=>F.get(e))),V=e=>e.reduce((e,t)=>e+t.w,0)+b*(e.length-1),H=B.map(e=>n.stack&&e.length>1&&V(e)>x);B.forEach((e,t)=>{if(H[t])for(let t of e)Object.assign(t,{stacked:!0,w:ee()})});let U=(e,t)=>H[t]?Math.max(...e.map(e=>e.w))+28:V(e),W=Math.max(M.brick.w,...B.map((e,t)=>e.length?U(e,t):0)),G=w,K=[];B.forEach((e,t)=>{if(!e.length)return;let n=(W-U(e,t))/2;if(H[t]){for(let t of e)Object.assign(t,{x:(W-t.w)/2,y:G}),G+=t.h+t.tags.length*A+O;G-=O}else{for(let t of e)Object.assign(t,{x:n,y:G}),n+=t.w+b;G+=Math.max(...e.map(e=>e.h)),G+=Math.max(0,...e.map(e=>e.tags.length))*A}K[t]=G+T/2,G+=T});let q=G-T,J=n.rails?ue.sort((e,t)=>Math.abs(t.span)-Math.abs(e.span)):[],Y=e=>28+e*k,me=e=>e.back?P(e.cycleDef):e.on.join(` · `),X=J.length?Y(J.length-1)+12:y;J.forEach((e,t)=>{X=Math.max(X,Y(t)+8+me(e).length*j-F.get(e.from).x)});for(let e of C)e.x+=X;let he=n.rails?R.filter(e=>e.kind===`stop`&&!v(e.from)):[],Z=X+W+24;for(let e of he){let t=F.get(e.from);Z=Math.max(Z,t.x+t.w+10+e.on.join(` · `).length*j)}let ge=Math.max(0,...C.filter(e=>e.tags.length).map(e=>e.x+e.w/2+6+z(e))),_e=Math.max(X+W,ge)+y;if(he.length){Z=Math.max(Z,ge+10);let e=ce?F.get(`$close`).y:q-M.stop.h,t={id:`$stop`,kind:`stop`,...M.stop,x:Z-M.stop.w/2,y:e,rank:g,tags:[]};C.push(t),F.set(`$stop`,t),_e=Z+M.stop.w/2+w}let Q=e=>e.x+e.w/2,$=e=>e.y+e.h/2,ve=e=>e.y+e.h,ye=e=>e.x-ie,be=e=>e.x+e.w+ie,xe=new Map;for(let e of R)e.kind===`flow`&&xe.set(e.target,(xe.get(e.target)||0)+1);let Se=e=>e.to===`$lane`&&F.get(i)?.stacked&&u.get(le(e.from))?.includes(i)?F.get(i):F.get(e.target),Ce=new Map;for(let e of J){let t=Se(e).id;Ce.set(t,(Ce.get(t)||0)+1)}let we=new Map,Te=R.map(e=>{let t=F.get(e.from),n=Se(e),r={from:e.from,to:e.to,on:e.on,kind:e.kind,back:e.back,cycle:e.cycle};if(e.kind===`stop`){if(!he.includes(e))return{...r,path:null};let n=F.get(`$stop`);return{...r,path:`M${t.x+t.w},${$(t)} H${Z} V${n.y}`,lx:t.x+t.w+6,ly:$(t)-6,anchor:`start`}}if(e.kind===`back`||e.kind===`skip`){let i=J.indexOf(e);if(i<0)return{...r,path:null};let a=we.get(n.id)||0;we.set(n.id,a+1);let o=Math.ceil((Ce.get(n.id)-1)/2),s=o?Math.min(10,(n.h/2-ae)/o):10,c=$(n)+(a%2?1:-1)*Math.ceil(a/2)*s;return{...r,path:`M${t.x},${$(t)} H${Y(i)} V${c} H${n.x}`,lx:Y(i)+6,ly:$(t)-6,anchor:`start`}}let i=K[t.rank],a=t.stacked?`M${t.x+t.w},${$(t)} H${be(t)} V${i}`:`M${Q(t)},${ve(t)} V${i}`,o=n.stacked?` H${ye(n)} V${$(n)} H${n.x}`:` H${Q(n)} V${n.y}`,s=e.on.length===1&&e.on[0]===`pass`,c=(xe.get(n.id)||0)>1?{lx:t.stacked?be(t)+4:Q(t)+6,ly:t.stacked?$(t)-4:ve(t)+13}:n.stacked?{lx:n.x,ly:n.y-5}:{lx:Q(n)+6,ly:n.y-8};return{...r,path:a+o,...c,anchor:`start`,plain:s}});return{width:Math.ceil(_e),height:Math.ceil(q+w),mode:n.rails?`rails`:`tags`,stacked:H.some(Boolean),nodes:C,edges:Te}}var R=n(),ue=20;function de({factory:e,bricks:t=[],loops:n=[],onSelect:r,highlight:i,child:a,counters:o,lane:s,history:c}){let l=(0,C.useRef)(null),[u,d]=(0,C.useState)(0);(0,C.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>d(t=>Math.abs(e.clientWidth-t)>ue?e.clientWidth:t);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let f=s===void 0?ce(e,c,t):s,p=le(e,t,{width:u,lane:f}),m=new Set(n.map(e=>e.name)),h=new Map((e.cycles||[]).map(e=>[e.name,e])),g=new Set(p.nodes.filter(e=>e.kind===`fork`).map(e=>e.id)),_=e=>e.kind===`back`?P(h.get(e.cycle),o):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,v=e=>e.kind===`loop`?`${e.id} stage, the ${e.loop} loop`:`${e.id} ${e.kind===`fork`?`fork`:`brick`}${e.human?`, ${e.human.toLowerCase()}`:``}`,y=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},b=e=>{let t=e.id===i,n=`${v(e)}${e.id===f?`, the lane taken`:``}`,o=t&&a&&(e.loop||e.lane)?`, at ${a.node}`:``;return r?{role:`button`,tabIndex:0,"aria-label":`${n}${o}`,onClick:y(e.id),onKeyDown:y(e.id)}:{role:`img`,"aria-label":`${n}${t?`, current stage`:``}${o}`}},x=e=>`fg-node ${e.kind}${e.lane?` lane`:``}${e.id===i?` current`:``}${e.id===f?` taken`:``}`,S=e=>f&&(e.to===f||e.from===f),te=e=>e.tags.map((t,n)=>(0,R.jsx)(`text`,{x:e.x+e.w/2+6,y:e.y+e.h+12+n*15,className:`fg-lbl fg-tag ${t.kind}`,children:_(t)},`${t.kind}${t.to}`));return(0,R.jsxs)(`div`,{className:`fg-wrap`,ref:l,children:[(0,R.jsxs)(`svg`,{className:`fgraph`,"data-mode":`${p.mode}${p.stacked?` stacked`:``}`,style:{"--fg-w":`${p.width}px`},viewBox:`0 0 ${p.width} ${p.height}`,role:`group`,"aria-label":`${e.name} factory: ${(e.stages||[]).join(`, `)}`,children:[(0,R.jsx)(`defs`,{children:[`flow`,`back`,`stop`].map(e=>(0,R.jsx)(`marker`,{id:`fg-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,R.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`fg-head-${e}`})},e))}),p.edges.map(e=>{if(!e.path)return null;let t=e.kind===`skip`?`flow`:e.kind,n=e.back?P(h.get(e.cycle),o):e.kind===`flow`&&e.plain?``:e.on.join(` · `);return(0,R.jsxs)(`g`,{children:[(0,R.jsx)(`path`,{d:e.path,className:`fg-edge ${e.kind}${S(e)&&e.kind===`flow`?` taken`:``}`,markerEnd:`url(#fg-arrow-${t})`}),n?(0,R.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`fg-lbl ${e.kind}${e.kind===`flow`&&g.has(e.from)?` fork`:``}`,children:n}):null]},`${e.from}>${e.to}`)}),p.nodes.map(e=>{if(e.kind===`close`||e.kind===`stop`)return(0,R.jsxs)(`g`,{className:`fg-${e.kind}`,role:`img`,"aria-label":e.kind,children:[(0,R.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.h/2}),(0,R.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+4,textAnchor:`middle`,children:e.kind})]},e.id);let t=e.id===i?`step`:void 0,n=a&&e.id===i?a:null,r=n&&(e.loop||e.lane)?`at ${n.node}`:e.loop?m.has(e.loop)?`whole loop`:`not in catalogue`:e.lane?`no loop`:null;return(0,R.jsxs)(`g`,{children:[(0,R.jsxs)(`g`,{className:x(e),"aria-current":t,...b(e),children:[e.lane||e.loop?(0,R.jsx)(`title`,{children:e.id}):null,(0,R.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:`10`}),(0,R.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+(r?-2:4),textAnchor:`middle`,children:e.loop||e.id}),r?(0,R.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+14,textAnchor:`middle`,className:`fg-sub`,children:r}):null,e.human?(0,R.jsx)(ee,{x:e.x+e.w-4,y:e.y+4,label:e.human}):null]}),te(e)]},e.id)})]}),(0,R.jsx)(`ul`,{className:`fg-legend`,"aria-label":`Graph legend`,children:[[`brick`,`brick`],[`loop`,`whole loop (test · fix · verify)`],[`fork`,`fork`],[`back`,`route back, bounded by its max`],[`stop`,`fail → stop`]].map(([e,t])=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`span`,{className:`fg-key ${e}`,"aria-hidden":`true`}),t]},e))})]})}var fe=encodeURIComponent,pe=5e3,z=a.factories.map(e=>[e,d[e]]),B={project:`Project`,global:`Global`,shipped:`Shipped`},V={templates:`Origins`,active:`Statuses`},H=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]],U=e=>!!e.graph,W=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r}))),G=e=>W(e.map(e=>({...e,desc:e.description})),e=>e.origin,Object.entries(B)),K=e=>W(e.map(e=>({...e,name:e.root,desc:e.factory})),e=>e.status,H),q=(e,t)=>(0,R.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),J={templates:e=>q(``,e.origin),active:e=>q(S[e.status],e.status)},Y=de;function me({factory:e,counters:t}){return e.cycles?.length?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`h3`,{className:`loop-h2`,children:`Routes back`}),(0,R.jsx)(`ul`,{className:`fac-cycles`,"aria-label":`Cycles`,children:e.cycles.map(e=>(0,R.jsxs)(`li`,{children:[(0,R.jsx)(`b`,{children:e.name}),`: `,e.nodes.join(` → `),` —`,` `,t?`lap ${t[e.name]??0} of ${e.max}`:`${e.max} laps at most`]},e.name))})]}):null}function X({f:e,bricks:t,loops:n}){let r=`Run the ${e.name} factory on <issue URL, file or request>`,i=[`git worktree add ../<repo>-factory-<slug> -b loop/factory-<slug>`,`cd ../<repo>-factory-<slug>`,`geneseed factory init --factory ${e.name} --title "<title>" --requirement "<requirement>" --input "<issue URL, file path or pasted text>"`].join(` && `);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`reader-tags`,children:[(0,R.jsx)(`span`,{className:`tag acc`,children:`Factory`}),q(``,e.origin)]}),(0,R.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,R.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,R.jsxs)(`p`,{className:`mono dim reader-src`,children:[`factories/`,e.name,`.json · `,e.origin]}),(0,R.jsx)(`hr`,{className:`hr`}),(0,R.jsx)(Y,{factory:e.factory,bricks:t,loops:n}),(0,R.jsx)(me,{factory:e.factory}),(0,R.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`fac-start-h`,children:[(0,R.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,R.jsx)(`h3`,{id:`fac-start-h`,className:`loop-kicker`,children:`Start it: ask the agent`}),(0,R.jsx)(x,{text:r,label:`Copy request`})]}),(0,R.jsx)(`pre`,{className:`mono`,children:r}),(0,R.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,R.jsx)(`h3`,{className:`loop-kicker`,children:`Or by hand, in a new worktree`}),(0,R.jsx)(x,{text:i,label:`Copy command`})]}),(0,R.jsx)(`pre`,{className:`mono`,children:i})]}),(0,R.jsxs)(`p`,{className:`panel-note`,children:[(0,R.jsx)(`code`,{className:`mono`,children:`init`}),` only registers the run: an agent then drives`,` `,(0,R.jsx)(`code`,{className:`mono`,children:`geneseed factory next`}),` and `,(0,R.jsx)(`code`,{className:`mono`,children:`record`}),`.`]}),e.factory.rules?.length?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,R.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every stage follows`,children:e.factory.rules.map(e=>(0,R.jsx)(`li`,{children:e},e))})]}):null]})}function he({run:e,bricks:t,loops:n,from:r}){let i=e.tasks;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`reader-tags`,children:[(0,R.jsx)(`span`,{className:`tag acc`,children:`Factory run`}),(0,R.jsx)(`span`,{className:`tag${S[e.status]?` ${S[e.status]}`:``}`,children:e.status})]}),(0,R.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,R.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.factory,` · `,e.branch,` · `,e.root]}),U(e)?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`reader-lede`,children:[`At `,e.stage,` · `,e.transitions,` transitions`,i?` · task ${i.index} / ${i.count}`:``,e.loop?` · loop at ${e.loop.node}, iteration ${e.loop.iteration}`:``]}),e.awaiting?(0,R.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,R.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind??`you`,e.awaiting.stage?` at ${e.awaiting.stage} (${e.awaiting.outcome})`:``]}),` `,`— Answer in the agent's session.`]}):null,e.reason?(0,R.jsx)(`p`,{className:`panel-note`,children:e.reason}):null,(0,R.jsx)(`hr`,{className:`hr`}),(0,R.jsx)(Y,{factory:e.graph,bricks:t,loops:n,highlight:e.stage,child:e.loop,counters:e.counters,lane:e.lane,history:e.history}),(0,R.jsx)(me,{factory:e.graph,counters:e.counters}),(0,R.jsxs)(`p`,{className:`panel-note`,children:[`Bricks and loops drawn from the catalogue of `,r||`the default install`,`, which the run’s project may not share.`]})]}):(0,R.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its FACTORY.md cannot be read, so there is no state to show.`:`Its FACTORY.md is gone: the run closed and its state went with it.`})]})}function Z({problems:e}){if(!e?.length)return null;let t=e.length;return(0,R.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,R.jsxs)(`b`,{className:`t-warn`,children:[t,` factory `,t===1?`problem`:`problems`,`: these factories cannot run as they are`]}),(0,R.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,R.jsx)(`li`,{className:`mono`,children:e},e))})]})}var ge={templates:{title:`No factories`,body:(0,R.jsxs)(R.Fragment,{children:[`Add one under `,(0,R.jsx)(`code`,{className:`mono`,children:`.geneseed/factories/`}),` in the repo.`]})},active:{title:`No runs yet`,body:(0,R.jsxs)(R.Fragment,{children:[`Ask the agent to run a factory, or start one by hand in a worktree with`,` `,(0,R.jsx)(`code`,{className:`mono`,children:`geneseed factory init`}),`. It shows up here while it runs.`]})}},_e={templates:(0,R.jsxs)(R.Fragment,{children:[`A factory carries one work item through bricks and loops to an open PR.`,` `,(0,R.jsx)(`a`,{href:`#/docs/factories`,children:`How factories work →`})]}),active:(0,R.jsxs)(R.Fragment,{children:[`Factory runs registered on this machine, read from their FACTORY.md.`,` `,(0,R.jsx)(`a`,{href:`#/docs/run-a-factory`,children:`Run a factory →`})]})};function Q(){let[e,t]=(0,C.useState)(null),[n,i]=(0,C.useState)(null);return h(e=>r.activeFactories().then(n=>e()&&(t(n),i(null)),t=>e()&&i(t.message)),pe,[]),{runs:e?e.factories||[]:null,error:n}}function $({tab:e=`templates`,item:t,dataRev:n}){let a=o(n),[d,h]=s(`factories`,a),{data:x,error:ee}=i(()=>r.factories(p(d)),[n,d?.id??``],`factories`),{runs:S,error:te}=Q(),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(`all`),[ne,re]=(0,C.useState)(e);e!==ne&&(re(e),T(``),D(`all`));let O=x?.bricks||[],ie=x?.loops||[],k=e===`active`?S&&K(S):x&&G(x.factories||[]),A=k||[],ae=b(A),j=E===`all`?A:A.filter(e=>e.group===E),M=w.trim(),N=g(j,M),oe=!!(t&&k&&!A.some(e=>e.name===t)),P=oe?null:A.find(e=>e.name===t)||e===`active`&&A.find(U)||A[0]||null,se={templates:x?.factories?.length,active:S?.length},F=z.find(([t])=>t===e)[1],I=e===`active`?te:ee;return(0,R.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,R.jsx)(l,{className:`page-pick`,installs:a,value:d,onChange:h}),(0,R.jsx)(f,{error:I,style:{margin:`0 0 var(--sp-3)`}}),(0,R.jsx)(Z,{problems:x?.problems}),(0,R.jsxs)(`div`,{className:`library`,children:[(0,R.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Factories sections`,children:[(0,R.jsxs)(`div`,{className:`lib-title`,children:[(0,R.jsx)(`h1`,{className:`h`,children:`Factories`}),(0,R.jsx)(`span`,{className:`dim`,children:`Work items, carried to a PR`})]}),(0,R.jsx)(`p`,{className:`panel-note lib-lede`,children:_e[e]}),(0,R.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:z.map(([t,n])=>(0,R.jsxs)(C.Fragment,{children:[(0,R.jsxs)(`a`,{href:`#/factories/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,R.jsx)(`span`,{className:`mono dim`,children:se[t]??``})]}),e===t&&(0,R.jsx)(y,{label:V[t],total:A.length,cats:ae,cat:E,onChange:D})]},t))})]}),(0,R.jsx)(_,{label:F,count:M?`${N.length} of ${j.length}`:k?j.length:``,q:w,onQ:T,matched:N.length,inView:[e,t],current:P?.name,sections:z.map(([t,n])=>({key:t,label:n,n:se[t],href:`#/factories/${t}`,on:e===t})),cats:ae,cat:E,total:A.length,onCat:D,catLabel:V[e],children:k?A.length===0?(0,R.jsx)(m,{title:ge[e].title,children:ge[e].body}):(0,R.jsx)(v,{rows:N,activeName:P?.name,hrefOf:t=>`#/factories/${e}/${fe(t.name)}`,pills:J[e]}):I?null:(0,R.jsx)(u,{})}),(0,R.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:oe?(0,R.jsx)(m,{title:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/factories/${e}`,label:`All ${F.toLowerCase()} →`}}):P?e===`active`?(0,R.jsx)(he,{run:P,bricks:O,loops:ie,from:d?c(d):null}):(0,R.jsx)(X,{f:P,bricks:O,loops:ie},P.name):e===`active`&&k?(0,R.jsx)(m,{title:`What is a factory?`,docs:{href:`#/docs/factories`,label:`How factories work →`},children:`A factory runs stages, bricks and whole loops, until the work is an open PR.`}):null})]})]})}export{$ as default,G as factoryRows,K as runRows};
@@ -1 +1 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,t as r}from"./motion-RlUl1osO.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{V as o,W as s,bt as c,yt as l,z as u}from"./index-BNttaGQb.js";import{i as d,n as f,r as p}from"./Dashboard-BUdUTjbB.js";e();var m=t(),h=12,g=Array.from({length:7},(e,t)=>`var(--cat-${t})`),_=n[9];function v({segments:e,size:t=186,stroke:n=26,caption:i=`capabilities`}){let a=e.reduce((e,t)=>e+t.n,0);return(0,m.jsxs)(`div`,{className:`ring-box`,children:[(0,m.jsx)(s,{segments:e,size:t,stroke:n,label:i,sweepMs:_}),(0,m.jsxs)(`div`,{className:`ring-center`,children:[(0,m.jsx)(`div`,{className:`donut-c-num`,children:(0,m.jsx)(r,{value:a,duration:_})}),(0,m.jsx)(`div`,{className:`donut-c-cap`,children:i})]})]})}function y(e){if(e.length<2)return e.length?`M${e[0][0]},${e[0][1]}`:``;let t=`M${e[0][0]},${e[0][1]}`;for(let n=0;n<e.length-1;n++){let r=e[n-1]||e[n],i=e[n],a=e[n+1],o=e[n+2]||a,s=i[0]+(a[0]-r[0])/6,c=i[1]+(a[1]-r[1])/6,l=a[0]-(o[0]-i[0])/6,u=a[1]-(o[1]-i[1])/6;t+=` C${s},${c} ${l},${u} ${a[0]},${a[1]}`}return t}function b({data:e,height:t=156,accent:n}){if(!e.length)return null;let r=t,i=Math.max(...e.map(e=>e.v),1)+1,a=e.length>1?588/(e.length-1):588,o=e.map((e,t)=>[6+t*a,r-6-e.v/i*(r-14-6)]),s=y(o),c=o[o.length-1],l=o[0],u=`${s} L${c[0]},${r} L${l[0]},${r} Z`;return(0,m.jsxs)(`svg`,{viewBox:`0 0 600 ${r}`,preserveAspectRatio:`none`,style:{width:`100%`,height:t,display:`block`,overflow:`visible`},children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`b-grad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0`,style:{stopColor:n},stopOpacity:`.28`}),(0,m.jsx)(`stop`,{offset:`1`,style:{stopColor:n},stopOpacity:`0`})]})}),(0,m.jsx)(`path`,{d:u,fill:`url(#b-grad)`}),(0,m.jsx)(`path`,{d:s,fill:`none`,style:{stroke:n},strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),(0,m.jsx)(`circle`,{cx:c[0],cy:c[1],r:`3.5`,style:{fill:n},vectorEffect:`non-scaling-stroke`})]})}function x({label:e,value:t,sub:n,color:r,icon:i}){return(0,m.jsxs)(`div`,{className:`b-tile`,children:[(0,m.jsx)(`span`,{className:`b-tile-ic`,style:{background:`color-mix(in srgb, ${r} 18%, transparent)`,color:r},children:(0,m.jsx)(l,{name:i})}),(0,m.jsxs)(`div`,{className:`b-tile-body`,children:[(0,m.jsx)(`div`,{className:`b-tile-val`+(t===0?` zero`:``),children:t}),(0,m.jsx)(`div`,{className:`b-tile-label`,children:e})]}),(0,m.jsx)(`div`,{className:`b-tile-sub`,children:n})]})}function S({overview:e,sigil:t,jobs:n,lens:s,onAction:_}){let y=e.counts||{},S=s?.doctor?.state||`loading`,C=s?.doctor?.data?.groups||[],w=S===`ok`,T=C.filter(e=>e.problems.length===0).length,E=C.length,D=d(e,s?.tone),O=o(n,h),k=c(e.diff),A=a.filter(e=>(y[e]||0)>0).map((e,t)=>({key:e,label:i[e].label,n:y[e]||0,tone:`cat`+t%g.length,color:g[t%g.length]})),j=A.reduce((e,t)=>e+t.n,0),M=u(n||[],10),N=M.reduce((e,t)=>e+t.v,0);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`b-greet`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`eyebrow`,children:`your harness`}),(0,m.jsx)(`h2`,{className:`h b-h`,children:D}),(0,m.jsx)(f,{verdict:s?.verdict}),(0,m.jsx)(`p`,{className:`sub`,children:t||`A friendly read of every layer growing in your harness.`})]})}),(0,m.jsxs)(`div`,{className:`grid b-hero-grid mb-16`,children:[(0,m.jsxs)(`div`,{className:`card b-hero`,children:[(0,m.jsx)(`div`,{className:`b-hero-ring`,children:(0,m.jsx)(v,{segments:[{key:`pass`,label:`pass`,n:T,tone:`good`},{key:`attention`,label:`attention`,n:Math.max(E-T,0),tone:`warn`}],size:168,stroke:20,caption:`checks`})}),(0,m.jsxs)(`div`,{className:`b-hero-side`,children:[(0,m.jsx)(`h3`,{className:`b-hero-title`,children:w?`${T} of ${E} checks pass`:S===`failed`?`Doctor did not answer`:`Checking…`}),S===`failed`&&(0,m.jsxs)(`button`,{className:`btn ghost b-hero-retry`,onClick:()=>_(`doctor`),children:[(0,m.jsx)(l,{name:`doctor`}),`Retry doctor`]}),(0,m.jsxs)(`p`,{className:`sub`,children:[`One source, rendered into `,(0,m.jsx)(`code`,{children:e.target}),` and inherited by every repo on this machine.`]}),w&&(0,m.jsx)(`ul`,{className:`b-hero-checks`,children:C.map(e=>{let t=e.problems.length===0;return(0,m.jsxs)(`li`,{className:`b-hcheck ${t?`ok`:`bad`}`,title:t?`clean`:e.problems.join(`; `),children:[(0,m.jsx)(`span`,{className:`b-hcheck-mark`,children:t?`✓`:`!`}),(0,m.jsx)(`span`,{className:`b-hcheck-label`,children:e.label})]},e.label)})}),(0,m.jsxs)(`div`,{className:`b-chips`,children:[(0,m.jsxs)(`span`,{className:`b-chip`,children:[(0,m.jsx)(`b`,{className:`t-cap`,children:e.theme}),` voice`]}),(0,m.jsx)(`span`,{className:`b-chip`,children:(0,m.jsx)(`b`,{children:e.emit})}),(0,m.jsxs)(`span`,{className:`b-chip`,children:[`built `,(0,m.jsx)(`b`,{children:e.build_time||`unknown`})]})]})]})]}),(0,m.jsxs)(`div`,{className:`b-tiles`,children:[(0,m.jsx)(x,{label:`Agents`,value:y.agents??`—`,sub:`specialists`,color:g[0],icon:`layers`}),(0,m.jsx)(x,{label:`Skills`,value:y.skills??`—`,sub:`workflows`,color:g[1],icon:`skill`}),(0,m.jsx)(x,{label:`Dictates`,value:y.laws??`—`,sub:y.doctrines?`${y.doctrines.active}/${y.doctrines.total} packs · ${y.doctrines.rules} rules`:`all upheld`,color:g[2],icon:`law`}),(0,m.jsx)(x,{label:`Local edits`,value:k,sub:`files`,color:g[3],icon:`changes`})]})]}),(0,m.jsxs)(`div`,{className:`grid split-even mb-16`,children:[(0,m.jsxs)(`div`,{className:`card pad-lg b-mix-card`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Capability mix`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[j,` total`]})})]}),(0,m.jsxs)(`div`,{className:`b-mix`,children:[(0,m.jsx)(v,{segments:A,size:186,stroke:26}),(0,m.jsx)(`div`,{className:`b-legend`,children:A.map(e=>(0,m.jsxs)(`div`,{className:`b-leg-row`,children:[(0,m.jsx)(`span`,{className:`b-leg-dot`,style:{background:e.color}}),(0,m.jsx)(`span`,{className:`b-leg-name`,children:e.label}),(0,m.jsx)(`span`,{className:`b-leg-bar`,children:(0,m.jsx)(`i`,{style:{width:`${e.n/j*100}%`,background:e.color}})}),(0,m.jsx)(`span`,{className:`b-leg-val`,children:e.n})]},e.label))})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent runs`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`badge ok`,children:[(0,m.jsx)(`span`,{className:`dot`}),`job log`]})})]}),(0,m.jsxs)(`div`,{className:`b-stat-lead`,children:[(0,m.jsx)(`span`,{className:`b-stat-big`,children:(0,m.jsx)(r,{value:N})}),(0,m.jsxs)(`span`,{className:`b-stat-cap`,children:[`runs in the last 10 days`,w&&E>0&&` · ${T}/${E} checks pass now`]})]}),(0,m.jsx)(b,{data:M,accent:g[0],height:156})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent activity`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[`last `,O.length,` runs`]})})]}),(0,m.jsx)(p,{jobs:n,max:h,empty:(0,m.jsx)(`p`,{className:`sub`,children:`No runs yet. Trigger an action to populate this.`})})]})]})}export{S as default};
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,t as r}from"./motion-RlUl1osO.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{V as o,W as s,bt as c,xt as l,z as u}from"./index-BQwOmbor.js";import{i as d,n as f,r as p}from"./Dashboard-Dnw6EyX7.js";e();var m=t(),h=12,g=Array.from({length:7},(e,t)=>`var(--cat-${t})`),_=n[9];function v({segments:e,size:t=186,stroke:n=26,caption:i=`capabilities`}){let a=e.reduce((e,t)=>e+t.n,0);return(0,m.jsxs)(`div`,{className:`ring-box`,children:[(0,m.jsx)(s,{segments:e,size:t,stroke:n,label:i,sweepMs:_}),(0,m.jsxs)(`div`,{className:`ring-center`,children:[(0,m.jsx)(`div`,{className:`donut-c-num`,children:(0,m.jsx)(r,{value:a,duration:_})}),(0,m.jsx)(`div`,{className:`donut-c-cap`,children:i})]})]})}function y(e){if(e.length<2)return e.length?`M${e[0][0]},${e[0][1]}`:``;let t=`M${e[0][0]},${e[0][1]}`;for(let n=0;n<e.length-1;n++){let r=e[n-1]||e[n],i=e[n],a=e[n+1],o=e[n+2]||a,s=i[0]+(a[0]-r[0])/6,c=i[1]+(a[1]-r[1])/6,l=a[0]-(o[0]-i[0])/6,u=a[1]-(o[1]-i[1])/6;t+=` C${s},${c} ${l},${u} ${a[0]},${a[1]}`}return t}function b({data:e,height:t=156,accent:n}){if(!e.length)return null;let r=t,i=Math.max(...e.map(e=>e.v),1)+1,a=e.length>1?588/(e.length-1):588,o=e.map((e,t)=>[6+t*a,r-6-e.v/i*(r-14-6)]),s=y(o),c=o[o.length-1],l=o[0],u=`${s} L${c[0]},${r} L${l[0]},${r} Z`;return(0,m.jsxs)(`svg`,{viewBox:`0 0 600 ${r}`,preserveAspectRatio:`none`,style:{width:`100%`,height:t,display:`block`,overflow:`visible`},children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`b-grad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0`,style:{stopColor:n},stopOpacity:`.28`}),(0,m.jsx)(`stop`,{offset:`1`,style:{stopColor:n},stopOpacity:`0`})]})}),(0,m.jsx)(`path`,{d:u,fill:`url(#b-grad)`}),(0,m.jsx)(`path`,{d:s,fill:`none`,style:{stroke:n},strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),(0,m.jsx)(`circle`,{cx:c[0],cy:c[1],r:`3.5`,style:{fill:n},vectorEffect:`non-scaling-stroke`})]})}function x({label:e,value:t,sub:n,color:r,icon:i}){return(0,m.jsxs)(`div`,{className:`b-tile`,children:[(0,m.jsx)(`span`,{className:`b-tile-ic`,style:{background:`color-mix(in srgb, ${r} 18%, transparent)`,color:r},children:(0,m.jsx)(c,{name:i})}),(0,m.jsxs)(`div`,{className:`b-tile-body`,children:[(0,m.jsx)(`div`,{className:`b-tile-val`+(t===0?` zero`:``),children:t}),(0,m.jsx)(`div`,{className:`b-tile-label`,children:e})]}),(0,m.jsx)(`div`,{className:`b-tile-sub`,children:n})]})}function S({overview:e,sigil:t,jobs:n,lens:s,onAction:_}){let y=e.counts||{},S=s?.doctor?.state||`loading`,C=s?.doctor?.data?.groups||[],w=S===`ok`,T=C.filter(e=>e.problems.length===0).length,E=C.length,D=d(e,s?.tone),O=o(n,h),k=l(e.diff),A=a.filter(e=>(y[e]||0)>0).map((e,t)=>({key:e,label:i[e].label,n:y[e]||0,tone:`cat`+t%g.length,color:g[t%g.length]})),j=A.reduce((e,t)=>e+t.n,0),M=u(n||[],10),N=M.reduce((e,t)=>e+t.v,0);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`b-greet`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`eyebrow`,children:`your harness`}),(0,m.jsx)(`h2`,{className:`h b-h`,children:D}),(0,m.jsx)(f,{verdict:s?.verdict}),(0,m.jsx)(`p`,{className:`sub`,children:t||`A friendly read of every layer growing in your harness.`})]})}),(0,m.jsxs)(`div`,{className:`grid b-hero-grid mb-16`,children:[(0,m.jsxs)(`div`,{className:`card b-hero`,children:[(0,m.jsx)(`div`,{className:`b-hero-ring`,children:(0,m.jsx)(v,{segments:[{key:`pass`,label:`pass`,n:T,tone:`good`},{key:`attention`,label:`attention`,n:Math.max(E-T,0),tone:`warn`}],size:168,stroke:20,caption:`checks`})}),(0,m.jsxs)(`div`,{className:`b-hero-side`,children:[(0,m.jsx)(`h3`,{className:`b-hero-title`,children:w?`${T} of ${E} checks pass`:S===`failed`?`Doctor did not answer`:`Checking…`}),S===`failed`&&(0,m.jsxs)(`button`,{className:`btn ghost b-hero-retry`,onClick:()=>_(`doctor`),children:[(0,m.jsx)(c,{name:`doctor`}),`Retry doctor`]}),(0,m.jsxs)(`p`,{className:`sub`,children:[`One source, rendered into `,(0,m.jsx)(`code`,{children:e.target}),` and inherited by every repo on this machine.`]}),w&&(0,m.jsx)(`ul`,{className:`b-hero-checks`,children:C.map(e=>{let t=e.problems.length===0;return(0,m.jsxs)(`li`,{className:`b-hcheck ${t?`ok`:`bad`}`,title:t?`clean`:e.problems.join(`; `),children:[(0,m.jsx)(`span`,{className:`b-hcheck-mark`,children:t?`✓`:`!`}),(0,m.jsx)(`span`,{className:`b-hcheck-label`,children:e.label})]},e.label)})}),(0,m.jsxs)(`div`,{className:`b-chips`,children:[(0,m.jsxs)(`span`,{className:`b-chip`,children:[(0,m.jsx)(`b`,{className:`t-cap`,children:e.theme}),` voice`]}),(0,m.jsx)(`span`,{className:`b-chip`,children:(0,m.jsx)(`b`,{children:e.emit})}),(0,m.jsxs)(`span`,{className:`b-chip`,children:[`built `,(0,m.jsx)(`b`,{children:e.build_time||`unknown`})]})]})]})]}),(0,m.jsxs)(`div`,{className:`b-tiles`,children:[(0,m.jsx)(x,{label:`Agents`,value:y.agents??`—`,sub:`specialists`,color:g[0],icon:`layers`}),(0,m.jsx)(x,{label:`Skills`,value:y.skills??`—`,sub:`workflows`,color:g[1],icon:`skill`}),(0,m.jsx)(x,{label:`Dictates`,value:y.laws??`—`,sub:y.doctrines?`${y.doctrines.active}/${y.doctrines.total} packs · ${y.doctrines.rules} rules`:`all upheld`,color:g[2],icon:`law`}),(0,m.jsx)(x,{label:`Local edits`,value:k,sub:`files`,color:g[3],icon:`changes`})]})]}),(0,m.jsxs)(`div`,{className:`grid split-even mb-16`,children:[(0,m.jsxs)(`div`,{className:`card pad-lg b-mix-card`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Capability mix`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[j,` total`]})})]}),(0,m.jsxs)(`div`,{className:`b-mix`,children:[(0,m.jsx)(v,{segments:A,size:186,stroke:26}),(0,m.jsx)(`div`,{className:`b-legend`,children:A.map(e=>(0,m.jsxs)(`div`,{className:`b-leg-row`,children:[(0,m.jsx)(`span`,{className:`b-leg-dot`,style:{background:e.color}}),(0,m.jsx)(`span`,{className:`b-leg-name`,children:e.label}),(0,m.jsx)(`span`,{className:`b-leg-bar`,children:(0,m.jsx)(`i`,{style:{width:`${e.n/j*100}%`,background:e.color}})}),(0,m.jsx)(`span`,{className:`b-leg-val`,children:e.n})]},e.label))})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent runs`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`badge ok`,children:[(0,m.jsx)(`span`,{className:`dot`}),`job log`]})})]}),(0,m.jsxs)(`div`,{className:`b-stat-lead`,children:[(0,m.jsx)(`span`,{className:`b-stat-big`,children:(0,m.jsx)(r,{value:N})}),(0,m.jsxs)(`span`,{className:`b-stat-cap`,children:[`runs in the last 10 days`,w&&E>0&&` · ${T}/${E} checks pass now`]})]}),(0,m.jsx)(b,{data:M,accent:g[0],height:156})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent activity`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[`last `,O.length,` runs`]})})]}),(0,m.jsx)(p,{jobs:n,max:h,empty:(0,m.jsx)(`p`,{className:`sub`,children:`No runs yet. Trigger an action to populate this.`})})]})]})}export{S as default};
@@ -1,3 +1,3 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-BMFDSXoB.js";import{G as i,J as a,Q as o,Tt as s,U as c,Y as l,Z as u,_t as d,at as f,bt as p,dt as m,ht as h,it as g,mt as _,rt as v,st as y,vt as b,yt as x}from"./index-BNttaGQb.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{t as C}from"./Tabs-d2RIRAKT.js";import{n as w,r as T,t as E}from"./controls-D4wmg_pl.js";var D=e(t(),1),O=n();function k({host:e,theme:t,options:n,onAction:i,onClose:a,onNote:o}){let[s,c]=(0,D.useState)({path:``,host:e,theme:t,footprint:`lean`,posture:`peer`,mode:`direct`,trust:`balanced`}),[l,u]=(0,D.useState)(!1),[d,f]=(0,D.useState)(``),p=(e,t)=>c(n=>({...n,[e]:t})),h=async()=>{u(!0),o(``);try{let e=await r.pickFolder();e.path?(p(`path`,e.path),f(``)):e.error&&o(e.error)}catch(e){o(e.message)}finally{u(!1)}},g=async()=>{let e=s.path.trim();e?(f(``),o(``),await i?.(`deploy`,{host:s.host,path:e,theme:s.theme,footprint:s.footprint,posture:s.posture,mode:s.mode,trust:s.trust})&&a()):f(`Choose or type a folder to deploy into.`)};return(0,O.jsxs)(`div`,{className:`deploy-pop`,children:[(0,O.jsxs)(`div`,{className:`dp-row`,children:[(0,O.jsx)(`input`,{className:`inp dp-path`,type:`text`,placeholder:`/path/to/project, or click Browse…`,value:s.path,onChange:e=>{p(`path`,e.target.value),f(``)},onKeyDown:e=>e.key===`Enter`&&g(),"aria-label":`Folder to deploy into`,"aria-invalid":d?!0:void 0,"aria-describedby":d?`dp-path-err`:void 0}),(0,O.jsx)(`button`,{className:`btn ghost sm`,disabled:l,onClick:h,children:l?`Choosing…`:`Browse…`})]}),d?(0,O.jsx)(`p`,{id:`dp-path-err`,className:`tag bad note`,role:`alert`,children:d}):null,(0,O.jsxs)(`div`,{className:`dp-row`,children:[(0,O.jsxs)(`label`,{className:`dp-field`,children:[(0,O.jsx)(`span`,{children:`Deploy as`}),(0,O.jsx)(`select`,{className:`sel`,"aria-label":`host for the new install`,value:s.host,onChange:e=>p(`host`,e.target.value),children:m.map(e=>(0,O.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,O.jsx)(w,{value:s,options:n,onChange:p,who:`the new install`}),(0,O.jsx)(`button`,{className:`btn ghost sm`,onClick:g,children:`Deploy`}),(0,O.jsx)(`button`,{className:`btn ghost sm`,onClick:a,children:`Cancel`})]}),(0,O.jsxs)(`p`,{className:`sub dp-note`,children:[`Adds a per-repo harness (`,(0,O.jsx)(`code`,{children:_(s.host).deployAdds}),`) into the folder, non-destructively. It’s then tracked here even after you leave its directory.`]})]})}function A(){let{data:e,error:t,reload:n}=s(()=>r.excludes(),[]),[i,a]=(0,D.useState)(!1),[o,c]=(0,D.useState)([]),l=async(e,t)=>{a(!0);try{let n=await r.excludeMutate(e,t);c(n.messages||[])}catch(e){c(e.body?.messages||[e.message])}finally{a(!1),n()}};return t||!e?.installs?.length?null:(0,O.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,O.jsx)(`div`,{className:`card-head`,children:(0,O.jsx)(`h3`,{children:`Excluded folders`})}),(0,O.jsx)(`p`,{className:`sub mb-16`,children:`Sovereign repos: inside these folders every global harness goes dormant — hooks stay silent and the global preamble is not loaded.`}),(e.excludes||[]).map(e=>(0,O.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,O.jsx)(`code`,{children:e.path}),(0,O.jsx)(`span`,{className:`mono muted`,children:e.hosts.map(e=>_(e).label).join(`, `)}),(0,O.jsx)(`button`,{className:`btn ghost sm`,disabled:i,"aria-label":`Stop excluding ${e.path}`,onClick:()=>l(`remove`,e.path),children:`Remove`})]},e.path)),(0,O.jsxs)(`button`,{className:`btn ghost sm`,disabled:i,onClick:async()=>{a(!0);try{let e=await r.pickFolder();e.path?await l(`add`,e.path):e.error&&c([e.error])}catch(e){c([e.message])}finally{a(!1)}},children:[(0,O.jsx)(x,{name:`folder`}),` Exclude a folder…`]}),o.map((e,t)=>(0,O.jsx)(`p`,{className:`sub`,children:e},t))]})}var j=`This project sees your machine-wide rules, profile and memory map, so what you taught one tool or repo applies here too.`,M=`About 1 500 tokens at every session start, growing with your rules. The hook budget is fixed at 9 000 characters, and the tier loads before this project's docs, so a large tier can push them down to a lazy listing.`;function N({targets:e,onReveal:t}){let n=e.flatMap(e=>e.servers);return(0,O.jsxs)(`div`,{className:`ip-block`,children:[(0,O.jsxs)(`span`,{className:`ip-label`,children:[`MCP servers `,(0,O.jsx)(`span`,{className:`mono dim`,children:n.length})]}),e.map(e=>(0,O.jsxs)(`div`,{className:`mcp-target`,children:[(0,O.jsxs)(`div`,{className:`mt-head`,children:[(0,O.jsx)(`code`,{title:e.path,children:e.label}),e.exists?(0,O.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>t(e),"aria-label":`Open the folder holding ${e.label}`,title:`Open the folder holding ${e.path} to edit it`,children:`Open folder`}):null]}),e.exists?e.servers.length?e.servers.map(e=>(0,O.jsxs)(`div`,{className:`mcp-row`,children:[(0,O.jsx)(`span`,{className:`mono`,children:e.name}),(0,O.jsx)(`span`,{className:`tag ${e.state===`enabled`?`ok`:`warn`}`,children:e.state===`enabled`?`Enabled`:`Disabled`})]},e.name)):(0,O.jsx)(`p`,{className:`sub`,children:`None configured in this file.`}):(0,O.jsxs)(`p`,{className:`sub`,children:[`No MCP file yet (it would be `,(0,O.jsx)(`code`,{children:e.path}),`).`]})]},e.path))]})}var P={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`],absent:[`Not installed`,``]};function F({inst:e,targets:t,choice:n,unchanged:r,options:i,onPick:a,canAct:o,busy:s,memory:c,onMemory:l,onApply:u,onToggleInstall:d,onRemove:f,onRevealMcp:p}){let m=`${_(e.host).label} · ${e.scope}`,[g,v]=P[e.state]||P.absent,y=e.state===`active`,b=e.state===`absent`;return(0,O.jsxs)(`aside`,{className:`install-panel`,"aria-label":`${m} install`,children:[(0,O.jsx)(`span`,{className:`ip-eyebrow`,children:`Selected install`}),(0,O.jsxs)(`div`,{className:`ip-head`,children:[(0,O.jsx)(`h2`,{children:h(e)}),(0,O.jsx)(`span`,{className:`tag ${v}`,children:g})]}),(0,O.jsx)(`span`,{className:`ip-kind`,children:e.scope===`global`?`Global install`:`Per-project install · ${_(e.host).label}`}),(0,O.jsx)(`code`,{className:`ip-path`,children:e.path}),b?(0,O.jsxs)(`p`,{className:`sub`,children:[`Install Geneseed here as `,(0,O.jsx)(`strong`,{children:_(e.host).label}),`. Files are added non-destructively; deactivate or uninstall later.`]}):null,(y||b)&&o?(0,O.jsxs)(`div`,{className:`ip-picks`,children:[(0,O.jsx)(w,{value:n,options:i,onChange:a,who:m}),(0,O.jsxs)(`p`,{className:`sub`,children:[n.footprint===`lean`?`Lean footprint: terse rule lines and a pointer to the full file, about 40% smaller.`:`Full footprint: every rule’s complete text inline, the largest context.`,` `,`Every rule stays in force. `,(0,O.jsx)(`a`,{href:`#/docs/footprint`,children:`Learn more →`})]})]}):null,(y||b)&&o&&e.scope!==`global`?(0,O.jsxs)(`div`,{className:`ip-block`,children:[(0,O.jsxs)(`label`,{className:`ip-switch`,children:[(0,O.jsx)(T,{on:!!n.sharedTier,label:`shared tier for ${m}`,onToggle:()=>a(`sharedTier`,!n.sharedTier)}),(0,O.jsx)(`span`,{children:`Read the machine-wide shared tier`})]}),(0,O.jsxs)(`p`,{className:`sub`,children:[(0,O.jsx)(`strong`,{children:`Benefit:`}),` `,j]}),(0,O.jsxs)(`p`,{className:`sub`,children:[(0,O.jsx)(`strong`,{children:`Cost:`}),` `,M]})]}):null,y&&t.length?(0,O.jsx)(N,{targets:t,onReveal:p}):null,y&&e.scope===`global`?(0,O.jsx)(A,{}):null,b?null:(0,O.jsxs)(`label`,{className:`ip-switch`,children:[(0,O.jsx)(T,{on:y,disabled:s,label:`activate ${m}`,onToggle:d}),(0,O.jsx)(`span`,{children:y?`Active: loads in every session`:`Disabled: files moved aside`})]}),(0,O.jsx)(`div`,{className:`ip-spacer`}),o?(0,O.jsxs)(`div`,{className:`ip-actions`,children:[b?(0,O.jsx)(`button`,{type:`button`,className:`btn`,onClick:u,children:`Install`}):y?(0,O.jsx)(`button`,{type:`button`,className:`btn`,disabled:r,onClick:u,children:`Apply and rebuild`}):null,b?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`field`,children:[(0,O.jsx)(`span`,{children:`On uninstall, memory and notebook`}),(0,O.jsxs)(`select`,{className:`sel`,value:c,onChange:e=>l(e.target.value),children:[(0,O.jsx)(`option`,{value:`keep`,children:`keep in place`}),(0,O.jsx)(`option`,{value:`archive`,children:`archive aside`}),(0,O.jsx)(`option`,{value:`delete`,children:`delete too`})]})]}),(0,O.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,"aria-label":`remove ${m} from ${e.path}`,disabled:s,onClick:f,children:`Uninstall…`})]})]}):null]})}function I({dataRev:e}){let{data:t,error:n,reload:i}=s(()=>r.migratePreview(),[e]);return(0,O.jsxs)(`section`,{className:`panel`,"aria-labelledby":`preview-h`,children:[(0,O.jsx)(`div`,{className:`panel-head`,children:(0,O.jsx)(`h2`,{id:`preview-h`,children:`Next rebuild`})}),n?(0,O.jsx)(v,{error:n,onRetry:i}):t?(0,O.jsxs)(O.Fragment,{children:[t.folds.length?(0,O.jsx)(`ul`,{className:`preview-list`,children:t.folds.map(e=>(0,O.jsxs)(`li`,{children:[(0,O.jsx)(`b`,{className:`mono`,children:e.host}),` `,e.summary||`nothing to fold`,e.failed.map(e=>(0,O.jsxs)(`div`,{className:`t-warn`,children:[`The fold would stop at `,e]},e))]},e.host))}):(0,O.jsx)(`p`,{className:`dim`,children:`No global install to fold.`}),t.orphans.length?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`h3`,{children:`Orphans`}),(0,O.jsx)(`p`,{className:`dim`,children:`No manifest owns these. An earlier build may have written them, or they may be yours. Nothing moves them: if one is not yours, move it by hand.`}),(0,O.jsx)(`ul`,{className:`preview-list mono`,children:t.orphans.map(e=>(0,O.jsx)(`li`,{children:e},e))})]}):null]}):(0,O.jsx)(g,{})]})}var L=(e,t)=>`${e} ${t}`,R=[`claude`,`bob`,`openclaude`],z={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},B=/[\\/]\.claude[\\/]worktrees[\\/]/,V=e=>e.scope===`project`&&B.test(e.path);function ee(e,t){let n=e.drift?.stale??0,r={behind:`Behind ${t||`source`}`+(n?` · ${n} file${n===1?``:`s`}`:``),synced:`In sync`,unknown:`Not checked`}[e.verdict],i=e.diffable?p(e.drift):0;return i?`${r} · ${i} edited`:r}function te({inst:e,fleet:t,version:n,onEdits:r}){if(t===void 0)return(0,O.jsx)(`span`,{className:`dim`,children:`…`});if(!t)return(0,O.jsx)(`span`,{className:`dim`,children:`—`});let i=t.drift?.stale??0,a=t.diffable?p(t.drift):0;return(0,O.jsxs)(`div`,{className:`sync-cell`,children:[t.diffable&&i+a>0?(0,O.jsx)(c,{label:`Sync with source of ${h(e)}`,parts:[{key:`stale`,label:`behind source`,n:i,tone:`warn`},{key:`edited`,label:`local edits`,n:a,tone:`bad`}]}):null,(0,O.jsx)(`span`,{className:`dim`,children:ee(t,n)}),t.diffable?null:(0,O.jsxs)(`span`,{className:`dim`,title:`Local edits are only checked for global installs`,children:[` `,`· not checkable`]}),a?(0,O.jsxs)(O.Fragment,{children:[` `,(0,O.jsx)(`a`,{href:`#/installs/edits`,onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e)},children:`Local edits`})]}):null]})}function H({rows:e,project:t,currentId:n,onPick:r,label:i,fleet:a,onEdits:o,onDefault:s,busyKey:c}){let l=e=>a===void 0?void 0:a?.installs?.find(t=>t.id===e.id)||null;return(0,O.jsx)(`div`,{className:`tbl-scroll`,children:(0,O.jsxs)(`table`,{className:`tbl hosts-tbl`,"aria-label":i,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{scope:`col`,children:t?`Project`:`Host`}),(0,O.jsx)(`th`,{scope:`col`,children:`State`}),(0,O.jsx)(`th`,{scope:`col`,children:`Sync with source`}),(0,O.jsx)(`th`,{scope:`col`,children:(0,O.jsx)(`span`,{className:`sr-only`,children:`Selected`})})]})}),(0,O.jsx)(`tbody`,{children:e.map(e=>{let[i,u]=z[e.state]||[`Not installed`,``],d=n===e.id,f=e.state===`absent`;return(0,O.jsxs)(`tr`,{className:`pickable${d?` on`:``}${f?` quiet`:``}`,onClick:()=>r(e.id),children:[(0,O.jsxs)(`td`,{children:[(0,O.jsx)(`button`,{type:`button`,className:`row-pick`,"aria-pressed":d,title:e.path,onClick:()=>r(e.id),children:h(e)}),(0,O.jsx)(`div`,{className:`mono path-cell`,title:e.path,children:t?_(e.host).label:e.path})]}),(0,O.jsxs)(`td`,{children:[(0,O.jsx)(`span`,{className:`tag ${u}`,children:i}),e.default?(0,O.jsxs)(O.Fragment,{children:[` `,(0,O.jsx)(`span`,{className:`tag`,title:`A page that names no install reads this one, and pickers start on it`,children:`Default`})]}):e.state===`active`&&s?(0,O.jsxs)(O.Fragment,{children:[` `,(0,O.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Make ${h(e)} the default install`,disabled:c===e.id,onClick:t=>{t.stopPropagation(),s(e)},children:`Make default`})]}):null,V(e)?(0,O.jsxs)(O.Fragment,{children:[` `,(0,O.jsx)(`span`,{className:`tag warn`,title:`Inside a .claude/worktrees folder: likely a finished worktree. Remove it from its panel.`,children:`Worktree leftover`})]}):null]}),(0,O.jsx)(`td`,{children:(0,O.jsx)(te,{inst:e,fleet:l(e),version:a?.version,onEdits:o})}),(0,O.jsx)(`td`,{className:`pick-mark`,children:d?`Editing ›`:``})]},e.id)})})]})})}function ne({themes:e,current:t}){if(!e.length||!t)return null;let n=[...e].sort((e,n)=>e.name===t?-1:+(n.name===t));return(0,O.jsxs)(`details`,{className:`panel voice-ref`,children:[(0,O.jsxs)(`summary`,{children:[(0,O.jsx)(`span`,{className:`vr-title`,children:`Voices`}),(0,O.jsxs)(`span`,{className:`mono dim`,children:[e.length,` to choose from, set per install`]})]}),(0,O.jsx)(`div`,{className:`vr-list`,children:n.map(e=>(0,O.jsxs)(`div`,{className:`voice-row${e.name===t?` current`:``}`,children:[(0,O.jsx)(`span`,{className:`vr-name`,children:e.name}),(0,O.jsx)(`span`,{className:`vr-desc`,children:e.tagline?`“${e.tagline}”`:e.blurb})]},e.name))})]})}function re({setup:e,overview:t}){if(!e)return null;let n=e.installed_fp&&e.installed_fp===e.source_fp;return(0,O.jsxs)(`section`,{className:`panel`,"aria-labelledby":`checkout-h`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`h2`,{id:`checkout-h`,children:`This checkout`}),(0,O.jsx)(`span`,{className:`mono ${n?`t-good`:`t-warn`}`,children:n?`in sync`:e.version_verdict})]}),(0,O.jsxs)(`dl`,{className:`kv-grid`,children:[(0,O.jsx)(`dt`,{children:`Source`}),(0,O.jsx)(`dd`,{className:`mono`,children:e.root}),(0,O.jsx)(`dt`,{children:`Version`}),(0,O.jsx)(`dd`,{className:`mono`,children:t?.version||`unknown`}),(0,O.jsx)(`dt`,{children:`Fingerprint`}),(0,O.jsx)(`dd`,{className:`mono`,children:e.source_fp})]})]})}function U({onAction:e,themes:t=[],currentTheme:n,overview:i,setup:o,dataRev:c,onMutated:u}){let d=y(),{data:f,error:p,reload:m}=s(()=>r.installs(),[c]),{data:C,error:w,reload:T}=s(()=>r.mcp(),[c]),{data:A,error:j}=s(()=>r.fleet(),[c]),M=j?null:A??void 0,[N,P]=(0,D.useState)(null),[z,B]=(0,D.useState)(``),[V,ee]=(0,D.useState)({}),[te,U]=(0,D.useState)(!1),[W,G]=(0,D.useState)(!1),[K,q]=(0,D.useState)({id:``,value:`keep`}),J=e=>K.id===e?.id?K.value:`keep`,[Y,X]=(0,D.useState)(()=>l(`hosts`)),ie=(0,D.useMemo)(()=>{let e={};for(let t of C?.targets||[]){let n=L(t.host||`opencode`,t.root);(e[n]||(e[n]=[])).push(t)}return e},[C]);if(p||w)return(0,O.jsx)(v,{error:p||w,onRetry:()=>{m(),T()}});if(!f||!C)return(0,O.jsx)(g,{});let ae={active:0,disabled:1,absent:2},Z=[...f.installs].sort((e,t)=>(e.scope===`global`?0:1)-(t.scope===`global`?0:1)||(ae[e.state]??3)-(ae[t.state]??3)),Q=Z.find(e=>e.id===Y)||Z.find(e=>e.default)||Z.find(e=>e.state===`active`)||Z[0],$=e=>{let t=V[e.id]||{};return{theme:t.theme||e.theme||n||`neutral`,footprint:t.footprint||e.state!==`absent`&&e.footprint||`lean`,posture:t.posture||e.posture||`peer`,mode:t.mode||e.mode||`direct`,trust:t.trust||e.trust||`balanced`,sharedTier:t.sharedTier??!!e.sharedTier}},oe=(e,t,n)=>ee(r=>({...r,[e.id]:{...r[e.id],[t]:n}})),se=e=>{let t=$(e);return t.theme===e.theme&&t.footprint===(e.footprint||`lean`)&&t.posture===(e.posture||`peer`)&&t.mode===(e.mode||`direct`)&&t.trust===(e.trust||`balanced`)&&(e.scope===`global`||t.sharedTier===!!e.sharedTier)},ce={theme:t.map(e=>e.name),footprint:E,posture:f.postures||[],mode:f.modes||[],trust:f.trusts||[]},le=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o,sharedTier:s}=$(t),c=_(t.host).label,l=`${r} footprint, ${i} posture, ${a} mode, ${o} loop trust`,u=t.state===`absent`?`Install Geneseed for ${c} into ${t.path} with the “${n}” voice (${l})? Files are added non-destructively (your own config is left untouched); deactivate or uninstall later.`:`Rebuild this ${c} install (voice “${n}”, ${l})? It rebuilds in place, non-destructive.`;await d(u,{title:t.state===`absent`?`Install Geneseed?`:`Rebuild this install?`,confirmLabel:t.state===`absent`?`Install`:`Rebuild`})&&e?.(`install`,{host:t.host,scope:t.scope,path:t.path,theme:n,footprint:r,posture:i,mode:a,trust:o,...t.scope===`global`?{}:{sharedTier:s}})},ue=async e=>{if(e.state!==`active`||await d(`Deactivate this install? Files are moved aside, not deleted; reactivate any time.`,{title:`Deactivate this install?`,confirmLabel:`Deactivate`})){B(e.id),P(null);try{let t=await r.installToggle(e.host,e.path,e.state===`active`?`deactivate`:`activate`);if(!t.ok){let e=Array.isArray(t.failed)?t.failed.join(`, `):``;P({text:t.error||e&&`unrestored: ${e}`||`action failed`,tone:`bad`});return}u?.()}catch(e){P({text:e.message,tone:`bad`})}finally{B(``)}}},de=async e=>{B(e.id),P(null);try{await r.setDefaultInstall(e.host,e.path),u?.()}catch(e){P({text:e.message,tone:`bad`})}finally{B(``)}},fe=(e,t)=>{let n=e.path.includes(`\\`)&&!e.path.includes(`/`)?`\\`:`/`,r=e.path.replace(/[\\/]+$/,``);return`${e.scope===`project`&&R.includes(e.host)?`${r}${n}.${e.host}`:r}${n}${t}`},pe=async e=>{let t=J(e),n=e.scope===`project`?` and de-lists it`:`; the row stays, marked “not installed”`,i=t===`delete`?`, and permanently deletes ${fe(e,`memory`)} and ${fe(e,`notebook`)}`:t===`archive`?`; memory and notebook are archived aside`:`; memory and notebook stay in place`;if(await d(`Uninstall ${_(e.host).label} · ${e.scope}? It deletes ${b(e.host,e.scope)}${n}${i}. This can’t be undone.`,{title:e.scope===`project`?`Remove this install?`:`Remove the global install?`,confirmLabel:t===`delete`?`Remove and delete memory`:`Remove`,tone:`danger`})){B(e.id),P(null);try{let n=await r.installRemove(e.host,e.path,t);if(!n.ok){P({text:n.error||`remove failed`,tone:`bad`});return}q({id:``,value:`keep`}),n.kept?.length&&P({text:`Removed. Kept ${n.kept.length} file(s) you edited: ${n.kept.join(`, `)} — they are yours now (the CLI geneseed uninstall --force deletes edited files too).`,tone:`ok`}),u?.()}catch(e){P({text:e.message,tone:`bad`})}finally{B(``)}}},me=async e=>{P(null);try{let t=await r.mcpReveal(e.path);P({text:`Opening ${t.dir}. If no window appeared, open that folder by hand.`,tone:``})}catch(e){P({text:e.message,tone:`bad`})}},he=async()=>{let t=Z.filter(e=>e.state===`active`).map(e=>`${h(e)} · ${e.scope}`);await d(`Rebuild every active install: ${t.join(`, `)||`none`}? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&e(`build-all`)},ge=Z.find(e=>e.default)?.host||Z.find(e=>e.state===`active`)?.host||Z[0]?.host||`opencode`,_e=Z.filter(e=>e.scope===`global`),ve=Z.filter(e=>e.scope!==`global`),ye=e=>{X(e)},be=e=>{a(`edits`,e.id),window.location.hash=`#/installs/edits`};return(0,O.jsxs)(`div`,{className:`hosts`,children:[(0,O.jsxs)(`div`,{className:`hosts-main`,children:[(0,O.jsxs)(`div`,{className:`toolbar`,children:[(0,O.jsxs)(`span`,{className:`dim`,children:[Z.filter(e=>e.state!==`absent`).length,` installed.`]}),(0,O.jsxs)(`div`,{className:`row gap-8`,children:[(0,O.jsx)(`button`,{type:`button`,className:`btn ghost`,"aria-expanded":W,onClick:()=>G(e=>!e),children:`Preview next rebuild`}),e?(0,O.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:he,children:[(0,O.jsx)(x,{name:`refresh`}),` Rebuild all`]}):null]})]}),W?(0,O.jsx)(I,{dataRev:c}):null,N?.tone===`bad`?(0,O.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:N.text}):N?(0,O.jsx)(`p`,{className:`tag ${N.tone===`ok`?`ok `:``}note`,role:`status`,children:N.text}):null,(0,O.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-global`,children:[(0,O.jsx)(`div`,{className:`inst-head`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{id:`inst-global`,children:`Global installs`}),(0,O.jsx)(`p`,{className:`dim`,children:`One per tool. Loaded in every folder, except excluded ones.`})]})}),(0,O.jsx)(H,{rows:_e,currentId:Q?.id,onPick:ye,label:`Global installs`,fleet:M,onEdits:be,onDefault:e?de:void 0,busyKey:z})]}),(0,O.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-project`,children:[(0,O.jsxs)(`div`,{className:`inst-head`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{id:`inst-project`,children:`Per-project installs`}),(0,O.jsx)(`p`,{className:`dim`,children:`A repo with its own install. Inside it, only that install loads.`})]}),e?(0,O.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>U(e=>!e),children:[(0,O.jsx)(x,{name:`folder`}),` Deploy to a repo…`]}):null]}),te?(0,O.jsx)(`div`,{className:`inst-deploy`,children:(0,O.jsx)(k,{host:ge,theme:n||`neutral`,options:ce,onAction:e,onClose:()=>U(!1),onNote:e=>P(e?{text:e,tone:`bad`}:null)})}):null,ve.length?(0,O.jsx)(H,{rows:ve,project:!0,currentId:Q?.id,onPick:ye,label:`Per-project installs`,fleet:M,onEdits:be,onDefault:e?de:void 0,busyKey:z}):(0,O.jsx)(S,{children:`No repo has its own install yet. Deploy one to give a project its own rules and voice.`})]}),(0,O.jsx)(re,{setup:o,overview:i}),(0,O.jsx)(ne,{themes:t,current:i?.theme})]}),Q?(0,O.jsx)(F,{inst:Q,targets:ie[L(Q.host,Q.path)]||[],choice:$(Q),unchanged:se(Q),options:ce,onPick:(e,t)=>oe(Q,e,t),canAct:!!e,busy:z===Q.id,memory:J(Q),onMemory:e=>q({id:Q.id,value:e}),onApply:()=>le(Q),onToggleInstall:()=>ue(Q),onRemove:()=>pe(Q),onRevealMcp:me},Q.id):null]})}function W(e){return e.startsWith(`@@`)||e.startsWith(`+++`)||e.startsWith(`---`)?`hunk`:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`}var G=300;function K(e){let t=o(e.dataRev),[n,r]=u(`edits`,t);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(f,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,O.jsx)(g,{}):(0,O.jsx)(q,{install:n,...e},n?.id||``)]})}function q({install:e,onMutated:t,onAction:n,dataRev:i,overview:a}){let o=y(),{data:c,error:l,reload:u}=s(()=>r.diff(d(e)),[i]),[f,p]=(0,D.useState)(!1),[m,h]=(0,D.useState)(``),[_,b]=(0,D.useState)(()=>new Set),[C,w]=(0,D.useState)(()=>new Set),[T,E]=(0,D.useState)(null);if(c&&c!==T){E(c),b(new Set);let e=c.files.reduce((e,t)=>e+t.diff.length,0);w(new Set(e<=G?c.files.map(e=>e.rel):[]))}let k=e=>b(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),A=()=>b(e=>e.size===N.length?new Set:new Set(N.map(e=>e.rel))),j=()=>n?.(`export`),M=async()=>{let n=[..._],i=n.filter(e=>c.files.find(t=>t.rel===e)?.status===`added`),a=i.length?`Restoring will DELETE ${i.length} deployed-only file(s):\n${i.join(`
2
- `)}\n\n`:``;if(await o(`${a}Discard local edits and restore ${n.length} file(s) from source?`,{title:`Restore from source?`,confirmLabel:`Restore`,tone:`danger`})){p(!0);try{let i=await r.restore(n,d(e)),a=i.errors.length?` · ${i.errors.length} error(s): ${i.errors.join(`; `)}`:``;h(`Restored ${i.restored.length}, archived ${i.deleted.length}${a}`),await u(),t?.()}catch(e){h(e.message)}finally{p(!1)}}};if(l)return(0,O.jsx)(v,{error:l,onRetry:u});if(!c)return(0,O.jsx)(g,{});if(!c.deployed)return(0,O.jsx)(S,{title:`Nothing installed here`,children:`Nothing to compare.`});if(!c.diffable)return(0,O.jsx)(S,{title:`No local-edit check for this install`,docs:{href:`#/installs/hosts`,label:`See every install in Hosts`},children:`Local edits are only checked for global installs. Pick a global install above.`});let N=c.files.filter(e=>e.status!==`linked`&&e.status!==`stale`),P=c.files.filter(e=>e.status===`linked`),F=c.files.filter(e=>e.status===`stale`),I=N.filter(e=>e.status===`edited`).length,L=N.filter(e=>e.status===`added`).length,R=N.filter(e=>e.status===`missing`).length,z=e=>w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`h`,children:`Local edits`}),c.target?(0,O.jsxs)(`p`,{className:`sub`,children:[`Comparing `,(0,O.jsx)(`code`,{children:c.target}),c.theme?` (${c.theme} voice)`:``,` with source`,` `,a?.version||`unknown`,`.`]}):null,I>0?(0,O.jsx)(`p`,{className:`sub`,children:`The agent refines its own deployed files in place. A rebuild keeps an edited file, which then stops receiving source updates — export it, then Restore to take the new source.`}):L+R>0?(0,O.jsx)(`p`,{className:`sub`,children:`These files differ from the source: added in the install, or missing from it.`}):null]}),(0,O.jsxs)(`div`,{className:`row gap-10`,children:[(0,O.jsxs)(`button`,{className:`btn ghost danger-line`,disabled:f||_.size===0,onClick:M,children:[`Restore`,_.size?` (${_.size})`:``]}),(0,O.jsxs)(`button`,{className:`btn`,disabled:f,onClick:j,children:[(0,O.jsx)(x,{name:`download`}),`Export improvements`]})]})]}),m?(0,O.jsx)(`p`,{className:`sub mb-14`,children:m}):null,P.length?(0,O.jsxs)(`p`,{className:`sub dim mb-14`,title:P.map(e=>e.rel).join(`
3
- `),children:[P.length,` linked — yours, left alone`]}):null,N.length===0&&F.length===0?(0,O.jsx)(S,{title:`In sync`,children:`This install matches its source.`}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`row between mb-14`,children:[(0,O.jsxs)(`div`,{className:`row gap-10`,children:[(0,O.jsxs)(`span`,{className:`badge warn`,children:[(0,O.jsx)(`span`,{className:`dot`}),I,` edited`]}),(0,O.jsxs)(`span`,{className:`badge`,children:[(0,O.jsx)(`span`,{className:`dot`}),L,` added`]}),R>0&&(0,O.jsxs)(`span`,{className:`badge bad`,children:[(0,O.jsx)(`span`,{className:`dot`}),R,` missing`]}),F.length>0&&(0,O.jsxs)(`span`,{className:`badge`,children:[(0,O.jsx)(`span`,{className:`dot`}),F.length,` behind`]})]}),(0,O.jsxs)(`div`,{className:`row gap-10`,children:[(0,O.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>w(new Set(c.files.map(e=>e.rel))),children:`Expand all`}),(0,O.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>w(new Set),children:`Collapse all`}),N.length?(0,O.jsxs)(`label`,{className:`row gap-8 dim sel-all`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:_.size===N.length,onChange:A}),`Select all`]}):null]})]}),(0,O.jsx)(`div`,{className:`stack gap-12`,children:N.map(e=>B(e,!0))}),F.length?(0,O.jsxs)(`div`,{className:`stack gap-12 diff-behind`,children:[(0,O.jsx)(`h3`,{children:`Behind source`}),(0,O.jsxs)(`div`,{className:`row between`,children:[(0,O.jsx)(`p`,{className:`sub`,children:`This install is built from older source. Rebuild to bring these files in sync.`}),(0,O.jsx)(`button`,{className:`btn ghost`,disabled:f,onClick:()=>n?.(`build-all`),"aria-label":`Rebuild all installs`,children:`Rebuild`})]}),F.map(e=>B(e,!1))]}):null]})]});function B(e,t){let n=C.has(e.rel),r=e.status===`stale`||e.status===`added`?``:e.status===`missing`?`bad`:`warn`;return(0,O.jsxs)(`div`,{className:`card diff-file${n?` open`:``}`,children:[(0,O.jsxs)(`div`,{className:`diff-head`,children:[t?(0,O.jsx)(`input`,{type:`checkbox`,className:`chk`,checked:_.has(e.rel),onChange:()=>k(e.rel),onClick:e=>e.stopPropagation(),"aria-label":`Select ${e.rel}`}):null,(0,O.jsx)(`span`,{className:`fname`,children:e.rel}),(0,O.jsxs)(`span`,{className:`badge ${r}`,children:[(0,O.jsx)(`span`,{className:`dot`}),e.status===`stale`?`behind source`:e.status]}),(0,O.jsxs)(`span`,{className:`dim mono diff-lines`,children:[e.diff.length,` lines`]}),(0,O.jsx)(`button`,{className:`iconbtn`,onClick:()=>z(e.rel),"aria-label":n?`Collapse ${e.rel}`:`Expand ${e.rel}`,"aria-expanded":n,children:(0,O.jsx)(x,{name:`chevron`})})]}),n&&(0,O.jsx)(`div`,{className:`diff-body`,children:e.diff.map((e,t)=>(0,O.jsx)(`div`,{className:`diff-line ${W(e)}`,children:e},t))})]},e.rel)}}function J({group:e,i:t}){let n=e.problems.length===0,[r,i]=(0,D.useState)(!n);return(0,O.jsxs)(`div`,{className:`card check rise ${n?``:`bad`} ${r?`open`:``}`,style:{"--i":t*.6},children:[(0,O.jsxs)(`button`,{className:`check-head`,onClick:()=>i(e=>!e),disabled:n,"aria-expanded":n?void 0:r,children:[(0,O.jsx)(`span`,{className:`feed-dot ${n?`ok`:`bad`}`}),(0,O.jsx)(`h3`,{children:e.label}),(0,O.jsxs)(`span`,{className:`badge ${n?`ok`:`bad`}`,children:[(0,O.jsx)(`span`,{className:`dot`}),n?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`]}),!n&&(0,O.jsx)(x,{name:`chevron`,className:`chev glyph`})]}),!n&&r&&(0,O.jsx)(`div`,{className:`check-body`,children:e.problems.map(e=>(0,O.jsxs)(`div`,{className:`problem`,children:[(0,O.jsx)(`span`,{className:`x`,children:`✕`}),(0,O.jsx)(`span`,{children:e})]},e))})]})}function Y({dataRev:e}){let t=o(e),[n,r]=u(`doctor`,t);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(f,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,O.jsx)(g,{}):(0,O.jsx)(X,{install:n,dataRev:e},n?.id||``)]})}function X({install:e,dataRev:t}){let n=(0,D.useRef)(!1),{data:i,error:a,reload:o,setData:c}=s(()=>{let t=n.current;return n.current=!1,r.doctor(t,d(e))},[t]),l=()=>{n.current=!0,c(null),o()};if(a)return(0,O.jsx)(v,{error:a,onRetry:o});let u=i?i.groups.filter(e=>e.problems.length):[],f=i?i.groups.filter(e=>!e.problems.length):[];return(0,O.jsxs)(`div`,{className:`page-fill`,children:[(0,O.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`h`,children:`Doctor`}),(0,O.jsx)(`p`,{className:`sub`,children:`Builds this install’s voice in a sandbox and validates the result: token resolution, link integrity, parity, and local edits.`})]}),(0,O.jsxs)(`button`,{className:`btn`,onClick:l,disabled:!i,children:[(0,O.jsx)(x,{name:`refresh`}),i?`Run doctor`:`Running…`]})]}),i?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`card pad-md mb-16 doc-summary`,children:(0,O.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,O.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,O.jsxs)(`span`,{className:`dim mono`,children:[`validated `,i.themes.length,` voice`,i.themes.length===1?``:`s`]}),i.checked_at?(0,O.jsxs)(`span`,{className:`dim mono`,title:i.checked_at,children:[`checked `,i.checked_at.slice(11)]}):null,i.themes.map(e=>(0,O.jsx)(`span`,{className:`badge cap`,children:e},e))]}),i.ok?(0,O.jsxs)(`span`,{className:`badge ok`,children:[(0,O.jsx)(`span`,{className:`dot`}),`all clean`]}):(0,O.jsxs)(`span`,{className:`badge bad`,children:[(0,O.jsx)(`span`,{className:`dot`}),i.problems.length,` problem`,i.problems.length===1?``:`s`]})]})}),(0,O.jsxs)(`div`,{className:`stack gap-12`,children:[u.map((e,t)=>(0,O.jsx)(J,{group:e,i:t},e.label)),f.length?(0,O.jsxs)(`details`,{className:`check-fold`,children:[(0,O.jsxs)(`summary`,{children:[f.length,` clean check`,f.length===1?``:`s`]}),(0,O.jsx)(`div`,{className:`stack gap-12`,children:f.map((e,t)=>(0,O.jsx)(J,{group:e,i:u.length+t},e.label))})]}):null]})]}):(0,O.jsx)(g,{label:`Running every check (builds this install’s voice in a sandbox)…`})]})}function ie({tab:e=`hosts`,overview:t,setup:n,themes:r,onAction:a,onMutated:o,dataRev:s}){return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(i,{title:`Installs`,sub:`Where the harness lives on this machine, and how each copy is built.`}),(0,O.jsx)(C,{page:`installs`,current:e,label:`Installs`}),e===`hosts`&&(0,O.jsx)(U,{onAction:a,themes:r,currentTheme:t?.theme,overview:t,setup:n,dataRev:s,onMutated:o}),e===`edits`&&(0,O.jsx)(K,{onMutated:o,onAction:a,dataRev:s,overview:t}),e===`doctor`&&(0,O.jsx)(Y,{dataRev:s})]})}export{ie as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Et as i,G as a,J as o,Q as s,U as c,Y as l,Z as u,at as d,bt as f,ct as p,ft as m,gt as h,ht as g,it as _,rt as v,vt as y,xt as b,yt as x}from"./index-BQwOmbor.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{t as C}from"./Tabs-C2oW7oEj.js";import{n as w,r as T,t as E}from"./controls-D4wmg_pl.js";var D=e(t(),1),O=n();function k({host:e,theme:t,options:n,onAction:i,onClose:a,onNote:o}){let[s,c]=(0,D.useState)({path:``,host:e,theme:t,footprint:`lean`,posture:`peer`,mode:`direct`,trust:`balanced`}),[l,u]=(0,D.useState)(!1),[d,f]=(0,D.useState)(``),p=(e,t)=>c(n=>({...n,[e]:t})),h=async()=>{u(!0),o(``);try{let e=await r.pickFolder();e.path?(p(`path`,e.path),f(``)):e.error&&o(e.error)}catch(e){o(e.message)}finally{u(!1)}},_=async()=>{let e=s.path.trim();e?(f(``),o(``),await i?.(`deploy`,{host:s.host,path:e,theme:s.theme,footprint:s.footprint,posture:s.posture,mode:s.mode,trust:s.trust})&&a()):f(`Choose or type a folder to deploy into.`)};return(0,O.jsxs)(`div`,{className:`deploy-pop`,children:[(0,O.jsxs)(`div`,{className:`dp-row`,children:[(0,O.jsx)(`input`,{className:`inp dp-path`,type:`text`,placeholder:`/path/to/project, or click Browse…`,value:s.path,onChange:e=>{p(`path`,e.target.value),f(``)},onKeyDown:e=>e.key===`Enter`&&_(),"aria-label":`Folder to deploy into`,"aria-invalid":d?!0:void 0,"aria-describedby":d?`dp-path-err`:void 0}),(0,O.jsx)(`button`,{className:`btn ghost sm`,disabled:l,onClick:h,children:l?`Choosing…`:`Browse…`})]}),d?(0,O.jsx)(`p`,{id:`dp-path-err`,className:`tag bad note`,role:`alert`,children:d}):null,(0,O.jsxs)(`div`,{className:`dp-row`,children:[(0,O.jsxs)(`label`,{className:`dp-field`,children:[(0,O.jsx)(`span`,{children:`Deploy as`}),(0,O.jsx)(`select`,{className:`sel`,"aria-label":`host for the new install`,value:s.host,onChange:e=>p(`host`,e.target.value),children:m.map(e=>(0,O.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,O.jsx)(w,{value:s,options:n,onChange:p,who:`the new install`}),(0,O.jsx)(`button`,{className:`btn ghost sm`,onClick:_,children:`Deploy`}),(0,O.jsx)(`button`,{className:`btn ghost sm`,onClick:a,children:`Cancel`})]}),(0,O.jsxs)(`p`,{className:`sub dp-note`,children:[`Adds a per-repo harness (`,(0,O.jsx)(`code`,{children:g(s.host).deployAdds}),`) into the folder, non-destructively. It’s then tracked here even after you leave its directory.`]})]})}function A(){let{data:e,error:t,reload:n}=i(()=>r.excludes(),[]),[a,o]=(0,D.useState)(!1),[s,c]=(0,D.useState)([]),l=async(e,t)=>{o(!0);try{let n=await r.excludeMutate(e,t);c(n.messages||[])}catch(e){c(e.body?.messages||[e.message])}finally{o(!1),n()}};return t||!e?.installs?.length?null:(0,O.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,O.jsx)(`div`,{className:`card-head`,children:(0,O.jsx)(`h3`,{children:`Excluded folders`})}),(0,O.jsx)(`p`,{className:`sub mb-16`,children:`Sovereign repos: inside these folders every global harness goes dormant — hooks stay silent and the global preamble is not loaded.`}),(e.excludes||[]).map(e=>(0,O.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,O.jsx)(`code`,{children:e.path}),(0,O.jsx)(`span`,{className:`mono muted`,children:e.hosts.map(e=>g(e).label).join(`, `)}),(0,O.jsx)(`button`,{className:`btn ghost sm`,disabled:a,"aria-label":`Stop excluding ${e.path}`,onClick:()=>l(`remove`,e.path),children:`Remove`})]},e.path)),(0,O.jsxs)(`button`,{className:`btn ghost sm`,disabled:a,onClick:async()=>{o(!0);try{let e=await r.pickFolder();e.path?await l(`add`,e.path):e.error&&c([e.error])}catch(e){c([e.message])}finally{o(!1)}},children:[(0,O.jsx)(f,{name:`folder`}),` Exclude a folder…`]}),s.map((e,t)=>(0,O.jsx)(`p`,{className:`sub`,children:e},t))]})}var j=`This project sees your machine-wide rules, profile and memory map, so what you taught one tool or repo applies here too.`,M=`About 1 500 tokens at every session start, growing with your rules. The hook budget is fixed at 9 000 characters, and the tier loads before this project's docs, so a large tier can push them down to a lazy listing.`;function N({targets:e,onReveal:t}){let n=e.flatMap(e=>e.servers);return(0,O.jsxs)(`div`,{className:`ip-block`,children:[(0,O.jsxs)(`span`,{className:`ip-label`,children:[`MCP servers `,(0,O.jsx)(`span`,{className:`mono dim`,children:n.length})]}),e.map(e=>(0,O.jsxs)(`div`,{className:`mcp-target`,children:[(0,O.jsxs)(`div`,{className:`mt-head`,children:[(0,O.jsx)(`code`,{title:e.path,children:e.label}),e.exists?(0,O.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>t(e),"aria-label":`Open the folder holding ${e.label}`,title:`Open the folder holding ${e.path} to edit it`,children:`Open folder`}):null]}),e.exists?e.servers.length?e.servers.map(e=>(0,O.jsxs)(`div`,{className:`mcp-row`,children:[(0,O.jsx)(`span`,{className:`mono`,children:e.name}),(0,O.jsx)(`span`,{className:`tag ${e.state===`enabled`?`ok`:`warn`}`,children:e.state===`enabled`?`Enabled`:`Disabled`})]},e.name)):(0,O.jsx)(`p`,{className:`sub`,children:`None configured in this file.`}):(0,O.jsxs)(`p`,{className:`sub`,children:[`No MCP file yet (it would be `,(0,O.jsx)(`code`,{children:e.path}),`).`]})]},e.path))]})}var P={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`],absent:[`Not installed`,``]};function F({inst:e,targets:t,choice:n,unchanged:r,options:i,onPick:a,canAct:o,busy:s,memory:c,onMemory:l,onApply:u,onToggleInstall:d,onRemove:f,onRevealMcp:p}){let m=`${g(e.host).label} · ${e.scope}`,[_,v]=P[e.state]||P.absent,y=e.state===`active`,b=e.state===`absent`;return(0,O.jsxs)(`aside`,{className:`install-panel`,"aria-label":`${m} install`,children:[(0,O.jsx)(`span`,{className:`ip-eyebrow`,children:`Selected install`}),(0,O.jsxs)(`div`,{className:`ip-head`,children:[(0,O.jsx)(`h2`,{children:h(e)}),(0,O.jsx)(`span`,{className:`tag ${v}`,children:_})]}),(0,O.jsx)(`span`,{className:`ip-kind`,children:e.scope===`global`?`Global install`:`Per-project install · ${g(e.host).label}`}),(0,O.jsx)(`code`,{className:`ip-path`,children:e.path}),b?(0,O.jsxs)(`p`,{className:`sub`,children:[`Install Geneseed here as `,(0,O.jsx)(`strong`,{children:g(e.host).label}),`. Files are added non-destructively; deactivate or uninstall later.`]}):null,(y||b)&&o?(0,O.jsxs)(`div`,{className:`ip-picks`,children:[(0,O.jsx)(w,{value:n,options:i,onChange:a,who:m}),(0,O.jsxs)(`p`,{className:`sub`,children:[n.footprint===`lean`?`Lean footprint: terse rule lines and a pointer to the full file, about 40% smaller.`:`Full footprint: every rule’s complete text inline, the largest context.`,` `,`Every rule stays in force. `,(0,O.jsx)(`a`,{href:`#/docs/footprint`,children:`Learn more →`})]})]}):null,(y||b)&&o&&e.scope!==`global`?(0,O.jsxs)(`div`,{className:`ip-block`,children:[(0,O.jsxs)(`label`,{className:`ip-switch`,children:[(0,O.jsx)(T,{on:!!n.sharedTier,label:`shared tier for ${m}`,onToggle:()=>a(`sharedTier`,!n.sharedTier)}),(0,O.jsx)(`span`,{children:`Read the machine-wide shared tier`})]}),(0,O.jsxs)(`p`,{className:`sub`,children:[(0,O.jsx)(`strong`,{children:`Benefit:`}),` `,j]}),(0,O.jsxs)(`p`,{className:`sub`,children:[(0,O.jsx)(`strong`,{children:`Cost:`}),` `,M]})]}):null,y&&t.length?(0,O.jsx)(N,{targets:t,onReveal:p}):null,y&&e.scope===`global`?(0,O.jsx)(A,{}):null,b?null:(0,O.jsxs)(`label`,{className:`ip-switch`,children:[(0,O.jsx)(T,{on:y,disabled:s,label:`activate ${m}`,onToggle:d}),(0,O.jsx)(`span`,{children:y?`Active: loads in every session`:`Disabled: files moved aside`})]}),(0,O.jsx)(`div`,{className:`ip-spacer`}),o?(0,O.jsxs)(`div`,{className:`ip-actions`,children:[b?(0,O.jsx)(`button`,{type:`button`,className:`btn`,onClick:u,children:`Install`}):y?(0,O.jsx)(`button`,{type:`button`,className:`btn`,disabled:r,onClick:u,children:`Apply and rebuild`}):null,b?null:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`label`,{className:`field`,children:[(0,O.jsx)(`span`,{children:`On uninstall, memory and notebook`}),(0,O.jsxs)(`select`,{className:`sel`,value:c,onChange:e=>l(e.target.value),children:[(0,O.jsx)(`option`,{value:`keep`,children:`keep in place`}),(0,O.jsx)(`option`,{value:`archive`,children:`archive aside`}),(0,O.jsx)(`option`,{value:`delete`,children:`delete too`})]})]}),(0,O.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,"aria-label":`remove ${m} from ${e.path}`,disabled:s,onClick:f,children:`Uninstall…`})]})]}):null]})}function I({dataRev:e}){let{data:t,error:n,reload:a}=i(()=>r.migratePreview(),[e]);return(0,O.jsxs)(`section`,{className:`panel`,"aria-labelledby":`preview-h`,children:[(0,O.jsx)(`div`,{className:`panel-head`,children:(0,O.jsx)(`h2`,{id:`preview-h`,children:`Next rebuild`})}),n?(0,O.jsx)(v,{error:n,onRetry:a}):t?(0,O.jsxs)(O.Fragment,{children:[t.folds.length?(0,O.jsx)(`ul`,{className:`preview-list`,children:t.folds.map(e=>(0,O.jsxs)(`li`,{children:[(0,O.jsx)(`b`,{className:`mono`,children:e.host}),` `,e.summary||`nothing to fold`,e.failed.map(e=>(0,O.jsxs)(`div`,{className:`t-warn`,children:[`The fold would stop at `,e]},e))]},e.host))}):(0,O.jsx)(`p`,{className:`dim`,children:`No global install to fold.`}),t.orphans.length?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`h3`,{children:`Orphans`}),(0,O.jsx)(`p`,{className:`dim`,children:`No manifest owns these. An earlier build may have written them, or they may be yours. Nothing moves them: if one is not yours, move it by hand.`}),(0,O.jsx)(`ul`,{className:`preview-list mono`,children:t.orphans.map(e=>(0,O.jsx)(`li`,{children:e},e))})]}):null]}):(0,O.jsx)(_,{})]})}var L=(e,t)=>`${e} ${t}`,R=[`claude`,`bob`,`openclaude`],z={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},B=/[\\/]\.claude[\\/]worktrees[\\/]/,V=e=>e.scope===`project`&&B.test(e.path);function ee(e,t){let n=e.drift?.stale??0,r={behind:`Behind ${t||`source`}`+(n?` · ${n} file${n===1?``:`s`}`:``),synced:`In sync`,unknown:`Not checked`}[e.verdict],i=e.diffable?b(e.drift):0;return i?`${r} · ${i} edited`:r}function te({inst:e,fleet:t,version:n,onEdits:r}){if(t===void 0)return(0,O.jsx)(`span`,{className:`dim`,children:`…`});if(!t)return(0,O.jsx)(`span`,{className:`dim`,children:`—`});let i=t.drift?.stale??0,a=t.diffable?b(t.drift):0;return(0,O.jsxs)(`div`,{className:`sync-cell`,children:[t.diffable&&i+a>0?(0,O.jsx)(c,{label:`Sync with source of ${h(e)}`,parts:[{key:`stale`,label:`behind source`,n:i,tone:`warn`},{key:`edited`,label:`local edits`,n:a,tone:`bad`}]}):null,(0,O.jsx)(`span`,{className:`dim`,children:ee(t,n)}),t.diffable?null:(0,O.jsxs)(`span`,{className:`dim`,title:`Local edits are only checked for global installs`,children:[` `,`· not checkable`]}),a?(0,O.jsxs)(O.Fragment,{children:[` `,(0,O.jsx)(`a`,{href:`#/installs/edits`,onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e)},children:`Local edits`})]}):null]})}function H({rows:e,project:t,currentId:n,onPick:r,label:i,fleet:a,onEdits:o,onDefault:s,busyKey:c}){let l=e=>a===void 0?void 0:a?.installs?.find(t=>t.id===e.id)||null;return(0,O.jsx)(`div`,{className:`tbl-scroll`,children:(0,O.jsxs)(`table`,{className:`tbl hosts-tbl`,"aria-label":i,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{scope:`col`,children:t?`Project`:`Host`}),(0,O.jsx)(`th`,{scope:`col`,children:`State`}),(0,O.jsx)(`th`,{scope:`col`,children:`Sync with source`}),(0,O.jsx)(`th`,{scope:`col`,children:(0,O.jsx)(`span`,{className:`sr-only`,children:`Selected`})})]})}),(0,O.jsx)(`tbody`,{children:e.map(e=>{let[i,u]=z[e.state]||[`Not installed`,``],d=n===e.id,f=e.state===`absent`;return(0,O.jsxs)(`tr`,{className:`pickable${d?` on`:``}${f?` quiet`:``}`,onClick:()=>r(e.id),children:[(0,O.jsxs)(`td`,{children:[(0,O.jsx)(`button`,{type:`button`,className:`row-pick`,"aria-pressed":d,title:e.path,onClick:()=>r(e.id),children:h(e)}),(0,O.jsx)(`div`,{className:`mono path-cell`,title:e.path,children:t?g(e.host).label:e.path})]}),(0,O.jsxs)(`td`,{children:[(0,O.jsx)(`span`,{className:`tag ${u}`,children:i}),e.default?(0,O.jsxs)(O.Fragment,{children:[` `,(0,O.jsx)(`span`,{className:`tag`,title:`A page that names no install reads this one, and pickers start on it`,children:`Default`})]}):e.state===`active`&&s?(0,O.jsxs)(O.Fragment,{children:[` `,(0,O.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Make ${h(e)} the default install`,disabled:c===e.id,onClick:t=>{t.stopPropagation(),s(e)},children:`Make default`})]}):null,V(e)?(0,O.jsxs)(O.Fragment,{children:[` `,(0,O.jsx)(`span`,{className:`tag warn`,title:`Inside a .claude/worktrees folder: likely a finished worktree. Remove it from its panel.`,children:`Worktree leftover`})]}):null]}),(0,O.jsx)(`td`,{children:(0,O.jsx)(te,{inst:e,fleet:l(e),version:a?.version,onEdits:o})}),(0,O.jsx)(`td`,{className:`pick-mark`,children:d?`Editing ›`:``})]},e.id)})})]})})}function ne({themes:e,current:t}){if(!e.length||!t)return null;let n=[...e].sort((e,n)=>e.name===t?-1:+(n.name===t));return(0,O.jsxs)(`details`,{className:`panel voice-ref`,children:[(0,O.jsxs)(`summary`,{children:[(0,O.jsx)(`span`,{className:`vr-title`,children:`Voices`}),(0,O.jsxs)(`span`,{className:`mono dim`,children:[e.length,` to choose from, set per install`]})]}),(0,O.jsx)(`div`,{className:`vr-list`,children:n.map(e=>(0,O.jsxs)(`div`,{className:`voice-row${e.name===t?` current`:``}`,children:[(0,O.jsx)(`span`,{className:`vr-name`,children:e.name}),(0,O.jsx)(`span`,{className:`vr-desc`,children:e.tagline?`“${e.tagline}”`:e.blurb})]},e.name))})]})}function re({setup:e,overview:t}){if(!e)return null;let n=e.installed_fp&&e.installed_fp===e.source_fp;return(0,O.jsxs)(`section`,{className:`panel`,"aria-labelledby":`checkout-h`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`h2`,{id:`checkout-h`,children:`This checkout`}),(0,O.jsx)(`span`,{className:`mono ${n?`t-good`:`t-warn`}`,children:n?`in sync`:e.version_verdict})]}),(0,O.jsxs)(`dl`,{className:`kv-grid`,children:[(0,O.jsx)(`dt`,{children:`Source`}),(0,O.jsx)(`dd`,{className:`mono`,children:e.root}),(0,O.jsx)(`dt`,{children:`Version`}),(0,O.jsx)(`dd`,{className:`mono`,children:t?.version||`unknown`}),(0,O.jsx)(`dt`,{children:`Fingerprint`}),(0,O.jsx)(`dd`,{className:`mono`,children:e.source_fp})]})]})}function U({onAction:e,themes:t=[],currentTheme:n,overview:a,setup:s,dataRev:c,onMutated:u}){let d=p(),{data:m,error:y,reload:b}=i(()=>r.installs(),[c]),{data:C,error:w,reload:T}=i(()=>r.mcp(),[c]),{data:A,error:j}=i(()=>r.fleet(),[c]),M=j?null:A??void 0,[N,P]=(0,D.useState)(null),[z,B]=(0,D.useState)(``),[V,ee]=(0,D.useState)({}),[te,U]=(0,D.useState)(!1),[W,G]=(0,D.useState)(!1),[K,q]=(0,D.useState)({id:``,value:`keep`}),J=e=>K.id===e?.id?K.value:`keep`,[Y,X]=(0,D.useState)(()=>l(`hosts`)),ie=(0,D.useMemo)(()=>{let e={};for(let t of C?.targets||[]){let n=L(t.host||`opencode`,t.root);(e[n]||(e[n]=[])).push(t)}return e},[C]);if(y||w)return(0,O.jsx)(v,{error:y||w,onRetry:()=>{b(),T()}});if(!m||!C)return(0,O.jsx)(_,{});let ae={active:0,disabled:1,absent:2},Z=[...m.installs].sort((e,t)=>(e.scope===`global`?0:1)-(t.scope===`global`?0:1)||(ae[e.state]??3)-(ae[t.state]??3)),Q=Z.find(e=>e.id===Y)||Z.find(e=>e.default)||Z.find(e=>e.state===`active`)||Z[0],$=e=>{let t=V[e.id]||{};return{theme:t.theme||e.theme||n||`neutral`,footprint:t.footprint||e.state!==`absent`&&e.footprint||`lean`,posture:t.posture||e.posture||`peer`,mode:t.mode||e.mode||`direct`,trust:t.trust||e.trust||`balanced`,sharedTier:t.sharedTier??!!e.sharedTier}},oe=(e,t,n)=>ee(r=>({...r,[e.id]:{...r[e.id],[t]:n}})),se=e=>{let t=$(e);return t.theme===e.theme&&t.footprint===(e.footprint||`lean`)&&t.posture===(e.posture||`peer`)&&t.mode===(e.mode||`direct`)&&t.trust===(e.trust||`balanced`)&&(e.scope===`global`||t.sharedTier===!!e.sharedTier)},ce={theme:t.map(e=>e.name),footprint:E,posture:m.postures||[],mode:m.modes||[],trust:m.trusts||[]},le=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o,sharedTier:s}=$(t),c=g(t.host).label,l=`${r} footprint, ${i} posture, ${a} mode, ${o} loop trust`,u=t.state===`absent`?`Install Geneseed for ${c} into ${t.path} with the “${n}” voice (${l})? Files are added non-destructively (your own config is left untouched); deactivate or uninstall later.`:`Rebuild this ${c} install (voice “${n}”, ${l})? It rebuilds in place, non-destructive.`;await d(u,{title:t.state===`absent`?`Install Geneseed?`:`Rebuild this install?`,confirmLabel:t.state===`absent`?`Install`:`Rebuild`})&&e?.(`install`,{host:t.host,scope:t.scope,path:t.path,theme:n,footprint:r,posture:i,mode:a,trust:o,...t.scope===`global`?{}:{sharedTier:s}})},ue=async e=>{if(e.state!==`active`||await d(`Deactivate this install? Files are moved aside, not deleted; reactivate any time.`,{title:`Deactivate this install?`,confirmLabel:`Deactivate`})){B(e.id),P(null);try{let t=await r.installToggle(e.host,e.path,e.state===`active`?`deactivate`:`activate`);if(!t.ok){let e=Array.isArray(t.failed)?t.failed.join(`, `):``;P({text:t.error||e&&`unrestored: ${e}`||`action failed`,tone:`bad`});return}u?.()}catch(e){P({text:e.message,tone:`bad`})}finally{B(``)}}},de=async e=>{B(e.id),P(null);try{await r.setDefaultInstall(e.host,e.path),u?.()}catch(e){P({text:e.message,tone:`bad`})}finally{B(``)}},fe=(e,t)=>{let n=e.path.includes(`\\`)&&!e.path.includes(`/`)?`\\`:`/`,r=e.path.replace(/[\\/]+$/,``);return`${e.scope===`project`&&R.includes(e.host)?`${r}${n}.${e.host}`:r}${n}${t}`},pe=async e=>{let t=J(e),n=e.scope===`project`?` and de-lists it`:`; the row stays, marked “not installed”`,i=t===`delete`?`, and permanently deletes ${fe(e,`memory`)} and ${fe(e,`notebook`)}`:t===`archive`?`; memory and notebook are archived aside`:`; memory and notebook stay in place`;if(await d(`Uninstall ${g(e.host).label} · ${e.scope}? It deletes ${x(e.host,e.scope)}${n}${i}. This can’t be undone.`,{title:e.scope===`project`?`Remove this install?`:`Remove the global install?`,confirmLabel:t===`delete`?`Remove and delete memory`:`Remove`,tone:`danger`})){B(e.id),P(null);try{let n=await r.installRemove(e.host,e.path,t);if(!n.ok){P({text:n.error||`remove failed`,tone:`bad`});return}q({id:``,value:`keep`}),n.kept?.length&&P({text:`Removed. Kept ${n.kept.length} file(s) you edited: ${n.kept.join(`, `)} — they are yours now (the CLI geneseed uninstall --force deletes edited files too).`,tone:`ok`}),u?.()}catch(e){P({text:e.message,tone:`bad`})}finally{B(``)}}},me=async e=>{P(null);try{let t=await r.mcpReveal(e.path);P({text:`Opening ${t.dir}. If no window appeared, open that folder by hand.`,tone:``})}catch(e){P({text:e.message,tone:`bad`})}},he=async()=>{let t=Z.filter(e=>e.state===`active`).map(e=>`${h(e)} · ${e.scope}`);await d(`Rebuild every active install: ${t.join(`, `)||`none`}? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&e(`build-all`)},ge=Z.find(e=>e.default)?.host||Z.find(e=>e.state===`active`)?.host||Z[0]?.host||`opencode`,_e=Z.filter(e=>e.scope===`global`),ve=Z.filter(e=>e.scope!==`global`),ye=e=>{X(e)},be=e=>{o(`edits`,e.id),window.location.hash=`#/installs/edits`};return(0,O.jsxs)(`div`,{className:`hosts`,children:[(0,O.jsxs)(`div`,{className:`hosts-main`,children:[(0,O.jsxs)(`div`,{className:`toolbar`,children:[(0,O.jsxs)(`span`,{className:`dim`,children:[Z.filter(e=>e.state!==`absent`).length,` installed.`]}),(0,O.jsxs)(`div`,{className:`row gap-8`,children:[(0,O.jsx)(`button`,{type:`button`,className:`btn ghost`,"aria-expanded":W,onClick:()=>G(e=>!e),children:`Preview next rebuild`}),e?(0,O.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:he,children:[(0,O.jsx)(f,{name:`refresh`}),` Rebuild all`]}):null]})]}),W?(0,O.jsx)(I,{dataRev:c}):null,N?.tone===`bad`?(0,O.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:N.text}):N?(0,O.jsx)(`p`,{className:`tag ${N.tone===`ok`?`ok `:``}note`,role:`status`,children:N.text}):null,(0,O.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-global`,children:[(0,O.jsx)(`div`,{className:`inst-head`,children:(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{id:`inst-global`,children:`Global installs`}),(0,O.jsx)(`p`,{className:`dim`,children:`One per tool. Loaded in every folder, except excluded ones.`})]})}),(0,O.jsx)(H,{rows:_e,currentId:Q?.id,onPick:ye,label:`Global installs`,fleet:M,onEdits:be,onDefault:e?de:void 0,busyKey:z})]}),(0,O.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-project`,children:[(0,O.jsxs)(`div`,{className:`inst-head`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{id:`inst-project`,children:`Per-project installs`}),(0,O.jsx)(`p`,{className:`dim`,children:`A repo with its own install. Inside it, only that install loads.`})]}),e?(0,O.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>U(e=>!e),children:[(0,O.jsx)(f,{name:`folder`}),` Deploy to a repo…`]}):null]}),te?(0,O.jsx)(`div`,{className:`inst-deploy`,children:(0,O.jsx)(k,{host:ge,theme:n||`neutral`,options:ce,onAction:e,onClose:()=>U(!1),onNote:e=>P(e?{text:e,tone:`bad`}:null)})}):null,ve.length?(0,O.jsx)(H,{rows:ve,project:!0,currentId:Q?.id,onPick:ye,label:`Per-project installs`,fleet:M,onEdits:be,onDefault:e?de:void 0,busyKey:z}):(0,O.jsx)(S,{children:`No repo has its own install yet. Deploy one to give a project its own rules and voice.`})]}),(0,O.jsx)(re,{setup:s,overview:a}),(0,O.jsx)(ne,{themes:t,current:a?.theme})]}),Q?(0,O.jsx)(F,{inst:Q,targets:ie[L(Q.host,Q.path)]||[],choice:$(Q),unchanged:se(Q),options:ce,onPick:(e,t)=>oe(Q,e,t),canAct:!!e,busy:z===Q.id,memory:J(Q),onMemory:e=>q({id:Q.id,value:e}),onApply:()=>le(Q),onToggleInstall:()=>ue(Q),onRemove:()=>pe(Q),onRevealMcp:me},Q.id):null]})}function W(e){return e.startsWith(`@@`)||e.startsWith(`+++`)||e.startsWith(`---`)?`hunk`:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`}var G=300;function K(e){let t=s(e.dataRev),[n,r]=u(`edits`,t);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(d,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,O.jsx)(_,{}):(0,O.jsx)(q,{install:n,...e},n?.id||``)]})}function q({install:e,onMutated:t,onAction:n,dataRev:a,overview:o}){let s=p(),{data:c,error:l,reload:u}=i(()=>r.diff(y(e)),[a]),[d,m]=(0,D.useState)(!1),[h,g]=(0,D.useState)(``),[b,x]=(0,D.useState)(()=>new Set),[C,w]=(0,D.useState)(()=>new Set),[T,E]=(0,D.useState)(null);if(c&&c!==T){E(c),x(new Set);let e=c.files.reduce((e,t)=>e+t.diff.length,0);w(new Set(e<=G?c.files.map(e=>e.rel):[]))}let k=e=>x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),A=()=>x(e=>e.size===N.length?new Set:new Set(N.map(e=>e.rel))),j=()=>n?.(`export`),M=async()=>{let n=[...b],i=n.filter(e=>c.files.find(t=>t.rel===e)?.status===`added`),a=i.length?`Restoring will DELETE ${i.length} deployed-only file(s):\n${i.join(`
2
+ `)}\n\n`:``;if(await s(`${a}Discard local edits and restore ${n.length} file(s) from source?`,{title:`Restore from source?`,confirmLabel:`Restore`,tone:`danger`})){m(!0);try{let i=await r.restore(n,y(e)),a=i.errors.length?` · ${i.errors.length} error(s): ${i.errors.join(`; `)}`:``;g(`Restored ${i.restored.length}, archived ${i.deleted.length}${a}`),await u(),t?.()}catch(e){g(e.message)}finally{m(!1)}}};if(l)return(0,O.jsx)(v,{error:l,onRetry:u});if(!c)return(0,O.jsx)(_,{});if(!c.deployed)return(0,O.jsx)(S,{title:`Nothing installed here`,children:`Nothing to compare.`});if(!c.diffable)return(0,O.jsx)(S,{title:`No local-edit check for this install`,docs:{href:`#/installs/hosts`,label:`See every install in Hosts`},children:`Local edits are only checked for global installs. Pick a global install above.`});let N=c.files.filter(e=>e.status!==`linked`&&e.status!==`stale`),P=c.files.filter(e=>e.status===`linked`),F=c.files.filter(e=>e.status===`stale`),I=N.filter(e=>e.status===`edited`).length,L=N.filter(e=>e.status===`added`).length,R=N.filter(e=>e.status===`missing`).length,z=e=>w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`h`,children:`Local edits`}),c.target?(0,O.jsxs)(`p`,{className:`sub`,children:[`Comparing `,(0,O.jsx)(`code`,{children:c.target}),c.theme?` (${c.theme} voice)`:``,` with source`,` `,o?.version||`unknown`,`.`]}):null,I>0?(0,O.jsx)(`p`,{className:`sub`,children:`The agent refines its own deployed files in place. A rebuild keeps an edited file, which then stops receiving source updates — export it, then Restore to take the new source.`}):L+R>0?(0,O.jsx)(`p`,{className:`sub`,children:`These files differ from the source: added in the install, or missing from it.`}):null]}),(0,O.jsxs)(`div`,{className:`row gap-10`,children:[(0,O.jsxs)(`button`,{className:`btn ghost danger-line`,disabled:d||b.size===0,onClick:M,children:[`Restore`,b.size?` (${b.size})`:``]}),(0,O.jsxs)(`button`,{className:`btn`,disabled:d,onClick:j,children:[(0,O.jsx)(f,{name:`download`}),`Export improvements`]})]})]}),h?(0,O.jsx)(`p`,{className:`sub mb-14`,children:h}):null,P.length?(0,O.jsxs)(`p`,{className:`sub dim mb-14`,title:P.map(e=>e.rel).join(`
3
+ `),children:[P.length,` linked — yours, left alone`]}):null,N.length===0&&F.length===0?(0,O.jsx)(S,{title:`In sync`,children:`This install matches its source.`}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`row between mb-14`,children:[(0,O.jsxs)(`div`,{className:`row gap-10`,children:[(0,O.jsxs)(`span`,{className:`badge warn`,children:[(0,O.jsx)(`span`,{className:`dot`}),I,` edited`]}),(0,O.jsxs)(`span`,{className:`badge`,children:[(0,O.jsx)(`span`,{className:`dot`}),L,` added`]}),R>0&&(0,O.jsxs)(`span`,{className:`badge bad`,children:[(0,O.jsx)(`span`,{className:`dot`}),R,` missing`]}),F.length>0&&(0,O.jsxs)(`span`,{className:`badge`,children:[(0,O.jsx)(`span`,{className:`dot`}),F.length,` behind`]})]}),(0,O.jsxs)(`div`,{className:`row gap-10`,children:[(0,O.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>w(new Set(c.files.map(e=>e.rel))),children:`Expand all`}),(0,O.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>w(new Set),children:`Collapse all`}),N.length?(0,O.jsxs)(`label`,{className:`row gap-8 dim sel-all`,children:[(0,O.jsx)(`input`,{type:`checkbox`,checked:b.size===N.length,onChange:A}),`Select all`]}):null]})]}),(0,O.jsx)(`div`,{className:`stack gap-12`,children:N.map(e=>B(e,!0))}),F.length?(0,O.jsxs)(`div`,{className:`stack gap-12 diff-behind`,children:[(0,O.jsx)(`h3`,{children:`Behind source`}),(0,O.jsxs)(`div`,{className:`row between`,children:[(0,O.jsx)(`p`,{className:`sub`,children:`This install is built from older source. Rebuild to bring these files in sync.`}),(0,O.jsx)(`button`,{className:`btn ghost`,disabled:d,onClick:()=>n?.(`build-all`),"aria-label":`Rebuild all installs`,children:`Rebuild`})]}),F.map(e=>B(e,!1))]}):null]})]});function B(e,t){let n=C.has(e.rel),r=e.status===`stale`||e.status===`added`?``:e.status===`missing`?`bad`:`warn`;return(0,O.jsxs)(`div`,{className:`card diff-file${n?` open`:``}`,children:[(0,O.jsxs)(`div`,{className:`diff-head`,children:[t?(0,O.jsx)(`input`,{type:`checkbox`,className:`chk`,checked:b.has(e.rel),onChange:()=>k(e.rel),onClick:e=>e.stopPropagation(),"aria-label":`Select ${e.rel}`}):null,(0,O.jsx)(`span`,{className:`fname`,children:e.rel}),(0,O.jsxs)(`span`,{className:`badge ${r}`,children:[(0,O.jsx)(`span`,{className:`dot`}),e.status===`stale`?`behind source`:e.status]}),(0,O.jsxs)(`span`,{className:`dim mono diff-lines`,children:[e.diff.length,` lines`]}),(0,O.jsx)(`button`,{className:`iconbtn`,onClick:()=>z(e.rel),"aria-label":n?`Collapse ${e.rel}`:`Expand ${e.rel}`,"aria-expanded":n,children:(0,O.jsx)(f,{name:`chevron`})})]}),n&&(0,O.jsx)(`div`,{className:`diff-body`,children:e.diff.map((e,t)=>(0,O.jsx)(`div`,{className:`diff-line ${W(e)}`,children:e},t))})]},e.rel)}}function J({group:e,i:t}){let n=e.problems.length===0,[r,i]=(0,D.useState)(!n);return(0,O.jsxs)(`div`,{className:`card check rise ${n?``:`bad`} ${r?`open`:``}`,style:{"--i":t*.6},children:[(0,O.jsxs)(`button`,{className:`check-head`,onClick:()=>i(e=>!e),disabled:n,"aria-expanded":n?void 0:r,children:[(0,O.jsx)(`span`,{className:`feed-dot ${n?`ok`:`bad`}`}),(0,O.jsx)(`h3`,{children:e.label}),(0,O.jsxs)(`span`,{className:`badge ${n?`ok`:`bad`}`,children:[(0,O.jsx)(`span`,{className:`dot`}),n?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`]}),!n&&(0,O.jsx)(f,{name:`chevron`,className:`chev glyph`})]}),!n&&r&&(0,O.jsx)(`div`,{className:`check-body`,children:e.problems.map(e=>(0,O.jsxs)(`div`,{className:`problem`,children:[(0,O.jsx)(`span`,{className:`x`,children:`✕`}),(0,O.jsx)(`span`,{children:e})]},e))})]})}function Y({dataRev:e}){let t=s(e),[n,r]=u(`doctor`,t);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(d,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,O.jsx)(_,{}):(0,O.jsx)(X,{install:n,dataRev:e},n?.id||``)]})}function X({install:e,dataRev:t}){let n=(0,D.useRef)(!1),{data:a,error:o,reload:s,setData:c}=i(()=>{let t=n.current;return n.current=!1,r.doctor(t,y(e))},[t]),l=()=>{n.current=!0,c(null),s()};if(o)return(0,O.jsx)(v,{error:o,onRetry:s});let u=a?a.groups.filter(e=>e.problems.length):[],d=a?a.groups.filter(e=>!e.problems.length):[];return(0,O.jsxs)(`div`,{className:`page-fill`,children:[(0,O.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`h2`,{className:`h`,children:`Doctor`}),(0,O.jsx)(`p`,{className:`sub`,children:`Builds this install’s voice in a sandbox and validates the result: token resolution, link integrity, parity, and local edits.`})]}),(0,O.jsxs)(`button`,{className:`btn`,onClick:l,disabled:!a,children:[(0,O.jsx)(f,{name:`refresh`}),a?`Run doctor`:`Running…`]})]}),a?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`card pad-md mb-16 doc-summary`,children:(0,O.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,O.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,O.jsxs)(`span`,{className:`dim mono`,children:[`validated `,a.themes.length,` voice`,a.themes.length===1?``:`s`]}),a.checked_at?(0,O.jsxs)(`span`,{className:`dim mono`,title:a.checked_at,children:[`checked `,a.checked_at.slice(11)]}):null,a.themes.map(e=>(0,O.jsx)(`span`,{className:`badge cap`,children:e},e))]}),a.ok?(0,O.jsxs)(`span`,{className:`badge ok`,children:[(0,O.jsx)(`span`,{className:`dot`}),`all clean`]}):(0,O.jsxs)(`span`,{className:`badge bad`,children:[(0,O.jsx)(`span`,{className:`dot`}),a.problems.length,` problem`,a.problems.length===1?``:`s`]})]})}),(0,O.jsxs)(`div`,{className:`stack gap-12`,children:[u.map((e,t)=>(0,O.jsx)(J,{group:e,i:t},e.label)),d.length?(0,O.jsxs)(`details`,{className:`check-fold`,children:[(0,O.jsxs)(`summary`,{children:[d.length,` clean check`,d.length===1?``:`s`]}),(0,O.jsx)(`div`,{className:`stack gap-12`,children:d.map((e,t)=>(0,O.jsx)(J,{group:e,i:u.length+t},e.label))})]}):null]})]}):(0,O.jsx)(_,{label:`Running every check (builds this install’s voice in a sandbox)…`})]})}function ie({tab:e=`hosts`,overview:t,setup:n,themes:r,onAction:i,onMutated:o,dataRev:s}){return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(a,{title:`Installs`,sub:`Where the harness lives on this machine, and how each copy is built.`}),(0,O.jsx)(C,{page:`installs`,current:e,label:`Installs`}),e===`hosts`&&(0,O.jsx)(U,{onAction:i,themes:r,currentTheme:t?.theme,overview:t,setup:n,dataRev:s,onMutated:o}),e===`edits`&&(0,O.jsx)(K,{onMutated:o,onAction:i,dataRev:s,overview:t}),e===`doctor`&&(0,O.jsx)(Y,{dataRev:s})]})}export{ie as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-BMFDSXoB.js";import{A as i,B as a,C as o,E as s,F as c,H as l,K as u,M as d,N as f,O as p,P as m,U as h,_ as g,a as _,d as ee,f as v,g as y,h as b,i as x,j as S,l as C,n as w,p as T,r as E,u as D,v as O,w as k,x as A}from"./motion-RlUl1osO.js";import{n as j}from"./sections-CtFz7HFH.js";import{Ct as M,E as N,Mt as P,Nt as F,Tt as I,jt as L,kt as R,wt as z}from"./index-BNttaGQb.js";import{n as B}from"./Dashboard-BUdUTjbB.js";function V(e){return k((e.iterationDuration+e._loopDelay)*e.iterationCount-e._loopDelay)||1e-11}function H(e,t,n,r,a,c){let l=i(e.duration)&&e.duration<=1e-11?n-h:n;t.composition&&O(t,l,1,1,u.AUTO);let d=r?new D(r,e,t,l,!1,a,c):new b(e,t,l);return t.composition&&d.init(!0),o(t,d),s(t,e=>{let n=e._offset+e._delay+e.duration;n>t.iterationDuration&&(t.iterationDuration=n)}),t.duration=V(t),t}var U=0,W=class extends b{constructor(e={}){super(e,null,0),++U,this.id=f(e.id)?U:e.id,this.duration=0,this.labels={};let t=e.defaults,n=a.defaults;this.defaults=t?m(t,n):n,this.composition=A(e.composition,!0),this.onRender=e.onRender||n.onRender;let r=A(e.playbackEase,n.playbackEase);this._ease=r?v(r):null,this.iterationDuration=0}add(e,t,n){let r=S(t),i=S(e);if(r||i){if(this._hasChildren=!0,r){let r=t,i=a.editor&&a.editor.addTimelineChild,o=n&&n.type===`Stagger`&&a.editor,s=p(n)?n:null;if(s||o){let t=T(e),o=this.duration,c=this.iterationDuration,l=r.id,u=0,d=t.length,p=i?i(e,r,this.id,n,d):null,m=s||a.editor.resolveStagger(n.defaultValue);t.forEach(e=>{let n={...p||r};this.duration=o,this.iterationDuration=c,f(l)||(n.id=l+`-`+u);let i=F(this,m(e,u,t,null,this));H(n,this,i,e,u,t),u++})}else{let t=i?i(e,r,this.id,n):r,a=n&&n.type?n.defaultValue:n;H(t,this,F(this,a),e)}}else H(e,this,F(this,t));return this.composition&&this.init(!0),this}}sync(e,t){if(f(e)||e&&f(e.pause))return this;e.pause();let n=+(e.effect?e.effect.getTiming().duration:e.duration);!f(e)&&!f(e.persist)&&(e.persist=!0);let r=a.editor,i=r&&r.addTimelineChild;r&&r.addTimelineSync&&(t=r.addTimelineSync(e,t,this.id),r.addTimelineChild=null);let o=this.add(e,{currentTime:[0,n],duration:n,delay:0,ease:`linear`,playbackEase:`linear`},t);return r&&(r.addTimelineChild=i),o}set(e,t,n){return f(t)?this:(t.duration=h,t.composition=l.replace,this.add(e,t,n))}call(e,t){return f(e)||e&&!p(e)?this:(a.editor&&a.editor.addTimelineCall&&(t=a.editor.addTimelineCall(e,t,this.id)),this.add({duration:0,delay:0,onComplete:()=>e(this)},t))}label(e,t){return f(e)||e&&!d(e)||(a.editor&&a.editor.addTimelineLabel&&(t=a.editor.addTimelineLabel(e,t,this.id)),this.labels[e]=F(this,t)),this}remove(e,t){return y(T(e),this,t),this}stretch(e){let t=this.duration;if(t===c(e))return this;let n=e/t,r=this.labels;s(this,e=>e.stretch(e.duration*n));for(let e in r)r[e]*=n;return super.stretch(e)}refresh(){return s(this,e=>{e.refresh&&e.refresh()}),this}revert(){return super.revert(),s(this,e=>e.revert,!0),g(this)}then(e){return super.then(e)}},G=e=>a.editor?a.editor.addTimeline(e):new W(e).init(),K=e(t(),1),q=n(),J=.62,te=(e,t)=>String(e).length*t*J;function Y(e,t){let n=0;for(let t of e){if(t.t===``||t.t==null)continue;let e=te(t.t,t.size)/2;n=Math.max(n,Math.hypot(e,t.dy-t.size*.75),Math.hypot(e,t.dy+t.size*.25))}return Math.ceil(n+t)}function X(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=r/a,s=i/a,c=e.x+o*e.r,l=e.y+s*e.r,u=t.x-o*t.r,d=t.y-s*t.r,f=n*a,p=e=>e.toFixed(1);return`M${p(c)} ${p(l)} C${p(c+o*a*.3-s*f)} ${p(l+s*a*.3+o*f)} ${p(u-o*a*.3-s*f)} ${p(d-s*a*.3+o*f)} ${p(u)} ${p(d)}`}var Z=!1,Q=!1,ne=w[8]+w[7];function $({hash:e,label:t,part:n,children:r}){return(0,q.jsx)(`g`,{className:`cm-node`,"data-cm":n,role:`button`,tabIndex:0,"aria-label":t,onClick:()=>R(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),R(e))},children:r})}function re({overview:e,dataRev:t}){let{data:n}=I(()=>r.catalog(`laws`),[t],`catalog:laws`),i=n?.items??null,a=n?.nouns?.ontology||`Ethos`,o=n?.nouns?.laws||`Dictates`,s=n?.nouns?.doctrines||`Doctrines`,c=(0,K.useRef)(null),l=(0,K.useRef)(!0),u=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=c.current;if(!e||Z||!x())return;Z=!0;let t=t=>[...e.querySelectorAll(t)],n=t(`[data-cm="hub"]`),r=t(`[data-cm="sat"]`),i=t(`[data-cm="gov"]`),a=t(`.cm-edge-gov`),o=t(`.cm-note, .cm-govern-label`),s=L(t(`.cm-edge`));C([...n,...r,...i],{opacity:0,scale:.7}),C([...a,...o],{opacity:0}),C(s,{draw:`0 0`});let d=G({autoplay:!1,defaults:{ease:E}}).add(n,{opacity:1,scale:1,duration:w[7]},0).add(s,{draw:`0 1`,duration:w[7],delay:P(w[1])},w[3]).add(r,{opacity:1,scale:1,duration:w[7],delay:P(w[1])},w[5]).add(a,{opacity:1,duration:w[6],delay:P(w[1])},w[7]).add(i,{opacity:1,scale:1,duration:w[7],delay:P(w[1])},w[8]).add(o,{opacity:1,duration:w[6]},w[8]);l.current=!1;let f=()=>d.complete(),p=()=>{d.play(),f=_(d,ne),l.current=!0,u.current?.()};if(typeof IntersectionObserver>`u`)return p(),()=>f();let m=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(m.disconnect(),p())},{threshold:.33});return m.observe(e),()=>{m.disconnect(),l.current=!0,f()}},[]);let d=e?.counts||{},f=z(d),p=[];for(let e of(i||[]).filter(e=>e.tier===`doctrine`)){let t=p.find(t=>t.id===e.pack);t||p.push(t={id:e.pack,n:0}),t.n+=1}let m=e?.footprint===`lean`?`lean — first line only`:`full text inlined`,h={x:330,y:165,r:Y([{t:`Constitution`,size:17,dy:-12},{t:`${f} rules`,size:10,dy:8},{t:m,size:8.5,dy:24}],12)},g={x:126,y:95,r:Y([{t:a,size:12.5,dy:-7},{t:`${d.ontology??0} sections`,size:10,dy:10}],11)},v={x:560,y:78,r:Y([{t:o,size:12.5,dy:-6},{t:`${d.laws??0}`,size:13,dy:12}],11)},y={x:560,y:252,r:Y([{t:s,size:12.5,dy:-6},{t:`${d.doctrines?.rules??0}`,size:13,dy:12}],11)},b=(e,t,n,r)=>({x:e,y:t,label:n,count:r,r:Y([{t:n,size:10.5,dy:-2},{t:`${r}`,size:9,dy:10}],9)}),S=[{...b(812,52,`Skills`,d.skills??0),hash:`#/skills`,from:v},{...b(820,126,`Agents`,d.agents??0),hash:`#/agents`,from:v},{...b(816,232,`Memory`,d.memory??0),hash:`#/personal/memory`,from:y},{...b(812,300,`Wiki`,d.wiki??0),hash:`#/section/wiki`,from:y}],T={rx:122,ry:68,from:212,to:112},D=p.map((e,t)=>{let n=(p.length===1?(T.from+T.to)/2:T.from+(T.to-T.from)*t/(p.length-1))*Math.PI/180;return{...e,x:y.x+T.rx*Math.cos(n),y:y.y+T.ry*Math.sin(n),r:Y([{t:e.id,size:7.5,dy:-2},{t:`${e.on}`,size:7.5,dy:8}],4)}}),O=D.length;return(0,K.useLayoutEffect)(()=>{let e=c.current;if(!e||!O||Q||!x())return;Q=!0;let t=[...e.querySelectorAll(`.cm-mini > g`)];C(t,{opacity:0,scale:.5});let n=()=>C(t,{opacity:1,scale:1}),r=()=>{u.current=null;let e=ee(t,{opacity:1,scale:1,duration:w[7],delay:P(w[1],{start:w[7]}),ease:E});n=_(e,w[7]+w[1]*O+w[7])};return l.current?r():u.current=r,()=>{u.current=null,n()}},[O]),(0,q.jsxs)(`svg`,{ref:c,className:`cmap`,viewBox:`0 0 940 350`,role:`group`,"aria-label":`The constitution map`,children:[(0,q.jsx)(`path`,{d:X(h,g,.05),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(h,v,-.07),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(h,y,.07),className:`cm-edge`}),S.map(e=>(0,q.jsx)(`path`,{d:X(e.from,e,.03),className:`cm-edge-gov`},`e-${e.label}`)),(0,q.jsxs)($,{hash:`#/laws`,part:`hub`,label:`Constitution: ${f} rules`,children:[(0,q.jsx)(`circle`,{cx:h.x,cy:h.y,r:h.r,className:`cm-hub-disc`}),(0,q.jsx)(`text`,{x:h.x,y:h.y-12,textAnchor:`middle`,className:`cm-hub-name`,children:`Constitution`}),(0,q.jsxs)(`text`,{x:h.x,y:h.y+8,textAnchor:`middle`,className:`cm-hub-num`,children:[f,` rules`]}),(0,q.jsx)(`text`,{x:h.x,y:h.y+24,textAnchor:`middle`,className:`cm-note`,children:m})]}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${a}: ${d.ontology??0} sections`,children:[(0,q.jsx)(`circle`,{cx:g.x,cy:g.y,r:g.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:g.x,y:g.y-7,textAnchor:`middle`,className:`cm-sat-name`,children:a}),(0,q.jsxs)(`text`,{x:g.x,y:g.y+10,textAnchor:`middle`,className:`cm-sat-num`,children:[d.ontology??0,` sections`]})]}),(0,q.jsx)(`text`,{x:g.x,y:g.y+g.r+16,textAnchor:`middle`,className:`cm-note`,children:`how it thinks, not a rule`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${o}: ${d.laws??0}, never broken`,children:[(0,q.jsx)(`circle`,{cx:v.x,cy:v.y,r:v.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:v.x,y:v.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:o}),(0,q.jsx)(`text`,{x:v.x,y:v.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:d.laws??0})]}),(0,q.jsx)(`text`,{x:v.x,y:v.y+v.r+16,textAnchor:`middle`,className:`cm-note`,children:`never broken`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${s}: ${d.doctrines?.rules??0} rules`,children:[(0,q.jsx)(`circle`,{cx:y.x,cy:y.y,r:y.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:y.x,y:y.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:s}),(0,q.jsx)(`text`,{x:y.x,y:y.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:d.doctrines?.rules??0})]}),(0,q.jsx)(`text`,{x:y.x+22,y:y.y+y.r+20,className:`cm-note`,children:d.doctrines?`${d.doctrines.active}/${d.doctrines.total} packs built in`:`packs chosen at build`}),(0,q.jsx)(`g`,{className:`cm-mini`,children:D.map(e=>(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-pack-disc`,style:{stroke:N(e.id)}}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-pack-id`,children:e.id}),(0,q.jsx)(`text`,{x:e.x,y:e.y+8,textAnchor:`middle`,style:{fill:N(e.id)},children:e.n})]},e.id))}),(0,q.jsx)(`text`,{x:866,y:16,textAnchor:`middle`,className:`cm-govern-label`,children:`GOVERNS THE HARNESS`}),S.map(e=>(0,q.jsxs)($,{hash:e.hash,part:`gov`,label:`${e.label}: ${e.count}`,children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-gov-disc`}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-gov-name`,children:e.label}),(0,q.jsx)(`text`,{x:e.x,y:e.y+10,textAnchor:`middle`,className:`cm-gov-num`,children:e.count})]},e.label)),(0,q.jsx)(`text`,{x:g.x,y:228,textAnchor:`middle`,className:`cm-note`,children:`tap any node to open its ledger`})]})}function ie({counts:e}){let t=[{label:j.skills.label,n:e.skills??0,hash:`#/skills`},{label:`Rules`,n:z(e),hash:`#/laws`},{label:j.agents.label,n:e.agents??0,hash:`#/agents`},{label:j.memory.label,n:e.memory??0,hash:`#/personal/memory`},{label:j.notebook.label,n:e.notebook??0,hash:`#/personal/notebook`},{label:j.wiki.label,n:e.wiki??0,hash:`#/section/wiki`},{label:j.config.label,n:e.config??0,hash:`#/section/config`}],n=Math.max(...t.map(e=>e.n),1);return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Growth rings`}),(0,q.jsx)(`span`,{className:`tick right`,children:`by section`})]}),t.map(e=>(0,q.jsxs)(`button`,{className:`jr-ring`,onClick:()=>R(e.hash),children:[(0,q.jsx)(`span`,{className:`jr-ring-label`,children:e.label}),(0,q.jsx)(`span`,{className:`jr-ring-track`,children:(0,q.jsx)(`span`,{className:`jr-ring-fill`,style:{width:`${e.n/n*100}%`}})}),(0,q.jsx)(`span`,{className:`jr-ring-num`,children:e.n})]},e.label))]})}function ae({recent:e,buildEpoch:t}){let n=e?.items||[],r=e?.skipped||[];return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Freshly grown`}),(0,q.jsx)(`span`,{className:`tick right`,children:`newest`})]}),e?n.length===0?(0,q.jsx)(`p`,{className:`sub`,children:`Nothing here carries a date yet.`}):n.slice(0,5).map(e=>(0,q.jsxs)(`button`,{className:`jr-fresh`,onClick:()=>R(`#/item/${e.type}/${encodeURIComponent(e.name)}`),children:[(0,q.jsx)(`span`,{className:`jr-fresh-kind`,children:e.section}),(0,q.jsx)(`span`,{className:`jr-fresh-name`,children:e.title}),(0,q.jsx)(`span`,{className:`jr-fresh-when`,children:M(e.mtime)})]},`${e.section}:${e.name}`)):(0,q.jsx)(`p`,{className:`sub`,children:`Reading the shelves…`}),r.length>0&&(0,q.jsxs)(`p`,{className:`sub jr-skipped`,children:[`Not dated: `,r.join(`, `),` — too many files to stat on every load.`]}),(0,q.jsxs)(`p`,{className:`jr-care`,children:[t?`Last built ✓ ${M(t)}`:`Never built here`,` ·`,` `,(0,q.jsx)(`button`,{className:`jr-go`,onClick:()=>R(`#/activity`),children:`log →`})]})]})}function oe({overview:e,recent:t,lens:n,dataRev:r}){let i=e?.counts||{};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`jr-head`,children:(0,q.jsx)(B,{verdict:n?.verdict})}),(0,q.jsxs)(`div`,{className:`jr-row2`,children:[(0,q.jsx)(ie,{counts:i}),(0,q.jsx)(ae,{recent:t,buildEpoch:e?.build_epoch})]}),(0,q.jsxs)(`div`,{className:`card pad-lg jr-map`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`The Constitution — and the harness it governs`}),(0,q.jsx)(`button`,{className:`jr-go right`,onClick:()=>R(`#/laws`),children:`open →`})]}),(0,q.jsx)(re,{overview:e,dataRev:r})]})]})}export{oe as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{A as i,B as a,C as o,E as s,F as c,H as l,K as u,M as d,N as f,O as p,P as m,U as h,_ as g,a as _,d as ee,f as v,g as y,h as b,i as x,j as S,l as C,n as w,p as T,r as E,u as D,v as O,w as k,x as A}from"./motion-RlUl1osO.js";import{n as j}from"./sections-CtFz7HFH.js";import{At as M,E as N,Et as P,Mt as F,Nt as I,Pt as L,Tt as R,wt as z}from"./index-BQwOmbor.js";import{n as B}from"./Dashboard-Dnw6EyX7.js";function V(e){return k((e.iterationDuration+e._loopDelay)*e.iterationCount-e._loopDelay)||1e-11}function H(e,t,n,r,a,c){let l=i(e.duration)&&e.duration<=1e-11?n-h:n;t.composition&&O(t,l,1,1,u.AUTO);let d=r?new D(r,e,t,l,!1,a,c):new b(e,t,l);return t.composition&&d.init(!0),o(t,d),s(t,e=>{let n=e._offset+e._delay+e.duration;n>t.iterationDuration&&(t.iterationDuration=n)}),t.duration=V(t),t}var U=0,W=class extends b{constructor(e={}){super(e,null,0),++U,this.id=f(e.id)?U:e.id,this.duration=0,this.labels={};let t=e.defaults,n=a.defaults;this.defaults=t?m(t,n):n,this.composition=A(e.composition,!0),this.onRender=e.onRender||n.onRender;let r=A(e.playbackEase,n.playbackEase);this._ease=r?v(r):null,this.iterationDuration=0}add(e,t,n){let r=S(t),i=S(e);if(r||i){if(this._hasChildren=!0,r){let r=t,i=a.editor&&a.editor.addTimelineChild,o=n&&n.type===`Stagger`&&a.editor,s=p(n)?n:null;if(s||o){let t=T(e),o=this.duration,c=this.iterationDuration,l=r.id,u=0,d=t.length,p=i?i(e,r,this.id,n,d):null,m=s||a.editor.resolveStagger(n.defaultValue);t.forEach(e=>{let n={...p||r};this.duration=o,this.iterationDuration=c,f(l)||(n.id=l+`-`+u);let i=L(this,m(e,u,t,null,this));H(n,this,i,e,u,t),u++})}else{let t=i?i(e,r,this.id,n):r,a=n&&n.type?n.defaultValue:n;H(t,this,L(this,a),e)}}else H(e,this,L(this,t));return this.composition&&this.init(!0),this}}sync(e,t){if(f(e)||e&&f(e.pause))return this;e.pause();let n=+(e.effect?e.effect.getTiming().duration:e.duration);!f(e)&&!f(e.persist)&&(e.persist=!0);let r=a.editor,i=r&&r.addTimelineChild;r&&r.addTimelineSync&&(t=r.addTimelineSync(e,t,this.id),r.addTimelineChild=null);let o=this.add(e,{currentTime:[0,n],duration:n,delay:0,ease:`linear`,playbackEase:`linear`},t);return r&&(r.addTimelineChild=i),o}set(e,t,n){return f(t)?this:(t.duration=h,t.composition=l.replace,this.add(e,t,n))}call(e,t){return f(e)||e&&!p(e)?this:(a.editor&&a.editor.addTimelineCall&&(t=a.editor.addTimelineCall(e,t,this.id)),this.add({duration:0,delay:0,onComplete:()=>e(this)},t))}label(e,t){return f(e)||e&&!d(e)||(a.editor&&a.editor.addTimelineLabel&&(t=a.editor.addTimelineLabel(e,t,this.id)),this.labels[e]=L(this,t)),this}remove(e,t){return y(T(e),this,t),this}stretch(e){let t=this.duration;if(t===c(e))return this;let n=e/t,r=this.labels;s(this,e=>e.stretch(e.duration*n));for(let e in r)r[e]*=n;return super.stretch(e)}refresh(){return s(this,e=>{e.refresh&&e.refresh()}),this}revert(){return super.revert(),s(this,e=>e.revert,!0),g(this)}then(e){return super.then(e)}},G=e=>a.editor?a.editor.addTimeline(e):new W(e).init(),K=e(t(),1),q=n(),J=.62,te=(e,t)=>String(e).length*t*J;function Y(e,t){let n=0;for(let t of e){if(t.t===``||t.t==null)continue;let e=te(t.t,t.size)/2;n=Math.max(n,Math.hypot(e,t.dy-t.size*.75),Math.hypot(e,t.dy+t.size*.25))}return Math.ceil(n+t)}function X(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=r/a,s=i/a,c=e.x+o*e.r,l=e.y+s*e.r,u=t.x-o*t.r,d=t.y-s*t.r,f=n*a,p=e=>e.toFixed(1);return`M${p(c)} ${p(l)} C${p(c+o*a*.3-s*f)} ${p(l+s*a*.3+o*f)} ${p(u-o*a*.3-s*f)} ${p(d-s*a*.3+o*f)} ${p(u)} ${p(d)}`}var Z=!1,Q=!1,ne=w[8]+w[7];function $({hash:e,label:t,part:n,children:r}){return(0,q.jsx)(`g`,{className:`cm-node`,"data-cm":n,role:`button`,tabIndex:0,"aria-label":t,onClick:()=>M(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),M(e))},children:r})}function re({overview:e,dataRev:t}){let{data:n}=P(()=>r.catalog(`laws`),[t],`catalog:laws`),i=n?.items??null,a=n?.nouns?.ontology||`Ethos`,o=n?.nouns?.laws||`Dictates`,s=n?.nouns?.doctrines||`Doctrines`,c=(0,K.useRef)(null),l=(0,K.useRef)(!0),u=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=c.current;if(!e||Z||!x())return;Z=!0;let t=t=>[...e.querySelectorAll(t)],n=t(`[data-cm="hub"]`),r=t(`[data-cm="sat"]`),i=t(`[data-cm="gov"]`),a=t(`.cm-edge-gov`),o=t(`.cm-note, .cm-govern-label`),s=F(t(`.cm-edge`));C([...n,...r,...i],{opacity:0,scale:.7}),C([...a,...o],{opacity:0}),C(s,{draw:`0 0`});let d=G({autoplay:!1,defaults:{ease:E}}).add(n,{opacity:1,scale:1,duration:w[7]},0).add(s,{draw:`0 1`,duration:w[7],delay:I(w[1])},w[3]).add(r,{opacity:1,scale:1,duration:w[7],delay:I(w[1])},w[5]).add(a,{opacity:1,duration:w[6],delay:I(w[1])},w[7]).add(i,{opacity:1,scale:1,duration:w[7],delay:I(w[1])},w[8]).add(o,{opacity:1,duration:w[6]},w[8]);l.current=!1;let f=()=>d.complete(),p=()=>{d.play(),f=_(d,ne),l.current=!0,u.current?.()};if(typeof IntersectionObserver>`u`)return p(),()=>f();let m=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(m.disconnect(),p())},{threshold:.33});return m.observe(e),()=>{m.disconnect(),l.current=!0,f()}},[]);let d=e?.counts||{},f=R(d),p=[];for(let e of(i||[]).filter(e=>e.tier===`doctrine`)){let t=p.find(t=>t.id===e.pack);t||p.push(t={id:e.pack,n:0}),t.n+=1}let m=e?.footprint===`lean`?`lean — first line only`:`full text inlined`,h={x:330,y:165,r:Y([{t:`Constitution`,size:17,dy:-12},{t:`${f} rules`,size:10,dy:8},{t:m,size:8.5,dy:24}],12)},g={x:126,y:95,r:Y([{t:a,size:12.5,dy:-7},{t:`${d.ontology??0} sections`,size:10,dy:10}],11)},v={x:560,y:78,r:Y([{t:o,size:12.5,dy:-6},{t:`${d.laws??0}`,size:13,dy:12}],11)},y={x:560,y:252,r:Y([{t:s,size:12.5,dy:-6},{t:`${d.doctrines?.rules??0}`,size:13,dy:12}],11)},b=(e,t,n,r)=>({x:e,y:t,label:n,count:r,r:Y([{t:n,size:10.5,dy:-2},{t:`${r}`,size:9,dy:10}],9)}),S=[{...b(812,52,`Skills`,d.skills??0),hash:`#/skills`,from:v},{...b(820,126,`Agents`,d.agents??0),hash:`#/agents`,from:v},{...b(816,232,`Memory`,d.memory??0),hash:`#/personal/memory`,from:y},{...b(812,300,`Wiki`,d.wiki??0),hash:`#/section/wiki`,from:y}],T={rx:122,ry:68,from:212,to:112},D=p.map((e,t)=>{let n=(p.length===1?(T.from+T.to)/2:T.from+(T.to-T.from)*t/(p.length-1))*Math.PI/180;return{...e,x:y.x+T.rx*Math.cos(n),y:y.y+T.ry*Math.sin(n),r:Y([{t:e.id,size:7.5,dy:-2},{t:`${e.on}`,size:7.5,dy:8}],4)}}),O=D.length;return(0,K.useLayoutEffect)(()=>{let e=c.current;if(!e||!O||Q||!x())return;Q=!0;let t=[...e.querySelectorAll(`.cm-mini > g`)];C(t,{opacity:0,scale:.5});let n=()=>C(t,{opacity:1,scale:1}),r=()=>{u.current=null;let e=ee(t,{opacity:1,scale:1,duration:w[7],delay:I(w[1],{start:w[7]}),ease:E});n=_(e,w[7]+w[1]*O+w[7])};return l.current?r():u.current=r,()=>{u.current=null,n()}},[O]),(0,q.jsxs)(`svg`,{ref:c,className:`cmap`,viewBox:`0 0 940 350`,role:`group`,"aria-label":`The constitution map`,children:[(0,q.jsx)(`path`,{d:X(h,g,.05),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(h,v,-.07),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(h,y,.07),className:`cm-edge`}),S.map(e=>(0,q.jsx)(`path`,{d:X(e.from,e,.03),className:`cm-edge-gov`},`e-${e.label}`)),(0,q.jsxs)($,{hash:`#/laws`,part:`hub`,label:`Constitution: ${f} rules`,children:[(0,q.jsx)(`circle`,{cx:h.x,cy:h.y,r:h.r,className:`cm-hub-disc`}),(0,q.jsx)(`text`,{x:h.x,y:h.y-12,textAnchor:`middle`,className:`cm-hub-name`,children:`Constitution`}),(0,q.jsxs)(`text`,{x:h.x,y:h.y+8,textAnchor:`middle`,className:`cm-hub-num`,children:[f,` rules`]}),(0,q.jsx)(`text`,{x:h.x,y:h.y+24,textAnchor:`middle`,className:`cm-note`,children:m})]}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${a}: ${d.ontology??0} sections`,children:[(0,q.jsx)(`circle`,{cx:g.x,cy:g.y,r:g.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:g.x,y:g.y-7,textAnchor:`middle`,className:`cm-sat-name`,children:a}),(0,q.jsxs)(`text`,{x:g.x,y:g.y+10,textAnchor:`middle`,className:`cm-sat-num`,children:[d.ontology??0,` sections`]})]}),(0,q.jsx)(`text`,{x:g.x,y:g.y+g.r+16,textAnchor:`middle`,className:`cm-note`,children:`how it thinks, not a rule`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${o}: ${d.laws??0}, never broken`,children:[(0,q.jsx)(`circle`,{cx:v.x,cy:v.y,r:v.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:v.x,y:v.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:o}),(0,q.jsx)(`text`,{x:v.x,y:v.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:d.laws??0})]}),(0,q.jsx)(`text`,{x:v.x,y:v.y+v.r+16,textAnchor:`middle`,className:`cm-note`,children:`never broken`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${s}: ${d.doctrines?.rules??0} rules`,children:[(0,q.jsx)(`circle`,{cx:y.x,cy:y.y,r:y.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:y.x,y:y.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:s}),(0,q.jsx)(`text`,{x:y.x,y:y.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:d.doctrines?.rules??0})]}),(0,q.jsx)(`text`,{x:y.x+22,y:y.y+y.r+20,className:`cm-note`,children:d.doctrines?`${d.doctrines.active}/${d.doctrines.total} packs built in`:`packs chosen at build`}),(0,q.jsx)(`g`,{className:`cm-mini`,children:D.map(e=>(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-pack-disc`,style:{stroke:N(e.id)}}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-pack-id`,children:e.id}),(0,q.jsx)(`text`,{x:e.x,y:e.y+8,textAnchor:`middle`,style:{fill:N(e.id)},children:e.n})]},e.id))}),(0,q.jsx)(`text`,{x:866,y:16,textAnchor:`middle`,className:`cm-govern-label`,children:`GOVERNS THE HARNESS`}),S.map(e=>(0,q.jsxs)($,{hash:e.hash,part:`gov`,label:`${e.label}: ${e.count}`,children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-gov-disc`}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-gov-name`,children:e.label}),(0,q.jsx)(`text`,{x:e.x,y:e.y+10,textAnchor:`middle`,className:`cm-gov-num`,children:e.count})]},e.label)),(0,q.jsx)(`text`,{x:g.x,y:228,textAnchor:`middle`,className:`cm-note`,children:`tap any node to open its ledger`})]})}function ie({counts:e}){let t=[{label:j.skills.label,n:e.skills??0,hash:`#/skills`},{label:`Rules`,n:R(e),hash:`#/laws`},{label:j.agents.label,n:e.agents??0,hash:`#/agents`},{label:j.memory.label,n:e.memory??0,hash:`#/personal/memory`},{label:j.notebook.label,n:e.notebook??0,hash:`#/personal/notebook`},{label:j.wiki.label,n:e.wiki??0,hash:`#/section/wiki`},{label:j.config.label,n:e.config??0,hash:`#/section/config`}],n=Math.max(...t.map(e=>e.n),1);return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Growth rings`}),(0,q.jsx)(`span`,{className:`tick right`,children:`by section`})]}),t.map(e=>(0,q.jsxs)(`button`,{className:`jr-ring`,onClick:()=>M(e.hash),children:[(0,q.jsx)(`span`,{className:`jr-ring-label`,children:e.label}),(0,q.jsx)(`span`,{className:`jr-ring-track`,children:(0,q.jsx)(`span`,{className:`jr-ring-fill`,style:{width:`${e.n/n*100}%`}})}),(0,q.jsx)(`span`,{className:`jr-ring-num`,children:e.n})]},e.label))]})}function ae({recent:e,buildEpoch:t}){let n=e?.items||[],r=e?.skipped||[];return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Freshly grown`}),(0,q.jsx)(`span`,{className:`tick right`,children:`newest`})]}),e?n.length===0?(0,q.jsx)(`p`,{className:`sub`,children:`Nothing here carries a date yet.`}):n.slice(0,5).map(e=>(0,q.jsxs)(`button`,{className:`jr-fresh`,onClick:()=>M(`#/item/${e.type}/${encodeURIComponent(e.name)}`),children:[(0,q.jsx)(`span`,{className:`jr-fresh-kind`,children:e.section}),(0,q.jsx)(`span`,{className:`jr-fresh-name`,children:e.title}),(0,q.jsx)(`span`,{className:`jr-fresh-when`,children:z(e.mtime)})]},`${e.section}:${e.name}`)):(0,q.jsx)(`p`,{className:`sub`,children:`Reading the shelves…`}),r.length>0&&(0,q.jsxs)(`p`,{className:`sub jr-skipped`,children:[`Not dated: `,r.join(`, `),` — too many files to stat on every load.`]}),(0,q.jsxs)(`p`,{className:`jr-care`,children:[t?`Last built ✓ ${z(t)}`:`Never built here`,` ·`,` `,(0,q.jsx)(`button`,{className:`jr-go`,onClick:()=>M(`#/activity`),children:`log →`})]})]})}function oe({overview:e,recent:t,lens:n,dataRev:r}){let i=e?.counts||{};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`jr-head`,children:(0,q.jsx)(B,{verdict:n?.verdict})}),(0,q.jsxs)(`div`,{className:`jr-row2`,children:[(0,q.jsx)(ie,{counts:i}),(0,q.jsx)(ae,{recent:t,buildEpoch:e?.build_epoch})]}),(0,q.jsxs)(`div`,{className:`card pad-lg jr-map`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`The Constitution — and the harness it governs`}),(0,q.jsx)(`button`,{className:`jr-go right`,onClick:()=>M(`#/laws`),children:`open →`})]}),(0,q.jsx)(re,{overview:e,dataRev:r})]})]})}export{oe as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-BMFDSXoB.js";import{G as i,H as a,Tt as o,et as s,gt as c,it as l,rt as u,st as d,tt as f}from"./index-BNttaGQb.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{r as h}from"./controls-D4wmg_pl.js";import{t as g}from"./DataTable-b9zTShqJ.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=d(),r=f(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===s(v(e))?t:null},{prune:a}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,s(v(e))]));a(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,a]);let o=e=>i(e)?.value??new Set(v(e)),l=(e,t)=>{let n=new Set(o(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,s(v(e)))},u=e=>{let t=o(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:o,toggle:l,change:u,apply:async e=>{let i=[...o(e)],a=`Rebuild ${c(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${c(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=c(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(h,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(p,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=c;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let o=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...F(n,t,e.name)})),u=l.filter(t=>v(t.row).includes(e.name)).length,d=l.filter(e=>e.staged).length,f=A(u,t.length),p=`on in ${u} of ${N(t.length,`install`)}${d?` · ${d} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${d?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(o.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(a,{value:s.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(a,{value:c.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,x.jsx)(j,{type:`skill`,names:s,listed:r?.skills,offNote:f}):null,c.length?(0,x.jsx)(j,{type:`agent`,names:c,listed:r?.agents,offNote:f}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[o.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,o.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(h,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(g,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:a,error:s}=o(()=>r.kits(),[n]),c=b(a,t),{data:d}=o(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=a?.kits||[],p=a?.installs||[],h=s||a?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(u,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:p,stage:c,listed:d})}):(0,x.jsxs)(m,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(l,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{eyebrow:a?`${N(f.length,`kit`)} · ${N(p.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(u,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?f.length===0?h?null:(0,x.jsx)(m,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:p,stage:c,listed:d,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:p,stage:c}),p.length?(0,x.jsx)(R,{installs:p,stage:c}):null]}):h?null:(0,x.jsx)(l,{})]})}export{z as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Et as i,G as a,H as o,_t as s,ct as c,et as l,it as u,rt as d,tt as f}from"./index-BQwOmbor.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{t as h}from"./DataTable-b9zTShqJ.js";import{r as g}from"./controls-D4wmg_pl.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=c(),r=f(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===l(v(e))?t:null},{prune:a}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,l(v(e))]));a(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,a]);let o=e=>i(e)?.value??new Set(v(e)),u=(e,t)=>{let n=new Set(o(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,l(v(e)))},d=e=>{let t=o(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:o,toggle:u,change:d,apply:async e=>{let i=[...o(e)],a=`Rebuild ${s(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${s(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=s(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(g,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(p,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=s;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let a=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...F(n,t,e.name)})),u=l.filter(t=>v(t.row).includes(e.name)).length,d=l.filter(e=>e.staged).length,f=A(u,t.length),p=`on in ${u} of ${N(t.length,`install`)}${d?` · ${d} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${d?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(a.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(o,{value:s.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(o,{value:c.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,x.jsx)(j,{type:`skill`,names:s,listed:r?.skills,offNote:f}):null,c.length?(0,x.jsx)(j,{type:`agent`,names:c,listed:r?.agents,offNote:f}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[a.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,a.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(g,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(h,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:o,error:s}=i(()=>r.kits(),[n]),c=b(o,t),{data:l}=i(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=o?.kits||[],p=o?.installs||[],h=s||o?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(a,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(d,{error:h,style:{margin:`0 0 var(--sp-3)`}}),o?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:p,stage:c,listed:l})}):(0,x.jsxs)(m,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(u,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(a,{eyebrow:o?`${N(f.length,`kit`)} · ${N(p.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(d,{error:h,style:{margin:`0 0 var(--sp-3)`}}),o?f.length===0?h?null:(0,x.jsx)(m,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:p,stage:c,listed:l,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:p,stage:c}),p.length?(0,x.jsx)(R,{installs:p,stage:c}):null]}):h?null:(0,x.jsx)(u,{})]})}export{z as default};
@@ -0,0 +1,4 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{At as i,C as a,Et as o,G as s,H as c,Q as l,S as u,Z as d,_ as f,_t as p,at as m,b as h,ct as g,d as _,et as v,f as y,g as b,h as x,it as S,m as C,mt as w,ot as ee,p as te,pt as T,q as ne,rt as E,tt as D,v as O,vt as k,x as re,y as ie}from"./index-BQwOmbor.js";import{t as ae}from"./Markdown-0ORz7tAc.js";import{t as oe}from"./EmptyState-CY5Pm2xy.js";import{t as se}from"./FilterInput-qGKNSlxv.js";var A=e(t(),1);function ce({items:e,packs:t,install:n,canApply:r,onAction:i,gateArmed:a}){let o=g(),s=e.filter(e=>e.tier===`doctrine`&&e.active!==!1).map(e=>e.name),c=s.join(`,`),l=D(),u=n?`${n.host}:${n.scope}:${n.path}`:``,d=v(s),{prune:m}=l,h=e.length>0;(0,A.useEffect)(()=>{h&&m(`rules`,(e,t)=>e===u&&t.base!==d)},[h,u,d,m]);let y=l.get(`rules`,u),b=y&&y.base===d?y.value:s,x=e=>l.put(`rules`,u,e(b),d),S=e=>b.includes(e),w=e=>x(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),ee=e=>e.rules.some(e=>S(e.addr)),te=e=>{let t=e.rules.map(e=>e.addr),n=e.rules.every(e=>S(e.addr));x(e=>n?e.filter(e=>!t.includes(e)):[...new Set([...e,...t])])},T=e=>{let t=e.rules.filter(e=>S(e.addr)).length;return t?e.active?`${t} of ${e.rules.length} active`:`staged on · ${t} of ${e.rules.length}`:e.active?`staged off`:`not built in`},ne=t.flatMap(e=>e.rules.map(e=>e.addr)),E=ne.filter(S),O=E.join(`,`)!==c,k=`process.5`,re=s.includes(k)&&!b.includes(k);return{deployedRules:s,isOn:S,toggleRule:w,packOn:ee,togglePack:te,packState:T,allRules:ne,pickedRules:E,dirty:O,losingConsent:re,applyPacks:async()=>{if(!r||!O)return;let e=t.filter(e=>e.rules.some(e=>S(e.addr))).map(e=>e.pack),c=t.filter(t=>e.includes(t.pack)).flatMap(e=>e.rules.filter(e=>!S(e.addr)).map(e=>e.addr)),d=re?`
2
+
3
+ process 5 carries commit/push consent. Dropping it also removes the git-gate hook, so commits and pushes stop being confirmed at the tool boundary (Bob still logs its warning). `+(a?`(Real data loss stays gated: that is Rule IV’s, not the pack’s.)`:`(Rule IV’s deletion gate is off on this install, so real data loss is not asked about either.)`):``,m={},h=[],g=[];for(let[e,{key:r,label:i}]of Object.entries(C)){if(!e.includes(`.`))continue;let a=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e,o=s.includes(e),c=n?.[r]!==!1;o&&!S(e)&&c&&(m[r]=!1,g.push(`Excluding ${a} also switches the ${i.toLowerCase()} off: its text goes, and its hook stops asking.`)),!o&&S(e)&&!c&&(h.push({key:r,label:i}),g.push(`Including ${a} brings its text back; the ${i.toLowerCase()} stays off unless you tick the box.`))}for(let e of f){if(e===k||!s.includes(e)||S(e))continue;let n=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e;g.push(`Excluding ${n} also drops its hook: it stops asking on every host.`)}for(let e of _){if(!s.includes(e)||S(e))continue;let n=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e;g.push(`Excluding ${n} drops its text; its hook still asks (it has no switch yet).`)}let v=E.length?`${E.length} of ${ne.length} doctrine rules`:`no doctrine rules`,y=g.length?`\n\n${g.join(`
4
+ `)}`:``,b=h.length?{label:`Also turn the ${h.map(e=>e.label.toLowerCase()).join(` and `)} back on`,checked:!0}:void 0,x=await o(`Rebuild ${p(n)} with ${v}? It rebuilds in place, non-destructive.${d}${y}`,{title:`Rebuild with these rules?`,confirmLabel:`Rebuild`,check:b});if(!x)return;let w={...m};if(x?.checked!==!1)for(let e of h)w[e.key]=!0;await i(`install`,{...n,doctrines:e,excludeRules:c,...w})&&l.startApply(`rules`,u)},revert:()=>l.drop(`rules`,u)}}var j=n();function M({addr:e,isOpen:t,onToggle:n,className:i,style:a,head:s,label:c,rev:l,toggleCol:u=null,renderBody:d,srcLine:f,after:p=null}){let m=(0,A.useId)(),{data:h,error:g,reload:_}=o(()=>t?r.item(`law`,e):Promise.resolve(null),[t,e,l],`law-item`),v=t&&(0,j.jsxs)(`div`,{className:`law-expand`,id:m,children:[g?(0,j.jsx)(E,{error:g,onRetry:_}):h?d(h):(0,j.jsx)(`p`,{className:`dim`,children:`Loading…`}),(0,j.jsx)(`div`,{className:`law-srcline`,children:f}),p]}),y={type:`button`,onClick:n,"aria-expanded":t,"aria-controls":m,"aria-label":c};return u?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:i,style:a,"data-addr":e,children:[(0,j.jsx)(`button`,{className:`law-disclosure`,...y,children:s}),(0,j.jsx)(`span`,{className:`toggle-col`,children:u})]}),v]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{className:i,style:a,"data-addr":e,...y,children:s}),v]})}function le({law:e,isOpen:t,onToggle:n,rev:r,toggleCol:i=null,after:a=null}){let o=e.enf===`Hook gate`?` hook`:e.enf===`Gate off`?` gate-off`:``,s=(0,j.jsx)(`span`,{className:`law-enf${o}`,"data-col":`enf`,"aria-hidden":i?`true`:void 0,children:e.enf},`enf`),c=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`law-no`,"data-col":`no`,children:[(0,j.jsx)(`span`,{className:`x`,"aria-hidden":`true`,children:`›`}),e.no]}),(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:e.name}),e.ess?(0,j.jsx)(`span`,{className:`law-princ`,children:e.ess}):null,e.asks?(0,j.jsx)(`span`,{className:`law-asks mono`,children:e.asks}):null,e.note?(0,j.jsx)(`span`,{className:`law-note`,children:e.note}):null,e.no?(0,j.jsxs)(`span`,{className:`law-fold law-fold-no`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`x`,children:`›`}),e.no]}):null,e.latin?(0,j.jsx)(`span`,{className:`law-fold law-fold-latin`,"aria-hidden":`true`,children:e.latin}):null,(0,j.jsxs)(`span`,{className:`law-fold law-fold-chips`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`law-chip-status ${e.statusTone}`,children:e.status}),(0,j.jsx)(`span`,{className:`law-chip-enf${o}`,children:e.enf})]})]}),(0,j.jsx)(`span`,{className:`law-latin`,"data-col":`latin`,children:e.latin}),(0,j.jsx)(`span`,{className:`law-status ${e.statusTone}`,"data-col":`status`,children:e.status}),i?null:s]});return(0,j.jsx)(M,{addr:e.addr,isOpen:t,onToggle:n,className:`law-row${i?` has-toggle`:``}${t?` on`:``}${e.off?` law-off`:``}`,style:{"--cc":e.c},head:c,label:`${e.no?e.no+` `:``}${e.name}, ${e.status}, ${e.enf}`,rev:r,toggleCol:i?[i[0],s,i[1]]:null,renderBody:t=>(0,j.jsx)(ae,{body:t.body||e.ess,links:t.links}),srcLine:`$ geneseed law ${e.addr} · ${e.src}`,after:a})}var N=[`invariants`,`doctrines`];function ue({tiers:e,current:t,onPick:n}){return(0,j.jsx)(`div`,{className:`tier-strip`,children:e.map((e,r)=>{let i=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`tier-head`,children:[(0,j.jsxs)(`span`,{className:`tier-k mono`,children:[`RANK `,r+1]}),e.pill?(0,j.jsx)(`span`,{className:`badge tier-pill ${e.pill[1]}`,children:e.pill[0]}):null]}),(0,j.jsxs)(`span`,{className:`tier-top`,children:[(0,j.jsx)(`span`,{className:`tier-name`,children:e.name}),(0,j.jsx)(`span`,{className:`tier-n mono`,children:e.n})]}),(0,j.jsx)(`span`,{className:`tier-bar`,"aria-hidden":`true`,children:(0,j.jsx)(`span`,{style:{width:`${Math.round(e.fill*100)}%`}})}),(0,j.jsx)(`span`,{className:`tier-sub`,children:e.sub}),(0,j.jsx)(`span`,{className:`tier-sub tier-rule`,children:e.rule})]}),a=`tier${t===e.key?` on`:``}`;return e.href?(0,j.jsx)(`a`,{className:`tier`,href:e.href,children:i},e.key):n&&N.includes(e.key)?(0,j.jsx)(`button`,{type:`button`,className:a,"aria-pressed":t===e.key,onClick:()=>n(t===e.key?`all`:e.key),children:i},e.key):(0,j.jsx)(`div`,{className:a,children:i},e.key)})})}function de({gates:e,byAddr:t,onJump:n,disarmed:r=()=>!1,install:i=null,slot:a=0}){let o=i?p(i):``,s=Object.entries(e?.asks||{}).map(([e,t])=>[e,t,r(ie(e))]).sort((e,t)=>e[2]-t[2]||t[1]-e[1]),l=Math.max(1,...s.map(([,e])=>e));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`gate-asks`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`gate-asks`,children:`Gate asks`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e?.total??0,` in ledger`]})]}),i&&s.some(e=>e[2])&&(0,j.jsx)(`span`,{className:`lib-legend mono`,children:(0,j.jsxs)(`span`,{children:[a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:T(a),"aria-hidden":`true`}),o]})}),s.length?(0,j.jsx)(`ul`,{className:`gate-list`,children:s.map(([e,r,s])=>{let u=ie(e),d=t[u]?.name||h(u);return(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`button`,{type:`button`,className:`gate-row`,onClick:()=>n(u),children:(0,j.jsxs)(`span`,{className:`gate-top`,children:[(0,j.jsx)(`span`,{className:`gate-name${s?` dim`:``}`,children:d}),s&&(0,j.jsxs)(`span`,{className:`mono off`,children:[i&&a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:T(a),"aria-hidden":`true`}),`off`,i&&(0,j.jsxs)(`span`,{className:`sr-only`,children:[` · `,o]})]}),(0,j.jsx)(`span`,{className:`mono gate-n`,children:r})]})}),(0,j.jsx)(c,{value:r,max:l,label:`${d} asks`,tone:s?`accent`:`warn`})]},e)})}):(0,j.jsx)(`p`,{className:`sub`,children:`No gate has asked yet.`}),(0,j.jsx)(`p`,{className:`panel-note`,children:e?.standing_down?.length?`Standing down: ${e.standing_down.join(`, `)}.`:`None standing down.`})]})}function fe({packs:e,sel:t,canApply:n,install:r,gateArmed:i}){let{isOn:a,packOn:o,togglePack:s,dirty:l,losingConsent:u}=t,d=Math.max(1,...e.map(e=>e.rules.length));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`doc-packs`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`doc-packs`,children:`Doctrine packs`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e.filter(o).length,`/`,e.length,` on`]})]}),e.length?(0,j.jsx)(`ul`,{className:`pack-list`,children:e.map(e=>{let t=e.rules.filter(e=>a(e.addr)).length;return(0,j.jsxs)(`li`,{className:o(e)?``:`off`,children:[(0,j.jsx)(`span`,{className:`pl-name`,title:e.desc,children:e.title}),(0,j.jsx)(c,{value:t,max:d,label:`${e.title} rules on`}),(0,j.jsx)(`span`,{className:`mono pl-n`,children:t}),n?(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${o(e)?` on`:``}${t&&t<e.rules.length?` mixed`:``}`,role:`checkbox`,"aria-checked":e.rules.length&&t===e.rules.length?`true`:t?`mixed`:`false`,"aria-label":`${e.title} pack`,onClick:()=>s(e)}):null]},e.pack)})}):(0,j.jsx)(`p`,{className:`sub`,children:`This install predates the three-tier constitution.`}),n&&e.length>0&&(0,j.jsxs)(j.Fragment,{children:[u&&(0,j.jsxs)(`p`,{className:`pack-warn`,role:`status`,"aria-live":`polite`,children:[`Dropping `,(0,j.jsx)(`b`,{children:`process 5`}),` also removes the commit/push consent gate:`,` `,(0,j.jsx)(`code`,{children:`git commit`}),` and `,(0,j.jsx)(`code`,{children:`git push`}),` stop being confirmed at the tool boundary.`,` `,i?`Real data loss stays gated by Rule IV.`:`Rule IV’s deletion gate is off on this install too.`]}),(0,j.jsx)(`p`,{className:`panel-note`,role:`status`,"aria-live":`polite`,children:l?`Not applied yet. Apply rebuilds ${r.host} · ${r.scope} once, with every change together.`:`Matches the deployed install. Changing a pack rebuilds it.`})]})]})}var pe=`ont:ownership`,me=e=>e===`ownership`?pe:e,he=`process.5`;function ge(e,t){let n=[];for(let r of e){if(r.tier!==`doctrine`)continue;let e=n.find(e=>e.pack===r.pack);e||(e={pack:r.pack,title:r.packTitle||r.pack,desc:r.packDesc||``,active:r.packActive!==!1,rules:[]},n.push(e));let i=re(r.title);e.rules.push({addr:r.name,no:`${r.pack} ${r.name.split(`.`)[1]||``}`,name:i.name,latin:i.latin,ess:r.summary||``,enf:O(r.name,t),c:a[r.pack]||`var(--text-3)`,src:`doctrines/${r.pack}.md`})}return n}function P(e){let t=l(e.dataRev),[n,r]=d(`laws`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(m,{className:`page-pick`,installs:t,value:n,onChange:r}),(0,j.jsx)(I,{...e,install:n,listed:t!==null,installSlot:w((t||[]).map(e=>e.id)).indexOf(n?.id)},n?.id??`none`)]})}var F=(e,t)=>e?.install?.host===t.host&&e.install.path===t.path;function I({install:e,listed:t,installSlot:n,...i}){let a=e&&F(i.overview,e)?i.overview:null,{data:s,error:c,loading:l}=o(()=>Promise.resolve().then(()=>e&&!a?r.overview(k(e)):null),[!!a,i.dataRev]),u=a||(e&&F(s,e)?s:null),d=e?u:i.overview,f=!(!e||u||l);return(0,j.jsxs)(j.Fragment,{children:[f?(0,j.jsx)(E,{error:`Could not read this install's gates${c?`: ${c}`:`.`}`}):null,(0,j.jsx)(L,{...i,overview:d,pair:k(e),onAction:t&&(!e||u!==null)?i.onAction:void 0,pending:!t||!!(e&&!u&&l),gatesUnread:f,installSlot:n})]})}function L({selected:e,overview:t,setup:n,onAction:l,dataRev:d,pair:m,pending:h,gatesUnread:v,installSlot:w}){let T=g(),{data:D,error:k}=o(()=>r.catalog(`laws`,m),m?[d,m.host,m.path]:[d],`catalog:laws`),{data:ae}=ne(d,m),[M,N]=(0,A.useState)(`all`),[P,F]=(0,A.useState)(``),[I,L]=(0,A.useState)(`all`),[_e,ve]=(0,A.useState)(()=>new Set),R=me(e)||null,ye=e=>i(R===e?`#/laws`:`#/item/law/${encodeURIComponent(e)}`),z=t?.install,B=!!(z&&l),[be,xe]=(0,A.useState)(0),Se=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!R)return;let e=requestAnimationFrame(()=>{let e=document.querySelector(`[data-addr="${CSS.escape(R)}"]`);if(!e)return;let t=Se.current===R;Se.current=null;let n=e.getBoundingClientRect();if(t||n.top<80||n.bottom>window.innerHeight){let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;e.scrollIntoView?.({block:`center`,behavior:t?`auto`:`smooth`})}t&&(e.classList.remove(`law-flash`),e.offsetWidth,e.classList.add(`law-flash`))});return()=>cancelAnimationFrame(e)},[R,be,D]);let V=D?.items||[],H=ge(V,t?.install),U=e=>t?.install?.[C[e].key]!==!1,Ce=U(`IV`),W=ce({items:V,packs:H,install:z,canApply:B,onAction:l,gateArmed:Ce}),{deployedRules:G,isOn:K,toggleRule:we,packOn:Te,packState:Ee,allRules:q}=W;if(k)return(0,j.jsx)(E,{error:k});if(!D||h)return(0,j.jsx)(S,{});let J={ontology:D.nouns?.ontology||`Ethos`,law:D.nouns?.law||`Dictate`,laws:D.nouns?.laws||`Dictates`,doctrines:D.nouns?.doctrines||`Doctrines`},De=(e,t)=>{let n=O(e,t);return v&&C[e]&&n===`Hook gate`?`Unknown`:n},Oe=V.filter(e=>e.tier===`ontology`).map(e=>({addr:e.name,no:``,name:e.title,latin:``,ess:``,status:`Always`,statusTone:`ok`,enf:e.name===pe&&(z||v)?De(`ownership`,z):`Instruction`,c:`var(--text-3)`,src:`ontology/universal.md`})),Y=V.filter(e=>(e.tier??`invariant`)===`invariant`).map(e=>{let n=e.klass&&u[e.klass]?e.klass:`craft`,r=re(e.title);return{addr:e.name,no:e.name,name:r.name,latin:r.latin,ess:e.summary||``,retired:r.retired,status:r.retired?`Retired`:`Active`,statusTone:r.retired?``:`ok`,enf:r.retired?`None`:De(e.name,t?.install),cat:n,c:u[n].c,off:r.retired,src:`laws/universal.md`}}),ke=B?[{addr:`ownership`,name:C.ownership.label,latin:``,ess:``,enf:O(`ownership`,z)}]:[],Ae=e=>K(e)?!1:_.has(e)?!0:!C[e]||v?!1:U(e)&&!G.includes(e),je=e=>{let t=K(e.addr),n=G.includes(e.addr),r=t===n?t?`Active`:`Off`:t?`Staged on`:`Staged off`;return{...e,enf:v&&C[e.addr]&&e.enf===`Hook gate`?`Unknown`:e.enf,note:Ae(e.addr)?`Text excluded; the hook still asks.`:``,off:!t,status:r,statusTone:t?`ok`:t===n?``:`warn`}},Me=H.filter(e=>e.active).flatMap(e=>e.rules.filter(e=>!G.includes(e.addr)).map(e=>e.addr)),Ne=async e=>{if(!B)return;let{key:t,label:n}=C[e],r=n.toLowerCase(),i=!U(e),a=p(z),o=W.dirty?` Your staged doctrine changes are not part of this rebuild; they stay staged.`:``;await T((i?`Re-arm the ${r} on ${a}? ${y[e].arm} It rebuilds in place, non-destructive.`:`Switch the ${r} off on ${a}? ${y[e].off} It rebuilds in place, non-destructive.`)+o,{title:i?`Re-arm the ${r}?`:`Switch the ${r} off?`,confirmLabel:i?`Re-arm`:`Switch off`})&&l(`install`,{...z,[t]:i})},Pe=(e,t)=>(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${U(e)?` on`:``}`,role:`switch`,"aria-checked":U(e),"aria-label":t?`${C[e].label}: hook gate of ${t}`:C[e].label,onClick:()=>Ne(e)}),Fe=(e,t)=>(0,j.jsxs)(`span`,{className:`no-gate`,title:t,children:[e,(0,j.jsxs)(`span`,{className:`sr-only`,children:[`: `,t]})]}),Ie=(e,t)=>[(0,j.jsx)(`span`,{className:`toggle-cell`,children:e},`text`),(0,j.jsx)(`span`,{className:`toggle-cell`,children:t},`gate`)],Le=e=>C[e.addr]?Pe(e.addr,e.name):e.addr===he?Fe(`with text`,`No switch of its own: excluding ${e.name} drops its commit and push ask in the same rebuild (Bob still logs its warning).`):f.has(e.addr)?Fe(`with text`,`No switch of its own: excluding ${e.name}, or its pack, drops its hook in the same rebuild.`):_.has(e.addr)?Fe(`always on`,`No switch yet: the hook asks even with ${e.name}'s text excluded.`):null,Re=e=>String(e.addr).includes(`.`)&&K(e.addr)!==G.includes(e.addr),ze=(e,t=I)=>t===`all`||(t===`gated`?e.enf===`Hook gate`&&(C[e.addr]||_.has(e.addr)||!String(e.addr).includes(`.`)||G.includes(e.addr)):Re(e)),X=P.trim().toLowerCase(),Z=e=>ze(e)&&(!X||`${e.addr} ${e.name} ${e.latin} ${e.ess}`.toLowerCase().includes(X)),Be=e=>{let t=Ze[e];(String(e).includes(`.`)?M===`invariants`:t&&M===`doctrines`)&&N(`all`),t&&!ze(t)&&L(`all`),t&&!Z(t)&&F(``),Se.current=me(e),xe(e=>e+1),i(`#/item/law/${encodeURIComponent(e)}`)},Ve={};for(let[e,t]of Object.entries(n?.gates?.asks||{}))Ve[ie(e)]=t;let He=e=>Ve[e.addr]?{...e,asks:`${Ve[e.addr]} ask${Ve[e.addr]===1?``:`s`}`}:e,Q=Y.filter(e=>!e.retired).length,Ue=G.length,We=e=>{if(v)return[`gates unread`,`warn`];let t=e.filter(e=>C[e.addr]&&!U(e.addr)).length;return t?[`${t} gate${t===1?``:`s`} off`,`warn`]:[`always`,`ok`]},Ge=q.length-Ue,Ke=[Ge>0&&`${Ge} excluded`,!v&&!U(`rigor.5`)&&`1 gate off`].filter(Boolean),qe=Ke.length?[Ke.join(` · `),`warn`]:[`all on`,`ok`],$=ae?.stats,Je={ethos:{name:J.ontology,n:Oe.length,fill:1,sub:`${Oe.length} sections`,pill:We(ke)},invariants:{name:J.laws,n:Y.length,fill:Y.length?Q/Y.length:0,sub:Y.length>Q?`${Q} active · ${Y.length-Q} retired`:`${Q} active`,pill:We(Y)},doctrines:{name:J.doctrines,n:q.length,fill:q.length?Ue/q.length:0,sub:`${H.length} packs`,pill:qe},yours:{name:`Your rules`,n:$?.rules??``,fill:+!!$?.rules,sub:$?`${$.rules} rule${$.rules===1?``:`s`} · ≈${$.tokens.toLocaleString(`en-US`)} tok`:`user-rules.md`,href:`#/personal/rules`,pill:[`yours`,``]}},Ye=e=>{if(e===`—`)return`Nothing outranks them.`;let t=e.replace(`{{LAW}}`,J.law);return`${t[0].toUpperCase()}${t.slice(1)}.`},Xe=x.map(e=>({key:e.key,...Je[e.key],rule:Ye(e.against)})),Ze=Object.fromEntries([...Y,...H.flatMap(e=>e.rules)].map(e=>[e.addr,e])),Qe=[[`all`,`All`,Y.length+q.length],[`invariants`,J.laws,Y.length],[`doctrines`,J.doctrines,q.length]],$e=M===`all`||M===`invariants`,et=M===`all`||M===`doctrines`,tt=[...ke,...$e?Y:[],...et?H.flatMap(e=>e.rules):[]],nt=[[`gated`,`Gated`,v?null:tt.filter(e=>ze(e,`gated`)).length],[`changed`,`Changed`,tt.filter(e=>ze(e,`changed`)).length]],rt=e=>String(e).includes(`.`)?String(e).split(`.`)[0]:null,it=e=>I!==`changed`&&_e.has(e)&&rt(R)!==e,at=e=>{let t=it(e);ve(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&rt(R)===e&&i(`#/laws`)},ot=H.flatMap(e=>e.rules.filter(Re).map(e=>({...e,plus:K(e.addr)}))),st=B&&H.length>0&&W.dirty,ct=()=>{L(`changed`),M===`invariants`&&N(`all`),F(``)},lt=(e,t)=>(0,j.jsxs)(`div`,{className:`band-head`,role:`presentation`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,children:e}),(0,j.jsx)(`span`,{className:`mono dim`,children:t})]}),ut=e=>(0,j.jsxs)(`div`,{className:`law-rowhead`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{"data-col":`no`,children:`No.`}),(0,j.jsx)(`span`,{children:`Rule`}),(0,j.jsx)(`span`,{"data-col":`latin`,children:`Latin name`}),(0,j.jsx)(`span`,{"data-col":`status`,children:`Status`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Rule `}),`text`]}),(0,j.jsx)(`span`,{"data-col":`enf`,children:`Enforced by`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Hook `}),`gate`]})]}),dt=Y.filter(Z),ft=(X||I!==`all`?ke.filter(Z).length:0)+($e?dt.length:0)+(et?H.reduce((e,t)=>e+t.rules.filter(Z).length,0):0),pt=He(ke[0]||{}).asks,mt=(e,t)=>B?(0,j.jsxs)(`div`,{className:`law-gate`,children:[(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:C[e].label}),t?(0,j.jsx)(`span`,{className:`law-asks mono`,children:t}):null,(0,j.jsx)(`span`,{className:`law-princ`,children:y[e].desc})]}),Pe(e)]}):null,ht=e=>{let t=te[e];return t?(0,j.jsxs)(`details`,{className:`law-hook`,children:[(0,j.jsx)(`summary`,{children:`What the hook does`}),(0,j.jsxs)(`dl`,{children:[(0,j.jsx)(`dt`,{children:`Triggers on`}),(0,j.jsx)(`dd`,{children:t.on}),(0,j.jsx)(`dt`,{children:`Per host`}),(0,j.jsx)(`dd`,{children:t.hosts}),(0,j.jsx)(`dt`,{children:`Does not see`}),(0,j.jsx)(`dd`,{children:t.blind}),(0,j.jsx)(`dt`,{children:`If switched off`}),(0,j.jsx)(`dd`,{children:t.off})]})]}):null};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(s,{eyebrow:z?[t?.theme,z.footprint&&`${z.footprint} footprint`,p(z)].filter(Boolean).join(` · `):null,title:`Constitution`,sub:`What the agent follows on every turn. Ranked: a lower rank may tighten a higher one, never repeal it. Open any rule to read its canonical text.`,actions:(0,j.jsx)(se,{className:`law-filter`,value:P,onChange:F,placeholder:`Filter rules`,label:`Filter rules`})}),(0,j.jsxs)(`section`,{className:`ladder`,"aria-labelledby":`ladder-h`,children:[(0,j.jsx)(`h2`,{id:`ladder-h`,className:`eyebrow`,children:`Precedence`}),(0,j.jsx)(ue,{tiers:Xe,current:M,onPick:N}),(0,j.jsx)(`div`,{className:`ladder-tail`,children:b.map((e,t)=>(0,j.jsxs)(`span`,{className:`ladder-low`,children:[(0,j.jsxs)(`span`,{className:`mono tier-k`,children:[`RANK `,x.length+t+1]}),` `,e.label,` —`,` `,e.against]},e.source))})]}),(0,j.jsxs)(`div`,{className:`split`,children:[(0,j.jsxs)(`section`,{className:`panel flush law-wrap${B?` with-toggle`:``}`,"aria-label":`Rules`,children:[Oe.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.ontology,`ontology/universal.md`),ut(!1),Oe.map(e=>(0,j.jsx)(le,{law:e,rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:e.addr===pe?(0,j.jsxs)(j.Fragment,{children:[ht(`ownership`),mt(`ownership`,pt)]}):null},e.addr))]}),(0,j.jsxs)(`div`,{className:`law-toolbar`,children:[(0,j.jsx)(ee,{"aria-label":`Show`,children:Qe.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:M===e?`on`:``,"aria-pressed":M===e,onClick:()=>N(e),children:[t,` `,(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))}),(0,j.jsx)(ee,{"aria-label":`Narrow`,children:nt.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:I===e?`on`:``,"aria-pressed":I===e,disabled:n===null,onClick:()=>L(I===e?`all`:e),children:[t,` `,n===null?null:(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))})]}),$e&&dt.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.laws,`laws/universal.md`),ut(B),dt.map(e=>(0,j.jsx)(le,{law:He(e),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:!B||e.retired?null:Ie(Fe(`locked`,`A ${J.law} cannot be excluded: its text always binds.`),C[e.addr]?Pe(e.addr,e.name):null)},e.addr))]}),et&&H.map(e=>{let t=e.rules.filter(Z);if(!t.length)return null;let n=it(e.pack),r=e.rules.filter(e=>K(e.addr)).length;return(0,j.jsxs)(`div`,{className:`pack-wrap${Te(e)?``:` pack-off`}`,children:[(0,j.jsxs)(`div`,{className:`band-head pack-head`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,style:{"--cc":a[e.pack]},children:(0,j.jsx)(`button`,{type:`button`,className:`pack-fold`,"aria-expanded":!n,onClick:()=>at(e.pack),children:e.title})}),(0,j.jsx)(`span`,{className:`mono dim`,children:e.pack}),(0,j.jsx)(`span`,{className:`pack-desc dim`,children:e.desc}),(0,j.jsx)(`span`,{className:`pack-fill`,children:(0,j.jsx)(c,{value:r,max:e.rules.length,label:`${e.title} rules switched on`})}),(0,j.jsx)(`span`,{className:`pack-state mono`,children:Ee(e)})]}),!e.active&&!B&&(0,j.jsxs)(`div`,{className:`pack-enable`,children:[`$ geneseed-build --doctrines`,` `,H.filter(t=>t.active||t.pack===e.pack).map(e=>e.pack).join(`,`),Me.length>0&&` --exclude-rules ${Me.join(`,`)}`]}),!n&&ut(B),!n&&t.map(e=>(0,j.jsx)(le,{law:He(je(e)),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:B?Ie((0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${K(e.addr)?` on`:``}`,role:`switch`,"aria-checked":K(e.addr),"aria-label":`${e.name} rule text`,onClick:()=>we(e.addr)}),Le(e)):null},e.addr))]},e.pack)}),ft===0&&(0,j.jsx)(oe,{title:X||I!==`all`?`No matching rules`:`Nothing in this tier`,children:X?(0,j.jsxs)(j.Fragment,{children:[`Nothing matches “`,P.trim(),`”.`]}):I===`all`?(0,j.jsx)(j.Fragment,{children:`This install predates the tier.`}):(0,j.jsxs)(j.Fragment,{children:[`No `,I,` rule in this tier.`]})})]}),(0,j.jsxs)(`aside`,{className:`aside-stack`,children:[(0,j.jsx)(fe,{packs:H,sel:W,canApply:B,install:z,gateArmed:Ce}),(0,j.jsx)(de,{gates:n?.gates,byAddr:Ze,onJump:Be,disarmed:e=>!!C[e]&&!U(e),install:t?.install,slot:w})]})]}),st&&(0,j.jsxs)(`div`,{className:`law-bar`,role:`region`,"aria-label":`Unapplied changes`,children:[(0,j.jsxs)(`span`,{className:`law-bar-n`,children:[ot.length,` unapplied change`,ot.length===1?``:`s`]}),(0,j.jsx)(`span`,{className:`law-bar-list`,children:ot.map(e=>(0,j.jsxs)(`span`,{className:`badge ${e.plus?`ok`:`warn`}`,children:[e.plus?`+`:`−`,` `,e.no,` `,e.name]},e.addr))}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:ct,children:`Review changes`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{L(`all`),W.revert()},children:`Revert`}),(0,j.jsxs)(`button`,{type:`button`,className:`btn`,onClick:W.applyPacks,children:[`Apply (`,W.pickedRules.length,`/`,q.length,` rules)`]})]})]})}export{P as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{bt as i}from"./index-BQwOmbor.js";import{t as a}from"./FilterInput-qGKNSlxv.js";var o=n(),s=e(t(),1),c=r(),l={experimental:{label:`experimental`,cls:`warn`,icon:`flask`,hint:`Shipped, but not yet confirmed by real use.`},deprecated:{label:`deprecated`,cls:`bad`,icon:`clear`,hint:`On its way out — look for the replacement before building on it.`},personal:{label:`personal`,cls:``,icon:`profile`,hint:`Yours — present in this install, not shipped or versioned by Geneseed.`},unknown:{label:`no status`,cls:``,icon:`about`,hint:`Not listed in registry.json.`}};function u({status:e,withHint:t=!1,compact:n=!1}){let r=l[e];if(!r)return null;if(n)return(0,c.jsxs)(`span`,{className:`badge status-icon ${r.cls}`,title:`${r.label}: ${r.hint}`,children:[(0,c.jsx)(i,{name:r.icon}),(0,c.jsx)(`span`,{className:`sr-only`,children:r.label})]});let a=(0,c.jsxs)(`span`,{className:`badge ${r.cls}`,title:t?void 0:r.hint,children:[(0,c.jsx)(`span`,{className:`dot`}),r.label]});return t?(0,c.jsxs)(c.Fragment,{children:[a,(0,c.jsx)(`span`,{className:`dim`,children:r.hint})]}):a}function d({items:e}){return Object.keys(l).filter(t=>e.some(e=>e.status===t)).map(e=>(0,c.jsxs)(`span`,{title:l[e].hint,children:[(0,c.jsx)(`span`,{className:`badge status-icon ${l[e].cls}`,"aria-hidden":`true`,children:(0,c.jsx)(i,{name:l[e].icon})}),l[e].label]},e))}function f({label:e,total:t,cats:n,cat:r,onChange:i}){if(n.length<=1)return null;let a=[{key:`all`,label:`All`,n:t,c:`var(--text-3)`},...n];return(0,c.jsxs)(`div`,{className:`rail-cats`,children:[(0,c.jsx)(`ul`,{"aria-label":e,children:a.map(({key:e,label:t,n,c:a})=>(0,c.jsx)(`li`,{children:(0,c.jsxs)(`button`,{type:`button`,className:r===e?`on`:``,"aria-pressed":r===e,style:{"--cc":a},onClick:()=>i(e),children:[(0,c.jsx)(`span`,{className:`cdot`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{className:`rc-name`,children:t}),(0,c.jsx)(`span`,{className:`mono dim`,children:n})]})},e))}),(0,c.jsx)(`div`,{className:`rail-mix`,"aria-hidden":`true`,children:n.map(({key:e,n:t,c:n})=>(0,c.jsx)(`span`,{className:r===`all`||r===e?``:`dim`,style:{"--cc":n,flexGrow:t}},e))})]})}function p(e){let t=[],n=new Map;for(let r of e)n.has(r.group)||t.push(r.group),n.set(r.group,(n.get(r.group)||0)+1);return t.map(e=>({key:e,label:e,n:n.get(e),c:`var(--accent)`}))}var m=({name:e})=>(0,c.jsxs)(`span`,{className:`tag acc`,title:`Ships with the ${e} kit`,children:[`kit: `,e]}),h=()=>(0,c.jsx)(`span`,{className:`tag acc`,title:`Every agent inherits this agent's root file`,children:`base`});function g(e,t){let n=(t||``).trim().toLowerCase();return n?e.filter(e=>`${e.title||``} ${e.name||``} ${e.desc||``}`.toLowerCase().includes(n)):e}function _({label:e,count:t,extra:n,tools:r,toolsCompact:i,q:l,onQ:u,matched:d,inView:p,current:m,sections:h,cats:g,cat:_,onCat:v,total:y,catLabel:w,children:T}){let E=C(p),D=E.list,O=S([...p,D]),k=(0,s.useId)(),A=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>x(O.current));let[j,M]=(0,s.useState)(``),N=(0,s.useRef)(!0);return(0,s.useEffect)(()=>{N.current?N.current=!1:M(O.current?.querySelector(`.lib-row.on`)?.dataset.title||``)},p),(0,c.jsxs)(`section`,{className:`lib-list`,"aria-label":e,onKeyDown:e=>{e.key===`ArrowDown`&&e.target.classList?.contains(`lib-filter`)&&(e.preventDefault(),D||(0,o.flushSync)(()=>E.setList(!0)),O.current?.querySelector(`.lib-row`)?.focus())},"data-open":D,children:[(0,c.jsxs)(`div`,{className:`lib-list-head`,children:[(0,c.jsxs)(`b`,{children:[e,` `,(0,c.jsx)(`span`,{className:`mono dim`,children:t})]}),n]}),(0,c.jsxs)(`div`,{className:`lib-toolbar`,children:[h?(0,c.jsx)(`nav`,{className:`lib-seg`,"aria-label":`Sections`,children:h.map(e=>(0,c.jsxs)(`a`,{href:e.href,className:e.on?`on`:``,"aria-current":e.on?`page`:void 0,onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||E.setList(!0)},children:[e.label,(0,c.jsx)(`span`,{className:`mono`,children:e.n??``})]},e.key))}):null,(0,c.jsxs)(`div`,{className:`lib-toolbar-filter`,children:[(0,c.jsx)(a,{value:l,onChange:u,placeholder:`Filter ${e.toLowerCase()}`,label:`Filter ${e}`}),r?(0,c.jsx)(`div`,{className:`lib-tools`,children:r}):null,i?(0,c.jsx)(`div`,{className:`lib-tools-compact`,children:i}):null]}),g?.length>1?(0,c.jsx)(`div`,{className:`lib-chips`,children:(0,c.jsx)(f,{label:w,total:y,cats:g,cat:_,onChange:v})}):null]}),(0,c.jsxs)(`div`,{className:`lib-picker`,children:[(0,c.jsxs)(`button`,{ref:A,type:`button`,className:`lib-list-toggle`,"aria-expanded":D,"aria-controls":k,onClick:()=>E.setList(e=>!e),children:[(0,c.jsx)(`span`,{className:`dim lib-pick-n`,children:d===void 0?``:`${d} ${e.toLowerCase()}`}),(0,c.jsx)(`b`,{children:m}),(0,c.jsx)(`span`,{className:`dim lib-pick-hint`,children:D?`close`:`change`}),(0,c.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,c.jsxs)(`div`,{className:`lib-rows`,id:k,ref:O,onKeyDown:b,onFocus:e=>x(e.currentTarget),onClick:e=>{if(e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0)return;let t=e.target.closest?.(`.lib-row`);t&&!(p[1]&&t.classList.contains(`on`))&&E.pick()},children:[T,l.trim()&&d===0&&(0,c.jsxs)(`div`,{className:`empty`,style:{padding:32},children:[(0,c.jsx)(`div`,{className:`big`,children:`No matches`}),`Nothing in `,e.toLowerCase(),` matches “`,l.trim(),`”.`]})]})]}),(0,c.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:j?`${j} opened`:``})]})}function v({item:e,isOpen:t,href:n,children:r}){return(0,c.jsxs)(`a`,{className:`lib-row${t?` on`:``}`,href:n,"aria-current":t?`true`:void 0,"data-title":e.title||e.name,"data-pinned":e.base?`true`:void 0,children:[(0,c.jsxs)(`span`,{className:`lr-name`,children:[e.title||e.name,(0,c.jsx)(u,{status:e.status,compact:!0}),e.kit?(0,c.jsx)(m,{name:e.kit}):null,e.base?(0,c.jsx)(h,{}):null,r]}),e.desc?(0,c.jsx)(`span`,{className:`lr-desc`,children:e.desc}):null,e.meta?(0,c.jsx)(`span`,{className:`lr-meta mono`,children:e.meta}):null]})}function y({rows:e,activeName:t,hrefOf:n,pills:r}){let i=null,a=[];for(let o of e)o.group&&o.group!==i&&(i=o.group,a.push((0,c.jsxs)(`div`,{className:`lib-group`,children:[o.groupC?(0,c.jsx)(`span`,{className:`cdot`,style:{"--cc":o.groupC},"aria-hidden":`true`}):null,o.group]},`g-${o.group}`))),a.push((0,c.jsx)(v,{item:o,isOpen:t===o.name,href:n(o),children:r?.(o)},o.name));return a}function b(e){let t=[...e.currentTarget.querySelectorAll(`.lib-row`)],n=t.indexOf(document.activeElement);if(n===-1)return;let r={ArrowDown:Math.min(n+1,t.length-1),ArrowUp:Math.max(n-1,0),Home:0,End:t.length-1}[e.key];r!==void 0&&(e.preventDefault(),t[r].focus())}function x(e){if(!e)return;let t=[...e.querySelectorAll(`.lib-row`)],n=t.find(e=>e===document.activeElement)||e.querySelector(`.lib-row.on`)||t[0];for(let e of t)e.tabIndex=e===n?0:-1}function S(e){let t=(0,s.useRef)(null);return(0,s.useEffect)(()=>{let e=t.current,n=e?.querySelector(`.lib-row.on`);if(!n||!e)return;let r=n.offsetTop;r>=e.scrollTop&&r+n.clientHeight<=e.scrollTop+e.clientHeight||(e.scrollTop=Math.max(0,r-e.clientHeight/2+n.clientHeight/2))},e),t}function C([e,t]){let[n,r]=(0,s.useState)(!t),[i,a]=(0,s.useState)([e,t]),[o,c]=(0,s.useState)(!1);return(i[0]!==e||i[1]!==t)&&(a([e,t]),r(o||!t),c(!1)),{list:n,setList:r,pick:()=>c(!0)}}export{g as a,u as c,_ as i,d as l,y as n,f as o,m as r,p as s,h as t};