geneseed 4.23.1 → 4.24.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.
- package/CHANGELOG.md +23 -0
- package/SHIPPED.md +1 -1
- package/adapters/opencode/plugins/geneseed-context.js +1 -1
- package/docs/concepts/footprint.md +2 -2
- package/docs/concepts/foreman-mode.md +20 -12
- package/docs/guides/choose-your-setup.md +2 -2
- package/docs/guides/setup-footprint.md +1 -1
- package/docs/reference/glossary.md +1 -1
- package/docs/web-ui.md +5 -4
- package/harness.config.json +1 -1
- package/js/hosts/hooks-context.mjs +1 -1
- package/js/maintain/memory.mjs +1 -0
- package/js/maintain/setup.mjs +1 -1
- package/js/web/actions.mjs +27 -1
- package/js/web/catalog.mjs +10 -2
- package/js/web/daemon.mjs +27 -8
- package/js/web/handler.mjs +29 -9
- package/js/web/update-check.mjs +6 -4
- package/js/web/user-files.mjs +34 -11
- package/package.json +1 -1
- package/src/AGENT.md.tmpl +1 -1
- package/src/modes/README.md +1 -1
- package/src/modes/foreman.md +45 -26
- package/src/skills/pipeline.md +2 -2
- package/src/skills/rule.md +2 -1
- package/web/dist/assets/Activity-BcwX4Zj2.js +1 -0
- package/web/dist/assets/{ActivityDetail-Bf5sBm8_.js → ActivityDetail-CDD7EM_5.js} +1 -1
- package/web/dist/assets/CopyButton-BHxw2k1Z.js +1 -0
- package/web/dist/assets/Dashboard-DmKR3TQg.js +2 -0
- package/web/dist/assets/Docs-CuwD_7Yq.js +5 -0
- package/web/dist/assets/GreenhouseView-50jF3dvM.js +1 -0
- package/web/dist/assets/Installs-DlxyaW98.js +3 -0
- package/web/dist/assets/{JournalView-DKqMrN35.js → JournalView-DhjSU8nT.js} +1 -1
- package/web/dist/assets/{KitApply-DCBS0ZWz.js → KitApply-DvryZjTL.js} +1 -1
- package/web/dist/assets/Kits-Dl-wrVqw.js +1 -0
- package/web/dist/assets/Laws-BD3DVthD.js +3 -0
- package/web/dist/assets/Library-dMx4l6kg.js +2 -0
- package/web/dist/assets/Loops-BfoE72d9.js +2 -0
- package/web/dist/assets/OperatorHudView-DJ_Wb0on.js +1 -0
- package/web/dist/assets/{Personal-d5Ssk-SW.js → Personal-Be0vEjUH.js} +1 -1
- package/web/dist/assets/RailCats-BuJD4Jou.js +1 -0
- package/web/dist/assets/{Tabs-DQLuylEi.js → Tabs-D1tN4jA9.js} +1 -1
- package/web/dist/assets/index-BUdl0KdD.js +3 -0
- package/web/dist/assets/index-BVxqp3vf.css +1 -0
- package/web/dist/index.html +2 -2
- package/web/dist/sw.js +10 -2
- package/web/dist/assets/Activity-D0GfEonq.js +0 -1
- package/web/dist/assets/Dashboard-gYZLE4r3.js +0 -2
- package/web/dist/assets/Docs-CQifoJkX.js +0 -4
- package/web/dist/assets/GreenhouseView-R6epl1PY.js +0 -1
- package/web/dist/assets/Installs-DBH3NEOC.js +0 -3
- package/web/dist/assets/Kits-BpUFbYHr.js +0 -1
- package/web/dist/assets/Laws-Qnzc5Lp7.js +0 -3
- package/web/dist/assets/Library-CWjWbVwS.js +0 -2
- package/web/dist/assets/Loops-BRuz2YFL.js +0 -2
- package/web/dist/assets/OperatorHudView-NW_xAOj1.js +0 -1
- package/web/dist/assets/RailCats-BtIstKaH.js +0 -1
- package/web/dist/assets/index-BX3zc2Yi.css +0 -1
- package/web/dist/assets/index-DMDF5Y3Y.js +0 -3
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BfpZmUMI.js";import{i}from"./motion-CXaUMNkg.js";import{n as a,t as o}from"./sections-ChwaobfW.js";import{B as s,X as ee,Z as te,at as c,b as l,ft as u,q as ne,x as d,yt as re}from"./index-BUdl0KdD.js";import{t as f}from"./EmptyState-1sPNleqv.js";import{a as ie,i as ae,o as oe,r as se,s as ce,t as le}from"./RailCats-BuJD4Jou.js";import{t as ue}from"./Markdown-DpmmtW2Y.js";var p=e(t(),1),m=n();function de({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,m.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function h({entries:e}){return e.length?(0,m.jsxs)(`table`,{className:`mf-entries`,children:[(0,m.jsx)(`thead`,{className:`sr-only`,children:(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`th`,{scope:`col`,children:`Path`}),(0,m.jsx)(`th`,{scope:`col`,children:`Load`}),(0,m.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,m.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,m.jsxs)(`tr`,{children:[(0,m.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,m.jsx)(`td`,{className:`mf-load-cell`,children:(0,m.jsx)(de,{load:e.load})}),(0,m.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function g({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,m.jsxs)(`div`,{className:`mf-vault`,children:[(0,m.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,m.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,m.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,m.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,m.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,m.jsxs)(`span`,{className:`mf-role`,children:[(0,m.jsx)(c,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,m.jsxs)(`span`,{className:`mf-role`,children:[(0,m.jsx)(c,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,m.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,m.jsx)(c,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,m.jsx)(h,{entries:t})]})}function _({body:e}){let[t,n]=(0,p.useState)(!1),r=(0,p.useId)();return e?(0,m.jsxs)(`div`,{className:`mf-raw`,children:[(0,m.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,m.jsx)(c,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,m.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function fe({manifest:e,body:t,name:n}){if(!e)return(0,m.jsx)(`pre`,{className:`mf-raw-pre`,children:(t||``).replace(/^```json\n|\n```$/g,``)});if(e.kind===`wiki`){let n=e.wikis||[];return n.length?(0,m.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,m.jsx)(g,{wiki:e},e.name||t)),(0,m.jsx)(_,{body:t})]}):(0,m.jsxs)(`div`,{className:`mf-empty`,children:[(0,m.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,m.jsxs)(`p`,{children:[`A wiki is your machine-wide knowledge base — an Obsidian vault or any folder of linked markdown the agent reads from and writes back to. Declare one in`,` `,(0,m.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,m.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,m.jsx)(_,{body:t})]})}let r=e.context||[];return r.length?(0,m.jsxs)(`div`,{className:`mf-doc`,children:[(0,m.jsx)(h,{entries:r}),(0,m.jsx)(_,{body:t})]}):(0,m.jsxs)(`div`,{className:`mf-empty`,children:[(0,m.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,m.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,m.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,m.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,m.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,m.jsx)(_,{body:t})]})}var v={fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},y={advocate:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M16 50h14M23 50V14`}),(0,m.jsx)(`path`,{className:`ag-wave ag-f`,d:`M23 15h20l-5 7.5 5 7.5H23z`}),(0,m.jsx)(`path`,{className:`ag-call`,d:`M47 38a6 6 0 0 1 0 8M51 35a11 11 0 0 1 0 14`})]}),architect:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{x:`14`,y:`14`,width:`36`,height:`32`,rx:`2`,opacity:`.3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M20 40V22h12v9h12v9z`}),(0,m.jsx)(`path`,{className:`ag-draw ag-late`,pathLength:`100`,d:`M32 31v9`}),(0,m.jsx)(`path`,{d:`M14 52h36M14 50v4M50 50v4`,opacity:`.5`})]}),developer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-f`,x:`10`,y:`14`,width:`44`,height:`36`,rx:`4`}),(0,m.jsx)(`path`,{d:`M10 22h44`,opacity:`.5`}),(0,m.jsx)(`circle`,{cx:`15`,cy:`18`,r:`1`}),(0,m.jsx)(`circle`,{cx:`19`,cy:`18`,r:`1`}),(0,m.jsx)(`path`,{className:`ag-nudge-l`,d:`M24 30l-6 6 6 6`}),(0,m.jsx)(`path`,{className:`ag-nudge-r`,d:`M40 30l6 6-6 6`}),(0,m.jsx)(`path`,{className:`ag-blink`,d:`M30 42h5`})]}),"devops-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M32 32c-5-9-18-9-18 0s13 9 18 0c5-9 18-9 18 0s-13 9-18 0z`,opacity:`.3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M32 32c-5-9-18-9-18 0s13 9 18 0c5-9 18-9 18 0s-13 9-18 0z`}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`3`})]}),"docker-expert":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`14`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`27`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`40`,y:`36`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`20`,y:`25`,width:`10`,height:`9`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`34`,y:`25`,width:`10`,height:`9`}),(0,m.jsx)(`path`,{d:`M8 52c5 0 5-3 10-3s5 3 10 3 5-3 10-3 5 3 10 3 5-3 10-3`,opacity:`.5`})]}),docs:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M16 10h22l8 8v36H16z`}),(0,m.jsx)(`path`,{d:`M38 10v8h8`,opacity:`.5`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M21 26h18`}),(0,m.jsx)(`path`,{className:`ag-draw ag-late`,pathLength:`100`,d:`M21 33h18`}),(0,m.jsx)(`path`,{className:`ag-draw ag-later`,pathLength:`100`,d:`M21 40h11`}),(0,m.jsx)(`g`,{className:`ag-write`,children:(0,m.jsx)(`path`,{d:`M40 44l12-20 3 2-12 20-4 1z`})})]}),empiricist:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 12v40h40`,opacity:`.5`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`18`,y:`36`,width:`6`,height:`14`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`29`,y:`28`,width:`6`,height:`22`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`40`,y:`20`,width:`6`,height:`30`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M16 34l12-8 10 3 12-14`})]}),explorer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`18`,opacity:`.5`}),(0,m.jsx)(`path`,{d:`M32 10v4M32 50v4M10 32h4M50 32h4`}),(0,m.jsxs)(`g`,{className:`ag-search`,children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 18l5 14h-10z`}),(0,m.jsx)(`path`,{d:`M32 18l5 14-5 14-5-14z`})]}),(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`2`})]}),framer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`g`,{className:`ag-frame`,children:(0,m.jsx)(`path`,{d:`M12 22V12h10M42 12h10v10M52 42v10H42M22 52H12V42`})}),(0,m.jsx)(`circle`,{className:`ag-pulse`,cx:`32`,cy:`32`,r:`7`,opacity:`.6`}),(0,m.jsx)(`path`,{d:`M32 22v6M32 36v6M22 32h6M36 32h6`,opacity:`.6`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`1.5`})]}),historian:(0,m.jsxs)(`g`,{className:`ag-turn`,children:[(0,m.jsx)(`path`,{d:`M20 12h24M20 52h24`}),(0,m.jsx)(`path`,{d:`M22 12c0 12 20 12 20 20s-20 8-20 20M42 12c0 12-20 12-20 20s20 8 20 20`}),(0,m.jsx)(`path`,{className:`ag-drain ag-f`,d:`M25 17h14c-1 6-5 9-7 11-2-2-6-5-7-11z`}),(0,m.jsx)(`path`,{className:`ag-fill ag-f`,d:`M24 49h16c-1-5-5-8-8-9-3 1-7 4-8 9z`})]}),operator:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 42a20 20 0 0 1 40 0`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M40 24a20 20 0 0 1 12 18`,strokeWidth:`4`,opacity:`.7`}),(0,m.jsx)(`path`,{d:`M16 30l3 2M32 22v4M48 30l-3 2`,opacity:`.6`}),(0,m.jsx)(`g`,{className:`ag-gauge`,children:(0,m.jsx)(`path`,{d:`M32 42l10-13`})}),(0,m.jsx)(`circle`,{cx:`32`,cy:`42`,r:`3`}),(0,m.jsx)(`path`,{d:`M22 50h20`,opacity:`.5`})]}),pragmatist:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M32 14v36M22 50h20`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`14`,r:`2`}),(0,m.jsxs)(`g`,{className:`ag-tilt`,children:[(0,m.jsx)(`path`,{d:`M14 18h36`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M14 18l-5 12h10zM50 18l-5 12h10z`})]})]}),"kubernetes-specialist":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`32`,cy:`32`,r:`16`}),(0,m.jsx)(`path`,{d:`M32 8v13M32 43v13M8 32h13M43 32h13M15 15l9 9M40 40l9 9M49 15l-9 9M24 40l-9 9`,opacity:`.6`}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`5`})]}),"memory-curator":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`rect`,{className:`ag-rise ag-f`,x:`17`,y:`16`,width:`14`,height:`20`,rx:`1`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-late ag-f`,x:`25`,y:`12`,width:`14`,height:`24`,rx:`1`}),(0,m.jsx)(`rect`,{className:`ag-rise ag-later ag-f`,x:`33`,y:`18`,width:`14`,height:`18`,rx:`1`}),(0,m.jsx)(`path`,{d:`M12 32h40v16a2 2 0 0 1-2 2H14a2 2 0 0 1-2-2z`}),(0,m.jsx)(`path`,{d:`M26 40h12`,opacity:`.6`})]}),researcher:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`34`,r:`16`}),(0,m.jsx)(`path`,{d:`M14 34h32M30 18c-6 5-6 27 0 32`,opacity:`.5`}),(0,m.jsx)(`ellipse`,{className:`ag-spin`,cx:`30`,cy:`34`,rx:`7`,ry:`16`}),(0,m.jsx)(`g`,{className:`ag-orbit`,children:(0,m.jsx)(`circle`,{cx:`50`,cy:`14`,r:`3`})})]}),reviewer:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 18h30M12 26h40M12 34h24M12 42h34`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-mark`,d:`M42 30l3 3 6-6`}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`22`,cy:`30`,r:`9`}),(0,m.jsx)(`path`,{d:`M29 37l8 8`,strokeWidth:`3`})]})]}),performance:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M26 10h8M30 10v6M44 18l3-3`}),(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`34`,r:`18`}),(0,m.jsx)(`path`,{d:`M30 19v3M45 34h-3M30 49v-3M15 34h3`,opacity:`.6`}),(0,m.jsx)(`g`,{className:`ag-orbit`,children:(0,m.jsx)(`path`,{d:`M30 34V22`})}),(0,m.jsx)(`circle`,{cx:`30`,cy:`34`,r:`2`})]}),security:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-ripple`,d:`M32 8l18 6v13c0 12-8 21-18 26-10-5-18-14-18-26V14z`}),(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 8l18 6v13c0 12-8 21-18 26-10-5-18-14-18-26V14z`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M24 31l6 6 11-11`})]}),skeptic:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M12 14h40v28H30l-10 8v-8h-8z`}),(0,m.jsxs)(`g`,{className:`ag-lean`,children:[(0,m.jsx)(`path`,{d:`M27 23a5 5 0 1 1 7 4.5c-1.5.8-2 2-2 3.5v1`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`36`,r:`1.2`})]})]}),"spring-boot-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M22 20a16 16 0 1 0 20 0`}),(0,m.jsx)(`path`,{className:`ag-pulse`,d:`M32 12v18`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M32 50c0-8 5-12 13-12 0 8-5 12-13 12z`})]}),"spring-reviewer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 18h26M12 26h18M12 34h22M12 42h14`,opacity:`.4`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M42 28c0-8 4-12 11-12 0 8-4 12-11 12z`}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`24`,cy:`32`,r:`9`}),(0,m.jsx)(`path`,{d:`M31 39l8 8`,strokeWidth:`3`})]})]}),"spring-security":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-ripple`,d:`M22 28v-6a10 10 0 0 1 20 0v6`}),(0,m.jsx)(`path`,{d:`M22 28v-6a10 10 0 0 1 20 0v6`}),(0,m.jsx)(`rect`,{className:`ag-f`,x:`16`,y:`28`,width:`32`,height:`24`,rx:`4`}),(0,m.jsx)(`circle`,{cx:`32`,cy:`38`,r:`3`}),(0,m.jsx)(`path`,{className:`ag-draw`,pathLength:`100`,d:`M32 41v6`})]}),"react-engineer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`g`,{className:`ag-spin`,children:[(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`}),(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`,transform:`rotate(60 32 32)`}),(0,m.jsx)(`ellipse`,{cx:`32`,cy:`32`,rx:`20`,ry:`8`,transform:`rotate(120 32 32)`})]}),(0,m.jsx)(`circle`,{className:`ag-pulse ag-f`,cx:`32`,cy:`32`,r:`4`})]}),"react-reviewer":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`g`,{opacity:`.4`,children:[(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`}),(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`,transform:`rotate(60 30 30)`}),(0,m.jsx)(`ellipse`,{cx:`30`,cy:`30`,rx:`18`,ry:`7`,transform:`rotate(120 30 30)`})]}),(0,m.jsxs)(`g`,{className:`ag-sweep`,children:[(0,m.jsx)(`circle`,{className:`ag-f`,cx:`30`,cy:`30`,r:`8`}),(0,m.jsx)(`path`,{d:`M36 36l9 9`,strokeWidth:`3`})]})]}),steward:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M12 52h40`,opacity:`.5`}),(0,m.jsx)(`path`,{d:`M22 52c2-3 6-4 10-4s8 1 10 4`,opacity:`.4`}),(0,m.jsxs)(`g`,{className:`ag-grow`,children:[(0,m.jsx)(`path`,{d:`M32 50V26`}),(0,m.jsx)(`path`,{className:`ag-sway ag-f`,d:`M32 32c0-9 6-14 15-14 0 9-6 14-15 14z`}),(0,m.jsx)(`path`,{className:`ag-sway ag-late ag-f`,d:`M32 38c0-7-5-11-12-11 0 7 5 11 12 11z`})]})]}),tester:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{d:`M26 10h12M28 10v14L15 48a3 3 0 0 0 2.6 4.5h28.8A3 3 0 0 0 49 48L36 24V10`}),(0,m.jsx)(`path`,{className:`ag-f ag-slosh`,d:`M20 40h24l4.5 8.5H15.5z`}),(0,m.jsx)(`circle`,{className:`ag-bubble`,cx:`28`,cy:`44`,r:`2`}),(0,m.jsx)(`circle`,{className:`ag-bubble ag-late`,cx:`35`,cy:`46`,r:`1.5`}),(0,m.jsx)(`circle`,{className:`ag-bubble ag-later`,cx:`31`,cy:`42`,r:`1`})]}),"user-advocate":(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`circle`,{cx:`24`,cy:`20`,r:`6`}),(0,m.jsx)(`path`,{d:`M12 50c0-9 5-15 12-15 4 0 7 1.5 9 4`}),(0,m.jsx)(`path`,{className:`ag-beat ag-f`,d:`M44 52s-10-6-10-12.5a5 5 0 0 1 10-1.5 5 5 0 0 1 10 1.5C54 46 44 52 44 52z`}),(0,m.jsx)(`path`,{className:`ag-twinkle`,d:`M48 22v4M46 24h4`})]}),visionary:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`g`,{className:`ag-rays`,opacity:`.5`,children:(0,m.jsx)(`path`,{d:`M32 6v6M32 52v6M6 32h6M52 32h6M13.6 13.6l4.2 4.2M46.2 46.2l4.2 4.2M13.6 50.4l4.2-4.2M46.2 17.8l4.2-4.2`})}),(0,m.jsx)(`path`,{className:`ag-f ag-pulse`,d:`M32 16l4.7 10.4 11.3 1.2-8.5 7.6 2.4 11.1L32 40.6l-9.9 5.7 2.4-11.1-8.5-7.6 11.3-1.2z`}),(0,m.jsx)(`path`,{className:`ag-twinkle`,d:`M50 8v6M47 11h6`})]})},b=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`path`,{className:`ag-f`,d:`M32 12l17 10v20L32 52 15 42V22z`}),(0,m.jsx)(`circle`,{className:`ag-pulse`,cx:`32`,cy:`32`,r:`6`})]});function pe({name:e,size:t=64}){return(0,m.jsxs)(`svg`,{className:`agent-glyph`,viewBox:`0 0 64 64`,width:t,height:t,"aria-hidden":`true`,...v,children:[(0,m.jsx)(`circle`,{className:`ag-disc`,cx:`32`,cy:`32`,r:`31`}),(0,m.jsx)(`circle`,{className:`ag-ring`,cx:`32`,cy:`32`,r:`31`,strokeWidth:`1`,strokeDasharray:`2 7`}),y[e]||b]})}function x({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,m.jsxs)(`div`,{className:`stat`,children:[(0,m.jsx)(`div`,{className:`stat-label`,children:e}),(0,m.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,m.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var me={skills:`skill`,agents:`agent`},he=(e,t)=>`${t?e/t*100:0}%`,S=e=>e.split(`:`).slice(0,2).join(` `);function C(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 ge({section:e,source:t}){return(0,m.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,m.jsx)(c,{name:a[e].icon,className:`glyph`}),(0,m.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,m.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var w=e=>e.replace(/\s+/g,` `).trim(),T=e=>e.replace(/^(?:[ \t]*\n)+/,``);function _e(e,t){let n=e.replace(/\r\n/g,`
|
|
2
|
+
`),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=T(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?w(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?w(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=T(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function ve({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,m.jsx)(`div`,{className:`lib-stats`,children:(0,m.jsx)(x,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(S))].join(`, `),i=t.days_counted>=30?`in the last 30 days`:`since ${t.since}`,a=Math.max(1,...e.per_day),o=[e.last?`last used ${e.last}`:null,i,r?`on ${r}`:null].filter(Boolean).join(` · `);return(0,m.jsx)(`div`,{className:`lib-stats`,children:(0,m.jsx)(x,{label:`Used`,value:e.n,delta:o,children:(0,m.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,m.jsx)(`i`,{className:t===29?`today`:``,style:{height:he(e,a)}},t))})})})}function E(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 ye={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},be=(e,t)=>t||(e&&o.includes(e)?e:o[0]),xe=encodeURIComponent;function Se(e){let t=e=>l[e.klass]?e.klass:`personal`,n=d.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:l[n].label,groupC:l[n].c})));return{rows:n,cats:d.map(e=>({key:e,label:l[e].label,c:l[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ce(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 D({overview:e,section:t,selected:n,dataRev:i,lock:c,base:d,onRulesChanged:de}){let h=te(),[g,_]=(0,p.useState)(()=>be(t,c)),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(`all`),[S,w]=(0,p.useState)(`all`),[T,D]=(0,p.useState)(``),[we,Te]=(0,p.useState)(null),[Ee,De]=(0,p.useState)(t);if(t!==Ee){De(t),D(``);let e=be(t,c);e!==g&&(_(e),y(``),x(`all`),w(`all`))}let[Oe,ke]=(0,p.useState)(n);n!==Oe&&(ke(n),D(``));let{data:O,error:Ae,reload:k}=u(()=>r.catalog(g),[g,i],`catalog`),A=c?null:me[g]||null,j=A!==null,{data:M}=u(()=>j?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[j,i],`usage`,{revalidate:!0}),N=j&&!!M?.enabled&&Array.isArray(M.names),je=(0,p.useMemo)(()=>new Map((Array.isArray(M?.names)?M.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[M]),P=e=>N&&je.get(`${A}\u0000${e}`)||null,F=e=>{let t=P(e.name);return!t||t.n===0&&!t.last},Me=M?.since?`No call since ${M.since}`:`No call recorded yet`,I=O?.section===g&&O?.items||[],L=g===`skills`,Ne=L?Se(I):null,R=L?Ne.rows:g===`memory`?Ce(I):I,z=n||R[0]?.name||null,B=z?I.find(e=>e.name===z):null,Pe=B?.type||a[g].type,{data:Fe,error:V}=u(()=>z?r.item(Pe,z):Promise.resolve(null),[g,z,Pe,i]),H=V?null:Fe,Ie=T||Ae||V,Le=z?{name:z,title:H?.title||z,desc:H?.desc||``}:null,U=B||Le,Re=e?.counts||{},W=L?R.filter(e=>b===`all`||e.cat===b):R,ze=N?W.filter(F).length:0,Be=e=>e.status===`experimental`,Ve=W.filter(Be).length,G=[[`all`,`All`,W.length],...N?[[`used`,`Used`,W.length-ze],[`unused`,`Not used yet`,ze,Me]]:[],...Ve?[[`experimental`,`Experimental`,Ve,`Shipped, not yet confirmed by real use`]]:[]],K=G.some(([e])=>e===S)?S:`all`,q=K===`all`?W:K===`experimental`?W.filter(Be):W.filter(e=>F(e)===(K===`unused`)),He=N?Math.max(0,...I.map(e=>P(e.name)?.n||0)):0,J=L?1/0:50,Y=v.trim().toLowerCase(),X=Y?oe(q,Y):q.slice(0,J),Ue=!Y&&b===`all`&&K===`all`&&z&&!X.some(e=>e.name===z)?[...X,...R.filter(e=>e.name===z)]:X,We=e=>d?`${d}/${xe(e.name)}`:`#/item/${e.type||a[g].type}/${xe(e.name)}`,Ge=async()=>{let e=U?.name;if(e&&await h(`Forget the memory fact "${e}"? It leaves the index and moves to memory/archive/ (geneseed memory rm --archived --purge deletes it for good).`,{title:`Forget this fact?`,confirmLabel:`Forget`,tone:`danger`})){D(``);try{await r.memoryDelete(e)}catch(t){D(`Could not forget "${e}": ${t.message}`);return}re(d||`#/section/memory`),k()}},Ke=async()=>{let e=U?.name;if(e&&await h(`Promote "${e}" into a standing rule? It is appended to user-rules.md as a trial rule (a month of probation), and the memory fact moves to memory/archive/ so the lesson isn't loaded twice.`,{title:`Promote to a rule?`,confirmLabel:`Promote`})){D(``);try{let t=await r.rules();await r.rulesPromote({name:e,fingerprint:t.fingerprint,delete_memory:!0}),s(),de?.(),re(`#/personal/rules`)}catch(e){D(`Could not promote: ${e.message}`),k()}}},Z=H?.body?_e(H.body,H.desc||U?.desc):null,qe=H?.title||U?.title||U?.name,Je=qe===U?.name&&Z?.title?Z.title:qe,Ye=O?.section===g&&I.length===0,Xe=H?.status||U?.status,Ze=g===`skills`?l[B?.klass]:null,Q=a[g].label,{lede:Qe,when:$e}=E(H?.desc||U?.desc||``),$=U?H?.source||U.source||(V?null:C(g,U.name)):null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(ne,{error:Ie,style:{margin:`0 0 var(--sp-3)`}}),(0,m.jsxs)(`div`,{className:`library lib-dossier${c?` locked`:``}${N?` uses`:``}`,children:[c?null:(0,m.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,m.jsxs)(`div`,{className:`lib-title`,children:[(0,m.jsx)(`h1`,{className:`h`,children:`Library`}),(0,m.jsx)(`span`,{className:`dim`,children:`What the agent knows`})]}),(0,m.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,m.jsxs)(p.Fragment,{children:[(0,m.jsxs)(`a`,{href:`#/section/${e}`,className:g===e?`on`:``,"aria-current":g===e?`page`:void 0,children:[a[e].label,(0,m.jsx)(`span`,{className:`mono dim`,children:Re[e]??``})]}),e===g&&L&&(0,m.jsx)(le,{label:`Skill types`,total:I.length,cats:Ne.cats,cat:b,onChange:x})]},e))})]}),(0,m.jsxs)(ie,{label:Q,count:Y?`${X.length} of ${q.length}`:q.length,q:v,onQ:y,matched:X.length,inView:[g,n],extra:N&&M.since?(0,m.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,M.since]}):null,tools:G.length>1?(0,m.jsx)(ee,{"aria-label":`Show`,children:G.map(([e,t,n,r])=>(0,m.jsxs)(`button`,{type:`button`,className:K===e?`on`:``,"aria-pressed":K===e,title:r,onClick:()=>w(e),children:[t,` `,(0,m.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[(0,m.jsx)(se,{rows:Ue,activeName:U?.name,hrefOf:We,pills:N?e=>{let t=P(e.name)?.n||0;return(0,m.jsxs)(`span`,{className:`lr-use`,children:[(0,m.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,m.jsx)(`i`,{style:{width:he(t,He)}})}),(0,m.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,m.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})}:void 0}),!Y&&I.length>J&&(0,m.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,J,` of `,I.length,`; type to search the rest.`]}),Ye&&(g===`wiki`?(0,m.jsxs)(f,{title:`No wiki entries`,action:(0,m.jsx)(`a`,{href:`#/section/config`,children:`Open the setup files`}),docs:{href:`#/docs/wiki`,label:`How to configure a wiki →`},children:[`Declare a wiki in `,(0,m.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,m.jsx)(f,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,m.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:U?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`reader-tags`,children:[(0,m.jsx)(`span`,{className:`tag acc`,children:Q.replace(/s$/,``)}),Ze?(0,m.jsx)(`span`,{className:`tag`,children:Ze.label}):null,H?.kit??U.kit?(0,m.jsx)(ae,{name:H?.kit??U.kit}):null,(0,m.jsx)(ce,{status:Xe,withHint:!0}),$?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`span`,{className:`mono dim reader-src`,children:$}),(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),Te({src:$,ok:!0})}catch{Te({src:$,ok:!1})}},children:we?.src===$?we.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,m.jsxs)(`div`,{className:`reader-head`,children:[(0,m.jsx)(`h2`,{className:`reader-title`,children:Je}),g===`agents`?(0,m.jsx)(pe,{name:U.name}):null]}),(0,m.jsxs)(`div`,{className:`reader-intro${N?` with-stats`:``}`,children:[(0,m.jsxs)(`div`,{className:`reader-intro-text`,children:[Qe?(0,m.jsx)(`p`,{className:`reader-lede`,children:Qe}):null,$e?(0,m.jsxs)(`section`,{className:`reader-when`,children:[(0,m.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,m.jsx)(`p`,{children:$e})]}):null]}),N?(0,m.jsx)(ve,{u:P(U.name),usage:M,noCall:Me}):null]}),g===`memory`&&U.name!==`MEMORY`&&U.name!==`README`&&(0,m.jsxs)(`div`,{className:`row gap-8`,children:[(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Ke,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,m.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Ge,children:`Forget this fact`})]}),(0,m.jsx)(`hr`,{className:`hr`}),V?(0,m.jsxs)(`p`,{className:`sub`,children:[`No `,Q.replace(/s$/,``).toLowerCase(),` named `,(0,m.jsx)(`em`,{children:U.name}),` could be read in this install.`]}):U?.kind===`manifest`||H?.manifest!==void 0?H?(0,m.jsx)(fe,{manifest:H.manifest,body:H.body,name:U.name}):(0,m.jsx)(`p`,{className:`sub`,children:`Loading…`}):H?.body?(0,m.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,m.jsx)(ue,{body:Z.body,links:H.links||[]})}):H===null&&z?(0,m.jsx)(`p`,{className:`sub`,children:`Loading…`}):(0,m.jsx)(ge,{section:g,source:C(g,U.name)}),ye[g]?(0,m.jsx)(`div`,{className:`reader-links`,children:(0,m.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${ye[g]}`,children:[`About `,Q.toLowerCase(),` in Docs`]})}):null]}):Ye?null:(0,m.jsx)(f,{title:`Select an entry`,children:`Pick something from the list to read it.`})})]})]})}export{_e as bodyHead,D as default,Ce as groupMemory,Se as splitSkills,E as splitWhen};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BfpZmUMI.js";import{J as i,_t as a,ft as o,q as s,vt as c}from"./index-BUdl0KdD.js";import{t as l}from"./EmptyState-1sPNleqv.js";import{t as u}from"./usePoll-bDFN-Hr6.js";import{a as d,n as f,o as p,r as m,t as h}from"./RailCats-BuJD4Jou.js";import{t as g}from"./CopyButton-BHxw2k1Z.js";import{t as _}from"./Markdown-DpmmtW2Y.js";import{t as v}from"./DataTable-BWbUx4bY.js";var y=e(t(),1),b={x:260,y:190},x=110,S=28,C=14,w=44,T=e=>e*Math.PI/180,E=e=>Math.round(e*10)/10,D=(e,t=x,n=b)=>({x:E(n.x+t*Math.cos(T(e))),y:E(n.y+t*Math.sin(T(e)))}),O=e=>e/x*(180/Math.PI)+3,k=(e,t,n,r=0)=>`M${t.x},${t.y} A${e},${e} 0 ${r} 1 ${n.x},${n.y}`,A=E(D(205).x-6),j=e=>e.length*6.4,M=e=>({x:e.x-j(e.name)/2,y:e.y-7,w:j(e.name),h:14}),N=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,P=(e,t)=>e.some((n,r)=>[...e.slice(r+1),...t.filter(e=>!e.gate)].some(e=>N(M(n),M(e))));function F(e){return e?.gate===`human`?e.gateOn?.length?`Human gate on ${e.gateOn.join(`, `)}`:`Human gate`:null}function I(e,t=[]){let n=L(e,t,0);if(n.mode!==`ring`)return n;let r=Math.min(...n.entry.map(e=>e.y-30),...n.nodes.map(e=>e.y-e.r-12),...n.inner.map(e=>e.cy-e.r-12),...n.exit?[n.exit.y-24]:[]);return r<0?L(e,t,Math.ceil(-r)):n}function L(e,t,n){let r={x:b.x,y:b.y+n},i=(e,t=x)=>D(e,t,r),a=e=>t.find(t=>t.name===e),o=e=>a(e)?.effect??null,s=e=>F(a(e)),c=e.loops||[],l=c.find(e=>e.iteration);if(!l||l.nodes.length>8)return R(e,o,s);let u=Math.max(...e.nodes.map(e=>c.filter(t=>t.nodes.includes(e)).length)),d=c.filter(e=>e!==l);if(u>3||d.some(e=>!e.nodes.every(e=>l.nodes.includes(e))))return R(e,o,s);let f=l.nodes[0],p=new Set(e.edges.filter(e=>e.to===f).map(e=>e.from)),m=new Map;for(let e of[...d].sort((e,t)=>e.nodes.length-t.nodes.length))for(let t of e.nodes.slice(1))t!==f&&!p.has(t)&&!m.has(t)&&m.set(t,e);let h=l.nodes.filter(e=>!m.has(e));if(h.length<2||d.some(e=>m.has(e.nodes[0])))return R(e,o,s);let g=360/h.length,_=h.map((e,t)=>({name:e,a:-90+t*g,r:S})),v=_.findIndex(e=>o(e.name)===`mutate`);v>=0&&_.splice(v,0,{name:`validate`,a:_[v].a-g/2,r:C,gate:!0});let y=_.map(e=>({name:e.name,...i(e.a),r:e.r,effect:e.gate?null:o(e.name),gate:!!e.gate,inner:!1,human:e.gate?null:s(e.name)})),T=_.map((e,t)=>{let n=_[(t+1)%_.length],r=(t+1===_.length?n.a+360:n.a)-O(n.r)-2,a=e.a+O(e.r);return{d:k(x,i(a),i(r),+(r-a>180)),kind:`ring`}}),A=[],M=new Map;for(let e of d)M.set(e.nodes[0],[...M.get(e.nodes[0])||[],e]);for(let[e,t]of M){let n=_.find(t=>t.name===e),r=i(n.a),a=t.length>1;t.sort((e,t)=>e.nodes.length-t.nodes.length).forEach((e,t)=>{let c=i(n.a+(a?t?18:-18:0),x+(a?54:44)),l=Math.atan2(c.y-r.y,c.x-r.x)*(180/Math.PI),u=e.nodes.filter(t=>m.get(t)===e),d=e=>u.map((t,n)=>({name:t,...D(l+(n-(u.length-1)/2)*e,w,c)})),f=105;for(;f<150&&P(d(f),y);)f+=5;d(f).forEach(({name:e,...t})=>{y.push({name:e,...t,r:S,effect:o(e),gate:!1,inner:!0,human:s(e)})});let p=l+180;T.push({d:k(w,D(p+42,w,c),D(p+138,w,c)),kind:`inner`}),T.push({d:k(w,D(p+222,w,c),D(p+318,w,c)),kind:`inner`});let h=`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)} · max ${e.max}`,g={lx:c.x,ly:c.y+w+20,anchor:`middle`};if(a){let e=c.x>=b.x,t=Math.max(w,...u.map(e=>{let t=y.find(t=>t.name===e);return Math.abs(t.x-c.x)+S}));g={lx:E(c.x+(e?t+8:-t-8)),ly:E(c.y+4),anchor:e?`start`:`end`}}A.push({loop:e.name,cx:c.x,cy:c.y,r:w,label:h,...g})})}let N=i(205).y,I=e.nodes.filter(e=>!l.nodes.includes(e)),L=I.map((e,t)=>({name:e,x:40,y:E(N-44*(I.length-1-t)),human:s(e)})),z=e.edges.find(e=>e.to===`$close`)?.from,B=y.find(e=>e.name===z),V=B?{from:z,x:B.x+200,y:B.y-30,d:`M${B.x+S},${B.y-6} C${B.x+90},${B.y-40} ${B.x+170},${B.y-40} ${B.x+200},${B.y-30}`}:null,ee=Math.max(540,...y.map(e=>e.x+e.r+8),...V?[V.x+6+j(`close`)+8]:[],...A.map(e=>e.cx+e.r+8),...A.map(e=>e.anchor===`start`?e.lx+j(e.label)+8:e.lx+j(e.label)/2+8)),H=Math.max(300,...y.map(e=>e.y+e.r+12),...A.map(e=>Math.max(e.cy+e.r,e.ly)+12));return{mode:`ring`,width:Math.ceil(ee),height:Math.ceil(H),center:{x:r.x,y:r.y,r:x},nodes:y,arcs:T,inner:A,entry:L,exit:V}}function R(e,t,n){let r=e.loops||[],i=e=>36+16*r.filter(t=>t!==e&&t.nodes.every(t=>e.nodes.includes(t))).length,a=Math.max(S,...r.map(i))+30,o=new Map(e.nodes.map((e,t)=>[e,60+t*100])),s=e.nodes.map(e=>({name:e,x:o.get(e),y:a,r:S,effect:t(e),gate:!1,inner:!1,human:n(e)})),c=e.nodes.slice(1).map((t,n)=>({d:`M${o.get(e.nodes[n])+S},${a} L${o.get(t)-S-4},${a}`,kind:`flow`})),l=r.map(e=>{let t=i(e),n=Math.min(...e.nodes.map(e=>o.get(e))),r=Math.max(...e.nodes.map(e=>o.get(e))),s={x:n-t,y:a-t,w:r-n+2*t,h:2*t};return c.push({d:`M${r},${s.y+s.h} L${n+4},${s.y+s.h}`,kind:`flow`}),{loop:e.name,label:`${e.name} · max ${e.max}`,box:s}});return{mode:`flow`,width:60+e.nodes.length*100,height:2*a,center:null,nodes:s,arcs:c,inner:l,entry:[],exit:null}}var z=n();function B({x:e,y:t,label:n}){return(0,z.jsxs)(`g`,{className:`lr-human`,children:[(0,z.jsx)(`title`,{children:n}),(0,z.jsx)(`circle`,{cx:e,cy:t,r:`9`}),(0,z.jsx)(`circle`,{cx:e,cy:t-2.4,r:`2.6`,className:`lr-human-fig`}),(0,z.jsx)(`path`,{d:`M${e-4.6},${t+5.6} a4.6,4.6 0 0 1 9.2,0 Z`,className:`lr-human-fig`})]})}function V({graph:e,bricks:t,onSelect:n,highlight:r}){let i=I(e,t),a=(e.loops||[]).find(e=>e.iteration),o=e=>`${e.name} brick${e.human?`, ${e.human.toLowerCase()}`:``}`,s=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n?.(e))};return(0,z.jsxs)(`svg`,{className:`loop-ring`,viewBox:`0 0 ${i.width} ${i.height}`,role:`group`,"aria-label":`${e.name} loop: ${e.nodes.join(`, `)}`,children:[(0,z.jsx)(`defs`,{children:[`ring`,`inner`,`flow`].map(e=>(0,z.jsx)(`marker`,{id:`lr-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,z.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`lr-head-${e}`})},e))}),i.mode===`ring`&&i.inner.map(e=>(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,className:`lr-inner`}),(0,z.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.mode===`flow`&&i.inner.map(e=>(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`rect`,{x:e.box.x,y:e.box.y,width:e.box.w,height:e.box.h,rx:`14`,className:`lr-box`}),(0,z.jsx)(`text`,{x:e.box.x+10,y:e.box.y-6,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.arcs.map((e,t)=>(0,z.jsx)(`path`,{d:e.d,className:`lr-${e.kind}`,markerEnd:`url(#lr-arrow-${e.kind})`},t)),i.entry.length>0&&(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`path`,{d:`M40,${i.entry.at(-1).y} L${A},${i.entry.at(-1).y}`,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),i.entry.map(e=>(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`text`,{x:e.x,y:e.y-10,className:`lr-lbl`,children:e.name}),(0,z.jsx)(`text`,{x:e.x,y:e.y+18,className:`lr-sub`,children:`setup · 1×`}),e.human?(0,z.jsx)(B,{x:e.x-14,y:e.y-14,label:e.human}):null]},e.name))]}),i.nodes.map(e=>e.gate?(0,z.jsxs)(`g`,{className:`lr-gate`,children:[(0,z.jsx)(`title`,{children:`validate — the engine scores the change before the first mutate step`}),(0,z.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,z.jsx)(`text`,{x:e.x,y:e.y+5,textAnchor:`middle`,children:`⛨`}),(0,z.jsx)(`text`,{x:e.x+20,y:e.y-10,className:`lr-sub lr-warn`,children:`validate`})]},e.name):(0,z.jsxs)(`g`,{className:`lr-node${e.inner?` inner`:``}${e.effect===`mutate`?` mutate`:``}${e.name===r?` current`:``}`,"aria-current":e.name===r?`step`:void 0,...n?{role:`button`,tabIndex:0,"aria-label":o(e),onClick:s(e.name),onKeyDown:s(e.name)}:{role:`img`,"aria-label":`${o(e)}${e.name===r?`, current step`:``}`},children:[(0,z.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,z.jsx)(`text`,{x:e.x,y:e.y+4,textAnchor:`middle`,children:e.name}),e.human?(0,z.jsx)(B,{x:e.x+e.r*.74,y:e.y-e.r*.74,label:e.human}):null]},e.name)),i.exit&&(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`path`,{d:i.exit.d,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),(0,z.jsx)(`text`,{x:i.exit.x+6,y:i.exit.y+4,className:`lr-lbl`,children:`close`}),(0,z.jsx)(`text`,{x:i.exit.x-90,y:i.exit.y-10,textAnchor:`middle`,className:`lr-sub`,children:`done`})]}),i.center&&a&&(0,z.jsxs)(`g`,{children:[(0,z.jsx)(`text`,{x:i.center.x,y:i.center.y-4,textAnchor:`middle`,className:`lr-title`,children:e.name}),(0,z.jsxs)(`text`,{x:i.center.x,y:i.center.y+16,textAnchor:`middle`,className:`lr-sub lr-acc`,children:[`iterations · max `,a.max]})]})]})}var ee=5e3,H=[`prudent`,`balanced`,`aggressive`],U={running:`acc`,awaiting:`warn`,unreadable:`bad`},W=e=>!!e.graph;function te(){let[e,t]=(0,y.useState)(null),[n,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(0);return u(e=>r.activeLoops().then(n=>e()&&(t(n),i(null)),t=>e()&&i(t.message)),ee,[s]),{loops:e?.loops??null,error:a||n,onPreset:(e,t)=>(o(null),r.setLoopPreset(e,t).then(()=>c(e=>e+1),e=>o(e.message)))}}var G=e=>({key:e,label:e,align:`right`,render:t=>(0,z.jsx)(`span`,{className:`num`,children:t[e]})}),ne=[G(`iteration`),{key:`intent`,label:`intent`},G(`declared`),G(`actual`),{key:`decision`,label:`decision`},{key:`tests`,label:`tests`}];function re({history:e}){return e.length?(0,z.jsx)(`div`,{className:`loop-history`,children:(0,z.jsx)(v,{caption:`Iterations`,captionHidden:!0,columns:ne,rows:e,rowKey:e=>e.iteration})}):(0,z.jsx)(`p`,{className:`panel-note`,children:`No iteration finished yet.`})}function ie({loop:e,bricks:t,onPreset:n}){let r=W(e)?(e.graph.loops||[]).find(e=>e.iteration):null,[i,a]=(0,y.useState)(!1);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`reader-tags`,children:[(0,z.jsx)(`span`,{className:`tag acc`,children:`Active loop`}),(0,z.jsx)(`span`,{className:`tag${U[e.status]?` ${U[e.status]}`:``}`,children:e.status})]}),(0,z.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,z.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.branch,` · `,e.root]}),W(e)?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`reader-lede`,children:[`Iteration `,e.iteration,r?` / ${r.max}`:``,` · at `,e.node]}),e.awaiting?(0,z.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,z.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind,e.awaiting.kind===`gate`?` at ${e.awaiting.node}`:``]}),` `,`— Answer in the agent's session.`]}):null,(0,z.jsxs)(`label`,{className:`panel-note loop-run-preset`,children:[`preset`,(0,z.jsx)(`select`,{className:`sel`,"aria-label":`Preset for ${e.title}`,value:e.preset,disabled:i,onChange:t=>{a(!0),Promise.resolve(n(e.root,t.target.value)).finally(()=>a(!1))},children:H.map(e=>(0,z.jsx)(`option`,{children:e},e))})]}),(0,z.jsx)(`a`,{href:`#/docs/loop-risk`,children:`What presets mean →`}),(0,z.jsx)(`hr`,{className:`hr`}),(0,z.jsx)(`div`,{className:`loop-graph`,children:(0,z.jsx)(V,{graph:e.graph,bricks:t,highlight:e.node})}),(0,z.jsx)(`h3`,{className:`loop-h2`,children:`Iterations`}),(0,z.jsx)(re,{history:e.history})]}):(0,z.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its LOOP.md cannot be read, so there is no state to show.`:`Its LOOP.md is gone: the loop closed and its state went with it.`})]})}var K=encodeURIComponent,q=a.loops.map(e=>[e,c[e]]),J={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},ae={project:`Project`,global:`Global`,shipped:`Shipped`},oe={templates:`Categories`,bricks:`Origins`,active:`Statuses`},se=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function Y(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var X=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function Z(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return X(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>J[e.graph.category]?e.graph.category:`other`,[...Object.entries(J),[`other`,`Other`]])}function Q(e,t){return X(e.map(e=>({...e,desc:e.description,override:Y(t,e.name)})),e=>e.origin,Object.entries(ae))}function ce(e){return X(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,se)}var $=(e,t)=>(0,z.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),le={templates:e=>e.human?$(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?$(`warn`,`mutate`):null,F(e)?$(`human`,`human gate`):null,e.override?$(`acc`,e.override):null,e.available===!1?$(`bad`,`unavailable`):null],active:e=>$(U[e.status],e.status)};function ue({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,z.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,z.jsx)(`b`,{children:(0,z.jsx)(`a`,{href:`#/loops/bricks/${K(e)}`,children:e})}),$(t.effect===`mutate`?`warn`:``,t.effect),(0,z.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,z.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),F(t)?$(`human`,F(t).toLowerCase()):null,n?$(`acc`,n):null]}):(0,z.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,z.jsx)(`b`,{children:e}),(0,z.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function de(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 fe({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,y.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=de(e.graph),c=I(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>W(t)&&t.graph.name===e.name).length;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`reader-tags`,children:[(0,z.jsx)(`span`,{className:`tag acc`,children:`Template`}),J[e.graph.category]?$(``,J[e.graph.category]):null,e.human?$(`human`,`human gate`):null]}),(0,z.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,z.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,z.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,z.jsx)(`hr`,{className:`hr`}),(0,z.jsxs)(`figure`,{className:`loop-console`,children:[(0,z.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:l?void 0:{"--loop-w":`${c.width}px`},children:(0,z.jsx)(V,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:`smooth`,block:`nearest`})}})}),(0,z.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,z.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,z.jsx)(`ol`,{children:s.map(([e,t])=>(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,z.jsxs)(`span`,{className:`loop-legend`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,z.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,z.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,z.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,z.jsx)(g,{text:u,label:`Copy command`})]}),(0,z.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,z.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,z.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,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,z.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,z.jsx)(`li`,{children:e},e))})]}):null,(0,z.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,z.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,z.jsx)(ue,{name:e,brick:o.get(e),override:Y(n,e),on:i===e},e))})]})}function pe(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
|
|
2
|
+
`)}\n---\n${e.body}`}function me({b:e}){let[t,n]=(0,y.useState)(!1),r=[[`effect`,$(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,z.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>$(``,e))],[`gate`,F(e)?$(`human`,F(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,z.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`reader-tags`,children:[(0,z.jsx)(`span`,{className:`tag acc`,children:`Brick`}),le.bricks(e)]}),(0,z.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,z.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,z.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,z.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,z.jsxs)(y.Fragment,{children:[(0,z.jsx)(`dt`,{children:e}),(0,z.jsx)(`dd`,{children:t})]},e))}),(0,z.jsx)(`hr`,{className:`hr`}),(0,z.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,z.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,z.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:pe(e)}):(0,z.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,z.jsx)(_,{body:e.body})})]})}function he({problems:e}){if(!e?.length)return null;let t=e.length;return(0,z.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,z.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,z.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,z.jsx)(`li`,{className:`mono`,children:e},e))})]})}var ge={templates:{title:`No templates`,body:(0,z.jsxs)(z.Fragment,{children:[`Add one under `,(0,z.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,z.jsxs)(z.Fragment,{children:[`Add one under `,(0,z.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,z.jsxs)(z.Fragment,{children:[`Start one with `,(0,z.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.`]})}},_e={templates:(0,z.jsxs)(z.Fragment,{children:[`A template wires bricks into a loop. `,(0,z.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,z.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,z.jsxs)(z.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,z.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,z.jsxs)(z.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,z.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function ve({tab:e=`templates`,item:t,dataRev:n}){let{data:a,error:c}=o(()=>r.loops(),[n],`loops`),u=te(),[g,_]=(0,y.useState)(``),[v,b]=(0,y.useState)(`all`),[x,S]=(0,y.useState)(e);e!==x&&(S(e),_(``),b(`all`));let C=a?.bricks||[],w=e===`active`?u.loops&&ce(u.loops):a&&(e===`bricks`?Q(a.bricks,a.overridden):Z(a.templates,a.bricks)),T=w||[],E=f(T),D=v===`all`?T:T.filter(e=>e.group===v),O=g.trim(),k=p(D,O),A=!!(t&&w&&!T.some(e=>e.name===t)),j=A?null:T.find(e=>e.name===t)||e===`active`&&T.find(W)||T[0]||null,M={templates:a?.templates.length,bricks:a?.bricks.length,active:u.loops?.length},N=q.find(([t])=>t===e)[1],P=e===`active`?u.error:c;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(s,{error:P,style:{margin:`0 0 var(--sp-3)`}}),(0,z.jsx)(he,{problems:a?.problems}),(0,z.jsxs)(`div`,{className:`library`,children:[(0,z.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,z.jsxs)(`div`,{className:`lib-title`,children:[(0,z.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,z.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,z.jsx)(`p`,{className:`panel-note lib-lede`,children:_e[e]}),(0,z.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:q.map(([t,n])=>(0,z.jsxs)(y.Fragment,{children:[(0,z.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,z.jsx)(`span`,{className:`mono dim`,children:M[t]??``})]}),e===t&&(0,z.jsx)(h,{label:oe[t],total:T.length,cats:E,cat:v,onChange:b})]},t))})]}),(0,z.jsx)(d,{label:N,count:O?`${k.length} of ${D.length}`:w?D.length:``,q:g,onQ:_,matched:k.length,inView:[e,t],children:w?T.length===0?(0,z.jsx)(l,{title:ge[e].title,children:ge[e].body}):(0,z.jsx)(m,{rows:k,activeName:j?.name,hrefOf:t=>`#/loops/${e}/${K(t.name)}`,pills:le[e]}):P?null:(0,z.jsx)(i,{})}),(0,z.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:A?(0,z.jsx)(l,{title:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${N.toLowerCase()} →`}}):j?e===`active`?(0,z.jsx)(ie,{loop:j,bricks:C,onPreset:u.onPreset}):e===`bricks`?(0,z.jsx)(me,{b:j}):(0,z.jsx)(fe,{t:j,bricks:C,overridden:a.overridden,runs:u.loops},j.name):e===`active`&&w?(0,z.jsx)(l,{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{ce as activeRows,Q as brickRows,pe as brickSource,ve as default,de as howItRuns,Z as templateRows};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{n,r}from"./sections-ChwaobfW.js";import{P as i,st as a}from"./index-BUdl0KdD.js";import{n as o,r as s}from"./Dashboard-DmKR3TQg.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=r.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...r.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=i(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=a(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS READOUT`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:r.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:n[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:n[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BfpZmUMI.js";import{J as i,L as a,U as o,V as s,X as c,Z as l,bt as u,ft as d,q as f,yt as p}from"./index-DMDF5Y3Y.js";import{t as m}from"./EmptyState-1sPNleqv.js";import{t as h}from"./Markdown-DpmmtW2Y.js";import{t as g}from"./Tabs-DQLuylEi.js";import _ from"./Library-CWjWbVwS.js";var v=e(t(),1),y=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),b=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function x({data:e,reload:t}){let n=l(),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),[d,f]=(0,v.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(a),g=(0,v.useRef)(!1),_=e=>{i(e),o(e)},x=()=>i(null);return(0,v.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=u(({to:e})=>(g.current||(g.current=!0,y(n).then(n=>{n&&(t(),i(null),p(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:x,discard:async()=>h&&!await y(n)?!1:(x(),!0),dirty:h,busy:s,notice:d,setNotice:f,save:async(e,{conflict:n}={})=>{c(!0),f(``);try{return await e(m)||!0}catch(e){e.status===409?f(n??b):f(e.message);return}finally{c(!1),t()}}}}var S=n(),C={title:``,body:``,scope:`project`,trial_until:``},w=[`project`,`global`],T=e=>e===`user`?`global`:e,E=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,D=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),O=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,k=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function A({value:e,onChange:t,onCancel:n,onSave:r,busy:i}){let[a]=(0,v.useState)(e.scope),o=n=>r=>t({...e,[n]:r.target.value}),s=e.body.trim().split(E).some(D)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,c=!(e.title.trim()&&e.body.trim()),l=!c&&!s;return(0,S.jsxs)(`div`,{className:`rule-form`,children:[(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule title`}),(0,S.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:o(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule body`}),(0,S.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:o(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":s?!0:void 0,"aria-describedby":s?`rule-body-error`:void 0})]}),s?(0,S.jsx)(`p`,{id:`rule-body-error`,className:`sub rule-notice`,role:`alert`,children:s}):null,(0,S.jsxs)(`div`,{className:`row wrap`,children:[(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule scope`}),(0,S.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:o(`scope`),children:[(0,S.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,S.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),w.includes(a)?null:(0,S.jsxs)(`option`,{value:a,children:[`scope: `,a,` (as written in the file)`]})]})]}),(0,S.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,S.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:o(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,S.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,S.jsx)(`button`,{className:`btn sm`,disabled:!l||i,onClick:()=>r(e),"aria-describedby":c?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),c?(0,S.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function j({rule:e,isOpen:t,onToggle:n,onEdit:r,onDelete:i,onGraduate:a}){return(0,S.jsxs)(`div`,{className:`rule-row ${t?`on`:``}`,children:[(0,S.jsxs)(`button`,{className:`rule-head`,onClick:n,"aria-expanded":t,"data-rule-head":e.id,children:[(0,S.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,S.jsx)(`span`,{className:`rule-title`,children:e.title}),(0,S.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,S.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`})]}),t&&(0,S.jsxs)(`div`,{className:`rule-expand`,children:[(0,S.jsx)(`p`,{children:e.body}),e.source?(0,S.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,S.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:a,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}`,children:`Graduate`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:r,"aria-label":`Edit R${e.id}`,children:`Edit`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:i,"aria-label":`Retire R${e.id}`,children:`Retire`})]})]})]})}function M({onChanged:e}){let t=l(),[n,a]=(0,v.useState)(0),{data:o,error:s}=d(()=>r.rules(),[n]),[c,u]=(0,v.useState)(null),p=()=>a(e=>e+1),h=x({data:o,reload:p}),{draft:g,busy:_,notice:y}=h,b=(0,v.useRef)(null),[w,E]=(0,v.useState)(0),D=e=>{b.current=e,E(e=>e+1)},M=(0,v.useRef)(null),N=(0,v.useRef)(null);if((0,v.useEffect)(()=>{let e=b.current;b.current=null,e!==null&&(e===`add`?M.current:N.current?.querySelector(`[data-rule-head="${e}"]`))?.focus()},[w]),s)return(0,S.jsx)(f,{error:s,onRetry:p});if(!o)return(0,S.jsx)(i,{});let P=o.rules||[],F=g?.target,I=F!==void 0&&F!==`new`&&!P.some(e=>e.id===F&&e.title===g.title0),L=F===`new`||I,R=async(t,n)=>{let i=await h.save(e=>r.rulesMutate({...t,fingerprint:e}),{conflict:n?O:k});return i&&n&&h.close(),e?.(),i},z=e=>h.setDraft({...g,form:e}),B=async(e,t)=>{await R(e,!0)&&D(t)},V=async e=>{await h.discard()&&D(e)},H=async e=>{await t(`Retire rule R${e.id} — “${e.title}”? It is removed from user-rules.md.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await R({op:`delete`,id:e.id})&&g===null&&D(`add`)},U=async e=>{await R({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``})&&D(e.id)};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`eyebrow`,children:`governance · yours`}),(0,S.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,S.jsxs)(`p`,{className:`sub`,children:[`Your own standing rules, from `,(0,S.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),` beside the deployed AGENT.md. The agent obeys them with the same force as the Laws — they may tighten a Law, never repeal one — and no update ever touches the file. Keep the set small: every rule is loaded every session.`]})]}),o.exists&&g===null&&(0,S.jsx)(`button`,{className:`btn`,ref:M,onClick:()=>h.open({target:`new`,title0:``,form:C}),children:`Add rule`})]}),y?(0,S.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:y}):null,(o.warnings||[]).map(e=>(0,S.jsxs)(`p`,{className:`sub rule-notice`,children:[`format warning: `,e]},e)),L&&(0,S.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,S.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),I?(0,S.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Rule R`,F,` 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,S.jsx)(A,{value:g.form,onChange:z,busy:_,onCancel:()=>V(`add`),onSave:e=>B({op:`add`,...e},`add`)})]}),o.exists?P.length===0&&!L?(0,S.jsx)(m,{title:`No rules yet`,children:`The file is seeded and loaded every session — it is just empty. Add your first standing rule here, ask the agent for one in-session (the rule skill), or promote a recurring memory fact from the Library.`}):(0,S.jsx)(`div`,{className:`card rules-list`,ref:N,children:P.map(e=>!I&&F===e.id?(0,S.jsx)(`div`,{className:`rule-row on`,children:(0,S.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,S.jsx)(A,{value:g.form,onChange:z,busy:_,onCancel:()=>V(e.id),onSave:t=>B({op:`update`,id:e.id,source:e.source,...t},e.id)})})},e.id):(0,S.jsx)(j,{rule:e,isOpen:c===e.id,onToggle:()=>u(c===e.id?null:e.id),onEdit:()=>{u(e.id),h.open({target:e.id,title0:e.title,form:{title:e.title,body:e.body,scope:T(e.scope),trial_until:e.trial_until}})},onDelete:()=>H(e),onGraduate:()=>U(e)},e.id))}):(0,S.jsxs)(m,{title:`No user-rules.md here yet`,children:[`The build seeds it beside AGENT.md — run a build/update from the Dashboard (or`,` `,(0,S.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`) and it appears, ready for your rules.`]})]})}var N=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`;function P({onChanged:e}){let{data:t,error:n,loading:a,reload:o,setData:s}=d(()=>r.profile(),[]),l=x({data:t,reload:o}),{draft:u,dirty:p,busy:g,notice:_}=l,[y,b]=(0,v.useState)(!1);if(t&&!y&&(b(!0),(t.text||``).trim()||l.open(t.text||``)),a&&!t)return(0,S.jsx)(i,{});if(n)return(0,S.jsx)(f,{error:n,onRetry:o});let C=u!==null,w=t?.text||``;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`eyebrow`,children:`identity · yours`}),(0,S.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,S.jsxs)(`p`,{className:`sub`,children:[`Who you are and how you like to work, from `,(0,S.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),` `,`beside the deployed AGENT.md. Unlike `,(0,S.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`, it is identity, not rules — it colours how the agent works but never binds (precedence is Laws, then rules, then this). Seeded once, never overwritten by an update. Prefer not to write it by hand? Ask the agent to run the `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]})]}),(0,S.jsxs)(`div`,{className:`row`,children:[(0,S.jsxs)(c,{"aria-label":`Profile mode`,children:[(0,S.jsx)(`button`,{className:C?``:`on`,"aria-pressed":!C,onClick:l.discard,children:`View`}),(0,S.jsx)(`button`,{className:C?`on`:``,"aria-pressed":C,onClick:()=>C||l.open(w),children:`Edit`})]}),C&&(0,S.jsx)(`button`,{className:`btn`,disabled:!p||g,onClick:async()=>{let t=await l.save(e=>r.profileSave({text:u,fingerprint:e}),{conflict:N});t&&(s(e=>({...e,text:u,seeded:!1,fingerprint:t.fingerprint||``})),l.setNotice(`Saved.`),l.close(),e?.())},children:g?`Saving…`:`Save`})]})]}),_?(0,S.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:_}):null,C?(0,S.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:u,onChange:e=>l.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):w.trim()?(0,S.jsxs)(S.Fragment,{children:[t?.seeded?(0,S.jsxs)(m,{title:`This is still the template`,action:(0,S.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>l.open(w),children:`Edit it here`}),children:[`Ask the agent to run the `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,S.jsx)(`div`,{className:`card pad-lg`,children:(0,S.jsx)(h,{body:w})})]}):(0,S.jsxs)(m,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var F=(e,t)=>`${e} ${t}${e===1?``:`s`}`,I=new Set([`MEMORY`,`NOTEBOOK`,`README`]),L=e=>e?(e.items||[]).filter(e=>!I.has(String(e.name).toUpperCase())).length:null;function R({rules:e,profile:t,facts:n,notes:r}){let i=e?.exists?e.stats:null;if(!i)return null;let o=Math.round(Math.max(i.rules/i.max_rules,i.tokens/i.max_tokens)*100),[s,c]=o>=100?[`bad`,`over budget: a bloated rule set dilutes the rules that matter`]:o>=70?[`warn`,`getting heavy; consider merging or pruning`]:[`accent`,i.rules?`${i.rules} rules in ${i.lines} lines.`:`All of it is the file’s preamble; no rule text yet.`],l=[{k:`Profile`,v:t?.seeded?`template`:t?.exists?`written`:`missing`,warn:!!t?.seeded},{k:`Rules`,v:`${i.rules}/${i.max_rules}`},{k:`Memory`,v:n==null?`n/a`:F(n,`fact`)},{k:`Notebook`,v:r==null?`n/a`:F(r,`note`)}];return(0,S.jsxs)(`div`,{className:`card-row`,children:[(0,S.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-budget`,children:[(0,S.jsxs)(`div`,{className:`panel-head`,children:[(0,S.jsx)(`h2`,{id:`pc-budget`,children:`Rule budget`}),(0,S.jsxs)(`span`,{className:`mono dim`,children:[i.rules,` of `,i.max_rules]})]}),(0,S.jsx)(`div`,{className:`slots`,style:{"--slots":i.max_rules},role:`img`,"aria-label":`${i.rules} of ${i.max_rules} rule slots used`,children:Array.from({length:i.max_rules},(e,t)=>(0,S.jsx)(`span`,{className:t<i.rules?`used`:``},t))}),(0,S.jsxs)(`p`,{className:`big-num`,children:[(0,S.jsx)(`span`,{className:`mono`,children:i.tokens}),` `,(0,S.jsxs)(`span`,{className:`dim`,children:[`/ `,i.max_tokens.toLocaleString(`en-US`),` tokens, every turn`]})]}),(0,S.jsx)(a,{value:i.tokens,max:i.max_tokens,label:`tokens`,tone:s}),(0,S.jsx)(`p`,{className:`panel-note`,children:c})]}),(0,S.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-known`,children:[(0,S.jsx)(`div`,{className:`panel-head`,children:(0,S.jsx)(`h2`,{id:`pc-known`,children:`What the agent knows about you`})}),(0,S.jsx)(`ul`,{className:`hbars`,children:l.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(`span`,{className:`hb-label`,children:e.k}),(0,S.jsx)(`span`,{className:`mono hb-n${e.warn?` warn`:``}`,children:e.v})]},e.k))})]})]})}var z=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,B=e=>String(e||``).split(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-BfpZmUMI.js";import{J as i,L as a,U as o,V as s,X as c,Z as l,bt as u,ft as d,q as f,yt as p}from"./index-BUdl0KdD.js";import{t as m}from"./EmptyState-1sPNleqv.js";import{t as h}from"./Markdown-DpmmtW2Y.js";import{t as g}from"./Tabs-D1tN4jA9.js";import _ from"./Library-dMx4l6kg.js";var v=e(t(),1),y=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),b=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function x({data:e,reload:t}){let n=l(),[r,i]=(0,v.useState)(null),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),[d,f]=(0,v.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(a),g=(0,v.useRef)(!1),_=e=>{i(e),o(e)},x=()=>i(null);return(0,v.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=u(({to:e})=>(g.current||(g.current=!0,y(n).then(n=>{n&&(t(),i(null),p(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:x,discard:async()=>h&&!await y(n)?!1:(x(),!0),dirty:h,busy:s,notice:d,setNotice:f,save:async(e,{conflict:n}={})=>{c(!0),f(``);try{return await e(m)||!0}catch(e){e.status===409?f(n??b):f(e.message);return}finally{c(!1),t()}}}}var S=n(),C={title:``,body:``,scope:`project`,trial_until:``},w=[`project`,`global`],T=e=>e===`user`?`global`:e,E=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,D=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),O=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,k=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function A({value:e,onChange:t,onCancel:n,onSave:r,busy:i}){let[a]=(0,v.useState)(e.scope),o=n=>r=>t({...e,[n]:r.target.value}),s=e.body.trim().split(E).some(D)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,c=!(e.title.trim()&&e.body.trim()),l=!c&&!s;return(0,S.jsxs)(`div`,{className:`rule-form`,children:[(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule title`}),(0,S.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:o(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule body`}),(0,S.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:o(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":s?!0:void 0,"aria-describedby":s?`rule-body-error`:void 0})]}),s?(0,S.jsx)(`p`,{id:`rule-body-error`,className:`sub rule-notice`,role:`alert`,children:s}):null,(0,S.jsxs)(`div`,{className:`row wrap`,children:[(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule scope`}),(0,S.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:o(`scope`),children:[(0,S.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,S.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),w.includes(a)?null:(0,S.jsxs)(`option`,{value:a,children:[`scope: `,a,` (as written in the file)`]})]})]}),(0,S.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,S.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:o(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,S.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,S.jsx)(`button`,{className:`btn sm`,disabled:!l||i,onClick:()=>r(e),"aria-describedby":c?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),c?(0,S.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function j({rule:e,isOpen:t,onToggle:n,onEdit:r,onDelete:i,onGraduate:a}){return(0,S.jsxs)(`div`,{className:`rule-row ${t?`on`:``}`,children:[(0,S.jsxs)(`button`,{className:`rule-head`,onClick:n,"aria-expanded":t,"data-rule-head":e.id,children:[(0,S.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,S.jsx)(`span`,{className:`rule-title`,children:e.title}),(0,S.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,S.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`})]}),t&&(0,S.jsxs)(`div`,{className:`rule-expand`,children:[(0,S.jsx)(`p`,{children:e.body}),e.source?(0,S.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,S.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:a,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}`,children:`Graduate`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:r,"aria-label":`Edit R${e.id}`,children:`Edit`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:i,"aria-label":`Retire R${e.id}`,children:`Retire`})]})]})]})}function M({onChanged:e}){let t=l(),[n,a]=(0,v.useState)(0),{data:o,error:s}=d(()=>r.rules(),[n]),[c,u]=(0,v.useState)(null),p=()=>a(e=>e+1),h=x({data:o,reload:p}),{draft:g,busy:_,notice:y}=h,b=(0,v.useRef)(null),[w,E]=(0,v.useState)(0),D=e=>{b.current=e,E(e=>e+1)},M=(0,v.useRef)(null),N=(0,v.useRef)(null);if((0,v.useEffect)(()=>{let e=b.current;b.current=null,e!==null&&(e===`add`?M.current:N.current?.querySelector(`[data-rule-head="${e}"]`))?.focus()},[w]),s)return(0,S.jsx)(f,{error:s,onRetry:p});if(!o)return(0,S.jsx)(i,{});let P=o.rules||[],F=g?.target,I=F!==void 0&&F!==`new`&&!P.some(e=>e.id===F&&e.title===g.title0),L=F===`new`||I,R=async(t,n)=>{let i=await h.save(e=>r.rulesMutate({...t,fingerprint:e}),{conflict:n?O:k});return i&&n&&h.close(),e?.(),i},z=e=>h.setDraft({...g,form:e}),B=async(e,t)=>{await R(e,!0)&&D(t)},V=async e=>{await h.discard()&&D(e)},H=async e=>{await t(`Retire rule R${e.id} — “${e.title}”? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await R({op:`delete`,id:e.id})&&g===null&&D(`add`)},U=async e=>{await R({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``})&&D(e.id)};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`eyebrow`,children:`governance · yours`}),(0,S.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,S.jsxs)(`p`,{className:`sub`,children:[`Your own standing rules, from `,(0,S.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),` beside the deployed AGENT.md. The agent obeys them with the same force as the Laws — they may tighten a Law, never repeal one — and no update ever touches the file. Keep the set small: every rule is loaded every session.`]})]}),o.exists&&g===null&&(0,S.jsx)(`button`,{className:`btn`,ref:M,onClick:()=>h.open({target:`new`,title0:``,form:C}),children:`Add rule`})]}),y?(0,S.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:y}):null,(o.warnings||[]).map(e=>(0,S.jsxs)(`p`,{className:`sub rule-notice`,children:[`format warning: `,e]},e)),L&&(0,S.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,S.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),I?(0,S.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Rule R`,F,` 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,S.jsx)(A,{value:g.form,onChange:z,busy:_,onCancel:()=>V(`add`),onSave:e=>B({op:`add`,...e},`add`)})]}),o.exists?P.length===0&&!L?(0,S.jsx)(m,{title:`No rules yet`,children:`The file is seeded and loaded every session — it is just empty. Add your first standing rule here, ask the agent for one in-session (the rule skill), or promote a recurring memory fact from the Library.`}):(0,S.jsx)(`div`,{className:`card rules-list`,ref:N,children:P.map(e=>!I&&F===e.id?(0,S.jsx)(`div`,{className:`rule-row on`,children:(0,S.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,S.jsx)(A,{value:g.form,onChange:z,busy:_,onCancel:()=>V(e.id),onSave:t=>B({op:`update`,id:e.id,source:e.source,...t},e.id)})})},e.id):(0,S.jsx)(j,{rule:e,isOpen:c===e.id,onToggle:()=>u(c===e.id?null:e.id),onEdit:()=>{u(e.id),h.open({target:e.id,title0:e.title,form:{title:e.title,body:e.body,scope:T(e.scope),trial_until:e.trial_until}})},onDelete:()=>H(e),onGraduate:()=>U(e)},e.id))}):(0,S.jsxs)(m,{title:`No user-rules.md here yet`,children:[`The build seeds it beside AGENT.md — run a build/update from the Dashboard (or`,` `,(0,S.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`) and it appears, ready for your rules.`]})]})}var N=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`;function P({onChanged:e}){let{data:t,error:n,loading:a,reload:o,setData:s}=d(()=>r.profile(),[]),l=x({data:t,reload:o}),{draft:u,dirty:p,busy:g,notice:_}=l,[y,b]=(0,v.useState)(!1);if(t&&!y&&(b(!0),(t.text||``).trim()||l.open(t.text||``)),a&&!t)return(0,S.jsx)(i,{});if(n)return(0,S.jsx)(f,{error:n,onRetry:o});let C=u!==null,w=t?.text||``;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`eyebrow`,children:`identity · yours`}),(0,S.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,S.jsxs)(`p`,{className:`sub`,children:[`Who you are and how you like to work, from `,(0,S.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),` `,`beside the deployed AGENT.md. Unlike `,(0,S.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`, it is identity, not rules — it colours how the agent works but never binds (precedence is Laws, then rules, then this). Seeded once, never overwritten by an update. Prefer not to write it by hand? Ask the agent to run the `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]})]}),(0,S.jsxs)(`div`,{className:`row`,children:[(0,S.jsxs)(c,{"aria-label":`Profile mode`,children:[(0,S.jsx)(`button`,{className:C?``:`on`,"aria-pressed":!C,onClick:l.discard,children:`View`}),(0,S.jsx)(`button`,{className:C?`on`:``,"aria-pressed":C,onClick:()=>C||l.open(w),children:`Edit`})]}),C&&(0,S.jsx)(`button`,{className:`btn`,disabled:!p||g,onClick:async()=>{let t=await l.save(e=>r.profileSave({text:u,fingerprint:e}),{conflict:N});t&&(s(e=>({...e,text:u,seeded:!1,fingerprint:t.fingerprint||``})),l.setNotice(`Saved.`),l.close(),e?.())},children:g?`Saving…`:`Save`})]})]}),_?(0,S.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:_}):null,C?(0,S.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:u,onChange:e=>l.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):w.trim()?(0,S.jsxs)(S.Fragment,{children:[t?.seeded?(0,S.jsxs)(m,{title:`This is still the template`,action:(0,S.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>l.open(w),children:`Edit it here`}),children:[`Ask the agent to run the `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,S.jsx)(`div`,{className:`card pad-lg`,children:(0,S.jsx)(h,{body:w})})]}):(0,S.jsxs)(m,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var F=(e,t)=>`${e} ${t}${e===1?``:`s`}`,I=new Set([`MEMORY`,`NOTEBOOK`,`README`]),L=e=>e?(e.items||[]).filter(e=>!I.has(String(e.name).toUpperCase())).length:null;function R({rules:e,profile:t,facts:n,notes:r}){let i=e?.exists?e.stats:null;if(!i)return null;let o=Math.round(Math.max(i.rules/i.max_rules,i.tokens/i.max_tokens)*100),[s,c]=o>=100?[`bad`,`over budget: a bloated rule set dilutes the rules that matter`]:o>=70?[`warn`,`getting heavy; consider merging or pruning`]:[`accent`,i.rules?`${i.rules} rules in ${i.lines} lines.`:`All of it is the file’s preamble; no rule text yet.`],l=[{k:`Profile`,v:t?.seeded?`template`:t?.exists?`written`:`missing`,warn:!!t?.seeded},{k:`Rules`,v:`${i.rules}/${i.max_rules}`},{k:`Memory`,v:n==null?`n/a`:F(n,`fact`)},{k:`Notebook`,v:r==null?`n/a`:F(r,`note`)}];return(0,S.jsxs)(`div`,{className:`card-row`,children:[(0,S.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-budget`,children:[(0,S.jsxs)(`div`,{className:`panel-head`,children:[(0,S.jsx)(`h2`,{id:`pc-budget`,children:`Rule budget`}),(0,S.jsxs)(`span`,{className:`mono dim`,children:[i.rules,` of `,i.max_rules]})]}),(0,S.jsx)(`div`,{className:`slots`,style:{"--slots":i.max_rules},role:`img`,"aria-label":`${i.rules} of ${i.max_rules} rule slots used`,children:Array.from({length:i.max_rules},(e,t)=>(0,S.jsx)(`span`,{className:t<i.rules?`used`:``},t))}),(0,S.jsxs)(`p`,{className:`big-num`,children:[(0,S.jsx)(`span`,{className:`mono`,children:i.tokens}),` `,(0,S.jsxs)(`span`,{className:`dim`,children:[`/ `,i.max_tokens.toLocaleString(`en-US`),` tokens, every turn`]})]}),(0,S.jsx)(a,{value:i.tokens,max:i.max_tokens,label:`tokens`,tone:s}),(0,S.jsx)(`p`,{className:`panel-note`,children:c})]}),(0,S.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-known`,children:[(0,S.jsx)(`div`,{className:`panel-head`,children:(0,S.jsx)(`h2`,{id:`pc-known`,children:`What the agent knows about you`})}),(0,S.jsx)(`ul`,{className:`hbars`,children:l.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(`span`,{className:`hb-label`,children:e.k}),(0,S.jsx)(`span`,{className:`mono hb-n${e.warn?` warn`:``}`,children:e.v})]},e.k))})]})]})}var z=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,B=e=>String(e||``).split(`
|
|
2
2
|
`).map(e=>z.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function V({topics:e}){return e.length?(0,S.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,S.jsxs)(`div`,{className:`panel-head`,children:[(0,S.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),(0,S.jsx)(`span`,{className:`mono dim`,children:F(e.length,`topic`)})]}),(0,S.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,S.jsx)(`span`,{className:`mono hb-n`,children:F(e.n,`fact`)})]},e.topic))})]}):null}var H={memory:{title:`No facts yet`,body:(0,S.jsxs)(`div`,{className:`pm-first`,children:[(0,S.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,S.jsxs)(`ul`,{children:[(0,S.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,S.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,S.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,S.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 U({tab:e=`rules`,item:t,dataRev:n}){let i=e=>Promise.resolve(e).catch(()=>null),{data:a,reload:c}=s(n),{data:l,reload:u}=d(()=>i(r.profile()),[n]),{data:f,reload:p}=d(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:h}=d(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),v=L(f),{data:y}=d(()=>e===`memory`?i(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,v]),b=L(h),x={memory:v,notebook:b},C={rules:a?.stats?.rules,profile:l?.seeded?`template`:null,memory:v,notebook:b},w=e===`memory`||e===`notebook`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(o,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`}),(0,S.jsx)(g,{page:`personal`,current:e,badges:C,label:`Personal files`}),e===`rules`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(R,{rules:a,profile:l,facts:v,notes:b}),(0,S.jsx)(M,{onChanged:c})]}),e===`profile`&&(0,S.jsx)(P,{onChanged:u}),w&&x[e]===0&&!t?(0,S.jsx)(m,{title:H[e].title,action:H[e].action,children:H[e].body}):w?(0,S.jsxs)(S.Fragment,{children:[e===`memory`&&(0,S.jsx)(V,{topics:B(y?.body)}),(0,S.jsx)(_,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onRulesChanged:()=>{c(),p()}},e)]}):null]})}export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./FilterInput-CZREvrjX.js";var i=e(t(),1),a=n(),o={experimental:{label:`experimental`,cls:`warn`,hint:`Shipped, but not yet confirmed by real use.`},deprecated:{label:`deprecated`,cls:`bad`,hint:`On its way out — look for the replacement before building on it.`},personal:{label:`personal`,cls:``,hint:`Yours — present in this install, not shipped or versioned by Geneseed.`},unknown:{label:`no status`,cls:``,hint:`Not listed in registry.json.`}};function s({status:e,withHint:t=!1}){let n=o[e];if(!n)return null;let r=(0,a.jsxs)(`span`,{className:`badge ${n.cls}`,title:t?void 0:n.hint,children:[(0,a.jsx)(`span`,{className:`dot`}),n.label]});return t?(0,a.jsxs)(a.Fragment,{children:[r,(0,a.jsx)(`span`,{className:`dim`,children:n.hint})]}):r}var c=({name:e})=>(0,a.jsxs)(`span`,{className:`tag acc`,title:`Ships with the ${e} kit`,children:[`kit: `,e]});function l(e,t){let n=(t||``).trim().toLowerCase();return n?e.filter(e=>`${e.title||``} ${e.name||``} ${e.desc||``}`.toLowerCase().includes(n)):e}function u({label:e,count:t,extra:n,tools:o,q:s,onQ:c,matched:l,inView:u,children:d}){let f=h(u);(0,i.useLayoutEffect)(()=>m(f.current));let[g,_]=(0,i.useState)(``),v=(0,i.useRef)(!0);return(0,i.useEffect)(()=>{if(v.current){v.current=!1;return}_(f.current?.querySelector(`.lib-row.on`)?.dataset.title||``)},u),(0,a.jsxs)(`section`,{className:`lib-list`,"aria-label":e,onKeyDown:e=>{e.key===`ArrowDown`&&e.target.classList?.contains(`lib-filter`)&&(e.preventDefault(),f.current?.querySelector(`.lib-row`)?.focus())},children:[(0,a.jsxs)(`div`,{className:`lib-list-head`,children:[(0,a.jsxs)(`b`,{children:[e,` `,(0,a.jsx)(`span`,{className:`mono dim`,children:t})]}),n]}),(0,a.jsx)(r,{value:s,onChange:c,placeholder:`Filter ${e.toLowerCase()}`,label:`Filter ${e}`}),o?(0,a.jsx)(`div`,{className:`lib-tools`,children:o}):null,(0,a.jsxs)(`div`,{className:`lib-rows`,ref:f,onKeyDown:p,onFocus:e=>m(e.currentTarget),children:[d,s.trim()&&l===0&&(0,a.jsxs)(`div`,{className:`empty`,style:{padding:32},children:[(0,a.jsx)(`div`,{className:`big`,children:`No matches`}),`Nothing in `,e.toLowerCase(),` matches “`,s.trim(),`”.`]})]}),(0,a.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:g?`${g} opened`:``})]})}function d({item:e,isOpen:t,href:n,children:r}){return(0,a.jsxs)(`a`,{className:`lib-row${t?` on`:``}`,href:n,"aria-current":t?`true`:void 0,"data-title":e.title||e.name,children:[(0,a.jsxs)(`span`,{className:`lr-name`,children:[e.title||e.name,(0,a.jsx)(s,{status:e.status}),e.kit?(0,a.jsx)(c,{name:e.kit}):null,r]}),e.desc?(0,a.jsx)(`span`,{className:`lr-desc`,children:e.desc}):null,e.meta?(0,a.jsx)(`span`,{className:`lr-meta mono`,children:e.meta}):null]})}function f({rows:e,activeName:t,hrefOf:n,pills:r}){let i=null,o=[];for(let s of e)s.group&&s.group!==i&&(i=s.group,o.push((0,a.jsxs)(`div`,{className:`lib-group`,children:[s.groupC?(0,a.jsx)(`span`,{className:`cdot`,style:{"--cc":s.groupC},"aria-hidden":`true`}):null,s.group]},`g-${s.group}`))),o.push((0,a.jsx)(d,{item:s,isOpen:t===s.name,href:n(s),children:r?.(s)},s.name));return o}function p(e){let t=[...e.currentTarget.querySelectorAll(`.lib-row`)],n=t.indexOf(document.activeElement);if(n===-1)return;let r={ArrowDown:Math.min(n+1,t.length-1),ArrowUp:Math.max(n-1,0),Home:0,End:t.length-1}[e.key];r!==void 0&&(e.preventDefault(),t[r].focus())}function m(e){if(!e)return;let t=[...e.querySelectorAll(`.lib-row`)],n=t.find(e=>e===document.activeElement)||e.querySelector(`.lib-row.on`)||t[0];for(let e of t)e.tabIndex=e===n?0:-1}function h(e){let t=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=t.current,n=e?.querySelector(`.lib-row.on`);if(!n||!e)return;let r=n.offsetTop;r>=e.scrollTop&&r+n.clientHeight<=e.scrollTop+e.clientHeight||(e.scrollTop=Math.max(0,r-e.clientHeight/2+n.clientHeight/2))},e),t}function g({label:e,total:t,cats:n,cat:r,onChange:i}){if(n.length<=1)return null;let o=[{key:`all`,label:`All`,n:t,c:`var(--text-3)`},...n];return(0,a.jsxs)(`div`,{className:`rail-cats`,children:[(0,a.jsx)(`ul`,{"aria-label":e,children:o.map(({key:e,label:t,n,c:o})=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,className:r===e?`on`:``,"aria-pressed":r===e,style:{"--cc":o},onClick:()=>i(e),children:[(0,a.jsx)(`span`,{className:`cdot`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`rc-name`,children:t}),(0,a.jsx)(`span`,{className:`mono dim`,children:n})]})},e))}),(0,a.jsx)(`div`,{className:`rail-mix`,"aria-hidden":`true`,children:n.map(({key:e,n:t,c:n})=>(0,a.jsx)(`span`,{className:r===`all`||r===e?``:`dim`,style:{"--cc":n,flexGrow:t}},e))})]})}function _(e){let t=[],n=new Map;for(let r of e)n.has(r.group)||t.push(r.group),n.set(r.group,(n.get(r.group)||0)+1);return t.map(e=>({key:e,label:e,n:n.get(e),c:`var(--accent)`}))}export{u as a,c as i,_ as n,l as o,f as r,s,g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{_t as n,vt as r}from"./index-
|
|
1
|
+
import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{_t as n,vt as r}from"./index-BUdl0KdD.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:n[e].map(n=>(0,i.jsxs)(`a`,{href:`#/${e}/${n}`,className:t===n?`on`:``,"aria-current":t===n?`page`:void 0,children:[r[n],a[n]==null?null:(0,i.jsx)(`span`,{className:`tab-badge`,children:a[n]})]},n))})}export{a as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DmKR3TQg.js","assets/rolldown-runtime-hePW80VL.js","assets/react-DlYQp10C.js","assets/api-BfpZmUMI.js","assets/motion-CXaUMNkg.js","assets/sections-ChwaobfW.js","assets/Activity-BcwX4Zj2.js","assets/EmptyState-1sPNleqv.js","assets/usePoll-bDFN-Hr6.js","assets/ActivityDetail-CDD7EM_5.js","assets/Library-dMx4l6kg.js","assets/RailCats-BuJD4Jou.js","assets/FilterInput-CZREvrjX.js","assets/Markdown-DpmmtW2Y.js","assets/Kits-Dl-wrVqw.js","assets/KitApply-DvryZjTL.js","assets/DataTable-BWbUx4bY.js","assets/Loops-BfoE72d9.js","assets/CopyButton-BHxw2k1Z.js","assets/Laws-BD3DVthD.js","assets/Personal-Be0vEjUH.js","assets/Tabs-D1tN4jA9.js","assets/Installs-DlxyaW98.js","assets/Docs-CuwD_7Yq.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n,r,t as i}from"./react-DlYQp10C.js";import{t as a}from"./api-BfpZmUMI.js";import{A as o,C as s,D as c,E as l,F as u,G as d,H as f,I as p,L as m,O as h,P as g,T as _,U as v,_ as y,b,d as x,f as S,i as C,j as w,l as T,n as E,o as D,r as O,s as k,t as A,u as j,v as M,z as N}from"./motion-CXaUMNkg.js";import{i as P,n as F,r as I}from"./sections-ChwaobfW.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ee=(e,t)=>{if(m(t,`<`)){let n=t[1]===`<`,r=e._tail,i=r?r._offset+r._delay:0;return n?i:i+r.duration}},te=(e,t)=>{let n=e.iterationDuration;if(n===1e-11&&(n=0),w(t))return n;if(h(+t))return+t;let r=t,i=e?e.labels:null,a=!c(i),o=ee(e,r),s=!w(o),l=v.exec(r);if(l){let e=l[0],t=r.split(e),c=a&&t[0]?i[t[0]]:n,u=s?o:a?c:n,d=+t[1];return M(u,d,e[0])}return s?o:a?w(i[r])?n:i[r]:n},L=(e=0,t=1,n=0)=>{let r=10**n;return Math.floor((Math.random()*(t-e+1/r)+e)*r)/r},ne=0,re=(e,t=0,n=1,r=0)=>{let i=e===void 0?ne++:e;return(e=t,a=n,o=r)=>{i+=1831565813,i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61);let s=10**o;return Math.floor((((i^i>>>14)>>>0)/4294967296*(a-e+1/s)+e)*s)/s}},ie=(e,t=L)=>{let n=e.length,r,i;for(;n;)i=t(0,--n),r=e[n],e[n]=e[i],e[i]=r;return e},ae=(e,t={})=>{let n=[],r=0,i,a=null,c=t.from,f=t.reversed,m=t.ease,v=!w(m),x=v&&!w(m.ease)?m.ease:v?j(m):null,C=t.grid,T=C===!0,E=t.axis,D=t.total,O=w(c)||c===0||c===`first`,k=c===`center`,A=c===`last`,M=c===`random`,N=_(c),P=_(e),F=t.use,I=g(P?e[0]:e),ee=P?g(e[1]):0,ne=d.exec((P?e[1]:e)+``),ae=t.start||0+(P?I:0),R=t.seed,oe=!w(R)&&R!==!1?re(R===!0?0:R):L,z=t.jitter,se=!w(z),ce=_(z),B=ce?z[0]:z||0,V=ce?z[1]:z||0,H=O?0:h(c)?c:0;return(e,d,m,g,_)=>{let[v]=S(e),O=w(D)?m.length:D,j=w(F)?!1:l(F)?F(v,d,O):y(v,F),L=h(j)||o(j)&&h(+j)?+j:d,re=L>=0&&L<O?L:d;if(k&&(H=(O-1)/2),A&&(H=O-1),!n.length){if(T){let e=!0,t=!1,r=1/0,i=1/0,a=1/0,o=-1/0,s=-1/0,u=-1/0,d=[],f=[],g=[];for(let n=0;n<O;n++){let c=m[n],p=0,_=0,v=0,y=!1;if(c&&l(c.getBoundingClientRect)){let e=c.getBoundingClientRect();p=e.left+e.width/2,_=e.top+e.height/2,y=!0}else{let e=c;e&&h(e.x)&&h(e.y)&&(p=e.x,_=e.y,h(e.z)&&(v=e.z,t=!0),y=!0)}if(!y){e=!1;break}d.push(p),f.push(_),g.push(v),p<r&&(r=p),_<i&&(i=_),v<a&&(a=v),p>o&&(o=p),_>s&&(s=_),v>u&&(u=v)}if(e){let e=d[0],l=f[0],m=g[0];N?(e=r+c[0]*(o-r),l=i+c[1]*(s-i),m=t?a+(c.length>=3?c[2]:.5)*(u-a):0):k?(e=(r+o)/2,l=(i+s)/2,m=(a+u)/2):A?(e=d[O-1],l=f[O-1],m=g[O-1]):h(c)&&(e=d[c],l=f[c],m=g[c]);for(let r=0;r<O;r++){let i=e-d[r],a=l-f[r],o=m-g[r],s=p(i*i+a*a+(t?o*o:0));E===`x`&&(s=-i),E===`y`&&(s=-a),E===`z`&&(s=-o),n.push(s)}let _=1/0;for(let e=0;e<O;e++){let t=b(n[e]);t>0&&t<_&&(_=t)}if(_>0&&_<1/0)for(let e=0;e<O;e++)n[e]=n[e]/_}else for(let e=0;e<O;e++)n.push(b(H-e))}else for(let e=0;e<O;e++)if(!C)n.push(b(H-e));else{let t=C.length,r=C[0]*C[1],i,a,o;N?(i=c[0]*(C[0]-1),a=c[1]*(C[1]-1),o=t===3?(c.length>=3?c[2]:.5)*(C[2]-1):0):k?(i=(C[0]-1)/2,a=(C[1]-1)/2,o=t===3?(C[2]-1)/2:0):(i=H%C[0],a=s(H/C[0])%C[1],o=t===3?s(H/r):0);let l=e%C[0],u=s(e/C[0])%C[1],d=t===3?s(e/r):0,f=i-l,m=a-u,h=o-d,g=p(f*f+m*m+(t===3?h*h:0));E===`x`&&(g=-f),E===`y`&&(g=-m),E===`z`&&(g=-h),n.push(g)}r=n[0];for(let e=1;e<O;e++)n[e]>r&&(r=n[e]);if(x||f)for(let e=0;e<O;e++){let t=n[e];x&&(t=x(t/r)*r),f&&(t=E?-t:b(r-t)),n[e]=t}if(se){a=Array(O);for(let e=0;e<O;e++)a[e]=oe(-1,1,4)}M&&(n=ie(n,oe))}let R=P?(ee-I)/r:I;w(i)&&(i=_?te(_,w(t.start)?_.iterationDuration:ae):ae);let z=i+(R*u(n[re],2)||0);if(se){let e=r?n[re]/r:0,t=B+(V-B)*e;z+=a[re]*t}return t.modifier&&(z=t.modifier(z)),ne&&(z=`${z}${ne[2]}`),z}},R=e=>{let t=1;if(e&&e.getCTM){let n=e.getCTM();n&&(t=(p(n.a*n.a+n.b*n.b)+p(n.c*n.c+n.d*n.d))/2)}return t},oe=(e,t,n)=>{let r=N,i=getComputedStyle(e),a=i.strokeLinecap,o=i.vectorEffect===`non-scaling-stroke`?e:null,s=a,c=new Proxy(e,{get(e,t){let n=e[t];return t===f?e:t===`setAttribute`?(...t)=>{if(t[0]===`draw`){let n=t[1].split(` `),i=+n[0],c=+n[1],l=R(o),u=i*-r*l,d=c*r*l+u,f=r*l+(i===0&&c===1||i===1&&c===0?0:10*l)-d;if(a!==`butt`){let t=i===c?`butt`:a;s!==t&&(e.style.strokeLinecap=`${t}`,s=t)}e.setAttribute(`stroke-dashoffset`,`${u}`),e.setAttribute(`stroke-dasharray`,`${d} ${f}`)}return Reflect.apply(n,e,t)}:l(n)?(...t)=>Reflect.apply(n,e,t):n}});return e.getAttribute(`pathLength`)!==`${r}`&&(e.setAttribute(`pathLength`,`${r}`),c.setAttribute(`draw`,`${t} ${n}`)),c},z=(e,t=0,n=0)=>x(e).map(e=>oe(e,t,n)),se=r(),ce=n(),B=e(t(),1),V={overview:`Overview`,laws:`Constitution`,library:`Library`,kits:`Kits`,loops:`Loops`,personal:`Personal`,installs:`Installs`,docs:`Docs`,activity:`Activity`},H={loops:[`templates`,`bricks`,`active`],personal:[`rules`,`profile`,`memory`,`notebook`],installs:[`hosts`,`kits`,`edits`,`doctor`,`server`]},le={templates:`Templates`,bricks:`Bricks`,active:`Active`,rules:`Rules`,profile:`Profile`,memory:`Memory`,notebook:`Notebook`,hosts:`Hosts`,kits:`Kits`,edits:`Local edits`,doctor:`Doctor`,server:`Server`},ue={dashboard:[`overview`],constitution:[`laws`],rules:[`personal`,`rules`],profile:[`personal`,`profile`],harness:[`installs`,`hosts`],harnesses:[`installs`,`hosts`],themes:[`installs`,`hosts`],diff:[`installs`,`edits`],doctor:[`installs`,`doctor`],settings:[`installs`,`server`],about:[`installs`,`server`]},de=(e,t)=>t!==void 0&&Object.hasOwn(e,t),fe=(e,t)=>H[e].includes(t)?t:H[e][0];function pe(e){let t=(e||`#/`).slice(2).split(`/`).filter(Boolean),[n,r,i]=t,a=e=>{try{return decodeURIComponent(e||``)}catch{return e||``}};if(n===`section`||n===`item`){let e=n===`item`&&de(P,r)?P[r]:r,t=n===`item`?a(i):void 0;return{page:e===`laws`?`laws`:`library`,section:e,item:t}}if(n===`docs`)return{page:`docs`,item:a(t.slice(1).join(`/`))};if(n===`kits`)return r?{page:`kits`,item:a(r)}:{page:`kits`};if(n===`activity`&&r)return{page:`activity`,item:a(r)};if(n===`skills`||n===`agents`)return{page:`library`,section:n};if(de(H,n)){let e=fe(n,r);return i&&e===r?{page:n,tab:e,item:a(i)}:{page:n,tab:e}}if(de(ue,n)){let[e,t]=ue[n];return t?{page:e,tab:t}:{page:e}}return{page:de(V,n)?n:`overview`}}var me=new Set;function he(e){return me.add(e),()=>me.delete(e)}function ge(){let e=()=>pe(typeof window<`u`?window.location.hash:``),[t,n]=(0,B.useState)(e);(0,B.useEffect)(()=>{let t=window.location.hash,r=()=>{let r=window.location.hash;if(r!==t){for(let e of me)if(e({from:t,to:r})===!1){window.history.replaceState(window.history.state,``,t||`#/`);return}t=r,n(e())}};return window.addEventListener(`hashchange`,r),()=>window.removeEventListener(`hashchange`,r)},[]);let r=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{if(document.title=`${V[t.page]} · Geneseed`,!r.current){r.current=!0;return}let e=document.getElementById(`main`);e?.focus();for(let t of[e,document.scrollingElement||document.documentElement])t&&(t.scrollTop=0)},[t.page]),t}var _e=e=>{window.location.hash=e},ve={red:`#FF5C57`,green:`#4ED888`,yellow:`#E8B53D`,blue:`#5B8CFF`,magenta:`#C77DFF`,cyan:`#3AD4C4`,white:`#E9EFEA`},ye={red:`#C53A36`,green:`#2FA864`,yellow:`#B8862A`,blue:`#3C66D8`,magenta:`#9A52D6`,cyan:`#2BA89B`,white:`#AEB8B0`},be=e=>ve[e]||ve.cyan,xe={red:`#A92F2B`,green:`#1E7A47`,yellow:`#8A6414`,blue:`#2F55C0`,magenta:`#7E3FB8`,cyan:`#15766C`,white:`#465A51`};function Se(e,t,n){if(!e)return;let r=n===`light`,i=r?ye[t]||ye.cyan:be(t);r&&t===`white`&&(i=`#566B62`);let a=r?xe[t]||xe.cyan:i;Be(e,Ie(i,ye[t]||ye.cyan,De,a,r),r)}var Ce={cultivar:{dark:`#3AD4C4`,light:`#127E73`,ink:`#06100D`},operator:{dark:`#E8A23B`,light:`#8F5E10`,ink:`#1A1306`},matrix:{dark:`#19E37C`,light:`#0B7A47`,ink:`#04140C`},atlas:{dark:`#8FD694`,light:`#1C8450`,ink:`#14200F`}};function we(e,t,n){let r=Ce[t];if(!e||!r)return!1;let i=n===`light`,a=i?r.light:r.dark;return Be(e,Ie(a,r.light,r.ink,a,i),i),!0}var Te={dark:{worst:`#232A31`,soft:[`#14181D`,`#1B2026`,`#11151A`,`#171C22`,`#0B1116`,`#121A21`,`#1C1A12`,`#211E15`]},light:{worst:`#EBE6D8`,soft:[`#FBFDFC`,`#F3F6F6`,`#F4F6F8`,`#E9F4ED`,`#FCFAF4`,`#F6F2E7`]}},Ee=.13,De=`#06100D`,Oe=e=>{let t=e.replace(`#`,``);return[0,2,4].map(e=>parseInt(t.slice(e,e+2),16))},ke=e=>`#`+e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``).toUpperCase(),Ae=e=>{let[t,n,r]=Oe(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},je=(e,t)=>{let[n,r]=[Ae(e),Ae(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)},Me=(e,t,n)=>{let r=Oe(e),i=Oe(t);return ke(r.map((e,t)=>e+(i[t]-e)*n))},Ne=(e,t,n,r)=>{let i=e=>Math.min(...[].concat(t).map(t=>je(e,t))),a=e;for(let t=.05;i(a)<n&&t<=1.0001;t+=.05)a=Me(e,r,t);return a},Pe=e=>{let[t,n,r]=Oe(e).map(e=>e/255),i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a;if(o===0)return{h:0,s:0};let s=o/(1-Math.abs(i+a-1));return{h:((i===t?(n-r)/o%6:i===n?(r-t)/o+2:(t-n)/o+4)*60+360)%360,s}},Fe=(e,t)=>{let n=Math.abs(e-t)%360;return n>180?360-n:n};function Ie(e,t,n,r,i){let a=i?`#000000`:`#FFFFFF`,o=e=>je(e,n)>=je(e,`#FFFFFF`)?n:`#FFFFFF`,s=je(e,o(e))>=4.5?e:Ne(e,i?`#FFFFFF`:n,4.5,a),c=i?Te.light:Te.dark,l=[c.worst,...c.soft.map(e=>Me(e,s,Ee))];return{accent:s,accent2:t,ink:o(s),text:Ne(r,l,4.5,a)}}var Le=39,Re={dark:[`#FF8A4C`,`#FF8A4C`],light:[`#B4441F`,`#9B3A1B`]};function ze(e,t,n){let[r,i]=n?Re.light:Re.dark,{h:a,s:o}=Pe(t),s=Fe(a,Le);o>=.15&&s<=29&&Fe(a,Pe(r).h)>s?(e.style.setProperty(`--warn`,r),e.style.setProperty(`--warn-text`,i)):(e.style.removeProperty(`--warn`),e.style.removeProperty(`--warn-text`))}function Be(e,t,n){e.style.setProperty(`--accent`,t.accent),e.style.setProperty(`--accent-2`,t.accent2),e.style.setProperty(`--accent-ink`,t.ink),e.style.setProperty(`--accent-text`,t.text),ze(e,t.accent,n)}var Ve=e=>typeof e==`string`&&/^#[0-9a-fA-F]{6}$/.test(e);function He(e,t){let n=t===`light`,r=n?Te.light:Te.dark,i=n?`#000000`:`#FFFFFF`,a=Ne(e,r.worst,3,i);return Ie(a,Ne(a,r.worst,4.5,i),De,a,n)}function Ue(e,t,n){return!e||!Ve(t)?!1:(Be(e,He(t,n),n===`light`),!0)}function We(e,t){let[n,r]=(0,B.useState)(()=>{try{return t(localStorage.getItem(e))}catch{return t(null)}});return[n,(0,B.useCallback)(t=>r(n=>{let r=typeof t==`function`?t(n):t;try{localStorage.setItem(e,r)}catch{}return r}),[e])]}var Ge=`geneseed-mode`;function Ke(){let[e,t]=We(Ge,e=>e===`light`?`light`:`dark`);return[e,()=>t(e=>e===`light`?`dark`:`light`)]}var qe=`geneseed-flavour`,Je=[{id:`cultivar`,short:`Cultivar`,name:`Cultivar Evolved`,tagline:`The calm default — cool teal ink, geometric sans, soft flat cards lit by one quiet shadow.`},{id:`operator`,short:`Operator`,name:`Operator HUD`,tagline:`Amber phosphor on cool charcoal — all-mono, zero-radius instrument readout.`},{id:`matrix`,short:`Matrix`,name:`Matrix`,tagline:`Acid-green order-book terminal on pure black — all Space Mono, square 2px, a faint code-grid.`},{id:`atlas`,short:`Atlas`,name:`Atlas`,tagline:`The field journal — loam dark, sage ink, the codex as a living map.`}],Ye=new Set(Je.map(e=>e.id)),Xe={a:`cultivar`,b:`atlas`,c:`operator`,d:`cultivar`,e:`matrix`,f:`cultivar`,g:`cultivar`,z:`cultivar`,cb:`matrix`,cm:`cultivar`,greenhouse:`atlas`,heirloom:`cultivar`,aurora:`cultivar`,perspective:`cultivar`,sequencer:`cultivar`,cobalt:`matrix`,cosmic:`cultivar`,neon:`matrix`};function Ze(){return We(qe,Qe)}function Qe(e){return Ye.has(e)?e:Xe[e]||`cultivar`}var $e=1e3,et=e=>new Promise(t=>setTimeout(t,e));async function tt(){try{return(await a.ping()).pid??null}catch{return null}}async function nt(e=0,t=null){await et(e);for(let e=0;e<30;e++){let e=await tt();if(e!==null&&e!==t)break;await et($e)}window.location.reload()}async function rt(){let e=await tt();try{await a.restart()}catch(e){if(e.status)throw e}await nt($e,e)}var it=`geneseed-accent`,at=[{id:`curated`,short:`Curated`,tagline:`Each theme's own signature colour.`}],ot=[[`cyan`,`Cyan`],[`blue`,`Blue`],[`magenta`,`Violet`],[`yellow`,`Amber`],[`green`,`Green`]].map(([e,t])=>({id:`custom:${e}`,name:e,short:t,hex:be(e),tagline:`${t}, whatever the voice, until the skin changes.`})),st=[...at,...ot],ct=new Set(st.map(e=>e.id)),lt=e=>{let t=typeof e==`string`&&e.startsWith(`hex:`)?e.slice(4):null;return Ve(t)?t.toUpperCase():null},ut=e=>e&&(ct.has(e)||lt(e))?e:`curated`,dt=e=>ot.find(t=>t.id===e)?.name??null,ft=e=>{let t=lt(e);return t?`Your own colour, ${t}.`:st.find(t=>t.id===e)?.tagline??``};function pt(){return We(it,ut)}var mt=`geneseed-layout`,ht=[{id:`overview`,short:`Overview`,tagline:`Every install, what needs you, cost, usage and gates.`},{id:`cultivar`,short:`Cultivar`,tagline:`Hero, KPIs & genome grid.`},{id:`greenhouse`,short:`Greenhouse`,tagline:`Ring, tiles & mix donut.`},{id:`operator`,short:`Operator`,tagline:`Dense terminal readout.`},{id:`journal`,short:`Journal`,tagline:`Growth rings & the constitution map.`}],gt=new Set(ht.map(e=>e.id));function _t(e){return e&>.has(e)?e:`overview`}function vt(){return We(mt,_t)}function yt(e){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(null),[o,s]=(0,B.useState)([]),c=()=>a.overview().then(e=>{n(e),i(null)}).catch(t=>{i(t?.body?.message||t?.message||String(t)),e?.(t)});return(0,B.useEffect)(()=>{c()},[]),(0,B.useEffect)(()=>{a.themes().then(e=>s(e.themes)).catch(()=>{})},[]),{overview:t,error:r,themes:o,reload:c}}var bt=600;function xt({onFinish:e,onError:t}={}){let[n,r]=(0,B.useState)([]),[i,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{a.jobs().then(({jobs:e})=>{if(!e.length)return;r(e.map(e=>({id:e.id,action:e.action,status:e.status,output:e.output||``,duration:e.duration,started:e.started})));let t=e.find(e=>e.status===`running`);t&&(o(t.id),c(!0))}).catch(()=>{})},[]),(0,B.useEffect)(()=>{if(!i)return;let t=n.find(e=>e.id===i),s=t?.action===`update`||!!t?.restarts,c=null;s&&tt().then(e=>c=e);let l=setInterval(async()=>{if(!document.hidden)try{let t=await a.job(i);if(r(e=>{let n=e.findIndex(e=>e.id===i);if(n===-1)return e;let r=e[n],a=t.output||``;if(r.output===a&&r.status===t.status&&r.duration===t.duration)return e;let o=e.slice();return o[n]={...r,output:a,status:t.status,duration:t.duration},o}),t.status!==`running`){if(clearInterval(l),o(null),s&&t.status===`done`){nt(2e3,c);return}e?.(t.status)}}catch{if(!s)return;clearInterval(l),nt(0,c)}},bt);return()=>clearInterval(l)},[i]),{runs:n,activeId:i,consoleOpen:s,setConsoleOpen:c,runAction:async(e,n)=>{try{let{job_id:t,restarts:i}=await a.action(e,n),s=e===`build`&&n?.theme?`build (${n.theme} · ${n.emit})`:e;return r(e=>[...e,{id:t,action:s,status:`running`,output:``,started:Date.now()/1e3,restarts:!!i}]),o(t),c(!0),t}catch(e){t?.(e)}},cancelJob:e=>a.cancelJob(e).catch(e=>t?.(e)),clearRuns:()=>r([])}}var U=new Map,St=new Map;function Ct(e){for(let t of U.keys())t.startsWith(`${e}|`)&&U.delete(t)}function W(e,t=[],n=null,{revalidate:r=!1}={}){let i=n===null?null:`${n}|${t.join(``)}`,[a,o]=(0,B.useState)(()=>i!==null&&U.has(i)?U.get(i):null),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(()=>!(i!==null&&U.has(i))),d=(0,B.useRef)(e),f=(0,B.useRef)(i);(0,B.useLayoutEffect)(()=>{d.current=e,f.current=i});let p=(0,B.useRef)(0),m=(0,B.useCallback)(()=>{let e=++p.current,t=()=>e===p.current;u(!0),c(``);let n=f.current;return Promise.resolve(d.current()).then(e=>{if(t()&&(o(e),n!==null)){U.set(n,e);for(let t of St.get(n)||[])t(e)}}).catch(e=>{t()&&c(e.message)}).finally(()=>{t()&&u(!1)})},t);return(0,B.useEffect)(()=>{let e=f.current;return e!==null&&(St.has(e)||St.set(e,new Set),St.get(e).add(o)),e!==null&&U.has(e)&&(p.current++,o(U.get(e)),c(``),u(!1),!r)||m(),()=>St.get(e)?.delete(o)},[m]),{data:a,error:s,loading:l,reload:m,setData:o}}var wt=60,Tt=3600,Et=86400,Dt={seconds:90,minutes:5400,hours:36*Tt};function Ot(e){let t=Math.max(0,Date.now()/1e3-e);return t<Dt.seconds?`${Math.round(t)}s`:t<Dt.minutes?`${Math.round(t/wt)}m`:t<Dt.hours?`${Math.round(t/Tt)}h`:`${Math.round(t/Et)}d`}function kt(e){return e?e.replace(/\\/g,`/`).replace(/^\/?(home|Users)\/[^/]+/i,`~`).replace(/^[A-Z]:\/Users\/[^/]+/i,`~`):`~`}var G={deployed:.4,doctorClean:.25,doctorMinor:.15,doctorMinorMax:2,doctorFail:.05,versionSynced:.2,diskClean:.15},At={warn:G.deployed+G.doctorClean,bad:G.deployed};function jt(e,t,n){if(!e)return 0;let r=e.doctor?.problems?.length??99,i=e.doctor?.ok?G.doctorClean:r<=G.doctorMinorMax?G.doctorMinor:G.doctorFail,a=t&&t.installed_fp&&t.installed_fp===t.source_fp,o=(e.deployed?G.deployed:0)+i+(a?G.versionSynced:0)+(e.diff&&e.diff.missing===0?G.diskClean:0);return Math.min(o,At[n]??1)}var Mt=e=>Math.max(...I.map(t=>e?.[t]??0),1),Nt=e=>(e?.edited??0)+(e?.added??0),K=e=>Nt(e)+(e?.missing??0),Pt=e=>(e?.laws??0)+(e?.doctrines?.rules??0),q=i(),Ft={dashboard:`M3 13h7V3H3v10Zm0 8h7v-6H3v6Zm11 0h7V11h-7v10Zm0-18v6h7V3h-7Z`,library:`M4 5h10v14H4zM16 7h4v12h-4M7 9h4M7 12h4`,loop:`M19.5 9A8 8 0 1 1 15 4.6M15 1.5l.2 3.3-3.2.8`,graph:`M6 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM7.5 14.5l8-8M16.7 15.2L8.8 16.6`,changes:`M4 6h10M4 12h7M4 18h12M17 4l3 3-3 3M20 7h-6`,doctor:`M12 3v6m0 0a4 4 0 0 1-4 4H7a3 3 0 0 0-3 3v2m8-9a4 4 0 0 0 4 4h1a3 3 0 0 1 3 3v2M12 3a1.5 1.5 0 1 0 0-.01`,themes:`M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.2 0-1 .8-1.5 1.7-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8-9-8Z`,settings:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm8-3a8 8 0 0 0-.1-1.3l2-1.6-2-3.4-2.4 1a8 8 0 0 0-2.2-1.3L15 2H9l-.3 2.6a8 8 0 0 0-2.2 1.3l-2.4-1-2 3.4 2 1.6A8 8 0 0 0 4 12c0 .4 0 .9.1 1.3l-2 1.6 2 3.4 2.4-1a8 8 0 0 0 2.2 1.3L9 22h6l.3-2.6a8 8 0 0 0 2.2-1.3l2.4 1 2-3.4-2-1.6c.1-.4.1-.9.1-1.3Z`,search:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3`,chevron:`M9 6l6 6-6 6`,x:`M6 6l12 12M18 6L6 18`,menu:`M4 7h16M4 12h16M4 17h16`,play:`M7 5v14l11-7L7 5Z`,clear:`M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14`,download:`M12 3v12m0 0l-4-4m4 4l4-4M4 19h16`,refresh:`M21 12a9 9 0 1 1-3-6.7M21 4v5h-5`,folder:`M3 7a2 2 0 0 1 2-2h3.5l2 2H19a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z`,build:`M14 3l-1 4 4-1 3 3-4 1 1 4-3 3-1-4-4 1-3-3 4-1-1-4 3-3 5 0Z`,arrow:`M5 12h14M13 6l6 6-6 6`,external:`M14 5h5v5M19 5l-8 8M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6`,copy:`M9 9h11v11H9zM5 15H4V4h11v1`,check:`M5 12.5l4.5 4.5L19 7`,spark:`M12 3v3m0 12v3m9-9h-3M6 12H3m13.5-6.5-2 2m-7 7-2 2m11 0-2-2m-7-7-2-2`,activity:`M3 12h4l2.5-7 5 14 2.5-7H21`,agent:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8`,kit:`M21 8l-9-5-9 5v8l9 5 9-5V8ZM3 8l9 5 9-5M12 13v8`,layers:`M12 3l9 5-9 5-9-5 9-5ZM3 13l9 5 9-5M3 17l9 5 9-5`,sun:`M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6 4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z`,moon:`M21 12.8A8.5 8.5 0 1 1 11.2 3a6.5 6.5 0 0 0 9.8 9.8Z`,power:`M12 3v9M7.5 6.5a7 7 0 1 0 9 0`,docs:`M5 4h9l5 5v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1ZM14 4v5h5M8 12h7M8 16h7`,skill:`M21.7 6.6a5 5 0 0 1-6.6 6.6l-7.4 7.4a2 2 0 1 1-2.8-2.8l7.4-7.4a5 5 0 0 1 6.6-6.6l-2.6 2.6a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0Z`,law:`M12 3v18M5 6h14M8 21h8M6 6l-3 6h6zM3 12a3 3 0 0 1 6 0M18 6l-3 6h6zM15 12a3 3 0 0 1 6 0`,rule:`M7 3h10a1 1 0 0 1 1 1v17l-6-3.5L6 21V4a1 1 0 0 1 1-1ZM9.5 9.5l1.8 1.8 3.4-3.6`,profile:`M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM5 20a7 7 0 0 1 14 0`,notebook:`M7 4h11v16H7zM4 8h3M4 12h3M4 16h3M11 9h5M11 13h5M11 17h3`,about:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 11v6M12 7.6h.01`,github:`M12 2a10 10 0 0 0-3.2 19.5c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.5 2.3 1.1 2.9.8.1-.6.3-1.1.6-1.3-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.7 1a9.4 9.4 0 0 1 5 0c1.9-1.3 2.7-1 2.7-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.8v2.6c0 .3.2.6.7.5A10 10 0 0 0 12 2Z`};function J({name:e,className:t=`glyph`,style:n}){return(0,q.jsx)(`svg`,{className:t,style:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:Ft[e]||``})})}function It({className:e=`sprout`}){return(0,q.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,q.jsx)(`path`,{d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,q.jsx)(`path`,{d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,q.jsx)(`path`,{d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,q.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})}var Lt=[{hash:`#/`,page:`overview`,label:`Overview`,icon:`dashboard`},{hash:`#/laws`,page:`laws`,label:`Constitution`,icon:`law`,count:e=>e?.counts?(e.counts.ontology??0)+(e.counts.laws??0)+(e.counts.doctrines?.rules??0):null},{hash:`#/library`,page:`library`,label:`Library`,icon:`library`,count:e=>e?.counts?[`skills`,`agents`,`memory`,`notebook`,`wiki`,`config`].reduce((t,n)=>t+(e.counts[n]??0),0):null},{hash:`#/kits`,page:`kits`,label:`Kits`,icon:`kit`},{hash:`#/loops`,page:`loops`,label:`Loops`,icon:`loop`,count:e=>e?.counts?.loops??null},{hash:`#/personal`,page:`personal`,label:`Personal`,icon:`profile`},{hash:`#/installs`,page:`installs`,label:`Installs`,icon:`layers`,count:(e,t)=>t?`${t.filter(e=>e.state===`active`).length}/${t.length}`:null}],Rt=[{hash:`#/docs`,page:`docs`,label:`Docs`,icon:`docs`},{hash:`#/activity`,page:`activity`,label:`Activity`,icon:`activity`}];function zt({n:e,lit:t,count:n,onNavigate:r}){return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{className:`sb-item${t?` on`:``}`,href:e.hash,"aria-current":t?`page`:void 0,onClick:()=>r?.(),children:[(0,q.jsx)(J,{name:e.icon}),(0,q.jsx)(`span`,{className:`sb-label`,children:e.label}),n==null?null:(0,q.jsx)(`span`,{className:`sb-count`,children:n})]})})}function Bt({overview:e,onOpenVoice:t}){if(!e)return null;let n=e.doctor,r=K(e.diff);return(0,q.jsxs)(`section`,{className:`sb-vitals`,"aria-label":`Install vitals`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`doctor`}),(0,q.jsx)(`b`,{className:n?n.ok?`good`:`bad`:``,children:n?n.ok?`clean`:`${n.problems.length} to fix`:`not run`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`drift`}),(0,q.jsx)(`b`,{className:r?`warn`:``,children:e.diff?r:`n/a`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`built`}),(0,q.jsx)(`b`,{title:e.build_time||void 0,children:e.build_epoch?`${Ot(e.build_epoch)} ago`:`never`})]}),(0,q.jsxs)(`button`,{type:`button`,className:`sb-voice`,onClick:t,title:`Switch voice`,"aria-haspopup":`dialog`,children:[(0,q.jsxs)(`span`,{className:`sb-voice-name`,children:[(0,q.jsx)(`i`,{className:`sb-voice-swatch`,"aria-hidden":`true`}),`Voice · `,e.theme||`none`]}),(0,q.jsx)(J,{name:`chevron`})]})]})}function Vt({route:e,overview:t,installs:n,onOpenVoice:r,onNavigate:i}){return(0,q.jsxs)(`nav`,{className:`sidebar`,id:`rail-nav`,"aria-label":`Console`,tabIndex:-1,children:[(0,q.jsxs)(`button`,{type:`button`,className:`sb-brand`,onClick:()=>{_e(`#/`),i?.()},"aria-label":`Geneseed, go to the overview`,children:[(0,q.jsx)(`span`,{className:`sb-mark`,children:(0,q.jsx)(It,{})}),(0,q.jsxs)(`span`,{className:`sb-brand-text`,children:[(0,q.jsx)(`span`,{className:`sb-name`,children:`Geneseed`}),(0,q.jsx)(`span`,{className:`sb-ver`,children:[t?.version&&`v${t.version}`,t?.theme].filter(Boolean).join(` · `)})]})]}),(0,q.jsx)(`ul`,{className:`sb-list`,children:[...Lt,...Rt].map(r=>(0,q.jsx)(zt,{n:r,lit:e.page===r.page,count:r.count?.(t,n),onNavigate:i},r.page))}),(0,q.jsx)(`div`,{className:`sb-spacer`}),t?(0,q.jsx)(`button`,{type:`button`,className:`sb-voice-rail`,"aria-label":`Switch voice, now ${t.theme||`none`}`,title:`Switch voice`,onClick:r,children:(0,q.jsx)(J,{name:`spark`})}):null,(0,q.jsx)(Bt,{overview:t,onOpenVoice:r})]})}var Ht=[`overview`,`laws`,`library`,`installs`];function Ut({route:e,navOpen:t,onMore:n}){return(0,q.jsxs)(`nav`,{className:`tabbar`,"aria-label":`Console pages`,children:[Lt.filter(e=>Ht.includes(e.page)).map(t=>(0,q.jsxs)(`a`,{href:t.hash,className:e.page===t.page?`on`:``,"aria-current":e.page===t.page?`page`:void 0,children:[(0,q.jsx)(J,{name:t.icon}),t.label]},t.page)),(0,q.jsxs)(`button`,{type:`button`,className:`tab-more${Ht.includes(e.page)?``:` on`}`,"aria-controls":`rail-nav`,"aria-expanded":!!t,onClick:n,children:[(0,q.jsx)(J,{name:`menu`}),`More`]})]})}var Wt=[{id:`opencode`,label:`OpenCode`,deployAdds:`.opencode/ + AGENT.md`,removeProject:`.opencode/ + AGENT.md + the bundle`,removeGlobal:`~/.config/opencode's AGENT.md, agents, skills, plugins + the opencode.json entry`},{id:`claude`,label:`Claude Code`,deployAdds:`.claude/ + CLAUDE.md`,removeProject:`.claude/ + the CLAUDE.md block`,removeGlobal:`~/.claude's agents/skills + the CLAUDE.md block + settings hooks`},{id:`bob`,label:`BOB (IBM)`,deployAdds:`.bob/ + AGENTS.md`,removeProject:`.bob/ + the AGENTS.md block`,removeGlobal:`~/.bob's agents/skills + the AGENTS.md block + settings hooks`},{id:`openclaude`,label:`OpenClaude`,deployAdds:`.openclaude/ + its CLAUDE.md`,removeProject:`.openclaude/ + its CLAUDE.md block`,removeGlobal:`~/.openclaude's agents/skills + the CLAUDE.md block + settings hooks`}],Gt=e=>Wt.find(t=>t.id===e)||Wt[0],Kt=(e,t)=>t===`project`?Gt(e).removeProject:Gt(e).removeGlobal,qt=e=>String(e||``).replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Jt=e=>e.scope===`global`?Gt(e.host).label:qt(e.path),Yt=`geneseed-harness`,Xt=Wt.map(({id:e,label:t})=>({id:e,label:t}));function Zt(e=`opencode`){let[t,n]=We(Yt,e=>Xt.some(t=>t.id===e)?e:null);return[t??e,n]}function Qt(e){let t=String(e||``);return Wt.find(e=>t.startsWith(e.id))?.id||`opencode`}var $t=Object.entries(V).flatMap(([e,t])=>(H[e]||[``]).map(n=>{let r=n?t+` / `+le[n]:t;return{kind:`Pages`,sortKey:-1,title:r,desc:``,hay:r.toLowerCase(),route:e===`overview`?`#/`:`#/`+e+(n?`/`+n:``)}}));function en(e=0){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),o=(0,B.useRef)(null),[s]=Zt(),c=`${e}|${s}`,[l,u]=(0,B.useState)(c);return l!==c&&(u(c),n(null)),(0,B.useEffect)(()=>{o.current=null},[c]),{index:t,error:r,prime:(0,B.useCallback)(()=>{if(t||o.current)return o.current;let e=(async()=>{let e=[],t=[`laws`,`skills`,...I],r=await Promise.all(t.map(async e=>{try{return{sec:e,items:(await a.catalog(e))?.items||[]}}catch{return{sec:e,items:[]}}}));for(let{sec:n,items:i}of r){let r=F[n];for(let a of i){let i=a.title||a.name;e.push({kind:r.label,sortKey:t.indexOf(n),title:i,desc:a.desc||``,hay:`${i} ${a.desc||``} ${a.name||``}`.toLowerCase(),route:`#/item/${r.type}/${encodeURIComponent(a.name)}`})}}try{let t=await a.mcp(),n=new Set;for(let r of t?.targets||[])for(let t of r.servers||[]){if(n.has(t.name))continue;n.add(t.name);let r=t.label||t.name;e.push({kind:`MCP servers`,sortKey:100,title:r,desc:t.desc||``,hay:`${r} ${t.desc||``} ${t.name||``} mcp`.toLowerCase(),route:`#/installs/hosts`})}}catch{}try{let t=await a.docs(s);for(let n of t?.groups||[])for(let t of n.pages||[])e.push({kind:`Docs`,sortKey:110,title:t.title,desc:n.label,hay:`${t.title||``} ${t.id||``} ${n.label||``} ${t.section||``} ${t.description||``}`.toLowerCase(),route:`#/docs/${encodeURIComponent(t.id)}`})}catch{}return n(e),o.current=null,e})().catch(e=>(o.current=null,i(e.message||String(e)),[]));return o.current=e,e},[t,s])}}function tn({open:e,title:t,children:n,confirmLabel:r,tone:i,onConfirm:a,onClose:o}){let s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useId)(),d=i===`danger`;return(0,B.useEffect)(()=>{let t=s.current;t&&(e&&!t.open&&(typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``)),e&&(d?c:l).current?.focus(),!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e,d]),(0,q.jsxs)(`dialog`,{ref:s,className:`confirm`,"aria-labelledby":`${u}-title`,"aria-describedby":`${u}-body`,onCancel:o,onClose:o,children:[(0,q.jsx)(`h3`,{className:`confirm-title`,id:`${u}-title`,children:t}),(0,q.jsx)(`div`,{className:`confirm-body`,id:`${u}-body`,children:n}),(0,q.jsxs)(`div`,{className:`confirm-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:o,ref:c,children:`Cancel`}),(0,q.jsx)(`button`,{type:`button`,className:d?`btn danger`:`btn`,onClick:a,ref:l,children:r||`Confirm`})]})]})}var nn=(0,B.createContext)(null),rn=()=>{throw Error(`useConfirm() needs a <ConfirmProvider> above it`)};function an(){return(0,B.useContext)(nn)||rn}function on({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useRef)(null),i=e=>{let t=r.current;r.current=null,n(null),t?.(e)},a=(0,B.useCallback)((e,t={})=>new Promise(i=>{r.current?.(!1),r.current=i,n({msg:e,...t})}),[]);return(0,q.jsxs)(nn.Provider,{value:a,children:[e,(0,q.jsx)(tn,{open:!!t,title:t?.title||`Are you sure?`,confirmLabel:t?.confirmLabel,tone:t?.tone,onConfirm:()=>i(!0),onClose:()=>i(!1),children:t?.msg})]})}var sn=24;function cn(e,t){let n=e.title.toLowerCase();return n.startsWith(t)?0:n.includes(t)?1:e.hay.includes(t)?2:-1}function ln(e,t){let n=t.toLowerCase().trim();if(!e)return[];if(!n)return e.filter(e=>e.sortKey<0).sort((e,t)=>e.sortKey-t.sortKey);let r=[];for(let t of e){let e=cn(t,n);e>=0&&r.push({e:t,s:e})}r.sort((e,t)=>e.e.sortKey-t.e.sortKey||e.s-t.s||e.e.title.localeCompare(t.e.title));let i=r.map(e=>e.e),a=i.filter(e=>e.sortKey>=0).slice(0,sn);return i.filter(e=>e.sortKey<0).concat(a)}function un(e,t){let n=t.trim().toLowerCase(),r=n?e.toLowerCase().indexOf(n):-1;return r<0?e:(0,q.jsxs)(q.Fragment,{children:[e.slice(0,r),(0,q.jsx)(`mark`,{className:`spot-hit`,children:e.slice(r,r+n.length)}),e.slice(r+n.length)]})}function dn({query:e,index:t,loading:n,error:r,active:i,onActive:a,onPick:o}){let s=(0,B.useMemo)(()=>ln(t,e),[t,e]),c=(0,B.useRef)(null),l=s.length>0;(0,B.useLayoutEffect)(()=>{let e=c.current?.querySelectorAll(`[data-spot-row]`);if(!l||!e?.length||!E())return;let t=T(e,{opacity:[0,1],translateY:[-4,0],duration:220,delay:ae(18),ease:`outQuart`});return O(t,220+18*e.length)},[l]),(0,B.useEffect)(()=>{i>=s.length&&a(0)},[s,i,a]),(0,B.useEffect)(()=>{(c.current?.querySelector(`[data-spot-row="${i}"]`))?.scrollIntoView({block:`nearest`})},[i]);let u=[],d=null;s.forEach((e,t)=>{(!d||d.kind!==e.kind)&&(d={kind:e.kind,rows:[]},u.push(d)),d.rows.push({entry:e,index:t})});let f=!!e.trim();return(0,q.jsxs)(`div`,{className:`spotlight`,ref:c,id:`spotlight-list`,role:`listbox`,"aria-label":`Search results`,children:[u.map(t=>(0,q.jsxs)(`div`,{className:`spot-group`,role:`group`,"aria-label":t.kind,children:[(0,q.jsx)(`div`,{className:`spot-group-head`,"aria-hidden":`true`,children:t.kind}),t.rows.map(({entry:t,index:n})=>(0,q.jsxs)(`div`,{id:`spot-opt-${n}`,"data-spot-row":n,role:`option`,"aria-selected":n===i,className:`spot-row ${n===i?`on`:``}`,onMouseDown:e=>{e.preventDefault(),o(t)},onMouseEnter:()=>a(n),children:[(0,q.jsx)(`div`,{className:`spot-title`,children:un(t.title,e)}),t.desc?(0,q.jsx)(`div`,{className:`spot-desc`,children:t.desc}):null]},`${t.route||t.title}-${n}`))]},`${t.kind}-${t.rows[0].index}`)),f&&r&&(0,q.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`Could not load the search index — `,r]}),f&&n&&!r&&(0,q.jsx)(`div`,{className:`spot-empty`,role:`presentation`,children:`Loading…`}),f&&!n&&!r&&s.length===0&&(0,q.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`No matches for “`,e,`”.`]})]})}function fn({actions:e=[],dataRev:t}){let n=(0,B.useRef)(null),r=(0,B.useRef)(null),i=(0,B.useRef)(null),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(0),{index:d,error:f,prime:p}=en(t),m=an(),h=()=>{o(!0),p()},g=()=>{let e=n.current;e?.open&&(typeof e.close==`function`?e.close():e.removeAttribute(`open`)),o(!1),c(``),u(0),i.current?.focus()};(0,B.useEffect)(()=>{let e=n.current;a&&e&&!e.open&&(typeof e.showModal==`function`?e.showModal():e.setAttribute(`open`,``),r.current?.focus())},[a]),(0,B.useEffect)(()=>{let e=e=>{((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`k`||e.key===`/`&&!e.target.closest(`input, textarea, select`))&&(e.preventDefault(),o(!0),p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]);let _=(0,B.useMemo)(()=>[...e.map(e=>({sortKey:-2,...e})),...$t,...d||[]],[e,d]),v=a?ln(_,s):[],y=l<v.length?`spot-opt-${l}`:void 0,b=async e=>{if(g(),!e.run)return _e(e.route);let t=e.confirm;(!t||await m(t.msg,{title:t.title,confirmLabel:t.confirmLabel,tone:t.tone}))&&e.run()};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`tb-cmdk`,ref:i,"aria-haspopup":`dialog`,onClick:h,title:`Press / to open, or Ctrl-K / ⌘K from inside any field`,children:[(0,q.jsx)(J,{name:`search`,className:`mag glyph`}),(0,q.jsx)(`span`,{className:`tb-cmdk-label`,children:`Search or run…`}),(0,q.jsx)(`kbd`,{className:`tb-cmdk-key`,children:`Ctrl K`})]}),(0,q.jsx)(`dialog`,{ref:n,className:`palette`,"aria-label":`Search or run`,onCancel:e=>{e.preventDefault(),g()},onClose:()=>a&&g(),onClick:e=>e.target===n.current&&g(),children:a&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`palette-head`,children:[(0,q.jsx)(J,{name:`search`,className:`mag glyph`}),(0,q.jsx)(`input`,{ref:r,role:`combobox`,"aria-label":`Search or run`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":`spotlight-list`,"aria-activedescendant":y,value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,Math.max(v.length-1,0)));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){let t=v[l];t&&(e.preventDefault(),b(t))}else e.key===`Escape`&&(e.preventDefault(),s?(c(``),u(0)):g())},placeholder:`Search or run…`}),(0,q.jsx)(`kbd`,{className:`palette-key`,children:`Esc`})]}),(0,q.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v.length?`${v.length} results`:`no matches`}),(0,q.jsx)(dn,{query:s,index:_,loading:!d,error:d?``:f,active:l,onActive:u,onPick:b}),(0,q.jsxs)(`div`,{className:`palette-foot`,children:[(0,q.jsx)(`span`,{children:`↑↓ move`}),(0,q.jsx)(`span`,{children:`↵ open`}),(0,q.jsx)(`span`,{children:`actions that write always ask first`})]})]})})]})}function pn({installs:e,onSwitch:t,fallback:n=null}){let[r,i]=(0,B.useState)(null),o=(e||[]).filter(e=>e.state===`active`);if(o.length<2)return n;let s=o.find(e=>e.selected)||o[0];return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`select`,{className:`sel tb-harness`,"aria-label":`Harness to view`,title:`Harness the console is viewing`,value:s.id,onChange:async e=>{let n=o.find(t=>t.id===e.target.value);if(n){i(null);try{await a.selectView(n.host,n.path),t?.()}catch(e){i(e?.body?.message||e.message)}}},children:o.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.scope===`global`?`${e.host} · global`:`${Jt(e)} · ${e.host}`},e.id))}),r&&(0,q.jsxs)(`span`,{className:`t-bad`,role:`alert`,children:[` `,`Switch failed: `,r]})]})}var mn=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function hn({open:e,onClose:t,anchorRef:n,label:r,className:i,children:a}){let o=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!e)return;let r=o.current,i=n?.current;(r.querySelector(mn)||r).focus();let a=e=>{e.key===`Escape`&&t()},s=e=>{r.contains(e.target)||i?.contains(e.target)||t()};return document.addEventListener(`keydown`,a),document.addEventListener(`mousedown`,s),()=>{document.removeEventListener(`keydown`,a),document.removeEventListener(`mousedown`,s);let e=document.activeElement;(!e||e===document.body||r.contains(e))&&i?.focus()}},[e]),e?(0,q.jsx)(`div`,{ref:o,className:i?`popover ${i}`:`popover`,role:`dialog`,"aria-label":r,tabIndex:-1,children:a}):null}function gn({children:e,...t}){let n=D(`button.on`);return(0,q.jsxs)(`div`,{className:`seg`,role:`group`,ref:n,...t,children:[(0,q.jsx)(`span`,{className:`glide`,"aria-hidden":`true`}),e]})}function _n({value:e,onChange:t,labelledBy:n}){let r=lt(e);return(0,q.jsxs)(`div`,{className:`accent-picker`,role:`group`,"aria-labelledby":n,children:[at.map(n=>(0,q.jsx)(`button`,{type:`button`,className:`accent-src${e===n.id?` on`:``}`,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id)),(0,q.jsxs)(`div`,{className:`accent-swatches`,children:[ot.map(n=>(0,q.jsx)(`button`,{type:`button`,className:`accent-swatch${e===n.id?` on`:``}`,style:{"--sw":n.hex},"aria-pressed":e===n.id,"aria-label":`${n.short} accent`,title:n.short,onClick:()=>t(n.id)},n.id)),(0,q.jsx)(`label`,{className:`accent-swatch accent-custom${r?` on picked`:``}`,style:r?{"--sw":r}:void 0,title:r?`Your colour, ${r}`:`Pick any colour`,children:(0,q.jsx)(`input`,{type:`color`,"aria-label":`Custom accent colour`,value:(r||`#3AD4C4`).toLowerCase(),onChange:e=>t(`hex:${e.target.value.toUpperCase()}`)})})]})]})}function vn({flavour:e,onFlavour:t,accentMode:n,onAccentMode:r,layout:i,onLayout:a,onClose:o,anchorRef:s}){let c=(e,t,n,r,i)=>(0,q.jsxs)(`div`,{className:`ap-group`,children:[(0,q.jsx)(`span`,{className:`ap-label`,id:e,children:t}),(0,q.jsx)(gn,{"aria-labelledby":e,children:n.map(e=>(0,q.jsx)(`button`,{type:`button`,className:r===e.id?`on`:``,"aria-pressed":r===e.id,title:e.tagline,onClick:()=>i(e.id),children:e.short},e.id))})]});return(0,se.createPortal)((0,q.jsxs)(hn,{open:!0,onClose:o,anchorRef:s,label:`Appearance`,className:`appearance-pop`,children:[c(`ap-skin`,`Skin`,Je,e,t),(0,q.jsxs)(`div`,{className:`ap-group`,children:[(0,q.jsx)(`span`,{className:`ap-label`,id:`ap-accent`,children:`Accent`}),(0,q.jsx)(_n,{value:n,onChange:r,labelledBy:`ap-accent`})]}),c(`ap-view`,`Overview view`,ht,i,a)]}),document.querySelector(`.app`)||document.body)}function yn({route:e,navOpen:t,onToggleNav:n,overview:r,installs:i,actions:a,mode:o,onToggleMode:s,appearance:c,dataRev:l,onSwitch:u}){let[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),m=r?.install,h=m?`${m.host}:${m.scope}`:kt(r?.target),g=e.tab&&le[e.tab];return(0,q.jsxs)(`header`,{className:`topbar`,children:[(0,q.jsx)(`button`,{type:`button`,className:`tb-menu iconbtn`,onClick:n,"aria-label":t?`Close navigation`:`Open navigation`,"aria-expanded":!!t,"aria-controls":`rail-nav`,children:(0,q.jsx)(J,{name:t?`x`:`menu`})}),(0,q.jsx)(`nav`,{className:`crumbs`,"aria-label":`Breadcrumb`,children:(0,q.jsxs)(`ol`,{children:[(0,q.jsx)(`li`,{className:`crumb-root mono`,children:(0,q.jsx)(pn,{installs:i,onSwitch:u,fallback:(0,q.jsx)(`a`,{href:`#/installs`,title:r?.target||void 0,children:h})})}),(0,q.jsx)(`li`,{children:g?(0,q.jsx)(`a`,{href:e.page===`overview`?`#/`:`#/${e.page}`,children:V[e.page]}):(0,q.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:V[e.page]})}),g?(0,q.jsx)(`li`,{children:(0,q.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:g})}):null]})}),(0,q.jsx)(`div`,{className:`topbar-spacer`}),(0,q.jsx)(fn,{actions:a,dataRev:l}),(0,q.jsx)(`button`,{type:`button`,className:`iconbtn`,ref:p,"aria-label":`Appearance`,title:`Appearance`,"aria-expanded":d,onClick:()=>f(e=>!e),children:(0,q.jsx)(J,{name:`themes`})}),d?(0,q.jsx)(vn,{...c,anchorRef:p,onClose:()=>f(!1)}):null,(0,q.jsx)(`button`,{type:`button`,className:`iconbtn`,title:o===`light`?`Switch to dark`:`Switch to light`,"aria-label":o===`light`?`Switch to dark mode`:`Switch to light mode`,onClick:s,children:(0,q.jsx)(J,{name:o===`light`?`moon`:`sun`})})]})}function bn({themes:e,current:t,onPick:n,onClose:r}){let i=an(),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,B.useEffect)(()=>{a.current?.querySelector(`button.pop-item`)?.focus()},[]),(0,q.jsxs)(`div`,{className:`pop`,ref:a,role:`dialog`,"aria-label":`Switch voice`,children:[(0,q.jsx)(`div`,{className:`tick`,style:{padding:`4px 10px 8px`},children:`Switch voice`}),e.map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":e.name===t,className:`pop-item ${e.name===t?`on`:``}`,onClick:async()=>{r(),await i(`Rebuild the deployed harness in the “${e.name}” voice? It rebuilds in place, non-destructive.`,{title:`Switch voice?`,confirmLabel:`Rebuild`})&&n(e.name)},children:(0,q.jsx)(`span`,{className:`pn`,children:e.name})},e.name))]})}var xn=3500;function Sn({toast:e,onClose:t}){let[n,r]=(0,B.useState)(null),i=!!e&&e.kind!==`err`&&n!==e;(0,B.useEffect)(()=>{if(!i)return;let e=setTimeout(t,xn);return()=>clearTimeout(e)},[e,i]);let a=()=>r(e),o=()=>r(null);return(0,q.jsx)(`div`,{className:`toast-region`,"aria-live":e?.kind===`err`?void 0:`polite`,children:e&&(0,q.jsxs)(`div`,{className:`toast ${e.kind}`,role:e.kind===`err`?`alert`:void 0,onMouseEnter:a,onMouseLeave:e=>{e.currentTarget.contains(document.activeElement)||o()},onFocus:a,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||o()},children:[(0,q.jsx)(`div`,{children:e.msg}),(0,q.jsx)(`div`,{style:{marginTop:8},children:(0,q.jsx)(`button`,{className:`btn ghost`,onClick:t,children:`Dismiss`})})]})})}function Cn({runs:e,open:t,onToggle:n,onClear:r,onCancel:i,busy:a,finish:o}){let s=(0,B.useRef)(null),c=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=c.current;o&&e&&(e.classList.remove(`flash-ok`,`flash-bad`),e.offsetWidth,e.classList.add(o.status===`done`?`flash-ok`:`flash-bad`))},[o]);let l=e.length?e[e.length-1].output.length:0;return(0,B.useEffect)(()=>{let e=s.current;e&&t&&(e.scrollTop=e.scrollHeight)},[e.length,l,t]),(0,q.jsxs)(`div`,{className:`console`,style:{height:`42vh`,transform:t?`none`:`translateY(calc(42vh - 42px))`},children:[(0,q.jsxs)(`div`,{className:`console-head`,ref:c,onClick:n,onAnimationEnd:e=>{e.target===e.currentTarget&&e.currentTarget.classList.remove(`flash-ok`,`flash-bad`)},children:[a&&(0,q.jsx)(`span`,{className:`console-progress`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`ttl`,children:[(0,q.jsx)(`span`,{className:`live ${a?`on`:``}`}),`terminal`]}),(0,q.jsx)(`span`,{className:`count`,children:e.length}),(0,q.jsxs)(`div`,{className:`right`,onClick:e=>e.stopPropagation(),children:[(0,q.jsx)(`button`,{className:`iconbtn`,title:`Clear`,"aria-label":`Clear run history`,onClick:r,disabled:!e.length,children:(0,q.jsx)(J,{name:`clear`})}),(0,q.jsx)(`button`,{className:`iconbtn`,title:t?`Collapse`:`Expand`,"aria-label":t?`Collapse console`:`Expand console`,"aria-expanded":t,onClick:n,children:(0,q.jsx)(J,{name:`chevron`,className:`glyph`,style:{transform:t?`rotate(90deg)`:`rotate(-90deg)`}})})]})]}),t&&(0,q.jsxs)(`div`,{className:`console-body`,ref:s,children:[e.length===0&&(0,q.jsx)(`div`,{className:`console-empty`,children:`No commands run yet. Actions you trigger stream here.`}),e.map(e=>(0,q.jsxs)(`div`,{className:`run`,children:[(0,q.jsxs)(`div`,{className:`run-head`,children:[(0,q.jsx)(`span`,{className:`pr`,children:`$`}),(0,q.jsx)(`span`,{className:`act`,children:e.action}),(0,q.jsx)(`span`,{className:`st ${e.status}`,children:e.status===`running`?`…running`:`${e.status===`done`?`✓ done`:`✗ failed`}${e.duration?` · ${e.duration}s`:``}`}),e.status===`running`&&i&&(0,q.jsx)(`button`,{className:`iconbtn run-cancel`,title:`Cancel this run`,"aria-label":`Cancel the ${e.action} run`,onClick:()=>i(e.id),children:(0,q.jsx)(J,{name:`x`})})]}),e.output&&(0,q.jsx)(`pre`,{className:`run-out`,children:e.output})]},e.id))]})]})}var wn=550,Tn=`gs-splash-seen`,En=8e3;function Dn(){try{if(window.localStorage.getItem(Tn))return 0;window.localStorage.setItem(Tn,`1`)}catch{}return wn}function On({ready:e,onDone:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=setTimeout(()=>r(!0),Dn());return()=>clearTimeout(e)},[]);let[o,s]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(e)return;let t=setTimeout(()=>s(!0),En);return()=>clearTimeout(t)},[e]),e&&n&&!i&&a(!0),(0,B.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>t?.(),700);return()=>clearTimeout(e)},[i]);let c=o&&!i;return(0,q.jsxs)(`div`,{className:`boot-splash${i?` fading`:``}`,"aria-hidden":c?void 0:`true`,onAnimationEnd:e=>{e.animationName===`splashOut`&&t?.()},children:[(0,q.jsxs)(`div`,{className:`boot-dial`,"aria-hidden":`true`,children:[(0,q.jsxs)(`svg`,{className:`boot-ring`,viewBox:`0 0 172 172`,children:[(0,q.jsx)(`circle`,{cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--surface-3)`,strokeWidth:`9`}),(0,q.jsx)(`circle`,{cx:`86`,cy:`86`,r:`50`,fill:`none`,stroke:`var(--line-2)`,strokeWidth:`8`,strokeDasharray:`1.2 5.3`,opacity:`.7`}),(0,q.jsx)(`circle`,{className:`boot-progress`,cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`9`,strokeLinecap:`round`})]}),(0,q.jsxs)(`svg`,{className:`boot-sprout`,viewBox:`0 0 24 24`,children:[(0,q.jsx)(`path`,{className:`bs-stem`,d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,q.jsx)(`path`,{className:`bs-leaf bs-leaf-main`,d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,q.jsx)(`path`,{className:`bs-leaf bs-leaf-back`,d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,q.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})]}),c?(0,q.jsxs)(`div`,{className:`boot-status`,role:`alert`,children:[(0,q.jsx)(`span`,{children:`The server is not answering.`}),` `,(0,q.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>window.location.reload(),children:`Retry`})]}):(0,q.jsxs)(`div`,{className:`boot-status`,children:[(0,q.jsx)(`span`,{children:`germinating harness`}),(0,q.jsx)(`span`,{className:`boot-caret`})]})]})}function kn({label:e=`Loading…`}){return(0,q.jsxs)(`div`,{className:`loading`,role:`status`,children:[e,(0,q.jsxs)(`div`,{className:`skel`,"aria-hidden":`true`,children:[(0,q.jsx)(`div`,{className:`skel-bar`}),(0,q.jsx)(`div`,{className:`skel-bar`}),(0,q.jsx)(`div`,{className:`skel-bar`})]})]})}function An({error:e,style:t,onRetry:n,role:r=`alert`}){return e?n?(0,q.jsxs)(`div`,{className:`error-state`,role:r,style:t,children:[(0,q.jsx)(`p`,{className:`badge bad`,children:e}),(0,q.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:n,children:`Retry`})]}):(0,q.jsx)(`p`,{className:`badge bad`,role:r,style:t,children:e}):null}function jn(){let[e,t]=(0,B.useState)(!1),[n,r]=(0,B.useState)(null);return(0,q.jsxs)(`div`,{className:`stale-banner`,role:`alert`,children:[(0,q.jsx)(`span`,{children:n||`This console is running code from before your last upgrade.`}),(0,q.jsx)(`button`,{className:`btn sm`,onClick:async()=>{t(!0),r(null);try{await rt()}catch(e){r(e.message),t(!1)}},disabled:e,children:e?`Restarting…`:`Restart`})]})}var Mn=/dynamically imported module|Importing a module script failed|Unable to preload CSS/i,Nn=e=>Mn.test(e?.message||``),Pn=class extends B.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=Nn(e);return(0,q.jsxs)(`div`,{role:t?void 0:`alert`,children:[(0,q.jsx)(An,{error:e.message||String(e),role:null}),t?(0,q.jsx)(jn,{}):(0,q.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>this.setState({error:null}),children:`Retry`})]})}},Fn=(0,B.createContext)(null),In=e=>[...e].sort().join(`,`),Ln=e=>[...e.values()].some(e=>!e.applied&&In(e.value)!==e.base);function Rn(e,t){let[n,r]=(0,B.useState)(()=>({kits:new Map,rules:new Map})),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(t);if(o!==t&&(s(t),i&&t)){let e=t.status===`done`?{applied:!0}:{failed:!0};r(t=>{let n=t[i.kind].get(i.key);return n?{...t,[i.kind]:new Map(t[i.kind]).set(i.key,{...n,...e})}:t}),a(null)}let c=Ln(n.kits)||Ln(n.rules);return(0,B.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[c]),{get:(e,t)=>n[e].get(t),put:(e,t,n,i)=>r(r=>{let a=new Map(r[e]);return In(n)===i?a.delete(t):a.set(t,{value:n,base:i}),{...r,[e]:a}}),drop:(e,t)=>r(n=>{let r=new Map(n[e]);return r.delete(t),{...n,[e]:r}}),prune:(0,B.useCallback)((e,t)=>r(n=>{let r=[...n[e]].filter(([e,n])=>t(e,n)).map(([e])=>e);if(!r.length)return n;let i=new Map(n[e]);return r.forEach(e=>i.delete(e)),{...n,[e]:i}}),[]),startApply:(e,t)=>{a({kind:e,key:t}),r(n=>{let r=n[e].get(t);return r?.failed?{...n,[e]:new Map(n[e]).set(t,{value:r.value,base:r.base})}:n})},running:(t,n)=>!!e&&i?.kind===t&&i?.key===n,busy:!!e}}function zn({activeId:e,finish:t,children:n}){let r=Rn(e,t);return(0,q.jsx)(Fn.Provider,{value:r,children:n})}function Bn(){let e=Rn(null,null);return(0,B.useContext)(Fn)||e}function Vn({eyebrow:e,title:t,sub:n,primary:r,actions:i,crumbs:a}){return(0,q.jsxs)(`div`,{className:`page-head`,children:[(0,q.jsxs)(`div`,{children:[a?.length?(0,q.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`page-crumbs`,children:(0,q.jsx)(`ol`,{children:a.map((e,t)=>(0,q.jsx)(`li`,{children:t===a.length-1?(0,q.jsx)(`span`,{"aria-current":`page`,children:e.label}):e.href?(0,q.jsx)(`a`,{href:e.href,children:e.label}):e.label},t))})}):null,e?(0,q.jsx)(`div`,{className:`eyebrow`,children:e}):null,(0,q.jsx)(`h1`,{className:`h`,children:t}),n?(0,q.jsx)(`p`,{className:`sub`,children:n}):null]}),r||i?(0,q.jsxs)(`div`,{className:`page-actions`,children:[i,r]}):null]})}var Hn=e=>!!e&&!e.endsWith(`-global`);function Un({onAction:e}){let{data:t,error:n}=W(()=>a.themes(),[]),[r,i]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(!1);if(n)return(0,q.jsx)(An,{error:n});if(!t)return(0,q.jsx)(kn,{});let m=r||t.current?.theme||`neutral`,h=(t.emits||[]).filter(e=>e.name!==`files`),g=t.emits?.some(e=>e.name===`opencode-global`),_=o||(g?`opencode-global`:t.current?.emit||h[0]?.name||``),v=i,y=s,b=Hn(_);return(0,q.jsxs)(`div`,{className:`narrow-lg`,children:[(0,q.jsx)(`div`,{className:`head-row mb-18`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`h`,children:`Deploy your harness`}),(0,q.jsx)(`p`,{className:`sub`,children:`Geneseed isn't implanted on this machine yet. Pick a voice and an install mode, then deploy. The graft runs in the console below, and this dashboard lights up when it lands.`})]})}),(0,q.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,q.jsx)(`div`,{className:`card-head`,children:(0,q.jsx)(`h3`,{children:`1 · Choose a voice`})}),(0,q.jsx)(`div`,{className:`row wrap gap-10`,children:t.themes.map(e=>(0,q.jsx)(`button`,{className:`btn ${e.name===m?`soft`:`ghost`}`,onClick:()=>v(e.name),title:e.blurb||e.tagline||e.name,children:(0,q.jsx)(`span`,{style:{textTransform:`capitalize`},children:e.name})},e.name))})]}),(0,q.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,q.jsx)(`div`,{className:`card-head`,children:(0,q.jsx)(`h3`,{children:`2 · Install mode`})}),(0,q.jsxs)(`p`,{className:`sub mb-16`,children:[`A `,(0,q.jsx)(`code`,{children:`-global`}),` mode deploys once to that tool's global config, so every repo on this machine inherits the harness (recommended). A project mode installs into the repository folder you choose.`]}),(0,q.jsxs)(`label`,{className:`stack`,style:{gap:6,maxWidth:360},children:[(0,q.jsx)(`span`,{className:`tick`,children:`Mode`}),(0,q.jsx)(`select`,{className:`sel`,value:_,onChange:e=>y(e.target.value),children:h.map(e=>(0,q.jsxs)(`option`,{value:e.name,children:[e.name,e.desc?` · ${e.desc}`:``]},e.name))})]}),b&&(0,q.jsxs)(`div`,{className:`row gap-10`,style:{maxWidth:560,marginTop:12},children:[(0,q.jsx)(`input`,{className:`inp`,style:{flex:1},type:`text`,placeholder:`/path/to/project, or click Browse…`,value:c,onChange:e=>l(e.target.value),"aria-label":`Project folder to install into`}),(0,q.jsx)(`button`,{className:`btn ghost sm`,disabled:f,onClick:async()=>{p(!0),d(``);try{let e=await a.pickFolder();e.path?l(e.path):e.error&&d(e.error)}catch(e){d(e.message)}finally{p(!1)}},children:f?`Choosing…`:`Browse…`})]}),u&&(0,q.jsx)(`p`,{className:`sub`,style:{marginTop:12},children:u})]}),(0,q.jsxs)(`button`,{className:`btn btn-grid`,disabled:!m||!_||b&&!c.trim(),onClick:()=>{if(!b)return e(`build`,{theme:m,emit:_});let t=c.trim();return t?(d(``),e(`deploy`,{host:_,path:t,theme:m})):d(`Choose or type the project folder to install into.`)},children:[(0,q.jsx)(J,{name:`build`}),`Deploy harness`]})]})}var Wn=e=>W(()=>a.rules().catch(()=>null),[e],`rules`,{revalidate:!0}),Gn=()=>Ct(`rules`);function Kn({segments:e,value:t,max:n,size:r=120,stroke:i=12,label:a,sweepMs:o=650}){let s=n>0?n:0,c=e||[{key:`v`,label:a,n:Math.min(Math.max(t||0,0),s),tone:`accent`}],l=e?c.reduce((e,t)=>e+t.n,0):s,u=e?c.map(e=>`${e.label}: ${e.n} of ${l}`).join(`, `):`${c[0].n} of ${l}`,d=r/2-i/2,f=r/2,p=e=>[f+d*Math.cos(e),f+d*Math.sin(e)],m=[],h=0;for(let e of c)m.push(h),h+=e.n;let g=(0,B.useRef)(null),_=c.map(e=>e.n).join(`,`);return(0,B.useLayoutEffect)(()=>{let e=g.current?.querySelectorAll(`path.ring-arc`);if(!o||!e?.length||!E())return;let t=c.map(e=>e.n/l).filter(e=>e>0),n=t.map((e,n)=>t.slice(0,n).reduce((e,t)=>e+t,0)),r=z(e);k(r,{draw:`0 0`});let i=T(r,{draw:[`0 0`,`0 1`],duration:(e,n)=>Math.max(o*t[n],60),delay:(e,t)=>o*n[t],ease:`linear`});return O(i,o)},[_,o]),(0,q.jsxs)(`svg`,{className:`ring`,width:r,height:r,viewBox:`0 0 ${r} ${r}`,role:`img`,"aria-label":a?`${a}: ${u}`:u,children:[(0,q.jsx)(`circle`,{className:`ring-track`,cx:f,cy:f,r:d,fill:`none`,strokeWidth:i}),(0,q.jsx)(`g`,{ref:g,children:l>0?c.map((e,t)=>{let n=e.n/l;if(!(n>0))return null;let r=m[t]/l*2*Math.PI-Math.PI/2,a=r+n*2*Math.PI,[o,s]=p(r),[c,u]=p(a),h=n>=.9999?`M ${o} ${s} A ${d} ${d} 0 1 1 ${2*f-o} ${2*f-s} A ${d} ${d} 0 1 1 ${o} ${s}`:`M ${o} ${s} A ${d} ${d} 0 ${+(n>.5)} 1 ${c} ${u}`;return(0,q.jsx)(`path`,{className:`ring-arc tone-${e.tone||`muted`}`,d:h,fill:`none`,strokeWidth:i,children:(0,q.jsxs)(`title`,{children:[e.label,`: `,e.n]})},e.key)}):null})]})}var qn=500;function Jn({parts:e,total:t,label:n,legend:r=!0}){let i=e.reduce((e,t)=>e+t.n,0),a=t??i,o=e=>a>0?`${e/a*100}%`:`0%`,s=e.map(e=>`${e.label}: ${e.n} of ${a}`).join(`, `),c=(0,B.useRef)(null),l=e.map(e=>e.n).join(`,`)+`/${a}`;return(0,B.useLayoutEffect)(()=>{if(c.current&&E())return k(c.current,{scaleX:0}),O(T(c.current,{scaleX:[0,1],duration:qn,ease:`outExpo`}),qn)},[l]),(0,q.jsxs)(`div`,{className:`stackbar-box`,children:[(0,q.jsx)(`div`,{className:`stackbar sweep`,role:`img`,"aria-label":n?`${n}: ${s}`:s,ref:c,children:e.map(e=>e.n>0?(0,q.jsx)(`span`,{className:`tone-${e.tone||`muted`}`,style:{width:o(e.n)},title:`${e.label}: ${e.n}`},e.key):null)}),r&&(0,q.jsx)(`ul`,{className:`stackbar-legend`,"aria-hidden":`true`,children:e.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`i`,{className:`tone-${e.tone||`muted`}`}),e.label,` `,(0,q.jsx)(`span`,{className:`mono`,children:e.n})]},e.key))})]})}function Yn({value:e,max:t,label:n=`value`,tone:r=`accent`}){let i=t>0?t:0;return(0,q.jsx)(Jn,{parts:[{key:`v`,label:n,n:Math.min(Math.max(e||0,0),i),tone:r}],total:i,legend:!1})}var Xn=864e5;function Zn(e,t=10,n=`today`){let r=Array(t).fill(0).map((e,r)=>({t:r===t-1?n:`${t-1-r}d`,v:0})),i=e=>new Date(e).setHours(0,0,0,0),a=i(Date.now());for(let n of e){let e=n.started||n.finished||n.created||n.ts;if(!e)continue;let o=typeof e==`string`?Date.parse(e):e*1e3;if(!Number.isFinite(o))continue;let s=Math.round((a-i(o))/Xn);s<0||s>=t||(r[t-1-s].v+=1)}return r}var Qn=(e,t)=>[...e||[]].sort((e,t)=>(t.started||0)-(e.started||0)).slice(0,t),$n=[`--emit`,`--theme`,`--scope`],er={done:`✓`,failed:`✗`};function tr(e){let t=(e.output||``).split(`
|
|
3
|
+
`).find(e=>e.startsWith(`$ `))||``,n=t.split(/\s+/),r=[];return n.forEach((e,t)=>{let[i,a]=e.split(`=`),o=a||n[t+1];$n.includes(i)&&o&&!o.startsWith(`--`)&&r.push(o)}),{verb:(e.action||`run`).split(/[\s(]/)[0],scope:r.join(` · `),result:er[e.status]||`…`,duration:e.duration?`${e.duration}s`:`—`,command:t}}var nr={busy:{cls:`acc`,label:`working`,accent:`var(--accent)`},"waiting-input":{cls:`warn`,label:`your move`,accent:`var(--warn)`},blocked:{cls:`bad`,label:`blocked`,accent:`var(--bad)`},idle:{cls:``,label:`idle`,accent:`var(--line)`}},rr={cls:``,label:`ended`};function ir(e){if(!e)return``;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||e}var ar=e=>e?e<1e3?String(e):e<1e5?(e/1e3).toFixed(1)+`k`:e<1e6?(e/1e3).toFixed(0)+`k`:(e/1e6).toFixed(1)+`M`:`0`;function or(e){if(e=Math.max(0,Math.floor(e)),e<60)return`${e}s`;let t=Math.floor(e/60);return t<60?`${t}m ${e%60}s`:`${Math.floor(t/60)}h ${t%60}m`}function sr({startedAt:e}){let[t,n]=(0,B.useState)(()=>Date.now()/1e3);return(0,B.useEffect)(()=>{let e=setInterval(()=>n(Date.now()/1e3),1e3);return()=>clearInterval(e)},[]),or(t-e)}function cr({done:e,total:t}){let n=Math.min(t,10),r=Math.min(n,Math.round(e/t*n));return(0,q.jsxs)(`span`,{className:`act-todo`,children:[(0,q.jsx)(`span`,{className:`on`,children:`●`.repeat(r)}),(0,q.jsx)(`span`,{className:`dim`,children:`○`.repeat(n-r)})]})}var lr=e=>e.ended?null:e.turn_started_at,ur=e=>!!(e.tokens>0||e.cost>0||lr(e)||e.files?.count>0);function dr({s:e,heading:t,id:n,children:r}){let i=e.ended?rr:nr[e.status]||nr.idle,a=e.files,o=ur(e),s=e=>n?`${n}-${e}`:void 0;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`row between wrap gap-12`,children:[t?(0,q.jsxs)(`div`,{className:`row gap-10 act-min`,children:[(0,q.jsx)(`span`,{className:`feed-dot act-dot ${e.ended?``:i.cls||`acc`}`}),(0,q.jsxs)(`div`,{className:`act-min`,children:[(0,q.jsx)(`h2`,{className:`act-title`,id:s(`t`),children:t}),e.cwd&&(0,q.jsx)(`div`,{className:`dim mono act-cwd`,title:e.cwd,children:e.cwd})]})]}):null,(0,q.jsxs)(`div`,{className:`row gap-8 act-fixed`,children:[e.model&&(0,q.jsx)(`span`,{className:`badge mono`,title:`model`,children:e.model}),e.agent&&(0,q.jsx)(`span`,{className:`badge`,children:e.agent}),(0,q.jsxs)(`span`,{className:`badge ${i.cls}`,id:s(`st`),children:[(0,q.jsx)(`span`,{className:`dot`}),i.label]}),r]})]}),e.phase&&(0,q.jsxs)(`div`,{className:`row gap-8 act-phase`,children:[(0,q.jsx)(J,{name:`activity`}),(0,q.jsx)(`span`,{className:`act-ell`,children:e.phase})]}),o&&(0,q.jsxs)(`div`,{className:`row wrap act-counters`,id:s(`c`),children:[e.tokens>0&&(0,q.jsxs)(`span`,{children:[ar(e.tokens),` tok`]}),e.cost>0&&(0,q.jsxs)(`span`,{children:[`$`,e.cost.toFixed(2)]}),lr(e)?(0,q.jsx)(`span`,{children:(0,q.jsx)(sr,{startedAt:e.turn_started_at})}):null,a&&a.count>0&&(0,q.jsxs)(`span`,{children:[a.count,` file`,a.count===1?``:`s`,` `,(0,q.jsxs)(`span`,{className:`t-good`,children:[`+`,a.additions]}),` `,(0,q.jsxs)(`span`,{className:`t-bad`,children:[`−`,a.deletions]})]})]}),(e.error||e.blocked_on)&&(0,q.jsx)(`div`,{className:`act-err-row`,children:(0,q.jsx)(`span`,{className:`badge bad act-ell`,title:e.error||e.blocked_on,children:e.error||e.blocked_on})})]})}var fr=e=>e?.status===`blocked`||e?.status===`waiting-input`,pr=864e5,mr=e=>new Date(e).toISOString().slice(0,10),hr=(e,t)=>new Date(`${e}T00:00:00Z`).toLocaleDateString(`en-GB`,{...t,timeZone:`UTC`}),gr=e=>hr(e,{day:`numeric`,month:`short`});function _r(e,t=Date.now()){let n=hr(e,{weekday:`long`,day:`numeric`,month:`long`}),r=e===mr(t)?`Today`:e===mr(t-pr)?`Yesterday`:``;return r?`${r} · ${n}`:n}function vr(e,{now:t=Date.now(),days:n=14,cap:r}={}){let i=(e||[]).filter(e=>Number.isFinite(e.started)),a={};for(let e of i){let t=mr(e.started*1e3);a[t]=(a[t]||0)+1}let o=i.length?mr(Math.min(...i.map(e=>e.started))*1e3):null,s=i.filter(e=>e.status!==`running`).length,c=typeof r!=`number`||s>=r;return Array.from({length:n},(e,r)=>{let i=mr(t-(n-1-r)*pr);return{key:i,n:a[i]||0,nodata:c&&(o===null||i<o)}})}var yr=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function br(e,t,n,r=Date.now()){let i={},a=e=>i[e]||={key:e,runs:[],asks:[]};for(let t of Qn(e,(e||[]).length))Number.isFinite(t.started)&&a(mr(t.started*1e3)).runs.push(t);return(n||[]).forEach((e,n)=>{for(let r of t||[])r.per_day?.[n]>0&&a(e).asks.push([r.name,r.per_day[n]])}),Object.values(i).sort((e,t)=>e.key<t.key?1:-1).map(({key:e,runs:t,asks:n})=>{n.sort((e,t)=>t[1]-e[1]);let i=n.reduce((e,t)=>e+t[1],0),a=n.map(([e,t],n)=>`${e}${n?``:` asked`} ${t}×`).join(`, `),o=[t.length&&yr(t.length,`run`),i&&yr(i,`gate ask`)];return{key:e,title:_r(e,r),sum:o.filter(Boolean).join(` · `),runs:t,gate:i?{title:a,n:i}:null}})}var xr=500;function Sr({vals:e,i:t,sweep:n=!1}){let r=(0,B.useRef)(null),i=e.join(`,`);(0,B.useLayoutEffect)(()=>{if(n&&r.current&&E())return k(r.current,{strokeDasharray:1,strokeDashoffset:1}),O(T(r.current,{strokeDashoffset:[1,0],duration:xr,ease:`outExpo`}),xr)},[i,n]);let a=Math.max(1,...e),o=96/(e.length-1),s=e.map((e,t)=>`${(t*o).toFixed(1)},${(20-e/a*17).toFixed(1)}`),[c,l]=s[s.length-1].split(`,`);return(0,q.jsxs)(`svg`,{className:`spark`,viewBox:`0 0 96 22`,"aria-hidden":`true`,style:{"--i":t},children:[(0,q.jsx)(`polyline`,{points:`0,21 96,21`,className:`spk-base`}),(0,q.jsx)(`polygon`,{className:`spk-area`,points:`0,21 ${s.join(` `)} 96,21`}),(0,q.jsx)(`polyline`,{className:`spk-line`,pathLength:`1`,points:s.join(` `),ref:r}),(0,q.jsx)(`circle`,{className:`spk-end`,cx:c,cy:l,r:`2.4`})]})}function Cr(e,t){let n=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let e=n.current?[...n.current.querySelectorAll(`[data-sweep]`)]:[];if(e.length&&E())return k(e,{[t]:0}),O(T(e,{[t]:[0,1],duration:xr,ease:`outExpo`}),xr)},[e,t]),n}var Y={security:`oklch(0.74 0.085 45)`,verify:`oklch(0.78 0.075 200)`,process:`oklch(0.76 0.075 150)`,craft:`oklch(0.78 0.085 95)`,context:`oklch(0.74 0.08 280)`,comms:`oklch(0.76 0.085 345)`},wr={security:{label:`Security`,c:Y.security},verify:{label:`Verification`,c:Y.verify},process:{label:`Process`,c:Y.process},craft:{label:`Craft`,c:Y.craft},context:{label:`Context`,c:Y.context},comms:{label:`Communication`,c:Y.comms}},Tr={craft:Y.craft,rigor:Y.verify,ops:Y.process,process:Y.security,comms:Y.comms},Er=e=>Tr[e]||`var(--text-3)`,Dr={design:{label:`Design`,c:Y.context},build:{label:`Build`,c:Y.craft},review:{label:`Review`,c:Y.security},ship:{label:`Ship`,c:Y.process},understand:{label:`Understand`,c:Y.verify},learn:{label:`Learn`,c:Y.comms},harness:{label:`Harness`,c:`oklch(0.76 0.07 250)`},personal:{label:`Personal`,c:`oklch(0.72 0.025 250)`}},Or=Object.keys(Dr);function kr(e){let t=String(e||``),n=/\(retired\)\s*$/i.test(t);t=t.replace(/\s*\(retired\)\s*$/i,``),t=t.replace(/^(?:Rule\s+[IVXLCDM\d]+|Doctrine\s+[a-z]+\s+\d+)\s*[—-]\s*/i,``);let r=t.indexOf(` · `);return r===-1?{latin:``,name:t.trim(),retired:n}:{latin:t.slice(0,r).trim(),name:t.slice(r+3).trim(),retired:n}}var Ar=[[10,`X`],[9,`IX`],[5,`V`],[4,`IV`],[1,`I`]],jr=e=>{let t=``;for(let[n,r]of Ar)for(;e>=n;)t+=r,e-=n;return t};function Mr(e){let t=/^([a-z]+)-(\d+)$/.exec(String(e));return t?t[1]===`law`?jr(Number(t[2])):`${t[1]}.${t[2]}`:String(e)}var Nr=new Set([`I`,`III`,`IV`,`process.1`,`process.5`,`rigor.5`,`ops.2`]),Pr={I:{key:`secretsGate`,label:`Secrets gate`},III:{key:`doneGate`,label:`Done gate`},IV:{key:`deletionGate`,label:`Deletion gate`}},Fr={I:{arm:`Writes that would carry a credential-shaped string are refused again.`,off:`A write carrying a credential-shaped string (on OpenCode, also a write to a key file) stops being refused. Rule I’s text still binds the agent; protected checks, real data loss and commit/push consent stay gated.`},III:{arm:`A turn that edited files cannot end before the project’s declared checks pass.`,off:`A turn that edited files may end without the checks in .geneseed/done-checks.txt passing. Rule III’s text still binds the agent; every other gate stays.`},IV:{arm:`Commands that would lose data nothing else holds ask again.`,off:`Commands that would really lose data — discarding uncommitted work, deleting an unpushed branch, removing untracked files — stop asking. Rule IV’s text still binds the agent; secrets, root-wide scans and commit/push consent stay gated.`}},Ir=[{key:`invariants`,source:`{{LAWS}}`,against:`—`},{key:`yours`,source:`user-rules.md`,against:`may tighten a {{LAW}}, never repeal one`},{key:`ethos`,source:`{{ONTOLOGY}}`,against:`never against a user rule`},{key:`doctrines`,source:`{{DOCTRINES}}`,against:`may tighten, never repeal`}],Lr=[{source:`mode`,label:`Mode`,against:`binds how work runs`},{source:`PROFILE.md, posture, theme`,label:`Profile, posture, theme`,against:`inform only; never bind`}],Rr=(e,t={})=>Pr[e]&&t?.[Pr[e].key]===!1?`Gate off`:Nr.has(e)?`Hook gate`:`Instruction`;function zr(e){let t={};for(let n of e||[]){let e=Dr[n.klass]?n.klass:`personal`,r=t[e]||(t[e]={key:e,label:Dr[e].label,ok:0,exp:0});n.status===`experimental`?r.exp+=1:r.ok+=1}let n=Or.filter(e=>t[e]).map(e=>({...t[e],n:t[e].ok+t[e].exp}));return{rows:n,total:n.reduce((e,t)=>e+t.n,0),experimental:n.reduce((e,t)=>e+t.exp,0),max:Math.max(1,...n.map(e=>e.n))}}var X=(e,t,n=t+`s`)=>`${e} ${e===1?t:n}`;function Br({overview:e,setup:t,rules:n,activity:r,profile:i,skills:a,laws:o}){let s=[],c=e?.doctor;c&&!c.ok&&s.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${X(c.problems.length,`problem`)}`,detail:c.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});let l=e?.diff,u=K(l);u&&s.push({id:`drift`,tag:`Drift`,tone:`warn`,title:`${X(u,`file`)} drifted from the source`,detail:`${l.edited} edited, ${l.added} added, ${l.missing} missing`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`}),i?.seeded&&s.push({id:`profile`,tag:`Profile`,tone:`warn`,title:`Profile is still the seeded template`,detail:`every section holds placeholder text`,where:`personal/profile`,verb:`Fill in`,href:`#/personal/profile`});let d=n?.exists?n.stats:null;d&&d.rules===0&&s.push({id:`rules`,tag:`Rules`,tone:``,title:`No standing rules yet`,detail:`0 of ${d.max_rules} · ${d.tokens} of ${d.max_tokens} tokens`,where:`personal/rules`,verb:`Write a rule`,href:`#/personal/rules`});let f=Object.entries(t?.gates?.asks||{}).sort((e,t)=>t[1]-e[1]);if(f.length){let[e,n]=f[0],r=Mr(e),i=(o?.items||[]).find(e=>e.name===r),a=i?kr(i.title).name:r;s.push({id:`gates`,tag:`Gates`,tone:``,title:`${a} asked ${X(n,`time`)}`,detail:`${n} of ${t.gates.total} gate asks`,where:r,verb:`Review`,href:`#/item/law/${encodeURIComponent(r)}`})}if(a){let{rows:e,experimental:t}=zr(a.items);t&&s.push({id:`skills`,tag:`Skills`,tone:``,title:`${X(t,`skill`)} still experimental`,detail:e.filter(e=>e.exp).sort((e,t)=>t.exp-e.exp).map(e=>`${e.label.toLowerCase()} ${e.exp}`).join(`, `),where:`library/skills`,verb:`Triage`,href:`#/skills`})}return t&&t.facts===0&&s.push({id:`memory`,tag:`Memory`,tone:``,title:`Memory holds no facts`,detail:`MEMORY.md is an empty index`,where:`library/memory`,verb:`Open`,href:`#/section/memory`}),r&&r.enabled===!1&&s.push({id:`activity`,tag:`Activity`,tone:``,title:`Session tracking is off`,detail:`no per-session trace is kept`,where:`activity`,verb:`Turn on`,href:`#/activity`}),s}var Vr=e=>K(e.drift),Hr=e=>e.drift?.stale??0;function Ur(e){let t=t=>new Set((e?.never||[]).filter(e=>e.kind===t).map(e=>e.name)).size;return{skills:t(`skill`),agents:t(`agent`)}}function Wr(e){let t=e?.installs||[],n=t.filter(e=>e.state===`active`),r=t.length-n.length,i=n.filter(e=>e.verdict===`behind`).length,a=n.reduce((e,t)=>e+Vr(t),0),o=n.reduce((e,t)=>e+Hr(t),0),s=e?.doctor,c=s&&!s.ok?`bad`:i||a||o?`warn`:`good`,l={good:`Harness healthy.`,warn:`Harness needs a look.`,bad:`Harness has problems.`}[c],u=[X(n.length,`active install`)+(r?`, ${r} disabled`:``),s?s.ok?`doctor clean`:`doctor found ${X(s.problems.length,`problem`)}`:`doctor not run yet`,i?`${X(i,`install`)} behind source`:`all in step with source`,a?`${X(a,`file`)} hand-edited`:`no hand edits`];return o&&u.push(`${X(o,`file`)} behind source`),{tone:c,head:l,facts:u}}var Gr=[[`carrier`,`Root file`],[`skills`,`Skill list`],[`agents`,`Agent list`],[`context`,`Session files`]],Kr=e=>e?e.carrier+e.skills+e.agents+e.context:0,qr=e=>e.state===`active`&&(e.verdict===`behind`||K(e.drift)>0||(e.drift?.stale??0)>0),Z=e=>`≈${(e/4/1e3).toFixed(1)}k`,Jr=e=>`${e.host} · ${e.scope}`,Yr=e=>({id:e.id,host:e.host,path:e.path,label:Jr(e)});function Xr({fleet:e,usage:t,...n}){let r=[],i=e?.doctor;i&&!i.ok&&r.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${X(i.problems.length,`problem`)}`,detail:i.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});for(let t of(e?.installs||[]).filter(e=>e.state===`active`)){if(t.verdict===`behind`){let e=t.built_epoch?`built ${Ot(t.built_epoch)} ago`:`never built`,n=Hr(t);r.push({id:`behind:${t.id}`,tag:`Behind`,tone:`warn`,title:`${Jr(t)} is behind its source`,detail:n?`${e} · ${X(n,`file`)} behind`:e,where:t.host,verb:`Rebuild`,act:`rebuild`,installs:[Yr(t)]})}let e=Vr(t);e&&r.push({id:`drift:${t.id}`,tag:`Drift`,tone:`warn`,title:`${Jr(t)}: ${X(e,`file`)} edited by hand`,detail:`${t.drift.edited} edited, ${t.drift.added} added, ${t.drift.missing} missing`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`})}if(t&&t.days_counted>=30&&t.never?.length){let{skills:e,agents:n}=Ur(t);r.push({id:`usage`,tag:`Usage`,tone:``,sugg:!0,title:`${X(e,`skill`)} never fired in 30 days`,detail:`${X(n,`agent`)} too`,where:`library/skills`,verb:`Triage`,href:`#/skills`})}let a=Br({...n,overview:n.overview&&{...n.overview,doctor:null,diff:null}});for(let e of a)r.push({...e,sugg:!0});return r}function Zr(e,t){return(e?.rules||[]).map(e=>{let n=Mr(e.rule),r=(t?.items||[]).find(e=>e.name===n);return{...e,name:r?kr(r.title).name:e.rule===`wiki`?`Wiki guard`:n}})}var Qr=e=>(e||[]).filter(e=>e.state===`active`&&e.cost);function $r(e){let t=Qr(e).filter(e=>e.cost.ceiling>0&&Number.isFinite(e.cost.carrier)),n=e=>e.cost.carrier/e.cost.ceiling,r=t.find(e=>e.selected)||t.reduce((e,t)=>!e||n(t)>n(e)?t:e,null);if(!r)return null;let{carrier:i,ceiling:a}=r.cost;return{label:`${r.host} · ${r.scope}`,carrier:i,ceiling:a,pct:Math.round(n(r)*100),selected:!!r.selected}}function ei(e){let t=Qr(e);if(!t.length)return null;let n=t.reduce((e,t)=>Kr(t.cost)>Kr(e.cost)?t:e),r=t.map(e=>Kr(e.cost)),i=t.find(e=>e.selected)||n;return{min:Math.min(...r),max:Math.max(...r),top:n,shown:i}}var ti=e=>(e?.per_day||[]).reduce((e,t)=>e+t,0);function ni(e,t){let n=Zr(e,t),r=n.reduce((e,t)=>e+t.n,0),i=n.reduce((e,t)=>!e||t.n>e.n?t:e,null),a=[];for(let e of n)(e.per_day||[]).forEach((e,t)=>{a[t]=(a[t]||0)+e});return{total:r,top:i?{name:i.name,n:i.n}:null,perDay:a}}var Q=e=>e.catch(()=>null),ri=(e,t)=>`${t?Math.min(100,e/t*100):0}%`,ii=36e5,ai=5e3;function oi({update:e,onAction:t,canFill:n=!0}){if(!e)return null;let r=e.install??(e.git?`git`:`npm-global`),i=r===`git`&&typeof e.behind==`number`?e.behind:null,a=i===null?e.latest===null?(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · `,e.checking?`checking…`:`update check unavailable`]}):e.available?(0,q.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current,` `,(0,q.jsxs)(`span`,{className:`ver-new`,children:[e.latest,` available`]})]}):(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current,` · latest`]}):i>0?(0,q.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current??``,` `,(0,q.jsxs)(`span`,{className:`ver-new`,children:[i,` commit`,i===1?``:`s`,` to pull`]})]}):(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · up to date`]});if(r===`other`)return!e.available||!e.command?a:(0,q.jsxs)(q.Fragment,{children:[a,(0,q.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,q.jsx)(`code`,{className:`mono`,children:e.command})]})]});if(r!==`git`&&!e.available)return a;let o=i===null?!!e.available:i>0;return(0,q.jsxs)(q.Fragment,{children:[a,(0,q.jsx)(`button`,{type:`button`,className:o&&n?`btn`:`btn ghost`,title:r===`git`?i===0?`Nothing to pull: up to date with upstream. Pulls and rebuilds every install anyway.`:`git pull, then rebuild every install`:`npm install -g geneseed@latest, then rebuild every install`,onClick:()=>t(`update`),children:`Update`})]})}var si={good:`M8 12.5l2.7 2.7L16 9.5M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`,warn:`M12 3 22 20H2zM12 10v4M12 17v.5`,bad:`M9 9l6 6M15 9l-6 6M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`};function ci({tone:e}){return(0,q.jsx)(`svg`,{className:`health-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:si[e]||si.warn})})}function li({fleet:e,error:t,behind:n,onAction:r,onRebuild:i}){let a=(0,q.jsx)(`button`,{type:`button`,className:`btn ghost ldg-doctor`,onClick:()=>r(`doctor`),children:`Run doctor`});if(!e)return t?(0,q.jsxs)(`section`,{className:`health unknown`,"aria-labelledby":`ldg-health`,children:[(0,q.jsx)(ci,{tone:`warn`}),(0,q.jsx)(`div`,{className:`health-text`,role:`status`,children:(0,q.jsx)(`h2`,{id:`ldg-health`,children:`Status unknown`})}),(0,q.jsx)(`div`,{className:`health-acts`,children:a})]}):(0,q.jsx)(`div`,{className:`health unknown`,"aria-busy":`true`});let o=Wr(e),s=[...o.facts,...e.version?[`Source is ${e.version}`]:[]];return(0,q.jsxs)(`section`,{className:`health ${o.tone}`,"aria-labelledby":`ldg-health`,children:[(0,q.jsx)(ci,{tone:o.tone}),(0,q.jsxs)(`div`,{className:`health-text`,role:`status`,children:[(0,q.jsx)(`h2`,{id:`ldg-health`,children:o.head}),(0,q.jsxs)(`p`,{className:`health-facts`,children:[s.join(` · `),`.`]})]}),(0,q.jsxs)(`div`,{className:`health-acts`,children:[a,n.length?(0,q.jsxs)(`button`,{type:`button`,className:`btn`,title:`Rebuilds ${n.map(e=>e.label).join(`, `)}`,onClick:()=>i(n),children:[`Rebuild all behind (`,n.length,`)`]}):null]})]})}function ui({chars:e}){let t=C(e);return(0,q.jsxs)(`span`,{className:`mono`,children:[Z(t??e),` tok`]})}var di=e=>Math.round(e/4),fi={carrier:`accent`,skills:`skill`,agents:`agent`,context:`context`},pi=e=>Gr.map(([t,n])=>({key:t,label:n,n:di(e[t]),tone:fi[t]})),mi=e=>`${e.host} · ${e.scope}`;function hi({cost:e,i:t}){let n=2*Math.PI*14,r=e.ceiling?Math.min(1,e.carrier/e.ceiling):0;return(0,q.jsxs)(`svg`,{className:`ldg-ring`,viewBox:`0 0 36 36`,"aria-hidden":`true`,children:[(0,q.jsx)(`circle`,{className:`bg`,cx:`18`,cy:`18`,r:14}),(0,q.jsx)(`circle`,{className:`fg`+(e.ceiling&&e.carrier>e.ceiling?` over`:``),cx:`18`,cy:`18`,r:14,strokeDasharray:n.toFixed(2),strokeDashoffset:(n*(1-r)).toFixed(2),style:{"--circ":n.toFixed(2),"--i":t}})]})}function gi({id:e,title:t,aside:n,className:r=``,children:i}){return(0,q.jsxs)(`section`,{className:`panel ldg-kpi ${r}`,"aria-labelledby":e,children:[(0,q.jsxs)(`div`,{className:`ldg-kpi-head`,children:[(0,q.jsx)(`h3`,{id:e,children:t}),n]}),i]})}function _i({installs:e}){let t=$r(e);return(0,q.jsx)(gi,{id:`ldg-k-root`,title:`Root file vs ceiling`,className:`ldg-kpi-root`,children:t?(0,q.jsxs)(`div`,{className:`ldg-kpi-ring`,children:[(0,q.jsxs)(`span`,{className:`ldg-ringbox`,children:[(0,q.jsx)(Kn,{value:di(t.carrier),max:di(t.ceiling),segments:t.pct>100?[{key:`v`,label:`root file`,n:di(t.carrier),tone:`bad`}]:void 0,size:64,stroke:7,label:`${t.selected?`Root file`:`Worst root file`}: ${t.label}, ${t.pct} percent of its ceiling`}),(0,q.jsxs)(`span`,{className:`mono ldg-ring-pct`,"aria-hidden":`true`,children:[t.pct,`%`]})]}),(0,q.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Z(t.carrier)} / ${Z(t.ceiling)} tokens`}),(0,q.jsx)(`span`,{className:`dim`,children:t.label})]})]}):(0,q.jsx)(`p`,{className:`dim`,children:`No root file to measure.`})})}function vi({installs:e}){let t=ei(e),n=t&&(Z(t.min)===Z(t.max)?Z(t.max):`${Z(t.min)} – ${Z(t.max)}`);return(0,q.jsx)(gi,{id:`ldg-k-cost`,title:`Loaded every turn`,className:`ldg-kpi-cost`,children:t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Z(Kr(t.shown.cost))} tokens`}),(0,q.jsx)(`span`,{className:`dim`,children:mi(t.shown)})]}),(0,q.jsx)(Jn,{parts:pi(t.shown.cost),label:`Loaded every turn, ${mi(t.shown)}`}),(0,q.jsx)(`span`,{className:`dim ldg-kpi-cap`,children:`All installs: ${n} tokens`})]}):(0,q.jsx)(`p`,{className:`dim`,children:`No install has a root file to measure.`})})}function yi({usage:e}){let t=e?.enabled?e.days_counted<30&&e.since?`since ${e.since}`:`30 days`:null;return(0,q.jsx)(gi,{id:`ldg-k-calls`,title:`Skill and agent calls`,className:`ldg-kpi-calls`,aside:t?(0,q.jsx)(`span`,{className:`mono dim ldg-kpi-aside`,children:t}):null,children:e?e.enabled?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:(0,q.jsx)(A,{value:ti(e)})}),e.per_day?.length>1?(0,q.jsx)(Sr,{vals:e.per_day,i:0}):null]}):(0,q.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`}):(0,q.jsx)(`p`,{className:`dim`,children:`Usage could not be read.`})})}function bi({gates:e,laws:t}){let n=ni(e,t);return(0,q.jsx)(gi,{id:`ldg-k-gates`,title:`Gate asks · 30 days`,className:`ldg-kpi-gates`,aside:(0,q.jsx)(`a`,{className:`ldg-kpi-aside`,href:`#/laws`,"aria-label":`Open the Constitution`,children:`Constitution →`}),children:e?n.total?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`ldg-kpi-line`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:n.total}),` `,(0,q.jsx)(`span`,{className:`dim`,children:`· ${n.top.name} ${n.top.n}`})]}),n.perDay.length>1?(0,q.jsx)(Sr,{vals:n.perDay,i:1}):null]}):(0,q.jsx)(`p`,{className:`dim`,children:`No gate asked in 30 days.`}):(0,q.jsx)(`p`,{className:`dim`,children:`Gate activity could not be read.`})})}var xi=6;function Si({i:e}){if(!e.diffable)return(0,q.jsx)(`span`,{className:`dim`,title:`Drift is only checked for global installs`,children:`not checkable`});let t=K(e.drift),n=e.drift?.stale??0;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-syncbar`,children:(0,q.jsx)(Jn,{parts:[{key:`stale`,label:`Behind source`,n,tone:`warn`},{key:`edited`,label:`Edited by hand`,n:t,tone:`bad`}],label:`Sync with source, ${mi(e)}`,legend:!1})}),t?(0,q.jsxs)(`span`,{className:`mono t-bad`,children:[t,` edited`]}):e.drift?.linked?(0,q.jsxs)(`span`,{className:`mono dim`,title:`Yours: links Geneseed leaves alone`,children:[e.drift.linked,` linked`]}):(0,q.jsx)(`span`,{className:`mono dim`,children:`none`}),n?(0,q.jsxs)(`div`,{className:`mono dim ldg-sub`,children:[n,` file`,n===1?``:`s`,` behind`]}):null]})}function Ci(e){if(!e.diffable)return`Not checkable: drift is only checked for global installs.`;let t=e.drift||{},n=[t.stale?`${t.stale} behind`:null,t.edited?`${t.edited} edited`:null,t.added?`${t.added} added`:null,t.missing?`${t.missing} missing`:null,t.linked?`${t.linked} linked (yours)`:null].filter(Boolean);return n.length?n.join(` · `):`Nothing differs.`}function wi({i:e,n:t,onRebuild:n,onOpen:r,busy:i}){let[a,o]=(0,B.useState)(!1),s=mi(e),c=(0,q.jsxs)(`td`,{className:`ldg-where`,children:[i?(0,q.jsx)(`span`,{className:`console-progress`,role:`progressbar`,"aria-label":`Rebuilding ${s}`}):null,(0,q.jsxs)(`div`,{className:`ldg-who`,children:[qr(e)?(0,q.jsx)(`svg`,{className:`ldg-glyph ${K(e.drift)?`bad`:`warn`}`,viewBox:`0 0 10 10`,role:`img`,"aria-label":K(e.drift)?`edited by hand`:`needs a rebuild`,children:(0,q.jsx)(`path`,{d:`M5 1 9 9H1z`,fill:`currentColor`})}):null,e.state===`active`&&e.cost?(0,q.jsx)(`span`,{className:`ldg-phone-ring`,"aria-hidden":`true`,children:(0,q.jsx)(hi,{cost:e.cost,i:t})}):null,(0,q.jsxs)(`div`,{className:`ldg-name`,children:[(0,q.jsx)(`span`,{className:`ldg-host`,children:e.host}),` `,(0,q.jsx)(`span`,{className:`dim`,children:e.scope}),(0,q.jsx)(`div`,{className:`mono dim ldg-path`,children:e.path})]})]})]});if(e.state!==`active`)return(0,q.jsxs)(`tr`,{className:`ldg-off`,children:[c,(0,q.jsx)(`td`,{className:`ldg-build`,children:(0,q.jsx)(`span`,{className:`pill off`,children:`disabled`})}),(0,q.jsx)(`td`,{className:`ldg-sync`}),(0,q.jsx)(`td`,{className:`ldg-root`}),(0,q.jsx)(`td`,{className:`ldg-total`}),(0,q.jsx)(`td`,{className:`ldg-act`,children:(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`})})]});let l={synced:(0,q.jsx)(`span`,{className:`pill good`,children:`in step`}),behind:(0,q.jsx)(`span`,{className:`pill warn`,children:`behind source`}),unknown:(0,q.jsx)(`span`,{className:`pill off`,children:`not checked`})}[e.verdict],u=Kr(e.cost),d=e.cost?.ceiling?Math.round(e.cost.carrier/e.cost.ceiling*100):null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`tr`,{className:a?`ldg-open`:``,children:[c,(0,q.jsxs)(`td`,{className:`ldg-build`,children:[l,(0,q.jsx)(`div`,{className:`mono dim ldg-sub`,children:e.built_epoch?`built ${Ot(e.built_epoch)} ago`:`never built`})]}),(0,q.jsx)(`td`,{className:`ldg-sync`,children:(0,q.jsx)(Si,{i:e})}),(0,q.jsx)(`td`,{className:`ldg-root`,children:e.cost?d===null?(0,q.jsx)(`span`,{className:`dim`,children:`no ceiling`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-rootbar`,children:(0,q.jsx)(Yn,{value:di(e.cost.carrier),max:di(e.cost.ceiling),label:`Root file, ${s}`,tone:d>100?`bad`:`accent`})}),(0,q.jsx)(`span`,{className:`mono dim ldg-sub`,children:`${Z(e.cost.carrier)} / ${Z(e.cost.ceiling)} · ${d}%`})]}):(0,q.jsx)(`span`,{className:`dim`,children:`not measured`})}),(0,q.jsx)(`td`,{className:`ldg-total`,children:e.cost?(0,q.jsx)(ui,{chars:u}):null}),(0,q.jsxs)(`td`,{className:`ldg-act`,children:[qr(e)?(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Rebuild ${s}`,title:`Rebuilds ${s} only`,onClick:()=>n([Yr(e)]),children:`Rebuild`}):(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`}),(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm ldg-toggle`,"aria-label":`Details for ${s}`,"aria-expanded":a,"aria-controls":a?`ldg-detail-${e.id}`:void 0,onClick:()=>o(e=>!e),children:(0,q.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:a?`M6 15l6-6 6 6`:`M6 9l6 6 6-6`})})})]})]}),a?(0,q.jsx)(`tr`,{className:`ldg-detail`,id:`ldg-detail-${e.id}`,children:(0,q.jsx)(`td`,{colSpan:xi,children:(0,q.jsxs)(`div`,{className:`ldg-detail-grid`,children:[(0,q.jsxs)(`div`,{className:`ldg-detail-col`,children:[e.cost?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-lbl`,children:`What rides every turn · ${Z(u)} tokens`}),(0,q.jsx)(Jn,{parts:pi(e.cost),label:s})]}):(0,q.jsx)(`span`,{className:`dim`,children:`Always-on cost not measured.`}),(0,q.jsx)(`span`,{className:`dim`,children:`Voice ${e.theme} · ${e.footprint} footprint`})]}),(0,q.jsxs)(`div`,{className:`ldg-detail-col`,children:[(0,q.jsx)(`span`,{className:`ldg-lbl`,children:`Differs from source`}),(0,q.jsx)(`span`,{className:`muted`,children:Ci(e)}),e.diffable?(0,q.jsx)(`span`,{children:(0,q.jsx)(`a`,{className:`btn ghost sm`,href:`#/installs/edits`,"aria-label":`View diff for ${s}`,children:`View diff`})}):null]})]})})}):null]})}function Ti({rows:e,onAction:t,onRebuild:n}){let r=e.filter(e=>!e.sugg).length;return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-needs`,children:[(0,q.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,q.jsx)(`h2`,{id:`ldg-needs`,children:`Needs you`}),(0,q.jsxs)(`span`,{className:`mono dim`,children:[r,` problem`,r===1?``:`s`,`, `,e.length-r,` suggestion`,e.length-r===1?``:`s`]})]}),e.length?(0,q.jsx)(`ul`,{className:`needs`,children:e.map(e=>(0,q.jsxs)(`li`,{className:e.sugg?`sugg`:``,children:[(0,q.jsx)(`span`,{className:`tag ${e.tone}`,children:e.tag}),(0,q.jsxs)(`span`,{className:`needs-what`,children:[(0,q.jsx)(`b`,{children:e.title}),e.detail?(0,q.jsxs)(`span`,{className:`dim`,children:[` · `,e.detail]}):null]}),(0,q.jsx)(`span`,{className:`mono dim needs-where`,children:e.where}),e.act?(0,q.jsx)(`button`,{type:`button`,className:`needs-verb linkish`,"aria-label":`${e.verb}: ${e.title}`,onClick:()=>e.installs?n(e.installs):t(e.act),children:e.verb}):(0,q.jsx)(`a`,{className:`needs-verb`,href:e.href,"aria-label":`${e.verb}: ${e.title}`,children:e.verb})]},e.id))}):(0,q.jsx)(`p`,{className:`needs-empty`,children:`Nothing needs you.`})]})}function Ei({usage:e}){let t=(0,q.jsxs)(`div`,{className:`panel-head`,children:[(0,q.jsx)(`h2`,{id:`ldg-usage`,children:`What fires`}),(0,q.jsx)(`span`,{className:`mono dim`,children:`skills and agents, 30 d`})]});if(!e)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`dim`,children:`Usage could not be read.`})]});if(!e.enabled)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`})]});if(e.days_counted<30)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`muted`,children:e.since?(0,q.jsxs)(q.Fragment,{children:[`Counting since `,(0,q.jsx)(`b`,{children:e.since}),`, `,e.days_counted,` of 30 days`]}):`No skill or agent call counted yet`}),(0,q.jsx)(`div`,{className:`daytrack`,"aria-hidden":`true`,children:Array.from({length:30},(t,n)=>(0,q.jsx)(`i`,{className:n<e.days_counted?`on`:``},n))}),(0,q.jsx)(`p`,{className:`dim chart-foot`,children:`Rankings and the never-fired count appear once 30 days are counted, so a new install is not told every skill is unused.`})]});let n=e.rows.slice(0,7),r=Math.max(1,...n.map(e=>e.n));return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`ul`,{className:`ubars`,children:n.map((e,t)=>(0,q.jsxs)(`li`,{className:e.kind,children:[(0,q.jsxs)(`span`,{className:`ub-name`,children:[e.name,` `,(0,q.jsx)(`span`,{className:`dim`,children:e.kind})]}),(0,q.jsx)(`span`,{className:`ub-trk`,children:(0,q.jsx)(`i`,{style:{width:ri(e.n,r),"--i":t}})}),(0,q.jsx)(`span`,{className:`mono`,children:e.n})]},`${e.install}:${e.kind}:${e.name}`))}),e.never.length?(0,q.jsxs)(`div`,{className:`ub-never`,children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`b`,{children:Ur(e).skills}),` skills never fired`]}),(0,q.jsx)(`a`,{className:`needs-verb`,href:`#/skills`,children:`Triage`})]}):null]})}function Di({overview:e,setup:t,runs:n,onAction:r,onRetry:i,dataRev:o,banner:s,view:c}){let l=an(),[u,d]=(0,B.useState)({}),{data:f,error:p,reload:m}=W(()=>a.fleet(),[o]),{data:h}=W(()=>Q(a.usage()),[o]),{data:g}=W(()=>Q(a.gates()),[o]),_=(0,B.useRef)(null),{data:v,reload:y}=W(()=>Q(a.update()).then(e=>(e?_.current=e:_.current?.checking&&(_.current={..._.current,checking:!1}),_.current)),[o]);(0,B.useEffect)(()=>{let e=setInterval(y,ii),t=()=>{document.visibilityState===`visible`&&y()};return document.addEventListener(`visibilitychange`,t),()=>{clearInterval(e),document.removeEventListener(`visibilitychange`,t)}},[y]);let b=!!v?.checking;(0,B.useEffect)(()=>{if(!b)return;let e=setTimeout(y,ai);return()=>clearTimeout(e)},[b,v,y]);let{data:x}=Wn(o),{data:S}=W(()=>Q(a.activity()),[o]),{data:C}=W(()=>Q(a.profile()),[o]),{data:w}=W(()=>Q(a.catalog(`skills`)),[o],`catalog:skills`),{data:T}=W(()=>Q(a.catalog(`laws`)),[o],`catalog:laws`),E=f?.installs||[],[D,O]=(0,B.useState)(``),k=async e=>{O(``);try{await a.selectView(e.host,e.path)}catch(t){O(`Could not open ${mi(e)}: ${t?.message||t}`);return}i?.(),window.location.hash=`#/installs/hosts`},A=Xr({fleet:f,usage:h,overview:e,setup:t,rules:x,activity:S,profile:C,skills:w,laws:T}),j=E.filter(qr).map(Yr),M=async e=>{let t=e.map(e=>e.label);if(!await l(`Rebuild ${t.join(`, `)}? Each is re-rendered from source with its own settings.`,{title:e.length===1?`Rebuild ${t[0]}?`:`Rebuild ${e.length} installs?`,confirmLabel:`Rebuild`}))return;let n=await r(`rebuild`,{installs:e.map(({host:e,path:t})=>({host:e,path:t}))});n&&d(t=>({...t,[n]:e.map(e=>e.id)}))},N=new Set(Object.entries(u).filter(([e])=>n?.find(t=>t.id===e)?.status===`running`).flatMap(([,e])=>e));return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Vn,{eyebrow:f?`${E.length} harness${E.length===1?``:`es`} installed on this machine`:null,title:`Overview`,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(oi,{update:v,onAction:r,canFill:!j.length}),c]})}),s,(0,q.jsxs)(`div`,{className:`ov-stack ldg`,children:[(0,q.jsx)(li,{fleet:f,error:p,behind:j,onAction:r,onRebuild:M}),(0,q.jsxs)(`div`,{className:`ldg-kpis`,role:`group`,"aria-labelledby":`ldg-kpis-h`,children:[(0,q.jsx)(`h2`,{id:`ldg-kpis-h`,className:`sr-only`,children:`Key figures`}),(0,q.jsx)(_i,{installs:E}),(0,q.jsx)(vi,{installs:E}),(0,q.jsx)(yi,{usage:h}),(0,q.jsx)(bi,{gates:g,laws:T})]}),(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-fleet`,children:[(0,q.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,q.jsx)(`h2`,{id:`ldg-fleet`,children:`Installed harnesses`}),f?.source_fp?(0,q.jsxs)(`span`,{className:`mono dim`,children:[`source `,f.source_fp]}):null]}),D?(0,q.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:D}):null,p&&f?(0,q.jsxs)(`p`,{className:`dim`,role:`status`,children:[`Could not refresh the installs — showing the last read.`,` `,(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:m,children:`Retry`})]}):null,(0,q.jsx)(`div`,{className:`ldg-scroll`,children:(0,q.jsxs)(`table`,{className:`ldg-fleet`,children:[(0,q.jsx)(`caption`,{className:`sr-only`,children:`Installs`}),(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{scope:`col`,children:`Install`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-build`,children:`Build`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-sync`,children:`Sync with source`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-root`,children:`Root file · ceiling`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-total`,children:`Always-on`}),(0,q.jsx)(`th`,{scope:`col`,children:(0,q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,q.jsxs)(`tbody`,{children:[p&&!f?(0,q.jsx)(`tr`,{children:(0,q.jsxs)(`td`,{colSpan:xi,children:[(0,q.jsx)(`span`,{className:`dim`,role:`status`,children:`Could not read the installs`}),` `,(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:m,children:`Retry`})]})}):null,E.map((e,t)=>(0,q.jsx)(wi,{i:e,n:t,onRebuild:M,onOpen:k,busy:N.has(e.id)},e.id))]})]})})]}),(0,q.jsxs)(`div`,{className:`ldg-bottom`,children:[(0,q.jsx)(Ti,{rows:A,onAction:r,onRebuild:M}),(0,q.jsx)(Ei,{usage:h})]})]})]})}var Oi=`geneseed-understand-seen`,ki=`understand`;function Ai(){try{let e=JSON.parse(localStorage.getItem(Oi));return Array.isArray(e)?e:[]}catch{return[]}}function ji(e){let t=Ai();if(t.includes(e))return t;let n=[...t,e];try{localStorage.setItem(Oi,JSON.stringify(n))}catch{}return n}function Mi(e,t){let n=e?.groups||[],r=n.findIndex(e=>e.id===ki),i=n[r]?.pages||[],a=i.findIndex(e=>e.id===t);if(a<0)return{prev:null,next:null};let o=n.slice(r+1).find(e=>e.pages.length);return{prev:i[a-1]||null,next:i[a+1]||o?.pages[0]||null}}function Ni(e,t){for(let n of e?.groups||[]){let e=n.pages.find(e=>e.id===t);if(e)return{part:n,section:e.section||`General`,page:e}}return{part:null,section:null,page:null}}function Pi(e,t){let{part:n,section:r}=Ni(e,t);if(!n)return{prev:null,next:null};if(n.id===`understand`)return Mi(e,t);let i=n.pages.filter(e=>(e.section||`General`)===r),a=i.findIndex(e=>e.id===t);return{prev:i[a-1]||null,next:i[a+1]||null}}var Fi=e=>`#/docs/`+encodeURIComponent(e);function Ii({pages:e,seen:t}){let n=e.filter(e=>t.includes(e.id)).length;return(0,q.jsx)(`div`,{className:`track-prog`,role:`progressbar`,"aria-label":`Pages read`,"aria-valuemin":0,"aria-valuemax":e.length,"aria-valuenow":n,children:(0,q.jsx)(`i`,{style:{width:`${n/(e.length||1)*100}%`}})})}function Li({menu:e,pageId:t}){let{prev:n,next:r}=Pi(e,t);return!n&&!r?null:(0,q.jsxs)(`nav`,{className:`track-bar`,"aria-label":`Pages`,children:[n?(0,q.jsxs)(`a`,{className:`track-card`,href:Fi(n.id),children:[(0,q.jsx)(`span`,{className:`track-card-lbl`,"aria-hidden":`true`,children:`Previous`}),(0,q.jsxs)(`span`,{className:`track-card-title`,children:[`← `,n.title]})]}):(0,q.jsx)(`span`,{}),r&&(0,q.jsxs)(`a`,{className:`track-card next`,href:Fi(r.id),children:[(0,q.jsx)(`span`,{className:`track-card-lbl`,"aria-hidden":`true`,children:`Next`}),(0,q.jsxs)(`span`,{className:`track-card-title`,children:[`Next: `,r.title,` →`]})]})]})}var Ri=`modulepreload`,zi=function(e){return`/`+e},Bi={},Vi=function(e){return e.pathname.endsWith(`.css`)},Hi=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=zi(t,n);let r=s(t),i=Vi(r);return Hi(Bi,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ri,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ui=`geneseed-newhere-dismissed`,Wi=(0,B.lazy)(()=>$(()=>import(`./Dashboard-DmKR3TQg.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5])));function Gi({harness:e}){let[t,n]=(0,B.useState)(()=>!!localStorage.getItem(Ui)),{data:r}=W(()=>t?Promise.resolve(null):a.docs(e).catch(()=>null),[t,e]),i=r?.groups?.find(e=>e.id===`understand`)?.pages||[],o=Ai(),s=i.findIndex(e=>!o.includes(e.id));if(t||!i.length||s<0)return null;let c=i.filter(e=>o.includes(e.id)).length;return(0,q.jsxs)(`section`,{className:`newhere`,"aria-label":`New here?`,children:[(0,q.jsxs)(`div`,{className:`newhere-body`,children:[(0,q.jsx)(`b`,{children:`New here? Understand your harness.`}),(0,q.jsxs)(`p`,{children:[i.length,` short pages: what a harness is, what was installed, what changes in your day, and what is guaranteed.`]}),(0,q.jsx)(`div`,{className:`newhere-dots`,"aria-label":`${c} of ${i.length} read`,children:i.map(e=>(0,q.jsx)(`i`,{className:o.includes(e.id)?`f`:``},e.id))})]}),(0,q.jsx)(`a`,{className:`btn ghost`,href:`#/docs/${encodeURIComponent(i[s].id)}`,children:c?`Continue · step ${s+1}`:`Start`}),(0,q.jsx)(`button`,{type:`button`,className:`newhere-x`,onClick:()=>{localStorage.setItem(Ui,`1`),n(!0)},title:`Dismiss for good`,"aria-label":`Dismiss`,children:`×`})]})}function Ki({layout:e,onLayout:t}){return(0,q.jsx)(gn,{"aria-label":`View`,children:ht.map(n=>(0,q.jsx)(`button`,{type:`button`,className:e===n.id?`on`:``,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id))})}function qi({overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c=`overview`,onLayout:l,dataRev:u}){let{data:d,loading:f}=W(()=>Promise.resolve().then(()=>a.installs()).catch(()=>null),[u],`installs`);if(!e)return t?(0,q.jsx)(An,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,q.jsx)(kn,{});if(!e.deployed){if(f&&!d)return(0,q.jsx)(kn,{});if(!d?.installs?.some(e=>e.state===`active`))return(0,q.jsx)(Un,{onAction:s})}let p=(0,q.jsx)(Gi,{harness:Qt(e.emit)}),m=l?(0,q.jsx)(Ki,{layout:c,onLayout:l}):null;return c===`overview`?(0,q.jsx)(Di,{overview:e,setup:i,runs:o,onAction:s,onRetry:n,dataRev:u,view:m,banner:(0,q.jsxs)(q.Fragment,{children:[e.daemon_stale?(0,q.jsx)(jn,{}):null,p]})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Vn,{title:`Overview`,sub:[e.theme&&`${e.theme} voice`,e.footprint&&`${e.footprint} footprint`,e.target].filter(Boolean).join(` · `),primary:(0,q.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s(`build-all`),children:`Rebuild`}),actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>s(`update`),children:`Update`}),(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>s(`doctor`),children:`Run doctor`}),m]})}),p,(0,q.jsx)(B.Suspense,{fallback:(0,q.jsx)(kn,{}),children:(0,q.jsx)(Wi,{overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c,dataRev:u})})]})}var Ji=(0,B.lazy)(()=>$(()=>import(`./Activity-BcwX4Zj2.js`),__vite__mapDeps([6,1,2,3,4,7,8]))),Yi=(0,B.lazy)(()=>$(()=>import(`./ActivityDetail-CDD7EM_5.js`),__vite__mapDeps([9,1,2,3,7,8]))),Xi=(0,B.lazy)(()=>$(()=>import(`./Library-dMx4l6kg.js`),__vite__mapDeps([10,1,2,3,4,5,7,11,12,13]))),Zi=(0,B.lazy)(()=>$(()=>import(`./Kits-Dl-wrVqw.js`),__vite__mapDeps([14,1,2,3,7,13,15,16]))),Qi=(0,B.lazy)(()=>$(()=>import(`./Loops-BfoE72d9.js`),__vite__mapDeps([17,1,2,3,7,8,11,12,18,13,16]))),$i=(0,B.lazy)(()=>$(()=>import(`./Laws-BD3DVthD.js`),__vite__mapDeps([19,1,2,3,7,12,13]))),ea=(0,B.lazy)(()=>$(()=>import(`./Personal-Be0vEjUH.js`),__vite__mapDeps([20,1,2,3,7,13,21,10,4,5,11,12]))),ta=(0,B.lazy)(()=>$(()=>import(`./Installs-DlxyaW98.js`),__vite__mapDeps([22,1,2,3,4,7,21,15]))),na=(0,B.lazy)(()=>$(()=>import(`./Docs-CuwD_7Yq.js`),__vite__mapDeps([23,1,2,3,4,7,11,12,18,13])));function ra(){let e=ge(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),[o,s]=Ke(),[c,l]=Ze(),[u,d]=pt(),f=e=>{if(e===c)return;let t=()=>{l(e),d(`curated`)};if(!document.startViewTransition||!E())return t();document.startViewTransition(()=>(0,se.flushSync)(t))},[p,m]=vt(),[h,g]=(0,B.useState)(()=>{try{return!window.sessionStorage.getItem(`gs-booted`)}catch{return!0}}),[_,v]=(0,B.useState)(!1),y=(0,B.useRef)(null),b=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!_)return;let e=e=>{e.key===`Escape`&&v(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_]),(0,B.useEffect)(()=>{if(!_)return;let e=b.current,t=document.activeElement;return e&&(e.inert=!0),document.getElementById(`rail-nav`)?.focus(),()=>{e&&(e.inert=!1),t instanceof HTMLElement&&t.focus()}},[_]);let x=e=>n({kind:e?.body?.kind||`err`,msg:e?.body?.message||e.message}),{overview:S,error:C,themes:w,reload:T}=yt(x),[D,O]=(0,B.useState)(0),k=()=>{T(),O(e=>e+1)},[A,j]=(0,B.useState)(null),{runs:M,activeId:N,consoleOpen:P,setConsoleOpen:F,runAction:I,cancelJob:ee,clearRuns:te}=xt({onFinish:e=>{k(),j({status:e,at:Date.now()})},onError:x}),{data:L}=W(()=>a.setup().catch(()=>null),[D],`setup`),{data:ne}=W(()=>a.installs().catch(()=>null),[D],`installs`),re=ne?.installs||null,ie=M[M.length-1],ae=ie?ie.status===`running`?`${ie.action} running`:`${ie.action} ${ie.status}`:``;(0,B.useEffect)(()=>{let e=y.current;if(e){if(!Ue(e,lt(u),o)){let t=dt(u);t?Se(e,t,o):we(e,c,o)}document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,getComputedStyle(e).getPropertyValue(`--bg`).trim())}},[o,u,c]);let R=[{title:`Rebuild all`,desc:`Re-emit every install`,run:()=>I(`build-all`),confirm:{msg:`Rebuild every install from the current sources?`,title:`Rebuild all?`,confirmLabel:`Rebuild all`}},{title:`Update`,desc:`Pull the latest Geneseed; the server restarts after`,run:()=>I(`update`),confirm:{msg:`Update Geneseed? The server restarts when the update ends.`,title:`Update Geneseed?`,confirmLabel:`Update`}},{title:`Run doctor`,desc:`Read-only health check`,run:()=>I(`doctor`)},{title:`Restart server`,desc:`Restart the local Geneseed server`,run:()=>rt().catch(x),confirm:{msg:`Restart the local Geneseed server? The console reconnects in a moment.`,title:`Restart the server?`,confirmLabel:`Restart`}},{title:o===`light`?`Switch to dark mode`:`Switch to light mode`,desc:`Appearance`,run:s},...Je.filter(e=>e.id!==c).map(e=>({title:`Flavour: ${e.name}`,desc:e.tagline,run:()=>f(e.id)}))].map(e=>({kind:`Actions`,hay:`${e.title} ${e.desc}`.toLowerCase(),...e})),oe={flavour:c,onFlavour:f,accentMode:u,onAccentMode:d,layout:p,onLayout:m};return(0,q.jsx)(`div`,{className:`app fl-${c} ${o===`light`?`light`:``}${_?` nav-open`:``}`,ref:y,children:(0,q.jsxs)(on,{children:[(0,q.jsx)(`div`,{className:`atmos`,"aria-hidden":`true`}),(0,q.jsx)(`a`,{className:`skip-link`,href:`#main`,onClick:e=>{e.preventDefault(),document.getElementById(`main`)?.focus()},children:`Skip to content`}),(0,q.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:ae}),_&&(0,q.jsx)(`button`,{type:`button`,className:`nav-scrim`,"aria-label":`Close navigation`,onClick:()=>v(!1)}),(0,q.jsx)(Vt,{route:e,overview:S,installs:re,onOpenVoice:()=>i(e=>!e),onNavigate:()=>v(!1)}),r&&(0,q.jsx)(bn,{themes:w,current:S?.theme,onPick:e=>{i(!1),I(`build`,{theme:e,emit:S?.emit})},onClose:()=>i(!1)}),(0,q.jsxs)(`div`,{className:`col`,ref:b,children:[(0,q.jsx)(yn,{route:e,navOpen:_,onToggleNav:()=>v(e=>!e),overview:S,installs:re,actions:R,mode:o,onToggleMode:s,appearance:oe,dataRev:D,onSwitch:k}),(0,q.jsx)(`main`,{className:`page`,id:`main`,tabIndex:-1,children:(0,q.jsx)(`div`,{className:[`library`,`kits`,`loops`,`docs`].includes(e.page)?`pad pad-wide`:`pad`,children:(0,q.jsx)(zn,{activeId:N,finish:A,children:(0,q.jsx)(Pn,{children:(0,q.jsx)(B.Suspense,{fallback:(0,q.jsx)(kn,{}),children:{overview:()=>(0,q.jsx)(qi,{overview:S,overviewError:C,onRetry:T,themes:w,setup:L,runs:M,onAction:I,layout:p,onLayout:m,dataRev:D}),laws:()=>(0,q.jsx)($i,{selected:e.item,overview:S,setup:L,onAction:I,dataRev:D}),library:()=>(0,q.jsx)(Xi,{overview:S,section:e.section,selected:e.item,dataRev:D}),kits:()=>(0,q.jsx)(Zi,{item:e.item,onAction:I,dataRev:D}),loops:()=>(0,q.jsx)(Qi,{tab:e.tab,item:e.item,dataRev:D}),personal:()=>(0,q.jsx)(ea,{tab:e.tab,item:e.item,setup:L,dataRev:D}),installs:()=>(0,q.jsx)(ta,{tab:e.tab,overview:S,setup:L,themes:w,onAction:I,onMutated:k,dataRev:D,appearance:oe}),activity:()=>e.item?(0,q.jsx)(Yi,{sid:e.item},e.item):(0,q.jsx)(Ji,{}),docs:()=>(0,q.jsx)(na,{page:e.item,onAction:I,overview:S})}[e.page]?.()})},e.page)})})}),(0,q.jsx)(Ut,{route:e,navOpen:_,onMore:()=>v(!0)}),(0,q.jsx)(Cn,{runs:M,open:P,busy:!!N,finish:A,onToggle:()=>F(e=>!e),onClear:te,onCancel:ee})]}),(0,q.jsx)(Sn,{toast:t,onClose:()=>n(null)}),h&&(0,q.jsx)(On,{ready:!!S||!!C,onDone:()=>{try{window.sessionStorage.setItem(`gs-booted`,`1`)}catch{}g(!1)}})]})})}(0,ce.createRoot)(document.getElementById(`root`)).render((0,q.jsx)(ra,{})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).catch(()=>{})});export{Qt as $,fr as A,Gn as B,dr as C,te as Ct,ar as D,ir as E,tr as F,Bn as G,Un as H,Qn as I,kn as J,jn as K,Yn as L,gr as M,Cr as N,br as O,Zn as P,Xt as Q,Jn as R,Er as S,ae as St,cr as T,Vn as U,Wn as V,In as W,gn as X,_n as Y,an as Z,kr as _,H as _t,Fi as a,J as at,Dr as b,he as bt,Ai as c,Mt as ct,Fr as d,Pt as dt,Zt as et,Pr as f,W as ft,Mr as g,Je as gt,Rr as h,rt as ht,Ii as i,Kt as it,vr as j,ur as k,Wr as l,jt as lt,Lr as m,ft as mt,Li as n,Gt as nt,ji as o,K as ot,Ir as p,ht as pt,An as q,ki as r,Jt as rt,Ni as s,Nt as st,$ as t,Wt as tt,Zr as u,Ot as ut,wr as v,le as vt,Sr as w,Or as x,z as xt,Tr as y,_e as yt,Kn as z};
|