geneseed 5.5.0 → 5.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +9 -9
- package/SHIPPED.md +1 -1
- package/docs/extending.md +1 -1
- package/docs/guides/install.md +5 -5
- package/docs/reference/profiles.md +84 -0
- package/harness.config.json +1 -1
- package/js/build/export.mjs +11 -16
- package/js/hosts/hooks.mjs +4 -1
- package/package.json +1 -1
- package/profiles/autonomous.json +14 -0
- package/profiles/corporate.json +14 -0
- package/profiles/mentor.json +13 -0
- package/profiles/minimal.json +15 -0
- package/src/agents/devops-engineer.md +6 -5
- package/src/agents/kubernetes-specialist.md +3 -1
- package/src/agents/spring-boot-engineer.md +3 -3
- package/src/agents/spring-reviewer.md +4 -2
- package/src/skills/codebase-design.md +2 -2
- package/src/skills/diagram-design/SKILL.md +12 -7
- package/src/skills/diagram-design/VENDOR.md +19 -14
- package/src/skills/diagram-design/references/layout-budget.md +7 -1
- package/src/skills/diagram-design/references/onboarding.md +1 -1
- package/src/skills/diagram-design/references/primitives-core.md +1 -1
- package/src/skills/diagram-design/references/semantic-patterns.md +1 -1
- package/src/skills/diagram-design/references/style-guide.md +1 -1
- package/src/skills/diagram-design/references/type-dependency.md +69 -0
- package/src/skills/diagram-design/references/type-event-modeling.md +36 -0
- package/src/skills/diagram-design/references/type-requirement-traceability.md +45 -0
- package/src/skills/diagram-design/references/type-sbgn.md +80 -0
- package/src/skills/diagram-design/references/type-scatter.md +1 -1
- package/src/skills/diagram-design/references/type-steps.md +180 -0
- package/src/skills/diagram-design/references/type-unit-grid.md +63 -0
- package/src/skills/geneseed-code-review.md +2 -1
- package/src/skills/parallel-agents.md +1 -1
- package/src/skills/react-view-transitions/AGENTS.md +26 -26
- package/src/skills/react-view-transitions/SKILL.md +1 -1
- package/src/skills/react-view-transitions/VENDOR.md +12 -3
- package/src/skills/spring-boot/cloud.md +19 -1
- package/src/skills/spring-boot/logging.md +5 -3
- package/src/skills/spring-boot/web.md +27 -2
- package/src/skills/spring-boot.md +4 -2
- package/src/skills/spring-data-jpa.md +18 -4
- package/src/skills/spring-testing.md +4 -0
- package/src/upstreams.json +4 -4
- package/web/dist/assets/{Activity-LKsDzsnK.js → Activity-bUSPM3Dl.js} +1 -1
- package/web/dist/assets/{ActivityDetail-DhwTfPm6.js → ActivityDetail-AHRoXeFN.js} +1 -1
- package/web/dist/assets/{Bonsai-CePMLrpr.js → Bonsai-B5XY9pid.js} +1 -1
- package/web/dist/assets/{CopyButton-CuoaJ6k7.js → CopyButton-C0wwRR9H.js} +1 -1
- package/web/dist/assets/{Dashboard-D1VKuvLe.js → Dashboard-DPAA96EI.js} +2 -2
- package/web/dist/assets/{Docs-CUrHJKaU.js → Docs-CpGDq165.js} +1 -1
- package/web/dist/assets/{Factories-Ci1XfmSy.js → Factories-cNhETa5Q.js} +1 -1
- package/web/dist/assets/{GreenhouseView-CNfH2lPK.js → GreenhouseView-DO3ADmT9.js} +1 -1
- package/web/dist/assets/{Installs-ZHQZM1iS.js → Installs-D3dDyq10.js} +1 -1
- package/web/dist/assets/{JournalView-CMsWahkS.js → JournalView--W-Lw_V9.js} +1 -1
- package/web/dist/assets/{Kits-CkliyK0n.js → Kits-ChfehxY6.js} +1 -1
- package/web/dist/assets/Laws-CNxYmV36.js +4 -0
- package/web/dist/assets/{LibRows-Brv0Hmkr.js → LibRows-CiPvsRYB.js} +1 -1
- package/web/dist/assets/{Library-BYmiLjJr.js → Library-BxQvbwVU.js} +1 -1
- package/web/dist/assets/{Loops-ytm-xJ68.js → Loops-DAblKkyq.js} +1 -1
- package/web/dist/assets/{OperatorHudView-KaqCx_HP.js → OperatorHudView-QtSaSyYm.js} +1 -1
- package/web/dist/assets/{Personal-CmcnRKYE.js → Personal-DxSGv638.js} +1 -1
- package/web/dist/assets/{Settings-tUrpdOfq.js → Settings-CgTbhvRv.js} +1 -1
- package/web/dist/assets/{Tabs-CD7etcGD.js → Tabs-Cf4X1hdz.js} +1 -1
- package/web/dist/assets/{index-COKbhFNo.js → index-B_pTwZra.js} +3 -3
- package/web/dist/assets/index-CzfImiYb.css +1 -0
- package/web/dist/index.html +2 -2
- package/web/dist/assets/Laws-hh4O3HZ4.js +0 -4
- package/web/dist/assets/index-Ba_Kg3Af.css +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,nt as u,tt as d,wt as f}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,nt as u,tt as d,wt as f}from"./index-B_pTwZra.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./CopyButton-C0wwRR9H.js";import{c as h,i as g,n as _,o as v,r as y,s as b,t as x}from"./ActiveLoops-DOJCPPPc.js";import{t as S}from"./Markdown-CxkA7940.js";import{a as ee,i as te,n as ne,o as C,s as w}from"./LibRows-CiPvsRYB.js";import{i as T}from"./motion-RlUl1osO.js";var E=e(t(),1),D=n(),O=encodeURIComponent,k=a.loops.map(e=>[e,i[e]]),A={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},j={project:`Project`,global:`Global`,shipped:`Shipped`},M={templates:`Categories`,bricks:`Origins`,active:`Statuses`},N=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function P(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var F=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function I(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return F(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>A[e.graph.category]?e.graph.category:`other`,[...Object.entries(A),[`other`,`Other`]])}function L(e,t){return F(e.map(e=>({...e,desc:e.description,override:P(t,e.name)})),e=>e.origin,Object.entries(j))}function R(e){return F(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,N)}var z=(e,t)=>(0,D.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),B={templates:e=>e.human?z(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?z(`warn`,`mutate`):null,b(e)?z(`human`,`human gate`):null,e.override?z(`acc`,e.override):null,e.available===!1?z(`bad`,`unavailable`):null],active:e=>z(_[e.status],e.status)};function V({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:(0,D.jsx)(`a`,{href:`#/loops/bricks/${O(e)}`,children:e})}),z(t.effect===`mutate`?`warn`:``,t.effect),(0,D.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,D.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),b(t)?z(`human`,b(t).toLowerCase()):null,n?z(`acc`,n):null]}):(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:e}),(0,D.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function H(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function re({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,E.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=H(e.graph),c=h(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>y(t)&&t.graph.name===e.name).length;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Template`}),A[e.graph.category]?z(``,A[e.graph.category]):null,e.human?z(`human`,`human gate`):null]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsxs)(`figure`,{className:`loop-console`,children:[(0,D.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${c.width}px`},children:(0,D.jsx)(v,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:T()?`smooth`:`auto`,block:`nearest`})}})}),(0,D.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,D.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,D.jsx)(`ol`,{children:s.map(([e,t])=>(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,D.jsxs)(`span`,{className:`loop-legend`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,D.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,D.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,D.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,D.jsx)(m,{text:u,label:`Copy command`})]}),(0,D.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,D.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,D.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,D.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}):null,(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,D.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,D.jsx)(V,{name:e,brick:o.get(e),override:P(n,e),on:i===e},e))})]})}function U(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
|
|
2
2
|
`)}\n---\n${e.body}`}function W({b:e}){let[t,n]=(0,E.useState)(!1),r=[[`effect`,z(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,D.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>z(``,e))],[`gate`,b(e)?z(`human`,b(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,D.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Brick`}),B.bricks(e)]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,D.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(`dt`,{children:e}),(0,D.jsx)(`dd`,{children:t})]},e))}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,D.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,D.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:U(e)}):(0,D.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,D.jsx)(S,{body:e.body})})]})}function G({problems:e}){if(!e?.length)return null;let t=e.length;return(0,D.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,D.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,D.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,D.jsx)(`li`,{className:`mono`,children:e},e))})]})}var K={templates:{title:`No templates`,body:(0,D.jsxs)(D.Fragment,{children:[`Add one under `,(0,D.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,D.jsxs)(D.Fragment,{children:[`Add one under `,(0,D.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,D.jsxs)(D.Fragment,{children:[`Start one with `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed loop init`}),` in a worktree, or ask the agent to run a loop. It shows up here while it runs.`]})}},q={templates:(0,D.jsxs)(D.Fragment,{children:[`A template wires bricks into a loop. `,(0,D.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,D.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,D.jsxs)(D.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,D.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,D.jsxs)(D.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,D.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function J({tab:e=`templates`,item:t,dataRev:n}){let i=s(n),[a,m]=o(`loops`,i),{data:h,error:_}=f(()=>r.loops(l(a)),[n,a?.id??``],`loops`),v=g(),[b,S]=(0,E.useState)(``),[T,A]=(0,E.useState)(`all`),[j,N]=(0,E.useState)(e);e!==j&&(N(e),S(``),A(`all`));let P=h?.bricks||[],F=e===`active`?v.loops&&R(v.loops):h&&(e===`bricks`?L(h.bricks,h.overridden):I(h.templates,h.bricks)),z=F||[],V=w(z),H=T===`all`?z:z.filter(e=>e.group===T),U=b.trim(),J=ee(H,U),Y=!!(t&&F&&!z.some(e=>e.name===t)),X=Y?null:z.find(e=>e.name===t)||e===`active`&&z.find(y)||z[0]||null,Z={templates:h?.templates.length,bricks:h?.bricks.length,active:v.loops?.length},Q=k.find(([t])=>t===e)[1],$=e===`active`?v.error:_;return(0,D.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,D.jsx)(u,{className:`page-pick`,installs:i,value:a,onChange:m}),(0,D.jsx)(c,{error:$,style:{margin:`0 0 var(--sp-3)`}}),(0,D.jsx)(G,{problems:h?.problems}),(0,D.jsxs)(`div`,{className:`library`,children:[(0,D.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,D.jsxs)(`div`,{className:`lib-title`,children:[(0,D.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,D.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,D.jsx)(`p`,{className:`panel-note lib-lede`,children:q[e]}),(0,D.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:k.map(([t,n])=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,D.jsx)(`span`,{className:`mono dim`,children:Z[t]??``})]}),e===t&&(0,D.jsx)(C,{label:M[t],total:z.length,cats:V,cat:T,onChange:A})]},t))})]}),(0,D.jsx)(te,{label:Q,count:U?`${J.length} of ${H.length}`:F?H.length:``,q:b,onQ:S,matched:J.length,inView:[e,t],current:X?.name,sections:k.map(([t,n])=>({key:t,label:n,n:Z[t],href:`#/loops/${t}`,on:e===t})),cats:V,cat:T,total:z.length,onCat:A,catLabel:M[e],children:F?z.length===0?(0,D.jsx)(p,{title:K[e].title,children:K[e].body}):(0,D.jsx)(ne,{rows:J,activeName:X?.name,hrefOf:t=>`#/loops/${e}/${O(t.name)}`,pills:B[e]}):$?null:(0,D.jsx)(d,{})}),(0,D.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:Y?(0,D.jsx)(p,{title:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${Q.toLowerCase()} →`}}):X?e===`active`?(0,D.jsx)(x,{loop:X,bricks:P,onPreset:v.onPreset}):e===`bricks`?(0,D.jsx)(W,{b:X}):(0,D.jsx)(re,{t:X,bricks:P,overridden:h.overridden,runs:v.loops},X.name):e===`active`&&F?(0,D.jsx)(p,{title:`What is a loop?`,docs:{href:`#/docs/loops`,label:`How loops work →`},children:`A loop runs bricks in a ring until its gate passes.`}):null})]})]})}export{R as activeRows,L as brickRows,U as brickSource,J as default,H as howItRuns,I as templateRows};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,vt as r}from"./index-
|
|
1
|
+
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,vt as r}from"./index-B_pTwZra.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{n as o,r as s}from"./Dashboard-DPAA96EI.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=a.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...a.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=n(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=r(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:a.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:i[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:i[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{H as i,Ot as a,W as o,Y as s,at as c,et as l,ht as u,kt as d,mt as f,nt as p,q as m,rt as h,tt as g,wt as _}from"./index-COKbhFNo.js";import{t as v}from"./Tabs-CD7etcGD.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Markdown-CxkA7940.js";import x,{installLabel as S}from"./Library-BYmiLjJr.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=c(),[r,i]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),[l,u]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(o),g=(0,C.useRef)(!1),_=e=>{i(e),s(e)},v=()=>i(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=d(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),i(null),a(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:l,notice:f,setNotice:p,save:async(e,{conflict:n}={})=>{u(!0),p(``);try{return await e(m)||!0}catch(e){e.status===409?p(n??T):p(e.message);return}finally{u(!1),t()}}}}var D=n(),O=(e,t)=>`${e} ${t}${e===1?``:`s`}`,k=e=>`≈${e.toLocaleString(`en-US`)} tokens`,ee={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(M).some(N)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),A.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),j(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:k(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var F=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function I({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ie({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(I,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${F(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:F(e,r)},r))}):null]})]},e.key??r))})]}):null}function L({onChanged:e,dataRev:t,onAction:n}){let i=c(),{targets:a,sets:o,failed:s,reason:d,reload:h}=m(r.rules,t),[_,v]=(0,C.useState)(null),b=E({data:null,reload:h}),{draft:x,busy:S,notice:w}=b,[T,A]=(0,C.useState)(``),[M,N]=(0,C.useState)(null),F=(0,C.useRef)(null),[I,L]=(0,C.useState)(0),R=e=>{F.current=e,L(e=>e+1)},z=(0,C.useRef)(null),B=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=F.current;if(F.current=null,e===null)return;let t=[...B.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?z.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[I]),o&&!o.length&&d)return(0,D.jsx)(l,{error:d,onRetry:h});if(!o)return(0,D.jsx)(g,{});let V=a.length>1,H=e=>e?.id??``,U=e=>e?.shared?`shared`:f(e),W=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${H(e)}#${t.id}`}))),G=o.filter(e=>e.data.exists).map(e=>e.inst),K=G.length>0,q=x?.target,J=q!==void 0&&q!==`new`&&!W.some(e=>e.key===q&&e.title===x.title0),Y=q===`new`||J,X=x?.to!==void 0&&!G.some(e=>H(e)===x.to),Z=X?null:G.find(e=>H(e)===x?.to)??G[0]??null,ae=X?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):G.length>1?(0,D.jsx)(p,{installs:G,value:Z,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:U}):V&&Z?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:U(Z)})]}):null,Q=async(t,n,i)=>{let a=o.find(e=>H(e.inst)===H(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},u(n)),{conflict:i?te:ne});return s&&i&&b.close(),e?.(),s},$=e=>b.setDraft({...x,form:e}),oe=async(e,t,n)=>{await Q(e,t,!0)&&R(n)},se=async e=>{await b.discard()&&R(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${V?` from ${U(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Q({op:`delete`,id:e.id},e.inst)&&x===null&&R(`add`)},le=async e=>{await Q({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&R(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){A(t.key),N(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},u(t.inst));N({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{A(``),h(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>V?`${U(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!J&&q===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,onCancel:()=>se(e.key),onSave:t=>oe({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:V?U(e.inst):null,usual:ge(e.inst),isOpen:_===e.key,onToggle:()=>v(_===e.key?null:e.key),onEdit:()=>{v(e.key),b.open({target:e.key,no:e.id,to:H(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),K&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:z,onClick:()=>b.open({target:`new`,title0:``,form:ee}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?f(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),M?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,M.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,M.cleared.length?` Cleared: ${M.cleared.join(`, `)}.`:``,` `,M.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ie,{drafts:me,deciding:T,onDecide:de}),Y&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),J?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,writeTo:ae,onCancel:()=>se(`add`),onSave:e=>!X&&G.length&&oe({op:`add`,...e},Z,`add`)})]}),K?W.length===0&&!Y?(0,D.jsx)(y,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:B,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":V?U(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[V?(0,D.jsx)(`b`,{className:`mono`,children:U(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[O(t.rules.length,`rule`),` · `,k(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:W.filter(t=>t.inst===e).map(_e)}):null]},H(e)))}):(0,D.jsxs)(y,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var R=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,z=e=>e?.id??``;function B({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=m(r.profile,t);if(!i)return(0,D.jsx)(g,{});let o=new Set(a.map(z)),s=new Set([...i.map(e=>z(e.inst)),...o]),c=n.filter(e=>s.has(z(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(z(e))?`shared`:f(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),c.map(({install:t,tag:n})=>(0,D.jsx)(V,{install:t,tag:n,onChanged:e},z(t)))]})}function V({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:s,setData:c}=_(()=>r.profile(u(e)),[]),d=E({data:i,reload:s}),{draft:f,dirty:p,busy:m,notice:v}=d,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||d.open(i.text||``)),o&&!i)return(0,D.jsx)(g,{});if(a)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(l,{error:a,onRetry:s})]});let w=f!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(h,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:d.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||d.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!p||m,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:f,fingerprint:t},u(e)),{conflict:R});t&&(c(e=>({...e,text:f,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:m?`Saving…`:`Save`})]})]}),v?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:v}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:f,onChange:e=>d.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(y,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(b,{body:T})})]}):(0,D.jsxs)(y,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var H=(e,t)=>`${e} ${t}${e===1?``:`s`}`,U=e=>e?(e.items||[]).length:null,W=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,G=e=>String(e||``).split(`
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{H as i,Ot as a,W as o,Y as s,at as c,et as l,ht as u,kt as d,mt as f,nt as p,q as m,rt as h,tt as g,wt as _}from"./index-B_pTwZra.js";import{t as v}from"./Tabs-Cf4X1hdz.js";import{t as y}from"./EmptyState-CY5Pm2xy.js";import{t as b}from"./Markdown-CxkA7940.js";import x,{installLabel as S}from"./Library-BxQvbwVU.js";var C=e(t(),1),w=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),T=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function E({data:e,reload:t}){let n=c(),[r,i]=(0,C.useState)(null),[o,s]=(0,C.useState)(null),[l,u]=(0,C.useState)(!1),[f,p]=(0,C.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(o),g=(0,C.useRef)(!1),_=e=>{i(e),s(e)},v=()=>i(null);return(0,C.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=d(({to:e})=>(g.current||(g.current=!0,w(n).then(n=>{n&&(t(),i(null),a(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:v,discard:async()=>h&&!await w(n)?!1:(v(),!0),dirty:h,busy:l,notice:f,setNotice:p,save:async(e,{conflict:n}={})=>{u(!0),p(``);try{return await e(m)||!0}catch(e){e.status===409?p(n??T):p(e.message);return}finally{u(!1),t()}}}}var D=n(),O=(e,t)=>`${e} ${t}${e===1?``:`s`}`,k=e=>`≈${e.toLocaleString(`en-US`)} tokens`,ee={title:``,body:``,scope:`project`,trial_until:``},A=[`project`,`global`],j=e=>e===`user`?`global`:e,M=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,N=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),te=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,ne=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function P({value:e,onChange:t,onCancel:n,onSave:r,busy:i,writeTo:a=null}){let[o]=(0,C.useState)(e.scope),s=n=>r=>t({...e,[n]:r.target.value}),c=e.body.trim().split(M).some(N)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,l=!(e.title.trim()&&e.body.trim()),u=!l&&!c;return(0,D.jsxs)(`div`,{className:`rule-form`,children:[a,(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule title`}),(0,D.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:s(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule body`}),(0,D.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:s(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":c?!0:void 0,"aria-describedby":c?`rule-body-error`:void 0})]}),c?(0,D.jsx)(`p`,{id:`rule-body-error`,className:`sub sub-wide rule-notice`,role:`alert`,children:c}):null,(0,D.jsxs)(`div`,{className:`row wrap`,children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`Rule scope`}),(0,D.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:s(`scope`),children:[(0,D.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,D.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),A.includes(o)?null:(0,D.jsxs)(`option`,{value:o,children:[`scope: `,o,` (as written in the file)`]})]})]}),(0,D.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,D.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:s(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,D.jsx)(`button`,{className:`btn sm`,disabled:!u||i,onClick:()=>r(e),"aria-describedby":l?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),l?(0,D.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function re({rule:e,tag:t,usual:n,isOpen:r,onToggle:i,onEdit:a,onDelete:o,onGraduate:s}){let c=t?` · ${t}`:``;return(0,D.jsxs)(`div`,{className:`rule-row ${r?`on`:``}`,children:[(0,D.jsxs)(`button`,{className:`rule-head`,onClick:i,"aria-expanded":r,"data-rule-head":e.key,children:[(0,D.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),j(e.scope)===n?null:(0,D.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,D.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`}),(0,D.jsx)(`span`,{className:`rule-chip mono`,children:k(e.tokens)})]}),r&&(0,D.jsxs)(`div`,{className:`rule-expand`,children:[(0,D.jsx)(`p`,{children:e.body}),e.source?(0,D.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,D.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:s,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}${c}`,children:`Graduate`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,"aria-label":`Edit R${e.id}${c}`,children:`Edit`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:o,"aria-label":`Retire R${e.id}${c}`,children:`Retire`})]})]})]})}var F=(e,t)=>({approve:`Approve`,reject:`Reject`,host:`Use the ${e.choice?.host} file`,shared:`Use the shared file`,both:`Keep both`})[t];function I({choice:e}){let t=(e,t,n)=>(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`rule-src`,title:t,children:e}),(0,D.jsx)(`pre`,{className:`mono`,children:n??`(absent)`})]});return(0,D.jsxs)(`div`,{className:`rule-choice`,children:[t(`Shared file`,e.shared_path,e.shared_text),t(`${e.host} file`,e.host_path,e.host_text)]})}function ie({drafts:e,deciding:t,onDecide:n}){return e.length?(0,D.jsxs)(`section`,{className:`mb-16`,"aria-labelledby":`rules-pending`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`rules-pending`,children:`Pending`}),(0,D.jsx)(`span`,{className:`mono dim`,children:e.length})]}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Waiting in `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.draft.md`}),`. A pending rule still binds on its host, and only there. Decide each one here, or ask the agent to run its rule Rite.`]}),(0,D.jsx)(`div`,{className:`card rules-list`,children:e.map((e,r)=>(0,D.jsxs)(`div`,{className:`rule-row`,children:[(0,D.jsxs)(`div`,{className:`rule-head static`,children:[(0,D.jsx)(`span`,{className:`rule-title`,children:e.title}),e.host?(0,D.jsxs)(`span`,{className:`rule-chip mono`,children:[`binds on `,e.host]}):null]}),(0,D.jsxs)(`div`,{className:`rule-expand`,children:[e.body?(0,D.jsx)(`p`,{children:e.body}):null,e.choice?(0,D.jsx)(I,{choice:e.choice}):null,e.held?(0,D.jsx)(`p`,{className:`rule-src`,children:`The shared file already holds this rule. The next rebuild clears it.`}):null,e.decisions?.length?(0,D.jsx)(`div`,{className:`row gap-8`,style:{marginTop:10},children:e.decisions.map(r=>(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:t!==``,"aria-label":`${F(e,r)} · ${e.title}`,onClick:()=>n(e,r),children:F(e,r)},r))}):null]})]},e.key??r))})]}):null}function L({onChanged:e,dataRev:t,onAction:n}){let i=c(),{targets:a,sets:o,failed:s,reason:d,reload:h}=m(r.rules,t),[_,v]=(0,C.useState)(null),b=E({data:null,reload:h}),{draft:x,busy:S,notice:w}=b,[T,A]=(0,C.useState)(``),[M,N]=(0,C.useState)(null),F=(0,C.useRef)(null),[I,L]=(0,C.useState)(0),R=e=>{F.current=e,L(e=>e+1)},z=(0,C.useRef)(null),B=(0,C.useRef)(null);if((0,C.useEffect)(()=>{let e=F.current;if(F.current=null,e===null)return;let t=[...B.current?.querySelectorAll(`[data-rule-head]`)||[]];(e===`add`?z.current:t.find(t=>t.dataset.ruleHead===e))?.focus()},[I]),o&&!o.length&&d)return(0,D.jsx)(l,{error:d,onRetry:h});if(!o)return(0,D.jsx)(g,{});let V=a.length>1,H=e=>e?.id??``,U=e=>e?.shared?`shared`:f(e),W=o.flatMap(({inst:e,data:t})=>(t.rules||[]).map(t=>({...t,inst:e,key:`${H(e)}#${t.id}`}))),G=o.filter(e=>e.data.exists).map(e=>e.inst),K=G.length>0,q=x?.target,J=q!==void 0&&q!==`new`&&!W.some(e=>e.key===q&&e.title===x.title0),Y=q===`new`||J,X=x?.to!==void 0&&!G.some(e=>H(e)===x.to),Z=X?null:G.find(e=>H(e)===x?.to)??G[0]??null,ae=X?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`alert`,children:`The install this draft was for has no user-rules.md now, so it is not saved anywhere else. Cancel it, or copy the text into a new rule.`}):G.length>1?(0,D.jsx)(p,{installs:G,value:Z,onChange:e=>b.setDraft({...x,to:e.id}),tagOf:U}):V&&Z?(0,D.jsxs)(`p`,{className:`install-pick`,children:[(0,D.jsx)(`span`,{className:`dim`,children:`Install:`}),` `,(0,D.jsx)(`span`,{className:`mono`,children:U(Z)})]}):null,Q=async(t,n,i)=>{let a=o.find(e=>H(e.inst)===H(n))?.data.fingerprint||``,s=await b.save(()=>r.rulesMutate({...t,fingerprint:a},u(n)),{conflict:i?te:ne});return s&&i&&b.close(),e?.(),s},$=e=>b.setDraft({...x,form:e}),oe=async(e,t,n)=>{await Q(e,t,!0)&&R(n)},se=async e=>{await b.discard()&&R(e)},ce=async e=>{await i(`Retire rule R${e.id} — “${e.title}”${V?` from ${U(e.inst)}`:``}? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await Q({op:`delete`,id:e.id},e.inst)&&x===null&&R(`add`)},le=async e=>{await Q({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``},e.inst)&&R(e.key)},ue=(e,t)=>{let n=e.choice?.file;return t===`approve`?i(`Approve “${e.title}”? It moves to the shared file under a new number and binds every host on this machine. A rule may tighten a law, never repeal one: check that it does not.`,{title:`Approve this rule?`,confirmLabel:`Approve`}):t===`host`?i(`Make the ${e.choice.host} file the shared ${n}? The current shared file is replaced, and a copy goes to archived-${n}/ beside it.`,{title:`Replace the shared file?`,confirmLabel:`Replace`,tone:`danger`}):t!==`shared`||i(`Keep the shared ${n}? The ${e.choice.host} file moves to archived-${n}/ beside it, and that host returns to its seed at the next rebuild.`,{title:`Move the host file aside?`,confirmLabel:`Move aside`,tone:`danger`})},de=async(t,n)=>{if(await ue(t,n)){A(t.key),N(null),b.setNotice(``);try{let e=await r.rulesDecide({key:t.key,decision:n,fingerprint:t.fingerprint},u(t.inst));N({rebuild:e.rebuild,cleared:e.cleared??[]})}catch(e){let t=e.body?.cleared?.length?` Cleared: ${e.body.cleared.join(`, `)}.`:``;b.setNotice(e.status===409?`${e.body?.detail??e.message}${t} Reloaded the fresh copy.`:e.message)}finally{A(``),h(),e?.()}}},fe=async()=>{await i(`Rebuild every active install? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&n(`build-all`)},pe=o.flatMap(({inst:e,data:t})=>(t.warnings||[]).map(t=>V?`${U(e)}: ${t}`:t)),me=o.flatMap(({inst:e,data:t})=>(t.drafts||[]).map(n=>({...n,inst:e,fingerprint:t.draft_fingerprint}))),he=o.filter(e=>e.data.exists),ge=e=>e?.scope===`project`?`project`:`global`,_e=e=>!J&&q===e.key?(0,D.jsx)(`div`,{className:`rule-row on`,children:(0,D.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,onCancel:()=>se(e.key),onSave:t=>oe({op:`update`,id:e.id,source:e.source,...t},e.inst,e.key)})})},e.key):(0,D.jsx)(re,{rule:e,tag:V?U(e.inst):null,usual:ge(e.inst),isOpen:_===e.key,onToggle:()=>v(_===e.key?null:e.key),onEdit:()=>{v(e.key),b.open({target:e.key,no:e.id,to:H(e.inst),title0:e.title,form:{title:e.title,body:e.body,scope:j(e.scope),trial_until:e.trial_until}})},onDelete:()=>ce(e),onGraduate:()=>le(e)},e.key);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{className:`head-text`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Your standing rules, from `,(0,D.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`. The agent obeys them in every session, so keep the set small. `,(0,D.jsx)(`a`,{href:`#/docs/rules`,children:`Docs`})]})]}),K&&x===null&&(0,D.jsx)(`button`,{className:`btn`,ref:z,onClick:()=>b.open({target:`new`,title0:``,form:ee}),children:`Add rule`})]}),w?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:w}):null,s.length?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Could not read user-rules.md of`,` `,s.map(e=>e?f(e):`the default install`).join(`, `),`.`]}):null,pe.map(e=>(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,children:[`format warning: `,e]},e)),M?(0,D.jsxs)(`p`,{className:`sub sub-wide`,role:`status`,children:[`Decided.`,` `,M.rebuild?`A rebuild removes the host copy.`:`The host file stays as it is.`,M.cleared.length?` Cleared: ${M.cleared.join(`, `)}.`:``,` `,M.rebuild&&n?(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:fe,children:`Rebuild all`}):null]}):null,(0,D.jsx)(ie,{drafts:me,deciding:T,onDecide:de}),Y&&(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),J?(0,D.jsxs)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:[`Rule R`,x.no,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,D.jsx)(P,{value:x.form,onChange:$,busy:S,writeTo:ae,onCancel:()=>se(`add`),onSave:e=>!X&&G.length&&oe({op:`add`,...e},Z,`add`)})]}),K?W.length===0&&!Y?(0,D.jsx)(y,{title:`No rules yet`,children:`The file is seeded and loaded every session, and it is empty. Add your first standing rule here, ask the agent for one in a session (the rule skill), or promote a recurring fact from Memory.`}):(0,D.jsx)(`div`,{ref:B,children:he.map(({inst:e,data:t})=>(0,D.jsxs)(`section`,{className:`mb-16`,"aria-label":V?U(e):`Rules`,children:[(0,D.jsxs)(`div`,{className:`rules-file`,children:[V?(0,D.jsx)(`b`,{className:`mono`,children:U(e)}):null,(0,D.jsxs)(`span`,{className:`mono dim`,children:[O(t.rules.length,`rule`),` · `,k(t.stats.tokens),` every turn · scope `,ge(e),` unless marked`]})]}),t.rules.length?(0,D.jsx)(`div`,{className:`card rules-list`,children:W.filter(t=>t.inst===e).map(_e)}):null]},H(e)))}):(0,D.jsxs)(y,{title:`No user-rules.md here yet`,children:[`The build seeds it. Rebuild on the Overview, or run`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`, and it appears, ready for your rules.`]})]})}var R=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`,z=e=>e?.id??``;function B({onChanged:e,dataRev:t}){let{targets:n,sets:i,failed:a}=m(r.profile,t);if(!i)return(0,D.jsx)(g,{});let o=new Set(a.map(z)),s=new Set([...i.map(e=>z(e.inst)),...o]),c=n.filter(e=>s.has(z(e))).map(e=>({install:e,tag:n.length<2?null:e?.shared&&!o.has(z(e))?`shared`:f(e)}));return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`mb-16`,children:[(0,D.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,D.jsxs)(`p`,{className:`sub sub-wide`,children:[`Who you are and how you like to work, from `,(0,D.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),`. It guides the agent and never binds it. `,(0,D.jsx)(`a`,{href:`#/docs/collaboration`,children:`Docs`})]})]}),c.map(({install:t,tag:n})=>(0,D.jsx)(V,{install:t,tag:n,onChanged:e},z(t)))]})}function V({install:e,tag:t,onChanged:n}){let{data:i,error:a,loading:o,reload:s,setData:c}=_(()=>r.profile(u(e)),[]),d=E({data:i,reload:s}),{draft:f,dirty:p,busy:m,notice:v}=d,[x,S]=(0,C.useState)(!1);if(i&&!x&&(S(!0),(i.text||``).trim()||d.open(i.text||``)),o&&!i)return(0,D.jsx)(g,{});if(a)return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null,(0,D.jsx)(l,{error:a,onRetry:s})]});let w=f!==null,T=i?.text||``;return(0,D.jsxs)(`section`,{"aria-label":t?`Profile, ${t}`:void 0,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsx)(`div`,{children:t?(0,D.jsx)(`span`,{className:`rule-chip mono`,children:t}):null}),(0,D.jsxs)(`div`,{className:`row`,children:[(0,D.jsxs)(h,{"aria-label":t?`Profile mode, ${t}`:`Profile mode`,children:[(0,D.jsx)(`button`,{className:w?``:`on`,"aria-pressed":!w,onClick:d.discard,children:`View`}),(0,D.jsx)(`button`,{className:w?`on`:``,"aria-pressed":w,onClick:()=>w||d.open(T),children:`Edit`})]}),w&&(0,D.jsx)(`button`,{className:`btn`,disabled:!p||m,onClick:async()=>{let t=await d.save(t=>r.profileSave({text:f,fingerprint:t},u(e)),{conflict:R});t&&(c(e=>({...e,text:f,seeded:!1,fingerprint:t.fingerprint||``})),d.setNotice(`Saved.`),d.close(),n?.())},children:m?`Saving…`:`Save`})]})]}),v?(0,D.jsx)(`p`,{className:`sub sub-wide rule-notice`,role:`status`,children:v}):null,w?(0,D.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:f,onChange:e=>d.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):T.trim()?(0,D.jsxs)(D.Fragment,{children:[i?.seeded?(0,D.jsxs)(y,{title:`This is still the template`,children:[`Ask the agent to run the `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,D.jsx)(`div`,{className:`card pad-lg`,children:(0,D.jsx)(b,{body:T})})]}):(0,D.jsxs)(y,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,D.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var H=(e,t)=>`${e} ${t}${e===1?``:`s`}`,U=e=>e?(e.items||[]).length:null,W=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,G=e=>String(e||``).split(`
|
|
2
2
|
`).map(e=>W.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function K({topics:e,install:t,shared:n}){return e.length?(0,D.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),t&&!n?(0,D.jsx)(`span`,{className:`mono dim`,children:S(t)}):null,(0,D.jsx)(`span`,{className:`mono dim`,children:H(e.length,`topic`)})]}),(0,D.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,D.jsx)(`span`,{className:`mono hb-n`,children:H(e.n,`fact`)})]},e.topic))})]}):null}var q={memory:{title:`No facts yet`,body:(0,D.jsxs)(`div`,{className:`pm-first`,children:[(0,D.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,D.jsxs)(`ul`,{children:[(0,D.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,D.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,D.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,D.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function J({tab:e=`rules`,item:t,dataRev:n,onCountsChanged:a,onAction:c}){let l=e=>Promise.resolve(e).catch(()=>null),u=s(n),{reload:d}=o(n),{data:f,error:p,reload:m}=_(()=>r.profile(),[n]),{data:h,reload:g}=_(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:b}=_(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),S=U(h),{data:C}=_(()=>e===`memory`?l(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,S]),w=U(b),T={memory:S,notebook:w},E={profile:p?`read failed`:f?.seeded?`template`:null,memory:S,notebook:w},O=e===`memory`||e===`notebook`;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(i,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`+(u?.some(e=>e.shared)?` Global installs share one copy of the rules, profile and memory; a project install keeps its own.`:``)}),(0,D.jsx)(v,{page:`personal`,current:e,badges:E,label:`Personal files`}),e===`rules`&&(0,D.jsx)(L,{onChanged:d,dataRev:n,onAction:c}),e===`profile`&&(0,D.jsx)(B,{onChanged:m,dataRev:n}),O&&T[e]===0&&!t?(0,D.jsx)(y,{title:q[e].title,action:q[e].action,children:q[e].body}):O?(0,D.jsxs)(D.Fragment,{children:[e===`memory`&&(0,D.jsx)(K,{topics:G(C?.body),install:C?.install,shared:C?.shared}),(0,D.jsx)(x,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onCountsChanged:a,onRulesChanged:()=>{d(),g()}},e)]}):null]})}export{J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{H as r,St as i,Tt as a,_t as o,at as s,et as c,pt as l}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{H as r,St as i,Tt as a,_t as o,at as s,et as c,pt as l}from"./index-B_pTwZra.js";import{t as u}from"./api-CZ-x0iWG.js";import{i as d}from"./motion-RlUl1osO.js";var f=e(t(),1),p=n();function m(){let e=s(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return t?(0,p.jsxs)(`p`,{className:`sub`,children:[`Server stopped. You can close this tab and reopen any time with `,(0,p.jsx)(`code`,{children:`geneseed web`}),`.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost danger-line`,onClick:async()=>{if(await e(`Stop the local Geneseed server? The console goes offline until you start it again.`,{title:`Stop the server?`,confirmLabel:`Stop server`,tone:`danger`})){i(null);try{await u.shutdown()}catch(e){if(e.status)return i(e.message)}n(!0)}},children:[(0,p.jsx)(o,{name:`x`}),`Stop server`]})]})}function h(){let e=s(),[t,n]=(0,f.useState)(!1),[r,i]=(0,f.useState)(null);return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:r}),(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:async()=>{if(await e(`Restart the local Geneseed server? The console reconnects in a moment.`,{title:`Restart the server?`,confirmLabel:`Restart`})){n(!0),i(null);try{await a()}catch(e){i(e.message),n(!1)}}},disabled:t,children:[(0,p.jsx)(o,{name:`refresh`}),t?`Restarting…`:`Restart server`]})]})}var g=`https://github.com/Arylmera/Geneseed`,_=`https://github.com/Arylmera`,v=[[`machine`,`Machine`],[`server`,`Server`],[`about`,`About`],[`danger`,`Danger zone`]],y=[`Host check`,`token on writes`,`framing refused`,`cross-site GET refused`];function b({k:e,help:t,children:n,control:r}){return(0,p.jsxs)(`div`,{className:`sheet-row`,children:[(0,p.jsxs)(`span`,{className:`sheet-k`,children:[e,t?(0,p.jsx)(`span`,{className:`sheet-h sub`,children:t}):null]}),(0,p.jsx)(`div`,{className:`sheet-v`,children:n}),(0,p.jsx)(`div`,{className:`sheet-c`,children:r})]})}function x({id:e,title:t,head:n,className:r=``,children:i}){return(0,p.jsxs)(`section`,{id:`set-${e}`,className:`card pad-md sheet-sec ${r}`,"aria-labelledby":`${e}-h`,children:[(0,p.jsxs)(`div`,{className:`card-head`,children:[(0,p.jsx)(`h3`,{id:`${e}-h`,children:t}),n]}),i]})}function S({stale:e}){let t=e=>document.getElementById(`set-${e}`)?.scrollIntoView?.({behavior:d()?`smooth`:`auto`,block:`start`});return(0,p.jsx)(`nav`,{className:`sheet-index`,"aria-label":`On this page`,children:v.map(([n,r])=>(0,p.jsxs)(`button`,{type:`button`,className:n===`danger`?`t-bad`:``,onClick:()=>t(n),children:[r,n===`server`&&(0,p.jsx)(`span`,{className:`sheet-dot ${e?`warn`:`good`}`,"aria-hidden":`true`})]},n))})}function C({version:e}){let[t,n]=(0,f.useState)(g),[r,i]=(0,f.useState)(!0);(0,f.useEffect)(()=>{Promise.resolve(u.docsPage?.(`about`)).then(e=>{e?.repo&&(n(e.repo),i(!!e.repo_is_github))}).catch(()=>{})},[]);let a=(e,t)=>(0,p.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:[t,` `,(0,p.jsx)(o,{name:`external`})]});return(0,p.jsxs)(x,{id:`about`,title:`About`,children:[(0,p.jsx)(b,{k:`Version`,control:r?a(t+`/blob/main/CHANGELOG.md`,`Changelog`):null,children:(0,p.jsx)(`span`,{className:`mono`,children:e||`unknown`})}),r?(0,p.jsx)(b,{k:`Credits`,control:a(t+`#-credits`,`Credits`),children:(0,p.jsx)(`span`,{className:`sub`,children:`Skills and agents adapted from other projects, with their licences`})}):null,(0,p.jsx)(b,{k:`Geneseed`,help:`MIT-licensed`,control:(0,p.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`github`}),r?`Source on GitHub`:`Source repo`]}),r&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/issues`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`external`}),`Issues`]}),(0,p.jsxs)(`a`,{className:`btn ghost`,href:t+`/blob/main/LICENSE`,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`external`}),`MIT License`]})]})]}),children:(0,p.jsx)(`span`,{className:`sub`,children:`A portable, theme-able harness you implant once and use everywhere to grow a disciplined AI coding agent. One canonical source, many voices.`})}),(0,p.jsx)(b,{k:`Creator`,control:(0,p.jsxs)(`a`,{className:`btn ghost`,href:_,target:`_blank`,rel:`noreferrer`,children:[(0,p.jsx)(o,{name:`github`}),`@Arylmera on GitHub`]}),children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Built by `,(0,p.jsx)(`strong`,{children:`Guillaume Lemer`}),`. It started as a personal, Obsidian-vault-grown agent operating system and was distilled into the repo you are running. If you find it useful, a star on the repo or an issue with feedback is the best way to help shape what comes next.`]})})]})}var w={absent:`Off`,ours:`On · written by Geneseed`,stale:`On · points at another copy or Node`,hand:`On · set up by hand`};function T({initial:e}){let t=s(),[n,r]=(0,f.useState)(void 0),[i,a]=(0,f.useState)(null),[o,l]=(0,f.useState)(!1),d=n===void 0?e:n,m=async e=>{let n=e===`install`;if(await t(n?`Write ${d.file}? It starts the web console from ${d.root} at each login (hidden, no browser).`+(d.file.endsWith(`.plist`)?` It loads at your next login.`:``)+(d.transient?` Warning: that copy is an agent worktree or an npx cache, which can be deleted; the login item then fails.`:``):`Delete ${d.file}? The console no longer starts at login.`,n?{title:`Start at login?`,confirmLabel:d.state===`stale`?`Update`:`Write file`}:{title:`Stop starting at login?`,confirmLabel:`Delete file`,tone:`danger`})){l(!0),a(null);try{r((await u.autostart(e)).autostart)}catch(e){a(e.message),e.body?.autostart&&r(e.body.autostart)}finally{l(!1)}}},h=d?.state,g=h===`absent`||h===`stale`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>m(`install`),children:h===`stale`?`Update`:`Turn on`}):h===`ours`?(0,p.jsx)(`button`,{className:`btn ghost`,disabled:o,onClick:()=>m(`remove`),children:`Remove`}):h===`hand`?(0,p.jsx)(`a`,{href:`#/docs/autostart`,children:`Install guide →`}):null;return(0,p.jsx)(b,{k:`Start at login`,help:d?d.file:d===null?`No login launcher on this system`:`A login launcher`,control:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{error:i}),g]}),children:(0,p.jsx)(`span`,{className:`sub`,children:d===null?`not available`:w[h]??`unknown`})})}function E({overview:e,onAction:t}){let n=s(),a=e?.server,c=e?.daemon_stale,[d,g]=(0,f.useState)(null);(0,f.useEffect)(()=>{Promise.resolve(u.update?.()).then(e=>g(e||null)).catch(()=>{})},[]);let _=d?d.install??(d.git?`git`:`npm-global`):null,v=_===`git`?`Update (git pull + rebuild)`:_===`npm-global`?`Update (npm install -g + rebuild)`:`Update`;return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(r,{title:`Settings`,sub:`This copy of Geneseed and the local server.`}),(0,p.jsxs)(`div`,{className:`sheet`,children:[(0,p.jsx)(S,{stale:c}),(0,p.jsxs)(`div`,{className:`sheet-body`,children:[(0,p.jsxs)(x,{id:`machine`,title:`Machine`,children:[(0,p.jsx)(b,{k:`Geneseed`,help:`This copy of the source`,control:_===`other`?d.command?(0,p.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,p.jsx)(`code`,{className:`mono`,children:d.command})]}):null:d?.behind===!1?(0,p.jsx)(`span`,{className:`dim`,children:`This checkout cannot pull: it has local changes, a detached HEAD, no upstream or a diverged branch.`}):(0,p.jsxs)(`button`,{className:`btn`,onClick:async()=>{let e=`the installs it finds`;try{let{installs:t=[]}=await u.installs();e=t.filter(e=>e.state===`active`).map(e=>`${l(e)} · ${e.scope}`).join(`, `)||`none`}catch{}await n(`Update Geneseed, then rebuild every active install: ${e}? Each is rebuilt in place with its own settings; files you edited are kept.`,{title:`Update and rebuild?`,confirmLabel:`Update`})&&t(`update`)},children:[(0,p.jsx)(o,{name:`download`}),v]}),children:(0,p.jsx)(`span`,{className:`mono`,children:e?.version||`unknown`})}),(0,p.jsx)(b,{k:`Command on PATH`,help:`Run geneseed from any folder`,control:(0,p.jsxs)(`button`,{className:`btn ghost`,onClick:()=>t(`link`),children:[(0,p.jsx)(o,{name:`external`}),`Add to PATH`]})})]}),(0,p.jsxs)(x,{id:`server`,title:`Server`,className:`sheet-live`,head:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`span`,{className:`pill good`,children:`running`}),(0,p.jsxs)(`span`,{className:`mono dim`,children:[`127.0.0.1:`,window.location.port||`80`,a?` · pid ${a.pid} · up ${i(a.started)}`:``]})]}),children:[(0,p.jsx)(b,{k:`Code`,help:`The page you see matches the build on disk`,control:(0,p.jsx)(h,{}),children:c?(0,p.jsx)(`span`,{className:`pill warn`,children:`disk has newer code → Restart`}):(0,p.jsx)(`span`,{className:`pill good`,children:`matches disk`})}),(0,p.jsx)(T,{initial:a?.autostart}),(0,p.jsx)(b,{k:`Guards`,help:`What stops another page from driving the console`,children:(0,p.jsx)(`span`,{className:`row wrap gap-8`,children:y.map(e=>(0,p.jsx)(`span`,{className:`pill good`,children:e},e))})})]}),(0,p.jsx)(C,{version:e?.version}),(0,p.jsxs)(x,{id:`danger`,title:`Danger zone`,className:`danger-zone`,children:[(0,p.jsx)(b,{k:`Stop the server`,help:`The console goes offline until you run geneseed web`,control:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{k:`The geneseed command`,help:`Installs keep working; only the command goes`,control:(0,p.jsx)(`button`,{className:`btn ghost danger-line`,onClick:()=>t(`unlink`),children:`Remove from PATH`})}),(0,p.jsx)(b,{k:`Uninstall`,children:(0,p.jsxs)(`span`,{className:`sub`,children:[`Each install has its own Uninstall in `,(0,p.jsx)(`a`,{href:`#/installs/hosts`,children:`Hosts`}),`, bound to its host and path.`]})})]})]})]})]})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Dt as n,Et as r}from"./index-
|
|
1
|
+
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{Dt as n,Et as r}from"./index-B_pTwZra.js";e();var i=t();function a({page:e,current:t,badges:a={},label:o}){return(0,i.jsx)(`nav`,{className:`tabs`,"aria-label":o,children:r[e].map(r=>(0,i.jsxs)(`a`,{href:`#/${e}/${r}`,className:t===r?`on`:``,"aria-current":t===r?`page`:void 0,children:[n[r],a[r]==null?null:(0,i.jsx)(`span`,{className:`tab-badge`,children:a[r]})]},r))})}export{a as t};
|