geneseed 4.3.1 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +2 -2
  3. package/SHIPPED.md +2 -2
  4. package/adapters/opencode/plugins/geneseed-context.js +18 -1
  5. package/adapters/opencode/plugins/geneseed-learn.js +178 -46
  6. package/docs/concepts/agents.md +1 -0
  7. package/docs/concepts/hooks.md +1 -1
  8. package/docs/reference/plugin-learn.md +2 -2
  9. package/docs/understand/a-day.md +3 -3
  10. package/docs/understand/machine-claude.md +1 -1
  11. package/docs/understand/machine-opencode.md +1 -1
  12. package/harness.config.json +1 -1
  13. package/js/README.md +1 -1
  14. package/js/build/bundle.mjs +2 -0
  15. package/js/build/emit-claude.mjs +2 -0
  16. package/js/build/emit-opencode.mjs +2 -0
  17. package/js/build/stubs.mjs +9 -4
  18. package/js/cli-table.json +32 -2
  19. package/js/hosts/hooks-context.mjs +25 -1
  20. package/js/hosts/hooks-learn.mjs +42 -16
  21. package/js/hosts/memory-files.mjs +283 -60
  22. package/js/inspect/checks-build.mjs +2 -1
  23. package/js/inspect/cost.mjs +1 -1
  24. package/js/maintain/memory.mjs +38 -11
  25. package/js/web/actions.mjs +4 -3
  26. package/package.json +1 -1
  27. package/registry.json +7 -0
  28. package/src/AGENT.md.tmpl +1 -0
  29. package/src/agents/memory-curator.md +71 -0
  30. package/src/memory/README.md +41 -10
  31. package/src/skills/geneseed.md +1 -1
  32. package/src/skills/rule/consolidate.md +18 -11
  33. package/src/skills/rule.md +9 -6
  34. package/themes/_TEMPLATE.json +1 -0
  35. package/themes/biker.json +1 -0
  36. package/themes/commentator.json +1 -0
  37. package/themes/cyberpunk.json +1 -0
  38. package/themes/gamer.json +1 -0
  39. package/themes/imperial.json +1 -0
  40. package/themes/joker.json +1 -0
  41. package/themes/marvin.json +1 -0
  42. package/themes/mean.json +1 -0
  43. package/themes/military.json +1 -0
  44. package/themes/neutral.json +1 -0
  45. package/themes/pirate.json +1 -0
  46. package/themes/sports.json +1 -0
  47. package/themes/verstappen.json +1 -0
  48. package/themes/wizard.json +1 -0
  49. package/web/dist/assets/{Activity-UiGvYgEl.js → Activity-BZE6REef.js} +1 -1
  50. package/web/dist/assets/{ActivityDetail-COXCSeXn.js → ActivityDetail-DCB8Cr2W.js} +1 -1
  51. package/web/dist/assets/{Dashboard-DkdOUpke.js → Dashboard-B4Drq5wp.js} +2 -2
  52. package/web/dist/assets/{Docs-TtVyc_Dy.js → Docs-D30CiqYy.js} +1 -1
  53. package/web/dist/assets/{GreenhouseView-Bh0xq6Up.js → GreenhouseView-Djt-4oO5.js} +1 -1
  54. package/web/dist/assets/{Installs-J3IoSqk6.js → Installs-B3bw5ckh.js} +1 -1
  55. package/web/dist/assets/{JournalView-BrD33V35.js → JournalView-OWhx9YKg.js} +1 -1
  56. package/web/dist/assets/{Laws-Cjkenizx.js → Laws-B9day2FV.js} +1 -1
  57. package/web/dist/assets/Library-BpIrLH-O.js +1 -0
  58. package/web/dist/assets/{Loops-D15LDhZO.js → Loops-CxH14kyE.js} +1 -1
  59. package/web/dist/assets/{OperatorHudView-B5CcWoJ6.js → OperatorHudView-otOz6Gha.js} +1 -1
  60. package/web/dist/assets/{Personal-BBdGbJn6.js → Personal-abL6089y.js} +1 -1
  61. package/web/dist/assets/{Tabs-s8T501po.js → Tabs-DjWN0i7A.js} +1 -1
  62. package/web/dist/assets/{drawable-DALqyS4l.js → drawable-C2ZsBZCv.js} +1 -1
  63. package/web/dist/assets/{index-BP4foUp0.js → index-CdpLpPQN.js} +2 -2
  64. package/web/dist/index.html +1 -1
  65. package/web/dist/assets/Library-CKyeB096.js +0 -1
@@ -1,2 +1,2 @@
1
- import{n as e,r as t}from"./sections-GalMS0Zv.js";import{i as n,t as r}from"./react-DRhoX0kS.js";import{A as i,k as a}from"./index-BP4foUp0.js";import{t as o}from"./jobBuckets-Dbq8ZlWW.js";n();var s=r(),c=14,l=120;function u({title:e,right:t,children:n,span:r}){return(0,s.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,s.jsxs)(`div`,{className:`c-mod-head`,children:[(0,s.jsx)(`span`,{className:`c-tab`}),(0,s.jsx)(`h3`,{children:e}),t&&(0,s.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,s.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,s.jsxs)(`div`,{className:`c-kpi`,children:[(0,s.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,s.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,s.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,s.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,s.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,s.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:n,jobs:r,doctor:h,onAction:g}){let _=n.counts||{},v=t.reduce((e,t)=>e+(_[t]||0),0),y=Math.max(...t.map(e=>_[e]||0),1),b=h?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=o(r||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(r),T=Math.max(...w.map(e=>e.value),1),E=i(n.diff),D=[[`status`,n.deployed?(0,s.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,s.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,s.jsx)(`span`,{style:{textTransform:`capitalize`},children:n.theme})],[`mode`,n.emit],[`doctor`,b.length===0?(0,s.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,s.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,s.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]})],[`edits`,String(E)],[`built`,n.build_time||`—`],[`target`,(0,s.jsx)(`span`,{className:`c-dim mono`,children:n.target})]];return(0,s.jsxs)(`div`,{className:`c-root`,children:[(0,s.jsxs)(`div`,{className:`c-titlebar`,children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{className:`c-h1`,children:`HARNESS // STATUS READOUT`}),(0,s.jsxs)(`div`,{className:`c-sub`,children:[n.target,` · rendered from src/ · inherited everywhere`]})]}),(0,s.jsxs)(`div`,{className:`row gap-8`,children:[(0,s.jsxs)(`button`,{className:`btn`,onClick:()=>g(`update`),children:[(0,s.jsx)(a,{name:`refresh`}),`UPDATE`]}),(0,s.jsx)(`button`,{className:`btn ghost`,onClick:()=>g(`build-all`),children:`REBUILD`}),(0,s.jsx)(`button`,{className:`btn ghost`,onClick:()=>g(`doctor`),children:`DOCTOR`})]})]}),(0,s.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,s.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,s.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,s.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,s.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,s.jsx)(d,{label:`AGENTS`,value:_.agents??`—`}),(0,s.jsx)(d,{label:`SKILLS`,value:_.skills??`—`}),(0,s.jsx)(d,{label:`INVARIANTS`,value:_.laws??`—`}),(0,s.jsx)(d,{label:`PACKS`,value:_.doctrines?`${_.doctrines.active}/${_.doctrines.total}`:`—`}),(0,s.jsx)(d,{label:`MEMORY`,value:_.memory??`—`}),(0,s.jsx)(d,{label:`NOTEBOOK`,value:_.notebook??`—`}),(0,s.jsx)(d,{label:`EDITS`,value:E})]}),(0,s.jsxs)(`div`,{className:`c-grid`,children:[(0,s.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${v} ENTRIES`,span:2,children:(0,s.jsxs)(`table`,{className:`c-tbl`,children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{children:`SECTION`}),(0,s.jsx)(`th`,{children:`DETAIL`}),(0,s.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,s.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,s.jsx)(`tbody`,{children:t.map(t=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{className:`c-name`,children:e[t].label}),(0,s.jsx)(`td`,{className:`c-dim`,children:e[t].desc}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`div`,{className:`c-bar`,children:(0,s.jsx)(`i`,{style:{width:`${(_[t]||0)/y*100}%`,background:t===`agents`||t===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,s.jsx)(`td`,{className:(_[t]||0)>0?`num`:`num c-dim`,children:_[t]??0})]},t))})]})}),(0,s.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p,{checks:b}),(0,s.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,s.jsxs)(`div`,{className:`c-check-row`,children:[(0,s.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,s.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,s.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,s.jsx)(`p`,{className:`c-dim mono`,style:{fontSize:11},children:`No doctor run loaded yet.`})}),(0,s.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,s.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,s.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,s.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,s.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(r||[]).length} LOGGED`,children:w.length>0?(0,s.jsx)(`table`,{className:`c-tbl`,children:(0,s.jsx)(`tbody`,{children:w.map(e=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`div`,{className:`c-bar`,children:(0,s.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,s.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,s.jsx)(`p`,{className:`c-dim mono`,style:{fontSize:11},children:`No runs logged.`})}),(0,s.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,s.jsx)(`table`,{className:`c-tbl`,children:(0,s.jsxs)(`tbody`,{children:[(r||[]).slice(0,c).map(e=>{let t=e.status===`done`,n=e.status===`failed`?`bad`:t?`ok`:`acc`,r=e.output?e.output.split(`
1
+ import{n as e,r as t}from"./sections-GalMS0Zv.js";import{i as n,t as r}from"./react-DRhoX0kS.js";import{A as i,k as a}from"./index-CdpLpPQN.js";import{t as o}from"./jobBuckets-Dbq8ZlWW.js";n();var s=r(),c=14,l=120;function u({title:e,right:t,children:n,span:r}){return(0,s.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,s.jsxs)(`div`,{className:`c-mod-head`,children:[(0,s.jsx)(`span`,{className:`c-tab`}),(0,s.jsx)(`h3`,{children:e}),t&&(0,s.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,s.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,s.jsxs)(`div`,{className:`c-kpi`,children:[(0,s.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,s.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,s.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,s.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,s.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,s.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:n,jobs:r,doctor:h,onAction:g}){let _=n.counts||{},v=t.reduce((e,t)=>e+(_[t]||0),0),y=Math.max(...t.map(e=>_[e]||0),1),b=h?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=o(r||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(r),T=Math.max(...w.map(e=>e.value),1),E=i(n.diff),D=[[`status`,n.deployed?(0,s.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,s.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,s.jsx)(`span`,{style:{textTransform:`capitalize`},children:n.theme})],[`mode`,n.emit],[`doctor`,b.length===0?(0,s.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,s.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,s.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]})],[`edits`,String(E)],[`built`,n.build_time||`—`],[`target`,(0,s.jsx)(`span`,{className:`c-dim mono`,children:n.target})]];return(0,s.jsxs)(`div`,{className:`c-root`,children:[(0,s.jsxs)(`div`,{className:`c-titlebar`,children:[(0,s.jsxs)(`div`,{children:[(0,s.jsx)(`h1`,{className:`c-h1`,children:`HARNESS // STATUS READOUT`}),(0,s.jsxs)(`div`,{className:`c-sub`,children:[n.target,` · rendered from src/ · inherited everywhere`]})]}),(0,s.jsxs)(`div`,{className:`row gap-8`,children:[(0,s.jsxs)(`button`,{className:`btn`,onClick:()=>g(`update`),children:[(0,s.jsx)(a,{name:`refresh`}),`UPDATE`]}),(0,s.jsx)(`button`,{className:`btn ghost`,onClick:()=>g(`build-all`),children:`REBUILD`}),(0,s.jsx)(`button`,{className:`btn ghost`,onClick:()=>g(`doctor`),children:`DOCTOR`})]})]}),(0,s.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,s.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,s.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,s.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,s.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,s.jsx)(d,{label:`AGENTS`,value:_.agents??`—`}),(0,s.jsx)(d,{label:`SKILLS`,value:_.skills??`—`}),(0,s.jsx)(d,{label:`INVARIANTS`,value:_.laws??`—`}),(0,s.jsx)(d,{label:`PACKS`,value:_.doctrines?`${_.doctrines.active}/${_.doctrines.total}`:`—`}),(0,s.jsx)(d,{label:`MEMORY`,value:_.memory??`—`}),(0,s.jsx)(d,{label:`NOTEBOOK`,value:_.notebook??`—`}),(0,s.jsx)(d,{label:`EDITS`,value:E})]}),(0,s.jsxs)(`div`,{className:`c-grid`,children:[(0,s.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${v} ENTRIES`,span:2,children:(0,s.jsxs)(`table`,{className:`c-tbl`,children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{children:`SECTION`}),(0,s.jsx)(`th`,{children:`DETAIL`}),(0,s.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,s.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,s.jsx)(`tbody`,{children:t.map(t=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{className:`c-name`,children:e[t].label}),(0,s.jsx)(`td`,{className:`c-dim`,children:e[t].desc}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`div`,{className:`c-bar`,children:(0,s.jsx)(`i`,{style:{width:`${(_[t]||0)/y*100}%`,background:t===`agents`||t===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,s.jsx)(`td`,{className:(_[t]||0)>0?`num`:`num c-dim`,children:_[t]??0})]},t))})]})}),(0,s.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(p,{checks:b}),(0,s.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,s.jsxs)(`div`,{className:`c-check-row`,children:[(0,s.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,s.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,s.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,s.jsx)(`p`,{className:`c-dim mono`,style:{fontSize:11},children:`No doctor run loaded yet.`})}),(0,s.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,s.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,s.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,s.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,s.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(r||[]).length} LOGGED`,children:w.length>0?(0,s.jsx)(`table`,{className:`c-tbl`,children:(0,s.jsx)(`tbody`,{children:w.map(e=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,s.jsx)(`td`,{children:(0,s.jsx)(`div`,{className:`c-bar`,children:(0,s.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,s.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,s.jsx)(`p`,{className:`c-dim mono`,style:{fontSize:11},children:`No runs logged.`})}),(0,s.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,s.jsx)(`table`,{className:`c-tbl`,children:(0,s.jsxs)(`tbody`,{children:[(r||[]).slice(0,c).map(e=>{let t=e.status===`done`,n=e.status===`failed`?`bad`:t?`ok`:`acc`,r=e.output?e.output.split(`
2
2
  `)[0].slice(0,l):`—`;return(0,s.jsxs)(`tr`,{children:[(0,s.jsxs)(`td`,{style:{width:96},children:[(0,s.jsx)(`span`,{className:`c-dotmark ${n}`}),` `,(0,s.jsx)(`span`,{className:`c-dim`,children:e.action})]}),(0,s.jsx)(`td`,{className:`c-name`,style:{fontWeight:400},children:r}),(0,s.jsx)(`td`,{className:`num c-dim`,children:e.duration?`${e.duration}s`:e.status})]},e.id)}),(!r||r.length===0)&&(0,s.jsx)(`tr`,{children:(0,s.jsx)(`td`,{colSpan:`3`,className:`c-dim`,style:{fontSize:11},children:`No runs logged.`})})]})})})]})]})}export{h as default};
@@ -1 +1 @@
1
- import{s as e}from"./sections-GalMS0Zv.js";import{i as t,t as n}from"./react-DRhoX0kS.js";import{t as r}from"./api-Bp5eW_6m.js";import{F as i,_ as a,v as o,x as s,y as c}from"./index-BP4foUp0.js";import{t as l}from"./Markdown-DrXLM6TA.js";import{t as u}from"./Tabs-s8T501po.js";import d from"./Library-CKyeB096.js";var f=e(t(),1),p=n(),m={title:``,body:``,scope:`project`,trial_until:``};function h({initial:e,onCancel:t,onSave:n,busy:r}){let[i,a]=(0,f.useState)(e),o=e=>t=>a({...i,[e]:t.target.value}),s=i.title.trim()&&i.body.trim();return(0,p.jsxs)(`div`,{className:`rule-form`,children:[(0,p.jsx)(`input`,{className:`lib-filter`,type:`text`,value:i.title,onChange:o(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,"aria-label":`Rule title`}),(0,p.jsx)(`textarea`,{className:`rule-body-input`,value:i.body,onChange:o(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-label":`Rule body`}),(0,p.jsxs)(`div`,{className:`row`,style:{flexWrap:`wrap`},children:[(0,p.jsxs)(`select`,{className:`sel`,value:i.scope,onChange:o(`scope`),"aria-label":`Rule scope`,children:[(0,p.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,p.jsx)(`option`,{value:`user`,children:`scope: user (personal)`})]}),(0,p.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,p.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:i.trial_until,onChange:o(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,p.jsxs)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8},children:[(0,p.jsx)(`button`,{className:`btn sm`,disabled:!s||r,onClick:()=>n(i),children:r?`Saving…`:`Save rule`}),(0,p.jsx)(`button`,{className:`btn ghost sm`,disabled:r,onClick:t,children:`Cancel`})]})]})]})}function g({rule:e,isOpen:t,onToggle:n,onEdit:r,onDelete:i,onGraduate:a}){return(0,p.jsxs)(`div`,{className:`rule-row ${t?`on`:``}`,children:[(0,p.jsxs)(`button`,{className:`rule-head`,onClick:n,"aria-expanded":t,children:[(0,p.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,p.jsx)(`span`,{className:`rule-title`,children:e.title}),(0,p.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,p.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`})]}),t&&(0,p.jsxs)(`div`,{className:`rule-expand`,children:[(0,p.jsx)(`p`,{children:e.body}),e.source?(0,p.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,p.jsxs)(`div`,{className:`row`,style:{marginTop:10,gap:8},children:[e.status===`trial`&&(0,p.jsx)(`button`,{className:`btn sm`,onClick:a,title:`Adopt for good — drop the trial marker`,children:`Graduate`}),(0,p.jsx)(`button`,{className:`btn ghost sm`,onClick:r,children:`Edit`}),(0,p.jsx)(`button`,{className:`btn ghost sm`,onClick:i,children:`Retire`})]})]})]})}function _({onChanged:e}){let t=o(),[n,s]=(0,f.useState)(0),{data:l,error:u}=i(()=>r.rules(),[n]),[d,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(null),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(``),w=()=>s(e=>e+1);if(u)return(0,p.jsx)(a,{error:u});if(!l)return(0,p.jsx)(c,{});let T=l.rules||[],{stats:E}=l,D=Math.round(Math.max(E.rules/E.max_rules,E.tokens/E.max_tokens)*100),O=D>=100?`over`:D>=70?`warn`:``,k=async t=>{x(!0),C(``);try{await r.rulesMutate({...t,fingerprint:l.fingerprint}),y(null)}catch(e){C(e.status===409?`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy; re-apply your edit.`:e.message)}finally{x(!1),w(),e?.()}},A=async e=>{await t(`Retire rule R${e.id} — “${e.title}”? It is removed from user-rules.md.`,{title:`Retire this rule?`,confirmLabel:`Retire`})&&k({op:`delete`,id:e.id})},j=e=>k({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`eyebrow`,children:`governance · yours`}),(0,p.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,p.jsxs)(`p`,{className:`sub`,children:[`Your own standing rules, from `,(0,p.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),` beside the deployed AGENT.md. The agent obeys them with the same force as the Laws — they may tighten a Law, never repeal one — and no update ever touches the file. Keep the set small: every rule is loaded every session.`]})]}),l.exists&&v===null&&(0,p.jsx)(`button`,{className:`btn`,onClick:()=>y(`new`),children:`Add rule`})]}),l.exists&&(0,p.jsxs)(`div`,{className:`rules-meter ${O}`,children:[(0,p.jsx)(`div`,{className:`rules-meter-bar`,children:(0,p.jsx)(`div`,{className:`rules-meter-fill`,style:{width:`${Math.min(D,100)}%`}})}),(0,p.jsxs)(`span`,{className:`rules-meter-label`,children:[E.rules,`/`,E.max_rules,` rules · ~`,E.tokens,` tokens`,D>=100?` — over budget: a bloated rule set dilutes the rules that matter`:D>=70?` — getting heavy; consider merging or pruning`:``]})]}),S?(0,p.jsx)(`p`,{className:`sub rule-notice`,children:S}):null,(l.warnings||[]).map(e=>(0,p.jsxs)(`p`,{className:`sub rule-notice`,children:[`format warning: `,e]},e)),v===`new`&&(0,p.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,p.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),(0,p.jsx)(h,{initial:m,busy:b,onCancel:()=>y(null),onSave:e=>k({op:`add`,...e})})]}),l.exists?T.length===0&&v!==`new`?(0,p.jsxs)(`div`,{className:`empty`,style:{padding:48},children:[(0,p.jsx)(`div`,{className:`big`,children:`No rules yet`}),`The file is seeded and loaded every session — it is just empty. Add your first standing rule here, ask the agent for one in-session (the rule skill), or promote a recurring memory fact from the Library.`]}):(0,p.jsx)(`div`,{className:`card rules-list`,children:T.map(e=>v===e.id?(0,p.jsx)(`div`,{className:`rule-row on`,children:(0,p.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,p.jsx)(h,{initial:{title:e.title,body:e.body,scope:e.scope,trial_until:e.trial_until},busy:b,onCancel:()=>y(null),onSave:t=>k({op:`update`,id:e.id,source:e.source,...t})})})},e.id):(0,p.jsx)(g,{rule:e,isOpen:d===e.id,onToggle:()=>_(d===e.id?null:e.id),onEdit:()=>{_(e.id),y(e.id)},onDelete:()=>A(e),onGraduate:()=>j(e)},e.id))}):(0,p.jsxs)(`div`,{className:`empty`,style:{padding:48},children:[(0,p.jsx)(`div`,{className:`big`,children:`No user-rules.md here yet`}),`The build seeds it beside AGENT.md — run a build/update from the Dashboard (or`,` `,(0,p.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`) and it appears, ready for your rules.`]})]})}function v({onChanged:e}){let{data:t,error:n,loading:o,reload:u}=i(()=>r.profile(),[]),[d,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(``),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(``),[x,S]=(0,f.useState)(null),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(null);t&&t!==T&&(E(t),g(t.fingerprint||``),C?w(!1):m(t.text||``),S(e=>e||((t.text||``).trim()?`view`:`edit`)));let D=!!t&&d!==(t.text||``);return(0,f.useEffect)(()=>{if(!D)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[D]),o&&!t?(0,p.jsx)(c,{}):n?(0,p.jsx)(a,{error:n}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`eyebrow`,children:`identity · yours`}),(0,p.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,p.jsxs)(`p`,{className:`sub`,children:[`Who you are and how you like to work, from `,(0,p.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),` `,`beside the deployed AGENT.md. Unlike `,(0,p.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`, it is identity, not rules — it colours how the agent works but never binds (precedence is Laws, then rules, then this). Seeded once, never overwritten by an update. Prefer not to write it by hand? Ask the agent to run the `,(0,p.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]})]}),(0,p.jsxs)(`div`,{className:`row`,style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,p.jsx)(s,{"aria-label":`Profile mode`,children:[[`view`,`View`],[`edit`,`Edit`]].map(([e,t])=>(0,p.jsx)(`button`,{className:x===e?`on`:``,onClick:()=>S(e),children:t},e))}),x===`edit`&&(0,p.jsx)(`button`,{className:`btn`,disabled:!D||_,onClick:async()=>{v(!0),b(``);try{let t=await r.profileSave({text:d,fingerprint:h});t.ok?(g(t.fingerprint||``),b(`Saved.`),S(`view`),u(),e?.()):(w(!0),b(`${t.detail||`PROFILE.md changed on disk since you opened it.`} Your edit is kept — Save again to replace the newer version with it.`),u())}catch(e){b(e.message)}finally{v(!1)}},children:_?`Saving…`:`Save`})]})]}),y?(0,p.jsx)(`p`,{className:`sub rule-notice`,children:y}):null,x===`edit`?(0,p.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:d,onChange:e=>m(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):d.trim()?(0,p.jsx)(`div`,{className:`card pad-lg`,children:(0,p.jsx)(l,{body:d})}):(0,p.jsx)(`div`,{className:`card pad-lg`,children:(0,p.jsxs)(`p`,{className:`sub`,style:{margin:0},children:[`No profile yet — switch to Edit to write one, or ask the agent to run the`,` `,(0,p.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})})]})}var y=(e,t)=>`${t?Math.min(100,e/t*100):0}%`;function b({rules:e,profile:t,facts:n,notes:r}){let i=e?.exists?e.stats:null;if(!i)return null;let a=[{k:`Profile`,v:t?.seeded?`template`:t?.exists?`written`:`missing`,fill:t?.exists&&!t.seeded?1:0,warn:!!t?.seeded},{k:`Rules`,v:`${i.rules}/${i.max_rules}`,fill:i.rules/i.max_rules},{k:`Memory`,v:n==null?`n/a`:`${n} facts`,fill:+!!n},{k:`Notebook`,v:r==null?`n/a`:`${r} notes`,fill:+!!r}];return(0,p.jsxs)(`div`,{className:`card-row`,children:[(0,p.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-budget`,children:[(0,p.jsxs)(`div`,{className:`panel-head`,children:[(0,p.jsx)(`h2`,{id:`pc-budget`,children:`Token budget`}),(0,p.jsx)(`span`,{className:`mono dim`,children:`loaded every turn`})]}),(0,p.jsxs)(`p`,{className:`big-num`,children:[(0,p.jsx)(`span`,{className:`mono`,children:i.tokens}),` `,(0,p.jsxs)(`span`,{className:`dim`,children:[`/ `,i.max_tokens.toLocaleString(`en-US`),` tokens`]})]}),(0,p.jsx)(`span`,{className:`hbar${i.tokens>i.max_tokens?` bad`:``}`,"aria-hidden":`true`,children:(0,p.jsx)(`span`,{style:{width:y(i.tokens,i.max_tokens)}})}),(0,p.jsx)(`p`,{className:`panel-note`,children:i.rules?`${i.rules} rules in ${i.lines} lines.`:`All of it is the file’s preamble; no rule text yet.`})]}),(0,p.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-slots`,children:[(0,p.jsxs)(`div`,{className:`panel-head`,children:[(0,p.jsx)(`h2`,{id:`pc-slots`,children:`Rule slots`}),(0,p.jsxs)(`span`,{className:`mono dim`,children:[i.rules,` of `,i.max_rules]})]}),(0,p.jsx)(`div`,{className:`slots`,style:{"--slots":i.max_rules},role:`img`,"aria-label":`${i.rules} of ${i.max_rules} rule slots used`,children:Array.from({length:i.max_rules},(e,t)=>(0,p.jsx)(`span`,{className:t<i.rules?`used`:``},t))}),(0,p.jsx)(`p`,{className:`panel-note`,children:`Trial rules graduate once they have held.`})]}),(0,p.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-known`,children:[(0,p.jsx)(`div`,{className:`panel-head`,children:(0,p.jsx)(`h2`,{id:`pc-known`,children:`What the agent knows about you`})}),(0,p.jsx)(`ul`,{className:`hbars`,children:a.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsx)(`span`,{className:`hb-label`,children:e.k}),(0,p.jsx)(`span`,{className:`hb-track`,"aria-hidden":`true`,children:(0,p.jsx)(`span`,{className:`hb-ok`,style:{width:y(e.fill,1)}})}),(0,p.jsx)(`span`,{className:`mono hb-n${e.warn?` warn`:``}`,children:e.v})]},e.k))})]})]})}function x({tab:e=`rules`,item:t,setup:n,dataRev:a}){let[o,s]=(0,f.useState)(0),c=e=>Promise.resolve(e).catch(()=>null),{data:l}=i(()=>c(r.rules()),[a,o]),{data:m}=i(()=>c(r.profile()),[a,o]),{data:h}=i(()=>c(r.catalog(`notebook`)),[a],`catalog`),g=h?(h.items||[]).filter(e=>e.name!==`NOTEBOOK`&&e.name!==`README`).length:null,y=n?.facts??null,x={rules:l?.stats?.rules,profile:m?.seeded?`●`:null,memory:y,notebook:g};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`page-head`,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`h`,children:`Personal`}),(0,p.jsx)(`p`,{className:`sub`,children:`The only files you write. They survive updates, reinstalls and voice changes.`})]})}),(0,p.jsx)(u,{page:`personal`,current:e,badges:x,label:`Personal files`}),e===`rules`&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(b,{rules:l,profile:m,facts:y,notes:g}),(0,p.jsx)(_,{onChanged:()=>s(e=>e+1)})]}),e===`profile`&&(0,p.jsx)(v,{onChanged:()=>s(e=>e+1)}),(e===`memory`||e===`notebook`)&&(0,p.jsx)(d,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:a},e)]})}export{x as default};
1
+ import{s as e}from"./sections-GalMS0Zv.js";import{i as t,t as n}from"./react-DRhoX0kS.js";import{t as r}from"./api-Bp5eW_6m.js";import{F as i,_ as a,v as o,x as s,y as c}from"./index-CdpLpPQN.js";import{t as l}from"./Markdown-DrXLM6TA.js";import{t as u}from"./Tabs-DjWN0i7A.js";import d from"./Library-BpIrLH-O.js";var f=e(t(),1),p=n(),m={title:``,body:``,scope:`project`,trial_until:``};function h({initial:e,onCancel:t,onSave:n,busy:r}){let[i,a]=(0,f.useState)(e),o=e=>t=>a({...i,[e]:t.target.value}),s=i.title.trim()&&i.body.trim();return(0,p.jsxs)(`div`,{className:`rule-form`,children:[(0,p.jsx)(`input`,{className:`lib-filter`,type:`text`,value:i.title,onChange:o(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,"aria-label":`Rule title`}),(0,p.jsx)(`textarea`,{className:`rule-body-input`,value:i.body,onChange:o(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-label":`Rule body`}),(0,p.jsxs)(`div`,{className:`row`,style:{flexWrap:`wrap`},children:[(0,p.jsxs)(`select`,{className:`sel`,value:i.scope,onChange:o(`scope`),"aria-label":`Rule scope`,children:[(0,p.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,p.jsx)(`option`,{value:`user`,children:`scope: user (personal)`})]}),(0,p.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,p.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:i.trial_until,onChange:o(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,p.jsxs)(`div`,{style:{marginLeft:`auto`,display:`flex`,gap:8},children:[(0,p.jsx)(`button`,{className:`btn sm`,disabled:!s||r,onClick:()=>n(i),children:r?`Saving…`:`Save rule`}),(0,p.jsx)(`button`,{className:`btn ghost sm`,disabled:r,onClick:t,children:`Cancel`})]})]})]})}function g({rule:e,isOpen:t,onToggle:n,onEdit:r,onDelete:i,onGraduate:a}){return(0,p.jsxs)(`div`,{className:`rule-row ${t?`on`:``}`,children:[(0,p.jsxs)(`button`,{className:`rule-head`,onClick:n,"aria-expanded":t,children:[(0,p.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,p.jsx)(`span`,{className:`rule-title`,children:e.title}),(0,p.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,p.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`})]}),t&&(0,p.jsxs)(`div`,{className:`rule-expand`,children:[(0,p.jsx)(`p`,{children:e.body}),e.source?(0,p.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,p.jsxs)(`div`,{className:`row`,style:{marginTop:10,gap:8},children:[e.status===`trial`&&(0,p.jsx)(`button`,{className:`btn sm`,onClick:a,title:`Adopt for good — drop the trial marker`,children:`Graduate`}),(0,p.jsx)(`button`,{className:`btn ghost sm`,onClick:r,children:`Edit`}),(0,p.jsx)(`button`,{className:`btn ghost sm`,onClick:i,children:`Retire`})]})]})]})}function _({onChanged:e}){let t=o(),[n,s]=(0,f.useState)(0),{data:l,error:u}=i(()=>r.rules(),[n]),[d,_]=(0,f.useState)(null),[v,y]=(0,f.useState)(null),[b,x]=(0,f.useState)(!1),[S,C]=(0,f.useState)(``),w=()=>s(e=>e+1);if(u)return(0,p.jsx)(a,{error:u});if(!l)return(0,p.jsx)(c,{});let T=l.rules||[],{stats:E}=l,D=Math.round(Math.max(E.rules/E.max_rules,E.tokens/E.max_tokens)*100),O=D>=100?`over`:D>=70?`warn`:``,k=async t=>{x(!0),C(``);try{await r.rulesMutate({...t,fingerprint:l.fingerprint}),y(null)}catch(e){C(e.status===409?`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy; re-apply your edit.`:e.message)}finally{x(!1),w(),e?.()}},A=async e=>{await t(`Retire rule R${e.id} — “${e.title}”? It is removed from user-rules.md.`,{title:`Retire this rule?`,confirmLabel:`Retire`})&&k({op:`delete`,id:e.id})},j=e=>k({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``});return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`eyebrow`,children:`governance · yours`}),(0,p.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,p.jsxs)(`p`,{className:`sub`,children:[`Your own standing rules, from `,(0,p.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),` beside the deployed AGENT.md. The agent obeys them with the same force as the Laws — they may tighten a Law, never repeal one — and no update ever touches the file. Keep the set small: every rule is loaded every session.`]})]}),l.exists&&v===null&&(0,p.jsx)(`button`,{className:`btn`,onClick:()=>y(`new`),children:`Add rule`})]}),l.exists&&(0,p.jsxs)(`div`,{className:`rules-meter ${O}`,children:[(0,p.jsx)(`div`,{className:`rules-meter-bar`,children:(0,p.jsx)(`div`,{className:`rules-meter-fill`,style:{width:`${Math.min(D,100)}%`}})}),(0,p.jsxs)(`span`,{className:`rules-meter-label`,children:[E.rules,`/`,E.max_rules,` rules · ~`,E.tokens,` tokens`,D>=100?` — over budget: a bloated rule set dilutes the rules that matter`:D>=70?` — getting heavy; consider merging or pruning`:``]})]}),S?(0,p.jsx)(`p`,{className:`sub rule-notice`,children:S}):null,(l.warnings||[]).map(e=>(0,p.jsxs)(`p`,{className:`sub rule-notice`,children:[`format warning: `,e]},e)),v===`new`&&(0,p.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,p.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),(0,p.jsx)(h,{initial:m,busy:b,onCancel:()=>y(null),onSave:e=>k({op:`add`,...e})})]}),l.exists?T.length===0&&v!==`new`?(0,p.jsxs)(`div`,{className:`empty`,style:{padding:48},children:[(0,p.jsx)(`div`,{className:`big`,children:`No rules yet`}),`The file is seeded and loaded every session — it is just empty. Add your first standing rule here, ask the agent for one in-session (the rule skill), or promote a recurring memory fact from the Library.`]}):(0,p.jsx)(`div`,{className:`card rules-list`,children:T.map(e=>v===e.id?(0,p.jsx)(`div`,{className:`rule-row on`,children:(0,p.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,p.jsx)(h,{initial:{title:e.title,body:e.body,scope:e.scope,trial_until:e.trial_until},busy:b,onCancel:()=>y(null),onSave:t=>k({op:`update`,id:e.id,source:e.source,...t})})})},e.id):(0,p.jsx)(g,{rule:e,isOpen:d===e.id,onToggle:()=>_(d===e.id?null:e.id),onEdit:()=>{_(e.id),y(e.id)},onDelete:()=>A(e),onGraduate:()=>j(e)},e.id))}):(0,p.jsxs)(`div`,{className:`empty`,style:{padding:48},children:[(0,p.jsx)(`div`,{className:`big`,children:`No user-rules.md here yet`}),`The build seeds it beside AGENT.md — run a build/update from the Dashboard (or`,` `,(0,p.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`) and it appears, ready for your rules.`]})]})}function v({onChanged:e}){let{data:t,error:n,loading:o,reload:u}=i(()=>r.profile(),[]),[d,m]=(0,f.useState)(``),[h,g]=(0,f.useState)(``),[_,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)(``),[x,S]=(0,f.useState)(null),[C,w]=(0,f.useState)(!1),[T,E]=(0,f.useState)(null);t&&t!==T&&(E(t),g(t.fingerprint||``),C?w(!1):m(t.text||``),S(e=>e||((t.text||``).trim()?`view`:`edit`)));let D=!!t&&d!==(t.text||``);return(0,f.useEffect)(()=>{if(!D)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[D]),o&&!t?(0,p.jsx)(c,{}):n?(0,p.jsx)(a,{error:n}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`div`,{className:`eyebrow`,children:`identity · yours`}),(0,p.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,p.jsxs)(`p`,{className:`sub`,children:[`Who you are and how you like to work, from `,(0,p.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),` `,`beside the deployed AGENT.md. Unlike `,(0,p.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`, it is identity, not rules — it colours how the agent works but never binds (precedence is Laws, then rules, then this). Seeded once, never overwritten by an update. Prefer not to write it by hand? Ask the agent to run the `,(0,p.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]})]}),(0,p.jsxs)(`div`,{className:`row`,style:{display:`flex`,alignItems:`center`,gap:12},children:[(0,p.jsx)(s,{"aria-label":`Profile mode`,children:[[`view`,`View`],[`edit`,`Edit`]].map(([e,t])=>(0,p.jsx)(`button`,{className:x===e?`on`:``,onClick:()=>S(e),children:t},e))}),x===`edit`&&(0,p.jsx)(`button`,{className:`btn`,disabled:!D||_,onClick:async()=>{v(!0),b(``);try{let t=await r.profileSave({text:d,fingerprint:h});t.ok?(g(t.fingerprint||``),b(`Saved.`),S(`view`),u(),e?.()):(w(!0),b(`${t.detail||`PROFILE.md changed on disk since you opened it.`} Your edit is kept — Save again to replace the newer version with it.`),u())}catch(e){b(e.message)}finally{v(!1)}},children:_?`Saving…`:`Save`})]})]}),y?(0,p.jsx)(`p`,{className:`sub rule-notice`,children:y}):null,x===`edit`?(0,p.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:d,onChange:e=>m(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):d.trim()?(0,p.jsx)(`div`,{className:`card pad-lg`,children:(0,p.jsx)(l,{body:d})}):(0,p.jsx)(`div`,{className:`card pad-lg`,children:(0,p.jsxs)(`p`,{className:`sub`,style:{margin:0},children:[`No profile yet — switch to Edit to write one, or ask the agent to run the`,` `,(0,p.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})})]})}var y=(e,t)=>`${t?Math.min(100,e/t*100):0}%`;function b({rules:e,profile:t,facts:n,notes:r}){let i=e?.exists?e.stats:null;if(!i)return null;let a=[{k:`Profile`,v:t?.seeded?`template`:t?.exists?`written`:`missing`,fill:t?.exists&&!t.seeded?1:0,warn:!!t?.seeded},{k:`Rules`,v:`${i.rules}/${i.max_rules}`,fill:i.rules/i.max_rules},{k:`Memory`,v:n==null?`n/a`:`${n} facts`,fill:+!!n},{k:`Notebook`,v:r==null?`n/a`:`${r} notes`,fill:+!!r}];return(0,p.jsxs)(`div`,{className:`card-row`,children:[(0,p.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-budget`,children:[(0,p.jsxs)(`div`,{className:`panel-head`,children:[(0,p.jsx)(`h2`,{id:`pc-budget`,children:`Token budget`}),(0,p.jsx)(`span`,{className:`mono dim`,children:`loaded every turn`})]}),(0,p.jsxs)(`p`,{className:`big-num`,children:[(0,p.jsx)(`span`,{className:`mono`,children:i.tokens}),` `,(0,p.jsxs)(`span`,{className:`dim`,children:[`/ `,i.max_tokens.toLocaleString(`en-US`),` tokens`]})]}),(0,p.jsx)(`span`,{className:`hbar${i.tokens>i.max_tokens?` bad`:``}`,"aria-hidden":`true`,children:(0,p.jsx)(`span`,{style:{width:y(i.tokens,i.max_tokens)}})}),(0,p.jsx)(`p`,{className:`panel-note`,children:i.rules?`${i.rules} rules in ${i.lines} lines.`:`All of it is the file’s preamble; no rule text yet.`})]}),(0,p.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-slots`,children:[(0,p.jsxs)(`div`,{className:`panel-head`,children:[(0,p.jsx)(`h2`,{id:`pc-slots`,children:`Rule slots`}),(0,p.jsxs)(`span`,{className:`mono dim`,children:[i.rules,` of `,i.max_rules]})]}),(0,p.jsx)(`div`,{className:`slots`,style:{"--slots":i.max_rules},role:`img`,"aria-label":`${i.rules} of ${i.max_rules} rule slots used`,children:Array.from({length:i.max_rules},(e,t)=>(0,p.jsx)(`span`,{className:t<i.rules?`used`:``},t))}),(0,p.jsx)(`p`,{className:`panel-note`,children:`Trial rules graduate once they have held.`})]}),(0,p.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-known`,children:[(0,p.jsx)(`div`,{className:`panel-head`,children:(0,p.jsx)(`h2`,{id:`pc-known`,children:`What the agent knows about you`})}),(0,p.jsx)(`ul`,{className:`hbars`,children:a.map(e=>(0,p.jsxs)(`li`,{children:[(0,p.jsx)(`span`,{className:`hb-label`,children:e.k}),(0,p.jsx)(`span`,{className:`hb-track`,"aria-hidden":`true`,children:(0,p.jsx)(`span`,{className:`hb-ok`,style:{width:y(e.fill,1)}})}),(0,p.jsx)(`span`,{className:`mono hb-n${e.warn?` warn`:``}`,children:e.v})]},e.k))})]})]})}function x({tab:e=`rules`,item:t,setup:n,dataRev:a}){let[o,s]=(0,f.useState)(0),c=e=>Promise.resolve(e).catch(()=>null),{data:l}=i(()=>c(r.rules()),[a,o]),{data:m}=i(()=>c(r.profile()),[a,o]),{data:h}=i(()=>c(r.catalog(`notebook`)),[a],`catalog`),g=h?(h.items||[]).filter(e=>e.name!==`NOTEBOOK`&&e.name!==`README`).length:null,y=n?.facts??null,x={rules:l?.stats?.rules,profile:m?.seeded?`●`:null,memory:y,notebook:g};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`page-head`,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`h`,children:`Personal`}),(0,p.jsx)(`p`,{className:`sub`,children:`The only files you write. They survive updates, reinstalls and voice changes.`})]})}),(0,p.jsx)(u,{page:`personal`,current:e,badges:x,label:`Personal files`}),e===`rules`&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(b,{rules:l,profile:m,facts:y,notes:g}),(0,p.jsx)(_,{onChanged:()=>s(e=>e+1)})]}),e===`profile`&&(0,p.jsx)(v,{onChanged:()=>s(e=>e+1)}),(e===`memory`||e===`notebook`)&&(0,p.jsx)(d,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:a},e)]})}export{x as default};
@@ -1 +1 @@
1
- import"./sections-GalMS0Zv.js";import{i as e,t}from"./react-DRhoX0kS.js";import{B as n,V as r}from"./index-BP4foUp0.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};
1
+ import"./sections-GalMS0Zv.js";import{i as e,t}from"./react-DRhoX0kS.js";import{B as n,V as r}from"./index-CdpLpPQN.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};
@@ -1 +1 @@
1
- import{et as e,gt as t,lt as n,vt as r,xt as i}from"./index-BP4foUp0.js";var a=e=>{let n=1;if(e&&e.getCTM){let r=e.getCTM();r&&(n=(t(r.a*r.a+r.b*r.b)+t(r.c*r.c+r.d*r.d))/2)}return n},o=(e,t,o)=>{let s=r,c=getComputedStyle(e),l=c.strokeLinecap,u=c.vectorEffect===`non-scaling-stroke`?e:null,d=l,f=new Proxy(e,{get(e,t){let r=e[t];return t===i?e:t===`setAttribute`?(...t)=>{if(t[0]===`draw`){let n=t[1].split(` `),r=+n[0],i=+n[1],o=a(u),c=r*-s*o,f=i*s*o+c,p=s*o+(r===0&&i===1||r===1&&i===0?0:10*o)-f;if(l!==`butt`){let t=r===i?`butt`:l;d!==t&&(e.style.strokeLinecap=`${t}`,d=t)}e.setAttribute(`stroke-dashoffset`,`${c}`),e.setAttribute(`stroke-dasharray`,`${f} ${p}`)}return Reflect.apply(r,e,t)}:n(r)?(...t)=>Reflect.apply(r,e,t):r}});return e.getAttribute(`pathLength`)!==`${s}`&&(e.setAttribute(`pathLength`,`${s}`),f.setAttribute(`draw`,`${t} ${o}`)),f},s=(t,n=0,r=0)=>e(t).map(e=>o(e,n,r));export{s as t};
1
+ import{et as e,gt as t,lt as n,vt as r,xt as i}from"./index-CdpLpPQN.js";var a=e=>{let n=1;if(e&&e.getCTM){let r=e.getCTM();r&&(n=(t(r.a*r.a+r.b*r.b)+t(r.c*r.c+r.d*r.d))/2)}return n},o=(e,t,o)=>{let s=r,c=getComputedStyle(e),l=c.strokeLinecap,u=c.vectorEffect===`non-scaling-stroke`?e:null,d=l,f=new Proxy(e,{get(e,t){let r=e[t];return t===i?e:t===`setAttribute`?(...t)=>{if(t[0]===`draw`){let n=t[1].split(` `),r=+n[0],i=+n[1],o=a(u),c=r*-s*o,f=i*s*o+c,p=s*o+(r===0&&i===1||r===1&&i===0?0:10*o)-f;if(l!==`butt`){let t=r===i?`butt`:l;d!==t&&(e.style.strokeLinecap=`${t}`,d=t)}e.setAttribute(`stroke-dashoffset`,`${c}`),e.setAttribute(`stroke-dasharray`,`${f} ${p}`)}return Reflect.apply(r,e,t)}:n(r)?(...t)=>Reflect.apply(r,e,t):r}});return e.getAttribute(`pathLength`)!==`${s}`&&(e.setAttribute(`pathLength`,`${s}`),f.setAttribute(`draw`,`${t} ${o}`)),f},s=(t,n=0,r=0)=>e(t).map(e=>o(e,n,r));export{s as t};