geneseed 5.0.3 → 5.0.4
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 +38 -0
- package/README.md +3 -3
- package/SHIPPED.md +2 -2
- package/adapters/claude-code/README.md +5 -1
- package/adapters/openclaude/README.md +3 -1
- package/adapters/opencode/plugins/geneseed-workflow.js +1 -1
- package/adapters/opencode/workflows/_runtime.js +1 -1
- package/bin/geneseed-cli.mjs +3 -0
- package/bin/geneseed-hook.mjs +10 -2
- package/docs/PRD.md +1 -1
- package/docs/README.md +4 -1
- package/docs/concepts/enforcement-table.md +1 -1
- package/docs/concepts/exclusions.md +1 -1
- package/docs/concepts/factories.md +151 -0
- package/docs/concepts/hooks.md +1 -1
- package/docs/concepts/host-matrix.md +1 -0
- package/docs/concepts/loop-gates.md +3 -0
- package/docs/concepts/loops.md +1 -0
- package/docs/concepts/rules.md +1 -1
- package/docs/extending.md +5 -1
- package/docs/guides/autostart.md +2 -0
- package/docs/guides/run-a-factory.md +88 -0
- package/docs/guides/set-up-ownership.md +1 -0
- package/docs/reference/factory-actions.md +22 -0
- package/docs/reference/loop-actions.md +1 -1
- package/docs/reference/plugin-activity.md +1 -1
- package/docs/web-ui.md +35 -2
- package/harness.config.json +1 -1
- package/js/README.md +20 -2
- package/js/build/args.mjs +14 -2
- package/js/build/source.mjs +19 -0
- package/js/cli-table.json +166 -2
- package/js/factory/cli.mjs +153 -0
- package/js/factory/graph.mjs +245 -0
- package/js/factory/registry.mjs +71 -0
- package/js/factory/state.mjs +429 -0
- package/js/hosts/activity.mjs +3 -3
- package/js/hosts/geneseed-dir.mjs +1 -1
- package/js/hosts/gitref.mjs +21 -0
- package/js/hosts/hooks-context.mjs +63 -9
- package/js/hosts/hooks-prims.mjs +1 -1
- package/js/hosts/settings.mjs +5 -4
- package/js/inspect/checks-authoring.mjs +11 -1
- package/js/inspect/cost.mjs +91 -5
- package/js/inspect/doctor.mjs +2 -1
- package/js/inspect/inventory.mjs +1 -1
- package/js/loop/catalog.mjs +24 -12
- package/js/loop/cli.mjs +21 -15
- package/js/loop/graph.mjs +13 -4
- package/js/loop/registry.mjs +65 -28
- package/js/loop/state.mjs +18 -8
- package/js/web/api.mjs +43 -1
- package/js/web/catalog.mjs +38 -2
- package/js/web/daemon.mjs +136 -6
- package/js/web/handler.mjs +14 -5
- package/js/web/routes.mjs +10 -3
- package/js/web/server.mjs +4 -1
- package/package.json +1 -1
- package/registry.json +14 -0
- package/src/AGENT.md.tmpl +5 -7
- package/src/bricks/docs-update.md +5 -0
- package/src/bricks/holdout-write.md +23 -0
- package/src/bricks/holdout.md +25 -0
- package/src/bricks/intake.md +18 -0
- package/src/bricks/merge-gate.md +22 -0
- package/src/bricks/pr-open.md +21 -0
- package/src/bricks/retro.md +17 -0
- package/src/bricks/test.md +4 -1
- package/src/bricks/triage.md +19 -0
- package/src/doctrines/comms.md +29 -41
- package/src/doctrines/craft.md +3 -10
- package/src/doctrines/ops.md +4 -15
- package/src/doctrines/rigor.md +1 -5
- package/src/factories/analysis-to-build.json +34 -0
- package/src/factories/bug-report-to-fix.json +32 -0
- package/src/factories/issue-to-pr.json +49 -0
- package/src/skills/_checkpoints.md +1 -0
- package/src/skills/adhd.md +1 -1
- package/src/skills/factory-forge.md +97 -0
- package/src/skills/factory.md +126 -0
- package/src/skills/parallel-agents.md +1 -1
- package/src/skills/workflow.md +2 -1
- package/themes/_TEMPLATE.json +4 -2
- package/themes/biker.json +4 -2
- package/themes/commentator.json +4 -2
- package/themes/cyberpunk.json +4 -2
- package/themes/gamer.json +4 -2
- package/themes/imperial.json +4 -2
- package/themes/joker.json +4 -2
- package/themes/marvin.json +4 -2
- package/themes/mean.json +4 -2
- package/themes/military.json +4 -2
- package/themes/neutral.json +4 -2
- package/themes/pirate.json +4 -2
- package/themes/sports.json +4 -2
- package/themes/verstappen.json +4 -2
- package/themes/wizard.json +4 -2
- package/web/dist/assets/ActiveLoops-BTHIaRhn.js +1 -0
- package/web/dist/assets/{Activity-Ck_Xffpo.js → Activity-BaoxwVFH.js} +1 -1
- package/web/dist/assets/{ActivityDetail-CBxVS4mU.js → ActivityDetail-C_bFD0rW.js} +1 -1
- package/web/dist/assets/{Bonsai-BlOwsvW6.js → Bonsai-B01lLf0m.js} +1 -1
- package/web/dist/assets/{CopyButton-DFMOIGbe.js → CopyButton-Bc66KPyA.js} +1 -1
- package/web/dist/assets/Dashboard-X7GZzGJp.js +2 -0
- package/web/dist/assets/{Docs-D_2Jt6gU.js → Docs-LRYVnGLG.js} +2 -2
- package/web/dist/assets/Factories-ARenKBiP.js +1 -0
- package/web/dist/assets/{GreenhouseView-WalcX5bp.js → GreenhouseView-CfWR2-sX.js} +1 -1
- package/web/dist/assets/{Installs-UGiPDMDt.js → Installs-nfFHnovH.js} +3 -3
- package/web/dist/assets/{JournalView-CZtXQz-v.js → JournalView-lpOHcHKK.js} +1 -1
- package/web/dist/assets/{Kits-XQHsazCN.js → Kits-Bw5EQl_i.js} +1 -1
- package/web/dist/assets/Laws-CnZJ0wjZ.js +4 -0
- package/web/dist/assets/LibRows-Hqvf1beK.js +1 -0
- package/web/dist/assets/Library-JaSsp6Yr.js +3 -0
- package/web/dist/assets/Loops-ZaHC5MVl.js +2 -0
- package/web/dist/assets/{OperatorHudView-CeDw5qMB.js → OperatorHudView-CggG0_sK.js} +1 -1
- package/web/dist/assets/{Personal-PVmGA2-M.js → Personal-BObvlb70.js} +2 -2
- package/web/dist/assets/{Settings-DWuxwh4i.js → Settings-BFfPMPc9.js} +1 -1
- package/web/dist/assets/{Tabs-d2RIRAKT.js → Tabs-B594Pad_.js} +1 -1
- package/web/dist/assets/api-DLDVY3K-.js +1 -0
- package/web/dist/assets/{index-BNttaGQb.js → index-DsLmKHw0.js} +3 -3
- package/web/dist/assets/index-DvPjphz0.css +1 -0
- package/web/dist/index.html +3 -3
- package/web/dist/assets/Dashboard-BUdUTjbB.js +0 -2
- package/web/dist/assets/Laws-B6A55S-2.js +0 -4
- package/web/dist/assets/Library-D7L0Wdbh.js +0 -3
- package/web/dist/assets/Loops-C0loS73u.js +0 -2
- package/web/dist/assets/RailCats-BGZnJ6fa.js +0 -1
- package/web/dist/assets/api-BMFDSXoB.js +0 -1
- package/web/dist/assets/index-BEI5ugYQ.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-BMFDSXoB.js";import{G as i,H as a,Tt as o,et as s,gt as c,it as l,rt as u,st as d,tt as f}from"./index-BNttaGQb.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{r as h}from"./controls-D4wmg_pl.js";import{t as g}from"./DataTable-b9zTShqJ.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=d(),r=f(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===s(v(e))?t:null},{prune:a}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,s(v(e))]));a(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,a]);let o=e=>i(e)?.value??new Set(v(e)),l=(e,t)=>{let n=new Set(o(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,s(v(e)))},u=e=>{let t=o(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:o,toggle:l,change:u,apply:async e=>{let i=[...o(e)],a=`Rebuild ${c(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${c(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=c(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(h,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(p,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=c;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let o=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...F(n,t,e.name)})),u=l.filter(t=>v(t.row).includes(e.name)).length,d=l.filter(e=>e.staged).length,f=A(u,t.length),p=`on in ${u} of ${N(t.length,`install`)}${d?` · ${d} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${d?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(o.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(a,{value:s.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(a,{value:c.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,x.jsx)(j,{type:`skill`,names:s,listed:r?.skills,offNote:f}):null,c.length?(0,x.jsx)(j,{type:`agent`,names:c,listed:r?.agents,offNote:f}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[o.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,o.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(h,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(g,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:a,error:s}=o(()=>r.kits(),[n]),c=b(a,t),{data:d}=o(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=a?.kits||[],p=a?.installs||[],h=s||a?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(u,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:p,stage:c,listed:d})}):(0,x.jsxs)(m,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(l,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{eyebrow:a?`${N(f.length,`kit`)} · ${N(p.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(u,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?f.length===0?h?null:(0,x.jsx)(m,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:p,stage:c,listed:d,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:p,stage:c}),p.length?(0,x.jsx)(R,{installs:p,stage:c}):null]}):h?null:(0,x.jsx)(l,{})]})}export{z as default};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Et as i,G as a,H as o,_t as s,ct as c,et as l,it as u,rt as d,tt as f}from"./index-DsLmKHw0.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{t as h}from"./DataTable-b9zTShqJ.js";import{r as g}from"./controls-D4wmg_pl.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=c(),r=f(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===l(v(e))?t:null},{prune:a}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,l(v(e))]));a(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,a]);let o=e=>i(e)?.value??new Set(v(e)),u=(e,t)=>{let n=new Set(o(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,l(v(e)))},d=e=>{let t=o(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:o,toggle:u,change:d,apply:async e=>{let i=[...o(e)],a=`Rebuild ${s(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${s(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=s(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(g,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(p,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=s;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let a=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...F(n,t,e.name)})),u=l.filter(t=>v(t.row).includes(e.name)).length,d=l.filter(e=>e.staged).length,f=A(u,t.length),p=`on in ${u} of ${N(t.length,`install`)}${d?` · ${d} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${d?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(a.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(o,{value:s.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(o,{value:c.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,x.jsx)(j,{type:`skill`,names:s,listed:r?.skills,offNote:f}):null,c.length?(0,x.jsx)(j,{type:`agent`,names:c,listed:r?.agents,offNote:f}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[a.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,a.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(g,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(h,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:o,error:s}=i(()=>r.kits(),[n]),c=b(o,t),{data:l}=i(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=o?.kits||[],p=o?.installs||[],h=s||o?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(a,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(d,{error:h,style:{margin:`0 0 var(--sp-3)`}}),o?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:p,stage:c,listed:l})}):(0,x.jsxs)(m,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(u,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(a,{eyebrow:o?`${N(f.length,`kit`)} · ${N(p.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(d,{error:h,style:{margin:`0 0 var(--sp-3)`}}),o?f.length===0?h?null:(0,x.jsx)(m,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:p,stage:c,listed:l,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:p,stage:c}),p.length?(0,x.jsx)(R,{installs:p,stage:c}):null]}):h?null:(0,x.jsx)(u,{})]})}export{z as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{At as i,C as a,Et as o,G as s,H as c,Q as l,S as u,Z as d,_ as f,_t as p,at as m,b as h,ct as g,d as _,et as v,f as y,g as b,h as x,it as S,m as C,mt as w,ot as ee,p as te,pt as T,q as ne,rt as E,tt as D,v as O,vt as k,x as re,y as ie}from"./index-DsLmKHw0.js";import{t as ae}from"./Markdown-0ORz7tAc.js";import{t as oe}from"./EmptyState-CY5Pm2xy.js";import{t as se}from"./FilterInput-qGKNSlxv.js";var A=e(t(),1);function ce({items:e,packs:t,install:n,canApply:r,onAction:i,gateArmed:a}){let o=g(),s=e.filter(e=>e.tier===`doctrine`&&e.active!==!1).map(e=>e.name),c=s.join(`,`),l=D(),u=n?`${n.host}:${n.scope}:${n.path}`:``,d=v(s),{prune:m}=l,h=e.length>0;(0,A.useEffect)(()=>{h&&m(`rules`,(e,t)=>e===u&&t.base!==d)},[h,u,d,m]);let y=l.get(`rules`,u),b=y&&y.base===d?y.value:s,x=e=>l.put(`rules`,u,e(b),d),S=e=>b.includes(e),w=e=>x(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),ee=e=>e.rules.some(e=>S(e.addr)),te=e=>{let t=e.rules.map(e=>e.addr),n=e.rules.every(e=>S(e.addr));x(e=>n?e.filter(e=>!t.includes(e)):[...new Set([...e,...t])])},T=e=>{let t=e.rules.filter(e=>S(e.addr)).length;return t?e.active?`${t} of ${e.rules.length} active`:`staged on · ${t} of ${e.rules.length}`:e.active?`staged off`:`not built in`},ne=t.flatMap(e=>e.rules.map(e=>e.addr)),E=ne.filter(S),O=E.join(`,`)!==c,k=`process.5`,re=s.includes(k)&&!b.includes(k);return{deployedRules:s,isOn:S,toggleRule:w,packOn:ee,togglePack:te,packState:T,allRules:ne,pickedRules:E,dirty:O,losingConsent:re,applyPacks:async()=>{if(!r||!O)return;let e=t.filter(e=>e.rules.some(e=>S(e.addr))).map(e=>e.pack),c=t.filter(t=>e.includes(t.pack)).flatMap(e=>e.rules.filter(e=>!S(e.addr)).map(e=>e.addr)),d=re?`
|
|
2
|
+
|
|
3
|
+
process 5 carries commit/push consent. Dropping it also removes the git-gate hook, so commits and pushes stop being confirmed at the tool boundary (Bob still logs its warning). `+(a?`(Real data loss stays gated: that is Rule IV’s, not the pack’s.)`:`(Rule IV’s deletion gate is off on this install, so real data loss is not asked about either.)`):``,m={},h=[],g=[];for(let[e,{key:r,label:i}]of Object.entries(C)){if(!e.includes(`.`))continue;let a=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e,o=s.includes(e),c=n?.[r]!==!1;o&&!S(e)&&c&&(m[r]=!1,g.push(`Excluding ${a} also switches the ${i.toLowerCase()} off: its text goes, and its hook stops asking.`)),!o&&S(e)&&!c&&(h.push({key:r,label:i}),g.push(`Including ${a} brings its text back; the ${i.toLowerCase()} stays off unless you tick the box.`))}for(let e of f){if(e===k||!s.includes(e)||S(e))continue;let n=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e;g.push(`Excluding ${n} also drops its hook: it stops asking on every host.`)}for(let e of _){if(!s.includes(e)||S(e))continue;let n=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e;g.push(`Excluding ${n} drops its text; its hook still asks (it has no switch yet).`)}let v=E.length?`${E.length} of ${ne.length} doctrine rules`:`no doctrine rules`,y=g.length?`\n\n${g.join(`
|
|
4
|
+
`)}`:``,b=h.length?{label:`Also turn the ${h.map(e=>e.label.toLowerCase()).join(` and `)} back on`,checked:!0}:void 0,x=await o(`Rebuild ${p(n)} with ${v}? It rebuilds in place, non-destructive.${d}${y}`,{title:`Rebuild with these rules?`,confirmLabel:`Rebuild`,check:b});if(!x)return;let w={...m};if(x?.checked!==!1)for(let e of h)w[e.key]=!0;await i(`install`,{...n,doctrines:e,excludeRules:c,...w})&&l.startApply(`rules`,u)},revert:()=>l.drop(`rules`,u)}}var j=n();function M({addr:e,isOpen:t,onToggle:n,className:i,style:a,head:s,label:c,rev:l,toggleCol:u=null,renderBody:d,srcLine:f,after:p=null}){let m=(0,A.useId)(),{data:h,error:g,reload:_}=o(()=>t?r.item(`law`,e):Promise.resolve(null),[t,e,l],`law-item`),v=t&&(0,j.jsxs)(`div`,{className:`law-expand`,id:m,children:[g?(0,j.jsx)(E,{error:g,onRetry:_}):h?d(h):(0,j.jsx)(`p`,{className:`dim`,children:`Loading…`}),(0,j.jsx)(`div`,{className:`law-srcline`,children:f}),p]}),y={type:`button`,onClick:n,"aria-expanded":t,"aria-controls":m,"aria-label":c};return u?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:i,style:a,"data-addr":e,children:[(0,j.jsx)(`button`,{className:`law-disclosure`,...y,children:s}),(0,j.jsx)(`span`,{className:`toggle-col`,children:u})]}),v]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{className:i,style:a,"data-addr":e,...y,children:s}),v]})}function le({law:e,isOpen:t,onToggle:n,rev:r,toggleCol:i=null,after:a=null}){let o=e.enf===`Hook gate`?` hook`:e.enf===`Gate off`?` gate-off`:``,s=(0,j.jsx)(`span`,{className:`law-enf${o}`,"data-col":`enf`,"aria-hidden":i?`true`:void 0,children:e.enf},`enf`),c=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`law-no`,"data-col":`no`,children:[(0,j.jsx)(`span`,{className:`x`,"aria-hidden":`true`,children:`›`}),e.no]}),(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:e.name}),e.ess?(0,j.jsx)(`span`,{className:`law-princ`,children:e.ess}):null,e.asks?(0,j.jsx)(`span`,{className:`law-asks mono`,children:e.asks}):null,e.note?(0,j.jsx)(`span`,{className:`law-note`,children:e.note}):null,e.no?(0,j.jsxs)(`span`,{className:`law-fold law-fold-no`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`x`,children:`›`}),e.no]}):null,e.latin?(0,j.jsx)(`span`,{className:`law-fold law-fold-latin`,"aria-hidden":`true`,children:e.latin}):null,(0,j.jsxs)(`span`,{className:`law-fold law-fold-chips`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`law-chip-status ${e.statusTone}`,children:e.status}),(0,j.jsx)(`span`,{className:`law-chip-enf${o}`,children:e.enf})]})]}),(0,j.jsx)(`span`,{className:`law-latin`,"data-col":`latin`,children:e.latin}),(0,j.jsx)(`span`,{className:`law-status ${e.statusTone}`,"data-col":`status`,children:e.status}),i?null:s]});return(0,j.jsx)(M,{addr:e.addr,isOpen:t,onToggle:n,className:`law-row${i?` has-toggle`:``}${t?` on`:``}${e.off?` law-off`:``}`,style:{"--cc":e.c},head:c,label:`${e.no?e.no+` `:``}${e.name}, ${e.status}, ${e.enf}`,rev:r,toggleCol:i?[i[0],s,i[1]]:null,renderBody:t=>(0,j.jsx)(ae,{body:t.body||e.ess,links:t.links}),srcLine:`$ geneseed law ${e.addr} · ${e.src}`,after:a})}var N=[`invariants`,`doctrines`];function ue({tiers:e,current:t,onPick:n}){return(0,j.jsx)(`div`,{className:`tier-strip`,children:e.map((e,r)=>{let i=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`tier-head`,children:[(0,j.jsxs)(`span`,{className:`tier-k mono`,children:[`RANK `,r+1]}),e.pill?(0,j.jsx)(`span`,{className:`badge tier-pill ${e.pill[1]}`,children:e.pill[0]}):null]}),(0,j.jsxs)(`span`,{className:`tier-top`,children:[(0,j.jsx)(`span`,{className:`tier-name`,children:e.name}),(0,j.jsx)(`span`,{className:`tier-n mono`,children:e.n})]}),(0,j.jsx)(`span`,{className:`tier-bar`,"aria-hidden":`true`,children:(0,j.jsx)(`span`,{style:{width:`${Math.round(e.fill*100)}%`}})}),(0,j.jsx)(`span`,{className:`tier-sub`,children:e.sub}),(0,j.jsx)(`span`,{className:`tier-sub tier-rule`,children:e.rule})]}),a=`tier${t===e.key?` on`:``}`;return e.href?(0,j.jsx)(`a`,{className:`tier`,href:e.href,children:i},e.key):n&&N.includes(e.key)?(0,j.jsx)(`button`,{type:`button`,className:a,"aria-pressed":t===e.key,onClick:()=>n(t===e.key?`all`:e.key),children:i},e.key):(0,j.jsx)(`div`,{className:a,children:i},e.key)})})}function de({gates:e,byAddr:t,onJump:n,disarmed:r=()=>!1,install:i=null,slot:a=0}){let o=i?p(i):``,s=Object.entries(e?.asks||{}).map(([e,t])=>[e,t,r(ie(e))]).sort((e,t)=>e[2]-t[2]||t[1]-e[1]),l=Math.max(1,...s.map(([,e])=>e));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`gate-asks`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`gate-asks`,children:`Gate asks`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e?.total??0,` in ledger`]})]}),i&&s.some(e=>e[2])&&(0,j.jsx)(`span`,{className:`lib-legend mono`,children:(0,j.jsxs)(`span`,{children:[a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:T(a),"aria-hidden":`true`}),o]})}),s.length?(0,j.jsx)(`ul`,{className:`gate-list`,children:s.map(([e,r,s])=>{let u=ie(e),d=t[u]?.name||h(u);return(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`button`,{type:`button`,className:`gate-row`,onClick:()=>n(u),children:(0,j.jsxs)(`span`,{className:`gate-top`,children:[(0,j.jsx)(`span`,{className:`gate-name${s?` dim`:``}`,children:d}),s&&(0,j.jsxs)(`span`,{className:`mono off`,children:[i&&a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:T(a),"aria-hidden":`true`}),`off`,i&&(0,j.jsxs)(`span`,{className:`sr-only`,children:[` · `,o]})]}),(0,j.jsx)(`span`,{className:`mono gate-n`,children:r})]})}),(0,j.jsx)(c,{value:r,max:l,label:`${d} asks`,tone:s?`accent`:`warn`})]},e)})}):(0,j.jsx)(`p`,{className:`sub`,children:`No gate has asked yet.`}),(0,j.jsx)(`p`,{className:`panel-note`,children:e?.standing_down?.length?`Standing down: ${e.standing_down.join(`, `)}.`:`None standing down.`})]})}function fe({packs:e,sel:t,canApply:n,install:r,gateArmed:i}){let{isOn:a,packOn:o,togglePack:s,dirty:l,losingConsent:u}=t,d=Math.max(1,...e.map(e=>e.rules.length));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`doc-packs`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`doc-packs`,children:`Doctrine packs`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e.filter(o).length,`/`,e.length,` on`]})]}),e.length?(0,j.jsx)(`ul`,{className:`pack-list`,children:e.map(e=>{let t=e.rules.filter(e=>a(e.addr)).length;return(0,j.jsxs)(`li`,{className:o(e)?``:`off`,children:[(0,j.jsx)(`span`,{className:`pl-name`,title:e.desc,children:e.title}),(0,j.jsx)(c,{value:t,max:d,label:`${e.title} rules on`}),(0,j.jsx)(`span`,{className:`mono pl-n`,children:t}),n?(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${o(e)?` on`:``}${t&&t<e.rules.length?` mixed`:``}`,role:`checkbox`,"aria-checked":e.rules.length&&t===e.rules.length?`true`:t?`mixed`:`false`,"aria-label":`${e.title} pack`,onClick:()=>s(e)}):null]},e.pack)})}):(0,j.jsx)(`p`,{className:`sub`,children:`This install predates the three-tier constitution.`}),n&&e.length>0&&(0,j.jsxs)(j.Fragment,{children:[u&&(0,j.jsxs)(`p`,{className:`pack-warn`,role:`status`,"aria-live":`polite`,children:[`Dropping `,(0,j.jsx)(`b`,{children:`process 5`}),` also removes the commit/push consent gate:`,` `,(0,j.jsx)(`code`,{children:`git commit`}),` and `,(0,j.jsx)(`code`,{children:`git push`}),` stop being confirmed at the tool boundary.`,` `,i?`Real data loss stays gated by Rule IV.`:`Rule IV’s deletion gate is off on this install too.`]}),(0,j.jsx)(`p`,{className:`panel-note`,role:`status`,"aria-live":`polite`,children:l?`Not applied yet. Apply rebuilds ${r.host} · ${r.scope} once, with every change together.`:`Matches the deployed install. Changing a pack rebuilds it.`})]})]})}var pe=`ont:ownership`,me=e=>e===`ownership`?pe:e,he=`process.5`;function ge(e,t){let n=[];for(let r of e){if(r.tier!==`doctrine`)continue;let e=n.find(e=>e.pack===r.pack);e||(e={pack:r.pack,title:r.packTitle||r.pack,desc:r.packDesc||``,active:r.packActive!==!1,rules:[]},n.push(e));let i=re(r.title);e.rules.push({addr:r.name,no:`${r.pack} ${r.name.split(`.`)[1]||``}`,name:i.name,latin:i.latin,ess:r.summary||``,enf:O(r.name,t),c:a[r.pack]||`var(--text-3)`,src:`doctrines/${r.pack}.md`})}return n}function P(e){let t=l(e.dataRev),[n,r]=d(`laws`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(m,{className:`page-pick`,installs:t,value:n,onChange:r}),(0,j.jsx)(I,{...e,install:n,listed:t!==null,installSlot:w((t||[]).map(e=>e.id)).indexOf(n?.id)},n?.id??`none`)]})}var F=(e,t)=>e?.install?.host===t.host&&e.install.path===t.path;function I({install:e,listed:t,installSlot:n,...i}){let a=e&&F(i.overview,e)?i.overview:null,{data:s,error:c,loading:l}=o(()=>Promise.resolve().then(()=>e&&!a?r.overview(k(e)):null),[!!a,i.dataRev]),u=a||(e&&F(s,e)?s:null),d=e?u:i.overview,f=!(!e||u||l);return(0,j.jsxs)(j.Fragment,{children:[f?(0,j.jsx)(E,{error:`Could not read this install's gates${c?`: ${c}`:`.`}`}):null,(0,j.jsx)(L,{...i,overview:d,pair:k(e),onAction:t&&(!e||u!==null)?i.onAction:void 0,pending:!t||!!(e&&!u&&l),gatesUnread:f,installSlot:n})]})}function L({selected:e,overview:t,setup:n,onAction:l,dataRev:d,pair:m,pending:h,gatesUnread:v,installSlot:w}){let T=g(),{data:D,error:k}=o(()=>r.catalog(`laws`,m),m?[d,m.host,m.path]:[d],`catalog:laws`),{data:ae}=ne(d,m),[M,N]=(0,A.useState)(`all`),[P,F]=(0,A.useState)(``),[I,L]=(0,A.useState)(`all`),[_e,ve]=(0,A.useState)(()=>new Set),R=me(e)||null,ye=e=>i(R===e?`#/laws`:`#/item/law/${encodeURIComponent(e)}`),z=t?.install,B=!!(z&&l),[be,xe]=(0,A.useState)(0),Se=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!R)return;let e=requestAnimationFrame(()=>{let e=document.querySelector(`[data-addr="${CSS.escape(R)}"]`);if(!e)return;let t=Se.current===R;Se.current=null;let n=e.getBoundingClientRect();if(t||n.top<80||n.bottom>window.innerHeight){let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;e.scrollIntoView?.({block:`center`,behavior:t?`auto`:`smooth`})}t&&(e.classList.remove(`law-flash`),e.offsetWidth,e.classList.add(`law-flash`))});return()=>cancelAnimationFrame(e)},[R,be,D]);let V=D?.items||[],H=ge(V,t?.install),U=e=>t?.install?.[C[e].key]!==!1,Ce=U(`IV`),W=ce({items:V,packs:H,install:z,canApply:B,onAction:l,gateArmed:Ce}),{deployedRules:G,isOn:K,toggleRule:we,packOn:Te,packState:Ee,allRules:q}=W;if(k)return(0,j.jsx)(E,{error:k});if(!D||h)return(0,j.jsx)(S,{});let J={ontology:D.nouns?.ontology||`Ethos`,law:D.nouns?.law||`Dictate`,laws:D.nouns?.laws||`Dictates`,doctrines:D.nouns?.doctrines||`Doctrines`},De=(e,t)=>{let n=O(e,t);return v&&C[e]&&n===`Hook gate`?`Unknown`:n},Oe=V.filter(e=>e.tier===`ontology`).map(e=>({addr:e.name,no:``,name:e.title,latin:``,ess:``,status:`Always`,statusTone:`ok`,enf:e.name===pe&&(z||v)?De(`ownership`,z):`Instruction`,c:`var(--text-3)`,src:`ontology/universal.md`})),Y=V.filter(e=>(e.tier??`invariant`)===`invariant`).map(e=>{let n=e.klass&&u[e.klass]?e.klass:`craft`,r=re(e.title);return{addr:e.name,no:e.name,name:r.name,latin:r.latin,ess:e.summary||``,retired:r.retired,status:r.retired?`Retired`:`Active`,statusTone:r.retired?``:`ok`,enf:r.retired?`None`:De(e.name,t?.install),cat:n,c:u[n].c,off:r.retired,src:`laws/universal.md`}}),ke=B?[{addr:`ownership`,name:C.ownership.label,latin:``,ess:``,enf:O(`ownership`,z)}]:[],Ae=e=>K(e)?!1:_.has(e)?!0:!C[e]||v?!1:U(e)&&!G.includes(e),je=e=>{let t=K(e.addr),n=G.includes(e.addr),r=t===n?t?`Active`:`Off`:t?`Staged on`:`Staged off`;return{...e,enf:v&&C[e.addr]&&e.enf===`Hook gate`?`Unknown`:e.enf,note:Ae(e.addr)?`Text excluded; the hook still asks.`:``,off:!t,status:r,statusTone:t?`ok`:t===n?``:`warn`}},Me=H.filter(e=>e.active).flatMap(e=>e.rules.filter(e=>!G.includes(e.addr)).map(e=>e.addr)),Ne=async e=>{if(!B)return;let{key:t,label:n}=C[e],r=n.toLowerCase(),i=!U(e),a=p(z),o=W.dirty?` Your staged doctrine changes are not part of this rebuild; they stay staged.`:``;await T((i?`Re-arm the ${r} on ${a}? ${y[e].arm} It rebuilds in place, non-destructive.`:`Switch the ${r} off on ${a}? ${y[e].off} It rebuilds in place, non-destructive.`)+o,{title:i?`Re-arm the ${r}?`:`Switch the ${r} off?`,confirmLabel:i?`Re-arm`:`Switch off`})&&l(`install`,{...z,[t]:i})},Pe=(e,t)=>(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${U(e)?` on`:``}`,role:`switch`,"aria-checked":U(e),"aria-label":t?`${C[e].label}: hook gate of ${t}`:C[e].label,onClick:()=>Ne(e)}),Fe=(e,t)=>(0,j.jsxs)(`span`,{className:`no-gate`,title:t,children:[e,(0,j.jsxs)(`span`,{className:`sr-only`,children:[`: `,t]})]}),Ie=(e,t)=>[(0,j.jsx)(`span`,{className:`toggle-cell`,children:e},`text`),(0,j.jsx)(`span`,{className:`toggle-cell`,children:t},`gate`)],Le=e=>C[e.addr]?Pe(e.addr,e.name):e.addr===he?Fe(`with text`,`No switch of its own: excluding ${e.name} drops its commit and push ask in the same rebuild (Bob still logs its warning).`):f.has(e.addr)?Fe(`with text`,`No switch of its own: excluding ${e.name}, or its pack, drops its hook in the same rebuild.`):_.has(e.addr)?Fe(`always on`,`No switch yet: the hook asks even with ${e.name}'s text excluded.`):null,Re=e=>String(e.addr).includes(`.`)&&K(e.addr)!==G.includes(e.addr),ze=(e,t=I)=>t===`all`||(t===`gated`?e.enf===`Hook gate`&&(C[e.addr]||_.has(e.addr)||!String(e.addr).includes(`.`)||G.includes(e.addr)):Re(e)),X=P.trim().toLowerCase(),Z=e=>ze(e)&&(!X||`${e.addr} ${e.name} ${e.latin} ${e.ess}`.toLowerCase().includes(X)),Be=e=>{let t=Ze[e];(String(e).includes(`.`)?M===`invariants`:t&&M===`doctrines`)&&N(`all`),t&&!ze(t)&&L(`all`),t&&!Z(t)&&F(``),Se.current=me(e),xe(e=>e+1),i(`#/item/law/${encodeURIComponent(e)}`)},Ve={};for(let[e,t]of Object.entries(n?.gates?.asks||{}))Ve[ie(e)]=t;let He=e=>Ve[e.addr]?{...e,asks:`${Ve[e.addr]} ask${Ve[e.addr]===1?``:`s`}`}:e,Q=Y.filter(e=>!e.retired).length,Ue=G.length,We=e=>{if(v)return[`gates unread`,`warn`];let t=e.filter(e=>C[e.addr]&&!U(e.addr)).length;return t?[`${t} gate${t===1?``:`s`} off`,`warn`]:[`always`,`ok`]},Ge=q.length-Ue,Ke=[Ge>0&&`${Ge} excluded`,!v&&!U(`rigor.5`)&&`1 gate off`].filter(Boolean),qe=Ke.length?[Ke.join(` · `),`warn`]:[`all on`,`ok`],$=ae?.stats,Je={ethos:{name:J.ontology,n:Oe.length,fill:1,sub:`${Oe.length} sections`,pill:We(ke)},invariants:{name:J.laws,n:Y.length,fill:Y.length?Q/Y.length:0,sub:Y.length>Q?`${Q} active · ${Y.length-Q} retired`:`${Q} active`,pill:We(Y)},doctrines:{name:J.doctrines,n:q.length,fill:q.length?Ue/q.length:0,sub:`${H.length} packs`,pill:qe},yours:{name:`Your rules`,n:$?.rules??``,fill:+!!$?.rules,sub:$?`${$.rules} rule${$.rules===1?``:`s`} · ≈${$.tokens.toLocaleString(`en-US`)} tok`:`user-rules.md`,href:`#/personal/rules`,pill:[`yours`,``]}},Ye=e=>{if(e===`—`)return`Nothing outranks them.`;let t=e.replace(`{{LAW}}`,J.law);return`${t[0].toUpperCase()}${t.slice(1)}.`},Xe=x.map(e=>({key:e.key,...Je[e.key],rule:Ye(e.against)})),Ze=Object.fromEntries([...Y,...H.flatMap(e=>e.rules)].map(e=>[e.addr,e])),Qe=[[`all`,`All`,Y.length+q.length],[`invariants`,J.laws,Y.length],[`doctrines`,J.doctrines,q.length]],$e=M===`all`||M===`invariants`,et=M===`all`||M===`doctrines`,tt=[...ke,...$e?Y:[],...et?H.flatMap(e=>e.rules):[]],nt=[[`gated`,`Gated`,v?null:tt.filter(e=>ze(e,`gated`)).length],[`changed`,`Changed`,tt.filter(e=>ze(e,`changed`)).length]],rt=e=>String(e).includes(`.`)?String(e).split(`.`)[0]:null,it=e=>I!==`changed`&&_e.has(e)&&rt(R)!==e,at=e=>{let t=it(e);ve(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&rt(R)===e&&i(`#/laws`)},ot=H.flatMap(e=>e.rules.filter(Re).map(e=>({...e,plus:K(e.addr)}))),st=B&&H.length>0&&W.dirty,ct=()=>{L(`changed`),M===`invariants`&&N(`all`),F(``)},lt=(e,t)=>(0,j.jsxs)(`div`,{className:`band-head`,role:`presentation`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,children:e}),(0,j.jsx)(`span`,{className:`mono dim`,children:t})]}),ut=e=>(0,j.jsxs)(`div`,{className:`law-rowhead`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{"data-col":`no`,children:`No.`}),(0,j.jsx)(`span`,{children:`Rule`}),(0,j.jsx)(`span`,{"data-col":`latin`,children:`Latin name`}),(0,j.jsx)(`span`,{"data-col":`status`,children:`Status`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Rule `}),`text`]}),(0,j.jsx)(`span`,{"data-col":`enf`,children:`Enforced by`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Hook `}),`gate`]})]}),dt=Y.filter(Z),ft=(X||I!==`all`?ke.filter(Z).length:0)+($e?dt.length:0)+(et?H.reduce((e,t)=>e+t.rules.filter(Z).length,0):0),pt=He(ke[0]||{}).asks,mt=(e,t)=>B?(0,j.jsxs)(`div`,{className:`law-gate`,children:[(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:C[e].label}),t?(0,j.jsx)(`span`,{className:`law-asks mono`,children:t}):null,(0,j.jsx)(`span`,{className:`law-princ`,children:y[e].desc})]}),Pe(e)]}):null,ht=e=>{let t=te[e];return t?(0,j.jsxs)(`details`,{className:`law-hook`,children:[(0,j.jsx)(`summary`,{children:`What the hook does`}),(0,j.jsxs)(`dl`,{children:[(0,j.jsx)(`dt`,{children:`Triggers on`}),(0,j.jsx)(`dd`,{children:t.on}),(0,j.jsx)(`dt`,{children:`Per host`}),(0,j.jsx)(`dd`,{children:t.hosts}),(0,j.jsx)(`dt`,{children:`Does not see`}),(0,j.jsx)(`dd`,{children:t.blind}),(0,j.jsx)(`dt`,{children:`If switched off`}),(0,j.jsx)(`dd`,{children:t.off})]})]}):null};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(s,{eyebrow:z?[t?.theme,z.footprint&&`${z.footprint} footprint`,p(z)].filter(Boolean).join(` · `):null,title:`Constitution`,sub:`What the agent follows on every turn. Ranked: a lower rank may tighten a higher one, never repeal it. Open any rule to read its canonical text.`,actions:(0,j.jsx)(se,{className:`law-filter`,value:P,onChange:F,placeholder:`Filter rules`,label:`Filter rules`})}),(0,j.jsxs)(`section`,{className:`ladder`,"aria-labelledby":`ladder-h`,children:[(0,j.jsx)(`h2`,{id:`ladder-h`,className:`eyebrow`,children:`Precedence`}),(0,j.jsx)(ue,{tiers:Xe,current:M,onPick:N}),(0,j.jsx)(`div`,{className:`ladder-tail`,children:b.map((e,t)=>(0,j.jsxs)(`span`,{className:`ladder-low`,children:[(0,j.jsxs)(`span`,{className:`mono tier-k`,children:[`RANK `,x.length+t+1]}),` `,e.label,` —`,` `,e.against]},e.source))})]}),(0,j.jsxs)(`div`,{className:`split`,children:[(0,j.jsxs)(`section`,{className:`panel flush law-wrap${B?` with-toggle`:``}`,"aria-label":`Rules`,children:[Oe.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.ontology,`ontology/universal.md`),ut(!1),Oe.map(e=>(0,j.jsx)(le,{law:e,rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:e.addr===pe?(0,j.jsxs)(j.Fragment,{children:[ht(`ownership`),mt(`ownership`,pt)]}):null},e.addr))]}),(0,j.jsxs)(`div`,{className:`law-toolbar`,children:[(0,j.jsx)(ee,{"aria-label":`Show`,children:Qe.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:M===e?`on`:``,"aria-pressed":M===e,onClick:()=>N(e),children:[t,` `,(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))}),(0,j.jsx)(ee,{"aria-label":`Narrow`,children:nt.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:I===e?`on`:``,"aria-pressed":I===e,disabled:n===null,onClick:()=>L(I===e?`all`:e),children:[t,` `,n===null?null:(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))})]}),$e&&dt.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.laws,`laws/universal.md`),ut(B),dt.map(e=>(0,j.jsx)(le,{law:He(e),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:!B||e.retired?null:Ie(Fe(`locked`,`A ${J.law} cannot be excluded: its text always binds.`),C[e.addr]?Pe(e.addr,e.name):null)},e.addr))]}),et&&H.map(e=>{let t=e.rules.filter(Z);if(!t.length)return null;let n=it(e.pack),r=e.rules.filter(e=>K(e.addr)).length;return(0,j.jsxs)(`div`,{className:`pack-wrap${Te(e)?``:` pack-off`}`,children:[(0,j.jsxs)(`div`,{className:`band-head pack-head`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,style:{"--cc":a[e.pack]},children:(0,j.jsx)(`button`,{type:`button`,className:`pack-fold`,"aria-expanded":!n,onClick:()=>at(e.pack),children:e.title})}),(0,j.jsx)(`span`,{className:`mono dim`,children:e.pack}),(0,j.jsx)(`span`,{className:`pack-desc dim`,children:e.desc}),(0,j.jsx)(`span`,{className:`pack-fill`,children:(0,j.jsx)(c,{value:r,max:e.rules.length,label:`${e.title} rules switched on`})}),(0,j.jsx)(`span`,{className:`pack-state mono`,children:Ee(e)})]}),!e.active&&!B&&(0,j.jsxs)(`div`,{className:`pack-enable`,children:[`$ geneseed-build --doctrines`,` `,H.filter(t=>t.active||t.pack===e.pack).map(e=>e.pack).join(`,`),Me.length>0&&` --exclude-rules ${Me.join(`,`)}`]}),!n&&ut(B),!n&&t.map(e=>(0,j.jsx)(le,{law:He(je(e)),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:B?Ie((0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${K(e.addr)?` on`:``}`,role:`switch`,"aria-checked":K(e.addr),"aria-label":`${e.name} rule text`,onClick:()=>we(e.addr)}),Le(e)):null},e.addr))]},e.pack)}),ft===0&&(0,j.jsx)(oe,{title:X||I!==`all`?`No matching rules`:`Nothing in this tier`,children:X?(0,j.jsxs)(j.Fragment,{children:[`Nothing matches “`,P.trim(),`”.`]}):I===`all`?(0,j.jsx)(j.Fragment,{children:`This install predates the tier.`}):(0,j.jsxs)(j.Fragment,{children:[`No `,I,` rule in this tier.`]})})]}),(0,j.jsxs)(`aside`,{className:`aside-stack`,children:[(0,j.jsx)(fe,{packs:H,sel:W,canApply:B,install:z,gateArmed:Ce}),(0,j.jsx)(de,{gates:n?.gates,byAddr:Ze,onJump:Be,disarmed:e=>!!C[e]&&!U(e),install:t?.install,slot:w})]})]}),st&&(0,j.jsxs)(`div`,{className:`law-bar`,role:`region`,"aria-label":`Unapplied changes`,children:[(0,j.jsxs)(`span`,{className:`law-bar-n`,children:[ot.length,` unapplied change`,ot.length===1?``:`s`]}),(0,j.jsx)(`span`,{className:`law-bar-list`,children:ot.map(e=>(0,j.jsxs)(`span`,{className:`badge ${e.plus?`ok`:`warn`}`,children:[e.plus?`+`:`−`,` `,e.no,` `,e.name]},e.addr))}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:ct,children:`Review changes`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{L(`all`),W.revert()},children:`Revert`}),(0,j.jsxs)(`button`,{type:`button`,className:`btn`,onClick:W.applyPacks,children:[`Apply (`,W.pickedRules.length,`/`,q.length,` rules)`]})]})]})}export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{bt as r}from"./index-DsLmKHw0.js";import{t as i}from"./FilterInput-qGKNSlxv.js";var a=e(t(),1),o=n(),s={experimental:{label:`experimental`,cls:`warn`,icon:`flask`,hint:`Shipped, but not yet confirmed by real use.`},deprecated:{label:`deprecated`,cls:`bad`,icon:`clear`,hint:`On its way out — look for the replacement before building on it.`},personal:{label:`personal`,cls:``,icon:`profile`,hint:`Yours — present in this install, not shipped or versioned by Geneseed.`},unknown:{label:`no status`,cls:``,icon:`about`,hint:`Not listed in registry.json.`}};function c({status:e,withHint:t=!1,compact:n=!1}){let i=s[e];if(!i)return null;if(n)return(0,o.jsxs)(`span`,{className:`badge status-icon ${i.cls}`,title:`${i.label}: ${i.hint}`,children:[(0,o.jsx)(r,{name:i.icon}),(0,o.jsx)(`span`,{className:`sr-only`,children:i.label})]});let a=(0,o.jsxs)(`span`,{className:`badge ${i.cls}`,title:t?void 0:i.hint,children:[(0,o.jsx)(`span`,{className:`dot`}),i.label]});return t?(0,o.jsxs)(o.Fragment,{children:[a,(0,o.jsx)(`span`,{className:`dim`,children:i.hint})]}):a}function l({items:e}){return Object.keys(s).filter(t=>e.some(e=>e.status===t)).map(e=>(0,o.jsxs)(`span`,{title:s[e].hint,children:[(0,o.jsx)(`span`,{className:`badge status-icon ${s[e].cls}`,"aria-hidden":`true`,children:(0,o.jsx)(r,{name:s[e].icon})}),s[e].label]},e))}function u({label:e,total:t,cats:n,cat:r,onChange:i}){if(n.length<=1)return null;let a=[{key:`all`,label:`All`,n:t,c:`var(--text-3)`},...n];return(0,o.jsxs)(`div`,{className:`rail-cats`,children:[(0,o.jsx)(`ul`,{"aria-label":e,children:a.map(({key:e,label:t,n,c:a})=>(0,o.jsx)(`li`,{children:(0,o.jsxs)(`button`,{type:`button`,className:r===e?`on`:``,"aria-pressed":r===e,style:{"--cc":a},onClick:()=>i(e),children:[(0,o.jsx)(`span`,{className:`cdot`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`rc-name`,children:t}),(0,o.jsx)(`span`,{className:`mono dim`,children:n})]})},e))}),(0,o.jsx)(`div`,{className:`rail-mix`,"aria-hidden":`true`,children:n.map(({key:e,n:t,c:n})=>(0,o.jsx)(`span`,{className:r===`all`||r===e?``:`dim`,style:{"--cc":n,flexGrow:t}},e))})]})}function d(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)`}))}var f=({name:e})=>(0,o.jsxs)(`span`,{className:`tag acc`,title:`Ships with the ${e} kit`,children:[`kit: `,e]}),p=()=>(0,o.jsx)(`span`,{className:`tag acc`,title:`Every agent inherits this agent's root file`,children:`base`});function m(e,t){let n=(t||``).trim().toLowerCase();return n?e.filter(e=>`${e.title||``} ${e.name||``} ${e.desc||``}`.toLowerCase().includes(n)):e}function h({label:e,count:t,extra:n,tools:r,toolsCompact:s,q:c,onQ:l,matched:d,inView:f,current:p,sections:m,cats:h,cat:g,onCat:_,total:S,catLabel:C,children:w}){let T=x(f),E=T.list,D=b([...f,E]),O=(0,a.useId)(),k=(0,a.useRef)(null);(0,a.useLayoutEffect)(()=>y(D.current));let[A,j]=(0,a.useState)(``),M=(0,a.useRef)(!0);return(0,a.useEffect)(()=>{M.current?M.current=!1:j(D.current?.querySelector(`.lib-row.on`)?.dataset.title||``)},f),(0,o.jsxs)(`section`,{className:`lib-list`,"aria-label":e,onKeyDown:e=>{e.key===`ArrowDown`&&e.target.classList?.contains(`lib-filter`)&&(e.preventDefault(),D.current?.querySelector(`.lib-row`)?.focus())},"data-open":E,children:[(0,o.jsxs)(`div`,{className:`lib-list-head`,children:[(0,o.jsxs)(`b`,{children:[e,` `,(0,o.jsx)(`span`,{className:`mono dim`,children:t})]}),n]}),(0,o.jsxs)(`div`,{className:`lib-toolbar`,children:[m?(0,o.jsx)(`nav`,{className:`lib-seg`,"aria-label":`Sections`,children:m.map(e=>(0,o.jsxs)(`a`,{href:e.href,className:e.on?`on`:``,"aria-current":e.on?`page`:void 0,onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||T.setList(!0)},children:[e.label,(0,o.jsx)(`span`,{className:`mono`,children:e.n??``})]},e.key))}):null,(0,o.jsxs)(`div`,{className:`lib-toolbar-filter`,children:[(0,o.jsx)(i,{value:c,onChange:l,placeholder:`Filter ${e.toLowerCase()}`,label:`Filter ${e}`}),r?(0,o.jsx)(`div`,{className:`lib-tools`,children:r}):null,s?(0,o.jsx)(`div`,{className:`lib-tools-compact`,children:s}):null]}),h?.length>1?(0,o.jsx)(`div`,{className:`lib-chips`,children:(0,o.jsx)(u,{label:C,total:S,cats:h,cat:g,onChange:_})}):null]}),(0,o.jsxs)(`div`,{className:`lib-picker`,children:[(0,o.jsxs)(`button`,{ref:k,type:`button`,className:`lib-list-toggle`,"aria-expanded":E,"aria-controls":O,onClick:()=>T.setList(e=>!e),children:[(0,o.jsx)(`span`,{className:`dim lib-pick-n`,children:d===void 0?``:`${d} ${e.toLowerCase()}`}),(0,o.jsx)(`b`,{children:p}),(0,o.jsx)(`span`,{className:`dim lib-pick-hint`,children:E?`close`:`change`}),(0,o.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,o.jsxs)(`div`,{className:`lib-rows`,id:O,ref:D,onKeyDown:v,onFocus:e=>y(e.currentTarget),onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||e.target.closest?.(`.lib-row`)&&T.pick()},children:[w,c.trim()&&d===0&&(0,o.jsxs)(`div`,{className:`empty`,style:{padding:32},children:[(0,o.jsx)(`div`,{className:`big`,children:`No matches`}),`Nothing in `,e.toLowerCase(),` matches “`,c.trim(),`”.`]})]})]}),(0,o.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:A?`${A} opened`:``})]})}function g({item:e,isOpen:t,href:n,children:r}){return(0,o.jsxs)(`a`,{className:`lib-row${t?` on`:``}`,href:n,"aria-current":t?`true`:void 0,"data-title":e.title||e.name,"data-pinned":e.base?`true`:void 0,children:[(0,o.jsxs)(`span`,{className:`lr-name`,children:[e.title||e.name,(0,o.jsx)(c,{status:e.status,compact:!0}),e.kit?(0,o.jsx)(f,{name:e.kit}):null,e.base?(0,o.jsx)(p,{}):null,r]}),e.desc?(0,o.jsx)(`span`,{className:`lr-desc`,children:e.desc}):null,e.meta?(0,o.jsx)(`span`,{className:`lr-meta mono`,children:e.meta}):null]})}function _({rows:e,activeName:t,hrefOf:n,pills:r}){let i=null,a=[];for(let s of e)s.group&&s.group!==i&&(i=s.group,a.push((0,o.jsxs)(`div`,{className:`lib-group`,children:[s.groupC?(0,o.jsx)(`span`,{className:`cdot`,style:{"--cc":s.groupC},"aria-hidden":`true`}):null,s.group]},`g-${s.group}`))),a.push((0,o.jsx)(g,{item:s,isOpen:t===s.name,href:n(s),children:r?.(s)},s.name));return a}function v(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 y(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 b(e){let t=(0,a.useRef)(null);return(0,a.useEffect)(()=>{let e=t.current,n=e?.querySelector(`.lib-row.on`);if(!n||!e)return;let r=n.offsetTop;r>=e.scrollTop&&r+n.clientHeight<=e.scrollTop+e.clientHeight||(e.scrollTop=Math.max(0,r-e.clientHeight/2+n.clientHeight/2))},e),t}function x([e,t]){let[n,r]=(0,a.useState)(!t),[i,o]=(0,a.useState)([e,t]),[s,c]=(0,a.useState)(!1);return(i[0]!==e||i[1]!==t)&&(o([e,t]),r(s||!t),c(!1)),{list:n,setList:r,pick:()=>c(!0)}}export{m as a,c,h as i,l,_ as n,u as o,f as r,d as s,p as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-0ORz7tAc.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/AgentGlyph-k6o3gCM1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{o as i}from"./motion-RlUl1osO.js";import{n as a,t as o}from"./sections-CtFz7HFH.js";import{At as s,Et as c,K as l,Q as u,T as d,U as f,_t as p,bt as m,ct as ee,it as h,mt as g,ot as te,pt as _,rt as ne,st as re,t as v,w as y}from"./index-DsLmKHw0.js";import{t as ie}from"./EmptyState-CY5Pm2xy.js";import{a as ae,c as oe,i as se,l as ce,n as le,o as ue,r as de,t as fe}from"./LibRows-Hqvf1beK.js";var b=e(t(),1),x=n();function pe({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,x.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function me({entries:e}){return e.length?(0,x.jsxs)(`table`,{className:`mf-entries`,children:[(0,x.jsx)(`thead`,{className:`sr-only`,children:(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`th`,{scope:`col`,children:`Path`}),(0,x.jsx)(`th`,{scope:`col`,children:`Load`}),(0,x.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,x.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,x.jsxs)(`tr`,{children:[(0,x.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,x.jsx)(`td`,{className:`mf-load-cell`,children:(0,x.jsx)(pe,{load:e.load})}),(0,x.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function he({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,x.jsxs)(`div`,{className:`mf-vault`,children:[(0,x.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,x.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,x.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,x.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,x.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,x.jsxs)(`span`,{className:`mf-role`,children:[(0,x.jsx)(m,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,x.jsxs)(`span`,{className:`mf-role`,children:[(0,x.jsx)(m,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,x.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,x.jsx)(m,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,x.jsx)(me,{entries:t})]})}function S({body:e}){let[t,n]=(0,b.useState)(!1),r=(0,b.useId)();return e?(0,x.jsxs)(`div`,{className:`mf-raw`,children:[(0,x.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,x.jsx)(m,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,x.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function ge({manifest:e,body:t,name:n}){if(!e)return(0,x.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,x.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,x.jsx)(he,{wiki:e},e.name||t)),(0,x.jsx)(S,{body:t})]}):(0,x.jsxs)(`div`,{className:`mf-empty`,children:[(0,x.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,x.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,x.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,x.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,x.jsx)(S,{body:t})]})}let r=e.context||[];return r.length?(0,x.jsxs)(`div`,{className:`mf-doc`,children:[(0,x.jsx)(me,{entries:r}),(0,x.jsx)(S,{body:t})]}):(0,x.jsxs)(`div`,{className:`mf-empty`,children:[(0,x.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,x.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,x.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,x.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,x.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,x.jsx)(S,{body:t})]})}var C=e=>e>=1e3?`${(e/1e3).toFixed(+(e<1e4))}k`:String(e),w=e=>Math.round(e/4),T=[{key:`root`,label:`Constitution`,tone:`accent`,has:e=>e.source===`root`},{key:`catalogue`,label:`Catalogues`,tone:`muted`,has:e=>e.source===`catalogue`},{key:`agent`,label:`This agent`,tone:`warn`,has:e=>e.source!==`root`&&e.source!==`catalogue`}],_e=[[`dictate`,`Dictates`],[`doctrine`,`Doctrines`],[`user`,`User rules`]],E={"not-wired":`not wired, re-emit this install`,"no-event":`not delivered on this host`};function ve(e,t){if(!e||!t)return``;let n=(e,t)=>e.blocks.filter(e=>e.chars>0&&!t.blocks.some(t=>t.id===e.id)),r=e=>e.id===`session-files`?`session files`:e.label.replace(/^.* spec$/,`spec`);return[...n(e,t).map(e=>`+ ${r(e)} ${C(e.chars)}`),...n(t,e).map(e=>`− ${r(e)} ${C(e.chars)}`)].join(`, `)}var D=e=>e.kind===`user`?`#/personal/rules`:`#/item/law/${encodeURIComponent(e.id)}`,O=e=>`${e.layer??``}${e.id}`;function k({label:e,n:t,children:n}){return(0,x.jsxs)(`li`,{children:[(0,x.jsx)(`span`,{children:e}),n,(0,x.jsx)(`span`,{className:`mono`,children:C(t)})]})}function ye({loadout:e,base:t,error:n,install:r}){let[i,a]=(0,b.useState)(!1);if(n)return(0,x.jsx)(`p`,{className:`sub`,children:`Loadout not measured for this install.`});if(!e)return null;let o=e=>e.reduce((e,t)=>e+t.chars,0),s=o(e.blocks),c=ve(e,t),l=T.map(t=>{let n=e.blocks.filter(t.has);return{...t,blocks:n,n:o(n)}}),[u,d,p]=l,m=Math.max(1,...u.blocks.map(e=>e.chars)),ee=e.blocks.find(e=>e.id===`user-rules`),h=ee?E[ee.delivery]:void 0,g=e.rules||[],te=g.filter(e=>!(h&&e.kind===`user`)),_=g.filter(e=>e.citedBySpec),ne=[];for(let e of g){let t=e.kind===`dictate`?`Dictates`:e.kind===`user`?`User rules`:e.id.split(`.`)[0],n=ne.find(e=>e.name===t);n?n.n+=1:ne.push({name:t,n:1,user:e.kind===`user`})}let re=_e.map(([e,t])=>[t,te.filter(t=>t.kind===e).length]).filter(([,e])=>e>0);return(0,x.jsxs)(`section`,{className:`loadout`,"aria-label":`Loadout`,children:[(0,x.jsxs)(`header`,{className:`loadout-head`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsxs)(`h3`,{className:`loadout-eyebrow mono`,children:[`Loadout · `,r||e.host]}),(0,x.jsxs)(`p`,{className:`loadout-total`,children:[(0,x.jsx)(`strong`,{children:C(w(s))}),(0,x.jsxs)(`span`,{className:`dim`,children:[`tokens at start · `,C(s),` chars`]})]})]}),c?(0,x.jsxs)(`div`,{className:`loadout-delta`,children:[(0,x.jsxs)(`span`,{className:`dim`,children:[`Against the `,t?.noun||`Primary agent`]}),(0,x.jsx)(`ul`,{children:c.split(`, `).map(e=>(0,x.jsx)(`li`,{className:`mono loadout-pill${e.startsWith(`+`)?` is-plus`:``}`,children:e},e))})]}):null]}),(0,x.jsxs)(`div`,{className:`loadout-bar`,children:[(0,x.jsx)(f,{label:`Loadout`,legend:!1,parts:l.map(e=>({key:e.key,label:e.label,n:e.n,tone:e.tone}))}),(0,x.jsx)(`ul`,{className:`loadout-groups`,"aria-hidden":`true`,children:l.map(e=>e.n>0?(0,x.jsxs)(`li`,{style:{flexGrow:e.n},children:[(0,x.jsx)(`span`,{children:e.label}),` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[C(e.n),` · `,Math.round(e.n/s*100),`%`]})]},e.key):null)})]}),(0,x.jsxs)(`details`,{className:`loadout-card`,open:e.agent===`primary`,children:[(0,x.jsxs)(`summary`,{children:[(0,x.jsx)(`i`,{className:`tone-accent`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`Constitution`}),(0,x.jsx)(`span`,{className:`dim`,children:`root file, loaded by the host`}),(0,x.jsxs)(`span`,{className:`mono dim loadout-sum`,children:[C(u.n),` · ≈ `,C(w(u.n)),` tok`]})]}),(0,x.jsx)(`ul`,{className:`loadout-root`,children:u.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars,children:(0,x.jsx)(`span`,{className:`loadout-mini`,"aria-hidden":`true`,children:(0,x.jsx)(`span`,{style:{width:`${Math.max(4,e.chars/m*100)}%`}})})},e.id))})]}),(0,x.jsxs)(`div`,{className:`loadout-pair`,children:[(0,x.jsxs)(`div`,{className:`loadout-card`,children:[(0,x.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,x.jsx)(`i`,{className:`tone-muted`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`Catalogues`}),(0,x.jsx)(`span`,{className:`mono dim loadout-sum`,children:C(d.n)})]}),(0,x.jsx)(`ul`,{className:`loadout-list`,children:d.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars},e.id))}),(0,x.jsx)(`p`,{className:`dim loadout-note`,children:`Listed by the host, not by Geneseed.`})]}),(0,x.jsxs)(`div`,{className:`loadout-card is-own`,children:[(0,x.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,x.jsx)(`i`,{className:`tone-warn`,"aria-hidden":`true`}),(0,x.jsx)(`strong`,{children:`This agent`}),(0,x.jsx)(`span`,{className:`mono dim loadout-sum`,children:C(p.n)})]}),(0,x.jsx)(`ul`,{className:`loadout-list`,children:p.blocks.map(e=>(0,x.jsx)(k,{label:e.label,n:e.chars,children:e.id===`user-rules`?(0,x.jsx)(`span`,{className:`loadout-pill${h?` is-plus`:``}`,children:h||`injected at sub-agent start`}):null},e.id))})]})]}),(0,x.jsxs)(`section`,{className:`loadout-rules`,"aria-label":`Rules it follows`,children:[(0,x.jsxs)(`div`,{className:`loadout-rules-h`,children:[(0,x.jsxs)(`h4`,{className:`loadout-eyebrow mono`,children:[`Rules it follows · `,te.length]}),(0,x.jsx)(`span`,{className:`dim`,children:re.map(([e,t])=>`${t} ${e}`).join(` · `)})]}),_.length?(0,x.jsxs)(`div`,{className:`loadout-cited`,children:[(0,x.jsx)(`span`,{className:`loadout-cited-h`,children:`Cited by its spec`}),_.map(e=>(0,x.jsxs)(`a`,{href:D(e),children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` · `,e.title]},O(e)))]}):null,(0,x.jsx)(`ul`,{className:`loadout-packs`,children:ne.map(e=>e.user&&h?(0,x.jsxs)(`li`,{className:`is-muted`,children:[(0,x.jsx)(`span`,{children:`User rules`}),` `,(0,x.jsx)(`span`,{className:`mono`,children:e.n}),` `,(0,x.jsx)(`span`,{className:`dim`,children:h})]},e.name):(0,x.jsx)(`li`,{children:(0,x.jsxs)(`a`,{href:e.user?`#/personal/rules`:`#/laws`,children:[(0,x.jsx)(`span`,{children:e.name}),` `,(0,x.jsx)(`span`,{className:`mono dim`,children:e.n})]})},e.name))}),g.length?(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":i,onClick:()=>a(e=>!e),children:i?`Show fewer`:`Show all ${g.length}${h?` listed`:``} rules`}):null,i?_e.map(([e,t])=>{let n=g.filter(t=>t.kind===e),r=h&&e===`user`;return n.length?(0,x.jsxs)(`div`,{className:r?`is-muted`:void 0,children:[(0,x.jsxs)(`h5`,{className:`reader-when-h`,children:[t,` `,(0,x.jsx)(`span`,{className:`mono dim`,children:n.length}),r?(0,x.jsxs)(`span`,{className:`dim`,children:[` · `,h]}):null]}),(0,x.jsx)(`ul`,{children:n.map(e=>(0,x.jsxs)(`li`,{children:[r?(0,x.jsxs)(`span`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}):(0,x.jsxs)(`a`,{href:D(e),children:[(0,x.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}),e.layer&&e.layer!==`install`?(0,x.jsxs)(`span`,{className:`dim`,children:[` (`,e.layer,`)`]}):null]},O(e)))})]},e):null}):null]}),(0,x.jsxs)(`p`,{className:`dim loadout-foot`,children:[`Not counted: `,e.notCounted.join(`; `),`. Tokens are chars ÷ 4.`]})]})}function be({label:e,options:t,value:n,onChange:r}){let[i,a]=(0,b.useState)(!1),o=(0,b.useRef)(null),s=(0,b.useId)(),c=t.find(e=>e.key===n)||t[0],l=()=>a(!1);return(0,b.useEffect)(()=>{i&&document.getElementById(s)?.querySelector(`[aria-pressed="true"]`)?.focus()},[i,s]),(0,x.jsxs)(`span`,{className:`drop-menu`,children:[(0,x.jsxs)(`button`,{ref:o,type:`button`,className:`drop-menu-btn`,"aria-label":`${e}: ${c.label}`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-controls":i?s:void 0,onClick:()=>a(e=>!e),children:[c.label,(0,x.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,x.jsx)(re,{open:i,onClose:l,anchorRef:o,label:e,className:`drop-menu-pop`,children:(0,x.jsx)(`div`,{id:s,className:`drop-menu-list`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(document.activeElement);e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()},onBlur:e=>{let t=e.relatedTarget;t&&t!==o.current&&!e.currentTarget.closest(`.popover`)?.contains(t)&&l()},children:t.map(e=>(0,x.jsx)(`button`,{type:`button`,"aria-pressed":e.key===c.key,onClick:()=>{r(e.key),l()},children:e.label},e.key))})})]})}function xe({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,x.jsxs)(`div`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`stat-label`,children:e}),(0,x.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,x.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var Se=(0,b.lazy)(()=>v(()=>import(`./Markdown-0ORz7tAc.js`).then(e=>e.n),__vite__mapDeps([0,1,2]))),Ce=(0,b.lazy)(()=>v(()=>import(`./AgentGlyph-k6o3gCM1.js`),__vite__mapDeps([3,1,2]))),we={skills:`skill`,agents:`agent`},Te=`:primary`,Ee=(e,t)=>`${t?e/t*100:0}%`,De=e=>e.split(`:`).slice(0,2).join(` `),Oe=e=>e.split(`/`).map((e,t)=>(0,x.jsxs)(b.Fragment,{children:[t?`/`:null,t?(0,x.jsx)(`wbr`,{}):null,e]},t)),A=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},ke=e=>p(A(e));function Ae(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 je({section:e,source:t}){return(0,x.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,x.jsx)(m,{name:a[e].icon,className:`glyph`}),(0,x.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,x.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var Me=e=>e.replace(/\s+/g,` `).trim(),Ne=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Pe(e,t){let n=e.replace(/\r\n/g,`
|
|
3
|
+
`),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=Ne(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?Me(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?Me(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=Ne(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function Fe({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,x.jsx)(`div`,{className:`lib-stats`,children:(0,x.jsx)(xe,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(De))].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,x.jsx)(`div`,{className:`lib-stats`,children:(0,x.jsx)(xe,{label:`Used`,value:e.n,delta:o,children:(0,x.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,x.jsx)(`i`,{className:t===29?`today`:``,style:{height:Ee(e,a)}},t))})})})}function Ie(e){let t=/\s*\bUse when:\s*/i.exec(e||``);if(!t)return{lede:e||``,when:``};let n=e.slice(t.index+t[0].length).trim();return{lede:e.slice(0,t.index).trim(),when:n&&n[0].toUpperCase()+n.slice(1)}}var Le={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},Re=(e,t)=>t||(e&&o.includes(e)?e:o[0]),ze=encodeURIComponent;function Be(e){let t=e=>y[e.klass]?e.klass:`personal`,n=d.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:y[n].label,groupC:y[n].c})));return{rows:n,cats:d.map(e=>({key:e,label:y[e].label,c:y[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Ve(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function j({overview:e,section:t,selected:n,dataRev:i,lock:d,base:f,onRulesChanged:p,onCountsChanged:m}){let re=ee(),[v,pe]=(0,b.useState)(()=>Re(t,d)),[me,he]=(0,b.useState)(``),[S,C]=(0,b.useState)(`all`),[w,T]=(0,b.useState)(`all`),[_e,E]=(0,b.useState)(``),[ve,D]=(0,b.useState)(null),[O,k]=(0,b.useState)(null),[xe,De]=(0,b.useState)(t);if(t!==xe){De(t),E(``);let e=Re(t,d);e!==v&&(pe(e),he(``),C(`all`),T(`all`))}let[Me,Ne]=(0,b.useState)(n);n!==Me&&(Ne(n),E(``));let{data:j,error:He,reload:Ue}=c(()=>r.catalog(v),[v,i],`catalog`),We=d?null:we[v]||null,Ge=We!==null,{data:M}=c(()=>Ge?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[Ge,i],`usage`,{revalidate:!0}),N=Ge&&!!M?.enabled&&Array.isArray(M.names),Ke=(0,b.useMemo)(()=>new Map((Array.isArray(M?.names)?M.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[M]),qe=e=>N&&Ke.get(`${We}\u0000${e}`)||null,Je=e=>{let t=qe(e.name);return!t||t.n===0&&!t.last},Ye=M?.since?`No call since ${M.since}`:`No call recorded yet`,P=j?.section===v,F=P&&j?.items||[],Xe=!P&&!He,[Ze,...Qe]=P&&j.sharedInstalls||[],I=e=>e===Ze?`shared`:ke(e),L=v===`skills`,$e=L?Be(F):null,R=L?$e.rows:v===`memory`?Ve(F):F,z=n||R[0]?.name||null,B=v===`agents`&&!d,V=B&&z===`:primary`,{data:et}=c(()=>B?Promise.resolve().then(()=>r.loadout()).catch(()=>null):Promise.resolve(null),[B,i],`loadout-primary`),tt=B?{name:Te,type:`agent`,base:!0,title:et?.noun||`Primary agent`,desc:`The main agent of the session. Every agent inherits its root file.`}:null,nt=V?tt:z?F.find(e=>e.name===z):null,rt=nt?.type||a[v].type,H=O?.sec===v&&O?.name===z?O.key:null,{data:it,error:U}=c(()=>!z||V?Promise.resolve(null):H?r.item(rt,z,A(H)):r.item(rt,z),[v,z,rt,H,i,V]),W=U?null:it,at=W&&W.name===z&&(!H||W.install===H)?W:null,ot=e=>q&&e?.install?` in ${I(e.install)}`:``,G=V?null:H||W?.install||null,st=B&&z&&(V||W&&W.name===z),{data:ct,error:lt}=c(()=>st?V?r.loadout().then(e=>({own:e,base:null})):Promise.all([r.loadout(z,G?A(G):void 0),r.loadout(void 0,G?A(G):void 0).catch(()=>null)]).then(([e,t])=>({own:e,base:t})):Promise.resolve(null),[st,z,G,i]),ut=_e||He||U,dt=z?{name:z,title:W?.title||z,desc:W?.desc||``}:null,K=nt||dt,ft=t=>t===v&&P?F.length:e?.counts?.[t]??``,pt=u(i),mt=G||pt?.[0]?.id,ht=mt?ke(mt):void 0,q=new Set(F.flatMap(e=>e.installs||[])).size>1,gt=g([...(pt||[]).map(e=>e.id),...F.flatMap(e=>e.installs||[])],Qe),J=L?R.filter(e=>S===`all`||e.cat===S):R,_t=N?J.filter(Je).length:0,vt=e=>e.status===`experimental`,yt=J.filter(vt).length,Y=[[`all`,`All`,J.length],...N?[[`used`,`Used`,J.length-_t],[`unused`,`Not used yet`,_t,Ye]]:[],...yt?[[`experimental`,`Experimental`,yt,`Shipped, not yet confirmed by real use`]]:[]],X=Y.some(([e])=>e===w)?w:`all`,bt=X===`all`?J:X===`experimental`?J.filter(vt):J.filter(e=>Je(e)===(X===`unused`)),xt=N?Math.max(0,...F.map(e=>qe(e.name)?.n||0)):0,St=L?1/0:50,Z=me.trim().toLowerCase(),Q=Z?ae(bt,Z):bt.slice(0,St),Ct=!Z&&S===`all`&&X===`all`&&z&&!Q.some(e=>e.name===z)?[...Q,...R.filter(e=>e.name===z)]:Q,wt=e=>f?`${f}/${ze(e.name)}`:`#/item/${e.type||a[v].type}/${ze(e.name)}`,Tt=async()=>{let e=at;if(!e)return;let t=e.name;if(await re(`Forget the memory fact "${t}"${ot(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`})){E(``);try{await r.memoryDelete(t,e.install?A(e.install):void 0)}catch(e){E(`Could not forget "${t}": ${e.message}`);return}s(f||`#/personal/memory`),Ue(),m?.()}},Et=async()=>{let e=at;if(!e)return;let t=e.name;if(await re(`Promote "${t}"${ot(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`})){E(``);try{let n=e.install?A(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),l(),p?.(),m?.(),s(`#/personal/rules`)}catch(e){E(`Could not promote: ${e.message}`),Ue()}}},Dt=W?.body?Pe(W.body,W.desc||K?.desc):null,Ot=W?.title||K?.title||K?.name,kt=Ot===K?.name&&Dt?.title?Dt.title:Ot,At=P&&F.length===0,jt=W?.status||K?.status,Mt=v===`skills`?y[nt?.klass]:null,Nt=a[v].label,{lede:Pt,when:Ft}=Ie(W?.desc||K?.desc||``),$=K&&!V?W?.source||K.source||(U?null:Ae(v,K.name)):null,It=async()=>{try{await navigator.clipboard.writeText($),D({src:$,ok:!0})}catch{D({src:$,ok:!1})}};return(0,x.jsxs)(`div`,{className:`lib-wrap`,children:[(0,x.jsx)(ne,{error:ut,style:{margin:`0 0 var(--sp-3)`}}),(0,x.jsxs)(`div`,{className:`library lib-dossier${d?` locked`:``}${N?` uses`:``}`,children:[d?null:(0,x.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,x.jsxs)(`div`,{className:`lib-title`,children:[(0,x.jsx)(`h1`,{className:`h`,children:`Library`}),(0,x.jsx)(`span`,{className:`dim`,children:`What the agent knows`}),N&&M.since?(0,x.jsxs)(`span`,{className:`mono dim lib-title-since`,children:[`calls since `,M.since]}):null]}),(0,x.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,x.jsxs)(b.Fragment,{children:[(0,x.jsxs)(`a`,{href:`#/section/${e}`,className:v===e?`on`:``,"aria-current":v===e?`page`:void 0,children:[a[e].label,(0,x.jsx)(`span`,{className:`mono dim`,children:ft(e)})]}),e===v&&L&&P&&(0,x.jsx)(ue,{label:`Skill types`,total:F.length,cats:$e.cats,cat:S,onChange:C})]},e))})]}),(0,x.jsxs)(se,{label:Nt,count:P?Z?`${Q.length} of ${bt.length}`:bt.length:``,q:me,onQ:he,matched:Q.length,inView:[v,n],current:K?kt:void 0,sections:d?void 0:o.map(e=>({key:e,label:a[e].label,n:ft(e),href:`#/section/${e}`,on:v===e})),cats:L&&P?$e.cats:null,cat:S,total:F.length,onCat:C,catLabel:`Skill types`,extra:(0,x.jsxs)(x.Fragment,{children:[N&&M.since?(0,x.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,M.since]}):null,(0,x.jsxs)(`span`,{className:`lib-legend mono`,children:[q?gt.map((e,t)=>(0,x.jsxs)(`span`,{className:`lk-install`,title:A(e).path,children:[(0,x.jsx)(`i`,{className:`lr-dot`,style:_(t),"aria-hidden":`true`}),I(e)]},e)):null,(0,x.jsx)(ce,{items:F})]})]}),toolsCompact:P&&Y.length>1?(0,x.jsx)(be,{label:`Show`,options:Y.map(([e,t])=>({key:e,label:e===`all`?`All uses`:t})),value:X,onChange:T}):void 0,tools:P&&Y.length>1?(0,x.jsx)(te,{"aria-label":`Show`,children:Y.map(([e,t,n,r])=>(0,x.jsxs)(`button`,{type:`button`,className:X===e?`on`:``,"aria-pressed":X===e,title:r,onClick:()=>T(e),children:[t,` `,(0,x.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[Xe?(0,x.jsx)(h,{}):null,(0,x.jsx)(le,{rows:tt&&P?[tt,...Ct]:Ct,activeName:K?.name,hrefOf:wt,pills:N||q?e=>{let t=qe(e.name)?.n||0,n=q?(0,x.jsx)(`span`,{className:`lr-dots`,children:gt.map((t,n)=>e.installs?.includes(t)?(0,x.jsx)(`span`,{className:`lr-dot lr-install`,style:_(n),title:`${I(t)} — ${A(t).path}`,children:(0,x.jsx)(`span`,{className:`sr-only`,children:I(t)})},t):(0,x.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return N?(0,x.jsxs)(x.Fragment,{children:[n,(0,x.jsxs)(`span`,{className:`lr-use`,children:[(0,x.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,x.jsx)(`i`,{style:{width:Ee(t,xt)}})}),(0,x.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,x.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!Z&&F.length>St&&(0,x.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,St,` of `,F.length,`; type to search the rest.`]}),At&&(v===`wiki`?(0,x.jsxs)(ie,{title:`No wiki entries`,action:(0,x.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,x.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,x.jsx)(ie,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,x.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:K?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:Nt.replace(/s$/,``)}),V?(0,x.jsx)(fe,{}):null,Mt?(0,x.jsx)(`span`,{className:`tag`,children:Mt.label}):null,W?.kit??K.kit?(0,x.jsx)(de,{name:W?.kit??K.kit}):null,(0,x.jsx)(oe,{status:jt,withHint:!0}),$?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{className:`mono dim reader-src`,children:Oe($)}),(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:It,children:ve?.src===$?ve.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,x.jsxs)(`div`,{className:`reader-head`,children:[(0,x.jsx)(`h2`,{className:`reader-title`,children:kt}),v===`agents`&&!V?(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(Ce,{name:K.name})}):null]}),(0,x.jsxs)(`div`,{className:`reader-intro${N?` with-stats`:``}`,children:[(0,x.jsxs)(`div`,{className:`reader-intro-text`,children:[Pt?(0,x.jsx)(`p`,{className:`reader-lede`,children:Pt}):null,Ft?(0,x.jsxs)(`section`,{className:`reader-when`,children:[(0,x.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,x.jsx)(`p`,{children:Ft})]}):null]}),N?(0,x.jsx)(Fe,{u:qe(K.name),usage:M,noCall:Ye}):null]}),v===`memory`&&at&&K.name!==`MEMORY`&&K.name!==`README`&&(0,x.jsxs)(`div`,{className:`row gap-8`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Et,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Tt,children:`Forget this fact`})]}),W?.installs?.length>1&&W.installs.includes(W.install)?(0,x.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,x.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,x.jsx)(`select`,{className:`sel`,"aria-label":`Install`,value:H||W.install,onChange:e=>k({sec:v,name:z,key:e.target.value}),children:W.installs.map(e=>(0,x.jsx)(`option`,{value:e,title:A(e).path,children:I(e)},e))}),(0,x.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,x.jsx)(`hr`,{className:`hr`}),B?(0,x.jsx)(ye,{loadout:ct?.own,base:ct?.base,error:lt,install:ht}):null,V?null:U?(0,x.jsxs)(`p`,{className:`sub`,children:[`No `,Nt.replace(/s$/,``).toLowerCase(),` named `,(0,x.jsx)(`em`,{children:K.name}),` could be read in this install.`]}):K?.kind===`manifest`||W?.manifest!==void 0?W?(0,x.jsx)(ge,{manifest:W.manifest,body:W.body,name:K.name}):(0,x.jsx)(h,{}):W?.body?(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(Se,{body:Dt.body,links:W.links||[]})})}):W===null&&z?(0,x.jsx)(h,{}):(0,x.jsx)(je,{section:v,source:Ae(v,K.name)}),Le[v]?(0,x.jsx)(`div`,{className:`reader-links`,children:(0,x.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${Le[v]}`,children:[`About `,Nt.toLowerCase(),` in Docs`]})}):null]}):Xe?(0,x.jsx)(h,{}):null})]})]})}export{Te as PRIMARY,Pe as bodyHead,j as default,Ve as groupMemory,ke as installLabel,A as installOfKey,Be as splitSkills,Ie as splitWhen};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Et as i,Ot as a,Q as o,Z as s,at as c,it as l,kt as u,rt as d,vt as f}from"./index-DsLmKHw0.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{a as h,i as ee,n as g,o as _,s as v}from"./LibRows-Hqvf1beK.js";import{t as y}from"./CopyButton-Bc66KPyA.js";import{c as b,i as te,n as x,o as S,r as C,s as w,t as ne}from"./ActiveLoops-BTHIaRhn.js";var T=e(t(),1),E=n(),D=encodeURIComponent,O=a.loops.map(e=>[e,u[e]]),k={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},A={project:`Project`,global:`Global`,shipped:`Shipped`},j={templates:`Categories`,bricks:`Origins`,active:`Statuses`},M=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function N(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var P=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function F(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return P(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>k[e.graph.category]?e.graph.category:`other`,[...Object.entries(k),[`other`,`Other`]])}function I(e,t){return P(e.map(e=>({...e,desc:e.description,override:N(t,e.name)})),e=>e.origin,Object.entries(A))}function L(e){return P(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,M)}var R=(e,t)=>(0,E.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),z={templates:e=>e.human?R(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?R(`warn`,`mutate`):null,w(e)?R(`human`,`human gate`):null,e.override?R(`acc`,e.override):null,e.available===!1?R(`bad`,`unavailable`):null],active:e=>R(x[e.status],e.status)};function B({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,E.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,E.jsx)(`b`,{children:(0,E.jsx)(`a`,{href:`#/loops/bricks/${D(e)}`,children:e})}),R(t.effect===`mutate`?`warn`:``,t.effect),(0,E.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,E.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),w(t)?R(`human`,w(t).toLowerCase()):null,n?R(`acc`,n):null]}):(0,E.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,E.jsx)(`b`,{children:e}),(0,E.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function V(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function re({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,T.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=V(e.graph),c=b(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>C(t)&&t.graph.name===e.name).length;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`reader-tags`,children:[(0,E.jsx)(`span`,{className:`tag acc`,children:`Template`}),k[e.graph.category]?R(``,k[e.graph.category]):null,e.human?R(`human`,`human gate`):null]}),(0,E.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,E.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,E.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,E.jsx)(`hr`,{className:`hr`}),(0,E.jsxs)(`figure`,{className:`loop-console`,children:[(0,E.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${c.width}px`},children:(0,E.jsx)(S,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:`smooth`,block:`nearest`})}})}),(0,E.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,E.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,E.jsx)(`ol`,{children:s.map(([e,t])=>(0,E.jsxs)(`li`,{children:[(0,E.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,E.jsxs)(`span`,{className:`loop-legend`,children:[(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,E.jsxs)(`span`,{children:[(0,E.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,E.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,E.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,E.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,E.jsx)(y,{text:u,label:`Copy command`})]}),(0,E.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,E.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,E.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,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,E.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,E.jsx)(`li`,{children:e},e))})]}):null,(0,E.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,E.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,E.jsx)(B,{name:e,brick:o.get(e),override:N(n,e),on:i===e},e))})]})}function H(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 U({b:e}){let[t,n]=(0,T.useState)(!1),r=[[`effect`,R(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,E.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>R(``,e))],[`gate`,w(e)?R(`human`,w(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,E.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`div`,{className:`reader-tags`,children:[(0,E.jsx)(`span`,{className:`tag acc`,children:`Brick`}),z.bricks(e)]}),(0,E.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,E.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,E.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,E.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,E.jsxs)(T.Fragment,{children:[(0,E.jsx)(`dt`,{children:e}),(0,E.jsx)(`dd`,{children:t})]},e))}),(0,E.jsx)(`hr`,{className:`hr`}),(0,E.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,E.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,E.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:H(e)}):(0,E.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,E.jsx)(p,{body:e.body})})]})}function W({problems:e}){if(!e?.length)return null;let t=e.length;return(0,E.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,E.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,E.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,E.jsx)(`li`,{className:`mono`,children:e},e))})]})}var G={templates:{title:`No templates`,body:(0,E.jsxs)(E.Fragment,{children:[`Add one under `,(0,E.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,E.jsxs)(E.Fragment,{children:[`Add one under `,(0,E.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,E.jsxs)(E.Fragment,{children:[`Start one with `,(0,E.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.`]})}},K={templates:(0,E.jsxs)(E.Fragment,{children:[`A template wires bricks into a loop. `,(0,E.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,E.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,E.jsxs)(E.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,E.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,E.jsxs)(E.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,E.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function q({tab:e=`templates`,item:t,dataRev:n}){let a=o(n),[u,p]=s(`loops`,a),{data:y,error:b}=i(()=>r.loops(f(u)),[n,u?.id??``],`loops`),x=te(),[S,w]=(0,T.useState)(``),[k,A]=(0,T.useState)(`all`),[M,N]=(0,T.useState)(e);e!==M&&(N(e),w(``),A(`all`));let P=y?.bricks||[],R=e===`active`?x.loops&&L(x.loops):y&&(e===`bricks`?I(y.bricks,y.overridden):F(y.templates,y.bricks)),B=R||[],V=v(B),H=k===`all`?B:B.filter(e=>e.group===k),q=S.trim(),J=h(H,q),Y=!!(t&&R&&!B.some(e=>e.name===t)),X=Y?null:B.find(e=>e.name===t)||e===`active`&&B.find(C)||B[0]||null,Z={templates:y?.templates.length,bricks:y?.bricks.length,active:x.loops?.length},Q=O.find(([t])=>t===e)[1],$=e===`active`?x.error:b;return(0,E.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,E.jsx)(c,{className:`page-pick`,installs:a,value:u,onChange:p}),(0,E.jsx)(d,{error:$,style:{margin:`0 0 var(--sp-3)`}}),(0,E.jsx)(W,{problems:y?.problems}),(0,E.jsxs)(`div`,{className:`library`,children:[(0,E.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,E.jsxs)(`div`,{className:`lib-title`,children:[(0,E.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,E.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,E.jsx)(`p`,{className:`panel-note lib-lede`,children:K[e]}),(0,E.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:O.map(([t,n])=>(0,E.jsxs)(T.Fragment,{children:[(0,E.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,E.jsx)(`span`,{className:`mono dim`,children:Z[t]??``})]}),e===t&&(0,E.jsx)(_,{label:j[t],total:B.length,cats:V,cat:k,onChange:A})]},t))})]}),(0,E.jsx)(ee,{label:Q,count:q?`${J.length} of ${H.length}`:R?H.length:``,q:S,onQ:w,matched:J.length,inView:[e,t],current:X?.name,sections:O.map(([t,n])=>({key:t,label:n,n:Z[t],href:`#/loops/${t}`,on:e===t})),cats:V,cat:k,total:B.length,onCat:A,catLabel:j[e],children:R?B.length===0?(0,E.jsx)(m,{title:G[e].title,children:G[e].body}):(0,E.jsx)(g,{rows:J,activeName:X?.name,hrefOf:t=>`#/loops/${e}/${D(t.name)}`,pills:z[e]}):$?null:(0,E.jsx)(l,{})}),(0,E.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:Y?(0,E.jsx)(m,{title:(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${Q.toLowerCase()} →`}}):X?e===`active`?(0,E.jsx)(ne,{loop:X,bricks:P,onPreset:x.onPreset}):e===`bricks`?(0,E.jsx)(U,{b:X}):(0,E.jsx)(re,{t:X,bricks:P,overridden:y.overridden,runs:x.loops},X.name):e===`active`&&R?(0,E.jsx)(m,{title:`What is a loop?`,docs:{href:`#/docs/loops`,label:`How loops work →`},children:`A loop runs bricks in a ring until its gate passes.`}):null})]})]})}export{L as activeRows,I as brickRows,H as brickSource,q as default,V as howItRuns,F as templateRows};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,r}from"./sections-CtFz7HFH.js";import{
|
|
1
|
+
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,r}from"./sections-CtFz7HFH.js";import{xt as i,z as a}from"./index-DsLmKHw0.js";import{n as o,r as s}from"./Dashboard-X7GZzGJp.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=a(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=i(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:r.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:n[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:n[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-BMFDSXoB.js";import{At as i,G as a,Q as o,Tt as s,X as c,_t as l,at as u,gt as d,it as f,kt as p,ot as m,q as h,rt as g,st as _}from"./index-BNttaGQb.js";import{t as v}from"./Markdown-0ORz7tAc.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Tabs-d2RIRAKT.js";import x,{installLabel as S}from"./Library-D7L0Wdbh.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=_(),[r,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(!1),[u,d]=(0,C.useState)(``),f=e?.fingerprint||``,m=r!==null&&JSON.stringify(r)!==JSON.stringify(o),h=(0,C.useRef)(!1),g=e=>{a(e),s(e)},v=()=>a(null);return(0,C.useEffect)(()=>{if(!m)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=i(({to:e})=>(h.current||(h.current=!0,w(n).then(n=>{n&&(t(),a(null),p(e))}).finally(()=>{h.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[m,n]),{draft:r,setDraft:a,open:g,close:v,discard:async()=>m&&!await w(n)?!1:(v(),!0),dirty:m,busy:c,notice:u,setNotice:d,save:async(e,{conflict:n}={})=>{l(!0),d(``);try{return await e(f)||!0}catch(e){e.status===409?d(n??T):d(e.message);return}finally{l(!1),t()}}}}var D=n(),ee=(e,t)=>`${e} ${t}${e===1?``:`s`}`,O=e=>`≈${e.toLocaleString(`en-US`)} tokens`,te={title:``,body:``,scope:`project`,trial_until:``},k=[`project`,`global`],A=e=>e===`user`?`global`:e,j=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,M=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,re=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function N({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(j).some(M)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),k.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function ie({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),A(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:O(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var P=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function F({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ae({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(F,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${P(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:P(e,r)},r))}):null]})]},e.key??r))})]}):null}function I({onChanged:e,dataRev:t,onAction:n}){let i=_(),{targets:a,sets:o,failed:s,reason:p,reload:m}=c(r.rules,t),[h,v]=(0,C.useState)(null),b=E({data:null,reload:m}),{draft:x,busy:S,notice:w}=b,[T,k]=(0,C.useState)(``),[j,M]=(0,C.useState)(null),P=(0,C.useRef)(null),[F,I]=(0,C.useState)(0),L=e=>{P.current=e,I(e=>e+1)},R=(0,C.useRef)(null),z=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=P.current;if(P.current=null,e===null)return;let t=[...z.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?R.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[F]),o&&!o.length&&p)return(0,D.jsx)(g,{error:p,onRetry:m});if(!o)return(0,D.jsx)(f,{});let B=a.length>1,V=e=>e?.id??``,H=e=>e?.shared?`shared`:d(e),U=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${V(e)}#${t.id}`}))),W=o.filter(e=>e.data.exists).map(e=>e.inst),G=W.length>0,K=x?.target,q=K!==void 0&&K!==`new`&&!U.some(e=>e.key===K&&e.title===x.title0),J=K===`new`||q,Y=x?.to!==void 0&&!W.some(e=>V(e)===x.to),X=Y?null:W.find(e=>V(e)===x?.to)??W[0]??null,oe=Y?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):W.length>1?(0,D.jsx)(u,{installs:W,value:X,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:H}):B&&X?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:H(X)})]}):null,Z=async(t,n,i)=>{let a=o.find(e=>V(e.inst)===V(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},l(n)),{conflict:i?ne:re});return s&&i&&b.close(),e?.(),s},Q=e=>b.setDraft({...x,form:e}),$=async(e,t,n)=>{await Z(e,t,!0)&&L(n)},se=async e=>{await b.discard()&&L(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${B?` from ${H(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Z({op:`delete`,id:e.id},e.inst)&&x===null&&L(`add`)},le=async e=>{await Z({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&L(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){k(t.key),M(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},l(t.inst));M({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{k(``),m(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>B?`${H(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!q&&K===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(N,{value:x.form,onChange:Q,busy:S,onCancel:()=>se(e.key),onSave:t=>$({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(ie,{rule:e,tag:B?H(e.inst):null,usual:ge(e.inst),isOpen:h===e.key,onToggle:()=>v(h===e.key?null:e.key),onEdit:()=>{v(e.key),b.open({target:e.key,no:e.id,to:V(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:A(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),G&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:R,onClick:()=>b.open({target:`new`,title0:``,form:te}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?d(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),j?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,j.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,j.cleared.length?` Cleared: ${j.cleared.join(`, `)}.`:``,` `,j.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ae,{drafts:me,deciding:T,onDecide:de}),J&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),q?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(N,{value:x.form,onChange:Q,busy:S,writeTo:oe,onCancel:()=>se(`add`),onSave:e=>!Y&&W.length&&$({op:`add`,...e},X,`add`)})]}),G?U.length===0&&!J?(0,D.jsx)(y,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:z,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":B?H(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[B?(0,D.jsx)(`b`,{className:`mono`,children:H(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[ee(t.rules.length,`rule`),` · `,O(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:U.filter(t=>t.inst===e).map(_e)}):null]},V(e)))}):(0,D.jsxs)(y,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var L=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,R=e=>e?.id??``;function z({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=c(r.profile,t);if(!i)return(0,D.jsx)(f,{});let o=new Set(a.map(R)),s=new Set([...i.map(e=>R(e.inst)),...o]),l=n.filter(e=>s.has(R(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(R(e))?`shared`:d(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),l.map(({install:t,tag:n})=>(0,D.jsx)(B,{install:t,tag:n,onChanged:e},R(t)))]})}function B({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:c,setData:u}=s(()=>r.profile(l(e)),[]),d=E({data:i,reload:c}),{draft:p,dirty:h,busy:_,notice:b}=d,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||d.open(i.text||``)),o&&!i)return(0,D.jsx)(f,{});if(a)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(g,{error:a,onRetry:c})]});let w=p!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(m,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:d.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||d.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!h||_,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:p,fingerprint:t},l(e)),{conflict:L});t&&(u(e=>({...e,text:p,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:_?`Saving…`:`Save`})]})]}),b?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:b}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:p,onChange:e=>d.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(y,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(v,{body:T})})]}):(0,D.jsxs)(y,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var V=(e,t)=>`${e} ${t}${e===1?``:`s`}`,H=e=>e?(e.items||[]).length:null,U=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,W=e=>String(e||``).split(`
|
|
2
|
-
`).map(e=>U.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function G({topics:e,install:t,shared:n}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:V(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:V(e.n,`fact`)})]},e.topic))})]}):null}var K={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function q({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:i,onAction:c}){let l=e=>Promise.resolve(e).catch(()=>null),u=
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{At as i,Et as a,G as o,Q as s,X as c,_t as l,at as u,ct as d,it as f,jt as p,ot as m,q as h,rt as g,vt as _}from"./index-DsLmKHw0.js";import{t as v}from"./Markdown-0ORz7tAc.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Tabs-B594Pad_.js";import x,{installLabel as S}from"./Library-JaSsp6Yr.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=d(),[r,a]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(!1),[u,f]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(o),g=(0,C.useRef)(!1),_=e=>{a(e),s(e)},v=()=>a(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=p(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),a(null),i(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:a,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:c,notice:u,setNotice:f,save:async(e,{conflict:n}={})=>{l(!0),f(``);try{return await e(m)||!0}catch(e){e.status===409?f(n??T):f(e.message);return}finally{l(!1),t()}}}}var D=n(),ee=(e,t)=>`${e} ${t}${e===1?``:`s`}`,O=e=>`≈${e.toLocaleString(`en-US`)} tokens`,te={title:``,body:``,scope:`project`,trial_until:``},k=[`project`,`global`],A=e=>e===`user`?`global`:e,j=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,M=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,re=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function N({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(j).some(M)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),k.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function ie({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),A(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:O(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var P=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function F({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ae({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(F,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${P(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:P(e,r)},r))}):null]})]},e.key??r))})]}):null}function I({onChanged:e,dataRev:t,onAction:n}){let i=d(),{targets:a,sets:o,failed:s,reason:p,reload:m}=c(r.rules,t),[h,v]=(0,C.useState)(null),b=E({data:null,reload:m}),{draft:x,busy:S,notice:w}=b,[T,k]=(0,C.useState)(``),[j,M]=(0,C.useState)(null),P=(0,C.useRef)(null),[F,I]=(0,C.useState)(0),L=e=>{P.current=e,I(e=>e+1)},R=(0,C.useRef)(null),z=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=P.current;if(P.current=null,e===null)return;let t=[...z.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?R.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[F]),o&&!o.length&&p)return(0,D.jsx)(g,{error:p,onRetry:m});if(!o)return(0,D.jsx)(f,{});let B=a.length>1,V=e=>e?.id??``,H=e=>e?.shared?`shared`:l(e),U=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${V(e)}#${t.id}`}))),W=o.filter(e=>e.data.exists).map(e=>e.inst),G=W.length>0,K=x?.target,q=K!==void 0&&K!==`new`&&!U.some(e=>e.key===K&&e.title===x.title0),J=K===`new`||q,Y=x?.to!==void 0&&!W.some(e=>V(e)===x.to),X=Y?null:W.find(e=>V(e)===x?.to)??W[0]??null,oe=Y?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):W.length>1?(0,D.jsx)(u,{installs:W,value:X,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:H}):B&&X?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:H(X)})]}):null,Z=async(t,n,i)=>{let a=o.find(e=>V(e.inst)===V(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},_(n)),{conflict:i?ne:re});return s&&i&&b.close(),e?.(),s},Q=e=>b.setDraft({...x,form:e}),$=async(e,t,n)=>{await Z(e,t,!0)&&L(n)},se=async e=>{await b.discard()&&L(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${B?` from ${H(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Z({op:`delete`,id:e.id},e.inst)&&x===null&&L(`add`)},le=async e=>{await Z({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&L(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){k(t.key),M(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},_(t.inst));M({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{k(``),m(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>B?`${H(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!q&&K===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(N,{value:x.form,onChange:Q,busy:S,onCancel:()=>se(e.key),onSave:t=>$({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(ie,{rule:e,tag:B?H(e.inst):null,usual:ge(e.inst),isOpen:h===e.key,onToggle:()=>v(h===e.key?null:e.key),onEdit:()=>{v(e.key),b.open({target:e.key,no:e.id,to:V(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:A(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),G&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:R,onClick:()=>b.open({target:`new`,title0:``,form:te}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?l(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),j?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,j.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,j.cleared.length?` Cleared: ${j.cleared.join(`, `)}.`:``,` `,j.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ae,{drafts:me,deciding:T,onDecide:de}),J&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),q?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(N,{value:x.form,onChange:Q,busy:S,writeTo:oe,onCancel:()=>se(`add`),onSave:e=>!Y&&W.length&&$({op:`add`,...e},X,`add`)})]}),G?U.length===0&&!J?(0,D.jsx)(y,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:z,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":B?H(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[B?(0,D.jsx)(`b`,{className:`mono`,children:H(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[ee(t.rules.length,`rule`),` · `,O(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:U.filter(t=>t.inst===e).map(_e)}):null]},V(e)))}):(0,D.jsxs)(y,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var L=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,R=e=>e?.id??``;function z({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=c(r.profile,t);if(!i)return(0,D.jsx)(f,{});let o=new Set(a.map(R)),s=new Set([...i.map(e=>R(e.inst)),...o]),u=n.filter(e=>s.has(R(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(R(e))?`shared`:l(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),u.map(({install:t,tag:n})=>(0,D.jsx)(B,{install:t,tag:n,onChanged:e},R(t)))]})}function B({install:e,tag:t,onChanged:n}){let{data:i,error:o,loading:s,reload:c,setData:l}=a(()=>r.profile(_(e)),[]),u=E({data:i,reload:c}),{draft:d,dirty:p,busy:h,notice:b}=u,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||u.open(i.text||``)),s&&!i)return(0,D.jsx)(f,{});if(o)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(g,{error:o,onRetry:c})]});let w=d!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(m,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:u.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||u.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!p||h,onClick:async()=>{let t=await u.save(t=>r.profileSave({text:d,fingerprint:t},_(e)),{conflict:L});t&&(l(e=>({...e,text:d,seeded:!1,fingerprint:t.fingerprint||``})),u.setNotice(`Saved.`),u.close(),n?.())},children:h?`Saving…`:`Save`})]})]}),b?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:b}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:d,onChange:e=>u.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(y,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(v,{body:T})})]}):(0,D.jsxs)(y,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var V=(e,t)=>`${e} ${t}${e===1?``:`s`}`,H=e=>e?(e.items||[]).length:null,U=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,W=e=>String(e||``).split(`
|
|
2
|
+
`).map(e=>U.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function G({topics:e,install:t,shared:n}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:V(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:V(e.n,`fact`)})]},e.topic))})]}):null}var K={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function q({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:i,onAction:c}){let l=e=>Promise.resolve(e).catch(()=>null),u=s(n),{reload:d}=h(n),{data:f,reload:p}=a(()=>l(r.profile()),[n]),{data:m,reload:g}=a(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:_}=a(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),v=H(m),{data:S}=a(()=>e===`memory`?l(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,v]),C=H(_),w={memory:v,notebook:C},T={profile:f?.seeded?`template`:null,memory:v,notebook:C},E=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(o,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`+(u?.some(e=>e.shared)?` Global installs share one copy of the rules, profile and memory; a project install keeps its own.`:``)}),(0,D.jsx)(b,{page:`personal`,current:e,badges:T,label:`Personal files`}),e===`rules`&&(0,D.jsx)(I,{onChanged:d,dataRev:n,onAction:c}),e===`profile`&&(0,D.jsx)(z,{onChanged:p,dataRev:n}),E&&w[e]===0&&!t?(0,D.jsx)(y,{title:K[e].title,action:K[e].action,children:K[e].body}):E?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(G,{topics:W(S?.body),install:S?.install,shared:S?.shared}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onCountsChanged:i,onRulesChanged:()=>{d(),g()}},e)]}):null]})}export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{i}from"./motion-RlUl1osO.js";import{Dt as a,G as o,bt as s,ct as c,gt as l,rt as u,wt as d}from"./index-DsLmKHw0.js";var f=e(t(),1),p=n();function m(){let e=c(),[t,n]=(0,f.useState)(!1),[i,a]=(0,f.useState)(null);return t?(0,p.jsxs)(`p`,{className:`sub`,children:[`Server stopped. You can close this tab and reopen any time with `,(0,p.jsx)(`code`,{children:`geneseed web`}),`.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(u,{error:i}),(0,p.jsxs)(`button`,{className:`btn ghost danger-line`,onClick:async()=>{if(await e(`Stop the local Geneseed server? The console goes offline until you start it again.`,{title:`Stop the server?`,confirmLabel:`Stop server`,tone:`danger`})){a(null);try{await r.shutdown()}catch(e){if(e.status)return a(e.message)}n(!0)}},children:[(0,p.jsx)(s,{name:`x`}),`Stop server`]})]})}function h(){let e=c(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(u,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:async()=>{if(await e(`Restart the local Geneseed server? The console reconnects in a moment.`,{title:`Restart the server?`,confirmLabel:`Restart`})){n(!0),i(null);try{await a()}catch(e){i(e.message),n(!1)}}},disabled:t,children:[(0,p.jsx)(s,{name:`refresh`}),t?`Restarting…`:`Restart server`]})]})}var g=`https://github.com/Arylmera/Geneseed`,_=`https://github.com/Arylmera`,v=[[`machine`,`Machine`],[`server`,`Server`],[`about`,`About`],[`danger`,`Danger zone`]],y=[`Host check`,`token on writes`,`framing refused`,`cross-site GET refused`];function b({k:e,help:t,children:n,control:r}){return(0,p.jsxs)(`div`,{className:`sheet-row`,children:[(0,p.jsxs)(`span`,{className:`sheet-k`,children:[e,t?(0,p.jsx)(`span`,{className:`sheet-h sub`,children:t}):null]}),(0,p.jsx)(`div`,{className:`sheet-v`,children:n}),(0,p.jsx)(`div`,{className:`sheet-c`,children:r})]})}function x({id:e,title:t,head:n,className:r=``,children:i}){return(0,p.jsxs)(`section`,{id:`set-${e}`,className:`card pad-md sheet-sec ${r}`,"aria-labelledby":`${e}-h`,children:[(0,p.jsxs)(`div`,{className:`card-head`,children:[(0,p.jsx)(`h3`,{id:`${e}-h`,children:t}),n]}),i]})}function S({stale:e}){let t=e=>document.getElementById(`set-${e}`)?.scrollIntoView?.({behavior:i()?`smooth`:`auto`,block:`start`});return(0,p.jsx)(`nav`,{className:`sheet-index`,"aria-label":`On this page`,children:v.map(([n,r])=>(0,p.jsxs)(`button`,{type:`button`,className:n===`danger`?`t-bad`:``,onClick:()=>t(n),children:[r,n===`server`&&(0,p.jsx)(`span`,{className:`sheet-dot ${e?`warn`:`good`}`,"aria-hidden":`true`})]},n))})}function C({version:e}){let[t,n]=(0,f.useState)(g),[i,a]=(0,f.useState)(!0);(0,f.useEffect)(()=>{Promise.resolve(r.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),a(!!e.repo_is_github))}).catch(()=>{})},[]);let o=(e,t)=>(0,p.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,p.jsx)(s,{name:`external`})]});return(0,p.jsxs)(x,{id:`about`,title:`About`,children:[(0,p.jsx)(b,{k:`Version`,control:i?o(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,p.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),i?(0,p.jsx)(b,{k:`Credits`,control:o(t+`#-credits`,`Credits`),children:(0,p.jsx)(`span`,{className:`sub`,children:`Skills and agents adapted from other projects, with their licences`})}):null,(0,p.jsx)(b,{k:`Geneseed`,help:`MIT-licensed`,control:(0,p.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(s,{name:`github`}),i?`Source on GitHub`:`Source repo`]}),i&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(s,{name:`external`}),`Issues`]}),(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(s,{name:`external`}),`MIT License`]})]})]}),children:(0,p.jsx)(`span`,{className:`sub`,children:`A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent. One canonical source, many voices.`})}),(0,p.jsx)(b,{k:`Creator`,control:(0,p.jsxs)(`a`,{className:`btn ghost`,href:_,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(s,{name:`github`}),`@Arylmera on GitHub`]}),children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Built by `,(0,p.jsx)(`strong`,{children:`Guillaume Lemer`}),`. It started as a personal, Obsidian-vault-grown agent operating system and was distilled into the repo you are running. If you find it useful, a star on the repo or an issue with feedback is the best way to help shape what comes next.`]})})]})}var w={absent:`Off`,ours:`On · written by Geneseed`,stale:`On · points at another copy or Node`,hand:`On · set up by hand`};function T({initial:e}){let t=c(),[n,i]=(0,f.useState)(void 0),[a,o]=(0,f.useState)(null),[s,l]=(0,f.useState)(!1),d=n===void 0?e:n,m=async e=>{let n=e===`install`;if(await t(n?`Write ${d.file}? It starts the web console from ${d.root} at each login (hidden, no browser).`+(d.file.endsWith(`.plist`)?` It loads at your next login.`:``)+(d.transient?` Warning: that copy is an agent worktree or an npx cache, which can be deleted; the login item then fails.`:``):`Delete ${d.file}? The console no longer starts at login.`,n?{title:`Start at login?`,confirmLabel:d.state===`stale`?`Update`:`Write file`}:{title:`Stop starting at login?`,confirmLabel:`Delete file`,tone:`danger`})){l(!0),o(null);try{i((await r.autostart(e)).autostart)}catch(e){o(e.message),e.body?.autostart&&i(e.body.autostart)}finally{l(!1)}}},h=d?.state,g=h===`absent`||h===`stale`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:s,onClick:()=>m(`install`),children:h===`stale`?`Update`:`Turn on`}):h===`ours`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:s,onClick:()=>m(`remove`),children:`Remove`}):h===`hand`?(0,p.jsx)(`a`,{href:`#/docs/autostart`,children:`Install guide →`}):null;return(0,p.jsx)(b,{k:`Start at login`,help:d?d.file:d===null?`No login launcher on this system`:`A login launcher`,control:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(u,{error:a}),g]}),children:(0,p.jsx)(`span`,{className:`sub`,children:d===null?`not available`:w[h]??`unknown`})})}function E({overview:e,onAction:t}){let n=c(),i=e?.server,a=e?.daemon_stale,[u,g]=(0,f.useState)(null);(0,f.useEffect)(()=>{Promise.resolve(r.update?.()).then(e=>g(e||null)).catch(()=>{})},[]);let _=u?u.install??(u.git?`git`:`npm-global`):null,v=_===`git`?`Update (git pull + rebuild)`:_===`npm-global`?`Update (npm install -g + rebuild)`:`Update`;return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(o,{title:`Settings`,sub:`This copy of Geneseed and the local server.`}),(0,p.jsxs)(`div`,{className:`sheet`,children:[(0,p.jsx)(S,{stale:a}),(0,p.jsxs)(`div`,{className:`sheet-body`,children:[(0,p.jsxs)(x,{id:`machine`,title:`Machine`,children:[(0,p.jsx)(b,{k:`Geneseed`,help:`This copy of the source`,control:_===`other`?u.command?(0,p.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,p.jsx)(`code`,{className:`mono`,children:u.command})]}):null:u?.behind===!1?(0,p.jsx)(`span`,{className:`dim`,children:`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`}):(0,p.jsxs)(`button`,{className:`btn`,onClick:async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await r.installs();e=t.filter(e=>e.state===`active`).map(e=>`${l(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await n(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},children:[(0,p.jsx)(s,{name:`download`}),v]}),children:(0,p.jsx)(`span`,{className:`mono`,children:e?.version||`unknown`})}),(0,p.jsx)(b,{k:`Command on PATH`,help:`Run geneseed from any folder`,control:(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:()=>t(`link`),children:[(0,p.jsx)(s,{name:`external`}),`Add to PATH`]})})]}),(0,p.jsxs)(x,{id:`server`,title:`Server`,className:`sheet-live`,head:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`pill good`,children:`running`}),(0,p.jsxs)(`span`,{className:`mono dim`,children:[`127.0.0.1:`,window.location.port||`80`,i?` · pid ${i.pid} · up ${d(i.started)}`:``]})]}),children:[(0,p.jsx)(b,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,p.jsx)(h,{}),children:a?(0,p.jsx)(`span`,{className:`pill warn`,children:`disk has newer code → Restart`}):(0,p.jsx)(`span`,{className:`pill good`,children:`matches disk`})}),(0,p.jsx)(T,{initial:i?.autostart}),(0,p.jsx)(b,{k:`Guards`,help:`What stops another page from driving the console`,children:(0,p.jsx)(`span`,{className:`row wrap gap-8`,children:y.map(e=>(0,p.jsx)(`span`,{className:`pill good`,children:e},e))})})]}),(0,p.jsx)(C,{version:e?.version}),(0,p.jsxs)(x,{id:`danger`,title:`Danger zone`,className:`danger-zone`,children:[(0,p.jsx)(b,{k:`Stop the server`,help:`The console goes offline until you run geneseed web`,control:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{k:`The geneseed command`,help:`Installs keep working; only the command goes`,control:(0,p.jsx)(`button`,{className:`btn ghost danger-line`,onClick:()=>t(`unlink`),children:`Remove from PATH`})}),(0,p.jsx)(b,{k:`Uninstall`,children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Each install has its own Uninstall in `,(0,p.jsx)(`a`,{href:`#/installs/hosts`,children:`Hosts`}),`, bound to its host and path.`]})})]})]})]})]})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{
|
|
1
|
+
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Ot as n,kt as r}from"./index-DsLmKHw0.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 @@
|
|
|
1
|
+
var e=typeof window<`u`?window.__GENESEED_TOKEN__:``;async function t(e){let t=await e.json().catch(()=>({})),n=e.status===403&&t.error===`forbidden`?`the web server restarted since this page loaded — reload the page, then re-apply your edit`:t.error||t.message||e.statusText,r=Error(n);return r.status=e.status,r.body=t,r}var n=2e5;async function r(e){try{let r=await fetch(e,{signal:AbortSignal.timeout(n)});if(!r.ok)throw await t(r);return await r.json()}catch(e){throw e?.name===`TimeoutError`?Error(`the local server did not answer in time`,{cause:e}):e}}async function i(n,r={}){let i=await fetch(n,{method:`POST`,headers:{"X-Geneseed-Token":e||``,"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok)throw await t(i);return i.json()}var a=e=>{if(e==null)return!1;if(typeof e.host==`string`&&typeof e.path==`string`)return!0;throw Error(`an install needs both host and path`)},o=(e,t)=>{if(!a(t))return e;let n=new URLSearchParams({host:t.host,path:t.path});return`${e}${e.includes(`?`)?`&`:`?`}${n}`},s=(e,t)=>{let n=e??{};if(!a(t))return n;if(`host`in n||`path`in n)throw Error(`this body already has host or path`);return{...n,host:t.host,path:t.path}},c=e=>{try{return e()}catch(e){return Promise.reject(e)}},l=(e,t)=>c(()=>r(o(e,t))),u=(e,t,n)=>c(()=>i(e,s(t,n))),d=e=>l(`/api/overview`,e),f=()=>r(`/api/fleet`),p=()=>r(`/api/migrate/preview`),m=()=>r(`/api/kits`),h=()=>r(`/api/usage`),g=()=>r(`/api/gates`),_=()=>r(`/api/update`),v=e=>l(`/api/recent`,e),y=()=>r(`/api/activity`),b=(e,t)=>l(`/api/activity/`+encodeURIComponent(e),t),x=(e,t)=>u(`/api/activity`,{enabled:e},t),S=e=>l(`/api/setup`,e),C=(e=!1,t)=>l(e?`/api/doctor?fresh=1`:`/api/doctor`,t),w=e=>l(`/api/themes`,e),T=(e,t)=>l(`/api/catalog/${e}`,t),E=(e,t,n)=>l(`/api/item/${e}/${encodeURIComponent(t)}`,n),D=(e,t)=>u(`/api/memory/delete`,{name:e},t),O=(e,t)=>l(e?`/api/loadout/${encodeURIComponent(e)}`:`/api/loadout`,t),k=e=>l(`/api/diff`,e),A=(e,t)=>u(`/api/actions/restore`,{files:e},t),ee=409,j=e=>r(`/api/jobs/${e}`),M=()=>r(`/api/jobs`),N=e=>i(`/api/jobs/${e}/cancel`),P=new Set([`build`,`restore`]);async function F(e,t,n){let r=t||{},a=`/api/actions/${e}`;try{return await(P.has(e)?u(a,r,n):i(a,r))}catch(e){throw e.status===ee&&e.body?.error===`busy`?Error(`An action is already running.`,{cause:e}):e}}var I=e=>l(`/api/loops`,e),L=()=>r(`/api/loops/active`),R=(e,t)=>i(`/api/loops/preset`,{root:e,preset:t}),z=e=>l(`/api/factories/catalog`,e),B=()=>r(`/api/factories/active`),V=()=>r(`/api/mcp`),H=e=>i(`/api/reveal`,{path:e}),U=()=>r(`/api/installs`),W=(e,t,n)=>i(`/api/install`,{host:e,path:t,action:n}),G=(e,t,n)=>i(`/api/install`,{host:e,path:t,action:`remove`,memory:n}),K=(e,t)=>i(`/api/default-install`,{host:e,path:t}),q=()=>i(`/api/pick-folder`,{}),J=()=>r(`/api/ping`),Y=()=>i(`/api/shutdown`),X=()=>i(`/api/restart`),Z=e=>i(`/api/autostart`,{action:e}),Q=e=>e?`?harness=${encodeURIComponent(e)}`:``,$={fleet:f,migratePreview:p,kits:m,usage:h,gates:g,update:_,loops:I,activeLoops:L,factories:z,activeFactories:B,setLoopPreset:R,overview:d,recent:v,activity:y,activityDetail:b,activityToggle:x,setup:S,doctor:C,themes:w,catalog:T,item:E,loadout:O,memoryDelete:D,diff:k,restore:A,job:j,jobs:M,cancelJob:N,action:F,mcp:V,mcpReveal:H,installs:U,installToggle:W,installRemove:G,setDefaultInstall:K,pickFolder:q,ping:J,shutdown:Y,restart:X,autostart:Z,docs:(e,t)=>l(`/api/docs${Q(e)}`,t),docsPage:(e,t,n)=>l(`/api/docs/page/${encodeURIComponent(e)}${Q(t)}`,n),rules:e=>l(`/api/rules`,e),rulesMutate:(e,t)=>u(`/api/rules`,e,t),rulesDecide:(e,t)=>u(`/api/rules/decide`,e,t),rulesPromote:(e,t)=>u(`/api/rules/promote`,e,t),profile:e=>l(`/api/profile`,e),profileSave:(e,t)=>u(`/api/profile`,e,t),excludes:()=>r(`/api/excludes`),excludeMutate:(e,t)=>i(`/api/excludes`,{action:e,path:t})};export{$ as t};
|