geneseed 4.31.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/DESIGN.md +2 -2
  3. package/README.md +6 -5
  4. package/SHIPPED.md +4 -3
  5. package/adapters/bob/README.md +6 -5
  6. package/adapters/claude-code/README.md +4 -3
  7. package/adapters/claude-code/skills/geneseed/SKILL.md +1 -1
  8. package/adapters/openclaude/README.md +4 -3
  9. package/adapters/opencode/GLOBAL-HARNESS-SPEC.md +3 -1
  10. package/adapters/opencode/HOW-OPENCODE-LOADS.md +2 -1
  11. package/adapters/opencode/README.md +18 -18
  12. package/adapters/opencode/plugins/geneseed-activity.js +57 -1
  13. package/adapters/opencode/plugins/geneseed-context.js +220 -18
  14. package/adapters/opencode/plugins/geneseed-guard.js +578 -74
  15. package/adapters/opencode/plugins/geneseed-learn.js +97 -23
  16. package/bin/geneseed-cli.mjs +17 -25
  17. package/bin/geneseed-hook.mjs +23 -8
  18. package/docs/DESIGN.md +175 -0
  19. package/docs/PRD.md +111 -0
  20. package/docs/README.md +3 -2
  21. package/docs/architecture.md +145 -0
  22. package/docs/concepts/agents.md +1 -1
  23. package/docs/concepts/collaboration.md +1 -1
  24. package/docs/concepts/enforcement-table.md +1 -1
  25. package/docs/concepts/exclusions.md +6 -6
  26. package/docs/concepts/footprint.md +1 -1
  27. package/docs/concepts/foreman-mode.md +2 -2
  28. package/docs/concepts/hook-gates.md +1 -1
  29. package/docs/concepts/hooks.md +27 -11
  30. package/docs/concepts/host-matrix.md +3 -3
  31. package/docs/concepts/hosts.md +1 -1
  32. package/docs/concepts/kits.md +3 -1
  33. package/docs/concepts/loop-bricks.md +1 -1
  34. package/docs/concepts/loop-notes.md +4 -2
  35. package/docs/concepts/loop-templates.md +7 -4
  36. package/docs/concepts/loops.md +3 -0
  37. package/docs/concepts/ownership.md +2 -2
  38. package/docs/concepts/rules.md +15 -2
  39. package/docs/concepts/shared-tier.md +73 -0
  40. package/docs/concepts/skills.md +2 -2
  41. package/docs/concepts/themes.md +1 -1
  42. package/docs/extending.md +13 -12
  43. package/docs/guides/install-claude-code.md +1 -1
  44. package/docs/guides/install-opencode.md +1 -1
  45. package/docs/guides/migrate.md +4 -2
  46. package/docs/guides/project-context.md +2 -2
  47. package/docs/guides/run-a-loop.md +1 -1
  48. package/docs/guides/set-up-ownership.md +1 -1
  49. package/docs/guides/setup-footprint.md +1 -1
  50. package/docs/guides/uninstall.md +2 -1
  51. package/docs/guides/upgrade-to-5.md +116 -0
  52. package/docs/guides/upgrade.md +21 -9
  53. package/docs/guides/wiki.md +3 -3
  54. package/docs/reference/env-context.md +5 -3
  55. package/docs/reference/environment.md +1 -1
  56. package/docs/reference/glossary.md +2 -0
  57. package/docs/reference/loop-actions.md +1 -1
  58. package/docs/reference/opencode-plugins.md +3 -3
  59. package/docs/reference/plugin-activity.md +1 -1
  60. package/docs/reference/plugin-context.md +5 -0
  61. package/docs/reference/plugin-guard.md +14 -6
  62. package/docs/reference/plugin-learn.md +13 -6
  63. package/docs/reference/troubleshoot-hooks.md +3 -3
  64. package/docs/reference/troubleshoot-update.md +14 -0
  65. package/docs/token-footprint.md +4 -3
  66. package/docs/understand/a-day.md +2 -2
  67. package/docs/understand/design-choices-install.md +2 -1
  68. package/docs/understand/enforced-vs-asked.md +4 -3
  69. package/docs/understand/machine-bob.md +3 -1
  70. package/docs/understand/machine-claude.md +7 -5
  71. package/docs/understand/machine-opencode.md +7 -5
  72. package/docs/understand/on-your-machine.md +4 -0
  73. package/docs/understand/take-it-out.md +1 -1
  74. package/docs/web-ui.md +141 -73
  75. package/harness.config.json +1 -1
  76. package/js/README.md +10 -6
  77. package/js/build/args.mjs +10 -8
  78. package/js/build/bundle.mjs +11 -13
  79. package/js/build/driver.mjs +66 -65
  80. package/js/build/emit-claude.mjs +22 -16
  81. package/js/build/emit-common.mjs +4 -5
  82. package/js/build/emit-opencode.mjs +22 -22
  83. package/js/build/fold.mjs +515 -0
  84. package/js/build/generate.mjs +41 -52
  85. package/js/build/render.mjs +115 -29
  86. package/js/build/source.mjs +4 -1
  87. package/js/build/stubs.mjs +70 -9
  88. package/js/build/version.mjs +10 -10
  89. package/js/cli-table.json +23 -83
  90. package/js/hosts/activity.mjs +2 -2
  91. package/js/hosts/geneseed-dir.mjs +1 -1
  92. package/js/hosts/hooks-context.mjs +410 -99
  93. package/js/hosts/hooks-done.mjs +97 -31
  94. package/js/hosts/hooks-learn.mjs +38 -7
  95. package/js/hosts/hooks-prims.mjs +69 -2
  96. package/js/hosts/hooks.mjs +300 -64
  97. package/js/hosts/hosts.mjs +150 -51
  98. package/js/hosts/installs.mjs +55 -167
  99. package/js/hosts/link.mjs +3 -5
  100. package/js/hosts/mcp.mjs +1 -1
  101. package/js/hosts/memory-files.mjs +219 -17
  102. package/js/hosts/ownership-gate.mjs +1 -1
  103. package/js/hosts/settings.mjs +18 -13
  104. package/js/hosts/shim.mjs +4 -33
  105. package/js/hosts/store-watch.mjs +189 -0
  106. package/js/inspect/checks-authoring.mjs +3 -3
  107. package/js/inspect/checks-build.mjs +45 -18
  108. package/js/inspect/checks-counts.mjs +4 -4
  109. package/js/inspect/checks-repo.mjs +13 -14
  110. package/js/inspect/cost.mjs +24 -2
  111. package/js/inspect/diff.mjs +123 -123
  112. package/js/inspect/doctor.mjs +22 -27
  113. package/js/inspect/excludes.mjs +181 -62
  114. package/js/inspect/inventory.mjs +22 -27
  115. package/js/inspect/registry.mjs +106 -30
  116. package/js/inspect/scan.mjs +5 -5
  117. package/js/inspect/status.mjs +141 -119
  118. package/js/inspect/validate.mjs +22 -24
  119. package/js/lib/fs.mjs +47 -50
  120. package/js/lib/json.mjs +10 -17
  121. package/js/lib/machine-dir.mjs +73 -0
  122. package/js/lib/paths.mjs +22 -33
  123. package/js/lib/proc.mjs +1 -1
  124. package/js/lib/prompt.mjs +19 -27
  125. package/js/lib/text.mjs +8 -12
  126. package/js/lib/udiff.mjs +11 -15
  127. package/js/loop/catalog.mjs +2 -3
  128. package/js/loop/state.mjs +15 -5
  129. package/js/maintain/memory.mjs +17 -17
  130. package/js/maintain/migrate.mjs +79 -89
  131. package/js/maintain/setup.mjs +43 -32
  132. package/js/maintain/uninstall.mjs +43 -61
  133. package/js/maintain/update.mjs +200 -93
  134. package/js/ui/anim.mjs +21 -35
  135. package/js/ui/cli.mjs +36 -58
  136. package/js/ui/menu.mjs +22 -45
  137. package/js/ui/tui.mjs +27 -67
  138. package/js/web/actions.mjs +38 -38
  139. package/js/web/api.mjs +132 -76
  140. package/js/web/catalog.mjs +175 -46
  141. package/js/web/docs.mjs +33 -12
  142. package/js/web/doctor-worker.mjs +14 -0
  143. package/js/web/handler.mjs +14 -5
  144. package/js/web/routes.mjs +17 -19
  145. package/js/web/state.mjs +78 -19
  146. package/js/web/update-check.mjs +25 -10
  147. package/js/web/user-files.mjs +50 -105
  148. package/package.json +7 -4
  149. package/registry.json +48 -55
  150. package/src/AGENT.md.tmpl +13 -14
  151. package/src/agents/_self-improvement.md +1 -1
  152. package/src/agents/_template.md +4 -1
  153. package/src/agents/advocate.md +1 -1
  154. package/src/agents/architect.md +1 -1
  155. package/src/agents/developer.md +6 -3
  156. package/src/agents/devops-engineer.md +1 -1
  157. package/src/agents/docker-expert.md +1 -1
  158. package/src/agents/docs.md +1 -1
  159. package/src/agents/empiricist.md +1 -1
  160. package/src/agents/explorer.md +1 -1
  161. package/src/agents/framer.md +1 -1
  162. package/src/agents/historian.md +1 -1
  163. package/src/agents/kubernetes-specialist.md +1 -1
  164. package/src/agents/memory-curator.md +2 -2
  165. package/src/agents/operator.md +1 -1
  166. package/src/agents/performance.md +1 -1
  167. package/src/agents/pragmatist.md +1 -1
  168. package/src/agents/react-engineer.md +1 -1
  169. package/src/agents/react-reviewer.md +1 -1
  170. package/src/agents/researcher.md +1 -1
  171. package/src/agents/reviewer.md +1 -1
  172. package/src/agents/security.md +1 -1
  173. package/src/agents/skeptic.md +1 -1
  174. package/src/agents/spring-boot-engineer.md +1 -1
  175. package/src/agents/spring-reviewer.md +1 -1
  176. package/src/agents/spring-security.md +1 -1
  177. package/src/agents/steward.md +1 -1
  178. package/src/agents/tester.md +5 -2
  179. package/src/agents/user-advocate.md +1 -1
  180. package/src/agents/visionary.md +1 -1
  181. package/src/bricks/apply.md +3 -0
  182. package/src/bricks/test.md +6 -4
  183. package/src/loops/bugfix.json +11 -5
  184. package/src/loops/feature.json +7 -4
  185. package/src/memory/README.md +1 -1
  186. package/src/skills/_self-improvement.md +2 -2
  187. package/src/skills/daydream/SKILL.md +2 -2
  188. package/src/skills/daydream/instructions.md +1 -1
  189. package/src/skills/geneseed.md +1 -1
  190. package/src/skills/learn-mode.md +1 -2
  191. package/src/skills/loop.md +1 -0
  192. package/src/skills/profile.md +2 -2
  193. package/src/skills/rule/approve.md +69 -0
  194. package/src/skills/rule/consolidate.md +3 -3
  195. package/src/skills/rule.md +13 -5
  196. package/src/skills/ship.md +9 -1
  197. package/src/skills/skill-forge.md +1 -1
  198. package/src/skills/teach.md +29 -12
  199. package/src/skills/wiki.md +1 -1
  200. package/themes/_TEMPLATE.json +1 -2
  201. package/themes/biker.json +1 -2
  202. package/themes/commentator.json +1 -2
  203. package/themes/cyberpunk.json +1 -2
  204. package/themes/gamer.json +1 -2
  205. package/themes/imperial.json +1 -2
  206. package/themes/joker.json +1 -2
  207. package/themes/marvin.json +1 -2
  208. package/themes/mean.json +1 -2
  209. package/themes/military.json +1 -2
  210. package/themes/neutral.json +1 -2
  211. package/themes/pirate.json +1 -2
  212. package/themes/sports.json +1 -2
  213. package/themes/verstappen.json +1 -2
  214. package/themes/wizard.json +1 -2
  215. package/web/dist/assets/Activity-D8G4eClY.js +1 -0
  216. package/web/dist/assets/ActivityDetail-BtOBYk3M.js +1 -0
  217. package/web/dist/assets/AgentGlyph-k6o3gCM1.js +1 -0
  218. package/web/dist/assets/Bonsai-B_y20b3i.js +1 -0
  219. package/web/dist/assets/{CopyButton-IXnXzH4Y.js → CopyButton-CHQte7Ap.js} +1 -1
  220. package/web/dist/assets/Dashboard-B8uXeJZ_.js +2 -0
  221. package/web/dist/assets/{DataTable-BWbUx4bY.js → DataTable-b9zTShqJ.js} +1 -1
  222. package/web/dist/assets/Docs-Dgv_MWfT.js +5 -0
  223. package/web/dist/assets/{EmptyState-1sPNleqv.js → EmptyState-CY5Pm2xy.js} +1 -1
  224. package/web/dist/assets/FilterInput-qGKNSlxv.js +1 -0
  225. package/web/dist/assets/GreenhouseView-CSzTMSl_.js +1 -0
  226. package/web/dist/assets/Installs-BDk9lqBI.js +3 -0
  227. package/web/dist/assets/JournalView-CvRk1-m5.js +1 -0
  228. package/web/dist/assets/Kits-CoITzxWM.js +1 -0
  229. package/web/dist/assets/Laws-Ctf5r9rE.js +3 -0
  230. package/web/dist/assets/Library-DNwHYVXt.js +3 -0
  231. package/web/dist/assets/{Loops-C5u7fQOR.js → Loops-S85PMQ8m.js} +2 -2
  232. package/web/dist/assets/Markdown-0ORz7tAc.js +69 -0
  233. package/web/dist/assets/OperatorHudView-DuGz_sTk.js +1 -0
  234. package/web/dist/assets/Personal-afJNwvRS.js +2 -0
  235. package/web/dist/assets/RailCats-AW92uhsX.js +1 -0
  236. package/web/dist/assets/Settings-CGDFz-6j.js +1 -0
  237. package/web/dist/assets/Tabs-1qLrnqmn.js +1 -0
  238. package/web/dist/assets/api-C46vAuqp.js +1 -0
  239. package/web/dist/assets/controls-D4wmg_pl.js +1 -0
  240. package/web/dist/assets/index-COTd4TRZ.js +3 -0
  241. package/web/dist/assets/index-CtorA7uK.css +1 -0
  242. package/web/dist/assets/motion-RlUl1osO.js +1 -0
  243. package/web/dist/assets/react-C1iE8mnY.js +9 -0
  244. package/web/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  245. package/web/dist/assets/{sections-ChwaobfW.js → sections-CtFz7HFH.js} +1 -1
  246. package/web/dist/assets/{usePoll-bDFN-Hr6.js → usePoll-o8ul-Sog.js} +1 -1
  247. package/web/dist/index.html +7 -7
  248. package/src/skills/quiz.md +0 -44
  249. package/web/dist/assets/Activity-B7cFtS00.js +0 -1
  250. package/web/dist/assets/ActivityDetail-C-GbMmuW.js +0 -1
  251. package/web/dist/assets/Bonsai-_YyexVC5.js +0 -1
  252. package/web/dist/assets/Dashboard-sCfEjowQ.js +0 -2
  253. package/web/dist/assets/Docs-w3Y7M5Ts.js +0 -5
  254. package/web/dist/assets/FilterInput-CZREvrjX.js +0 -1
  255. package/web/dist/assets/GreenhouseView-BWWbMKmg.js +0 -1
  256. package/web/dist/assets/Installs-CnkdJ-VA.js +0 -3
  257. package/web/dist/assets/JournalView-C7bPD3fZ.js +0 -1
  258. package/web/dist/assets/KitApply-CQQbnThf.js +0 -1
  259. package/web/dist/assets/Kits-aj07N7mT.js +0 -1
  260. package/web/dist/assets/Laws-DZ38nl_H.js +0 -3
  261. package/web/dist/assets/Library-QCGXPV5h.js +0 -2
  262. package/web/dist/assets/Markdown-DpmmtW2Y.js +0 -65
  263. package/web/dist/assets/OperatorHudView-Blu1lqiZ.js +0 -1
  264. package/web/dist/assets/Personal-ox_MktWO.js +0 -2
  265. package/web/dist/assets/RailCats-BuJD4Jou.js +0 -1
  266. package/web/dist/assets/Tabs-CIPyMAX-.js +0 -1
  267. package/web/dist/assets/api-BxjLd7Qd.js +0 -1
  268. package/web/dist/assets/index-0GCxkY7m.css +0 -1
  269. package/web/dist/assets/index-CzDi9JpF.js +0 -3
  270. package/web/dist/assets/motion-CXaUMNkg.js +0 -1
  271. package/web/dist/assets/react-DlYQp10C.js +0 -9
  272. package/web/dist/assets/rolldown-runtime-hePW80VL.js +0 -1
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C46vAuqp.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{C as M,Dt as N,Et as P,Ot as F,bt as I,ct as L,st as R,wt as z}from"./index-COTd4TRZ.js";import{n as B}from"./Dashboard-B8uXeJZ_.js";function V(e){return k((e.iterationDuration+e._loopDelay)*e.iterationCount-e._loopDelay)||1e-11}function H(e,t,n,r,a,c){let l=i(e.duration)&&e.duration<=1e-11?n-h:n;t.composition&&O(t,l,1,1,u.AUTO);let d=r?new D(r,e,t,l,!1,a,c):new b(e,t,l);return t.composition&&d.init(!0),o(t,d),s(t,e=>{let n=e._offset+e._delay+e.duration;n>t.iterationDuration&&(t.iterationDuration=n)}),t.duration=V(t),t}var U=0,W=class extends b{constructor(e={}){super(e,null,0),++U,this.id=f(e.id)?U:e.id,this.duration=0,this.labels={};let t=e.defaults,n=a.defaults;this.defaults=t?m(t,n):n,this.composition=A(e.composition,!0),this.onRender=e.onRender||n.onRender;let r=A(e.playbackEase,n.playbackEase);this._ease=r?v(r):null,this.iterationDuration=0}add(e,t,n){let r=S(t),i=S(e);if(r||i){if(this._hasChildren=!0,r){let r=t,i=a.editor&&a.editor.addTimelineChild,o=n&&n.type===`Stagger`&&a.editor,s=p(n)?n:null;if(s||o){let t=T(e),o=this.duration,c=this.iterationDuration,l=r.id,u=0,d=t.length,p=i?i(e,r,this.id,n,d):null,m=s||a.editor.resolveStagger(n.defaultValue);t.forEach(e=>{let n={...p||r};this.duration=o,this.iterationDuration=c,f(l)||(n.id=l+`-`+u);let i=F(this,m(e,u,t,null,this));H(n,this,i,e,u,t),u++})}else{let t=i?i(e,r,this.id,n):r,a=n&&n.type?n.defaultValue:n;H(t,this,F(this,a),e)}}else H(e,this,F(this,t));return this.composition&&this.init(!0),this}}sync(e,t){if(f(e)||e&&f(e.pause))return this;e.pause();let n=+(e.effect?e.effect.getTiming().duration:e.duration);!f(e)&&!f(e.persist)&&(e.persist=!0);let r=a.editor,i=r&&r.addTimelineChild;r&&r.addTimelineSync&&(t=r.addTimelineSync(e,t,this.id),r.addTimelineChild=null);let o=this.add(e,{currentTime:[0,n],duration:n,delay:0,ease:`linear`,playbackEase:`linear`},t);return r&&(r.addTimelineChild=i),o}set(e,t,n){return f(t)?this:(t.duration=h,t.composition=l.replace,this.add(e,t,n))}call(e,t){return f(e)||e&&!p(e)?this:(a.editor&&a.editor.addTimelineCall&&(t=a.editor.addTimelineCall(e,t,this.id)),this.add({duration:0,delay:0,onComplete:()=>e(this)},t))}label(e,t){return f(e)||e&&!d(e)||(a.editor&&a.editor.addTimelineLabel&&(t=a.editor.addTimelineLabel(e,t,this.id)),this.labels[e]=F(this,t)),this}remove(e,t){return y(T(e),this,t),this}stretch(e){let t=this.duration;if(t===c(e))return this;let n=e/t,r=this.labels;s(this,e=>e.stretch(e.duration*n));for(let e in r)r[e]*=n;return super.stretch(e)}refresh(){return s(this,e=>{e.refresh&&e.refresh()}),this}revert(){return super.revert(),s(this,e=>e.revert,!0),g(this)}then(e){return super.then(e)}},G=e=>a.editor?a.editor.addTimeline(e):new W(e).init(),K=e(t(),1),q=n(),J=.62,te=(e,t)=>String(e).length*t*J;function Y(e,t){let n=0;for(let t of e){if(t.t===``||t.t==null)continue;let e=te(t.t,t.size)/2;n=Math.max(n,Math.hypot(e,t.dy-t.size*.75),Math.hypot(e,t.dy+t.size*.25))}return Math.ceil(n+t)}function X(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=r/a,s=i/a,c=e.x+o*e.r,l=e.y+s*e.r,u=t.x-o*t.r,d=t.y-s*t.r,f=n*a,p=e=>e.toFixed(1);return`M${p(c)} ${p(l)} C${p(c+o*a*.3-s*f)} ${p(l+s*a*.3+o*f)} ${p(u-o*a*.3-s*f)} ${p(d-s*a*.3+o*f)} ${p(u)} ${p(d)}`}var Z=!1,Q=!1,ne=w[8]+w[7];function $({hash:e,label:t,part:n,children:r}){return(0,q.jsx)(`g`,{className:`cm-node`,"data-cm":n,role:`button`,tabIndex:0,"aria-label":t,onClick:()=>z(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),z(e))},children:r})}function re({overview:e,dataRev:t}){let{data:n}=I(()=>r.catalog(`laws`),[t],`catalog:laws`),i=n?.items??null,a=n?.nouns?.ontology||`Ethos`,o=n?.nouns?.laws||`Dictates`,s=n?.nouns?.doctrines||`Doctrines`,c=(0,K.useRef)(null),l=(0,K.useRef)(!0),u=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=c.current;if(!e||Z||!x())return;Z=!0;let t=t=>[...e.querySelectorAll(t)],n=t(`[data-cm="hub"]`),r=t(`[data-cm="sat"]`),i=t(`[data-cm="gov"]`),a=t(`.cm-edge-gov`),o=t(`.cm-note, .cm-govern-label`),s=P(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:N(w[1])},w[3]).add(r,{opacity:1,scale:1,duration:w[7],delay:N(w[1])},w[5]).add(a,{opacity:1,duration:w[6],delay:N(w[1])},w[7]).add(i,{opacity:1,scale:1,duration:w[7],delay:N(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=L(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:N(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:M(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:M(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:L(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:()=>z(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:()=>z(`#/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:R(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 ✓ ${R(t)}`:`Never built here`,` ·`,` `,(0,q.jsx)(`button`,{className:`jr-go`,onClick:()=>z(`#/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:()=>z(`#/laws`),children:`open →`})]}),(0,q.jsx)(re,{overview:e,dataRev:r})]})]})}export{oe as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C46vAuqp.js";import{$ as i,H as a,K as o,X as s,Y as c,_t as l,bt as u,q as d,z as f}from"./index-COTd4TRZ.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{r as h}from"./controls-D4wmg_pl.js";import{t as g}from"./DataTable-b9zTShqJ.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=i(),r=d(),a=e=>{let t=r.get(`kits`,e.id);return t&&t.base===o(v(e))?t:null},{prune:s}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,o(v(e))]));s(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,s]);let c=e=>a(e)?.value??new Set(v(e)),u=(e,t)=>{let n=new Set(c(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,o(v(e)))},f=e=>{let t=c(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)||!!a(e)?.applied;return{setOf:c,toggle:u,change:f,apply:async e=>{let i=[...c(e)],a=`Rebuild ${l(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=>!!a(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 ${l(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=l(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(h,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(p,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=l;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||[],o=e.skills||[],s=e.agents||[],c=t.map(t=>({row:t,...F(n,t,e.name)})),l=c.filter(t=>v(t.row).includes(e.name)).length,u=c.filter(e=>e.staged).length,d=A(l,t.length),p=`on in ${l} of ${N(t.length,`install`)}${u?` · ${u} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${u?` 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)(f,{value:o.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:o.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(f,{value:s.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length})]}),o.length?(0,x.jsx)(j,{type:`skill`,names:o,listed:r?.skills,offNote:d}):null,s.length?(0,x.jsx)(j,{type:`agent`,names:s,listed:r?.agents,offNote:d}):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":c.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:c.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(h,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(g,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:i,error:o}=u(()=>r.kits(),[n]),l=b(i,t),{data:d}=u(()=>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=i?.kits||[],p=i?.installs||[],h=o||i?.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)(c,{error:h,style:{margin:`0 0 var(--sp-3)`}}),i?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:p,stage:l,listed:d})}):(0,x.jsxs)(m,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(s,{})]})}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:i?`${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)(c,{error:h,style:{margin:`0 0 var(--sp-3)`}}),i?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:l,listed:d,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:p,stage:l}),p.length?(0,x.jsx)(R,{installs:p,stage:l}):null]}):h?null:(0,x.jsx)(s,{})]})}export{z as default};
@@ -0,0 +1,3 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C46vAuqp.js";import{$ as i,H as a,K as o,Q as s,W as c,X as l,Y as u,Z as d,_ as f,_t as p,b as m,bt as h,d as g,f as _,ft as v,g as y,h as b,m as ee,p as te,pt as x,q as ne,v as re,vt as S,wt as C,y as w,z as T}from"./index-COTd4TRZ.js";import{t as E}from"./Markdown-0ORz7tAc.js";import{t as ie}from"./EmptyState-CY5Pm2xy.js";import{t as ae}from"./FilterInput-qGKNSlxv.js";var D=e(t(),1);function oe({items:e,packs:t,install:n,canApply:r,onAction:a,gateArmed:s}){let c=i(),l=e.filter(e=>e.tier===`doctrine`&&e.active!==!1).map(e=>e.name),u=l.join(`,`),d=ne(),f=n?`${n.host}:${n.scope}:${n.path}`:``,m=o(l),{prune:h}=d,g=e.length>0;(0,D.useEffect)(()=>{g&&h(`rules`,(e,t)=>e===f&&t.base!==m)},[g,f,m,h]);let _=d.get(`rules`,f),v=_&&_.base===m?_.value:l,y=e=>d.put(`rules`,f,e(v),m),b=e=>v.includes(e),ee=e=>y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),te=e=>e.rules.some(e=>b(e.addr)),x=e=>{let t=e.rules.map(e=>e.addr),n=e.rules.every(e=>b(e.addr));y(e=>n?e.filter(e=>!t.includes(e)):[...new Set([...e,...t])])},re=e=>{let t=e.rules.filter(e=>b(e.addr)).length;return t?e.active?`${t} of ${e.rules.length} active`:`staged on · ${t} of ${e.rules.length}`:e.active?`staged off`:`not built in`},S=t.flatMap(e=>e.rules.map(e=>e.addr)),C=S.filter(b),w=C.join(`,`)!==u,T=`process.5`,E=l.includes(T)&&!v.includes(T);return{deployedRules:l,isOn:b,toggleRule:ee,packOn:te,togglePack:x,packState:re,allRules:S,pickedRules:C,dirty:w,losingConsent:E,applyPacks:async()=>{if(!r||!w)return;let e=t.filter(e=>e.rules.some(e=>b(e.addr))).map(e=>e.pack),i=t.filter(t=>e.includes(t.pack)).flatMap(e=>e.rules.filter(e=>!b(e.addr)).map(e=>e.addr)),o=E?`
2
+
3
+ process 5 carries commit/push consent. Dropping it also removes the git-gate hook, so commits and pushes stop being confirmed at the tool boundary. `+(s?`(Real data loss stays gated: that is Rule IV’s, not the pack’s.)`:`(Rule IV’s deletion gate is off on this install, so real data loss is not asked about either.)`):``,l=C.length?`${C.length} of ${S.length} doctrine rules`:`no doctrine rules`;await c(`Rebuild ${p(n)} with ${l}? It rebuilds in place, non-destructive.${o}`,{title:`Rebuild with these rules?`,confirmLabel:`Rebuild`})&&await a(`install`,{...n,doctrines:e,excludeRules:i})&&d.startApply(`rules`,f)},revert:()=>d.drop(`rules`,f)}}var O=n();function se({addr:e,isOpen:t,onToggle:n,className:i,style:a,head:o,label:s,rev:c,toggleCol:l=null,renderBody:d,srcLine:f,after:p=null}){let m=(0,D.useId)(),{data:g,error:_,reload:v}=h(()=>t?r.item(`law`,e):Promise.resolve(null),[t,e,c],`law-item`),y=t&&(0,O.jsxs)(`div`,{className:`law-expand`,id:m,children:[_?(0,O.jsx)(u,{error:_,onRetry:v}):g?d(g):(0,O.jsx)(`p`,{className:`dim`,children:`Loading…`}),(0,O.jsx)(`div`,{className:`law-srcline`,children:f}),p]}),b={type:`button`,onClick:n,"aria-expanded":t,"aria-controls":m,"aria-label":s};return l?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:i,style:a,"data-addr":e,children:[(0,O.jsx)(`button`,{className:`law-disclosure`,...b,children:o}),(0,O.jsx)(`span`,{className:`toggle-col`,children:l})]}),y]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`button`,{className:i,style:a,"data-addr":e,...b,children:o}),y]})}function ce({law:e,isOpen:t,onToggle:n,rev:r,toggleCol:i=null,after:a=null}){let o=(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`span`,{className:`law-no`,children:[(0,O.jsx)(`span`,{className:`x`,"aria-hidden":`true`,children:`›`}),e.no]}),(0,O.jsxs)(`span`,{className:`law-name`,children:[(0,O.jsx)(`span`,{children:e.name}),e.ess?(0,O.jsx)(`span`,{className:`law-princ`,children:e.ess}):null,e.asks?(0,O.jsx)(`span`,{className:`law-asks mono`,children:e.asks}):null]}),(0,O.jsx)(`span`,{className:`law-latin`,children:e.latin}),(0,O.jsx)(`span`,{className:`law-status ${e.statusTone}`,children:e.status}),(0,O.jsx)(`span`,{className:`law-enf${e.enf===`Hook gate`?` hook`:e.enf===`Gate off`?` gate-off`:``}`,children:e.enf})]});return(0,O.jsx)(se,{addr:e.addr,isOpen:t,onToggle:n,className:`law-row${i?` has-toggle`:``}${t?` on`:``}${e.off?` law-off`:``}`,style:{"--cc":e.c},head:o,label:`${e.no?e.no+` `:``}${e.name}, ${e.status}, ${e.enf}`,rev:r,toggleCol:i,renderBody:t=>(0,O.jsx)(E,{body:t.body||e.ess,links:t.links}),srcLine:`$ geneseed law ${e.addr} · ${e.src}`,after:a})}var k=[`invariants`,`doctrines`];function le({tiers:e,current:t,onPick:n}){return(0,O.jsx)(`div`,{className:`tier-strip`,children:e.map((e,r)=>{let i=(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`span`,{className:`tier-head`,children:[(0,O.jsxs)(`span`,{className:`tier-k mono`,children:[`RANK `,r+1]}),e.pill?(0,O.jsx)(`span`,{className:`badge tier-pill ${e.pill[1]}`,children:e.pill[0]}):null]}),(0,O.jsxs)(`span`,{className:`tier-top`,children:[(0,O.jsx)(`span`,{className:`tier-name`,children:e.name}),(0,O.jsx)(`span`,{className:`tier-n mono`,children:e.n})]}),(0,O.jsx)(`span`,{className:`tier-bar`,"aria-hidden":`true`,children:(0,O.jsx)(`span`,{style:{width:`${Math.round(e.fill*100)}%`}})}),(0,O.jsx)(`span`,{className:`tier-sub`,children:e.sub}),(0,O.jsx)(`span`,{className:`tier-sub tier-rule`,children:e.rule})]}),a=`tier${t===e.key?` on`:``}`;return e.href?(0,O.jsx)(`a`,{className:`tier`,href:e.href,children:i},e.key):n&&k.includes(e.key)?(0,O.jsx)(`button`,{type:`button`,className:a,"aria-pressed":t===e.key,onClick:()=>n(t===e.key?`all`:e.key),children:i},e.key):(0,O.jsx)(`div`,{className:a,children:i},e.key)})})}function ue({gates:e,byAddr:t,onJump:n,disarmed:r=()=>!1,install:i=null}){let a=i?`off · ${p(i)}`:`off`,o=Object.entries(e?.asks||{}).map(([e,t])=>[e,t,r(y(e))]).sort((e,t)=>e[2]-t[2]||t[1]-e[1]),s=Math.max(1,...o.map(([,e])=>e));return(0,O.jsxs)(`section`,{className:`panel`,"aria-labelledby":`gate-asks`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`h2`,{id:`gate-asks`,children:`Gate asks`}),(0,O.jsxs)(`span`,{className:`mono dim`,children:[e?.total??0,` in ledger`]})]}),o.length?(0,O.jsx)(`ul`,{className:`gate-list`,children:o.map(([e,r,i])=>{let o=y(e),c=t[o]?.name||f(o);return(0,O.jsxs)(`li`,{children:[(0,O.jsx)(`button`,{type:`button`,className:`gate-row`,onClick:()=>n(o),children:(0,O.jsxs)(`span`,{className:`gate-top`,children:[(0,O.jsx)(`span`,{className:`gate-name${i?` dim`:``}`,children:c}),i&&(0,O.jsx)(`span`,{className:`mono off`,children:a}),(0,O.jsx)(`span`,{className:`mono gate-n`,children:r})]})}),(0,O.jsx)(T,{value:r,max:s,label:`${c} asks`,tone:i?`accent`:`warn`})]},e)})}):(0,O.jsx)(`p`,{className:`sub`,children:`No gate has asked yet.`}),(0,O.jsx)(`p`,{className:`panel-note`,children:e?.standing_down?.length?`Standing down: ${e.standing_down.join(`, `)}.`:`None standing down.`})]})}function de({packs:e,sel:t,canApply:n,install:r,gateArmed:i}){let{isOn:a,packOn:o,togglePack:s,dirty:c,losingConsent:l}=t,u=Math.max(1,...e.map(e=>e.rules.length));return(0,O.jsxs)(`section`,{className:`panel`,"aria-labelledby":`doc-packs`,children:[(0,O.jsxs)(`div`,{className:`panel-head`,children:[(0,O.jsx)(`h2`,{id:`doc-packs`,children:`Doctrine packs`}),(0,O.jsxs)(`span`,{className:`mono dim`,children:[e.filter(o).length,`/`,e.length,` on`]})]}),e.length?(0,O.jsx)(`ul`,{className:`pack-list`,children:e.map(e=>{let t=e.rules.filter(e=>a(e.addr)).length;return(0,O.jsxs)(`li`,{className:o(e)?``:`off`,children:[(0,O.jsx)(`span`,{className:`pl-name`,title:e.desc,children:e.title}),(0,O.jsx)(T,{value:t,max:u,label:`${e.title} rules on`}),(0,O.jsx)(`span`,{className:`mono pl-n`,children:t}),n?(0,O.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,O.jsx)(`p`,{className:`sub`,children:`This install predates the three-tier constitution.`}),n&&e.length>0&&(0,O.jsxs)(O.Fragment,{children:[l&&(0,O.jsxs)(`p`,{className:`pack-warn`,role:`status`,"aria-live":`polite`,children:[`Dropping `,(0,O.jsx)(`b`,{children:`process 5`}),` also removes the commit/push consent gate:`,` `,(0,O.jsx)(`code`,{children:`git commit`}),` and `,(0,O.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,O.jsx)(`p`,{className:`panel-note`,role:`status`,"aria-live":`polite`,children:c?`Not applied yet. Apply rebuilds ${r.host} · ${r.scope} once, with every change together.`:`Matches the deployed install. Changing a pack rebuilds it.`})]})]})}var fe=`ont:ownership`,pe=e=>e===`ownership`?fe:e;function me(e){let t=[];for(let n of e){if(n.tier!==`doctrine`)continue;let e=t.find(e=>e.pack===n.pack);e||(e={pack:n.pack,title:n.packTitle||n.pack,desc:n.packDesc||``,active:n.packActive!==!1,rules:[]},t.push(e));let r=re(n.title);e.rules.push({addr:n.name,no:`${n.pack} ${n.name.split(`.`)[1]||``}`,name:r.name,latin:r.latin,ess:n.summary||``,enf:b(n.name),c:m[n.pack]||`var(--text-3)`,src:`doctrines/${n.pack}.md`})}return t}function A(e){let t=x(e.dataRev),[n,r]=v(`laws`,t);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(d,{className:`page-pick`,installs:t,value:n,onChange:r}),(0,O.jsx)(M,{...e,install:n,listed:t!==null},n?.id??`none`)]})}var j=(e,t)=>e?.install?.host===t.host&&e.install.path===t.path;function M({install:e,listed:t,...n}){let i=e&&j(n.overview,e)?n.overview:null,{data:a,error:o,loading:s}=h(()=>Promise.resolve().then(()=>e&&!i?r.overview(S(e)):null),[!!i,n.dataRev]),c=i||(e&&j(a,e)?a:null),l=e?c:n.overview,d=!(!e||c||s);return(0,O.jsxs)(O.Fragment,{children:[d?(0,O.jsx)(u,{error:`Could not read this install's gates${o?`: ${o}`:`.`}`}):null,(0,O.jsx)(N,{...n,overview:l,pair:S(e),onAction:t&&(!e||c!==null)?n.onAction:void 0,pending:!t||!!(e&&!c&&s),gatesUnread:d})]})}function N({selected:e,overview:t,setup:n,onAction:o,dataRev:d,pair:f,pending:v,gatesUnread:x}){let ne=i(),{data:S,error:E}=h(()=>r.catalog(`laws`,f),f?[d,f.host,f.path]:[d],`catalog:laws`),{data:se}=c(d,f),[k,A]=(0,D.useState)(`all`),[j,M]=(0,D.useState)(``),[N,he]=(0,D.useState)(`all`),[ge,_e]=(0,D.useState)(()=>new Set),P=pe(e)||null,ve=e=>C(P===e?`#/laws`:`#/item/law/${encodeURIComponent(e)}`),F=t?.install,I=!!(F&&o),[ye,be]=(0,D.useState)(0),xe=(0,D.useRef)(null);(0,D.useEffect)(()=>{if(!P)return;let e=requestAnimationFrame(()=>{let e=document.querySelector(`[data-addr="${CSS.escape(P)}"]`);if(!e)return;let t=xe.current===P;xe.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)},[P,ye,S]);let L=S?.items||[],R=me(L),z=e=>t?.install?.[_[e].key]!==!1,Se=z(`IV`),B=oe({items:L,packs:R,install:F,canApply:I,onAction:o,gateArmed:Se}),{deployedRules:V,isOn:H,toggleRule:Ce,packOn:we,packState:Te,allRules:U}=B;if(E)return(0,O.jsx)(u,{error:E});if(!S||v)return(0,O.jsx)(l,{});let W={ontology:S.nouns?.ontology||`Ethos`,law:S.nouns?.law||`Dictate`,laws:S.nouns?.laws||`Dictates`,doctrines:S.nouns?.doctrines||`Doctrines`},Ee=(e,t)=>{let n=b(e,t);return x&&_[e]&&n===`Hook gate`?`Unknown`:n},G=L.filter(e=>e.tier===`ontology`).map(e=>({addr:e.name,no:``,name:e.title,latin:``,ess:``,status:`Always`,statusTone:`ok`,enf:e.name===fe&&(F||x)?Ee(`ownership`,F):`Instruction`,c:`var(--text-3)`,src:`ontology/universal.md`})),K=L.filter(e=>(e.tier??`invariant`)===`invariant`).map(e=>{let n=e.klass&&w[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`:Ee(e.name,t?.install),cat:n,c:w[n].c,off:r.retired,src:`laws/universal.md`}}),q=I?[{addr:`ownership`,name:_.ownership.label,latin:``,ess:``,enf:b(`ownership`,F)}]:[],De=e=>{let t=H(e.addr),n=V.includes(e.addr),r=t===n?t?`Active`:`Off`:t?`Staged on`:`Staged off`;return{...e,enf:x&&_[e.addr]&&e.enf===`Hook gate`?`Unknown`:e.enf,off:!t,status:r,statusTone:t?`ok`:t===n?``:`warn`}},Oe=R.filter(e=>e.active).flatMap(e=>e.rules.filter(e=>!V.includes(e.addr)).map(e=>e.addr)),ke=async e=>{if(!I)return;let{key:t,label:n}=_[e],r=n.toLowerCase(),i=!z(e),a=p(F),s=B.dirty?` Your staged doctrine changes are not part of this rebuild; they stay staged.`:``;await ne((i?`Re-arm the ${r} on ${a}? ${g[e].arm} It rebuilds in place, non-destructive.`:`Switch the ${r} off on ${a}? ${g[e].off} It rebuilds in place, non-destructive.`)+s,{title:i?`Re-arm the ${r}?`:`Switch the ${r} off?`,confirmLabel:i?`Re-arm`:`Switch off`})&&o(`install`,{...F,[t]:i})},Ae=e=>(0,O.jsx)(`button`,{type:`button`,className:`sw-toggle${z(e)?` on`:``}`,role:`switch`,"aria-checked":z(e),"aria-label":_[e].label,onClick:()=>ke(e)}),je=e=>String(e.addr).includes(`.`)&&H(e.addr)!==V.includes(e.addr),J=(e,t=N)=>t===`all`||(t===`gated`?e.enf===`Hook gate`&&(!String(e.addr).includes(`.`)||V.includes(e.addr)):je(e)),Y=j.trim().toLowerCase(),X=e=>J(e)&&(!Y||`${e.addr} ${e.name} ${e.latin} ${e.ess}`.toLowerCase().includes(Y)),Me=e=>{let t=Be[e];(String(e).includes(`.`)?k===`invariants`:t&&k===`doctrines`)&&A(`all`),t&&!J(t)&&he(`all`),t&&!X(t)&&M(``),xe.current=pe(e),be(e=>e+1),C(`#/item/law/${encodeURIComponent(e)}`)},Z={};for(let[e,t]of Object.entries(n?.gates?.asks||{}))Z[y(e)]=t;let Ne=e=>Z[e.addr]?{...e,asks:`${Z[e.addr]} ask${Z[e.addr]===1?``:`s`}`}:e,Q=K.filter(e=>!e.retired).length,Pe=V.length,Fe=e=>{if(x)return[`gates unread`,`warn`];let t=e.filter(e=>_[e.addr]&&!z(e.addr)).length;return t?[`${t} gate${t===1?``:`s`} off`,`warn`]:[`always`,`ok`]},Ie=U.length-Pe,$=se?.stats,Le={ethos:{name:W.ontology,n:G.length,fill:1,sub:`${G.length} sections`,pill:Fe(q)},invariants:{name:W.laws,n:K.length,fill:K.length?Q/K.length:0,sub:K.length>Q?`${Q} active · ${K.length-Q} retired`:`${Q} active`,pill:Fe(K)},doctrines:{name:W.doctrines,n:U.length,fill:U.length?Pe/U.length:0,sub:`${R.length} packs`,pill:Ie>0?[`${Ie} excluded`,`warn`]:[`all on`,`ok`]},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`,``]}},Re=e=>{if(e===`—`)return`Nothing outranks them.`;let t=e.replace(`{{LAW}}`,W.law);return`${t[0].toUpperCase()}${t.slice(1)}.`},ze=te.map(e=>({key:e.key,...Le[e.key],rule:Re(e.against)})),Be=Object.fromEntries([...K,...R.flatMap(e=>e.rules)].map(e=>[e.addr,e])),Ve=[[`all`,`All`,K.length+U.length],[`invariants`,W.laws,K.length],[`doctrines`,W.doctrines,U.length]],He=k===`all`||k===`invariants`,Ue=k===`all`||k===`doctrines`,We=[...q,...He?K:[],...Ue?R.flatMap(e=>e.rules):[]],Ge=[[`gated`,`Gated`,x?null:We.filter(e=>J(e,`gated`)).length],[`changed`,`Changed`,We.filter(e=>J(e,`changed`)).length]],Ke=e=>String(e).includes(`.`)?String(e).split(`.`)[0]:null,qe=e=>N!==`changed`&&ge.has(e)&&Ke(P)!==e,Je=e=>{let t=qe(e);_e(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&Ke(P)===e&&C(`#/laws`)},Ye=R.flatMap(e=>e.rules.filter(je).map(e=>({...e,plus:H(e.addr)}))),Xe=I&&R.length>0&&B.dirty,Ze=()=>{he(`changed`),k===`invariants`&&A(`all`),M(``)},Qe=(e,t)=>(0,O.jsxs)(`div`,{className:`band-head`,role:`presentation`,children:[(0,O.jsx)(`h2`,{className:`tier-h`,children:e}),(0,O.jsx)(`span`,{className:`mono dim`,children:t})]}),$e=K.filter(X),et=(Y||N!==`all`?q.filter(X).length:0)+(He?$e.length:0)+(Ue?R.reduce((e,t)=>e+t.rules.filter(X).length,0):0),tt=Ne(q[0]||{}).asks,nt=q.length>0&&(0,O.jsxs)(`div`,{className:`law-gate`,children:[(0,O.jsxs)(`span`,{className:`law-name`,children:[(0,O.jsx)(`span`,{children:_.ownership.label}),tt?(0,O.jsx)(`span`,{className:`law-asks mono`,children:tt}):null,(0,O.jsx)(`span`,{className:`law-princ`,children:g.ownership.desc})]}),Ae(`ownership`)]});return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(a,{eyebrow:F?[t?.theme,F.footprint&&`${F.footprint} footprint`,p(F)].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,O.jsx)(ae,{className:`law-filter`,value:j,onChange:M,placeholder:`Filter rules`,label:`Filter rules`})}),(0,O.jsxs)(`section`,{className:`ladder`,"aria-labelledby":`ladder-h`,children:[(0,O.jsx)(`h2`,{id:`ladder-h`,className:`eyebrow`,children:`Precedence`}),(0,O.jsx)(le,{tiers:ze,current:k,onPick:A}),(0,O.jsx)(`div`,{className:`ladder-tail`,children:ee.map((e,t)=>(0,O.jsxs)(`span`,{className:`ladder-low`,children:[(0,O.jsxs)(`span`,{className:`mono tier-k`,children:[`RANK `,te.length+t+1]}),` `,e.label,` —`,` `,e.against]},e.source))})]}),(0,O.jsxs)(`div`,{className:`split`,children:[(0,O.jsxs)(`section`,{className:`panel flush law-wrap${I?` with-toggle`:``}`,"aria-label":`Rules`,children:[G.length>0&&(0,O.jsxs)(O.Fragment,{children:[Qe(W.ontology,`ontology/universal.md`),G.map(e=>(0,O.jsx)(ce,{law:e,rev:d,isOpen:P===e.addr,onToggle:()=>ve(e.addr),after:e.addr===fe?nt:null},e.addr))]}),(0,O.jsxs)(`div`,{className:`law-toolbar`,children:[(0,O.jsx)(s,{"aria-label":`Show`,children:Ve.map(([e,t,n])=>(0,O.jsxs)(`button`,{type:`button`,className:k===e?`on`:``,"aria-pressed":k===e,onClick:()=>A(e),children:[t,` `,(0,O.jsx)(`span`,{className:`mono`,children:n})]},e))}),(0,O.jsx)(s,{"aria-label":`Narrow`,children:Ge.map(([e,t,n])=>(0,O.jsxs)(`button`,{type:`button`,className:N===e?`on`:``,"aria-pressed":N===e,disabled:n===null,onClick:()=>he(N===e?`all`:e),children:[t,` `,n===null?null:(0,O.jsx)(`span`,{className:`mono`,children:n})]},e))})]}),(0,O.jsxs)(`div`,{className:`law-rowhead`,children:[(0,O.jsx)(`span`,{children:`No.`}),(0,O.jsx)(`span`,{children:`Rule`}),(0,O.jsx)(`span`,{children:`Latin name`}),(0,O.jsx)(`span`,{children:`Status`}),(0,O.jsx)(`span`,{children:`Enforced by`})]}),He&&$e.length>0&&(0,O.jsxs)(O.Fragment,{children:[Qe(W.laws,`laws/universal.md`),$e.map(e=>(0,O.jsx)(ce,{law:Ne(e),rev:d,isOpen:P===e.addr,onToggle:()=>ve(e.addr),toggleCol:!I||e.retired?null:_[e.addr]?Ae(e.addr):(0,O.jsx)(`span`,{className:`no-gate`,title:`Enforced by its text alone: no hook gate`,children:`no gate`})},e.addr))]}),Ue&&R.map(e=>{let t=e.rules.filter(X);if(!t.length)return null;let n=qe(e.pack),r=e.rules.filter(e=>H(e.addr)).length;return(0,O.jsxs)(`div`,{className:`pack-wrap${we(e)?``:` pack-off`}`,children:[(0,O.jsxs)(`div`,{className:`band-head pack-head`,children:[(0,O.jsx)(`h2`,{className:`tier-h`,style:{"--cc":m[e.pack]},children:(0,O.jsx)(`button`,{type:`button`,className:`pack-fold`,"aria-expanded":!n,onClick:()=>Je(e.pack),children:e.title})}),(0,O.jsx)(`span`,{className:`mono dim`,children:e.pack}),(0,O.jsx)(`span`,{className:`pack-desc dim`,children:e.desc}),(0,O.jsx)(`span`,{className:`pack-fill`,children:(0,O.jsx)(T,{value:r,max:e.rules.length,label:`${e.title} rules switched on`})}),(0,O.jsx)(`span`,{className:`pack-state mono`,children:Te(e)})]}),!e.active&&!I&&(0,O.jsxs)(`div`,{className:`pack-enable`,children:[`$ geneseed-build --doctrines`,` `,R.filter(t=>t.active||t.pack===e.pack).map(e=>e.pack).join(`,`),Oe.length>0&&` --exclude-rules ${Oe.join(`,`)}`]}),!n&&t.map(e=>(0,O.jsx)(ce,{law:Ne(De(e)),rev:d,isOpen:P===e.addr,onToggle:()=>ve(e.addr),toggleCol:I?(0,O.jsx)(`button`,{type:`button`,className:`sw-toggle${H(e.addr)?` on`:``}`,role:`switch`,"aria-checked":H(e.addr),"aria-label":`${e.name} rule`,onClick:()=>Ce(e.addr)}):null},e.addr))]},e.pack)}),et===0&&(0,O.jsx)(ie,{title:Y||N!==`all`?`No matching rules`:`Nothing in this tier`,children:Y?(0,O.jsxs)(O.Fragment,{children:[`Nothing matches “`,j.trim(),`”.`]}):N===`all`?(0,O.jsx)(O.Fragment,{children:`This install predates the tier.`}):(0,O.jsxs)(O.Fragment,{children:[`No `,N,` rule in this tier.`]})})]}),(0,O.jsxs)(`aside`,{className:`aside-stack`,children:[(0,O.jsx)(de,{packs:R,sel:B,canApply:I,install:F,gateArmed:Se}),(0,O.jsx)(ue,{gates:n?.gates,byAddr:Be,onJump:Me,disarmed:e=>!!_[e]&&!z(e),install:t?.install})]})]}),Xe&&(0,O.jsxs)(`div`,{className:`law-bar`,role:`region`,"aria-label":`Unapplied changes`,children:[(0,O.jsxs)(`span`,{className:`law-bar-n`,children:[Ye.length,` unapplied change`,Ye.length===1?``:`s`]}),(0,O.jsx)(`span`,{className:`law-bar-list`,children:Ye.map(e=>(0,O.jsxs)(`span`,{className:`badge ${e.plus?`ok`:`warn`}`,children:[e.plus?`+`:`−`,` `,e.no,` `,e.name]},e.addr))}),(0,O.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:Ze,children:`Review changes`}),(0,O.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{he(`all`),B.revert()},children:`Revert`}),(0,O.jsxs)(`button`,{type:`button`,className:`btn`,onClick:B.applyPacks,children:[`Apply (`,B.pickedRules.length,`/`,U.length,` rules)`]})]})]})}export{A as default};
@@ -0,0 +1,3 @@
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-C46vAuqp.js";import{o as i}from"./motion-RlUl1osO.js";import{n as a,t as o}from"./sections-CtFz7HFH.js";import{$ as ee,Q as te,S as s,U as ne,X as c,Y as re,_t as l,bt as u,pt as ie,rt as d,t as f,wt as ae,x as p}from"./index-COTd4TRZ.js";import{t as oe}from"./EmptyState-CY5Pm2xy.js";import{a as se,c as ce,i as le,o as ue,r as de,s as fe,t as pe}from"./RailCats-AW92uhsX.js";var m=e(t(),1),h=n();function me({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,h.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function g({entries:e}){return e.length?(0,h.jsxs)(`table`,{className:`mf-entries`,children:[(0,h.jsx)(`thead`,{className:`sr-only`,children:(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`th`,{scope:`col`,children:`Path`}),(0,h.jsx)(`th`,{scope:`col`,children:`Load`}),(0,h.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,h.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,h.jsxs)(`tr`,{children:[(0,h.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,h.jsx)(`td`,{className:`mf-load-cell`,children:(0,h.jsx)(me,{load:e.load})}),(0,h.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function he({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,h.jsxs)(`div`,{className:`mf-vault`,children:[(0,h.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,h.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,h.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,h.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,h.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,h.jsxs)(`span`,{className:`mf-role`,children:[(0,h.jsx)(d,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,h.jsxs)(`span`,{className:`mf-role`,children:[(0,h.jsx)(d,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,h.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,h.jsx)(d,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,h.jsx)(g,{entries:t})]})}function _({body:e}){let[t,n]=(0,m.useState)(!1),r=(0,m.useId)();return e?(0,h.jsxs)(`div`,{className:`mf-raw`,children:[(0,h.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,h.jsx)(d,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,h.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function ge({manifest:e,body:t,name:n}){if(!e)return(0,h.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,h.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,h.jsx)(he,{wiki:e},e.name||t)),(0,h.jsx)(_,{body:t})]}):(0,h.jsxs)(`div`,{className:`mf-empty`,children:[(0,h.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,h.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,h.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,h.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,h.jsx)(_,{body:t})]})}let r=e.context||[];return r.length?(0,h.jsxs)(`div`,{className:`mf-doc`,children:[(0,h.jsx)(g,{entries:r}),(0,h.jsx)(_,{body:t})]}):(0,h.jsxs)(`div`,{className:`mf-empty`,children:[(0,h.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,h.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,h.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,h.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,h.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,h.jsx)(_,{body:t})]})}function v({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,h.jsxs)(`div`,{className:`stat`,children:[(0,h.jsx)(`div`,{className:`stat-label`,children:e}),(0,h.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,h.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var _e=(0,m.lazy)(()=>f(()=>import(`./Markdown-0ORz7tAc.js`).then(e=>e.n),__vite__mapDeps([0,1,2]))),ve=(0,m.lazy)(()=>f(()=>import(`./AgentGlyph-k6o3gCM1.js`),__vite__mapDeps([3,1,2]))),ye={skills:`skill`,agents:`agent`},be=(e,t)=>`${t?e/t*100:0}%`,y=e=>e.split(`:`).slice(0,2).join(` `),b=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},xe=e=>l(b(e)),Se=e=>({"--cc":`var(--cat-${e*2%7})`});function Ce(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 we({section:e,source:t}){return(0,h.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,h.jsx)(d,{name:a[e].icon,className:`glyph`}),(0,h.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,h.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var x=e=>e.replace(/\s+/g,` `).trim(),S=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Te(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=S(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?x(a[0].replace(/^>[ \t]?/gm,``)):``,ee=t?x(t):``;return o&&(ee===o||ee.startsWith(o+` `))&&(i=S(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function Ee({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,h.jsx)(`div`,{className:`lib-stats`,children:(0,h.jsx)(v,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(y))].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,h.jsx)(`div`,{className:`lib-stats`,children:(0,h.jsx)(v,{label:`Used`,value:e.n,delta:o,children:(0,h.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,h.jsx)(`i`,{className:t===29?`today`:``,style:{height:be(e,a)}},t))})})})}function De(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 Oe={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},ke=(e,t)=>t||(e&&o.includes(e)?e:o[0]),Ae=encodeURIComponent;function je(e){let t=e=>p[e.klass]?e.klass:`personal`,n=s.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:p[n].label,groupC:p[n].c})));return{rows:n,cats:s.map(e=>({key:e,label:p[e].label,c:p[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Me(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 C({overview:e,section:t,selected:n,dataRev:i,lock:s,base:l,onRulesChanged:d,onCountsChanged:f}){let me=ee(),[g,he]=(0,m.useState)(()=>ke(t,s)),[_,v]=(0,m.useState)(``),[y,x]=(0,m.useState)(`all`),[S,C]=(0,m.useState)(`all`),[Ne,w]=(0,m.useState)(``),[Pe,Fe]=(0,m.useState)(null),[T,Ie]=(0,m.useState)(null),[Le,Re]=(0,m.useState)(t);if(t!==Le){Re(t),w(``);let e=ke(t,s);e!==g&&(he(e),v(``),x(`all`),C(`all`))}let[ze,Be]=(0,m.useState)(n);n!==ze&&(Be(n),w(``));let{data:E,error:Ve,reload:He}=u(()=>r.catalog(g),[g,i],`catalog`),Ue=s?null:ye[g]||null,D=Ue!==null,{data:O}=u(()=>D?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[D,i],`usage`,{revalidate:!0}),k=D&&!!O?.enabled&&Array.isArray(O.names),We=(0,m.useMemo)(()=>new Map((Array.isArray(O?.names)?O.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[O]),A=e=>k&&We.get(`${Ue}\u0000${e}`)||null,Ge=e=>{let t=A(e.name);return!t||t.n===0&&!t.last},Ke=O?.since?`No call since ${O.since}`:`No call recorded yet`,j=E?.section===g,M=j&&E?.items||[],qe=!j&&!Ve,[Je,...Ye]=j&&E.sharedInstalls||[],N=e=>e===Je?`shared`:xe(e),P=g===`skills`,Xe=P?je(M):null,F=P?Xe.rows:g===`memory`?Me(M):M,I=n||F[0]?.name||null,L=I?M.find(e=>e.name===I):null,R=L?.type||a[g].type,z=T?.sec===g&&T?.name===I?T.key:null,{data:Ze,error:B}=u(()=>I?z?r.item(R,I,b(z)):r.item(R,I):Promise.resolve(null),[g,I,R,z,i]),V=B?null:Ze,H=V&&V.name===I&&(!z||V.install===z)?V:null,Qe=e=>W&&e?.install?` in ${N(e.install)}`:``,$e=Ne||Ve||B,et=I?{name:I,title:V?.title||I,desc:V?.desc||``}:null,U=L||et,tt=t=>t===g&&j?M.length:e?.counts?.[t]??``,nt=ie(i),W=new Set(M.flatMap(e=>e.installs||[])).size>1,rt=[...new Set([...(nt||[]).map(e=>e.id),...M.flatMap(e=>e.installs||[])])].filter(e=>!Ye.includes(e)),G=P?F.filter(e=>y===`all`||e.cat===y):F,it=k?G.filter(Ge).length:0,at=e=>e.status===`experimental`,ot=G.filter(at).length,K=[[`all`,`All`,G.length],...k?[[`used`,`Used`,G.length-it],[`unused`,`Not used yet`,it,Ke]]:[],...ot?[[`experimental`,`Experimental`,ot,`Shipped, not yet confirmed by real use`]]:[]],q=K.some(([e])=>e===S)?S:`all`,J=q===`all`?G:q===`experimental`?G.filter(at):G.filter(e=>Ge(e)===(q===`unused`)),st=k?Math.max(0,...M.map(e=>A(e.name)?.n||0)):0,ct=P?1/0:50,Y=_.trim().toLowerCase(),X=Y?ue(J,Y):J.slice(0,ct),lt=!Y&&y===`all`&&q===`all`&&I&&!X.some(e=>e.name===I)?[...X,...F.filter(e=>e.name===I)]:X,ut=e=>l?`${l}/${Ae(e.name)}`:`#/item/${e.type||a[g].type}/${Ae(e.name)}`,dt=async()=>{let e=H;if(!e)return;let t=e.name;if(await me(`Forget the memory fact "${t}"${Qe(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`})){w(``);try{await r.memoryDelete(t,e.install?b(e.install):void 0)}catch(e){w(`Could not forget "${t}": ${e.message}`);return}ae(l||`#/personal/memory`),He(),f?.()}},ft=async()=>{let e=H;if(!e)return;let t=e.name;if(await me(`Promote "${t}"${Qe(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`})){w(``);try{let n=e.install?b(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),ne(),d?.(),f?.(),ae(`#/personal/rules`)}catch(e){w(`Could not promote: ${e.message}`),He()}}},Z=V?.body?Te(V.body,V.desc||U?.desc):null,pt=V?.title||U?.title||U?.name,mt=pt===U?.name&&Z?.title?Z.title:pt,ht=j&&M.length===0,gt=V?.status||U?.status,_t=g===`skills`?p[L?.klass]:null,Q=a[g].label,{lede:vt,when:yt}=De(V?.desc||U?.desc||``),$=U?V?.source||U.source||(B?null:Ce(g,U.name)):null;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(re,{error:$e,style:{margin:`0 0 var(--sp-3)`}}),(0,h.jsxs)(`div`,{className:`library lib-dossier${s?` locked`:``}${k?` uses`:``}`,children:[s?null:(0,h.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,h.jsxs)(`div`,{className:`lib-title`,children:[(0,h.jsx)(`h1`,{className:`h`,children:`Library`}),(0,h.jsx)(`span`,{className:`dim`,children:`What the agent knows`})]}),(0,h.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,h.jsxs)(m.Fragment,{children:[(0,h.jsxs)(`a`,{href:`#/section/${e}`,className:g===e?`on`:``,"aria-current":g===e?`page`:void 0,children:[a[e].label,(0,h.jsx)(`span`,{className:`mono dim`,children:tt(e)})]}),e===g&&P&&j&&(0,h.jsx)(pe,{label:`Skill types`,total:M.length,cats:Xe.cats,cat:y,onChange:x})]},e))})]}),(0,h.jsxs)(se,{label:Q,count:j?Y?`${X.length} of ${J.length}`:J.length:``,q:_,onQ:v,matched:X.length,inView:[g,n],extra:(0,h.jsxs)(h.Fragment,{children:[k&&O.since?(0,h.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,O.since]}):null,(0,h.jsxs)(`span`,{className:`lib-legend mono`,children:[W?rt.map((e,t)=>(0,h.jsxs)(`span`,{className:`lk-install`,title:b(e).path,children:[(0,h.jsx)(`i`,{className:`lr-dot`,style:Se(t),"aria-hidden":`true`}),N(e)]},e)):null,(0,h.jsx)(ce,{items:M})]})]}),tools:j&&K.length>1?(0,h.jsx)(te,{"aria-label":`Show`,children:K.map(([e,t,n,r])=>(0,h.jsxs)(`button`,{type:`button`,className:q===e?`on`:``,"aria-pressed":q===e,title:r,onClick:()=>C(e),children:[t,` `,(0,h.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[qe?(0,h.jsx)(c,{}):null,(0,h.jsx)(de,{rows:lt,activeName:U?.name,hrefOf:ut,pills:k||W?e=>{let t=A(e.name)?.n||0,n=W?(0,h.jsx)(`span`,{className:`lr-dots`,children:rt.map((t,n)=>e.installs?.includes(t)?(0,h.jsx)(`span`,{className:`lr-dot lr-install`,style:Se(n),title:`${N(t)} — ${b(t).path}`,children:(0,h.jsx)(`span`,{className:`sr-only`,children:N(t)})},t):(0,h.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return k?(0,h.jsxs)(h.Fragment,{children:[n,(0,h.jsxs)(`span`,{className:`lr-use`,children:[(0,h.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,h.jsx)(`i`,{style:{width:be(t,st)}})}),(0,h.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,h.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!Y&&M.length>ct&&(0,h.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,ct,` of `,M.length,`; type to search the rest.`]}),ht&&(g===`wiki`?(0,h.jsxs)(oe,{title:`No wiki entries`,action:(0,h.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,h.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,h.jsx)(oe,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,h.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:U?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`div`,{className:`reader-tags`,children:[(0,h.jsx)(`span`,{className:`tag acc`,children:Q.replace(/s$/,``)}),_t?(0,h.jsx)(`span`,{className:`tag`,children:_t.label}):null,V?.kit??U.kit?(0,h.jsx)(le,{name:V?.kit??U.kit}):null,(0,h.jsx)(fe,{status:gt,withHint:!0}),$?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`span`,{className:`mono dim reader-src`,children:$}),(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),Fe({src:$,ok:!0})}catch{Fe({src:$,ok:!1})}},children:Pe?.src===$?Pe.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,h.jsxs)(`div`,{className:`reader-head`,children:[(0,h.jsx)(`h2`,{className:`reader-title`,children:mt}),g===`agents`?(0,h.jsx)(m.Suspense,{fallback:null,children:(0,h.jsx)(ve,{name:U.name})}):null]}),(0,h.jsxs)(`div`,{className:`reader-intro${k?` with-stats`:``}`,children:[(0,h.jsxs)(`div`,{className:`reader-intro-text`,children:[vt?(0,h.jsx)(`p`,{className:`reader-lede`,children:vt}):null,yt?(0,h.jsxs)(`section`,{className:`reader-when`,children:[(0,h.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,h.jsx)(`p`,{children:yt})]}):null]}),k?(0,h.jsx)(Ee,{u:A(U.name),usage:O,noCall:Ke}):null]}),g===`memory`&&H&&U.name!==`MEMORY`&&U.name!==`README`&&(0,h.jsxs)(`div`,{className:`row gap-8`,children:[(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:ft,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,h.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:dt,children:`Forget this fact`})]}),V?.installs?.length>1&&V.installs.includes(V.install)?(0,h.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,h.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,h.jsx)(`select`,{className:`sel`,"aria-label":`Install`,value:z||V.install,onChange:e=>Ie({sec:g,name:I,key:e.target.value}),children:V.installs.map(e=>(0,h.jsx)(`option`,{value:e,title:b(e).path,children:N(e)},e))}),(0,h.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,h.jsx)(`hr`,{className:`hr`}),B?(0,h.jsxs)(`p`,{className:`sub`,children:[`No `,Q.replace(/s$/,``).toLowerCase(),` named `,(0,h.jsx)(`em`,{children:U.name}),` could be read in this install.`]}):U?.kind===`manifest`||V?.manifest!==void 0?V?(0,h.jsx)(ge,{manifest:V.manifest,body:V.body,name:U.name}):(0,h.jsx)(c,{}):V?.body?(0,h.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,h.jsx)(m.Suspense,{fallback:null,children:(0,h.jsx)(_e,{body:Z.body,links:V.links||[]})})}):V===null&&I?(0,h.jsx)(c,{}):(0,h.jsx)(we,{section:g,source:Ce(g,U.name)}),Oe[g]?(0,h.jsx)(`div`,{className:`reader-links`,children:(0,h.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${Oe[g]}`,children:[`About `,Q.toLowerCase(),` in Docs`]})}):null]}):qe?(0,h.jsx)(c,{}):null})]})]})}export{Te as bodyHead,C as default,Me as groupMemory,xe as installLabel,b as installOfKey,je as splitSkills,De as splitWhen};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BxjLd7Qd.js";import{Et as i,J as a,Tt as o,X as s,Y as c,bt as l,ft as u,pt as d,vt as f}from"./index-CzDi9JpF.js";import{t as p}from"./EmptyState-1sPNleqv.js";import{t as m}from"./usePoll-bDFN-Hr6.js";import{a as h,n as g,o as _,r as v,t as y}from"./RailCats-BuJD4Jou.js";import{t as b}from"./CopyButton-IXnXzH4Y.js";import{t as x}from"./Markdown-DpmmtW2Y.js";import{t as S}from"./DataTable-BWbUx4bY.js";var C=e(t(),1),w={x:260,y:190},T=110,E=28,D=14,O=44,k=e=>e*Math.PI/180,A=e=>Math.round(e*10)/10,j=(e,t=T,n=w)=>({x:A(n.x+t*Math.cos(k(e))),y:A(n.y+t*Math.sin(k(e)))}),M=e=>e/T*(180/Math.PI)+3,N=(e,t,n,r=0)=>`M${t.x},${t.y} A${e},${e} 0 ${r} 1 ${n.x},${n.y}`,P=A(j(205).x-6),F=e=>e.length*6.4,I=e=>({x:e.x-F(e.name)/2,y:e.y-7,w:F(e.name),h:14}),L=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,R=(e,t)=>e.some((n,r)=>[...e.slice(r+1),...t.filter(e=>!e.gate)].some(e=>L(I(n),I(e))));function z(e){return e?.gate===`human`?e.gateOn?.length?`Human gate on ${e.gateOn.join(`, `)}`:`Human gate`:null}function B(e,t=[]){let n=V(e,t,0);if(n.mode!==`ring`)return n;let r=Math.min(...n.entry.map(e=>e.y-30),...n.nodes.map(e=>e.y-e.r-12),...n.inner.map(e=>e.cy-e.r-12),...n.exit?[n.exit.y-24]:[]);return r<0?V(e,t,Math.ceil(-r)):n}function V(e,t,n){let r={x:w.x,y:w.y+n},i=(e,t=T)=>j(e,t,r),a=e=>t.find(t=>t.name===e),o=e=>a(e)?.effect??null,s=e=>z(a(e)),c=e.loops||[],l=c.find(e=>e.iteration);if(!l||l.nodes.length>8)return H(e,o,s);let u=Math.max(...e.nodes.map(e=>c.filter(t=>t.nodes.includes(e)).length)),d=c.filter(e=>e!==l);if(u>3||d.some(e=>!e.nodes.every(e=>l.nodes.includes(e))))return H(e,o,s);let f=l.nodes[0],p=new Set(e.edges.filter(e=>e.to===f).map(e=>e.from)),m=new Map;for(let e of[...d].sort((e,t)=>e.nodes.length-t.nodes.length))for(let t of e.nodes.slice(1))t!==f&&!p.has(t)&&!m.has(t)&&m.set(t,e);let h=l.nodes.filter(e=>!m.has(e));if(h.length<2||d.some(e=>m.has(e.nodes[0])))return H(e,o,s);let g=360/h.length,_=h.map((e,t)=>({name:e,a:-90+t*g,r:E})),v=_.findIndex(e=>o(e.name)===`mutate`);v>=0&&_.splice(v,0,{name:`validate`,a:_[v].a-g/2,r:D,gate:!0});let y=_.map(e=>({name:e.name,...i(e.a),r:e.r,effect:e.gate?null:o(e.name),gate:!!e.gate,inner:!1,human:e.gate?null:s(e.name)})),b=_.map((e,t)=>{let n=_[(t+1)%_.length],r=(t+1===_.length?n.a+360:n.a)-M(n.r)-2,a=e.a+M(e.r);return{d:N(T,i(a),i(r),+(r-a>180)),kind:`ring`}}),x=[],S=new Map;for(let e of d)S.set(e.nodes[0],[...S.get(e.nodes[0])||[],e]);for(let[e,t]of S){let n=_.find(t=>t.name===e),r=i(n.a),a=t.length>1;t.sort((e,t)=>e.nodes.length-t.nodes.length).forEach((e,t)=>{let c=i(n.a+(a?t?18:-18:0),T+(a?54:44)),l=Math.atan2(c.y-r.y,c.x-r.x)*(180/Math.PI),u=e.nodes.filter(t=>m.get(t)===e),d=e=>u.map((t,n)=>({name:t,...j(l+(n-(u.length-1)/2)*e,O,c)})),f=105;for(;f<150&&R(d(f),y);)f+=5;d(f).forEach(({name:e,...t})=>{y.push({name:e,...t,r:E,effect:o(e),gate:!1,inner:!0,human:s(e)})});let p=l+180;b.push({d:N(O,j(p+42,O,c),j(p+138,O,c)),kind:`inner`}),b.push({d:N(O,j(p+222,O,c),j(p+318,O,c)),kind:`inner`});let h=`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)} · max ${e.max}`,g={lx:c.x,ly:c.y+O+20,anchor:`middle`};if(a){let e=c.x>=w.x,t=Math.max(O,...u.map(e=>{let t=y.find(t=>t.name===e);return Math.abs(t.x-c.x)+E}));g={lx:A(c.x+(e?t+8:-t-8)),ly:A(c.y+4),anchor:e?`start`:`end`}}x.push({loop:e.name,cx:c.x,cy:c.y,r:O,label:h,...g})})}let C=i(205).y,k=e.nodes.filter(e=>!l.nodes.includes(e)),P=k.map((e,t)=>({name:e,x:40,y:A(C-44*(k.length-1-t)),human:s(e)})),I=e.edges.find(e=>e.to===`$close`)?.from,L=y.find(e=>e.name===I),B=L?{from:I,x:L.x+200,y:L.y-30,d:`M${L.x+E},${L.y-6} C${L.x+90},${L.y-40} ${L.x+170},${L.y-40} ${L.x+200},${L.y-30}`}:null,V=Math.max(540,...y.map(e=>e.x+e.r+8),...B?[B.x+6+F(`close`)+8]:[],...x.map(e=>e.cx+e.r+8),...x.map(e=>e.anchor===`start`?e.lx+F(e.label)+8:e.lx+F(e.label)/2+8)),U=Math.max(300,...y.map(e=>e.y+e.r+12),...x.map(e=>Math.max(e.cy+e.r,e.ly)+12));return{mode:`ring`,width:Math.ceil(V),height:Math.ceil(U),center:{x:r.x,y:r.y,r:T},nodes:y,arcs:b,inner:x,entry:P,exit:B}}function H(e,t,n){let r=e.loops||[],i=e=>36+16*r.filter(t=>t!==e&&t.nodes.every(t=>e.nodes.includes(t))).length,a=Math.max(E,...r.map(i))+30,o=new Map(e.nodes.map((e,t)=>[e,60+t*100])),s=e.nodes.map(e=>({name:e,x:o.get(e),y:a,r:E,effect:t(e),gate:!1,inner:!1,human:n(e)})),c=e.nodes.slice(1).map((t,n)=>({d:`M${o.get(e.nodes[n])+E},${a} L${o.get(t)-E-4},${a}`,kind:`flow`})),l=r.map(e=>{let t=i(e),n=Math.min(...e.nodes.map(e=>o.get(e))),r=Math.max(...e.nodes.map(e=>o.get(e))),s={x:n-t,y:a-t,w:r-n+2*t,h:2*t};return c.push({d:`M${r},${s.y+s.h} L${n+4},${s.y+s.h}`,kind:`flow`}),{loop:e.name,label:`${e.name} · max ${e.max}`,box:s}});return{mode:`flow`,width:60+e.nodes.length*100,height:2*a,center:null,nodes:s,arcs:c,inner:l,entry:[],exit:null}}var U=n();function W({x:e,y:t,label:n}){return(0,U.jsxs)(`g`,{className:`lr-human`,children:[(0,U.jsx)(`title`,{children:n}),(0,U.jsx)(`circle`,{cx:e,cy:t,r:`9`}),(0,U.jsx)(`circle`,{cx:e,cy:t-2.4,r:`2.6`,className:`lr-human-fig`}),(0,U.jsx)(`path`,{d:`M${e-4.6},${t+5.6} a4.6,4.6 0 0 1 9.2,0 Z`,className:`lr-human-fig`})]})}function ee({graph:e,bricks:t,onSelect:n,highlight:r}){let i=B(e,t),a=(e.loops||[]).find(e=>e.iteration),o=e=>`${e.name} brick${e.human?`, ${e.human.toLowerCase()}`:``}`,s=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n?.(e))};return(0,U.jsxs)(`svg`,{className:`loop-ring`,viewBox:`0 0 ${i.width} ${i.height}`,role:`group`,"aria-label":`${e.name} loop: ${e.nodes.join(`, `)}`,children:[(0,U.jsx)(`defs`,{children:[`ring`,`inner`,`flow`].map(e=>(0,U.jsx)(`marker`,{id:`lr-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,U.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`lr-head-${e}`})},e))}),i.mode===`ring`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,className:`lr-inner`}),(0,U.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.mode===`flow`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`rect`,{x:e.box.x,y:e.box.y,width:e.box.w,height:e.box.h,rx:`14`,className:`lr-box`}),(0,U.jsx)(`text`,{x:e.box.x+10,y:e.box.y-6,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.arcs.map((e,t)=>(0,U.jsx)(`path`,{d:e.d,className:`lr-${e.kind}`,markerEnd:`url(#lr-arrow-${e.kind})`},t)),i.entry.length>0&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:`M40,${i.entry.at(-1).y} L${P},${i.entry.at(-1).y}`,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),i.entry.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:e.x,y:e.y-10,className:`lr-lbl`,children:e.name}),(0,U.jsx)(`text`,{x:e.x,y:e.y+18,className:`lr-sub`,children:`setup · 1×`}),e.human?(0,U.jsx)(W,{x:e.x-14,y:e.y-14,label:e.human}):null]},e.name))]}),i.nodes.map(e=>e.gate?(0,U.jsxs)(`g`,{className:`lr-gate`,children:[(0,U.jsx)(`title`,{children:`validate — the engine scores the change before the first mutate step`}),(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+5,textAnchor:`middle`,children:`⛨`}),(0,U.jsx)(`text`,{x:e.x+20,y:e.y-10,className:`lr-sub lr-warn`,children:`validate`})]},e.name):(0,U.jsxs)(`g`,{className:`lr-node${e.inner?` inner`:``}${e.effect===`mutate`?` mutate`:``}${e.name===r?` current`:``}`,"aria-current":e.name===r?`step`:void 0,...n?{role:`button`,tabIndex:0,"aria-label":o(e),onClick:s(e.name),onKeyDown:s(e.name)}:{role:`img`,"aria-label":`${o(e)}${e.name===r?`, current step`:``}`},children:[(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+4,textAnchor:`middle`,children:e.name}),e.human?(0,U.jsx)(W,{x:e.x+e.r*.74,y:e.y-e.r*.74,label:e.human}):null]},e.name)),i.exit&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:i.exit.d,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),(0,U.jsx)(`text`,{x:i.exit.x+6,y:i.exit.y+4,className:`lr-lbl`,children:`close`}),(0,U.jsx)(`text`,{x:i.exit.x-90,y:i.exit.y-10,textAnchor:`middle`,className:`lr-sub`,children:`done`})]}),i.center&&a&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:i.center.x,y:i.center.y-4,textAnchor:`middle`,className:`lr-title`,children:e.name}),(0,U.jsxs)(`text`,{x:i.center.x,y:i.center.y+16,textAnchor:`middle`,className:`lr-sub lr-acc`,children:[`iterations · max `,a.max]})]})]})}var te=5e3,ne=[`prudent`,`balanced`,`aggressive`],G={running:`acc`,awaiting:`warn`,unreadable:`bad`},K=e=>!!e.graph;function re(){let[e,t]=(0,C.useState)(null),[n,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(0);return m(e=>r.activeLoops().then(n=>e()&&(t(n),i(null)),t=>e()&&i(t.message)),te,[s]),{loops:e?.loops??null,error:a||n,onPreset:(e,t)=>(o(null),r.setLoopPreset(e,t).then(()=>c(e=>e+1),e=>o(e.message)))}}var q=e=>({key:e,label:e,align:`right`,render:t=>(0,U.jsx)(`span`,{className:`num`,children:t[e]})}),ie=[q(`iteration`),{key:`intent`,label:`intent`},q(`declared`),q(`actual`),{key:`decision`,label:`decision`},{key:`tests`,label:`tests`}];function ae({history:e}){return e.length?(0,U.jsx)(`div`,{className:`loop-history`,children:(0,U.jsx)(S,{caption:`Iterations`,captionHidden:!0,columns:ie,rows:e,rowKey:e=>e.iteration})}):(0,U.jsx)(`p`,{className:`panel-note`,children:`No iteration finished yet.`})}function oe({loop:e,bricks:t,onPreset:n}){let r=K(e)?(e.graph.loops||[]).find(e=>e.iteration):null,[i,a]=(0,C.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Active loop`}),(0,U.jsx)(`span`,{className:`tag${G[e.status]?` ${G[e.status]}`:``}`,children:e.status})]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.branch,` · `,e.root]}),K(e)?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`reader-lede`,children:[`Iteration `,e.iteration,r?` / ${r.max}`:``,` · at `,e.node]}),e.awaiting?(0,U.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,U.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind,e.awaiting.kind===`gate`?` at ${e.awaiting.node}`:``]}),` `,`— Answer in the agent's session.`]}):null,(0,U.jsxs)(`label`,{className:`panel-note loop-run-preset`,children:[`preset`,(0,U.jsx)(`select`,{className:`sel`,"aria-label":`Preset for ${e.title}`,value:e.preset,disabled:i,onChange:t=>{a(!0),Promise.resolve(n(e.root,t.target.value)).finally(()=>a(!1))},children:ne.map(e=>(0,U.jsx)(`option`,{children:e},e))})]}),(0,U.jsx)(`a`,{href:`#/docs/loop-risk`,children:`What presets mean →`}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`loop-graph`,children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,highlight:e.node})}),(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Iterations`}),(0,U.jsx)(ae,{history:e.history})]}):(0,U.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its LOOP.md cannot be read, so there is no state to show.`:`Its LOOP.md is gone: the loop closed and its state went with it.`})]})}var J=encodeURIComponent,Y=o.loops.map(e=>[e,i[e]]),X={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},se={project:`Project`,global:`Global`,shipped:`Shipped`},ce={templates:`Categories`,bricks:`Origins`,active:`Statuses`},le=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function Z(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var Q=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function ue(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return Q(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>X[e.graph.category]?e.graph.category:`other`,[...Object.entries(X),[`other`,`Other`]])}function de(e,t){return Q(e.map(e=>({...e,desc:e.description,override:Z(t,e.name)})),e=>e.origin,Object.entries(se))}function fe(e){return Q(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,le)}var $=(e,t)=>(0,U.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),pe={templates:e=>e.human?$(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?$(`warn`,`mutate`):null,z(e)?$(`human`,`human gate`):null,e.override?$(`acc`,e.override):null,e.available===!1?$(`bad`,`unavailable`):null],active:e=>$(G[e.status],e.status)};function me({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:(0,U.jsx)(`a`,{href:`#/loops/bricks/${J(e)}`,children:e})}),$(t.effect===`mutate`?`warn`:``,t.effect),(0,U.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,U.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),z(t)?$(`human`,z(t).toLowerCase()):null,n?$(`acc`,n):null]}):(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:e}),(0,U.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function he(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function ge({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,C.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=he(e.graph),c=B(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>K(t)&&t.graph.name===e.name).length;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Template`}),X[e.graph.category]?$(``,X[e.graph.category]):null,e.human?$(`human`,`human gate`):null]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsxs)(`figure`,{className:`loop-console`,children:[(0,U.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:l?void 0:{"--loop-w":`${c.width}px`},children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:`smooth`,block:`nearest`})}})}),(0,U.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,U.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,U.jsx)(`ol`,{children:s.map(([e,t])=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,U.jsxs)(`span`,{className:`loop-legend`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,U.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,U.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,U.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,U.jsx)(b,{text:u,label:`Copy command`})]}),(0,U.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,U.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,U.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,U.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,U.jsx)(`li`,{children:e},e))})]}):null,(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,U.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,U.jsx)(me,{name:e,brick:o.get(e),override:Z(n,e),on:i===e},e))})]})}function _e(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
2
- `)}\n---\n${e.body}`}function ve({b:e}){let[t,n]=(0,C.useState)(!1),r=[[`effect`,$(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,U.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>$(``,e))],[`gate`,z(e)?$(`human`,z(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,U.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Brick`}),pe.bricks(e)]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,U.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,U.jsxs)(C.Fragment,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e))}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,U.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,U.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:_e(e)}):(0,U.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,U.jsx)(x,{body:e.body})})]})}function ye({problems:e}){if(!e?.length)return null;let t=e.length;return(0,U.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,U.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,U.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,U.jsx)(`li`,{className:`mono`,children:e},e))})]})}var be={templates:{title:`No templates`,body:(0,U.jsxs)(U.Fragment,{children:[`Add one under `,(0,U.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,U.jsxs)(U.Fragment,{children:[`Add one under `,(0,U.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,U.jsxs)(U.Fragment,{children:[`Start one with `,(0,U.jsx)(`code`,{className:`mono`,children:`geneseed loop init`}),` in a worktree, or ask the agent to run a loop. It shows up here while it runs.`]})}},xe={templates:(0,U.jsxs)(U.Fragment,{children:[`A template wires bricks into a loop. `,(0,U.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,U.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,U.jsxs)(U.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,U.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,U.jsxs)(U.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,U.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function Se({tab:e=`templates`,item:t,dataRev:n}){let i=d(n),[o,m]=u(`loops`,i),{data:b,error:x}=l(()=>r.loops(f(o)),[n,o?.id??``],`loops`),S=re(),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(`all`),[O,k]=(0,C.useState)(e);e!==O&&(k(e),T(``),D(`all`));let A=b?.bricks||[],j=e===`active`?S.loops&&fe(S.loops):b&&(e===`bricks`?de(b.bricks,b.overridden):ue(b.templates,b.bricks)),M=j||[],N=g(M),P=E===`all`?M:M.filter(e=>e.group===E),F=w.trim(),I=_(P,F),L=!!(t&&j&&!M.some(e=>e.name===t)),R=L?null:M.find(e=>e.name===t)||e===`active`&&M.find(K)||M[0]||null,z={templates:b?.templates.length,bricks:b?.bricks.length,active:S.loops?.length},B=Y.find(([t])=>t===e)[1],V=e===`active`?S.error:x;return(0,U.jsxs)(U.Fragment,{children:[e===`active`?null:(0,U.jsx)(s,{className:`page-pick`,installs:i,value:o,onChange:m,label:`Templates and bricks of:`}),(0,U.jsx)(a,{error:V,style:{margin:`0 0 var(--sp-3)`}}),(0,U.jsx)(ye,{problems:b?.problems}),(0,U.jsxs)(`div`,{className:`library`,children:[(0,U.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,U.jsxs)(`div`,{className:`lib-title`,children:[(0,U.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,U.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,U.jsx)(`p`,{className:`panel-note lib-lede`,children:xe[e]}),(0,U.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:Y.map(([t,n])=>(0,U.jsxs)(C.Fragment,{children:[(0,U.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,U.jsx)(`span`,{className:`mono dim`,children:z[t]??``})]}),e===t&&(0,U.jsx)(y,{label:ce[t],total:M.length,cats:N,cat:E,onChange:D})]},t))})]}),(0,U.jsx)(h,{label:B,count:F?`${I.length} of ${P.length}`:j?P.length:``,q:w,onQ:T,matched:I.length,inView:[e,t],children:j?M.length===0?(0,U.jsx)(p,{title:be[e].title,children:be[e].body}):(0,U.jsx)(v,{rows:I,activeName:R?.name,hrefOf:t=>`#/loops/${e}/${J(t.name)}`,pills:pe[e]}):V?null:(0,U.jsx)(c,{})}),(0,U.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:L?(0,U.jsx)(p,{title:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${B.toLowerCase()} →`}}):R?e===`active`?(0,U.jsx)(oe,{loop:R,bricks:A,onPreset:S.onPreset}):e===`bricks`?(0,U.jsx)(ve,{b:R}):(0,U.jsx)(ge,{t:R,bricks:A,overridden:b.overridden,runs:S.loops},R.name):e===`active`&&j?(0,U.jsx)(p,{title:`What is a loop?`,docs:{href:`#/docs/loops`,label:`How loops work →`},children:`A loop runs bricks in a ring until its gate passes.`}):null})]})]})}export{fe as activeRows,de as brickRows,_e as brickSource,Se as default,he as howItRuns,ue as templateRows};
1
+ 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-C46vAuqp.js";import{Ct as i,St as a,X as o,Y as s,Z as c,bt as l,ft as u,pt as d,vt as f}from"./index-COTd4TRZ.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{t as h}from"./usePoll-o8ul-Sog.js";import{a as g,n as _,o as v,r as y,t as b}from"./RailCats-AW92uhsX.js";import{t as x}from"./CopyButton-CHQte7Ap.js";import{t as S}from"./DataTable-b9zTShqJ.js";var C=e(t(),1),w={x:260,y:190},T=110,E=28,D=14,O=44,k=e=>e*Math.PI/180,A=e=>Math.round(e*10)/10,j=(e,t=T,n=w)=>({x:A(n.x+t*Math.cos(k(e))),y:A(n.y+t*Math.sin(k(e)))}),M=e=>e/T*(180/Math.PI)+3,N=(e,t,n,r=0)=>`M${t.x},${t.y} A${e},${e} 0 ${r} 1 ${n.x},${n.y}`,P=A(j(205).x-6),F=e=>e.length*6.4,I=e=>({x:e.x-F(e.name)/2,y:e.y-7,w:F(e.name),h:14}),L=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,R=(e,t)=>e.some((n,r)=>[...e.slice(r+1),...t.filter(e=>!e.gate)].some(e=>L(I(n),I(e))));function z(e){return e?.gate===`human`?e.gateOn?.length?`Human gate on ${e.gateOn.join(`, `)}`:`Human gate`:null}function B(e,t=[]){let n=V(e,t,0);if(n.mode!==`ring`)return n;let r=Math.min(...n.entry.map(e=>e.y-30),...n.nodes.map(e=>e.y-e.r-12),...n.inner.map(e=>e.cy-e.r-12),...n.exit?[n.exit.y-24]:[]);return r<0?V(e,t,Math.ceil(-r)):n}function V(e,t,n){let r={x:w.x,y:w.y+n},i=(e,t=T)=>j(e,t,r),a=e=>t.find(t=>t.name===e),o=e=>a(e)?.effect??null,s=e=>z(a(e)),c=e.loops||[],l=c.find(e=>e.iteration);if(!l||l.nodes.length>8)return H(e,o,s);let u=Math.max(...e.nodes.map(e=>c.filter(t=>t.nodes.includes(e)).length)),d=c.filter(e=>e!==l);if(u>3||d.some(e=>!e.nodes.every(e=>l.nodes.includes(e))))return H(e,o,s);let f=l.nodes[0],p=new Set(e.edges.filter(e=>e.to===f).map(e=>e.from)),m=new Map;for(let e of[...d].sort((e,t)=>e.nodes.length-t.nodes.length))for(let t of e.nodes.slice(1))t!==f&&!p.has(t)&&!m.has(t)&&m.set(t,e);let h=l.nodes.filter(e=>!m.has(e));if(h.length<2||d.some(e=>m.has(e.nodes[0])))return H(e,o,s);let g=360/h.length,_=h.map((e,t)=>({name:e,a:-90+t*g,r:E})),v=_.findIndex(e=>o(e.name)===`mutate`);v>=0&&_.splice(v,0,{name:`validate`,a:_[v].a-g/2,r:D,gate:!0});let y=_.map(e=>({name:e.name,...i(e.a),r:e.r,effect:e.gate?null:o(e.name),gate:!!e.gate,inner:!1,human:e.gate?null:s(e.name)})),b=_.map((e,t)=>{let n=_[(t+1)%_.length],r=(t+1===_.length?n.a+360:n.a)-M(n.r)-2,a=e.a+M(e.r);return{d:N(T,i(a),i(r),+(r-a>180)),kind:`ring`}}),x=[],S=new Map;for(let e of d)S.set(e.nodes[0],[...S.get(e.nodes[0])||[],e]);for(let[e,t]of S){let n=_.find(t=>t.name===e),r=i(n.a),a=t.length>1;t.sort((e,t)=>e.nodes.length-t.nodes.length).forEach((e,t)=>{let c=i(n.a+(a?t?18:-18:0),T+(a?54:44)),l=Math.atan2(c.y-r.y,c.x-r.x)*(180/Math.PI),u=e.nodes.filter(t=>m.get(t)===e),d=e=>u.map((t,n)=>({name:t,...j(l+(n-(u.length-1)/2)*e,O,c)})),f=105;for(;f<150&&R(d(f),y);)f+=5;d(f).forEach(({name:e,...t})=>{y.push({name:e,...t,r:E,effect:o(e),gate:!1,inner:!0,human:s(e)})});let p=l+180;b.push({d:N(O,j(p+42,O,c),j(p+138,O,c)),kind:`inner`}),b.push({d:N(O,j(p+222,O,c),j(p+318,O,c)),kind:`inner`});let h=`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)} · max ${e.max}`,g={lx:c.x,ly:c.y+O+20,anchor:`middle`};if(a){let e=c.x>=w.x,t=Math.max(O,...u.map(e=>{let t=y.find(t=>t.name===e);return Math.abs(t.x-c.x)+E}));g={lx:A(c.x+(e?t+8:-t-8)),ly:A(c.y+4),anchor:e?`start`:`end`}}x.push({loop:e.name,cx:c.x,cy:c.y,r:O,label:h,...g})})}let C=i(205).y,k=e.nodes.filter(e=>!l.nodes.includes(e)),P=k.map((e,t)=>({name:e,x:40,y:A(C-44*(k.length-1-t)),human:s(e)})),I=e.edges.find(e=>e.to===`$close`)?.from,L=y.find(e=>e.name===I),B=L?{from:I,x:L.x+200,y:L.y-30,d:`M${L.x+E},${L.y-6} C${L.x+90},${L.y-40} ${L.x+170},${L.y-40} ${L.x+200},${L.y-30}`}:null,V=Math.max(540,...y.map(e=>e.x+e.r+8),...B?[B.x+6+F(`close`)+8]:[],...x.map(e=>e.cx+e.r+8),...x.map(e=>e.anchor===`start`?e.lx+F(e.label)+8:e.lx+F(e.label)/2+8)),U=Math.max(300,...y.map(e=>e.y+e.r+12),...x.map(e=>Math.max(e.cy+e.r,e.ly)+12));return{mode:`ring`,width:Math.ceil(V),height:Math.ceil(U),center:{x:r.x,y:r.y,r:T},nodes:y,arcs:b,inner:x,entry:P,exit:B}}function H(e,t,n){let r=e.loops||[],i=e=>36+16*r.filter(t=>t!==e&&t.nodes.every(t=>e.nodes.includes(t))).length,a=Math.max(E,...r.map(i))+30,o=new Map(e.nodes.map((e,t)=>[e,60+t*100])),s=e.nodes.map(e=>({name:e,x:o.get(e),y:a,r:E,effect:t(e),gate:!1,inner:!1,human:n(e)})),c=e.nodes.slice(1).map((t,n)=>({d:`M${o.get(e.nodes[n])+E},${a} L${o.get(t)-E-4},${a}`,kind:`flow`})),l=r.map(e=>{let t=i(e),n=Math.min(...e.nodes.map(e=>o.get(e))),r=Math.max(...e.nodes.map(e=>o.get(e))),s={x:n-t,y:a-t,w:r-n+2*t,h:2*t};return c.push({d:`M${r},${s.y+s.h} L${n+4},${s.y+s.h}`,kind:`flow`}),{loop:e.name,label:`${e.name} · max ${e.max}`,box:s}});return{mode:`flow`,width:60+e.nodes.length*100,height:2*a,center:null,nodes:s,arcs:c,inner:l,entry:[],exit:null}}var U=n();function W({x:e,y:t,label:n}){return(0,U.jsxs)(`g`,{className:`lr-human`,children:[(0,U.jsx)(`title`,{children:n}),(0,U.jsx)(`circle`,{cx:e,cy:t,r:`9`}),(0,U.jsx)(`circle`,{cx:e,cy:t-2.4,r:`2.6`,className:`lr-human-fig`}),(0,U.jsx)(`path`,{d:`M${e-4.6},${t+5.6} a4.6,4.6 0 0 1 9.2,0 Z`,className:`lr-human-fig`})]})}function ee({graph:e,bricks:t,onSelect:n,highlight:r}){let i=B(e,t),a=(e.loops||[]).find(e=>e.iteration),o=e=>`${e.name} brick${e.human?`, ${e.human.toLowerCase()}`:``}`,s=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n?.(e))};return(0,U.jsxs)(`svg`,{className:`loop-ring`,viewBox:`0 0 ${i.width} ${i.height}`,role:`group`,"aria-label":`${e.name} loop: ${e.nodes.join(`, `)}`,children:[(0,U.jsx)(`defs`,{children:[`ring`,`inner`,`flow`].map(e=>(0,U.jsx)(`marker`,{id:`lr-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,U.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`lr-head-${e}`})},e))}),i.mode===`ring`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,className:`lr-inner`}),(0,U.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.mode===`flow`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`rect`,{x:e.box.x,y:e.box.y,width:e.box.w,height:e.box.h,rx:`14`,className:`lr-box`}),(0,U.jsx)(`text`,{x:e.box.x+10,y:e.box.y-6,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.arcs.map((e,t)=>(0,U.jsx)(`path`,{d:e.d,className:`lr-${e.kind}`,markerEnd:`url(#lr-arrow-${e.kind})`},t)),i.entry.length>0&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:`M40,${i.entry.at(-1).y} L${P},${i.entry.at(-1).y}`,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),i.entry.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:e.x,y:e.y-10,className:`lr-lbl`,children:e.name}),(0,U.jsx)(`text`,{x:e.x,y:e.y+18,className:`lr-sub`,children:`setup · 1×`}),e.human?(0,U.jsx)(W,{x:e.x-14,y:e.y-14,label:e.human}):null]},e.name))]}),i.nodes.map(e=>e.gate?(0,U.jsxs)(`g`,{className:`lr-gate`,children:[(0,U.jsx)(`title`,{children:`validate — the engine scores the change before the first mutate step`}),(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+5,textAnchor:`middle`,children:`⛨`}),(0,U.jsx)(`text`,{x:e.x+20,y:e.y-10,className:`lr-sub lr-warn`,children:`validate`})]},e.name):(0,U.jsxs)(`g`,{className:`lr-node${e.inner?` inner`:``}${e.effect===`mutate`?` mutate`:``}${e.name===r?` current`:``}`,"aria-current":e.name===r?`step`:void 0,...n?{role:`button`,tabIndex:0,"aria-label":o(e),onClick:s(e.name),onKeyDown:s(e.name)}:{role:`img`,"aria-label":`${o(e)}${e.name===r?`, current step`:``}`},children:[(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+4,textAnchor:`middle`,children:e.name}),e.human?(0,U.jsx)(W,{x:e.x+e.r*.74,y:e.y-e.r*.74,label:e.human}):null]},e.name)),i.exit&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:i.exit.d,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),(0,U.jsx)(`text`,{x:i.exit.x+6,y:i.exit.y+4,className:`lr-lbl`,children:`close`}),(0,U.jsx)(`text`,{x:i.exit.x-90,y:i.exit.y-10,textAnchor:`middle`,className:`lr-sub`,children:`done`})]}),i.center&&a&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:i.center.x,y:i.center.y-4,textAnchor:`middle`,className:`lr-title`,children:e.name}),(0,U.jsxs)(`text`,{x:i.center.x,y:i.center.y+16,textAnchor:`middle`,className:`lr-sub lr-acc`,children:[`iterations · max `,a.max]})]})]})}var te=5e3,ne=[`prudent`,`balanced`,`aggressive`],G={running:`acc`,awaiting:`warn`,unreadable:`bad`},K=e=>!!e.graph;function re(){let[e,t]=(0,C.useState)(null),[n,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(0);return h(e=>r.activeLoops().then(n=>e()&&(t(n),i(null)),t=>e()&&i(t.message)),te,[s]),{loops:e?.loops??null,error:a||n,onPreset:(e,t)=>(o(null),r.setLoopPreset(e,t).then(()=>c(e=>e+1),e=>o(e.message)))}}var q=e=>({key:e,label:e,align:`right`,render:t=>(0,U.jsx)(`span`,{className:`num`,children:t[e]})}),ie=[q(`iteration`),{key:`intent`,label:`intent`},q(`declared`),q(`actual`),{key:`decision`,label:`decision`},{key:`tests`,label:`tests`}];function ae({history:e}){return e.length?(0,U.jsx)(`div`,{className:`loop-history`,children:(0,U.jsx)(S,{caption:`Iterations`,captionHidden:!0,columns:ie,rows:e,rowKey:e=>e.iteration})}):(0,U.jsx)(`p`,{className:`panel-note`,children:`No iteration finished yet.`})}function oe({loop:e,bricks:t,onPreset:n}){let r=K(e)?(e.graph.loops||[]).find(e=>e.iteration):null,[i,a]=(0,C.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Active loop`}),(0,U.jsx)(`span`,{className:`tag${G[e.status]?` ${G[e.status]}`:``}`,children:e.status})]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.branch,` · `,e.root]}),K(e)?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`reader-lede`,children:[`Iteration `,e.iteration,r?` / ${r.max}`:``,` · at `,e.node]}),e.awaiting?(0,U.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,U.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind,e.awaiting.kind===`gate`?` at ${e.awaiting.node}`:``]}),` `,`— Answer in the agent's session.`]}):null,(0,U.jsxs)(`label`,{className:`panel-note loop-run-preset`,children:[`preset`,(0,U.jsx)(`select`,{className:`sel`,"aria-label":`Preset for ${e.title}`,value:e.preset,disabled:i,onChange:t=>{a(!0),Promise.resolve(n(e.root,t.target.value)).finally(()=>a(!1))},children:ne.map(e=>(0,U.jsx)(`option`,{children:e},e))})]}),(0,U.jsx)(`a`,{href:`#/docs/loop-risk`,children:`What presets mean →`}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`loop-graph`,children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,highlight:e.node})}),(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Iterations`}),(0,U.jsx)(ae,{history:e.history})]}):(0,U.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its LOOP.md cannot be read, so there is no state to show.`:`Its LOOP.md is gone: the loop closed and its state went with it.`})]})}var J=encodeURIComponent,Y=a.loops.map(e=>[e,i[e]]),X={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},se={project:`Project`,global:`Global`,shipped:`Shipped`},ce={templates:`Categories`,bricks:`Origins`,active:`Statuses`},le=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function Z(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var Q=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function ue(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return Q(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>X[e.graph.category]?e.graph.category:`other`,[...Object.entries(X),[`other`,`Other`]])}function de(e,t){return Q(e.map(e=>({...e,desc:e.description,override:Z(t,e.name)})),e=>e.origin,Object.entries(se))}function fe(e){return Q(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,le)}var $=(e,t)=>(0,U.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),pe={templates:e=>e.human?$(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?$(`warn`,`mutate`):null,z(e)?$(`human`,`human gate`):null,e.override?$(`acc`,e.override):null,e.available===!1?$(`bad`,`unavailable`):null],active:e=>$(G[e.status],e.status)};function me({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:(0,U.jsx)(`a`,{href:`#/loops/bricks/${J(e)}`,children:e})}),$(t.effect===`mutate`?`warn`:``,t.effect),(0,U.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,U.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),z(t)?$(`human`,z(t).toLowerCase()):null,n?$(`acc`,n):null]}):(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:e}),(0,U.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function he(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function ge({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,C.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=he(e.graph),c=B(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>K(t)&&t.graph.name===e.name).length;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Template`}),X[e.graph.category]?$(``,X[e.graph.category]):null,e.human?$(`human`,`human gate`):null]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsxs)(`figure`,{className:`loop-console`,children:[(0,U.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:l?void 0:{"--loop-w":`${c.width}px`},children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:`smooth`,block:`nearest`})}})}),(0,U.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,U.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,U.jsx)(`ol`,{children:s.map(([e,t])=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,U.jsxs)(`span`,{className:`loop-legend`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,U.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,U.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,U.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,U.jsx)(x,{text:u,label:`Copy command`})]}),(0,U.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,U.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,U.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,U.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,U.jsx)(`li`,{children:e},e))})]}):null,(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,U.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,U.jsx)(me,{name:e,brick:o.get(e),override:Z(n,e),on:i===e},e))})]})}function _e(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
2
+ `)}\n---\n${e.body}`}function ve({b:e}){let[t,n]=(0,C.useState)(!1),r=[[`effect`,$(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,U.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>$(``,e))],[`gate`,z(e)?$(`human`,z(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,U.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Brick`}),pe.bricks(e)]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,U.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,U.jsxs)(C.Fragment,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e))}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,U.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,U.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:_e(e)}):(0,U.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,U.jsx)(p,{body:e.body})})]})}function ye({problems:e}){if(!e?.length)return null;let t=e.length;return(0,U.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,U.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,U.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,U.jsx)(`li`,{className:`mono`,children:e},e))})]})}var be={templates:{title:`No templates`,body:(0,U.jsxs)(U.Fragment,{children:[`Add one under `,(0,U.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,U.jsxs)(U.Fragment,{children:[`Add one under `,(0,U.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,U.jsxs)(U.Fragment,{children:[`Start one with `,(0,U.jsx)(`code`,{className:`mono`,children:`geneseed loop init`}),` in a worktree, or ask the agent to run a loop. It shows up here while it runs.`]})}},xe={templates:(0,U.jsxs)(U.Fragment,{children:[`A template wires bricks into a loop. `,(0,U.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,U.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,U.jsxs)(U.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,U.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,U.jsxs)(U.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,U.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function Se({tab:e=`templates`,item:t,dataRev:n}){let i=d(n),[a,p]=u(`loops`,i),{data:h,error:x}=l(()=>r.loops(f(a)),[n,a?.id??``],`loops`),S=re(),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(`all`),[O,k]=(0,C.useState)(e);e!==O&&(k(e),T(``),D(`all`));let A=h?.bricks||[],j=e===`active`?S.loops&&fe(S.loops):h&&(e===`bricks`?de(h.bricks,h.overridden):ue(h.templates,h.bricks)),M=j||[],N=_(M),P=E===`all`?M:M.filter(e=>e.group===E),F=w.trim(),I=v(P,F),L=!!(t&&j&&!M.some(e=>e.name===t)),R=L?null:M.find(e=>e.name===t)||e===`active`&&M.find(K)||M[0]||null,z={templates:h?.templates.length,bricks:h?.bricks.length,active:S.loops?.length},B=Y.find(([t])=>t===e)[1],V=e===`active`?S.error:x;return(0,U.jsxs)(U.Fragment,{children:[e===`active`?null:(0,U.jsx)(c,{className:`page-pick`,installs:i,value:a,onChange:p}),(0,U.jsx)(s,{error:V,style:{margin:`0 0 var(--sp-3)`}}),(0,U.jsx)(ye,{problems:h?.problems}),(0,U.jsxs)(`div`,{className:`library`,children:[(0,U.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,U.jsxs)(`div`,{className:`lib-title`,children:[(0,U.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,U.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,U.jsx)(`p`,{className:`panel-note lib-lede`,children:xe[e]}),(0,U.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:Y.map(([t,n])=>(0,U.jsxs)(C.Fragment,{children:[(0,U.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,U.jsx)(`span`,{className:`mono dim`,children:z[t]??``})]}),e===t&&(0,U.jsx)(b,{label:ce[t],total:M.length,cats:N,cat:E,onChange:D})]},t))})]}),(0,U.jsx)(g,{label:B,count:F?`${I.length} of ${P.length}`:j?P.length:``,q:w,onQ:T,matched:I.length,inView:[e,t],children:j?M.length===0?(0,U.jsx)(m,{title:be[e].title,children:be[e].body}):(0,U.jsx)(y,{rows:I,activeName:R?.name,hrefOf:t=>`#/loops/${e}/${J(t.name)}`,pills:pe[e]}):V?null:(0,U.jsx)(o,{})}),(0,U.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:L?(0,U.jsx)(m,{title:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${B.toLowerCase()} →`}}):R?e===`active`?(0,U.jsx)(oe,{loop:R,bricks:A,onPreset:S.onPreset}):e===`bricks`?(0,U.jsx)(ve,{b:R}):(0,U.jsx)(ge,{t:R,bricks:A,overridden:h.overridden,runs:S.loops},R.name):e===`active`&&j?(0,U.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{fe as activeRows,de as brickRows,_e as brickSource,Se as default,he as howItRuns,ue as templateRows};
@@ -0,0 +1,69 @@
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};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,r}from"./sections-CtFz7HFH.js";import{I as i,it as a}from"./index-COTd4TRZ.js";import{n as o,r as s}from"./Dashboard-B8uXeJZ_.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=r.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...r.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=i(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=a(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:r.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:n[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:n[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C46vAuqp.js";import{$ as i,H as a,Q as o,Tt as s,W as c,X as l,Y as u,Z as d,_t as f,bt as p,dt as m,pt as h,vt as g,wt as _}from"./index-COTd4TRZ.js";import{t as v}from"./Markdown-0ORz7tAc.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Tabs-1qLrnqmn.js";import x,{installLabel as S}from"./Library-DNwHYVXt.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=i(),[r,a]=(0,C.useState)(null),[o,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(!1),[d,f]=(0,C.useState)(``),p=e?.fingerprint||``,m=r!==null&&JSON.stringify(r)!==JSON.stringify(o),h=(0,C.useRef)(!1),g=e=>{a(e),c(e)},v=()=>a(null);return(0,C.useEffect)(()=>{if(!m)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=s(({to:e})=>(h.current||(h.current=!0,w(n).then(n=>{n&&(t(),a(null),_(e))}).finally(()=>{h.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[m,n]),{draft:r,setDraft:a,open:g,close:v,discard:async()=>m&&!await w(n)?!1:(v(),!0),dirty:m,busy:l,notice:d,setNotice:f,save:async(e,{conflict:n}={})=>{u(!0),f(``);try{return await e(p)||!0}catch(e){e.status===409?f(n??T):f(e.message);return}finally{u(!1),t()}}}}var D=n(),ee=(e,t)=>`${e} ${t}${e===1?``:`s`}`,O=e=>`≈${e.toLocaleString(`en-US`)} tokens`,k={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(M).some(N)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),A.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),j(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:O(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}function ie({drafts:e}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. The agent’s rule Rite decides each one: ask the agent to run it.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,t)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),e.body?(0,D.jsx)(`div`,{className:`rule-expand`,children:(0,D.jsx)(`p`,{children:e.body})}):null]},t))})]}):null}function F({onChanged:e,dataRev:t}){let n=i(),{targets:a,sets:o,failed:s,reason:c,reload:p}=m(r.rules,t),[h,_]=(0,C.useState)(null),v=E({data:null,reload:p}),{draft:b,busy:x,notice:S}=v,w=(0,C.useRef)(null),[T,A]=(0,C.useState)(0),M=e=>{w.current=e,A(e=>e+1)},N=(0,C.useRef)(null),F=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=w.current;if(w.current=null,e===null)return;let t=[...F.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?N.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[T]),o&&!o.length&&c)return(0,D.jsx)(u,{error:c,onRetry:p});if(!o)return(0,D.jsx)(l,{});let I=a.length>1,L=e=>e?.id??``,R=e=>e?.shared?`shared`:f(e),z=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${L(e)}#${t.id}`}))),B=o.filter(e=>e.data.exists).map(e=>e.inst),V=B.length>0,H=b?.target,U=H!==void 0&&H!==`new`&&!z.some(e=>e.key===H&&e.title===b.title0),W=H===`new`||U,G=b?.to!==void 0&&!B.some(e=>L(e)===b.to),K=G?null:B.find(e=>L(e)===b?.to)??B[0]??null,q=G?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):B.length>1?(0,D.jsx)(d,{installs:B,value:K,onChange:e=>v.setDraft({...b,to:e.id}),tagOf:R}):I&&K?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:R(K)})]}):null,J=async(t,n,i)=>{let a=o.find(e=>L(e.inst)===L(n))?.data.fingerprint||``,s=await v.save(()=>r.rulesMutate({...t,fingerprint:a},g(n)),{conflict:i?te:ne});return s&&i&&v.close(),e?.(),s},Y=e=>v.setDraft({...b,form:e}),X=async(e,t,n)=>{await J(e,t,!0)&&M(n)},Z=async e=>{await v.discard()&&M(e)},ae=async e=>{await n(`Retire rule R${e.id} — “${e.title}”${I?` from ${R(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await J({op:`delete`,id:e.id},e.inst)&&b===null&&M(`add`)},oe=async e=>{await J({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&M(e.key)},se=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>I?`${R(e)}: ${t}`:t)),ce=o.flatMap(({data:e})=>e.drafts||[]),le=o.filter(e=>e.data.exists),Q=e=>e?.scope===`project`?`project`:`global`,$=e=>!U&&H===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(P,{value:b.form,onChange:Y,busy:x,onCancel:()=>Z(e.key),onSave:t=>X({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:I?R(e.inst):null,usual:Q(e.inst),isOpen:h===e.key,onToggle:()=>_(h===e.key?null:e.key),onEdit:()=>{_(e.key),v.open({target:e.key,no:e.id,to:L(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ae(e),onGraduate:()=>oe(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),V&&b===null&&(0,D.jsx)(`button`,{className:`btn`,ref:N,onClick:()=>v.open({target:`new`,title0:``,form:k}),children:`Add rule`})]}),S?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:S}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?f(e):`the default install`).join(`, `),`.`]}):null,se.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),(0,D.jsx)(ie,{drafts:ce}),W&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),U?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,b.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(P,{value:b.form,onChange:Y,busy:x,writeTo:q,onCancel:()=>Z(`add`),onSave:e=>!G&&B.length&&X({op:`add`,...e},K,`add`)})]}),V?z.length===0&&!W?(0,D.jsx)(y,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:F,children:le.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":I?R(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[I?(0,D.jsx)(`b`,{className:`mono`,children:R(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[ee(t.rules.length,`rule`),` · `,O(t.stats.tokens),` every turn · scope `,Q(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:z.filter(t=>t.inst===e).map($)}):null]},L(e)))}):(0,D.jsxs)(y,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var I=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,L=e=>e?.id??``;function R({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=m(r.profile,t);if(!i)return(0,D.jsx)(l,{});let o=new Set(a.map(L)),s=new Set([...i.map(e=>L(e.inst)),...o]),c=n.filter(e=>s.has(L(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(L(e))?`shared`:f(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),c.map(({install:t,tag:n})=>(0,D.jsx)(z,{install:t,tag:n,onChanged:e},L(t)))]})}function z({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:s,reload:c,setData:d}=p(()=>r.profile(g(e)),[]),f=E({data:i,reload:c}),{draft:m,dirty:h,busy:_,notice:b}=f,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||f.open(i.text||``)),s&&!i)return(0,D.jsx)(l,{});if(a)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(u,{error:a,onRetry:c})]});let w=m!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(o,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:f.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||f.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!h||_,onClick:async()=>{let t=await f.save(t=>r.profileSave({text:m,fingerprint:t},g(e)),{conflict:I});t&&(d(e=>({...e,text:m,seeded:!1,fingerprint:t.fingerprint||``})),f.setNotice(`Saved.`),f.close(),n?.())},children:_?`Saving…`:`Save`})]})]}),b?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:b}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:m,onChange:e=>f.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(y,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(v,{body:T})})]}):(0,D.jsxs)(y,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var B=(e,t)=>`${e} ${t}${e===1?``:`s`}`,V=e=>e?(e.items||[]).length:null,H=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,U=e=>String(e||``).split(`
2
+ `).map(e=>H.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function W({topics:e,install:t,shared:n}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:B(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:B(e.n,`fact`)})]},e.topic))})]}):null}var G={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function K({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:i}){let o=e=>Promise.resolve(e).catch(()=>null),s=h(n),{reload:l}=c(n),{data:u,reload:d}=p(()=>o(r.profile()),[n]),{data:f,reload:m}=p(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:g}=p(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),_=V(f),{data:v}=p(()=>e===`memory`?o(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,_]),S=V(g),C={memory:_,notebook:S},w={profile:u?.seeded?`template`:null,memory:_,notebook:S},T=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(a,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`+(s?.some(e=>e.shared)?` Global installs share one copy of the rules, profile and memory; a project install keeps its own.`:``)}),(0,D.jsx)(b,{page:`personal`,current:e,badges:w,label:`Personal files`}),e===`rules`&&(0,D.jsx)(F,{onChanged:l,dataRev:n}),e===`profile`&&(0,D.jsx)(R,{onChanged:d,dataRev:n}),T&&C[e]===0&&!t?(0,D.jsx)(y,{title:G[e].title,action:G[e].action,children:G[e].body}):T?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(W,{topics:U(v?.body),install:v?.install,shared:v?.shared}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onCountsChanged:i,onRulesChanged:()=>{l(),m()}},e)]}):null]})}export{K as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{rt as r}from"./index-COTd4TRZ.js";import{t as i}from"./FilterInput-qGKNSlxv.js";var a=e(t(),1),o=n(),s={experimental:{label:`experimental`,cls:`warn`,icon:`flask`,hint:`Shipped, but not yet confirmed by real use.`},deprecated:{label:`deprecated`,cls:`bad`,icon:`clear`,hint:`On its way out — look for the replacement before building on it.`},personal:{label:`personal`,cls:``,icon:`profile`,hint:`Yours — present in this install, not shipped or versioned by Geneseed.`},unknown:{label:`no status`,cls:``,icon:`about`,hint:`Not listed in registry.json.`}};function c({status:e,withHint:t=!1,compact:n=!1}){let i=s[e];if(!i)return null;if(n)return(0,o.jsxs)(`span`,{className:`badge status-icon ${i.cls}`,title:`${i.label}: ${i.hint}`,children:[(0,o.jsx)(r,{name:i.icon}),(0,o.jsx)(`span`,{className:`sr-only`,children:i.label})]});let a=(0,o.jsxs)(`span`,{className:`badge ${i.cls}`,title:t?void 0:i.hint,children:[(0,o.jsx)(`span`,{className:`dot`}),i.label]});return t?(0,o.jsxs)(o.Fragment,{children:[a,(0,o.jsx)(`span`,{className:`dim`,children:i.hint})]}):a}function l({items:e}){return Object.keys(s).filter(t=>e.some(e=>e.status===t)).map(e=>(0,o.jsxs)(`span`,{title:s[e].hint,children:[(0,o.jsx)(`span`,{className:`badge status-icon ${s[e].cls}`,"aria-hidden":`true`,children:(0,o.jsx)(r,{name:s[e].icon})}),s[e].label]},e))}var u=({name:e})=>(0,o.jsxs)(`span`,{className:`tag acc`,title:`Ships with the ${e} kit`,children:[`kit: `,e]});function d(e,t){let n=(t||``).trim().toLowerCase();return n?e.filter(e=>`${e.title||``} ${e.name||``} ${e.desc||``}`.toLowerCase().includes(n)):e}function f({label:e,count:t,extra:n,tools:r,q:s,onQ:c,matched:l,inView:u,children:d}){let f=_(u);(0,a.useLayoutEffect)(()=>g(f.current));let[p,m]=(0,a.useState)(``),v=(0,a.useRef)(!0);return(0,a.useEffect)(()=>{v.current?v.current=!1:m(f.current?.querySelector(`.lib-row.on`)?.dataset.title||``)},u),(0,o.jsxs)(`section`,{className:`lib-list`,"aria-label":e,onKeyDown:e=>{e.key===`ArrowDown`&&e.target.classList?.contains(`lib-filter`)&&(e.preventDefault(),f.current?.querySelector(`.lib-row`)?.focus())},children:[(0,o.jsxs)(`div`,{className:`lib-list-head`,children:[(0,o.jsxs)(`b`,{children:[e,` `,(0,o.jsx)(`span`,{className:`mono dim`,children:t})]}),n]}),(0,o.jsx)(i,{value:s,onChange:c,placeholder:`Filter ${e.toLowerCase()}`,label:`Filter ${e}`}),r?(0,o.jsx)(`div`,{className:`lib-tools`,children:r}):null,(0,o.jsxs)(`div`,{className:`lib-rows`,ref:f,onKeyDown:h,onFocus:e=>g(e.currentTarget),children:[d,s.trim()&&l===0&&(0,o.jsxs)(`div`,{className:`empty`,style:{padding:32},children:[(0,o.jsx)(`div`,{className:`big`,children:`No matches`}),`Nothing in `,e.toLowerCase(),` matches “`,s.trim(),`”.`]})]}),(0,o.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:p?`${p} opened`:``})]})}function p({item:e,isOpen:t,href:n,children:r}){return(0,o.jsxs)(`a`,{className:`lib-row${t?` on`:``}`,href:n,"aria-current":t?`true`:void 0,"data-title":e.title||e.name,children:[(0,o.jsxs)(`span`,{className:`lr-name`,children:[e.title||e.name,(0,o.jsx)(c,{status:e.status,compact:!0}),e.kit?(0,o.jsx)(u,{name:e.kit}):null,r]}),e.desc?(0,o.jsx)(`span`,{className:`lr-desc`,children:e.desc}):null,e.meta?(0,o.jsx)(`span`,{className:`lr-meta mono`,children:e.meta}):null]})}function m({rows:e,activeName:t,hrefOf:n,pills:r}){let i=null,a=[];for(let s of e)s.group&&s.group!==i&&(i=s.group,a.push((0,o.jsxs)(`div`,{className:`lib-group`,children:[s.groupC?(0,o.jsx)(`span`,{className:`cdot`,style:{"--cc":s.groupC},"aria-hidden":`true`}):null,s.group]},`g-${s.group}`))),a.push((0,o.jsx)(p,{item:s,isOpen:t===s.name,href:n(s),children:r?.(s)},s.name));return a}function h(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 g(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 _(e){let t=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=t.current,n=e?.querySelector(`.lib-row.on`);if(!n||!e)return;let r=n.offsetTop;r>=e.scrollTop&&r+n.clientHeight<=e.scrollTop+e.clientHeight||(e.scrollTop=Math.max(0,r-e.clientHeight/2+n.clientHeight/2))},e),t}function v({label:e,total:t,cats:n,cat:r,onChange:i}){if(n.length<=1)return null;let a=[{key:`all`,label:`All`,n:t,c:`var(--text-3)`},...n];return(0,o.jsxs)(`div`,{className:`rail-cats`,children:[(0,o.jsx)(`ul`,{"aria-label":e,children:a.map(({key:e,label:t,n,c:a})=>(0,o.jsx)(`li`,{children:(0,o.jsxs)(`button`,{type:`button`,className:r===e?`on`:``,"aria-pressed":r===e,style:{"--cc":a},onClick:()=>i(e),children:[(0,o.jsx)(`span`,{className:`cdot`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`rc-name`,children:t}),(0,o.jsx)(`span`,{className:`mono dim`,children:n})]})},e))}),(0,o.jsx)(`div`,{className:`rail-mix`,"aria-hidden":`true`,children:n.map(({key:e,n:t,c:n})=>(0,o.jsx)(`span`,{className:r===`all`||r===e?``:`dim`,style:{"--cc":n,flexGrow:t}},e))})]})}function y(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)`}))}export{f as a,l as c,u as i,y as n,d as o,m as r,c as s,v as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-C46vAuqp.js";import{i}from"./motion-RlUl1osO.js";import{$ as a,H as o,Y as s,gt as c,rt as l,st as u,xt as d}from"./index-COTd4TRZ.js";var f=e(t(),1),p=n();function m(){let e=a(),[t,n]=(0,f.useState)(!1),[i,o]=(0,f.useState)(null);return t?(0,p.jsxs)(`p`,{className:`sub`,children:[`Server stopped. You can close this tab and reopen any time with `,(0,p.jsx)(`code`,{children:`geneseed web`}),`.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{error:i}),(0,p.jsxs)(`button`,{className:`btn ghost danger-line`,onClick:async()=>{if(await e(`Stop the local Geneseed server? The console goes offline until you start it again.`,{title:`Stop the server?`,confirmLabel:`Stop server`,tone:`danger`})){o(null);try{await r.shutdown()}catch(e){if(e.status)return o(e.message)}n(!0)}},children:[(0,p.jsx)(l,{name:`x`}),`Stop server`]})]})}function h(){let e=a(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:async()=>{if(await e(`Restart the local Geneseed server? The console reconnects in a moment.`,{title:`Restart the server?`,confirmLabel:`Restart`})){n(!0),i(null);try{await d()}catch(e){i(e.message),n(!1)}}},disabled:t,children:[(0,p.jsx)(l,{name:`refresh`}),t?`Restarting…`:`Restart server`]})]})}var g=`https://github.com/Arylmera/Geneseed`,_=`https://github.com/Arylmera`,v=[[`machine`,`Machine`],[`server`,`Server`],[`about`,`About`],[`danger`,`Danger zone`]],y=[`Host check`,`token on writes`,`framing refused`,`cross-site GET refused`];function b({k:e,help:t,children:n,control:r}){return(0,p.jsxs)(`div`,{className:`sheet-row`,children:[(0,p.jsxs)(`span`,{className:`sheet-k`,children:[e,t?(0,p.jsx)(`span`,{className:`sheet-h sub`,children:t}):null]}),(0,p.jsx)(`div`,{className:`sheet-v`,children:n}),(0,p.jsx)(`div`,{className:`sheet-c`,children:r})]})}function x({id:e,title:t,head:n,className:r=``,children:i}){return(0,p.jsxs)(`section`,{id:`set-${e}`,className:`card pad-md sheet-sec ${r}`,"aria-labelledby":`${e}-h`,children:[(0,p.jsxs)(`div`,{className:`card-head`,children:[(0,p.jsx)(`h3`,{id:`${e}-h`,children:t}),n]}),i]})}function S({stale:e}){let t=e=>document.getElementById(`set-${e}`)?.scrollIntoView?.({behavior:i()?`smooth`:`auto`,block:`start`});return(0,p.jsx)(`nav`,{className:`sheet-index`,"aria-label":`On this page`,children:v.map(([n,r])=>(0,p.jsxs)(`button`,{type:`button`,className:n===`danger`?`t-bad`:``,onClick:()=>t(n),children:[r,n===`server`&&(0,p.jsx)(`span`,{className:`sheet-dot ${e?`warn`:`good`}`,"aria-hidden":`true`})]},n))})}function C({version:e}){let[t,n]=(0,f.useState)(g),[i,a]=(0,f.useState)(!0);(0,f.useEffect)(()=>{Promise.resolve(r.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),a(!!e.repo_is_github))}).catch(()=>{})},[]);let o=(e,t)=>(0,p.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,p.jsx)(l,{name:`external`})]});return(0,p.jsxs)(x,{id:`about`,title:`About`,children:[(0,p.jsx)(b,{k:`Version`,control:i?o(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,p.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),i?(0,p.jsx)(b,{k:`Credits`,control:o(t+`#-credits`,`Credits`),children:(0,p.jsx)(`span`,{className:`sub`,children:`Skills and agents adapted from other projects, with their licences`})}):null,(0,p.jsx)(b,{k:`Geneseed`,help:`MIT-licensed`,control:(0,p.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(l,{name:`github`}),i?`Source on GitHub`:`Source repo`]}),i&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(l,{name:`external`}),`Issues`]}),(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(l,{name:`external`}),`MIT License`]})]})]}),children:(0,p.jsx)(`span`,{className:`sub`,children:`A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent. One canonical source, many voices.`})}),(0,p.jsx)(b,{k:`Creator`,control:(0,p.jsxs)(`a`,{className:`btn ghost`,href:_,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(l,{name:`github`}),`@Arylmera on GitHub`]}),children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Built by `,(0,p.jsx)(`strong`,{children:`Guillaume Lemer`}),`. It started as a personal, Obsidian-vault-grown agent operating system and was distilled into the repo you are running. If you find it useful, a star on the repo or an issue with feedback is the best way to help shape what comes next.`]})})]})}function w({overview:e,onAction:t}){let n=a(),i=e?.server,s=e?.daemon_stale,[d,g]=(0,f.useState)(null);(0,f.useEffect)(()=>{Promise.resolve(r.update?.()).then(e=>g(e||null)).catch(()=>{})},[]);let _=d?d.install??(d.git?`git`:`npm-global`):null,v=_===`git`?`Update (git pull + rebuild)`:_===`npm-global`?`Update (npm install -g + rebuild)`:`Update`,w=async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await r.installs();e=t.filter(e=>e.state===`active`).map(e=>`${c(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await n(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},T=i?.autostart===!0?`On · login script`:i?.autostart===!1?`Off`:`unknown`;return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(o,{title:`Settings`,sub:`This copy of Geneseed and the local server.`}),(0,p.jsxs)(`div`,{className:`sheet`,children:[(0,p.jsx)(S,{stale:s}),(0,p.jsxs)(`div`,{className:`sheet-body`,children:[(0,p.jsxs)(x,{id:`machine`,title:`Machine`,children:[(0,p.jsx)(b,{k:`Geneseed`,help:`This copy of the source`,control:_===`other`?d.command?(0,p.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,p.jsx)(`code`,{className:`mono`,children:d.command})]}):null:d?.behind===!1?(0,p.jsx)(`span`,{className:`dim`,children:`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`}):(0,p.jsxs)(`button`,{className:`btn`,onClick:w,children:[(0,p.jsx)(l,{name:`download`}),v]}),children:(0,p.jsx)(`span`,{className:`mono`,children:e?.version||`unknown`})}),(0,p.jsx)(b,{k:`Command on PATH`,help:`Run geneseed from any folder`,control:(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:()=>t(`link`),children:[(0,p.jsx)(l,{name:`external`}),`Add to PATH`]})})]}),(0,p.jsxs)(x,{id:`server`,title:`Server`,className:`sheet-live`,head:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`pill good`,children:`running`}),(0,p.jsxs)(`span`,{className:`mono dim`,children:[`127.0.0.1:`,window.location.port||`80`,i?` · pid ${i.pid} · up ${u(i.started)}`:``]})]}),children:[(0,p.jsx)(b,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,p.jsx)(h,{}),children:s?(0,p.jsx)(`span`,{className:`pill warn`,children:`disk has newer code → Restart`}):(0,p.jsx)(`span`,{className:`pill good`,children:`matches disk`})}),(0,p.jsx)(b,{k:`Start at login`,help:`A login script you set up by hand (install guide)`,children:(0,p.jsx)(`span`,{className:`sub`,children:T})}),(0,p.jsx)(b,{k:`Guards`,help:`What stops another page from driving the console`,children:(0,p.jsx)(`span`,{className:`row wrap gap-8`,children:y.map(e=>(0,p.jsx)(`span`,{className:`pill good`,children:e},e))})})]}),(0,p.jsx)(C,{version:e?.version}),(0,p.jsxs)(x,{id:`danger`,title:`Danger zone`,className:`danger-zone`,children:[(0,p.jsx)(b,{k:`Stop the server`,help:`The console goes offline until you run geneseed web`,control:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{k:`The geneseed command`,help:`Installs keep working; only the command goes`,control:(0,p.jsx)(`button`,{className:`btn ghost danger-line`,onClick:()=>t(`unlink`),children:`Remove from PATH`})}),(0,p.jsx)(b,{k:`Uninstall`,children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Each install has its own Uninstall in `,(0,p.jsx)(`a`,{href:`#/installs/hosts`,children:`Hosts`}),`, bound to its host and path.`]})})]})]})]})]})}export{w as default};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Ct as n,St as r}from"./index-COTd4TRZ.js";e();var i=t();function a({page:e,current:t,badges:a={},label:o}){return(0,i.jsx)(`nav`,{className:`tabs`,"aria-label":o,children:r[e].map(r=>(0,i.jsxs)(`a`,{href:`#/${e}/${r}`,className:t===r?`on`:``,"aria-current":t===r?`page`:void 0,children:[n[r],a[r]==null?null:(0,i.jsx)(`span`,{className:`tab-badge`,children:a[r]})]},r))})}export{a as t};
@@ -0,0 +1 @@
1
+ var e=typeof window<`u`?window.__GENESEED_TOKEN__:``;async function t(e){let t=await e.json().catch(()=>({})),n=e.status===403&&t.error===`forbidden`?`the web server restarted since this page loaded — reload the page, then re-apply your edit`:t.error||t.message||e.statusText,r=Error(n);return r.status=e.status,r.body=t,r}var n=2e5;async function r(e){try{let r=await fetch(e,{signal:AbortSignal.timeout(n)});if(!r.ok)throw await t(r);return await r.json()}catch(e){throw e?.name===`TimeoutError`?Error(`the local server did not answer in time`,{cause:e}):e}}async function i(n,r={}){let i=await fetch(n,{method:`POST`,headers:{"X-Geneseed-Token":e||``,"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok)throw await t(i);return i.json()}var a=e=>{if(e==null)return!1;if(typeof e.host==`string`&&typeof e.path==`string`)return!0;throw Error(`an install needs both host and path`)},o=(e,t)=>{if(!a(t))return e;let n=new URLSearchParams({host:t.host,path:t.path});return`${e}${e.includes(`?`)?`&`:`?`}${n}`},s=(e,t)=>{let n=e??{};if(!a(t))return n;if(`host`in n||`path`in n)throw Error(`this body already has host or path`);return{...n,host:t.host,path:t.path}},c=e=>{try{return e()}catch(e){return Promise.reject(e)}},l=(e,t)=>c(()=>r(o(e,t))),u=(e,t,n)=>c(()=>i(e,s(t,n))),d=e=>l(`/api/overview`,e),f=()=>r(`/api/fleet`),p=()=>r(`/api/kits`),m=()=>r(`/api/usage`),h=()=>r(`/api/gates`),g=()=>r(`/api/update`),_=e=>l(`/api/recent`,e),v=()=>r(`/api/activity`),y=(e,t)=>l(`/api/activity/`+encodeURIComponent(e),t),b=(e,t)=>u(`/api/activity`,{enabled:e},t),x=e=>l(`/api/setup`,e),S=(e=!1,t)=>l(e?`/api/doctor?fresh=1`:`/api/doctor`,t),C=e=>l(`/api/themes`,e),w=(e,t)=>l(`/api/catalog/${e}`,t),T=(e,t,n)=>l(`/api/item/${e}/${encodeURIComponent(t)}`,n),E=(e,t)=>u(`/api/memory/delete`,{name:e},t),D=e=>l(`/api/diff`,e),O=(e,t)=>u(`/api/actions/restore`,{files:e},t),k=409,A=e=>r(`/api/jobs/${e}`),j=()=>r(`/api/jobs`),M=e=>i(`/api/jobs/${e}/cancel`),N=new Set([`build`,`restore`]);async function P(e,t,n){let r=t||{},a=`/api/actions/${e}`;try{return await(N.has(e)?u(a,r,n):i(a,r))}catch(e){throw e.status===k&&e.body?.error===`busy`?Error(`An action is already running.`,{cause:e}):e}}var F=e=>l(`/api/loops`,e),I=()=>r(`/api/loops/active`),L=(e,t)=>i(`/api/loops/preset`,{root:e,preset:t}),R=()=>r(`/api/mcp`),z=e=>i(`/api/reveal`,{path:e}),B=()=>r(`/api/installs`),V=(e,t,n)=>i(`/api/install`,{host:e,path:t,action:n}),H=(e,t,n)=>i(`/api/install`,{host:e,path:t,action:`remove`,memory:n}),U=(e,t)=>i(`/api/default-install`,{host:e,path:t}),W=()=>i(`/api/pick-folder`,{}),G=()=>r(`/api/ping`),K=()=>i(`/api/shutdown`),q=()=>i(`/api/restart`),J=e=>e?`?harness=${encodeURIComponent(e)}`:``,Y={fleet:f,kits:p,usage:m,gates:h,update:g,loops:F,activeLoops:I,setLoopPreset:L,overview:d,recent:_,activity:v,activityDetail:y,activityToggle:b,setup:x,doctor:S,themes:C,catalog:w,item:T,memoryDelete:E,diff:D,restore:O,job:A,jobs:j,cancelJob:M,action:P,mcp:R,mcpReveal:z,installs:B,installToggle:V,installRemove:H,setDefaultInstall:U,pickFolder:W,ping:G,shutdown:K,restart:q,docs:(e,t)=>l(`/api/docs${J(e)}`,t),docsPage:(e,t,n)=>l(`/api/docs/page/${encodeURIComponent(e)}${J(t)}`,n),rules:e=>l(`/api/rules`,e),rulesMutate:(e,t)=>u(`/api/rules`,e,t),rulesPromote:(e,t)=>u(`/api/rules/promote`,e,t),profile:e=>l(`/api/profile`,e),profileSave:(e,t)=>u(`/api/profile`,e,t),excludes:()=>r(`/api/excludes`),excludeMutate:(e,t)=>i(`/api/excludes`,{action:e,path:t})};export{Y as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";e();var n=t();function r({label:e,value:t,options:r,onChange:i}){return r.length?(0,n.jsx)(`select`,{className:`sel`,"aria-label":e,value:t,onChange:e=>i(e.target.value),children:r.map(e=>(0,n.jsx)(`option`,{value:e,children:e},e))}):null}var i=[`lean`,`full`];function a({on:e,disabled:t,label:r,onToggle:i}){return(0,n.jsx)(`input`,{type:`checkbox`,role:`switch`,className:`sw-toggle${e?` on`:``}`,checked:e,"aria-checked":e,disabled:t,"aria-label":r,onChange:i,onKeyDown:e=>{e.key===`Enter`&&!t&&i()}})}var o=[{key:`theme`,name:`voice`,title:`Voice`},{key:`footprint`,name:`footprint`,title:`Footprint`},{key:`posture`,name:`posture`,title:`Posture`},{key:`mode`,name:`mode`,title:`Mode`},{key:`trust`,name:`trust`,title:`Loop trust`}];function s({value:e,options:t,onChange:i,who:a}){return o.map(o=>(0,n.jsxs)(`label`,{className:`dp-field`,children:[(0,n.jsx)(`span`,{children:o.title}),(0,n.jsx)(r,{label:`${o.name} for ${a}`,value:e[o.key],options:t[o.key],onChange:e=>i(o.key,e)})]},o.key))}export{s as n,a as r,i as t};