geneseed 5.2.0 → 5.3.1

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 (190) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +4 -4
  3. package/SHIPPED.md +1 -1
  4. package/adapters/bob/README.md +31 -18
  5. package/adapters/claude-code/README.md +27 -22
  6. package/adapters/openclaude/README.md +18 -8
  7. package/adapters/opencode/HOW-OPENCODE-LOADS.md +8 -3
  8. package/adapters/opencode/plugins/geneseed-activity.js +20 -21
  9. package/adapters/opencode/plugins/geneseed-context.js +224 -71
  10. package/adapters/opencode/plugins/geneseed-guard.js +420 -203
  11. package/adapters/opencode/plugins/geneseed-workflow.js +3 -2
  12. package/adapters/opencode/workflows/_runtime.js +3 -2
  13. package/bin/geneseed-cli.mjs +61 -16
  14. package/bin/geneseed-hook.mjs +94 -12
  15. package/docs/concepts/enforcement-table.md +1 -1
  16. package/docs/concepts/exclusions.md +2 -2
  17. package/docs/concepts/factories.md +40 -6
  18. package/docs/concepts/footprint.md +11 -1
  19. package/docs/concepts/foreman-mode.md +2 -2
  20. package/docs/concepts/hook-gates.md +3 -3
  21. package/docs/concepts/host-matrix.md +22 -4
  22. package/docs/concepts/loop-gates.md +1 -1
  23. package/docs/concepts/loops.md +2 -2
  24. package/docs/concepts/shared-tier.md +1 -1
  25. package/docs/design-history.md +148 -0
  26. package/docs/extending.md +97 -163
  27. package/docs/guides/install-bob.md +2 -2
  28. package/docs/guides/install-openclaude.md +1 -1
  29. package/docs/guides/run-a-factory.md +15 -2
  30. package/docs/guides/upgrade.md +2 -2
  31. package/docs/guides/verify.md +12 -0
  32. package/docs/reference/environment.md +1 -0
  33. package/docs/reference/factory-actions.md +6 -5
  34. package/docs/reference/troubleshoot-doctor.md +1 -1
  35. package/docs/reference/troubleshoot-update.md +1 -1
  36. package/docs/token-footprint.md +66 -2
  37. package/docs/understand/design-choices-hosts.md +1 -1
  38. package/docs/understand/design-choices-shape.md +1 -0
  39. package/docs/understand/enforced-vs-asked.md +1 -1
  40. package/docs/understand/machine-bob.md +1 -1
  41. package/docs/web-ui.md +21 -3
  42. package/harness.config.json +1 -1
  43. package/js/README.md +7 -5
  44. package/js/build/args.mjs +4 -4
  45. package/js/build/driver.mjs +1 -1
  46. package/js/build/emit-claude.mjs +1 -1
  47. package/js/build/generate.mjs +5 -14
  48. package/js/build/render.mjs +44 -24
  49. package/js/cli-table.json +135 -59
  50. package/js/factory/cli.mjs +24 -5
  51. package/js/factory/graph.mjs +13 -9
  52. package/js/factory/metrics.mjs +93 -0
  53. package/js/factory/registry.mjs +37 -12
  54. package/js/factory/state.mjs +25 -6
  55. package/js/hosts/done-checks.mjs +6 -0
  56. package/js/hosts/geneseed-dir.mjs +3 -2
  57. package/js/hosts/gitref.mjs +5 -3
  58. package/js/hosts/hook-tap.mjs +104 -0
  59. package/js/hosts/hooks-context.mjs +30 -3
  60. package/js/hosts/hooks-learn.mjs +47 -16
  61. package/js/hosts/hooks-prims.mjs +52 -3
  62. package/js/hosts/hooks.mjs +69 -42
  63. package/js/hosts/hosts.mjs +80 -12
  64. package/js/hosts/installs.mjs +7 -0
  65. package/js/hosts/loss.mjs +6 -1
  66. package/js/hosts/native.mjs +14 -5
  67. package/js/hosts/owned.mjs +7 -6
  68. package/js/hosts/ownership-gate.mjs +14 -1
  69. package/js/hosts/settings.mjs +245 -103
  70. package/js/hosts/shim.mjs +4 -4
  71. package/js/hosts/usage.mjs +9 -3
  72. package/js/inspect/checks-probe.mjs +66 -5
  73. package/js/inspect/checks-repo.mjs +196 -2
  74. package/js/inspect/cost.mjs +34 -2
  75. package/js/inspect/diff.mjs +16 -1
  76. package/js/inspect/doctor.mjs +13 -4
  77. package/js/inspect/excludes.mjs +18 -6
  78. package/js/inspect/status.mjs +35 -7
  79. package/js/inspect/validate.mjs +44 -21
  80. package/js/lib/machine-dir.mjs +1 -1
  81. package/js/lib/node-floor.mjs +46 -6
  82. package/js/maintain/uninstall.mjs +70 -17
  83. package/js/maintain/update.mjs +31 -7
  84. package/js/ui/cli.mjs +34 -4
  85. package/js/ui/menu.mjs +1 -1
  86. package/js/ui/tui.mjs +11 -14
  87. package/js/web/actions.mjs +3 -9
  88. package/js/web/api.mjs +28 -10
  89. package/js/web/daemon.mjs +0 -1
  90. package/js/web/server.mjs +1 -0
  91. package/js/web/state.mjs +37 -16
  92. package/package.json +1 -1
  93. package/src/AGENT.md.tmpl +23 -17
  94. package/src/agents/_template.md +1 -1
  95. package/src/agents/advocate.md +1 -1
  96. package/src/agents/developer.md +12 -3
  97. package/src/agents/empiricist.md +1 -1
  98. package/src/agents/framer.md +1 -1
  99. package/src/agents/historian.md +1 -1
  100. package/src/agents/operator.md +1 -1
  101. package/src/agents/pragmatist.md +1 -1
  102. package/src/agents/researcher.md +1 -1
  103. package/src/agents/skeptic.md +1 -1
  104. package/src/agents/steward.md +1 -1
  105. package/src/agents/user-advocate.md +1 -1
  106. package/src/agents/visionary.md +1 -1
  107. package/src/bricks/intake.md +10 -3
  108. package/src/bricks/retro.md +13 -3
  109. package/src/doctrines/comms.md +1 -1
  110. package/src/doctrines/ops.md +1 -1
  111. package/src/doctrines/process.md +7 -5
  112. package/src/factories/analysis-to-build.json +1 -0
  113. package/src/factories/bug-report-to-fix.json +1 -0
  114. package/src/factories/issue-to-pr.json +1 -0
  115. package/src/laws/universal.md +2 -2
  116. package/src/modes/foreman.md +8 -14
  117. package/src/skills/commit.md +7 -2
  118. package/src/skills/debug.md +1 -1
  119. package/src/skills/diagram-design/SKILL.md +1 -1
  120. package/src/skills/diagram-design/VENDOR.md +3 -1
  121. package/src/skills/factory-forge.md +5 -3
  122. package/src/skills/factory.md +22 -1
  123. package/src/skills/geneseed.md +1 -1
  124. package/src/skills/handoff.md +1 -1
  125. package/src/skills/parallel-agents.md +1 -1
  126. package/src/skills/pipeline.md +6 -6
  127. package/src/skills/plan.md +7 -3
  128. package/src/skills/spring-testing.md +1 -1
  129. package/themes/biker.json +78 -78
  130. package/themes/commentator.json +81 -81
  131. package/themes/cyberpunk.json +79 -79
  132. package/themes/gamer.json +77 -77
  133. package/themes/imperial.json +82 -82
  134. package/themes/joker.json +79 -79
  135. package/themes/marvin.json +82 -82
  136. package/themes/mean.json +82 -82
  137. package/themes/military.json +78 -78
  138. package/themes/neutral.json +78 -78
  139. package/themes/pirate.json +79 -79
  140. package/themes/sports.json +79 -79
  141. package/themes/verstappen.json +78 -78
  142. package/themes/wizard.json +79 -79
  143. package/web/dist/assets/ActiveLoops-BJJN3P-V.js +1 -0
  144. package/web/dist/assets/Activity-WQ3ykgxU.js +1 -0
  145. package/web/dist/assets/ActivityDetail-7rt04SkS.js +1 -0
  146. package/web/dist/assets/{Bonsai-DSwUbavu.js → Bonsai-BBl4XXqs.js} +1 -1
  147. package/web/dist/assets/{CopyButton-BzRQz7k2.js → CopyButton-Beven8yn.js} +1 -1
  148. package/web/dist/assets/Dashboard-BgLArtgu.js +2 -0
  149. package/web/dist/assets/Docs-B5aHp86J.js +5 -0
  150. package/web/dist/assets/Factories-BjqzXAw8.js +1 -0
  151. package/web/dist/assets/GreenhouseView-Bce212qd.js +1 -0
  152. package/web/dist/assets/Installs-B1OsrHXF.js +3 -0
  153. package/web/dist/assets/JournalView-CV4omyww.js +1 -0
  154. package/web/dist/assets/Kits-CW1e7xNa.js +1 -0
  155. package/web/dist/assets/Laws-1Ckf1lbs.js +4 -0
  156. package/web/dist/assets/LibRows-Dag1s0ZX.js +1 -0
  157. package/web/dist/assets/Library-B3FuFLel.js +3 -0
  158. package/web/dist/assets/Loops-CwqgnLNw.js +2 -0
  159. package/web/dist/assets/Markdown-CxkA7940.js +71 -0
  160. package/web/dist/assets/OperatorHudView-JmYY1pBR.js +1 -0
  161. package/web/dist/assets/Personal-DKLgLa7Z.js +2 -0
  162. package/web/dist/assets/Settings-BwErnh-R.js +1 -0
  163. package/web/dist/assets/Tabs-8zsyEPSK.js +1 -0
  164. package/web/dist/assets/index-CRWqKxfY.css +1 -0
  165. package/web/dist/assets/index-Ce6qF2nG.js +6 -0
  166. package/web/dist/assets/usePoll-D5c_qIFZ.js +1 -0
  167. package/web/dist/index.html +2 -2
  168. package/adapters/claude-code/settings.json +0 -52
  169. package/web/dist/assets/ActiveLoops-BTHIaRhn.js +0 -1
  170. package/web/dist/assets/Activity-DlQ30znB.js +0 -1
  171. package/web/dist/assets/ActivityDetail-CG0mn5fW.js +0 -1
  172. package/web/dist/assets/Dashboard-Ce3UOsxJ.js +0 -2
  173. package/web/dist/assets/Docs-CisVnYqv.js +0 -5
  174. package/web/dist/assets/Factories-Dq5oW4CU.js +0 -1
  175. package/web/dist/assets/GreenhouseView-y9WAfcc_.js +0 -1
  176. package/web/dist/assets/Installs-m4GElwFW.js +0 -3
  177. package/web/dist/assets/JournalView-DeBLRNGc.js +0 -1
  178. package/web/dist/assets/Kits-DJYVAnyE.js +0 -1
  179. package/web/dist/assets/Laws-CNpc_8ZV.js +0 -4
  180. package/web/dist/assets/LibRows-RO5bvXth.js +0 -1
  181. package/web/dist/assets/Library-Dg0ScciC.js +0 -3
  182. package/web/dist/assets/Loops-CjEdo-NG.js +0 -2
  183. package/web/dist/assets/Markdown-0ORz7tAc.js +0 -69
  184. package/web/dist/assets/OperatorHudView-2ujVMjq1.js +0 -1
  185. package/web/dist/assets/Personal-D0yS7ahT.js +0 -2
  186. package/web/dist/assets/Settings-DEN0U8QI.js +0 -1
  187. package/web/dist/assets/Tabs-But5R6_r.js +0 -1
  188. package/web/dist/assets/index-Ck42AbRX.js +0 -6
  189. package/web/dist/assets/index-PG_ukkh6.css +0 -1
  190. package/web/dist/assets/usePoll-o8ul-Sog.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Et as i,Ot as a,Q as o,Z as s,_t as c,at as l,it as u,kt as d,rt as f,vt as p}from"./index-Ck42AbRX.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-RO5bvXth.js";import{t as x}from"./CopyButton-BzRQz7k2.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 +0,0 @@
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-Ck42AbRX.js";import{i as d,n as f,r as p}from"./Dashboard-Ce3UOsxJ.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 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Et as i,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-Ck42AbRX.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{t as C}from"./Tabs-But5R6_r.js";import{n as w,r as T,t as ee}from"./controls-D4wmg_pl.js";var E=e(t(),1),D=n();function te({host:e,theme:t,options:n,onAction:i,onClose:a,onNote:o}){let[s,c]=(0,E.useState)({path:``,host:e,theme:t,footprint:`lean`,posture:`peer`,mode:`direct`,trust:`balanced`}),[l,u]=(0,E.useState)(!1),[d,f]=(0,E.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,D.jsxs)(`div`,{className:`deploy-pop`,children:[(0,D.jsxs)(`div`,{className:`dp-row`,children:[(0,D.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,D.jsx)(`button`,{className:`btn ghost sm`,disabled:l,onClick:h,children:l?`Choosing…`:`Browse…`})]}),d?(0,D.jsx)(`p`,{id:`dp-path-err`,className:`tag bad note`,role:`alert`,children:d}):null,(0,D.jsxs)(`div`,{className:`dp-row`,children:[(0,D.jsxs)(`label`,{className:`dp-field`,children:[(0,D.jsx)(`span`,{children:`Deploy as`}),(0,D.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,D.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,D.jsx)(w,{value:s,options:n,onChange:p,who:`the new install`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:_,children:`Deploy`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,children:`Cancel`})]}),(0,D.jsxs)(`p`,{className:`sub dp-note`,children:[`Adds a per-repo harness (`,(0,D.jsx)(`code`,{children:g(s.host).deployAdds}),`) into the folder, non-destructively. It’s then tracked here even after you leave its directory.`]})]})}function O(){let{data:e,error:t,reload:n}=i(()=>r.excludes(),[]),[a,o]=(0,E.useState)(!1),[s,c]=(0,E.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,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`card-head`,children:(0,D.jsx)(`h3`,{children:`Excluded folders`})}),(0,D.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,D.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,D.jsx)(`code`,{children:e.path}),(0,D.jsx)(`span`,{className:`mono muted`,children:e.hosts.map(e=>g(e).label).join(`, `)}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:a,"aria-label":`Stop excluding ${e.path}`,onClick:()=>l(`remove`,e.path),children:`Remove`})]},e.path)),(0,D.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,D.jsx)(f,{name:`folder`}),` Exclude a folder…`]}),s.map((e,t)=>(0,D.jsx)(`p`,{className:`sub`,children:e},t))]})}var k=`This project sees your machine-wide rules, profile and memory map, so what you taught one tool or repo applies here too.`,A=`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 j({targets:e,onReveal:t}){let n=e.flatMap(e=>e.servers);return(0,D.jsxs)(`div`,{className:`ip-block`,children:[(0,D.jsxs)(`span`,{className:`ip-label`,children:[`MCP servers `,(0,D.jsx)(`span`,{className:`mono dim`,children:n.length})]}),e.map(e=>(0,D.jsxs)(`div`,{className:`mcp-target`,children:[(0,D.jsxs)(`div`,{className:`mt-head`,children:[(0,D.jsx)(`code`,{title:e.path,children:e.label}),e.exists?(0,D.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,D.jsxs)(`div`,{className:`mcp-row`,children:[(0,D.jsx)(`span`,{className:`mono`,children:e.name}),(0,D.jsx)(`span`,{className:`tag ${e.state===`enabled`?`ok`:`warn`}`,children:e.state===`enabled`?`Enabled`:`Disabled`})]},e.name)):(0,D.jsx)(`p`,{className:`sub`,children:`None configured in this file.`}):(0,D.jsxs)(`p`,{className:`sub`,children:[`No MCP file yet (it would be `,(0,D.jsx)(`code`,{children:e.path}),`).`]})]},e.path))]})}var M=6;function N({leftovers:e,canAct:t,busy:n,onForce:r}){let i=e?.kept||[],a=e?.stale||[],o=[...i,...a];return o.length?(0,D.jsxs)(`div`,{className:`ip-block ip-leftovers`,role:`group`,"aria-label":`Files a rebuild keeps`,children:[(0,D.jsxs)(`span`,{className:`ip-label`,children:[`Not Geneseed’s copy `,(0,D.jsx)(`span`,{className:`mono dim`,children:o.length})]}),i.length?(0,D.jsxs)(`p`,{className:`sub`,children:[i.length===1?`This file is yours`:`These files are yours`,` where Geneseed ships its own: you edited a shipped file, or had one under the same name. A rebuild keeps`,` `,i.length===1?`it`:`them`,`.`]}):null,a.length?(0,D.jsxs)(`p`,{className:`sub`,children:[a.length===1?`One retired skill was`:`${a.length} retired skills were`,` `,`left by an older version. A rebuild leaves `,a.length===1?`it`:`them`,` in place.`]}):null,(0,D.jsxs)(`ul`,{className:`ip-files`,children:[o.slice(0,M).map(e=>(0,D.jsx)(`li`,{children:(0,D.jsx)(`code`,{title:e,children:e})},e)),o.length>M?(0,D.jsxs)(`li`,{className:`dim`,children:[`and `,o.length-M,` more`]}):null]}),t?(0,D.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,disabled:n,onClick:r,children:`Replace with Geneseed’s copies…`}):null,(0,D.jsx)(`p`,{className:`sub`,children:`Skills and agents under your own names, memory, notebook, rules and profile are never touched. To keep a file of yours for good, exclude that skill instead.`})]}):null}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,onForce:m}){let _=`${g(e.host).label} · ${e.scope}`,[v,y]=P[e.state]||P.absent,b=e.state===`active`,x=e.state===`absent`;return(0,D.jsxs)(`aside`,{className:`install-panel`,"aria-label":`${_} install`,children:[(0,D.jsx)(`span`,{className:`ip-eyebrow`,children:`Selected install`}),(0,D.jsxs)(`div`,{className:`ip-head`,children:[(0,D.jsx)(`h2`,{children:h(e)}),(0,D.jsx)(`span`,{className:`tag ${y}`,children:v})]}),(0,D.jsx)(`span`,{className:`ip-kind`,children:e.scope===`global`?`Global install`:`Per-project install · ${g(e.host).label}`}),(0,D.jsx)(`code`,{className:`ip-path`,children:e.path}),x?(0,D.jsxs)(`p`,{className:`sub`,children:[`Install Geneseed here as `,(0,D.jsx)(`strong`,{children:g(e.host).label}),`. Files are added non-destructively; deactivate or uninstall later.`]}):null,(b||x)&&o?(0,D.jsxs)(`div`,{className:`ip-picks`,children:[(0,D.jsx)(w,{value:n,options:i,onChange:a,who:_}),(0,D.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,D.jsx)(`a`,{href:`#/docs/footprint`,children:`Learn more →`})]})]}):null,(b||x)&&o&&e.scope!==`global`?(0,D.jsxs)(`div`,{className:`ip-block`,children:[(0,D.jsxs)(`label`,{className:`ip-switch`,children:[(0,D.jsx)(T,{on:!!n.sharedTier,label:`shared tier for ${_}`,onToggle:()=>a(`sharedTier`,!n.sharedTier)}),(0,D.jsx)(`span`,{children:`Read the machine-wide shared tier`})]}),(0,D.jsxs)(`p`,{className:`sub`,children:[(0,D.jsx)(`strong`,{children:`Benefit:`}),` `,k]}),(0,D.jsxs)(`p`,{className:`sub`,children:[(0,D.jsx)(`strong`,{children:`Cost:`}),` `,A]})]}):null,b?(0,D.jsx)(N,{leftovers:e.leftovers,canAct:o,busy:s,onForce:m}):null,b&&t.length?(0,D.jsx)(j,{targets:t,onReveal:p}):null,b&&e.scope===`global`?(0,D.jsx)(O,{}):null,x?null:(0,D.jsxs)(`label`,{className:`ip-switch`,children:[(0,D.jsx)(T,{on:b,disabled:s,label:`activate ${_}`,onToggle:d}),(0,D.jsx)(`span`,{children:b?`Active: loads in every session`:`Disabled: files moved aside`})]}),(0,D.jsx)(`div`,{className:`ip-spacer`}),o?(0,D.jsxs)(`div`,{className:`ip-actions`,children:[x?(0,D.jsx)(`button`,{type:`button`,className:`btn`,onClick:u,children:`Install`}):b?(0,D.jsx)(`button`,{type:`button`,className:`btn`,disabled:r,onClick:u,children:`Apply and rebuild`}):null,x?null:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`On uninstall, memory and notebook`}),(0,D.jsxs)(`select`,{className:`sel`,value:c,onChange:e=>l(e.target.value),children:[(0,D.jsx)(`option`,{value:`keep`,children:`keep in place`}),(0,D.jsx)(`option`,{value:`archive`,children:`archive aside`}),(0,D.jsx)(`option`,{value:`delete`,children:`delete too`})]})]}),(0,D.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,"aria-label":`remove ${_} 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,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`preview-h`,children:[(0,D.jsx)(`div`,{className:`panel-head`,children:(0,D.jsx)(`h2`,{id:`preview-h`,children:`Next rebuild`})}),n?(0,D.jsx)(v,{error:n,onRetry:a}):t?(0,D.jsxs)(D.Fragment,{children:[t.folds.length?(0,D.jsx)(`ul`,{className:`preview-list`,children:t.folds.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`b`,{className:`mono`,children:e.host}),` `,e.summary||`nothing to fold`,e.failed.map(e=>(0,D.jsxs)(`div`,{className:`t-warn`,children:[`The fold would stop at `,e]},e))]},e.host))}):(0,D.jsx)(`p`,{className:`dim`,children:`No global install to fold.`}),t.orphans.length?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h3`,{children:`Orphans`}),(0,D.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,D.jsx)(`ul`,{className:`preview-list mono`,children:t.orphans.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}):null]}):(0,D.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 H(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 U({inst:e,fleet:t,version:n,onEdits:r}){if(t===void 0)return(0,D.jsx)(`span`,{className:`dim`,children:`…`});if(!t)return(0,D.jsx)(`span`,{className:`dim`,children:`—`});let i=t.drift?.stale??0,a=t.diffable?b(t.drift):0;return(0,D.jsxs)(`div`,{className:`sync-cell`,children:[t.diffable&&i+a>0?(0,D.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,D.jsx)(`span`,{className:`dim`,children:H(t,n)}),t.diffable?null:(0,D.jsxs)(`span`,{className:`dim`,title:`Local edits are only checked for global installs`,children:[` `,`· not checkable`]}),a?(0,D.jsxs)(D.Fragment,{children:[` `,(0,D.jsx)(`a`,{href:`#/installs/edits`,onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e)},children:`Local edits`})]}):null]})}function ne({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,D.jsx)(`div`,{className:`tbl-scroll`,children:(0,D.jsxs)(`table`,{className:`tbl hosts-tbl`,"aria-label":i,children:[(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`th`,{scope:`col`,children:t?`Project`:`Host`}),(0,D.jsx)(`th`,{scope:`col`,children:`State`}),(0,D.jsx)(`th`,{scope:`col`,children:`Sync with source`}),(0,D.jsx)(`th`,{scope:`col`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Selected`})})]})}),(0,D.jsx)(`tbody`,{children:e.map(e=>{let[i,u]=z[e.state]||[`Not installed`,``],d=n===e.id,f=e.state===`absent`;return(0,D.jsxs)(`tr`,{className:`pickable${d?` on`:``}${f?` quiet`:``}`,onClick:()=>r(e.id),children:[(0,D.jsxs)(`td`,{children:[(0,D.jsx)(`button`,{type:`button`,className:`row-pick`,"aria-pressed":d,title:e.path,onClick:()=>r(e.id),children:h(e)}),(0,D.jsx)(`div`,{className:`mono path-cell`,title:e.path,children:t?g(e.host).label:e.path})]}),(0,D.jsxs)(`td`,{children:[(0,D.jsx)(`span`,{className:`tag ${u}`,children:i}),e.default?(0,D.jsxs)(D.Fragment,{children:[` `,(0,D.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,D.jsxs)(D.Fragment,{children:[` `,(0,D.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,D.jsxs)(D.Fragment,{children:[` `,(0,D.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,D.jsx)(`td`,{children:(0,D.jsx)(U,{inst:e,fleet:l(e),version:a?.version,onEdits:o})}),(0,D.jsx)(`td`,{className:`pick-mark`,children:d?`Editing ›`:``})]},e.id)})})]})})}function re({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,D.jsxs)(`details`,{className:`panel voice-ref`,children:[(0,D.jsxs)(`summary`,{children:[(0,D.jsx)(`span`,{className:`vr-title`,children:`Voices`}),(0,D.jsxs)(`span`,{className:`mono dim`,children:[e.length,` to choose from, set per install`]})]}),(0,D.jsx)(`div`,{className:`vr-list`,children:n.map(e=>(0,D.jsxs)(`div`,{className:`voice-row${e.name===t?` current`:``}`,children:[(0,D.jsx)(`span`,{className:`vr-name`,children:e.name}),(0,D.jsx)(`span`,{className:`vr-desc`,children:e.tagline?`“${e.tagline}”`:e.blurb})]},e.name))})]})}function ie({setup:e,overview:t}){if(!e)return null;let n=e.installed_fp&&e.installed_fp===e.source_fp;return(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`checkout-h`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`checkout-h`,children:`This checkout`}),(0,D.jsx)(`span`,{className:`mono ${n?`t-good`:`t-warn`}`,children:n?`in sync`:e.version_verdict})]}),(0,D.jsxs)(`dl`,{className:`kv-grid`,children:[(0,D.jsx)(`dt`,{children:`Source`}),(0,D.jsx)(`dd`,{className:`mono`,children:e.root}),(0,D.jsx)(`dt`,{children:`Version`}),(0,D.jsx)(`dd`,{className:`mono`,children:t?.version||`unknown`}),(0,D.jsx)(`dt`,{children:`Fingerprint`}),(0,D.jsx)(`dd`,{className:`mono`,children:e.source_fp})]})]})}function ae({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:O,error:k}=i(()=>r.fleet(),[c]),A=k?null:O??void 0,[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(``),[z,B]=(0,E.useState)({}),[V,H]=(0,E.useState)(!1),[U,ae]=(0,E.useState)(!1),[W,G]=(0,E.useState)({id:``,value:`keep`}),K=e=>W.id===e?.id?W.value:`keep`,[q,J]=(0,E.useState)(()=>l(`hosts`)),oe=(0,E.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,D.jsx)(v,{error:y||w,onRetry:()=>{b(),T()}});if(!m||!C)return(0,D.jsx)(_,{});let Y={active:0,disabled:1,absent:2},X=[...m.installs].sort((e,t)=>(e.scope===`global`?0:1)-(t.scope===`global`?0:1)||(Y[e.state]??3)-(Y[t.state]??3)),Z=X.find(e=>e.id===q)||X.find(e=>e.default)||X.find(e=>e.state===`active`)||X[0],Q=e=>{let t=z[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}},se=(e,t,n)=>B(r=>({...r,[e.id]:{...r[e.id],[t]:n}})),ce=e=>{let t=Q(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)},le={theme:t.map(e=>e.name),footprint:ee,posture:m.postures||[],mode:m.modes||[],trust:m.trusts||[]},ue=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o,sharedTier:s}=Q(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}})},de=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o,sharedTier:s}=Q(t),c=t.leftovers?.kept||[],l=t.leftovers?.stale||[],u=e=>e.slice(0,8).join(`, `)+(e.length>8?`, and ${e.length-8} more`:``),f=(c.length?`Replace with Geneseed’s copy: ${u(c)}. Your version of each is overwritten. `:``)+(l.length?`Remove: ${u(l)}. `:``)+`Nothing else is touched.`;await d(f,{title:`Replace your files with Geneseed’s?`,confirmLabel:`Replace and rebuild`,tone:`danger`})&&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},force:!0})},fe=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`})){P(e.id),M(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(`, `):``;M({text:t.error||e&&`unrestored: ${e}`||`action failed`,tone:`bad`});return}u?.()}catch(e){M({text:e.message,tone:`bad`})}finally{P(``)}}},$=async e=>{P(e.id),M(null);try{await r.setDefaultInstall(e.host,e.path),u?.()}catch(e){M({text:e.message,tone:`bad`})}finally{P(``)}},pe=(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}`},me=async e=>{let t=K(e),n=e.scope===`project`?` and de-lists it`:`; the row stays, marked “not installed”`,i=t===`delete`?`, and permanently deletes ${pe(e,`memory`)} and ${pe(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`})){P(e.id),M(null);try{let n=await r.installRemove(e.host,e.path,t);if(!n.ok){M({text:n.error||`remove failed`,tone:`bad`});return}G({id:``,value:`keep`}),n.kept?.length&&M({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){M({text:e.message,tone:`bad`})}finally{P(``)}}},he=async e=>{M(null);try{let t=await r.mcpReveal(e.path);M({text:`Opening ${t.dir}. If no window appeared, open that folder by hand.`,tone:``})}catch(e){M({text:e.message,tone:`bad`})}},ge=async()=>{let t=X.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`)},_e=X.find(e=>e.default)?.host||X.find(e=>e.state===`active`)?.host||X[0]?.host||`opencode`,ve=X.filter(e=>e.scope===`global`),ye=X.filter(e=>e.scope!==`global`),be=e=>{J(e)},xe=e=>{o(`edits`,e.id),window.location.hash=`#/installs/edits`};return(0,D.jsxs)(`div`,{className:`hosts`,children:[(0,D.jsxs)(`div`,{className:`hosts-main`,children:[(0,D.jsxs)(`div`,{className:`toolbar`,children:[(0,D.jsxs)(`span`,{className:`dim`,children:[X.filter(e=>e.state!==`absent`).length,` installed.`]}),(0,D.jsxs)(`div`,{className:`row gap-8`,children:[(0,D.jsx)(`button`,{type:`button`,className:`btn ghost`,"aria-expanded":U,onClick:()=>ae(e=>!e),children:`Preview next rebuild`}),e?(0,D.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:ge,children:[(0,D.jsx)(f,{name:`refresh`}),` Rebuild all`]}):null]})]}),U?(0,D.jsx)(I,{dataRev:c}):null,j?.tone===`bad`?(0,D.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:j.text}):j?(0,D.jsx)(`p`,{className:`tag ${j.tone===`ok`?`ok `:``}note`,role:`status`,children:j.text}):null,(0,D.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-global`,children:[(0,D.jsx)(`div`,{className:`inst-head`,children:(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{id:`inst-global`,children:`Global installs`}),(0,D.jsx)(`p`,{className:`dim`,children:`One per tool. Loaded in every folder, except excluded ones.`})]})}),(0,D.jsx)(ne,{rows:ve,currentId:Z?.id,onPick:be,label:`Global installs`,fleet:A,onEdits:xe,onDefault:e?$:void 0,busyKey:N})]}),(0,D.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-project`,children:[(0,D.jsxs)(`div`,{className:`inst-head`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{id:`inst-project`,children:`Per-project installs`}),(0,D.jsx)(`p`,{className:`dim`,children:`A repo with its own install. Inside it, only that install loads.`})]}),e?(0,D.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>H(e=>!e),children:[(0,D.jsx)(f,{name:`folder`}),` Deploy to a repo…`]}):null]}),V?(0,D.jsx)(`div`,{className:`inst-deploy`,children:(0,D.jsx)(te,{host:_e,theme:n||`neutral`,options:le,onAction:e,onClose:()=>H(!1),onNote:e=>M(e?{text:e,tone:`bad`}:null)})}):null,ye.length?(0,D.jsx)(ne,{rows:ye,project:!0,currentId:Z?.id,onPick:be,label:`Per-project installs`,fleet:A,onEdits:xe,onDefault:e?$:void 0,busyKey:N}):(0,D.jsx)(S,{children:`No repo has its own install yet. Deploy one to give a project its own rules and voice.`})]}),(0,D.jsx)(ie,{setup:s,overview:a}),(0,D.jsx)(re,{themes:t,current:a?.theme})]}),Z?(0,D.jsx)(F,{inst:Z,targets:oe[L(Z.host,Z.path)]||[],choice:Q(Z),unchanged:ce(Z),options:le,onPick:(e,t)=>se(Z,e,t),canAct:!!e,busy:N===Z.id,memory:K(Z),onMemory:e=>G({id:Z.id,value:e}),onApply:()=>ue(Z),onToggleInstall:()=>fe(Z),onRemove:()=>me(Z),onRevealMcp:he,onForce:()=>de(Z)},Z.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,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,D.jsx)(_,{}):(0,D.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,E.useState)(!1),[h,g]=(0,E.useState)(``),[b,x]=(0,E.useState)(()=>new Set),[C,w]=(0,E.useState)(()=>new Set),[T,ee]=(0,E.useState)(null);if(c&&c!==T){ee(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 te=e=>x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),O=()=>x(e=>e.size===j.length?new Set:new Set(j.map(e=>e.rel))),k=()=>n?.(`export`),A=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,D.jsx)(v,{error:l,onRetry:u});if(!c)return(0,D.jsx)(_,{});if(!c.deployed)return(0,D.jsx)(S,{title:`Nothing installed here`,children:`Nothing to compare.`});if(!c.diffable)return(0,D.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 j=c.files.filter(e=>e.status!==`linked`&&e.status!==`stale`),M=c.files.filter(e=>e.status===`linked`),N=c.files.filter(e=>e.status===`stale`),P=j.filter(e=>e.status===`edited`).length,F=j.filter(e=>e.status===`added`).length,I=j.filter(e=>e.status===`missing`).length,L=e=>w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`h`,children:`Local edits`}),c.target?(0,D.jsxs)(`p`,{className:`sub`,children:[`Comparing `,(0,D.jsx)(`code`,{children:c.target}),c.theme?` (${c.theme} voice)`:``,` with source`,` `,o?.version||`unknown`,`.`]}):null,P>0?(0,D.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.`}):F+I>0?(0,D.jsx)(`p`,{className:`sub`,children:`These files differ from the source: added in the install, or missing from it.`}):null]}),(0,D.jsxs)(`div`,{className:`row gap-10`,children:[(0,D.jsxs)(`button`,{className:`btn ghost danger-line`,disabled:d||b.size===0,onClick:A,children:[`Restore`,b.size?` (${b.size})`:``]}),(0,D.jsxs)(`button`,{className:`btn`,disabled:d,onClick:k,children:[(0,D.jsx)(f,{name:`download`}),`Export improvements`]})]})]}),h?(0,D.jsx)(`p`,{className:`sub mb-14`,children:h}):null,M.length?(0,D.jsxs)(`p`,{className:`sub dim mb-14`,title:M.map(e=>e.rel).join(`
3
- `),children:[M.length,` linked — yours, left alone`]}):null,j.length===0&&N.length===0?(0,D.jsx)(S,{title:`In sync`,children:`This install matches its source.`}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`row between mb-14`,children:[(0,D.jsxs)(`div`,{className:`row gap-10`,children:[(0,D.jsxs)(`span`,{className:`badge warn`,children:[(0,D.jsx)(`span`,{className:`dot`}),P,` edited`]}),(0,D.jsxs)(`span`,{className:`badge`,children:[(0,D.jsx)(`span`,{className:`dot`}),F,` added`]}),I>0&&(0,D.jsxs)(`span`,{className:`badge bad`,children:[(0,D.jsx)(`span`,{className:`dot`}),I,` missing`]}),N.length>0&&(0,D.jsxs)(`span`,{className:`badge`,children:[(0,D.jsx)(`span`,{className:`dot`}),N.length,` behind`]})]}),(0,D.jsxs)(`div`,{className:`row gap-10`,children:[(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>w(new Set(c.files.map(e=>e.rel))),children:`Expand all`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>w(new Set),children:`Collapse all`}),j.length?(0,D.jsxs)(`label`,{className:`row gap-8 dim sel-all`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:b.size===j.length,onChange:O}),`Select all`]}):null]})]}),(0,D.jsx)(`div`,{className:`stack gap-12`,children:j.map(e=>R(e,!0))}),N.length?(0,D.jsxs)(`div`,{className:`stack gap-12 diff-behind`,children:[(0,D.jsx)(`h3`,{children:`Behind source`}),(0,D.jsxs)(`div`,{className:`row between`,children:[(0,D.jsx)(`p`,{className:`sub`,children:`This install is built from older source. Rebuild to bring these files in sync.`}),(0,D.jsx)(`button`,{className:`btn ghost`,disabled:d,onClick:()=>n?.(`build-all`),"aria-label":`Rebuild all installs`,children:`Rebuild`})]}),N.map(e=>R(e,!1))]}):null]})]});function R(e,t){let n=C.has(e.rel),r=e.status===`stale`||e.status===`added`?``:e.status===`missing`?`bad`:`warn`;return(0,D.jsxs)(`div`,{className:`card diff-file${n?` open`:``}`,children:[(0,D.jsxs)(`div`,{className:`diff-head`,children:[t?(0,D.jsx)(`input`,{type:`checkbox`,className:`chk`,checked:b.has(e.rel),onChange:()=>te(e.rel),onClick:e=>e.stopPropagation(),"aria-label":`Select ${e.rel}`}):null,(0,D.jsx)(`span`,{className:`fname`,children:e.rel}),(0,D.jsxs)(`span`,{className:`badge ${r}`,children:[(0,D.jsx)(`span`,{className:`dot`}),e.status===`stale`?`behind source`:e.status]}),(0,D.jsxs)(`span`,{className:`dim mono diff-lines`,children:[e.diff.length,` lines`]}),(0,D.jsx)(`button`,{className:`iconbtn`,onClick:()=>L(e.rel),"aria-label":n?`Collapse ${e.rel}`:`Expand ${e.rel}`,"aria-expanded":n,children:(0,D.jsx)(f,{name:`chevron`})})]}),n&&(0,D.jsx)(`div`,{className:`diff-body`,children:e.diff.map((e,t)=>(0,D.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,E.useState)(!n);return(0,D.jsxs)(`div`,{className:`card check rise ${n?``:`bad`} ${r?`open`:``}`,style:{"--i":t*.6},children:[(0,D.jsxs)(`button`,{className:`check-head`,onClick:()=>i(e=>!e),disabled:n,"aria-expanded":n?void 0:r,children:[(0,D.jsx)(`span`,{className:`feed-dot ${n?`ok`:`bad`}`}),(0,D.jsx)(`h3`,{children:e.label}),(0,D.jsxs)(`span`,{className:`badge ${n?`ok`:`bad`}`,children:[(0,D.jsx)(`span`,{className:`dot`}),n?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`]}),!n&&(0,D.jsx)(f,{name:`chevron`,className:`chev glyph`})]}),!n&&r&&(0,D.jsx)(`div`,{className:`check-body`,children:e.problems.map(e=>(0,D.jsxs)(`div`,{className:`problem`,children:[(0,D.jsx)(`span`,{className:`x`,children:`✕`}),(0,D.jsx)(`span`,{children:e})]},e))})]})}function oe({dataRev:e}){let t=s(e),[n,r]=u(`doctor`,t);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,D.jsx)(_,{}):(0,D.jsx)(Y,{install:n,dataRev:e},n?.id||``)]})}function Y({install:e,dataRev:t}){let n=(0,E.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,D.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,D.jsxs)(`div`,{className:`page-fill`,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`h`,children:`Doctor`}),(0,D.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,D.jsxs)(`button`,{className:`btn`,onClick:l,disabled:!a,children:[(0,D.jsx)(f,{name:`refresh`}),a?`Run doctor`:`Running…`]})]}),a?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`card pad-md mb-16 doc-summary`,children:(0,D.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,D.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,D.jsxs)(`span`,{className:`dim mono`,children:[`validated `,a.themes.length,` voice`,a.themes.length===1?``:`s`]}),a.checked_at?(0,D.jsxs)(`span`,{className:`dim mono`,title:a.checked_at,children:[`checked `,a.checked_at.slice(11)]}):null,a.themes.map(e=>(0,D.jsx)(`span`,{className:`badge cap`,children:e},e))]}),a.ok?(0,D.jsxs)(`span`,{className:`badge ok`,children:[(0,D.jsx)(`span`,{className:`dot`}),`all clean`]}):(0,D.jsxs)(`span`,{className:`badge bad`,children:[(0,D.jsx)(`span`,{className:`dot`}),a.problems.length,` problem`,a.problems.length===1?``:`s`]})]})}),(0,D.jsxs)(`div`,{className:`stack gap-12`,children:[u.map((e,t)=>(0,D.jsx)(J,{group:e,i:t},e.label)),d.length?(0,D.jsxs)(`details`,{className:`check-fold`,children:[(0,D.jsxs)(`summary`,{children:[d.length,` clean check`,d.length===1?``:`s`]}),(0,D.jsx)(`div`,{className:`stack gap-12`,children:d.map((e,t)=>(0,D.jsx)(J,{group:e,i:u.length+t},e.label))})]}):null]})]}):(0,D.jsx)(_,{label:`Running every check (builds this install’s voice in a sandbox)…`})]})}function X({tab:e=`hosts`,overview:t,setup:n,themes:r,onAction:i,onMutated:o,dataRev:s}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(a,{title:`Installs`,sub:`Where the harness lives on this machine, and how each copy is built.`}),(0,D.jsx)(C,{page:`installs`,current:e,label:`Installs`}),e===`hosts`&&(0,D.jsx)(ae,{onAction:i,themes:r,currentTheme:t?.theme,overview:t,setup:n,dataRev:s,onMutated:o}),e===`edits`&&(0,D.jsx)(K,{onMutated:o,onAction:i,dataRev:s,overview:t}),e===`doctor`&&(0,D.jsx)(oe,{dataRev:s})]})}export{X as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{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-Ck42AbRX.js";import{n as B}from"./Dashboard-Ce3UOsxJ.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 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Et as i,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-Ck42AbRX.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};
@@ -1,4 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{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-Ck42AbRX.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};
@@ -1 +0,0 @@
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-Ck42AbRX.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};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-0ORz7tAc.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/AgentGlyph-k6o3gCM1.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{o as i}from"./motion-RlUl1osO.js";import{n as a,t as o}from"./sections-CtFz7HFH.js";import{At as s,Et as c,K as l,Q as ee,T as u,U as d,_t as f,bt as p,ct as te,it as m,mt as ne,ot as h,pt as g,rt as re,st as _,t as v,w as y}from"./index-Ck42AbRX.js";import{t as ie}from"./EmptyState-CY5Pm2xy.js";import{a as ae,c as oe,i as se,l as ce,n as le,o as ue,r as de,t as fe}from"./LibRows-RO5bvXth.js";var b=e(t(),1),x=n();function pe({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,x.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function S({entries:e}){return e.length?(0,x.jsxs)(`table`,{className:`mf-entries`,children:[(0,x.jsx)(`thead`,{className:`sr-only`,children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{scope:`col`,children:`Path`}),(0,x.jsx)(`th`,{scope:`col`,children:`Load`}),(0,x.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,x.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,x.jsx)(`td`,{className:`mf-load-cell`,children:(0,x.jsx)(pe,{load:e.load})}),(0,x.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function me({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,x.jsxs)(`div`,{className:`mf-vault`,children:[(0,x.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,x.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,x.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,x.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,x.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,x.jsxs)(`span`,{className:`mf-role`,children:[(0,x.jsx)(p,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,x.jsxs)(`span`,{className:`mf-role`,children:[(0,x.jsx)(p,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,x.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,x.jsx)(p,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,x.jsx)(S,{entries:t})]})}function C({body:e}){let[t,n]=(0,b.useState)(!1),r=(0,b.useId)();return e?(0,x.jsxs)(`div`,{className:`mf-raw`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,x.jsx)(p,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,x.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function he({manifest:e,body:t,name:n}){if(!e)return(0,x.jsx)(`pre`,{className:`mf-raw-pre`,children:(t||``).replace(/^```json\n|\n```$/g,``)});if(e.kind===`wiki`){let n=e.wikis||[];return n.length?(0,x.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,x.jsx)(me,{wiki:e},e.name||t)),(0,x.jsx)(C,{body:t})]}):(0,x.jsxs)(`div`,{className:`mf-empty`,children:[(0,x.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,x.jsxs)(`p`,{children:[`A wiki is your machine-wide knowledge base — an Obsidian vault or any folder of linked markdown the agent reads from and writes back to. Declare one in`,` `,(0,x.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,x.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,x.jsx)(C,{body:t})]})}let r=e.context||[];return r.length?(0,x.jsxs)(`div`,{className:`mf-doc`,children:[(0,x.jsx)(S,{entries:r}),(0,x.jsx)(C,{body:t})]}):(0,x.jsxs)(`div`,{className:`mf-empty`,children:[(0,x.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,x.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,x.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,x.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,x.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,x.jsx)(C,{body:t})]})}var w=e=>e>=1e3?`${(e/1e3).toFixed(+(e<1e4))}k`:String(e),T=e=>Math.round(e/4),E=[{key:`root`,label:`Constitution`,tone:`accent`,has:e=>e.source===`root`},{key:`catalogue`,label:`Catalogues`,tone:`muted`,has:e=>e.source===`catalogue`},{key:`agent`,label:`This agent`,tone:`warn`,has:e=>e.source!==`root`&&e.source!==`catalogue`}],ge=[[`dictate`,`Dictates`],[`doctrine`,`Doctrines`],[`user`,`User rules`]],D={"not-wired":`not wired, re-emit this install`,"no-event":`not delivered on this host`};function _e(e,t){if(!e||!t)return``;let n=(e,t)=>e.blocks.filter(e=>e.chars>0&&!t.blocks.some(t=>t.id===e.id)),r=e=>e.id===`session-files`?`session files`:e.label.replace(/^.* spec$/,`spec`);return[...n(e,t).map(e=>`+ ${r(e)} ${w(e.chars)}`),...n(t,e).map(e=>`− ${r(e)} ${w(e.chars)}`)].join(`, `)}var ve=e=>e.kind===`user`?`#/personal/rules`:`#/item/law/${encodeURIComponent(e.id)}`,O=e=>`${e.layer??``}${e.id}`;function k({label:e,n:t,children:n}){return(0,x.jsxs)(`li`,{children:[(0,x.jsx)(`span`,{children:e}),n,(0,x.jsx)(`span`,{className:`mono`,children:w(t)})]})}function ye({loadout:e,base:t,error:n,install:r}){let[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(e?.agent);if(e?.agent!==o&&(s(e?.agent),a(!1)),n)return(0,x.jsx)(`p`,{className:`sub`,children:`Loadout not measured for this install.`});if(!e)return null;let c=e=>e.reduce((e,t)=>e+t.chars,0),l=c(e.blocks),ee=_e(e,t),u=E.map(t=>{let n=e.blocks.filter(t.has);return{...t,blocks:n,n:c(n)}}),[f,p,te]=u,m=Math.max(1,...f.blocks.map(e=>e.chars)),ne=e.blocks.find(e=>e.id===`user-rules`),h=ne?D[ne.delivery]:void 0,g=e.rules||[],re=g.filter(e=>!(h&&e.kind===`user`)),_=g.filter(e=>e.citedBySpec),v=[];for(let e of g){let t=e.kind===`dictate`?`Dictates`:e.kind===`user`?`User rules`:e.id.split(`.`)[0],n=v.find(e=>e.name===t);n?n.n+=1:v.push({name:t,n:1,user:e.kind===`user`})}let y=ge.map(([e,t])=>[t,re.filter(t=>t.kind===e).length]).filter(([,e])=>e>0);return(0,x.jsxs)(`section`,{className:`loadout`,"aria-label":`Loadout`,children:[(0,x.jsxs)(`header`,{className:`loadout-head`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`h3`,{className:`loadout-eyebrow mono`,children:[`Loadout · `,r||e.host]}),(0,x.jsxs)(`p`,{className:`loadout-total`,children:[(0,x.jsx)(`strong`,{children:w(T(l))}),(0,x.jsxs)(`span`,{className:`dim`,children:[`tokens at start · `,w(l),` chars`]})]})]}),ee?(0,x.jsxs)(`div`,{className:`loadout-delta`,children:[(0,x.jsxs)(`span`,{className:`dim`,children:[`Against the `,t?.noun||`Primary agent`]}),(0,x.jsx)(`ul`,{children:ee.split(`, `).map(e=>(0,x.jsx)(`li`,{className:`mono loadout-pill${e.startsWith(`+`)?` is-plus`:``}`,children:e},e))})]}):null]}),(0,x.jsxs)(`div`,{className:`loadout-bar`,children:[(0,x.jsx)(d,{label:`Loadout`,legend:!1,parts:u.map(e=>({key:e.key,label:e.label,n:e.n,tone:e.tone}))}),(0,x.jsx)(`ul`,{className:`loadout-groups`,"aria-hidden":`true`,children:u.map(e=>e.n>0?(0,x.jsxs)(`li`,{style:{flexGrow:e.n},children:[(0,x.jsx)(`span`,{children:e.label}),` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[w(e.n),` · `,Math.round(e.n/l*100),`%`]})]},e.key):null)})]}),(0,x.jsxs)(`details`,{className:`loadout-card`,open:e.agent===`primary`,children:[(0,x.jsxs)(`summary`,{children:[(0,x.jsx)(`i`,{className:`tone-accent`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`Constitution`}),(0,x.jsx)(`span`,{className:`dim`,children:`root file, loaded by the host`}),(0,x.jsxs)(`span`,{className:`mono dim loadout-sum`,children:[w(f.n),` · ≈ `,w(T(f.n)),` tok`]})]}),(0,x.jsx)(`ul`,{className:`loadout-root`,children:f.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars,children:(0,x.jsx)(`span`,{className:`loadout-mini`,"aria-hidden":`true`,children:(0,x.jsx)(`span`,{style:{width:`${Math.max(4,e.chars/m*100)}%`}})})},e.id))})]}),(0,x.jsxs)(`div`,{className:`loadout-pair`,children:[(0,x.jsxs)(`div`,{className:`loadout-card`,children:[(0,x.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,x.jsx)(`i`,{className:`tone-muted`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`Catalogues`}),(0,x.jsx)(`span`,{className:`mono dim loadout-sum`,children:w(p.n)})]}),(0,x.jsx)(`ul`,{className:`loadout-list`,children:p.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars},e.id))}),(0,x.jsx)(`p`,{className:`dim loadout-note`,children:`Listed by the host, not by Geneseed.`})]}),(0,x.jsxs)(`div`,{className:`loadout-card is-own`,children:[(0,x.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,x.jsx)(`i`,{className:`tone-warn`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`This agent`}),(0,x.jsx)(`span`,{className:`mono dim loadout-sum`,children:w(te.n)})]}),(0,x.jsx)(`ul`,{className:`loadout-list`,children:te.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars,children:e.id===`user-rules`?(0,x.jsx)(`span`,{className:`loadout-pill${h?` is-plus`:``}`,children:h||`injected at sub-agent start`}):null},e.id))})]})]}),(0,x.jsxs)(`section`,{className:`loadout-rules`,"aria-label":`Rules it follows`,children:[(0,x.jsxs)(`div`,{className:`loadout-rules-h`,children:[(0,x.jsxs)(`h4`,{className:`loadout-eyebrow mono`,children:[`Rules it follows · `,re.length]}),(0,x.jsx)(`span`,{className:`dim`,children:y.map(([e,t])=>`${t} ${e}`).join(` · `)})]}),_.length?(0,x.jsxs)(`div`,{className:`loadout-cited`,children:[(0,x.jsx)(`span`,{className:`loadout-cited-h`,children:`Cited by its spec`}),_.map(e=>(0,x.jsxs)(`a`,{href:ve(e),children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` · `,e.title]},O(e)))]}):null,(0,x.jsx)(`ul`,{className:`loadout-packs`,children:v.map(e=>e.user&&h?(0,x.jsxs)(`li`,{className:`is-muted`,children:[(0,x.jsx)(`span`,{children:`User rules`}),` `,(0,x.jsx)(`span`,{className:`mono`,children:e.n}),` `,(0,x.jsx)(`span`,{className:`dim`,children:h})]},e.name):(0,x.jsx)(`li`,{children:(0,x.jsxs)(`a`,{href:e.user?`#/personal/rules`:`#/laws`,children:[(0,x.jsx)(`span`,{children:e.name}),` `,(0,x.jsx)(`span`,{className:`mono dim`,children:e.n})]})},e.name))}),g.length?(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":i,onClick:()=>a(e=>!e),children:i?`Show fewer`:`Show all ${g.length}${h?` listed`:``} rules`}):null,i?ge.map(([e,t])=>{let n=g.filter(t=>t.kind===e),r=h&&e===`user`;return n.length?(0,x.jsxs)(`div`,{className:r?`is-muted`:void 0,children:[(0,x.jsxs)(`h5`,{className:`reader-when-h`,children:[t,` `,(0,x.jsx)(`span`,{className:`mono dim`,children:n.length}),r?(0,x.jsxs)(`span`,{className:`dim`,children:[` · `,h]}):null]}),(0,x.jsx)(`ul`,{children:n.map(e=>(0,x.jsxs)(`li`,{children:[r?(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}):(0,x.jsxs)(`a`,{href:ve(e),children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}),e.layer&&e.layer!==`install`?(0,x.jsxs)(`span`,{className:`dim`,children:[` (`,e.layer,`)`]}):null]},O(e)))})]},e):null}):null]}),(0,x.jsxs)(`p`,{className:`dim loadout-foot`,children:[`Not counted: `,e.notCounted.join(`; `),`. Tokens are chars ÷ 4.`]})]})}function be({label:e,options:t,value:n,onChange:r}){let[i,a]=(0,b.useState)(!1),o=(0,b.useRef)(null),s=(0,b.useId)(),c=t.find(e=>e.key===n)||t[0],l=()=>a(!1);return(0,b.useEffect)(()=>{i&&document.getElementById(s)?.querySelector(`[aria-pressed="true"]`)?.focus()},[i,s]),(0,x.jsxs)(`span`,{className:`drop-menu`,children:[(0,x.jsxs)(`button`,{ref:o,type:`button`,className:`drop-menu-btn`,"aria-label":`${e}: ${c.label}`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-controls":i?s:void 0,onClick:()=>a(e=>!e),children:[c.label,(0,x.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,x.jsx)(_,{open:i,onClose:l,anchorRef:o,label:e,className:`drop-menu-pop`,children:(0,x.jsx)(`div`,{id:s,className:`drop-menu-list`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(document.activeElement);e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()},onBlur:e=>{let t=e.relatedTarget;t&&t!==o.current&&!e.currentTarget.closest(`.popover`)?.contains(t)&&l()},children:t.map(e=>(0,x.jsx)(`button`,{type:`button`,"aria-pressed":e.key===c.key,onClick:()=>{r(e.key),l()},children:e.label},e.key))})})]})}function xe({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,x.jsxs)(`div`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`stat-label`,children:e}),(0,x.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,x.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var Se=(0,b.lazy)(()=>v(()=>import(`./Markdown-0ORz7tAc.js`).then(e=>e.n),__vite__mapDeps([0,1,2]))),Ce=(0,b.lazy)(()=>v(()=>import(`./AgentGlyph-k6o3gCM1.js`),__vite__mapDeps([3,1,2]))),we={skills:`skill`,agents:`agent`},Te=`:primary`,Ee=(e,t)=>`${t?e/t*100:0}%`,De=e=>e.split(`:`).slice(0,2).join(` `),Oe=e=>e.split(`/`).map((e,t)=>(0,x.jsxs)(b.Fragment,{children:[t?`/`:null,t?(0,x.jsx)(`wbr`,{}):null,e]},t)),A=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},ke=e=>f(A(e));function Ae(e,t){return e===`memory`?`memory/${t}`:e===`notebook`?`notebook/${t}`:e===`wiki`?`geneseed-wiki.jsonc`:e===`config`?t:e===`skills`?`skills/${t}/SKILL.md`:`${e}/${t}.md`}function je({section:e,source:t}){return(0,x.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,x.jsx)(p,{name:a[e].icon,className:`glyph`}),(0,x.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,x.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var Me=e=>e.replace(/\s+/g,` `).trim(),Ne=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Pe(e,t){let n=e.replace(/\r\n/g,`
3
- `),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=Ne(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?Me(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?Me(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=Ne(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function Fe({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,x.jsx)(`div`,{className:`lib-stats`,children:(0,x.jsx)(xe,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(De))].join(`, `),i=t.days_counted>=30?`in the last 30 days`:`since ${t.since}`,a=Math.max(1,...e.per_day),o=[e.last?`last used ${e.last}`:null,i,r?`on ${r}`:null].filter(Boolean).join(` · `);return(0,x.jsx)(`div`,{className:`lib-stats`,children:(0,x.jsx)(xe,{label:`Used`,value:e.n,delta:o,children:(0,x.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,x.jsx)(`i`,{className:t===29?`today`:``,style:{height:Ee(e,a)}},t))})})})}function Ie(e){let t=/\s*\bUse when:\s*/i.exec(e||``);if(!t)return{lede:e||``,when:``};let n=e.slice(t.index+t[0].length).trim();return{lede:e.slice(0,t.index).trim(),when:n&&n[0].toUpperCase()+n.slice(1)}}var Le={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},Re=(e,t)=>t||(e&&o.includes(e)?e:o[0]),ze=encodeURIComponent;function Be(e){let t=e=>y[e.klass]?e.klass:`personal`,n=u.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:y[n].label,groupC:y[n].c})));return{rows:n,cats:u.map(e=>({key:e,label:y[e].label,c:y[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ve(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function j({overview:e,section:t,selected:n,dataRev:i,lock:u,base:d,onRulesChanged:f,onCountsChanged:p}){let _=te(),[v,pe]=(0,b.useState)(()=>Re(t,u)),[S,me]=(0,b.useState)(``),[C,w]=(0,b.useState)(`all`),[T,E]=(0,b.useState)(`all`),[ge,D]=(0,b.useState)(``),[_e,ve]=(0,b.useState)(null),[O,k]=(0,b.useState)(null),[xe,De]=(0,b.useState)(t);if(t!==xe){De(t),D(``);let e=Re(t,u);e!==v&&(pe(e),me(``),w(`all`),E(`all`))}let[Me,Ne]=(0,b.useState)(n);n!==Me&&(Ne(n),D(``));let{data:j,error:He,reload:Ue}=c(()=>r.catalog(v),[v,i],`catalog`),We=u?null:we[v]||null,Ge=We!==null,{data:M}=c(()=>Ge?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[Ge,i],`usage`,{revalidate:!0}),N=Ge&&!!M?.enabled&&Array.isArray(M.names),Ke=(0,b.useMemo)(()=>new Map((Array.isArray(M?.names)?M.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[M]),P=e=>N&&Ke.get(`${We}\u0000${e}`)||null,qe=e=>{let t=P(e.name);return!t||t.n===0&&!t.last},Je=M?.since?`No call since ${M.since}`:`No call recorded yet`,F=j?.section===v,I=F&&j?.items||[],Ye=!F&&!He,[Xe,...Ze]=F&&j.sharedInstalls||[],L=e=>e===Xe?`shared`:ke(e),R=v===`skills`,Qe=R?Be(I):null,z=R?Qe.rows:v===`memory`?Ve(I):I,B=n||z[0]?.name||null,V=v===`agents`&&!u,H=V&&B===`:primary`,{data:$e,error:et}=c(()=>V?Promise.resolve().then(()=>r.loadout()):Promise.resolve(null),[V,i],`loadout-primary`,{revalidate:!0}),tt=V?{name:Te,type:`agent`,base:!0,title:!et&&$e?.noun||`Primary agent`,desc:`The main agent of the session. Every agent inherits its root file.`}:null,nt=H?tt:B?I.find(e=>e.name===B):null,rt=nt?.type||a[v].type,U=O?.sec===v&&O?.name===B?O.key:null,{data:it,error:W}=c(()=>!B||H?Promise.resolve(null):U?r.item(rt,B,A(U)):r.item(rt,B),[v,B,rt,U,i,H]),G=W?null:it,at=G&&G.name===B&&(!U||G.install===U)?G:null,ot=e=>vt&&e?.install?` in ${L(e.install)}`:``,K=H?null:U||G?.install||null,st=V&&B&&!H&&G&&G.name===B,{data:ct,error:lt}=c(()=>st?Promise.all([r.loadout(B,K?A(K):void 0),r.loadout(void 0,K?A(K):void 0).catch(()=>null)]).then(([e,t])=>({own:e,base:t})):Promise.resolve(null),[st,B,K,i]),ut=H?{own:et?null:$e,base:null}:ct,dt=H?et:lt,ft=ge||He||W,pt=B?{name:B,title:G?.title||B,desc:G?.desc||``}:null,q=nt||pt,mt=t=>t===v&&F?I.length:e?.counts?.[t]??``,ht=ee(i),gt=K||ht?.[0]?.id,_t=gt?ke(gt):void 0,vt=new Set(I.flatMap(e=>e.installs||[])).size>1,yt=ne([...(ht||[]).map(e=>e.id),...I.flatMap(e=>e.installs||[])],Ze),J=R?z.filter(e=>C===`all`||e.cat===C):z,bt=N?J.filter(qe).length:0,xt=e=>e.status===`experimental`,St=J.filter(xt).length,Y=[[`all`,`All`,J.length],...N?[[`used`,`Used`,J.length-bt],[`unused`,`Not used yet`,bt,Je]]:[],...St?[[`experimental`,`Experimental`,St,`Shipped, not yet confirmed by real use`]]:[]],X=Y.some(([e])=>e===T)?T:`all`,Ct=X===`all`?J:X===`experimental`?J.filter(xt):J.filter(e=>qe(e)===(X===`unused`)),wt=N?Math.max(0,...I.map(e=>P(e.name)?.n||0)):0,Tt=R?1/0:50,Z=S.trim().toLowerCase(),Q=Z?ae(Ct,Z):Ct.slice(0,Tt),Et=!Z&&C===`all`&&X===`all`&&B&&!Q.some(e=>e.name===B)?[...Q,...z.filter(e=>e.name===B)]:Q,Dt=tt&&F&&C===`all`&&X===`all`?ae([tt],Z):[],Ot=Dt.length+Q.length,kt=[...Dt,...Et],At=e=>d?`${d}/${ze(e.name)}`:`#/item/${e.type||a[v].type}/${ze(e.name)}`,jt=async()=>{let e=at;if(!e)return;let t=e.name;if(await _(`Forget the memory fact "${t}"${ot(e)}? It leaves the index and moves to memory/archive/ (geneseed memory rm --archived --purge deletes it for good).`,{title:`Forget this fact?`,confirmLabel:`Forget`,tone:`danger`})){D(``);try{await r.memoryDelete(t,e.install?A(e.install):void 0)}catch(e){D(`Could not forget "${t}": ${e.message}`);return}s(d||`#/personal/memory`),Ue(),p?.()}},Mt=async()=>{let e=at;if(!e)return;let t=e.name;if(await _(`Promote "${t}"${ot(e)} into a standing rule? It is appended to user-rules.md as a trial rule (a month of probation), and the memory fact moves to memory/archive/ so the lesson isn't loaded twice.`,{title:`Promote to a rule?`,confirmLabel:`Promote`})){D(``);try{let n=e.install?A(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),l(),f?.(),p?.(),s(`#/personal/rules`)}catch(e){D(`Could not promote: ${e.message}`),Ue()}}},Nt=G?.body?Pe(G.body,G.desc||q?.desc):null,Pt=G?.title||q?.title||q?.name,Ft=Pt===q?.name&&Nt?.title?Nt.title:Pt,It=F&&I.length===0,Lt=G?.status||q?.status,Rt=v===`skills`?y[nt?.klass]:null,zt=a[v].label,{lede:Bt,when:Vt}=Ie(G?.desc||q?.desc||``),$=q&&!H?G?.source||q.source||(W?null:Ae(v,q.name)):null;return(0,x.jsxs)(`div`,{className:`lib-wrap`,children:[(0,x.jsx)(re,{error:ft,style:{margin:`0 0 var(--sp-3)`}}),(0,x.jsxs)(`div`,{className:`library lib-dossier${u?` locked`:``}${N?` uses`:``}`,children:[u?null:(0,x.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,x.jsxs)(`div`,{className:`lib-title`,children:[(0,x.jsx)(`h1`,{className:`h`,children:`Library`}),(0,x.jsx)(`span`,{className:`dim`,children:`What the agent knows`}),N&&M.since?(0,x.jsxs)(`span`,{className:`mono dim lib-title-since`,children:[`calls since `,M.since]}):null]}),(0,x.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,x.jsxs)(b.Fragment,{children:[(0,x.jsxs)(`a`,{href:`#/section/${e}`,className:v===e?`on`:``,"aria-current":v===e?`page`:void 0,children:[a[e].label,(0,x.jsx)(`span`,{className:`mono dim`,children:mt(e)})]}),e===v&&R&&F&&(0,x.jsx)(ue,{label:`Skill types`,total:I.length,cats:Qe.cats,cat:C,onChange:w})]},e))})]}),(0,x.jsxs)(se,{label:zt,count:F?Z?`${Q.length} of ${Ct.length}`:Ct.length:``,q:S,onQ:me,matched:Ot,inView:[v,n],current:q?Ft:void 0,sections:u?void 0:o.map(e=>({key:e,label:a[e].label,n:mt(e),href:`#/section/${e}`,on:v===e})),cats:R&&F?Qe.cats:null,cat:C,total:I.length,onCat:w,catLabel:`Skill types`,extra:(0,x.jsxs)(x.Fragment,{children:[N&&M.since?(0,x.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,M.since]}):null,(0,x.jsxs)(`span`,{className:`lib-legend mono`,children:[vt?yt.map((e,t)=>(0,x.jsxs)(`span`,{className:`lk-install`,title:A(e).path,children:[(0,x.jsx)(`i`,{className:`lr-dot`,style:g(t),"aria-hidden":`true`}),L(e)]},e)):null,(0,x.jsx)(ce,{items:I})]})]}),toolsCompact:F&&Y.length>1?(0,x.jsx)(be,{label:`Show`,options:Y.map(([e,t])=>({key:e,label:e===`all`?`All uses`:t})),value:X,onChange:E}):void 0,tools:F&&Y.length>1?(0,x.jsx)(h,{"aria-label":`Show`,children:Y.map(([e,t,n,r])=>(0,x.jsxs)(`button`,{type:`button`,className:X===e?`on`:``,"aria-pressed":X===e,title:r,onClick:()=>E(e),children:[t,` `,(0,x.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[Ye?(0,x.jsx)(m,{}):null,(0,x.jsx)(le,{rows:kt,activeName:q?.name,hrefOf:At,pills:N||vt?e=>{let t=P(e.name)?.n||0,n=vt?(0,x.jsx)(`span`,{className:`lr-dots`,children:yt.map((t,n)=>e.installs?.includes(t)?(0,x.jsx)(`span`,{className:`lr-dot lr-install`,style:g(n),title:`${L(t)} — ${A(t).path}`,children:(0,x.jsx)(`span`,{className:`sr-only`,children:L(t)})},t):(0,x.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return N?(0,x.jsxs)(x.Fragment,{children:[n,(0,x.jsxs)(`span`,{className:`lr-use`,children:[(0,x.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,x.jsx)(`i`,{style:{width:Ee(t,wt)}})}),(0,x.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,x.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!Z&&I.length>Tt&&(0,x.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,Tt,` of `,I.length,`; type to search the rest.`]}),It&&(v===`wiki`?(0,x.jsxs)(ie,{title:`No wiki entries`,action:(0,x.jsx)(`a`,{href:`#/section/config`,children:`Open the setup files`}),docs:{href:`#/docs/wiki`,label:`How to configure a wiki →`},children:[`Declare a wiki in `,(0,x.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,x.jsx)(ie,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,x.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:q?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:zt.replace(/s$/,``)}),H?(0,x.jsx)(fe,{}):null,Rt?(0,x.jsx)(`span`,{className:`tag`,children:Rt.label}):null,G?.kit??q.kit?(0,x.jsx)(de,{name:G?.kit??q.kit}):null,(0,x.jsx)(oe,{status:Lt,withHint:!0}),$?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`mono dim reader-src`,children:Oe($)}),(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),ve({src:$,ok:!0})}catch{ve({src:$,ok:!1})}},children:_e?.src===$?_e.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,x.jsxs)(`div`,{className:`reader-head`,children:[(0,x.jsx)(`h2`,{className:`reader-title`,children:Ft}),v===`agents`&&!H?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(Ce,{name:q.name})}):null]}),(0,x.jsxs)(`div`,{className:`reader-intro${N?` with-stats`:``}`,children:[(0,x.jsxs)(`div`,{className:`reader-intro-text`,children:[Bt?(0,x.jsx)(`p`,{className:`reader-lede`,children:Bt}):null,Vt?(0,x.jsxs)(`section`,{className:`reader-when`,children:[(0,x.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,x.jsx)(`p`,{children:Vt})]}):null]}),N?(0,x.jsx)(Fe,{u:P(q.name),usage:M,noCall:Je}):null]}),v===`memory`&&at&&q.name!==`MEMORY`&&q.name!==`README`&&(0,x.jsxs)(`div`,{className:`row gap-8`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Mt,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:jt,children:`Forget this fact`})]}),G?.installs?.length>1&&G.installs.includes(G.install)?(0,x.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,x.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,x.jsx)(`select`,{className:`sel`,"aria-label":`Install`,value:U||G.install,onChange:e=>k({sec:v,name:B,key:e.target.value}),children:G.installs.map(e=>(0,x.jsx)(`option`,{value:e,title:A(e).path,children:L(e)},e))}),(0,x.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,x.jsx)(`hr`,{className:`hr`}),V?(0,x.jsx)(ye,{loadout:ut?.own,base:ut?.base,error:dt,install:_t}):null,H?null:W?(0,x.jsxs)(`p`,{className:`sub`,children:[`No `,zt.replace(/s$/,``).toLowerCase(),` named `,(0,x.jsx)(`em`,{children:q.name}),` could be read in this install.`]}):q?.kind===`manifest`||G?.manifest!==void 0?G?(0,x.jsx)(he,{manifest:G.manifest,body:G.body,name:q.name}):(0,x.jsx)(m,{}):G?.body?(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(Se,{body:Nt.body,links:G.links||[]})})}):G===null&&B?(0,x.jsx)(m,{}):(0,x.jsx)(je,{section:v,source:Ae(v,q.name)}),Le[v]?(0,x.jsx)(`div`,{className:`reader-links`,children:(0,x.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${Le[v]}`,children:[`About `,zt.toLowerCase(),` in Docs`]})}):null]}):Ye?(0,x.jsx)(m,{}):null})]})]})}export{Te as PRIMARY,Pe as bodyHead,j as default,Ve as groupMemory,ke as installLabel,A as installOfKey,Be as splitSkills,Ie as splitWhen};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Et as i,Ot as a,Q as o,Z as s,at as c,it as l,kt as u,rt as d,vt as f}from"./index-Ck42AbRX.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{a as h,i as ee,n as g,o as _,s as v}from"./LibRows-RO5bvXth.js";import{t as y}from"./CopyButton-BzRQz7k2.js";import{c as b,i as te,n as x,o as S,r as C,s as w,t as ne}from"./ActiveLoops-BTHIaRhn.js";var T=e(t(),1),E=n(),D=encodeURIComponent,O=a.loops.map(e=>[e,u[e]]),k={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},A={project:`Project`,global:`Global`,shipped:`Shipped`},j={templates:`Categories`,bricks:`Origins`,active:`Statuses`},M=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function N(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var P=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function F(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return P(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>k[e.graph.category]?e.graph.category:`other`,[...Object.entries(k),[`other`,`Other`]])}function I(e,t){return P(e.map(e=>({...e,desc:e.description,override:N(t,e.name)})),e=>e.origin,Object.entries(A))}function L(e){return P(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,M)}var R=(e,t)=>(0,E.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),z={templates:e=>e.human?R(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?R(`warn`,`mutate`):null,w(e)?R(`human`,`human gate`):null,e.override?R(`acc`,e.override):null,e.available===!1?R(`bad`,`unavailable`):null],active:e=>R(x[e.status],e.status)};function B({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,E.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,E.jsx)(`b`,{children:(0,E.jsx)(`a`,{href:`#/loops/bricks/${D(e)}`,children:e})}),R(t.effect===`mutate`?`warn`:``,t.effect),(0,E.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,E.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),w(t)?R(`human`,w(t).toLowerCase()):null,n?R(`acc`,n):null]}):(0,E.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,E.jsx)(`b`,{children:e}),(0,E.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function V(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function re({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,T.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=V(e.graph),c=b(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>C(t)&&t.graph.name===e.name).length;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`reader-tags`,children:[(0,E.jsx)(`span`,{className:`tag acc`,children:`Template`}),k[e.graph.category]?R(``,k[e.graph.category]):null,e.human?R(`human`,`human gate`):null]}),(0,E.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,E.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,E.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,E.jsx)(`hr`,{className:`hr`}),(0,E.jsxs)(`figure`,{className:`loop-console`,children:[(0,E.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${c.width}px`},children:(0,E.jsx)(S,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:`smooth`,block:`nearest`})}})}),(0,E.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,E.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,E.jsx)(`ol`,{children:s.map(([e,t])=>(0,E.jsxs)(`li`,{children:[(0,E.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,E.jsxs)(`span`,{className:`loop-legend`,children:[(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,E.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,E.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,E.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,E.jsx)(y,{text:u,label:`Copy command`})]}),(0,E.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,E.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,E.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,E.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,E.jsx)(`li`,{children:e},e))})]}):null,(0,E.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,E.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,E.jsx)(B,{name:e,brick:o.get(e),override:N(n,e),on:i===e},e))})]})}function H(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
2
- `)}\n---\n${e.body}`}function U({b:e}){let[t,n]=(0,T.useState)(!1),r=[[`effect`,R(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,E.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>R(``,e))],[`gate`,w(e)?R(`human`,w(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,E.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`reader-tags`,children:[(0,E.jsx)(`span`,{className:`tag acc`,children:`Brick`}),z.bricks(e)]}),(0,E.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,E.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,E.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,E.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,E.jsxs)(T.Fragment,{children:[(0,E.jsx)(`dt`,{children:e}),(0,E.jsx)(`dd`,{children:t})]},e))}),(0,E.jsx)(`hr`,{className:`hr`}),(0,E.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,E.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,E.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:H(e)}):(0,E.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,E.jsx)(p,{body:e.body})})]})}function W({problems:e}){if(!e?.length)return null;let t=e.length;return(0,E.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,E.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,E.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,E.jsx)(`li`,{className:`mono`,children:e},e))})]})}var G={templates:{title:`No templates`,body:(0,E.jsxs)(E.Fragment,{children:[`Add one under `,(0,E.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,E.jsxs)(E.Fragment,{children:[`Add one under `,(0,E.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,E.jsxs)(E.Fragment,{children:[`Start one with `,(0,E.jsx)(`code`,{className:`mono`,children:`geneseed loop init`}),` in a worktree, or ask the agent to run a loop. It shows up here while it runs.`]})}},K={templates:(0,E.jsxs)(E.Fragment,{children:[`A template wires bricks into a loop. `,(0,E.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,E.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,E.jsxs)(E.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,E.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,E.jsxs)(E.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,E.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function q({tab:e=`templates`,item:t,dataRev:n}){let a=o(n),[u,p]=s(`loops`,a),{data:y,error:b}=i(()=>r.loops(f(u)),[n,u?.id??``],`loops`),x=te(),[S,w]=(0,T.useState)(``),[k,A]=(0,T.useState)(`all`),[M,N]=(0,T.useState)(e);e!==M&&(N(e),w(``),A(`all`));let P=y?.bricks||[],R=e===`active`?x.loops&&L(x.loops):y&&(e===`bricks`?I(y.bricks,y.overridden):F(y.templates,y.bricks)),B=R||[],V=v(B),H=k===`all`?B:B.filter(e=>e.group===k),q=S.trim(),J=h(H,q),Y=!!(t&&R&&!B.some(e=>e.name===t)),X=Y?null:B.find(e=>e.name===t)||e===`active`&&B.find(C)||B[0]||null,Z={templates:y?.templates.length,bricks:y?.bricks.length,active:x.loops?.length},Q=O.find(([t])=>t===e)[1],$=e===`active`?x.error:b;return(0,E.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,E.jsx)(c,{className:`page-pick`,installs:a,value:u,onChange:p}),(0,E.jsx)(d,{error:$,style:{margin:`0 0 var(--sp-3)`}}),(0,E.jsx)(W,{problems:y?.problems}),(0,E.jsxs)(`div`,{className:`library`,children:[(0,E.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,E.jsxs)(`div`,{className:`lib-title`,children:[(0,E.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,E.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,E.jsx)(`p`,{className:`panel-note lib-lede`,children:K[e]}),(0,E.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:O.map(([t,n])=>(0,E.jsxs)(T.Fragment,{children:[(0,E.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,E.jsx)(`span`,{className:`mono dim`,children:Z[t]??``})]}),e===t&&(0,E.jsx)(_,{label:j[t],total:B.length,cats:V,cat:k,onChange:A})]},t))})]}),(0,E.jsx)(ee,{label:Q,count:q?`${J.length} of ${H.length}`:R?H.length:``,q:S,onQ:w,matched:J.length,inView:[e,t],current:X?.name,sections:O.map(([t,n])=>({key:t,label:n,n:Z[t],href:`#/loops/${t}`,on:e===t})),cats:V,cat:k,total:B.length,onCat:A,catLabel:j[e],children:R?B.length===0?(0,E.jsx)(m,{title:G[e].title,children:G[e].body}):(0,E.jsx)(g,{rows:J,activeName:X?.name,hrefOf:t=>`#/loops/${e}/${D(t.name)}`,pills:z[e]}):$?null:(0,E.jsx)(l,{})}),(0,E.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:Y?(0,E.jsx)(m,{title:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${Q.toLowerCase()} →`}}):X?e===`active`?(0,E.jsx)(ne,{loop:X,bricks:P,onPreset:x.onPreset}):e===`bricks`?(0,E.jsx)(U,{b:X}):(0,E.jsx)(re,{t:X,bricks:P,overridden:y.overridden,runs:x.loops},X.name):e===`active`&&R?(0,E.jsx)(m,{title:`What is a loop?`,docs:{href:`#/docs/loops`,label:`How loops work →`},children:`A loop runs bricks in a ring until its gate passes.`}):null})]})]})}export{L as activeRows,I as brickRows,H as brickSource,q as default,V as howItRuns,F as templateRows};
@@ -1,69 +0,0 @@
1
- import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n,t as r}from"./react-C1iE8mnY.js";var i=t(n(),1);function a(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var o=a();function s(e){o=e}var c={exec:()=>null};function l(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function u(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(f.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var d=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),f={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:l(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:l(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:l(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:l(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:l(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:l(e=>RegExp(`^ {0,${e}}(?:</?(?:${S})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:l(e=>RegExp(`^ {0,${e}}>`))},p=/^(?:[ \t]*(?:\n|$))+/,m=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,h=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,g=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,v=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ee=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,y=u(ee).replace(/bull/g,v).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),te=u(ee).replace(/bull/g,v).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),b=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ne=/^[^\n]+/,x=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,re=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,x).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ie=u(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,v).getRegex(),S=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,C=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ae=u(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,C).replace(`tag`,S).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe=e=>u(b).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex(),se=oe(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ce=oe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),w={blockquote:u(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ce).getRegex(),code:m,def:re,fences:h,heading:_,hr:g,html:ae,lheading:y,list:ie,newline:p,paragraph:se,table:c,text:ne},le=u(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex(),ue={...w,lheading:te,table:le,paragraph:u(b).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,le).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex()},de={...w,html:u(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,C).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:c,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(b).replace(`hr`,g).replace(`heading`,` *#{1,6} *[^
2
- ]`).replace(`lheading`,y).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},fe=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,pe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,me=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,he=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,T=/[\p{P}\p{S}]/u,E=/[\s\p{P}\p{S}]/u,D=/[^\s\p{P}\p{S}]/u,ge=u(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,E).getRegex(),_e=/[\p{Pi}\p{Ps}"']/u,ve=/(?!~)[\p{P}\p{S}]/u,ye=/(?!~)[\s\p{P}\p{S}]/u,be=/(?:[^\s\p{P}\p{S}]|~)/u,xe=u(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,d?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),O=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Se=u(O,`u`).replace(/punct/g,T).getRegex(),Ce=u(O,`u`).replace(/punct/g,ve).getRegex(),we=u(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,_e).replace(/punct/g,T).getRegex(),k=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Te=u(k,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Ee=u(k,`gu`).replace(/notPunctSpace/g,be).replace(/punctSpace/g,ye).replace(/punct/g,ve).getRegex(),De=u(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Oe=u(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),ke=u(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Ae=u(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,T).getRegex(),je=u(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,D).replace(/punctSpace/g,E).replace(/punct/g,T).getRegex(),Me=u(/\\(punct)/,`gu`).replace(/punct/g,T).getRegex(),Ne=u(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,T).getRegex(),Pe=u(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Fe=u(C).replace(`(?:-->|$)`,`-->`).getRegex(),Ie=u(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Fe).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),A=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,j=u(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,A).getRegex(),Le=u(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,j).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Re=u(/^!?\[(label)\]\[(ref)\]/).replace(`label`,j).replace(`ref`,x).getRegex(),ze=u(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,x).getRegex(),M=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Be=u(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,A).getRegex(),Ve=u(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,u(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Be).replace(`ref`,M).getRegex()).replace(`nolink`,u(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,M).getRegex()).getRegex(),N=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,He=u(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),P={_backpedal:c,anyPunctuation:Me,anyPunctuationOutsideCode:Ne,autolink:Pe,blockSkip:xe,br:me,code:pe,del:c,delLDelim:c,delRDelim:c,emStrongLDelim:Se,emStrongRDelimAst:Te,emStrongRDelimUnd:Oe,escape:fe,link:Le,nolink:ze,punctuation:ge,reflink:Re,reflinkSearch:Ve,tag:Ie,text:he,url:c},Ue={...P,emStrongLDelim:we,emStrongRDelimAst:De,emStrongRDelimUnd:ke,link:u(/^!?\[(label)\]\((.*?)\)/).replace(`label`,j).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,j).getRegex()},F={...P,emStrongRDelimAst:Ee,emStrongLDelim:Ce,delLDelim:Ae,delRDelim:je,url:u(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,He).replace(`protocol`,N).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:u(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,N).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},We={...F,br:u(me).replace(`{2,}`,`*`).getRegex(),text:u(F.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},I={normal:w,gfm:ue,pedantic:de},L={normal:P,gfm:F,breaks:We,pedantic:Ue},Ge={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Ke=e=>Ge[e];function R(e,t){if(t){if(f.escapeTest.test(e))return e.replace(f.escapeReplace,Ke)}else if(f.escapeTestNoEncode.test(e))return e.replace(f.escapeReplaceNoEncode,Ke);return e}function qe(e){return f.numericCharacterReference.test(e)?e.replace(f.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&amp;`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&amp;`:String.fromCodePoint(r)}):e}function Je(e){try{e=encodeURI(e).replace(f.percentDecode,`%`)}catch{return null}return e}function Ye(e,t){let n=e.replace(f.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(f.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(f.slashPipe,`|`);return n}function z(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Xe(e){let t=e.split(`
3
- `),n=t.length-1;for(;n>=0&&f.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
4
- `)}function B(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Ze(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function V(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Qe(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function $e(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
5
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
6
- `)}function et(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var H=class{options;rules;lexer;constructor(e){this.options=e||o}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Xe(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=$e(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=z(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:z(t[0],`
7
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:z(t[0],`
8
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=z(t[0],`
9
- `).split(`
10
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
11
- `),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+V(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
12
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
13
- ${s}`:s,r=r?`${r}
14
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
15
- `),o=t.raw+`
16
- `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
17
- `).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
18
- ${d.join(`
19
- `)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
20
- `+e.join(`
21
- `),o=this.list(a);i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`
22
- `).length:0;if(s>0){let t=e.slice(0,s).join(`
23
- `);n=`${n}
24
- ${t}`,r=`${r}
25
- ${t}`}e=e.slice(s)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
26
- `,1)[0],d=t[1].length,f=this.options.pedantic?V(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>V(e,d)),p=e.split(`
27
- `,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
28
- `,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>V(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
29
- `+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
30
- ${p}`)?` ${l.replace(/^ {0,3}/,``)}`:p;a+=`
31
- `+e}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Xe(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&Ze(t[2],`()`)!==-1)return;let e=B(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:z(t[0],`
32
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ye(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
33
- `):[],a={type:`table`,raw:z(t[0],`
34
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Ye(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:z(t[0],`
35
- `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
36
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&et(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=z(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Ze(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),Qe(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&et(e,n[1],r,this.rules))return;let i=t[B((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Qe(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l),_=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(_.lastIndex=0,t=t.slice(-1*e.length+n);(r=_.exec(t))!==null;){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(f=[...u].length,r[3]||r[4]){p+=f;continue}if(r[5]||r[6]||g){if(a&&(r[5]||r[6]))break;if(h%3&&!((h+f)%3)){m+=f;continue}}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let t=[...r[0]][0].length,i=e.slice(0,n+r.index+t+f);if(Math.min(n,f)%2){let e=i.slice(1,-1);return{type:`em`,raw:i,text:e,tokens:this.lexer.inlineTokens(e)}}let o=i.slice(2,-2);return{type:`strong`,raw:i,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:qe(t[0]),escaped:e}}}},U=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||o,this.options.tokenizer=this.options.tokenizer||new H,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:f,block:I.normal,inline:L.normal};this.options.pedantic?(t.block=I.pedantic,t.inline=L.pedantic):this.options.gfm&&(t.block=I.gfm,t.inline=this.options.breaks?L.breaks:L.gfm),this.tokenizer.rules=t}static get rules(){return{block:I,inline:L}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(f.carriageReturn,`
37
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(f.tabCharGlobal,` `).replace(f.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
38
- `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
39
- `)?``:`
40
- `)+i.raw,n.text+=`
41
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
42
- `)?``:`
43
- `)+i.raw,n.text+=`
44
- `+i.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}),t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
45
- `)?``:`
46
- `)+i.raw,r.text+=`
47
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
48
- `)?``:`
49
- `)+i.raw,n.text+=`
50
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,B(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e.includes(`*`)||e.includes(`_`)||e.includes(`~`)||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==H.prototype.emStrong||this.tokenizer.del!==H.prototype.del?this.#t(e):e,r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}#t(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,B(t.slice(r+1,-1))))return t;if(r>1&&t.charAt(0)!==`!`){let i=t.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,n)+`][`+`a`.repeat(t.length-r-2)+`]`}return`[`+`a`.repeat(t.length-2)+`]`};t=t.replace(e,n)}return t=t.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),t=t.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},W=class{options;parser;constructor(e){this.options=e||o}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(f.notSpaceStart)?.[0],i=e?e.replace(f.endingNewline,``)+`
51
- `:``;return r?`<pre><code class="language-`+R(r)+`">`+(n?i:R(i,!0))+`</code></pre>
52
- `:`<pre><code>`+(n?i:R(i,!0))+`</code></pre>
53
- `}blockquote({tokens:e}){return`<blockquote>
54
- ${this.parser.parse(e)}</blockquote>
55
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
56
- `}hr(e){return`<hr>
57
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
58
- `+r+`</`+i+`>
59
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
60
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
61
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
62
- <thead>
63
- `+t+`</thead>
64
- `+r+`</table>
65
- `}tablerow({text:e}){return`<tr>
66
- ${e}</tr>
67
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
68
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${R(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?R(n,!0):this.parser.parseInline(r),o=Je(e);if(o===null)return a;e=R(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+R(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Je(e);if(i===null)return R(n);e=i;let a=`<img src="${R(e)}" alt="${R(n)}"`;return t&&(a+=` title="${R(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:R(e.text)}},G=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return``}checkbox({raw:e}){return e}},K=class e{options;renderer;textRenderer;constructor(e){this.options=e||o,this.options.renderer=this.options.renderer||new W,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new G,this.textRenderer.parser=this}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},q=class{options;block;constructor(e){this.options=e||o}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?U.lex:U.lexInline}provideParser(e=this.block){return e?K.parse:K.parseInline}};function J(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var Y=new class{defaults=a();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=K;Renderer=W;TextRenderer=G;Lexer=U;Tokenizer=H;Hooks=q;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(J(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)J(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)J(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;J(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);J(n,this.walkTokens(i,t))}):e.tokens&&J(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new W(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new H(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new q;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=q.passThroughHooks.has(n)?e=>{if(t.options.async&&q.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&J(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return U.lex(e,t??this.defaults)}parser(e,t){return K.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?U.lex:U.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?K.parse:K.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?U.lex:U.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?K.parse:K.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
69
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+R(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function X(e,t){return Y.parse(e,t)}X.options=X.setOptions=function(e){return Y.setOptions(e),X.defaults=Y.defaults,s(X.defaults),X},X.getDefaults=a,X.defaults=o;function tt(...e){return Y.use(...e),X.defaults=Y.defaults,s(X.defaults),X}X.use=tt,X.walkTokens=function(e,t){return Y.walkTokens(e,t)},X.parseInline=Y.parseInline,X.Parser=K,X.parser=K.parse,X.Renderer=W,X.TextRenderer=G,X.Lexer=U,X.lexer=U.lex,X.Tokenizer=H,X.Hooks=q,X.parse=X,X.options,X.setOptions,X.walkTokens,X.parseInline,K.parse,U.lex;var nt=e({default:()=>$,renderMarkdown:()=>Q,sanitizeHtml:()=>Z}),rt=r(),it=new Set([`script`,`style`,`iframe`,`frame`,`frameset`,`object`,`embed`,`link`,`meta`,`base`,`form`,`template`,`animate`,`set`,`animatemotion`,`animatetransform`,`discard`,`animatecolor`,`xmp`,`noembed`,`noframes`,`noscript`,`plaintext`]),at=new Set([`href`,`src`,`xlink:href`,`action`,`formaction`,`poster`,`background`]),ot=new Set([`http`,`https`,`mailto`]);function st(e){let t=/^([a-z][a-z0-9+.-]*):/.exec(e.replace(/[\u0000- ]/g,``).toLowerCase());return!t||ot.has(t[1])}function Z(e){for(let t=0;t<4;t++){let t=ct(e);if(t===e)return t;e=t}return``}function ct(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`*`).forEach(e=>{if(it.has(e.localName.toLowerCase()))return e.remove();for(let{name:t,value:n}of[...e.attributes]){let r=t.toLowerCase();(r.startsWith(`on`)||r===`srcdoc`||r===`style`||at.has(r)&&!st(n))&&e.removeAttribute(t)}}),t.innerHTML}function Q(e,t=[]){let n=new Map(t.map(e=>[e.label,e])),r=(e||``).replace(/\[\[([^\]]+)\]\]/g,(e,t)=>{let r=n.get(t.trim());return r?`[${r.label}](#/item/${r.type}/${encodeURIComponent(r.name)})`:e});return Z(X.parse(r,{breaks:!1}))}var lt=[];function $({body:e,links:t=lt}){let n=(0,i.useMemo)(()=>Q(e,t),[e,t]);return(0,rt.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:n}})}export{X as a,Z as i,nt as n,Q as r,$ as t};