geneseed 5.4.0 → 5.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +31 -1
  3. package/SHIPPED.md +1 -1
  4. package/adapters/bob/README.md +12 -1
  5. package/adapters/opencode/README.md +2 -1
  6. package/adapters/opencode/plugins/geneseed-context.js +71 -10
  7. package/adapters/opencode/plugins/geneseed-guard.js +101 -19
  8. package/adapters/opencode/plugins/geneseed-learn.js +641 -6
  9. package/bin/geneseed-cli.mjs +3 -0
  10. package/bin/geneseed-hook.mjs +2 -1
  11. package/docs/concepts/agents.md +13 -1
  12. package/docs/concepts/enforcement-table.md +1 -1
  13. package/docs/concepts/foreman-mode.md +22 -3
  14. package/docs/concepts/hook-gates.md +1 -1
  15. package/docs/concepts/hooks.md +22 -5
  16. package/docs/concepts/host-matrix.md +2 -2
  17. package/docs/concepts/hosts.md +1 -1
  18. package/docs/concepts/shared-tier.md +1 -1
  19. package/docs/concepts/skills.md +21 -1
  20. package/docs/concepts/themes.md +1 -1
  21. package/docs/extending.md +11 -2
  22. package/docs/guides/install-clone.md +18 -0
  23. package/docs/guides/install-scripted.md +8 -2
  24. package/docs/guides/install.md +19 -1
  25. package/docs/guides/upgrade.md +1 -1
  26. package/docs/reference/env-context.md +1 -1
  27. package/docs/reference/environment.md +1 -1
  28. package/docs/reference/plugin-learn.md +4 -0
  29. package/docs/reference/profiles.md +226 -0
  30. package/docs/token-footprint.md +9 -4
  31. package/docs/understand/design-choices-engineering.md +1 -1
  32. package/docs/web-ui.md +3 -1
  33. package/harness.config.json +1 -1
  34. package/js/README.md +9 -2
  35. package/js/build/args.mjs +4 -3
  36. package/js/build/catalog.mjs +11 -1
  37. package/js/build/driver.mjs +42 -11
  38. package/js/build/emit-claude.mjs +24 -1
  39. package/js/build/emit-opencode.mjs +3 -0
  40. package/js/build/export.mjs +12 -17
  41. package/js/build/generate.mjs +2 -1
  42. package/js/build/notes-migrate.mjs +99 -0
  43. package/js/build/profile.mjs +14 -6
  44. package/js/build/render.mjs +34 -10
  45. package/js/build/source.mjs +85 -2
  46. package/js/cli-table.json +164 -4
  47. package/js/hosts/agent-runs.mjs +205 -0
  48. package/js/hosts/done-checks.mjs +3 -1
  49. package/js/hosts/hooks-done.mjs +91 -16
  50. package/js/hosts/hooks-learn.mjs +85 -0
  51. package/js/hosts/hooks-prims.mjs +39 -1
  52. package/js/hosts/hooks.mjs +10 -4
  53. package/js/hosts/hosts.mjs +10 -0
  54. package/js/hosts/installs.mjs +25 -1
  55. package/js/hosts/link.mjs +45 -10
  56. package/js/hosts/native.mjs +42 -5
  57. package/js/hosts/opencode.mjs +1 -1
  58. package/js/hosts/settings.mjs +72 -0
  59. package/js/hosts/spec-feedback.mjs +538 -0
  60. package/js/hosts/usage.mjs +67 -8
  61. package/js/inspect/agent-scores.mjs +118 -0
  62. package/js/inspect/checks-authoring.mjs +2 -1
  63. package/js/inspect/checks-build.mjs +20 -4
  64. package/js/inspect/checks-repo.mjs +27 -2
  65. package/js/inspect/cost.mjs +6 -5
  66. package/js/inspect/diff.mjs +25 -5
  67. package/js/inspect/doctor.mjs +4 -0
  68. package/js/inspect/status.mjs +3 -1
  69. package/js/inspect/validate.mjs +1 -0
  70. package/js/lib/machine-dir.mjs +8 -0
  71. package/js/lib/paths.mjs +4 -1
  72. package/js/maintain/profile-scope.mjs +145 -0
  73. package/js/maintain/profiles.mjs +486 -0
  74. package/js/maintain/setup.mjs +409 -15
  75. package/js/maintain/uninstall.mjs +4 -1
  76. package/js/maintain/update.mjs +1 -1
  77. package/js/web/actions.mjs +28 -38
  78. package/js/web/api.mjs +7 -2
  79. package/js/web/handler.mjs +8 -0
  80. package/js/web/jobs.mjs +5 -4
  81. package/js/web/profiles-api.mjs +201 -0
  82. package/js/web/routes.mjs +5 -0
  83. package/package.json +2 -1
  84. package/profiles/autonomous.json +14 -0
  85. package/profiles/corporate.json +14 -0
  86. package/profiles/guillaume-claude-global.json +16 -0
  87. package/profiles/mentor.json +13 -0
  88. package/profiles/minimal.json +15 -0
  89. package/profiles/starter.json +14 -0
  90. package/src/AGENT.md.tmpl +1 -1
  91. package/src/agents/_self-improvement.md +15 -7
  92. package/src/agents/_template.md +4 -2
  93. package/src/agents/advocate.md +1 -1
  94. package/src/agents/architect.md +1 -1
  95. package/src/agents/developer.md +10 -3
  96. package/src/agents/devops-engineer.md +7 -6
  97. package/src/agents/docker-expert.md +1 -1
  98. package/src/agents/docs.md +1 -1
  99. package/src/agents/empiricist.md +1 -1
  100. package/src/agents/explorer.md +4 -2
  101. package/src/agents/framer.md +1 -1
  102. package/src/agents/historian.md +1 -1
  103. package/src/agents/kubernetes-specialist.md +4 -2
  104. package/src/agents/memory-curator.md +1 -1
  105. package/src/agents/operator.md +1 -1
  106. package/src/agents/performance.md +1 -1
  107. package/src/agents/pragmatist.md +1 -1
  108. package/src/agents/react-engineer.md +1 -1
  109. package/src/agents/react-reviewer.md +1 -1
  110. package/src/agents/researcher.md +1 -1
  111. package/src/agents/reviewer.md +10 -3
  112. package/src/agents/security.md +1 -1
  113. package/src/agents/skeptic.md +1 -1
  114. package/src/agents/spring-boot-engineer.md +4 -4
  115. package/src/agents/spring-reviewer.md +5 -3
  116. package/src/agents/spring-security.md +1 -1
  117. package/src/agents/steward.md +1 -1
  118. package/src/agents/tester.md +4 -2
  119. package/src/agents/user-advocate.md +1 -1
  120. package/src/agents/visionary.md +1 -1
  121. package/src/memory/README.md +12 -2
  122. package/src/modes/foreman.md +23 -10
  123. package/src/skill-descriptions.json +63 -0
  124. package/src/skills/_self-improvement.md +42 -26
  125. package/src/skills/_template.md +3 -1
  126. package/src/skills/brainstorm.md +35 -22
  127. package/src/skills/codebase-design.md +2 -2
  128. package/src/skills/daydream/VENDOR.md +6 -0
  129. package/src/skills/diagram-design/SKILL.md +12 -7
  130. package/src/skills/diagram-design/VENDOR.md +23 -14
  131. package/src/skills/diagram-design/references/layout-budget.md +7 -1
  132. package/src/skills/diagram-design/references/onboarding.md +1 -1
  133. package/src/skills/diagram-design/references/primitives-core.md +1 -1
  134. package/src/skills/diagram-design/references/semantic-patterns.md +1 -1
  135. package/src/skills/diagram-design/references/style-guide.md +1 -1
  136. package/src/skills/diagram-design/references/type-dependency.md +69 -0
  137. package/src/skills/diagram-design/references/type-event-modeling.md +36 -0
  138. package/src/skills/diagram-design/references/type-requirement-traceability.md +45 -0
  139. package/src/skills/diagram-design/references/type-sbgn.md +80 -0
  140. package/src/skills/diagram-design/references/type-scatter.md +1 -1
  141. package/src/skills/diagram-design/references/type-steps.md +180 -0
  142. package/src/skills/diagram-design/references/type-unit-grid.md +63 -0
  143. package/src/skills/explain-changes/VENDOR.md +5 -1
  144. package/src/skills/geneseed-code-review.md +2 -1
  145. package/src/skills/parallel-agents.md +12 -1
  146. package/src/skills/pipeline.md +3 -3
  147. package/src/skills/plan.md +5 -4
  148. package/src/skills/react-view-transitions/AGENTS.md +26 -26
  149. package/src/skills/react-view-transitions/SKILL.md +1 -1
  150. package/src/skills/react-view-transitions/VENDOR.md +19 -4
  151. package/src/skills/release.md +7 -2
  152. package/src/skills/rule/approve.md +2 -1
  153. package/src/skills/skill-forge.md +5 -3
  154. package/src/skills/spring-boot/cloud.md +19 -1
  155. package/src/skills/spring-boot/logging.md +5 -3
  156. package/src/skills/spring-boot/web.md +27 -2
  157. package/src/skills/spring-boot.md +4 -2
  158. package/src/skills/spring-data-jpa.md +18 -4
  159. package/src/skills/spring-testing.md +4 -0
  160. package/src/skills/token-report/VENDOR.md +5 -1
  161. package/src/upstreams.json +6 -6
  162. package/themes/README.md +3 -1
  163. package/web/dist/assets/{ActiveLoops-BJJN3P-V.js → ActiveLoops-DOJCPPPc.js} +1 -1
  164. package/web/dist/assets/{Activity-D2kOc3yi.js → Activity-bUSPM3Dl.js} +1 -1
  165. package/web/dist/assets/{ActivityDetail-By3xOr21.js → ActivityDetail-AHRoXeFN.js} +1 -1
  166. package/web/dist/assets/{Bonsai-CBWDTBA4.js → Bonsai-B5XY9pid.js} +1 -1
  167. package/web/dist/assets/{CopyButton-BVbpriMB.js → CopyButton-C0wwRR9H.js} +1 -1
  168. package/web/dist/assets/{Dashboard-CIJLPHM9.js → Dashboard-DPAA96EI.js} +2 -2
  169. package/web/dist/assets/{Docs-CiRRIELs.js → Docs-CpGDq165.js} +1 -1
  170. package/web/dist/assets/{Factories-DhyK0O8d.js → Factories-cNhETa5Q.js} +1 -1
  171. package/web/dist/assets/{GreenhouseView-DW3PgTPy.js → GreenhouseView-DO3ADmT9.js} +1 -1
  172. package/web/dist/assets/Installs-D3dDyq10.js +3 -0
  173. package/web/dist/assets/{JournalView-O65qEWfp.js → JournalView--W-Lw_V9.js} +1 -1
  174. package/web/dist/assets/{Kits-C5U-yT6Z.js → Kits-ChfehxY6.js} +1 -1
  175. package/web/dist/assets/Laws-CNxYmV36.js +4 -0
  176. package/web/dist/assets/{LibRows-D6-CVa3K.js → LibRows-CiPvsRYB.js} +1 -1
  177. package/web/dist/assets/{Library-CzPlerd6.js → Library-BxQvbwVU.js} +1 -1
  178. package/web/dist/assets/{Loops-CqNF_-nS.js → Loops-DAblKkyq.js} +1 -1
  179. package/web/dist/assets/{OperatorHudView-BNr8K5qj.js → OperatorHudView-QtSaSyYm.js} +1 -1
  180. package/web/dist/assets/{Personal-DeDb9e8O.js → Personal-DxSGv638.js} +1 -1
  181. package/web/dist/assets/{Settings-B8MPN_AD.js → Settings-CgTbhvRv.js} +1 -1
  182. package/web/dist/assets/{Tabs-DJzAez4h.js → Tabs-Cf4X1hdz.js} +1 -1
  183. package/web/dist/assets/api-CZ-x0iWG.js +1 -0
  184. package/web/dist/assets/{controls-D4wmg_pl.js → controls-CK7qHA8H.js} +1 -1
  185. package/web/dist/assets/{index-BL3P-9Rg.js → index-B_pTwZra.js} +4 -4
  186. package/web/dist/assets/index-CzfImiYb.css +1 -0
  187. package/web/dist/index.html +3 -3
  188. package/web/dist/assets/Installs-B6nlo-Ly.js +0 -3
  189. package/web/dist/assets/Laws-CuTw_XNf.js +0 -4
  190. package/web/dist/assets/api-DLDVY3K-.js +0 -1
  191. package/web/dist/assets/index-CRWqKxfY.css +0 -1
@@ -8,28 +8,28 @@
8
8
  },
9
9
  "react-view-transitions": {
10
10
  "repo": "vercel-labs/agent-skills",
11
- "commit": "063bee94c3f4df8453406c830b0a7df0f2860278",
11
+ "commit": "1a2c79d4e6c4a2283dc2c614b6538cbe1ed5ca62",
12
12
  "author": "Vercel Engineering",
13
13
  "license": "MIT",
14
14
  "licenseFile": null
15
15
  },
16
16
  "diagram-design": {
17
17
  "repo": "cathrynlavery/diagram-design",
18
- "commit": "0cf73c3fcc56667ad91a9a04c439ac6ccfabc9d1",
18
+ "commit": "f6db0decea96de66b901331a0f79a8d4b147ebae",
19
19
  "author": "Cathryn Lavery",
20
20
  "license": "MIT",
21
21
  "licenseFile": "skills/diagram-design/LICENSE"
22
22
  },
23
23
  "mattpocock-skills": {
24
24
  "repo": "mattpocock/skills",
25
- "commit": "5beb35b040e3de97e54fa9e386d7e42d15c295c2",
25
+ "commit": "5863806dd4e15c63174bee4e7515a4256792ecfa",
26
26
  "author": "Matt Pocock",
27
27
  "license": "MIT",
28
28
  "licenseFile": "licenses/mattpocock-skills.txt"
29
29
  },
30
30
  "superpowers": {
31
31
  "repo": "obra/superpowers",
32
- "commit": "bb92a77741419a4ab5f06e711a283343f1ada0c3",
32
+ "commit": "22f0b463e7a5e579904dd6211a520321035526f7",
33
33
  "author": "Jesse Vincent",
34
34
  "license": "MIT",
35
35
  "licenseFile": "licenses/superpowers.txt"
@@ -58,14 +58,14 @@
58
58
  },
59
59
  "piomin-spring-boot": {
60
60
  "repo": "piomin/claude-ai-spring-boot",
61
- "commit": "cf876a1041ac4692f32422261f6d67d7f12140d5",
61
+ "commit": "647d768a5d333e15b6a50dc0e8fc41e41a330e92",
62
62
  "author": "Piotr Mińkowski",
63
63
  "license": "Apache-2.0",
64
64
  "licenseFile": "licenses/piomin-spring-boot.txt"
65
65
  },
66
66
  "everything-claude-code": {
67
67
  "repo": "affaan-m/everything-claude-code",
68
- "commit": "90606c8315ee09cafc303515c5f33024db6b9882",
68
+ "commit": "d2ef2680594f9a17526a6e1a2e18b3d242c5d17b",
69
69
  "author": "Affaan Mustafa",
70
70
  "license": "MIT",
71
71
  "licenseFile": "licenses/everything-claude-code.txt"
package/themes/README.md CHANGED
@@ -57,7 +57,9 @@ English); the others range from `imperial` (Warhammer 40k) to community voices.
57
57
  `EPI_DOCTRINES`), section intros (`INTRO_*`), the nine Rule titles (`LEX_*`),
58
58
  the twenty-three doctrine rule titles (`DOC_<PACK>_<N>`), the four pack names
59
59
  (`PACK_CRAFT`, `PACK_RIGOR`, `PACK_OPS`, `PACK_PROCESS`), capability
60
- descriptions (`DESC_*`), and `ROAST_PERSONA`.
60
+ descriptions (`DESC_*`), and `ROAST_PERSONA`. A skill's `DESC_*` opens its
61
+ body; the `description:` a host lists is the theme-neutral line in
62
+ `src/skill-descriptions.json`, the same in every theme.
61
63
  - **Themed nouns** — `ONTOLOGY`, `LAW(S)`, `DOCTRINE(S)`, `AGENT(S)`, `SKILL(S)`,
62
64
  `MEMORY`, `NOTEBOOK`, `VAULT`, `WIKI`. These read in your voice but must stay
63
65
  nouns the prose can use. ⚠ `LAW` and `DOCTRINE` must each be a **single word** —
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{n as i,t as a}from"./usePoll-D5c_qIFZ.js";import{t as o}from"./DataTable-b9zTShqJ.js";var s=e(t(),1),c={x:260,y:190},l=110,u=28,d=14,f=44,p=e=>e*Math.PI/180,m=e=>Math.round(e*10)/10,h=(e,t=l,n=c)=>({x:m(n.x+t*Math.cos(p(e))),y:m(n.y+t*Math.sin(p(e)))}),g=e=>e/l*(180/Math.PI)+3,_=(e,t,n,r=0)=>`M${t.x},${t.y} A${e},${e} 0 ${r} 1 ${n.x},${n.y}`,v=m(h(205).x-6),y=e=>e.length*6.4,b=e=>({x:e.x-y(e.name)/2,y:e.y-7,w:y(e.name),h:14}),x=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,S=(e,t)=>e.some((n,r)=>[...e.slice(r+1),...t.filter(e=>!e.gate)].some(e=>x(b(n),b(e))));function C(e){return e?.gate===`human`?e.gateOn?.length?`Human gate on ${e.gateOn.join(`, `)}`:`Human gate`:null}function w(e,t=[]){let n=T(e,t,0);if(n.mode!==`ring`)return n;let r=Math.min(...n.entry.map(e=>e.y-30),...n.nodes.map(e=>e.y-e.r-12),...n.inner.map(e=>e.cy-e.r-12),...n.exit?[n.exit.y-24]:[]);return r<0?T(e,t,Math.ceil(-r)):n}function T(e,t,n){let r={x:c.x,y:c.y+n},i=(e,t=l)=>h(e,t,r),a=e=>t.find(t=>t.name===e),o=e=>a(e)?.effect??null,s=e=>C(a(e)),p=e.loops||[],v=p.find(e=>e.iteration);if(!v||v.nodes.length>8)return E(e,o,s);let b=Math.max(...e.nodes.map(e=>p.filter(t=>t.nodes.includes(e)).length)),x=p.filter(e=>e!==v);if(b>3||x.some(e=>!e.nodes.every(e=>v.nodes.includes(e))))return E(e,o,s);let w=v.nodes[0],T=new Set(e.edges.filter(e=>e.to===w).map(e=>e.from)),D=new Map;for(let e of[...x].sort((e,t)=>e.nodes.length-t.nodes.length))for(let t of e.nodes.slice(1))t!==w&&!T.has(t)&&!D.has(t)&&D.set(t,e);let O=v.nodes.filter(e=>!D.has(e));if(O.length<2||x.some(e=>D.has(e.nodes[0])))return E(e,o,s);let k=360/O.length,A=O.map((e,t)=>({name:e,a:-90+t*k,r:u})),j=A.findIndex(e=>o(e.name)===`mutate`);j>=0&&A.splice(j,0,{name:`validate`,a:A[j].a-k/2,r:d,gate:!0});let M=A.map(e=>({name:e.name,...i(e.a),r:e.r,effect:e.gate?null:o(e.name),gate:!!e.gate,inner:!1,human:e.gate?null:s(e.name)})),N=A.map((e,t)=>{let n=A[(t+1)%A.length],r=(t+1===A.length?n.a+360:n.a)-g(n.r)-2,a=e.a+g(e.r);return{d:_(l,i(a),i(r),+(r-a>180)),kind:`ring`}}),P=[],F=new Map;for(let e of x)F.set(e.nodes[0],[...F.get(e.nodes[0])||[],e]);for(let[e,t]of F){let n=A.find(t=>t.name===e),r=i(n.a),a=t.length>1;t.sort((e,t)=>e.nodes.length-t.nodes.length).forEach((e,t)=>{let d=i(n.a+(a?t?18:-18:0),l+(a?54:44)),p=Math.atan2(d.y-r.y,d.x-r.x)*(180/Math.PI),g=e.nodes.filter(t=>D.get(t)===e),v=e=>g.map((t,n)=>({name:t,...h(p+(n-(g.length-1)/2)*e,f,d)})),y=105;for(;y<150&&S(v(y),M);)y+=5;v(y).forEach(({name:e,...t})=>{M.push({name:e,...t,r:u,effect:o(e),gate:!1,inner:!0,human:s(e)})});let b=p+180;N.push({d:_(f,h(b+42,f,d),h(b+138,f,d)),kind:`inner`}),N.push({d:_(f,h(b+222,f,d),h(b+318,f,d)),kind:`inner`});let x=`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)} · max ${e.max}`,C={lx:d.x,ly:d.y+f+20,anchor:`middle`};if(a){let e=d.x>=c.x,t=Math.max(f,...g.map(e=>{let t=M.find(t=>t.name===e);return Math.abs(t.x-d.x)+u}));C={lx:m(d.x+(e?t+8:-t-8)),ly:m(d.y+4),anchor:e?`start`:`end`}}P.push({loop:e.name,cx:d.x,cy:d.y,r:f,label:x,...C})})}let I=i(205).y,L=e.nodes.filter(e=>!v.nodes.includes(e)),R=L.map((e,t)=>({name:e,x:40,y:m(I-44*(L.length-1-t)),human:s(e)})),z=e.edges.find(e=>e.to===`$close`)?.from,B=M.find(e=>e.name===z),V=B?{from:z,x:B.x+200,y:B.y-30,d:`M${B.x+u},${B.y-6} C${B.x+90},${B.y-40} ${B.x+170},${B.y-40} ${B.x+200},${B.y-30}`}:null,H=Math.max(540,...M.map(e=>e.x+e.r+8),...V?[V.x+6+y(`close`)+8]:[],...P.map(e=>e.cx+e.r+8),...P.map(e=>e.anchor===`start`?e.lx+y(e.label)+8:e.lx+y(e.label)/2+8)),U=Math.max(300,...M.map(e=>e.y+e.r+12),...P.map(e=>Math.max(e.cy+e.r,e.ly)+12));return{mode:`ring`,width:Math.ceil(H),height:Math.ceil(U),center:{x:r.x,y:r.y,r:l},nodes:M,arcs:N,inner:P,entry:R,exit:V}}function E(e,t,n){let r=e.loops||[],i=e=>36+16*r.filter(t=>t!==e&&t.nodes.every(t=>e.nodes.includes(t))).length,a=Math.max(u,...r.map(i))+30,o=new Map(e.nodes.map((e,t)=>[e,60+t*100])),s=e.nodes.map(e=>({name:e,x:o.get(e),y:a,r:u,effect:t(e),gate:!1,inner:!1,human:n(e)})),c=e.nodes.slice(1).map((t,n)=>({d:`M${o.get(e.nodes[n])+u},${a} L${o.get(t)-u-4},${a}`,kind:`flow`})),l=r.map(e=>{let t=i(e),n=Math.min(...e.nodes.map(e=>o.get(e))),r=Math.max(...e.nodes.map(e=>o.get(e))),s={x:n-t,y:a-t,w:r-n+2*t,h:2*t};return c.push({d:`M${r},${s.y+s.h} L${n+4},${s.y+s.h}`,kind:`flow`}),{loop:e.name,label:`${e.name} · max ${e.max}`,box:s}});return{mode:`flow`,width:60+e.nodes.length*100,height:2*a,center:null,nodes:s,arcs:c,inner:l,entry:[],exit:null}}var D=n();function O({x:e,y:t,label:n}){return(0,D.jsxs)(`g`,{className:`lr-human`,children:[(0,D.jsx)(`title`,{children:n}),(0,D.jsx)(`circle`,{cx:e,cy:t,r:`9`}),(0,D.jsx)(`circle`,{cx:e,cy:t-2.4,r:`2.6`,className:`lr-human-fig`}),(0,D.jsx)(`path`,{d:`M${e-4.6},${t+5.6} a4.6,4.6 0 0 1 9.2,0 Z`,className:`lr-human-fig`})]})}function k({graph:e,bricks:t,onSelect:n,highlight:r}){let i=w(e,t),a=(e.loops||[]).find(e=>e.iteration),o=e=>`${e.name} brick${e.human?`, ${e.human.toLowerCase()}`:``}`,s=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n?.(e))};return(0,D.jsxs)(`svg`,{className:`loop-ring`,viewBox:`0 0 ${i.width} ${i.height}`,style:{"--loop-w":`${i.width}px`},role:`group`,"aria-label":`${e.name} loop: ${e.nodes.join(`, `)}`,children:[(0,D.jsx)(`defs`,{children:[`ring`,`inner`,`flow`].map(e=>(0,D.jsx)(`marker`,{id:`lr-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,D.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`lr-head-${e}`})},e))}),i.mode===`ring`&&i.inner.map(e=>(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,className:`lr-inner`}),(0,D.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.mode===`flow`&&i.inner.map(e=>(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`rect`,{x:e.box.x,y:e.box.y,width:e.box.w,height:e.box.h,rx:`14`,className:`lr-box`}),(0,D.jsx)(`text`,{x:e.box.x+10,y:e.box.y-6,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.arcs.map((e,t)=>(0,D.jsx)(`path`,{d:e.d,className:`lr-${e.kind}`,markerEnd:`url(#lr-arrow-${e.kind})`},t)),i.entry.length>0&&(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`path`,{d:`M40,${i.entry.at(-1).y} L${v},${i.entry.at(-1).y}`,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),i.entry.map(e=>(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`text`,{x:e.x,y:e.y-10,className:`lr-lbl`,children:e.name}),(0,D.jsx)(`text`,{x:e.x,y:e.y+18,className:`lr-sub`,children:`setup · 1×`}),e.human?(0,D.jsx)(O,{x:e.x-14,y:e.y-14,label:e.human}):null]},e.name))]}),i.nodes.map(e=>e.gate?(0,D.jsxs)(`g`,{className:`lr-gate`,children:[(0,D.jsx)(`title`,{children:`validate — the engine scores the change before the first mutate step`}),(0,D.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,D.jsx)(`text`,{x:e.x,y:e.y+5,textAnchor:`middle`,children:`⛨`}),(0,D.jsx)(`text`,{x:e.x+20,y:e.y-10,className:`lr-sub lr-warn`,children:`validate`})]},e.name):(0,D.jsxs)(`g`,{className:`lr-node${e.inner?` inner`:``}${e.effect===`mutate`?` mutate`:``}${e.name===r?` current`:``}`,"aria-current":e.name===r?`step`:void 0,...n?{role:`button`,tabIndex:0,"aria-label":o(e),onClick:s(e.name),onKeyDown:s(e.name)}:{role:`img`,"aria-label":`${o(e)}${e.name===r?`, current step`:``}`},children:[(0,D.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,D.jsx)(`text`,{x:e.x,y:e.y+4,textAnchor:`middle`,children:e.name}),e.human?(0,D.jsx)(O,{x:e.x+e.r*.74,y:e.y-e.r*.74,label:e.human}):null]},e.name)),i.exit&&(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`path`,{d:i.exit.d,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),(0,D.jsx)(`text`,{x:i.exit.x+6,y:i.exit.y+4,className:`lr-lbl`,children:`close`}),(0,D.jsx)(`text`,{x:i.exit.x-90,y:i.exit.y-10,textAnchor:`middle`,className:`lr-sub`,children:`done`})]}),i.center&&a&&(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`text`,{x:i.center.x,y:i.center.y-4,textAnchor:`middle`,className:`lr-title`,children:e.name}),(0,D.jsxs)(`text`,{x:i.center.x,y:i.center.y+16,textAnchor:`middle`,className:`lr-sub lr-acc`,children:[`iterations · max `,a.max]})]})]})}var A=5e3,j=[`prudent`,`balanced`,`aggressive`],M={running:`acc`,awaiting:`warn`,unreadable:`bad`},N=e=>!!e.graph;function P(){let[e,t]=(0,s.useState)(null),[n,o]=(0,s.useState)(null),[c,l]=(0,s.useState)(null),[u,d]=(0,s.useState)(0);return i(e=>r.activeLoops().then(n=>e()&&(t(a(n)),o(null)),t=>e()&&o(t.message)),A,[u]),{loops:e?.loops??null,error:c||n,onPreset:(e,t)=>(l(null),r.setLoopPreset(e,t).then(()=>d(e=>e+1),e=>l(e.message)))}}var F=e=>({key:e,label:e,align:`right`,render:t=>(0,D.jsx)(`span`,{className:`num`,children:t[e]})}),I=[F(`iteration`),{key:`intent`,label:`intent`},F(`declared`),F(`actual`),{key:`decision`,label:`decision`},{key:`tests`,label:`tests`}];function L({history:e}){return e.length?(0,D.jsx)(`div`,{className:`loop-history`,children:(0,D.jsx)(o,{caption:`Iterations`,captionHidden:!0,columns:I,rows:e,rowKey:e=>e.iteration})}):(0,D.jsx)(`p`,{className:`panel-note`,children:`No iteration finished yet.`})}function R({loop:e,bricks:t,onPreset:n}){let r=N(e)?(e.graph.loops||[]).find(e=>e.iteration):null,[i,a]=(0,s.useState)(!1);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Active loop`}),(0,D.jsx)(`span`,{className:`tag${M[e.status]?` ${M[e.status]}`:``}`,children:e.status})]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.branch,` · `,e.root]}),N(e)?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`p`,{className:`reader-lede`,children:[`Iteration `,e.iteration,r?` / ${r.max}`:``,` · at `,e.node]}),e.awaiting?(0,D.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,D.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind,e.awaiting.kind===`gate`?` at ${e.awaiting.node}`:``]}),` `,`— Answer in the agent's session.`]}):null,(0,D.jsxs)(`label`,{className:`panel-note loop-run-preset`,children:[`preset`,(0,D.jsx)(`select`,{className:`sel`,"aria-label":`Preset for ${e.title}`,value:e.preset,disabled:i,onChange:t=>{a(!0),Promise.resolve(n(e.root,t.target.value)).finally(()=>a(!1))},children:j.map(e=>(0,D.jsx)(`option`,{children:e},e))})]}),(0,D.jsx)(`a`,{href:`#/docs/loop-risk`,children:`What presets mean →`}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsx)(`div`,{className:`loop-graph`,children:(0,D.jsx)(k,{graph:e.graph,bricks:t,highlight:e.node})}),(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Iterations`}),(0,D.jsx)(L,{history:e.history})]}):(0,D.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its LOOP.md cannot be read, so there is no state to show.`:`Its LOOP.md is gone: the loop closed and its state went with it.`})]})}export{O as a,w as c,P as i,M as n,k as o,N as r,C as s,R as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{n as i,t as a}from"./usePoll-D5c_qIFZ.js";import{t as o}from"./DataTable-b9zTShqJ.js";var s=e(t(),1),c={x:260,y:190},l=110,u=28,d=14,f=44,p=e=>e*Math.PI/180,m=e=>Math.round(e*10)/10,h=(e,t=l,n=c)=>({x:m(n.x+t*Math.cos(p(e))),y:m(n.y+t*Math.sin(p(e)))}),g=e=>e/l*(180/Math.PI)+3,_=(e,t,n,r=0)=>`M${t.x},${t.y} A${e},${e} 0 ${r} 1 ${n.x},${n.y}`,v=m(h(205).x-6),y=e=>e.length*6.4,b=e=>({x:e.x-y(e.name)/2,y:e.y-7,w:y(e.name),h:14}),x=(e,t)=>e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h,S=(e,t)=>e.some((n,r)=>[...e.slice(r+1),...t.filter(e=>!e.gate)].some(e=>x(b(n),b(e))));function C(e){return e?.gate===`human`?e.gateOn?.length?`Human gate on ${e.gateOn.join(`, `)}`:`Human gate`:null}function w(e,t=[]){let n=T(e,t,0);if(n.mode!==`ring`)return n;let r=Math.min(...n.entry.map(e=>e.y-30),...n.nodes.map(e=>e.y-e.r-12),...n.inner.map(e=>e.cy-e.r-12),...n.exit?[n.exit.y-24]:[]);return r<0?T(e,t,Math.ceil(-r)):n}function T(e,t,n){let r={x:c.x,y:c.y+n},i=(e,t=l)=>h(e,t,r),a=e=>t.find(t=>t.name===e),o=e=>a(e)?.effect??null,s=e=>C(a(e)),p=e.loops||[],v=p.find(e=>e.iteration);if(!v||v.nodes.length>8)return E(e,o,s);let b=Math.max(...e.nodes.map(e=>p.filter(t=>t.nodes.includes(e)).length)),x=p.filter(e=>e!==v);if(b>3||x.some(e=>!e.nodes.every(e=>v.nodes.includes(e))))return E(e,o,s);let w=v.nodes[0],T=new Set(e.edges.filter(e=>e.to===w).map(e=>e.from)),D=new Map;for(let e of[...x].sort((e,t)=>e.nodes.length-t.nodes.length))for(let t of e.nodes.slice(1))t!==w&&!T.has(t)&&!D.has(t)&&D.set(t,e);let O=v.nodes.filter(e=>!D.has(e));if(O.length<2||x.some(e=>D.has(e.nodes[0])))return E(e,o,s);let k=360/O.length,A=O.map((e,t)=>({name:e,a:-90+t*k,r:u})),j=A.findIndex(e=>o(e.name)===`mutate`);j>=0&&A.splice(j,0,{name:`validate`,a:A[j].a-k/2,r:d,gate:!0});let M=A.map(e=>({name:e.name,...i(e.a),r:e.r,effect:e.gate?null:o(e.name),gate:!!e.gate,inner:!1,human:e.gate?null:s(e.name)})),N=A.map((e,t)=>{let n=A[(t+1)%A.length],r=(t+1===A.length?n.a+360:n.a)-g(n.r)-2,a=e.a+g(e.r);return{d:_(l,i(a),i(r),+(r-a>180)),kind:`ring`}}),P=[],F=new Map;for(let e of x)F.set(e.nodes[0],[...F.get(e.nodes[0])||[],e]);for(let[e,t]of F){let n=A.find(t=>t.name===e),r=i(n.a),a=t.length>1;t.sort((e,t)=>e.nodes.length-t.nodes.length).forEach((e,t)=>{let d=i(n.a+(a?t?18:-18:0),l+(a?54:44)),p=Math.atan2(d.y-r.y,d.x-r.x)*(180/Math.PI),g=e.nodes.filter(t=>D.get(t)===e),v=e=>g.map((t,n)=>({name:t,...h(p+(n-(g.length-1)/2)*e,f,d)})),y=105;for(;y<150&&S(v(y),M);)y+=5;v(y).forEach(({name:e,...t})=>{M.push({name:e,...t,r:u,effect:o(e),gate:!1,inner:!0,human:s(e)})});let b=p+180;N.push({d:_(f,h(b+42,f,d),h(b+138,f,d)),kind:`inner`}),N.push({d:_(f,h(b+222,f,d),h(b+318,f,d)),kind:`inner`});let x=`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)} · max ${e.max}`,C={lx:d.x,ly:d.y+f+20,anchor:`middle`};if(a){let e=d.x>=c.x,t=Math.max(f,...g.map(e=>{let t=M.find(t=>t.name===e);return Math.abs(t.x-d.x)+u}));C={lx:m(d.x+(e?t+8:-t-8)),ly:m(d.y+4),anchor:e?`start`:`end`}}P.push({loop:e.name,cx:d.x,cy:d.y,r:f,label:x,...C})})}let I=i(205).y,L=e.nodes.filter(e=>!v.nodes.includes(e)),R=L.map((e,t)=>({name:e,x:40,y:m(I-44*(L.length-1-t)),human:s(e)})),z=e.edges.find(e=>e.to===`$close`)?.from,B=M.find(e=>e.name===z),V=B?{from:z,x:B.x+200,y:B.y-30,d:`M${B.x+u},${B.y-6} C${B.x+90},${B.y-40} ${B.x+170},${B.y-40} ${B.x+200},${B.y-30}`}:null,H=Math.max(540,...M.map(e=>e.x+e.r+8),...V?[V.x+6+y(`close`)+8]:[],...P.map(e=>e.cx+e.r+8),...P.map(e=>e.anchor===`start`?e.lx+y(e.label)+8:e.lx+y(e.label)/2+8)),U=Math.max(300,...M.map(e=>e.y+e.r+12),...P.map(e=>Math.max(e.cy+e.r,e.ly)+12));return{mode:`ring`,width:Math.ceil(H),height:Math.ceil(U),center:{x:r.x,y:r.y,r:l},nodes:M,arcs:N,inner:P,entry:R,exit:V}}function E(e,t,n){let r=e.loops||[],i=e=>36+16*r.filter(t=>t!==e&&t.nodes.every(t=>e.nodes.includes(t))).length,a=Math.max(u,...r.map(i))+30,o=new Map(e.nodes.map((e,t)=>[e,60+t*100])),s=e.nodes.map(e=>({name:e,x:o.get(e),y:a,r:u,effect:t(e),gate:!1,inner:!1,human:n(e)})),c=e.nodes.slice(1).map((t,n)=>({d:`M${o.get(e.nodes[n])+u},${a} L${o.get(t)-u-4},${a}`,kind:`flow`})),l=r.map(e=>{let t=i(e),n=Math.min(...e.nodes.map(e=>o.get(e))),r=Math.max(...e.nodes.map(e=>o.get(e))),s={x:n-t,y:a-t,w:r-n+2*t,h:2*t};return c.push({d:`M${r},${s.y+s.h} L${n+4},${s.y+s.h}`,kind:`flow`}),{loop:e.name,label:`${e.name} · max ${e.max}`,box:s}});return{mode:`flow`,width:60+e.nodes.length*100,height:2*a,center:null,nodes:s,arcs:c,inner:l,entry:[],exit:null}}var D=n();function O({x:e,y:t,label:n}){return(0,D.jsxs)(`g`,{className:`lr-human`,children:[(0,D.jsx)(`title`,{children:n}),(0,D.jsx)(`circle`,{cx:e,cy:t,r:`9`}),(0,D.jsx)(`circle`,{cx:e,cy:t-2.4,r:`2.6`,className:`lr-human-fig`}),(0,D.jsx)(`path`,{d:`M${e-4.6},${t+5.6} a4.6,4.6 0 0 1 9.2,0 Z`,className:`lr-human-fig`})]})}function k({graph:e,bricks:t,onSelect:n,highlight:r}){let i=w(e,t),a=(e.loops||[]).find(e=>e.iteration),o=e=>`${e.name} brick${e.human?`, ${e.human.toLowerCase()}`:``}`,s=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n?.(e))};return(0,D.jsxs)(`svg`,{className:`loop-ring`,viewBox:`0 0 ${i.width} ${i.height}`,style:{"--loop-w":`${i.width}px`},role:`group`,"aria-label":`${e.name} loop: ${e.nodes.join(`, `)}`,children:[(0,D.jsx)(`defs`,{children:[`ring`,`inner`,`flow`].map(e=>(0,D.jsx)(`marker`,{id:`lr-arrow-${e}`,markerWidth:`10`,markerHeight:`10`,refX:`7`,refY:`4`,orient:`auto`,children:(0,D.jsx)(`path`,{d:`M0,0 L8,4 L0,8 Z`,className:`lr-head-${e}`})},e))}),i.mode===`ring`&&i.inner.map(e=>(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`circle`,{cx:e.cx,cy:e.cy,r:e.r,className:`lr-inner`}),(0,D.jsx)(`text`,{x:e.lx,y:e.ly,textAnchor:e.anchor,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.mode===`flow`&&i.inner.map(e=>(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`rect`,{x:e.box.x,y:e.box.y,width:e.box.w,height:e.box.h,rx:`14`,className:`lr-box`}),(0,D.jsx)(`text`,{x:e.box.x+10,y:e.box.y-6,className:`lr-sub lr-good`,children:e.label})]},e.loop)),i.arcs.map((e,t)=>(0,D.jsx)(`path`,{d:e.d,className:`lr-${e.kind}`,markerEnd:`url(#lr-arrow-${e.kind})`},t)),i.entry.length>0&&(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`path`,{d:`M40,${i.entry.at(-1).y} L${v},${i.entry.at(-1).y}`,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),i.entry.map(e=>(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`text`,{x:e.x,y:e.y-10,className:`lr-lbl`,children:e.name}),(0,D.jsx)(`text`,{x:e.x,y:e.y+18,className:`lr-sub`,children:`setup · 1×`}),e.human?(0,D.jsx)(O,{x:e.x-14,y:e.y-14,label:e.human}):null]},e.name))]}),i.nodes.map(e=>e.gate?(0,D.jsxs)(`g`,{className:`lr-gate`,children:[(0,D.jsx)(`title`,{children:`validate — the engine scores the change before the first mutate step`}),(0,D.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,D.jsx)(`text`,{x:e.x,y:e.y+5,textAnchor:`middle`,children:`⛨`}),(0,D.jsx)(`text`,{x:e.x+20,y:e.y-10,className:`lr-sub lr-warn`,children:`validate`})]},e.name):(0,D.jsxs)(`g`,{className:`lr-node${e.inner?` inner`:``}${e.effect===`mutate`?` mutate`:``}${e.name===r?` current`:``}`,"aria-current":e.name===r?`step`:void 0,...n?{role:`button`,tabIndex:0,"aria-label":o(e),onClick:s(e.name),onKeyDown:s(e.name)}:{role:`img`,"aria-label":`${o(e)}${e.name===r?`, current step`:``}`},children:[(0,D.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r}),(0,D.jsx)(`text`,{x:e.x,y:e.y+4,textAnchor:`middle`,children:e.name}),e.human?(0,D.jsx)(O,{x:e.x+e.r*.74,y:e.y-e.r*.74,label:e.human}):null]},e.name)),i.exit&&(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`path`,{d:i.exit.d,className:`lr-flow`,markerEnd:`url(#lr-arrow-flow)`}),(0,D.jsx)(`text`,{x:i.exit.x+6,y:i.exit.y+4,className:`lr-lbl`,children:`close`}),(0,D.jsx)(`text`,{x:i.exit.x-90,y:i.exit.y-10,textAnchor:`middle`,className:`lr-sub`,children:`done`})]}),i.center&&a&&(0,D.jsxs)(`g`,{children:[(0,D.jsx)(`text`,{x:i.center.x,y:i.center.y-4,textAnchor:`middle`,className:`lr-title`,children:e.name}),(0,D.jsxs)(`text`,{x:i.center.x,y:i.center.y+16,textAnchor:`middle`,className:`lr-sub lr-acc`,children:[`iterations · max `,a.max]})]})]})}var A=5e3,j=[`prudent`,`balanced`,`aggressive`],M={running:`acc`,awaiting:`warn`,unreadable:`bad`},N=e=>!!e.graph;function P(){let[e,t]=(0,s.useState)(null),[n,o]=(0,s.useState)(null),[c,l]=(0,s.useState)(null),[u,d]=(0,s.useState)(0);return i(e=>r.activeLoops().then(n=>e()&&(t(a(n)),o(null)),t=>e()&&o(t.message)),A,[u]),{loops:e?.loops??null,error:c||n,onPreset:(e,t)=>(l(null),r.setLoopPreset(e,t).then(()=>d(e=>e+1),e=>l(e.message)))}}var F=e=>({key:e,label:e,align:`right`,render:t=>(0,D.jsx)(`span`,{className:`num`,children:t[e]})}),I=[F(`iteration`),{key:`intent`,label:`intent`},F(`declared`),F(`actual`),{key:`decision`,label:`decision`},{key:`tests`,label:`tests`}];function L({history:e}){return e.length?(0,D.jsx)(`div`,{className:`loop-history`,children:(0,D.jsx)(o,{caption:`Iterations`,captionHidden:!0,columns:I,rows:e,rowKey:e=>e.iteration})}):(0,D.jsx)(`p`,{className:`panel-note`,children:`No iteration finished yet.`})}function R({loop:e,bricks:t,onPreset:n}){let r=N(e)?(e.graph.loops||[]).find(e=>e.iteration):null,[i,a]=(0,s.useState)(!1);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Active loop`}),(0,D.jsx)(`span`,{className:`tag${M[e.status]?` ${M[e.status]}`:``}`,children:e.status})]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.title}),(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[e.branch,` · `,e.root]}),N(e)?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`p`,{className:`reader-lede`,children:[`Iteration `,e.iteration,r?` / ${r.max}`:``,` · at `,e.node]}),e.awaiting?(0,D.jsxs)(`p`,{className:`loop-run-wait t-warn`,children:[(0,D.jsxs)(`b`,{children:[`Awaiting `,e.awaiting.kind,e.awaiting.kind===`gate`?` at ${e.awaiting.node}`:``]}),` `,`— Answer in the agent's session.`]}):null,(0,D.jsxs)(`label`,{className:`panel-note loop-run-preset`,children:[`preset`,(0,D.jsx)(`select`,{className:`sel`,"aria-label":`Preset for ${e.title}`,value:e.preset,disabled:i,onChange:t=>{a(!0),Promise.resolve(n(e.root,t.target.value)).finally(()=>a(!1))},children:j.map(e=>(0,D.jsx)(`option`,{children:e},e))})]}),(0,D.jsx)(`a`,{href:`#/docs/loop-risk`,children:`What presets mean →`}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsx)(`div`,{className:`loop-graph`,children:(0,D.jsx)(k,{graph:e.graph,bricks:t,highlight:e.node})}),(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Iterations`}),(0,D.jsx)(L,{history:e.history})]}):(0,D.jsx)(`p`,{className:`reader-lede`,children:e.status===`unreadable`?`Its LOOP.md cannot be read, so there is no state to show.`:`Its LOOP.md is gone: the loop closed and its state went with it.`})]})}export{O as a,w as c,P as i,M as n,k as o,N as r,C as s,R as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{A as i,D as a,E as o,F as s,H as c,L as l,M as u,N as d,O as f,P as p,St as m,T as h,_t as g,et as _,j as v,o as ee,rt as te,tt as y,w as b,wt as x}from"./index-BL3P-9Rg.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 ne,n as j,o as M,p as N,r as P,s as F,t as I,u as L,v as R}from"./Bonsai-CBWDTBA4.js";import{s as re}from"./motion-RlUl1osO.js";import{n as ie,t as ae}from"./usePoll-D5c_qIFZ.js";var z=e(t(),1),B=n(),V=4,H=56*V,U=24,W=165,G=188,K=(e,t)=>e>0?Math.max(1,Math.floor((e-32+U)/(H+U))):Math.max(1,t),q=e=>e.status===`blocked`?`bad`:u(e)?`warn`:e.status===`busy`?`ok`:``,J=e=>{let t=A(e);return t==null?null:Math.round(t*100)};function Y(e,t,n){let r=b[e.status]||b.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=J(e);return[`${e.title||f(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 X({s:e,t,mine:n}){let r=J(e);return(0,B.jsxs)(`div`,{className:`card gd-card`,children:[(0,B.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`model`}),(0,B.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,B.jsx)(`dt`,{children:`turns`}),(0,B.jsx)(`dd`,{children:e.turns||0}),(0,B.jsx)(`dt`,{children:`context`}),(0,B.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,B.jsx)(`dt`,{children:`compactions`}),(0,B.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,B.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,B.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=R(e,n),s=(0,z.useMemo)(()=>E(e,{sakura:n}),[o]),c=b[e.status]||b.idle,l=Array.isArray(e.loops)?e.loops[0]:null,d=e.status!==`idle`,p=F(e),m=e.title||f(e.cwd)||e.session_id,h=J(e),g=(0,z.useRef)(null),_=(0,z.useCallback)(e=>a(p,e,Q(g.current)),[a,p]);return(0,B.jsxs)(`a`,{ref:g,className:`gd-tree${u(e)?` gd-needs`:``}`,href:e.href||L(e.session_id),"aria-label":Y(e,s,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,s.pads.length,i,_),children:[(0,B.jsx)(P,{t:s,pad:i,swaying:d,onPad:_,px:V}),(0,B.jsxs)(`div`,{className:`gd-cap`,children:[(0,B.jsx)(`div`,{className:`gd-title`,title:m,children:m}),(0,B.jsxs)(`div`,{className:`row wrap gd-pills`,children:[(0,B.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip||e.host||`?`}),(0,B.jsx)(`span`,{className:`badge ${q(e)}`,children:c.label}),t&&(0,B.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),l&&(0,B.jsxs)(`span`,{className:`badge`,children:[`↻ `,l.title,l.iteration==null?``:` ${l.iteration}`]}),e.attribution===!1&&(0,B.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`})]}),(0,B.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*H+(t-1)*U,r=e=>e*(H+U)+H/2;return(0,B.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*V+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,B.jsxs)(`g`,{className:o,children:[(0,B.jsx)(`path`,{d:`M${e} ${W} C${n} 179 ${n} 159 ${t} 169`}),(0,B.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${W}`})]},`${i}-${a}`)}return(0,B.jsx)(`g`,{className:o,children:(0,B.jsx)(`path`,{d:`M${r(i)} ${G} Q${(r(i)+r(a))/2} 222 ${r(a)} ${G}`})},`${i}-${a}`)})})}var Q=e=>e.offsetLeft;function se({sessions:e,collisions:t}){let[n,r]=(0,z.useState)(M),[i,a]=(0,z.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(j,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=T(N(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>D(e,s);return(0,B.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,B.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,B.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,B.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Pink blossom`})]}),l.length>0&&(0,B.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,B.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,B.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,z.useState)({sid:null,pad:null,x:0}),o=(0,z.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(0);(0,z.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=K(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=>F(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,B.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,B.jsxs)(`div`,{className:`gd-row`,children:[(0,B.jsx)(`div`,{className:`gd-plank`,children:n===0&&(0,B.jsxs)(`h3`,{className:`gd-plate`,children:[e.name,` · `,_,` session`,_===1?``:`s`]})}),a.map(({s:e,worktree:n})=>(0,B.jsx)(Z,{s:e,worktree:n,sakura:t,mine:r(F(e)),pad:F(e)===i.sid?i.pad:null,onHover:o},F(e))),(0,B.jsx)(oe,{pairs:c,count:a.length}),m&&p>=n&&p<s&&(0,B.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:g?(0,B.jsx)(I,{pad:g}):(0,B.jsx)(X,{s:m,t:h,mine:r(F(m))})})]},n)}),(0,B.jsx)(`span`,{className:`sr-only`,role:`status`,children:w(g)})]})}var $=e=>e.catch(()=>null);function le({s:e}){let t=(0,z.useId)(),n=e.todos,r=v(e);return(0,B.jsxs)(`a`,{className:`card pad-md act-card`,href:e.href||L(e.session_id),"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,B.jsxs)(h,{s:e,id:t,heading:e.title||f(e.cwd)||e.session_id,children:[e.chip&&(0,B.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip}),(0,B.jsx)(g,{name:`chevron`,className:`glyph act-chev`})]}),n&&n.total>0&&(0,B.jsx)(`div`,{className:`act-foot`,children:(0,B.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,B.jsx)(a,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,B.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,m(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(u),r=e.current;return e.current=new Set(n.map(e=>`${F(e)}:${e.status}`)),r?n.filter(e=>!r.has(`${F(e)}:${e.status}`)).map(e=>`${e.title||f(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=ne(t);return(0,B.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,B.jsx)(g,{name:`activity`,className:`glyph act-fixed`}),(0,B.jsxs)(`div`,{className:`act-grow`,children:[(0,B.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,B.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,B.jsxs)(`ul`,{className:`stack gap-8 act-fixed act-sm`,"aria-label":`Tracking per install`,children:[t.length===0&&(0,B.jsx)(`li`,{className:`dim`,children:`No active install to track.`}),t.map((e,t)=>(0,B.jsxs)(`li`,{className:`row gap-10`,children:[(0,B.jsxs)(`span`,{id:`act-track-l${t}`,title:e.path,children:[`Track live sessions in `,(0,B.jsx)(`span`,{className:`mono`,children:r.get(e.install)})]}),(0,B.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=s(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),c=r.find(e=>!e.nodata),l=r.some(e=>e.nodata),u=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${p(e.key)}`).join(`, `)||`none`}.`+(l?c?` Days before ${p(c.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,B.jsxs)(`div`,{className:`act-stat-head`,children:[(0,B.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,B.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,B.jsx)(y,{label:`Reading the job log…`}):e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":u,ref:i,children:r.map(e=>e.nodata?(0,B.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,B.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${p(e.key)}: ${e.n}`},e.key):(0,B.jsx)(`i`,{className:`zero`},e.key))}),(0,B.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,B.jsx)(`span`,{children:p(r[0].key)}),(0,B.jsx)(`span`,{children:p(r[7].key)}),(0,B.jsx)(`span`,{children:`today`})]}),l&&(0,B.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,B.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,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,B.jsxs)(`div`,{className:`act-stat-head`,children:[(0,B.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,B.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,B.jsx)(y,{label:`Reading the gate ledger…`}):e.length?(0,B.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,B.jsx)(o,{vals:e.per_day,i:t,sweep:!0}),(0,B.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,B.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=l(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,B.jsxs)(`li`,{className:`act-row`,children:[(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:s}),(0,B.jsx)(g,{name:`play`,className:`glyph act-glyph`}),(0,B.jsxs)(`span`,{className:`act-what`,children:[(0,B.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,B.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,B.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":o,children:(0,B.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,B.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function be({gate:e}){return(0,B.jsxs)(`li`,{className:`act-row gate`,children:[(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,B.jsx)(g,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,B.jsxs)(`span`,{className:`act-what`,children:[(0,B.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,B.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,B.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,B.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,z.useState)(null),[n,a]=(0,z.useState)(``),[o,l]=(0,z.useState)(pe),[d,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(``),g=(0,z.useRef)(null),v=e=>{let t={...o,...e};l(t),me(t)};ie(e=>r.activity().then(n=>{if(e()){t(ae(n)),a(``);let e=de(g,n?.activity);e&&h(t=>t===e?e+`\xA0`:e)}},t=>{e()&&a(t.message)}),2e3,[]);let b=x(()=>$(r.jobs()),[]),C=x(()=>$(r.gates()),[]),w=x(()=>$(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=re(),A=T&&e?D.filter(u).length:null,ne=new Set(D.map(F)),j=o.v===`list`?O(e?.ended,E).filter(e=>!ne.has(F(e))):[],M=Se([...D,...j].map(e=>e.host),o.host),N=Se([...D,...j].map(e=>f(e.cwd)),o.project),P=o.host&&o.project?`host or project`:o.host?`host`:o.project?`project`:``,I=e=>(!o.host||e.host===o.host)&&(!o.project||f(e.cwd)===o.project),L=D.filter(e=>I(e)&&(o.f!==`needs`||u(e))),R=o.f===`all`||o.f===`needs`,V=o.f===`all`&&T?j.filter(I):[],H=d?V:V.slice(0,xe),U=!P&&(o.f===`all`||o.f===`runs`),W=!P&&(o.f===`all`||o.f===`gates`),G=b.data?.jobs||[],K=ee(C.data,w.data),q=i(G,K,C.data?.days).map(e=>({...e,runs:U?e.runs:[],gate:W?e.gate:null})).filter(e=>e.runs.length||e.gate),J=Math.max(0,...G.map(e=>e.duration||0)),Y=s(q.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),X=async e=>{let n=!e.enabled;try{let i=await r.activityToggle(n,{host:e.host,path:e.path});if(i.ok===!1){a(i.error||`Could not change tracking`);return}let o=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:o(t?.activity),ended:o(t?.ended)}}),a(``)}catch(e){a(e.message)}},Z=(e,t,n)=>(0,B.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,B.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,B.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:o[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>v({[e]:t.target.value}),children:[(0,B.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]});return(0,B.jsxs)(`div`,{className:`page-fill`,children:[(0,B.jsx)(c,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,B.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:m}),n&&(0,B.jsx)(`div`,{className:`act-gap`,children:(0,B.jsx)(_,{error:n})}),e&&(0,B.jsx)(he,{enabled:T,installs:E,onToggle:X}),(0,B.jsxs)(`div`,{className:`act-today`,children:[(0,B.jsx)(ge,{jobs:b.data,loading:b.loading}),(0,B.jsx)(_e,{rows:K,gates:C.data,loading:C.loading}),(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,B.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),!e&&!n?(0,B.jsx)(y,{}):e?(0,B.jsxs)(B.Fragment,{children:[T?(0,B.jsxs)(`span`,{className:`act-big act-wait`,children:[A,` `,(0,B.jsx)(`span`,{className:`dim act-sm`,children:A===1?`session`:`sessions`})]}):null,(0,B.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,B.jsx)(`p`,{className:`dim act-sm`,children:`The sessions could not be read.`})]})]}),(0,B.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,B.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:fe.map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,className:o.f===e?`chip-f on`:`chip-f`,"aria-pressed":o.f===e,onClick:()=>v({f:e}),children:[t,e===`needs`&&A>0?(0,B.jsxs)(`span`,{className:`mono`,children:[` `,A]}):null]},e))}),Z(`host`,`Host`,M),Z(`project`,`Project`,N),(0,B.jsx)(te,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,className:o.v===e?`on`:``,"aria-pressed":o.v===e,onClick:()=>v({v:e}),children:t},e))})]}),P&&o.f!==`needs`&&(0,B.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,P,`; showing sessions only.`]}),R&&(e?!T&&o.f!==`needs`?null:L.length===0?o.f===`needs`?(0,B.jsx)(S,{title:`Nothing waits on you`}):(0,B.jsx)(S,{title:`No active sessions`,children:`Start an agent session and it appears here.`}):o.v===`garden`?(0,B.jsx)(se,{sessions:L,collisions:e.collisions}):(0,B.jsx)(`div`,{className:`stack gap-12 act-live`,ref:k,children:L.map(e=>(0,B.jsx)(`div`,{"data-flip":F(e),children:(0,B.jsx)(le,{s:e})},F(e)))}):(0,B.jsx)(y,{label:`Reading live sessions…`})),V.length>0&&(0,B.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,B.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),H.map(e=>(0,B.jsx)(`div`,{children:(0,B.jsx)(le,{s:e})},F(e))),V.length>xe&&(0,B.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":d,onClick:()=>p(e=>!e),children:d?`Show fewer`:`Show all ${V.length}`})]}),o.f!==`needs`&&(0,B.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:Y,children:q.map(e=>(0,B.jsxs)(`section`,{className:`card act-day`,children:[(0,B.jsxs)(`h3`,{className:`act-day-h`,children:[(0,B.jsx)(`span`,{children:e.title}),(0,B.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,B.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,B.jsx)(ye,{job:e,longest:J},e.id)),e.gate&&(0,B.jsx)(be,{gate:e.gate})]})]},e.key))})]})}export{Ce as default};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{A as i,D as a,E as o,F as s,H as c,L as l,M as u,N as d,O as f,P as p,St as m,T as h,_t as g,et as _,j as v,o as ee,rt as te,tt as y,w as b,wt as x}from"./index-B_pTwZra.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 ne,n as j,o as M,p as N,r as P,s as F,t as I,u as L,v as R}from"./Bonsai-B5XY9pid.js";import{s as re}from"./motion-RlUl1osO.js";import{n as ie,t as ae}from"./usePoll-D5c_qIFZ.js";var z=e(t(),1),B=n(),V=4,H=56*V,U=24,W=165,G=188,K=(e,t)=>e>0?Math.max(1,Math.floor((e-32+U)/(H+U))):Math.max(1,t),q=e=>e.status===`blocked`?`bad`:u(e)?`warn`:e.status===`busy`?`ok`:``,J=e=>{let t=A(e);return t==null?null:Math.round(t*100)};function Y(e,t,n){let r=b[e.status]||b.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=J(e);return[`${e.title||f(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 X({s:e,t,mine:n}){let r=J(e);return(0,B.jsxs)(`div`,{className:`card gd-card`,children:[(0,B.jsxs)(`dl`,{className:`gd-facts`,children:[e.model&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`model`}),(0,B.jsx)(`dd`,{className:`mono`,children:e.model})]}),(0,B.jsx)(`dt`,{children:`turns`}),(0,B.jsx)(`dd`,{children:e.turns||0}),(0,B.jsx)(`dt`,{children:`context`}),(0,B.jsx)(`dd`,{children:r==null?`unknown`:`${r} %`}),(0,B.jsx)(`dt`,{children:`compactions`}),(0,B.jsx)(`dd`,{children:e.compactions||0})]}),t.fallen.length>0&&(0,B.jsxs)(`div`,{className:`dim act-xs`,children:[`finished: `,t.fallen.map(e=>`${e.type||`agent`} (${e.files.length})`).join(`, `)]}),n.map(e=>(0,B.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=R(e,n),s=(0,z.useMemo)(()=>E(e,{sakura:n}),[o]),c=b[e.status]||b.idle,l=Array.isArray(e.loops)?e.loops[0]:null,d=e.status!==`idle`,p=F(e),m=e.title||f(e.cwd)||e.session_id,h=J(e),g=(0,z.useRef)(null),_=(0,z.useCallback)(e=>a(p,e,Q(g.current)),[a,p]);return(0,B.jsxs)(`a`,{ref:g,className:`gd-tree${u(e)?` gd-needs`:``}`,href:e.href||L(e.session_id),"aria-label":Y(e,s,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,s.pads.length,i,_),children:[(0,B.jsx)(P,{t:s,pad:i,swaying:d,onPad:_,px:V}),(0,B.jsxs)(`div`,{className:`gd-cap`,children:[(0,B.jsx)(`div`,{className:`gd-title`,title:m,children:m}),(0,B.jsxs)(`div`,{className:`row wrap gd-pills`,children:[(0,B.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip||e.host||`?`}),(0,B.jsx)(`span`,{className:`badge ${q(e)}`,children:c.label}),t&&(0,B.jsxs)(`span`,{className:`badge mono`,children:[`⎇ `,t]}),l&&(0,B.jsxs)(`span`,{className:`badge`,children:[`↻ `,l.title,l.iteration==null?``:` ${l.iteration}`]}),e.attribution===!1&&(0,B.jsx)(`span`,{className:`badge`,title:`attribution unavailable on ${e.host}`,children:`no attrib.`})]}),(0,B.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*H+(t-1)*U,r=e=>e*(H+U)+H/2;return(0,B.jsx)(`svg`,{className:`gd-threads`,width:n,height:56*V+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,B.jsxs)(`g`,{className:o,children:[(0,B.jsx)(`path`,{d:`M${e} ${W} C${n} 179 ${n} 159 ${t} 169`}),(0,B.jsx)(`path`,{d:`M${e} 169 C${n} 159 ${n} 179 ${t} ${W}`})]},`${i}-${a}`)}return(0,B.jsx)(`g`,{className:o,children:(0,B.jsx)(`path`,{d:`M${r(i)} ${G} Q${(r(i)+r(a))/2} 222 ${r(a)} ${G}`})},`${i}-${a}`)})})}var Q=e=>e.offsetLeft;function se({sessions:e,collisions:t}){let[n,r]=(0,z.useState)(M),[i,a]=(0,z.useState)(()=>new Set),o=()=>{let e=!n;r(e);try{window.localStorage.setItem(j,e?`1`:`0`)}catch{}},s=Array.isArray(t)?t:[],c=T(N(e)).map(e=>i.has(e.key)?{...e,collapsed:!1}:e),l=c.filter(e=>e.collapsed),u=e=>D(e,s);return(0,B.jsxs)(`section`,{className:`gd`,"aria-label":`Garden`,children:[(0,B.jsxs)(`div`,{className:`row between wrap gap-8 gd-head`,children:[(0,B.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,B.jsx)(`button`,{type:`button`,className:n?`chip-f on`:`chip-f`,"aria-pressed":n,onClick:o,children:`Pink blossom`})]}),l.length>0&&(0,B.jsx)(`div`,{className:`row wrap gap-8 gd-chips`,role:`group`,"aria-label":`Folded shelves`,children:l.map(e=>(0,B.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,B.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,z.useState)({sid:null,pad:null,x:0}),o=(0,z.useCallback)((e,t,n)=>a(r=>({sid:e,pad:t,x:n??(r.sid===e?r.x:0)})),[]),s=(0,z.useRef)(null),[c,l]=(0,z.useState)(0);(0,z.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=K(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=>F(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,B.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,B.jsxs)(`div`,{className:`gd-row`,children:[(0,B.jsx)(`div`,{className:`gd-plank`,children:n===0&&(0,B.jsxs)(`h3`,{className:`gd-plate`,children:[e.name,` · `,_,` session`,_===1?``:`s`]})}),a.map(({s:e,worktree:n})=>(0,B.jsx)(Z,{s:e,worktree:n,sakura:t,mine:r(F(e)),pad:F(e)===i.sid?i.pad:null,onHover:o},F(e))),(0,B.jsx)(oe,{pairs:c,count:a.length}),m&&p>=n&&p<s&&(0,B.jsx)(`div`,{className:`gd-info`,"aria-hidden":`true`,style:{left:Math.max(0,i.x)},children:g?(0,B.jsx)(I,{pad:g}):(0,B.jsx)(X,{s:m,t:h,mine:r(F(m))})})]},n)}),(0,B.jsx)(`span`,{className:`sr-only`,role:`status`,children:w(g)})]})}var $=e=>e.catch(()=>null);function le({s:e}){let t=(0,z.useId)(),n=e.todos,r=v(e);return(0,B.jsxs)(`a`,{className:`card pad-md act-card`,href:e.href||L(e.session_id),"aria-labelledby":`${t}-t ${t}-st`,"aria-describedby":r?`${t}-c`:void 0,children:[(0,B.jsxs)(h,{s:e,id:t,heading:e.title||f(e.cwd)||e.session_id,children:[e.chip&&(0,B.jsx)(`span`,{className:`badge mono`,title:`The install this session runs in`,children:e.chip}),(0,B.jsx)(g,{name:`chevron`,className:`glyph act-chev`})]}),n&&n.total>0&&(0,B.jsx)(`div`,{className:`act-foot`,children:(0,B.jsxs)(`span`,{className:`row gap-8 dim act-sm`,children:[(0,B.jsx)(a,{done:n.done,total:n.total}),`plan `,n.done,`/`,n.total]})}),(0,B.jsxs)(`div`,{className:`dim mono act-updated`,children:[`updated `,m(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(u),r=e.current;return e.current=new Set(n.map(e=>`${F(e)}:${e.status}`)),r?n.filter(e=>!r.has(`${F(e)}:${e.status}`)).map(e=>`${e.title||f(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=ne(t);return(0,B.jsxs)(`section`,{className:`card pad-md act-track`,"aria-labelledby":`act-track-h`,children:[(0,B.jsx)(g,{name:`activity`,className:`glyph act-fixed`}),(0,B.jsxs)(`div`,{className:`act-grow`,children:[(0,B.jsx)(`h2`,{id:`act-track-h`,className:`act-track-title`,children:e?`Live sessions are on`:`Live sessions are off`}),!e&&(0,B.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,B.jsxs)(`ul`,{className:`stack gap-8 act-fixed act-sm`,"aria-label":`Tracking per install`,children:[t.length===0&&(0,B.jsx)(`li`,{className:`dim`,children:`No active install to track.`}),t.map((e,t)=>(0,B.jsxs)(`li`,{className:`row gap-10`,children:[(0,B.jsxs)(`span`,{id:`act-track-l${t}`,title:e.path,children:[`Track live sessions in `,(0,B.jsx)(`span`,{className:`mono`,children:r.get(e.install)})]}),(0,B.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=s(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),c=r.find(e=>!e.nodata),l=r.some(e=>e.nodata),u=`Runs per day: ${r.filter(e=>e.n).map(e=>`${e.n} on ${p(e.key)}`).join(`, `)||`none`}.`+(l?c?` Days before ${p(c.key)} are older than the runs the log keeps.`:` No run is in the log yet.`:``);return(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-runs-h`,children:[(0,B.jsxs)(`div`,{className:`act-stat-head`,children:[(0,B.jsx)(`h2`,{id:`act-runs-h`,className:`act-lbl`,children:`Runs per day · 14 days`}),e&&(0,B.jsx)(`span`,{className:`act-big`,children:o})]}),t?(0,B.jsx)(y,{label:`Reading the job log…`}):e?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`act-runs`,role:`img`,"aria-label":u,ref:i,children:r.map(e=>e.nodata?(0,B.jsx)(`i`,{className:`nodata`},e.key):e.n?(0,B.jsx)(`i`,{"data-sweep":!0,style:{height:`${e.n/a*100}%`},title:`${p(e.key)}: ${e.n}`},e.key):(0,B.jsx)(`i`,{className:`zero`},e.key))}),(0,B.jsxs)(`div`,{className:`mono act-axis`,"aria-hidden":`true`,children:[(0,B.jsx)(`span`,{children:p(r[0].key)}),(0,B.jsx)(`span`,{children:p(r[7].key)}),(0,B.jsx)(`span`,{children:`today`})]}),l&&(0,B.jsxs)(`span`,{className:`dim act-xs`,children:[`Hatched: older than the runs the log keeps`,n?` (last ${n})`:``,`.`]})]}):(0,B.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,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-gates-h`,children:[(0,B.jsxs)(`div`,{className:`act-stat-head`,children:[(0,B.jsx)(`h2`,{id:`act-gates-h`,className:`act-lbl`,children:`Gate asks by rule · 30 days`}),t&&(0,B.jsx)(`span`,{className:`act-big`,children:r})]}),n?(0,B.jsx)(y,{label:`Reading the gate ledger…`}):e.length?(0,B.jsx)(`ul`,{className:`gate-rows`,children:e.slice(0,6).map((e,t)=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{className:`act-ell`,children:[e.name,` `,(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:e.rule})]}),(0,B.jsx)(o,{vals:e.per_day,i:t,sweep:!0}),(0,B.jsx)(`span`,{className:`mono`,children:e.n})]},e.rule))}):(0,B.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=l(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,B.jsxs)(`li`,{className:`act-row`,children:[(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:s}),(0,B.jsx)(g,{name:`play`,className:`glyph act-glyph`}),(0,B.jsxs)(`span`,{className:`act-what`,children:[(0,B.jsx)(`span`,{className:`act-row-title`,children:n.verb}),n.scope&&(0,B.jsx)(`span`,{className:`dim act-xs act-ell`,title:n.command,children:n.scope})]}),(0,B.jsx)(`span`,{className:`act-dur`,role:`img`,"aria-label":o,children:(0,B.jsx)(`span`,{"data-sweep":!0,style:{width:t>0?`${(e.duration||0)/t*100}%`:`0%`}})}),(0,B.jsx)(`span`,{className:`badge ${i}`,children:a})]})}function be({gate:e}){return(0,B.jsxs)(`li`,{className:`act-row gate`,children:[(0,B.jsx)(`span`,{className:`mono dim act-xs`,children:`—`}),(0,B.jsx)(g,{name:`rule`,className:`glyph act-glyph t-warn`}),(0,B.jsxs)(`span`,{className:`act-what`,children:[(0,B.jsx)(`span`,{className:`act-row-title`,children:e.title}),(0,B.jsx)(`span`,{className:`dim act-xs`,children:`Gate ledger`})]}),(0,B.jsx)(`span`,{className:`act-dur-none`,"aria-hidden":`true`}),(0,B.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,z.useState)(null),[n,a]=(0,z.useState)(``),[o,l]=(0,z.useState)(pe),[d,p]=(0,z.useState)(!1),[m,h]=(0,z.useState)(``),g=(0,z.useRef)(null),v=e=>{let t={...o,...e};l(t),me(t)};ie(e=>r.activity().then(n=>{if(e()){t(ae(n)),a(``);let e=de(g,n?.activity);e&&h(t=>t===e?e+`\xA0`:e)}},t=>{e()&&a(t.message)}),2e3,[]);let b=x(()=>$(r.jobs()),[]),C=x(()=>$(r.gates()),[]),w=x(()=>$(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=re(),A=T&&e?D.filter(u).length:null,ne=new Set(D.map(F)),j=o.v===`list`?O(e?.ended,E).filter(e=>!ne.has(F(e))):[],M=Se([...D,...j].map(e=>e.host),o.host),N=Se([...D,...j].map(e=>f(e.cwd)),o.project),P=o.host&&o.project?`host or project`:o.host?`host`:o.project?`project`:``,I=e=>(!o.host||e.host===o.host)&&(!o.project||f(e.cwd)===o.project),L=D.filter(e=>I(e)&&(o.f!==`needs`||u(e))),R=o.f===`all`||o.f===`needs`,V=o.f===`all`&&T?j.filter(I):[],H=d?V:V.slice(0,xe),U=!P&&(o.f===`all`||o.f===`runs`),W=!P&&(o.f===`all`||o.f===`gates`),G=b.data?.jobs||[],K=ee(C.data,w.data),q=i(G,K,C.data?.days).map(e=>({...e,runs:U?e.runs:[],gate:W?e.gate:null})).filter(e=>e.runs.length||e.gate),J=Math.max(0,...G.map(e=>e.duration||0)),Y=s(q.flatMap(e=>e.runs.map(e=>`${e.id}:${e.duration}`)).join(`,`),`scaleX`),X=async e=>{let n=!e.enabled;try{let i=await r.activityToggle(n,{host:e.host,path:e.path});if(i.ok===!1){a(i.error||`Could not change tracking`);return}let o=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:o(t?.activity),ended:o(t?.ended)}}),a(``)}catch(e){a(e.message)}},Z=(e,t,n)=>(0,B.jsxs)(`span`,{className:`row gap-8 act-sm`,children:[(0,B.jsx)(`label`,{htmlFor:`act-f-${e}`,children:t}),(0,B.jsxs)(`select`,{id:`act-f-${e}`,className:`sel`,value:o[e],disabled:n.length===0,title:n.length===0?`No source carries a ${e} yet`:void 0,onChange:t=>v({[e]:t.target.value}),children:[(0,B.jsxs)(`option`,{value:``,children:[`All `,e===`host`?`hosts`:`projects`]}),n.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]})]});return(0,B.jsxs)(`div`,{className:`page-fill`,children:[(0,B.jsx)(c,{title:`Activity`,sub:`What your agents ran, what the gates asked, and which sessions are waiting on you.`}),(0,B.jsx)(`div`,{className:`sr-only`,"aria-live":`polite`,children:m}),n&&(0,B.jsx)(`div`,{className:`act-gap`,children:(0,B.jsx)(_,{error:n})}),e&&(0,B.jsx)(he,{enabled:T,installs:E,onToggle:X}),(0,B.jsxs)(`div`,{className:`act-today`,children:[(0,B.jsx)(ge,{jobs:b.data,loading:b.loading}),(0,B.jsx)(_e,{rows:K,gates:C.data,loading:C.loading}),(0,B.jsxs)(`section`,{className:`card pad-md act-stat`,"aria-labelledby":`act-wait-h`,children:[(0,B.jsx)(`h2`,{id:`act-wait-h`,className:`act-lbl`,children:`Waiting on you`}),!e&&!n?(0,B.jsx)(y,{}):e?(0,B.jsxs)(B.Fragment,{children:[T?(0,B.jsxs)(`span`,{className:`act-big act-wait`,children:[A,` `,(0,B.jsx)(`span`,{className:`dim act-sm`,children:A===1?`session`:`sessions`})]}):null,(0,B.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,B.jsx)(`p`,{className:`dim act-sm`,children:`The sessions could not be read.`})]})]}),(0,B.jsxs)(`div`,{className:`row wrap gap-8 act-filters`,children:[(0,B.jsx)(`div`,{role:`group`,"aria-label":`Filter`,className:`row wrap gap-8`,children:fe.map(([e,t])=>(0,B.jsxs)(`button`,{type:`button`,className:o.f===e?`chip-f on`:`chip-f`,"aria-pressed":o.f===e,onClick:()=>v({f:e}),children:[t,e===`needs`&&A>0?(0,B.jsxs)(`span`,{className:`mono`,children:[` `,A]}):null]},e))}),Z(`host`,`Host`,M),Z(`project`,`Project`,N),(0,B.jsx)(te,{"aria-label":`Live sessions view`,children:[[`list`,`List`],[`garden`,`Garden`]].map(([e,t])=>(0,B.jsx)(`button`,{type:`button`,className:o.v===e?`on`:``,"aria-pressed":o.v===e,onClick:()=>v({v:e}),children:t},e))})]}),P&&o.f!==`needs`&&(0,B.jsxs)(`p`,{className:`dim act-sm`,children:[`Runs and gate asks carry no `,P,`; showing sessions only.`]}),R&&(e?!T&&o.f!==`needs`?null:L.length===0?o.f===`needs`?(0,B.jsx)(S,{title:`Nothing waits on you`}):(0,B.jsx)(S,{title:`No active sessions`,children:`Start an agent session and it appears here.`}):o.v===`garden`?(0,B.jsx)(se,{sessions:L,collisions:e.collisions}):(0,B.jsx)(`div`,{className:`stack gap-12 act-live`,ref:k,children:L.map(e=>(0,B.jsx)(`div`,{"data-flip":F(e),children:(0,B.jsx)(le,{s:e})},F(e)))}):(0,B.jsx)(y,{label:`Reading live sessions…`})),V.length>0&&(0,B.jsxs)(`section`,{className:`stack gap-12 act-live act-ended`,"aria-labelledby":`act-ended-h`,children:[(0,B.jsx)(`h2`,{id:`act-ended-h`,className:`act-lbl`,children:`Recently ended`}),H.map(e=>(0,B.jsx)(`div`,{children:(0,B.jsx)(le,{s:e})},F(e))),V.length>xe&&(0,B.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":d,onClick:()=>p(e=>!e),children:d?`Show fewer`:`Show all ${V.length}`})]}),o.f!==`needs`&&(0,B.jsx)(`section`,{"aria-label":`Feed`,className:`stack gap-16 act-feed`,ref:Y,children:q.map(e=>(0,B.jsxs)(`section`,{className:`card act-day`,children:[(0,B.jsxs)(`h3`,{className:`act-day-h`,children:[(0,B.jsx)(`span`,{children:e.title}),(0,B.jsx)(`span`,{className:`mono dim`,children:e.sum})]}),(0,B.jsxs)(`ul`,{className:`act-rows`,children:[e.runs.map(e=>(0,B.jsx)(ye,{job:e,longest:J},e.id)),e.gate&&(0,B.jsx)(be,{gate:e.gate})]})]},e.key))})]})}export{Ce as default};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{H as i,M as a,O as o,St as s,T as c,_t as l,et as u,k as d,tt as f}from"./index-BL3P-9Rg.js";import{a as p,d as m,f as h,i as g,l as _,o as v,r as y,t as b,v as x}from"./Bonsai-CBWDTBA4.js";import{t as S}from"./EmptyState-CY5Pm2xy.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(`${d(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:`${s(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)(v),[n,r]=(0,T.useState)(null),i=!!e.ended,o=i?{...e,status:a(e)?`busy`:e.status,error:null}:e,s=x(o,t),c=(0,T.useMemo)(()=>h(o,{sakura:t}),[s]),l=(0,T.useCallback)(e=>r(e),[]),u=_(e),d=Number(e.turns)||0,f=Number(e.compactions)||0,m=[`${d} turn${d===1?``:`s`}`,`context ${u==null?`unknown`:`${Math.round(u*100)} %`}`,`${f} compaction${f===1?``:`s`}`,`sub-agents: ${c.pads.filter(e=>e.key!=null).length} ${i?`unfinished`:`running`}, ${c.fallen.length} finished`].join(` · `),S=n==null?null:c.pads[n];return(0,E.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!i&&a(e)?` gd-needs`:``}`,children:[(0,E.jsx)(`div`,{role:`group`,tabIndex:0,"aria-label":`Bonsai pads, arrow keys walk them`,onKeyDown:e=>g(e,c.pads.length,n,l),children:(0,E.jsx)(y,{t:c,pad:n,swaying:!i&&e.status!==`idle`,onPad:l,px:A,label:`Bonsai of this session${i?`, ended`:``}: ${m}`})}),(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:m}),(0,E.jsx)(`span`,{className:`sr-only`,role:`status`,children:p(S)}),S?(0,E.jsx)(b,{pad:S}):(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}=m(e,window.location.hash),[a,d]=(0,T.useState)(null),[p,h]=(0,T.useState)(``),[g,_]=(0,T.useState)(!1),[v,y]=(0,T.useState)(!1),b=(0,T.useId)();C(e=>g?void 0:r.activityDetail(t,n).then(t=>{e()&&(d(w(t)),h(``),_(!1))},t=>{e()&&(t.status===404?_(!0):h(t.message))}),2e3,[t,g]);let x=(0,E.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,E.jsx)(l,{name:`arrow`}),` Activity`]});if(g)return(0,E.jsxs)(`div`,{className:`page-fill`,children:[x,(0,E.jsx)(S,{title:`Session ended`,action:(0,E.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!a)return(0,E.jsxs)(`div`,{className:`page-fill`,children:[x,p?(0,E.jsx)(u,{error:p}):(0,E.jsx)(f,{label:`Loading session…`})]});let D=a.session,A=D.files,M=D.todos,N=!!(A&&A.items&&A.items.length>0),P=!!(M&&M.items&&M.items.length>0),F=a.conversation||[],I=a.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:[x,(0,E.jsx)(i,{title:D.title||o(D.cwd)||D.session_id,sub:D.cwd?(0,E.jsx)(`span`,{className:`mono act-cwd`,title:D.cwd,children:D.cwd}):null}),p&&(0,E.jsx)(`div`,{className:`act-gap`,children:(0,E.jsx)(u,{error:p})}),(0,E.jsxs)(`div`,{className:`card pad-md`,children:[(0,E.jsx)(c,{s:D}),(0,E.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,s(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":v,"aria-controls":b,onClick:()=>y(e=>!e),children:v?`Show conversation`:`Show full stream (${L.length})`})]}),(0,E.jsx)(`div`,{id:b,children:v?(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
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{H as i,M as a,O as o,St as s,T as c,_t as l,et as u,k as d,tt as f}from"./index-B_pTwZra.js";import{a as p,d as m,f as h,i as g,l as _,o as v,r as y,t as b,v as x}from"./Bonsai-B5XY9pid.js";import{t as S}from"./EmptyState-CY5Pm2xy.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(`${d(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:`${s(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)(v),[n,r]=(0,T.useState)(null),i=!!e.ended,o=i?{...e,status:a(e)?`busy`:e.status,error:null}:e,s=x(o,t),c=(0,T.useMemo)(()=>h(o,{sakura:t}),[s]),l=(0,T.useCallback)(e=>r(e),[]),u=_(e),d=Number(e.turns)||0,f=Number(e.compactions)||0,m=[`${d} turn${d===1?``:`s`}`,`context ${u==null?`unknown`:`${Math.round(u*100)} %`}`,`${f} compaction${f===1?``:`s`}`,`sub-agents: ${c.pads.filter(e=>e.key!=null).length} ${i?`unfinished`:`running`}, ${c.fallen.length} finished`].join(` · `),S=n==null?null:c.pads[n];return(0,E.jsxs)(`div`,{className:`card pad-md act-mt gd-detail${!i&&a(e)?` gd-needs`:``}`,children:[(0,E.jsx)(`div`,{role:`group`,tabIndex:0,"aria-label":`Bonsai pads, arrow keys walk them`,onKeyDown:e=>g(e,c.pads.length,n,l),children:(0,E.jsx)(y,{t:c,pad:n,swaying:!i&&e.status!==`idle`,onPad:l,px:A,label:`Bonsai of this session${i?`, ended`:``}: ${m}`})}),(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:m}),(0,E.jsx)(`span`,{className:`sr-only`,role:`status`,children:p(S)}),S?(0,E.jsx)(b,{pad:S}):(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}=m(e,window.location.hash),[a,d]=(0,T.useState)(null),[p,h]=(0,T.useState)(``),[g,_]=(0,T.useState)(!1),[v,y]=(0,T.useState)(!1),b=(0,T.useId)();C(e=>g?void 0:r.activityDetail(t,n).then(t=>{e()&&(d(w(t)),h(``),_(!1))},t=>{e()&&(t.status===404?_(!0):h(t.message))}),2e3,[t,g]);let x=(0,E.jsxs)(`a`,{className:`btn ghost sm act-back`,href:`#/activity`,children:[(0,E.jsx)(l,{name:`arrow`}),` Activity`]});if(g)return(0,E.jsxs)(`div`,{className:`page-fill`,children:[x,(0,E.jsx)(S,{title:`Session ended`,action:(0,E.jsx)(`a`,{href:`#/activity`,children:`Back to Activity`}),children:`It's no longer live.`})]});if(!a)return(0,E.jsxs)(`div`,{className:`page-fill`,children:[x,p?(0,E.jsx)(u,{error:p}):(0,E.jsx)(f,{label:`Loading session…`})]});let D=a.session,A=D.files,M=D.todos,N=!!(A&&A.items&&A.items.length>0),P=!!(M&&M.items&&M.items.length>0),F=a.conversation||[],I=a.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:[x,(0,E.jsx)(i,{title:D.title||o(D.cwd)||D.session_id,sub:D.cwd?(0,E.jsx)(`span`,{className:`mono act-cwd`,title:D.cwd,children:D.cwd}):null}),p&&(0,E.jsx)(`div`,{className:`act-gap`,children:(0,E.jsx)(u,{error:p})}),(0,E.jsxs)(`div`,{className:`card pad-md`,children:[(0,E.jsx)(c,{s:D}),(0,E.jsxs)(`div`,{className:`dim act-updated`,children:[`updated `,s(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":v,"aria-controls":b,onClick:()=>y(e=>!e),children:v?`Show conversation`:`Show full stream (${L.length})`})]}),(0,E.jsx)(`div`,{id:b,children:v?(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 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{ft as r}from"./index-BL3P-9Rg.js";var i=e(t(),1),a=e=>{let t=2166136261;for(let n of String(e))t=Math.imul(t^n.charCodeAt(0),16777619);return t>>>0},o=e=>()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296},s=e=>Math.max(0,Math.min(1,e)),c={claude:[`#8E4A33`,`#C46A4C`,`#E3906F`],bob:[`#173F8C`,`#2A5CC0`,`#6A96E8`],opencode:[`#5E6670`,`#98A2AD`,`#C8D0D8`],openclaude:[`#2F1F55`,`#4E3484`,`#8A6CC8`]},l={live:[`#16393D`,`#1F5A55`,`#2C7D55`,`#5DA845`,`#A8D23E`],sakura:[`#16393D`,`#6E2A55`,`#B83C80`,`#E9649F`,`#FFB0D2`],done:[`#5A2E14`,`#8A4A1C`,`#B8702A`,`#DB9A3E`,`#F2C46A`],idle:[`#2E3236`,`#44494E`,`#5E646A`,`#7C8288`,`#A2A7AC`]},u={developer:[`#123A3F`,`#1A5A5E`,`#24806F`,`#3FB08A`,`#8EE6C2`],explorer:[`#2C3A12`,`#4A6418`,`#6E9424`,`#9CC23A`,`#DDF07A`],reviewer:[`#16283F`,`#1F3E66`,`#2E5E92`,`#4A86C4`,`#9AC8F0`],tester:[`#3A3012`,`#5E4C18`,`#8A6E22`,`#B8952E`,`#EAD27A`]},d=[`#4E2E1C`,`#7A4A2E`,`#A2683F`,`#C78A5A`],f=[`#34312F`,`#4F4A46`,`#6B6560`,`#8A847E`],p=[`#3E8E41`,`#5FB14F`],m=[`#4A4F54`,`#62686E`],h=`#FFF6E0`,g=[`#E3C24A`,`#C9A23A`],_=[`#9BDD6A`,`#D8F59A`],v={"!":`#E8B04A`,x:`#FF6F69`},y=12;function b(e){let t=String(e||``).toLowerCase();return/implement|develop/.test(t)?`developer`:/explor/.test(t)?`explorer`:/review/.test(t)?`reviewer`:/test/.test(t)?`tester`:null}var x=e=>e?.status===`blocked`||e?.status===`waiting-input`;function S(e){return Array.isArray(e.files_all)?e.files_all.filter(e=>e&&typeof e==`object`):(Array.isArray(e.files?.items)?e.files.items:[]).filter(e=>e&&typeof e==`object`).map(e=>({file:e.file??null,path:e.path??null,additions:e.additions??0,deletions:e.deletions??0,by:e.by??null}))}var C=e=>e==null||e===``?NaN:Number(e);function w(e){let t=C(e?.context?.used),n=C(e?.context?.window);return Number.isFinite(t)&&Number.isFinite(n)&&n>0?s(t/n):null}function T(e){let t=S(e),n=(Array.isArray(e.agents)?e.agents:[]).filter(e=>e&&typeof e==`object`).map((e,t)=>({key:e.id??`#${t}`,id:e.id??null,type:e.type||null,running:e.status!==`done`,files:[]})),r=new Map(n.map(e=>[e.key,e])),i=[],a=e.attribution!==!1;for(let e of t){if(!a||e.by==null){i.push(e);continue}let t=r.get(e.by);t||(t={key:e.by,id:e.by,type:`agent`,running:!0,files:[]},n.push(t),r.set(e.by,t)),t.files.push(e)}let o=w(e),l=o!=null,u=l?C(e.context.used):NaN,d=l?o:.5,f=Math.max(0,Math.floor(Number(e.compactions)||0)),p=C(e.context_at_compaction),m=f===0?1:l&&Number.isFinite(p)&&p>0?s(u/p):0;return{id:String(e.session_id??``),host:c[e.host]?e.host:`claude`,idle:e.status===`idle`,bubble:x(e)?`!`:e.error?`x`:null,turns:Math.max(0,Number(e.turns)||0),ctx:d,compactions:f,compacted:f>0&&m<1,regrow:m,crown:i,agents:n}}function E(e,t=!1){let n=T(e);return JSON.stringify([n.id,n.host,n.idle,n.bubble,n.turns,Math.round(n.ctx*100),n.compactions,Math.round(n.regrow*100),n.crown.length,n.agents.map(e=>[e.key,e.type,e.running,e.files.length]),!!t])}function D(e,{sakura:t=!1}={}){let n=T(e),{id:r,idle:i}=n,s=Math.min(1,Math.log1p(n.turns)/Math.log1p(40)),x=.55+.45*s,S=o(a(r)),C=Array.from({length:56},()=>Array(56).fill(null)),w=Array.from({length:56},()=>Array(56).fill(-1)),E=-1,D=(e,t,n)=>{e=Math.round(e),t=Math.round(t),e>=0&&e<56&&t>=0&&t<56&&(C[t][e]=n,w[t][e]=E)},O=i?f:d,k=i?m:p,A=i?l.idle:t?l.sakura:l.live,j=Math.round(41-(9+18*s)),M=1+S()*2+3*s,N=S()*Math.PI*2,P=.9+S()*.6,F=e=>28+M*Math.sin(e*Math.PI*P+N)-M*Math.sin(N);for(let e=41;e>=j;e--){let t=(41-e)/(41-j),n=F(t),r=3+4.5*s-(1.5+3.5*s)*t;for(let t=Math.floor(n-r/2);t<=Math.ceil(n+r/2);t++){let i=(t-(n-r/2))/r;D(t,e,i<.25?O[3]:i>.75?O[0]:S()<.15?O[1]:O[2])}}for(let e=-6;e<=6;e++)D(28+e,41,Math.abs(e)>4?O[1]:O[2]),Math.abs(e)<=5&&D(28+e,40,Math.abs(e)>3?O[1]:O[2]);let I=[],L=(e,t,n,i,s,c)=>{n*=1.15,e=Math.max(n+2,Math.min(53-n,e));let l=o(a(`${r}:pad:${c}`)),u=n*.72;t=Math.max(t,u+6);for(let r=0;r<6;r++){let r=-Math.PI*(.15+.7*l()),i=n*(.4+.5*l());for(let n=0;n<i;n++)D(e+Math.cos(r)*n,t+u*.5+Math.sin(r)*n*.8,O[0])}let d=Math.round(10+n*1.6),f=[];for(let r=0;r<d;r++){let r=l()*Math.PI*2,i=Math.sqrt(l());f.push([e+Math.cos(r)*i*n,t+Math.sin(r)*i*u,1.8+l()*2.2])}f.sort((e,t)=>t[1]-e[1]);for(let[e,n,r]of f){let a=Math.max(0,Math.min(4,Math.round(4*(1-(n-(t-u))/(2*u))+(l()-.5))));for(let t=Math.floor(n-r);t<=n+r;t++)for(let o=Math.floor(e-r);o<=e+r;o++){if(((o-e)**2+(t-n)**2)/(r*r)>1+(l()-.5)*.5)continue;let s=o-e+(t-n)<-r*.3?1:t-n>r*.5?-1:0;D(o,t,i[Math.max(0,Math.min(4,a+s))])}}let p=o(a(`${r}:bloom:${c}`));for(let r=0;r<Math.min(s,y);r++)D(e+(p()*2-1)*n*.8,t-p()*u*.9,h);return{rx:n,cy:t}},R=o(a(`${r}:side`))()<.5?-1:1,z=[];n.agents.forEach((e,t)=>{let c=.25+.55*(t/Math.max(1,n.agents.length-1)),l=Math.round(41-c*(41-j)),d=F(c);if(!e.running){let t=(3+4.5*s-(1.5+3.5*s)*c)/2;E=-1,D(d+R*(t+1),l,O[3]),D(d+R*(t+2),l-1,O[2]),z.push({agentId:e.id,type:e.type,files:e.files}),R=-R;return}let f=Math.round((12+Math.floor(o(a(`${r}:branch:${e.key}`))()*4))*x);E=-1;for(let e=0;e<=f;e++){let t=d+R*e,n=l-e*.45;D(t,n,O[e<f/2?1:2]),D(t,n+1,O[0]),e<f*.6&&D(t,n+2,O[0])}let p=i?null:b(e.type),m=p?u[p]:A;E=I.length,I.push({agentId:e.id,key:e.key,type:e.type,family:p,files:e.files,bbox:null}),L(d+R*f,l-f*.45-2,(8+Math.min(e.files.length,6)*.6)*x,m,e.files.length,e.key),R=-R});let B=I.length;I.push({agentId:null,key:null,type:null,family:null,files:n.crown,bbox:null}),E=B;let V=(4+7*n.ctx+Math.min(n.crown.length,6)*.5)*x*1.35,{rx:H,cy:U}=L(F(1),j-3,V,A,n.crown.length,`crown`);if(n.ctx>.8&&!n.compacted){let e=o(a(`${r}:yellow`));for(let t=0;t<56;t++)for(let n=0;n<56;n++)w[t][n]===B&&C[t][n]!==h&&t<U-H*.2&&e()<.55&&(C[t][n]=e()<.5?g[0]:g[1])}if(n.compacted){let e=o(a(`${r}:shoots`)),t=Math.round(U-H*.15-n.regrow*H*.5);for(let e=0;e<Math.max(0,t);e++)for(let t=0;t<56;t++)w[e][t]===B&&(C[e][t]=null,w[e][t]=-1);if(t>=0&&t<56)for(let r=0;r<56;r++){if(w[t][r]!==B||e()>=.12+n.regrow*.5)continue;let i=1+Math.floor(e()*(1+n.regrow*3));for(let e=1;e<=i;e++)D(r,t-e,e===i?_[1]:_[0])}}E=-1;let W=o(a(`${r}:fallen`));z.forEach((e,t)=>D(16+(t*7+Math.floor(W()*4))%24,40,l.done[2+t%2]));for(let e=0;e<Math.min(n.compactions,6);e++)D(15+e*2,42,h);let[G,K,q]=c[n.host];for(let e=42;e<=46;e++){let t=e<=43?0:Math.floor((e-43)*.45)+2;for(let n=13+t;n<=42-t;n++){if(e===42&&C[e][n]===h)continue;let r=K;e<=43?r=e===42?q:G:(e===46||n===13+t||n===42-t)&&(r=G),D(n,e,r)}}let J=o(a(`${r}:moss`));for(let e=15;e<=40;e++)D(e,41,J()<.5?k[0]:k[1]),J()<.35&&D(e,40,k[0]);for(let e=16;e<=39;e++)D(e,47,`#00000055`);if(n.bubble){let e=v[n.bubble];for(let t=3;t<10;t++)for(let n=40;n<47;n++)D(n,t,t===3||t===9||n===40||n===46?e:`#14191F`);if(D(41,10,e),n.bubble===`!`){for(let t=5;t<=6;t++)D(43,t,e);D(43,8,e)}else for(let[t,n]of[[2,2],[4,2],[3,3],[2,4],[4,4]])D(40+t,3+n,e)}let Y=[],X=I.map(()=>null);for(let e=0;e<56;e++){let t=0;for(;t<56;){let n=C[e][t],r=w[e][t];if(!n){t++;continue}let i=t;for(;i+1<56&&C[e][i+1]===n&&w[e][i+1]===r;)i++;if(Y.push({x:t,y:e,w:i-t+1,c:n,p:r}),r>=0){let n=X[r]||={x0:t,y0:e,x1:i,y1:e};n.x0=Math.min(n.x0,t),n.x1=Math.max(n.x1,i),n.y1=e}t=i+1}}return I.forEach((e,t)=>{let n=X[t];e.bbox=n?{x:n.x0,y:n.y0,w:n.x1-n.x0+1,h:n.y1-n.y0+1}:null}),{width:56,height:56,runs:Y,pads:I,bubble:n.bubble,fallen:z}}var O=e=>{if(!e)return``;let t=String(e).replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||String(e)},k=e=>e?String(e).replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase():``;function A(e){let t=new Map;for(let n of e||[]){let e=n.repo||n.root,r=n.repo_key||(e?k(e):n.cwd?`cwd:${k(n.cwd)}`:`outside a repo`),i=O(e||n.cwd)||`outside a repo`;t.has(r)||t.set(r,{key:r,name:i,trees:[]});let a=n.root&&e&&k(n.root)!==k(e)?O(n.root):null;t.get(r).trees.push({s:n,worktree:a})}let n=(e,t)=>e<t?-1:+(e>t),r=[...t.values()];for(let e of r)e.trees.sort((e,t)=>n(e.worktree||``,t.worktree||``)||n(String(e.s.session_id),String(t.s.session_id)));return r.sort((e,t)=>n(e.name.toLowerCase(),t.name.toLowerCase())||n(e.key,t.key))}var j=e=>e.key??(e.install?`${e.install}\0${e.session_id}`:String(e.session_id)),M=e=>j({key:e.key??void 0,install:e.install,session_id:e.sid}),N=(e,t)=>String(e).split(/[\\/]+/).filter(Boolean).slice(-t).join(`/`),P=e=>r(e.host).label;function F(e){let t=e||[],n=e=>n=>t.filter(t=>e(t)===e(n)).length,r=n(e=>e.host),i=n(e=>`${e.host} ${e.scope}`),a=new Map(t.map(e=>[e.install,r(e)<2?P(e):i(e)<2||e.scope===`global`?`${P(e)} · ${e.scope}`:`${P(e)} · ${O(e.path)}`])),o=()=>t.filter(e=>t.some(t=>t!==e&&a.get(t.install)===a.get(e.install)));for(let e=2,t=o();t.length;e++,t=o()){for(let n of t){let t=String(n.path).split(/[\\/]+/).filter(Boolean).length;a.set(n.install,`${P(n)} · ${e>t?n.path:N(n.path,e)}`)}if(e>64)break}return a}var I=(e,t)=>`#/activity/${encodeURIComponent(e)}`+(t?`?${new URLSearchParams({host:t.host,path:t.path})}`:``);function L(e,t){let n=String(e).indexOf(`?`),r=new URLSearchParams(String(t||``).split(`?`)[1]||``),i=r.get(`host`),a=r.get(`path`);return{sid:n<0?e:String(e).slice(0,n),install:i&&a?{host:i,path:a}:void 0}}function R(e,t){let n=new Map((t||[]).map(e=>[e.install,e])),i=F(t);return(e||[]).map(e=>{let t=n.get(e.install);return{...e,host:t?.host??e.host,chip:i.get(e.install)??(e.host?r(e.host).label:null),href:I(e.session_id,t)}})}var z=(e,t)=>new Set((e.writers||[]).filter(e=>M(e)===t).map(e=>k(e.root)));function B(e,t,n){let r=z(e,t);for(let t of z(e,n))if(r.has(t))return`same-worktree`;return`cross-worktree`}var V=e=>[...new Set((e.writers||[]).map(M))];function H(e,t){let n=new Map(e.map((e,t)=>[j(e.s),t])),r=new Map;for(let e of t||[]){let t=V(e).filter(e=>n.has(e));for(let i=0;i<t.length;i++)for(let a=i+1;a<t.length;a++){let o=n.get(t[i]),s=n.get(t[a]),c=o<s?`${o}-${s}`:`${s}-${o}`,l=B(e,t[i],t[a]);r.has(c)&&l!==`same-worktree`||r.set(c,{a:o,b:s,kind:l})}}return[...r.values()]}function U(e,t){let n=[];for(let r of t||[]){let t=V(r).filter(t=>t!==e);if(!t.length||!V(r).includes(e))continue;let i=t.some(t=>B(r,e,t)===`same-worktree`);n.push({path:r.path,kind:i?`same-worktree`:`cross-worktree`})}return n}var W=e=>e?.status===`busy`||x(e);function G(e,t=10){let n=e.map(e=>({...e,collapsed:!1})),r=n.reduce((e,t)=>e+t.trees.length,0);if(r<=t)return n;let i=n.length,a=n.filter(e=>!e.trees.some(e=>W(e.s))).sort((e,t)=>t.trees.length-e.trees.length||(e.key<t.key?-1:1));for(let e of a){if(r<=t||i<=1)break;e.collapsed=!0,r-=e.trees.length,i--}return n}var K=n(),q=12,J=10,Y=`geneseed-garden-sakura`;function X(){try{return window.localStorage.getItem(Y)===`1`}catch{return!1}}var Z=e=>e.key==null?`the session`:e.type||`agent`,Q=e=>e.path||e.file||`?`;function $({pad:e}){let t=e.files.slice(0,q);return(0,K.jsxs)(`div`,{className:`card gd-card`,children:[(0,K.jsxs)(`div`,{className:`act-lbl`,children:[Z(e),` · `,e.files.length,` file`,e.files.length===1?``:`s`]}),(0,K.jsx)(`ul`,{className:`gd-files`,children:t.map((e,t)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mono act-ell`,children:Q(e)}),(0,K.jsxs)(`span`,{className:`mono act-xs`,children:[(0,K.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions??0]}),` `,(0,K.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions??0]})]})]},`${Q(e)}:${t}`))}),e.files.length>t.length&&(0,K.jsxs)(`div`,{className:`dim act-xs`,children:[`+`,e.files.length-t.length,` more`]})]})}var ee=e=>e?`${Z(e)}: ${e.files.length} file${e.files.length===1?``:`s`}`:``;function te(e,t,n,r){let i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];e.key===`Escape`&&n!=null&&r(null),i&&t&&(e.preventDefault(),r(n==null?i>0?0:t-1:(n+i+t)%t))}var ne=(0,i.memo)(function({t:e,pad:t,swaying:n,onPad:r,px:a,label:o}){let s=(0,i.useMemo)(()=>{let t=new Map;for(let n of e.runs)t.has(n.p)||t.set(n.p,[]),t.get(n.p).push(n);return[...t.entries()]},[e]),c=(0,i.useRef)(null),l=e=>{let[t,n]=[c.current,e.changedTouches?.[0]];return!!t&&!!n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>J};return(0,K.jsx)(`svg`,{onTouchStart:e=>{let t=e.touches?.[0];c.current=t?{x:t.clientX,y:t.clientY}:null},className:`gd-svg${t==null?``:` gd-dimming`}`,viewBox:`0 0 56 56`,width:56*a,height:56*a,shapeRendering:`crispEdges`,"data-bubble":e.bubble||void 0,...o?{role:`img`,"aria-label":o}:{"aria-hidden":`true`},children:s.map(([i,a])=>(0,K.jsx)(`g`,{"data-p":i,className:[i===t&&`gd-hot`,n&&i>=0&&e.pads[i].key!=null&&`gd-sway`].filter(Boolean).join(` `)||void 0,onMouseEnter:i>=0?()=>r(i):void 0,onMouseLeave:i>=0?()=>r(null):void 0,onTouchEnd:i>=0?e=>{l(e)||(e.cancelable&&e.preventDefault(),r(i===t?null:i))}:void 0,children:a.map(e=>(0,K.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:1,fill:e.c},`${e.x},${e.y}`))},i))})});export{H as _,ee as a,G as c,L as d,D as f,U as g,R as h,te as i,w as l,F as m,Y as n,X as o,A as p,ne as r,j as s,$ as t,I as u,E as v};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{ft as r}from"./index-B_pTwZra.js";var i=e(t(),1),a=e=>{let t=2166136261;for(let n of String(e))t=Math.imul(t^n.charCodeAt(0),16777619);return t>>>0},o=e=>()=>{e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296},s=e=>Math.max(0,Math.min(1,e)),c={claude:[`#8E4A33`,`#C46A4C`,`#E3906F`],bob:[`#173F8C`,`#2A5CC0`,`#6A96E8`],opencode:[`#5E6670`,`#98A2AD`,`#C8D0D8`],openclaude:[`#2F1F55`,`#4E3484`,`#8A6CC8`]},l={live:[`#16393D`,`#1F5A55`,`#2C7D55`,`#5DA845`,`#A8D23E`],sakura:[`#16393D`,`#6E2A55`,`#B83C80`,`#E9649F`,`#FFB0D2`],done:[`#5A2E14`,`#8A4A1C`,`#B8702A`,`#DB9A3E`,`#F2C46A`],idle:[`#2E3236`,`#44494E`,`#5E646A`,`#7C8288`,`#A2A7AC`]},u={developer:[`#123A3F`,`#1A5A5E`,`#24806F`,`#3FB08A`,`#8EE6C2`],explorer:[`#2C3A12`,`#4A6418`,`#6E9424`,`#9CC23A`,`#DDF07A`],reviewer:[`#16283F`,`#1F3E66`,`#2E5E92`,`#4A86C4`,`#9AC8F0`],tester:[`#3A3012`,`#5E4C18`,`#8A6E22`,`#B8952E`,`#EAD27A`]},d=[`#4E2E1C`,`#7A4A2E`,`#A2683F`,`#C78A5A`],f=[`#34312F`,`#4F4A46`,`#6B6560`,`#8A847E`],p=[`#3E8E41`,`#5FB14F`],m=[`#4A4F54`,`#62686E`],h=`#FFF6E0`,g=[`#E3C24A`,`#C9A23A`],_=[`#9BDD6A`,`#D8F59A`],v={"!":`#E8B04A`,x:`#FF6F69`},y=12;function b(e){let t=String(e||``).toLowerCase();return/implement|develop/.test(t)?`developer`:/explor/.test(t)?`explorer`:/review/.test(t)?`reviewer`:/test/.test(t)?`tester`:null}var x=e=>e?.status===`blocked`||e?.status===`waiting-input`;function S(e){return Array.isArray(e.files_all)?e.files_all.filter(e=>e&&typeof e==`object`):(Array.isArray(e.files?.items)?e.files.items:[]).filter(e=>e&&typeof e==`object`).map(e=>({file:e.file??null,path:e.path??null,additions:e.additions??0,deletions:e.deletions??0,by:e.by??null}))}var C=e=>e==null||e===``?NaN:Number(e);function w(e){let t=C(e?.context?.used),n=C(e?.context?.window);return Number.isFinite(t)&&Number.isFinite(n)&&n>0?s(t/n):null}function T(e){let t=S(e),n=(Array.isArray(e.agents)?e.agents:[]).filter(e=>e&&typeof e==`object`).map((e,t)=>({key:e.id??`#${t}`,id:e.id??null,type:e.type||null,running:e.status!==`done`,files:[]})),r=new Map(n.map(e=>[e.key,e])),i=[],a=e.attribution!==!1;for(let e of t){if(!a||e.by==null){i.push(e);continue}let t=r.get(e.by);t||(t={key:e.by,id:e.by,type:`agent`,running:!0,files:[]},n.push(t),r.set(e.by,t)),t.files.push(e)}let o=w(e),l=o!=null,u=l?C(e.context.used):NaN,d=l?o:.5,f=Math.max(0,Math.floor(Number(e.compactions)||0)),p=C(e.context_at_compaction),m=f===0?1:l&&Number.isFinite(p)&&p>0?s(u/p):0;return{id:String(e.session_id??``),host:c[e.host]?e.host:`claude`,idle:e.status===`idle`,bubble:x(e)?`!`:e.error?`x`:null,turns:Math.max(0,Number(e.turns)||0),ctx:d,compactions:f,compacted:f>0&&m<1,regrow:m,crown:i,agents:n}}function E(e,t=!1){let n=T(e);return JSON.stringify([n.id,n.host,n.idle,n.bubble,n.turns,Math.round(n.ctx*100),n.compactions,Math.round(n.regrow*100),n.crown.length,n.agents.map(e=>[e.key,e.type,e.running,e.files.length]),!!t])}function D(e,{sakura:t=!1}={}){let n=T(e),{id:r,idle:i}=n,s=Math.min(1,Math.log1p(n.turns)/Math.log1p(40)),x=.55+.45*s,S=o(a(r)),C=Array.from({length:56},()=>Array(56).fill(null)),w=Array.from({length:56},()=>Array(56).fill(-1)),E=-1,D=(e,t,n)=>{e=Math.round(e),t=Math.round(t),e>=0&&e<56&&t>=0&&t<56&&(C[t][e]=n,w[t][e]=E)},O=i?f:d,k=i?m:p,A=i?l.idle:t?l.sakura:l.live,j=Math.round(41-(9+18*s)),M=1+S()*2+3*s,N=S()*Math.PI*2,P=.9+S()*.6,F=e=>28+M*Math.sin(e*Math.PI*P+N)-M*Math.sin(N);for(let e=41;e>=j;e--){let t=(41-e)/(41-j),n=F(t),r=3+4.5*s-(1.5+3.5*s)*t;for(let t=Math.floor(n-r/2);t<=Math.ceil(n+r/2);t++){let i=(t-(n-r/2))/r;D(t,e,i<.25?O[3]:i>.75?O[0]:S()<.15?O[1]:O[2])}}for(let e=-6;e<=6;e++)D(28+e,41,Math.abs(e)>4?O[1]:O[2]),Math.abs(e)<=5&&D(28+e,40,Math.abs(e)>3?O[1]:O[2]);let I=[],L=(e,t,n,i,s,c)=>{n*=1.15,e=Math.max(n+2,Math.min(53-n,e));let l=o(a(`${r}:pad:${c}`)),u=n*.72;t=Math.max(t,u+6);for(let r=0;r<6;r++){let r=-Math.PI*(.15+.7*l()),i=n*(.4+.5*l());for(let n=0;n<i;n++)D(e+Math.cos(r)*n,t+u*.5+Math.sin(r)*n*.8,O[0])}let d=Math.round(10+n*1.6),f=[];for(let r=0;r<d;r++){let r=l()*Math.PI*2,i=Math.sqrt(l());f.push([e+Math.cos(r)*i*n,t+Math.sin(r)*i*u,1.8+l()*2.2])}f.sort((e,t)=>t[1]-e[1]);for(let[e,n,r]of f){let a=Math.max(0,Math.min(4,Math.round(4*(1-(n-(t-u))/(2*u))+(l()-.5))));for(let t=Math.floor(n-r);t<=n+r;t++)for(let o=Math.floor(e-r);o<=e+r;o++){if(((o-e)**2+(t-n)**2)/(r*r)>1+(l()-.5)*.5)continue;let s=o-e+(t-n)<-r*.3?1:t-n>r*.5?-1:0;D(o,t,i[Math.max(0,Math.min(4,a+s))])}}let p=o(a(`${r}:bloom:${c}`));for(let r=0;r<Math.min(s,y);r++)D(e+(p()*2-1)*n*.8,t-p()*u*.9,h);return{rx:n,cy:t}},R=o(a(`${r}:side`))()<.5?-1:1,z=[];n.agents.forEach((e,t)=>{let c=.25+.55*(t/Math.max(1,n.agents.length-1)),l=Math.round(41-c*(41-j)),d=F(c);if(!e.running){let t=(3+4.5*s-(1.5+3.5*s)*c)/2;E=-1,D(d+R*(t+1),l,O[3]),D(d+R*(t+2),l-1,O[2]),z.push({agentId:e.id,type:e.type,files:e.files}),R=-R;return}let f=Math.round((12+Math.floor(o(a(`${r}:branch:${e.key}`))()*4))*x);E=-1;for(let e=0;e<=f;e++){let t=d+R*e,n=l-e*.45;D(t,n,O[e<f/2?1:2]),D(t,n+1,O[0]),e<f*.6&&D(t,n+2,O[0])}let p=i?null:b(e.type),m=p?u[p]:A;E=I.length,I.push({agentId:e.id,key:e.key,type:e.type,family:p,files:e.files,bbox:null}),L(d+R*f,l-f*.45-2,(8+Math.min(e.files.length,6)*.6)*x,m,e.files.length,e.key),R=-R});let B=I.length;I.push({agentId:null,key:null,type:null,family:null,files:n.crown,bbox:null}),E=B;let V=(4+7*n.ctx+Math.min(n.crown.length,6)*.5)*x*1.35,{rx:H,cy:U}=L(F(1),j-3,V,A,n.crown.length,`crown`);if(n.ctx>.8&&!n.compacted){let e=o(a(`${r}:yellow`));for(let t=0;t<56;t++)for(let n=0;n<56;n++)w[t][n]===B&&C[t][n]!==h&&t<U-H*.2&&e()<.55&&(C[t][n]=e()<.5?g[0]:g[1])}if(n.compacted){let e=o(a(`${r}:shoots`)),t=Math.round(U-H*.15-n.regrow*H*.5);for(let e=0;e<Math.max(0,t);e++)for(let t=0;t<56;t++)w[e][t]===B&&(C[e][t]=null,w[e][t]=-1);if(t>=0&&t<56)for(let r=0;r<56;r++){if(w[t][r]!==B||e()>=.12+n.regrow*.5)continue;let i=1+Math.floor(e()*(1+n.regrow*3));for(let e=1;e<=i;e++)D(r,t-e,e===i?_[1]:_[0])}}E=-1;let W=o(a(`${r}:fallen`));z.forEach((e,t)=>D(16+(t*7+Math.floor(W()*4))%24,40,l.done[2+t%2]));for(let e=0;e<Math.min(n.compactions,6);e++)D(15+e*2,42,h);let[G,K,q]=c[n.host];for(let e=42;e<=46;e++){let t=e<=43?0:Math.floor((e-43)*.45)+2;for(let n=13+t;n<=42-t;n++){if(e===42&&C[e][n]===h)continue;let r=K;e<=43?r=e===42?q:G:(e===46||n===13+t||n===42-t)&&(r=G),D(n,e,r)}}let J=o(a(`${r}:moss`));for(let e=15;e<=40;e++)D(e,41,J()<.5?k[0]:k[1]),J()<.35&&D(e,40,k[0]);for(let e=16;e<=39;e++)D(e,47,`#00000055`);if(n.bubble){let e=v[n.bubble];for(let t=3;t<10;t++)for(let n=40;n<47;n++)D(n,t,t===3||t===9||n===40||n===46?e:`#14191F`);if(D(41,10,e),n.bubble===`!`){for(let t=5;t<=6;t++)D(43,t,e);D(43,8,e)}else for(let[t,n]of[[2,2],[4,2],[3,3],[2,4],[4,4]])D(40+t,3+n,e)}let Y=[],X=I.map(()=>null);for(let e=0;e<56;e++){let t=0;for(;t<56;){let n=C[e][t],r=w[e][t];if(!n){t++;continue}let i=t;for(;i+1<56&&C[e][i+1]===n&&w[e][i+1]===r;)i++;if(Y.push({x:t,y:e,w:i-t+1,c:n,p:r}),r>=0){let n=X[r]||={x0:t,y0:e,x1:i,y1:e};n.x0=Math.min(n.x0,t),n.x1=Math.max(n.x1,i),n.y1=e}t=i+1}}return I.forEach((e,t)=>{let n=X[t];e.bbox=n?{x:n.x0,y:n.y0,w:n.x1-n.x0+1,h:n.y1-n.y0+1}:null}),{width:56,height:56,runs:Y,pads:I,bubble:n.bubble,fallen:z}}var O=e=>{if(!e)return``;let t=String(e).replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||String(e)},k=e=>e?String(e).replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase():``;function A(e){let t=new Map;for(let n of e||[]){let e=n.repo||n.root,r=n.repo_key||(e?k(e):n.cwd?`cwd:${k(n.cwd)}`:`outside a repo`),i=O(e||n.cwd)||`outside a repo`;t.has(r)||t.set(r,{key:r,name:i,trees:[]});let a=n.root&&e&&k(n.root)!==k(e)?O(n.root):null;t.get(r).trees.push({s:n,worktree:a})}let n=(e,t)=>e<t?-1:+(e>t),r=[...t.values()];for(let e of r)e.trees.sort((e,t)=>n(e.worktree||``,t.worktree||``)||n(String(e.s.session_id),String(t.s.session_id)));return r.sort((e,t)=>n(e.name.toLowerCase(),t.name.toLowerCase())||n(e.key,t.key))}var j=e=>e.key??(e.install?`${e.install}\0${e.session_id}`:String(e.session_id)),M=e=>j({key:e.key??void 0,install:e.install,session_id:e.sid}),N=(e,t)=>String(e).split(/[\\/]+/).filter(Boolean).slice(-t).join(`/`),P=e=>r(e.host).label;function F(e){let t=e||[],n=e=>n=>t.filter(t=>e(t)===e(n)).length,r=n(e=>e.host),i=n(e=>`${e.host} ${e.scope}`),a=new Map(t.map(e=>[e.install,r(e)<2?P(e):i(e)<2||e.scope===`global`?`${P(e)} · ${e.scope}`:`${P(e)} · ${O(e.path)}`])),o=()=>t.filter(e=>t.some(t=>t!==e&&a.get(t.install)===a.get(e.install)));for(let e=2,t=o();t.length;e++,t=o()){for(let n of t){let t=String(n.path).split(/[\\/]+/).filter(Boolean).length;a.set(n.install,`${P(n)} · ${e>t?n.path:N(n.path,e)}`)}if(e>64)break}return a}var I=(e,t)=>`#/activity/${encodeURIComponent(e)}`+(t?`?${new URLSearchParams({host:t.host,path:t.path})}`:``);function L(e,t){let n=String(e).indexOf(`?`),r=new URLSearchParams(String(t||``).split(`?`)[1]||``),i=r.get(`host`),a=r.get(`path`);return{sid:n<0?e:String(e).slice(0,n),install:i&&a?{host:i,path:a}:void 0}}function R(e,t){let n=new Map((t||[]).map(e=>[e.install,e])),i=F(t);return(e||[]).map(e=>{let t=n.get(e.install);return{...e,host:t?.host??e.host,chip:i.get(e.install)??(e.host?r(e.host).label:null),href:I(e.session_id,t)}})}var z=(e,t)=>new Set((e.writers||[]).filter(e=>M(e)===t).map(e=>k(e.root)));function B(e,t,n){let r=z(e,t);for(let t of z(e,n))if(r.has(t))return`same-worktree`;return`cross-worktree`}var V=e=>[...new Set((e.writers||[]).map(M))];function H(e,t){let n=new Map(e.map((e,t)=>[j(e.s),t])),r=new Map;for(let e of t||[]){let t=V(e).filter(e=>n.has(e));for(let i=0;i<t.length;i++)for(let a=i+1;a<t.length;a++){let o=n.get(t[i]),s=n.get(t[a]),c=o<s?`${o}-${s}`:`${s}-${o}`,l=B(e,t[i],t[a]);r.has(c)&&l!==`same-worktree`||r.set(c,{a:o,b:s,kind:l})}}return[...r.values()]}function U(e,t){let n=[];for(let r of t||[]){let t=V(r).filter(t=>t!==e);if(!t.length||!V(r).includes(e))continue;let i=t.some(t=>B(r,e,t)===`same-worktree`);n.push({path:r.path,kind:i?`same-worktree`:`cross-worktree`})}return n}var W=e=>e?.status===`busy`||x(e);function G(e,t=10){let n=e.map(e=>({...e,collapsed:!1})),r=n.reduce((e,t)=>e+t.trees.length,0);if(r<=t)return n;let i=n.length,a=n.filter(e=>!e.trees.some(e=>W(e.s))).sort((e,t)=>t.trees.length-e.trees.length||(e.key<t.key?-1:1));for(let e of a){if(r<=t||i<=1)break;e.collapsed=!0,r-=e.trees.length,i--}return n}var K=n(),q=12,J=10,Y=`geneseed-garden-sakura`;function X(){try{return window.localStorage.getItem(Y)===`1`}catch{return!1}}var Z=e=>e.key==null?`the session`:e.type||`agent`,Q=e=>e.path||e.file||`?`;function $({pad:e}){let t=e.files.slice(0,q);return(0,K.jsxs)(`div`,{className:`card gd-card`,children:[(0,K.jsxs)(`div`,{className:`act-lbl`,children:[Z(e),` · `,e.files.length,` file`,e.files.length===1?``:`s`]}),(0,K.jsx)(`ul`,{className:`gd-files`,children:t.map((e,t)=>(0,K.jsxs)(`li`,{children:[(0,K.jsx)(`span`,{className:`mono act-ell`,children:Q(e)}),(0,K.jsxs)(`span`,{className:`mono act-xs`,children:[(0,K.jsxs)(`span`,{className:`t-good`,children:[`+`,e.additions??0]}),` `,(0,K.jsxs)(`span`,{className:`t-bad`,children:[`−`,e.deletions??0]})]})]},`${Q(e)}:${t}`))}),e.files.length>t.length&&(0,K.jsxs)(`div`,{className:`dim act-xs`,children:[`+`,e.files.length-t.length,` more`]})]})}var ee=e=>e?`${Z(e)}: ${e.files.length} file${e.files.length===1?``:`s`}`:``;function te(e,t,n,r){let i={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1}[e.key];e.key===`Escape`&&n!=null&&r(null),i&&t&&(e.preventDefault(),r(n==null?i>0?0:t-1:(n+i+t)%t))}var ne=(0,i.memo)(function({t:e,pad:t,swaying:n,onPad:r,px:a,label:o}){let s=(0,i.useMemo)(()=>{let t=new Map;for(let n of e.runs)t.has(n.p)||t.set(n.p,[]),t.get(n.p).push(n);return[...t.entries()]},[e]),c=(0,i.useRef)(null),l=e=>{let[t,n]=[c.current,e.changedTouches?.[0]];return!!t&&!!n&&Math.hypot(n.clientX-t.x,n.clientY-t.y)>J};return(0,K.jsx)(`svg`,{onTouchStart:e=>{let t=e.touches?.[0];c.current=t?{x:t.clientX,y:t.clientY}:null},className:`gd-svg${t==null?``:` gd-dimming`}`,viewBox:`0 0 56 56`,width:56*a,height:56*a,shapeRendering:`crispEdges`,"data-bubble":e.bubble||void 0,...o?{role:`img`,"aria-label":o}:{"aria-hidden":`true`},children:s.map(([i,a])=>(0,K.jsx)(`g`,{"data-p":i,className:[i===t&&`gd-hot`,n&&i>=0&&e.pads[i].key!=null&&`gd-sway`].filter(Boolean).join(` `)||void 0,onMouseEnter:i>=0?()=>r(i):void 0,onMouseLeave:i>=0?()=>r(null):void 0,onTouchEnd:i>=0?e=>{l(e)||(e.cancelable&&e.preventDefault(),r(i===t?null:i))}:void 0,children:a.map(e=>(0,K.jsx)(`rect`,{x:e.x,y:e.y,width:e.w,height:1,fill:e.c},`${e.x},${e.y}`))},i))})});export{H as _,ee as a,G as c,L as d,D as f,U as g,R as h,te as i,w as l,F as m,Y as n,X as o,A as p,ne as r,j as s,$ as t,I as u,E as v};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{_t as r}from"./index-BL3P-9Rg.js";var i=e(t(),1),a=n(),o=1200;function s({text:e,label:t,title:n,className:s=`btn ghost sm`}){let[c,l]=(0,i.useState)(null),u=(0,i.useRef)(null),d=(0,i.useRef)(!1);(0,i.useEffect)(()=>(d.current=!1,()=>{d.current=!0,clearTimeout(u.current)}),[]);let f=e=>{d.current||(l(e),clearTimeout(u.current),u.current=setTimeout(()=>l(null),o))};return(0,a.jsxs)(`button`,{type:`button`,className:s,onClick:async()=>{try{await navigator.clipboard.writeText(e),f(`ok`)}catch{f(`fail`)}},"aria-label":t,title:n,children:[(0,a.jsx)(r,{name:c===`ok`?`check`:c===`fail`?`x`:`copy`}),c===`ok`?`Copied`:c===`fail`?`Copy failed`:`Copy`]})}export{s as t};
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"./index-B_pTwZra.js";var i=e(t(),1),a=n(),o=1200;function s({text:e,label:t,title:n,className:s=`btn ghost sm`}){let[c,l]=(0,i.useState)(null),u=(0,i.useRef)(null),d=(0,i.useRef)(!1);(0,i.useEffect)(()=>(d.current=!1,()=>{d.current=!0,clearTimeout(u.current)}),[]);let f=e=>{d.current||(l(e),clearTimeout(u.current),u.current=setTimeout(()=>l(null),o))};return(0,a.jsxs)(`button`,{type:`button`,className:s,onClick:async()=>{try{await navigator.clipboard.writeText(e),f(`ok`)}catch{f(`fail`)}},"aria-label":t,title:n,children:[(0,a.jsx)(r,{name:c===`ok`?`check`:c===`fail`?`x`:`copy`}),c===`ok`?`Copied`:c===`fail`?`Copy failed`:`Copy`]})}export{s as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GreenhouseView-DW3PgTPy.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/index-BL3P-9Rg.js","assets/api-DLDVY3K-.js","assets/motion-RlUl1osO.js","assets/sections-CtFz7HFH.js","assets/index-CRWqKxfY.css","assets/OperatorHudView-BNr8K5qj.js","assets/JournalView-O65qEWfp.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{n as a,r as o}from"./sections-CtFz7HFH.js";import{$ as s,L as c,Ot as l,R as u,St as d,V as f,X as p,_t as m,a as h,bt as g,et as _,rt as v,t as y,tt as b,vt as x,wt as S,xt as C}from"./index-BL3P-9Rg.js";import{o as w,t as T}from"./motion-RlUl1osO.js";var E=t(n(),1),D={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.`},O=(e,t)=>e.deployed?t===void 0||t===`good`?D[e.theme]||`Loaded & ready`:`Deployed`:`Not deployed`,k=r(),A={done:`ok`,failed:`bad`},j={done:(0,k.jsx)(`path`,{d:`M5 12l5 5L20 7`}),failed:(0,k.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})},M=e=>typeof e==`number`&&Number.isFinite(e);function ee(e){let t=[];for(let n of e){let e=c(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(M(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:[M(n.duration)?n.duration:null]})}return t}function N(e){if(!e.newest)return`—`;let t=d(e.newest),n=e.oldest?d(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=u(e,t),i=Math.max(0,...r.map(e=>M(e.duration)?e.duration:0))||1,a=ee(r),o=Math.max(...a.map(e=>e.jobs.length));return(0,k.jsx)(`ul`,{className:`run-chips`,children:a.map(e=>{let t=e.durations.filter(M),n=e.jobs.length,r=e.status||`running`;return(0,k.jsxs)(`li`,{className:`run-chip ${A[e.status]||`acc`}`,title:e.command||void 0,children:[(0,k.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:j[e.status]||(0,k.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`,stroke:`none`})}),(0,k.jsx)(`span`,{className:`sr-only`,children:r}),(0,k.jsxs)(`span`,{className:`run-chip-main`,children:[(0,k.jsxs)(`span`,{className:`run-chip-head`,children:[(0,k.jsx)(`b`,{children:e.verb}),n>1&&(0,k.jsxs)(`span`,{className:`run-chip-times`,children:[`×`,n]})]}),(0,k.jsx)(`span`,{className:`run-chip-sub`,children:[e.scope,N(e)].filter(Boolean).join(` · `)})]}),t.length?(0,k.jsx)(`span`,{className:`run-chip-bars`,role:`img`,"aria-label":`Durations: ${t.join(`, `)} seconds`,children:t.map((e,t)=>(0,k.jsx)(`i`,{style:{width:`${e/i/o*100}%`}},t))}):(0,k.jsx)(`span`,{className:`run-chip-bars`,"aria-hidden":`true`}),(0,k.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,k.jsxs)(`span`,{className:`badge ${F[e.tone]}`,role:`status`,style:{alignSelf:`flex-start`},children:[(0,k.jsx)(`span`,{className:`dot`}),e.head]}):null}function L({overview:e,dataRev:t}){let{data:n}=S(()=>Promise.resolve().then(()=>i.catalog(`laws`)),[t],`catalog:laws`),r=x(e.diff),a=e.counts||{},o=[{key:`agents`,label:`Agents`,hash:`#/agents`},{key:`skills`,label:`Skills`,hash:`#/skills`},{key:`laws`,label:n?.nouns?.laws||`Dictates`,hash:`#/laws`}];return(0,k.jsxs)(`div`,{className:`card kpiband rise mb-16`,children:[o.map(e=>{let t=a[e.key];return(0,k.jsxs)(`a`,{className:`kseg`,href:e.hash,title:`Open ${e.label}`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(t===0?` zero`:``),children:t==null?`—`:(0,k.jsx)(T,{value:t})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:e.label})]},e.key)}),(0,k.jsx)(`div`,{className:`kseg-spacer`}),(0,k.jsxs)(`button`,{className:`kseg`+(r>0?` hot`:``),onClick:()=>l(`#/diff`),title:`Open changes`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(r===0?` zero`:``),children:(0,k.jsx)(T,{value:r})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:`Local edits`}),r>0&&(0,k.jsx)(`span`,{className:`delta up`,children:`▲`})]})]})}function R({overview:e}){return(0,k.jsx)(`div`,{className:`genome`,children:o.map((t,n)=>{let r=a[t],i=e.counts?.[t];return(0,k.jsxs)(`a`,{className:`card gcell rise`,style:{"--i":n},href:`#/section/`+t,children:[(0,k.jsxs)(`div`,{className:`gtop`,children:[(0,k.jsx)(`span`,{className:`gname`,children:r.label}),(0,k.jsx)(m,{name:r.icon,className:`gicon`})]}),(0,k.jsx)(`div`,{className:`gcount`+(i===0?` zero`:``),children:i==null?`—`:(0,k.jsx)(T,{value:i})}),(0,k.jsx)(`div`,{className:`gdesc`,children:r.desc})]},t)})})}function z({jobs:e}){if(!e||e.length===0)return(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})});let t={done:`ok`,running:`acc`,failed:`bad`},n=u(e,8);return(0,k.jsx)(`div`,{className:`feed`,children:n.map(e=>(0,k.jsxs)(`div`,{className:`feed-row`,children:[(0,k.jsx)(`span`,{className:`feed-dot ${t[e.status]||`ok`}`}),(0,k.jsx)(`span`,{className:`feed-txt`,children:(0,k.jsx)(`b`,{children:e.action})}),(0,k.jsxs)(`span`,{className:`feed-when`,children:[d(e.started),` ago`]})]},e.id))})}function B({value:e}){let t=w(e,1100)??0,n=Math.round(t*100);return(0,k.jsxs)(`div`,{className:`ring-box`,children:[(0,k.jsx)(f,{value:n,max:100,label:`germination`,size:232,stroke:10,sweepMs:0}),(0,k.jsxs)(`div`,{className:`ring-center`,children:[(0,k.jsxs)(`div`,{className:`pct`,children:[n,(0,k.jsx)(`span`,{className:`pct-unit`,children:`%`})]}),(0,k.jsx)(`div`,{className:`lbl`,children:`germination`})]})]})}function V({overview:e,sigil:t,setup:n,jobs:r,lens:i,dataRev:a}){let s=O(e,i?.tone),c=C(e,n,i?.tone);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-lg rise mb-16`,children:(0,k.jsxs)(`div`,{className:`hero`,children:[(0,k.jsx)(B,{value:c}),(0,k.jsxs)(`div`,{className:`hero-facts`,children:[(0,k.jsx)(`div`,{className:`ttl`,children:s}),(0,k.jsx)(I,{verdict:i?.verdict}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`p`,{className:`sub`,children:[`One source rendered into `,(0,k.jsx)(`code`,{children:e.target}),`. Every repo on this machine inherits it.`]}),(0,k.jsxs)(`div`,{className:`hero-chips`,children:[(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`voice`}),(0,k.jsx)(`span`,{className:`cv t-cap`,children:e.theme})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`mode`}),(0,k.jsx)(`span`,{className:`cv`,children:e.emit})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`footprint`}),(0,k.jsx)(`span`,{className:`cv`,children:e.footprint})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`built`}),(0,k.jsx)(`span`,{className:`cv`,children:e.build_time||`unknown`})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`fp`}),(0,k.jsx)(`span`,{className:`cv`,children:n?.installed_fp||`—`})]})]})]})]})}),(0,k.jsx)(L,{overview:e,dataRev:a}),(0,k.jsxs)(`div`,{className:`grid split-status`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Capability genome`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[o.length,` sections`]})})]}),(0,k.jsx)(R,{overview:e})]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Recent activity`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`badge acc`,children:[(0,k.jsx)(`span`,{className:`dot`}),`live`]})})]}),(0,k.jsx)(z,{jobs:r})]})]})]})}function H({k:e,overview:t,max:n}){let r=a[e],i=t.counts?.[e]??0;return(0,k.jsxs)(`div`,{className:`strand`,children:[(0,k.jsxs)(`span`,{className:`strand-name`,children:[(0,k.jsx)(`span`,{className:`strand-dot`}),(0,k.jsx)(`a`,{href:`#/section/`+e,className:`strand-link stretch-link`,children:r.label})]}),(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${i/n*100}%`}})}),(0,k.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=g(e.counts),s=n?.version_verdict||``,c=U(s),l=x(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,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`mb-16`,children:(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{position:`relative`,overflow:`hidden`},children:[(0,k.jsx)(`h2`,{className:`h`,style:{fontSize:22,margin:`0 0 18px`},children:`Gene-seed lineage`}),(0,k.jsxs)(`div`,{className:`lineage-track`,children:[(0,k.jsx)(`div`,{className:`spine`}),u.map(([e,t,n,r],i)=>(0,k.jsxs)(`div`,{className:`lineage-step`,children:[(0,k.jsx)(`span`,{className:`node ${r?`on`:``}`}),(0,k.jsx)(`div`,{className:`lt`,children:e}),(0,k.jsx)(`div`,{className:`ld`,children:t}),(0,k.jsx)(`div`,{className:`ltag`,children:n})]},i))]}),(0,k.jsx)(`hr`,{className:`hr`}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,style:{marginBottom:14},children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,k.jsx)(I,{verdict:i?.verdict}),c&&(0,k.jsxs)(`span`,{className:`badge ${c.tone}`,title:s,children:[(0,k.jsx)(`span`,{className:`dot`}),c.label]}),(0,k.jsxs)(`span`,{className:`badge`,children:[(0,k.jsx)(`span`,{className:`dot`}),l,` local edits`]})]})]})}),(0,k.jsxs)(`div`,{className:`grid split-even`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Genome strand`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsx)(`span`,{className:`tick`,children:`by volume`})})]}),o.map(t=>(0,k.jsx)(H,{k:t,overview:e,max:a},t))]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Recent activity`})}),(0,k.jsx)(z,{jobs:r})]})]})]})}function G({overview:e,setup:t,jobs:n,lens:r}){let i=o.reduce((t,n)=>t+(e.counts?.[n]??0),0),s=g(e.counts),c=e.doctor?.ok,l=e.doctor?.problems?.length??0,u=x(e.diff);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-md rise mb-16`,children:(0,k.jsx)(`div`,{className:`row wrap between gap-16`,children:(0,k.jsxs)(`div`,{className:`row`,style:{gap:20,flexWrap:`wrap`},children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`status`}),(0,k.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:[(0,k.jsxs)(`span`,{className:`badge ${e.deployed?`ok`:`warn`}`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.deployed?`deployed`:`not deployed`]}),(0,k.jsx)(I,{verdict:r?.verdict})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`voice`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6,textTransform:`capitalize`},children:e.theme})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`mode`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6},children:e.emit})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`fingerprint`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6,color:`var(--accent-text)`},children:t?.installed_fp||`—`})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`doctor`}),(0,k.jsx)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:c?(0,k.jsxs)(`span`,{className:`badge ok`,children:[(0,k.jsx)(`span`,{className:`dot`}),`clean`]}):(0,k.jsxs)(`span`,{className:`badge warn`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.doctor===null?`checking`:`${l} issue${l===1?``:`s`}`]})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`edits`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6},children:u})]})]})})}),(0,k.jsxs)(`div`,{className:`grid split-operator`,children:[(0,k.jsxs)(`div`,{className:`card rise`,style:{"--i":1},children:[(0,k.jsxs)(`div`,{className:`card-head pad-lg`,style:{padding:`18px 20px 0`,marginBottom:14},children:[(0,k.jsx)(`h3`,{children:`Sections`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[i,` entries total`]})})]}),(0,k.jsxs)(`table`,{className:`tbl`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsxs)(`tr`,{children:[(0,k.jsx)(`th`,{children:`Section`}),(0,k.jsx)(`th`,{children:`Detail`}),(0,k.jsx)(`th`,{style:{width:130},children:`Share`}),(0,k.jsx)(`th`,{className:`num`,children:`Count`})]})}),(0,k.jsx)(`tbody`,{children:o.map(t=>{let n=a[t],r=e.counts?.[t]??0;return(0,k.jsxs)(`tr`,{className:`clickable`,children:[(0,k.jsx)(`td`,{className:`name`,children:(0,k.jsx)(`a`,{href:`#/section/`+t,className:`stretch-link`,children:n.label})}),(0,k.jsx)(`td`,{className:`muted`,children:n.desc}),(0,k.jsx)(`td`,{children:(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${r/s*100}%`}})})}),(0,k.jsx)(`td`,{className:`num`,children:r})]},t)})})]})]}),(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{"--i":2},children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Run log`})}),(0,k.jsx)(P,{jobs:n,max:8,empty:(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.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=S(()=>q(()=>i.fleet()),[e]),r=S(()=>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?h(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,E.lazy)(()=>y(()=>import(`./GreenhouseView-DW3PgTPy.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Z=(0,E.lazy)(()=>y(()=>import(`./OperatorHudView-BNr8K5qj.js`),__vite__mapDeps([8,1,2,3,4,5,6,7]))),Q=(0,E.lazy)(()=>y(()=>import(`./JournalView-O65qEWfp.js`),__vite__mapDeps([9,1,2,3,4,5,6,7])));function $({overview:e,overviewError:t,onRetry:n,themes:r,setup:a,runs:o,onAction:c,layout:l=`genome`,dataRev:u}){let d=l,[f,m]=(0,E.useState)(`status`),[h,g]=(0,E.useState)(d);h!==d&&(g(d),m(`status`));let y=e&&r.find(t=>t.name===e.theme)?.sigil||``,x=J({dataRev:u,needDoctor:d===`greenhouse`||d===`hud`}),{data:C}=S(()=>d===`journal`?i.recent().catch(()=>null):Promise.resolve(null),[d,u]);if(!e)return t?(0,k.jsx)(_,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,k.jsx)(b,{});let w=e.daemon_stale?(0,k.jsx)(s,{}):null;return e.deployed?(0,k.jsxs)(k.Fragment,{children:[w,(0,k.jsx)(`div`,{className:`head-row`,children:(0,k.jsx)(v,{"aria-label":`Dashboard view`,children:[[`status`,`Status`],[`lineage`,`Lineage`],[`readout`,`Readout`]].map(([e,t])=>(0,k.jsx)(`button`,{className:f===e?`on`:``,onClick:()=>m(e),"aria-pressed":f===e,children:t},e))})}),(0,k.jsxs)(`div`,{className:`view-in`,children:[f===`status`&&d===`genome`&&(0,k.jsx)(V,{overview:e,sigil:y,setup:a,jobs:o,lens:x,dataRev:u}),f===`status`&&d===`greenhouse`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(X,{overview:e,sigil:y,jobs:o,lens:x,onAction:c})}),f===`status`&&d===`hud`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(Z,{overview:e,jobs:o,lens:x})}),f===`status`&&d===`journal`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(Q,{overview:e,recent:C,lens:x,dataRev:u})}),f===`lineage`&&(0,k.jsx)(W,{overview:e,sigil:y,setup:a,jobs:o,lens:x}),f===`readout`&&(0,k.jsx)(G,{overview:e,setup:a,jobs:o,lens:x})]},f)]}):(0,k.jsxs)(k.Fragment,{children:[w,(0,k.jsx)(p,{onAction:c})]})}export{$ as default,O as i,I as n,P as r,Y as t};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/GreenhouseView-DO3ADmT9.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/index-B_pTwZra.js","assets/api-CZ-x0iWG.js","assets/motion-RlUl1osO.js","assets/sections-CtFz7HFH.js","assets/index-CzfImiYb.css","assets/OperatorHudView-QtSaSyYm.js","assets/JournalView--W-Lw_V9.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-CZ-x0iWG.js";import{n as a,r as o}from"./sections-CtFz7HFH.js";import{$ as s,L as c,Ot as l,R as u,St as d,V as f,X as p,_t as m,a as h,bt as g,et as _,rt as v,t as y,tt as b,vt as x,wt as S,xt as C}from"./index-B_pTwZra.js";import{o as w,t as T}from"./motion-RlUl1osO.js";var E=t(n(),1),D={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.`},O=(e,t)=>e.deployed?t===void 0||t===`good`?D[e.theme]||`Loaded & ready`:`Deployed`:`Not deployed`,k=r(),A={done:`ok`,failed:`bad`},j={done:(0,k.jsx)(`path`,{d:`M5 12l5 5L20 7`}),failed:(0,k.jsx)(`path`,{d:`M6 6l12 12M18 6L6 18`})},M=e=>typeof e==`number`&&Number.isFinite(e);function ee(e){let t=[];for(let n of e){let e=c(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(M(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:[M(n.duration)?n.duration:null]})}return t}function N(e){if(!e.newest)return`—`;let t=d(e.newest),n=e.oldest?d(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=u(e,t),i=Math.max(0,...r.map(e=>M(e.duration)?e.duration:0))||1,a=ee(r),o=Math.max(...a.map(e=>e.jobs.length));return(0,k.jsx)(`ul`,{className:`run-chips`,children:a.map(e=>{let t=e.durations.filter(M),n=e.jobs.length,r=e.status||`running`;return(0,k.jsxs)(`li`,{className:`run-chip ${A[e.status]||`acc`}`,title:e.command||void 0,children:[(0,k.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:j[e.status]||(0,k.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`,fill:`currentColor`,stroke:`none`})}),(0,k.jsx)(`span`,{className:`sr-only`,children:r}),(0,k.jsxs)(`span`,{className:`run-chip-main`,children:[(0,k.jsxs)(`span`,{className:`run-chip-head`,children:[(0,k.jsx)(`b`,{children:e.verb}),n>1&&(0,k.jsxs)(`span`,{className:`run-chip-times`,children:[`×`,n]})]}),(0,k.jsx)(`span`,{className:`run-chip-sub`,children:[e.scope,N(e)].filter(Boolean).join(` · `)})]}),t.length?(0,k.jsx)(`span`,{className:`run-chip-bars`,role:`img`,"aria-label":`Durations: ${t.join(`, `)} seconds`,children:t.map((e,t)=>(0,k.jsx)(`i`,{style:{width:`${e/i/o*100}%`}},t))}):(0,k.jsx)(`span`,{className:`run-chip-bars`,"aria-hidden":`true`}),(0,k.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,k.jsxs)(`span`,{className:`badge ${F[e.tone]}`,role:`status`,style:{alignSelf:`flex-start`},children:[(0,k.jsx)(`span`,{className:`dot`}),e.head]}):null}function L({overview:e,dataRev:t}){let{data:n}=S(()=>Promise.resolve().then(()=>i.catalog(`laws`)),[t],`catalog:laws`),r=x(e.diff),a=e.counts||{},o=[{key:`agents`,label:`Agents`,hash:`#/agents`},{key:`skills`,label:`Skills`,hash:`#/skills`},{key:`laws`,label:n?.nouns?.laws||`Dictates`,hash:`#/laws`}];return(0,k.jsxs)(`div`,{className:`card kpiband rise mb-16`,children:[o.map(e=>{let t=a[e.key];return(0,k.jsxs)(`a`,{className:`kseg`,href:e.hash,title:`Open ${e.label}`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(t===0?` zero`:``),children:t==null?`—`:(0,k.jsx)(T,{value:t})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:e.label})]},e.key)}),(0,k.jsx)(`div`,{className:`kseg-spacer`}),(0,k.jsxs)(`button`,{className:`kseg`+(r>0?` hot`:``),onClick:()=>l(`#/diff`),title:`Open changes`,children:[(0,k.jsx)(`span`,{className:`kseg-n`+(r===0?` zero`:``),children:(0,k.jsx)(T,{value:r})}),(0,k.jsx)(`span`,{className:`kseg-l`,children:`Local edits`}),r>0&&(0,k.jsx)(`span`,{className:`delta up`,children:`▲`})]})]})}function R({overview:e}){return(0,k.jsx)(`div`,{className:`genome`,children:o.map((t,n)=>{let r=a[t],i=e.counts?.[t];return(0,k.jsxs)(`a`,{className:`card gcell rise`,style:{"--i":n},href:`#/section/`+t,children:[(0,k.jsxs)(`div`,{className:`gtop`,children:[(0,k.jsx)(`span`,{className:`gname`,children:r.label}),(0,k.jsx)(m,{name:r.icon,className:`gicon`})]}),(0,k.jsx)(`div`,{className:`gcount`+(i===0?` zero`:``),children:i==null?`—`:(0,k.jsx)(T,{value:i})}),(0,k.jsx)(`div`,{className:`gdesc`,children:r.desc})]},t)})})}function z({jobs:e}){if(!e||e.length===0)return(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.jsx)(`div`,{className:`big`,children:`No activity yet`}),`Actions you run appear here.`]})});let t={done:`ok`,running:`acc`,failed:`bad`},n=u(e,8);return(0,k.jsx)(`div`,{className:`feed`,children:n.map(e=>(0,k.jsxs)(`div`,{className:`feed-row`,children:[(0,k.jsx)(`span`,{className:`feed-dot ${t[e.status]||`ok`}`}),(0,k.jsx)(`span`,{className:`feed-txt`,children:(0,k.jsx)(`b`,{children:e.action})}),(0,k.jsxs)(`span`,{className:`feed-when`,children:[d(e.started),` ago`]})]},e.id))})}function B({value:e}){let t=w(e,1100)??0,n=Math.round(t*100);return(0,k.jsxs)(`div`,{className:`ring-box`,children:[(0,k.jsx)(f,{value:n,max:100,label:`germination`,size:232,stroke:10,sweepMs:0}),(0,k.jsxs)(`div`,{className:`ring-center`,children:[(0,k.jsxs)(`div`,{className:`pct`,children:[n,(0,k.jsx)(`span`,{className:`pct-unit`,children:`%`})]}),(0,k.jsx)(`div`,{className:`lbl`,children:`germination`})]})]})}function V({overview:e,sigil:t,setup:n,jobs:r,lens:i,dataRev:a}){let s=O(e,i?.tone),c=C(e,n,i?.tone);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-lg rise mb-16`,children:(0,k.jsxs)(`div`,{className:`hero`,children:[(0,k.jsx)(B,{value:c}),(0,k.jsxs)(`div`,{className:`hero-facts`,children:[(0,k.jsx)(`div`,{className:`ttl`,children:s}),(0,k.jsx)(I,{verdict:i?.verdict}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`p`,{className:`sub`,children:[`One source rendered into `,(0,k.jsx)(`code`,{children:e.target}),`. Every repo on this machine inherits it.`]}),(0,k.jsxs)(`div`,{className:`hero-chips`,children:[(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`voice`}),(0,k.jsx)(`span`,{className:`cv t-cap`,children:e.theme})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`mode`}),(0,k.jsx)(`span`,{className:`cv`,children:e.emit})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`footprint`}),(0,k.jsx)(`span`,{className:`cv`,children:e.footprint})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`built`}),(0,k.jsx)(`span`,{className:`cv`,children:e.build_time||`unknown`})]}),(0,k.jsxs)(`span`,{className:`chip`,children:[(0,k.jsx)(`span`,{className:`ck`,children:`fp`}),(0,k.jsx)(`span`,{className:`cv`,children:n?.installed_fp||`—`})]})]})]})]})}),(0,k.jsx)(L,{overview:e,dataRev:a}),(0,k.jsxs)(`div`,{className:`grid split-status`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Capability genome`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[o.length,` sections`]})})]}),(0,k.jsx)(R,{overview:e})]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Recent activity`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`badge acc`,children:[(0,k.jsx)(`span`,{className:`dot`}),`live`]})})]}),(0,k.jsx)(z,{jobs:r})]})]})]})}function H({k:e,overview:t,max:n}){let r=a[e],i=t.counts?.[e]??0;return(0,k.jsxs)(`div`,{className:`strand`,children:[(0,k.jsxs)(`span`,{className:`strand-name`,children:[(0,k.jsx)(`span`,{className:`strand-dot`}),(0,k.jsx)(`a`,{href:`#/section/`+e,className:`strand-link stretch-link`,children:r.label})]}),(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${i/n*100}%`}})}),(0,k.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=g(e.counts),s=n?.version_verdict||``,c=U(s),l=x(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,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`mb-16`,children:(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{position:`relative`,overflow:`hidden`},children:[(0,k.jsx)(`h2`,{className:`h`,style:{fontSize:22,margin:`0 0 18px`},children:`Gene-seed lineage`}),(0,k.jsxs)(`div`,{className:`lineage-track`,children:[(0,k.jsx)(`div`,{className:`spine`}),u.map(([e,t,n,r],i)=>(0,k.jsxs)(`div`,{className:`lineage-step`,children:[(0,k.jsx)(`span`,{className:`node ${r?`on`:``}`}),(0,k.jsx)(`div`,{className:`lt`,children:e}),(0,k.jsx)(`div`,{className:`ld`,children:t}),(0,k.jsx)(`div`,{className:`ltag`,children:n})]},i))]}),(0,k.jsx)(`hr`,{className:`hr`}),t&&(0,k.jsxs)(`div`,{className:`voice-readout`,style:{marginBottom:14},children:[(0,k.jsx)(`span`,{className:`vr-cur`,children:`▕`}),(0,k.jsx)(`span`,{className:`vr-txt`,children:t})]},e.theme),(0,k.jsxs)(`div`,{className:`row wrap gap-10`,children:[(0,k.jsx)(I,{verdict:i?.verdict}),c&&(0,k.jsxs)(`span`,{className:`badge ${c.tone}`,title:s,children:[(0,k.jsx)(`span`,{className:`dot`}),c.label]}),(0,k.jsxs)(`span`,{className:`badge`,children:[(0,k.jsx)(`span`,{className:`dot`}),l,` local edits`]})]})]})}),(0,k.jsxs)(`div`,{className:`grid split-even`,children:[(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsxs)(`div`,{className:`card-head`,children:[(0,k.jsx)(`h3`,{children:`Genome strand`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsx)(`span`,{className:`tick`,children:`by volume`})})]}),o.map(t=>(0,k.jsx)(H,{k:t,overview:e,max:a},t))]}),(0,k.jsxs)(`div`,{className:`card pad-lg`,children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Recent activity`})}),(0,k.jsx)(z,{jobs:r})]})]})]})}function G({overview:e,setup:t,jobs:n,lens:r}){let i=o.reduce((t,n)=>t+(e.counts?.[n]??0),0),s=g(e.counts),c=e.doctor?.ok,l=e.doctor?.problems?.length??0,u=x(e.diff);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`div`,{className:`card pad-md rise mb-16`,children:(0,k.jsx)(`div`,{className:`row wrap between gap-16`,children:(0,k.jsxs)(`div`,{className:`row`,style:{gap:20,flexWrap:`wrap`},children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`status`}),(0,k.jsxs)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:[(0,k.jsxs)(`span`,{className:`badge ${e.deployed?`ok`:`warn`}`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.deployed?`deployed`:`not deployed`]}),(0,k.jsx)(I,{verdict:r?.verdict})]})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`voice`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6,textTransform:`capitalize`},children:e.theme})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`mode`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6},children:e.emit})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`fingerprint`}),(0,k.jsx)(`div`,{className:`mono`,style:{fontSize:14,marginTop:6,color:`var(--accent-text)`},children:t?.installed_fp||`—`})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`doctor`}),(0,k.jsx)(`div`,{className:`row`,style:{gap:8,marginTop:4},children:c?(0,k.jsxs)(`span`,{className:`badge ok`,children:[(0,k.jsx)(`span`,{className:`dot`}),`clean`]}):(0,k.jsxs)(`span`,{className:`badge warn`,children:[(0,k.jsx)(`span`,{className:`dot`}),e.doctor===null?`checking`:`${l} issue${l===1?``:`s`}`]})})]}),(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`tick`,children:`edits`}),(0,k.jsx)(`div`,{className:`metric`,style:{fontSize:18,marginTop:6},children:u})]})]})})}),(0,k.jsxs)(`div`,{className:`grid split-operator`,children:[(0,k.jsxs)(`div`,{className:`card rise`,style:{"--i":1},children:[(0,k.jsxs)(`div`,{className:`card-head pad-lg`,style:{padding:`18px 20px 0`,marginBottom:14},children:[(0,k.jsx)(`h3`,{children:`Sections`}),(0,k.jsx)(`div`,{className:`right`,children:(0,k.jsxs)(`span`,{className:`tick`,children:[i,` entries total`]})})]}),(0,k.jsxs)(`table`,{className:`tbl`,children:[(0,k.jsx)(`thead`,{children:(0,k.jsxs)(`tr`,{children:[(0,k.jsx)(`th`,{children:`Section`}),(0,k.jsx)(`th`,{children:`Detail`}),(0,k.jsx)(`th`,{style:{width:130},children:`Share`}),(0,k.jsx)(`th`,{className:`num`,children:`Count`})]})}),(0,k.jsx)(`tbody`,{children:o.map(t=>{let n=a[t],r=e.counts?.[t]??0;return(0,k.jsxs)(`tr`,{className:`clickable`,children:[(0,k.jsx)(`td`,{className:`name`,children:(0,k.jsx)(`a`,{href:`#/section/`+t,className:`stretch-link`,children:n.label})}),(0,k.jsx)(`td`,{className:`muted`,children:n.desc}),(0,k.jsx)(`td`,{children:(0,k.jsx)(`div`,{className:`hbar`,children:(0,k.jsx)(`i`,{style:{width:`${r/s*100}%`}})})}),(0,k.jsx)(`td`,{className:`num`,children:r})]},t)})})]})]}),(0,k.jsxs)(`div`,{className:`card pad-lg rise`,style:{"--i":2},children:[(0,k.jsx)(`div`,{className:`card-head`,children:(0,k.jsx)(`h3`,{children:`Run log`})}),(0,k.jsx)(P,{jobs:n,max:8,empty:(0,k.jsx)(`div`,{className:`feed`,children:(0,k.jsxs)(`div`,{className:`empty`,children:[(0,k.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=S(()=>q(()=>i.fleet()),[e]),r=S(()=>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?h(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,E.lazy)(()=>y(()=>import(`./GreenhouseView-DO3ADmT9.js`),__vite__mapDeps([0,1,2,3,4,5,6,7]))),Z=(0,E.lazy)(()=>y(()=>import(`./OperatorHudView-QtSaSyYm.js`),__vite__mapDeps([8,1,2,3,4,5,6,7]))),Q=(0,E.lazy)(()=>y(()=>import(`./JournalView--W-Lw_V9.js`),__vite__mapDeps([9,1,2,3,4,5,6,7])));function $({overview:e,overviewError:t,onRetry:n,themes:r,setup:a,runs:o,onAction:c,layout:l=`genome`,dataRev:u}){let d=l,[f,m]=(0,E.useState)(`status`),[h,g]=(0,E.useState)(d);h!==d&&(g(d),m(`status`));let y=e&&r.find(t=>t.name===e.theme)?.sigil||``,x=J({dataRev:u,needDoctor:d===`greenhouse`||d===`hud`}),{data:C}=S(()=>d===`journal`?i.recent().catch(()=>null):Promise.resolve(null),[d,u]);if(!e)return t?(0,k.jsx)(_,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,k.jsx)(b,{});let w=e.daemon_stale?(0,k.jsx)(s,{}):null;return e.deployed?(0,k.jsxs)(k.Fragment,{children:[w,(0,k.jsx)(`div`,{className:`head-row`,children:(0,k.jsx)(v,{"aria-label":`Dashboard view`,children:[[`status`,`Status`],[`lineage`,`Lineage`],[`readout`,`Readout`]].map(([e,t])=>(0,k.jsx)(`button`,{className:f===e?`on`:``,onClick:()=>m(e),"aria-pressed":f===e,children:t},e))})}),(0,k.jsxs)(`div`,{className:`view-in`,children:[f===`status`&&d===`genome`&&(0,k.jsx)(V,{overview:e,sigil:y,setup:a,jobs:o,lens:x,dataRev:u}),f===`status`&&d===`greenhouse`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(X,{overview:e,sigil:y,jobs:o,lens:x,onAction:c})}),f===`status`&&d===`hud`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(Z,{overview:e,jobs:o,lens:x})}),f===`status`&&d===`journal`&&(0,k.jsx)(E.Suspense,{fallback:(0,k.jsx)(b,{}),children:(0,k.jsx)(Q,{overview:e,recent:C,lens:x,dataRev:u})}),f===`lineage`&&(0,k.jsx)(W,{overview:e,sigil:y,setup:a,jobs:o,lens:x}),f===`readout`&&(0,k.jsx)(G,{overview:e,setup:a,jobs:o,lens:x})]},f)]}):(0,k.jsxs)(k.Fragment,{children:[w,(0,k.jsx)(p,{onAction:c})]})}export{$ as default,O as i,I as n,P as r,Y as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-DLDVY3K-.js";import{H as a,Ot as o,_t as s,ct as c,et as l,i as u,n as d,ot as f,r as p,rt as ee,st as te,tt as m,wt as h}from"./index-BL3P-9Rg.js";import{t as g}from"./EmptyState-CY5Pm2xy.js";import{a as _,i as ne,n as re,o as ie,s as ae}from"./LibRows-D6-CVa3K.js";import{t as v}from"./CopyButton-BVbpriMB.js";import{a as y,i as b,r as x}from"./Markdown-CxkA7940.js";import{i as S}from"./motion-RlUl1osO.js";var C=e(t(),1),w=n();function T(e,t=0){let n=String(e).toLowerCase().trim().replace(/[^a-z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``);return n&&/^[a-z]/.test(n)?n:`h-${t}-${n||`section`}`}function E(e){let t=[],n=[],r=`before`;for(let i of(e||``).split(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{t as i}from"./api-CZ-x0iWG.js";import{H as a,Ot as o,_t as s,ct as c,et as l,i as u,n as d,ot as f,r as p,rt as ee,st as te,tt as m,wt as h}from"./index-B_pTwZra.js";import{t as g}from"./EmptyState-CY5Pm2xy.js";import{a as _,i as ne,n as re,o as ie,s as ae}from"./LibRows-CiPvsRYB.js";import{t as v}from"./CopyButton-C0wwRR9H.js";import{a as y,i as b,r as x}from"./Markdown-CxkA7940.js";import{i as S}from"./motion-RlUl1osO.js";var C=e(t(),1),w=n();function T(e,t=0){let n=String(e).toLowerCase().trim().replace(/[^a-z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``);return n&&/^[a-z]/.test(n)?n:`h-${t}-${n||`section`}`}function E(e){let t=[],n=[],r=`before`;for(let i of(e||``).split(`
2
2
  `))r===`before`&&/^\|\s*piece\s*\|/i.test(i)?r=`map`:r===`map`&&!i.trimStart().startsWith(`|`)&&(r=`after`),r===`before`?t.push(i):r===`after`&&n.push(i);return[t.join(`
3
3
  `),n.join(`
4
4
  `)]}function D(e){let t=[...e.querySelectorAll(`h2, h3, h4, h5, h6`)],n=e=>Number(e.tagName[1]),r=t.length?Math.min(...t.map(n))-2:0;if(!(r<=0))for(let e of t){let t=document.createElement(`h${n(e)-r}`);for(let n of e.attributes)t.setAttribute(n.name,n.value);t.append(...e.childNodes),e.replaceWith(t)}}function O(e,t){let n=document.createElement(`template`);return n.innerHTML=e,D(n.content),n.content.querySelectorAll(`h1, h2, h3`).forEach(e=>{e.tagName!==`H1`&&(t.idx+=1);let n=e.id||T(e.textContent||``,t.idx),r=n;for(let e=2;t.ids.has(r);e++)r=`${n}-${e}`;t.ids.add(r),e.id=r,e.tagName!==`H1`&&t.toc.push({level:Number(e.tagName[1]),title:(e.textContent||``).trim(),id:r})}),n.content.querySelectorAll(`table`).forEach(e=>{let t=document.createElement(`div`);t.className=`table-scroll`,t.setAttribute(`tabindex`,`0`),t.setAttribute(`role`,`region`),t.setAttribute(`aria-label`,`Table`),e.replaceWith(t),t.appendChild(e)}),n.innerHTML}function k(e){let t={ids:new Set,idx:0,toc:[]},n=n=>O(x(n,e?.links),t);if(e?.rows){let[r,i]=E(e.body);return{before:n(r),after:n(i),toc:t.toc}}return{html:n(e?.body),toc:t.toc}}var A=r(),j={"opencode-global":[`install-opencode`,`Global (recommended)`],opencode:[`install-opencode`,`Per repo`],"claude-global":[`install-claude-code`],claude:[`install-claude-code`],"openclaude-global":[`install-openclaude`],openclaude:[`install-openclaude`],"bob-global":[`install-bob`],bob:[`install-bob`],files:[`install-agent-md`]},M=`you already know this`,N=e=>Math.max(1,Math.ceil((e||``).split(/\s+/).filter(Boolean).length/200));function P(e){return e.querySelectorAll(`pre`).forEach(e=>{if(e.parentElement?.classList.contains(`docs-code`))return;let t=document.createElement(`figure`);t.className=`docs-code`;let n=document.createElement(`figcaption`),r=e.querySelector(`code`)?.className.match(/(?:^|\s)language-(\S+)/)?.[1];if(r){let e=document.createElement(`span`);e.className=`mono`,e.textContent=r,n.append(e)}e.replaceWith(t),t.append(n,e)}),[...e.querySelectorAll(`figure.docs-code > figcaption`)]}var F=e=>(e.parentElement?.querySelector(`pre`)?.textContent||``).replace(/\n+$/,``),I=40,L=e=>{let t=e.split(`
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,mt as u,nt as ee,tt as d,wt as f}from"./index-BL3P-9Rg.js";import{n as p,t as m}from"./usePoll-D5c_qIFZ.js";import{t as h}from"./EmptyState-CY5Pm2xy.js";import{t as g}from"./CopyButton-BVbpriMB.js";import{t as _}from"./DataTable-b9zTShqJ.js";import{a as v,n as y,s as b}from"./ActiveLoops-BJJN3P-V.js";import{a as x,i as te,n as ne,o as S,s as C}from"./LibRows-D6-CVa3K.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)),l=new Map(t.map(e=>[e.name,e])),u=fe(e,t),ee=new Set([...u.values()].flat()),d=e=>ue(c,e.from,e.to,ee),f=new Map(o.has(e.start)?[[e.start,0]]:[]),p=s.filter(e=>o.has(e.to)&&!d(e));for(let e=0;e<a.length;e++){let e=!1;for(let t of p){if(!f.has(t.from))continue;let n=f.get(t.from)+1;f.get(t.to)>=n||(f.set(t.to,n),e=!0)}if(!e)break}let m=Math.max(-1,...f.values());for(let e of a)f.has(e)||f.set(e,++m);let h=m+1,g=[];for(let e of a)(g[f.get(e)]||=[]).push(e);let _=e=>g[f.get(e)].length>1,v=n.rails?T:oe,y=n.rails?re:ae,x=r===1/0?1/0:r-2*v,te=()=>Math.max(j.lane.w,Math.min(240,x-28)),ne=e=>n.rails?j.lane.w:Math.max(ie,Math.min(j.lane.w,Math.floor((x-y*(e-1))/e))),S=a.map(e=>{let t=_(e),n=e.startsWith(M)?e.slice(5):null,r=n?`loop`:u.has(e)?`fork`:`brick`;return{id:e,kind:r,...t?{w:ne(g[f.get(e)].length),h:j.lane.h}:{...j[r]||j.brick},rank:f.get(e),lane:t,stacked:!1,loop:n,human:r===`brick`||r===`fork`?b(l.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:h,tags:[]};S.push(e),C.set(`$close`,e),g[h]=[`$close`]}let de=e=>{let t=null;for(let n of u.keys())f.get(n)<f.get(e)&&(!t||f.get(n)>f.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=d(e),r=e.to===`$lane`?u.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-f.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`&&_(e.from)),me=n.rails?I:[...pe,...F.filter(e=>e.kind===`stop`&&!_(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=g.map(e=>(e||[]).map(e=>C.get(e))),R=e=>e.reduce((e,t)=>e+t.w,0)+y*(e.length-1),z=L.map(e=>n.stack&&e.length>1&&R(e)>x);L.forEach((e,t)=>{if(z[t])for(let t of e)Object.assign(t,{stacked:!0,w:te()})});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+y;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:v;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`&&!_(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)+v;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:h,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&&u.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 l=(0,w.useRef)(null),[u,ee]=(0,w.useState)(0);(0,w.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>ee(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 d=s===void 0?P(e,c,t):s,f=F(e,t,{width:u,lane:d}),p=new Set(n.map(e=>e.name)),m=new Map((e.cycles||[]).map(e=>[e.name,e])),h=new Set(f.nodes.filter(e=>e.kind===`fork`).map(e=>e.id)),g=e=>e.kind===`back`?N(m.get(e.cycle),o):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,_=e=>e.kind===`loop`?`${e.id} stage, the ${e.loop} loop`:`${e.id} ${e.kind===`fork`?`fork`:`brick`}${e.human?`, ${e.human.toLowerCase()}`:``}`,y=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},b=e=>{let t=e.id===i,n=`${_(e)}${e.id===d?`, the lane taken`:``}`,o=t&&a&&(e.loop||e.lane)?`, at ${a.node}`:``;return r?{role:`button`,tabIndex:0,"aria-label":`${n}${o}`,onClick:y(e.id),onKeyDown:y(e.id)}:{role:`img`,"aria-label":`${n}${t?`, current stage`:``}${o}`}},x=e=>`fg-node ${e.kind}${e.lane?` lane`:``}${e.id===i?` current`:``}${e.id===d?` taken`:``}`,te=e=>d&&(e.to===d||e.from===d),ne=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:g(t)},`${t.kind}${t.to}`));return(0,I.jsxs)(`div`,{className:`fg-wrap`,ref:l,children:[(0,I.jsxs)(`svg`,{className:`fgraph`,"data-mode":`${f.mode}${f.stacked?` stacked`:``}`,style:{"--fg-w":`${f.width}px`},viewBox:`0 0 ${f.width} ${f.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))}),f.edges.map(e=>{if(!e.path)return null;let t=e.kind===`skip`?`flow`:e.kind,n=e.back?N(m.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}${te(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`&&h.has(e.from)?` fork`:``}`,children:n}):null]},`${e.from}>${e.to}`)}),f.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?p.has(e.loop)?`whole loop`:`not in catalogue`:e.lane?`no loop`:null;return(0,I.jsxs)(`g`,{children:[(0,I.jsxs)(`g`,{className:x(e),"aria-current":t,...b(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)(v,{x:e.x+e.w-4,y:e.y+4,label:e.human}):null]}),ne(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=a.factories.map(e=>[e,i[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)(_,{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(y[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)(g,{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)(g,{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${y[e.status]?` ${y[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 i=s(n),[a,p]=o(`factories`,i),{data:m,error:g}=f(()=>r.factories(l(a)),[n,a?.id??``],`factories`),{runs:_,error:v}=we(),[y,b]=(0,w.useState)(``),[T,E]=(0,w.useState)(`all`),[re,ie]=(0,w.useState)(e);e!==re&&(ie(e),b(``),E(`all`));let ae=m?.bricks||[],oe=m?.loops||[],D=e===`active`?_&&K(_):m&&G(m.factories||[]),O=D||[],se=C(O),k=T===`all`?O:O.filter(e=>e.group===T),ce=y.trim(),A=x(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:_?.length},N=R.find(([t])=>t===e)[1],ue=e===`active`?v:g;return(0,I.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,I.jsx)(ee,{className:`page-pick`,installs:i,value:a,onChange:p}),(0,I.jsx)(c,{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)(S,{label:B[t],total:O.length,cats:se,cat:T,onChange:E})]},t))})]}),(0,I.jsx)(te,{label:N,count:ce?`${A.length} of ${k.length}`:D?k.length:``,q:y,onQ:b,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)(h,{title:Se[e].title,children:Se[e].body}):(0,I.jsx)(ne,{rows:A,activeName:M?.name,hrefOf:t=>`#/factories/${e}/${ge(t.name)}`,pills:Q[e]}):ue?null:(0,I.jsx)(d,{})}),(0,I.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:j?(0,I.jsx)(h,{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:a?u(a):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)(h,{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
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-CZ-x0iWG.js";import{Dt as i,Et as a,J as o,Y as s,et as c,ht as l,mt as u,nt as ee,tt as d,wt as f}from"./index-B_pTwZra.js";import{n as p,t as m}from"./usePoll-D5c_qIFZ.js";import{t as h}from"./EmptyState-CY5Pm2xy.js";import{t as g}from"./CopyButton-C0wwRR9H.js";import{t as _}from"./DataTable-b9zTShqJ.js";import{a as v,n as y,s as b}from"./ActiveLoops-DOJCPPPc.js";import{a as x,i as te,n as ne,o as S,s as C}from"./LibRows-CiPvsRYB.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)),l=new Map(t.map(e=>[e.name,e])),u=fe(e,t),ee=new Set([...u.values()].flat()),d=e=>ue(c,e.from,e.to,ee),f=new Map(o.has(e.start)?[[e.start,0]]:[]),p=s.filter(e=>o.has(e.to)&&!d(e));for(let e=0;e<a.length;e++){let e=!1;for(let t of p){if(!f.has(t.from))continue;let n=f.get(t.from)+1;f.get(t.to)>=n||(f.set(t.to,n),e=!0)}if(!e)break}let m=Math.max(-1,...f.values());for(let e of a)f.has(e)||f.set(e,++m);let h=m+1,g=[];for(let e of a)(g[f.get(e)]||=[]).push(e);let _=e=>g[f.get(e)].length>1,v=n.rails?T:oe,y=n.rails?re:ae,x=r===1/0?1/0:r-2*v,te=()=>Math.max(j.lane.w,Math.min(240,x-28)),ne=e=>n.rails?j.lane.w:Math.max(ie,Math.min(j.lane.w,Math.floor((x-y*(e-1))/e))),S=a.map(e=>{let t=_(e),n=e.startsWith(M)?e.slice(5):null,r=n?`loop`:u.has(e)?`fork`:`brick`;return{id:e,kind:r,...t?{w:ne(g[f.get(e)].length),h:j.lane.h}:{...j[r]||j.brick},rank:f.get(e),lane:t,stacked:!1,loop:n,human:r===`brick`||r===`fork`?b(l.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:h,tags:[]};S.push(e),C.set(`$close`,e),g[h]=[`$close`]}let de=e=>{let t=null;for(let n of u.keys())f.get(n)<f.get(e)&&(!t||f.get(n)>f.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=d(e),r=e.to===`$lane`?u.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-f.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`&&_(e.from)),me=n.rails?I:[...pe,...F.filter(e=>e.kind===`stop`&&!_(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=g.map(e=>(e||[]).map(e=>C.get(e))),R=e=>e.reduce((e,t)=>e+t.w,0)+y*(e.length-1),z=L.map(e=>n.stack&&e.length>1&&R(e)>x);L.forEach((e,t)=>{if(z[t])for(let t of e)Object.assign(t,{stacked:!0,w:te()})});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+y;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:v;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`&&!_(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)+v;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:h,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&&u.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 l=(0,w.useRef)(null),[u,ee]=(0,w.useState)(0);(0,w.useLayoutEffect)(()=>{let e=l.current;if(!e)return;let t=()=>ee(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 d=s===void 0?P(e,c,t):s,f=F(e,t,{width:u,lane:d}),p=new Set(n.map(e=>e.name)),m=new Map((e.cycles||[]).map(e=>[e.name,e])),h=new Set(f.nodes.filter(e=>e.kind===`fork`).map(e=>e.id)),g=e=>e.kind===`back`?N(m.get(e.cycle),o):`${e.on.join(` · `)} → ${e.kind===`stop`?`stop`:e.to}`,_=e=>e.kind===`loop`?`${e.id} stage, the ${e.loop} loop`:`${e.id} ${e.kind===`fork`?`fork`:`brick`}${e.human?`, ${e.human.toLowerCase()}`:``}`,y=e=>t=>{(t.type===`click`||t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r?.(e))},b=e=>{let t=e.id===i,n=`${_(e)}${e.id===d?`, the lane taken`:``}`,o=t&&a&&(e.loop||e.lane)?`, at ${a.node}`:``;return r?{role:`button`,tabIndex:0,"aria-label":`${n}${o}`,onClick:y(e.id),onKeyDown:y(e.id)}:{role:`img`,"aria-label":`${n}${t?`, current stage`:``}${o}`}},x=e=>`fg-node ${e.kind}${e.lane?` lane`:``}${e.id===i?` current`:``}${e.id===d?` taken`:``}`,te=e=>d&&(e.to===d||e.from===d),ne=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:g(t)},`${t.kind}${t.to}`));return(0,I.jsxs)(`div`,{className:`fg-wrap`,ref:l,children:[(0,I.jsxs)(`svg`,{className:`fgraph`,"data-mode":`${f.mode}${f.stacked?` stacked`:``}`,style:{"--fg-w":`${f.width}px`},viewBox:`0 0 ${f.width} ${f.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))}),f.edges.map(e=>{if(!e.path)return null;let t=e.kind===`skip`?`flow`:e.kind,n=e.back?N(m.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}${te(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`&&h.has(e.from)?` fork`:``}`,children:n}):null]},`${e.from}>${e.to}`)}),f.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?p.has(e.loop)?`whole loop`:`not in catalogue`:e.lane?`no loop`:null;return(0,I.jsxs)(`g`,{children:[(0,I.jsxs)(`g`,{className:x(e),"aria-current":t,...b(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)(v,{x:e.x+e.w-4,y:e.y+4,label:e.human}):null]}),ne(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=a.factories.map(e=>[e,i[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)(_,{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(y[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)(g,{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)(g,{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${y[e.status]?` ${y[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 i=s(n),[a,p]=o(`factories`,i),{data:m,error:g}=f(()=>r.factories(l(a)),[n,a?.id??``],`factories`),{runs:_,error:v}=we(),[y,b]=(0,w.useState)(``),[T,E]=(0,w.useState)(`all`),[re,ie]=(0,w.useState)(e);e!==re&&(ie(e),b(``),E(`all`));let ae=m?.bricks||[],oe=m?.loops||[],D=e===`active`?_&&K(_):m&&G(m.factories||[]),O=D||[],se=C(O),k=T===`all`?O:O.filter(e=>e.group===T),ce=y.trim(),A=x(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:_?.length},N=R.find(([t])=>t===e)[1],ue=e===`active`?v:g;return(0,I.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,I.jsx)(ee,{className:`page-pick`,installs:i,value:a,onChange:p}),(0,I.jsx)(c,{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)(S,{label:B[t],total:O.length,cats:se,cat:T,onChange:E})]},t))})]}),(0,I.jsx)(te,{label:N,count:ce?`${A.length} of ${k.length}`:D?k.length:``,q:y,onQ:b,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)(h,{title:Se[e].title,children:Se[e].body}):(0,I.jsx)(ne,{rows:A,activeName:M?.name,hrefOf:t=>`#/factories/${e}/${ge(t.name)}`,pills:Q[e]}):ue?null:(0,I.jsx)(d,{})}),(0,I.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:j?(0,I.jsx)(h,{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:a?u(a):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)(h,{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 +1 @@
1
- import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,R as r,V as i,_t as a,vt as o}from"./index-BL3P-9Rg.js";import{i as s,n as c,r as l}from"./Dashboard-CIJLPHM9.js";import{n as u,r as d}from"./sections-CtFz7HFH.js";import{n as f,t as p}from"./motion-RlUl1osO.js";e();var m=t(),h=12,g=Array.from({length:7},(e,t)=>`var(--cat-${t})`),_=f[9];function v({segments:e,size:t=186,stroke:n=26,caption:r=`capabilities`}){let a=e.reduce((e,t)=>e+t.n,0);return(0,m.jsxs)(`div`,{className:`ring-box`,children:[(0,m.jsx)(i,{segments:e,size:t,stroke:n,label:r,sweepMs:_}),(0,m.jsxs)(`div`,{className:`ring-center`,children:[(0,m.jsx)(`div`,{className:`donut-c-num`,children:(0,m.jsx)(p,{value:a,duration:_})}),(0,m.jsx)(`div`,{className:`donut-c-cap`,children:r})]})]})}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)(a,{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:i,lens:f,onAction:_}){let y=e.counts||{},S=f?.doctor?.state||`loading`,C=f?.doctor?.data?.groups||[],w=S===`ok`,T=C.filter(e=>e.problems.length===0).length,E=C.length,D=s(e,f?.tone),O=r(i,h),k=o(e.diff),A=d.filter(e=>(y[e]||0)>0).map((e,t)=>({key:e,label:u[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=n(i||[],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)(c,{verdict:f?.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)(a,{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)(p,{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)(l,{jobs:i,max:h,empty:(0,m.jsx)(`p`,{className:`sub`,children:`No runs yet. Trigger an action to populate this.`})})]})]})}export{S as default};
1
+ import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{I as n,R as r,V as i,_t as a,vt as o}from"./index-B_pTwZra.js";import{i as s,n as c,r as l}from"./Dashboard-DPAA96EI.js";import{n as u,r as d}from"./sections-CtFz7HFH.js";import{n as f,t as p}from"./motion-RlUl1osO.js";e();var m=t(),h=12,g=Array.from({length:7},(e,t)=>`var(--cat-${t})`),_=f[9];function v({segments:e,size:t=186,stroke:n=26,caption:r=`capabilities`}){let a=e.reduce((e,t)=>e+t.n,0);return(0,m.jsxs)(`div`,{className:`ring-box`,children:[(0,m.jsx)(i,{segments:e,size:t,stroke:n,label:r,sweepMs:_}),(0,m.jsxs)(`div`,{className:`ring-center`,children:[(0,m.jsx)(`div`,{className:`donut-c-num`,children:(0,m.jsx)(p,{value:a,duration:_})}),(0,m.jsx)(`div`,{className:`donut-c-cap`,children:r})]})]})}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)(a,{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:i,lens:f,onAction:_}){let y=e.counts||{},S=f?.doctor?.state||`loading`,C=f?.doctor?.data?.groups||[],w=S===`ok`,T=C.filter(e=>e.problems.length===0).length,E=C.length,D=s(e,f?.tone),O=r(i,h),k=o(e.diff),A=d.filter(e=>(y[e]||0)>0).map((e,t)=>({key:e,label:u[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=n(i||[],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)(c,{verdict:f?.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)(a,{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)(p,{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)(l,{jobs:i,max:h,empty:(0,m.jsx)(`p`,{className:`sub`,children:`No runs yet. Trigger an action to populate this.`})})]})]})}export{S as default};