geneseed 5.3.0 → 5.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 (198) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +23 -20
  3. package/SHIPPED.md +7 -7
  4. package/adapters/bob/README.md +31 -18
  5. package/adapters/claude-code/README.md +27 -22
  6. package/adapters/openclaude/README.md +18 -8
  7. package/adapters/opencode/HOW-OPENCODE-LOADS.md +8 -3
  8. package/adapters/opencode/README.md +3 -2
  9. package/adapters/opencode/plugins/geneseed-activity.js +20 -21
  10. package/adapters/opencode/plugins/geneseed-context.js +175 -62
  11. package/adapters/opencode/plugins/geneseed-guard.js +419 -205
  12. package/adapters/opencode/plugins/geneseed-workflow.js +3 -2
  13. package/adapters/opencode/workflows/_runtime.js +3 -2
  14. package/bin/geneseed-cli.mjs +7 -0
  15. package/bin/geneseed-hook.mjs +59 -11
  16. package/docs/PRD.md +1 -1
  17. package/docs/README.md +1 -0
  18. package/docs/concepts/agents.md +1 -1
  19. package/docs/concepts/collaboration.md +2 -2
  20. package/docs/concepts/enforcement-table.md +5 -2
  21. package/docs/concepts/exclusions.md +18 -4
  22. package/docs/concepts/footprint.md +11 -1
  23. package/docs/concepts/foreman-mode.md +1 -1
  24. package/docs/concepts/hook-gates.md +5 -5
  25. package/docs/concepts/hooks.md +4 -3
  26. package/docs/concepts/host-matrix.md +24 -6
  27. package/docs/concepts/kits.md +12 -2
  28. package/docs/concepts/loop-bricks.md +3 -3
  29. package/docs/concepts/loops.md +6 -4
  30. package/docs/concepts/ownership.md +1 -1
  31. package/docs/concepts/rules.md +2 -2
  32. package/docs/concepts/skills.md +1 -1
  33. package/docs/design-history.md +8 -0
  34. package/docs/extending.md +112 -35
  35. package/docs/guides/auto-merge.md +100 -0
  36. package/docs/guides/choose-your-setup.md +1 -1
  37. package/docs/guides/headless.md +1 -1
  38. package/docs/guides/install-bob.md +2 -2
  39. package/docs/guides/install-clone.md +1 -1
  40. package/docs/guides/install-openclaude.md +1 -1
  41. package/docs/guides/install.md +1 -1
  42. package/docs/guides/loop-finish.md +3 -3
  43. package/docs/guides/loop-running.md +4 -4
  44. package/docs/guides/project-context.md +1 -1
  45. package/docs/guides/run-a-factory.md +2 -2
  46. package/docs/guides/setup-doctrines.md +2 -2
  47. package/docs/guides/setup-footprint.md +1 -1
  48. package/docs/guides/uninstall.md +3 -3
  49. package/docs/guides/upgrade.md +1 -1
  50. package/docs/guides/verify.md +12 -0
  51. package/docs/guides/worktree.md +1 -1
  52. package/docs/reference/environment.md +5 -2
  53. package/docs/reference/plugin-activity.md +1 -1
  54. package/docs/reference/plugin-guard.md +1 -1
  55. package/docs/reference/plugin-learn.md +1 -1
  56. package/docs/reference/plugin-workflow.md +1 -1
  57. package/docs/reference/troubleshoot-doctor.md +2 -2
  58. package/docs/reference/troubleshoot-hooks.md +2 -2
  59. package/docs/reference/troubleshoot-install.md +3 -3
  60. package/docs/reference/troubleshoot-tools.md +1 -1
  61. package/docs/token-footprint.md +68 -4
  62. package/docs/understand/design-choices-hosts.md +1 -1
  63. package/docs/understand/design-choices-shape.md +1 -0
  64. package/docs/understand/enforced-vs-asked.md +2 -2
  65. package/docs/understand/machine-bob.md +1 -1
  66. package/docs/understand/machine-claude.md +2 -2
  67. package/docs/understand/on-your-machine.md +1 -1
  68. package/docs/web-ui.md +10 -5
  69. package/harness.config.json +1 -1
  70. package/js/README.md +5 -3
  71. package/js/build/args.mjs +13 -2
  72. package/js/build/driver.mjs +34 -7
  73. package/js/build/emit-claude.mjs +9 -5
  74. package/js/build/emit-opencode.mjs +13 -9
  75. package/js/build/generate.mjs +10 -165
  76. package/js/build/profile.mjs +318 -0
  77. package/js/build/render.mjs +81 -3
  78. package/js/build/retired-skills.mjs +60 -13
  79. package/js/build/source.mjs +15 -1
  80. package/js/build/stubs.mjs +4 -1
  81. package/js/cli-table.json +48 -3
  82. package/js/hosts/done-checks.mjs +6 -0
  83. package/js/hosts/geneseed-dir.mjs +3 -2
  84. package/js/hosts/gitref.mjs +5 -3
  85. package/js/hosts/hook-tap.mjs +104 -0
  86. package/js/hosts/hooks-context.mjs +4 -2
  87. package/js/hosts/hooks-done.mjs +345 -55
  88. package/js/hosts/hooks-learn.mjs +51 -19
  89. package/js/hosts/hooks-prims.mjs +5 -3
  90. package/js/hosts/hooks.mjs +172 -19
  91. package/js/hosts/hosts.mjs +80 -12
  92. package/js/hosts/installs.mjs +26 -1
  93. package/js/hosts/native.mjs +33 -7
  94. package/js/hosts/owned.mjs +7 -6
  95. package/js/hosts/ownership-gate.mjs +14 -1
  96. package/js/hosts/settings.mjs +273 -105
  97. package/js/hosts/shim.mjs +4 -4
  98. package/js/hosts/usage.mjs +9 -3
  99. package/js/inspect/checks-constitution.mjs +32 -0
  100. package/js/inspect/checks-probe.mjs +66 -5
  101. package/js/inspect/checks-repo.mjs +196 -2
  102. package/js/inspect/cost.mjs +34 -2
  103. package/js/inspect/diff.mjs +21 -3
  104. package/js/inspect/doctor.mjs +6 -1
  105. package/js/inspect/inventory.mjs +1 -1
  106. package/js/lib/machine-dir.mjs +1 -1
  107. package/js/lib/node-floor.mjs +46 -6
  108. package/js/maintain/setup.mjs +5 -1
  109. package/js/maintain/uninstall.mjs +42 -16
  110. package/js/maintain/update.mjs +4 -2
  111. package/js/web/actions.mjs +17 -12
  112. package/js/web/api.mjs +7 -2
  113. package/package.json +1 -1
  114. package/registry.json +14 -0
  115. package/src/AGENT.md.tmpl +15 -17
  116. package/src/bricks/pr-open.md +3 -2
  117. package/src/doctrines/ops.md +2 -2
  118. package/src/doctrines/process.md +40 -36
  119. package/src/factories/analysis-to-build.json +1 -1
  120. package/src/factories/bug-report-to-fix.json +1 -1
  121. package/src/factories/issue-to-pr.json +1 -1
  122. package/src/kits/terminal-tools/rules.md +10 -0
  123. package/src/kits/terminal-tools.json +13 -0
  124. package/src/licenses/herdr.txt +201 -0
  125. package/src/modes/foreman.md +6 -3
  126. package/src/skills/_self-improvement.md +9 -7
  127. package/src/skills/commit.md +17 -17
  128. package/src/skills/debug/ci.md +1 -1
  129. package/src/skills/dependencies.md +3 -3
  130. package/src/skills/document-project.md +3 -2
  131. package/src/skills/factory.md +13 -4
  132. package/src/skills/geneseed.md +4 -2
  133. package/src/skills/git-history.md +5 -7
  134. package/src/skills/herdr.md +135 -0
  135. package/src/skills/loop.md +3 -2
  136. package/src/skills/opencode-cli.md +84 -0
  137. package/src/skills/pipeline.md +1 -1
  138. package/src/skills/release.md +5 -8
  139. package/src/skills/review-response.md +4 -2
  140. package/src/skills/rule.md +27 -1
  141. package/src/skills/ship.md +54 -7
  142. package/src/skills/worktree.md +2 -2
  143. package/src/upstreams.json +7 -0
  144. package/themes/_TEMPLATE.json +2 -0
  145. package/themes/biker.json +2 -0
  146. package/themes/commentator.json +2 -0
  147. package/themes/cyberpunk.json +2 -0
  148. package/themes/gamer.json +2 -0
  149. package/themes/imperial.json +2 -0
  150. package/themes/joker.json +2 -0
  151. package/themes/marvin.json +2 -0
  152. package/themes/mean.json +2 -0
  153. package/themes/military.json +2 -0
  154. package/themes/neutral.json +2 -0
  155. package/themes/pirate.json +2 -0
  156. package/themes/sports.json +2 -0
  157. package/themes/verstappen.json +2 -0
  158. package/themes/wizard.json +2 -0
  159. package/web/dist/assets/Activity-D2kOc3yi.js +1 -0
  160. package/web/dist/assets/ActivityDetail-By3xOr21.js +1 -0
  161. package/web/dist/assets/{Bonsai-Bfpb6W-1.js → Bonsai-CBWDTBA4.js} +1 -1
  162. package/web/dist/assets/{CopyButton-ByIntFtB.js → CopyButton-BVbpriMB.js} +1 -1
  163. package/web/dist/assets/Dashboard-CIJLPHM9.js +2 -0
  164. package/web/dist/assets/{Docs-DvlMJhpu.js → Docs-CiRRIELs.js} +3 -3
  165. package/web/dist/assets/Factories-DhyK0O8d.js +1 -0
  166. package/web/dist/assets/GreenhouseView-DW3PgTPy.js +1 -0
  167. package/web/dist/assets/Installs-B6nlo-Ly.js +3 -0
  168. package/web/dist/assets/JournalView-O65qEWfp.js +1 -0
  169. package/web/dist/assets/Kits-C5U-yT6Z.js +1 -0
  170. package/web/dist/assets/Laws-CuTw_XNf.js +4 -0
  171. package/web/dist/assets/{LibRows-DEHjIoD-.js → LibRows-D6-CVa3K.js} +1 -1
  172. package/web/dist/assets/Library-CzPlerd6.js +3 -0
  173. package/web/dist/assets/Loops-CqNF_-nS.js +2 -0
  174. package/web/dist/assets/Markdown-CxkA7940.js +71 -0
  175. package/web/dist/assets/OperatorHudView-BNr8K5qj.js +1 -0
  176. package/web/dist/assets/Personal-DeDb9e8O.js +2 -0
  177. package/web/dist/assets/Settings-B8MPN_AD.js +1 -0
  178. package/web/dist/assets/{Tabs-CWeQTADL.js → Tabs-DJzAez4h.js} +1 -1
  179. package/web/dist/assets/index-BL3P-9Rg.js +6 -0
  180. package/web/dist/assets/{index-CsAZq0BQ.css → index-CRWqKxfY.css} +1 -1
  181. package/web/dist/index.html +2 -2
  182. package/adapters/claude-code/settings.json +0 -52
  183. package/web/dist/assets/Activity-CqJiquEq.js +0 -1
  184. package/web/dist/assets/ActivityDetail-BSzevynX.js +0 -1
  185. package/web/dist/assets/Dashboard-DBOEi9lQ.js +0 -2
  186. package/web/dist/assets/Factories-Bpvv7L2H.js +0 -1
  187. package/web/dist/assets/GreenhouseView-GpBsYn50.js +0 -1
  188. package/web/dist/assets/Installs-BlGmVrFK.js +0 -3
  189. package/web/dist/assets/JournalView-iLuLrOxE.js +0 -1
  190. package/web/dist/assets/Kits-DRwpxC-J.js +0 -1
  191. package/web/dist/assets/Laws-CZkiNOWQ.js +0 -4
  192. package/web/dist/assets/Library-B4K-1iNF.js +0 -3
  193. package/web/dist/assets/Loops-BWSzaW8E.js +0 -2
  194. package/web/dist/assets/Markdown-0ORz7tAc.js +0 -69
  195. package/web/dist/assets/OperatorHudView-BAXwCEvY.js +0 -1
  196. package/web/dist/assets/Personal-Bp9nV4GR.js +0 -2
  197. package/web/dist/assets/Settings-CWWuaIp-.js +0 -1
  198. package/web/dist/assets/index-How7SzDZ.js +0 -6
@@ -11,13 +11,13 @@
11
11
  <!-- The brand sprout as an inline SVG favicon (no extra asset to serve). -->
12
12
  <link rel="icon" type="image/svg+xml"
13
13
  href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21.5v-9' stroke='%233AD4C4' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3Cpath d='M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z' fill='%233AD4C4'/%3E%3Cpath d='M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z' fill='%233AD4C4' opacity='.42'/%3E%3C/svg%3E" />
14
- <script type="module" crossorigin src="/assets/index-How7SzDZ.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-BL3P-9Rg.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/react-C1iE8mnY.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/api-DLDVY3K-.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/motion-RlUl1osO.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/sections-CtFz7HFH.js">
20
- <link rel="stylesheet" crossorigin href="/assets/index-CsAZq0BQ.css">
20
+ <link rel="stylesheet" crossorigin href="/assets/index-CRWqKxfY.css">
21
21
  </head>
22
22
  <body>
23
23
  <div id="root"></div>
@@ -1,52 +0,0 @@
1
- {
2
- "hooks": {
3
- "PreToolUse": [
4
- {
5
- "matcher": "Bash|PowerShell",
6
- "hooks": [
7
- { "type": "command", "command": "node bin/geneseed-hook.mjs git-gate" }
8
- ]
9
- },
10
- {
11
- "matcher": "Write|Edit|NotebookEdit",
12
- "hooks": [
13
- { "type": "command", "command": "node bin/geneseed-hook.mjs rule-gate" }
14
- ]
15
- }
16
- ],
17
- "SessionStart": [
18
- {
19
- "hooks": [
20
- { "type": "command", "command": "node bin/geneseed-hook.mjs context" }
21
- ]
22
- },
23
- {
24
- "matcher": "startup|clear",
25
- "hooks": [
26
- { "type": "command", "command": "node -e \"process.stdout.write(require('fs').readFileSync('AGENT.md','utf8'))\"" }
27
- ]
28
- }
29
- ],
30
- "Stop": [
31
- {
32
- "hooks": [
33
- { "type": "command", "command": "node bin/geneseed-hook.mjs learn || exit 0" }
34
- ]
35
- }
36
- ],
37
- "SubagentStop": [
38
- {
39
- "hooks": [
40
- { "type": "command", "command": "node bin/geneseed-hook.mjs learn || exit 0" }
41
- ]
42
- }
43
- ],
44
- "PreCompact": [
45
- {
46
- "hooks": [
47
- { "type": "command", "command": "node bin/geneseed-hook.mjs learn || exit 0" }
48
- ]
49
- }
50
- ]
51
- }
52
- }
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{s as i}from"./motion-RlUl1osO.js";import{$ as a,A as o,C as s,D as c,E as l,I as u,M as d,N as f,P as p,St as m,T as h,V as g,bt as _,et as v,gt as y,j as b,k as ee,nt as te,o as ne,w as x}from"./index-How7SzDZ.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{_ as C,a as w,c as T,f as E,g as D,h as O,i as k,l as A,m as j,n as M,o as N,p as P,r as F,s as I,t as L,u as R,v as z}from"./Bonsai-Bfpb6W-1.js";import{n as re,t as ie}from"./usePoll-D5c_qIFZ.js";var B=e(t(),1),V=n(),H=4,U=56*H,W=24,G=165,K=188,q=(e,t)=>e>0?Math.max(1,Math.floor((e-32+W)/(U+W))):Math.max(1,t),J=e=>e.status===`blocked`?`bad`:b(e)?`warn`:e.status===`busy`?`ok`:``,Y=e=>{let t=A(e);return t==null?null:Math.round(t*100)};function X(e,t,n){let r=s[e.status]||s.idle,i=t.pads.filter(e=>e.key!=null),a=t.pads.reduce((e,t)=>e+t.files.length,0)+t.fallen.reduce((e,t)=>e+t.files.length,0),o=Y(e);return[`${e.title||c(e.cwd)||e.session_id}, ${e.chip||e.host||`unknown host`}, ${r.label}${e.phase?`, ${e.phase}`:``}`,`${e.turns||0} turns${o==null?``:`, context ${o} %`}${e.compactions?`, ${e.compactions} compactions`:``}`,i.length?`${i.length} sub-agent${i.length===1?``:`s`} running: ${i.map(e=>`${e.type||`agent`} (${e.files.length} file${e.files.length===1?``:`s`})`).join(`, `)}`:``,t.fallen.length?`${t.fallen.length} finished`:``,`${a} file${a===1?``:`s`} changed`,n.length?`shares ${n.length} file${n.length===1?``:`s`} with another session`:``,e.error?`error: ${e.error}`:``].filter(Boolean).join(`. `)}function ae({s:e,t,mine:n}){let r=Y(e);return(0,V.jsxs)(`div`,{className:`card gd-card`,children:[(0,V.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`model`}),(0,V.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,V.jsx)(`dt`,{children:`turns`}),(0,V.jsx)(`dd`,{children:e.turns||0}),(0,V.jsx)(`dt`,{children:`context`}),(0,V.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,V.jsx)(`dt`,{children:`compactions`}),(0,V.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,V.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,V.jsxs)(`div`,{className:`act-xs ${e.kind===`same-worktree`?`t-bad`:`t-warn`}`,children:[`same file`,e.kind===`same-worktree`?``:`, other worktree`,`: `,e.path]},`${e.kind}:${e.path}`))]})}function Z({s:e,worktree:t,sakura:n,mine:r,pad:i,onHover:a}){let o=z(e,n),l=(0,B.useMemo)(()=>E(e,{sakura:n}),[o]),u=s[e.status]||s.idle,d=Array.isArray(e.loops)?e.loops[0]:null,f=e.status!==`idle`,p=I(e),m=e.title||c(e.cwd)||e.session_id,h=Y(e),g=(0,B.useRef)(null),_=(0,B.useCallback)(e=>a(p,e,Q(g.current)),[a,p]);return(0,V.jsxs)(`a`,{ref:g,className:`gd-tree${b(e)?` gd-needs`:``}`,href:e.href||R(e.session_id),"aria-label":X(e,l,r),"data-sid":e.session_id,onMouseEnter:e=>a(p,null,Q(e.currentTarget)),onMouseLeave:()=>a(null,null),onFocus:e=>a(p,null,Q(e.currentTarget)),onBlur:()=>a(null,null),onKeyDown:e=>k(e,l.pads.length,i,_),children:[(0,V.jsx)(F,{t:l,pad:i,swaying:f,onPad:_,px:H}),(0,V.jsxs)(`div`,{className:`gd-cap`,children:[(0,V.jsx)(`div`,{className:`gd-title`,title:m,children:m}),(0,V.jsxs)(`div`,{className:`row wrap gd-pills`,children:[(0,V.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip||e.host||`?`}),(0,V.jsx)(`span`,{className:`badge ${J(e)}`,children:u.label}),t&&(0,V.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),d&&(0,V.jsxs)(`span`,{className:`badge`,children:[`↻ `,d.title,d.iteration==null?``:` ${d.iteration}`]}),e.attribution===!1&&(0,V.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`})]}),(0,V.jsxs)(`div`,{className:`mono gd-meta`,children:[e.turns||0,` turns`,h==null?``:` · ${h}%`]})]})]})}function oe({pairs:e,count:t}){if(!e.length)return null;let n=t*U+(t-1)*W,r=e=>e*(U+W)+U/2;return(0,V.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*H+20,"aria-hidden":`true`,children:e.map(({a:e,b:t,kind:n})=>{let[i,a]=e<t?[e,t]:[t,e],o=`gd-thread ${n===`same-worktree`?`red`:`amber`}`;if(a-i===1){let e=r(i)+30,t=r(a)-30,n=(e+t)/2;return(0,V.jsxs)(`g`,{className:o,children:[(0,V.jsx)(`path`,{d:`M${e} ${G} C${n} 179 ${n} 159 ${t} 169`}),(0,V.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${G}`})]},`${i}-${a}`)}return(0,V.jsx)(`g`,{className:o,children:(0,V.jsx)(`path`,{d:`M${r(i)} ${K} Q${(r(i)+r(a))/2} 222 ${r(a)} ${K}`})},`${i}-${a}`)})})}var Q=e=>e.offsetLeft;function se({sessions:e,collisions:t}){let[n,r]=(0,B.useState)(N),[i,a]=(0,B.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(M,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=T(P(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>D(e,s);return(0,V.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,V.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,V.jsxs)(`span`,{className:`dim act-sm`,children:[e.length,` tree`,e.length===1?``:`s`,` · `,c.length,` `,c.length===1?`shelf`:`shelves`,` · a tree opens its session; hover or focus shows its details, and a tap or the arrow keys walk its pads`]}),(0,V.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Pink blossom`})]}),l.length>0&&(0,V.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,V.jsxs)(`button`,{type:`button`,className:`chip-f`,"aria-expanded":!1,onClick:()=>a(t=>new Set(t).add(e.key)),children:[e.name,` · `,e.trees.length]},e.key))}),c.filter(e=>!e.collapsed).map(e=>(0,V.jsx)(ce,{sh:e,sakura:n,cols:s,mineOf:u},e.key))]})}function ce({sh:e,sakura:t,cols:n,mineOf:r}){let[i,a]=(0,B.useState)({sid:null,pad:null,x:0}),o=(0,B.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=(0,B.useRef)(null),[c,l]=(0,B.useState)(0);(0,B.useLayoutEffect)(()=>{let e=s.current,t=()=>l(e.clientWidth);if(t(),typeof ResizeObserver>`u`)return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t);let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let u=q(c,e.trees.length),d=C(e.trees,n),f=[];for(let t=0;t<e.trees.length;t+=u)f.push(t);let p=e.trees.findIndex(e=>I(e.s)===i.sid),m=p<0?null:e.trees[p].s,h=m?E(m,{sakura:t}):null,g=h&&i.pad!=null?h.pads[i.pad]:null,_=e.trees.length;return(0,V.jsxs)(`section`,{className:`gd-shelf`,"aria-label":`${e.name} shelf`,ref:s,children:[f.map(n=>{let a=e.trees.slice(n,n+u),s=n+a.length,c=d.filter(e=>e.a>=n&&e.a<s&&e.b>=n&&e.b<s).map(e=>({...e,a:e.a-n,b:e.b-n}));return(0,V.jsxs)(`div`,{className:`gd-row`,children:[(0,V.jsx)(`div`,{className:`gd-plank`,children:n===0&&(0,V.jsxs)(`h3`,{className:`gd-plate`,children:[e.name,` · `,_,` session`,_===1?``:`s`]})}),a.map(({s:e,worktree:n})=>(0,V.jsx)(Z,{s:e,worktree:n,sakura:t,mine:r(I(e)),pad:I(e)===i.sid?i.pad:null,onHover:o},I(e))),(0,V.jsx)(oe,{pairs:c,count:a.length}),m&&p>=n&&p<s&&(0,V.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:g?(0,V.jsx)(L,{pad:g}):(0,V.jsx)(ae,{s:m,t:h,mine:r(I(m))})})]},n)}),(0,V.jsx)(`span`,{className:`sr-only`,role:`status`,children:w(g)})]})}var $=e=>e.catch(()=>null);function le({s:e}){let t=(0,B.useId)(),n=e.todos,r=o(e);return(0,V.jsxs)(`a`,{className:`card pad-md act-card`,href:e.href||R(e.session_id),"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,V.jsxs)(x,{s:e,id:t,heading:e.title||c(e.cwd)||e.session_id,children:[e.chip&&(0,V.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip}),(0,V.jsx)(y,{name:`chevron`,className:`glyph act-chev`})]}),n&&n.total>0&&(0,V.jsx)(`div`,{className:`act-foot`,children:(0,V.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,V.jsx)(l,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,V.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,_(e.updated_at),` ago`]})]})}var ue={blocked:`is blocked`,"waiting-input":`waits for your answer`};function de(e,t){if(!Array.isArray(t))return``;let n=t.filter(b),r=e.current;return e.current=new Set(n.map(e=>`${I(e)}:${e.status}`)),r?n.filter(e=>!r.has(`${I(e)}:${e.status}`)).map(e=>`${e.title||c(e.cwd)||e.session_id} ${ue[e.status]}`).join(`. `):``}var fe=[[`all`,`All`],[`needs`,`Needs you`],[`runs`,`Runs`],[`gates`,`Gate asks`]];function pe(){let e=new URLSearchParams(window.location.hash.split(`?`)[1]||``),t=e.get(`f`);return{f:fe.some(([e])=>e===t)?t:`all`,host:e.get(`host`)||``,project:e.get(`project`)||``,v:e.get(`v`)===`list`?`list`:`garden`}}function me(e){let t=new URLSearchParams;e.f!==`all`&&t.set(`f`,e.f),e.v===`list`&&t.set(`v`,`list`),e.host&&t.set(`host`,e.host),e.project&&t.set(`project`,e.project);let n=t.toString();window.history.replaceState(null,``,`#/activity${n?`?${n}`:``}`)}function he({enabled:e,installs:t,onToggle:n}){let r=j(t);return(0,V.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,V.jsx)(y,{name:`activity`,className:`glyph act-fixed`}),(0,V.jsxs)(`div`,{className:`act-grow`,children:[(0,V.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,V.jsx)(`p`,{className:`dim act-sm act-track-p`,children:`Runs and gate asks below come from the job log and the gate ledger. Turn tracking on to see what each session is doing now.`})]}),(0,V.jsxs)(`ul`,{className:`stack gap-8 act-fixed act-sm`,"aria-label":`Tracking per install`,children:[t.length===0&&(0,V.jsx)(`li`,{className:`dim`,children:`No active install to track.`}),t.map((e,t)=>(0,V.jsxs)(`li`,{className:`row gap-10`,children:[(0,V.jsxs)(`span`,{id:`act-track-l${t}`,title:e.path,children:[`Track live sessions in `,(0,V.jsx)(`span`,{className:`mono`,children:r.get(e.install)})]}),(0,V.jsx)(`div`,{className:`sw-toggle${e.enabled?` on`:``}`,role:`switch`,"aria-checked":e.enabled,"aria-labelledby":`act-track-l${t}`,tabIndex:0,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.key===` `&&t.preventDefault(),n(e))}})]},e.install))]})]})}function ge({jobs:e,loading:t}){let n=typeof e?.cap==`number`?e.cap:void 0,r=d(e?.jobs,{days:14,cap:n}),i=p(r.map(e=>e.nodata?`-`:e.n).join(`,`),`scaleY`),a=Math.max(1,...r.map(e=>e.n)),o=r.reduce((e,t)=>e+t.n,0),s=r.find(e=>!e.nodata),c=r.some(e=>e.nodata),l=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${f(e.key)}`).join(`, `)||`none`}.`+(c?s?` Days before ${f(s.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,V.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,V.jsxs)(`div`,{className:`act-stat-head`,children:[(0,V.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,V.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,V.jsx)(v,{label:`Reading the job log…`}):e?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":l,ref:i,children:r.map(e=>e.nodata?(0,V.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,V.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${f(e.key)}: ${e.n}`},e.key):(0,V.jsx)(`i`,{className:`zero`},e.key))}),(0,V.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,V.jsx)(`span`,{children:f(r[0].key)}),(0,V.jsx)(`span`,{children:f(r[7].key)}),(0,V.jsx)(`span`,{children:`today`})]}),c&&(0,V.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,V.jsx)(`p`,{className:`dim act-sm`,children:`The job log could not be read.`})]})}function _e({rows:e,gates:t,loading:n}){let r=e.reduce((e,t)=>e+t.n,0);return(0,V.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,V.jsxs)(`div`,{className:`act-stat-head`,children:[(0,V.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,V.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,V.jsx)(v,{label:`Reading the gate ledger…`}):e.length?(0,V.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,V.jsxs)(`li`,{children:[(0,V.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,V.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,V.jsx)(h,{vals:e.per_day,i:t,sweep:!0}),(0,V.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,V.jsx)(`p`,{className:`dim act-sm`,children:t?`No gate asked in 30 days.`:`The gate ledger could not be read.`})]})}var ve={done:[`ok`,`done`],failed:[`bad`,`failed`],running:[``,`running`]};function ye({job:e,longest:t}){let n=u(e),r=e.duration?Math.round(e.duration*10)/10:0,[i,a]=ve[e.status]||[``,e.status||`…`],o=e.status===`running`?`Still running`:r?`Took ${r} second${r===1?``:`s`}`:`No duration`,s=e.started?new Date(e.started*1e3).toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`}):`—`;return(0,V.jsxs)(`li`,{className:`act-row`,children:[(0,V.jsx)(`span`,{className:`mono dim act-xs`,children:s}),(0,V.jsx)(y,{name:`play`,className:`glyph act-glyph`}),(0,V.jsxs)(`span`,{className:`act-what`,children:[(0,V.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,V.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,V.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":o,children:(0,V.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,V.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function be({gate:e}){return(0,V.jsxs)(`li`,{className:`act-row gate`,children:[(0,V.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,V.jsx)(y,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,V.jsxs)(`span`,{className:`act-what`,children:[(0,V.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,V.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,V.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{className:`badge warn`,children:`asked`})]})}var xe=5,Se=(e,t)=>[...new Set([...e.filter(Boolean),t].filter(Boolean))];function Ce(){let[e,t]=(0,B.useState)(null),[n,o]=(0,B.useState)(``),[s,l]=(0,B.useState)(pe),[u,d]=(0,B.useState)(!1),[f,h]=(0,B.useState)(``),_=(0,B.useRef)(null),y=e=>{let t={...s,...e};l(t),me(t)};re(e=>r.activity().then(n=>{if(e()){t(ie(n)),o(``);let e=de(_,n?.activity);e&&h(t=>t===e?e+`\xA0`:e)}},t=>{e()&&o(t.message)}),2e3,[]);let x=m(()=>$(r.jobs()),[]),C=m(()=>$(r.gates()),[]),w=m(()=>$(r.catalog(`laws`)),[]),T=!e||e.enabled!==!1,E=Array.isArray(e?.installs)?e.installs:[],D=O(e?.activity,E).sort((e,t)=>e.session_id<t.session_id?-1:+(e.session_id>t.session_id)),k=i(),A=T&&e?D.filter(b).length:null,j=new Set(D.map(I)),M=s.v===`list`?O(e?.ended,E).filter(e=>!j.has(I(e))):[],N=Se([...D,...M].map(e=>e.host),s.host),P=Se([...D,...M].map(e=>c(e.cwd)),s.project),F=s.host&&s.project?`host or project`:s.host?`host`:s.project?`project`:``,L=e=>(!s.host||e.host===s.host)&&(!s.project||c(e.cwd)===s.project),R=D.filter(e=>L(e)&&(s.f!==`needs`||b(e))),z=s.f===`all`||s.f===`needs`,H=s.f===`all`&&T?M.filter(L):[],U=u?H:H.slice(0,xe),W=!F&&(s.f===`all`||s.f===`runs`),G=!F&&(s.f===`all`||s.f===`gates`),K=x.data?.jobs||[],q=ne(C.data,w.data),J=ee(K,q,C.data?.days).map(e=>({...e,runs:W?e.runs:[],gate:G?e.gate:null})).filter(e=>e.runs.length||e.gate),Y=Math.max(0,...K.map(e=>e.duration||0)),X=p(J.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),ae=async e=>{let n=!e.enabled;try{let i=await r.activityToggle(n,{host:e.host,path:e.path});if(i.ok===!1){o(i.error||`Could not change tracking`);return}let a=t=>i.enabled?t||[]:(t||[]).flatMap(t=>{let n=(t.installs||[t.install]).filter(t=>t!==e.install);return n.length?[{...t,install:n[0],installs:n}]:[]});t(t=>{let n=(t?.installs||[]).map(t=>t.install===e.install?{...t,enabled:i.enabled}:t);return{...t||{},installs:n,enabled:n.length===0||n.some(e=>e.enabled),activity:a(t?.activity),ended:a(t?.ended)}}),o(``)}catch(e){o(e.message)}},Z=(e,t,n)=>(0,V.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,V.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,V.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:s[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>y({[e]:t.target.value}),children:[(0,V.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,V.jsx)(`option`,{value:e,children:e},e))]})]});return(0,V.jsxs)(`div`,{className:`page-fill`,children:[(0,V.jsx)(g,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,V.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:f}),n&&(0,V.jsx)(`div`,{className:`act-gap`,children:(0,V.jsx)(a,{error:n})}),e&&(0,V.jsx)(he,{enabled:T,installs:E,onToggle:ae}),(0,V.jsxs)(`div`,{className:`act-today`,children:[(0,V.jsx)(ge,{jobs:x.data,loading:x.loading}),(0,V.jsx)(_e,{rows:q,gates:C.data,loading:C.loading}),(0,V.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,V.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),!e&&!n?(0,V.jsx)(v,{}):e?(0,V.jsxs)(V.Fragment,{children:[T?(0,V.jsxs)(`span`,{className:`act-big act-wait`,children:[A,` `,(0,V.jsx)(`span`,{className:`dim act-sm`,children:A===1?`session`:`sessions`})]}):null,(0,V.jsx)(`p`,{className:`dim act-sm`,children:T?`A session that waits on an approval or on your answer counts here.`:`Turn tracking on to count the sessions that wait on you.`})]}):(0,V.jsx)(`p`,{className:`dim act-sm`,children:`The sessions could not be read.`})]})]}),(0,V.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,V.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:fe.map(([e,t])=>(0,V.jsxs)(`button`,{type:`button`,className:s.f===e?`chip-f on`:`chip-f`,"aria-pressed":s.f===e,onClick:()=>y({f:e}),children:[t,e===`needs`&&A>0?(0,V.jsxs)(`span`,{className:`mono`,children:[` `,A]}):null]},e))}),Z(`host`,`Host`,N),Z(`project`,`Project`,P),(0,V.jsx)(te,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,V.jsx)(`button`,{type:`button`,className:s.v===e?`on`:``,"aria-pressed":s.v===e,onClick:()=>y({v:e}),children:t},e))})]}),F&&s.f!==`needs`&&(0,V.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,F,`; showing sessions only.`]}),z&&(e?!T&&s.f!==`needs`?null:R.length===0?s.f===`needs`?(0,V.jsx)(S,{title:`Nothing waits on you`}):(0,V.jsx)(S,{title:`No active sessions`,children:`Start an agent session and it appears here.`}):s.v===`garden`?(0,V.jsx)(se,{sessions:R,collisions:e.collisions}):(0,V.jsx)(`div`,{className:`stack gap-12 act-live`,ref:k,children:R.map(e=>(0,V.jsx)(`div`,{"data-flip":I(e),children:(0,V.jsx)(le,{s:e})},I(e)))}):(0,V.jsx)(v,{label:`Reading live sessions…`})),H.length>0&&(0,V.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,V.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),U.map(e=>(0,V.jsx)(`div`,{children:(0,V.jsx)(le,{s:e})},I(e))),H.length>xe&&(0,V.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":u,onClick:()=>d(e=>!e),children:u?`Show fewer`:`Show all ${H.length}`})]}),s.f!==`needs`&&(0,V.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:X,children:J.map(e=>(0,V.jsxs)(`section`,{className:`card act-day`,children:[(0,V.jsxs)(`h3`,{className:`act-day-h`,children:[(0,V.jsx)(`span`,{children:e.title}),(0,V.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,V.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,V.jsx)(ye,{job:e,longest:Y},e.id)),e.gate&&(0,V.jsx)(be,{gate:e.gate})]})]},e.key))})]})}export{Ce as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,D as a,O as o,V as s,bt as c,et as l,gt as u,j as d,w as f}from"./index-How7SzDZ.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{a as m,d as h,f as g,i as _,l as v,o as y,r as b,t as x,v as S}from"./Bonsai-Bfpb6W-1.js";import{n as C,t as w}from"./usePoll-D5c_qIFZ.js";var T=e(t(),1),E=n();function D(e){return e.kind===`tool`?e.status===`error`?`bad`:e.status===`completed`?`ok`:`acc`:{retry:`warn`,error:`bad`,subtask:`acc`,text:`acc`}[e.kind]||``}function O({rec:e}){let t=e.who===`you`,n=[];t||(e.kind===`tool`&&e.ms!=null&&n.push(`${(e.ms/1e3).toFixed(1)}s`),e.kind===`step`&&(e.tokens&&n.push(`${o(e.tokens)} tok`),e.cost&&n.push(`$${e.cost.toFixed(2)}`)),e.kind===`subtask`&&e.agent&&n.unshift(e.agent));let r=!t&&(e.kind===`text`||e.kind===`thinking`||e.kind===`step`),i=t?e.text:e.label||e.snippet||e.kind;return(0,E.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,E.jsx)(`span`,{className:`badge act-who ${t?``:`acc`}`,children:t?`you`:`agent`}),(0,E.jsxs)(`div`,{className:`act-grow act-sm`,children:[!t&&(0,E.jsx)(`span`,{className:`feed-dot act-inline-dot ${D(e)||`acc`}`}),e.kind===`thinking`&&(0,E.jsx)(`span`,{className:`dim`,children:`thinking: `}),r?(0,E.jsx)(`span`,{className:`dim`,children:i}):t?i:(0,E.jsx)(`b`,{children:i}),e.error&&(0,E.jsxs)(`span`,{className:`dim`,children:[`: `,e.error]})]}),n.length>0&&(0,E.jsx)(`span`,{className:`dim mono act-xs act-fixed`,children:n.join(` · `)}),e.t?(0,E.jsx)(`time`,{className:`mono dim act-xs act-fixed`,dateTime:new Date(e.t).toISOString(),title:`${c(e.t/1e3)} ago`,children:new Date(e.t).toTimeString().slice(0,8)}):null]})}function k({turns:e}){return!e||e.length===0?(0,E.jsx)(`div`,{className:`dim act-sm`,children:`No conversation captured yet.`}):(0,E.jsx)(`div`,{className:`stack gap-12`,children:e.map((e,t)=>{let n=e.role===`user`;return(0,E.jsxs)(`div`,{className:`row gap-10 act-line`,children:[(0,E.jsx)(`span`,{className:`badge act-who ${n?``:`acc`}`,children:n?`you`:`agent`}),(0,E.jsx)(`div`,{className:`act-min act-sm${n?``:` muted`}`,children:e.text})]},t)})})}var A=5;function j({s:e}){let[t]=(0,T.useState)(y),[n,r]=(0,T.useState)(null),i=!!e.ended,a=i?{...e,status:d(e)?`busy`:e.status,error:null}:e,o=S(a,t),s=(0,T.useMemo)(()=>g(a,{sakura:t}),[o]),c=(0,T.useCallback)(e=>r(e),[]),l=v(e),u=Number(e.turns)||0,f=Number(e.compactions)||0,p=[`${u} turn${u===1?``:`s`}`,`context ${l==null?`unknown`:`${Math.round(l*100)} %`}`,`${f} compaction${f===1?``:`s`}`,`sub-agents: ${s.pads.filter(e=>e.key!=null).length} ${i?`unfinished`:`running`}, ${s.fallen.length} finished`].join(` · `),h=n==null?null:s.pads[n];return(0,E.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!i&&d(e)?` gd-needs`:``}`,children:[(0,E.jsx)(`div`,{role:`group`,tabIndex:0,"aria-label":`Bonsai pads, arrow keys walk them`,onKeyDown:e=>_(e,s.pads.length,n,c),children:(0,E.jsx)(b,{t:s,pad:n,swaying:!i&&e.status!==`idle`,onPad:c,px:A,label:`Bonsai of this session${i?`, ended`:``}: ${p}`})}),(0,E.jsxs)(`div`,{className:`stack gap-8 act-min`,children:[i&&(0,E.jsx)(`span`,{className:`dim act-xs`,children:`ended`}),(0,E.jsx)(`div`,{className:`dim act-sm`,children:p}),(0,E.jsx)(`span`,{className:`sr-only`,role:`status`,children:m(h)}),h?(0,E.jsx)(x,{pad:h}):(0,E.jsx)(`div`,{className:`dim act-xs`,children:`Hover or tap a pad, or use the arrow keys, for its files.`})]})]})}function M({sid:e}){let{sid:t,install:n}=h(e,window.location.hash),[o,d]=(0,T.useState)(null),[m,g]=(0,T.useState)(``),[_,v]=(0,T.useState)(!1),[y,b]=(0,T.useState)(!1),x=(0,T.useId)();C(e=>_?void 0:r.activityDetail(t,n).then(t=>{e()&&(d(w(t)),g(``),v(!1))},t=>{e()&&(t.status===404?v(!0):g(t.message))}),2e3,[t,_]);let S=(0,E.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,E.jsx)(u,{name:`arrow`}),` Activity`]});if(_)return(0,E.jsxs)(`div`,{className:`page-fill`,children:[S,(0,E.jsx)(p,{title:`Session ended`,action:(0,E.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!o)return(0,E.jsxs)(`div`,{className:`page-fill`,children:[S,m?(0,E.jsx)(i,{error:m}):(0,E.jsx)(l,{label:`Loading session…`})]});let D=o.session,A=D.files,M=D.todos,N=!!(A&&A.items&&A.items.length>0),P=!!(M&&M.items&&M.items.length>0),F=o.conversation||[],I=o.timeline||[],L=[...F.filter(e=>e.role===`user`).map(e=>({who:`you`,text:e.text,t:e.t||0})),...I.map(e=>({...e,who:`agent`}))].sort((e,t)=>(e.t||0)-(t.t||0));return(0,E.jsxs)(`div`,{className:`page-fill`,children:[S,(0,E.jsx)(s,{title:D.title||a(D.cwd)||D.session_id,sub:D.cwd?(0,E.jsx)(`span`,{className:`mono act-cwd`,title:D.cwd,children:D.cwd}):null}),m&&(0,E.jsx)(`div`,{className:`act-gap`,children:(0,E.jsx)(i,{error:m})}),(0,E.jsxs)(`div`,{className:`card pad-md`,children:[(0,E.jsx)(f,{s:D}),(0,E.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,c(D.updated_at),` ago`]})]}),(0,E.jsx)(j,{s:D}),(N||P)&&(0,E.jsxs)(`div`,{className:`grid gap-12 act-panels${N&&P?` two`:``}`,children:[N&&(0,E.jsxs)(`div`,{className:`card pad-md`,children:[(0,E.jsx)(`div`,{className:`card-head`,children:(0,E.jsxs)(`h2`,{children:[`Files touched `,(0,E.jsxs)(`span`,{className:`dim`,children:[`(`,A.count,`)`]})]})}),(0,E.jsx)(`div`,{className:`stack act-list`,children:A.items.map(e=>(0,E.jsxs)(`div`,{className:`row between gap-12 act-sm`,children:[(0,E.jsx)(`span`,{className:`mono act-ell act-grow`,title:e.file,children:e.file}),(0,E.jsxs)(`span`,{className:`act-fixed`,children:[(0,E.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions]}),` `,(0,E.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions]})]})]},e.file))})]}),P&&(0,E.jsxs)(`div`,{className:`card pad-md`,children:[(0,E.jsx)(`div`,{className:`card-head`,children:(0,E.jsxs)(`h2`,{children:[`Plan`,` `,(0,E.jsxs)(`span`,{className:`dim`,children:[`(`,M.done,`/`,M.total,`)`]})]})}),(0,E.jsx)(`div`,{className:`stack act-list`,children:M.items.map((e,t)=>(0,E.jsxs)(`div`,{className:`row gap-8 act-sm`,children:[(0,E.jsx)(`span`,{className:`feed-dot ${e.status===`completed`?`ok`:e.status===`in_progress`?`acc`:``}`}),(0,E.jsx)(`span`,{className:e.status===`completed`?`act-done`:void 0,children:e.content})]},t))})]})]}),(0,E.jsxs)(`div`,{className:`card pad-md act-mt`,children:[(0,E.jsxs)(`div`,{className:`card-head act-tl-head`,children:[(0,E.jsx)(`h2`,{children:`Timeline`}),I.length>0&&(0,E.jsx)(`button`,{className:`btn ghost sm`,"aria-expanded":y,"aria-controls":x,onClick:()=>b(e=>!e),children:y?`Show conversation`:`Show full stream (${L.length})`})]}),(0,E.jsx)(`div`,{id:x,children:y?(0,E.jsx)(`div`,{className:`stack gap-12`,children:L.map((e,t)=>(0,E.jsx)(O,{rec:e},t))}):(0,E.jsx)(k,{turns:F})})]})]})}export{j as SessionTree,M as default};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GreenhouseView-GpBsYn50.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/motion-RlUl1osO.js","assets/sections-CtFz7HFH.js","assets/index-How7SzDZ.js","assets/api-DLDVY3K-.js","assets/index-CsAZq0BQ.css","assets/OperatorHudView-BAXwCEvY.js","assets/JournalView-iLuLrOxE.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-DLDVY3K-.js";import{o as a,t as o}from"./motion-RlUl1osO.js";import{n as s,r as c}from"./sections-CtFz7HFH.js";import{$ as l,B as u,Et as d,I as f,L as p,Q as m,St as h,Y as g,_t as _,a as v,bt as y,et as b,gt as x,nt as S,t as C,vt as w,yt as ee}from"./index-How7SzDZ.js";var T=t(n(),1),E={neutral:`Loaded & ready`,imperial:`The Codex in force`,military:`The unit stands ready`,cyberpunk:`Jacked in`,wizard:`Wards in place`,pirate:`The crew stands ready`,gamer:`Game loaded`,sports:`The squad takes the field`,biker:`The crew rolls out`,commentator:`Lights out, away we go`,verstappen:`Setup's in`,joker:`Mic check`,mean:`Rules are up`,marvin:`Online. Reluctantly.`},D=(e,t)=>e.deployed?t===void 0||t===`good`?E[e.theme]||`Loaded & ready`:`Deployed`:`Not deployed`,O=r(),k={done:`ok`,failed:`bad`},A={done:(0,O.jsx)(`path`,{d:`M5 12l5 5L20 7`}),failed:(0,O.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})},j=e=>typeof e==`number`&&Number.isFinite(e);function M(e){let t=[];for(let n of e){let e=f(n),r=`${e.verb}\u0000${e.scope}\u0000${n.status}`,i=t[t.length-1];i&&i.key===r?(i.jobs.push(n),i.durations.push(j(n.duration)?n.duration:null),n.started&&(i.oldest=n.started)):t.push({key:r,id:n.id,verb:e.verb,scope:e.scope,status:n.status,jobs:[n],command:e.command,newest:n.started||null,oldest:n.started||null,durations:[j(n.duration)?n.duration:null]})}return t}function N(e){if(!e.newest)return`—`;let t=y(e.newest),n=e.oldest?y(e.oldest):t;return n===t?`${t} ago`:`${n} – ${t} ago`}function P({jobs:e,max:t,empty:n}){if(!e||e.length===0)return n??null;let r=p(e,t),i=Math.max(0,...r.map(e=>j(e.duration)?e.duration:0))||1,a=M(r),o=Math.max(...a.map(e=>e.jobs.length));return(0,O.jsx)(`ul`,{className:`run-chips`,children:a.map(e=>{let t=e.durations.filter(j),n=e.jobs.length,r=e.status||`running`;return(0,O.jsxs)(`li`,{className:`run-chip ${k[e.status]||`acc`}`,title:e.command||void 0,children:[(0,O.jsx)(`svg`,{className:`run-chip-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:A[e.status]||(0,O.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`,stroke:`none`})}),(0,O.jsx)(`span`,{className:`sr-only`,children:r}),(0,O.jsxs)(`span`,{className:`run-chip-main`,children:[(0,O.jsxs)(`span`,{className:`run-chip-head`,children:[(0,O.jsx)(`b`,{children:e.verb}),n>1&&(0,O.jsxs)(`span`,{className:`run-chip-times`,children:[`×`,n]})]}),(0,O.jsx)(`span`,{className:`run-chip-sub`,children:[e.scope,N(e)].filter(Boolean).join(` · `)})]}),t.length?(0,O.jsx)(`span`,{className:`run-chip-bars`,role:`img`,"aria-label":`Durations: ${t.join(`, `)} seconds`,children:t.map((e,t)=>(0,O.jsx)(`i`,{style:{width:`${e/i/o*100}%`}},t))}):(0,O.jsx)(`span`,{className:`run-chip-bars`,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`run-chip-dur`,children:t.length?n>1?`≤ ${Math.max(...t)} s`:`${t[0]} s`:`—`})]},e.id)})})}var F={good:`ok`,warn:`warn`,bad:`bad`,unknown:``};function I({verdict:e}){return e?(0,O.jsxs)(`span`,{className:`badge ${F[e.tone]}`,role:`status`,style:{alignSelf:`flex-start`},children:[(0,O.jsx)(`span`,{className:`dot`}),e.head]}):null}function L({overview:e,dataRev:t}){let{data:n}=h(()=>Promise.resolve().then(()=>i.catalog(`laws`)),[t],`catalog:laws`),r=_(e.diff),a=e.counts||{},s=[{key:`agents`,label:`Agents`,hash:`#/agents`},{key:`skills`,label:`Skills`,hash:`#/skills`},{key:`laws`,label:n?.nouns?.laws||`Dictates`,hash:`#/laws`}];return(0,O.jsxs)(`div`,{className:`card kpiband rise mb-16`,children:[s.map(e=>{let t=a[e.key];return(0,O.jsxs)(`a`,{className:`kseg`,href:e.hash,title:`Open ${e.label}`,children:[(0,O.jsx)(`span`,{className:`kseg-n`+(t===0?` zero`:``),children:t==null?`—`:(0,O.jsx)(o,{value:t})}),(0,O.jsx)(`span`,{className:`kseg-l`,children:e.label})]},e.key)}),(0,O.jsx)(`div`,{className:`kseg-spacer`}),(0,O.jsxs)(`button`,{className:`kseg`+(r>0?` hot`:``),onClick:()=>d(`#/diff`),title:`Open changes`,children:[(0,O.jsx)(`span`,{className:`kseg-n`+(r===0?` zero`:``),children:(0,O.jsx)(o,{value:r})}),(0,O.jsx)(`span`,{className:`kseg-l`,children:`Local edits`}),r>0&&(0,O.jsx)(`span`,{className:`delta up`,children:`▲`})]})]})}function R({overview:e}){return(0,O.jsx)(`div`,{className:`genome`,children:c.map((t,n)=>{let r=s[t],i=e.counts?.[t];return(0,O.jsxs)(`a`,{className:`card gcell rise`,style:{"--i":n},href:`#/section/`+t,children:[(0,O.jsxs)(`div`,{className:`gtop`,children:[(0,O.jsx)(`span`,{className:`gname`,children:r.label}),(0,O.jsx)(x,{name:r.icon,className:`gicon`})]}),(0,O.jsx)(`div`,{className:`gcount`+(i===0?` zero`:``),children:i==null?`—`:(0,O.jsx)(o,{value:i})}),(0,O.jsx)(`div`,{className:`gdesc`,children:r.desc})]},t)})})}function z({jobs:e}){if(!e||e.length===0)return(0,O.jsx)(`div`,{className:`feed`,children:(0,O.jsxs)(`div`,{className:`empty`,children:[(0,O.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})});let t={done:`ok`,running:`acc`,failed:`bad`},n=p(e,8);return(0,O.jsx)(`div`,{className:`feed`,children:n.map(e=>(0,O.jsxs)(`div`,{className:`feed-row`,children:[(0,O.jsx)(`span`,{className:`feed-dot ${t[e.status]||`ok`}`}),(0,O.jsx)(`span`,{className:`feed-txt`,children:(0,O.jsx)(`b`,{children:e.action})}),(0,O.jsxs)(`span`,{className:`feed-when`,children:[y(e.started),` ago`]})]},e.id))})}function B({value:e}){let t=a(e,1100)??0,n=Math.round(t*100);return(0,O.jsxs)(`div`,{className:`ring-box`,children:[(0,O.jsx)(u,{value:n,max:100,label:`germination`,size:232,stroke:10,sweepMs:0}),(0,O.jsxs)(`div`,{className:`ring-center`,children:[(0,O.jsxs)(`div`,{className:`pct`,children:[n,(0,O.jsx)(`span`,{className:`pct-unit`,children:`%`})]}),(0,O.jsx)(`div`,{className:`lbl`,children:`germination`})]})]})}function V({overview:e,sigil:t,setup:n,jobs:r,lens:i,dataRev:a}){let o=D(e,i?.tone),s=ee(e,n,i?.tone);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`card pad-lg rise mb-16`,children:(0,O.jsxs)(`div`,{className:`hero`,children:[(0,O.jsx)(B,{value:s}),(0,O.jsxs)(`div`,{className:`hero-facts`,children:[(0,O.jsx)(`div`,{className:`ttl`,children:o}),(0,O.jsx)(I,{verdict:i?.verdict}),t&&(0,O.jsxs)(`div`,{className:`voice-readout`,children:[(0,O.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,O.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,O.jsxs)(`p`,{className:`sub`,children:[`One source rendered into `,(0,O.jsx)(`code`,{children:e.target}),`. Every repo on this machine inherits it.`]}),(0,O.jsxs)(`div`,{className:`hero-chips`,children:[(0,O.jsxs)(`span`,{className:`chip`,children:[(0,O.jsx)(`span`,{className:`ck`,children:`voice`}),(0,O.jsx)(`span`,{className:`cv t-cap`,children:e.theme})]}),(0,O.jsxs)(`span`,{className:`chip`,children:[(0,O.jsx)(`span`,{className:`ck`,children:`mode`}),(0,O.jsx)(`span`,{className:`cv`,children:e.emit})]}),(0,O.jsxs)(`span`,{className:`chip`,children:[(0,O.jsx)(`span`,{className:`ck`,children:`footprint`}),(0,O.jsx)(`span`,{className:`cv`,children:e.footprint})]}),(0,O.jsxs)(`span`,{className:`chip`,children:[(0,O.jsx)(`span`,{className:`ck`,children:`built`}),(0,O.jsx)(`span`,{className:`cv`,children:e.build_time||`unknown`})]}),(0,O.jsxs)(`span`,{className:`chip`,children:[(0,O.jsx)(`span`,{className:`ck`,children:`fp`}),(0,O.jsx)(`span`,{className:`cv`,children:n?.installed_fp||`—`})]})]})]})]})}),(0,O.jsx)(L,{overview:e,dataRev:a}),(0,O.jsxs)(`div`,{className:`grid split-status`,children:[(0,O.jsxs)(`div`,{className:`card pad-lg`,children:[(0,O.jsxs)(`div`,{className:`card-head`,children:[(0,O.jsx)(`h3`,{children:`Capability genome`}),(0,O.jsx)(`div`,{className:`right`,children:(0,O.jsxs)(`span`,{className:`tick`,children:[c.length,` sections`]})})]}),(0,O.jsx)(R,{overview:e})]}),(0,O.jsxs)(`div`,{className:`card pad-lg`,children:[(0,O.jsxs)(`div`,{className:`card-head`,children:[(0,O.jsx)(`h3`,{children:`Recent activity`}),(0,O.jsx)(`div`,{className:`right`,children:(0,O.jsxs)(`span`,{className:`badge acc`,children:[(0,O.jsx)(`span`,{className:`dot`}),`live`]})})]}),(0,O.jsx)(z,{jobs:r})]})]})]})}function H({k:e,overview:t,max:n}){let r=s[e],i=t.counts?.[e]??0;return(0,O.jsxs)(`div`,{className:`strand`,children:[(0,O.jsxs)(`span`,{className:`strand-name`,children:[(0,O.jsx)(`span`,{className:`strand-dot`}),(0,O.jsx)(`a`,{href:`#/section/`+e,className:`strand-link stretch-link`,children:r.label})]}),(0,O.jsx)(`div`,{className:`hbar`,children:(0,O.jsx)(`i`,{style:{width:`${i/n*100}%`}})}),(0,O.jsx)(`span`,{className:`strand-val`,children:i})]})}function U(e){return e?e.includes(`in sync`)?{label:`in sync`,tone:`ok`}:e.includes(`no Geneseed install`)?{label:`not installed`,tone:``}:{label:`behind source`,tone:`warn`}:null}function W({overview:e,sigil:t,setup:n,jobs:r,lens:i}){let a=w(e.counts),o=n?.version_verdict||``,s=U(o),l=_(e.diff),u=[[`Source`,`src/, the canonical genetic material`,n?.source_fp||`—`,!0],[`Render`,`geneseed build → ${e.emit}`,e.theme+` voice`,!0],[`Deployed`,e.target,`inherited by every repo`,!1]];return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`mb-16`,children:(0,O.jsxs)(`div`,{className:`card pad-lg rise`,style:{position:`relative`,overflow:`hidden`},children:[(0,O.jsx)(`h2`,{className:`h`,style:{fontSize:22,margin:`0 0 18px`},children:`Gene-seed lineage`}),(0,O.jsxs)(`div`,{className:`lineage-track`,children:[(0,O.jsx)(`div`,{className:`spine`}),u.map(([e,t,n,r],i)=>(0,O.jsxs)(`div`,{className:`lineage-step`,children:[(0,O.jsx)(`span`,{className:`node ${r?`on`:``}`}),(0,O.jsx)(`div`,{className:`lt`,children:e}),(0,O.jsx)(`div`,{className:`ld`,children:t}),(0,O.jsx)(`div`,{className:`ltag`,children:n})]},i))]}),(0,O.jsx)(`hr`,{className:`hr`}),t&&(0,O.jsxs)(`div`,{className:`voice-readout`,style:{marginBottom:14},children:[(0,O.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,O.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,O.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,O.jsx)(I,{verdict:i?.verdict}),s&&(0,O.jsxs)(`span`,{className:`badge ${s.tone}`,title:o,children:[(0,O.jsx)(`span`,{className:`dot`}),s.label]}),(0,O.jsxs)(`span`,{className:`badge`,children:[(0,O.jsx)(`span`,{className:`dot`}),l,` local edits`]})]})]})}),(0,O.jsxs)(`div`,{className:`grid split-even`,children:[(0,O.jsxs)(`div`,{className:`card pad-lg`,children:[(0,O.jsxs)(`div`,{className:`card-head`,children:[(0,O.jsx)(`h3`,{children:`Genome strand`}),(0,O.jsx)(`div`,{className:`right`,children:(0,O.jsx)(`span`,{className:`tick`,children:`by volume`})})]}),c.map(t=>(0,O.jsx)(H,{k:t,overview:e,max:a},t))]}),(0,O.jsxs)(`div`,{className:`card pad-lg`,children:[(0,O.jsx)(`div`,{className:`card-head`,children:(0,O.jsx)(`h3`,{children:`Recent activity`})}),(0,O.jsx)(z,{jobs:r})]})]})]})}function G({overview:e,setup:t,jobs:n,lens:r}){let i=c.reduce((t,n)=>t+(e.counts?.[n]??0),0),a=w(e.counts),o=e.doctor?.ok,l=e.doctor?.problems?.length??0,u=_(e.diff);return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`div`,{className:`card pad-md rise mb-16`,children:(0,O.jsx)(`div`,{className:`row wrap between gap-16`,children:(0,O.jsxs)(`div`,{className:`row`,style:{gap:20,flexWrap:`wrap`},children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`tick`,children:`status`}),(0,O.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:[(0,O.jsxs)(`span`,{className:`badge ${e.deployed?`ok`:`warn`}`,children:[(0,O.jsx)(`span`,{className:`dot`}),e.deployed?`deployed`:`not deployed`]}),(0,O.jsx)(I,{verdict:r?.verdict})]})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`tick`,children:`voice`}),(0,O.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6,textTransform:`capitalize`},children:e.theme})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`tick`,children:`mode`}),(0,O.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6},children:e.emit})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`tick`,children:`fingerprint`}),(0,O.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6,color:`var(--accent-text)`},children:t?.installed_fp||`—`})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`tick`,children:`doctor`}),(0,O.jsx)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:o?(0,O.jsxs)(`span`,{className:`badge ok`,children:[(0,O.jsx)(`span`,{className:`dot`}),`clean`]}):(0,O.jsxs)(`span`,{className:`badge warn`,children:[(0,O.jsx)(`span`,{className:`dot`}),e.doctor===null?`checking`:`${l} issue${l===1?``:`s`}`]})})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`tick`,children:`edits`}),(0,O.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6},children:u})]})]})})}),(0,O.jsxs)(`div`,{className:`grid split-operator`,children:[(0,O.jsxs)(`div`,{className:`card rise`,style:{"--i":1},children:[(0,O.jsxs)(`div`,{className:`card-head pad-lg`,style:{padding:`18px 20px 0`,marginBottom:14},children:[(0,O.jsx)(`h3`,{children:`Sections`}),(0,O.jsx)(`div`,{className:`right`,children:(0,O.jsxs)(`span`,{className:`tick`,children:[i,` entries total`]})})]}),(0,O.jsxs)(`table`,{className:`tbl`,children:[(0,O.jsx)(`thead`,{children:(0,O.jsxs)(`tr`,{children:[(0,O.jsx)(`th`,{children:`Section`}),(0,O.jsx)(`th`,{children:`Detail`}),(0,O.jsx)(`th`,{style:{width:130},children:`Share`}),(0,O.jsx)(`th`,{className:`num`,children:`Count`})]})}),(0,O.jsx)(`tbody`,{children:c.map(t=>{let n=s[t],r=e.counts?.[t]??0;return(0,O.jsxs)(`tr`,{className:`clickable`,children:[(0,O.jsx)(`td`,{className:`name`,children:(0,O.jsx)(`a`,{href:`#/section/`+t,className:`stretch-link`,children:n.label})}),(0,O.jsx)(`td`,{className:`muted`,children:n.desc}),(0,O.jsx)(`td`,{children:(0,O.jsx)(`div`,{className:`hbar`,children:(0,O.jsx)(`i`,{style:{width:`${r/a*100}%`}})})}),(0,O.jsx)(`td`,{className:`num`,children:r})]},t)})})]})]}),(0,O.jsxs)(`div`,{className:`card pad-lg rise`,style:{"--i":2},children:[(0,O.jsx)(`div`,{className:`card-head`,children:(0,O.jsx)(`h3`,{children:`Run log`})}),(0,O.jsx)(P,{jobs:n,max:8,empty:(0,O.jsx)(`div`,{className:`feed`,children:(0,O.jsxs)(`div`,{className:`empty`,children:[(0,O.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})})})]})]})]})}var K=Symbol(`failed`),q=e=>Promise.resolve().then(e).catch(()=>K);function J({dataRev:e,needDoctor:t}){let n=h(()=>q(()=>i.fleet()),[e]),r=h(()=>t?q(()=>i.doctor()):Promise.resolve(null),[t,e]),a=n.data,o=a==null?`loading`:a===K?`failed`:`ok`,s=o===`ok`?a:null,c=s?v(s):null,l=r.data,u=t?l==null?`loading`:l===K?`failed`:`ok`:`idle`;return{fleet:s,fleetState:o,verdict:c,tone:o===`failed`?`failed`:c?.tone,doctor:{state:u,data:u===`ok`?r.data:null}}}var Y=e({default:()=>$}),X=(0,T.lazy)(()=>C(()=>import(`./GreenhouseView-GpBsYn50.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Z=(0,T.lazy)(()=>C(()=>import(`./OperatorHudView-BAXwCEvY.js`),__vite__mapDeps([8,1,2,4,5,6,3,7]))),Q=(0,T.lazy)(()=>C(()=>import(`./JournalView-iLuLrOxE.js`),__vite__mapDeps([9,1,2,6,3,4,5,7])));function $({overview:e,overviewError:t,onRetry:n,themes:r,setup:a,runs:o,onAction:s,layout:c=`genome`,dataRev:u}){let d=c,[f,p]=(0,T.useState)(`status`),[_,v]=(0,T.useState)(d);_!==d&&(v(d),p(`status`));let y=e&&r.find(t=>t.name===e.theme)?.sigil||``,x=J({dataRev:u,needDoctor:d===`greenhouse`||d===`hud`}),{data:C}=h(()=>d===`journal`?i.recent().catch(()=>null):Promise.resolve(null),[d,u]);if(!e)return t?(0,O.jsx)(l,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,O.jsx)(b,{});let w=e.daemon_stale?(0,O.jsx)(m,{}):null;return e.deployed?(0,O.jsxs)(O.Fragment,{children:[w,(0,O.jsx)(`div`,{className:`head-row`,children:(0,O.jsx)(S,{"aria-label":`Dashboard view`,children:[[`status`,`Status`],[`lineage`,`Lineage`],[`readout`,`Readout`]].map(([e,t])=>(0,O.jsx)(`button`,{className:f===e?`on`:``,onClick:()=>p(e),"aria-pressed":f===e,children:t},e))})}),(0,O.jsxs)(`div`,{className:`view-in`,children:[f===`status`&&d===`genome`&&(0,O.jsx)(V,{overview:e,sigil:y,setup:a,jobs:o,lens:x,dataRev:u}),f===`status`&&d===`greenhouse`&&(0,O.jsx)(T.Suspense,{fallback:(0,O.jsx)(b,{}),children:(0,O.jsx)(X,{overview:e,sigil:y,jobs:o,lens:x,onAction:s})}),f===`status`&&d===`hud`&&(0,O.jsx)(T.Suspense,{fallback:(0,O.jsx)(b,{}),children:(0,O.jsx)(Z,{overview:e,jobs:o,lens:x})}),f===`status`&&d===`journal`&&(0,O.jsx)(T.Suspense,{fallback:(0,O.jsx)(b,{}),children:(0,O.jsx)(Q,{overview:e,recent:C,lens:x,dataRev:u})}),f===`lineage`&&(0,O.jsx)(W,{overview:e,sigil:y,setup:a,jobs:o,lens:x}),f===`readout`&&(0,O.jsx)(G,{overview:e,setup:a,jobs:o,lens:x})]},f)]}):(0,O.jsxs)(O.Fragment,{children:[w,(0,O.jsx)(g,{onAction:s})]})}export{$ as default,D as i,I as n,P as r,Y as t};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,J as a,St as o,Tt as s,et as c,mt as ee,pt as l,q as te,tt as u,wt as d}from"./index-How7SzDZ.js";import{t as f}from"./EmptyState-CY5Pm2xy.js";import{n as p,t as m}from"./usePoll-D5c_qIFZ.js";import{a as h,i as g,n as _,o as v,s as y}from"./LibRows-DEHjIoD-.js";import{t as b}from"./CopyButton-ByIntFtB.js";import{t as x}from"./DataTable-b9zTShqJ.js";import{a as S,n as C,s as ne}from"./ActiveLoops-BJJN3P-V.js";var w=e(t(),1),T=24,E=48,re=16,ie=92,ae=8,oe=16,D=22,O=14,se=14,k=15,ce=4,A=7.2,j={brick:{w:200,h:48},fork:{w:200,h:48},loop:{w:200,h:56},lane:{w:150,h:56},close:{w:96,h:34},stop:{w:76,h:34}},M=`loop:`,le=new Set([`$close`,`$stop`,`$lane`]),N=(e,t)=>{if(!e?.name)return`↺ route back`;let n=t?`${t[e.name]??0} / ${e.max??`?`}`:`max ${e.max??`?`}`;return`↺ ${e.name} · ${n}`};function ue(e,t,n,r){let i=null;for(let a of e)Array.isArray(a?.nodes)&&a.nodes[0]===n&&(a.nodes.includes(t)||a.nodes.includes(`$lane`)&&r.has(t))&&(!i||a.nodes.length<i.nodes.length)&&(i=a);return i}var de=new Set([`pass`,`fail`,`error`,`none`,`needs-info`,`reject`]);function fe(e,t=[]){let n=new Set(Array.isArray(e.stages)?e.stages:[]),r=(e.cycles||[]).filter(e=>Array.isArray(e?.nodes)),i=e=>r.some(t=>t.nodes[0]===e.to&&t.nodes.includes(e.from)),a=new Map((Array.isArray(t)?t:[]).map(e=>[e?.name,e])),o=(e.edges||[]).filter(e=>n.has(e?.from)),s=e=>(a.has(e)?a.get(e)?.outcomes||[]:o.filter(t=>t.from===e).map(e=>e.on)).some(e=>!de.has(e)),c=new Map;for(let e of o)n.has(e.to)&&!i(e)&&!e.from.startsWith(M)&&s(e.from)&&(c.has(e.from)||c.set(e.from,[]),c.get(e.from).includes(e.to)||c.get(e.from).push(e.to));return c}function P(e,t,n=[]){let r=fe(e,n);for(let n of[...Array.isArray(t)?t:[]].reverse()){if(!r.has(n?.stage)||!n.outcome)continue;let t=(e.edges||[]).find(e=>e.from===n.stage&&e.on===n.outcome);if(t&&r.get(n.stage).includes(t.to))return t.to}return null}function F(e,t=[],n={}){let r=n.width>0?Math.floor(n.width):1/0,i=[{rails:!0,stack:!1},{rails:!1,stack:!1},{rails:!0,stack:!0},{rails:!1,stack:!0}];for(let a of i){let o=pe(e,t,a,r,n.lane);if(o.width<=r||a===i.at(-1))return o}}function pe(e,t,n,r,i){let a=Array.isArray(e.stages)?e.stages:[],o=new Set(a),s=(Array.isArray(e.edges)?e.edges:[]).filter(e=>typeof e?.from==`string`&&typeof e?.to==`string`&&o.has(e.from)&&(o.has(e.to)||le.has(e.to))),c=(Array.isArray(e.cycles)?e.cycles:[]).filter(e=>Array.isArray(e?.nodes)),ee=new Map(t.map(e=>[e.name,e])),l=fe(e,t),te=new Set([...l.values()].flat()),u=e=>ue(c,e.from,e.to,te),d=new Map(o.has(e.start)?[[e.start,0]]:[]),f=s.filter(e=>o.has(e.to)&&!u(e));for(let e=0;e<a.length;e++){let e=!1;for(let t of f){if(!d.has(t.from))continue;let n=d.get(t.from)+1;d.get(t.to)>=n||(d.set(t.to,n),e=!0)}if(!e)break}let p=Math.max(-1,...d.values());for(let e of a)d.has(e)||d.set(e,++p);let m=p+1,h=[];for(let e of a)(h[d.get(e)]||=[]).push(e);let g=e=>h[d.get(e)].length>1,_=n.rails?T:oe,v=n.rails?re:ae,y=r===1/0?1/0:r-2*_,b=()=>Math.max(j.lane.w,Math.min(240,y-28)),x=e=>n.rails?j.lane.w:Math.max(ie,Math.min(j.lane.w,Math.floor((y-v*(e-1))/e))),S=a.map(e=>{let t=g(e),n=e.startsWith(M)?e.slice(5):null,r=n?`loop`:l.has(e)?`fork`:`brick`;return{id:e,kind:r,...t?{w:x(h[d.get(e)].length),h:j.lane.h}:{...j[r]||j.brick},rank:d.get(e),lane:t,stacked:!1,loop:n,human:r===`brick`||r===`fork`?ne(ee.get(e)):null,tags:[]}}),C=new Map(S.map(e=>[e.id,e])),w=s.some(e=>e.to===`$close`);if(w){let e={id:`$close`,kind:`close`,...j.close,rank:m,tags:[]};S.push(e),C.set(`$close`,e),h[m]=[`$close`]}let de=e=>{let t=null;for(let n of l.keys())d.get(n)<d.get(e)&&(!t||d.get(n)>d.get(t))&&(t=n);return t},P=new Map;for(let e of s){let t=`${e.from}\u0000${e.to}`;if(P.has(t))P.get(t).on.push(e.on);else{let n=u(e),r=e.to===`$lane`?l.get(de(e.from))?.[0]:e.to;if(e.to!==`$stop`&&!C.has(r))continue;let i=e.to===`$stop`?0:C.get(r).rank-d.get(e.from),a=e.to===`$stop`?`stop`:n?`back`:i===1?`flow`:`skip`;P.set(t,{from:e.from,to:e.to,target:r,on:[e.on],kind:a,back:!!n,cycle:n?.name??null,cycleDef:n,span:i})}}let F=[...P.values()],pe=F.filter(e=>e.kind===`back`||e.kind===`skip`),I=F.filter(e=>e.kind===`stop`&&g(e.from)),me=n.rails?I:[...pe,...F.filter(e=>e.kind===`stop`&&!g(e.from)),...I];for(let e of me)C.get(e.from).tags.push({kind:e.kind,on:e.on,to:e.to,cycle:e.cycle});let he=(e,t)=>e.kind===`back`?N(t.cycleDef):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,ge=e=>Math.max(0,...e.tags.map(t=>he(t,F.find(n=>n.from===e.id&&n.to===t.to)).length*A)),L=h.map(e=>(e||[]).map(e=>C.get(e))),R=e=>e.reduce((e,t)=>e+t.w,0)+v*(e.length-1),z=L.map(e=>n.stack&&e.length>1&&R(e)>y);L.forEach((e,t)=>{if(z[t])for(let t of e)Object.assign(t,{stacked:!0,w:b()})});let B=(e,t)=>z[t]?Math.max(...e.map(e=>e.w))+28:R(e),V=Math.max(j.brick.w,...L.map((e,t)=>e.length?B(e,t):0)),H=T,U=[];L.forEach((e,t)=>{if(!e.length)return;let n=(V-B(e,t))/2;if(z[t]){for(let t of e)Object.assign(t,{x:(V-t.w)/2,y:H}),H+=t.h+t.tags.length*k+D;H-=D}else{for(let t of e)Object.assign(t,{x:n,y:H}),n+=t.w+v;H+=Math.max(...e.map(e=>e.h)),H+=Math.max(0,...e.map(e=>e.tags.length))*k}U[t]=H+E/2,H+=E});let W=H-E,G=n.rails?pe.sort((e,t)=>Math.abs(t.span)-Math.abs(e.span)):[],K=e=>28+e*se,q=e=>e.back?N(e.cycleDef):e.on.join(` · `),J=G.length?K(G.length-1)+12:_;G.forEach((e,t)=>{J=Math.max(J,K(t)+8+q(e).length*A-C.get(e.from).x)});for(let e of S)e.x+=J;let Y=n.rails?F.filter(e=>e.kind===`stop`&&!g(e.from)):[],X=J+V+24;for(let e of Y){let t=C.get(e.from);X=Math.max(X,t.x+t.w+10+e.on.join(` · `).length*A)}let _e=Math.max(0,...S.filter(e=>e.tags.length).map(e=>e.x+e.w/2+6+ge(e))),Z=Math.max(J+V,_e)+_;if(Y.length){X=Math.max(X,_e+10);let e=w?C.get(`$close`).y:W-j.stop.h,t={id:`$stop`,kind:`stop`,...j.stop,x:X-j.stop.w/2,y:e,rank:m,tags:[]};S.push(t),C.set(`$stop`,t),Z=X+j.stop.w/2+T}let Q=e=>e.x+e.w/2,$=e=>e.y+e.h/2,ve=e=>e.y+e.h,ye=e=>e.x-O,be=e=>e.x+e.w+O,xe=new Map;for(let e of F)e.kind===`flow`&&xe.set(e.target,(xe.get(e.target)||0)+1);let Se=e=>e.to===`$lane`&&C.get(i)?.stacked&&l.get(de(e.from))?.includes(i)?C.get(i):C.get(e.target),Ce=new Map;for(let e of G){let t=Se(e).id;Ce.set(t,(Ce.get(t)||0)+1)}let we=new Map,Te=F.map(e=>{let t=C.get(e.from),n=Se(e),r={from:e.from,to:e.to,on:e.on,kind:e.kind,back:e.back,cycle:e.cycle};if(e.kind===`stop`){if(!Y.includes(e))return{...r,path:null};let n=C.get(`$stop`);return{...r,path:`M${t.x+t.w},${$(t)} H${X} V${n.y}`,lx:t.x+t.w+6,ly:$(t)-6,anchor:`start`}}if(e.kind===`back`||e.kind===`skip`){let i=G.indexOf(e);if(i<0)return{...r,path:null};let a=we.get(n.id)||0;we.set(n.id,a+1);let o=Math.ceil((Ce.get(n.id)-1)/2),s=o?Math.min(10,(n.h/2-ce)/o):10,c=$(n)+(a%2?1:-1)*Math.ceil(a/2)*s;return{...r,path:`M${t.x},${$(t)} H${K(i)} V${c} H${n.x}`,lx:K(i)+6,ly:$(t)-6,anchor:`start`}}let i=U[t.rank],a=t.stacked?`M${t.x+t.w},${$(t)} H${be(t)} V${i}`:`M${Q(t)},${ve(t)} V${i}`,o=n.stacked?` H${ye(n)} V${$(n)} H${n.x}`:` H${Q(n)} V${n.y}`,s=e.on.length===1&&e.on[0]===`pass`,c=(xe.get(n.id)||0)>1?{lx:t.stacked?be(t)+4:Q(t)+6,ly:t.stacked?$(t)-4:ve(t)+13}:n.stacked?{lx:n.x,ly:n.y-5}:{lx:Q(n)+6,ly:n.y-8};return{...r,path:a+o,...c,anchor:`start`,plain:s}});return{width:Math.ceil(Z),height:Math.ceil(W+T),mode:n.rails?`rails`:`tags`,stacked:z.some(Boolean),nodes:S,edges:Te}}var I=n(),me=20;function he({factory:e,bricks:t=[],loops:n=[],onSelect:r,highlight:i,child:a,counters:o,lane:s,history:c}){let ee=(0,w.useRef)(null),[l,te]=(0,w.useState)(0);(0,w.useLayoutEffect)(()=>{let e=ee.current;if(!e)return;let t=()=>te(t=>Math.abs(e.clientWidth-t)>me?e.clientWidth:t);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let u=s===void 0?P(e,c,t):s,d=F(e,t,{width:l,lane:u}),f=new Set(n.map(e=>e.name)),p=new Map((e.cycles||[]).map(e=>[e.name,e])),m=new Set(d.nodes.filter(e=>e.kind===`fork`).map(e=>e.id)),h=e=>e.kind===`back`?N(p.get(e.cycle),o):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,g=e=>e.kind===`loop`?`${e.id} stage, the ${e.loop} loop`:`${e.id} ${e.kind===`fork`?`fork`:`brick`}${e.human?`, ${e.human.toLowerCase()}`:``}`,_=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},v=e=>{let t=e.id===i,n=`${g(e)}${e.id===u?`, the lane taken`:``}`,o=t&&a&&(e.loop||e.lane)?`, at ${a.node}`:``;return r?{role:`button`,tabIndex:0,"aria-label":`${n}${o}`,onClick:_(e.id),onKeyDown:_(e.id)}:{role:`img`,"aria-label":`${n}${t?`, current stage`:``}${o}`}},y=e=>`fg-node ${e.kind}${e.lane?` lane`:``}${e.id===i?` current`:``}${e.id===u?` taken`:``}`,b=e=>u&&(e.to===u||e.from===u),x=e=>e.tags.map((t,n)=>(0,I.jsx)(`text`,{x:e.x+e.w/2+6,y:e.y+e.h+12+n*15,className:`fg-lbl fg-tag ${t.kind}`,children:h(t)},`${t.kind}${t.to}`));return(0,I.jsxs)(`div`,{className:`fg-wrap`,ref:ee,children:[(0,I.jsxs)(`svg`,{className:`fgraph`,"data-mode":`${d.mode}${d.stacked?` stacked`:``}`,style:{"--fg-w":`${d.width}px`},viewBox:`0 0 ${d.width} ${d.height}`,role:`group`,"aria-label":`${e.name} factory: ${(e.stages||[]).join(`, `)}`,children:[(0,I.jsx)(`defs`,{children:[`flow`,`back`,`stop`].map(e=>(0,I.jsx)(`marker`,{id:`fg-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,I.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`fg-head-${e}`})},e))}),d.edges.map(e=>{if(!e.path)return null;let t=e.kind===`skip`?`flow`:e.kind,n=e.back?N(p.get(e.cycle),o):e.kind===`flow`&&e.plain?``:e.on.join(` · `);return(0,I.jsxs)(`g`,{children:[(0,I.jsx)(`path`,{d:e.path,className:`fg-edge ${e.kind}${b(e)&&e.kind===`flow`?` taken`:``}`,markerEnd:`url(#fg-arrow-${t})`}),n?(0,I.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`fg-lbl ${e.kind}${e.kind===`flow`&&m.has(e.from)?` fork`:``}`,children:n}):null]},`${e.from}>${e.to}`)}),d.nodes.map(e=>{if(e.kind===`close`||e.kind===`stop`)return(0,I.jsxs)(`g`,{className:`fg-${e.kind}`,role:`img`,"aria-label":e.kind,children:[(0,I.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.h/2}),(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+4,textAnchor:`middle`,children:e.kind})]},e.id);let t=e.id===i?`step`:void 0,n=a&&e.id===i?a:null,r=n&&(e.loop||e.lane)?`at ${n.node}`:e.loop?f.has(e.loop)?`whole loop`:`not in catalogue`:e.lane?`no loop`:null;return(0,I.jsxs)(`g`,{children:[(0,I.jsxs)(`g`,{className:y(e),"aria-current":t,...v(e),children:[e.lane||e.loop?(0,I.jsx)(`title`,{children:e.id}):null,(0,I.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:e.h,rx:`10`}),(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+(r?-2:4),textAnchor:`middle`,children:e.loop||e.id}),r?(0,I.jsx)(`text`,{x:e.x+e.w/2,y:e.y+e.h/2+14,textAnchor:`middle`,className:`fg-sub`,children:r}):null,e.human?(0,I.jsx)(S,{x:e.x+e.w-4,y:e.y+4,label:e.human}):null]}),x(e)]},e.id)})]}),(0,I.jsx)(`ul`,{className:`fg-legend`,"aria-label":`Graph legend`,children:[[`brick`,`brick`],[`loop`,`whole loop (test · fix · verify)`],[`fork`,`fork`],[`back`,`route back, bounded by its max`],[`stop`,`fail → stop`]].map(([e,t])=>(0,I.jsxs)(`li`,{children:[(0,I.jsx)(`span`,{className:`fg-key ${e}`,"aria-hidden":`true`}),t]},e))})]})}var ge=encodeURIComponent,L=5e3,R=d.factories.map(e=>[e,s[e]]),z={project:`Project`,global:`Global`,shipped:`Shipped`},B={templates:`Origins`,active:`Statuses`},V=[[`wait`,`Waits for you`,[`awaiting`,`unreadable`]],[`run`,`Running`,[`running`]],[`end`,`Ended`,[`stopped`,`done`,`finished`]]],H=V.flatMap(([,e,t])=>t.map(t=>[t,e])),U=e=>!!e.graph,W=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r}))),G=e=>W(e.map(e=>({...e,desc:e.description})),e=>e.origin,Object.entries(z)),K=e=>W(e.map(e=>({...e,name:e.root,desc:e.factory,meta:U(e)?Y(e).join(` · `):void 0})),e=>e.status,H);function q(e){if(e==null)return`unknown`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.round(t/60);return n<60?`${n} min`:`${Math.floor(n/60)} h ${String(n%60).padStart(2,`0`)} min`}var J=e=>`${e.slice(0,16).replace(`T`,` `)} UTC`;function Y(e){if(e.status===`unreadable`)return[`Its FACTORY.md cannot be read.`];if(e.status===`finished`)return[`Its FACTORY.md is gone: the run closed.`];let t=e.tasks,n=e.metrics;return[e.awaiting?`${e.awaiting.stage} · ${e.awaiting.outcome}`:e.status===`stopped`?`stopped: ${e.reason}`:e.status===`done`?`closed`:e.stage,t?`task ${t.index}/${t.count}`:null,n?`work ${q(n.workMs)}`:null,n?.openWaitMs==null?null:`waiting ${q(n.openWaitMs)}`,...(e.graph?.cycles||[]).filter(t=>e.counters?.[t.name]>0).map(t=>`${t.name} ${e.counters[t.name]}/${t.max}`)].filter(Boolean)}function X({runs:e}){return(0,I.jsx)(`section`,{className:`fac-board`,"aria-label":`Runs board`,children:V.map(([t,n,r])=>{let i=e.filter(e=>r.includes(e.status));return(0,I.jsxs)(`div`,{className:`fac-col ${t}`,role:`group`,"aria-label":n,children:[(0,I.jsxs)(`h3`,{className:`loop-kicker`,children:[n,` `,(0,I.jsx)(`span`,{className:`mono dim`,children:i.length})]}),i.length?(0,I.jsx)(`ul`,{children:i.map(e=>(0,I.jsx)(`li`,{children:(0,I.jsxs)(`a`,{className:`fac-card`,href:`#/factories/active/${ge(e.root)}`,children:[(0,I.jsx)(`b`,{children:e.title}),(0,I.jsx)(`span`,{className:`mono`,children:e.factory}),(0,I.jsx)(`span`,{children:Y(e).join(` · `)})]})},e.root))}):(0,I.jsx)(`p`,{className:`panel-note`,children:`None.`})]},t)})})}function _e({run:e}){if(!e.history?.length)return null;let t=e.metrics,n=e.history.map((e,n)=>({i:n,h:e,e:t?.entries?.[n]||{}}));return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Timeline`}),(0,I.jsx)(x,{caption:`Run history`,captionHidden:!0,rowKey:e=>e.i,rows:n,columns:[{key:`stage`,label:`Stage`,render:e=>e.h.stage},{key:`result`,label:`Result`,render:e=>e.h.verdict?`you answered ${e.h.verdict}`:(0,I.jsxs)(I.Fragment,{children:[e.h.outcome,` `,e.e.rework?(0,I.jsx)(`span`,{className:`tag warn`,children:`rework`}):null]})},{key:`at`,label:`Time`,render:e=>typeof e.h.at==`string`?(0,I.jsx)(`time`,{dateTime:e.h.at,children:J(e.h.at)}):`unknown`},{key:`ms`,label:`Duration`,render:e=>`${q(e.e.ms)}${e.e.wait?` waiting`:``}`}]}),t?(0,I.jsxs)(`p`,{className:`panel-note fac-totals`,children:[`Work `,q(t.workMs),` · waited `,q(t.waitMs),t.openWaitMs==null?``:` · waiting ${q(t.openWaitMs)}`,` · tokens`,` `,t.tokens??`unknown`]}):null]})}var Z=(e,t)=>(0,I.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),Q={templates:e=>Z(``,e.origin),active:e=>Z(C[e.status],e.status)},$=he;function ve({factory:e,counters:t}){return e.cycles?.length?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Routes back`}),(0,I.jsx)(`ul`,{className:`fac-cycles`,"aria-label":`Cycles`,children:e.cycles.map(e=>(0,I.jsxs)(`li`,{children:[(0,I.jsx)(`b`,{children:e.name}),`: `,e.nodes.join(` → `),` —`,` `,t?`lap ${t[e.name]??0} of ${e.max}`:`${e.max} laps at most`]},e.name))})]}):null}function ye({f:e,bricks:t,loops:n}){let r=`Run the ${e.name} factory on <issue URL, file or request>`,i=[`git worktree add ../<repo>-factory-<slug> -b loop/factory-<slug>`,`cd ../<repo>-factory-<slug>`,`geneseed factory init --factory ${e.name} --title "<title>" --requirement "<requirement>" --input "<issue URL, file path or pasted text>"`].join(` && `);return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`reader-tags`,children:[(0,I.jsx)(`span`,{className:`tag acc`,children:`Factory`}),Z(``,e.origin)]}),(0,I.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,I.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,I.jsxs)(`p`,{className:`mono dim reader-src`,children:[`factories/`,e.name,`.json · `,e.origin]}),(0,I.jsx)(`hr`,{className:`hr`}),(0,I.jsx)($,{factory:e.factory,bricks:t,loops:n}),(0,I.jsx)(ve,{factory:e.factory}),(0,I.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`fac-start-h`,children:[(0,I.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,I.jsx)(`h3`,{id:`fac-start-h`,className:`loop-kicker`,children:`Start it: ask the agent`}),(0,I.jsx)(b,{text:r,label:`Copy request`})]}),(0,I.jsx)(`pre`,{className:`mono`,children:r}),(0,I.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,I.jsx)(`h3`,{className:`loop-kicker`,children:`Or by hand, in a new worktree`}),(0,I.jsx)(b,{text:i,label:`Copy command`})]}),(0,I.jsx)(`pre`,{className:`mono`,children:i})]}),(0,I.jsxs)(`p`,{className:`panel-note`,children:[(0,I.jsx)(`code`,{className:`mono`,children:`init`}),` only registers the run: an agent then drives`,` `,(0,I.jsx)(`code`,{className:`mono`,children:`geneseed factory next`}),` and `,(0,I.jsx)(`code`,{className:`mono`,children:`record`}),`.`]}),e.factory.rules?.length?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,I.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every stage follows`,children:e.factory.rules.map(e=>(0,I.jsx)(`li`,{children:e},e))})]}):null]})}function be({run:e,bricks:t,loops:n,from:r}){let i=e.tasks;return(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`p`,{className:`panel-note`,children:(0,I.jsx)(`a`,{href:`#/factories/active`,children:`← All runs`})}),(0,I.jsxs)(`div`,{className:`reader-tags`,children:[(0,I.jsx)(`span`,{className:`tag acc`,children:`Factory run`}),(0,I.jsx)(`span`,{className:`tag${C[e.status]?` ${C[e.status]}`:``}`,children:e.status})]}),(0,I.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,I.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.factory,` · `,e.branch,` · `,e.root]}),U(e)?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`reader-lede`,children:[`At `,e.stage,` · `,e.transitions,` transitions`,i?` · task ${i.index} / ${i.count}`:``,e.loop?` · loop at ${e.loop.node}, iteration ${e.loop.iteration}`:``]}),e.awaiting?(0,I.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,I.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind??`you`,e.awaiting.stage?` at ${e.awaiting.stage} (${e.awaiting.outcome})`:``]}),` `,`— Answer in the agent's session.`,e.awaiting.note?(0,I.jsxs)(I.Fragment,{children:[` `,`Its note: `,(0,I.jsx)(`code`,{className:`mono`,children:e.awaiting.note})]}):null]}):null,e.reason?(0,I.jsx)(`p`,{className:`panel-note`,children:e.reason}):null,(0,I.jsx)(`hr`,{className:`hr`}),(0,I.jsx)($,{factory:e.graph,bricks:t,loops:n,highlight:e.stage,child:e.loop,counters:e.counters,lane:e.lane,history:e.history}),(0,I.jsx)(ve,{factory:e.graph,counters:e.counters}),(0,I.jsx)(_e,{run:e}),(0,I.jsxs)(`p`,{className:`panel-note`,children:[`Bricks and loops drawn from the catalogue of `,r||`the default install`,`, which the run’s project may not share.`]})]}):(0,I.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its FACTORY.md cannot be read, so there is no state to show.`:`Its FACTORY.md is gone: the run closed and its state went with it.`})]})}function xe({problems:e}){if(!e?.length)return null;let t=e.length;return(0,I.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,I.jsxs)(`b`,{className:`t-warn`,children:[t,` factory `,t===1?`problem`:`problems`,`: these factories cannot run as they are`]}),(0,I.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,I.jsx)(`li`,{className:`mono`,children:e},e))})]})}var Se={templates:{title:`No factories`,body:(0,I.jsxs)(I.Fragment,{children:[`Add one under `,(0,I.jsx)(`code`,{className:`mono`,children:`.geneseed/factories/`}),` in the repo.`]})},active:{title:`No runs yet`,body:(0,I.jsxs)(I.Fragment,{children:[`Ask the agent to run a factory, or start one by hand in a worktree with`,` `,(0,I.jsx)(`code`,{className:`mono`,children:`geneseed factory init`}),`. It shows up here while it runs.`]})}},Ce={templates:(0,I.jsxs)(I.Fragment,{children:[`A factory carries one work item through bricks and loops to an open PR.`,` `,(0,I.jsx)(`a`,{href:`#/docs/factories`,children:`How factories work →`})]}),active:(0,I.jsxs)(I.Fragment,{children:[`Factory runs registered on this machine, read from their FACTORY.md: the ones that wait for you first. A card opens its timeline. `,(0,I.jsx)(`a`,{href:`#/docs/run-a-factory`,children:`Run a factory →`})]})};function we(){let[e,t]=(0,w.useState)(null),[n,i]=(0,w.useState)(null);return p(e=>r.activeFactories().then(n=>e()&&(t(m(n)),i(null)),t=>e()&&i(t.message)),L,[]),{runs:e?e.factories||[]:null,error:n}}function Te({tab:e=`templates`,item:t,dataRev:n}){let s=a(n),[d,p]=te(`factories`,s),{data:m,error:b}=o(()=>r.factories(ee(d)),[n,d?.id??``],`factories`),{runs:x,error:S}=we(),[C,ne]=(0,w.useState)(``),[T,E]=(0,w.useState)(`all`),[re,ie]=(0,w.useState)(e);e!==re&&(ie(e),ne(``),E(`all`));let ae=m?.bricks||[],oe=m?.loops||[],D=e===`active`?x&&K(x):m&&G(m.factories||[]),O=D||[],se=y(O),k=T===`all`?O:O.filter(e=>e.group===T),ce=C.trim(),A=h(k,ce),j=!!(t&&D&&!O.some(e=>e.name===t)),M=j?null:O.find(e=>e.name===t)||(e===`active`?null:O[0])||null,le={templates:m?.factories?.length,active:x?.length},N=R.find(([t])=>t===e)[1],ue=e===`active`?S:b;return(0,I.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,I.jsx)(u,{className:`page-pick`,installs:s,value:d,onChange:p}),(0,I.jsx)(i,{error:ue,style:{margin:`0 0 var(--sp-3)`}}),(0,I.jsx)(xe,{problems:m?.problems}),(0,I.jsxs)(`div`,{className:`library`,children:[(0,I.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Factories sections`,children:[(0,I.jsxs)(`div`,{className:`lib-title`,children:[(0,I.jsx)(`h1`,{className:`h`,children:`Factories`}),(0,I.jsx)(`span`,{className:`dim`,children:`Work items, carried to a PR`})]}),(0,I.jsx)(`p`,{className:`panel-note lib-lede`,children:Ce[e]}),(0,I.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:R.map(([t,n])=>(0,I.jsxs)(w.Fragment,{children:[(0,I.jsxs)(`a`,{href:`#/factories/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,I.jsx)(`span`,{className:`mono dim`,children:le[t]??``})]}),e===t&&(0,I.jsx)(v,{label:B[t],total:O.length,cats:se,cat:T,onChange:E})]},t))})]}),(0,I.jsx)(g,{label:N,count:ce?`${A.length} of ${k.length}`:D?k.length:``,q:C,onQ:ne,matched:A.length,inView:[e,t],current:M?M.title||M.name:void 0,sections:R.map(([t,n])=>({key:t,label:n,n:le[t],href:`#/factories/${t}`,on:e===t})),cats:se,cat:T,total:O.length,onCat:E,catLabel:B[e],children:D?O.length===0?(0,I.jsx)(f,{title:Se[e].title,children:Se[e].body}):(0,I.jsx)(_,{rows:A,activeName:M?.name,hrefOf:t=>`#/factories/${e}/${ge(t.name)}`,pills:Q[e]}):ue?null:(0,I.jsx)(c,{})}),(0,I.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:j?(0,I.jsx)(f,{title:(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/factories/${e}`,label:`All ${N.toLowerCase()} →`}}):M?e===`active`?(0,I.jsx)(be,{run:M,bricks:ae,loops:oe,from:d?l(d):null}):(0,I.jsx)(ye,{f:M,bricks:ae,loops:oe},M.name):e===`active`&&D&&O.length?(0,I.jsx)(X,{runs:A}):e===`active`&&D?(0,I.jsx)(f,{title:`What is a factory?`,docs:{href:`#/docs/factories`,label:`How factories work →`},children:`A factory runs stages, bricks and whole loops, until the work is an open PR.`}):null})]})]})}export{V as COLUMNS,Y as cardFacts,Te as default,G as factoryRows,q as fmtMs,K as runRows};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{n,t as r}from"./motion-RlUl1osO.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{B as o,F as s,L as c,_t as l,gt as u}from"./index-How7SzDZ.js";import{i as d,n as f,r as p}from"./Dashboard-DBOEi9lQ.js";e();var m=t(),h=12,g=Array.from({length:7},(e,t)=>`var(--cat-${t})`),_=n[9];function v({segments:e,size:t=186,stroke:n=26,caption:i=`capabilities`}){let a=e.reduce((e,t)=>e+t.n,0);return(0,m.jsxs)(`div`,{className:`ring-box`,children:[(0,m.jsx)(o,{segments:e,size:t,stroke:n,label:i,sweepMs:_}),(0,m.jsxs)(`div`,{className:`ring-center`,children:[(0,m.jsx)(`div`,{className:`donut-c-num`,children:(0,m.jsx)(r,{value:a,duration:_})}),(0,m.jsx)(`div`,{className:`donut-c-cap`,children:i})]})]})}function y(e){if(e.length<2)return e.length?`M${e[0][0]},${e[0][1]}`:``;let t=`M${e[0][0]},${e[0][1]}`;for(let n=0;n<e.length-1;n++){let r=e[n-1]||e[n],i=e[n],a=e[n+1],o=e[n+2]||a,s=i[0]+(a[0]-r[0])/6,c=i[1]+(a[1]-r[1])/6,l=a[0]-(o[0]-i[0])/6,u=a[1]-(o[1]-i[1])/6;t+=` C${s},${c} ${l},${u} ${a[0]},${a[1]}`}return t}function b({data:e,height:t=156,accent:n}){if(!e.length)return null;let r=t,i=Math.max(...e.map(e=>e.v),1)+1,a=e.length>1?588/(e.length-1):588,o=e.map((e,t)=>[6+t*a,r-6-e.v/i*(r-14-6)]),s=y(o),c=o[o.length-1],l=o[0],u=`${s} L${c[0]},${r} L${l[0]},${r} Z`;return(0,m.jsxs)(`svg`,{viewBox:`0 0 600 ${r}`,preserveAspectRatio:`none`,style:{width:`100%`,height:t,display:`block`,overflow:`visible`},children:[(0,m.jsx)(`defs`,{children:(0,m.jsxs)(`linearGradient`,{id:`b-grad`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,m.jsx)(`stop`,{offset:`0`,style:{stopColor:n},stopOpacity:`.28`}),(0,m.jsx)(`stop`,{offset:`1`,style:{stopColor:n},stopOpacity:`0`})]})}),(0,m.jsx)(`path`,{d:u,fill:`url(#b-grad)`}),(0,m.jsx)(`path`,{d:s,fill:`none`,style:{stroke:n},strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`,vectorEffect:`non-scaling-stroke`}),(0,m.jsx)(`circle`,{cx:c[0],cy:c[1],r:`3.5`,style:{fill:n},vectorEffect:`non-scaling-stroke`})]})}function x({label:e,value:t,sub:n,color:r,icon:i}){return(0,m.jsxs)(`div`,{className:`b-tile`,children:[(0,m.jsx)(`span`,{className:`b-tile-ic`,style:{background:`color-mix(in srgb, ${r} 18%, transparent)`,color:r},children:(0,m.jsx)(u,{name:i})}),(0,m.jsxs)(`div`,{className:`b-tile-body`,children:[(0,m.jsx)(`div`,{className:`b-tile-val`+(t===0?` zero`:``),children:t}),(0,m.jsx)(`div`,{className:`b-tile-label`,children:e})]}),(0,m.jsx)(`div`,{className:`b-tile-sub`,children:n})]})}function S({overview:e,sigil:t,jobs:n,lens:o,onAction:_}){let y=e.counts||{},S=o?.doctor?.state||`loading`,C=o?.doctor?.data?.groups||[],w=S===`ok`,T=C.filter(e=>e.problems.length===0).length,E=C.length,D=d(e,o?.tone),O=c(n,h),k=l(e.diff),A=a.filter(e=>(y[e]||0)>0).map((e,t)=>({key:e,label:i[e].label,n:y[e]||0,tone:`cat`+t%g.length,color:g[t%g.length]})),j=A.reduce((e,t)=>e+t.n,0),M=s(n||[],10),N=M.reduce((e,t)=>e+t.v,0);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`b-greet`,children:(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`eyebrow`,children:`your harness`}),(0,m.jsx)(`h2`,{className:`h b-h`,children:D}),(0,m.jsx)(f,{verdict:o?.verdict}),(0,m.jsx)(`p`,{className:`sub`,children:t||`A friendly read of every layer growing in your harness.`})]})}),(0,m.jsxs)(`div`,{className:`grid b-hero-grid mb-16`,children:[(0,m.jsxs)(`div`,{className:`card b-hero`,children:[(0,m.jsx)(`div`,{className:`b-hero-ring`,children:(0,m.jsx)(v,{segments:[{key:`pass`,label:`pass`,n:T,tone:`good`},{key:`attention`,label:`attention`,n:Math.max(E-T,0),tone:`warn`}],size:168,stroke:20,caption:`checks`})}),(0,m.jsxs)(`div`,{className:`b-hero-side`,children:[(0,m.jsx)(`h3`,{className:`b-hero-title`,children:w?`${T} of ${E} checks pass`:S===`failed`?`Doctor did not answer`:`Checking…`}),S===`failed`&&(0,m.jsxs)(`button`,{className:`btn ghost b-hero-retry`,onClick:()=>_(`doctor`),children:[(0,m.jsx)(u,{name:`doctor`}),`Retry doctor`]}),(0,m.jsxs)(`p`,{className:`sub`,children:[`One source, rendered into `,(0,m.jsx)(`code`,{children:e.target}),` and inherited by every repo on this machine.`]}),w&&(0,m.jsx)(`ul`,{className:`b-hero-checks`,children:C.map(e=>{let t=e.problems.length===0;return(0,m.jsxs)(`li`,{className:`b-hcheck ${t?`ok`:`bad`}`,title:t?`clean`:e.problems.join(`; `),children:[(0,m.jsx)(`span`,{className:`b-hcheck-mark`,children:t?`✓`:`!`}),(0,m.jsx)(`span`,{className:`b-hcheck-label`,children:e.label})]},e.label)})}),(0,m.jsxs)(`div`,{className:`b-chips`,children:[(0,m.jsxs)(`span`,{className:`b-chip`,children:[(0,m.jsx)(`b`,{className:`t-cap`,children:e.theme}),` voice`]}),(0,m.jsx)(`span`,{className:`b-chip`,children:(0,m.jsx)(`b`,{children:e.emit})}),(0,m.jsxs)(`span`,{className:`b-chip`,children:[`built `,(0,m.jsx)(`b`,{children:e.build_time||`unknown`})]})]})]})]}),(0,m.jsxs)(`div`,{className:`b-tiles`,children:[(0,m.jsx)(x,{label:`Agents`,value:y.agents??`—`,sub:`specialists`,color:g[0],icon:`layers`}),(0,m.jsx)(x,{label:`Skills`,value:y.skills??`—`,sub:`workflows`,color:g[1],icon:`skill`}),(0,m.jsx)(x,{label:`Dictates`,value:y.laws??`—`,sub:y.doctrines?`${y.doctrines.active}/${y.doctrines.total} packs · ${y.doctrines.rules} rules`:`all upheld`,color:g[2],icon:`law`}),(0,m.jsx)(x,{label:`Local edits`,value:k,sub:`files`,color:g[3],icon:`changes`})]})]}),(0,m.jsxs)(`div`,{className:`grid split-even mb-16`,children:[(0,m.jsxs)(`div`,{className:`card pad-lg b-mix-card`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Capability mix`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[j,` total`]})})]}),(0,m.jsxs)(`div`,{className:`b-mix`,children:[(0,m.jsx)(v,{segments:A,size:186,stroke:26}),(0,m.jsx)(`div`,{className:`b-legend`,children:A.map(e=>(0,m.jsxs)(`div`,{className:`b-leg-row`,children:[(0,m.jsx)(`span`,{className:`b-leg-dot`,style:{background:e.color}}),(0,m.jsx)(`span`,{className:`b-leg-name`,children:e.label}),(0,m.jsx)(`span`,{className:`b-leg-bar`,children:(0,m.jsx)(`i`,{style:{width:`${e.n/j*100}%`,background:e.color}})}),(0,m.jsx)(`span`,{className:`b-leg-val`,children:e.n})]},e.label))})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent runs`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`badge ok`,children:[(0,m.jsx)(`span`,{className:`dot`}),`job log`]})})]}),(0,m.jsxs)(`div`,{className:`b-stat-lead`,children:[(0,m.jsx)(`span`,{className:`b-stat-big`,children:(0,m.jsx)(r,{value:N})}),(0,m.jsxs)(`span`,{className:`b-stat-cap`,children:[`runs in the last 10 days`,w&&E>0&&` · ${T}/${E} checks pass now`]})]}),(0,m.jsx)(b,{data:M,accent:g[0],height:156})]})]}),(0,m.jsxs)(`div`,{className:`card pad-lg`,children:[(0,m.jsxs)(`div`,{className:`card-head`,children:[(0,m.jsx)(`h3`,{children:`Recent activity`}),(0,m.jsx)(`div`,{className:`right`,children:(0,m.jsxs)(`span`,{className:`tick`,children:[`last `,O.length,` runs`]})})]}),(0,m.jsx)(p,{jobs:n,max:h,empty:(0,m.jsx)(`p`,{className:`sub`,children:`No runs yet. Trigger an action to populate this.`})})]})]})}export{S as default};
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,G as a,J as o,St as s,V as c,W as l,_t as u,ct as d,dt as f,et as p,ft as m,gt as h,ht as g,it as _,mt as v,q as y,tt as b,z as x}from"./index-How7SzDZ.js";import{t as S}from"./EmptyState-CY5Pm2xy.js";import{t as C}from"./Tabs-CWeQTADL.js";import{n as w,r as T,t as ee}from"./controls-D4wmg_pl.js";var E=e(t(),1),D=n();function te({host:e,theme:t,options:n,onAction:i,onClose:a,onNote:o}){let[s,c]=(0,E.useState)({path:``,host:e,theme:t,footprint:`lean`,posture:`peer`,mode:`direct`,trust:`balanced`}),[l,u]=(0,E.useState)(!1),[p,m]=(0,E.useState)(``),h=(e,t)=>c(n=>({...n,[e]:t})),g=async()=>{u(!0),o(``);try{let e=await r.pickFolder();e.path?(h(`path`,e.path),m(``)):e.error&&o(e.error)}catch(e){o(e.message)}finally{u(!1)}},_=async()=>{let e=s.path.trim();e?(m(``),o(``),await i?.(`deploy`,{host:s.host,path:e,theme:s.theme,footprint:s.footprint,posture:s.posture,mode:s.mode,trust:s.trust})&&a()):m(`Choose or type a folder to deploy into.`)};return(0,D.jsxs)(`div`,{className:`deploy-pop`,children:[(0,D.jsxs)(`div`,{className:`dp-row`,children:[(0,D.jsx)(`input`,{className:`inp dp-path`,type:`text`,placeholder:`/path/to/project, or click Browse…`,value:s.path,onChange:e=>{h(`path`,e.target.value),m(``)},onKeyDown:e=>e.key===`Enter`&&_(),"aria-label":`Folder to deploy into`,"aria-invalid":p?!0:void 0,"aria-describedby":p?`dp-path-err`:void 0}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:l,onClick:g,children:l?`Choosing…`:`Browse…`})]}),p?(0,D.jsx)(`p`,{id:`dp-path-err`,className:`tag bad note`,role:`alert`,children:p}):null,(0,D.jsxs)(`div`,{className:`dp-row`,children:[(0,D.jsxs)(`label`,{className:`dp-field`,children:[(0,D.jsx)(`span`,{children:`Deploy as`}),(0,D.jsx)(`select`,{className:`sel`,"aria-label":`host for the new install`,value:s.host,onChange:e=>h(`host`,e.target.value),children:d.map(e=>(0,D.jsx)(`option`,{value:e.id,children:e.label},e.id))})]}),(0,D.jsx)(w,{value:s,options:n,onChange:h,who:`the new install`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:_,children:`Deploy`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:a,children:`Cancel`})]}),(0,D.jsxs)(`p`,{className:`sub dp-note`,children:[`Adds a per-repo harness (`,(0,D.jsx)(`code`,{children:f(s.host).deployAdds}),`) into the folder, non-destructively. It’s then tracked here even after you leave its directory.`]})]})}function O(){let{data:e,error:t,reload:n}=s(()=>r.excludes(),[]),[i,a]=(0,E.useState)(!1),[o,c]=(0,E.useState)([]),l=async(e,t)=>{a(!0);try{let n=await r.excludeMutate(e,t);c(n.messages||[])}catch(e){c(e.body?.messages||[e.message])}finally{a(!1),n()}};return t||!e?.installs?.length?null:(0,D.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,D.jsx)(`div`,{className:`card-head`,children:(0,D.jsx)(`h3`,{children:`Excluded folders`})}),(0,D.jsx)(`p`,{className:`sub mb-16`,children:`Sovereign repos: inside these folders every global harness goes dormant — hooks stay silent and the global preamble is not loaded.`}),(e.excludes||[]).map(e=>(0,D.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,D.jsx)(`code`,{children:e.path}),(0,D.jsx)(`span`,{className:`mono muted`,children:e.hosts.map(e=>f(e).label).join(`, `)}),(0,D.jsx)(`button`,{className:`btn ghost sm`,disabled:i,"aria-label":`Stop excluding ${e.path}`,onClick:()=>l(`remove`,e.path),children:`Remove`})]},e.path)),(0,D.jsxs)(`button`,{className:`btn ghost sm`,disabled:i,onClick:async()=>{a(!0);try{let e=await r.pickFolder();e.path?await l(`add`,e.path):e.error&&c([e.error])}catch(e){c([e.message])}finally{a(!1)}},children:[(0,D.jsx)(h,{name:`folder`}),` Exclude a folder…`]}),o.map((e,t)=>(0,D.jsx)(`p`,{className:`sub`,children:e},t))]})}var k=`This project sees your machine-wide rules, profile and memory map, so what you taught one tool or repo applies here too.`,A=`About 1 500 tokens at every session start, growing with your rules. The hook budget is fixed at 9 000 characters, and the tier loads before this project's docs, so a large tier can push them down to a lazy listing.`;function j({targets:e,onReveal:t}){let n=e.flatMap(e=>e.servers);return(0,D.jsxs)(`div`,{className:`ip-block`,children:[(0,D.jsxs)(`span`,{className:`ip-label`,children:[`MCP servers `,(0,D.jsx)(`span`,{className:`mono dim`,children:n.length})]}),e.map(e=>(0,D.jsxs)(`div`,{className:`mcp-target`,children:[(0,D.jsxs)(`div`,{className:`mt-head`,children:[(0,D.jsx)(`code`,{title:e.path,children:e.label}),e.exists?(0,D.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:()=>t(e),"aria-label":`Open the folder holding ${e.label}`,title:`Open the folder holding ${e.path} to edit it`,children:`Open folder`}):null]}),e.exists?e.servers.length?e.servers.map(e=>(0,D.jsxs)(`div`,{className:`mcp-row`,children:[(0,D.jsx)(`span`,{className:`mono`,children:e.name}),(0,D.jsx)(`span`,{className:`tag ${e.state===`enabled`?`ok`:`warn`}`,children:e.state===`enabled`?`Enabled`:`Disabled`})]},e.name)):(0,D.jsx)(`p`,{className:`sub`,children:`None configured in this file.`}):(0,D.jsxs)(`p`,{className:`sub`,children:[`No MCP file yet (it would be `,(0,D.jsx)(`code`,{children:e.path}),`).`]})]},e.path))]})}var M=6;function N({leftovers:e,canAct:t,busy:n,onForce:r}){let i=e?.kept||[],a=e?.stale||[],o=[...i,...a];return o.length?(0,D.jsxs)(`div`,{className:`ip-block ip-leftovers`,role:`group`,"aria-label":`Files a rebuild keeps`,children:[(0,D.jsxs)(`span`,{className:`ip-label`,children:[`Not Geneseed’s copy `,(0,D.jsx)(`span`,{className:`mono dim`,children:o.length})]}),i.length?(0,D.jsxs)(`p`,{className:`sub`,children:[i.length===1?`This file is yours`:`These files are yours`,` where Geneseed ships its own: you edited a shipped file, or had one under the same name. A rebuild keeps`,` `,i.length===1?`it`:`them`,`.`]}):null,a.length?(0,D.jsxs)(`p`,{className:`sub`,children:[a.length===1?`One retired skill was`:`${a.length} retired skills were`,` `,`left by an older version. A rebuild leaves `,a.length===1?`it`:`them`,` in place.`]}):null,(0,D.jsxs)(`ul`,{className:`ip-files`,children:[o.slice(0,M).map(e=>(0,D.jsx)(`li`,{children:(0,D.jsx)(`code`,{title:e,children:e})},e)),o.length>M?(0,D.jsxs)(`li`,{className:`dim`,children:[`and `,o.length-M,` more`]}):null]}),t?(0,D.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,disabled:n,onClick:r,children:`Replace with Geneseed’s copies…`}):null,(0,D.jsx)(`p`,{className:`sub`,children:`Skills and agents under your own names, memory, notebook, rules and profile are never touched. To keep a file of yours for good, exclude that skill instead.`})]}):null}var P={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`],absent:[`Not installed`,``]};function F({inst:e,targets:t,choice:n,unchanged:r,options:i,onPick:a,canAct:o,busy:s,memory:c,onMemory:l,onApply:u,onToggleInstall:d,onRemove:p,onRevealMcp:h,onForce:g}){let _=`${f(e.host).label} · ${e.scope}`,[v,y]=P[e.state]||P.absent,b=e.state===`active`,x=e.state===`absent`;return(0,D.jsxs)(`aside`,{className:`install-panel`,"aria-label":`${_} install`,children:[(0,D.jsx)(`span`,{className:`ip-eyebrow`,children:`Selected install`}),(0,D.jsxs)(`div`,{className:`ip-head`,children:[(0,D.jsx)(`h2`,{children:m(e)}),(0,D.jsx)(`span`,{className:`tag ${y}`,children:v})]}),(0,D.jsx)(`span`,{className:`ip-kind`,children:e.scope===`global`?`Global install`:`Per-project install · ${f(e.host).label}`}),(0,D.jsx)(`code`,{className:`ip-path`,children:e.path}),x?(0,D.jsxs)(`p`,{className:`sub`,children:[`Install Geneseed here as `,(0,D.jsx)(`strong`,{children:f(e.host).label}),`. Files are added non-destructively; deactivate or uninstall later.`]}):null,(b||x)&&o?(0,D.jsxs)(`div`,{className:`ip-picks`,children:[(0,D.jsx)(w,{value:n,options:i,onChange:a,who:_}),(0,D.jsxs)(`p`,{className:`sub`,children:[n.footprint===`lean`?`Lean footprint: terse rule lines and a pointer to the full file, about 40% smaller.`:`Full footprint: every rule’s complete text inline, the largest context.`,` `,`Every rule stays in force. `,(0,D.jsx)(`a`,{href:`#/docs/footprint`,children:`Learn more →`})]})]}):null,(b||x)&&o&&e.scope!==`global`?(0,D.jsxs)(`div`,{className:`ip-block`,children:[(0,D.jsxs)(`label`,{className:`ip-switch`,children:[(0,D.jsx)(T,{on:!!n.sharedTier,label:`shared tier for ${_}`,onToggle:()=>a(`sharedTier`,!n.sharedTier)}),(0,D.jsx)(`span`,{children:`Read the machine-wide shared tier`})]}),(0,D.jsxs)(`p`,{className:`sub`,children:[(0,D.jsx)(`strong`,{children:`Benefit:`}),` `,k]}),(0,D.jsxs)(`p`,{className:`sub`,children:[(0,D.jsx)(`strong`,{children:`Cost:`}),` `,A]})]}):null,b?(0,D.jsx)(N,{leftovers:e.leftovers,canAct:o,busy:s,onForce:g}):null,b&&t.length?(0,D.jsx)(j,{targets:t,onReveal:h}):null,b&&e.scope===`global`?(0,D.jsx)(O,{}):null,x?null:(0,D.jsxs)(`label`,{className:`ip-switch`,children:[(0,D.jsx)(T,{on:b,disabled:s,label:`activate ${_}`,onToggle:d}),(0,D.jsx)(`span`,{children:b?`Active: loads in every session`:`Disabled: files moved aside`})]}),(0,D.jsx)(`div`,{className:`ip-spacer`}),o?(0,D.jsxs)(`div`,{className:`ip-actions`,children:[x?(0,D.jsx)(`button`,{type:`button`,className:`btn`,onClick:u,children:`Install`}):b?(0,D.jsx)(`button`,{type:`button`,className:`btn`,disabled:r,onClick:u,children:`Apply and rebuild`}):null,x?null:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`label`,{className:`field`,children:[(0,D.jsx)(`span`,{children:`On uninstall, memory and notebook`}),(0,D.jsxs)(`select`,{className:`sel`,value:c,onChange:e=>l(e.target.value),children:[(0,D.jsx)(`option`,{value:`keep`,children:`keep in place`}),(0,D.jsx)(`option`,{value:`archive`,children:`archive aside`}),(0,D.jsx)(`option`,{value:`delete`,children:`delete too`})]})]}),(0,D.jsx)(`button`,{type:`button`,className:`btn ghost danger-line`,"aria-label":`remove ${_} from ${e.path}`,disabled:s,onClick:p,children:`Uninstall…`})]})]}):null]})}function I({dataRev:e}){let{data:t,error:n,reload:a}=s(()=>r.migratePreview(),[e]);return(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`preview-h`,children:[(0,D.jsx)(`div`,{className:`panel-head`,children:(0,D.jsx)(`h2`,{id:`preview-h`,children:`Next rebuild`})}),n?(0,D.jsx)(i,{error:n,onRetry:a}):t?(0,D.jsxs)(D.Fragment,{children:[t.folds.length?(0,D.jsx)(`ul`,{className:`preview-list`,children:t.folds.map(e=>(0,D.jsxs)(`li`,{children:[(0,D.jsx)(`b`,{className:`mono`,children:e.host}),` `,e.summary||`nothing to fold`,e.failed.map(e=>(0,D.jsxs)(`div`,{className:`t-warn`,children:[`The fold would stop at `,e]},e))]},e.host))}):(0,D.jsx)(`p`,{className:`dim`,children:`No global install to fold.`}),t.orphans.length?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h3`,{children:`Orphans`}),(0,D.jsx)(`p`,{className:`dim`,children:`No manifest owns these. An earlier build may have written them, or they may be yours. Nothing moves them: if one is not yours, move it by hand.`}),(0,D.jsx)(`ul`,{className:`preview-list mono`,children:t.orphans.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}):null]}):(0,D.jsx)(p,{})]})}var L=(e,t)=>`${e} ${t}`,R=[`claude`,`bob`,`openclaude`],z={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},B=/[\\/]\.claude[\\/]worktrees[\\/]/,V=e=>e.scope===`project`&&B.test(e.path);function H(e,t){let n=e.drift?.stale??0,r={behind:`Behind ${t||`source`}`+(n?` · ${n} file${n===1?``:`s`}`:``),synced:`In sync`,unknown:`Not checked`}[e.verdict],i=e.diffable?u(e.drift):0;return i?`${r} · ${i} edited`:r}function U({inst:e,fleet:t,version:n,onEdits:r}){if(t===void 0)return(0,D.jsx)(`span`,{className:`dim`,children:`…`});if(!t)return(0,D.jsx)(`span`,{className:`dim`,children:`—`});let i=t.drift?.stale??0,a=t.diffable?u(t.drift):0;return(0,D.jsxs)(`div`,{className:`sync-cell`,children:[t.diffable&&i+a>0?(0,D.jsx)(x,{label:`Sync with source of ${m(e)}`,parts:[{key:`stale`,label:`behind source`,n:i,tone:`warn`},{key:`edited`,label:`local edits`,n:a,tone:`bad`}]}):null,(0,D.jsx)(`span`,{className:`dim`,children:H(t,n)}),t.diffable?null:(0,D.jsxs)(`span`,{className:`dim`,title:`Local edits are only checked for global installs`,children:[` `,`· not checkable`]}),a?(0,D.jsxs)(D.Fragment,{children:[` `,(0,D.jsx)(`a`,{href:`#/installs/edits`,onClick:t=>{t.preventDefault(),t.stopPropagation(),r(e)},children:`Local edits`})]}):null]})}function ne({rows:e,project:t,currentId:n,onPick:r,label:i,fleet:a,onEdits:o,onDefault:s,busyKey:c}){let l=e=>a===void 0?void 0:a?.installs?.find(t=>t.id===e.id)||null;return(0,D.jsx)(`div`,{className:`tbl-scroll`,children:(0,D.jsxs)(`table`,{className:`tbl hosts-tbl`,"aria-label":i,children:[(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`th`,{scope:`col`,children:t?`Project`:`Host`}),(0,D.jsx)(`th`,{scope:`col`,children:`State`}),(0,D.jsx)(`th`,{scope:`col`,children:`Sync with source`}),(0,D.jsx)(`th`,{scope:`col`,children:(0,D.jsx)(`span`,{className:`sr-only`,children:`Selected`})})]})}),(0,D.jsx)(`tbody`,{children:e.map(e=>{let[i,u]=z[e.state]||[`Not installed`,``],d=n===e.id,p=e.state===`absent`;return(0,D.jsxs)(`tr`,{className:`pickable${d?` on`:``}${p?` quiet`:``}`,onClick:()=>r(e.id),children:[(0,D.jsxs)(`td`,{children:[(0,D.jsx)(`button`,{type:`button`,className:`row-pick`,"aria-pressed":d,title:e.path,onClick:()=>r(e.id),children:m(e)}),(0,D.jsx)(`div`,{className:`mono path-cell`,title:e.path,children:t?f(e.host).label:e.path})]}),(0,D.jsxs)(`td`,{children:[(0,D.jsx)(`span`,{className:`tag ${u}`,children:i}),e.default?(0,D.jsxs)(D.Fragment,{children:[` `,(0,D.jsx)(`span`,{className:`tag`,title:`A page that names no install reads this one, and pickers start on it`,children:`Default`})]}):e.state===`active`&&s?(0,D.jsxs)(D.Fragment,{children:[` `,(0,D.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Make ${m(e)} the default install`,disabled:c===e.id,onClick:t=>{t.stopPropagation(),s(e)},children:`Make default`})]}):null,V(e)?(0,D.jsxs)(D.Fragment,{children:[` `,(0,D.jsx)(`span`,{className:`tag warn`,title:`Inside a .claude/worktrees folder: likely a finished worktree. Remove it from its panel.`,children:`Worktree leftover`})]}):null]}),(0,D.jsx)(`td`,{children:(0,D.jsx)(U,{inst:e,fleet:l(e),version:a?.version,onEdits:o})}),(0,D.jsx)(`td`,{className:`pick-mark`,children:d?`Editing ›`:``})]},e.id)})})]})})}function re({themes:e,current:t}){if(!e.length||!t)return null;let n=[...e].sort((e,n)=>e.name===t?-1:+(n.name===t));return(0,D.jsxs)(`details`,{className:`panel voice-ref`,children:[(0,D.jsxs)(`summary`,{children:[(0,D.jsx)(`span`,{className:`vr-title`,children:`Voices`}),(0,D.jsxs)(`span`,{className:`mono dim`,children:[e.length,` to choose from, set per install`]})]}),(0,D.jsx)(`div`,{className:`vr-list`,children:n.map(e=>(0,D.jsxs)(`div`,{className:`voice-row${e.name===t?` current`:``}`,children:[(0,D.jsx)(`span`,{className:`vr-name`,children:e.name}),(0,D.jsx)(`span`,{className:`vr-desc`,children:e.tagline?`“${e.tagline}”`:e.blurb})]},e.name))})]})}function ie({setup:e,overview:t}){if(!e)return null;let n=e.installed_fp&&e.installed_fp===e.source_fp;return(0,D.jsxs)(`section`,{className:`panel`,"aria-labelledby":`checkout-h`,children:[(0,D.jsxs)(`div`,{className:`panel-head`,children:[(0,D.jsx)(`h2`,{id:`checkout-h`,children:`This checkout`}),(0,D.jsx)(`span`,{className:`mono ${n?`t-good`:`t-warn`}`,children:n?`in sync`:e.version_verdict})]}),(0,D.jsxs)(`dl`,{className:`kv-grid`,children:[(0,D.jsx)(`dt`,{children:`Source`}),(0,D.jsx)(`dd`,{className:`mono`,children:e.root}),(0,D.jsx)(`dt`,{children:`Version`}),(0,D.jsx)(`dd`,{className:`mono`,children:t?.version||`unknown`}),(0,D.jsx)(`dt`,{children:`Fingerprint`}),(0,D.jsx)(`dd`,{className:`mono`,children:e.source_fp})]})]})}function ae({onAction:e,themes:t=[],currentTheme:n,overview:o,setup:c,dataRev:u,onMutated:d}){let v=_(),{data:y,error:b,reload:x}=s(()=>r.installs(),[u]),{data:C,error:w,reload:T}=s(()=>r.mcp(),[u]),{data:O,error:k}=s(()=>r.fleet(),[u]),A=k?null:O??void 0,[j,M]=(0,E.useState)(null),[N,P]=(0,E.useState)(``),[z,B]=(0,E.useState)({}),[V,H]=(0,E.useState)(!1),[U,ae]=(0,E.useState)(!1),[W,G]=(0,E.useState)({id:``,value:`keep`}),K=e=>W.id===e?.id?W.value:`keep`,[q,J]=(0,E.useState)(()=>a(`hosts`)),oe=(0,E.useMemo)(()=>{let e={};for(let t of C?.targets||[]){let n=L(t.host||`opencode`,t.root);(e[n]||(e[n]=[])).push(t)}return e},[C]);if(b||w)return(0,D.jsx)(i,{error:b||w,onRetry:()=>{x(),T()}});if(!y||!C)return(0,D.jsx)(p,{});let Y={active:0,disabled:1,absent:2},X=[...y.installs].sort((e,t)=>(e.scope===`global`?0:1)-(t.scope===`global`?0:1)||(Y[e.state]??3)-(Y[t.state]??3)),Z=X.find(e=>e.id===q)||X.find(e=>e.default)||X.find(e=>e.state===`active`)||X[0],Q=e=>{let t=z[e.id]||{};return{theme:t.theme||e.theme||n||`neutral`,footprint:t.footprint||e.state!==`absent`&&e.footprint||`lean`,posture:t.posture||e.posture||`peer`,mode:t.mode||e.mode||`direct`,trust:t.trust||e.trust||`balanced`,sharedTier:t.sharedTier??!!e.sharedTier}},se=(e,t,n)=>B(r=>({...r,[e.id]:{...r[e.id],[t]:n}})),ce=e=>{let t=Q(e);return t.theme===e.theme&&t.footprint===(e.footprint||`lean`)&&t.posture===(e.posture||`peer`)&&t.mode===(e.mode||`direct`)&&t.trust===(e.trust||`balanced`)&&(e.scope===`global`||t.sharedTier===!!e.sharedTier)},le={theme:t.map(e=>e.name),footprint:ee,posture:y.postures||[],mode:y.modes||[],trust:y.trusts||[]},ue=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o,sharedTier:s}=Q(t),c=f(t.host).label,l=`${r} footprint, ${i} posture, ${a} mode, ${o} loop trust`,u=t.state===`absent`?`Install Geneseed for ${c} into ${t.path} with the “${n}” voice (${l})? Files are added non-destructively (your own config is left untouched); deactivate or uninstall later.`:`Rebuild this ${c} install (voice “${n}”, ${l})? It rebuilds in place, non-destructive.`;await v(u,{title:t.state===`absent`?`Install Geneseed?`:`Rebuild this install?`,confirmLabel:t.state===`absent`?`Install`:`Rebuild`})&&e?.(`install`,{host:t.host,scope:t.scope,path:t.path,theme:n,footprint:r,posture:i,mode:a,trust:o,...t.scope===`global`?{}:{sharedTier:s}})},de=async t=>{let{theme:n,footprint:r,posture:i,mode:a,trust:o,sharedTier:s}=Q(t),c=t.leftovers?.kept||[],l=t.leftovers?.stale||[],u=e=>e.slice(0,8).join(`, `)+(e.length>8?`, and ${e.length-8} more`:``),d=(c.length?`Replace with Geneseed’s copy: ${u(c)}. Your version of each is overwritten. `:``)+(l.length?`Remove: ${u(l)}. `:``)+`Nothing else is touched.`;await v(d,{title:`Replace your files with Geneseed’s?`,confirmLabel:`Replace and rebuild`,tone:`danger`})&&e?.(`install`,{host:t.host,scope:t.scope,path:t.path,theme:n,footprint:r,posture:i,mode:a,trust:o,...t.scope===`global`?{}:{sharedTier:s},force:!0})},fe=async e=>{if(e.state!==`active`||await v(`Deactivate this install? Files are moved aside, not deleted; reactivate any time.`,{title:`Deactivate this install?`,confirmLabel:`Deactivate`})){P(e.id),M(null);try{let t=await r.installToggle(e.host,e.path,e.state===`active`?`deactivate`:`activate`);if(!t.ok){let e=Array.isArray(t.failed)?t.failed.join(`, `):``;M({text:t.error||e&&`unrestored: ${e}`||`action failed`,tone:`bad`});return}d?.()}catch(e){M({text:e.message,tone:`bad`})}finally{P(``)}}},$=async e=>{P(e.id),M(null);try{await r.setDefaultInstall(e.host,e.path),d?.()}catch(e){M({text:e.message,tone:`bad`})}finally{P(``)}},pe=(e,t)=>{let n=e.path.includes(`\\`)&&!e.path.includes(`/`)?`\\`:`/`,r=e.path.replace(/[\\/]+$/,``);return`${e.scope===`project`&&R.includes(e.host)?`${r}${n}.${e.host}`:r}${n}${t}`},me=async e=>{let t=K(e),n=e.scope===`project`?` and de-lists it`:`; the row stays, marked “not installed”`,i=t===`delete`?`, and permanently deletes ${pe(e,`memory`)} and ${pe(e,`notebook`)}`:t===`archive`?`; memory and notebook are archived aside`:`; memory and notebook stay in place`;if(await v(`Uninstall ${f(e.host).label} · ${e.scope}? It deletes ${g(e.host,e.scope)}${n}${i}. This can’t be undone.`,{title:e.scope===`project`?`Remove this install?`:`Remove the global install?`,confirmLabel:t===`delete`?`Remove and delete memory`:`Remove`,tone:`danger`})){P(e.id),M(null);try{let n=await r.installRemove(e.host,e.path,t);if(!n.ok){M({text:n.error||`remove failed`,tone:`bad`});return}G({id:``,value:`keep`}),n.kept?.length&&M({text:`Removed. Kept ${n.kept.length} file(s) you edited: ${n.kept.join(`, `)} — they are yours now (the CLI geneseed uninstall --force deletes edited files too).`,tone:`ok`}),d?.()}catch(e){M({text:e.message,tone:`bad`})}finally{P(``)}}},he=async e=>{M(null);try{let t=await r.mcpReveal(e.path);M({text:`Opening ${t.dir}. If no window appeared, open that folder by hand.`,tone:``})}catch(e){M({text:e.message,tone:`bad`})}},ge=async()=>{let t=X.filter(e=>e.state===`active`).map(e=>`${m(e)} · ${e.scope}`);await v(`Rebuild every active install: ${t.join(`, `)||`none`}? Each is rebuilt in place from source with its own settings; files you edited are kept.`,{title:`Rebuild all active installs?`,confirmLabel:`Rebuild all`})&&e(`build-all`)},_e=X.find(e=>e.default)?.host||X.find(e=>e.state===`active`)?.host||X[0]?.host||`opencode`,ve=X.filter(e=>e.scope===`global`),ye=X.filter(e=>e.scope!==`global`),be=e=>{J(e)},xe=e=>{l(`edits`,e.id),window.location.hash=`#/installs/edits`};return(0,D.jsxs)(`div`,{className:`hosts`,children:[(0,D.jsxs)(`div`,{className:`hosts-main`,children:[(0,D.jsxs)(`div`,{className:`toolbar`,children:[(0,D.jsxs)(`span`,{className:`dim`,children:[X.filter(e=>e.state!==`absent`).length,` installed.`]}),(0,D.jsxs)(`div`,{className:`row gap-8`,children:[(0,D.jsx)(`button`,{type:`button`,className:`btn ghost`,"aria-expanded":U,onClick:()=>ae(e=>!e),children:`Preview next rebuild`}),e?(0,D.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:ge,children:[(0,D.jsx)(h,{name:`refresh`}),` Rebuild all`]}):null]})]}),U?(0,D.jsx)(I,{dataRev:u}):null,j?.tone===`bad`?(0,D.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:j.text}):j?(0,D.jsx)(`p`,{className:`tag ${j.tone===`ok`?`ok `:``}note`,role:`status`,children:j.text}):null,(0,D.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-global`,children:[(0,D.jsx)(`div`,{className:`inst-head`,children:(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{id:`inst-global`,children:`Global installs`}),(0,D.jsx)(`p`,{className:`dim`,children:`One per tool. Loaded in every folder, except excluded ones.`})]})}),(0,D.jsx)(ne,{rows:ve,currentId:Z?.id,onPick:be,label:`Global installs`,fleet:A,onEdits:xe,onDefault:e?$:void 0,busyKey:N})]}),(0,D.jsxs)(`section`,{className:`panel flush`,"aria-labelledby":`inst-project`,children:[(0,D.jsxs)(`div`,{className:`inst-head`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{id:`inst-project`,children:`Per-project installs`}),(0,D.jsx)(`p`,{className:`dim`,children:`A repo with its own install. Inside it, only that install loads.`})]}),e?(0,D.jsxs)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>H(e=>!e),children:[(0,D.jsx)(h,{name:`folder`}),` Deploy to a repo…`]}):null]}),V?(0,D.jsx)(`div`,{className:`inst-deploy`,children:(0,D.jsx)(te,{host:_e,theme:n||`neutral`,options:le,onAction:e,onClose:()=>H(!1),onNote:e=>M(e?{text:e,tone:`bad`}:null)})}):null,ye.length?(0,D.jsx)(ne,{rows:ye,project:!0,currentId:Z?.id,onPick:be,label:`Per-project installs`,fleet:A,onEdits:xe,onDefault:e?$:void 0,busyKey:N}):(0,D.jsx)(S,{children:`No repo has its own install yet. Deploy one to give a project its own rules and voice.`})]}),(0,D.jsx)(ie,{setup:c,overview:o}),(0,D.jsx)(re,{themes:t,current:o?.theme})]}),Z?(0,D.jsx)(F,{inst:Z,targets:oe[L(Z.host,Z.path)]||[],choice:Q(Z),unchanged:ce(Z),options:le,onPick:(e,t)=>se(Z,e,t),canAct:!!e,busy:N===Z.id,memory:K(Z),onMemory:e=>G({id:Z.id,value:e}),onApply:()=>ue(Z),onToggleInstall:()=>fe(Z),onRemove:()=>me(Z),onRevealMcp:he,onForce:()=>de(Z)},Z.id):null]})}function W(e){return e.startsWith(`@@`)||e.startsWith(`+++`)||e.startsWith(`---`)?`hunk`:e.startsWith(`+`)?`add`:e.startsWith(`-`)?`del`:`ctx`}var G=300;function K(e){let t=o(e.dataRev),[n,r]=y(`edits`,t);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,D.jsx)(p,{}):(0,D.jsx)(q,{install:n,...e},n?.id||``)]})}function q({install:e,onMutated:t,onAction:n,dataRev:a,overview:o}){let c=_(),{data:l,error:u,reload:d}=s(()=>r.diff(v(e)),[a]),[f,m]=(0,E.useState)(!1),[g,y]=(0,E.useState)(``),[b,x]=(0,E.useState)(()=>new Set),[C,w]=(0,E.useState)(()=>new Set),[T,ee]=(0,E.useState)(null);if(l&&l!==T){ee(l),x(new Set);let e=l.files.reduce((e,t)=>e+t.diff.length,0);w(new Set(e<=G?l.files.map(e=>e.rel):[]))}let te=e=>x(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),O=()=>x(e=>e.size===j.length?new Set:new Set(j.map(e=>e.rel))),k=()=>n?.(`export`),A=async()=>{let n=[...b],i=n.filter(e=>l.files.find(t=>t.rel===e)?.status===`added`),a=i.length?`Restoring will DELETE ${i.length} deployed-only file(s):\n${i.join(`
2
- `)}\n\n`:``;if(await c(`${a}Discard local edits and restore ${n.length} file(s) from source?`,{title:`Restore from source?`,confirmLabel:`Restore`,tone:`danger`})){m(!0);try{let i=await r.restore(n,v(e)),a=i.errors.length?` · ${i.errors.length} error(s): ${i.errors.join(`; `)}`:``;y(`Restored ${i.restored.length}, archived ${i.deleted.length}${a}`),await d(),t?.()}catch(e){y(e.message)}finally{m(!1)}}};if(u)return(0,D.jsx)(i,{error:u,onRetry:d});if(!l)return(0,D.jsx)(p,{});if(!l.deployed)return(0,D.jsx)(S,{title:`Nothing installed here`,children:`Nothing to compare.`});if(!l.diffable)return(0,D.jsx)(S,{title:`No local-edit check for this install`,docs:{href:`#/installs/hosts`,label:`See every install in Hosts`},children:`Local edits are only checked for global installs. Pick a global install above.`});let j=l.files.filter(e=>e.status!==`linked`&&e.status!==`stale`),M=l.files.filter(e=>e.status===`linked`),N=l.files.filter(e=>e.status===`stale`),P=j.filter(e=>e.status===`edited`).length,F=j.filter(e=>e.status===`added`).length,I=j.filter(e=>e.status===`missing`).length,L=e=>w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`h`,children:`Local edits`}),l.target?(0,D.jsxs)(`p`,{className:`sub`,children:[`Comparing `,(0,D.jsx)(`code`,{children:l.target}),l.theme?` (${l.theme} voice)`:``,` with source`,` `,o?.version||`unknown`,`.`]}):null,P>0?(0,D.jsx)(`p`,{className:`sub`,children:`The agent refines its own deployed files in place. A rebuild keeps an edited file, which then stops receiving source updates — export it, then Restore to take the new source.`}):F+I>0?(0,D.jsx)(`p`,{className:`sub`,children:`These files differ from the source: added in the install, or missing from it.`}):null]}),(0,D.jsxs)(`div`,{className:`row gap-10`,children:[(0,D.jsxs)(`button`,{className:`btn ghost danger-line`,disabled:f||b.size===0,onClick:A,children:[`Restore`,b.size?` (${b.size})`:``]}),(0,D.jsxs)(`button`,{className:`btn`,disabled:f,onClick:k,children:[(0,D.jsx)(h,{name:`download`}),`Export improvements`]})]})]}),g?(0,D.jsx)(`p`,{className:`sub mb-14`,children:g}):null,M.length?(0,D.jsxs)(`p`,{className:`sub dim mb-14`,title:M.map(e=>e.rel).join(`
3
- `),children:[M.length,` linked — yours, left alone`]}):null,j.length===0&&N.length===0?(0,D.jsx)(S,{title:`In sync`,children:`This install matches its source.`}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`row between mb-14`,children:[(0,D.jsxs)(`div`,{className:`row gap-10`,children:[(0,D.jsxs)(`span`,{className:`badge warn`,children:[(0,D.jsx)(`span`,{className:`dot`}),P,` edited`]}),(0,D.jsxs)(`span`,{className:`badge`,children:[(0,D.jsx)(`span`,{className:`dot`}),F,` added`]}),I>0&&(0,D.jsxs)(`span`,{className:`badge bad`,children:[(0,D.jsx)(`span`,{className:`dot`}),I,` missing`]}),N.length>0&&(0,D.jsxs)(`span`,{className:`badge`,children:[(0,D.jsx)(`span`,{className:`dot`}),N.length,` behind`]})]}),(0,D.jsxs)(`div`,{className:`row gap-10`,children:[(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>w(new Set(l.files.map(e=>e.rel))),children:`Expand all`}),(0,D.jsx)(`button`,{className:`btn ghost sm`,onClick:()=>w(new Set),children:`Collapse all`}),j.length?(0,D.jsxs)(`label`,{className:`row gap-8 dim sel-all`,children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:b.size===j.length,onChange:O}),`Select all`]}):null]})]}),(0,D.jsx)(`div`,{className:`stack gap-12`,children:j.map(e=>R(e,!0))}),N.length?(0,D.jsxs)(`div`,{className:`stack gap-12 diff-behind`,children:[(0,D.jsx)(`h3`,{children:`Behind source`}),(0,D.jsxs)(`div`,{className:`row between`,children:[(0,D.jsx)(`p`,{className:`sub`,children:`This install is built from older source. Rebuild to bring these files in sync.`}),(0,D.jsx)(`button`,{className:`btn ghost`,disabled:f,onClick:()=>n?.(`build-all`),"aria-label":`Rebuild all installs`,children:`Rebuild`})]}),N.map(e=>R(e,!1))]}):null]})]});function R(e,t){let n=C.has(e.rel),r=e.status===`stale`||e.status===`added`?``:e.status===`missing`?`bad`:`warn`;return(0,D.jsxs)(`div`,{className:`card diff-file${n?` open`:``}`,children:[(0,D.jsxs)(`div`,{className:`diff-head`,children:[t?(0,D.jsx)(`input`,{type:`checkbox`,className:`chk`,checked:b.has(e.rel),onChange:()=>te(e.rel),onClick:e=>e.stopPropagation(),"aria-label":`Select ${e.rel}`}):null,(0,D.jsx)(`span`,{className:`fname`,children:e.rel}),(0,D.jsxs)(`span`,{className:`badge ${r}`,children:[(0,D.jsx)(`span`,{className:`dot`}),e.status===`stale`?`behind source`:e.status]}),(0,D.jsxs)(`span`,{className:`dim mono diff-lines`,children:[e.diff.length,` lines`]}),(0,D.jsx)(`button`,{className:`iconbtn`,onClick:()=>L(e.rel),"aria-label":n?`Collapse ${e.rel}`:`Expand ${e.rel}`,"aria-expanded":n,children:(0,D.jsx)(h,{name:`chevron`})})]}),n&&(0,D.jsx)(`div`,{className:`diff-body`,children:e.diff.map((e,t)=>(0,D.jsx)(`div`,{className:`diff-line ${W(e)}`,children:e},t))})]},e.rel)}}function J({group:e,i:t}){let n=e.problems.length===0,[r,i]=(0,E.useState)(!n);return(0,D.jsxs)(`div`,{className:`card check rise ${n?``:`bad`} ${r?`open`:``}`,style:{"--i":t*.6},children:[(0,D.jsxs)(`button`,{className:`check-head`,onClick:()=>i(e=>!e),disabled:n,"aria-expanded":n?void 0:r,children:[(0,D.jsx)(`span`,{className:`feed-dot ${n?`ok`:`bad`}`}),(0,D.jsx)(`h3`,{children:e.label}),(0,D.jsxs)(`span`,{className:`badge ${n?`ok`:`bad`}`,children:[(0,D.jsx)(`span`,{className:`dot`}),n?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`]}),!n&&(0,D.jsx)(h,{name:`chevron`,className:`chev glyph`})]}),!n&&r&&(0,D.jsx)(`div`,{className:`check-body`,children:e.problems.map(e=>(0,D.jsxs)(`div`,{className:`problem`,children:[(0,D.jsx)(`span`,{className:`x`,children:`✕`}),(0,D.jsx)(`span`,{children:e})]},e))})]})}function oe({dataRev:e}){let t=o(e),[n,r]=y(`doctor`,t);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{className:`page-pick`,installs:t,value:n,onChange:r}),t===null?(0,D.jsx)(p,{}):(0,D.jsx)(Y,{install:n,dataRev:e},n?.id||``)]})}function Y({install:e,dataRev:t}){let n=(0,E.useRef)(!1),{data:a,error:o,reload:c,setData:l}=s(()=>{let t=n.current;return n.current=!1,r.doctor(t,v(e))},[t]),u=()=>{n.current=!0,l(null),c()};if(o)return(0,D.jsx)(i,{error:o,onRetry:c});let d=a?a.groups.filter(e=>e.problems.length):[],f=a?a.groups.filter(e=>!e.problems.length):[];return(0,D.jsxs)(`div`,{className:`page-fill`,children:[(0,D.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`h`,children:`Doctor`}),(0,D.jsx)(`p`,{className:`sub`,children:`Builds this install’s voice in a sandbox and validates the result: token resolution, link integrity, parity, and local edits.`})]}),(0,D.jsxs)(`button`,{className:`btn`,onClick:u,disabled:!a,children:[(0,D.jsx)(h,{name:`refresh`}),a?`Run doctor`:`Running…`]})]}),a?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`card pad-md mb-16 doc-summary`,children:(0,D.jsxs)(`div`,{className:`row wrap between gap-12`,children:[(0,D.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,D.jsxs)(`span`,{className:`dim mono`,children:[`validated `,a.themes.length,` voice`,a.themes.length===1?``:`s`]}),a.checked_at?(0,D.jsxs)(`span`,{className:`dim mono`,title:a.checked_at,children:[`checked `,a.checked_at.slice(11)]}):null,a.themes.map(e=>(0,D.jsx)(`span`,{className:`badge cap`,children:e},e))]}),a.ok?(0,D.jsxs)(`span`,{className:`badge ok`,children:[(0,D.jsx)(`span`,{className:`dot`}),`all clean`]}):(0,D.jsxs)(`span`,{className:`badge bad`,children:[(0,D.jsx)(`span`,{className:`dot`}),a.problems.length,` problem`,a.problems.length===1?``:`s`]})]})}),(0,D.jsxs)(`div`,{className:`stack gap-12`,children:[d.map((e,t)=>(0,D.jsx)(J,{group:e,i:t},e.label)),f.length?(0,D.jsxs)(`details`,{className:`check-fold`,children:[(0,D.jsxs)(`summary`,{children:[f.length,` clean check`,f.length===1?``:`s`]}),(0,D.jsx)(`div`,{className:`stack gap-12`,children:f.map((e,t)=>(0,D.jsx)(J,{group:e,i:d.length+t},e.label))})]}):null]})]}):(0,D.jsx)(p,{label:`Running every check (builds this install’s voice in a sandbox)…`})]})}function X({tab:e=`hosts`,overview:t,setup:n,themes:r,onAction:i,onMutated:a,dataRev:o}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(c,{title:`Installs`,sub:`Where the harness lives on this machine, and how each copy is built.`}),(0,D.jsx)(C,{page:`installs`,current:e,label:`Installs`}),e===`hosts`&&(0,D.jsx)(ae,{onAction:i,themes:r,currentTheme:t?.theme,overview:t,setup:n,dataRev:o,onMutated:a}),e===`edits`&&(0,D.jsx)(K,{onMutated:a,onAction:i,dataRev:o,overview:t}),e===`doctor`&&(0,D.jsx)(oe,{dataRev:o})]})}export{X as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{A as i,B as a,C as o,E as s,F as c,H as l,K as u,M as d,N as f,O as p,P as m,U as h,_ as g,a as _,d as ee,f as v,g as y,h as b,i as x,j as S,l as C,n as w,p as T,r as E,u as D,v as O,w as k,x as A}from"./motion-RlUl1osO.js";import{n as j}from"./sections-CtFz7HFH.js";import{At as M,Et as N,Ot as P,S as F,St as I,bt as L,kt as R,xt as z}from"./index-How7SzDZ.js";import{n as B}from"./Dashboard-DBOEi9lQ.js";function V(e){return k((e.iterationDuration+e._loopDelay)*e.iterationCount-e._loopDelay)||1e-11}function H(e,t,n,r,a,c){let l=i(e.duration)&&e.duration<=1e-11?n-h:n;t.composition&&O(t,l,1,1,u.AUTO);let d=r?new D(r,e,t,l,!1,a,c):new b(e,t,l);return t.composition&&d.init(!0),o(t,d),s(t,e=>{let n=e._offset+e._delay+e.duration;n>t.iterationDuration&&(t.iterationDuration=n)}),t.duration=V(t),t}var U=0,W=class extends b{constructor(e={}){super(e,null,0),++U,this.id=f(e.id)?U:e.id,this.duration=0,this.labels={};let t=e.defaults,n=a.defaults;this.defaults=t?m(t,n):n,this.composition=A(e.composition,!0),this.onRender=e.onRender||n.onRender;let r=A(e.playbackEase,n.playbackEase);this._ease=r?v(r):null,this.iterationDuration=0}add(e,t,n){let r=S(t),i=S(e);if(r||i){if(this._hasChildren=!0,r){let r=t,i=a.editor&&a.editor.addTimelineChild,o=n&&n.type===`Stagger`&&a.editor,s=p(n)?n:null;if(s||o){let t=T(e),o=this.duration,c=this.iterationDuration,l=r.id,u=0,d=t.length,p=i?i(e,r,this.id,n,d):null,m=s||a.editor.resolveStagger(n.defaultValue);t.forEach(e=>{let n={...p||r};this.duration=o,this.iterationDuration=c,f(l)||(n.id=l+`-`+u);let i=M(this,m(e,u,t,null,this));H(n,this,i,e,u,t),u++})}else{let t=i?i(e,r,this.id,n):r,a=n&&n.type?n.defaultValue:n;H(t,this,M(this,a),e)}}else H(e,this,M(this,t));return this.composition&&this.init(!0),this}}sync(e,t){if(f(e)||e&&f(e.pause))return this;e.pause();let n=+(e.effect?e.effect.getTiming().duration:e.duration);!f(e)&&!f(e.persist)&&(e.persist=!0);let r=a.editor,i=r&&r.addTimelineChild;r&&r.addTimelineSync&&(t=r.addTimelineSync(e,t,this.id),r.addTimelineChild=null);let o=this.add(e,{currentTime:[0,n],duration:n,delay:0,ease:`linear`,playbackEase:`linear`},t);return r&&(r.addTimelineChild=i),o}set(e,t,n){return f(t)?this:(t.duration=h,t.composition=l.replace,this.add(e,t,n))}call(e,t){return f(e)||e&&!p(e)?this:(a.editor&&a.editor.addTimelineCall&&(t=a.editor.addTimelineCall(e,t,this.id)),this.add({duration:0,delay:0,onComplete:()=>e(this)},t))}label(e,t){return f(e)||e&&!d(e)||(a.editor&&a.editor.addTimelineLabel&&(t=a.editor.addTimelineLabel(e,t,this.id)),this.labels[e]=M(this,t)),this}remove(e,t){return y(T(e),this,t),this}stretch(e){let t=this.duration;if(t===c(e))return this;let n=e/t,r=this.labels;s(this,e=>e.stretch(e.duration*n));for(let e in r)r[e]*=n;return super.stretch(e)}refresh(){return s(this,e=>{e.refresh&&e.refresh()}),this}revert(){return super.revert(),s(this,e=>e.revert,!0),g(this)}then(e){return super.then(e)}},G=e=>a.editor?a.editor.addTimeline(e):new W(e).init(),K=e(t(),1),q=n(),J=.62,te=(e,t)=>String(e).length*t*J;function Y(e,t){let n=0;for(let t of e){if(t.t===``||t.t==null)continue;let e=te(t.t,t.size)/2;n=Math.max(n,Math.hypot(e,t.dy-t.size*.75),Math.hypot(e,t.dy+t.size*.25))}return Math.ceil(n+t)}function X(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=r/a,s=i/a,c=e.x+o*e.r,l=e.y+s*e.r,u=t.x-o*t.r,d=t.y-s*t.r,f=n*a,p=e=>e.toFixed(1);return`M${p(c)} ${p(l)} C${p(c+o*a*.3-s*f)} ${p(l+s*a*.3+o*f)} ${p(u-o*a*.3-s*f)} ${p(d-s*a*.3+o*f)} ${p(u)} ${p(d)}`}var Z=!1,Q=!1,ne=w[8]+w[7];function $({hash:e,label:t,part:n,children:r}){return(0,q.jsx)(`g`,{className:`cm-node`,"data-cm":n,role:`button`,tabIndex:0,"aria-label":t,onClick:()=>N(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),N(e))},children:r})}function re({overview:e,dataRev:t}){let{data:n}=I(()=>r.catalog(`laws`),[t],`catalog:laws`),i=n?.items??null,a=n?.nouns?.ontology||`Ethos`,o=n?.nouns?.laws||`Dictates`,s=n?.nouns?.doctrines||`Doctrines`,c=(0,K.useRef)(null),l=(0,K.useRef)(!0),u=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=c.current;if(!e||Z||!x())return;Z=!0;let t=t=>[...e.querySelectorAll(t)],n=t(`[data-cm="hub"]`),r=t(`[data-cm="sat"]`),i=t(`[data-cm="gov"]`),a=t(`.cm-edge-gov`),o=t(`.cm-note, .cm-govern-label`),s=P(t(`.cm-edge`));C([...n,...r,...i],{opacity:0,scale:.7}),C([...a,...o],{opacity:0}),C(s,{draw:`0 0`});let d=G({autoplay:!1,defaults:{ease:E}}).add(n,{opacity:1,scale:1,duration:w[7]},0).add(s,{draw:`0 1`,duration:w[7],delay:R(w[1])},w[3]).add(r,{opacity:1,scale:1,duration:w[7],delay:R(w[1])},w[5]).add(a,{opacity:1,duration:w[6],delay:R(w[1])},w[7]).add(i,{opacity:1,scale:1,duration:w[7],delay:R(w[1])},w[8]).add(o,{opacity:1,duration:w[6]},w[8]);l.current=!1;let f=()=>d.complete(),p=()=>{d.play(),f=_(d,ne),l.current=!0,u.current?.()};if(typeof IntersectionObserver>`u`)return p(),()=>f();let m=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(m.disconnect(),p())},{threshold:.33});return m.observe(e),()=>{m.disconnect(),l.current=!0,f()}},[]);let d=e?.counts||{},f=z(d),p=[];for(let e of(i||[]).filter(e=>e.tier===`doctrine`)){let t=p.find(t=>t.id===e.pack);t||p.push(t={id:e.pack,n:0}),t.n+=1}let m=e?.footprint===`lean`?`lean — first line only`:`full text inlined`,h={x:330,y:165,r:Y([{t:`Constitution`,size:17,dy:-12},{t:`${f} rules`,size:10,dy:8},{t:m,size:8.5,dy:24}],12)},g={x:126,y:95,r:Y([{t:a,size:12.5,dy:-7},{t:`${d.ontology??0} sections`,size:10,dy:10}],11)},v={x:560,y:78,r:Y([{t:o,size:12.5,dy:-6},{t:`${d.laws??0}`,size:13,dy:12}],11)},y={x:560,y:252,r:Y([{t:s,size:12.5,dy:-6},{t:`${d.doctrines?.rules??0}`,size:13,dy:12}],11)},b=(e,t,n,r)=>({x:e,y:t,label:n,count:r,r:Y([{t:n,size:10.5,dy:-2},{t:`${r}`,size:9,dy:10}],9)}),S=[{...b(812,52,`Skills`,d.skills??0),hash:`#/skills`,from:v},{...b(820,126,`Agents`,d.agents??0),hash:`#/agents`,from:v},{...b(816,232,`Memory`,d.memory??0),hash:`#/personal/memory`,from:y},{...b(812,300,`Wiki`,d.wiki??0),hash:`#/section/wiki`,from:y}],T={rx:122,ry:68,from:212,to:112},D=p.map((e,t)=>{let n=(p.length===1?(T.from+T.to)/2:T.from+(T.to-T.from)*t/(p.length-1))*Math.PI/180;return{...e,x:y.x+T.rx*Math.cos(n),y:y.y+T.ry*Math.sin(n),r:Y([{t:e.id,size:7.5,dy:-2},{t:`${e.on}`,size:7.5,dy:8}],4)}}),O=D.length;return(0,K.useLayoutEffect)(()=>{let e=c.current;if(!e||!O||Q||!x())return;Q=!0;let t=[...e.querySelectorAll(`.cm-mini > g`)];C(t,{opacity:0,scale:.5});let n=()=>C(t,{opacity:1,scale:1}),r=()=>{u.current=null;let e=ee(t,{opacity:1,scale:1,duration:w[7],delay:R(w[1],{start:w[7]}),ease:E});n=_(e,w[7]+w[1]*O+w[7])};return l.current?r():u.current=r,()=>{u.current=null,n()}},[O]),(0,q.jsxs)(`svg`,{ref:c,className:`cmap`,viewBox:`0 0 940 350`,role:`group`,"aria-label":`The constitution map`,children:[(0,q.jsx)(`path`,{d:X(h,g,.05),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(h,v,-.07),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(h,y,.07),className:`cm-edge`}),S.map(e=>(0,q.jsx)(`path`,{d:X(e.from,e,.03),className:`cm-edge-gov`},`e-${e.label}`)),(0,q.jsxs)($,{hash:`#/laws`,part:`hub`,label:`Constitution: ${f} rules`,children:[(0,q.jsx)(`circle`,{cx:h.x,cy:h.y,r:h.r,className:`cm-hub-disc`}),(0,q.jsx)(`text`,{x:h.x,y:h.y-12,textAnchor:`middle`,className:`cm-hub-name`,children:`Constitution`}),(0,q.jsxs)(`text`,{x:h.x,y:h.y+8,textAnchor:`middle`,className:`cm-hub-num`,children:[f,` rules`]}),(0,q.jsx)(`text`,{x:h.x,y:h.y+24,textAnchor:`middle`,className:`cm-note`,children:m})]}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${a}: ${d.ontology??0} sections`,children:[(0,q.jsx)(`circle`,{cx:g.x,cy:g.y,r:g.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:g.x,y:g.y-7,textAnchor:`middle`,className:`cm-sat-name`,children:a}),(0,q.jsxs)(`text`,{x:g.x,y:g.y+10,textAnchor:`middle`,className:`cm-sat-num`,children:[d.ontology??0,` sections`]})]}),(0,q.jsx)(`text`,{x:g.x,y:g.y+g.r+16,textAnchor:`middle`,className:`cm-note`,children:`how it thinks, not a rule`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${o}: ${d.laws??0}, never broken`,children:[(0,q.jsx)(`circle`,{cx:v.x,cy:v.y,r:v.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:v.x,y:v.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:o}),(0,q.jsx)(`text`,{x:v.x,y:v.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:d.laws??0})]}),(0,q.jsx)(`text`,{x:v.x,y:v.y+v.r+16,textAnchor:`middle`,className:`cm-note`,children:`never broken`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${s}: ${d.doctrines?.rules??0} rules`,children:[(0,q.jsx)(`circle`,{cx:y.x,cy:y.y,r:y.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:y.x,y:y.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:s}),(0,q.jsx)(`text`,{x:y.x,y:y.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:d.doctrines?.rules??0})]}),(0,q.jsx)(`text`,{x:y.x+22,y:y.y+y.r+20,className:`cm-note`,children:d.doctrines?`${d.doctrines.active}/${d.doctrines.total} packs built in`:`packs chosen at build`}),(0,q.jsx)(`g`,{className:`cm-mini`,children:D.map(e=>(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-pack-disc`,style:{stroke:F(e.id)}}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-pack-id`,children:e.id}),(0,q.jsx)(`text`,{x:e.x,y:e.y+8,textAnchor:`middle`,style:{fill:F(e.id)},children:e.n})]},e.id))}),(0,q.jsx)(`text`,{x:866,y:16,textAnchor:`middle`,className:`cm-govern-label`,children:`GOVERNS THE HARNESS`}),S.map(e=>(0,q.jsxs)($,{hash:e.hash,part:`gov`,label:`${e.label}: ${e.count}`,children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-gov-disc`}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-gov-name`,children:e.label}),(0,q.jsx)(`text`,{x:e.x,y:e.y+10,textAnchor:`middle`,className:`cm-gov-num`,children:e.count})]},e.label)),(0,q.jsx)(`text`,{x:g.x,y:228,textAnchor:`middle`,className:`cm-note`,children:`tap any node to open its ledger`})]})}function ie({counts:e}){let t=[{label:j.skills.label,n:e.skills??0,hash:`#/skills`},{label:`Rules`,n:z(e),hash:`#/laws`},{label:j.agents.label,n:e.agents??0,hash:`#/agents`},{label:j.memory.label,n:e.memory??0,hash:`#/personal/memory`},{label:j.notebook.label,n:e.notebook??0,hash:`#/personal/notebook`},{label:j.wiki.label,n:e.wiki??0,hash:`#/section/wiki`},{label:j.config.label,n:e.config??0,hash:`#/section/config`}],n=Math.max(...t.map(e=>e.n),1);return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Growth rings`}),(0,q.jsx)(`span`,{className:`tick right`,children:`by section`})]}),t.map(e=>(0,q.jsxs)(`button`,{className:`jr-ring`,onClick:()=>N(e.hash),children:[(0,q.jsx)(`span`,{className:`jr-ring-label`,children:e.label}),(0,q.jsx)(`span`,{className:`jr-ring-track`,children:(0,q.jsx)(`span`,{className:`jr-ring-fill`,style:{width:`${e.n/n*100}%`}})}),(0,q.jsx)(`span`,{className:`jr-ring-num`,children:e.n})]},e.label))]})}function ae({recent:e,buildEpoch:t}){let n=e?.items||[],r=e?.skipped||[];return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Freshly grown`}),(0,q.jsx)(`span`,{className:`tick right`,children:`newest`})]}),e?n.length===0?(0,q.jsx)(`p`,{className:`sub`,children:`Nothing here carries a date yet.`}):n.slice(0,5).map(e=>(0,q.jsxs)(`button`,{className:`jr-fresh`,onClick:()=>N(`#/item/${e.type}/${encodeURIComponent(e.name)}`),children:[(0,q.jsx)(`span`,{className:`jr-fresh-kind`,children:e.section}),(0,q.jsx)(`span`,{className:`jr-fresh-name`,children:e.title}),(0,q.jsx)(`span`,{className:`jr-fresh-when`,children:L(e.mtime)})]},`${e.section}:${e.name}`)):(0,q.jsx)(`p`,{className:`sub`,children:`Reading the shelves…`}),r.length>0&&(0,q.jsxs)(`p`,{className:`sub jr-skipped`,children:[`Not dated: `,r.join(`, `),` — too many files to stat on every load.`]}),(0,q.jsxs)(`p`,{className:`jr-care`,children:[t?`Last built ✓ ${L(t)}`:`Never built here`,` ·`,` `,(0,q.jsx)(`button`,{className:`jr-go`,onClick:()=>N(`#/activity`),children:`log →`})]})]})}function oe({overview:e,recent:t,lens:n,dataRev:r}){let i=e?.counts||{};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`jr-head`,children:(0,q.jsx)(B,{verdict:n?.verdict})}),(0,q.jsxs)(`div`,{className:`jr-row2`,children:[(0,q.jsx)(ie,{counts:i}),(0,q.jsx)(ae,{recent:t,buildEpoch:e?.build_epoch})]}),(0,q.jsxs)(`div`,{className:`card pad-lg jr-map`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`The Constitution — and the harness it governs`}),(0,q.jsx)(`button`,{className:`jr-go right`,onClick:()=>N(`#/laws`),children:`open →`})]}),(0,q.jsx)(re,{overview:e,dataRev:r})]})]})}export{oe as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,R as a,St as o,V as s,X as c,Z as l,et as u,it as d,pt as f}from"./index-How7SzDZ.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{t as h}from"./DataTable-b9zTShqJ.js";import{r as g}from"./controls-D4wmg_pl.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=d(),r=l(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===c(v(e))?t:null},{prune:a}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,c(v(e))]));a(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,a]);let o=e=>i(e)?.value??new Set(v(e)),s=(e,t)=>{let n=new Set(o(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,c(v(e)))},u=e=>{let t=o(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:o,toggle:s,change:u,apply:async e=>{let i=[...o(e)],a=`Rebuild ${f(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${f(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=f(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(g,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(p,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=f;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let o=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...F(n,t,e.name)})),u=l.filter(t=>v(t.row).includes(e.name)).length,d=l.filter(e=>e.staged).length,f=A(u,t.length),p=`on in ${u} of ${N(t.length,`install`)}${d?` · ${d} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${d?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(o.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(a,{value:s.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(a,{value:c.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,x.jsx)(j,{type:`skill`,names:s,listed:r?.skills,offNote:f}):null,c.length?(0,x.jsx)(j,{type:`agent`,names:c,listed:r?.agents,offNote:f}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[o.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,o.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(g,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(h,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:a,error:c}=o(()=>r.kits(),[n]),l=b(a,t),{data:d}=o(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=a?.kits||[],p=a?.installs||[],h=c||a?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(s,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(i,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:p,stage:l,listed:d})}):(0,x.jsxs)(m,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(u,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(s,{eyebrow:a?`${N(f.length,`kit`)} · ${N(p.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(i,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?f.length===0?h?null:(0,x.jsx)(m,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:p,stage:l,listed:d,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:p,stage:l}),p.length?(0,x.jsx)(R,{installs:p,stage:l}):null]}):h?null:(0,x.jsx)(u,{})]})}export{z as default};
@@ -1,4 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,Et as a,J as o,R as s,St as c,U as l,V as u,X as d,Z as f,_ as p,c as m,d as h,et as g,f as _,g as v,h as y,it as b,l as ee,lt as x,m as S,mt as te,nt as C,p as ne,pt as w,q as T,s as re,tt as E,u as D,ut as O,v as k,y as ie}from"./index-How7SzDZ.js";import{t as ae}from"./Markdown-0ORz7tAc.js";import{t as oe}from"./EmptyState-CY5Pm2xy.js";import{t as se}from"./FilterInput-qGKNSlxv.js";var A=e(t(),1);function ce({items:e,packs:t,install:n,canApply:r,onAction:i,gateArmed:a}){let o=b(),s=e.filter(e=>e.tier===`doctrine`&&e.active!==!1).map(e=>e.name),c=s.join(`,`),l=f(),u=n?`${n.host}:${n.scope}:${n.path}`:``,p=d(s),{prune:m}=l,h=e.length>0;(0,A.useEffect)(()=>{h&&m(`rules`,(e,t)=>e===u&&t.base!==p)},[h,u,p,m]);let g=l.get(`rules`,u),_=g&&g.base===p?g.value:s,v=e=>l.put(`rules`,u,e(_),p),y=e=>_.includes(e),ee=e=>v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),x=e=>e.rules.some(e=>y(e.addr)),S=e=>{let t=e.rules.map(e=>e.addr),n=e.rules.every(e=>y(e.addr));v(e=>n?e.filter(e=>!t.includes(e)):[...new Set([...e,...t])])},te=e=>{let t=e.rules.filter(e=>y(e.addr)).length;return t?e.active?`${t} of ${e.rules.length} active`:`staged on · ${t} of ${e.rules.length}`:e.active?`staged off`:`not built in`},C=t.flatMap(e=>e.rules.map(e=>e.addr)),T=C.filter(y),E=T.join(`,`)!==c,O=`process.5`,k=s.includes(O)&&!_.includes(O);return{deployedRules:s,isOn:y,toggleRule:ee,packOn:x,togglePack:S,packState:te,allRules:C,pickedRules:T,dirty:E,losingConsent:k,applyPacks:async()=>{if(!r||!E)return;let e=t.filter(e=>e.rules.some(e=>y(e.addr))).map(e=>e.pack),c=t.filter(t=>e.includes(t.pack)).flatMap(e=>e.rules.filter(e=>!y(e.addr)).map(e=>e.addr)),d=k?`
2
-
3
- process 5 carries commit/push consent. Dropping it also removes the git-gate hook, so commits and pushes stop being confirmed at the tool boundary (Bob still logs its warning). `+(a?`(Real data loss stays gated: that is Rule IV’s, not the pack’s.)`:`(Rule IV’s deletion gate is off on this install, so real data loss is not asked about either.)`):``,f={},p=[],m=[];for(let[e,{key:r,label:i}]of Object.entries(D)){if(!e.includes(`.`))continue;let a=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e,o=s.includes(e),c=n?.[r]!==!1;o&&!y(e)&&c&&(f[r]=!1,m.push(`Excluding ${a} also switches the ${i.toLowerCase()} off: its text goes, and its hook stops asking.`)),!o&&y(e)&&!c&&(p.push({key:r,label:i}),m.push(`Including ${a} brings its text back; the ${i.toLowerCase()} stays off unless you tick the box.`))}for(let e of ne){if(e===O||!s.includes(e)||y(e))continue;let n=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e;m.push(`Excluding ${n} also drops its hook: it stops asking on every host.`)}for(let e of re){if(!s.includes(e)||y(e))continue;let n=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e;m.push(`Excluding ${n} drops its text; its hook still asks (it has no switch yet).`)}let h=T.length?`${T.length} of ${C.length} doctrine rules`:`no doctrine rules`,g=m.length?`\n\n${m.join(`
4
- `)}`:``,_=p.length?{label:`Also turn the ${p.map(e=>e.label.toLowerCase()).join(` and `)} back on`,checked:!0}:void 0,v=await o(`Rebuild ${w(n)} with ${h}? It rebuilds in place, non-destructive.${d}${g}`,{title:`Rebuild with these rules?`,confirmLabel:`Rebuild`,check:_});if(!v)return;let b={...f};if(v?.checked!==!1)for(let e of p)b[e.key]=!0;await i(`install`,{...n,doctrines:e,excludeRules:c,...b})&&l.startApply(`rules`,u)},revert:()=>l.drop(`rules`,u)}}var j=n();function M({addr:e,isOpen:t,onToggle:n,className:a,style:o,head:s,label:l,rev:u,toggleCol:d=null,renderBody:f,srcLine:p,after:m=null}){let h=(0,A.useId)(),{data:g,error:_,reload:v}=c(()=>t?r.item(`law`,e):Promise.resolve(null),[t,e,u],`law-item`),y=t&&(0,j.jsxs)(`div`,{className:`law-expand`,id:h,children:[_?(0,j.jsx)(i,{error:_,onRetry:v}):g?f(g):(0,j.jsx)(`p`,{className:`dim`,children:`Loading…`}),(0,j.jsx)(`div`,{className:`law-srcline`,children:p}),m]}),b={type:`button`,onClick:n,"aria-expanded":t,"aria-controls":h,"aria-label":l};return d?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:a,style:o,"data-addr":e,children:[(0,j.jsx)(`button`,{className:`law-disclosure`,...b,children:s}),(0,j.jsx)(`span`,{className:`toggle-col`,children:d})]}),y]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{className:a,style:o,"data-addr":e,...b,children:s}),y]})}function le({law:e,isOpen:t,onToggle:n,rev:r,toggleCol:i=null,after:a=null}){let o=e.enf===`Hook gate`?` hook`:e.enf===`Gate off`?` gate-off`:``,s=(0,j.jsx)(`span`,{className:`law-enf${o}`,"data-col":`enf`,"aria-hidden":i?`true`:void 0,children:e.enf},`enf`),c=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`law-no`,"data-col":`no`,children:[(0,j.jsx)(`span`,{className:`x`,"aria-hidden":`true`,children:`›`}),e.no]}),(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:e.name}),e.ess?(0,j.jsx)(`span`,{className:`law-princ`,children:e.ess}):null,e.asks?(0,j.jsx)(`span`,{className:`law-asks mono`,children:e.asks}):null,e.note?(0,j.jsx)(`span`,{className:`law-note`,children:e.note}):null,e.no?(0,j.jsxs)(`span`,{className:`law-fold law-fold-no`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`x`,children:`›`}),e.no]}):null,e.latin?(0,j.jsx)(`span`,{className:`law-fold law-fold-latin`,"aria-hidden":`true`,children:e.latin}):null,(0,j.jsxs)(`span`,{className:`law-fold law-fold-chips`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`law-chip-status ${e.statusTone}`,children:e.status}),(0,j.jsx)(`span`,{className:`law-chip-enf${o}`,children:e.enf})]})]}),(0,j.jsx)(`span`,{className:`law-latin`,"data-col":`latin`,children:e.latin}),(0,j.jsx)(`span`,{className:`law-status ${e.statusTone}`,"data-col":`status`,children:e.status}),i?null:s]});return(0,j.jsx)(M,{addr:e.addr,isOpen:t,onToggle:n,className:`law-row${i?` has-toggle`:``}${t?` on`:``}${e.off?` law-off`:``}`,style:{"--cc":e.c},head:c,label:`${e.no?e.no+` `:``}${e.name}, ${e.status}, ${e.enf}`,rev:r,toggleCol:i?[i[0],s,i[1]]:null,renderBody:t=>(0,j.jsx)(ae,{body:t.body||e.ess,links:t.links}),srcLine:`$ geneseed law ${e.addr} · ${e.src}`,after:a})}var N=[`invariants`,`doctrines`];function ue({tiers:e,current:t,onPick:n}){return(0,j.jsx)(`div`,{className:`tier-strip`,children:e.map((e,r)=>{let i=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`tier-head`,children:[(0,j.jsxs)(`span`,{className:`tier-k mono`,children:[`RANK `,r+1]}),e.pill?(0,j.jsx)(`span`,{className:`badge tier-pill ${e.pill[1]}`,children:e.pill[0]}):null]}),(0,j.jsxs)(`span`,{className:`tier-top`,children:[(0,j.jsx)(`span`,{className:`tier-name`,children:e.name}),(0,j.jsx)(`span`,{className:`tier-n mono`,children:e.n})]}),(0,j.jsx)(`span`,{className:`tier-bar`,"aria-hidden":`true`,children:(0,j.jsx)(`span`,{style:{width:`${Math.round(e.fill*100)}%`}})}),(0,j.jsx)(`span`,{className:`tier-sub`,children:e.sub}),(0,j.jsx)(`span`,{className:`tier-sub tier-rule`,children:e.rule})]}),a=`tier${t===e.key?` on`:``}`;return e.href?(0,j.jsx)(`a`,{className:`tier`,href:e.href,children:i},e.key):n&&N.includes(e.key)?(0,j.jsx)(`button`,{type:`button`,className:a,"aria-pressed":t===e.key,onClick:()=>n(t===e.key?`all`:e.key),children:i},e.key):(0,j.jsx)(`div`,{className:a,children:i},e.key)})})}function de({gates:e,byAddr:t,onJump:n,disarmed:r=()=>!1,install:i=null,slot:a=0}){let o=i?w(i):``,c=Object.entries(e?.asks||{}).map(([e,t])=>[e,t,r(y(e))]).sort((e,t)=>e[2]-t[2]||t[1]-e[1]),l=Math.max(1,...c.map(([,e])=>e));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`gate-asks`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`gate-asks`,children:`Gate asks`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e?.total??0,` in ledger`]})]}),i&&c.some(e=>e[2])&&(0,j.jsx)(`span`,{className:`lib-legend mono`,children:(0,j.jsxs)(`span`,{children:[a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:x(a),"aria-hidden":`true`}),o]})}),c.length?(0,j.jsx)(`ul`,{className:`gate-list`,children:c.map(([e,r,c])=>{let u=y(e),d=t[u]?.name||v(u);return(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`button`,{type:`button`,className:`gate-row`,onClick:()=>n(u),children:(0,j.jsxs)(`span`,{className:`gate-top`,children:[(0,j.jsx)(`span`,{className:`gate-name${c?` dim`:``}`,children:d}),c&&(0,j.jsxs)(`span`,{className:`mono off`,children:[i&&a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:x(a),"aria-hidden":`true`}),`off`,i&&(0,j.jsxs)(`span`,{className:`sr-only`,children:[` · `,o]})]}),(0,j.jsx)(`span`,{className:`mono gate-n`,children:r})]})}),(0,j.jsx)(s,{value:r,max:l,label:`${d} asks`,tone:c?`accent`:`warn`})]},e)})}):(0,j.jsx)(`p`,{className:`sub`,children:`No gate has asked yet.`}),(0,j.jsx)(`p`,{className:`panel-note`,children:e?.standing_down?.length?`Standing down: ${e.standing_down.join(`, `)}.`:`None standing down.`})]})}function fe({packs:e,sel:t,canApply:n,install:r,gateArmed:i}){let{isOn:a,packOn:o,togglePack:c,dirty:l,losingConsent:u}=t,d=Math.max(1,...e.map(e=>e.rules.length));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`doc-packs`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`doc-packs`,children:`Doctrine packs`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e.filter(o).length,`/`,e.length,` on`]})]}),e.length?(0,j.jsx)(`ul`,{className:`pack-list`,children:e.map(e=>{let t=e.rules.filter(e=>a(e.addr)).length;return(0,j.jsxs)(`li`,{className:o(e)?``:`off`,children:[(0,j.jsx)(`span`,{className:`pl-name`,title:e.desc,children:e.title}),(0,j.jsx)(s,{value:t,max:d,label:`${e.title} rules on`}),(0,j.jsx)(`span`,{className:`mono pl-n`,children:t}),n?(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${o(e)?` on`:``}${t&&t<e.rules.length?` mixed`:``}`,role:`checkbox`,"aria-checked":e.rules.length&&t===e.rules.length?`true`:t?`mixed`:`false`,"aria-label":`${e.title} pack`,onClick:()=>c(e)}):null]},e.pack)})}):(0,j.jsx)(`p`,{className:`sub`,children:`This install predates the three-tier constitution.`}),n&&e.length>0&&(0,j.jsxs)(j.Fragment,{children:[u&&(0,j.jsxs)(`p`,{className:`pack-warn`,role:`status`,"aria-live":`polite`,children:[`Dropping `,(0,j.jsx)(`b`,{children:`process 5`}),` also removes the commit/push consent gate:`,` `,(0,j.jsx)(`code`,{children:`git commit`}),` and `,(0,j.jsx)(`code`,{children:`git push`}),` stop being confirmed at the tool boundary.`,` `,i?`Real data loss stays gated by Rule IV.`:`Rule IV’s deletion gate is off on this install too.`]}),(0,j.jsx)(`p`,{className:`panel-note`,role:`status`,"aria-live":`polite`,children:l?`Not applied yet. Apply rebuilds ${r.host} · ${r.scope} once, with every change together.`:`Matches the deployed install. Changing a pack rebuilds it.`})]})]})}var pe=`ont:ownership`,me=e=>e===`ownership`?pe:e,he=`process.5`;function ge(e,t){let n=[];for(let r of e){if(r.tier!==`doctrine`)continue;let e=n.find(e=>e.pack===r.pack);e||(e={pack:r.pack,title:r.packTitle||r.pack,desc:r.packDesc||``,active:r.packActive!==!1,rules:[]},n.push(e));let i=p(r.title);e.rules.push({addr:r.name,no:`${r.pack} ${r.name.split(`.`)[1]||``}`,name:i.name,latin:i.latin,ess:r.summary||``,enf:S(r.name,t),c:ie[r.pack]||`var(--text-3)`,src:`doctrines/${r.pack}.md`})}return n}function P(e){let t=o(e.dataRev),[n,r]=T(`laws`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(E,{className:`page-pick`,installs:t,value:n,onChange:r}),(0,j.jsx)(I,{...e,install:n,listed:t!==null,installSlot:O((t||[]).map(e=>e.id)).indexOf(n?.id)},n?.id??`none`)]})}var F=(e,t)=>e?.install?.host===t.host&&e.install.path===t.path;function I({install:e,listed:t,installSlot:n,...a}){let o=e&&F(a.overview,e)?a.overview:null,{data:s,error:l,loading:u}=c(()=>Promise.resolve().then(()=>e&&!o?r.overview(te(e)):null),[!!o,a.dataRev]),d=o||(e&&F(s,e)?s:null),f=e?d:a.overview,p=!(!e||d||u);return(0,j.jsxs)(j.Fragment,{children:[p?(0,j.jsx)(i,{error:`Could not read this install's gates${l?`: ${l}`:`.`}`}):null,(0,j.jsx)(L,{...a,overview:f,pair:te(e),onAction:t&&(!e||d!==null)?a.onAction:void 0,pending:!t||!!(e&&!d&&u),gatesUnread:p,installSlot:n})]})}function L({selected:e,overview:t,setup:n,onAction:o,dataRev:d,pair:f,pending:v,gatesUnread:x,installSlot:te}){let T=b(),{data:E,error:O}=c(()=>r.catalog(`laws`,f),f?[d,f.host,f.path]:[d],`catalog:laws`),{data:ae}=l(d,f),[M,N]=(0,A.useState)(`all`),[P,F]=(0,A.useState)(``),[I,L]=(0,A.useState)(`all`),[_e,ve]=(0,A.useState)(()=>new Set),R=me(e)||null,ye=e=>a(R===e?`#/laws`:`#/item/law/${encodeURIComponent(e)}`),z=t?.install,B=!!(z&&o),[be,xe]=(0,A.useState)(0),Se=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!R)return;let e=requestAnimationFrame(()=>{let e=document.querySelector(`[data-addr="${CSS.escape(R)}"]`);if(!e)return;let t=Se.current===R;Se.current=null;let n=e.getBoundingClientRect();if(t||n.top<80||n.bottom>window.innerHeight){let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;e.scrollIntoView?.({block:`center`,behavior:t?`auto`:`smooth`})}t&&(e.classList.remove(`law-flash`),e.offsetWidth,e.classList.add(`law-flash`))});return()=>cancelAnimationFrame(e)},[R,be,E]);let V=E?.items||[],H=ge(V,t?.install),U=e=>t?.install?.[D[e].key]!==!1,Ce=U(`IV`),W=ce({items:V,packs:H,install:z,canApply:B,onAction:o,gateArmed:Ce}),{deployedRules:G,isOn:K,toggleRule:we,packOn:Te,packState:Ee,allRules:q}=W;if(O)return(0,j.jsx)(i,{error:O});if(!E||v)return(0,j.jsx)(g,{});let J={ontology:E.nouns?.ontology||`Ethos`,law:E.nouns?.law||`Dictate`,laws:E.nouns?.laws||`Dictates`,doctrines:E.nouns?.doctrines||`Doctrines`},De=(e,t)=>{let n=S(e,t);return x&&D[e]&&n===`Hook gate`?`Unknown`:n},Oe=V.filter(e=>e.tier===`ontology`).map(e=>({addr:e.name,no:``,name:e.title,latin:``,ess:``,status:`Always`,statusTone:`ok`,enf:e.name===pe&&(z||x)?De(`ownership`,z):`Instruction`,c:`var(--text-3)`,src:`ontology/universal.md`})),Y=V.filter(e=>(e.tier??`invariant`)===`invariant`).map(e=>{let n=e.klass&&k[e.klass]?e.klass:`craft`,r=p(e.title);return{addr:e.name,no:e.name,name:r.name,latin:r.latin,ess:e.summary||``,retired:r.retired,status:r.retired?`Retired`:`Active`,statusTone:r.retired?``:`ok`,enf:r.retired?`None`:De(e.name,t?.install),cat:n,c:k[n].c,off:r.retired,src:`laws/universal.md`}}),ke=B?[{addr:`ownership`,name:D.ownership.label,latin:``,ess:``,enf:S(`ownership`,z)}]:[],Ae=e=>K(e)?!1:re.has(e)?!0:!D[e]||x?!1:U(e)&&!G.includes(e),je=e=>{let t=K(e.addr),n=G.includes(e.addr),r=t===n?t?`Active`:`Off`:t?`Staged on`:`Staged off`;return{...e,enf:x&&D[e.addr]&&e.enf===`Hook gate`?`Unknown`:e.enf,note:Ae(e.addr)?`Text excluded; the hook still asks.`:``,off:!t,status:r,statusTone:t?`ok`:t===n?``:`warn`}},Me=H.filter(e=>e.active).flatMap(e=>e.rules.filter(e=>!G.includes(e.addr)).map(e=>e.addr)),Ne=async e=>{if(!B)return;let{key:t,label:n}=D[e],r=n.toLowerCase(),i=!U(e),a=w(z),s=W.dirty?` Your staged doctrine changes are not part of this rebuild; they stay staged.`:``;await T((i?`Re-arm the ${r} on ${a}? ${m[e].arm} It rebuilds in place, non-destructive.`:`Switch the ${r} off on ${a}? ${m[e].off} It rebuilds in place, non-destructive.`)+s,{title:i?`Re-arm the ${r}?`:`Switch the ${r} off?`,confirmLabel:i?`Re-arm`:`Switch off`})&&o(`install`,{...z,[t]:i})},Pe=(e,t)=>(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${U(e)?` on`:``}`,role:`switch`,"aria-checked":U(e),"aria-label":t?`${D[e].label}: hook gate of ${t}`:D[e].label,onClick:()=>Ne(e)}),Fe=(e,t)=>(0,j.jsxs)(`span`,{className:`no-gate`,title:t,children:[e,(0,j.jsxs)(`span`,{className:`sr-only`,children:[`: `,t]})]}),Ie=(e,t)=>[(0,j.jsx)(`span`,{className:`toggle-cell`,children:e},`text`),(0,j.jsx)(`span`,{className:`toggle-cell`,children:t},`gate`)],Le=e=>D[e.addr]?Pe(e.addr,e.name):e.addr===he?Fe(`with text`,`No switch of its own: excluding ${e.name} drops its commit and push ask in the same rebuild (Bob still logs its warning).`):ne.has(e.addr)?Fe(`with text`,`No switch of its own: excluding ${e.name}, or its pack, drops its hook in the same rebuild.`):re.has(e.addr)?Fe(`always on`,`No switch yet: the hook asks even with ${e.name}'s text excluded.`):null,Re=e=>String(e.addr).includes(`.`)&&K(e.addr)!==G.includes(e.addr),ze=(e,t=I)=>t===`all`||(t===`gated`?e.enf===`Hook gate`&&(D[e.addr]||re.has(e.addr)||!String(e.addr).includes(`.`)||G.includes(e.addr)):Re(e)),X=P.trim().toLowerCase(),Z=e=>ze(e)&&(!X||`${e.addr} ${e.name} ${e.latin} ${e.ess}`.toLowerCase().includes(X)),Be=e=>{let t=Ze[e];(String(e).includes(`.`)?M===`invariants`:t&&M===`doctrines`)&&N(`all`),t&&!ze(t)&&L(`all`),t&&!Z(t)&&F(``),Se.current=me(e),xe(e=>e+1),a(`#/item/law/${encodeURIComponent(e)}`)},Ve={};for(let[e,t]of Object.entries(n?.gates?.asks||{}))Ve[y(e)]=t;let He=e=>Ve[e.addr]?{...e,asks:`${Ve[e.addr]} ask${Ve[e.addr]===1?``:`s`}`}:e,Q=Y.filter(e=>!e.retired).length,Ue=G.length,We=e=>{if(x)return[`gates unread`,`warn`];let t=e.filter(e=>D[e.addr]&&!U(e.addr)).length;return t?[`${t} gate${t===1?``:`s`} off`,`warn`]:[`always`,`ok`]},Ge=q.length-Ue,Ke=[Ge>0&&`${Ge} excluded`,!x&&!U(`rigor.5`)&&`1 gate off`].filter(Boolean),qe=Ke.length?[Ke.join(` · `),`warn`]:[`all on`,`ok`],$=ae?.stats,Je={ethos:{name:J.ontology,n:Oe.length,fill:1,sub:`${Oe.length} sections`,pill:We(ke)},invariants:{name:J.laws,n:Y.length,fill:Y.length?Q/Y.length:0,sub:Y.length>Q?`${Q} active · ${Y.length-Q} retired`:`${Q} active`,pill:We(Y)},doctrines:{name:J.doctrines,n:q.length,fill:q.length?Ue/q.length:0,sub:`${H.length} packs`,pill:qe},yours:{name:`Your rules`,n:$?.rules??``,fill:+!!$?.rules,sub:$?`${$.rules} rule${$.rules===1?``:`s`} · ≈${$.tokens.toLocaleString(`en-US`)} tok`:`user-rules.md`,href:`#/personal/rules`,pill:[`yours`,``]}},Ye=e=>{if(e===`—`)return`Nothing outranks them.`;let t=e.replace(`{{LAW}}`,J.law);return`${t[0].toUpperCase()}${t.slice(1)}.`},Xe=h.map(e=>({key:e.key,...Je[e.key],rule:Ye(e.against)})),Ze=Object.fromEntries([...Y,...H.flatMap(e=>e.rules)].map(e=>[e.addr,e])),Qe=[[`all`,`All`,Y.length+q.length],[`invariants`,J.laws,Y.length],[`doctrines`,J.doctrines,q.length]],$e=M===`all`||M===`invariants`,et=M===`all`||M===`doctrines`,tt=[...ke,...$e?Y:[],...et?H.flatMap(e=>e.rules):[]],nt=[[`gated`,`Gated`,x?null:tt.filter(e=>ze(e,`gated`)).length],[`changed`,`Changed`,tt.filter(e=>ze(e,`changed`)).length]],rt=e=>String(e).includes(`.`)?String(e).split(`.`)[0]:null,it=e=>I!==`changed`&&_e.has(e)&&rt(R)!==e,at=e=>{let t=it(e);ve(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&rt(R)===e&&a(`#/laws`)},ot=H.flatMap(e=>e.rules.filter(Re).map(e=>({...e,plus:K(e.addr)}))),st=B&&H.length>0&&W.dirty,ct=()=>{L(`changed`),M===`invariants`&&N(`all`),F(``)},lt=(e,t)=>(0,j.jsxs)(`div`,{className:`band-head`,role:`presentation`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,children:e}),(0,j.jsx)(`span`,{className:`mono dim`,children:t})]}),ut=e=>(0,j.jsxs)(`div`,{className:`law-rowhead`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{"data-col":`no`,children:`No.`}),(0,j.jsx)(`span`,{children:`Rule`}),(0,j.jsx)(`span`,{"data-col":`latin`,children:`Latin name`}),(0,j.jsx)(`span`,{"data-col":`status`,children:`Status`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Rule `}),`text`]}),(0,j.jsx)(`span`,{"data-col":`enf`,children:`Enforced by`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Hook `}),`gate`]})]}),dt=Y.filter(Z),ft=(X||I!==`all`?ke.filter(Z).length:0)+($e?dt.length:0)+(et?H.reduce((e,t)=>e+t.rules.filter(Z).length,0):0),pt=He(ke[0]||{}).asks,mt=(e,t)=>B?(0,j.jsxs)(`div`,{className:`law-gate`,children:[(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:D[e].label}),t?(0,j.jsx)(`span`,{className:`law-asks mono`,children:t}):null,(0,j.jsx)(`span`,{className:`law-princ`,children:m[e].desc})]}),Pe(e)]}):null,ht=e=>{let t=ee[e];return t?(0,j.jsxs)(`details`,{className:`law-hook`,children:[(0,j.jsx)(`summary`,{children:`What the hook does`}),(0,j.jsxs)(`dl`,{children:[(0,j.jsx)(`dt`,{children:`Triggers on`}),(0,j.jsx)(`dd`,{children:t.on}),(0,j.jsx)(`dt`,{children:`Per host`}),(0,j.jsx)(`dd`,{children:t.hosts}),(0,j.jsx)(`dt`,{children:`Does not see`}),(0,j.jsx)(`dd`,{children:t.blind}),(0,j.jsx)(`dt`,{children:`If switched off`}),(0,j.jsx)(`dd`,{children:t.off})]})]}):null};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(u,{eyebrow:z?[t?.theme,z.footprint&&`${z.footprint} footprint`,w(z)].filter(Boolean).join(` · `):null,title:`Constitution`,sub:`What the agent follows on every turn. Ranked: a lower rank may tighten a higher one, never repeal it. Open any rule to read its canonical text.`,actions:(0,j.jsx)(se,{className:`law-filter`,value:P,onChange:F,placeholder:`Filter rules`,label:`Filter rules`})}),(0,j.jsxs)(`section`,{className:`ladder`,"aria-labelledby":`ladder-h`,children:[(0,j.jsx)(`h2`,{id:`ladder-h`,className:`eyebrow`,children:`Precedence`}),(0,j.jsx)(ue,{tiers:Xe,current:M,onPick:N}),(0,j.jsx)(`div`,{className:`ladder-tail`,children:_.map((e,t)=>(0,j.jsxs)(`span`,{className:`ladder-low`,children:[(0,j.jsxs)(`span`,{className:`mono tier-k`,children:[`RANK `,h.length+t+1]}),` `,e.label,` —`,` `,e.against]},e.source))})]}),(0,j.jsxs)(`div`,{className:`split`,children:[(0,j.jsxs)(`section`,{className:`panel flush law-wrap${B?` with-toggle`:``}`,"aria-label":`Rules`,children:[Oe.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.ontology,`ontology/universal.md`),ut(!1),Oe.map(e=>(0,j.jsx)(le,{law:e,rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:e.addr===pe?(0,j.jsxs)(j.Fragment,{children:[ht(`ownership`),mt(`ownership`,pt)]}):null},e.addr))]}),(0,j.jsxs)(`div`,{className:`law-toolbar`,children:[(0,j.jsx)(C,{"aria-label":`Show`,children:Qe.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:M===e?`on`:``,"aria-pressed":M===e,onClick:()=>N(e),children:[t,` `,(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))}),(0,j.jsx)(C,{"aria-label":`Narrow`,children:nt.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:I===e?`on`:``,"aria-pressed":I===e,disabled:n===null,onClick:()=>L(I===e?`all`:e),children:[t,` `,n===null?null:(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))})]}),$e&&dt.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.laws,`laws/universal.md`),ut(B),dt.map(e=>(0,j.jsx)(le,{law:He(e),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:!B||e.retired?null:Ie(Fe(`locked`,`A ${J.law} cannot be excluded: its text always binds.`),D[e.addr]?Pe(e.addr,e.name):null)},e.addr))]}),et&&H.map(e=>{let t=e.rules.filter(Z);if(!t.length)return null;let n=it(e.pack),r=e.rules.filter(e=>K(e.addr)).length;return(0,j.jsxs)(`div`,{className:`pack-wrap${Te(e)?``:` pack-off`}`,children:[(0,j.jsxs)(`div`,{className:`band-head pack-head`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,style:{"--cc":ie[e.pack]},children:(0,j.jsx)(`button`,{type:`button`,className:`pack-fold`,"aria-expanded":!n,onClick:()=>at(e.pack),children:e.title})}),(0,j.jsx)(`span`,{className:`mono dim`,children:e.pack}),(0,j.jsx)(`span`,{className:`pack-desc dim`,children:e.desc}),(0,j.jsx)(`span`,{className:`pack-fill`,children:(0,j.jsx)(s,{value:r,max:e.rules.length,label:`${e.title} rules switched on`})}),(0,j.jsx)(`span`,{className:`pack-state mono`,children:Ee(e)})]}),!e.active&&!B&&(0,j.jsxs)(`div`,{className:`pack-enable`,children:[`$ geneseed-build --doctrines`,` `,H.filter(t=>t.active||t.pack===e.pack).map(e=>e.pack).join(`,`),Me.length>0&&` --exclude-rules ${Me.join(`,`)}`]}),!n&&ut(B),!n&&t.map(e=>(0,j.jsx)(le,{law:He(je(e)),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:B?Ie((0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${K(e.addr)?` on`:``}`,role:`switch`,"aria-checked":K(e.addr),"aria-label":`${e.name} rule text`,onClick:()=>we(e.addr)}),Le(e)):null},e.addr))]},e.pack)}),ft===0&&(0,j.jsx)(oe,{title:X||I!==`all`?`No matching rules`:`Nothing in this tier`,children:X?(0,j.jsxs)(j.Fragment,{children:[`Nothing matches “`,P.trim(),`”.`]}):I===`all`?(0,j.jsx)(j.Fragment,{children:`This install predates the tier.`}):(0,j.jsxs)(j.Fragment,{children:[`No `,I,` rule in this tier.`]})})]}),(0,j.jsxs)(`aside`,{className:`aside-stack`,children:[(0,j.jsx)(fe,{packs:H,sel:W,canApply:B,install:z,gateArmed:Ce}),(0,j.jsx)(de,{gates:n?.gates,byAddr:Ze,onJump:Be,disarmed:e=>!!D[e]&&!U(e),install:t?.install,slot:te})]})]}),st&&(0,j.jsxs)(`div`,{className:`law-bar`,role:`region`,"aria-label":`Unapplied changes`,children:[(0,j.jsxs)(`span`,{className:`law-bar-n`,children:[ot.length,` unapplied change`,ot.length===1?``:`s`]}),(0,j.jsx)(`span`,{className:`law-bar-list`,children:ot.map(e=>(0,j.jsxs)(`span`,{className:`badge ${e.plus?`ok`:`warn`}`,children:[e.plus?`+`:`−`,` `,e.no,` `,e.name]},e.addr))}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:ct,children:`Review changes`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{L(`all`),W.revert()},children:`Revert`}),(0,j.jsxs)(`button`,{type:`button`,className:`btn`,onClick:W.applyPacks,children:[`Apply (`,W.pickedRules.length,`/`,q.length,` rules)`]})]})]})}export{P as default};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-0ORz7tAc.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/AgentGlyph-k6o3gCM1.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{o as i}from"./motion-RlUl1osO.js";import{n as a,t as o}from"./sections-CtFz7HFH.js";import{$ as s,Et as c,H as l,J as ee,St as u,b as d,et as f,gt as p,it as te,lt as m,nt as h,pt as g,rt as _,t as v,ut as y,x as b,z as x}from"./index-How7SzDZ.js";import{t as ne}from"./EmptyState-CY5Pm2xy.js";import{a as re,c as ie,i as ae,l as oe,n as se,o as ce,r as le,t as ue}from"./LibRows-DEHjIoD-.js";var S=e(t(),1),C=n();function de({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,C.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function w({entries:e}){return e.length?(0,C.jsxs)(`table`,{className:`mf-entries`,children:[(0,C.jsx)(`thead`,{className:`sr-only`,children:(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`th`,{scope:`col`,children:`Path`}),(0,C.jsx)(`th`,{scope:`col`,children:`Load`}),(0,C.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,C.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,C.jsx)(`td`,{className:`mf-load-cell`,children:(0,C.jsx)(de,{load:e.load})}),(0,C.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function fe({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,C.jsxs)(`div`,{className:`mf-vault`,children:[(0,C.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,C.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,C.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,C.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,C.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,C.jsxs)(`span`,{className:`mf-role`,children:[(0,C.jsx)(p,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,C.jsxs)(`span`,{className:`mf-role`,children:[(0,C.jsx)(p,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,C.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,C.jsx)(p,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,C.jsx)(w,{entries:t})]})}function T({body:e}){let[t,n]=(0,S.useState)(!1),r=(0,S.useId)();return e?(0,C.jsxs)(`div`,{className:`mf-raw`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,C.jsx)(p,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,C.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function pe({manifest:e,body:t,name:n}){if(!e)return(0,C.jsx)(`pre`,{className:`mf-raw-pre`,children:(t||``).replace(/^```json\n|\n```$/g,``)});if(e.kind===`wiki`){let n=e.wikis||[];return n.length?(0,C.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,C.jsx)(fe,{wiki:e},e.name||t)),(0,C.jsx)(T,{body:t})]}):(0,C.jsxs)(`div`,{className:`mf-empty`,children:[(0,C.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,C.jsxs)(`p`,{children:[`A wiki is your machine-wide knowledge base — an Obsidian vault or any folder of linked markdown the agent reads from and writes back to. Declare one in`,` `,(0,C.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,C.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,C.jsx)(T,{body:t})]})}let r=e.context||[];return r.length?(0,C.jsxs)(`div`,{className:`mf-doc`,children:[(0,C.jsx)(w,{entries:r}),(0,C.jsx)(T,{body:t})]}):(0,C.jsxs)(`div`,{className:`mf-empty`,children:[(0,C.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,C.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,C.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,C.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,C.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,C.jsx)(T,{body:t})]})}var E=e=>e>=1e3?`${(e/1e3).toFixed(+(e<1e4))}k`:String(e),me=e=>Math.round(e/4),he=[{key:`root`,label:`Constitution`,tone:`accent`,has:e=>e.source===`root`},{key:`catalogue`,label:`Catalogues`,tone:`muted`,has:e=>e.source===`catalogue`},{key:`agent`,label:`This agent`,tone:`warn`,has:e=>e.source!==`root`&&e.source!==`catalogue`}],ge=[[`dictate`,`Dictates`],[`doctrine`,`Doctrines`],[`user`,`User rules`]],D={"not-wired":`not wired, re-emit this install`,"no-event":`not delivered on this host`};function _e(e,t){if(!e||!t)return``;let n=(e,t)=>e.blocks.filter(e=>e.chars>0&&!t.blocks.some(t=>t.id===e.id)),r=e=>e.id===`session-files`?`session files`:e.label.replace(/^.* spec$/,`spec`);return[...n(e,t).map(e=>`+ ${r(e)} ${E(e.chars)}`),...n(t,e).map(e=>`− ${r(e)} ${E(e.chars)}`)].join(`, `)}var O=e=>e.kind===`user`?`#/personal/rules`:`#/item/law/${encodeURIComponent(e.id)}`,k=e=>`${e.layer??``}${e.id}`;function A({label:e,n:t,children:n}){return(0,C.jsxs)(`li`,{children:[(0,C.jsx)(`span`,{children:e}),n,(0,C.jsx)(`span`,{className:`mono`,children:E(t)})]})}function ve({loadout:e,base:t,error:n,install:r}){let[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(e?.agent);if(e?.agent!==o&&(s(e?.agent),a(!1)),n)return(0,C.jsx)(`p`,{className:`sub`,children:`Loadout not measured for this install.`});if(!e)return null;let c=e=>e.reduce((e,t)=>e+t.chars,0),l=c(e.blocks),ee=_e(e,t),u=he.map(t=>{let n=e.blocks.filter(t.has);return{...t,blocks:n,n:c(n)}}),[d,f,p]=u,te=Math.max(1,...d.blocks.map(e=>e.chars)),m=e.blocks.find(e=>e.id===`user-rules`),h=m?D[m.delivery]:void 0,g=e.rules||[],_=g.filter(e=>!(h&&e.kind===`user`)),v=g.filter(e=>e.citedBySpec),y=[];for(let e of g){let t=e.kind===`dictate`?`Dictates`:e.kind===`user`?`User rules`:e.id.split(`.`)[0],n=y.find(e=>e.name===t);n?n.n+=1:y.push({name:t,n:1,user:e.kind===`user`})}let b=ge.map(([e,t])=>[t,_.filter(t=>t.kind===e).length]).filter(([,e])=>e>0);return(0,C.jsxs)(`section`,{className:`loadout`,"aria-label":`Loadout`,children:[(0,C.jsxs)(`header`,{className:`loadout-head`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`h3`,{className:`loadout-eyebrow mono`,children:[`Loadout · `,r||e.host]}),(0,C.jsxs)(`p`,{className:`loadout-total`,children:[(0,C.jsx)(`strong`,{children:E(me(l))}),(0,C.jsxs)(`span`,{className:`dim`,children:[`tokens at start · `,E(l),` chars`]})]})]}),ee?(0,C.jsxs)(`div`,{className:`loadout-delta`,children:[(0,C.jsxs)(`span`,{className:`dim`,children:[`Against the `,t?.noun||`Primary agent`]}),(0,C.jsx)(`ul`,{children:ee.split(`, `).map(e=>(0,C.jsx)(`li`,{className:`mono loadout-pill${e.startsWith(`+`)?` is-plus`:``}`,children:e},e))})]}):null]}),(0,C.jsxs)(`div`,{className:`loadout-bar`,children:[(0,C.jsx)(x,{label:`Loadout`,legend:!1,parts:u.map(e=>({key:e.key,label:e.label,n:e.n,tone:e.tone}))}),(0,C.jsx)(`ul`,{className:`loadout-groups`,"aria-hidden":`true`,children:u.map(e=>e.n>0?(0,C.jsxs)(`li`,{style:{flexGrow:e.n},children:[(0,C.jsx)(`span`,{children:e.label}),` `,(0,C.jsxs)(`span`,{className:`mono dim`,children:[E(e.n),` · `,Math.round(e.n/l*100),`%`]})]},e.key):null)})]}),(0,C.jsxs)(`details`,{className:`loadout-card`,open:e.agent===`primary`,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsx)(`i`,{className:`tone-accent`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`Constitution`}),(0,C.jsx)(`span`,{className:`dim`,children:`root file, loaded by the host`}),(0,C.jsxs)(`span`,{className:`mono dim loadout-sum`,children:[E(d.n),` · ≈ `,E(me(d.n)),` tok`]})]}),(0,C.jsx)(`ul`,{className:`loadout-root`,children:d.blocks.map(e=>(0,C.jsx)(A,{label:e.label,n:e.chars,children:(0,C.jsx)(`span`,{className:`loadout-mini`,"aria-hidden":`true`,children:(0,C.jsx)(`span`,{style:{width:`${Math.max(4,e.chars/te*100)}%`}})})},e.id))})]}),(0,C.jsxs)(`div`,{className:`loadout-pair`,children:[(0,C.jsxs)(`div`,{className:`loadout-card`,children:[(0,C.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,C.jsx)(`i`,{className:`tone-muted`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`Catalogues`}),(0,C.jsx)(`span`,{className:`mono dim loadout-sum`,children:E(f.n)})]}),(0,C.jsx)(`ul`,{className:`loadout-list`,children:f.blocks.map(e=>(0,C.jsx)(A,{label:e.label,n:e.chars},e.id))}),(0,C.jsx)(`p`,{className:`dim loadout-note`,children:`Listed by the host, not by Geneseed.`})]}),(0,C.jsxs)(`div`,{className:`loadout-card is-own`,children:[(0,C.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,C.jsx)(`i`,{className:`tone-warn`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`This agent`}),(0,C.jsx)(`span`,{className:`mono dim loadout-sum`,children:E(p.n)})]}),(0,C.jsx)(`ul`,{className:`loadout-list`,children:p.blocks.map(e=>(0,C.jsx)(A,{label:e.label,n:e.chars,children:e.id===`user-rules`?(0,C.jsx)(`span`,{className:`loadout-pill${h?` is-plus`:``}`,children:h||`injected at sub-agent start`}):null},e.id))})]})]}),(0,C.jsxs)(`section`,{className:`loadout-rules`,"aria-label":`Rules it follows`,children:[(0,C.jsxs)(`div`,{className:`loadout-rules-h`,children:[(0,C.jsxs)(`h4`,{className:`loadout-eyebrow mono`,children:[`Rules it follows · `,_.length]}),(0,C.jsx)(`span`,{className:`dim`,children:b.map(([e,t])=>`${t} ${e}`).join(` · `)})]}),v.length?(0,C.jsxs)(`div`,{className:`loadout-cited`,children:[(0,C.jsx)(`span`,{className:`loadout-cited-h`,children:`Cited by its spec`}),v.map(e=>(0,C.jsxs)(`a`,{href:O(e),children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` · `,e.title]},k(e)))]}):null,(0,C.jsx)(`ul`,{className:`loadout-packs`,children:y.map(e=>e.user&&h?(0,C.jsxs)(`li`,{className:`is-muted`,children:[(0,C.jsx)(`span`,{children:`User rules`}),` `,(0,C.jsx)(`span`,{className:`mono`,children:e.n}),` `,(0,C.jsx)(`span`,{className:`dim`,children:h})]},e.name):(0,C.jsx)(`li`,{children:(0,C.jsxs)(`a`,{href:e.user?`#/personal/rules`:`#/laws`,children:[(0,C.jsx)(`span`,{children:e.name}),` `,(0,C.jsx)(`span`,{className:`mono dim`,children:e.n})]})},e.name))}),g.length?(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":i,onClick:()=>a(e=>!e),children:i?`Show fewer`:`Show all ${g.length}${h?` listed`:``} rules`}):null,i?ge.map(([e,t])=>{let n=g.filter(t=>t.kind===e),r=h&&e===`user`;return n.length?(0,C.jsxs)(`div`,{className:r?`is-muted`:void 0,children:[(0,C.jsxs)(`h5`,{className:`reader-when-h`,children:[t,` `,(0,C.jsx)(`span`,{className:`mono dim`,children:n.length}),r?(0,C.jsxs)(`span`,{className:`dim`,children:[` · `,h]}):null]}),(0,C.jsx)(`ul`,{children:n.map(e=>(0,C.jsxs)(`li`,{children:[r?(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}):(0,C.jsxs)(`a`,{href:O(e),children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}),e.layer&&e.layer!==`install`?(0,C.jsxs)(`span`,{className:`dim`,children:[` (`,e.layer,`)`]}):null]},k(e)))})]},e):null}):null]}),(0,C.jsxs)(`p`,{className:`dim loadout-foot`,children:[`Not counted: `,e.notCounted.join(`; `),`. Tokens are chars ÷ 4.`]})]})}function ye({label:e,options:t,value:n,onChange:r}){let[i,a]=(0,S.useState)(!1),o=(0,S.useRef)(null),s=(0,S.useId)(),c=t.find(e=>e.key===n)||t[0],l=()=>a(!1);return(0,S.useEffect)(()=>{i&&document.getElementById(s)?.querySelector(`[aria-pressed="true"]`)?.focus()},[i,s]),(0,C.jsxs)(`span`,{className:`drop-menu`,children:[(0,C.jsxs)(`button`,{ref:o,type:`button`,className:`drop-menu-btn`,"aria-label":`${e}: ${c.label}`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-controls":i?s:void 0,onClick:()=>a(e=>!e),children:[c.label,(0,C.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,C.jsx)(_,{open:i,onClose:l,anchorRef:o,label:e,className:`drop-menu-pop`,children:(0,C.jsx)(`div`,{id:s,className:`drop-menu-list`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(document.activeElement);e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()},children:t.map(e=>(0,C.jsx)(`button`,{type:`button`,"aria-pressed":e.key===c.key,onClick:()=>{r(e.key),l()},children:e.label},e.key))})})]})}function be({label:e,value:t,delta:n,children:r}){let a=i(Number.isInteger(t)?t:null);return(0,C.jsxs)(`div`,{className:`stat`,children:[(0,C.jsx)(`div`,{className:`stat-label`,children:e}),(0,C.jsx)(`div`,{className:`stat-value mono`,children:a===null?t:Math.round(a)}),n==null?null:(0,C.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var xe=(0,S.lazy)(()=>v(()=>import(`./Markdown-0ORz7tAc.js`).then(e=>e.n),__vite__mapDeps([0,1,2]))),Se=(0,S.lazy)(()=>v(()=>import(`./AgentGlyph-k6o3gCM1.js`),__vite__mapDeps([3,1,2]))),Ce={skills:`skill`,agents:`agent`},we=`:primary`,Te=(e,t)=>`${t?e/t*100:0}%`,Ee=e=>e.split(`:`).slice(0,2).join(` `),De=e=>e.split(`/`).map((e,t)=>(0,C.jsxs)(S.Fragment,{children:[t?`/`:null,t?(0,C.jsx)(`wbr`,{}):null,e]},t)),j=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},Oe=e=>g(j(e));function ke(e,t){return e===`memory`?`memory/${t}`:e===`notebook`?`notebook/${t}`:e===`wiki`?`geneseed-wiki.jsonc`:e===`config`?t:e===`skills`?`skills/${t}/SKILL.md`:`${e}/${t}.md`}function Ae({section:e,source:t}){return(0,C.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,C.jsx)(p,{name:a[e].icon,className:`glyph`}),(0,C.jsxs)(`span`,{children:[`This entry is part of the `,a[e].label.toLowerCase(),` convention; see`,` `,(0,C.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var je=e=>e.replace(/\s+/g,` `).trim(),Me=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Ne(e,t){let n=e.replace(/\r\n/g,`
3
- `),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=Me(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?je(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?je(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=Me(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function Pe({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,C.jsx)(`div`,{className:`lib-stats`,children:(0,C.jsx)(be,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(Ee))].join(`, `),i=t.days_counted>=30?`in the last 30 days`:`since ${t.since}`,a=Math.max(1,...e.per_day),o=[e.last?`last used ${e.last}`:null,i,r?`on ${r}`:null].filter(Boolean).join(` · `);return(0,C.jsx)(`div`,{className:`lib-stats`,children:(0,C.jsx)(be,{label:`Used`,value:e.n,delta:o,children:(0,C.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,C.jsx)(`i`,{className:t===29?`today`:``,style:{height:Te(e,a)}},t))})})})}function Fe(e){let t=/\s*\bUse when:\s*/i.exec(e||``);if(!t)return{lede:e||``,when:``};let n=e.slice(t.index+t[0].length).trim();return{lede:e.slice(0,t.index).trim(),when:n&&n[0].toUpperCase()+n.slice(1)}}var Ie={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},Le=(e,t)=>t||(e&&o.includes(e)?e:o[0]),Re=encodeURIComponent;function ze(e){let t=e=>d[e.klass]?e.klass:`personal`,n=b.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:d[n].label,groupC:d[n].c})));return{rows:n,cats:b.map(e=>({key:e,label:d[e].label,c:d[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Be(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function M({overview:e,section:t,selected:n,dataRev:i,lock:p,base:g,onRulesChanged:_,onCountsChanged:v}){let b=te(),[x,de]=(0,S.useState)(()=>Le(t,p)),[w,fe]=(0,S.useState)(``),[T,E]=(0,S.useState)(`all`),[me,he]=(0,S.useState)(`all`),[ge,D]=(0,S.useState)(``),[_e,O]=(0,S.useState)(null),[k,A]=(0,S.useState)(null),[be,Ee]=(0,S.useState)(t);if(t!==be){Ee(t),D(``);let e=Le(t,p);e!==x&&(de(e),fe(``),E(`all`),he(`all`))}let[je,Me]=(0,S.useState)(n);n!==je&&(Me(n),D(``));let{data:M,error:Ve,reload:He}=u(()=>r.catalog(x),[x,i],`catalog`),Ue=p?null:Ce[x]||null,We=Ue!==null,{data:N}=u(()=>We?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[We,i],`usage`,{revalidate:!0}),P=We&&!!N?.enabled&&Array.isArray(N.names),Ge=(0,S.useMemo)(()=>new Map((Array.isArray(N?.names)?N.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[N]),F=e=>P&&Ge.get(`${Ue}\u0000${e}`)||null,Ke=e=>{let t=F(e.name);return!t||t.n===0&&!t.last},qe=N?.since?`No call since ${N.since}`:`No call recorded yet`,I=M?.section===x,L=I&&M?.items||[],Je=!I&&!Ve,[Ye,...Xe]=I&&M.sharedInstalls||[],R=e=>e===Ye?`shared`:Oe(e),z=x===`skills`,Ze=z?ze(L):null,B=z?Ze.rows:x===`memory`?Be(L):L,V=n||B[0]?.name||null,H=x===`agents`&&!p,U=H&&V===`:primary`,{data:Qe,error:$e}=u(()=>H?Promise.resolve().then(()=>r.loadout()):Promise.resolve(null),[H,i],`loadout-primary`,{revalidate:!0}),et=H?{name:we,type:`agent`,base:!0,title:!$e&&Qe?.noun||`Primary agent`,desc:`The main agent of the session. Every agent inherits its root file.`}:null,tt=U?et:V?L.find(e=>e.name===V):null,nt=tt?.type||a[x].type,W=k?.sec===x&&k?.name===V?k.key:null,{data:rt,error:it}=u(()=>!V||U?Promise.resolve(null):W?r.item(nt,V,j(W)):r.item(nt,V),[x,V,nt,W,i,U]),G=it?null:rt,at=G&&G.name===V&&(!W||G.install===W)?G:null,ot=e=>vt&&e?.install?` in ${R(e.install)}`:``,K=U?null:W||G?.install||null,st=H&&V&&!U&&G&&G.name===V,{data:ct,error:lt}=u(()=>st?Promise.all([r.loadout(V,K?j(K):void 0),r.loadout(void 0,K?j(K):void 0).catch(()=>null)]).then(([e,t])=>({own:e,base:t})):Promise.resolve(null),[st,V,K,i]),ut=U?{own:$e?null:Qe,base:null}:ct,dt=U?$e:lt,ft=ge||Ve||it,pt=V?{name:V,title:G?.title||V,desc:G?.desc||``}:null,q=tt||pt,mt=t=>t===x&&I?L.length:e?.counts?.[t]??``,ht=ee(i),gt=K||ht?.[0]?.id,_t=gt?Oe(gt):void 0,vt=new Set(L.flatMap(e=>e.installs||[])).size>1,yt=y([...(ht||[]).map(e=>e.id),...L.flatMap(e=>e.installs||[])],Xe),J=z?B.filter(e=>T===`all`||e.cat===T):B,bt=P?J.filter(Ke).length:0,xt=e=>e.status===`experimental`,St=J.filter(xt).length,Y=[[`all`,`All`,J.length],...P?[[`used`,`Used`,J.length-bt],[`unused`,`Not used yet`,bt,qe]]:[],...St?[[`experimental`,`Experimental`,St,`Shipped, not yet confirmed by real use`]]:[]],X=Y.some(([e])=>e===me)?me:`all`,Ct=X===`all`?J:X===`experimental`?J.filter(xt):J.filter(e=>Ke(e)===(X===`unused`)),wt=P?Math.max(0,...L.map(e=>F(e.name)?.n||0)):0,Tt=z?1/0:50,Z=w.trim().toLowerCase(),Q=Z?re(Ct,Z):Ct.slice(0,Tt),Et=!Z&&T===`all`&&X===`all`&&V&&!Q.some(e=>e.name===V)?[...Q,...B.filter(e=>e.name===V)]:Q,Dt=et&&I&&T===`all`&&X===`all`?re([et],Z):[],Ot=Dt.length+Q.length,kt=[...Dt,...Et],At=e=>g?`${g}/${Re(e.name)}`:`#/item/${e.type||a[x].type}/${Re(e.name)}`,jt=async()=>{let e=at;if(!e)return;let t=e.name;if(await b(`Forget the memory fact "${t}"${ot(e)}? It leaves the index and moves to memory/archive/ (geneseed memory rm --archived --purge deletes it for good).`,{title:`Forget this fact?`,confirmLabel:`Forget`,tone:`danger`})){D(``);try{await r.memoryDelete(t,e.install?j(e.install):void 0)}catch(e){D(`Could not forget "${t}": ${e.message}`);return}c(g||`#/personal/memory`),He(),v?.()}},Mt=async()=>{let e=at;if(!e)return;let t=e.name;if(await b(`Promote "${t}"${ot(e)} into a standing rule? It is appended to user-rules.md as a trial rule (a month of probation), and the memory fact moves to memory/archive/ so the lesson isn't loaded twice.`,{title:`Promote to a rule?`,confirmLabel:`Promote`})){D(``);try{let n=e.install?j(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),l(),_?.(),v?.(),c(`#/personal/rules`)}catch(e){D(`Could not promote: ${e.message}`),He()}}},Nt=G?.body?Ne(G.body,G.desc||q?.desc):null,Pt=G?.title||q?.title||q?.name,Ft=Pt===q?.name&&Nt?.title?Nt.title:Pt,It=I&&L.length===0,Lt=G?.status||q?.status,Rt=x===`skills`?d[tt?.klass]:null,zt=a[x].label,{lede:Bt,when:Vt}=Fe(G?.desc||q?.desc||``),$=q&&!U?G?.source||q.source||(it?null:ke(x,q.name)):null;return(0,C.jsxs)(`div`,{className:`lib-wrap`,children:[(0,C.jsx)(s,{error:ft,style:{margin:`0 0 var(--sp-3)`}}),(0,C.jsxs)(`div`,{className:`library lib-dossier${p?` locked`:``}${P?` uses`:``}`,children:[p?null:(0,C.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,C.jsxs)(`div`,{className:`lib-title`,children:[(0,C.jsx)(`h1`,{className:`h`,children:`Library`}),(0,C.jsx)(`span`,{className:`dim`,children:`What the agent knows`}),P&&N.since?(0,C.jsxs)(`span`,{className:`mono dim lib-title-since`,children:[`calls since `,N.since]}):null]}),(0,C.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:o.map(e=>(0,C.jsxs)(S.Fragment,{children:[(0,C.jsxs)(`a`,{href:`#/section/${e}`,className:x===e?`on`:``,"aria-current":x===e?`page`:void 0,children:[a[e].label,(0,C.jsx)(`span`,{className:`mono dim`,children:mt(e)})]}),e===x&&z&&I&&(0,C.jsx)(ce,{label:`Skill types`,total:L.length,cats:Ze.cats,cat:T,onChange:E})]},e))})]}),(0,C.jsxs)(ae,{label:zt,count:I?Z?`${Q.length} of ${Ct.length}`:Ct.length:``,q:w,onQ:fe,matched:Ot,inView:[x,n],current:q?Ft:void 0,sections:p?void 0:o.map(e=>({key:e,label:a[e].label,n:mt(e),href:`#/section/${e}`,on:x===e})),cats:z&&I?Ze.cats:null,cat:T,total:L.length,onCat:E,catLabel:`Skill types`,extra:(0,C.jsxs)(C.Fragment,{children:[P&&N.since?(0,C.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,N.since]}):null,(0,C.jsxs)(`span`,{className:`lib-legend mono`,children:[vt?yt.map((e,t)=>(0,C.jsxs)(`span`,{className:`lk-install`,title:j(e).path,children:[(0,C.jsx)(`i`,{className:`lr-dot`,style:m(t),"aria-hidden":`true`}),R(e)]},e)):null,(0,C.jsx)(oe,{items:L})]})]}),toolsCompact:I&&Y.length>1?(0,C.jsx)(ye,{label:`Show`,options:Y.map(([e,t])=>({key:e,label:e===`all`?`All uses`:t})),value:X,onChange:he}):void 0,tools:I&&Y.length>1?(0,C.jsx)(h,{"aria-label":`Show`,children:Y.map(([e,t,n,r])=>(0,C.jsxs)(`button`,{type:`button`,className:X===e?`on`:``,"aria-pressed":X===e,title:r,onClick:()=>he(e),children:[t,` `,(0,C.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[Je?(0,C.jsx)(f,{}):null,(0,C.jsx)(se,{rows:kt,activeName:q?.name,hrefOf:At,pills:P||vt?e=>{let t=F(e.name)?.n||0,n=vt?(0,C.jsx)(`span`,{className:`lr-dots`,children:yt.map((t,n)=>e.installs?.includes(t)?(0,C.jsx)(`span`,{className:`lr-dot lr-install`,style:m(n),title:`${R(t)} — ${j(t).path}`,children:(0,C.jsx)(`span`,{className:`sr-only`,children:R(t)})},t):(0,C.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return P?(0,C.jsxs)(C.Fragment,{children:[n,(0,C.jsxs)(`span`,{className:`lr-use`,children:[(0,C.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,C.jsx)(`i`,{style:{width:Te(t,wt)}})}),(0,C.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,C.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!Z&&L.length>Tt&&(0,C.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,Tt,` of `,L.length,`; type to search the rest.`]}),It&&(x===`wiki`?(0,C.jsxs)(ne,{title:`No wiki entries`,action:(0,C.jsx)(`a`,{href:`#/section/config`,children:`Open the setup files`}),docs:{href:`#/docs/wiki`,label:`How to configure a wiki →`},children:[`Declare a wiki in `,(0,C.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,C.jsx)(ne,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,C.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:q?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`reader-tags`,children:[(0,C.jsx)(`span`,{className:`tag acc`,children:zt.replace(/s$/,``)}),U?(0,C.jsx)(ue,{}):null,Rt?(0,C.jsx)(`span`,{className:`tag`,children:Rt.label}):null,G?.kit??q.kit?(0,C.jsx)(le,{name:G?.kit??q.kit}):null,(0,C.jsx)(ie,{status:Lt,withHint:!0}),$?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`mono dim reader-src`,children:De($)}),(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),O({src:$,ok:!0})}catch{O({src:$,ok:!1})}},children:_e?.src===$?_e.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,C.jsxs)(`div`,{className:`reader-head`,children:[(0,C.jsx)(`h2`,{className:`reader-title`,children:Ft}),x===`agents`&&!U?(0,C.jsx)(S.Suspense,{fallback:null,children:(0,C.jsx)(Se,{name:q.name})}):null]}),(0,C.jsxs)(`div`,{className:`reader-intro${P?` with-stats`:``}`,children:[(0,C.jsxs)(`div`,{className:`reader-intro-text`,children:[Bt?(0,C.jsx)(`p`,{className:`reader-lede`,children:Bt}):null,Vt?(0,C.jsxs)(`section`,{className:`reader-when`,children:[(0,C.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,C.jsx)(`p`,{children:Vt})]}):null]}),P?(0,C.jsx)(Pe,{u:F(q.name),usage:N,noCall:qe}):null]}),x===`memory`&&at&&q.name!==`MEMORY`&&q.name!==`README`&&(0,C.jsxs)(`div`,{className:`row gap-8`,children:[(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Mt,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:jt,children:`Forget this fact`})]}),G?.installs?.length>1&&G.installs.includes(G.install)?(0,C.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,C.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,C.jsx)(`select`,{className:`sel`,"aria-label":`Install`,value:W||G.install,onChange:e=>A({sec:x,name:V,key:e.target.value}),children:G.installs.map(e=>(0,C.jsx)(`option`,{value:e,title:j(e).path,children:R(e)},e))}),(0,C.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,C.jsx)(`hr`,{className:`hr`}),H?(0,C.jsx)(ve,{loadout:ut?.own,base:ut?.base,error:dt,install:_t}):null,U?null:it?(0,C.jsxs)(`p`,{className:`sub`,children:[`No `,zt.replace(/s$/,``).toLowerCase(),` named `,(0,C.jsx)(`em`,{children:q.name}),` could be read in this install.`]}):q?.kind===`manifest`||G?.manifest!==void 0?G?(0,C.jsx)(pe,{manifest:G.manifest,body:G.body,name:q.name}):(0,C.jsx)(f,{}):G?.body?(0,C.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,C.jsx)(S.Suspense,{fallback:null,children:(0,C.jsx)(xe,{body:Nt.body,links:G.links||[]})})}):G===null&&V?(0,C.jsx)(f,{}):(0,C.jsx)(Ae,{section:x,source:ke(x,q.name)}),Ie[x]?(0,C.jsx)(`div`,{className:`reader-links`,children:(0,C.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${Ie[x]}`,children:[`About `,zt.toLowerCase(),` in Docs`]})}):null]}):Je?(0,C.jsx)(f,{}):null})]})]})}export{we as PRIMARY,Ne as bodyHead,M as default,Be as groupMemory,Oe as installLabel,j as installOfKey,ze as splitSkills,Fe as splitWhen};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{i}from"./motion-RlUl1osO.js";import{$ as a,J as o,St as s,Tt as c,et as l,mt as u,q as d,tt as f,wt as p}from"./index-How7SzDZ.js";import{t as m}from"./Markdown-0ORz7tAc.js";import{t as h}from"./EmptyState-CY5Pm2xy.js";import{a as g,i as _,n as ee,o as te,s as v}from"./LibRows-DEHjIoD-.js";import{t as y}from"./CopyButton-ByIntFtB.js";import{c as b,i as ne,n as x,o as S,r as C,s as w,t as T}from"./ActiveLoops-BJJN3P-V.js";var E=e(t(),1),D=n(),O=encodeURIComponent,k=p.loops.map(e=>[e,c[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,w(e)?z(`human`,`human gate`):null,e.override?z(`acc`,e.override):null,e.available===!1?z(`bad`,`unavailable`):null],active:e=>z(x[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(` · `)}),w(t)?z(`human`,w(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[a,o]=(0,E.useState)(null),s=new Map(t.map(e=>[e.name,e])),c=H(e.graph),l=b(e.graph,t),u=l.mode===`ring`,d=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,f=r?.filter(t=>C(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:u?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${l.width}px`},children:(0,D.jsx)(S,{graph:e.graph,bricks:t,onSelect:e=>{o(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:i()?`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:c.map(([e,t])=>(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),u?(0,D.jsxs)(`span`,{className:`loop-legend`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),c.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)(y,{text:d,label:`Copy command`})]}),(0,D.jsx)(`pre`,{className:`mono`,children:d})]}),r?(0,D.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,f?`${f} of this template`:`none`,`.`,` `,f?(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:s.get(e),override:P(n,e),on:a===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
- `)}\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`,w(e)?z(`human`,w(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)(m,{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=o(n),[c,p]=d(`loops`,i),{data:m,error:y}=s(()=>r.loops(u(c)),[n,c?.id??``],`loops`),b=ne(),[x,S]=(0,E.useState)(``),[w,A]=(0,E.useState)(`all`),[j,N]=(0,E.useState)(e);e!==j&&(N(e),S(``),A(`all`));let P=m?.bricks||[],F=e===`active`?b.loops&&R(b.loops):m&&(e===`bricks`?L(m.bricks,m.overridden):I(m.templates,m.bricks)),z=F||[],V=v(z),H=w===`all`?z:z.filter(e=>e.group===w),U=x.trim(),J=g(H,U),Y=!!(t&&F&&!z.some(e=>e.name===t)),X=Y?null:z.find(e=>e.name===t)||e===`active`&&z.find(C)||z[0]||null,Z={templates:m?.templates.length,bricks:m?.bricks.length,active:b.loops?.length},Q=k.find(([t])=>t===e)[1],$=e===`active`?b.error:y;return(0,D.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,D.jsx)(f,{className:`page-pick`,installs:i,value:c,onChange:p}),(0,D.jsx)(a,{error:$,style:{margin:`0 0 var(--sp-3)`}}),(0,D.jsx)(G,{problems:m?.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)(te,{label:M[t],total:z.length,cats:V,cat:w,onChange:A})]},t))})]}),(0,D.jsx)(_,{label:Q,count:U?`${J.length} of ${H.length}`:F?H.length:``,q:x,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:w,total:z.length,onCat:A,catLabel:M[e],children:F?z.length===0?(0,D.jsx)(h,{title:K[e].title,children:K[e].body}):(0,D.jsx)(ee,{rows:J,activeName:X?.name,hrefOf:t=>`#/loops/${e}/${O(t.name)}`,pills:B[e]}):$?null:(0,D.jsx)(l,{})}),(0,D.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:Y?(0,D.jsx)(h,{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)(T,{loop:X,bricks:P,onPreset:b.onPreset}):e===`bricks`?(0,D.jsx)(W,{b:X}):(0,D.jsx)(re,{t:X,bricks:P,overridden:m.overridden,runs:b.loops},X.name):e===`active`&&F?(0,D.jsx)(h,{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};