geneseed 5.6.0 → 6.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +2 -2
  3. package/SHIPPED.md +2 -2
  4. package/adapters/opencode/README.md +7 -4
  5. package/docs/concepts/agents.md +10 -0
  6. package/docs/concepts/exclusions.md +1 -1
  7. package/docs/concepts/foreman-mode.md +4 -2
  8. package/docs/concepts/kits.md +20 -2
  9. package/docs/concepts/loops.md +5 -0
  10. package/docs/concepts/skills.md +1 -1
  11. package/docs/concepts/superpowers-kit.md +79 -0
  12. package/docs/extending.md +11 -4
  13. package/docs/guides/install-scripted.md +1 -1
  14. package/docs/reference/cli.md +2 -0
  15. package/docs/reference/profiles.md +10 -5
  16. package/harness.config.json +1 -1
  17. package/js/README.md +3 -0
  18. package/js/build/args.mjs +4 -2
  19. package/js/build/driver.mjs +8 -8
  20. package/js/build/emit-claude.mjs +5 -3
  21. package/js/build/emit-opencode.mjs +2 -2
  22. package/js/build/generate.mjs +1 -1
  23. package/js/build/profile.mjs +15 -7
  24. package/js/build/render.mjs +81 -10
  25. package/js/build/source.mjs +75 -1
  26. package/js/cli-table.json +17 -2
  27. package/js/hosts/installs.mjs +50 -4
  28. package/js/hosts/native.mjs +125 -9
  29. package/js/hosts/opencode.mjs +13 -15
  30. package/js/inspect/checks-authoring.mjs +24 -1
  31. package/js/inspect/checks-build.mjs +43 -2
  32. package/js/inspect/checks-counts.mjs +72 -1
  33. package/js/inspect/diff.mjs +17 -3
  34. package/js/inspect/doctor.mjs +23 -2
  35. package/js/inspect/status.mjs +5 -1
  36. package/js/inspect/validate.mjs +1 -1
  37. package/js/loop/catalog.mjs +10 -0
  38. package/js/maintain/kit-migration.mjs +109 -0
  39. package/js/maintain/plugin-detect.mjs +150 -0
  40. package/js/maintain/profiles.mjs +46 -5
  41. package/js/maintain/setup.mjs +45 -11
  42. package/js/maintain/update.mjs +1 -1
  43. package/js/web/actions.mjs +28 -7
  44. package/js/web/agent-models-api.mjs +172 -0
  45. package/js/web/api.mjs +3 -1
  46. package/js/web/profiles-api.mjs +11 -7
  47. package/js/web/routes.mjs +5 -1
  48. package/package.json +1 -1
  49. package/profiles/autonomous.json +1 -0
  50. package/profiles/corporate.json +1 -1
  51. package/profiles/mentor.json +1 -0
  52. package/profiles/minimal.json +2 -1
  53. package/profiles/starter.json +1 -1
  54. package/src/AGENT.md.tmpl +1 -6
  55. package/src/agents/_template.md +4 -0
  56. package/src/agents/advocate.md +1 -0
  57. package/src/agents/architect.md +1 -0
  58. package/src/agents/developer.md +12 -4
  59. package/src/agents/empiricist.md +1 -0
  60. package/src/agents/explorer.md +1 -0
  61. package/src/agents/framer.md +1 -0
  62. package/src/agents/historian.md +1 -0
  63. package/src/agents/operator.md +1 -0
  64. package/src/agents/performance.md +2 -1
  65. package/src/agents/pragmatist.md +1 -0
  66. package/src/agents/react-reviewer.md +1 -0
  67. package/src/agents/researcher.md +1 -0
  68. package/src/agents/reviewer.md +1 -0
  69. package/src/agents/security.md +1 -0
  70. package/src/agents/skeptic.md +1 -0
  71. package/src/agents/spring-reviewer.md +1 -0
  72. package/src/agents/spring-security.md +1 -0
  73. package/src/agents/steward.md +1 -0
  74. package/src/agents/user-advocate.md +1 -0
  75. package/src/agents/visionary.md +1 -0
  76. package/src/bricks/ci-fix.md +12 -2
  77. package/src/kits/superpowers/missing.md +3 -0
  78. package/src/kits/superpowers/provider.md +7 -0
  79. package/src/kits/superpowers/rules.md +6 -0
  80. package/src/kits/superpowers.json +45 -0
  81. package/src/modes/foreman.md +18 -12
  82. package/src/skills/parallel-agents.md +2 -2
  83. package/src/skills/spring-boot/cloud.md +8 -2
  84. package/src/skills/spring-boot.md +3 -1
  85. package/src/skills/spring-testing.md +3 -3
  86. package/src/upstreams.json +1 -1
  87. package/web/dist/assets/{ActiveLoops-DOJCPPPc.js → ActiveLoops-6p44eD86.js} +1 -1
  88. package/web/dist/assets/{Activity-bUSPM3Dl.js → Activity-CIgrq5R1.js} +1 -1
  89. package/web/dist/assets/{ActivityDetail-AHRoXeFN.js → ActivityDetail-Brqv1u4f.js} +1 -1
  90. package/web/dist/assets/{Bonsai-B5XY9pid.js → Bonsai-8NtlFrPO.js} +1 -1
  91. package/web/dist/assets/{CopyButton-C0wwRR9H.js → CopyButton-BHqKgdjJ.js} +1 -1
  92. package/web/dist/assets/{Dashboard-DPAA96EI.js → Dashboard-CoveJ_-U.js} +2 -2
  93. package/web/dist/assets/{Docs-CpGDq165.js → Docs-C1jzrFnD.js} +1 -1
  94. package/web/dist/assets/{Factories-cNhETa5Q.js → Factories-D5pLnt5S.js} +1 -1
  95. package/web/dist/assets/{GreenhouseView-DO3ADmT9.js → GreenhouseView-ofAQ-V5h.js} +1 -1
  96. package/web/dist/assets/Installs-DpWgyT5j.js +3 -0
  97. package/web/dist/assets/{JournalView--W-Lw_V9.js → JournalView-CsuN3_B-.js} +1 -1
  98. package/web/dist/assets/{Kits-ChfehxY6.js → Kits-P4xspDuN.js} +1 -1
  99. package/web/dist/assets/{Laws-CNxYmV36.js → Laws-DK3OwGDl.js} +1 -1
  100. package/web/dist/assets/{LibRows-CiPvsRYB.js → LibRows-CGO25X3D.js} +1 -1
  101. package/web/dist/assets/Library-e-94YED6.js +3 -0
  102. package/web/dist/assets/{Loops-DAblKkyq.js → Loops-C9DSBj-A.js} +1 -1
  103. package/web/dist/assets/{OperatorHudView-QtSaSyYm.js → OperatorHudView-Cc8mlViW.js} +1 -1
  104. package/web/dist/assets/{Personal-DxSGv638.js → Personal-DVh2jYPO.js} +1 -1
  105. package/web/dist/assets/{Settings-CgTbhvRv.js → Settings-CknBI-Fx.js} +1 -1
  106. package/web/dist/assets/{Tabs-Cf4X1hdz.js → Tabs-C30JrkJH.js} +1 -1
  107. package/web/dist/assets/api-DxwG8y94.js +1 -0
  108. package/web/dist/assets/index-CUJ8AaAF.css +1 -0
  109. package/web/dist/assets/{index-B_pTwZra.js → index-MB7E-va_.js} +3 -3
  110. package/web/dist/index.html +3 -3
  111. package/web/dist/assets/Installs-D3dDyq10.js +0 -3
  112. package/web/dist/assets/Library-BxQvbwVU.js +0 -3
  113. package/web/dist/assets/api-CZ-x0iWG.js +0 -1
  114. package/web/dist/assets/index-CzfImiYb.css +0 -1
@@ -0,0 +1,3 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-CxkA7940.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/AgentGlyph-k6o3gCM1.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DxwG8y94.js";import{B as i,Ot as a,S as o,U as s,Y as c,_t as l,at as u,dt as ee,et as d,it as f,mt as p,rt as m,t as h,tt as g,ut as _,wt as v,x as y}from"./index-MB7E-va_.js";import{n as b,t as x}from"./sections-CtFz7HFH.js";import{a as te,c as ne,i as re,l as ie,n as ae,o as oe,r as se,t as ce}from"./LibRows-CGO25X3D.js";import{t as le}from"./EmptyState-CY5Pm2xy.js";import{o as S}from"./motion-RlUl1osO.js";var C=e(t(),1),w=n();function ue({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,w.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function T({entries:e}){return e.length?(0,w.jsxs)(`table`,{className:`mf-entries`,children:[(0,w.jsx)(`thead`,{className:`sr-only`,children:(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`th`,{scope:`col`,children:`Path`}),(0,w.jsx)(`th`,{scope:`col`,children:`Load`}),(0,w.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,w.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,w.jsxs)(`tr`,{children:[(0,w.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,w.jsx)(`td`,{className:`mf-load-cell`,children:(0,w.jsx)(ue,{load:e.load})}),(0,w.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function de({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,w.jsxs)(`div`,{className:`mf-vault`,children:[(0,w.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,w.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,w.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,w.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,w.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,w.jsxs)(`span`,{className:`mf-role`,children:[(0,w.jsx)(l,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,w.jsxs)(`span`,{className:`mf-role`,children:[(0,w.jsx)(l,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,w.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,w.jsx)(l,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,w.jsx)(T,{entries:t})]})}function E({body:e}){let[t,n]=(0,C.useState)(!1),r=(0,C.useId)();return e?(0,w.jsxs)(`div`,{className:`mf-raw`,children:[(0,w.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,w.jsx)(l,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,w.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function fe({manifest:e,body:t,name:n}){if(!e)return(0,w.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,w.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,w.jsx)(de,{wiki:e},e.name||t)),(0,w.jsx)(E,{body:t})]}):(0,w.jsxs)(`div`,{className:`mf-empty`,children:[(0,w.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,w.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,w.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,w.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,w.jsx)(E,{body:t})]})}let r=e.context||[];return r.length?(0,w.jsxs)(`div`,{className:`mf-doc`,children:[(0,w.jsx)(T,{entries:r}),(0,w.jsx)(E,{body:t})]}):(0,w.jsxs)(`div`,{className:`mf-empty`,children:[(0,w.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,w.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,w.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,w.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,w.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,w.jsx)(E,{body:t})]})}var D={strong:`acc`,standard:``,light:`ok`},pe={pin:`your pin`,map:`the tiers map`,default:`the tier default`,inherit:`your session model`};function me({name:e,install:t,installName:n}){let{data:i,error:a,setData:o}=v(()=>Promise.resolve().then(()=>r.agentModels(t)),[e,t?.host,t?.path]),[s,c]=(0,C.useState)(null),[l,u]=(0,C.useState)(``),[ee,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(!1),m=i?.agents?.find(t=>t.name===e);if(a||!m)return null;let h=m.from===`pin`?null:i.warnings?.find(e=>e.includes(`the ${m.tier} tier`)),g=n?` on ${n}`:``,_=m.pin??``,y=s??_,b=async n=>{p(!0),u(``);try{let i=await r.agentModelsSave({agents:{[e]:n}},t);o(i),c(null),d(!0)}catch(e){u(e.message)}finally{p(!1)}};return(0,w.jsxs)(`div`,{className:`agent-model`,role:`group`,"aria-label":`Model of ${e}`,children:[(0,w.jsxs)(`div`,{className:`row gap-8 wrap`,children:[m.tier?(0,w.jsxs)(`span`,{className:`tag ${D[m.tier]??``}`,title:`The tier this agent's source declares`,children:[m.tier,` tier`]}):(0,w.jsx)(`span`,{className:`tag`,title:`No Geneseed source: not tiered`,children:`not tiered`}),i.claude?(0,w.jsxs)(`span`,{className:`sub`,"data-testid":`agent-model-effective`,children:[m.model?(0,w.jsxs)(w.Fragment,{children:[`runs on `,(0,w.jsx)(`code`,{children:m.model}),` (`,pe[m.from],`)`]}):(0,w.jsx)(w.Fragment,{children:`runs on your session model`}),g]}):null]}),i.claude?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`label`,{className:`row gap-8 wrap`,children:[(0,w.jsx)(`span`,{className:`dim`,children:`Pin a model`}),(0,w.jsx)(`input`,{className:`inp`,type:`text`,"aria-label":`pin a model for ${e}`,placeholder:`none: follows the tier`,disabled:!!i.file?.problem||f,value:y,onChange:e=>{c(e.target.value),d(!1)}}),(0,w.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:f||!!i.file?.problem||s===null||s.trim()===_,onClick:()=>b(s.trim()),children:`Save pin`}),_?(0,w.jsx)(`button`,{type:`button`,className:`btn ghost sm`,disabled:f||!!i.file?.problem,onClick:()=>b(null),children:`Clear pin`}):null]}),i.file?.problem?(0,w.jsxs)(`p`,{className:`sub tiers-warn`,role:`alert`,children:[i.file.problem,`.`]}):null,h?(0,w.jsx)(`p`,{className:`sub tiers-warn`,role:`note`,children:h}):null,l?(0,w.jsx)(`p`,{className:`sub tiers-warn`,role:`alert`,children:l}):null,ee?(0,w.jsx)(`p`,{className:`sub`,children:`Saved. The agent file changes at the next rebuild of this install.`}):null]}):null]})}var O=e=>e>=1e3?`${(e/1e3).toFixed(+(e<1e4))}k`:String(e),he=e=>Math.round(e/4),k=[{key:`root`,label:`Constitution`,tone:`accent`,has:e=>e.source===`root`},{key:`catalogue`,label:`Catalogues`,tone:`muted`,has:e=>e.source===`catalogue`},{key:`agent`,label:`This agent`,tone:`warn`,has:e=>e.source!==`root`&&e.source!==`catalogue`}],A=[[`dictate`,`Dictates`],[`doctrine`,`Doctrines`],[`user`,`User rules`]],ge={"not-wired":`not wired, re-emit this install`,"no-event":`not delivered on this host`};function j(e,t){if(!e||!t)return``;let n=(e,t)=>e.blocks.filter(e=>e.chars>0&&!t.blocks.some(t=>t.id===e.id)),r=e=>e.id===`session-files`?`session files`:e.label.replace(/^.* spec$/,`spec`);return[...n(e,t).map(e=>`+ ${r(e)} ${O(e.chars)}`),...n(t,e).map(e=>`− ${r(e)} ${O(e.chars)}`)].join(`, `)}var _e=e=>e.kind===`user`?`#/personal/rules`:`#/item/law/${encodeURIComponent(e.id)}`,ve=e=>`${e.layer??``}${e.id}`;function ye({label:e,n:t,children:n}){return(0,w.jsxs)(`li`,{children:[(0,w.jsx)(`span`,{children:e}),n,(0,w.jsx)(`span`,{className:`mono`,children:O(t)})]})}function be({loadout:e,base:t,error:n,install:r}){let[a,o]=(0,C.useState)(!1),[s,c]=(0,C.useState)(e?.agent);if(e?.agent!==s&&(c(e?.agent),o(!1)),n)return(0,w.jsx)(`p`,{className:`sub`,children:`Loadout not measured for this install.`});if(!e)return null;let l=e=>e.reduce((e,t)=>e+t.chars,0),u=l(e.blocks),ee=j(e,t),d=k.map(t=>{let n=e.blocks.filter(t.has);return{...t,blocks:n,n:l(n)}}),[f,p,m]=d,h=Math.max(1,...f.blocks.map(e=>e.chars)),g=e.blocks.find(e=>e.id===`user-rules`),_=g?ge[g.delivery]:void 0,v=e.rules||[],y=v.filter(e=>!(_&&e.kind===`user`)),b=v.filter(e=>e.citedBySpec),x=[];for(let e of v){let t=e.kind===`dictate`?`Dictates`:e.kind===`user`?`User rules`:e.id.split(`.`)[0],n=x.find(e=>e.name===t);n?n.n+=1:x.push({name:t,n:1,user:e.kind===`user`})}let te=A.map(([e,t])=>[t,y.filter(t=>t.kind===e).length]).filter(([,e])=>e>0);return(0,w.jsxs)(`section`,{className:`loadout`,"aria-label":`Loadout`,children:[(0,w.jsxs)(`header`,{className:`loadout-head`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`h3`,{className:`loadout-eyebrow mono`,children:[`Loadout · `,r||e.host]}),(0,w.jsxs)(`p`,{className:`loadout-total`,children:[(0,w.jsx)(`strong`,{children:O(he(u))}),(0,w.jsxs)(`span`,{className:`dim`,children:[`tokens at start · `,O(u),` chars`]})]})]}),ee?(0,w.jsxs)(`div`,{className:`loadout-delta`,children:[(0,w.jsxs)(`span`,{className:`dim`,children:[`Against the `,t?.noun||`Primary agent`]}),(0,w.jsx)(`ul`,{children:ee.split(`, `).map(e=>(0,w.jsx)(`li`,{className:`mono loadout-pill${e.startsWith(`+`)?` is-plus`:``}`,children:e},e))})]}):null]}),(0,w.jsxs)(`div`,{className:`loadout-bar`,children:[(0,w.jsx)(i,{label:`Loadout`,legend:!1,parts:d.map(e=>({key:e.key,label:e.label,n:e.n,tone:e.tone}))}),(0,w.jsx)(`ul`,{className:`loadout-groups`,"aria-hidden":`true`,children:d.map(e=>e.n>0?(0,w.jsxs)(`li`,{style:{flexGrow:e.n},children:[(0,w.jsx)(`span`,{children:e.label}),` `,(0,w.jsxs)(`span`,{className:`mono dim`,children:[O(e.n),` · `,Math.round(e.n/u*100),`%`]})]},e.key):null)})]}),(0,w.jsxs)(`details`,{className:`loadout-card`,open:e.agent===`primary`,children:[(0,w.jsxs)(`summary`,{children:[(0,w.jsx)(`i`,{className:`tone-accent`,"aria-hidden":`true`}),(0,w.jsx)(`strong`,{children:`Constitution`}),(0,w.jsx)(`span`,{className:`dim`,children:`root file, loaded by the host`}),(0,w.jsxs)(`span`,{className:`mono dim loadout-sum`,children:[O(f.n),` · ≈ `,O(he(f.n)),` tok`]})]}),(0,w.jsx)(`ul`,{className:`loadout-root`,children:f.blocks.map(e=>(0,w.jsx)(ye,{label:e.label,n:e.chars,children:(0,w.jsx)(`span`,{className:`loadout-mini`,"aria-hidden":`true`,children:(0,w.jsx)(`span`,{style:{width:`${Math.max(4,e.chars/h*100)}%`}})})},e.id))})]}),(0,w.jsxs)(`div`,{className:`loadout-pair`,children:[(0,w.jsxs)(`div`,{className:`loadout-card`,children:[(0,w.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,w.jsx)(`i`,{className:`tone-muted`,"aria-hidden":`true`}),(0,w.jsx)(`strong`,{children:`Catalogues`}),(0,w.jsx)(`span`,{className:`mono dim loadout-sum`,children:O(p.n)})]}),(0,w.jsx)(`ul`,{className:`loadout-list`,children:p.blocks.map(e=>(0,w.jsx)(ye,{label:e.label,n:e.chars},e.id))}),(0,w.jsx)(`p`,{className:`dim loadout-note`,children:`Listed by the host, not by Geneseed.`})]}),(0,w.jsxs)(`div`,{className:`loadout-card is-own`,children:[(0,w.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,w.jsx)(`i`,{className:`tone-warn`,"aria-hidden":`true`}),(0,w.jsx)(`strong`,{children:`This agent`}),(0,w.jsx)(`span`,{className:`mono dim loadout-sum`,children:O(m.n)})]}),(0,w.jsx)(`ul`,{className:`loadout-list`,children:m.blocks.map(e=>(0,w.jsx)(ye,{label:e.label,n:e.chars,children:e.id===`user-rules`?(0,w.jsx)(`span`,{className:`loadout-pill${_?` is-plus`:``}`,children:_||`injected at sub-agent start`}):null},e.id))})]})]}),(0,w.jsxs)(`section`,{className:`loadout-rules`,"aria-label":`Rules it follows`,children:[(0,w.jsxs)(`div`,{className:`loadout-rules-h`,children:[(0,w.jsxs)(`h4`,{className:`loadout-eyebrow mono`,children:[`Rules it follows · `,y.length]}),(0,w.jsx)(`span`,{className:`dim`,children:te.map(([e,t])=>`${t} ${e}`).join(` · `)})]}),b.length?(0,w.jsxs)(`div`,{className:`loadout-cited`,children:[(0,w.jsx)(`span`,{className:`loadout-cited-h`,children:`Cited by its spec`}),b.map(e=>(0,w.jsxs)(`a`,{href:_e(e),children:[(0,w.jsx)(`span`,{className:`mono`,children:e.id}),` · `,e.title]},ve(e)))]}):null,(0,w.jsx)(`ul`,{className:`loadout-packs`,children:x.map(e=>e.user&&_?(0,w.jsxs)(`li`,{className:`is-muted`,children:[(0,w.jsx)(`span`,{children:`User rules`}),` `,(0,w.jsx)(`span`,{className:`mono`,children:e.n}),` `,(0,w.jsx)(`span`,{className:`dim`,children:_})]},e.name):(0,w.jsx)(`li`,{children:(0,w.jsxs)(`a`,{href:e.user?`#/personal/rules`:`#/laws`,children:[(0,w.jsx)(`span`,{children:e.name}),` `,(0,w.jsx)(`span`,{className:`mono dim`,children:e.n})]})},e.name))}),v.length?(0,w.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":a,onClick:()=>o(e=>!e),children:a?`Show fewer`:`Show all ${v.length}${_?` listed`:``} rules`}):null,a?A.map(([e,t])=>{let n=v.filter(t=>t.kind===e),r=_&&e===`user`;return n.length?(0,w.jsxs)(`div`,{className:r?`is-muted`:void 0,children:[(0,w.jsxs)(`h5`,{className:`reader-when-h`,children:[t,` `,(0,w.jsx)(`span`,{className:`mono dim`,children:n.length}),r?(0,w.jsxs)(`span`,{className:`dim`,children:[` · `,_]}):null]}),(0,w.jsx)(`ul`,{children:n.map(e=>(0,w.jsxs)(`li`,{children:[r?(0,w.jsxs)(`span`,{children:[(0,w.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}):(0,w.jsxs)(`a`,{href:_e(e),children:[(0,w.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}),e.layer&&e.layer!==`install`?(0,w.jsxs)(`span`,{className:`dim`,children:[` (`,e.layer,`)`]}):null]},ve(e)))})]},e):null}):null]}),(0,w.jsxs)(`p`,{className:`dim loadout-foot`,children:[`Not counted: `,e.notCounted.join(`; `),`. Tokens are chars ÷ 4.`]})]})}function xe({label:e,options:t,value:n,onChange:r}){let[i,a]=(0,C.useState)(!1),o=(0,C.useRef)(null),s=(0,C.useId)(),c=t.find(e=>e.key===n)||t[0],l=()=>a(!1);return(0,C.useEffect)(()=>{i&&document.getElementById(s)?.querySelector(`[aria-pressed="true"]`)?.focus()},[i,s]),(0,w.jsxs)(`span`,{className:`drop-menu`,children:[(0,w.jsxs)(`button`,{ref:o,type:`button`,className:`drop-menu-btn`,"aria-label":`${e}: ${c.label}`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-controls":i?s:void 0,onClick:()=>a(e=>!e),children:[c.label,(0,w.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,w.jsx)(f,{open:i,onClose:l,anchorRef:o,label:e,className:`drop-menu-pop`,children:(0,w.jsx)(`div`,{id:s,className:`drop-menu-list`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(document.activeElement);e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()},children:t.map(e=>(0,w.jsx)(`button`,{type:`button`,"aria-pressed":e.key===c.key,onClick:()=>{r(e.key),l()},children:e.label},e.key))})})]})}function Se({label:e,value:t,delta:n,children:r}){let i=S(Number.isInteger(t)?t:null);return(0,w.jsxs)(`div`,{className:`stat`,children:[(0,w.jsx)(`div`,{className:`stat-label`,children:e}),(0,w.jsx)(`div`,{className:`stat-value mono`,children:i===null?t:Math.round(i)}),n==null?null:(0,w.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var Ce=(0,C.lazy)(()=>h(()=>import(`./Markdown-CxkA7940.js`).then(e=>e.n),__vite__mapDeps([0,1,2]))),we=(0,C.lazy)(()=>h(()=>import(`./AgentGlyph-k6o3gCM1.js`),__vite__mapDeps([3,1,2]))),Te={skills:`skill`,agents:`agent`},Ee=`:primary`,De=(e,t)=>`${t?e/t*100:0}%`,Oe=e=>e.split(`:`).slice(0,2).join(` `),ke=e=>e.split(`/`).map((e,t)=>(0,w.jsxs)(C.Fragment,{children:[t?`/`:null,t?(0,w.jsx)(`wbr`,{}):null,e]},t)),M=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},Ae=e=>p(M(e));function je(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 Me({section:e,source:t}){return(0,w.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,w.jsx)(l,{name:b[e].icon,className:`glyph`}),(0,w.jsxs)(`span`,{children:[`This entry is part of the `,b[e].label.toLowerCase(),` convention; see`,` `,(0,w.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var N=e=>e.replace(/\s+/g,` `).trim(),Ne=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Pe(e,t){let n=e.replace(/\r\n/g,`
3
+ `),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=Ne(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?N(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?N(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=Ne(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function Fe({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,w.jsx)(`div`,{className:`lib-stats`,children:(0,w.jsx)(Se,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(Oe))].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,w.jsx)(`div`,{className:`lib-stats`,children:(0,w.jsx)(Se,{label:`Used`,value:e.n,delta:o,children:(0,w.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,w.jsx)(`i`,{className:t===29?`today`:``,style:{height:De(e,a)}},t))})})})}function Ie(e){let t=/\s*\bUse when:\s*/i.exec(e||``);if(!t)return{lede:e||``,when:``};let n=e.slice(t.index+t[0].length).trim();return{lede:e.slice(0,t.index).trim(),when:n&&n[0].toUpperCase()+n.slice(1)}}var Le={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},Re=(e,t)=>t||(e&&x.includes(e)?e:x[0]),ze=encodeURIComponent;function Be(e){let t=e=>y[e.klass]?e.klass:`personal`,n=o.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:y[n].label,groupC:y[n].c})));return{rows:n,cats:o.map(e=>({key:e,label:y[e].label,c:y[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ve(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function He({overview:e,section:t,selected:n,dataRev:i,lock:o,base:l,onRulesChanged:f,onCountsChanged:p}){let h=u(),[S,ue]=(0,C.useState)(()=>Re(t,o)),[T,de]=(0,C.useState)(``),[E,D]=(0,C.useState)(`all`),[pe,O]=(0,C.useState)(`all`),[he,k]=(0,C.useState)(``),[A,ge]=(0,C.useState)(null),[j,_e]=(0,C.useState)(null),[ve,ye]=(0,C.useState)(t);if(t!==ve){ye(t),k(``);let e=Re(t,o);e!==S&&(ue(e),de(``),D(`all`),O(`all`))}let[Se,Oe]=(0,C.useState)(n);n!==Se&&(Oe(n),k(``));let{data:N,error:Ne,reload:He}=v(()=>r.catalog(S),[S,i],`catalog`),Ue=o?null:Te[S]||null,We=Ue!==null,{data:P}=v(()=>We?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[We,i],`usage`,{revalidate:!0}),F=We&&!!P?.enabled&&Array.isArray(P.names),Ge=(0,C.useMemo)(()=>new Map((Array.isArray(P?.names)?P.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[P]),Ke=e=>F&&Ge.get(`${Ue}\u0000${e}`)||null,qe=e=>{let t=Ke(e.name);return!t||t.n===0&&!t.last},Je=P?.since?`No call since ${P.since}`:`No call recorded yet`,I=N?.section===S,L=I&&N?.items||[],Ye=!I&&!Ne,[Xe,...Ze]=I&&N.sharedInstalls||[],R=e=>e===Xe?`shared`:Ae(e),z=S===`skills`,Qe=z?Be(L):null,$e=z?Qe.rows:S===`memory`?Ve(L):L,B=n||$e[0]?.name||null,V=S===`agents`&&!o,H=V&&B===`:primary`,{data:et,error:tt}=v(()=>V?Promise.resolve().then(()=>r.loadout()):Promise.resolve(null),[V,i],`loadout-primary`,{revalidate:!0}),nt=V?{name:Ee,type:`agent`,base:!0,title:!tt&&et?.noun||`Primary agent`,desc:`The main agent of the session. Every agent inherits its root file.`}:null,rt=H?nt:B?L.find(e=>e.name===B):null,it=rt?.type||b[S].type,U=j?.sec===S&&j?.name===B?j.key:null,{data:at,error:ot}=v(()=>!B||H?Promise.resolve(null):U?r.item(it,B,M(U)):r.item(it,B),[S,B,it,U,i,H]),W=ot?null:at,st=W&&W.name===B&&(!U||W.install===U)?W:null,ct=e=>q&&e?.install?` in ${R(e.install)}`:``,G=H?null:U||W?.install||null,lt=V&&B&&!H&&W&&W.name===B,{data:ut,error:dt}=v(()=>lt?Promise.all([r.loadout(B,G?M(G):void 0),r.loadout(void 0,G?M(G):void 0).catch(()=>null)]).then(([e,t])=>({own:e,base:t})):Promise.resolve(null),[lt,B,G,i]),ft=H?{own:tt?null:et,base:null}:ut,pt=H?tt:dt,mt=he||Ne||ot,ht=B?{name:B,title:W?.title||B,desc:W?.desc||``}:null,K=rt||ht,gt=t=>t===S&&I?L.length:e?.counts?.[t]??``,_t=c(i),vt=G||_t?.[0]?.id,yt=vt?Ae(vt):void 0,q=new Set(L.flatMap(e=>e.installs||[])).size>1,bt=ee([...(_t||[]).map(e=>e.id),...L.flatMap(e=>e.installs||[])],Ze),J=z?$e.filter(e=>E===`all`||e.cat===E):$e,xt=F?J.filter(qe).length:0,St=e=>e.status===`experimental`,Ct=J.filter(St).length,Y=[[`all`,`All`,J.length],...F?[[`used`,`Used`,J.length-xt],[`unused`,`Not used yet`,xt,Je]]:[],...Ct?[[`experimental`,`Experimental`,Ct,`Shipped, not yet confirmed by real use`]]:[]],X=Y.some(([e])=>e===pe)?pe:`all`,wt=X===`all`?J:X===`experimental`?J.filter(St):J.filter(e=>qe(e)===(X===`unused`)),Tt=F?Math.max(0,...L.map(e=>Ke(e.name)?.n||0)):0,Et=z?1/0:50,Z=T.trim().toLowerCase(),Q=Z?te(wt,Z):wt.slice(0,Et),Dt=!Z&&E===`all`&&X===`all`&&B&&!Q.some(e=>e.name===B)?[...Q,...$e.filter(e=>e.name===B)]:Q,Ot=nt&&I&&E===`all`&&X===`all`?te([nt],Z):[],kt=Ot.length+Q.length,At=[...Ot,...Dt],jt=e=>l?`${l}/${ze(e.name)}`:`#/item/${e.type||b[S].type}/${ze(e.name)}`,Mt=async()=>{let e=st;if(!e)return;let t=e.name;if(await h(`Forget the memory fact "${t}"${ct(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`})){k(``);try{await r.memoryDelete(t,e.install?M(e.install):void 0)}catch(e){k(`Could not forget "${t}": ${e.message}`);return}a(l||`#/personal/memory`),He(),p?.()}},Nt=async()=>{let e=st;if(!e)return;let t=e.name;if(await h(`Promote "${t}"${ct(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`})){k(``);try{let n=e.install?M(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),s(),f?.(),p?.(),a(`#/personal/rules`)}catch(e){k(`Could not promote: ${e.message}`),He()}}},Pt=W?.body?Pe(W.body,W.desc||K?.desc):null,Ft=W?.title||K?.title||K?.name,It=Ft===K?.name&&Pt?.title?Pt.title:Ft,Lt=I&&L.length===0,Rt=W?.status||K?.status,zt=S===`skills`?y[rt?.klass]:null,Bt=b[S].label,{lede:Vt,when:Ht}=Ie(W?.desc||K?.desc||``),$=K&&!H?W?.source||K.source||(ot?null:je(S,K.name)):null;return(0,w.jsxs)(`div`,{className:`lib-wrap`,children:[(0,w.jsx)(d,{error:mt,style:{margin:`0 0 var(--sp-3)`}}),(0,w.jsxs)(`div`,{className:`library lib-dossier${o?` locked`:``}${F?` uses`:``}`,children:[o?null:(0,w.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,w.jsxs)(`div`,{className:`lib-title`,children:[(0,w.jsx)(`h1`,{className:`h`,children:`Library`}),(0,w.jsx)(`span`,{className:`dim`,children:`What the agent knows`}),F&&P.since?(0,w.jsxs)(`span`,{className:`mono dim lib-title-since`,children:[`calls since `,P.since]}):null]}),(0,w.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:x.map(e=>(0,w.jsxs)(C.Fragment,{children:[(0,w.jsxs)(`a`,{href:`#/section/${e}`,className:S===e?`on`:``,"aria-current":S===e?`page`:void 0,children:[b[e].label,(0,w.jsx)(`span`,{className:`mono dim`,children:gt(e)})]}),e===S&&z&&I&&(0,w.jsx)(oe,{label:`Skill types`,total:L.length,cats:Qe.cats,cat:E,onChange:D})]},e))})]}),(0,w.jsxs)(re,{label:Bt,count:I?Z?`${Q.length} of ${wt.length}`:wt.length:``,q:T,onQ:de,matched:kt,inView:[S,n],current:K?It:void 0,sections:o?void 0:x.map(e=>({key:e,label:b[e].label,n:gt(e),href:`#/section/${e}`,on:S===e})),cats:z&&I?Qe.cats:null,cat:E,total:L.length,onCat:D,catLabel:`Skill types`,extra:(0,w.jsxs)(w.Fragment,{children:[F&&P.since?(0,w.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,P.since]}):null,(0,w.jsxs)(`span`,{className:`lib-legend mono`,children:[q?bt.map((e,t)=>(0,w.jsxs)(`span`,{className:`lk-install`,title:M(e).path,children:[(0,w.jsx)(`i`,{className:`lr-dot`,style:_(t),"aria-hidden":`true`}),R(e)]},e)):null,(0,w.jsx)(ie,{items:L})]})]}),toolsCompact:I&&Y.length>1?(0,w.jsx)(xe,{label:`Show`,options:Y.map(([e,t])=>({key:e,label:e===`all`?`All uses`:t})),value:X,onChange:O}):void 0,tools:I&&Y.length>1?(0,w.jsx)(m,{"aria-label":`Show`,children:Y.map(([e,t,n,r])=>(0,w.jsxs)(`button`,{type:`button`,className:X===e?`on`:``,"aria-pressed":X===e,title:r,onClick:()=>O(e),children:[t,` `,(0,w.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[Ye?(0,w.jsx)(g,{}):null,(0,w.jsx)(ae,{rows:At,activeName:K?.name,hrefOf:jt,pills:F||q?e=>{let t=Ke(e.name)?.n||0,n=q?(0,w.jsx)(`span`,{className:`lr-dots`,children:bt.map((t,n)=>e.installs?.includes(t)?(0,w.jsx)(`span`,{className:`lr-dot lr-install`,style:_(n),title:`${R(t)} — ${M(t).path}`,children:(0,w.jsx)(`span`,{className:`sr-only`,children:R(t)})},t):(0,w.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return F?(0,w.jsxs)(w.Fragment,{children:[n,(0,w.jsxs)(`span`,{className:`lr-use`,children:[(0,w.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,w.jsx)(`i`,{style:{width:De(t,Tt)}})}),(0,w.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,w.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!Z&&L.length>Et&&(0,w.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,Et,` of `,L.length,`; type to search the rest.`]}),Lt&&(S===`wiki`?(0,w.jsxs)(le,{title:`No wiki entries`,action:(0,w.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,w.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,w.jsx)(le,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,w.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:K?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(`div`,{className:`reader-tags`,children:[(0,w.jsx)(`span`,{className:`tag acc`,children:Bt.replace(/s$/,``)}),H?(0,w.jsx)(ce,{}):null,zt?(0,w.jsx)(`span`,{className:`tag`,children:zt.label}):null,W?.kit??K.kit?(0,w.jsx)(se,{name:W?.kit??K.kit}):null,(0,w.jsx)(ne,{status:Rt,withHint:!0}),$?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(`span`,{className:`mono dim reader-src`,children:ke($)}),(0,w.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),ge({src:$,ok:!0})}catch{ge({src:$,ok:!1})}},children:A?.src===$?A.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,w.jsxs)(`div`,{className:`reader-head`,children:[(0,w.jsx)(`h2`,{className:`reader-title`,children:It}),S===`agents`&&!H?(0,w.jsx)(C.Suspense,{fallback:null,children:(0,w.jsx)(we,{name:K.name})}):null]}),(0,w.jsxs)(`div`,{className:`reader-intro${F?` with-stats`:``}`,children:[(0,w.jsxs)(`div`,{className:`reader-intro-text`,children:[Vt?(0,w.jsx)(`p`,{className:`reader-lede`,children:Vt}):null,Ht?(0,w.jsxs)(`section`,{className:`reader-when`,children:[(0,w.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,w.jsx)(`p`,{children:Ht})]}):null]}),F?(0,w.jsx)(Fe,{u:Ke(K.name),usage:P,noCall:Je}):null]}),S===`memory`&&st&&K.name!==`MEMORY`&&K.name!==`README`&&(0,w.jsxs)(`div`,{className:`row gap-8`,children:[(0,w.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Nt,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,w.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Mt,children:`Forget this fact`})]}),W?.installs?.length>1&&W.installs.includes(W.install)?(0,w.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,w.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,w.jsx)(`select`,{className:`sel`,"aria-label":`Install`,value:U||W.install,onChange:e=>_e({sec:S,name:B,key:e.target.value}),children:W.installs.map(e=>(0,w.jsx)(`option`,{value:e,title:M(e).path,children:R(e)},e))}),(0,w.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,w.jsx)(`hr`,{className:`hr`}),lt?(0,w.jsx)(me,{name:B,install:G?M(G):void 0,installName:q?yt:void 0}):null,V?(0,w.jsx)(be,{loadout:ft?.own,base:ft?.base,error:pt,install:yt}):null,H?null:ot?(0,w.jsxs)(`p`,{className:`sub`,children:[`No `,Bt.replace(/s$/,``).toLowerCase(),` named `,(0,w.jsx)(`em`,{children:K.name}),` could be read in this install.`]}):K?.kind===`manifest`||W?.manifest!==void 0?W?(0,w.jsx)(fe,{manifest:W.manifest,body:W.body,name:K.name}):(0,w.jsx)(g,{}):W?.body?(0,w.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,w.jsx)(C.Suspense,{fallback:null,children:(0,w.jsx)(Ce,{body:Pt.body,links:W.links||[]})})}):W===null&&B?(0,w.jsx)(g,{}):(0,w.jsx)(Me,{section:S,source:je(S,K.name)}),Le[S]?(0,w.jsx)(`div`,{className:`reader-links`,children:(0,w.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${Le[S]}`,children:[`About `,Bt.toLowerCase(),` in Docs`]})}):null]}):Ye?(0,w.jsx)(g,{}):null})]})]})}export{Ee as PRIMARY,Pe as bodyHead,He as default,Ve as groupMemory,Ae as installLabel,M as installOfKey,Be as splitSkills,Ie as splitWhen};
@@ -1,2 +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-CZ-x0iWG.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,nt as u,tt as d,wt as f}from"./index-B_pTwZra.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./CopyButton-C0wwRR9H.js";import{c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./ActiveLoops-DOJCPPPc.js";import{t as S}from"./Markdown-CxkA7940.js";import{a as ee,i as te,n as ne,o as C,s as w}from"./LibRows-CiPvsRYB.js";import{i as T}from"./motion-RlUl1osO.js";var E=e(t(),1),D=n(),O=encodeURIComponent,k=a.loops.map(e=>[e,i[e]]),A={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},j={project:`Project`,global:`Global`,shipped:`Shipped`},M={templates:`Categories`,bricks:`Origins`,active:`Statuses`},N=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function P(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var F=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function I(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return F(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>A[e.graph.category]?e.graph.category:`other`,[...Object.entries(A),[`other`,`Other`]])}function L(e,t){return F(e.map(e=>({...e,desc:e.description,override:P(t,e.name)})),e=>e.origin,Object.entries(j))}function R(e){return F(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,N)}var z=(e,t)=>(0,D.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),B={templates:e=>e.human?z(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?z(`warn`,`mutate`):null,b(e)?z(`human`,`human gate`):null,e.override?z(`acc`,e.override):null,e.available===!1?z(`bad`,`unavailable`):null],active:e=>z(_[e.status],e.status)};function V({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:(0,D.jsx)(`a`,{href:`#/loops/bricks/${O(e)}`,children:e})}),z(t.effect===`mutate`?`warn`:``,t.effect),(0,D.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,D.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),b(t)?z(`human`,b(t).toLowerCase()):null,n?z(`acc`,n):null]}):(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:e}),(0,D.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function H(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function re({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,E.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=H(e.graph),c=h(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>y(t)&&t.graph.name===e.name).length;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Template`}),A[e.graph.category]?z(``,A[e.graph.category]):null,e.human?z(`human`,`human gate`):null]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsxs)(`figure`,{className:`loop-console`,children:[(0,D.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${c.width}px`},children:(0,D.jsx)(v,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:T()?`smooth`:`auto`,block:`nearest`})}})}),(0,D.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,D.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,D.jsx)(`ol`,{children:s.map(([e,t])=>(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,D.jsxs)(`span`,{className:`loop-legend`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,D.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,D.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,D.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,D.jsx)(m,{text:u,label:`Copy command`})]}),(0,D.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,D.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,D.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,D.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}):null,(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,D.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,D.jsx)(V,{name:e,brick:o.get(e),override:P(n,e),on:i===e},e))})]})}function U(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
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-DxwG8y94.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,nt as u,tt as d,wt as f}from"./index-MB7E-va_.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./CopyButton-BHqKgdjJ.js";import{c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./ActiveLoops-6p44eD86.js";import{t as S}from"./Markdown-CxkA7940.js";import{a as ee,i as te,n as ne,o as C,s as w}from"./LibRows-CGO25X3D.js";import{i as T}from"./motion-RlUl1osO.js";var E=e(t(),1),D=n(),O=encodeURIComponent,k=a.loops.map(e=>[e,i[e]]),A={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},j={project:`Project`,global:`Global`,shipped:`Shipped`},M={templates:`Categories`,bricks:`Origins`,active:`Statuses`},N=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function P(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var F=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function I(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return F(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>A[e.graph.category]?e.graph.category:`other`,[...Object.entries(A),[`other`,`Other`]])}function L(e,t){return F(e.map(e=>({...e,desc:e.description,override:P(t,e.name)})),e=>e.origin,Object.entries(j))}function R(e){return F(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,N)}var z=(e,t)=>(0,D.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),B={templates:e=>e.human?z(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?z(`warn`,`mutate`):null,b(e)?z(`human`,`human gate`):null,e.override?z(`acc`,e.override):null,e.available===!1?z(`bad`,`unavailable`):null],active:e=>z(_[e.status],e.status)};function V({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:(0,D.jsx)(`a`,{href:`#/loops/bricks/${O(e)}`,children:e})}),z(t.effect===`mutate`?`warn`:``,t.effect),(0,D.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,D.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),b(t)?z(`human`,b(t).toLowerCase()):null,n?z(`acc`,n):null]}):(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:e}),(0,D.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function H(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function re({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,E.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=H(e.graph),c=h(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>y(t)&&t.graph.name===e.name).length;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Template`}),A[e.graph.category]?z(``,A[e.graph.category]):null,e.human?z(`human`,`human gate`):null]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsxs)(`figure`,{className:`loop-console`,children:[(0,D.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${c.width}px`},children:(0,D.jsx)(v,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:T()?`smooth`:`auto`,block:`nearest`})}})}),(0,D.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,D.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,D.jsx)(`ol`,{children:s.map(([e,t])=>(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,D.jsxs)(`span`,{className:`loop-legend`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,D.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,D.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,D.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,D.jsx)(m,{text:u,label:`Copy command`})]}),(0,D.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,D.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,D.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,D.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}):null,(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,D.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,D.jsx)(V,{name:e,brick:o.get(e),override:P(n,e),on:i===e},e))})]})}function U(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
2
2
  `)}\n---\n${e.body}`}function W({b:e}){let[t,n]=(0,E.useState)(!1),r=[[`effect`,z(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,D.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>z(``,e))],[`gate`,b(e)?z(`human`,b(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,D.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Brick`}),B.bricks(e)]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,D.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(`dt`,{children:e}),(0,D.jsx)(`dd`,{children:t})]},e))}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,D.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,D.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:U(e)}):(0,D.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,D.jsx)(S,{body:e.body})})]})}function G({problems:e}){if(!e?.length)return null;let t=e.length;return(0,D.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,D.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,D.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,D.jsx)(`li`,{className:`mono`,children:e},e))})]})}var K={templates:{title:`No templates`,body:(0,D.jsxs)(D.Fragment,{children:[`Add one under `,(0,D.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,D.jsxs)(D.Fragment,{children:[`Add one under `,(0,D.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,D.jsxs)(D.Fragment,{children:[`Start one with `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed loop init`}),` in a worktree, or ask the agent to run a loop. It shows up here while it runs.`]})}},q={templates:(0,D.jsxs)(D.Fragment,{children:[`A template wires bricks into a loop. `,(0,D.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,D.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,D.jsxs)(D.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,D.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,D.jsxs)(D.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,D.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function J({tab:e=`templates`,item:t,dataRev:n}){let i=s(n),[a,m]=o(`loops`,i),{data:h,error:_}=f(()=>r.loops(l(a)),[n,a?.id??``],`loops`),v=g(),[b,S]=(0,E.useState)(``),[T,A]=(0,E.useState)(`all`),[j,N]=(0,E.useState)(e);e!==j&&(N(e),S(``),A(`all`));let P=h?.bricks||[],F=e===`active`?v.loops&&R(v.loops):h&&(e===`bricks`?L(h.bricks,h.overridden):I(h.templates,h.bricks)),z=F||[],V=w(z),H=T===`all`?z:z.filter(e=>e.group===T),U=b.trim(),J=ee(H,U),Y=!!(t&&F&&!z.some(e=>e.name===t)),X=Y?null:z.find(e=>e.name===t)||e===`active`&&z.find(y)||z[0]||null,Z={templates:h?.templates.length,bricks:h?.bricks.length,active:v.loops?.length},Q=k.find(([t])=>t===e)[1],$=e===`active`?v.error:_;return(0,D.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,D.jsx)(u,{className:`page-pick`,installs:i,value:a,onChange:m}),(0,D.jsx)(c,{error:$,style:{margin:`0 0 var(--sp-3)`}}),(0,D.jsx)(G,{problems:h?.problems}),(0,D.jsxs)(`div`,{className:`library`,children:[(0,D.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,D.jsxs)(`div`,{className:`lib-title`,children:[(0,D.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,D.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,D.jsx)(`p`,{className:`panel-note lib-lede`,children:q[e]}),(0,D.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:k.map(([t,n])=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,D.jsx)(`span`,{className:`mono dim`,children:Z[t]??``})]}),e===t&&(0,D.jsx)(C,{label:M[t],total:z.length,cats:V,cat:T,onChange:A})]},t))})]}),(0,D.jsx)(te,{label:Q,count:U?`${J.length} of ${H.length}`:F?H.length:``,q:b,onQ:S,matched:J.length,inView:[e,t],current:X?.name,sections:k.map(([t,n])=>({key:t,label:n,n:Z[t],href:`#/loops/${t}`,on:e===t})),cats:V,cat:T,total:z.length,onCat:A,catLabel:M[e],children:F?z.length===0?(0,D.jsx)(p,{title:K[e].title,children:K[e].body}):(0,D.jsx)(ne,{rows:J,activeName:X?.name,hrefOf:t=>`#/loops/${e}/${O(t.name)}`,pills:B[e]}):$?null:(0,D.jsx)(d,{})}),(0,D.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:Y?(0,D.jsx)(p,{title:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${Q.toLowerCase()} →`}}):X?e===`active`?(0,D.jsx)(x,{loop:X,bricks:P,onPreset:v.onPreset}):e===`bricks`?(0,D.jsx)(W,{b:X}):(0,D.jsx)(re,{t:X,bricks:P,overridden:h.overridden,runs:v.loops},X.name):e===`active`&&F?(0,D.jsx)(p,{title:`What is a loop?`,docs:{href:`#/docs/loops`,label:`How loops work →`},children:`A loop runs bricks in a ring until its gate passes.`}):null})]})]})}export{R as activeRows,L as brickRows,U as brickSource,J as default,H as howItRuns,I as templateRows};
@@ -1 +1 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,vt as r}from"./index-B_pTwZra.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{n as o,r as s}from"./Dashboard-DPAA96EI.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=a.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...a.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=n(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=r(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:a.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:i[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:i[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,vt as r}from"./index-MB7E-va_.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{n as o,r as s}from"./Dashboard-CoveJ_-U.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=a.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...a.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=n(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=r(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:a.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:i[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:i[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
@@ -1,2 +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-CZ-x0iWG.js";import{H as i,Ot as a,W as o,Y as s,at as c,et as l,ht as u,kt as d,mt as f,nt as p,q as m,rt as h,tt as g,wt as _}from"./index-B_pTwZra.js";import{t as v}from"./Tabs-Cf4X1hdz.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Markdown-CxkA7940.js";import x,{installLabel as S}from"./Library-BxQvbwVU.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=c(),[r,i]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),[l,u]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(o),g=(0,C.useRef)(!1),_=e=>{i(e),s(e)},v=()=>i(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=d(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),i(null),a(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:l,notice:f,setNotice:p,save:async(e,{conflict:n}={})=>{u(!0),p(``);try{return await e(m)||!0}catch(e){e.status===409?p(n??T):p(e.message);return}finally{u(!1),t()}}}}var D=n(),O=(e,t)=>`${e} ${t}${e===1?``:`s`}`,k=e=>`≈${e.toLocaleString(`en-US`)} tokens`,ee={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(M).some(N)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),A.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),j(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:k(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var F=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function I({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ie({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(I,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${F(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:F(e,r)},r))}):null]})]},e.key??r))})]}):null}function L({onChanged:e,dataRev:t,onAction:n}){let i=c(),{targets:a,sets:o,failed:s,reason:d,reload:h}=m(r.rules,t),[_,v]=(0,C.useState)(null),b=E({data:null,reload:h}),{draft:x,busy:S,notice:w}=b,[T,A]=(0,C.useState)(``),[M,N]=(0,C.useState)(null),F=(0,C.useRef)(null),[I,L]=(0,C.useState)(0),R=e=>{F.current=e,L(e=>e+1)},z=(0,C.useRef)(null),B=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=F.current;if(F.current=null,e===null)return;let t=[...B.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?z.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[I]),o&&!o.length&&d)return(0,D.jsx)(l,{error:d,onRetry:h});if(!o)return(0,D.jsx)(g,{});let V=a.length>1,H=e=>e?.id??``,U=e=>e?.shared?`shared`:f(e),W=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${H(e)}#${t.id}`}))),G=o.filter(e=>e.data.exists).map(e=>e.inst),K=G.length>0,q=x?.target,J=q!==void 0&&q!==`new`&&!W.some(e=>e.key===q&&e.title===x.title0),Y=q===`new`||J,X=x?.to!==void 0&&!G.some(e=>H(e)===x.to),Z=X?null:G.find(e=>H(e)===x?.to)??G[0]??null,ae=X?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):G.length>1?(0,D.jsx)(p,{installs:G,value:Z,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:U}):V&&Z?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:U(Z)})]}):null,Q=async(t,n,i)=>{let a=o.find(e=>H(e.inst)===H(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},u(n)),{conflict:i?te:ne});return s&&i&&b.close(),e?.(),s},$=e=>b.setDraft({...x,form:e}),oe=async(e,t,n)=>{await Q(e,t,!0)&&R(n)},se=async e=>{await b.discard()&&R(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${V?` from ${U(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Q({op:`delete`,id:e.id},e.inst)&&x===null&&R(`add`)},le=async e=>{await Q({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&R(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){A(t.key),N(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},u(t.inst));N({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{A(``),h(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>V?`${U(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!J&&q===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,onCancel:()=>se(e.key),onSave:t=>oe({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:V?U(e.inst):null,usual:ge(e.inst),isOpen:_===e.key,onToggle:()=>v(_===e.key?null:e.key),onEdit:()=>{v(e.key),b.open({target:e.key,no:e.id,to:H(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),K&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:z,onClick:()=>b.open({target:`new`,title0:``,form:ee}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?f(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),M?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,M.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,M.cleared.length?` Cleared: ${M.cleared.join(`, `)}.`:``,` `,M.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ie,{drafts:me,deciding:T,onDecide:de}),Y&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),J?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,writeTo:ae,onCancel:()=>se(`add`),onSave:e=>!X&&G.length&&oe({op:`add`,...e},Z,`add`)})]}),K?W.length===0&&!Y?(0,D.jsx)(y,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:B,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":V?U(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[V?(0,D.jsx)(`b`,{className:`mono`,children:U(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[O(t.rules.length,`rule`),` · `,k(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:W.filter(t=>t.inst===e).map(_e)}):null]},H(e)))}):(0,D.jsxs)(y,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var R=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,z=e=>e?.id??``;function B({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=m(r.profile,t);if(!i)return(0,D.jsx)(g,{});let o=new Set(a.map(z)),s=new Set([...i.map(e=>z(e.inst)),...o]),c=n.filter(e=>s.has(z(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(z(e))?`shared`:f(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),c.map(({install:t,tag:n})=>(0,D.jsx)(V,{install:t,tag:n,onChanged:e},z(t)))]})}function V({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:s,setData:c}=_(()=>r.profile(u(e)),[]),d=E({data:i,reload:s}),{draft:f,dirty:p,busy:m,notice:v}=d,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||d.open(i.text||``)),o&&!i)return(0,D.jsx)(g,{});if(a)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(l,{error:a,onRetry:s})]});let w=f!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(h,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:d.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||d.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!p||m,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:f,fingerprint:t},u(e)),{conflict:R});t&&(c(e=>({...e,text:f,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:m?`Saving…`:`Save`})]})]}),v?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:v}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:f,onChange:e=>d.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(y,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(b,{body:T})})]}):(0,D.jsxs)(y,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var H=(e,t)=>`${e} ${t}${e===1?``:`s`}`,U=e=>e?(e.items||[]).length:null,W=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,G=e=>String(e||``).split(`
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-DxwG8y94.js";import{H as i,Ot as a,W as o,Y as s,at as c,et as l,ht as u,kt as d,mt as f,nt as p,q as m,rt as h,tt as g,wt as _}from"./index-MB7E-va_.js";import{t as v}from"./Tabs-C30JrkJH.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Markdown-CxkA7940.js";import x,{installLabel as S}from"./Library-e-94YED6.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=c(),[r,i]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),[l,u]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(o),g=(0,C.useRef)(!1),_=e=>{i(e),s(e)},v=()=>i(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=d(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),i(null),a(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:l,notice:f,setNotice:p,save:async(e,{conflict:n}={})=>{u(!0),p(``);try{return await e(m)||!0}catch(e){e.status===409?p(n??T):p(e.message);return}finally{u(!1),t()}}}}var D=n(),O=(e,t)=>`${e} ${t}${e===1?``:`s`}`,k=e=>`≈${e.toLocaleString(`en-US`)} tokens`,ee={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(M).some(N)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),A.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),j(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:k(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var F=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function I({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ie({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(I,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${F(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:F(e,r)},r))}):null]})]},e.key??r))})]}):null}function L({onChanged:e,dataRev:t,onAction:n}){let i=c(),{targets:a,sets:o,failed:s,reason:d,reload:h}=m(r.rules,t),[_,v]=(0,C.useState)(null),b=E({data:null,reload:h}),{draft:x,busy:S,notice:w}=b,[T,A]=(0,C.useState)(``),[M,N]=(0,C.useState)(null),F=(0,C.useRef)(null),[I,L]=(0,C.useState)(0),R=e=>{F.current=e,L(e=>e+1)},z=(0,C.useRef)(null),B=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=F.current;if(F.current=null,e===null)return;let t=[...B.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?z.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[I]),o&&!o.length&&d)return(0,D.jsx)(l,{error:d,onRetry:h});if(!o)return(0,D.jsx)(g,{});let V=a.length>1,H=e=>e?.id??``,U=e=>e?.shared?`shared`:f(e),W=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${H(e)}#${t.id}`}))),G=o.filter(e=>e.data.exists).map(e=>e.inst),K=G.length>0,q=x?.target,J=q!==void 0&&q!==`new`&&!W.some(e=>e.key===q&&e.title===x.title0),Y=q===`new`||J,X=x?.to!==void 0&&!G.some(e=>H(e)===x.to),Z=X?null:G.find(e=>H(e)===x?.to)??G[0]??null,ae=X?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):G.length>1?(0,D.jsx)(p,{installs:G,value:Z,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:U}):V&&Z?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:U(Z)})]}):null,Q=async(t,n,i)=>{let a=o.find(e=>H(e.inst)===H(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},u(n)),{conflict:i?te:ne});return s&&i&&b.close(),e?.(),s},$=e=>b.setDraft({...x,form:e}),oe=async(e,t,n)=>{await Q(e,t,!0)&&R(n)},se=async e=>{await b.discard()&&R(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${V?` from ${U(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Q({op:`delete`,id:e.id},e.inst)&&x===null&&R(`add`)},le=async e=>{await Q({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&R(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){A(t.key),N(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},u(t.inst));N({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{A(``),h(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>V?`${U(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!J&&q===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,onCancel:()=>se(e.key),onSave:t=>oe({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:V?U(e.inst):null,usual:ge(e.inst),isOpen:_===e.key,onToggle:()=>v(_===e.key?null:e.key),onEdit:()=>{v(e.key),b.open({target:e.key,no:e.id,to:H(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),K&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:z,onClick:()=>b.open({target:`new`,title0:``,form:ee}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?f(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),M?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,M.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,M.cleared.length?` Cleared: ${M.cleared.join(`, `)}.`:``,` `,M.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ie,{drafts:me,deciding:T,onDecide:de}),Y&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),J?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,writeTo:ae,onCancel:()=>se(`add`),onSave:e=>!X&&G.length&&oe({op:`add`,...e},Z,`add`)})]}),K?W.length===0&&!Y?(0,D.jsx)(y,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:B,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":V?U(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[V?(0,D.jsx)(`b`,{className:`mono`,children:U(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[O(t.rules.length,`rule`),` · `,k(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:W.filter(t=>t.inst===e).map(_e)}):null]},H(e)))}):(0,D.jsxs)(y,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var R=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,z=e=>e?.id??``;function B({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=m(r.profile,t);if(!i)return(0,D.jsx)(g,{});let o=new Set(a.map(z)),s=new Set([...i.map(e=>z(e.inst)),...o]),c=n.filter(e=>s.has(z(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(z(e))?`shared`:f(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),c.map(({install:t,tag:n})=>(0,D.jsx)(V,{install:t,tag:n,onChanged:e},z(t)))]})}function V({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:s,setData:c}=_(()=>r.profile(u(e)),[]),d=E({data:i,reload:s}),{draft:f,dirty:p,busy:m,notice:v}=d,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||d.open(i.text||``)),o&&!i)return(0,D.jsx)(g,{});if(a)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(l,{error:a,onRetry:s})]});let w=f!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(h,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:d.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||d.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!p||m,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:f,fingerprint:t},u(e)),{conflict:R});t&&(c(e=>({...e,text:f,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:m?`Saving…`:`Save`})]})]}),v?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:v}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:f,onChange:e=>d.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(y,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(b,{body:T})})]}):(0,D.jsxs)(y,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var H=(e,t)=>`${e} ${t}${e===1?``:`s`}`,U=e=>e?(e.items||[]).length:null,W=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,G=e=>String(e||``).split(`
2
2
  `).map(e=>W.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function K({topics:e,install:t,shared:n}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:H(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:H(e.n,`fact`)})]},e.topic))})]}):null}var q={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function J({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:a,onAction:c}){let l=e=>Promise.resolve(e).catch(()=>null),u=s(n),{reload:d}=o(n),{data:f,error:p,reload:m}=_(()=>r.profile(),[n]),{data:h,reload:g}=_(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:b}=_(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),S=U(h),{data:C}=_(()=>e===`memory`?l(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,S]),w=U(b),T={memory:S,notebook:w},E={profile:p?`read failed`:f?.seeded?`template`:null,memory:S,notebook:w},O=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`+(u?.some(e=>e.shared)?` Global installs share one copy of the rules, profile and memory; a project install keeps its own.`:``)}),(0,D.jsx)(v,{page:`personal`,current:e,badges:E,label:`Personal files`}),e===`rules`&&(0,D.jsx)(L,{onChanged:d,dataRev:n,onAction:c}),e===`profile`&&(0,D.jsx)(B,{onChanged:m,dataRev:n}),O&&T[e]===0&&!t?(0,D.jsx)(y,{title:q[e].title,action:q[e].action,children:q[e].body}):O?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(K,{topics:G(C?.body),install:C?.install,shared:C?.shared}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onCountsChanged:a,onRulesChanged:()=>{d(),g()}},e)]}):null]})}export{J as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{H as r,St as i,Tt as a,_t as o,at as s,et as c,pt as l}from"./index-B_pTwZra.js";import{t as u}from"./api-CZ-x0iWG.js";import{i as d}from"./motion-RlUl1osO.js";var f=e(t(),1),p=n();function m(){let e=s(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return t?(0,p.jsxs)(`p`,{className:`sub`,children:[`Server stopped. You can close this tab and reopen any time with `,(0,p.jsx)(`code`,{children:`geneseed web`}),`.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost danger-line`,onClick:async()=>{if(await e(`Stop the local Geneseed server? The console goes offline until you start it again.`,{title:`Stop the server?`,confirmLabel:`Stop server`,tone:`danger`})){i(null);try{await u.shutdown()}catch(e){if(e.status)return i(e.message)}n(!0)}},children:[(0,p.jsx)(o,{name:`x`}),`Stop server`]})]})}function h(){let e=s(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:async()=>{if(await e(`Restart the local Geneseed server? The console reconnects in a moment.`,{title:`Restart the server?`,confirmLabel:`Restart`})){n(!0),i(null);try{await a()}catch(e){i(e.message),n(!1)}}},disabled:t,children:[(0,p.jsx)(o,{name:`refresh`}),t?`Restarting…`:`Restart server`]})]})}var g=`https://github.com/Arylmera/Geneseed`,_=`https://github.com/Arylmera`,v=[[`machine`,`Machine`],[`server`,`Server`],[`about`,`About`],[`danger`,`Danger zone`]],y=[`Host check`,`token on writes`,`framing refused`,`cross-site GET refused`];function b({k:e,help:t,children:n,control:r}){return(0,p.jsxs)(`div`,{className:`sheet-row`,children:[(0,p.jsxs)(`span`,{className:`sheet-k`,children:[e,t?(0,p.jsx)(`span`,{className:`sheet-h sub`,children:t}):null]}),(0,p.jsx)(`div`,{className:`sheet-v`,children:n}),(0,p.jsx)(`div`,{className:`sheet-c`,children:r})]})}function x({id:e,title:t,head:n,className:r=``,children:i}){return(0,p.jsxs)(`section`,{id:`set-${e}`,className:`card pad-md sheet-sec ${r}`,"aria-labelledby":`${e}-h`,children:[(0,p.jsxs)(`div`,{className:`card-head`,children:[(0,p.jsx)(`h3`,{id:`${e}-h`,children:t}),n]}),i]})}function S({stale:e}){let t=e=>document.getElementById(`set-${e}`)?.scrollIntoView?.({behavior:d()?`smooth`:`auto`,block:`start`});return(0,p.jsx)(`nav`,{className:`sheet-index`,"aria-label":`On this page`,children:v.map(([n,r])=>(0,p.jsxs)(`button`,{type:`button`,className:n===`danger`?`t-bad`:``,onClick:()=>t(n),children:[r,n===`server`&&(0,p.jsx)(`span`,{className:`sheet-dot ${e?`warn`:`good`}`,"aria-hidden":`true`})]},n))})}function C({version:e}){let[t,n]=(0,f.useState)(g),[r,i]=(0,f.useState)(!0);(0,f.useEffect)(()=>{Promise.resolve(u.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),i(!!e.repo_is_github))}).catch(()=>{})},[]);let a=(e,t)=>(0,p.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,p.jsx)(o,{name:`external`})]});return(0,p.jsxs)(x,{id:`about`,title:`About`,children:[(0,p.jsx)(b,{k:`Version`,control:r?a(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,p.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),r?(0,p.jsx)(b,{k:`Credits`,control:a(t+`#-credits`,`Credits`),children:(0,p.jsx)(`span`,{className:`sub`,children:`Skills and agents adapted from other projects, with their licences`})}):null,(0,p.jsx)(b,{k:`Geneseed`,help:`MIT-licensed`,control:(0,p.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`github`}),r?`Source on GitHub`:`Source repo`]}),r&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`external`}),`Issues`]}),(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`external`}),`MIT License`]})]})]}),children:(0,p.jsx)(`span`,{className:`sub`,children:`A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent. One canonical source, many voices.`})}),(0,p.jsx)(b,{k:`Creator`,control:(0,p.jsxs)(`a`,{className:`btn ghost`,href:_,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`github`}),`@Arylmera on GitHub`]}),children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Built by `,(0,p.jsx)(`strong`,{children:`Guillaume Lemer`}),`. It started as a personal, Obsidian-vault-grown agent operating system and was distilled into the repo you are running. If you find it useful, a star on the repo or an issue with feedback is the best way to help shape what comes next.`]})})]})}var w={absent:`Off`,ours:`On · written by Geneseed`,stale:`On · points at another copy or Node`,hand:`On · set up by hand`};function T({initial:e}){let t=s(),[n,r]=(0,f.useState)(void 0),[i,a]=(0,f.useState)(null),[o,l]=(0,f.useState)(!1),d=n===void 0?e:n,m=async e=>{let n=e===`install`;if(await t(n?`Write ${d.file}? It starts the web console from ${d.root} at each login (hidden, no browser).`+(d.file.endsWith(`.plist`)?` It loads at your next login.`:``)+(d.transient?` Warning: that copy is an agent worktree or an npx cache, which can be deleted; the login item then fails.`:``):`Delete ${d.file}? The console no longer starts at login.`,n?{title:`Start at login?`,confirmLabel:d.state===`stale`?`Update`:`Write file`}:{title:`Stop starting at login?`,confirmLabel:`Delete file`,tone:`danger`})){l(!0),a(null);try{r((await u.autostart(e)).autostart)}catch(e){a(e.message),e.body?.autostart&&r(e.body.autostart)}finally{l(!1)}}},h=d?.state,g=h===`absent`||h===`stale`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>m(`install`),children:h===`stale`?`Update`:`Turn on`}):h===`ours`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>m(`remove`),children:`Remove`}):h===`hand`?(0,p.jsx)(`a`,{href:`#/docs/autostart`,children:`Install guide →`}):null;return(0,p.jsx)(b,{k:`Start at login`,help:d?d.file:d===null?`No login launcher on this system`:`A login launcher`,control:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:i}),g]}),children:(0,p.jsx)(`span`,{className:`sub`,children:d===null?`not available`:w[h]??`unknown`})})}function E({overview:e,onAction:t}){let n=s(),a=e?.server,c=e?.daemon_stale,[d,g]=(0,f.useState)(null);(0,f.useEffect)(()=>{Promise.resolve(u.update?.()).then(e=>g(e||null)).catch(()=>{})},[]);let _=d?d.install??(d.git?`git`:`npm-global`):null,v=_===`git`?`Update (git pull + rebuild)`:_===`npm-global`?`Update (npm install -g + rebuild)`:`Update`;return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(r,{title:`Settings`,sub:`This copy of Geneseed and the local server.`}),(0,p.jsxs)(`div`,{className:`sheet`,children:[(0,p.jsx)(S,{stale:c}),(0,p.jsxs)(`div`,{className:`sheet-body`,children:[(0,p.jsxs)(x,{id:`machine`,title:`Machine`,children:[(0,p.jsx)(b,{k:`Geneseed`,help:`This copy of the source`,control:_===`other`?d.command?(0,p.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,p.jsx)(`code`,{className:`mono`,children:d.command})]}):null:d?.behind===!1?(0,p.jsx)(`span`,{className:`dim`,children:`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`}):(0,p.jsxs)(`button`,{className:`btn`,onClick:async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await u.installs();e=t.filter(e=>e.state===`active`).map(e=>`${l(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await n(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},children:[(0,p.jsx)(o,{name:`download`}),v]}),children:(0,p.jsx)(`span`,{className:`mono`,children:e?.version||`unknown`})}),(0,p.jsx)(b,{k:`Command on PATH`,help:`Run geneseed from any folder`,control:(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:()=>t(`link`),children:[(0,p.jsx)(o,{name:`external`}),`Add to PATH`]})})]}),(0,p.jsxs)(x,{id:`server`,title:`Server`,className:`sheet-live`,head:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`pill good`,children:`running`}),(0,p.jsxs)(`span`,{className:`mono dim`,children:[`127.0.0.1:`,window.location.port||`80`,a?` · pid ${a.pid} · up ${i(a.started)}`:``]})]}),children:[(0,p.jsx)(b,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,p.jsx)(h,{}),children:c?(0,p.jsx)(`span`,{className:`pill warn`,children:`disk has newer code → Restart`}):(0,p.jsx)(`span`,{className:`pill good`,children:`matches disk`})}),(0,p.jsx)(T,{initial:a?.autostart}),(0,p.jsx)(b,{k:`Guards`,help:`What stops another page from driving the console`,children:(0,p.jsx)(`span`,{className:`row wrap gap-8`,children:y.map(e=>(0,p.jsx)(`span`,{className:`pill good`,children:e},e))})})]}),(0,p.jsx)(C,{version:e?.version}),(0,p.jsxs)(x,{id:`danger`,title:`Danger zone`,className:`danger-zone`,children:[(0,p.jsx)(b,{k:`Stop the server`,help:`The console goes offline until you run geneseed web`,control:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{k:`The geneseed command`,help:`Installs keep working; only the command goes`,control:(0,p.jsx)(`button`,{className:`btn ghost danger-line`,onClick:()=>t(`unlink`),children:`Remove from PATH`})}),(0,p.jsx)(b,{k:`Uninstall`,children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Each install has its own Uninstall in `,(0,p.jsx)(`a`,{href:`#/installs/hosts`,children:`Hosts`}),`, bound to its host and path.`]})})]})]})]})]})}export{E as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{H as r,St as i,Tt as a,_t as o,at as s,et as c,pt as l}from"./index-MB7E-va_.js";import{t as u}from"./api-DxwG8y94.js";import{i as d}from"./motion-RlUl1osO.js";var f=e(t(),1),p=n();function m(){let e=s(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return t?(0,p.jsxs)(`p`,{className:`sub`,children:[`Server stopped. You can close this tab and reopen any time with `,(0,p.jsx)(`code`,{children:`geneseed web`}),`.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost danger-line`,onClick:async()=>{if(await e(`Stop the local Geneseed server? The console goes offline until you start it again.`,{title:`Stop the server?`,confirmLabel:`Stop server`,tone:`danger`})){i(null);try{await u.shutdown()}catch(e){if(e.status)return i(e.message)}n(!0)}},children:[(0,p.jsx)(o,{name:`x`}),`Stop server`]})]})}function h(){let e=s(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:async()=>{if(await e(`Restart the local Geneseed server? The console reconnects in a moment.`,{title:`Restart the server?`,confirmLabel:`Restart`})){n(!0),i(null);try{await a()}catch(e){i(e.message),n(!1)}}},disabled:t,children:[(0,p.jsx)(o,{name:`refresh`}),t?`Restarting…`:`Restart server`]})]})}var g=`https://github.com/Arylmera/Geneseed`,_=`https://github.com/Arylmera`,v=[[`machine`,`Machine`],[`server`,`Server`],[`about`,`About`],[`danger`,`Danger zone`]],y=[`Host check`,`token on writes`,`framing refused`,`cross-site GET refused`];function b({k:e,help:t,children:n,control:r}){return(0,p.jsxs)(`div`,{className:`sheet-row`,children:[(0,p.jsxs)(`span`,{className:`sheet-k`,children:[e,t?(0,p.jsx)(`span`,{className:`sheet-h sub`,children:t}):null]}),(0,p.jsx)(`div`,{className:`sheet-v`,children:n}),(0,p.jsx)(`div`,{className:`sheet-c`,children:r})]})}function x({id:e,title:t,head:n,className:r=``,children:i}){return(0,p.jsxs)(`section`,{id:`set-${e}`,className:`card pad-md sheet-sec ${r}`,"aria-labelledby":`${e}-h`,children:[(0,p.jsxs)(`div`,{className:`card-head`,children:[(0,p.jsx)(`h3`,{id:`${e}-h`,children:t}),n]}),i]})}function S({stale:e}){let t=e=>document.getElementById(`set-${e}`)?.scrollIntoView?.({behavior:d()?`smooth`:`auto`,block:`start`});return(0,p.jsx)(`nav`,{className:`sheet-index`,"aria-label":`On this page`,children:v.map(([n,r])=>(0,p.jsxs)(`button`,{type:`button`,className:n===`danger`?`t-bad`:``,onClick:()=>t(n),children:[r,n===`server`&&(0,p.jsx)(`span`,{className:`sheet-dot ${e?`warn`:`good`}`,"aria-hidden":`true`})]},n))})}function C({version:e}){let[t,n]=(0,f.useState)(g),[r,i]=(0,f.useState)(!0);(0,f.useEffect)(()=>{Promise.resolve(u.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),i(!!e.repo_is_github))}).catch(()=>{})},[]);let a=(e,t)=>(0,p.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,p.jsx)(o,{name:`external`})]});return(0,p.jsxs)(x,{id:`about`,title:`About`,children:[(0,p.jsx)(b,{k:`Version`,control:r?a(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,p.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),r?(0,p.jsx)(b,{k:`Credits`,control:a(t+`#-credits`,`Credits`),children:(0,p.jsx)(`span`,{className:`sub`,children:`Skills and agents adapted from other projects, with their licences`})}):null,(0,p.jsx)(b,{k:`Geneseed`,help:`MIT-licensed`,control:(0,p.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`github`}),r?`Source on GitHub`:`Source repo`]}),r&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`external`}),`Issues`]}),(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`external`}),`MIT License`]})]})]}),children:(0,p.jsx)(`span`,{className:`sub`,children:`A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent. One canonical source, many voices.`})}),(0,p.jsx)(b,{k:`Creator`,control:(0,p.jsxs)(`a`,{className:`btn ghost`,href:_,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`github`}),`@Arylmera on GitHub`]}),children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Built by `,(0,p.jsx)(`strong`,{children:`Guillaume Lemer`}),`. It started as a personal, Obsidian-vault-grown agent operating system and was distilled into the repo you are running. If you find it useful, a star on the repo or an issue with feedback is the best way to help shape what comes next.`]})})]})}var w={absent:`Off`,ours:`On · written by Geneseed`,stale:`On · points at another copy or Node`,hand:`On · set up by hand`};function T({initial:e}){let t=s(),[n,r]=(0,f.useState)(void 0),[i,a]=(0,f.useState)(null),[o,l]=(0,f.useState)(!1),d=n===void 0?e:n,m=async e=>{let n=e===`install`;if(await t(n?`Write ${d.file}? It starts the web console from ${d.root} at each login (hidden, no browser).`+(d.file.endsWith(`.plist`)?` It loads at your next login.`:``)+(d.transient?` Warning: that copy is an agent worktree or an npx cache, which can be deleted; the login item then fails.`:``):`Delete ${d.file}? The console no longer starts at login.`,n?{title:`Start at login?`,confirmLabel:d.state===`stale`?`Update`:`Write file`}:{title:`Stop starting at login?`,confirmLabel:`Delete file`,tone:`danger`})){l(!0),a(null);try{r((await u.autostart(e)).autostart)}catch(e){a(e.message),e.body?.autostart&&r(e.body.autostart)}finally{l(!1)}}},h=d?.state,g=h===`absent`||h===`stale`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>m(`install`),children:h===`stale`?`Update`:`Turn on`}):h===`ours`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>m(`remove`),children:`Remove`}):h===`hand`?(0,p.jsx)(`a`,{href:`#/docs/autostart`,children:`Install guide →`}):null;return(0,p.jsx)(b,{k:`Start at login`,help:d?d.file:d===null?`No login launcher on this system`:`A login launcher`,control:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:i}),g]}),children:(0,p.jsx)(`span`,{className:`sub`,children:d===null?`not available`:w[h]??`unknown`})})}function E({overview:e,onAction:t}){let n=s(),a=e?.server,c=e?.daemon_stale,[d,g]=(0,f.useState)(null);(0,f.useEffect)(()=>{Promise.resolve(u.update?.()).then(e=>g(e||null)).catch(()=>{})},[]);let _=d?d.install??(d.git?`git`:`npm-global`):null,v=_===`git`?`Update (git pull + rebuild)`:_===`npm-global`?`Update (npm install -g + rebuild)`:`Update`;return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(r,{title:`Settings`,sub:`This copy of Geneseed and the local server.`}),(0,p.jsxs)(`div`,{className:`sheet`,children:[(0,p.jsx)(S,{stale:c}),(0,p.jsxs)(`div`,{className:`sheet-body`,children:[(0,p.jsxs)(x,{id:`machine`,title:`Machine`,children:[(0,p.jsx)(b,{k:`Geneseed`,help:`This copy of the source`,control:_===`other`?d.command?(0,p.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,p.jsx)(`code`,{className:`mono`,children:d.command})]}):null:d?.behind===!1?(0,p.jsx)(`span`,{className:`dim`,children:`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`}):(0,p.jsxs)(`button`,{className:`btn`,onClick:async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await u.installs();e=t.filter(e=>e.state===`active`).map(e=>`${l(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await n(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},children:[(0,p.jsx)(o,{name:`download`}),v]}),children:(0,p.jsx)(`span`,{className:`mono`,children:e?.version||`unknown`})}),(0,p.jsx)(b,{k:`Command on PATH`,help:`Run geneseed from any folder`,control:(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:()=>t(`link`),children:[(0,p.jsx)(o,{name:`external`}),`Add to PATH`]})})]}),(0,p.jsxs)(x,{id:`server`,title:`Server`,className:`sheet-live`,head:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`pill good`,children:`running`}),(0,p.jsxs)(`span`,{className:`mono dim`,children:[`127.0.0.1:`,window.location.port||`80`,a?` · pid ${a.pid} · up ${i(a.started)}`:``]})]}),children:[(0,p.jsx)(b,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,p.jsx)(h,{}),children:c?(0,p.jsx)(`span`,{className:`pill warn`,children:`disk has newer code → Restart`}):(0,p.jsx)(`span`,{className:`pill good`,children:`matches disk`})}),(0,p.jsx)(T,{initial:a?.autostart}),(0,p.jsx)(b,{k:`Guards`,help:`What stops another page from driving the console`,children:(0,p.jsx)(`span`,{className:`row wrap gap-8`,children:y.map(e=>(0,p.jsx)(`span`,{className:`pill good`,children:e},e))})})]}),(0,p.jsx)(C,{version:e?.version}),(0,p.jsxs)(x,{id:`danger`,title:`Danger zone`,className:`danger-zone`,children:[(0,p.jsx)(b,{k:`Stop the server`,help:`The console goes offline until you run geneseed web`,control:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{k:`The geneseed command`,help:`Installs keep working; only the command goes`,control:(0,p.jsx)(`button`,{className:`btn ghost danger-line`,onClick:()=>t(`unlink`),children:`Remove from PATH`})}),(0,p.jsx)(b,{k:`Uninstall`,children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Each install has its own Uninstall in `,(0,p.jsx)(`a`,{href:`#/installs/hosts`,children:`Hosts`}),`, bound to its host and path.`]})})]})]})]})]})}export{E as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Dt as n,Et as r}from"./index-B_pTwZra.js";e();var i=t();function a({page:e,current:t,badges:a={},label:o}){return(0,i.jsx)(`nav`,{className:`tabs`,"aria-label":o,children:r[e].map(r=>(0,i.jsxs)(`a`,{href:`#/${e}/${r}`,className:t===r?`on`:``,"aria-current":t===r?`page`:void 0,children:[n[r],a[r]==null?null:(0,i.jsx)(`span`,{className:`tab-badge`,children:a[r]})]},r))})}export{a as t};
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Dt as n,Et as r}from"./index-MB7E-va_.js";e();var i=t();function a({page:e,current:t,badges:a={},label:o}){return(0,i.jsx)(`nav`,{className:`tabs`,"aria-label":o,children:r[e].map(r=>(0,i.jsxs)(`a`,{href:`#/${e}/${r}`,className:t===r?`on`:``,"aria-current":t===r?`page`:void 0,children:[n[r],a[r]==null?null:(0,i.jsx)(`span`,{className:`tab-badge`,children:a[r]})]},r))})}export{a as t};
@@ -0,0 +1 @@
1
+ var e=typeof window<`u`?window.__GENESEED_TOKEN__:``;async function t(e){let t=await e.json().catch(()=>({})),n=e.status===403&&t.error===`forbidden`?`the web server restarted since this page loaded — reload the page, then re-apply your edit`:t.error||t.message||e.statusText,r=Error(n);return r.status=e.status,r.body=t,r}var n=2e5;async function r(e){try{let r=await fetch(e,{signal:AbortSignal.timeout(n)});if(!r.ok)throw await t(r);return await r.json()}catch(e){throw e?.name===`TimeoutError`?Error(`the local server did not answer in time`,{cause:e}):e}}async function i(n,r={}){let i=await fetch(n,{method:`POST`,headers:{"X-Geneseed-Token":e||``,"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok)throw await t(i);return i.json()}var a=e=>{if(e==null)return!1;if(typeof e.host==`string`&&typeof e.path==`string`)return!0;throw Error(`an install needs both host and path`)},ee=(e,t)=>{if(!a(t))return e;let n=new URLSearchParams({host:t.host,path:t.path});return`${e}${e.includes(`?`)?`&`:`?`}${n}`},o=(e,t)=>{let n=e??{};if(!a(t))return n;if(`host`in n||`path`in n)throw Error(`this body already has host or path`);return{...n,host:t.host,path:t.path}},s=e=>{try{return e()}catch(e){return Promise.reject(e)}},c=(e,t)=>s(()=>r(ee(e,t))),l=(e,t,n)=>s(()=>i(e,o(t,n))),u=e=>c(`/api/overview`,e),d=()=>r(`/api/fleet`),f=()=>r(`/api/migrate/preview`),p=()=>r(`/api/kits`),m=(e,t)=>{if(!e)return r(`/api/profiles`);let n=new URLSearchParams({profile:e});return t!=null&&n.set(`project`,t),r(`/api/profiles?${n}`)},h=()=>r(`/api/usage`),g=()=>r(`/api/gates`),_=()=>r(`/api/update`),v=e=>c(`/api/recent`,e),y=()=>r(`/api/activity`),b=(e,t)=>c(`/api/activity/`+encodeURIComponent(e),t),x=(e,t)=>l(`/api/activity`,{enabled:e},t),S=e=>c(`/api/setup`,e),C=(e=!1,t)=>c(e?`/api/doctor?fresh=1`:`/api/doctor`,t),w=e=>c(`/api/themes`,e),T=(e,t)=>c(`/api/catalog/${e}`,t),E=(e,t,n)=>c(`/api/item/${e}/${encodeURIComponent(t)}`,n),D=(e,t)=>l(`/api/memory/delete`,{name:e},t),O=(e,t)=>c(e?`/api/loadout/${encodeURIComponent(e)}`:`/api/loadout`,t),k=e=>c(`/api/agent-models`,e),te=(e,t)=>l(`/api/agent-models`,e,t),A=e=>c(`/api/diff`,e),j=(e,t)=>l(`/api/actions/restore`,{files:e},t),M=409,N=e=>r(`/api/jobs/${e}`),P=()=>r(`/api/jobs`),F=e=>i(`/api/jobs/${e}/cancel`),I=new Set([`build`,`restore`]);async function L(e,t,n){let r=t||{},a=`/api/actions/${e}`;try{return await(I.has(e)?l(a,r,n):i(a,r))}catch(e){throw e.status===M&&e.body?.error===`busy`?Error(`An action is already running.`,{cause:e}):e}}var R=e=>c(`/api/loops`,e),z=()=>r(`/api/loops/active`),B=(e,t)=>i(`/api/loops/preset`,{root:e,preset:t}),V=e=>c(`/api/factories/catalog`,e),H=()=>r(`/api/factories/active`),U=()=>r(`/api/mcp`),W=e=>i(`/api/reveal`,{path:e}),G=()=>r(`/api/installs`),K=(e,t,n)=>i(`/api/install`,{host:e,path:t,action:n}),q=(e,t,n)=>i(`/api/install`,{host:e,path:t,action:`remove`,memory:n}),J=(e,t)=>i(`/api/default-install`,{host:e,path:t}),Y=()=>i(`/api/pick-folder`,{}),X=()=>r(`/api/ping`),Z=()=>i(`/api/shutdown`),Q=()=>i(`/api/restart`),ne=e=>i(`/api/autostart`,{action:e}),$=e=>e?`?harness=${encodeURIComponent(e)}`:``,re={fleet:d,migratePreview:f,kits:p,usage:h,gates:g,update:_,loops:R,activeLoops:z,factories:V,activeFactories:H,setLoopPreset:B,overview:u,recent:v,activity:y,activityDetail:b,activityToggle:x,setup:S,doctor:C,themes:w,catalog:T,item:E,loadout:O,agentModels:k,agentModelsSave:te,memoryDelete:D,diff:A,restore:j,job:N,jobs:P,cancelJob:F,action:L,mcp:U,mcpReveal:W,installs:G,profiles:m,installToggle:K,installRemove:q,setDefaultInstall:J,pickFolder:Y,ping:X,shutdown:Z,restart:Q,autostart:ne,docs:(e,t)=>c(`/api/docs${$(e)}`,t),docsPage:(e,t,n)=>c(`/api/docs/page/${encodeURIComponent(e)}${$(t)}`,n),rules:e=>c(`/api/rules`,e),rulesMutate:(e,t)=>l(`/api/rules`,e,t),rulesDecide:(e,t)=>l(`/api/rules/decide`,e,t),rulesPromote:(e,t)=>l(`/api/rules/promote`,e,t),profile:e=>c(`/api/profile`,e),profileSave:(e,t)=>l(`/api/profile`,e,t),excludes:()=>r(`/api/excludes`),excludeMutate:(e,t)=>i(`/api/excludes`,{action:e,path:t})};export{re as t};