geneseed 4.31.0 → 4.32.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 (80) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/SHIPPED.md +1 -1
  3. package/adapters/opencode/plugins/geneseed-context.js +136 -1
  4. package/adapters/opencode/plugins/geneseed-guard.js +145 -2
  5. package/docs/concepts/exclusions.md +1 -1
  6. package/docs/concepts/hook-gates.md +1 -1
  7. package/docs/concepts/hooks.md +6 -4
  8. package/docs/concepts/host-matrix.md +1 -1
  9. package/docs/concepts/loop-bricks.md +1 -1
  10. package/docs/concepts/loop-notes.md +4 -2
  11. package/docs/concepts/loop-templates.md +7 -4
  12. package/docs/concepts/loops.md +3 -0
  13. package/docs/concepts/ownership.md +1 -1
  14. package/docs/guides/run-a-loop.md +1 -1
  15. package/docs/guides/set-up-ownership.md +1 -1
  16. package/docs/reference/loop-actions.md +1 -1
  17. package/docs/reference/plugin-context.md +4 -0
  18. package/docs/reference/plugin-guard.md +1 -1
  19. package/docs/understand/enforced-vs-asked.md +3 -2
  20. package/docs/understand/machine-bob.md +1 -1
  21. package/docs/web-ui.md +15 -5
  22. package/harness.config.json +1 -1
  23. package/js/hosts/hooks-context.mjs +22 -1
  24. package/js/hosts/hooks-done.mjs +97 -31
  25. package/js/hosts/hooks-prims.mjs +65 -0
  26. package/js/hosts/hooks.mjs +188 -27
  27. package/js/loop/state.mjs +15 -5
  28. package/js/web/actions.mjs +4 -4
  29. package/js/web/api.mjs +2 -2
  30. package/package.json +1 -1
  31. package/src/agents/_template.md +3 -0
  32. package/src/agents/developer.md +5 -2
  33. package/src/agents/tester.md +4 -1
  34. package/src/bricks/apply.md +3 -0
  35. package/src/bricks/test.md +6 -4
  36. package/src/loops/bugfix.json +11 -5
  37. package/src/loops/feature.json +7 -4
  38. package/src/skills/loop.md +1 -0
  39. package/src/skills/ship.md +9 -1
  40. package/web/dist/assets/{Activity-B7cFtS00.js → Activity-Bjy64wHC.js} +1 -1
  41. package/web/dist/assets/{ActivityDetail-C-GbMmuW.js → ActivityDetail-B0AaipP8.js} +1 -1
  42. package/web/dist/assets/{Bonsai-_YyexVC5.js → Bonsai-CJniRqaH.js} +1 -1
  43. package/web/dist/assets/{CopyButton-IXnXzH4Y.js → CopyButton-C5Li6awl.js} +1 -1
  44. package/web/dist/assets/Dashboard-B-6DTmae.js +2 -0
  45. package/web/dist/assets/{DataTable-BWbUx4bY.js → DataTable-b9zTShqJ.js} +1 -1
  46. package/web/dist/assets/{Docs-w3Y7M5Ts.js → Docs-LRc30XL9.js} +1 -1
  47. package/web/dist/assets/{EmptyState-1sPNleqv.js → EmptyState-CY5Pm2xy.js} +1 -1
  48. package/web/dist/assets/FilterInput-qGKNSlxv.js +1 -0
  49. package/web/dist/assets/{GreenhouseView-BWWbMKmg.js → GreenhouseView-CcoYlaWo.js} +1 -1
  50. package/web/dist/assets/Installs-dp1epTcE.js +3 -0
  51. package/web/dist/assets/JournalView-nFP4poCf.js +1 -0
  52. package/web/dist/assets/{KitApply-CQQbnThf.js → KitApply-DwyZUj57.js} +1 -1
  53. package/web/dist/assets/{Kits-aj07N7mT.js → Kits-C0IEdZXe.js} +1 -1
  54. package/web/dist/assets/Laws-CkykmQWu.js +3 -0
  55. package/web/dist/assets/Library-Guh9HBZU.js +2 -0
  56. package/web/dist/assets/{Loops-C5u7fQOR.js → Loops-CzitjxGV.js} +1 -1
  57. package/web/dist/assets/Markdown-C4S4tTA7.js +69 -0
  58. package/web/dist/assets/{OperatorHudView-Blu1lqiZ.js → OperatorHudView-DLGNulIY.js} +1 -1
  59. package/web/dist/assets/{Personal-ox_MktWO.js → Personal-BMtberL8.js} +1 -1
  60. package/web/dist/assets/RailCats-D5weYPCS.js +1 -0
  61. package/web/dist/assets/{Tabs-CIPyMAX-.js → Tabs-uYJqfuQt.js} +1 -1
  62. package/web/dist/assets/index-DA7BiaE5.js +3 -0
  63. package/web/dist/assets/index-dbbDGFDq.css +1 -0
  64. package/web/dist/assets/{motion-CXaUMNkg.js → motion-Bccx3zE8.js} +1 -1
  65. package/web/dist/assets/react-C1iE8mnY.js +9 -0
  66. package/web/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  67. package/web/dist/assets/{usePoll-bDFN-Hr6.js → usePoll-o8ul-Sog.js} +1 -1
  68. package/web/dist/index.html +5 -5
  69. package/web/dist/assets/Dashboard-sCfEjowQ.js +0 -2
  70. package/web/dist/assets/FilterInput-CZREvrjX.js +0 -1
  71. package/web/dist/assets/Installs-CnkdJ-VA.js +0 -3
  72. package/web/dist/assets/JournalView-C7bPD3fZ.js +0 -1
  73. package/web/dist/assets/Laws-DZ38nl_H.js +0 -3
  74. package/web/dist/assets/Library-QCGXPV5h.js +0 -2
  75. package/web/dist/assets/Markdown-DpmmtW2Y.js +0 -65
  76. package/web/dist/assets/RailCats-BuJD4Jou.js +0 -1
  77. package/web/dist/assets/index-0GCxkY7m.css +0 -1
  78. package/web/dist/assets/index-CzDi9JpF.js +0 -3
  79. package/web/dist/assets/react-DlYQp10C.js +0 -9
  80. package/web/dist/assets/rolldown-runtime-hePW80VL.js +0 -1
@@ -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-BxjLd7Qd.js";import{i}from"./motion-Bccx3zE8.js";import{n as a,t as o}from"./sections-ChwaobfW.js";import{$ as s,Dt as ee,J as te,Q as ne,V as re,_t as ie,b as c,bt as l,pt as ae,rt as u,x as d}from"./index-DA7BiaE5.js";import{t as f}from"./EmptyState-CY5Pm2xy.js";import{a as oe,c as se,i as ce,o as le,r as ue,s as de,t as fe}from"./RailCats-D5weYPCS.js";import{t as pe}from"./Markdown-C4S4tTA7.js";var p=e(t(),1),m=n();function me({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,m.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function h({entries:e}){return e.length?(0,m.jsxs)(`table`,{className:`mf-entries`,children:[(0,m.jsx)(`thead`,{className:`sr-only`,children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{scope:`col`,children:`Path`}),(0,m.jsx)(`th`,{scope:`col`,children:`Load`}),(0,m.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,m.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,m.jsx)(`td`,{className:`mf-load-cell`,children:(0,m.jsx)(me,{load:e.load})}),(0,m.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function g({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,m.jsxs)(`div`,{className:`mf-vault`,children:[(0,m.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,m.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,m.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,m.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,m.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,m.jsxs)(`span`,{className:`mf-role`,children:[(0,m.jsx)(u,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,m.jsxs)(`span`,{className:`mf-role`,children:[(0,m.jsx)(u,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,m.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,m.jsx)(u,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,m.jsx)(h,{entries:t})]})}function _({body:e}){let[t,n]=(0,p.useState)(!1),r=(0,p.useId)();return e?(0,m.jsxs)(`div`,{className:`mf-raw`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,m.jsx)(u,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,m.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function he({manifest:e,body:t,name:n}){if(!e)return(0,m.jsx)(`pre`,{className:`mf-raw-pre`,children:(t||``).replace(/^```json\n|\n```$/g,``)});if(e.kind===`wiki`){let n=e.wikis||[];return n.length?(0,m.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,m.jsx)(g,{wiki:e},e.name||t)),(0,m.jsx)(_,{body:t})]}):(0,m.jsxs)(`div`,{className:`mf-empty`,children:[(0,m.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,m.jsxs)(`p`,{children:[`A wiki is your machine-wide knowledge base — an Obsidian vault or any folder of linked markdown the agent reads from and writes back to. Declare one in`,` `,(0,m.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,m.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,m.jsx)(_,{body:t})]})}let r=e.context||[];return r.length?(0,m.jsxs)(`div`,{className:`mf-doc`,children:[(0,m.jsx)(h,{entries:r}),(0,m.jsx)(_,{body:t})]}):(0,m.jsxs)(`div`,{className:`mf-empty`,children:[(0,m.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,m.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,m.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,m.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,m.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,m.jsx)(_,{body:t})]})}var v={fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ge={advocate:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M16 50h14M23 50V14`}),(0,m.jsx)(`path`,{className:`ag-wave ag-f`,d:`M23 15h20l-5 7.5 5 7.5H23z`}),(0,m.jsx)(`path`,{className:`ag-call`,d:`M47 38a6 6 0 0 1 0 8M51 35a11 11 0 0 1 0 14`})]}),architect:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{x:`14`,y:`14`,width:`36`,height:`32`,rx:`2`,opacity:`.3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M20 40V22h12v9h12v9z`}),(0,m.jsx)(`path`,{className:`ag-draw ag-late`,pathLength:`100`,d:`M32 31v9`}),(0,m.jsx)(`path`,{d:`M14 52h36M14 50v4M50 50v4`,opacity:`.5`})]}),developer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-f`,x:`10`,y:`14`,width:`44`,height:`36`,rx:`4`}),(0,m.jsx)(`path`,{d:`M10 22h44`,opacity:`.5`}),(0,m.jsx)(`circle`,{cx:`15`,cy:`18`,r:`1`}),(0,m.jsx)(`circle`,{cx:`19`,cy:`18`,r:`1`}),(0,m.jsx)(`path`,{className:`ag-nudge-l`,d:`M24 30l-6 6 6 6`}),(0,m.jsx)(`path`,{className:`ag-nudge-r`,d:`M40 30l6 6-6 6`}),(0,m.jsx)(`path`,{className:`ag-blink`,d:`M30 42h5`})]}),"devops-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M32 32c-5-9-18-9-18 0s13 9 18 0c5-9 18-9 18 0s-13 9-18 0z`,opacity:`.3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M32 32c-5-9-18-9-18 0s13 9 18 0c5-9 18-9 18 0s-13 9-18 0z`}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`3`})]}),"docker-expert":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`14`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`27`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`40`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`20`,y:`25`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`34`,y:`25`,width:`10`,height:`9`}),(0,m.jsx)(`path`,{d:`M8 52c5 0 5-3 10-3s5 3 10 3 5-3 10-3 5 3 10 3 5-3 10-3`,opacity:`.5`})]}),docs:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M16 10h22l8 8v36H16z`}),(0,m.jsx)(`path`,{d:`M38 10v8h8`,opacity:`.5`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M21 26h18`}),(0,m.jsx)(`path`,{className:`ag-draw ag-late`,pathLength:`100`,d:`M21 33h18`}),(0,m.jsx)(`path`,{className:`ag-draw ag-later`,pathLength:`100`,d:`M21 40h11`}),(0,m.jsx)(`g`,{className:`ag-write`,children:(0,m.jsx)(`path`,{d:`M40 44l12-20 3 2-12 20-4 1z`})})]}),empiricist:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 12v40h40`,opacity:`.5`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`18`,y:`36`,width:`6`,height:`14`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`29`,y:`28`,width:`6`,height:`22`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`40`,y:`20`,width:`6`,height:`30`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M16 34l12-8 10 3 12-14`})]}),explorer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`18`,opacity:`.5`}),(0,m.jsx)(`path`,{d:`M32 10v4M32 50v4M10 32h4M50 32h4`}),(0,m.jsxs)(`g`,{className:`ag-search`,children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 18l5 14h-10z`}),(0,m.jsx)(`path`,{d:`M32 18l5 14-5 14-5-14z`})]}),(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`2`})]}),framer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`g`,{className:`ag-frame`,children:(0,m.jsx)(`path`,{d:`M12 22V12h10M42 12h10v10M52 42v10H42M22 52H12V42`})}),(0,m.jsx)(`circle`,{className:`ag-pulse`,cx:`32`,cy:`32`,r:`7`,opacity:`.6`}),(0,m.jsx)(`path`,{d:`M32 22v6M32 36v6M22 32h6M36 32h6`,opacity:`.6`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`1.5`})]}),historian:(0,m.jsxs)(`g`,{className:`ag-turn`,children:[(0,m.jsx)(`path`,{d:`M20 12h24M20 52h24`}),(0,m.jsx)(`path`,{d:`M22 12c0 12 20 12 20 20s-20 8-20 20M42 12c0 12-20 12-20 20s20 8 20 20`}),(0,m.jsx)(`path`,{className:`ag-drain ag-f`,d:`M25 17h14c-1 6-5 9-7 11-2-2-6-5-7-11z`}),(0,m.jsx)(`path`,{className:`ag-fill ag-f`,d:`M24 49h16c-1-5-5-8-8-9-3 1-7 4-8 9z`})]}),operator:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 42a20 20 0 0 1 40 0`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M40 24a20 20 0 0 1 12 18`,strokeWidth:`4`,opacity:`.7`}),(0,m.jsx)(`path`,{d:`M16 30l3 2M32 22v4M48 30l-3 2`,opacity:`.6`}),(0,m.jsx)(`g`,{className:`ag-gauge`,children:(0,m.jsx)(`path`,{d:`M32 42l10-13`})}),(0,m.jsx)(`circle`,{cx:`32`,cy:`42`,r:`3`}),(0,m.jsx)(`path`,{d:`M22 50h20`,opacity:`.5`})]}),pragmatist:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M32 14v36M22 50h20`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`14`,r:`2`}),(0,m.jsxs)(`g`,{className:`ag-tilt`,children:[(0,m.jsx)(`path`,{d:`M14 18h36`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M14 18l-5 12h10zM50 18l-5 12h10z`})]})]}),"kubernetes-specialist":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`16`}),(0,m.jsx)(`path`,{d:`M32 8v13M32 43v13M8 32h13M43 32h13M15 15l9 9M40 40l9 9M49 15l-9 9M24 40l-9 9`,opacity:`.6`}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`5`})]}),"memory-curator":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`17`,y:`16`,width:`14`,height:`20`,rx:`1`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`25`,y:`12`,width:`14`,height:`24`,rx:`1`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`33`,y:`18`,width:`14`,height:`18`,rx:`1`}),(0,m.jsx)(`path`,{d:`M12 32h40v16a2 2 0 0 1-2 2H14a2 2 0 0 1-2-2z`}),(0,m.jsx)(`path`,{d:`M26 40h12`,opacity:`.6`})]}),researcher:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`34`,r:`16`}),(0,m.jsx)(`path`,{d:`M14 34h32M30 18c-6 5-6 27 0 32`,opacity:`.5`}),(0,m.jsx)(`ellipse`,{className:`ag-spin`,cx:`30`,cy:`34`,rx:`7`,ry:`16`}),(0,m.jsx)(`g`,{className:`ag-orbit`,children:(0,m.jsx)(`circle`,{cx:`50`,cy:`14`,r:`3`})})]}),reviewer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 18h30M12 26h40M12 34h24M12 42h34`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-mark`,d:`M42 30l3 3 6-6`}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`22`,cy:`30`,r:`9`}),(0,m.jsx)(`path`,{d:`M29 37l8 8`,strokeWidth:`3`})]})]}),performance:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M26 10h8M30 10v6M44 18l3-3`}),(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`34`,r:`18`}),(0,m.jsx)(`path`,{d:`M30 19v3M45 34h-3M30 49v-3M15 34h3`,opacity:`.6`}),(0,m.jsx)(`g`,{className:`ag-orbit`,children:(0,m.jsx)(`path`,{d:`M30 34V22`})}),(0,m.jsx)(`circle`,{cx:`30`,cy:`34`,r:`2`})]}),security:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-ripple`,d:`M32 8l18 6v13c0 12-8 21-18 26-10-5-18-14-18-26V14z`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 8l18 6v13c0 12-8 21-18 26-10-5-18-14-18-26V14z`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M24 31l6 6 11-11`})]}),skeptic:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M12 14h40v28H30l-10 8v-8h-8z`}),(0,m.jsxs)(`g`,{className:`ag-lean`,children:[(0,m.jsx)(`path`,{d:`M27 23a5 5 0 1 1 7 4.5c-1.5.8-2 2-2 3.5v1`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`36`,r:`1.2`})]})]}),"spring-boot-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M22 20a16 16 0 1 0 20 0`}),(0,m.jsx)(`path`,{className:`ag-pulse`,d:`M32 12v18`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M32 50c0-8 5-12 13-12 0 8-5 12-13 12z`})]}),"spring-reviewer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 18h26M12 26h18M12 34h22M12 42h14`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M42 28c0-8 4-12 11-12 0 8-4 12-11 12z`}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`24`,cy:`32`,r:`9`}),(0,m.jsx)(`path`,{d:`M31 39l8 8`,strokeWidth:`3`})]})]}),"spring-security":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-ripple`,d:`M22 28v-6a10 10 0 0 1 20 0v6`}),(0,m.jsx)(`path`,{d:`M22 28v-6a10 10 0 0 1 20 0v6`}),(0,m.jsx)(`rect`,{className:`ag-f`,x:`16`,y:`28`,width:`32`,height:`24`,rx:`4`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`38`,r:`3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M32 41v6`})]}),"react-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`g`,{className:`ag-spin`,children:[(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`}),(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`,transform:`rotate(60 32 32)`}),(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`,transform:`rotate(120 32 32)`})]}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`4`})]}),"react-reviewer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`g`,{opacity:`.4`,children:[(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`}),(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`,transform:`rotate(60 30 30)`}),(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`,transform:`rotate(120 30 30)`})]}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`30`,r:`8`}),(0,m.jsx)(`path`,{d:`M36 36l9 9`,strokeWidth:`3`})]})]}),steward:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 52h40`,opacity:`.5`}),(0,m.jsx)(`path`,{d:`M22 52c2-3 6-4 10-4s8 1 10 4`,opacity:`.4`}),(0,m.jsxs)(`g`,{className:`ag-grow`,children:[(0,m.jsx)(`path`,{d:`M32 50V26`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M32 32c0-9 6-14 15-14 0 9-6 14-15 14z`}),(0,m.jsx)(`path`,{className:`ag-sway ag-late ag-f`,d:`M32 38c0-7-5-11-12-11 0 7 5 11 12 11z`})]})]}),tester:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M26 10h12M28 10v14L15 48a3 3 0 0 0 2.6 4.5h28.8A3 3 0 0 0 49 48L36 24V10`}),(0,m.jsx)(`path`,{className:`ag-f ag-slosh`,d:`M20 40h24l4.5 8.5H15.5z`}),(0,m.jsx)(`circle`,{className:`ag-bubble`,cx:`28`,cy:`44`,r:`2`}),(0,m.jsx)(`circle`,{className:`ag-bubble ag-late`,cx:`35`,cy:`46`,r:`1.5`}),(0,m.jsx)(`circle`,{className:`ag-bubble ag-later`,cx:`31`,cy:`42`,r:`1`})]}),"user-advocate":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`24`,cy:`20`,r:`6`}),(0,m.jsx)(`path`,{d:`M12 50c0-9 5-15 12-15 4 0 7 1.5 9 4`}),(0,m.jsx)(`path`,{className:`ag-beat ag-f`,d:`M44 52s-10-6-10-12.5a5 5 0 0 1 10-1.5 5 5 0 0 1 10 1.5C54 46 44 52 44 52z`}),(0,m.jsx)(`path`,{className:`ag-twinkle`,d:`M48 22v4M46 24h4`})]}),visionary:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`g`,{className:`ag-rays`,opacity:`.5`,children:(0,m.jsx)(`path`,{d:`M32 6v6M32 52v6M6 32h6M52 32h6M13.6 13.6l4.2 4.2M46.2 46.2l4.2 4.2M13.6 50.4l4.2-4.2M46.2 17.8l4.2-4.2`})}),(0,m.jsx)(`path`,{className:`ag-f ag-pulse`,d:`M32 16l4.7 10.4 11.3 1.2-8.5 7.6 2.4 11.1L32 40.6l-9.9 5.7 2.4-11.1-8.5-7.6 11.3-1.2z`}),(0,m.jsx)(`path`,{className:`ag-twinkle`,d:`M50 8v6M47 11h6`})]})},y=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 12l17 10v20L32 52 15 42V22z`}),(0,m.jsx)(`circle`,{className:`ag-pulse`,cx:`32`,cy:`32`,r:`6`})]});function _e({name:e,size:t=64}){return(0,m.jsxs)(`svg`,{className:`agent-glyph`,viewBox:`0 0 64 64`,width:t,height:t,"aria-hidden":`true`,...v,children:[(0,m.jsx)(`circle`,{className:`ag-disc`,cx:`32`,cy:`32`,r:`31`}),(0,m.jsx)(`circle`,{className:`ag-ring`,cx:`32`,cy:`32`,r:`31`,strokeWidth:`1`,strokeDasharray:`2 7`}),ge[e]||y]})}function b({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,m.jsxs)(`div`,{className:`stat`,children:[(0,m.jsx)(`div`,{className:`stat-label`,children:e}),(0,m.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,m.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var ve={skills:`skill`,agents:`agent`},x=[`skills`,`agents`,`memory`,`notebook`],ye=new Set([`MEMORY`,`NOTEBOOK`,`README`]),be=e=>e.filter(e=>!ye.has(String(e.name).toUpperCase())).length,xe=(e,t)=>`${t?e/t*100:0}%`,S=e=>e.split(`:`).slice(0,2).join(` `),C=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},w=e=>ie(C(e)),Se=e=>({"--cc":`var(--cat-${e*2%7})`});function Ce(e,t){return e===`memory`?`memory/${t}`:e===`notebook`?`notebook/${t}`:e===`wiki`?`geneseed-wiki.jsonc`:e===`config`?t:e===`skills`?`skills/${t}/SKILL.md`:`${e}/${t}.md`}function we({section:e,source:t}){return(0,m.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,m.jsx)(u,{name:a[e].icon,className:`glyph`}),(0,m.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,m.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var Te=e=>e.replace(/\s+/g,` `).trim(),T=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Ee(e,t){let n=e.replace(/\r\n/g,`
2
+ `),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=T(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?Te(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?Te(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=T(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function De({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,m.jsx)(`div`,{className:`lib-stats`,children:(0,m.jsx)(b,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(S))].join(`, `),i=t.days_counted>=30?`in the last 30 days`:`since ${t.since}`,a=Math.max(1,...e.per_day),o=[e.last?`last used ${e.last}`:null,i,r?`on ${r}`:null].filter(Boolean).join(` · `);return(0,m.jsx)(`div`,{className:`lib-stats`,children:(0,m.jsx)(b,{label:`Used`,value:e.n,delta:o,children:(0,m.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,m.jsx)(`i`,{className:t===29?`today`:``,style:{height:xe(e,a)}},t))})})})}function Oe(e){let t=/\s*\bUse when:\s*/i.exec(e||``);if(!t)return{lede:e||``,when:``};let n=e.slice(t.index+t[0].length).trim();return{lede:e.slice(0,t.index).trim(),when:n&&n[0].toUpperCase()+n.slice(1)}}var ke={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},Ae=(e,t)=>t||(e&&o.includes(e)?e:o[0]),je=encodeURIComponent;function Me(e){let t=e=>c[e.klass]?e.klass:`personal`,n=d.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:c[n].label,groupC:c[n].c})));return{rows:n,cats:d.map(e=>({key:e,label:c[e].label,c:c[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ne(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function E({overview:e,section:t,selected:n,dataRev:i,lock:u,base:d,onRulesChanged:me}){let h=s(),[g,_]=(0,p.useState)(()=>Ae(t,u)),[v,ge]=(0,p.useState)(``),[y,b]=(0,p.useState)(`all`),[ye,S]=(0,p.useState)(`all`),[Te,T]=(0,p.useState)(``),[E,Pe]=(0,p.useState)(null),[D,Fe]=(0,p.useState)(null),[Ie,Le]=(0,p.useState)(t);if(t!==Ie){Le(t),T(``);let e=Ae(t,u);e!==g&&(_(e),ge(``),b(`all`),S(`all`))}let[Re,ze]=(0,p.useState)(n);n!==Re&&(ze(n),T(``));let{data:O,error:Be,reload:Ve}=l(()=>r.catalog(g),[g,i],`catalog`),He=u?null:ve[g]||null,Ue=He!==null||g===`memory`||g===`notebook`,{data:We}=l(()=>u?Promise.resolve(null):Promise.all(x.map(e=>r.catalog(e))).catch(()=>null),[u,i]),k=He!==null,{data:A}=l(()=>k?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[k,i],`usage`,{revalidate:!0}),j=k&&!!A?.enabled&&Array.isArray(A.names),Ge=(0,p.useMemo)(()=>new Map((Array.isArray(A?.names)?A.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[A]),M=e=>j&&Ge.get(`${He}\u0000${e}`)||null,Ke=e=>{let t=M(e.name);return!t||t.n===0&&!t.last},qe=A?.since?`No call since ${A.since}`:`No call recorded yet`,N=O?.section===g&&O?.items||[],P=g===`skills`,Je=P?Me(N):null,F=P?Je.rows:g===`memory`?Ne(N):N,I=n||F[0]?.name||null,L=I?N.find(e=>e.name===I):null,R=L?.type||a[g].type,z=D?.sec===g&&D?.name===I?D.key:null,{data:Ye,error:B}=l(()=>I?z?r.item(R,I,C(z)):r.item(R,I):Promise.resolve(null),[g,I,R,z,i]),V=B?null:Ye,H=V&&V.name===I&&(!z||V.install===z)?V:null,Xe=e=>G&&e?.install?` in ${w(e.install)}`:``,Ze=Te||Be||B,Qe=I?{name:I,title:V?.title||I,desc:V?.desc||``}:null,U=L||Qe,$e=e?.counts||{},et=e=>{if(!x.includes(e))return $e[e]??``;if(e===g&&O?.section===g)return be(N);let t=We?.find(t=>t?.section===e)?.items;return t?be(t):``},W=ae(i),tt=W?.length>1?`of ${ie(W[0])}`:null,G=Ue&&new Set(N.flatMap(e=>e.installs||[])).size>1,nt=[...new Set([...(W||[]).map(e=>e.id),...N.flatMap(e=>e.installs||[])])],K=P?F.filter(e=>y===`all`||e.cat===y):F,rt=j?K.filter(Ke).length:0,it=e=>e.status===`experimental`,at=K.filter(it).length,q=[[`all`,`All`,K.length],...j?[[`used`,`Used`,K.length-rt],[`unused`,`Not used yet`,rt,qe]]:[],...at?[[`experimental`,`Experimental`,at,`Shipped, not yet confirmed by real use`]]:[]],J=q.some(([e])=>e===ye)?ye:`all`,Y=J===`all`?K:J===`experimental`?K.filter(it):K.filter(e=>Ke(e)===(J===`unused`)),ot=j?Math.max(0,...N.map(e=>M(e.name)?.n||0)):0,st=P?1/0:50,X=v.trim().toLowerCase(),Z=X?le(Y,X):Y.slice(0,st),ct=!X&&y===`all`&&J===`all`&&I&&!Z.some(e=>e.name===I)?[...Z,...F.filter(e=>e.name===I)]:Z,lt=e=>d?`${d}/${je(e.name)}`:`#/item/${e.type||a[g].type}/${je(e.name)}`,ut=async()=>{let e=H;if(!e)return;let t=e.name;if(await h(`Forget the memory fact "${t}"${Xe(e)}? It leaves the index and moves to memory/archive/ (geneseed memory rm --archived --purge deletes it for good).`,{title:`Forget this fact?`,confirmLabel:`Forget`,tone:`danger`})){T(``);try{await r.memoryDelete(t,e.install?C(e.install):void 0)}catch(e){T(`Could not forget "${t}": ${e.message}`);return}ee(d||`#/section/memory`),Ve()}},dt=async()=>{let e=H;if(!e)return;let t=e.name;if(await h(`Promote "${t}"${Xe(e)} into a standing rule? It is appended to user-rules.md as a trial rule (a month of probation), and the memory fact moves to memory/archive/ so the lesson isn't loaded twice.`,{title:`Promote to a rule?`,confirmLabel:`Promote`})){T(``);try{let n=e.install?C(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),re(),me?.(),ee(`#/personal/rules`)}catch(e){T(`Could not promote: ${e.message}`),Ve()}}},ft=V?.body?Ee(V.body,V.desc||U?.desc):null,pt=V?.title||U?.title||U?.name,mt=pt===U?.name&&ft?.title?ft.title:pt,ht=O?.section===g&&N.length===0,gt=V?.status||U?.status,_t=g===`skills`?c[L?.klass]:null,Q=a[g].label,{lede:vt,when:yt}=Oe(V?.desc||U?.desc||``),$=U?V?.source||U.source||(B?null:Ce(g,U.name)):null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(te,{error:Ze,style:{margin:`0 0 var(--sp-3)`}}),(0,m.jsxs)(`div`,{className:`library lib-dossier${u?` locked`:``}${j?` uses`:``}`,children:[u?null:(0,m.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,m.jsxs)(`div`,{className:`lib-title`,children:[(0,m.jsx)(`h1`,{className:`h`,children:`Library`}),(0,m.jsx)(`span`,{className:`dim`,children:`What the agent knows`})]}),(0,m.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,m.jsxs)(p.Fragment,{children:[(0,m.jsxs)(`a`,{href:`#/section/${e}`,className:g===e?`on`:``,"aria-current":g===e?`page`:void 0,children:[a[e].label,(0,m.jsx)(`span`,{className:`mono dim`,children:et(e)})]}),e===g&&P&&(0,m.jsx)(fe,{label:`Skill types`,total:N.length,cats:Je.cats,cat:y,onChange:b})]},e))})]}),(0,m.jsxs)(oe,{label:Q,count:X?`${Z.length} of ${Y.length}`:Y.length,q:v,onQ:ge,matched:Z.length,inView:[g,n],extra:(0,m.jsxs)(m.Fragment,{children:[j&&A.since?(0,m.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,A.since]}):!x.includes(g)&&g!==`laws`&&tt?(0,m.jsx)(`span`,{className:`mono dim lib-since`,children:tt}):null,(0,m.jsxs)(`span`,{className:`lib-legend mono`,children:[G?nt.map((e,t)=>(0,m.jsxs)(`span`,{className:`lk-install`,title:C(e).path,children:[(0,m.jsx)(`i`,{className:`lr-dot`,style:Se(t),"aria-hidden":`true`}),w(e)]},e)):null,(0,m.jsx)(se,{items:N})]})]}),tools:q.length>1?(0,m.jsx)(ne,{"aria-label":`Show`,children:q.map(([e,t,n,r])=>(0,m.jsxs)(`button`,{type:`button`,className:J===e?`on`:``,"aria-pressed":J===e,title:r,onClick:()=>S(e),children:[t,` `,(0,m.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[(0,m.jsx)(ue,{rows:ct,activeName:U?.name,hrefOf:lt,pills:j||G?e=>{let t=M(e.name)?.n||0,n=G?(0,m.jsx)(`span`,{className:`lr-dots`,children:nt.map((t,n)=>e.installs?.includes(t)?(0,m.jsx)(`span`,{className:`lr-dot lr-install`,style:Se(n),title:`${w(t)} — ${C(t).path}`,children:(0,m.jsx)(`span`,{className:`sr-only`,children:w(t)})},t):(0,m.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return j?(0,m.jsxs)(m.Fragment,{children:[n,(0,m.jsxs)(`span`,{className:`lr-use`,children:[(0,m.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,m.jsx)(`i`,{style:{width:xe(t,ot)}})}),(0,m.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,m.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!X&&N.length>st&&(0,m.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,st,` of `,N.length,`; type to search the rest.`]}),ht&&(g===`wiki`?(0,m.jsxs)(f,{title:`No wiki entries`,action:(0,m.jsx)(`a`,{href:`#/section/config`,children:`Open the setup files`}),docs:{href:`#/docs/wiki`,label:`How to configure a wiki →`},children:[`Declare a wiki in `,(0,m.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,m.jsx)(f,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,m.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`reader-tags`,children:[(0,m.jsx)(`span`,{className:`tag acc`,children:Q.replace(/s$/,``)}),_t?(0,m.jsx)(`span`,{className:`tag`,children:_t.label}):null,V?.kit??U.kit?(0,m.jsx)(ce,{name:V?.kit??U.kit}):null,(0,m.jsx)(de,{status:gt,withHint:!0}),$?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`mono dim reader-src`,children:$}),(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),Pe({src:$,ok:!0})}catch{Pe({src:$,ok:!1})}},children:E?.src===$?E.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,m.jsxs)(`div`,{className:`reader-head`,children:[(0,m.jsx)(`h2`,{className:`reader-title`,children:mt}),g===`agents`?(0,m.jsx)(_e,{name:U.name}):null]}),(0,m.jsxs)(`div`,{className:`reader-intro${j?` with-stats`:``}`,children:[(0,m.jsxs)(`div`,{className:`reader-intro-text`,children:[vt?(0,m.jsx)(`p`,{className:`reader-lede`,children:vt}):null,yt?(0,m.jsxs)(`section`,{className:`reader-when`,children:[(0,m.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,m.jsx)(`p`,{children:yt})]}):null]}),j?(0,m.jsx)(De,{u:M(U.name),usage:A,noCall:qe}):null]}),g===`memory`&&H&&U.name!==`MEMORY`&&U.name!==`README`&&(0,m.jsxs)(`div`,{className:`row gap-8`,children:[(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:dt,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:ut,children:`Forget this fact`})]}),V?.installs?.length>1&&V.installs.includes(V.install)?(0,m.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,m.jsx)(`span`,{className:`dim`,children:`Viewing copy from:`}),(0,m.jsx)(`select`,{className:`sel`,value:z||V.install,onChange:e=>Fe({sec:g,name:I,key:e.target.value}),children:V.installs.map(e=>(0,m.jsx)(`option`,{value:e,title:C(e).path,children:w(e)},e))}),(0,m.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,m.jsx)(`hr`,{className:`hr`}),B?(0,m.jsxs)(`p`,{className:`sub`,children:[`No `,Q.replace(/s$/,``).toLowerCase(),` named `,(0,m.jsx)(`em`,{children:U.name}),` could be read in this install.`]}):U?.kind===`manifest`||V?.manifest!==void 0?V?(0,m.jsx)(he,{manifest:V.manifest,body:V.body,name:U.name}):(0,m.jsx)(`p`,{className:`sub`,children:`Loading…`}):V?.body?(0,m.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,m.jsx)(pe,{body:ft.body,links:V.links||[]})}):V===null&&I?(0,m.jsx)(`p`,{className:`sub`,children:`Loading…`}):(0,m.jsx)(we,{section:g,source:Ce(g,U.name)}),ke[g]?(0,m.jsx)(`div`,{className:`reader-links`,children:(0,m.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${ke[g]}`,children:[`About `,Q.toLowerCase(),` in Docs`]})}):null]}):ht?null:(0,m.jsx)(f,{title:`Select an entry`,children:`Pick something from the list to read it.`})})]})]})}export{Ee as bodyHead,E as default,Ne as groupMemory,w as installLabel,C as installOfKey,Me as splitSkills,Oe as splitWhen};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BxjLd7Qd.js";import{Et as i,J as a,Tt as o,X as s,Y as c,bt as l,ft as u,pt as d,vt as f}from"./index-CzDi9JpF.js";import{t as p}from"./EmptyState-1sPNleqv.js";import{t as m}from"./usePoll-bDFN-Hr6.js";import{a as h,n as g,o as _,r as v,t as y}from"./RailCats-BuJD4Jou.js";import{t as b}from"./CopyButton-IXnXzH4Y.js";import{t as x}from"./Markdown-DpmmtW2Y.js";import{t as S}from"./DataTable-BWbUx4bY.js";var C=e(t(),1),w={x:260,y:190},T=110,E=28,D=14,O=44,k=e=>e*Math.PI/180,A=e=>Math.round(e*10)/10,j=(e,t=T,n=w)=>({x:A(n.x+t*Math.cos(k(e))),y:A(n.y+t*Math.sin(k(e)))}),M=e=>e/T*(180/Math.PI)+3,N=(e,t,n,r=0)=>`M${t.x},${t.y} A${e},${e} 0 ${r} 1 ${n.x},${n.y}`,P=A(j(205).x-6),F=e=>e.length*6.4,I=e=>({x:e.x-F(e.name)/2,y:e.y-7,w:F(e.name),h:14}),L=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,R=(e,t)=>e.some((n,r)=>[...e.slice(r+1),...t.filter(e=>!e.gate)].some(e=>L(I(n),I(e))));function z(e){return e?.gate===`human`?e.gateOn?.length?`Human gate on ${e.gateOn.join(`, `)}`:`Human gate`:null}function B(e,t=[]){let n=V(e,t,0);if(n.mode!==`ring`)return n;let r=Math.min(...n.entry.map(e=>e.y-30),...n.nodes.map(e=>e.y-e.r-12),...n.inner.map(e=>e.cy-e.r-12),...n.exit?[n.exit.y-24]:[]);return r<0?V(e,t,Math.ceil(-r)):n}function V(e,t,n){let r={x:w.x,y:w.y+n},i=(e,t=T)=>j(e,t,r),a=e=>t.find(t=>t.name===e),o=e=>a(e)?.effect??null,s=e=>z(a(e)),c=e.loops||[],l=c.find(e=>e.iteration);if(!l||l.nodes.length>8)return H(e,o,s);let u=Math.max(...e.nodes.map(e=>c.filter(t=>t.nodes.includes(e)).length)),d=c.filter(e=>e!==l);if(u>3||d.some(e=>!e.nodes.every(e=>l.nodes.includes(e))))return H(e,o,s);let f=l.nodes[0],p=new Set(e.edges.filter(e=>e.to===f).map(e=>e.from)),m=new Map;for(let e of[...d].sort((e,t)=>e.nodes.length-t.nodes.length))for(let t of e.nodes.slice(1))t!==f&&!p.has(t)&&!m.has(t)&&m.set(t,e);let h=l.nodes.filter(e=>!m.has(e));if(h.length<2||d.some(e=>m.has(e.nodes[0])))return H(e,o,s);let g=360/h.length,_=h.map((e,t)=>({name:e,a:-90+t*g,r:E})),v=_.findIndex(e=>o(e.name)===`mutate`);v>=0&&_.splice(v,0,{name:`validate`,a:_[v].a-g/2,r:D,gate:!0});let y=_.map(e=>({name:e.name,...i(e.a),r:e.r,effect:e.gate?null:o(e.name),gate:!!e.gate,inner:!1,human:e.gate?null:s(e.name)})),b=_.map((e,t)=>{let n=_[(t+1)%_.length],r=(t+1===_.length?n.a+360:n.a)-M(n.r)-2,a=e.a+M(e.r);return{d:N(T,i(a),i(r),+(r-a>180)),kind:`ring`}}),x=[],S=new Map;for(let e of d)S.set(e.nodes[0],[...S.get(e.nodes[0])||[],e]);for(let[e,t]of S){let n=_.find(t=>t.name===e),r=i(n.a),a=t.length>1;t.sort((e,t)=>e.nodes.length-t.nodes.length).forEach((e,t)=>{let c=i(n.a+(a?t?18:-18:0),T+(a?54:44)),l=Math.atan2(c.y-r.y,c.x-r.x)*(180/Math.PI),u=e.nodes.filter(t=>m.get(t)===e),d=e=>u.map((t,n)=>({name:t,...j(l+(n-(u.length-1)/2)*e,O,c)})),f=105;for(;f<150&&R(d(f),y);)f+=5;d(f).forEach(({name:e,...t})=>{y.push({name:e,...t,r:E,effect:o(e),gate:!1,inner:!0,human:s(e)})});let p=l+180;b.push({d:N(O,j(p+42,O,c),j(p+138,O,c)),kind:`inner`}),b.push({d:N(O,j(p+222,O,c),j(p+318,O,c)),kind:`inner`});let h=`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)} · max ${e.max}`,g={lx:c.x,ly:c.y+O+20,anchor:`middle`};if(a){let e=c.x>=w.x,t=Math.max(O,...u.map(e=>{let t=y.find(t=>t.name===e);return Math.abs(t.x-c.x)+E}));g={lx:A(c.x+(e?t+8:-t-8)),ly:A(c.y+4),anchor:e?`start`:`end`}}x.push({loop:e.name,cx:c.x,cy:c.y,r:O,label:h,...g})})}let C=i(205).y,k=e.nodes.filter(e=>!l.nodes.includes(e)),P=k.map((e,t)=>({name:e,x:40,y:A(C-44*(k.length-1-t)),human:s(e)})),I=e.edges.find(e=>e.to===`$close`)?.from,L=y.find(e=>e.name===I),B=L?{from:I,x:L.x+200,y:L.y-30,d:`M${L.x+E},${L.y-6} C${L.x+90},${L.y-40} ${L.x+170},${L.y-40} ${L.x+200},${L.y-30}`}:null,V=Math.max(540,...y.map(e=>e.x+e.r+8),...B?[B.x+6+F(`close`)+8]:[],...x.map(e=>e.cx+e.r+8),...x.map(e=>e.anchor===`start`?e.lx+F(e.label)+8:e.lx+F(e.label)/2+8)),U=Math.max(300,...y.map(e=>e.y+e.r+12),...x.map(e=>Math.max(e.cy+e.r,e.ly)+12));return{mode:`ring`,width:Math.ceil(V),height:Math.ceil(U),center:{x:r.x,y:r.y,r:T},nodes:y,arcs:b,inner:x,entry:P,exit:B}}function H(e,t,n){let r=e.loops||[],i=e=>36+16*r.filter(t=>t!==e&&t.nodes.every(t=>e.nodes.includes(t))).length,a=Math.max(E,...r.map(i))+30,o=new Map(e.nodes.map((e,t)=>[e,60+t*100])),s=e.nodes.map(e=>({name:e,x:o.get(e),y:a,r:E,effect:t(e),gate:!1,inner:!1,human:n(e)})),c=e.nodes.slice(1).map((t,n)=>({d:`M${o.get(e.nodes[n])+E},${a} L${o.get(t)-E-4},${a}`,kind:`flow`})),l=r.map(e=>{let t=i(e),n=Math.min(...e.nodes.map(e=>o.get(e))),r=Math.max(...e.nodes.map(e=>o.get(e))),s={x:n-t,y:a-t,w:r-n+2*t,h:2*t};return c.push({d:`M${r},${s.y+s.h} L${n+4},${s.y+s.h}`,kind:`flow`}),{loop:e.name,label:`${e.name} · max ${e.max}`,box:s}});return{mode:`flow`,width:60+e.nodes.length*100,height:2*a,center:null,nodes:s,arcs:c,inner:l,entry:[],exit:null}}var U=n();function W({x:e,y:t,label:n}){return(0,U.jsxs)(`g`,{className:`lr-human`,children:[(0,U.jsx)(`title`,{children:n}),(0,U.jsx)(`circle`,{cx:e,cy:t,r:`9`}),(0,U.jsx)(`circle`,{cx:e,cy:t-2.4,r:`2.6`,className:`lr-human-fig`}),(0,U.jsx)(`path`,{d:`M${e-4.6},${t+5.6} a4.6,4.6 0 0 1 9.2,0 Z`,className:`lr-human-fig`})]})}function ee({graph:e,bricks:t,onSelect:n,highlight:r}){let i=B(e,t),a=(e.loops||[]).find(e=>e.iteration),o=e=>`${e.name} brick${e.human?`, ${e.human.toLowerCase()}`:``}`,s=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n?.(e))};return(0,U.jsxs)(`svg`,{className:`loop-ring`,viewBox:`0 0 ${i.width} ${i.height}`,role:`group`,"aria-label":`${e.name} loop: ${e.nodes.join(`, `)}`,children:[(0,U.jsx)(`defs`,{children:[`ring`,`inner`,`flow`].map(e=>(0,U.jsx)(`marker`,{id:`lr-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,U.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`lr-head-${e}`})},e))}),i.mode===`ring`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,className:`lr-inner`}),(0,U.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.mode===`flow`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`rect`,{x:e.box.x,y:e.box.y,width:e.box.w,height:e.box.h,rx:`14`,className:`lr-box`}),(0,U.jsx)(`text`,{x:e.box.x+10,y:e.box.y-6,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.arcs.map((e,t)=>(0,U.jsx)(`path`,{d:e.d,className:`lr-${e.kind}`,markerEnd:`url(#lr-arrow-${e.kind})`},t)),i.entry.length>0&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:`M40,${i.entry.at(-1).y} L${P},${i.entry.at(-1).y}`,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),i.entry.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:e.x,y:e.y-10,className:`lr-lbl`,children:e.name}),(0,U.jsx)(`text`,{x:e.x,y:e.y+18,className:`lr-sub`,children:`setup · 1×`}),e.human?(0,U.jsx)(W,{x:e.x-14,y:e.y-14,label:e.human}):null]},e.name))]}),i.nodes.map(e=>e.gate?(0,U.jsxs)(`g`,{className:`lr-gate`,children:[(0,U.jsx)(`title`,{children:`validate — the engine scores the change before the first mutate step`}),(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+5,textAnchor:`middle`,children:`⛨`}),(0,U.jsx)(`text`,{x:e.x+20,y:e.y-10,className:`lr-sub lr-warn`,children:`validate`})]},e.name):(0,U.jsxs)(`g`,{className:`lr-node${e.inner?` inner`:``}${e.effect===`mutate`?` mutate`:``}${e.name===r?` current`:``}`,"aria-current":e.name===r?`step`:void 0,...n?{role:`button`,tabIndex:0,"aria-label":o(e),onClick:s(e.name),onKeyDown:s(e.name)}:{role:`img`,"aria-label":`${o(e)}${e.name===r?`, current step`:``}`},children:[(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+4,textAnchor:`middle`,children:e.name}),e.human?(0,U.jsx)(W,{x:e.x+e.r*.74,y:e.y-e.r*.74,label:e.human}):null]},e.name)),i.exit&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:i.exit.d,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),(0,U.jsx)(`text`,{x:i.exit.x+6,y:i.exit.y+4,className:`lr-lbl`,children:`close`}),(0,U.jsx)(`text`,{x:i.exit.x-90,y:i.exit.y-10,textAnchor:`middle`,className:`lr-sub`,children:`done`})]}),i.center&&a&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:i.center.x,y:i.center.y-4,textAnchor:`middle`,className:`lr-title`,children:e.name}),(0,U.jsxs)(`text`,{x:i.center.x,y:i.center.y+16,textAnchor:`middle`,className:`lr-sub lr-acc`,children:[`iterations · max `,a.max]})]})]})}var te=5e3,ne=[`prudent`,`balanced`,`aggressive`],G={running:`acc`,awaiting:`warn`,unreadable:`bad`},K=e=>!!e.graph;function re(){let[e,t]=(0,C.useState)(null),[n,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(0);return m(e=>r.activeLoops().then(n=>e()&&(t(n),i(null)),t=>e()&&i(t.message)),te,[s]),{loops:e?.loops??null,error:a||n,onPreset:(e,t)=>(o(null),r.setLoopPreset(e,t).then(()=>c(e=>e+1),e=>o(e.message)))}}var q=e=>({key:e,label:e,align:`right`,render:t=>(0,U.jsx)(`span`,{className:`num`,children:t[e]})}),ie=[q(`iteration`),{key:`intent`,label:`intent`},q(`declared`),q(`actual`),{key:`decision`,label:`decision`},{key:`tests`,label:`tests`}];function ae({history:e}){return e.length?(0,U.jsx)(`div`,{className:`loop-history`,children:(0,U.jsx)(S,{caption:`Iterations`,captionHidden:!0,columns:ie,rows:e,rowKey:e=>e.iteration})}):(0,U.jsx)(`p`,{className:`panel-note`,children:`No iteration finished yet.`})}function oe({loop:e,bricks:t,onPreset:n}){let r=K(e)?(e.graph.loops||[]).find(e=>e.iteration):null,[i,a]=(0,C.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Active loop`}),(0,U.jsx)(`span`,{className:`tag${G[e.status]?` ${G[e.status]}`:``}`,children:e.status})]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.branch,` · `,e.root]}),K(e)?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`reader-lede`,children:[`Iteration `,e.iteration,r?` / ${r.max}`:``,` · at `,e.node]}),e.awaiting?(0,U.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,U.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind,e.awaiting.kind===`gate`?` at ${e.awaiting.node}`:``]}),` `,`— Answer in the agent's session.`]}):null,(0,U.jsxs)(`label`,{className:`panel-note loop-run-preset`,children:[`preset`,(0,U.jsx)(`select`,{className:`sel`,"aria-label":`Preset for ${e.title}`,value:e.preset,disabled:i,onChange:t=>{a(!0),Promise.resolve(n(e.root,t.target.value)).finally(()=>a(!1))},children:ne.map(e=>(0,U.jsx)(`option`,{children:e},e))})]}),(0,U.jsx)(`a`,{href:`#/docs/loop-risk`,children:`What presets mean →`}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`loop-graph`,children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,highlight:e.node})}),(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Iterations`}),(0,U.jsx)(ae,{history:e.history})]}):(0,U.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its LOOP.md cannot be read, so there is no state to show.`:`Its LOOP.md is gone: the loop closed and its state went with it.`})]})}var J=encodeURIComponent,Y=o.loops.map(e=>[e,i[e]]),X={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},se={project:`Project`,global:`Global`,shipped:`Shipped`},ce={templates:`Categories`,bricks:`Origins`,active:`Statuses`},le=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function Z(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var Q=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function ue(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return Q(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>X[e.graph.category]?e.graph.category:`other`,[...Object.entries(X),[`other`,`Other`]])}function de(e,t){return Q(e.map(e=>({...e,desc:e.description,override:Z(t,e.name)})),e=>e.origin,Object.entries(se))}function fe(e){return Q(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,le)}var $=(e,t)=>(0,U.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),pe={templates:e=>e.human?$(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?$(`warn`,`mutate`):null,z(e)?$(`human`,`human gate`):null,e.override?$(`acc`,e.override):null,e.available===!1?$(`bad`,`unavailable`):null],active:e=>$(G[e.status],e.status)};function me({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:(0,U.jsx)(`a`,{href:`#/loops/bricks/${J(e)}`,children:e})}),$(t.effect===`mutate`?`warn`:``,t.effect),(0,U.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,U.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),z(t)?$(`human`,z(t).toLowerCase()):null,n?$(`acc`,n):null]}):(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:e}),(0,U.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function he(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function ge({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,C.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=he(e.graph),c=B(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>K(t)&&t.graph.name===e.name).length;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Template`}),X[e.graph.category]?$(``,X[e.graph.category]):null,e.human?$(`human`,`human gate`):null]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsxs)(`figure`,{className:`loop-console`,children:[(0,U.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:l?void 0:{"--loop-w":`${c.width}px`},children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:`smooth`,block:`nearest`})}})}),(0,U.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,U.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,U.jsx)(`ol`,{children:s.map(([e,t])=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,U.jsxs)(`span`,{className:`loop-legend`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,U.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,U.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,U.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,U.jsx)(b,{text:u,label:`Copy command`})]}),(0,U.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,U.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,U.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,U.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,U.jsx)(`li`,{children:e},e))})]}):null,(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,U.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,U.jsx)(me,{name:e,brick:o.get(e),override:Z(n,e),on:i===e},e))})]})}function _e(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
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-BxjLd7Qd.js";import{Et as i,J as a,Tt as o,X as s,Y as c,bt as l,ft as u,pt as d,vt as f}from"./index-DA7BiaE5.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./usePoll-o8ul-Sog.js";import{a as h,n as g,o as _,r as v,t as y}from"./RailCats-D5weYPCS.js";import{t as b}from"./CopyButton-C5Li6awl.js";import{t as x}from"./Markdown-C4S4tTA7.js";import{t as S}from"./DataTable-b9zTShqJ.js";var C=e(t(),1),w={x:260,y:190},T=110,E=28,D=14,O=44,k=e=>e*Math.PI/180,A=e=>Math.round(e*10)/10,j=(e,t=T,n=w)=>({x:A(n.x+t*Math.cos(k(e))),y:A(n.y+t*Math.sin(k(e)))}),M=e=>e/T*(180/Math.PI)+3,N=(e,t,n,r=0)=>`M${t.x},${t.y} A${e},${e} 0 ${r} 1 ${n.x},${n.y}`,P=A(j(205).x-6),F=e=>e.length*6.4,I=e=>({x:e.x-F(e.name)/2,y:e.y-7,w:F(e.name),h:14}),L=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,R=(e,t)=>e.some((n,r)=>[...e.slice(r+1),...t.filter(e=>!e.gate)].some(e=>L(I(n),I(e))));function z(e){return e?.gate===`human`?e.gateOn?.length?`Human gate on ${e.gateOn.join(`, `)}`:`Human gate`:null}function B(e,t=[]){let n=V(e,t,0);if(n.mode!==`ring`)return n;let r=Math.min(...n.entry.map(e=>e.y-30),...n.nodes.map(e=>e.y-e.r-12),...n.inner.map(e=>e.cy-e.r-12),...n.exit?[n.exit.y-24]:[]);return r<0?V(e,t,Math.ceil(-r)):n}function V(e,t,n){let r={x:w.x,y:w.y+n},i=(e,t=T)=>j(e,t,r),a=e=>t.find(t=>t.name===e),o=e=>a(e)?.effect??null,s=e=>z(a(e)),c=e.loops||[],l=c.find(e=>e.iteration);if(!l||l.nodes.length>8)return H(e,o,s);let u=Math.max(...e.nodes.map(e=>c.filter(t=>t.nodes.includes(e)).length)),d=c.filter(e=>e!==l);if(u>3||d.some(e=>!e.nodes.every(e=>l.nodes.includes(e))))return H(e,o,s);let f=l.nodes[0],p=new Set(e.edges.filter(e=>e.to===f).map(e=>e.from)),m=new Map;for(let e of[...d].sort((e,t)=>e.nodes.length-t.nodes.length))for(let t of e.nodes.slice(1))t!==f&&!p.has(t)&&!m.has(t)&&m.set(t,e);let h=l.nodes.filter(e=>!m.has(e));if(h.length<2||d.some(e=>m.has(e.nodes[0])))return H(e,o,s);let g=360/h.length,_=h.map((e,t)=>({name:e,a:-90+t*g,r:E})),v=_.findIndex(e=>o(e.name)===`mutate`);v>=0&&_.splice(v,0,{name:`validate`,a:_[v].a-g/2,r:D,gate:!0});let y=_.map(e=>({name:e.name,...i(e.a),r:e.r,effect:e.gate?null:o(e.name),gate:!!e.gate,inner:!1,human:e.gate?null:s(e.name)})),b=_.map((e,t)=>{let n=_[(t+1)%_.length],r=(t+1===_.length?n.a+360:n.a)-M(n.r)-2,a=e.a+M(e.r);return{d:N(T,i(a),i(r),+(r-a>180)),kind:`ring`}}),x=[],S=new Map;for(let e of d)S.set(e.nodes[0],[...S.get(e.nodes[0])||[],e]);for(let[e,t]of S){let n=_.find(t=>t.name===e),r=i(n.a),a=t.length>1;t.sort((e,t)=>e.nodes.length-t.nodes.length).forEach((e,t)=>{let c=i(n.a+(a?t?18:-18:0),T+(a?54:44)),l=Math.atan2(c.y-r.y,c.x-r.x)*(180/Math.PI),u=e.nodes.filter(t=>m.get(t)===e),d=e=>u.map((t,n)=>({name:t,...j(l+(n-(u.length-1)/2)*e,O,c)})),f=105;for(;f<150&&R(d(f),y);)f+=5;d(f).forEach(({name:e,...t})=>{y.push({name:e,...t,r:E,effect:o(e),gate:!1,inner:!0,human:s(e)})});let p=l+180;b.push({d:N(O,j(p+42,O,c),j(p+138,O,c)),kind:`inner`}),b.push({d:N(O,j(p+222,O,c),j(p+318,O,c)),kind:`inner`});let h=`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)} · max ${e.max}`,g={lx:c.x,ly:c.y+O+20,anchor:`middle`};if(a){let e=c.x>=w.x,t=Math.max(O,...u.map(e=>{let t=y.find(t=>t.name===e);return Math.abs(t.x-c.x)+E}));g={lx:A(c.x+(e?t+8:-t-8)),ly:A(c.y+4),anchor:e?`start`:`end`}}x.push({loop:e.name,cx:c.x,cy:c.y,r:O,label:h,...g})})}let C=i(205).y,k=e.nodes.filter(e=>!l.nodes.includes(e)),P=k.map((e,t)=>({name:e,x:40,y:A(C-44*(k.length-1-t)),human:s(e)})),I=e.edges.find(e=>e.to===`$close`)?.from,L=y.find(e=>e.name===I),B=L?{from:I,x:L.x+200,y:L.y-30,d:`M${L.x+E},${L.y-6} C${L.x+90},${L.y-40} ${L.x+170},${L.y-40} ${L.x+200},${L.y-30}`}:null,V=Math.max(540,...y.map(e=>e.x+e.r+8),...B?[B.x+6+F(`close`)+8]:[],...x.map(e=>e.cx+e.r+8),...x.map(e=>e.anchor===`start`?e.lx+F(e.label)+8:e.lx+F(e.label)/2+8)),U=Math.max(300,...y.map(e=>e.y+e.r+12),...x.map(e=>Math.max(e.cy+e.r,e.ly)+12));return{mode:`ring`,width:Math.ceil(V),height:Math.ceil(U),center:{x:r.x,y:r.y,r:T},nodes:y,arcs:b,inner:x,entry:P,exit:B}}function H(e,t,n){let r=e.loops||[],i=e=>36+16*r.filter(t=>t!==e&&t.nodes.every(t=>e.nodes.includes(t))).length,a=Math.max(E,...r.map(i))+30,o=new Map(e.nodes.map((e,t)=>[e,60+t*100])),s=e.nodes.map(e=>({name:e,x:o.get(e),y:a,r:E,effect:t(e),gate:!1,inner:!1,human:n(e)})),c=e.nodes.slice(1).map((t,n)=>({d:`M${o.get(e.nodes[n])+E},${a} L${o.get(t)-E-4},${a}`,kind:`flow`})),l=r.map(e=>{let t=i(e),n=Math.min(...e.nodes.map(e=>o.get(e))),r=Math.max(...e.nodes.map(e=>o.get(e))),s={x:n-t,y:a-t,w:r-n+2*t,h:2*t};return c.push({d:`M${r},${s.y+s.h} L${n+4},${s.y+s.h}`,kind:`flow`}),{loop:e.name,label:`${e.name} · max ${e.max}`,box:s}});return{mode:`flow`,width:60+e.nodes.length*100,height:2*a,center:null,nodes:s,arcs:c,inner:l,entry:[],exit:null}}var U=n();function W({x:e,y:t,label:n}){return(0,U.jsxs)(`g`,{className:`lr-human`,children:[(0,U.jsx)(`title`,{children:n}),(0,U.jsx)(`circle`,{cx:e,cy:t,r:`9`}),(0,U.jsx)(`circle`,{cx:e,cy:t-2.4,r:`2.6`,className:`lr-human-fig`}),(0,U.jsx)(`path`,{d:`M${e-4.6},${t+5.6} a4.6,4.6 0 0 1 9.2,0 Z`,className:`lr-human-fig`})]})}function ee({graph:e,bricks:t,onSelect:n,highlight:r}){let i=B(e,t),a=(e.loops||[]).find(e=>e.iteration),o=e=>`${e.name} brick${e.human?`, ${e.human.toLowerCase()}`:``}`,s=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n?.(e))};return(0,U.jsxs)(`svg`,{className:`loop-ring`,viewBox:`0 0 ${i.width} ${i.height}`,role:`group`,"aria-label":`${e.name} loop: ${e.nodes.join(`, `)}`,children:[(0,U.jsx)(`defs`,{children:[`ring`,`inner`,`flow`].map(e=>(0,U.jsx)(`marker`,{id:`lr-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,U.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`lr-head-${e}`})},e))}),i.mode===`ring`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,className:`lr-inner`}),(0,U.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.mode===`flow`&&i.inner.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`rect`,{x:e.box.x,y:e.box.y,width:e.box.w,height:e.box.h,rx:`14`,className:`lr-box`}),(0,U.jsx)(`text`,{x:e.box.x+10,y:e.box.y-6,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.arcs.map((e,t)=>(0,U.jsx)(`path`,{d:e.d,className:`lr-${e.kind}`,markerEnd:`url(#lr-arrow-${e.kind})`},t)),i.entry.length>0&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:`M40,${i.entry.at(-1).y} L${P},${i.entry.at(-1).y}`,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),i.entry.map(e=>(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:e.x,y:e.y-10,className:`lr-lbl`,children:e.name}),(0,U.jsx)(`text`,{x:e.x,y:e.y+18,className:`lr-sub`,children:`setup · 1×`}),e.human?(0,U.jsx)(W,{x:e.x-14,y:e.y-14,label:e.human}):null]},e.name))]}),i.nodes.map(e=>e.gate?(0,U.jsxs)(`g`,{className:`lr-gate`,children:[(0,U.jsx)(`title`,{children:`validate — the engine scores the change before the first mutate step`}),(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+5,textAnchor:`middle`,children:`⛨`}),(0,U.jsx)(`text`,{x:e.x+20,y:e.y-10,className:`lr-sub lr-warn`,children:`validate`})]},e.name):(0,U.jsxs)(`g`,{className:`lr-node${e.inner?` inner`:``}${e.effect===`mutate`?` mutate`:``}${e.name===r?` current`:``}`,"aria-current":e.name===r?`step`:void 0,...n?{role:`button`,tabIndex:0,"aria-label":o(e),onClick:s(e.name),onKeyDown:s(e.name)}:{role:`img`,"aria-label":`${o(e)}${e.name===r?`, current step`:``}`},children:[(0,U.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,U.jsx)(`text`,{x:e.x,y:e.y+4,textAnchor:`middle`,children:e.name}),e.human?(0,U.jsx)(W,{x:e.x+e.r*.74,y:e.y-e.r*.74,label:e.human}):null]},e.name)),i.exit&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`path`,{d:i.exit.d,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),(0,U.jsx)(`text`,{x:i.exit.x+6,y:i.exit.y+4,className:`lr-lbl`,children:`close`}),(0,U.jsx)(`text`,{x:i.exit.x-90,y:i.exit.y-10,textAnchor:`middle`,className:`lr-sub`,children:`done`})]}),i.center&&a&&(0,U.jsxs)(`g`,{children:[(0,U.jsx)(`text`,{x:i.center.x,y:i.center.y-4,textAnchor:`middle`,className:`lr-title`,children:e.name}),(0,U.jsxs)(`text`,{x:i.center.x,y:i.center.y+16,textAnchor:`middle`,className:`lr-sub lr-acc`,children:[`iterations · max `,a.max]})]})]})}var te=5e3,ne=[`prudent`,`balanced`,`aggressive`],G={running:`acc`,awaiting:`warn`,unreadable:`bad`},K=e=>!!e.graph;function re(){let[e,t]=(0,C.useState)(null),[n,i]=(0,C.useState)(null),[a,o]=(0,C.useState)(null),[s,c]=(0,C.useState)(0);return m(e=>r.activeLoops().then(n=>e()&&(t(n),i(null)),t=>e()&&i(t.message)),te,[s]),{loops:e?.loops??null,error:a||n,onPreset:(e,t)=>(o(null),r.setLoopPreset(e,t).then(()=>c(e=>e+1),e=>o(e.message)))}}var q=e=>({key:e,label:e,align:`right`,render:t=>(0,U.jsx)(`span`,{className:`num`,children:t[e]})}),ie=[q(`iteration`),{key:`intent`,label:`intent`},q(`declared`),q(`actual`),{key:`decision`,label:`decision`},{key:`tests`,label:`tests`}];function ae({history:e}){return e.length?(0,U.jsx)(`div`,{className:`loop-history`,children:(0,U.jsx)(S,{caption:`Iterations`,captionHidden:!0,columns:ie,rows:e,rowKey:e=>e.iteration})}):(0,U.jsx)(`p`,{className:`panel-note`,children:`No iteration finished yet.`})}function oe({loop:e,bricks:t,onPreset:n}){let r=K(e)?(e.graph.loops||[]).find(e=>e.iteration):null,[i,a]=(0,C.useState)(!1);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Active loop`}),(0,U.jsx)(`span`,{className:`tag${G[e.status]?` ${G[e.status]}`:``}`,children:e.status})]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.branch,` · `,e.root]}),K(e)?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`reader-lede`,children:[`Iteration `,e.iteration,r?` / ${r.max}`:``,` · at `,e.node]}),e.awaiting?(0,U.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,U.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind,e.awaiting.kind===`gate`?` at ${e.awaiting.node}`:``]}),` `,`— Answer in the agent's session.`]}):null,(0,U.jsxs)(`label`,{className:`panel-note loop-run-preset`,children:[`preset`,(0,U.jsx)(`select`,{className:`sel`,"aria-label":`Preset for ${e.title}`,value:e.preset,disabled:i,onChange:t=>{a(!0),Promise.resolve(n(e.root,t.target.value)).finally(()=>a(!1))},children:ne.map(e=>(0,U.jsx)(`option`,{children:e},e))})]}),(0,U.jsx)(`a`,{href:`#/docs/loop-risk`,children:`What presets mean →`}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`loop-graph`,children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,highlight:e.node})}),(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Iterations`}),(0,U.jsx)(ae,{history:e.history})]}):(0,U.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its LOOP.md cannot be read, so there is no state to show.`:`Its LOOP.md is gone: the loop closed and its state went with it.`})]})}var J=encodeURIComponent,Y=o.loops.map(e=>[e,i[e]]),X={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},se={project:`Project`,global:`Global`,shipped:`Shipped`},ce={templates:`Categories`,bricks:`Origins`,active:`Statuses`},le=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function Z(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var Q=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function ue(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return Q(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>X[e.graph.category]?e.graph.category:`other`,[...Object.entries(X),[`other`,`Other`]])}function de(e,t){return Q(e.map(e=>({...e,desc:e.description,override:Z(t,e.name)})),e=>e.origin,Object.entries(se))}function fe(e){return Q(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,le)}var $=(e,t)=>(0,U.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),pe={templates:e=>e.human?$(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?$(`warn`,`mutate`):null,z(e)?$(`human`,`human gate`):null,e.override?$(`acc`,e.override):null,e.available===!1?$(`bad`,`unavailable`):null],active:e=>$(G[e.status],e.status)};function me({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:(0,U.jsx)(`a`,{href:`#/loops/bricks/${J(e)}`,children:e})}),$(t.effect===`mutate`?`warn`:``,t.effect),(0,U.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,U.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),z(t)?$(`human`,z(t).toLowerCase()):null,n?$(`acc`,n):null]}):(0,U.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,U.jsx)(`b`,{children:e}),(0,U.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function he(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function ge({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,C.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=he(e.graph),c=B(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>K(t)&&t.graph.name===e.name).length;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Template`}),X[e.graph.category]?$(``,X[e.graph.category]):null,e.human?$(`human`,`human gate`):null]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsxs)(`figure`,{className:`loop-console`,children:[(0,U.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:l?void 0:{"--loop-w":`${c.width}px`},children:(0,U.jsx)(ee,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:`smooth`,block:`nearest`})}})}),(0,U.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,U.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,U.jsx)(`ol`,{children:s.map(([e,t])=>(0,U.jsxs)(`li`,{children:[(0,U.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,U.jsxs)(`span`,{className:`loop-legend`,children:[(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,U.jsxs)(`span`,{children:[(0,U.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,U.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,U.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,U.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,U.jsx)(b,{text:u,label:`Copy command`})]}),(0,U.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,U.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,U.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,U.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,U.jsx)(`li`,{children:e},e))})]}):null,(0,U.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,U.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,U.jsx)(me,{name:e,brick:o.get(e),override:Z(n,e),on:i===e},e))})]})}function _e(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
2
2
  `)}\n---\n${e.body}`}function ve({b:e}){let[t,n]=(0,C.useState)(!1),r=[[`effect`,$(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,U.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>$(``,e))],[`gate`,z(e)?$(`human`,z(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,U.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`reader-tags`,children:[(0,U.jsx)(`span`,{className:`tag acc`,children:`Brick`}),pe.bricks(e)]}),(0,U.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,U.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,U.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,U.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,U.jsxs)(C.Fragment,{children:[(0,U.jsx)(`dt`,{children:e}),(0,U.jsx)(`dd`,{children:t})]},e))}),(0,U.jsx)(`hr`,{className:`hr`}),(0,U.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,U.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,U.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:_e(e)}):(0,U.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,U.jsx)(x,{body:e.body})})]})}function ye({problems:e}){if(!e?.length)return null;let t=e.length;return(0,U.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,U.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,U.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,U.jsx)(`li`,{className:`mono`,children:e},e))})]})}var be={templates:{title:`No templates`,body:(0,U.jsxs)(U.Fragment,{children:[`Add one under `,(0,U.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,U.jsxs)(U.Fragment,{children:[`Add one under `,(0,U.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,U.jsxs)(U.Fragment,{children:[`Start one with `,(0,U.jsx)(`code`,{className:`mono`,children:`geneseed loop init`}),` in a worktree, or ask the agent to run a loop. It shows up here while it runs.`]})}},xe={templates:(0,U.jsxs)(U.Fragment,{children:[`A template wires bricks into a loop. `,(0,U.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,U.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,U.jsxs)(U.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,U.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,U.jsxs)(U.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,U.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function Se({tab:e=`templates`,item:t,dataRev:n}){let i=d(n),[o,m]=u(`loops`,i),{data:b,error:x}=l(()=>r.loops(f(o)),[n,o?.id??``],`loops`),S=re(),[w,T]=(0,C.useState)(``),[E,D]=(0,C.useState)(`all`),[O,k]=(0,C.useState)(e);e!==O&&(k(e),T(``),D(`all`));let A=b?.bricks||[],j=e===`active`?S.loops&&fe(S.loops):b&&(e===`bricks`?de(b.bricks,b.overridden):ue(b.templates,b.bricks)),M=j||[],N=g(M),P=E===`all`?M:M.filter(e=>e.group===E),F=w.trim(),I=_(P,F),L=!!(t&&j&&!M.some(e=>e.name===t)),R=L?null:M.find(e=>e.name===t)||e===`active`&&M.find(K)||M[0]||null,z={templates:b?.templates.length,bricks:b?.bricks.length,active:S.loops?.length},B=Y.find(([t])=>t===e)[1],V=e===`active`?S.error:x;return(0,U.jsxs)(U.Fragment,{children:[e===`active`?null:(0,U.jsx)(s,{className:`page-pick`,installs:i,value:o,onChange:m,label:`Templates and bricks of:`}),(0,U.jsx)(a,{error:V,style:{margin:`0 0 var(--sp-3)`}}),(0,U.jsx)(ye,{problems:b?.problems}),(0,U.jsxs)(`div`,{className:`library`,children:[(0,U.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,U.jsxs)(`div`,{className:`lib-title`,children:[(0,U.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,U.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,U.jsx)(`p`,{className:`panel-note lib-lede`,children:xe[e]}),(0,U.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:Y.map(([t,n])=>(0,U.jsxs)(C.Fragment,{children:[(0,U.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,U.jsx)(`span`,{className:`mono dim`,children:z[t]??``})]}),e===t&&(0,U.jsx)(y,{label:ce[t],total:M.length,cats:N,cat:E,onChange:D})]},t))})]}),(0,U.jsx)(h,{label:B,count:F?`${I.length} of ${P.length}`:j?P.length:``,q:w,onQ:T,matched:I.length,inView:[e,t],children:j?M.length===0?(0,U.jsx)(p,{title:be[e].title,children:be[e].body}):(0,U.jsx)(v,{rows:I,activeName:R?.name,hrefOf:t=>`#/loops/${e}/${J(t.name)}`,pills:pe[e]}):V?null:(0,U.jsx)(c,{})}),(0,U.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:L?(0,U.jsx)(p,{title:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${B.toLowerCase()} →`}}):R?e===`active`?(0,U.jsx)(oe,{loop:R,bricks:A,onPreset:S.onPreset}):e===`bricks`?(0,U.jsx)(ve,{b:R}):(0,U.jsx)(ge,{t:R,bricks:A,overridden:b.overridden,runs:S.loops},R.name):e===`active`&&j?(0,U.jsx)(p,{title:`What is a loop?`,docs:{href:`#/docs/loops`,label:`How loops work →`},children:`A loop runs bricks in a ring until its gate passes.`}):null})]})]})}export{fe as activeRows,de as brickRows,_e as brickSource,Se as default,he as howItRuns,ue as templateRows};
@@ -0,0 +1,69 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";var r=e(t(),1);function i(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var a=i();function o(e){a=e}var s={exec:()=>null};function c(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 l(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(d.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var u=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),d={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:c(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:c(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:c(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:c(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:c(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:c(e=>RegExp(`^ {0,${e}}(?:</?(?:${S})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:c(e=>RegExp(`^ {0,${e}}>`))},f=/^(?:[ \t]*(?:\n|$))+/,p=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,m=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,h=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,g=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,v=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,y=l(v).replace(/bull/g,_).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=l(v).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),b=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,te=/^[^\n]+/,x=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,ne=l(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,x).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),re=l(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_).getRegex(),S=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,C=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ie=l(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,C).replace(`tag`,S).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae=e=>l(b).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex(),oe=ae(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),se=ae(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),w={blockquote:l(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace(`paragraph`,se).getRegex(),code:p,def:ne,fences:m,heading:g,hr:h,html:ie,lheading:y,list:re,newline:f,paragraph:oe,table:s,text:te},T=l(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex(),ce={...w,lheading:ee,table:T,paragraph:l(b).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,T).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,S).getRegex()},le={...w,html:l(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,C).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:s,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:l(b).replace(`hr`,h).replace(`heading`,` *#{1,6} *[^
2
+ ]`).replace(`lheading`,y).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ue=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,de=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,E=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,fe=/^(`+|[^`])(?:(?= {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,pe=l(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,O).getRegex(),me=/[\p{Pi}\p{Ps}"']/u,A=/(?!~)[\p{P}\p{S}]/u,he=/(?!~)[\s\p{P}\p{S}]/u,ge=/(?:[^\s\p{P}\p{S}]|~)/u,_e=l(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,u?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),j=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ve=l(j,`u`).replace(/punct/g,D).getRegex(),ye=l(j,`u`).replace(/punct/g,A).getRegex(),be=l(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,me).replace(/punct/g,D).getRegex(),M=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,xe=l(M,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Se=l(M,`gu`).replace(/notPunctSpace/g,ge).replace(/punctSpace/g,he).replace(/punct/g,A).getRegex(),Ce=l(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)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(),we=l(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Te=l(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)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(),Ee=l(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,D).getRegex(),De=l(`^[^~]+(?=[^~])|(?!~)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(),Oe=l(/\\(punct)/,`gu`).replace(/punct/g,D).getRegex(),ke=l(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,D).getRegex(),Ae=l(/^<(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(),je=l(C).replace(`(?:-->|$)`,`-->`).getRegex(),Me=l(`^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`,je).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),N=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,P=l(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,N).getRegex(),Ne=l(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,P).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Pe=l(/^!?\[(label)\]\[(ref)\]/).replace(`label`,P).replace(`ref`,x).getRegex(),Fe=l(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,x).getRegex(),F=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Ie=l(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,N).getRegex(),Le=l(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,l(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ie).replace(`ref`,F).getRegex()).replace(`nolink`,l(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,F).getRegex()).getRegex(),I=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Re=l(/(?: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(),L={_backpedal:s,anyPunctuation:Oe,anyPunctuationOutsideCode:ke,autolink:Ae,blockSkip:_e,br:E,code:de,del:s,delLDelim:s,delRDelim:s,emStrongLDelim:ve,emStrongRDelimAst:xe,emStrongRDelimUnd:we,escape:ue,link:Ne,nolink:Fe,punctuation:pe,reflink:Pe,reflinkSearch:Le,tag:Me,text:fe,url:s},ze={...L,emStrongLDelim:be,emStrongRDelimAst:Ce,emStrongRDelimUnd:Te,link:l(/^!?\[(label)\]\((.*?)\)/).replace(`label`,P).getRegex(),reflink:l(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,P).getRegex()},R={...L,emStrongRDelimAst:Se,emStrongLDelim:ye,delLDelim:Ee,delRDelim:De,url:l(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Re).replace(`protocol`,I).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:l(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,I).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Be={...R,br:l(E).replace(`{2,}`,`*`).getRegex(),text:l(R.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},z={normal:w,gfm:ce,pedantic:le},B={normal:L,gfm:R,breaks:Be,pedantic:ze},Ve={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},He=e=>Ve[e];function V(e,t){if(t){if(d.escapeTest.test(e))return e.replace(d.escapeReplace,He)}else if(d.escapeTestNoEncode.test(e))return e.replace(d.escapeReplaceNoEncode,He);return e}function Ue(e){return d.numericCharacterReference.test(e)?e.replace(d.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 We(e){try{e=encodeURI(e).replace(d.percentDecode,`%`)}catch{return null}return e}function Ge(e,t){let n=e.replace(d.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(d.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(d.slashPipe,`|`);return n}function H(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 Ke(e){let t=e.split(`
3
+ `),n=t.length-1;for(;n>=0&&d.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
4
+ `)}function U(e){return e.trim().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}function W(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 Je(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 Ye(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
5
+ `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
6
+ `)}function Xe(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 G=class{options;rules;lexer;constructor(e){this.options=e||a}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]:Ke(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=Ye(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=H(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:H(t[0],`
7
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:H(t[0],`
8
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=H(t[0],`
9
+ `).split(`
10
+ `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
11
+ `),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+W(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
12
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
13
+ ${s}`:s,r=r?`${r}
14
+ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
15
+ `),o=t.raw+`
16
+ `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
17
+ `).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
18
+ ${d.join(`
19
+ `)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
20
+ `+e.join(`
21
+ `),o=this.list(a);i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`
22
+ `).length:0;if(s>0){let t=e.slice(0,s).join(`
23
+ `);n=`${n}
24
+ ${t}`,r=`${r}
25
+ ${t}`}e=e.slice(s)}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
26
+ `,1)[0],d=t[1].length,f=this.options.pedantic?W(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>W(e,d)),p=e.split(`
27
+ `,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
28
+ `,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>W(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
29
+ `+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
30
+ ${p}`)?` ${l.replace(/^ {0,3}/,``)}`:p;a+=`
31
+ `+e}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Ke(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=U(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:H(t[0],`
32
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ge(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
33
+ `):[],a={type:`table`,raw:H(t[0],`
34
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Ge(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:H(t[0],`
35
+ `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
36
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Xe(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=H(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=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),Je(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Xe(e,n[1],r,this.rules))return;let i=t[U((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Je(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!r||!r[1]&&!r[2]&&!r[3]&&!r[4])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l),_=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(_.lastIndex=0,t=t.slice(-1*e.length+n);(r=_.exec(t))!==null;){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(f=[...u].length,r[3]||r[4]){p+=f;continue}if(r[5]||r[6]||g){if(a&&(r[5]||r[6]))break;if(h%3&&!((h+f)%3)){m+=f;continue}}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let t=[...r[0]][0].length,i=e.slice(0,n+r.index+t+f);if(Math.min(n,f)%2){let e=i.slice(1,-1);return{type:`em`,raw:i,text:e,tokens:this.lexer.inlineTokens(e)}}let o=i.slice(2,-2);return{type:`strong`,raw:i,text:o,tokens:this.lexer.inlineTokens(o)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:Ue(t[0]),escaped:e}}}},K=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||a,this.options.tokenizer=this.options.tokenizer||new G,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:d,block:z.normal,inline:B.normal};this.options.pedantic?(t.block=z.pedantic,t.inline=B.pedantic):this.options.gfm&&(t.block=z.gfm,t.inline=this.options.breaks?B.breaks:B.gfm),this.tokenizer.rules=t}static get rules(){return{block:z,inline:B}}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(d.carriageReturn,`
37
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(d.tabCharGlobal,` `).replace(d.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
38
+ `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
39
+ `)?``:`
40
+ `)+i.raw,n.text+=`
41
+ `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(i=this.tokenizer.html(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
42
+ `)?``:`
43
+ `)+i.raw,n.text+=`
44
+ `+i.raw,this.inlineQueue.at(-1).src=n.text):(this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}),t.push(i));continue}if((i=this.tokenizer.table(e))||(i=this.tokenizer.lheading(e))){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
45
+ `)?``:`
46
+ `)+i.raw,r.text+=`
47
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length)}else if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
48
+ `)?``:`
49
+ `)+i.raw,n.text+=`
50
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,U(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!==G.prototype.emStrong||this.tokenizer.del!==G.prototype.del?this.#t(e):e,r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if((o=this.tokenizer.emStrong(e,n,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,n,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}#t(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,U(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)}},q=class{options;parser;constructor(e){this.options=e||a}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(d.notSpaceStart)?.[0],i=e?e.replace(d.endingNewline,``)+`
51
+ `:``;return r?`<pre><code class="language-`+V(r)+`">`+(n?i:V(i,!0))+`</code></pre>
52
+ `:`<pre><code>`+(n?i:V(i,!0))+`</code></pre>
53
+ `}blockquote({tokens:e}){return`<blockquote>
54
+ ${this.parser.parse(e)}</blockquote>
55
+ `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
56
+ `}hr(e){return`<hr>
57
+ `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
58
+ `+r+`</`+i+`>
59
+ `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
60
+ `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
61
+ `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
62
+ <thead>
63
+ `+t+`</thead>
64
+ `+r+`</table>
65
+ `}tablerow({text:e}){return`<tr>
66
+ ${e}</tr>
67
+ `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
68
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${V(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?V(n,!0):this.parser.parseInline(r),o=We(e);if(o===null)return a;e=V(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+V(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=We(e);if(i===null)return V(n);e=i;let a=`<img src="${V(e)}" alt="${V(n)}"`;return t&&(a+=` title="${V(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:V(e.text)}},J=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}},Y=class e{options;renderer;textRenderer;constructor(e){this.options=e||a,this.options.renderer=this.options.renderer||new q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J,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}},X=class{options;block;constructor(e){this.options=e||a}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?K.lex:K.lexInline}provideParser(e=this.block){return e?Y.parse:Y.parseInline}};function Z(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var Q=new class{defaults=i();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Y;Renderer=q;TextRenderer=J;Lexer=K;Tokenizer=G;Hooks=X;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(Z(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)Z(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)Z(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;Z(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);Z(n,this.walkTokens(i,t))}):e.tokens&&Z(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new q(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new G(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 X;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]=X.passThroughHooks.has(n)?e=>{if(t.options.async&&X.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(t.options.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&Z(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 K.lex(e,t??this.defaults)}parser(e,t){return Y.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?K.lex:K.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?Y.parse:Y.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?K.lex:K.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?Y.parse:Y.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
69
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+V(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return Q.parse(e,t)}$.options=$.setOptions=function(e){return Q.setOptions(e),$.defaults=Q.defaults,o($.defaults),$},$.getDefaults=i,$.defaults=a;function Ze(...e){return Q.use(...e),$.defaults=Q.defaults,o($.defaults),$}$.use=Ze,$.walkTokens=function(e,t){return Q.walkTokens(e,t)},$.parseInline=Q.parseInline,$.Parser=Y,$.parser=Y.parse,$.Renderer=q,$.TextRenderer=J,$.Lexer=K,$.lexer=K.lex,$.Tokenizer=G,$.Hooks=X,$.parse=$,$.options,$.setOptions,$.walkTokens,$.parseInline,Y.parse,K.lex;var Qe=n(),$e=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`]),et=new Set([`href`,`src`,`xlink:href`,`action`,`formaction`,`poster`,`background`]),tt=new Set([`http`,`https`,`mailto`]);function nt(e){let t=/^([a-z][a-z0-9+.-]*):/.exec(e.replace(/[\u0000- ]/g,``).toLowerCase());return!t||tt.has(t[1])}function rt(e){for(let t=0;t<4;t++){let t=it(e);if(t===e)return t;e=t}return``}function it(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`*`).forEach(e=>{if($e.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`||et.has(r)&&!nt(n))&&e.removeAttribute(t)}}),t.innerHTML}function at(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 rt($.parse(r,{breaks:!1}))}var ot=[];function st({body:e,links:t=ot}){let n=(0,r.useMemo)(()=>at(e,t),[e,t]);return(0,Qe.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:n}})}export{$ as i,at as n,rt as r,st as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{n,r}from"./sections-ChwaobfW.js";import{F as i,at as a}from"./index-CzDi9JpF.js";import{n as o,r as s}from"./Dashboard-sCfEjowQ.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=r.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...r.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=i(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=a(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS READOUT`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:r.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:n[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:n[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,r}from"./sections-ChwaobfW.js";import{F as i,at as a}from"./index-DA7BiaE5.js";import{n as o,r as s}from"./Dashboard-B-6DTmae.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=r.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...r.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=i(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=a(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS READOUT`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:r.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:n[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:n[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BxjLd7Qd.js";import{$ as i,Dt as a,H as o,J as s,Ot as c,Q as l,R as u,W as d,X as f,Y as p,_t as m,bt as h,pt as g,vt as _}from"./index-CzDi9JpF.js";import{t as v}from"./EmptyState-1sPNleqv.js";import{t as y}from"./Markdown-DpmmtW2Y.js";import{t as b}from"./Tabs-CIPyMAX-.js";import x,{installLabel as S}from"./Library-QCGXPV5h.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=i(),[r,o]=(0,C.useState)(null),[s,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(s),g=(0,C.useRef)(!1),_=e=>{o(e),l(e)},v=()=>o(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=c(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),o(null),a(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:o,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:u,notice:f,setNotice:p,save:async(e,{conflict:n}={})=>{d(!0),p(``);try{return await e(m)||!0}catch(e){e.status===409?p(n??T):p(e.message);return}finally{d(!1),t()}}}}var D=n(),O={title:``,body:``,scope:`project`,trial_until:``},k=[`project`,`global`],ee=e=>e===`user`?`global`:e,A=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,j=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),M=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function N({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(A).some(j)?`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 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)`}),k.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 ne({rule:e,tag:t,isOpen:n,onToggle:r,onEdit:i,onDelete:a,onGraduate:o}){let s=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${n?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:r,"aria-expanded":n,"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}),t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):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}`})]}),n&&(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:o,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${s}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:i,"aria-label":`Edit R${e.id}${s}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Retire R${e.id}${s}`,children:`Retire`})]})]})]})}function P({onChanged:e,dataRev:t}){let n=i(),[a,o]=(0,C.useState)(0),c=g(t),l=c===null?null:c.length?c:[null],u=l?l.map(e=>e?.id??``).join(`|`):null,{data:d,error:y}=h(()=>l?Promise.allSettled(l.map(e=>r.rules(_(e)))).then(e=>{if(e.every(e=>e.status===`rejected`))throw e[0].reason;return{sets:e.flatMap((e,t)=>e.status===`fulfilled`?[{inst:l[t],data:e.value}]:[]),failed:e.flatMap((e,t)=>e.status===`rejected`?[l[t]]:[])}}):Promise.resolve(null),[a,u]),b=d?.sets,[x,S]=(0,C.useState)(null),w=()=>o(e=>e+1),T=E({data:null,reload:w}),{draft:k,busy:A,notice:j}=T,P=(0,C.useRef)(null),[F,I]=(0,C.useState)(0),L=e=>{P.current=e,I(e=>e+1)},R=(0,C.useRef)(null),z=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=P.current;if(P.current=null,e===null)return;let t=[...z.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?R.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[F]),y)return(0,D.jsx)(s,{error:y,onRetry:w});if(!b)return(0,D.jsx)(p,{});let B=l.length>1,V=e=>e?.id??``,H=b.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${V(e)}#${t.id}`}))),U=b.filter(e=>e.data.exists).map(e=>e.inst),W=U.length>0,G=k?.target,K=G!==void 0&&G!==`new`&&!H.some(e=>e.key===G&&e.title===k.title0),q=G===`new`||K,J=k?.to!==void 0&&!U.some(e=>V(e)===k.to),Y=J?null:U.find(e=>V(e)===k?.to)??U[0]??null,re=J?(0,D.jsx)(`p`,{className:`sub 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.`}):U.length>1?(0,D.jsx)(f,{installs:U,value:Y,onChange:e=>T.setDraft({...k,to:e.id}),label:`Write to:`}):B&&Y?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Write to:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:m(Y)})]}):null,X=async(t,n,i)=>{let a=b.find(e=>V(e.inst)===V(n))?.data.fingerprint||``,o=await T.save(()=>r.rulesMutate({...t,fingerprint:a},_(n)),{conflict:i?M:te});return o&&i&&T.close(),e?.(),o},Z=e=>T.setDraft({...k,form:e}),Q=async(e,t,n)=>{await X(e,t,!0)&&L(n)},$=async e=>{await T.discard()&&L(e)},ie=async e=>{await n(`Retire rule R${e.id} — “${e.title}”${B?` from ${m(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await X({op:`delete`,id:e.id},e.inst)&&k===null&&L(`add`)},ae=async e=>{await X({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&L(e.key)},oe=b.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>B?`${m(e)}: ${t}`:t));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`eyebrow`,children:`governance · yours`}),(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub`,children:[`Your own standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),` beside the deployed AGENT.md`,B?` of each install, each rule tagged with its install`:``,`. The agent obeys them with the same force as the Laws — they may tighten a Law, never repeal one — and no update ever touches the file. Keep the set small: every rule is loaded every session.`]})]}),W&&k===null&&(0,D.jsx)(`button`,{className:`btn`,ref:R,onClick:()=>T.open({target:`new`,title0:``,form:O}),children:`Add rule`})]}),j?(0,D.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:j}):null,d.failed.length?(0,D.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,d.failed.map(e=>e?m(e):`the default install`).join(`, `),`.`]}):null,oe.map(e=>(0,D.jsxs)(`p`,{className:`sub rule-notice`,children:[`format warning: `,e]},e)),q&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),K?(0,D.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Rule R`,k.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)(N,{value:k.form,onChange:Z,busy:A,writeTo:re,onCancel:()=>$(`add`),onSave:e=>!J&&U.length&&Q({op:`add`,...e},Y,`add`)})]}),W?H.length===0&&!q?(0,D.jsx)(v,{title:`No rules yet`,children:`The file is seeded and loaded every session — it is just empty. Add your first standing rule here, ask the agent for one in-session (the rule skill), or promote a recurring memory fact from the Library.`}):(0,D.jsx)(`div`,{className:`card rules-list`,ref:z,children:H.map(e=>!K&&G===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)(N,{value:k.form,onChange:Z,busy:A,onCancel:()=>$(e.key),onSave:t=>Q({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(ne,{rule:e,tag:B?m(e.inst):null,isOpen:x===e.key,onToggle:()=>S(x===e.key?null:e.key),onEdit:()=>{S(e.key),T.open({target:e.key,no:e.id,to:V(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:ee(e.scope),trial_until:e.trial_until}})},onDelete:()=>ie(e),onGraduate:()=>ae(e)},e.key))}):(0,D.jsxs)(v,{title:`No user-rules.md here yet`,children:[`The build seeds it beside AGENT.md — run a build/update from the Dashboard (or`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`) and it appears, ready for your rules.`]})]})}var F=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`;function I({onChanged:e,dataRev:t}){let n=g(t);if(n===null)return(0,D.jsx)(p,{});let r=n.length?n:[null],i=r.length>1;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,children:`identity · yours`}),(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),` beside the deployed AGENT.md`,i?` of each install`:``,`. Unlike`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`, it is identity, not rules — it colours how the agent works but never binds (precedence is Laws, then rules, then this). Seeded once, never overwritten by an update. Prefer not to write it by hand? 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.`]})]}),r.map(t=>(0,D.jsx)(L,{install:t,tag:i?m(t):null,onChanged:e},t?.id??``))]})}function L({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:c,setData:u}=h(()=>r.profile(_(e)),[]),d=E({data:i,reload:c}),{draft:f,dirty:m,busy:g,notice:b}=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)(p,{});if(a)return(0,D.jsx)(s,{error:a,onRetry:c});let w=f!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile of ${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)(l,{"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:!m||g,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:f,fingerprint:t},_(e)),{conflict:F});t&&(u(e=>({...e,text:f,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:g?`Saving…`:`Save`})]})]}),b?(0,D.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:b}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value: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)(v,{title:`This is still the template`,action:(0,D.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>d.open(T),children:`Edit it here`}),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)(y,{body:T})})]}):(0,D.jsxs)(v,{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 R=(e,t)=>`${e} ${t}${e===1?``:`s`}`,z=new Set([`MEMORY`,`NOTEBOOK`,`README`]),B=e=>e?(e.items||[]).filter(e=>!z.has(String(e.name).toUpperCase())).length:null;function V({rules:e,profile:t,facts:n,notes:r,tag:i}){let a=e?.exists?e.stats:null;if(!a)return null;let o=Math.round(Math.max(a.rules/a.max_rules,a.tokens/a.max_tokens)*100),[s,c]=o>=100?[`bad`,`over budget: a bloated rule set dilutes the rules that matter`]:o>=70?[`warn`,`getting heavy; consider merging or pruning`]:[`accent`,a.rules?`${a.rules} rules in ${a.lines} lines.`:`All of it is the file’s preamble; no rule text yet.`],l=[{k:`Profile`,v:t?.seeded?`template`:t?.exists?`written`:`missing`,warn:!!t?.seeded},{k:`Rules`,v:`${a.rules}/${a.max_rules}`},{k:`Memory`,v:n==null?`n/a`:R(n,`fact`)},{k:`Notebook`,v:r==null?`n/a`:R(r,`note`)}];return(0,D.jsxs)(`div`,{className:`card-row`,children:[(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-budget`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pc-budget`,children:`Rule budget`}),(0,D.jsxs)(`span`,{className:`mono dim`,children:[a.rules,` of `,a.max_rules,i?` · ${i}`:``]})]}),(0,D.jsx)(`div`,{className:`slots`,style:{"--slots":a.max_rules},role:`img`,"aria-label":`${a.rules} of ${a.max_rules} rule slots used`,children:Array.from({length:a.max_rules},(e,t)=>(0,D.jsx)(`span`,{className:t<a.rules?`used`:``},t))}),(0,D.jsxs)(`p`,{className:`big-num`,children:[(0,D.jsx)(`span`,{className:`mono`,children:a.tokens}),` `,(0,D.jsxs)(`span`,{className:`dim`,children:[`/ `,a.max_tokens.toLocaleString(`en-US`),` tokens, every turn`]})]}),(0,D.jsx)(u,{value:a.tokens,max:a.max_tokens,label:`tokens`,tone:s}),(0,D.jsx)(`p`,{className:`panel-note`,children:c})]}),(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-known`,children:[(0,D.jsx)(`div`,{className:`panel-head`,children:(0,D.jsx)(`h2`,{id:`pc-known`,children:`What the agent knows about you`})}),(0,D.jsx)(`ul`,{className:`hbars`,children:l.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.k}),(0,D.jsx)(`span`,{className:`mono hb-n${e.warn?` warn`:``}`,children:e.v})]},e.k))}),i?(0,D.jsxs)(`p`,{className:`panel-note`,children:[`Profile and rules of `,i,`; memory and notebook across every install.`]}):null]})]})}var H=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,U=e=>String(e||``).split(`
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-BxjLd7Qd.js";import{$ as i,Dt as a,H as o,J as s,Ot as c,Q as l,R as u,W as d,X as f,Y as p,_t as m,bt as h,pt as g,vt as _}from"./index-DA7BiaE5.js";import{t as v}from"./EmptyState-CY5Pm2xy.js";import{t as y}from"./Markdown-C4S4tTA7.js";import{t as b}from"./Tabs-uYJqfuQt.js";import x,{installLabel as S}from"./Library-Guh9HBZU.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=i(),[r,o]=(0,C.useState)(null),[s,l]=(0,C.useState)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(s),g=(0,C.useRef)(!1),_=e=>{o(e),l(e)},v=()=>o(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=c(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),o(null),a(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:o,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:u,notice:f,setNotice:p,save:async(e,{conflict:n}={})=>{d(!0),p(``);try{return await e(m)||!0}catch(e){e.status===409?p(n??T):p(e.message);return}finally{d(!1),t()}}}}var D=n(),O={title:``,body:``,scope:`project`,trial_until:``},k=[`project`,`global`],ee=e=>e===`user`?`global`:e,A=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,j=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),M=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function N({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(A).some(j)?`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 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)`}),k.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 ne({rule:e,tag:t,isOpen:n,onToggle:r,onEdit:i,onDelete:a,onGraduate:o}){let s=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${n?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:r,"aria-expanded":n,"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}),t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):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}`})]}),n&&(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:o,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${s}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:i,"aria-label":`Edit R${e.id}${s}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Retire R${e.id}${s}`,children:`Retire`})]})]})]})}function P({onChanged:e,dataRev:t}){let n=i(),[a,o]=(0,C.useState)(0),c=g(t),l=c===null?null:c.length?c:[null],u=l?l.map(e=>e?.id??``).join(`|`):null,{data:d,error:y}=h(()=>l?Promise.allSettled(l.map(e=>r.rules(_(e)))).then(e=>{if(e.every(e=>e.status===`rejected`))throw e[0].reason;return{sets:e.flatMap((e,t)=>e.status===`fulfilled`?[{inst:l[t],data:e.value}]:[]),failed:e.flatMap((e,t)=>e.status===`rejected`?[l[t]]:[])}}):Promise.resolve(null),[a,u]),b=d?.sets,[x,S]=(0,C.useState)(null),w=()=>o(e=>e+1),T=E({data:null,reload:w}),{draft:k,busy:A,notice:j}=T,P=(0,C.useRef)(null),[F,I]=(0,C.useState)(0),L=e=>{P.current=e,I(e=>e+1)},R=(0,C.useRef)(null),z=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=P.current;if(P.current=null,e===null)return;let t=[...z.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?R.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[F]),y)return(0,D.jsx)(s,{error:y,onRetry:w});if(!b)return(0,D.jsx)(p,{});let B=l.length>1,V=e=>e?.id??``,H=b.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${V(e)}#${t.id}`}))),U=b.filter(e=>e.data.exists).map(e=>e.inst),W=U.length>0,G=k?.target,K=G!==void 0&&G!==`new`&&!H.some(e=>e.key===G&&e.title===k.title0),q=G===`new`||K,J=k?.to!==void 0&&!U.some(e=>V(e)===k.to),Y=J?null:U.find(e=>V(e)===k?.to)??U[0]??null,re=J?(0,D.jsx)(`p`,{className:`sub 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.`}):U.length>1?(0,D.jsx)(f,{installs:U,value:Y,onChange:e=>T.setDraft({...k,to:e.id}),label:`Write to:`}):B&&Y?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Write to:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:m(Y)})]}):null,X=async(t,n,i)=>{let a=b.find(e=>V(e.inst)===V(n))?.data.fingerprint||``,o=await T.save(()=>r.rulesMutate({...t,fingerprint:a},_(n)),{conflict:i?M:te});return o&&i&&T.close(),e?.(),o},Z=e=>T.setDraft({...k,form:e}),Q=async(e,t,n)=>{await X(e,t,!0)&&L(n)},$=async e=>{await T.discard()&&L(e)},ie=async e=>{await n(`Retire rule R${e.id} — “${e.title}”${B?` from ${m(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await X({op:`delete`,id:e.id},e.inst)&&k===null&&L(`add`)},ae=async e=>{await X({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&L(e.key)},oe=b.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>B?`${m(e)}: ${t}`:t));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`eyebrow`,children:`governance · yours`}),(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub`,children:[`Your own standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),` beside the deployed AGENT.md`,B?` of each install, each rule tagged with its install`:``,`. The agent obeys them with the same force as the Laws — they may tighten a Law, never repeal one — and no update ever touches the file. Keep the set small: every rule is loaded every session.`]})]}),W&&k===null&&(0,D.jsx)(`button`,{className:`btn`,ref:R,onClick:()=>T.open({target:`new`,title0:``,form:O}),children:`Add rule`})]}),j?(0,D.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:j}):null,d.failed.length?(0,D.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,d.failed.map(e=>e?m(e):`the default install`).join(`, `),`.`]}):null,oe.map(e=>(0,D.jsxs)(`p`,{className:`sub rule-notice`,children:[`format warning: `,e]},e)),q&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),K?(0,D.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Rule R`,k.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)(N,{value:k.form,onChange:Z,busy:A,writeTo:re,onCancel:()=>$(`add`),onSave:e=>!J&&U.length&&Q({op:`add`,...e},Y,`add`)})]}),W?H.length===0&&!q?(0,D.jsx)(v,{title:`No rules yet`,children:`The file is seeded and loaded every session — it is just empty. Add your first standing rule here, ask the agent for one in-session (the rule skill), or promote a recurring memory fact from the Library.`}):(0,D.jsx)(`div`,{className:`card rules-list`,ref:z,children:H.map(e=>!K&&G===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)(N,{value:k.form,onChange:Z,busy:A,onCancel:()=>$(e.key),onSave:t=>Q({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(ne,{rule:e,tag:B?m(e.inst):null,isOpen:x===e.key,onToggle:()=>S(x===e.key?null:e.key),onEdit:()=>{S(e.key),T.open({target:e.key,no:e.id,to:V(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:ee(e.scope),trial_until:e.trial_until}})},onDelete:()=>ie(e),onGraduate:()=>ae(e)},e.key))}):(0,D.jsxs)(v,{title:`No user-rules.md here yet`,children:[`The build seeds it beside AGENT.md — run a build/update from the Dashboard (or`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`) and it appears, ready for your rules.`]})]})}var F=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`;function I({onChanged:e,dataRev:t}){let n=g(t);if(n===null)return(0,D.jsx)(p,{});let r=n.length?n:[null],i=r.length>1;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,children:`identity · yours`}),(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),` beside the deployed AGENT.md`,i?` of each install`:``,`. Unlike`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`, it is identity, not rules — it colours how the agent works but never binds (precedence is Laws, then rules, then this). Seeded once, never overwritten by an update. Prefer not to write it by hand? 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.`]})]}),r.map(t=>(0,D.jsx)(L,{install:t,tag:i?m(t):null,onChanged:e},t?.id??``))]})}function L({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:c,setData:u}=h(()=>r.profile(_(e)),[]),d=E({data:i,reload:c}),{draft:f,dirty:m,busy:g,notice:b}=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)(p,{});if(a)return(0,D.jsx)(s,{error:a,onRetry:c});let w=f!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile of ${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)(l,{"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:!m||g,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:f,fingerprint:t},_(e)),{conflict:F});t&&(u(e=>({...e,text:f,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:g?`Saving…`:`Save`})]})]}),b?(0,D.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:b}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value: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)(v,{title:`This is still the template`,action:(0,D.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>d.open(T),children:`Edit it here`}),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)(y,{body:T})})]}):(0,D.jsxs)(v,{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 R=(e,t)=>`${e} ${t}${e===1?``:`s`}`,z=new Set([`MEMORY`,`NOTEBOOK`,`README`]),B=e=>e?(e.items||[]).filter(e=>!z.has(String(e.name).toUpperCase())).length:null;function V({rules:e,profile:t,facts:n,notes:r,tag:i}){let a=e?.exists?e.stats:null;if(!a)return null;let o=Math.round(Math.max(a.rules/a.max_rules,a.tokens/a.max_tokens)*100),[s,c]=o>=100?[`bad`,`over budget: a bloated rule set dilutes the rules that matter`]:o>=70?[`warn`,`getting heavy; consider merging or pruning`]:[`accent`,a.rules?`${a.rules} rules in ${a.lines} lines.`:`All of it is the file’s preamble; no rule text yet.`],l=[{k:`Profile`,v:t?.seeded?`template`:t?.exists?`written`:`missing`,warn:!!t?.seeded},{k:`Rules`,v:`${a.rules}/${a.max_rules}`},{k:`Memory`,v:n==null?`n/a`:R(n,`fact`)},{k:`Notebook`,v:r==null?`n/a`:R(r,`note`)}];return(0,D.jsxs)(`div`,{className:`card-row`,children:[(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-budget`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pc-budget`,children:`Rule budget`}),(0,D.jsxs)(`span`,{className:`mono dim`,children:[a.rules,` of `,a.max_rules,i?` · ${i}`:``]})]}),(0,D.jsx)(`div`,{className:`slots`,style:{"--slots":a.max_rules},role:`img`,"aria-label":`${a.rules} of ${a.max_rules} rule slots used`,children:Array.from({length:a.max_rules},(e,t)=>(0,D.jsx)(`span`,{className:t<a.rules?`used`:``},t))}),(0,D.jsxs)(`p`,{className:`big-num`,children:[(0,D.jsx)(`span`,{className:`mono`,children:a.tokens}),` `,(0,D.jsxs)(`span`,{className:`dim`,children:[`/ `,a.max_tokens.toLocaleString(`en-US`),` tokens, every turn`]})]}),(0,D.jsx)(u,{value:a.tokens,max:a.max_tokens,label:`tokens`,tone:s}),(0,D.jsx)(`p`,{className:`panel-note`,children:c})]}),(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-known`,children:[(0,D.jsx)(`div`,{className:`panel-head`,children:(0,D.jsx)(`h2`,{id:`pc-known`,children:`What the agent knows about you`})}),(0,D.jsx)(`ul`,{className:`hbars`,children:l.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.k}),(0,D.jsx)(`span`,{className:`mono hb-n${e.warn?` warn`:``}`,children:e.v})]},e.k))}),i?(0,D.jsxs)(`p`,{className:`panel-note`,children:[`Profile and rules of `,i,`; memory and notebook across every install.`]}):null]})]})}var H=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,U=e=>String(e||``).split(`
2
2
  `).map(e=>H.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function W({topics:e,install:t}){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?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:R(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:R(e.n,`fact`)})]},e.topic))})]}):null}var G={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function K({tab:e=`rules`,item:t,dataRev:n}){let i=e=>Promise.resolve(e).catch(()=>null),{data:a,reload:s}=o(n),c=g(n),l=c?.length>1?m(c[0]):null,{data:u,reload:f}=h(()=>i(r.profile()),[n]),{data:p,reload:_}=h(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:y}=h(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),S=B(p),{data:C}=h(()=>e===`memory`?i(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,S]),w=B(y),T={memory:S,notebook:w},E={rules:a?.stats?.rules,profile:u?.seeded?`template`:null,memory:S,notebook:w},O=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(d,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`}),(0,D.jsx)(b,{page:`personal`,current:e,badges:E,label:`Personal files`}),e===`rules`&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(V,{rules:a,profile:u,facts:S,notes:w,tag:l}),(0,D.jsx)(P,{onChanged:s,dataRev:n})]}),e===`profile`&&(0,D.jsx)(I,{onChanged:f,dataRev:n}),O&&T[e]===0&&!t?(0,D.jsx)(v,{title:G[e].title,action:G[e].action,children:G[e].body}):O?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(W,{topics:U(C?.body),install:C?.install}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onRulesChanged:()=>{s(),_()}},e)]}):null]})}export{K as default};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{rt as r}from"./index-DA7BiaE5.js";import{t as i}from"./FilterInput-qGKNSlxv.js";var a=e(t(),1),o=n(),s={experimental:{label:`experimental`,cls:`warn`,icon:`flask`,hint:`Shipped, but not yet confirmed by real use.`},deprecated:{label:`deprecated`,cls:`bad`,icon:`clear`,hint:`On its way out — look for the replacement before building on it.`},personal:{label:`personal`,cls:``,icon:`profile`,hint:`Yours — present in this install, not shipped or versioned by Geneseed.`},unknown:{label:`no status`,cls:``,icon:`about`,hint:`Not listed in registry.json.`}};function c({status:e,withHint:t=!1,compact:n=!1}){let i=s[e];if(!i)return null;if(n)return(0,o.jsxs)(`span`,{className:`badge status-icon ${i.cls}`,title:`${i.label}: ${i.hint}`,children:[(0,o.jsx)(r,{name:i.icon}),(0,o.jsx)(`span`,{className:`sr-only`,children:i.label})]});let a=(0,o.jsxs)(`span`,{className:`badge ${i.cls}`,title:t?void 0:i.hint,children:[(0,o.jsx)(`span`,{className:`dot`}),i.label]});return t?(0,o.jsxs)(o.Fragment,{children:[a,(0,o.jsx)(`span`,{className:`dim`,children:i.hint})]}):a}function l({items:e}){return Object.keys(s).filter(t=>e.some(e=>e.status===t)).map(e=>(0,o.jsxs)(`span`,{title:s[e].hint,children:[(0,o.jsx)(`span`,{className:`badge status-icon ${s[e].cls}`,"aria-hidden":`true`,children:(0,o.jsx)(r,{name:s[e].icon})}),s[e].label]},e))}var u=({name:e})=>(0,o.jsxs)(`span`,{className:`tag acc`,title:`Ships with the ${e} kit`,children:[`kit: `,e]});function d(e,t){let n=(t||``).trim().toLowerCase();return n?e.filter(e=>`${e.title||``} ${e.name||``} ${e.desc||``}`.toLowerCase().includes(n)):e}function f({label:e,count:t,extra:n,tools:r,q:s,onQ:c,matched:l,inView:u,children:d}){let f=_(u);(0,a.useLayoutEffect)(()=>g(f.current));let[p,m]=(0,a.useState)(``),v=(0,a.useRef)(!0);return(0,a.useEffect)(()=>{v.current?v.current=!1:m(f.current?.querySelector(`.lib-row.on`)?.dataset.title||``)},u),(0,o.jsxs)(`section`,{className:`lib-list`,"aria-label":e,onKeyDown:e=>{e.key===`ArrowDown`&&e.target.classList?.contains(`lib-filter`)&&(e.preventDefault(),f.current?.querySelector(`.lib-row`)?.focus())},children:[(0,o.jsxs)(`div`,{className:`lib-list-head`,children:[(0,o.jsxs)(`b`,{children:[e,` `,(0,o.jsx)(`span`,{className:`mono dim`,children:t})]}),n]}),(0,o.jsx)(i,{value:s,onChange:c,placeholder:`Filter ${e.toLowerCase()}`,label:`Filter ${e}`}),r?(0,o.jsx)(`div`,{className:`lib-tools`,children:r}):null,(0,o.jsxs)(`div`,{className:`lib-rows`,ref:f,onKeyDown:h,onFocus:e=>g(e.currentTarget),children:[d,s.trim()&&l===0&&(0,o.jsxs)(`div`,{className:`empty`,style:{padding:32},children:[(0,o.jsx)(`div`,{className:`big`,children:`No matches`}),`Nothing in `,e.toLowerCase(),` matches “`,s.trim(),`”.`]})]}),(0,o.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:p?`${p} opened`:``})]})}function p({item:e,isOpen:t,href:n,children:r}){return(0,o.jsxs)(`a`,{className:`lib-row${t?` on`:``}`,href:n,"aria-current":t?`true`:void 0,"data-title":e.title||e.name,children:[(0,o.jsxs)(`span`,{className:`lr-name`,children:[e.title||e.name,(0,o.jsx)(c,{status:e.status,compact:!0}),e.kit?(0,o.jsx)(u,{name:e.kit}):null,r]}),e.desc?(0,o.jsx)(`span`,{className:`lr-desc`,children:e.desc}):null,e.meta?(0,o.jsx)(`span`,{className:`lr-meta mono`,children:e.meta}):null]})}function m({rows:e,activeName:t,hrefOf:n,pills:r}){let i=null,a=[];for(let s of e)s.group&&s.group!==i&&(i=s.group,a.push((0,o.jsxs)(`div`,{className:`lib-group`,children:[s.groupC?(0,o.jsx)(`span`,{className:`cdot`,style:{"--cc":s.groupC},"aria-hidden":`true`}):null,s.group]},`g-${s.group}`))),a.push((0,o.jsx)(p,{item:s,isOpen:t===s.name,href:n(s),children:r?.(s)},s.name));return a}function h(e){let t=[...e.currentTarget.querySelectorAll(`.lib-row`)],n=t.indexOf(document.activeElement);if(n===-1)return;let r={ArrowDown:Math.min(n+1,t.length-1),ArrowUp:Math.max(n-1,0),Home:0,End:t.length-1}[e.key];r!==void 0&&(e.preventDefault(),t[r].focus())}function g(e){if(!e)return;let t=[...e.querySelectorAll(`.lib-row`)],n=t.find(e=>e===document.activeElement)||e.querySelector(`.lib-row.on`)||t[0];for(let e of t)e.tabIndex=e===n?0:-1}function _(e){let t=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=t.current,n=e?.querySelector(`.lib-row.on`);if(!n||!e)return;let r=n.offsetTop;r>=e.scrollTop&&r+n.clientHeight<=e.scrollTop+e.clientHeight||(e.scrollTop=Math.max(0,r-e.clientHeight/2+n.clientHeight/2))},e),t}function v({label:e,total:t,cats:n,cat:r,onChange:i}){if(n.length<=1)return null;let a=[{key:`all`,label:`All`,n:t,c:`var(--text-3)`},...n];return(0,o.jsxs)(`div`,{className:`rail-cats`,children:[(0,o.jsx)(`ul`,{"aria-label":e,children:a.map(({key:e,label:t,n,c:a})=>(0,o.jsx)(`li`,{children:(0,o.jsxs)(`button`,{type:`button`,className:r===e?`on`:``,"aria-pressed":r===e,style:{"--cc":a},onClick:()=>i(e),children:[(0,o.jsx)(`span`,{className:`cdot`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`rc-name`,children:t}),(0,o.jsx)(`span`,{className:`mono dim`,children:n})]})},e))}),(0,o.jsx)(`div`,{className:`rail-mix`,"aria-hidden":`true`,children:n.map(({key:e,n:t,c:n})=>(0,o.jsx)(`span`,{className:r===`all`||r===e?``:`dim`,style:{"--cc":n,flexGrow:t}},e))})]})}function y(e){let t=[],n=new Map;for(let r of e)n.has(r.group)||t.push(r.group),n.set(r.group,(n.get(r.group)||0)+1);return t.map(e=>({key:e,label:e,n:n.get(e),c:`var(--accent)`}))}export{f as a,l as c,u as i,y as n,d as o,m as r,c as s,v as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{Et as n,Tt as r}from"./index-CzDi9JpF.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:a[r]?.of?(0,i.jsxs)(`span`,{className:`tab-badge`,title:`for ${a[r].of}`,children:[a[r].v,(0,i.jsxs)(`span`,{className:`sr-only`,children:[` for `,a[r].of]})]}):(0,i.jsx)(`span`,{className:`tab-badge`,children:a[r]?.v??a[r]})]},r))})}export{a as t};
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Et as n,Tt as r}from"./index-DA7BiaE5.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:a[r]?.of?(0,i.jsxs)(`span`,{className:`tab-badge`,title:`for ${a[r].of}`,children:[a[r].v,(0,i.jsxs)(`span`,{className:`sr-only`,children:[` for `,a[r].of]})]}):(0,i.jsx)(`span`,{className:`tab-badge`,children:a[r]?.v??a[r]})]},r))})}export{a as t};