geneseed 5.3.0 → 5.4.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 (198) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +23 -20
  3. package/SHIPPED.md +7 -7
  4. package/adapters/bob/README.md +31 -18
  5. package/adapters/claude-code/README.md +27 -22
  6. package/adapters/openclaude/README.md +18 -8
  7. package/adapters/opencode/HOW-OPENCODE-LOADS.md +8 -3
  8. package/adapters/opencode/README.md +3 -2
  9. package/adapters/opencode/plugins/geneseed-activity.js +20 -21
  10. package/adapters/opencode/plugins/geneseed-context.js +175 -62
  11. package/adapters/opencode/plugins/geneseed-guard.js +419 -205
  12. package/adapters/opencode/plugins/geneseed-workflow.js +3 -2
  13. package/adapters/opencode/workflows/_runtime.js +3 -2
  14. package/bin/geneseed-cli.mjs +7 -0
  15. package/bin/geneseed-hook.mjs +59 -11
  16. package/docs/PRD.md +1 -1
  17. package/docs/README.md +1 -0
  18. package/docs/concepts/agents.md +1 -1
  19. package/docs/concepts/collaboration.md +2 -2
  20. package/docs/concepts/enforcement-table.md +5 -2
  21. package/docs/concepts/exclusions.md +18 -4
  22. package/docs/concepts/footprint.md +11 -1
  23. package/docs/concepts/foreman-mode.md +1 -1
  24. package/docs/concepts/hook-gates.md +5 -5
  25. package/docs/concepts/hooks.md +4 -3
  26. package/docs/concepts/host-matrix.md +24 -6
  27. package/docs/concepts/kits.md +12 -2
  28. package/docs/concepts/loop-bricks.md +3 -3
  29. package/docs/concepts/loops.md +6 -4
  30. package/docs/concepts/ownership.md +1 -1
  31. package/docs/concepts/rules.md +2 -2
  32. package/docs/concepts/skills.md +1 -1
  33. package/docs/design-history.md +8 -0
  34. package/docs/extending.md +112 -35
  35. package/docs/guides/auto-merge.md +100 -0
  36. package/docs/guides/choose-your-setup.md +1 -1
  37. package/docs/guides/headless.md +1 -1
  38. package/docs/guides/install-bob.md +2 -2
  39. package/docs/guides/install-clone.md +1 -1
  40. package/docs/guides/install-openclaude.md +1 -1
  41. package/docs/guides/install.md +1 -1
  42. package/docs/guides/loop-finish.md +3 -3
  43. package/docs/guides/loop-running.md +4 -4
  44. package/docs/guides/project-context.md +1 -1
  45. package/docs/guides/run-a-factory.md +2 -2
  46. package/docs/guides/setup-doctrines.md +2 -2
  47. package/docs/guides/setup-footprint.md +1 -1
  48. package/docs/guides/uninstall.md +3 -3
  49. package/docs/guides/upgrade.md +1 -1
  50. package/docs/guides/verify.md +12 -0
  51. package/docs/guides/worktree.md +1 -1
  52. package/docs/reference/environment.md +5 -2
  53. package/docs/reference/plugin-activity.md +1 -1
  54. package/docs/reference/plugin-guard.md +1 -1
  55. package/docs/reference/plugin-learn.md +1 -1
  56. package/docs/reference/plugin-workflow.md +1 -1
  57. package/docs/reference/troubleshoot-doctor.md +2 -2
  58. package/docs/reference/troubleshoot-hooks.md +2 -2
  59. package/docs/reference/troubleshoot-install.md +3 -3
  60. package/docs/reference/troubleshoot-tools.md +1 -1
  61. package/docs/token-footprint.md +68 -4
  62. package/docs/understand/design-choices-hosts.md +1 -1
  63. package/docs/understand/design-choices-shape.md +1 -0
  64. package/docs/understand/enforced-vs-asked.md +2 -2
  65. package/docs/understand/machine-bob.md +1 -1
  66. package/docs/understand/machine-claude.md +2 -2
  67. package/docs/understand/on-your-machine.md +1 -1
  68. package/docs/web-ui.md +10 -5
  69. package/harness.config.json +1 -1
  70. package/js/README.md +5 -3
  71. package/js/build/args.mjs +13 -2
  72. package/js/build/driver.mjs +34 -7
  73. package/js/build/emit-claude.mjs +9 -5
  74. package/js/build/emit-opencode.mjs +13 -9
  75. package/js/build/generate.mjs +10 -165
  76. package/js/build/profile.mjs +318 -0
  77. package/js/build/render.mjs +81 -3
  78. package/js/build/retired-skills.mjs +60 -13
  79. package/js/build/source.mjs +15 -1
  80. package/js/build/stubs.mjs +4 -1
  81. package/js/cli-table.json +48 -3
  82. package/js/hosts/done-checks.mjs +6 -0
  83. package/js/hosts/geneseed-dir.mjs +3 -2
  84. package/js/hosts/gitref.mjs +5 -3
  85. package/js/hosts/hook-tap.mjs +104 -0
  86. package/js/hosts/hooks-context.mjs +4 -2
  87. package/js/hosts/hooks-done.mjs +345 -55
  88. package/js/hosts/hooks-learn.mjs +51 -19
  89. package/js/hosts/hooks-prims.mjs +5 -3
  90. package/js/hosts/hooks.mjs +172 -19
  91. package/js/hosts/hosts.mjs +80 -12
  92. package/js/hosts/installs.mjs +26 -1
  93. package/js/hosts/native.mjs +33 -7
  94. package/js/hosts/owned.mjs +7 -6
  95. package/js/hosts/ownership-gate.mjs +14 -1
  96. package/js/hosts/settings.mjs +273 -105
  97. package/js/hosts/shim.mjs +4 -4
  98. package/js/hosts/usage.mjs +9 -3
  99. package/js/inspect/checks-constitution.mjs +32 -0
  100. package/js/inspect/checks-probe.mjs +66 -5
  101. package/js/inspect/checks-repo.mjs +196 -2
  102. package/js/inspect/cost.mjs +34 -2
  103. package/js/inspect/diff.mjs +21 -3
  104. package/js/inspect/doctor.mjs +6 -1
  105. package/js/inspect/inventory.mjs +1 -1
  106. package/js/lib/machine-dir.mjs +1 -1
  107. package/js/lib/node-floor.mjs +46 -6
  108. package/js/maintain/setup.mjs +5 -1
  109. package/js/maintain/uninstall.mjs +42 -16
  110. package/js/maintain/update.mjs +4 -2
  111. package/js/web/actions.mjs +17 -12
  112. package/js/web/api.mjs +7 -2
  113. package/package.json +1 -1
  114. package/registry.json +14 -0
  115. package/src/AGENT.md.tmpl +15 -17
  116. package/src/bricks/pr-open.md +3 -2
  117. package/src/doctrines/ops.md +2 -2
  118. package/src/doctrines/process.md +40 -36
  119. package/src/factories/analysis-to-build.json +1 -1
  120. package/src/factories/bug-report-to-fix.json +1 -1
  121. package/src/factories/issue-to-pr.json +1 -1
  122. package/src/kits/terminal-tools/rules.md +10 -0
  123. package/src/kits/terminal-tools.json +13 -0
  124. package/src/licenses/herdr.txt +201 -0
  125. package/src/modes/foreman.md +6 -3
  126. package/src/skills/_self-improvement.md +9 -7
  127. package/src/skills/commit.md +17 -17
  128. package/src/skills/debug/ci.md +1 -1
  129. package/src/skills/dependencies.md +3 -3
  130. package/src/skills/document-project.md +3 -2
  131. package/src/skills/factory.md +13 -4
  132. package/src/skills/geneseed.md +4 -2
  133. package/src/skills/git-history.md +5 -7
  134. package/src/skills/herdr.md +135 -0
  135. package/src/skills/loop.md +3 -2
  136. package/src/skills/opencode-cli.md +84 -0
  137. package/src/skills/pipeline.md +1 -1
  138. package/src/skills/release.md +5 -8
  139. package/src/skills/review-response.md +4 -2
  140. package/src/skills/rule.md +27 -1
  141. package/src/skills/ship.md +54 -7
  142. package/src/skills/worktree.md +2 -2
  143. package/src/upstreams.json +7 -0
  144. package/themes/_TEMPLATE.json +2 -0
  145. package/themes/biker.json +2 -0
  146. package/themes/commentator.json +2 -0
  147. package/themes/cyberpunk.json +2 -0
  148. package/themes/gamer.json +2 -0
  149. package/themes/imperial.json +2 -0
  150. package/themes/joker.json +2 -0
  151. package/themes/marvin.json +2 -0
  152. package/themes/mean.json +2 -0
  153. package/themes/military.json +2 -0
  154. package/themes/neutral.json +2 -0
  155. package/themes/pirate.json +2 -0
  156. package/themes/sports.json +2 -0
  157. package/themes/verstappen.json +2 -0
  158. package/themes/wizard.json +2 -0
  159. package/web/dist/assets/Activity-D2kOc3yi.js +1 -0
  160. package/web/dist/assets/ActivityDetail-By3xOr21.js +1 -0
  161. package/web/dist/assets/{Bonsai-Bfpb6W-1.js → Bonsai-CBWDTBA4.js} +1 -1
  162. package/web/dist/assets/{CopyButton-ByIntFtB.js → CopyButton-BVbpriMB.js} +1 -1
  163. package/web/dist/assets/Dashboard-CIJLPHM9.js +2 -0
  164. package/web/dist/assets/{Docs-DvlMJhpu.js → Docs-CiRRIELs.js} +3 -3
  165. package/web/dist/assets/Factories-DhyK0O8d.js +1 -0
  166. package/web/dist/assets/GreenhouseView-DW3PgTPy.js +1 -0
  167. package/web/dist/assets/Installs-B6nlo-Ly.js +3 -0
  168. package/web/dist/assets/JournalView-O65qEWfp.js +1 -0
  169. package/web/dist/assets/Kits-C5U-yT6Z.js +1 -0
  170. package/web/dist/assets/Laws-CuTw_XNf.js +4 -0
  171. package/web/dist/assets/{LibRows-DEHjIoD-.js → LibRows-D6-CVa3K.js} +1 -1
  172. package/web/dist/assets/Library-CzPlerd6.js +3 -0
  173. package/web/dist/assets/Loops-CqNF_-nS.js +2 -0
  174. package/web/dist/assets/Markdown-CxkA7940.js +71 -0
  175. package/web/dist/assets/OperatorHudView-BNr8K5qj.js +1 -0
  176. package/web/dist/assets/Personal-DeDb9e8O.js +2 -0
  177. package/web/dist/assets/Settings-B8MPN_AD.js +1 -0
  178. package/web/dist/assets/{Tabs-CWeQTADL.js → Tabs-DJzAez4h.js} +1 -1
  179. package/web/dist/assets/index-BL3P-9Rg.js +6 -0
  180. package/web/dist/assets/{index-CsAZq0BQ.css → index-CRWqKxfY.css} +1 -1
  181. package/web/dist/index.html +2 -2
  182. package/adapters/claude-code/settings.json +0 -52
  183. package/web/dist/assets/Activity-CqJiquEq.js +0 -1
  184. package/web/dist/assets/ActivityDetail-BSzevynX.js +0 -1
  185. package/web/dist/assets/Dashboard-DBOEi9lQ.js +0 -2
  186. package/web/dist/assets/Factories-Bpvv7L2H.js +0 -1
  187. package/web/dist/assets/GreenhouseView-GpBsYn50.js +0 -1
  188. package/web/dist/assets/Installs-BlGmVrFK.js +0 -3
  189. package/web/dist/assets/JournalView-iLuLrOxE.js +0 -1
  190. package/web/dist/assets/Kits-DRwpxC-J.js +0 -1
  191. package/web/dist/assets/Laws-CZkiNOWQ.js +0 -4
  192. package/web/dist/assets/Library-B4K-1iNF.js +0 -3
  193. package/web/dist/assets/Loops-BWSzaW8E.js +0 -2
  194. package/web/dist/assets/Markdown-0ORz7tAc.js +0 -69
  195. package/web/dist/assets/OperatorHudView-BAXwCEvY.js +0 -1
  196. package/web/dist/assets/Personal-Bp9nV4GR.js +0 -2
  197. package/web/dist/assets/Settings-CWWuaIp-.js +0 -1
  198. package/web/dist/assets/index-How7SzDZ.js +0 -6
@@ -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-DLDVY3K-.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,nt as u,tt as d,wt as f}from"./index-BL3P-9Rg.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./CopyButton-BVbpriMB.js";import{c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./ActiveLoops-BJJN3P-V.js";import{t as S}from"./Markdown-CxkA7940.js";import{a as ee,i as te,n as ne,o as C,s as w}from"./LibRows-D6-CVa3K.js";import{i as T}from"./motion-RlUl1osO.js";var E=e(t(),1),D=n(),O=encodeURIComponent,k=a.loops.map(e=>[e,i[e]]),A={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},j={project:`Project`,global:`Global`,shipped:`Shipped`},M={templates:`Categories`,bricks:`Origins`,active:`Statuses`},N=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function P(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var F=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function I(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return F(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>A[e.graph.category]?e.graph.category:`other`,[...Object.entries(A),[`other`,`Other`]])}function L(e,t){return F(e.map(e=>({...e,desc:e.description,override:P(t,e.name)})),e=>e.origin,Object.entries(j))}function R(e){return F(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,N)}var z=(e,t)=>(0,D.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),B={templates:e=>e.human?z(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?z(`warn`,`mutate`):null,b(e)?z(`human`,`human gate`):null,e.override?z(`acc`,e.override):null,e.available===!1?z(`bad`,`unavailable`):null],active:e=>z(_[e.status],e.status)};function V({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:(0,D.jsx)(`a`,{href:`#/loops/bricks/${O(e)}`,children:e})}),z(t.effect===`mutate`?`warn`:``,t.effect),(0,D.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,D.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),b(t)?z(`human`,b(t).toLowerCase()):null,n?z(`acc`,n):null]}):(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:e}),(0,D.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function H(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function re({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,E.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=H(e.graph),c=h(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>y(t)&&t.graph.name===e.name).length;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Template`}),A[e.graph.category]?z(``,A[e.graph.category]):null,e.human?z(`human`,`human gate`):null]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsxs)(`figure`,{className:`loop-console`,children:[(0,D.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${c.width}px`},children:(0,D.jsx)(v,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:T()?`smooth`:`auto`,block:`nearest`})}})}),(0,D.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,D.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,D.jsx)(`ol`,{children:s.map(([e,t])=>(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,D.jsxs)(`span`,{className:`loop-legend`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,D.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,D.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,D.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,D.jsx)(m,{text:u,label:`Copy command`})]}),(0,D.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,D.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,D.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,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,D.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}):null,(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,D.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,D.jsx)(V,{name:e,brick:o.get(e),override:P(n,e),on:i===e},e))})]})}function U(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 W({b:e}){let[t,n]=(0,E.useState)(!1),r=[[`effect`,z(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,D.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>z(``,e))],[`gate`,b(e)?z(`human`,b(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,D.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Brick`}),B.bricks(e)]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,D.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(`dt`,{children:e}),(0,D.jsx)(`dd`,{children:t})]},e))}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,D.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,D.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:U(e)}):(0,D.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,D.jsx)(S,{body:e.body})})]})}function G({problems:e}){if(!e?.length)return null;let t=e.length;return(0,D.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,D.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,D.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,D.jsx)(`li`,{className:`mono`,children:e},e))})]})}var K={templates:{title:`No templates`,body:(0,D.jsxs)(D.Fragment,{children:[`Add one under `,(0,D.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,D.jsxs)(D.Fragment,{children:[`Add one under `,(0,D.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,D.jsxs)(D.Fragment,{children:[`Start one with `,(0,D.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.`]})}},q={templates:(0,D.jsxs)(D.Fragment,{children:[`A template wires bricks into a loop. `,(0,D.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,D.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,D.jsxs)(D.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,D.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,D.jsxs)(D.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,D.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function J({tab:e=`templates`,item:t,dataRev:n}){let i=s(n),[a,m]=o(`loops`,i),{data:h,error:_}=f(()=>r.loops(l(a)),[n,a?.id??``],`loops`),v=g(),[b,S]=(0,E.useState)(``),[T,A]=(0,E.useState)(`all`),[j,N]=(0,E.useState)(e);e!==j&&(N(e),S(``),A(`all`));let P=h?.bricks||[],F=e===`active`?v.loops&&R(v.loops):h&&(e===`bricks`?L(h.bricks,h.overridden):I(h.templates,h.bricks)),z=F||[],V=w(z),H=T===`all`?z:z.filter(e=>e.group===T),U=b.trim(),J=ee(H,U),Y=!!(t&&F&&!z.some(e=>e.name===t)),X=Y?null:z.find(e=>e.name===t)||e===`active`&&z.find(y)||z[0]||null,Z={templates:h?.templates.length,bricks:h?.bricks.length,active:v.loops?.length},Q=k.find(([t])=>t===e)[1],$=e===`active`?v.error:_;return(0,D.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,D.jsx)(u,{className:`page-pick`,installs:i,value:a,onChange:m}),(0,D.jsx)(c,{error:$,style:{margin:`0 0 var(--sp-3)`}}),(0,D.jsx)(G,{problems:h?.problems}),(0,D.jsxs)(`div`,{className:`library`,children:[(0,D.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,D.jsxs)(`div`,{className:`lib-title`,children:[(0,D.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,D.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,D.jsx)(`p`,{className:`panel-note lib-lede`,children:q[e]}),(0,D.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:k.map(([t,n])=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,D.jsx)(`span`,{className:`mono dim`,children:Z[t]??``})]}),e===t&&(0,D.jsx)(C,{label:M[t],total:z.length,cats:V,cat:T,onChange:A})]},t))})]}),(0,D.jsx)(te,{label:Q,count:U?`${J.length} of ${H.length}`:F?H.length:``,q:b,onQ:S,matched:J.length,inView:[e,t],current:X?.name,sections:k.map(([t,n])=>({key:t,label:n,n:Z[t],href:`#/loops/${t}`,on:e===t})),cats:V,cat:T,total:z.length,onCat:A,catLabel:M[e],children:F?z.length===0?(0,D.jsx)(p,{title:K[e].title,children:K[e].body}):(0,D.jsx)(ne,{rows:J,activeName:X?.name,hrefOf:t=>`#/loops/${e}/${O(t.name)}`,pills:B[e]}):$?null:(0,D.jsx)(d,{})}),(0,D.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:Y?(0,D.jsx)(p,{title:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${Q.toLowerCase()} →`}}):X?e===`active`?(0,D.jsx)(x,{loop:X,bricks:P,onPreset:v.onPreset}):e===`bricks`?(0,D.jsx)(W,{b:X}):(0,D.jsx)(re,{t:X,bricks:P,overridden:h.overridden,runs:v.loops},X.name):e===`active`&&F?(0,D.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{R as activeRows,L as brickRows,U as brickSource,J as default,H as howItRuns,I as templateRows};
@@ -0,0 +1,71 @@
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}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,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}}(?:</?(?:${C})(?: +|$|/?>)|<(?:(?: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`*|(?=~)\1~*) *(?=\n|$)|$)/,g=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,v=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,y=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,b=u(y).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(),ee=u(y).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(),x=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,te=/^[^\n]+/,S=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,ne=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,S).replace(`title`,/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),re=u(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,v).getRegex(),C=`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`,w=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ie=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`,w).replace(`tag`,C).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae=e=>u(x).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`,C).getRegex(),oe=ae(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),se=ae(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),T={blockquote:u(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace(`paragraph`,se).getRegex(),code:m,def:ne,fences:h,heading:_,hr:g,html:ie,lheading:b,list:re,newline:p,paragraph:oe,table:c,text:te},ce=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`,C).getRegex(),le={...T,lheading:ee,table:ce,paragraph:u(x).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ce).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`,C).getRegex()},ue={...T,html:u(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace(`comment`,w).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(x).replace(`hr`,g).replace(`heading`,` *#{1,6} *[^
2
+ ]`).replace(`lheading`,b).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},de=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,E=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,pe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D=/[\p{P}\p{S}]/u,O=/[\s\p{P}\p{S}]/u,k=/[^\s\p{P}\p{S}]/u,me=u(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,O).getRegex(),he=/[\p{Pi}\p{Ps}"']/u,ge=/(?!~)[\p{P}\p{S}]/u,_e=/(?!~)[\s\p{P}\p{S}]/u,ve=/(?:[^\s\p{P}\p{S}]|~)/u,ye=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(),be=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,xe=u(be,`u`).replace(/punct/g,D).getRegex(),Se=u(be,`u`).replace(/punct/g,ge).getRegex(),Ce=u(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,he).replace(/punct/g,D).getRegex(),we=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Te=u(we,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Ee=u(we,`gu`).replace(/notPunctSpace/g,ve).replace(/punctSpace/g,_e).replace(/punct/g,ge).getRegex(),De=u(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Oe=u(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),ke=u(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Ae=u(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,D).getRegex(),je=u(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Me=u(/\\(punct)/,`gu`).replace(/punct/g,D).getRegex(),Ne=u(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,D).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(w).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(),Le=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,A=u(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Le).getRegex(),Re=u(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,A).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),ze=u(/^!?\[(label)\]\[(ref)\]/).replace(`label`,A).replace(`ref`,S).getRegex(),Be=u(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,S).getRegex(),Ve=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,He=u(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Le).getRegex(),Ue=u(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,u(/^!?\[(label)\]\[(ref)\]/).replace(`label`,He).replace(`ref`,Ve).getRegex()).replace(`nolink`,u(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ve).getRegex()).getRegex(),We=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ge=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(),j={_backpedal:c,anyPunctuation:Me,anyPunctuationOutsideCode:Ne,autolink:Pe,blockSkip:ye,br:E,code:fe,del:c,delLDelim:c,delRDelim:c,emStrongLDelim:xe,emStrongRDelimAst:Te,emStrongRDelimUnd:Oe,escape:de,link:Re,nolink:Be,punctuation:me,reflink:ze,reflinkSearch:Ue,tag:Ie,text:pe,url:c},Ke={...j,emStrongLDelim:Ce,emStrongRDelimAst:De,emStrongRDelimUnd:ke,link:u(/^!?\[(label)\]\((.*?)\)/).replace(`label`,A).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,A).getRegex()},M={...j,emStrongRDelimAst:Ee,emStrongLDelim:Se,delLDelim:Ae,delRDelim:je,url:u(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Ge).replace(`protocol`,We).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:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,We).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace(`wwwStart`,d?`(?<![^\\s*_~(])www\\.`:`www\\.`).getRegex()},qe={...M,br:u(E).replace(`{2,}`,`*`).getRegex(),text:u(M.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},N={normal:T,gfm:le,pedantic:ue},P={normal:j,gfm:M,breaks:qe,pedantic:Ke},Je={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Ye=e=>Je[e];function F(e,t){if(t){if(f.escapeTest.test(e))return e.replace(f.escapeReplace,Ye)}else if(f.escapeTestNoEncode.test(e))return e.replace(f.escapeReplaceNoEncode,Ye);return e}function Xe(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 I(e){try{e=encodeURI(e).replace(f.percentDecode,`%`)}catch{return null}return e}function Ze(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 L(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 R(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 z(e){return e.trim().replace(f.multipleSpaceGlobal,` `).toLowerCase().toUpperCase().toLowerCase()}function Qe(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}var B=new WeakMap;function V(e){let t={"*":-1,_:-1},n=-1,r=e.length;for(let i=0;i<r;i++){let a=e[i];if(a!==`*`&&a!==`_`&&a!==`~`)continue;let o=i===0?`
5
+ `:e[i-1],s=i+1;for(;s<r&&e[s]===a;)s++;o!==` `&&o!==` `&&o!==`
6
+ `&&o!==`\r`&&o!==`\f`&&(a===`~`?n=i:t[a]=i),i=s-1}return{maskedSrc:e,lastPossibleEmStrongCloserIndex:t,lastPossibleDelCloserIndex:n}}function $e(e,t){let n=V(t),r=B.get(e);r?r.push(n):B.set(e,[n])}function et(e){let t=B.get(e);t&&(t.pop(),t.length===0&&B.delete(e))}function tt(e,t,n){let r=B.get(e)?.at(-1);return r&&r.maskedSrc===t?r.lastPossibleEmStrongCloserIndex[n]:V(t).lastPossibleEmStrongCloserIndex[n]}function nt(e,t){let n=B.get(e)?.at(-1);return n&&n.maskedSrc===t?n.lastPossibleDelCloserIndex:V(t).lastPossibleDelCloserIndex}function H(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 rt(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 it(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
7
+ `).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(`
8
+ `)}function at(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 U=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]:R(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=it(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=L(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:L(t[0],`
9
+ `),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:L(t[0],`
10
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=L(t[0],`
11
+ `).split(`
12
+ `),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(`
13
+ `),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+H(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
14
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
15
+ ${s}`:s,r=r?`${r}
16
+ ${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`||u?.type===`table`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
17
+ `),o=t.raw+`
18
+ `+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(`
19
+ `).length:0,d=l?e.slice(0,-l):e;if(d.length>0&&(n=`${n}
20
+ ${d.join(`
21
+ `)}`),r=r.substring(0,r.length-t.text.length)+s.text,e=e.slice(d.length),e.length>0&&this.rules.other.blockquoteStart.test(e[0]))continue;break}if(u?.type===`list`){let t=u,a=t.raw+`
22
+ `+e.join(`
23
+ `),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(`
24
+ `).length:0;if(s>0){let t=e.slice(0,s).join(`
25
+ `);n=`${n}
26
+ ${t}`,r=`${r}
27
+ ${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(`
28
+ `,1)[0],d=t[1].length,f=this.options.pedantic?H(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>H(e,d)),p=e.split(`
29
+ `,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(`
30
+ `,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=>H(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+=`
31
+ `+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||o.test(f)||n.test(f))break;let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
32
+ ${p}`)?` ${l.replace(/^ {0,3}/,``)}`:p;a+=`
33
+ `+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=R(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])&&Qe(t[2],`()`)!==-1)return;let e=z(t[1]),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:L(t[0],`
34
+ `),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=Ze(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
35
+ `):[],a={type:`table`,raw:L(t[0],`
36
+ `),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(Ze(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:L(t[0],`
37
+ `),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)===`
38
+ `?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&&at(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=L(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Qe(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=L(t[0].slice(0,-1),`\\`);if((t[0].length-i.length)%2==0)return;let a=t[2],o=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(a);e&&(a=e[1],o=e[3])}else o=t[3]?t[3].slice(1,-1):``;return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(a=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a.slice(1):a.slice(1,-1)),rt(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,`$1`),title:o&&o.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&&at(e,n[1],r,this.rules))return;let i=t[z(n[2]||n[1])];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return rt(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);if(i!==`*`&&i!==`_`)return;let _=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,v=tt(this,t,i),y=t.length-e.length+n;if(v<y)return;t=t.slice(-1*e.length+n);let b=v-y;for(_.lastIndex=0;(r=_.exec(t))!==null&&!(r.index>b);){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,c=nt(this,t),l=t.length-e.length+n;if(c<l)return;t=t.slice(-1*e.length+n);let u=c-l;for(s.lastIndex=0;(r=s.exec(t))!==null&&!(r.index>u);){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]:Xe(t[0]),escaped:e}}}},W=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 U,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:N.normal,inline:P.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=P.pedantic):this.options.gfm&&(t.block=N.gfm,t.inline=this.options.breaks?P.breaks:P.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:P}}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,`
39
+ `),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+=`
40
+ `: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(`
41
+ `)?``:`
42
+ `)+i.raw,n.text+=`
43
+ `+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(`
44
+ `)?``:`
45
+ `)+i.raw,n.text+=`
46
+ `+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(`
47
+ `)?``:`
48
+ `)+i.raw,r.text+=`
49
+ `+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(`
50
+ `)?``:`
51
+ `)+i.raw,n.text+=`
52
+ `+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,z(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!==U.prototype.emStrong||this.tokenizer.del!==U.prototype.del?this.#n(e):e;$e(this.tokenizer,n);try{return this.#t(e,n,t)}finally{et(this.tokenizer)}}#t(e,t,n){let 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(t=>(o=t.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.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),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let t=n.at(-1);o.type===`text`&&t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o);continue}if((o=this.tokenizer.emStrong(e,t,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,t,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.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 t=n.at(-1);t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#n(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,z(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)}},G=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,``)+`
53
+ `:``;return r?`<pre><code class="language-`+F(r)+`">`+(n?i:F(i,!0))+`</code></pre>
54
+ `:`<pre><code>`+(n?i:F(i,!0))+`</code></pre>
55
+ `}blockquote({tokens:e}){return`<blockquote>
56
+ ${this.parser.parse(e)}</blockquote>
57
+ `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
58
+ `}hr(e){return`<hr>
59
+ `}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+`>
60
+ `+r+`</`+i+`>
61
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
62
+ `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
63
+ `}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>
64
+ <thead>
65
+ `+t+`</thead>
66
+ `+r+`</table>
67
+ `}tablerow({text:e}){return`<tr>
68
+ ${e}</tr>
69
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
70
+ `}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>${F(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?F(n,!0):this.parser.parseInline(r),o=I(e);if(o===null)return a;e=F(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+F(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=I(e);if(i===null)return F(n);e=i;let a=`<img src="${F(e)}" alt="${F(n)}"`;return t&&(a+=` title="${F(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:F(e.text)}},K=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}},q=class e{options;renderer;textRenderer;constructor(e){this.options=e||o,this.options.renderer=this.options.renderer||new G,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new K,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}},J=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?W.lex:W.lexInline}provideParser(e=this.block){return e?q.parse:q.parseInline}};function Y(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var X=new class{defaults=a();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=q;Renderer=G;TextRenderer=K;Lexer=W;Tokenizer=U;Hooks=J;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(Y(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)Y(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)Y(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;Y(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);Y(n,this.walkTokens(i,t))}):e.tokens&&Y(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};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 G(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===!1?``:n??``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new U(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 J;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]=J.passThroughHooks.has(n)?e=>{if(t.options.async&&J.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 Y(n,r.call(this,e)),t&&Y(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 W.lex(e,t??this.defaults)}parser(e,t){return q.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?W.lex:W.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?q.parse:q.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?W.lex:W.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?q.parse:q.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+=`
71
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+F(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Z(e,t){return X.parse(e,t)}Z.options=Z.setOptions=function(e){return X.setOptions(e),Z.defaults=X.defaults,s(Z.defaults),Z},Z.getDefaults=a,Z.defaults=o;function ot(...e){return X.use(...e),Z.defaults=X.defaults,s(Z.defaults),Z}Z.use=ot,Z.walkTokens=function(e,t){return X.walkTokens(e,t)},Z.parseInline=X.parseInline,Z.Parser=q,Z.parser=q.parse,Z.Renderer=G,Z.TextRenderer=K,Z.Lexer=W,Z.lexer=W.lex,Z.Tokenizer=U,Z.Hooks=J,Z.parse=Z,Z.options,Z.setOptions,Z.walkTokens,Z.parseInline,q.parse,W.lex;var st=e({default:()=>ht,renderMarkdown:()=>$,sanitizeHtml:()=>Q}),ct=r(),lt=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`]),ut=new Set([`href`,`src`,`xlink:href`,`action`,`formaction`,`poster`,`background`]),dt=new Set([`http`,`https`,`mailto`]);function ft(e){let t=/^([a-z][a-z0-9+.-]*):/.exec(e.replace(/[\u0000- ]/g,``).toLowerCase());return!t||dt.has(t[1])}function Q(e){for(let t=0;t<4;t++){let t=pt(e);if(t===e)return t;e=t}return``}function pt(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`*`).forEach(e=>{if(lt.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`||ut.has(r)&&!ft(n))&&e.removeAttribute(t)}}),t.innerHTML}function $(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 Q(Z.parse(r,{breaks:!1}))}var mt=[];function ht({body:e,links:t=mt}){let n=(0,i.useMemo)(()=>$(e,t),[e,t]);return(0,ct.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:n}})}export{Z as a,Q as i,st as n,$ as r,ht as t};
@@ -0,0 +1 @@
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,vt as r}from"./index-BL3P-9Rg.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{n as o,r as s}from"./Dashboard-CIJLPHM9.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=a.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...a.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=n(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=r(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:a.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:i[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:i[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{H as i,Ot as a,W as o,Y as s,at as c,et as l,ht as u,kt as d,mt as f,nt as p,q as m,rt as h,tt as g,wt as _}from"./index-BL3P-9Rg.js";import{t as v}from"./Tabs-DJzAez4h.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Markdown-CxkA7940.js";import x,{installLabel as S}from"./Library-CzPlerd6.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=c(),[r,i]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),[l,u]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(o),g=(0,C.useRef)(!1),_=e=>{i(e),s(e)},v=()=>i(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=d(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),i(null),a(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:l,notice:f,setNotice:p,save:async(e,{conflict:n}={})=>{u(!0),p(``);try{return await e(m)||!0}catch(e){e.status===409?p(n??T):p(e.message);return}finally{u(!1),t()}}}}var D=n(),O=(e,t)=>`${e} ${t}${e===1?``:`s`}`,k=e=>`≈${e.toLocaleString(`en-US`)} tokens`,ee={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(M).some(N)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),A.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),j(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:k(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var F=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function I({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ie({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(I,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${F(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:F(e,r)},r))}):null]})]},e.key??r))})]}):null}function L({onChanged:e,dataRev:t,onAction:n}){let i=c(),{targets:a,sets:o,failed:s,reason:d,reload:h}=m(r.rules,t),[_,v]=(0,C.useState)(null),b=E({data:null,reload:h}),{draft:x,busy:S,notice:w}=b,[T,A]=(0,C.useState)(``),[M,N]=(0,C.useState)(null),F=(0,C.useRef)(null),[I,L]=(0,C.useState)(0),R=e=>{F.current=e,L(e=>e+1)},z=(0,C.useRef)(null),B=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=F.current;if(F.current=null,e===null)return;let t=[...B.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?z.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[I]),o&&!o.length&&d)return(0,D.jsx)(l,{error:d,onRetry:h});if(!o)return(0,D.jsx)(g,{});let V=a.length>1,H=e=>e?.id??``,U=e=>e?.shared?`shared`:f(e),W=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${H(e)}#${t.id}`}))),G=o.filter(e=>e.data.exists).map(e=>e.inst),K=G.length>0,q=x?.target,J=q!==void 0&&q!==`new`&&!W.some(e=>e.key===q&&e.title===x.title0),Y=q===`new`||J,X=x?.to!==void 0&&!G.some(e=>H(e)===x.to),Z=X?null:G.find(e=>H(e)===x?.to)??G[0]??null,ae=X?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):G.length>1?(0,D.jsx)(p,{installs:G,value:Z,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:U}):V&&Z?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:U(Z)})]}):null,Q=async(t,n,i)=>{let a=o.find(e=>H(e.inst)===H(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},u(n)),{conflict:i?te:ne});return s&&i&&b.close(),e?.(),s},$=e=>b.setDraft({...x,form:e}),oe=async(e,t,n)=>{await Q(e,t,!0)&&R(n)},se=async e=>{await b.discard()&&R(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${V?` from ${U(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Q({op:`delete`,id:e.id},e.inst)&&x===null&&R(`add`)},le=async e=>{await Q({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&R(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){A(t.key),N(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},u(t.inst));N({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{A(``),h(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>V?`${U(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!J&&q===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,onCancel:()=>se(e.key),onSave:t=>oe({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:V?U(e.inst):null,usual:ge(e.inst),isOpen:_===e.key,onToggle:()=>v(_===e.key?null:e.key),onEdit:()=>{v(e.key),b.open({target:e.key,no:e.id,to:H(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),K&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:z,onClick:()=>b.open({target:`new`,title0:``,form:ee}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?f(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),M?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,M.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,M.cleared.length?` Cleared: ${M.cleared.join(`, `)}.`:``,` `,M.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ie,{drafts:me,deciding:T,onDecide:de}),Y&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),J?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,writeTo:ae,onCancel:()=>se(`add`),onSave:e=>!X&&G.length&&oe({op:`add`,...e},Z,`add`)})]}),K?W.length===0&&!Y?(0,D.jsx)(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:B,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":V?U(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[V?(0,D.jsx)(`b`,{className:`mono`,children:U(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[O(t.rules.length,`rule`),` · `,k(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:W.filter(t=>t.inst===e).map(_e)}):null]},H(e)))}):(0,D.jsxs)(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 R=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,z=e=>e?.id??``;function B({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=m(r.profile,t);if(!i)return(0,D.jsx)(g,{});let o=new Set(a.map(z)),s=new Set([...i.map(e=>z(e.inst)),...o]),c=n.filter(e=>s.has(z(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(z(e))?`shared`: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)(V,{install:t,tag:n,onChanged:e},z(t)))]})}function V({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:s,setData:c}=_(()=>r.profile(u(e)),[]),d=E({data:i,reload:s}),{draft:f,dirty:p,busy:m,notice:v}=d,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||d.open(i.text||``)),o&&!i)return(0,D.jsx)(g,{});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)(l,{error:a,onRetry:s})]});let w=f!==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)(h,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:d.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||d.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!p||m,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:f,fingerprint:t},u(e)),{conflict:R});t&&(c(e=>({...e,text:f,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:m?`Saving…`:`Save`})]})]}),v?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:v}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:f,onChange:e=>d.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(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)(b,{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 H=(e,t)=>`${e} ${t}${e===1?``:`s`}`,U=e=>e?(e.items||[]).length:null,W=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,G=e=>String(e||``).split(`
2
+ `).map(e=>W.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function K({topics:e,install:t,shared:n}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:H(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:H(e.n,`fact`)})]},e.topic))})]}):null}var q={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function J({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:a,onAction:c}){let l=e=>Promise.resolve(e).catch(()=>null),u=s(n),{reload:d}=o(n),{data:f,error:p,reload:m}=_(()=>r.profile(),[n]),{data:h,reload:g}=_(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:b}=_(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),S=U(h),{data:C}=_(()=>e===`memory`?l(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,S]),w=U(b),T={memory:S,notebook:w},E={profile:p?`read failed`:f?.seeded?`template`:null,memory:S,notebook:w},O=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`+(u?.some(e=>e.shared)?` Global installs share one copy of the rules, profile and memory; a project install keeps its own.`:``)}),(0,D.jsx)(v,{page:`personal`,current:e,badges:E,label:`Personal files`}),e===`rules`&&(0,D.jsx)(L,{onChanged:d,dataRev:n,onAction:c}),e===`profile`&&(0,D.jsx)(B,{onChanged:m,dataRev:n}),O&&T[e]===0&&!t?(0,D.jsx)(y,{title:q[e].title,action:q[e].action,children:q[e].body}):O?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(K,{topics:G(C?.body),install:C?.install,shared:C?.shared}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onCountsChanged:a,onRulesChanged:()=>{d(),g()}},e)]}):null]})}export{J as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{H as r,St as i,Tt as a,_t as o,at as s,et as c,pt as l}from"./index-BL3P-9Rg.js";import{t as u}from"./api-DLDVY3K-.js";import{i as d}from"./motion-RlUl1osO.js";var f=e(t(),1),p=n();function m(){let e=s(),[t,n]=(0,f.useState)(!1),[r,i]=(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)(c,{error:r}),(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`})){i(null);try{await u.shutdown()}catch(e){if(e.status)return i(e.message)}n(!0)}},children:[(0,p.jsx)(o,{name:`x`}),`Stop server`]})]})}function h(){let e=s(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{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 a()}catch(e){i(e.message),n(!1)}}},disabled:t,children:[(0,p.jsx)(o,{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:d()?`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),[r,i]=(0,f.useState)(!0);(0,f.useEffect)(()=>{Promise.resolve(u.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),i(!!e.repo_is_github))}).catch(()=>{})},[]);let a=(e,t)=>(0,p.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,p.jsx)(o,{name:`external`})]});return(0,p.jsxs)(x,{id:`about`,title:`About`,children:[(0,p.jsx)(b,{k:`Version`,control:r?a(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,p.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),r?(0,p.jsx)(b,{k:`Credits`,control:a(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)(o,{name:`github`}),r?`Source on GitHub`:`Source repo`]}),r&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`external`}),`Issues`]}),(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{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)(o,{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.`]})})]})}var w={absent:`Off`,ours:`On · written by Geneseed`,stale:`On · points at another copy or Node`,hand:`On · set up by hand`};function T({initial:e}){let t=s(),[n,r]=(0,f.useState)(void 0),[i,a]=(0,f.useState)(null),[o,l]=(0,f.useState)(!1),d=n===void 0?e:n,m=async e=>{let n=e===`install`;if(await t(n?`Write ${d.file}? It starts the web console from ${d.root} at each login (hidden, no browser).`+(d.file.endsWith(`.plist`)?` It loads at your next login.`:``)+(d.transient?` Warning: that copy is an agent worktree or an npx cache, which can be deleted; the login item then fails.`:``):`Delete ${d.file}? The console no longer starts at login.`,n?{title:`Start at login?`,confirmLabel:d.state===`stale`?`Update`:`Write file`}:{title:`Stop starting at login?`,confirmLabel:`Delete file`,tone:`danger`})){l(!0),a(null);try{r((await u.autostart(e)).autostart)}catch(e){a(e.message),e.body?.autostart&&r(e.body.autostart)}finally{l(!1)}}},h=d?.state,g=h===`absent`||h===`stale`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>m(`install`),children:h===`stale`?`Update`:`Turn on`}):h===`ours`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>m(`remove`),children:`Remove`}):h===`hand`?(0,p.jsx)(`a`,{href:`#/docs/autostart`,children:`Install guide →`}):null;return(0,p.jsx)(b,{k:`Start at login`,help:d?d.file:d===null?`No login launcher on this system`:`A login launcher`,control:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:i}),g]}),children:(0,p.jsx)(`span`,{className:`sub`,children:d===null?`not available`:w[h]??`unknown`})})}function E({overview:e,onAction:t}){let n=s(),a=e?.server,c=e?.daemon_stale,[d,g]=(0,f.useState)(null);(0,f.useEffect)(()=>{Promise.resolve(u.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`;return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(r,{title:`Settings`,sub:`This copy of Geneseed and the local server.`}),(0,p.jsxs)(`div`,{className:`sheet`,children:[(0,p.jsx)(S,{stale:c}),(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:async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await u.installs();e=t.filter(e=>e.state===`active`).map(e=>`${l(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await n(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},children:[(0,p.jsx)(o,{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)(o,{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`,a?` · pid ${a.pid} · up ${i(a.started)}`:``]})]}),children:[(0,p.jsx)(b,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,p.jsx)(h,{}),children:c?(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)(T,{initial:a?.autostart}),(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{E as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Tt as n,wt as r}from"./index-How7SzDZ.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};
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Dt as n,Et as r}from"./index-BL3P-9Rg.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};