@ashlr/hub 3.5.0 → 3.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 (168) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/build-identity.json +2 -2
  3. package/dist/core/fleet/external-skill-audit.js +1 -1
  4. package/dist/core/fleet/external-skill-audit.js.map +1 -1
  5. package/dist/core/local-runtime/llama/config.d.ts +28 -6
  6. package/dist/core/local-runtime/llama/config.js +28 -6
  7. package/dist/core/local-runtime/llama/config.js.map +1 -1
  8. package/dist/core/web/public/next/assets/App-BbVoUCIi.js +7 -0
  9. package/dist/core/web/public/next/assets/App-BbVoUCIi.js.map +1 -0
  10. package/dist/core/web/public/next/assets/App-Cgi6j1Gk.css +1 -0
  11. package/dist/core/web/public/next/assets/ApprovalsSection-BW9iVjUa.js +2 -0
  12. package/dist/core/web/public/next/assets/ApprovalsSection-BW9iVjUa.js.map +1 -0
  13. package/dist/core/web/public/next/assets/ApprovalsSection-Su-NUTis.css +1 -0
  14. package/dist/core/web/public/next/assets/AutonomySection-CRqHUhED.js +2 -0
  15. package/dist/core/web/public/next/assets/AutonomySection-CRqHUhED.js.map +1 -0
  16. package/dist/core/web/public/next/assets/AutonomySection-Cpk_oEhc.css +1 -0
  17. package/dist/core/web/public/next/assets/ChatSection-5irrh6Jw.js +80 -0
  18. package/dist/core/web/public/next/assets/ChatSection-5irrh6Jw.js.map +1 -0
  19. package/dist/core/web/public/next/assets/ChatSection-LQiAn6Eu.css +1 -0
  20. package/dist/core/web/public/next/assets/ConfirmDialog-CXevY3Au.js +2 -0
  21. package/dist/core/web/public/next/assets/ConfirmDialog-CXevY3Au.js.map +1 -0
  22. package/dist/core/web/public/next/assets/{ConfirmDialog-cYuivhCX.css → ConfirmDialog-Dx15x0Ho.css} +1 -1
  23. package/dist/core/web/public/next/assets/Dialog-Bn0CgEGz.js +2 -0
  24. package/dist/core/web/public/next/assets/Dialog-Bn0CgEGz.js.map +1 -0
  25. package/dist/core/web/public/next/assets/Dialog-tQ8kFulD.css +1 -0
  26. package/dist/core/web/public/next/assets/DiffViewer-C8HHTnVE.css +1 -0
  27. package/dist/core/web/public/next/assets/DiffViewer-QKyisN2L.js +7 -0
  28. package/dist/core/web/public/next/assets/DiffViewer-QKyisN2L.js.map +1 -0
  29. package/dist/core/web/public/next/assets/{MutationTokenDialog-jWLLCxWn.css → MutationTokenDialog-CrfJ0PdD.css} +1 -1
  30. package/dist/core/web/public/next/assets/MutationTokenDialog-DbSHPy3w.js +2 -0
  31. package/dist/core/web/public/next/assets/MutationTokenDialog-DbSHPy3w.js.map +1 -0
  32. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-C-PCgCzo.js +7 -0
  33. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-C-PCgCzo.js.map +1 -0
  34. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-CM_8pJs6.css +1 -0
  35. package/dist/core/web/public/next/assets/RouteErrorBoundary-Dw8ZjmkS.js +2 -0
  36. package/dist/core/web/public/next/assets/RouteErrorBoundary-Dw8ZjmkS.js.map +1 -0
  37. package/dist/core/web/public/next/assets/RouteErrorBoundary-ekyMXAK8.css +1 -0
  38. package/dist/core/web/public/next/assets/SettingsSection-BII7TTSD.css +1 -0
  39. package/dist/core/web/public/next/assets/SettingsSection-CWxtTNlD.js +2 -0
  40. package/dist/core/web/public/next/assets/SettingsSection-CWxtTNlD.js.map +1 -0
  41. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bk5HipM0.js +2 -0
  42. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bk5HipM0.js.map +1 -0
  43. package/dist/core/web/public/next/assets/UniverseConsoleApp-Dh7A-hLD.css +1 -0
  44. package/dist/core/web/public/next/assets/UniverseView-Bqa8DH57.css +1 -0
  45. package/dist/core/web/public/next/assets/UniverseView-D8k9q0ce.js +9 -0
  46. package/dist/core/web/public/next/assets/UniverseView-D8k9q0ce.js.map +1 -0
  47. package/dist/core/web/public/next/assets/UsageSection-B2E06ZH1.js +2 -0
  48. package/dist/core/web/public/next/assets/UsageSection-B2E06ZH1.js.map +1 -0
  49. package/dist/core/web/public/next/assets/UsageSection-DwgNOYvi.css +1 -0
  50. package/dist/core/web/public/next/assets/VerseConsoleApp-CRfZUV-T.js +3 -0
  51. package/dist/core/web/public/next/assets/VerseConsoleApp-CRfZUV-T.js.map +1 -0
  52. package/dist/core/web/public/next/assets/VerseConsoleApp-D2E3mU9a.css +1 -0
  53. package/dist/core/web/public/next/assets/charts-CsrtT4rk.css +1 -0
  54. package/dist/core/web/public/next/assets/charts-DSUpczxG.js +2 -0
  55. package/dist/core/web/public/next/assets/charts-DSUpczxG.js.map +1 -0
  56. package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js +2 -0
  57. package/dist/core/web/public/next/assets/fleet-model-ClBbQ0Uj.js.map +1 -0
  58. package/dist/core/web/public/next/assets/format-BNYWGJat.js +2 -0
  59. package/dist/core/web/public/next/assets/format-BNYWGJat.js.map +1 -0
  60. package/dist/core/web/public/next/assets/global-C4jfYHrj.js +2 -0
  61. package/dist/core/web/public/next/assets/global-C4jfYHrj.js.map +1 -0
  62. package/dist/core/web/public/next/assets/global-D463gG1X.css +1 -0
  63. package/dist/core/web/public/next/assets/icons-BxOX8-XB.js +2 -0
  64. package/dist/core/web/public/next/assets/icons-BxOX8-XB.js.map +1 -0
  65. package/dist/core/web/public/next/assets/index-BMRIET7F.js +11 -0
  66. package/dist/core/web/public/next/assets/index-BMRIET7F.js.map +1 -0
  67. package/dist/core/web/public/next/assets/queries-AxnVa02h.js +2 -0
  68. package/dist/core/web/public/next/assets/queries-AxnVa02h.js.map +1 -0
  69. package/dist/core/web/public/next/assets/use-guarded-action-BO6c94Wp.js +2 -0
  70. package/dist/core/web/public/next/assets/use-guarded-action-BO6c94Wp.js.map +1 -0
  71. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js +2 -0
  72. package/dist/core/web/public/next/assets/verse-model-CvtK6vP6.js.map +1 -0
  73. package/dist/core/web/public/next/assets/workspace-model-cE4LkKpE.js +2 -0
  74. package/dist/core/web/public/next/assets/workspace-model-cE4LkKpE.js.map +1 -0
  75. package/dist/core/web/public/next/index.html +1 -1
  76. package/dist/release-dependency-inventory.json +1 -1
  77. package/node_modules/marked/README.md +8 -0
  78. package/node_modules/marked/bin/main.js +12 -11
  79. package/node_modules/marked/lib/marked.d.ts +88 -25
  80. package/node_modules/marked/lib/marked.esm.js +50 -44
  81. package/node_modules/marked/lib/marked.esm.js.map +3 -3
  82. package/node_modules/marked/lib/marked.umd.js +50 -44
  83. package/node_modules/marked/lib/marked.umd.js.map +3 -3
  84. package/node_modules/marked/man/marked.1 +1 -1
  85. package/node_modules/marked/package.json +21 -21
  86. package/package.json +13 -8
  87. package/dist/core/web/public/next/assets/App-BCKqSppK.css +0 -1
  88. package/dist/core/web/public/next/assets/App-CsbPYQqy.js +0 -16
  89. package/dist/core/web/public/next/assets/App-CsbPYQqy.js.map +0 -1
  90. package/dist/core/web/public/next/assets/ApprovalsSection-CBZquyLK.js +0 -2
  91. package/dist/core/web/public/next/assets/ApprovalsSection-CBZquyLK.js.map +0 -1
  92. package/dist/core/web/public/next/assets/ApprovalsSection-CRP59wSb.css +0 -1
  93. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js +0 -2
  94. package/dist/core/web/public/next/assets/AutonomySection-CQVpEdCE.js.map +0 -1
  95. package/dist/core/web/public/next/assets/AutonomySection-DTN6m6QE.css +0 -1
  96. package/dist/core/web/public/next/assets/ChatSection-DiRvNX3Q.css +0 -1
  97. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js +0 -77
  98. package/dist/core/web/public/next/assets/ChatSection-DmE9K0Tg.js.map +0 -1
  99. package/dist/core/web/public/next/assets/ConfirmDialog-deO0C0iY.js +0 -2
  100. package/dist/core/web/public/next/assets/ConfirmDialog-deO0C0iY.js.map +0 -1
  101. package/dist/core/web/public/next/assets/Dialog-CNd7q89m.js +0 -2
  102. package/dist/core/web/public/next/assets/Dialog-CNd7q89m.js.map +0 -1
  103. package/dist/core/web/public/next/assets/Dialog-DxN7RgB5.css +0 -1
  104. package/dist/core/web/public/next/assets/DiffViewer-DTO0KRuG.js +0 -7
  105. package/dist/core/web/public/next/assets/DiffViewer-DTO0KRuG.js.map +0 -1
  106. package/dist/core/web/public/next/assets/DiffViewer-hN7X6wGT.css +0 -1
  107. package/dist/core/web/public/next/assets/Epistemic-53PikaUI.js +0 -2
  108. package/dist/core/web/public/next/assets/Epistemic-53PikaUI.js.map +0 -1
  109. package/dist/core/web/public/next/assets/Epistemic-DiyMyeaN.css +0 -1
  110. package/dist/core/web/public/next/assets/Meter-CGBsbXUX.css +0 -1
  111. package/dist/core/web/public/next/assets/Meter-DRWZQgr1.js +0 -2
  112. package/dist/core/web/public/next/assets/Meter-DRWZQgr1.js.map +0 -1
  113. package/dist/core/web/public/next/assets/MutationTokenDialog-DYF8n_RD.js +0 -2
  114. package/dist/core/web/public/next/assets/MutationTokenDialog-DYF8n_RD.js.map +0 -1
  115. package/dist/core/web/public/next/assets/RefreshIndicator-DXJQXKyA.js +0 -2
  116. package/dist/core/web/public/next/assets/RefreshIndicator-DXJQXKyA.js.map +0 -1
  117. package/dist/core/web/public/next/assets/RefreshIndicator-O7jUBOmX.css +0 -1
  118. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-DLl4DbGG.css +0 -1
  119. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-hDSEFdLU.js +0 -7
  120. package/dist/core/web/public/next/assets/ResourcePoolConsoleApp-hDSEFdLU.js.map +0 -1
  121. package/dist/core/web/public/next/assets/RouteErrorBoundary-BIpdnxp-.css +0 -1
  122. package/dist/core/web/public/next/assets/RouteErrorBoundary-CZd7ln8v.js +0 -2
  123. package/dist/core/web/public/next/assets/RouteErrorBoundary-CZd7ln8v.js.map +0 -1
  124. package/dist/core/web/public/next/assets/SettingsSection-C9Qs9JWW.js +0 -2
  125. package/dist/core/web/public/next/assets/SettingsSection-C9Qs9JWW.js.map +0 -1
  126. package/dist/core/web/public/next/assets/SettingsSection-DGJMdUh2.css +0 -1
  127. package/dist/core/web/public/next/assets/Skeleton-D2JaTXyv.css +0 -1
  128. package/dist/core/web/public/next/assets/Skeleton-YkcOpgFb.js +0 -2
  129. package/dist/core/web/public/next/assets/Skeleton-YkcOpgFb.js.map +0 -1
  130. package/dist/core/web/public/next/assets/StatusBadge-DJw0LSPg.js +0 -2
  131. package/dist/core/web/public/next/assets/StatusBadge-DJw0LSPg.js.map +0 -1
  132. package/dist/core/web/public/next/assets/StatusBadge-TpDqZf6K.css +0 -1
  133. package/dist/core/web/public/next/assets/TableView-Bj-w1O6o.js +0 -2
  134. package/dist/core/web/public/next/assets/TableView-Bj-w1O6o.js.map +0 -1
  135. package/dist/core/web/public/next/assets/TableView-R6Yeztp1.css +0 -1
  136. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bs2fxaen.js +0 -2
  137. package/dist/core/web/public/next/assets/UniverseConsoleApp-Bs2fxaen.js.map +0 -1
  138. package/dist/core/web/public/next/assets/UniverseConsoleApp-CiZZxRPV.css +0 -1
  139. package/dist/core/web/public/next/assets/UniverseView-B6b2hw-8.js +0 -9
  140. package/dist/core/web/public/next/assets/UniverseView-B6b2hw-8.js.map +0 -1
  141. package/dist/core/web/public/next/assets/UniverseView-gBxl6yum.css +0 -1
  142. package/dist/core/web/public/next/assets/UsageSection-C__ziNkV.js +0 -2
  143. package/dist/core/web/public/next/assets/UsageSection-C__ziNkV.js.map +0 -1
  144. package/dist/core/web/public/next/assets/UsageSection-UUYDidOg.css +0 -1
  145. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js +0 -3
  146. package/dist/core/web/public/next/assets/VerseConsoleApp-Cu5aG6J6.js.map +0 -1
  147. package/dist/core/web/public/next/assets/VerseConsoleApp-mOAXvWa6.css +0 -1
  148. package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js +0 -2
  149. package/dist/core/web/public/next/assets/fleet-model-DXCfVtNW.js.map +0 -1
  150. package/dist/core/web/public/next/assets/format-fggwu_Rs.js +0 -2
  151. package/dist/core/web/public/next/assets/format-fggwu_Rs.js.map +0 -1
  152. package/dist/core/web/public/next/assets/global-BHjd6fVZ.js +0 -2
  153. package/dist/core/web/public/next/assets/global-BHjd6fVZ.js.map +0 -1
  154. package/dist/core/web/public/next/assets/global-BeRYd1Bu.css +0 -1
  155. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js +0 -2
  156. package/dist/core/web/public/next/assets/index-CJ-e8YA9.js.map +0 -1
  157. package/dist/core/web/public/next/assets/index-CpgkRaTi.js +0 -51
  158. package/dist/core/web/public/next/assets/index-CpgkRaTi.js.map +0 -1
  159. package/dist/core/web/public/next/assets/queries-856qUN3Y.js +0 -2
  160. package/dist/core/web/public/next/assets/queries-856qUN3Y.js.map +0 -1
  161. package/dist/core/web/public/next/assets/use-guarded-action-Bqa2v0a-.css +0 -1
  162. package/dist/core/web/public/next/assets/use-guarded-action-DwaESKVy.js +0 -2
  163. package/dist/core/web/public/next/assets/use-guarded-action-DwaESKVy.js.map +0 -1
  164. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js +0 -2
  165. package/dist/core/web/public/next/assets/verse-model-Dllo8rRt.js.map +0 -1
  166. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js +0 -2
  167. package/dist/core/web/public/next/assets/workspace-model-JgmWDKt4.js.map +0 -1
  168. /package/node_modules/marked/{LICENSE.md → LICENSE} +0 -0
@@ -1,16 +0,0 @@
1
- import{r as c,j as e}from"./index-CpgkRaTi.js";import{f as q,k as Sn,u as Bs,i as at,r as ft,q as Cn,v as He,d as Rn,j as Os,A as Ln,D as Fs,h as Tn,S as En,l as An,m as Dn}from"./global-BHjd6fVZ.js";import{D as Jt}from"./Dialog-CNd7q89m.js";import{E as O,a as Mn,i as _t}from"./Epistemic-53PikaUI.js";import{S as U,P as In,s as Pn}from"./StatusBadge-DJw0LSPg.js";import{c as kt,f as Us,r as Ge,a as Hs,g as bt,i as Yt,d as Me,b as Gs,p as Ws,e as hs,h as Qs,j as qn,k as Bn,l as On,m as Fn,n as Un,s as Hn,o as Gn,q as Wn,v as Qn,t as Vn}from"./queries-856qUN3Y.js";import{r as zn}from"./index-CJ-e8YA9.js";import{a as Xt,r as Zt,p as Vs,b as zs,C as es}from"./ConfirmDialog-deO0C0iY.js";import{M as $t}from"./MutationTokenDialog-DYF8n_RD.js";import{u as Kn,R as Jn,T as Yn}from"./RouteErrorBoundary-CZd7ln8v.js";import{u as Ne,a as Xn}from"./UniverseView-B6b2hw-8.js";import{R as ae}from"./RefreshIndicator-DXJQXKyA.js";import{a as rt,b as te,S as K}from"./Skeleton-YkcOpgFb.js";import{S as re,f as ge,a as st,C as Le,L as Zn,T as Ie,B as Pe,b as ea,c as xt}from"./TableView-Bj-w1O6o.js";import{D as ta}from"./DiffViewer-DTO0KRuG.js";/**
2
- * react-router v7.18.2
3
- *
4
- * Copyright (c) Remix Software Inc.
5
- *
6
- * This source code is licensed under the MIT license found in the
7
- * LICENSE.md file in the root directory of this source tree.
8
- *
9
- * @license MIT
10
- */var ts=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ks=/^[\\/]{2}/;function sa(t,s){return s+t.replace(/\\/g,"/")}var ms="popstate";function ps(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function na(t={}){function s(r,l){let{pathname:o="/",search:d="",hash:i=""}=qe(r.location.hash.substring(1));return!o.startsWith("/")&&!o.startsWith(".")&&(o="/"+o),Qt("",{pathname:o,search:d,hash:i},l.state&&l.state.usr||null,l.state&&l.state.key||"default")}function n(r,l){let o=r.document.querySelector("base"),d="";if(o&&o.getAttribute("href")){let i=r.location.href,u=i.indexOf("#");d=u===-1?i:i.slice(0,u)}return d+"#"+(typeof l=="string"?l:lt(l))}function a(r,l){pe(r.pathname.charAt(0)==="/",`relative pathnames are not supported in hash history.push(${JSON.stringify(l)})`)}return ra(s,n,a,t)}function Y(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function pe(t,s){if(!t){typeof console<"u"&&console.warn(s);try{throw new Error(s)}catch{}}}function aa(){return Math.random().toString(36).substring(2,10)}function fs(t,s){return{usr:t.state,key:t.key,idx:s,masked:t.mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function Qt(t,s,n=null,a,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof s=="string"?qe(s):s,state:n,key:s&&s.key||a||aa(),mask:r}}function lt({pathname:t="/",search:s="",hash:n=""}){return s&&s!=="?"&&(t+=s.charAt(0)==="?"?s:"?"+s),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function qe(t){let s={};if(t){let n=t.indexOf("#");n>=0&&(s.hash=t.substring(n),t=t.substring(0,n));let a=t.indexOf("?");a>=0&&(s.search=t.substring(a),t=t.substring(0,a)),t&&(s.pathname=t)}return s}function ra(t,s,n,a={}){let{window:r=document.defaultView,v5Compat:l=!1}=a,o=r.history,d="POP",i=null,u=h();u==null&&(u=0,o.replaceState({...o.state,idx:u},""));function h(){return(o.state||{idx:null}).idx}function m(){d="POP";let p=h(),x=p==null?null:p-u;u=p,i&&i({action:d,location:_.location,delta:x})}function f(p,x){d="PUSH";let v=ps(p)?p:Qt(_.location,p,x);n&&n(v,p),u=h()+1;let w=fs(v,u),L=_.createHref(v.mask||v);try{o.pushState(w,"",L)}catch(g){if(g instanceof DOMException&&g.name==="DataCloneError")throw g;r.location.assign(L)}l&&i&&i({action:d,location:_.location,delta:1})}function j(p,x){d="REPLACE";let v=ps(p)?p:Qt(_.location,p,x);n&&n(v,p),u=h();let w=fs(v,u),L=_.createHref(v.mask||v);o.replaceState(w,"",L),l&&i&&i({action:d,location:_.location,delta:0})}function b(p){return la(r,p)}let _={get action(){return d},get location(){return t(r,o)},listen(p){if(i)throw new Error("A history only accepts one active listener");return r.addEventListener(ms,m),i=p,()=>{r.removeEventListener(ms,m),i=null}},createHref(p){return s(r,p)},createURL:b,encodeLocation(p){let x=b(p);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:f,replace:j,go(p){return o.go(p)}};return _}function la(t,s,n=!1){let a="http://localhost";t&&(a=t.location.origin!=="null"?t.location.origin:t.location.href),Y(a,"No window.location.(origin|href) available to create URL");let r=typeof s=="string"?s:lt(s);return r=r.replace(/ $/,"%20"),!n&&Ks.test(r)&&(r=a+r),new URL(r,a)}function Js(t,s,n="/"){return oa(t,s,n,!1)}function oa(t,s,n,a,r){let l=typeof s=="string"?qe(s):s,o=Se(l.pathname||"/",n);if(o==null)return null;let d=ia(t),i=null,u=ja(o);for(let h=0;i==null&&h<d.length;++h)i=ga(d[h],u,a);return i}function ia(t){let s=Ys(t);return ca(s),s}function Ys(t,s=[],n=[],a="",r=!1){let l=(o,d,i=r,u)=>{let h={relativePath:u===void 0?o.path||"":u,caseSensitive:o.caseSensitive===!0,childrenIndex:d,route:o};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(a)&&i)return;Y(h.relativePath.startsWith(a),`Absolute route path "${h.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(a.length)}let m=je([a,h.relativePath]),f=n.concat(h);o.children&&o.children.length>0&&(Y(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),Ys(o.children,s,f,m,i)),!(o.path==null&&!o.index)&&s.push({path:m,score:_a(m,o.index),routesMeta:f.map((j,b)=>{let[_,p]=en(j.relativePath,j.caseSensitive,b===f.length-1);return{...j,matcher:_,compiledParams:p}})})};return t.forEach((o,d)=>{if(o.path===""||!o.path?.includes("?"))l(o,d);else for(let i of Xs(o.path))l(o,d,!0,i)}),s}function Xs(t){let s=t.split("/");if(s.length===0)return[];let[n,...a]=s,r=n.endsWith("?"),l=n.replace(/\?$/,"");if(a.length===0)return r?[l,""]:[l];let o=Xs(a.join("/")),d=[];return d.push(...o.map(i=>i===""?l:[l,i].join("/"))),r&&d.push(...o),d.map(i=>t.startsWith("/")&&i===""?"/":i)}function ca(t){t.sort((s,n)=>s.score!==n.score?n.score-s.score:xa(s.routesMeta.map(a=>a.childrenIndex),n.routesMeta.map(a=>a.childrenIndex)))}var da=/^:[\w-]+$/,ua=3,ha=2,ma=1,pa=10,fa=-2,_s=t=>t==="*";function _a(t,s){let n=t.split("/"),a=n.length;return n.some(_s)&&(a+=fa),s&&(a+=ha),n.filter(r=>!_s(r)).reduce((r,l)=>r+(da.test(l)?ua:l===""?ma:pa),a)}function xa(t,s){return t.length===s.length&&t.slice(0,-1).every((a,r)=>a===s[r])?t[t.length-1]-s[s.length-1]:0}function ga(t,s,n=!1){let{routesMeta:a}=t,r={},l="/",o=[];for(let d=0;d<a.length;++d){let i=a[d],u=d===a.length-1,h=l==="/"?s:s.slice(l.length)||"/",m={path:i.relativePath,caseSensitive:i.caseSensitive,end:u},f=i.matcher&&i.compiledParams?Zs(m,h,i.matcher,i.compiledParams):yt(m,h),j=i.route;if(!f&&u&&n&&!a[a.length-1].route.index&&(f=yt({path:i.relativePath,caseSensitive:i.caseSensitive,end:!1},h)),!f)return null;Object.assign(r,f.params),o.push({params:r,pathname:je([l,f.pathname]),pathnameBase:ya(je([l,f.pathnameBase])),route:j}),f.pathnameBase!=="/"&&(l=je([l,f.pathnameBase]))}return o}function yt(t,s){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,a]=en(t.path,t.caseSensitive,t.end);return Zs(t,s,n,a)}function Zs(t,s,n,a){let r=s.match(n);if(!r)return null;let l=r[0],o=l.replace(/(.)\/+$/,"$1"),d=r.slice(1);return{params:a.reduce((u,{paramName:h,isOptional:m},f)=>{if(h==="*"){let b=d[f]||"";o=l.slice(0,l.length-b.length).replace(/(.)\/+$/,"$1")}const j=d[f];return m&&!j?u[h]=void 0:u[h]=(j||"").replace(/%2F/g,"/"),u},{}),pathname:l,pathnameBase:o,pattern:t}}function en(t,s=!1,n=!0){pe(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let a=[],r="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,d,i,u,h)=>{if(a.push({paramName:d,isOptional:i!=null}),i){let m=h.charAt(u+o.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(a.push({paramName:"*"}),r+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?r+="\\/*$":t!==""&&t!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,s?void 0:"i"),a]}function ja(t){try{return t.split("/").map(s=>decodeURIComponent(s).replace(/\//g,"%2F")).join("/")}catch(s){return pe(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${s}).`),t}}function Se(t,s){if(s==="/")return t;if(!t.toLowerCase().startsWith(s.toLowerCase()))return null;let n=s.endsWith("/")?s.length-1:s.length,a=t.charAt(n);return a&&a!=="/"?null:t.slice(n)||"/"}function va(t,s="/"){let{pathname:n,search:a="",hash:r=""}=typeof t=="string"?qe(t):t,l;return n?(n=tn(n),n.startsWith("/")?l=xs(n.substring(1),"/"):l=xs(n,s)):l=s,{pathname:l,search:wa(a),hash:Na(r)}}function xs(t,s){let n=wt(s).split("/");return t.split("/").forEach(r=>{r===".."?n.length>1&&n.pop():r!=="."&&n.push(r)}),n.length>1?n.join("/"):"/"}function Tt(t,s,n,a){return`Cannot include a '${t}' character in a manually specified \`to.${s}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ba(t){return t.filter((s,n)=>n===0||s.route.path&&s.route.path.length>0)}function ss(t){let s=ba(t);return s.map((n,a)=>a===s.length-1?n.pathname:n.pathnameBase)}function St(t,s,n,a=!1){let r;typeof t=="string"?r=qe(t):(r={...t},Y(!r.pathname||!r.pathname.includes("?"),Tt("?","pathname","search",r)),Y(!r.pathname||!r.pathname.includes("#"),Tt("#","pathname","hash",r)),Y(!r.search||!r.search.includes("#"),Tt("#","search","hash",r)));let l=t===""||r.pathname==="",o=l?"/":r.pathname,d;if(o==null)d=n;else{let m=s.length-1;if(!a&&o.startsWith("..")){let f=o.split("/");for(;f[0]==="..";)f.shift(),m-=1;r.pathname=f.join("/")}d=m>=0?s[m]:"/"}let i=va(r,d),u=o&&o!=="/"&&o.endsWith("/"),h=(l||o===".")&&n.endsWith("/");return!i.pathname.endsWith("/")&&(u||h)&&(i.pathname+="/"),i}var tn=t=>t.replace(/[\\/]{2,}/g,"/"),je=t=>tn(t.join("/")),wt=t=>t.replace(/\/+$/,""),ya=t=>wt(t).replace(/^\/*/,"/"),wa=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,Na=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,ka=class{constructor(t,s,n,a=!1){this.status=t,this.statusText=s||"",this.internal=a,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function $a(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function Sa(t){let s=t.map(n=>n.route.path).filter(Boolean);return je(s)||"/"}var sn=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function nn(t,s){let n=t;if(typeof n!="string"||!ts.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let a=n,r=!1;if(sn)try{let l=new URL(window.location.href),o=Ks.test(n)?new URL(sa(n,l.protocol)):new URL(n),d=Se(o.pathname,s);o.origin===l.origin&&d!=null?n=d+o.search+o.hash:r=!0}catch{pe(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:r,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var an=["POST","PUT","PATCH","DELETE"];new Set(an);var Ca=["GET",...an];new Set(Ca);var Ra=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function La(t){try{return Ra.includes(new URL(t).protocol)}catch{return!1}}var Qe=c.createContext(null);Qe.displayName="DataRouter";var Ct=c.createContext(null);Ct.displayName="DataRouterState";var rn=c.createContext(!1);function Ta(){return c.useContext(rn)}var ln=c.createContext({isTransitioning:!1});ln.displayName="ViewTransition";var Ea=c.createContext(new Map);Ea.displayName="Fetchers";var Aa=c.createContext(null);Aa.displayName="Await";var de=c.createContext(null);de.displayName="Navigation";var ct=c.createContext(null);ct.displayName="Location";var fe=c.createContext({outlet:null,matches:[],isDataRoute:!1});fe.displayName="Route";var ns=c.createContext(null);ns.displayName="RouteError";var on="REACT_ROUTER_ERROR",Da="REDIRECT",Ma="ROUTE_ERROR_RESPONSE";function Ia(t){if(t.startsWith(`${on}:${Da}:{`))try{let s=JSON.parse(t.slice(28));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.location=="string"&&typeof s.reloadDocument=="boolean"&&typeof s.replace=="boolean")return s}catch{}}function Pa(t){if(t.startsWith(`${on}:${Ma}:{`))try{let s=JSON.parse(t.slice(40));if(typeof s=="object"&&s&&typeof s.status=="number"&&typeof s.statusText=="string")return new ka(s.status,s.statusText,s.data)}catch{}}function qa(t,{relative:s}={}){Y(Ve(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:a}=c.useContext(de),{hash:r,pathname:l,search:o}=ut(t,{relative:s}),d=l;return n!=="/"&&(d=l==="/"?n:je([n,l])),a.createHref({pathname:d,search:o,hash:r})}function Ve(){return c.useContext(ct)!=null}function ue(){return Y(Ve(),"useLocation() may be used only in the context of a <Router> component."),c.useContext(ct).location}var cn="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function dn(t){c.useContext(de).static||c.useLayoutEffect(t)}function dt(){let{isDataRoute:t}=c.useContext(fe);return t?Za():Ba()}function Ba(){Y(Ve(),"useNavigate() may be used only in the context of a <Router> component.");let t=c.useContext(Qe),{basename:s,navigator:n}=c.useContext(de),{matches:a}=c.useContext(fe),{pathname:r}=ue(),l=JSON.stringify(ss(a)),o=c.useRef(!1);return dn(()=>{o.current=!0}),c.useCallback((i,u={})=>{if(pe(o.current,cn),!o.current)return;if(typeof i=="number"){n.go(i);return}let h=St(i,JSON.parse(l),r,u.relative==="path");t==null&&s!=="/"&&(h.pathname=h.pathname==="/"?s:je([s,h.pathname])),(u.replace?n.replace:n.push)(h,u.state,u)},[s,n,l,r,t])}var Oa=c.createContext(null);function Fa(t){let s=c.useContext(fe).outlet;return c.useMemo(()=>s&&c.createElement(Oa.Provider,{value:t},s),[s,t])}function as(){let{matches:t}=c.useContext(fe);return t[t.length-1]?.params??{}}function ut(t,{relative:s}={}){let{matches:n}=c.useContext(fe),{pathname:a}=ue(),r=JSON.stringify(ss(n));return c.useMemo(()=>St(t,JSON.parse(r),a,s==="path"),[t,r,a,s])}function Ua(t,s){return un(t,s)}function un(t,s,n){Y(Ve(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=c.useContext(de),{matches:r}=c.useContext(fe),l=r[r.length-1],o=l?l.params:{},d=l?l.pathname:"/",i=l?l.pathnameBase:"/",u=l&&l.route;{let p=u&&u.path||"";mn(d,!u||p.endsWith("*")||p.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${p}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
11
-
12
- Please change the parent <Route path="${p}"> to <Route path="${p==="/"?"*":`${p}/*`}">.`)}let h=ue(),m;if(s){let p=typeof s=="string"?qe(s):s;Y(i==="/"||p.pathname?.startsWith(i),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${i}" but pathname "${p.pathname}" was given in the \`location\` prop.`),m=p}else m=h;let f=m.pathname||"/",j=f;if(i!=="/"){let p=i.replace(/^\//,"").split("/");j="/"+f.replace(/^\//,"").split("/").slice(p.length).join("/")}let b=n&&n.state.matches.length?n.state.matches.map(p=>Object.assign(p,{route:n.manifest[p.route.id]||p.route})):Js(t,{pathname:j});pe(u||b!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),pe(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=Va(b&&b.map(p=>Object.assign({},p,{params:Object.assign({},o,p.params),pathname:je([i,a.encodeLocation?a.encodeLocation(p.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:p.pathname]),pathnameBase:p.pathnameBase==="/"?i:je([i,a.encodeLocation?a.encodeLocation(p.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:p.pathnameBase])})),r,n);return s&&_?c.createElement(ct.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},_):_}function Ha(){let t=Xa(),s=$a(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,a="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:a},l={padding:"2px 4px",backgroundColor:a},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=c.createElement(c.Fragment,null,c.createElement("p",null,"💿 Hey developer 👋"),c.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",c.createElement("code",{style:l},"ErrorBoundary")," or"," ",c.createElement("code",{style:l},"errorElement")," prop on your route.")),c.createElement(c.Fragment,null,c.createElement("h2",null,"Unexpected Application Error!"),c.createElement("h3",{style:{fontStyle:"italic"}},s),n?c.createElement("pre",{style:r},n):null,o)}var Ga=c.createElement(Ha,null),hn=class extends c.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,s){return s.location!==t.location||s.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:s.error,location:s.location,revalidation:t.revalidation||s.revalidation}}componentDidCatch(t,s){this.props.onError?this.props.onError(t,s):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=Pa(t.digest);n&&(t=n)}let s=t!==void 0?c.createElement(fe.Provider,{value:this.props.routeContext},c.createElement(ns.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?c.createElement(Wa,{error:t},s):s}};hn.contextType=rn;var Et=new WeakMap;function Wa({children:t,error:s}){let{basename:n}=c.useContext(de);if(typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){let a=Ia(s.digest);if(a){let r=Et.get(s);if(r)throw r;let l=nn(a.location,n),o=l.absoluteURL||l.to;if(La(o))throw new Error("Invalid redirect location");if(sn&&!Et.get(s))if(l.isExternal||a.reloadDocument)window.location.href=o;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:a.replace}));throw Et.set(s,d),d}return c.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return t}function Qa({routeContext:t,match:s,children:n}){let a=c.useContext(Qe);return a&&a.static&&a.staticContext&&(s.route.errorElement||s.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=s.route.id),c.createElement(fe.Provider,{value:t},n)}function Va(t,s=[],n){let a=n?.state;if(t==null){if(!a)return null;if(a.errors)t=a.matches;else if(s.length===0&&!a.initialized&&a.matches.length>0)t=a.matches;else return null}let r=t,l=a?.errors;if(l!=null){let h=r.findIndex(m=>m.route.id&&l?.[m.route.id]!==void 0);Y(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(l).join(",")}`),r=r.slice(0,Math.min(r.length,h+1))}let o=!1,d=-1;if(n&&a){o=a.renderFallback;for(let h=0;h<r.length;h++){let m=r[h];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(d=h),m.route.id){let{loaderData:f,errors:j}=a,b=m.route.loader&&!f.hasOwnProperty(m.route.id)&&(!j||j[m.route.id]===void 0);if(m.route.lazy||b){n.isStatic&&(o=!0),d>=0?r=r.slice(0,d+1):r=[r[0]];break}}}}let i=n?.onError,u=a&&i?(h,m)=>{i(h,{location:a.location,params:a.matches?.[0]?.params??{},pattern:Sa(a.matches),errorInfo:m})}:void 0;return r.reduceRight((h,m,f)=>{let j,b=!1,_=null,p=null;a&&(j=l&&m.route.id?l[m.route.id]:void 0,_=m.route.errorElement||Ga,o&&(d<0&&f===0?(mn("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,p=null):d===f&&(b=!0,p=m.route.hydrateFallbackElement||null)));let x=s.concat(r.slice(0,f+1)),v=()=>{let w;return j?w=_:b?w=p:m.route.Component?w=c.createElement(m.route.Component,null):m.route.element?w=m.route.element:w=h,c.createElement(Qa,{match:m,routeContext:{outlet:h,matches:x,isDataRoute:a!=null},children:w})};return a&&(m.route.ErrorBoundary||m.route.errorElement||f===0)?c.createElement(hn,{location:a.location,revalidation:a.revalidation,component:_,error:j,children:v(),routeContext:{outlet:null,matches:x,isDataRoute:!0},onError:u}):v()},null)}function rs(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function za(t){let s=c.useContext(Qe);return Y(s,rs(t)),s}function Ka(t){let s=c.useContext(Ct);return Y(s,rs(t)),s}function Ja(t){let s=c.useContext(fe);return Y(s,rs(t)),s}function ls(t){let s=Ja(t),n=s.matches[s.matches.length-1];return Y(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function Ya(){return ls("useRouteId")}function Xa(){let t=c.useContext(ns),s=Ka("useRouteError"),n=ls("useRouteError");return t!==void 0?t:s.errors?.[n]}function Za(){let{router:t}=za("useNavigate"),s=ls("useNavigate"),n=c.useRef(!1);return dn(()=>{n.current=!0}),c.useCallback(async(r,l={})=>{pe(n.current,cn),n.current&&(typeof r=="number"?await t.navigate(r):await t.navigate(r,{fromRouteId:s,...l}))},[t,s])}var gs={};function mn(t,s,n){!s&&!gs[t]&&(gs[t]=!0,pe(!1,n))}c.memo(er);function er({routes:t,manifest:s,future:n,state:a,isStatic:r,onError:l}){return un(t,void 0,{manifest:s,state:a,isStatic:r,onError:l})}function js({to:t,replace:s,state:n,relative:a}){Y(Ve(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=c.useContext(de);pe(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=c.useContext(fe),{pathname:o}=ue(),d=dt(),i=St(t,ss(l),o,a==="path"),u=JSON.stringify(i);return c.useEffect(()=>{d(JSON.parse(u),{replace:s,state:n,relative:a})},[d,u,a,s,n]),null}function tr(t){return Fa(t.context)}function X(t){Y(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function sr({basename:t="/",children:s=null,location:n,navigationType:a="POP",navigator:r,static:l=!1,useTransitions:o}){Y(!Ve(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let d=t.replace(/^\/*/,"/"),i=c.useMemo(()=>({basename:d,navigator:r,static:l,useTransitions:o,future:{}}),[d,r,l,o]);typeof n=="string"&&(n=qe(n));let{pathname:u="/",search:h="",hash:m="",state:f=null,key:j="default",mask:b}=n,_=c.useMemo(()=>{let p=Se(u,d);return p==null?null:{location:{pathname:p,search:h,hash:m,state:f,key:j,mask:b},navigationType:a}},[d,u,h,m,f,j,a,b]);return pe(_!=null,`<Router basename="${d}"> is not able to match the URL "${u}${h}${m}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:c.createElement(de.Provider,{value:i},c.createElement(ct.Provider,{children:s,value:_}))}function nr({children:t,location:s}){return Ua(Vt(t),s)}function Vt(t,s=[]){let n=[];return c.Children.forEach(t,(a,r)=>{if(!c.isValidElement(a))return;let l=[...s,r];if(a.type===c.Fragment){n.push.apply(n,Vt(a.props.children,l));return}Y(a.type===X,`[${typeof a.type=="string"?a.type:a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Y(!a.props.index||!a.props.children,"An index route cannot have child routes.");let o={id:a.props.id||l.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,Component:a.props.Component,index:a.props.index,path:a.props.path,middleware:a.props.middleware,loader:a.props.loader,action:a.props.action,hydrateFallbackElement:a.props.hydrateFallbackElement,HydrateFallback:a.props.HydrateFallback,errorElement:a.props.errorElement,ErrorBoundary:a.props.ErrorBoundary,hasErrorBoundary:a.props.hasErrorBoundary===!0||a.props.ErrorBoundary!=null||a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle,lazy:a.props.lazy};a.props.children&&(o.children=Vt(a.props.children,l)),n.push(o)}),n}var gt="get",jt="application/x-www-form-urlencoded";function Rt(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function ar(t){return Rt(t)&&t.tagName.toLowerCase()==="button"}function rr(t){return Rt(t)&&t.tagName.toLowerCase()==="form"}function lr(t){return Rt(t)&&t.tagName.toLowerCase()==="input"}function or(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function ir(t,s){return t.button===0&&(!s||s==="_self")&&!or(t)}var mt=null;function cr(){if(mt===null)try{new FormData(document.createElement("form"),0),mt=!1}catch{mt=!0}return mt}var dr=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function At(t){return t!=null&&!dr.has(t)?(pe(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${jt}"`),null):t}function ur(t,s){let n,a,r,l,o;if(rr(t)){let d=t.getAttribute("action");a=d?Se(d,s):null,n=t.getAttribute("method")||gt,r=At(t.getAttribute("enctype"))||jt,l=new FormData(t)}else if(ar(t)||lr(t)&&(t.type==="submit"||t.type==="image")){let d=t.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let i=t.getAttribute("formaction")||d.getAttribute("action");if(a=i?Se(i,s):null,n=t.getAttribute("formmethod")||d.getAttribute("method")||gt,r=At(t.getAttribute("formenctype"))||At(d.getAttribute("enctype"))||jt,l=new FormData(d,t),!cr()){let{name:u,type:h,value:m}=t;if(h==="image"){let f=u?`${u}.`:"";l.append(`${f}x`,"0"),l.append(`${f}y`,"0")}else u&&l.append(u,m)}}else{if(Rt(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=gt,a=null,r=jt,o=t}return l&&r==="text/plain"&&(o=l,l=void 0),{action:a,method:n.toLowerCase(),encType:r,formData:l,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function os(t,s){if(t===!1||t===null||typeof t>"u")throw new Error(s)}function pn(t,s,n,a){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${a}`:r.pathname=`${r.pathname}.${a}`:r.pathname==="/"?r.pathname=`_root.${a}`:s&&Se(r.pathname,s)==="/"?r.pathname=`${wt(s)}/_root.${a}`:r.pathname=`${wt(r.pathname)}.${a}`,r}async function hr(t,s){if(t.id in s)return s[t.id];try{let n=await import(t.module);return s[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function mr(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function pr(t,s,n){let a=await Promise.all(t.map(async r=>{let l=s.routes[r.route.id];if(l){let o=await hr(l,n);return o.links?o.links():[]}return[]}));return gr(a.flat(1).filter(mr).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function vs(t,s,n,a,r,l){let o=(i,u)=>n[u]?i.route.id!==n[u].route.id:!0,d=(i,u)=>n[u].pathname!==i.pathname||n[u].route.path?.endsWith("*")&&n[u].params["*"]!==i.params["*"];return l==="assets"?s.filter((i,u)=>o(i,u)||d(i,u)):l==="data"?s.filter((i,u)=>{let h=a.routes[i.route.id];if(!h||!h.hasLoader)return!1;if(o(i,u)||d(i,u))return!0;if(i.route.shouldRevalidate){let m=i.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:i.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function fr(t,s,{includeHydrateFallback:n}={}){return _r(t.map(a=>{let r=s.routes[a.route.id];if(!r)return[];let l=[r.module];return r.clientActionModule&&(l=l.concat(r.clientActionModule)),r.clientLoaderModule&&(l=l.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(l=l.concat(r.hydrateFallbackModule)),r.imports&&(l=l.concat(r.imports)),l}).flat(1))}function _r(t){return[...new Set(t)]}function xr(t){let s={},n=Object.keys(t).sort();for(let a of n)s[a]=t[a];return s}function gr(t,s){let n=new Set;return new Set(s),t.reduce((a,r)=>{let l=JSON.stringify(xr(r));return n.has(l)||(n.add(l),a.push({key:l,link:r})),a},[])}function is(){let t=c.useContext(Qe);return os(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function jr(){let t=c.useContext(Ct);return os(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var cs=c.createContext(void 0);cs.displayName="FrameworkContext";function Lt(){let t=c.useContext(cs);return os(t,"You must render this element inside a <HydratedRouter> element"),t}function vr(t,s){let n=c.useContext(cs),[a,r]=c.useState(!1),[l,o]=c.useState(!1),{onFocus:d,onBlur:i,onMouseEnter:u,onMouseLeave:h,onTouchStart:m}=s,f=c.useRef(null);c.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let _=x=>{x.forEach(v=>{o(v.isIntersecting)})},p=new IntersectionObserver(_,{threshold:.5});return f.current&&p.observe(f.current),()=>{p.disconnect()}}},[t]),c.useEffect(()=>{if(a){let _=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(_)}}},[a]);let j=()=>{r(!0)},b=()=>{r(!1),o(!1)};return n?t!=="intent"?[l,f,{}]:[l,f,{onFocus:ze(d,j),onBlur:ze(i,b),onMouseEnter:ze(u,j),onMouseLeave:ze(h,b),onTouchStart:ze(m,j)}]:[!1,f,{}]}function ze(t,s){return n=>{t&&t(n),n.defaultPrevented||s(n)}}function br({page:t,...s}){let n=Ta(),{nonce:a}=Lt(),{router:r}=is(),l=c.useMemo(()=>Js(r.routes,t,r.basename),[r.routes,t,r.basename]);return l?(s.nonce==null&&a&&(s={...s,nonce:a}),n?c.createElement(wr,{page:t,matches:l,...s}):c.createElement(Nr,{page:t,matches:l,...s})):null}function yr(t){let{manifest:s,routeModules:n}=Lt(),[a,r]=c.useState([]);return c.useEffect(()=>{let l=!1;return pr(t,s,n).then(o=>{l||r(o)}),()=>{l=!0}},[t,s,n]),a}function wr({page:t,matches:s,...n}){let a=ue(),{future:r}=Lt(),{basename:l}=is(),o=c.useMemo(()=>{if(t===a.pathname+a.search+a.hash)return[];let d=pn(t,l,r.v8_trailingSlashAwareDataRequests,"rsc"),i=!1,u=[];for(let h of s)typeof h.route.shouldRevalidate=="function"?i=!0:u.push(h.route.id);return i&&u.length>0&&d.searchParams.set("_routes",u.join(",")),[d.pathname+d.search]},[l,r.v8_trailingSlashAwareDataRequests,t,a,s]);return c.createElement(c.Fragment,null,o.map(d=>c.createElement("link",{key:d,rel:"prefetch",as:"fetch",href:d,...n})))}function Nr({page:t,matches:s,...n}){let a=ue(),{future:r,manifest:l,routeModules:o}=Lt(),{basename:d}=is(),{loaderData:i,matches:u}=jr(),h=c.useMemo(()=>vs(t,s,u,l,a,"data"),[t,s,u,l,a]),m=c.useMemo(()=>vs(t,s,u,l,a,"assets"),[t,s,u,l,a]),f=c.useMemo(()=>{if(t===a.pathname+a.search+a.hash)return[];let _=new Set,p=!1;if(s.forEach(v=>{let w=l.routes[v.route.id];!w||!w.hasLoader||(!h.some(L=>L.route.id===v.route.id)&&v.route.id in i&&o[v.route.id]?.shouldRevalidate||w.hasClientLoader?p=!0:_.add(v.route.id))}),_.size===0)return[];let x=pn(t,d,r.v8_trailingSlashAwareDataRequests,"data");return p&&_.size>0&&x.searchParams.set("_routes",s.filter(v=>_.has(v.route.id)).map(v=>v.route.id).join(",")),[x.pathname+x.search]},[d,r.v8_trailingSlashAwareDataRequests,i,a,l,h,s,t,o]),j=c.useMemo(()=>fr(m,l),[m,l]),b=yr(m);return c.createElement(c.Fragment,null,f.map(_=>c.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...n})),j.map(_=>c.createElement("link",{key:_,rel:"modulepreload",href:_,...n})),b.map(({key:_,link:p})=>c.createElement("link",{key:_,nonce:n.nonce,...p,crossOrigin:p.crossOrigin??n.crossOrigin})))}function kr(...t){return s=>{t.forEach(n=>{typeof n=="function"?n(s):n!=null&&(n.current=s)})}}var $r=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{$r&&(window.__reactRouterVersion="7.18.2")}catch{}function Sr({basename:t,children:s,useTransitions:n,window:a}){let r=c.useRef();r.current==null&&(r.current=na({window:a,v5Compat:!0}));let l=r.current,[o,d]=c.useState({action:l.action,location:l.location}),i=c.useCallback(u=>{n===!1?d(u):c.startTransition(()=>d(u))},[n]);return c.useLayoutEffect(()=>l.listen(i),[l,i]),c.createElement(sr,{basename:t,children:s,location:o.location,navigationType:o.action,navigator:l,useTransitions:n})}var ht=c.forwardRef(function({onClick:s,discover:n="render",prefetch:a="none",relative:r,reloadDocument:l,replace:o,mask:d,state:i,target:u,to:h,preventScrollReset:m,viewTransition:f,defaultShouldRevalidate:j,...b},_){let{basename:p,navigator:x,useTransitions:v}=c.useContext(de),w=typeof h=="string"&&ts.test(h),L=nn(h,p);h=L.to;let g=qa(h,{relative:r}),H=ue(),A=null;if(d){let G=St(d,[],H.mask?H.mask.pathname:"/",!0);p!=="/"&&(G.pathname=G.pathname==="/"?p:je([p,G.pathname])),A=x.createHref(G)}let[N,C,oe]=vr(a,b),ne=Lr(h,{replace:o,mask:d,state:i,target:u,preventScrollReset:m,relative:r,viewTransition:f,defaultShouldRevalidate:j,useTransitions:v});function se(G){s&&s(G),G.defaultPrevented||ne(G)}let y=!(L.isExternal||l),P=c.createElement("a",{...b,...oe,href:(y?A:void 0)||L.absoluteURL||g,onClick:y?se:s,ref:kr(_,C),target:u,"data-discover":!w&&n==="render"?"true":void 0});return N&&!w?c.createElement(c.Fragment,null,P,c.createElement(br,{page:g})):P});ht.displayName="Link";var fn=c.forwardRef(function({"aria-current":s="page",caseSensitive:n=!1,className:a="",end:r=!1,style:l,to:o,viewTransition:d,children:i,...u},h){let m=ut(o,{relative:u.relative}),f=ue(),j=c.useContext(Ct),{navigator:b,basename:_}=c.useContext(de),p=j!=null&&Mr(m)&&d===!0,x=b.encodeLocation?b.encodeLocation(m).pathname:m.pathname,v=f.pathname,w=j&&j.navigation&&j.navigation.location?j.navigation.location.pathname:null;n||(v=v.toLowerCase(),w=w?w.toLowerCase():null,x=x.toLowerCase()),w&&_&&(w=Se(w,_)||w);const L=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let g=v===x||!r&&v.startsWith(x)&&v.charAt(L)==="/",H=w!=null&&(w===x||!r&&w.startsWith(x)&&w.charAt(x.length)==="/"),A={isActive:g,isPending:H,isTransitioning:p},N=g?s:void 0,C;typeof a=="function"?C=a(A):C=[a,g?"active":null,H?"pending":null,p?"transitioning":null].filter(Boolean).join(" ");let oe=typeof l=="function"?l(A):l;return c.createElement(ht,{...u,"aria-current":N,className:C,ref:h,style:oe,to:o,viewTransition:d},typeof i=="function"?i(A):i)});fn.displayName="NavLink";var Cr=c.forwardRef(({discover:t="render",fetcherKey:s,navigate:n,reloadDocument:a,replace:r,state:l,method:o=gt,action:d,onSubmit:i,relative:u,preventScrollReset:h,viewTransition:m,defaultShouldRevalidate:f,...j},b)=>{let{useTransitions:_}=c.useContext(de),p=Ar(),x=Dr(d,{relative:u}),v=o.toLowerCase()==="get"?"get":"post",w=typeof d=="string"&&ts.test(d),L=g=>{if(i&&i(g),g.defaultPrevented)return;g.preventDefault();let H=g.nativeEvent.submitter,A=H?.getAttribute("formmethod")||o,N=()=>p(H||g.currentTarget,{fetcherKey:s,method:A,navigate:n,replace:r,state:l,relative:u,preventScrollReset:h,viewTransition:m,defaultShouldRevalidate:f});_&&n!==!1?c.startTransition(()=>N()):N()};return c.createElement("form",{ref:b,method:v,action:x,onSubmit:a?i:L,...j,"data-discover":!w&&t==="render"?"true":void 0})});Cr.displayName="Form";function Rr(t){return`${t} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _n(t){let s=c.useContext(Qe);return Y(s,Rr(t)),s}function Lr(t,{target:s,replace:n,mask:a,state:r,preventScrollReset:l,relative:o,viewTransition:d,defaultShouldRevalidate:i,useTransitions:u}={}){let h=dt(),m=ue(),f=ut(t,{relative:o});return c.useCallback(j=>{if(ir(j,s)){j.preventDefault();let b=n!==void 0?n:lt(m)===lt(f),_=()=>h(t,{replace:b,mask:a,state:r,preventScrollReset:l,relative:o,viewTransition:d,defaultShouldRevalidate:i});u?c.startTransition(()=>_()):_()}},[m,h,f,n,a,r,s,t,l,o,d,i,u])}var Tr=0,Er=()=>`__${String(++Tr)}__`;function Ar(){let{router:t}=_n("useSubmit"),{basename:s}=c.useContext(de),n=Ya(),a=t.fetch,r=t.navigate;return c.useCallback(async(l,o={})=>{let{action:d,method:i,encType:u,formData:h,body:m}=ur(l,s);if(o.navigate===!1){let f=o.fetcherKey||Er();await a(f,n,o.action||d,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:m,formMethod:o.method||i,formEncType:o.encType||u,flushSync:o.flushSync})}else await r(o.action||d,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:h,body:m,formMethod:o.method||i,formEncType:o.encType||u,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[a,r,s,n])}function Dr(t,{relative:s}={}){let{basename:n}=c.useContext(de),a=c.useContext(fe);Y(a,"useFormAction must be used inside a RouteContext");let[r]=a.matches.slice(-1),l={...ut(t||".",{relative:s})},o=ue();if(t==null){l.search=o.search;let d=new URLSearchParams(l.search),i=d.getAll("index");if(i.some(h=>h==="")){d.delete("index"),i.filter(m=>m).forEach(m=>d.append("index",m));let h=d.toString();l.search=h?`?${h}`:""}}return(!t||t===".")&&r.route.index&&(l.search=l.search?l.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(l.pathname=l.pathname==="/"?n:je([n,l.pathname])),lt(l)}function Mr(t,{relative:s}={}){let n=c.useContext(ln);Y(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=_n("useViewTransitionState"),r=ut(t,{relative:s});if(!n.isTransitioning)return!1;let l=Se(n.currentLocation.pathname,a)||n.currentLocation.pathname,o=Se(n.nextLocation.pathname,a)||n.nextLocation.pathname;return yt(r.pathname,o)!=null||yt(r.pathname,l)!=null}const xn=[{id:"overview",label:"Overview",leaves:[{path:"/overview",label:"Fleet Dashboard",description:"Repos, activity, runs, swarms, MCP health, genome, and daemon status at a glance.",implemented:!0},{path:"/agent-os",label:"Agent OS",description:"Authenticated, observation-only decision spine for capability runway and value bets.",implemented:!0},{path:"/universe",label:"Universe",description:"Compare experiments, follow variant lineages, and inspect the retained population.",implemented:!0}]},{id:"journal",label:"Journal",leaves:[{path:"/journal",label:"Work Journal",description:"Chronological, filterable, scrubable record of runs, merges, judge verdicts, and daemon ticks — with live streaming into any in-progress run.",implemented:!0}]},{id:"work",label:"Work",leaves:[{path:"/work/runs",label:"Runs",description:"Dispatched goal runs and their token burn.",implemented:!0},{path:"/work/swarms",label:"Swarms",description:"Multi-task DAG runs with live burndown.",implemented:!0}]},{id:"inbox",label:"Inbox",leaves:[{path:"/inbox",label:"Proposals",description:"Review, filter, and approve/reject proposals — including history (rejected/approved).",implemented:!0}]},{id:"control",label:"Control",leaves:[{path:"/control/daemon",label:"Daemon",description:"Autonomous operator state, spend, and direction mode.",implemented:!0},{path:"/control/fleet",label:"Fleet",description:"Queue depth, lease health, and the kill switch.",implemented:!0},{path:"/control/security",label:"Security",description:"Supply-chain / binshield findings from the cached backlog.",implemented:!0}]},{id:"intelligence",label:"Intelligence",leaves:[{path:"/intelligence/pulse",label:"Pulse",description:"Activity rollups over the dashboard window.",implemented:!0},{path:"/intelligence/genome",label:"Genome",description:"Cross-repo knowledge search and recall.",implemented:!0},{path:"/intelligence/production",label:"Production",description:"Ships-per-day, judge verdicts, auto-merges.",implemented:!0}]},{id:"portfolio",label:"Portfolio",leaves:[{path:"/portfolio",label:"Portfolio",description:"Org-level roll-up across enrolled repos.",implemented:!0}]},{id:"goals",label:"Goals",leaves:[{path:"/goals",label:"Goals",description:"Active goals and milestone progress.",implemented:!0}]}],gn=xn.flatMap(t=>t.leaves),Ir="_sidebar_vbjva_1",Pr="_brand_vbjva_11",qr="_brandMark_vbjva_19",Br="_group_vbjva_23",Or="_groupLabel_vbjva_27",Fr="_leaves_vbjva_37",Ur="_link_vbjva_43",Hr="_active_vbjva_60",Gr="_soon_vbjva_66",be={sidebar:Ir,brand:Pr,brandMark:qr,group:Br,groupLabel:Or,leaves:Fr,link:Ur,active:Hr,soon:Gr};function Wr(){return e.jsxs("nav",{className:be.sidebar,"aria-label":"Primary",children:[e.jsxs("div",{className:be.brand,children:[e.jsx("span",{className:be.brandMark,"aria-hidden":"true",children:"▲"}),e.jsx("span",{className:be.brandName,children:"ashlr"})]}),xn.map(t=>e.jsxs("div",{className:be.group,children:[e.jsx("h2",{className:be.groupLabel,children:t.label}),e.jsx("ul",{className:be.leaves,children:t.leaves.map(s=>e.jsx("li",{children:e.jsxs(fn,{to:s.path,className:({isActive:n})=>`${be.link} ${n?be.active:""}`,children:[s.label,s.implemented?null:e.jsx("span",{className:be.soon,children:"soon"})]})},s.path))})]},t.id))]})}const Qr=180*1e3,bs=7200*1e3,Vr=1440*60*1e3;function zr(t){const s=t.toLowerCase();return s.includes("proposal")||s.includes("inbox")?"/inbox":s.includes("security")||s.includes("audit")?"/control/security":s.includes("evidence")||s.includes("fleet")||s.includes("queue")?"/control/fleet":"/control/daemon"}function Kr(t){const s=[],n=Date.now();for(const o of t.fleet?.nextActions??[])s.push({id:`next-action-${o.id}`,category:"action-required",severity:o.priority,title:o.label,detail:o.detail,ts:new Date(n).toISOString(),actionHref:zr(o.id),actionLabel:"Inspect"});const a=t.fleet?.autonomousShipReadiness;a&&(a.verdict==="blocked"&&a.topBlocker?s.push({id:`readiness-blocked-${a.topBlocker.id}`,category:"readiness",severity:a.topBlocker.severity,title:"Autonomous readiness is blocked",detail:a.topBlocker.detail,ts:a.freshness.generatedAt,actionHref:"/control/fleet",actionLabel:"Inspect fleet"}):a.verdict==="unknown"&&s.push({id:"readiness-unknown",category:"readiness",severity:"medium",title:"Autonomous readiness is unknown",detail:"Fresh, authoritative state is required before autonomous operation can be treated as clear.",ts:a.freshness.generatedAt,actionHref:"/control/fleet",actionLabel:"Inspect fleet"}));const r=t.control?.security;if(r?.available){if(r.counts.critical>0){const o=r.findings.find(d=>d.severity==="critical");s.push({id:"security-critical",category:"security",severity:"critical",title:`${r.counts.critical} critical security finding${r.counts.critical===1?"":"s"}`,detail:o?`${o.repo}: ${o.title}`:"See the security backlog for details.",ts:new Date(n).toISOString(),actionHref:"/control/security",actionLabel:"Review findings"})}else if(r.counts.high>0){const o=r.findings.find(d=>d.severity==="high");s.push({id:"security-high",category:"security",severity:"high",title:`${r.counts.high} high-severity security finding${r.counts.high===1?"":"s"}`,detail:o?`${o.repo}: ${o.title}`:"See the security backlog for details.",ts:new Date(n).toISOString(),actionHref:"/control/security",actionLabel:"Review findings"})}}for(const o of t.control?.limits??[])o.standing==="over"?s.push({id:`budget-over-${o.backend}-${o.window}`,category:"budget",severity:"high",title:`${o.backend} is over its ${o.window} limit`,detail:`${o.used.toLocaleString()} / ${o.max.toLocaleString()} used.`,ts:new Date(n).toISOString(),actionHref:"/control/daemon",actionLabel:"Review usage"}):o.standing==="warn"&&s.push({id:`budget-warn-${o.backend}-${o.window}`,category:"budget",severity:"medium",title:`${o.backend} is approaching its ${o.window} limit`,detail:`${o.used.toLocaleString()} / ${o.max.toLocaleString()} used.`,ts:new Date(n).toISOString(),actionHref:"/control/daemon",actionLabel:"Review usage"});const l=t.control?.daemon;if(l&&(l.sourceQuality.sourceState!=="healthy"||l.sourceQuality.complete===!1)){const o=l.sourceQuality.reason;s.push({id:"daemon-health-degraded",category:"daemon-health",severity:o==="missing"||o==="unavailable"?"high":"medium",title:"Daemon state cannot be confirmed",detail:o?`Source: ${o}.`:"The daemon state source is degraded or incomplete.",ts:new Date(n).toISOString(),actionHref:"/control/daemon",actionLabel:"Inspect daemon",sourceQuality:l.sourceQuality})}if(t.inbox&&t.inbox.pending>0){const o=t.inbox.proposals.reduce((u,h)=>{const m=new Date(h.createdAt).getTime();return u===null||m<u?m:u},null),d=o!==null?n-o:0,i=d>bs?"high":"medium";s.push({id:"proposal-backlog",category:"proposal",severity:i,title:`${t.inbox.pending} proposal${t.inbox.pending===1?"":"s"} awaiting review`,detail:d>bs?`Oldest has been waiting ${Math.round(d/(3600*1e3))}h.`:"Approve, reject, or leave for autonomous handling per policy.",ts:o!==null?new Date(o).toISOString():new Date(n).toISOString(),actionHref:"/inbox",actionLabel:"Open inbox"})}for(const o of t.runs??[]){if(o.status==="failed"||o.status==="aborted"){if(n-new Date(o.updatedAt).getTime()>Vr)continue;s.push({id:`run-failed-${o.id}`,category:"run",severity:o.status==="failed"?"high":"medium",title:`Run ${o.status}: ${o.goal}`,detail:o.result??o.terminationReason??`Run ${o.id} ${o.status}.`,ts:o.updatedAt,actionHref:`/work/runs/${o.id}`,actionLabel:"Open run"});continue}if(o.status==="running"){const d=n-new Date(o.updatedAt).getTime();d>Qr&&s.push({id:`run-stalled-${o.id}`,category:"run",severity:"medium",title:`No update from a running run in ${Math.round(d/6e4)}m`,detail:o.goal,ts:o.updatedAt,actionHref:`/work/runs/${o.id}`,actionLabel:"Watch live"})}}return s}function Jr(t){const s={critical:0,high:1,medium:2,low:3,info:4};return[...t].sort((n,a)=>{const r=s[n.severity]-s[a.severity];return r!==0?r:new Date(a.ts).getTime()-new Date(n.ts).getTime()})}const jn="ashlr.notifications.mutedCategories.v1",ds="ashlr.notifications.desktopEnabled.v1";function Yr(){try{const t=localStorage.getItem(jn);if(!t)return new Set;const s=JSON.parse(t);if(Array.isArray(s))return new Set(s)}catch{}return new Set}function Xr(t){try{localStorage.setItem(jn,JSON.stringify([...t]))}catch{}}function Zr(){try{return localStorage.getItem(ds)==="1"}catch{return!1}}function us(){return typeof Notification>"u"?"unsupported":Notification.permission}const Te=Yr();let zt=[],ot=!1,We=Zr();const Dt=new Set;let vn={items:[],panelOpen:!1,mutedCategories:[...Te],desktopEnabled:We,desktopPermission:us()};const Kt=new Set;function el(){for(const t of Kt)t()}function Be(){vn={items:Jr(zt.filter(s=>!Te.has(s.category))),panelOpen:ot,mutedCategories:[...Te],desktopEnabled:We,desktopPermission:us()},el()}function tl(t){return Kt.add(t),()=>Kt.delete(t)}function ys(){return vn}function sl(t){const s=new Set(zt.map(n=>n.id));if(zt=t,We&&us()==="granted"){for(const n of t)if(!Te.has(n.category)&&!(n.severity!=="critical"&&n.severity!=="high")&&!(s.has(n.id)||Dt.has(n.id))){Dt.add(n.id);try{new Notification(n.title,{body:n.detail,tag:n.id})}catch{}}}for(const n of t)Dt.add(n.id);Be()}function nl(){ot=!0,Be()}function Mt(){ot=!1,Be()}function al(){ot=!ot,Be()}function rl(t){return Te.has(t)}function ll(t,s){s?Te.add(t):Te.delete(t),Xr(Te),Be()}async function ol(){if(typeof Notification>"u")return"unsupported";let t=Notification.permission;t==="default"&&(t=await Notification.requestPermission()),We=t==="granted";try{localStorage.setItem(ds,We?"1":"0")}catch{}return Be(),t}function il(){We=!1;try{localStorage.setItem(ds,"0")}catch{}Be()}function bn(){return c.useSyncExternalStore(tl,ys,ys)}const cl="_bell_c1uhc_1",dl="_badge_c1uhc_25",ul="_badgeUrgent_c1uhc_41",It={bell:cl,badge:dl,badgeUrgent:ul};function hl(){const{items:t}=bn(),s=t.filter(o=>o.severity==="critical"||o.severity==="high").length,n=t.length,a=c.useRef(s),[r,l]=c.useState("");return c.useEffect(()=>{if(s>a.current){const o=s-a.current;l(`${o} new urgent notification${o===1?"":"s"}, ${s} urgent total.`)}a.current=s},[s]),e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",className:It.bell,onClick:al,"aria-haspopup":"dialog","aria-label":n===0?"Notifications, none open":`Notifications, ${n} open, ${s} urgent`,children:[e.jsx("span",{"aria-hidden":"true",children:"🔔"}),n>0?e.jsx("span",{className:`${It.badge} ${s>0?It.badgeUrgent:""}`,"aria-hidden":"true",children:n>99?"99+":n}):null]}),e.jsx("div",{"aria-live":"polite",className:"visually-hidden",children:r})]})}function ml(t){switch(t){case"critical":return"danger";case"high":return"warning";case"medium":return"running";case"low":return"neutral";case"info":return"info"}}const Pt={"action-required":"Action required",readiness:"Autonomous readiness",security:"Security",budget:"Budget & limits","daemon-health":"Daemon health",proposal:"Proposals",run:"Runs","log-source":"Log source"},pl="_item_1gxz9_1",fl="_top_1gxz9_15",_l="_category_1gxz9_21",xl="_time_1gxz9_26",gl="_title_1gxz9_32",jl="_detail_1gxz9_39",vl="_actions_1gxz9_45",bl="_actionLink_1gxz9_52",yl="_muteBtn_1gxz9_58",ke={item:pl,top:fl,category:_l,time:xl,title:gl,detail:jl,actions:vl,actionLink:bl,muteBtn:yl};function wl(t){const s=Math.max(0,Math.round((Date.now()-new Date(t).getTime())/1e3));if(s<5)return"just now";if(s<60)return`${s}s ago`;const n=Math.round(s/60);if(n<60)return`${n}m ago`;const a=Math.round(n/60);return a<48?`${a}h ago`:`${Math.round(a/24)}d ago`}function Nl({item:t}){const s=rl(t.category);return e.jsxs("article",{className:ke.item,"data-focus-key":`notification-${t.id}`,children:[e.jsxs("div",{className:ke.top,children:[e.jsx(U,{status:t.severity,tone:ml(t.severity),children:t.severity.toUpperCase()}),e.jsx("span",{className:ke.category,children:Pt[t.category]}),e.jsx("span",{className:ke.time,title:new Date(t.ts).toLocaleString(),children:wl(t.ts)})]}),e.jsx("h3",{className:ke.title,children:t.title}),e.jsx("p",{className:ke.detail,children:t.sourceQuality?e.jsx(O,{quality:t.sourceQuality,label:t.title,children:t.detail}):t.detail}),e.jsxs("div",{className:ke.actions,children:[t.actionHref?e.jsx("a",{className:ke.actionLink,href:`#${t.actionHref}`,"data-focus-key":`notification-${t.id}-action`,children:t.actionLabel??"Open"}):null,e.jsx("button",{type:"button",className:ke.muteBtn,onClick:()=>ll(t.category,!s),"aria-pressed":s,children:s?`Unmute ${Pt[t.category]}`:`Mute ${Pt[t.category]}`})]})]})}function kl(){const t=q(kt),s=q(Us),n=q(Ge),a=q(Hs),r=t.data,l=s.data,o=n.data,d=a.data;c.useEffect(()=>{sl(Kr({control:r,fleet:l,runs:o,inbox:d}))},[r,l,o,d])}const $l="_drawer_itt3q_1",Sl="_titleRow_itt3q_16",Cl="_closeBtn_itt3q_23",Rl="_header_itt3q_37",Ll="_desktopToggle_itt3q_42",Tl="_clear_itt3q_57",El="_list_itt3q_66",Al="_journalLink_itt3q_77",Ce={drawer:$l,titleRow:Sl,closeBtn:Cl,header:Rl,desktopToggle:Ll,clear:Tl,list:El,journalLink:Al};function Dl(){kl();const{items:t,panelOpen:s,desktopEnabled:n,desktopPermission:a}=bn(),r=c.useRef(null);async function l(){n?il():await ol()}return e.jsxs(Jt,{open:s,onClose:Mt,titleId:"notification-center-title",title:e.jsxs("span",{className:Ce.titleRow,children:[e.jsx("span",{children:"Notifications"}),e.jsx("button",{type:"button",ref:r,className:Ce.closeBtn,onClick:Mt,"aria-label":"Close notifications",children:"×"})]}),widthClassName:Ce.drawer,initialFocusRef:r,children:[e.jsx("div",{className:Ce.header,children:e.jsx("button",{type:"button",className:Ce.desktopToggle,onClick:()=>void l(),disabled:a==="unsupported"||a==="denied",children:a==="unsupported"?"Desktop alerts not supported in this browser":a==="denied"?"Desktop alerts blocked in browser settings":n?"🔔 Desktop alerts on":"🔕 Desktop alerts off — enable"})}),t.length===0?e.jsxs("div",{className:Ce.clear,children:[e.jsx("strong",{children:"Nothing needs you right now."}),e.jsx("span",{children:"The fleet is operating within its observed authority."})]}):e.jsx("ul",{className:Ce.list,children:t.map(o=>e.jsx("li",{children:e.jsx(Nl,{item:o})},o.id))}),e.jsx("a",{href:"#/journal",className:Ce.journalLink,onClick:Mt,children:"See full history in the Work Journal →"})]})}const Ml="_topbar_nwlse_1",Il="_paletteTrigger_nwlse_12",Pl="_kbd_nwlse_32",ql="_actions_nwlse_41",Bl="_lockedIndicator_nwlse_47",Ol="_lockBtn_nwlse_52",Fl="_themeBtn_nwlse_60",Ee={topbar:Ml,paletteTrigger:Il,kbd:Pl,actions:ql,lockedIndicator:Bl,lockBtn:Ol,themeBtn:Fl};function Ul({onOpenPalette:t}){const{theme:s,cycle:n}=Sn(),a=Bs();return e.jsxs("header",{className:Ee.topbar,children:[e.jsxs("button",{type:"button",className:Ee.paletteTrigger,onClick:t,children:[e.jsx("span",{children:"Search or run a command"}),e.jsx("kbd",{className:Ee.kbd,children:"⌘K"})]}),e.jsxs("div",{className:Ee.actions,children:[e.jsx(hl,{}),a.hasHold?e.jsx("button",{type:"button",className:Ee.lockBtn,onClick:a.clear,title:"Lock actions now",children:"🔓 Unlocked"}):e.jsx("span",{className:Ee.lockedIndicator,title:"Actions require the dispatch token",children:"🔒 Locked"}),e.jsx("button",{type:"button",className:Ee.themeBtn,onClick:n,"aria-label":`Theme: ${s}`,children:s==="system"?"🖥️":s==="light"?"☀️":"🌙"})]}),e.jsx(Dl,{})]})}const Hl=gn.map(t=>({id:`nav:${t.path}`,title:t.label,subtitle:t.description,group:"Navigate",run:s=>s(t.path)})),Gl=[{id:"action:pause-fleet",title:"Pause fleet",subtitle:"Engage the fleet kill switch",group:"Actions",keywords:["stop","kill","halt"],requiresConfirm:{title:"Pause the fleet?",body:"This engages the global kill switch. Autonomous dispatch halts fleet-wide until explicitly resumed.",confirmLabel:"Yes, pause"},requiresMutationToken:!0,run:async()=>{await Vs()}},{id:"action:resume-fleet",title:"Resume fleet",subtitle:"Clear the fleet kill switch",group:"Actions",keywords:["start","unpause"],requiresConfirm:{title:"Resume the fleet?",body:"This clears the global kill switch. Autonomous dispatch will resume across the fleet.",confirmLabel:"Yes, resume"},requiresMutationToken:!0,run:async()=>{await zs()}},{id:"action:open-notifications",title:"Open notification centre",subtitle:"What needs you right now, ranked by severity",group:"Actions",keywords:["alerts","attention","bell","needs you"],run:()=>{nl()}},{id:"action:toggle-theme",title:"Toggle theme",subtitle:"Cycle system → light → dark",group:"Actions",keywords:["dark mode","light mode","appearance","dark","light"],run:()=>{Cn()}},{id:"action:open-journal-today",title:"Open journal — today",subtitle:"Work journal filtered to today",group:"Actions",keywords:["journal","today","log","history"],run:t=>{t("/journal",{state:{windowToday:!0}})}}],Wl=[...Hl,...Gl];function Ql(){ft(Ge.key,Ge.fetch),ft(bt.key,bt.fetch);const t=Yt({status:"all",limit:500});ft(t.key,t.fetch)}const qt=5,Vl=2;function Oe(t,s){return t.toLowerCase().includes(s)}function zl(t){const s=t.trim().toLowerCase();if(s.length<Vl)return[];const n=[],a=at(Ge.key).data??[];for(const u of a){if(n.length>=qt)break;(Oe(u.id,s)||Oe(u.goal,s))&&n.push({id:`jump:run:${u.id}`,title:u.goal,subtitle:`Run ${u.id} · ${u.status}`,group:"Jump to",run:h=>h(`/work/runs/${u.id}`)})}const r=at(bt.key).data??[];let l=0;for(const u of r){if(l>=qt)break;(Oe(u.id,s)||Oe(u.objective,s))&&(l++,n.push({id:`jump:goal:${u.id}`,title:u.objective,subtitle:`Goal ${u.id} · ${u.status}`,group:"Jump to",run:h=>h("/goals")}))}const o=Yt({status:"all",limit:500}).key,d=at(o).data?.proposals??[];let i=0;for(const u of d){if(i>=qt)break;(Oe(u.id,s)||Oe(u.title,s))&&(i++,n.push({id:`jump:proposal:${u.id}`,title:u.title,subtitle:`Proposal ${u.id} · ${u.status}`,group:"Jump to",run:h=>h(`/inbox/${encodeURIComponent(u.id)}`)}))}return n}const Kl=/^\/inbox\/([^/]+)$/;function Jl(t){const s=Kl.exec(t);if(!s)return[];const n=decodeURIComponent(s[1]),a=at(`proposal-detail-${n}`).data;return!a||a.status!=="pending"?[]:[{id:`action:approve-proposal:${n}`,title:`Approve "${a.title}"`,subtitle:"Writes the diff to disk and dispatches it",group:"Actions",keywords:["approve","ship","proposal"],requiresConfirm:{title:"Approve this proposal?",body:`"${a.title}" will be applied. This writes the diff to disk and dispatches it.`,confirmLabel:"Approve"},requiresMutationToken:!0,run:async()=>{await Xt(n)}},{id:`action:reject-proposal:${n}`,title:`Reject "${a.title}"`,subtitle:"Cannot be undone",group:"Actions",keywords:["reject","decline","proposal"],requiresConfirm:{title:"Reject this proposal?",body:`"${a.title}" will be rejected. This cannot be undone.`,confirmLabel:"Reject",destructive:!0},requiresMutationToken:!0,run:async()=>{await Zt(n)}}]}function Yl(t,s=[]){const n=t.trim().toLowerCase(),a=[...s,...Wl];return[...n?a.filter(l=>{const o=[l.title,l.subtitle??"",...l.keywords??[]].join(" ").toLowerCase();return n.split(/\s+/).every(d=>o.includes(d))}):a,...zl(t)]}const Xl="_backdrop_1odjm_1",Zl="_panel_1odjm_12",eo="_input_1odjm_24",to="_list_1odjm_37",so="_item_1odjm_42",no="_active_1odjm_51",ao="_itemTitle_1odjm_55",ro="_itemSubtitle_1odjm_61",lo="_itemGroup_1odjm_67",oo="_empty_1odjm_75",ye={backdrop:Xl,panel:Zl,input:eo,list:to,item:so,active:no,itemTitle:ao,itemSubtitle:ro,itemGroup:lo,empty:oo};function io(t){c.useEffect(()=>{function s(n){(n.metaKey||n.ctrlKey)&&n.key.toLowerCase()==="k"&&(n.preventDefault(),t(!0))}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[t])}function co({open:t,onClose:s}){const[n,a]=c.useState(""),[r,l]=c.useState(0),[o,d]=c.useState(null),[i,u]=c.useState(!1),[h,m]=c.useState(!1),f=c.useRef(null),j=c.useId(),b=dt(),_=ue(),p=Kn(),x=c.useMemo(()=>t?Jl(_.pathname):[],[t,_.pathname]),v=c.useMemo(()=>Yl(n,x),[n,x]);c.useEffect(()=>{if(!t)return;const N=document.activeElement;a(""),l(0),Ql();const C=requestAnimationFrame(()=>f.current?.focus());return()=>{cancelAnimationFrame(C),N?.focus()}},[t]),c.useEffect(()=>{l(0)},[n]),c.useEffect(()=>{l(N=>Math.min(N,Math.max(v.length-1,0)))},[v.length]);async function w(N){try{await N.run((C,oe)=>b(C,oe))}catch(C){p.show(C instanceof Error?C.message:"Command failed.","danger")}finally{d(null)}}function L(N){if(s(),N.requiresConfirm){d(N),u(!0);return}if(N.requiresMutationToken&&!He()){d(N),m(!0);return}w(N)}function g(){u(!1),o&&(o.requiresMutationToken&&!He()?m(!0):w(o))}function H(){u(!1),d(null)}function A(N){if(N.key==="Escape"){s();return}if(N.key==="Tab"){N.preventDefault();return}if(N.key==="ArrowDown")N.preventDefault(),l(C=>Math.min(C+1,v.length-1));else if(N.key==="ArrowUp")N.preventDefault(),l(C=>Math.max(C-1,0));else if(N.key==="Enter"){N.preventDefault();const C=v[r];C&&L(C)}}return e.jsxs(e.Fragment,{children:[t?zn.createPortal(e.jsx("div",{className:ye.backdrop,onMouseDown:N=>N.target===N.currentTarget&&s(),children:e.jsxs("div",{className:ye.panel,role:"dialog","aria-modal":"true","aria-label":"Command palette",children:[e.jsx("input",{ref:f,className:ye.input,value:n,onChange:N=>a(N.target.value),onKeyDown:A,placeholder:"Navigate or run a command…",role:"combobox","aria-expanded":"true","aria-controls":j,"aria-activedescendant":v[r]?`cmd-${v[r].id}`:void 0,autoComplete:"off"}),e.jsx("ul",{id:j,role:"listbox",className:ye.list,children:v.length===0?e.jsx("li",{className:ye.empty,children:"No matching commands."}):v.map((N,C)=>e.jsxs("li",{id:`cmd-${N.id}`,role:"option","aria-selected":C===r,className:`${ye.item} ${C===r?ye.active:""}`,onMouseEnter:()=>l(C),onMouseDown:oe=>{oe.preventDefault(),L(N)},children:[e.jsx("span",{className:ye.itemTitle,children:N.title}),N.subtitle?e.jsx("span",{className:ye.itemSubtitle,children:N.subtitle}):null,e.jsx("span",{className:ye.itemGroup,children:N.group})]},N.id))})]})}),document.body):null,o?.requiresConfirm?e.jsx(es,{open:i,onClose:H,title:o.requiresConfirm.title,body:o.requiresConfirm.body,confirmLabel:o.requiresConfirm.confirmLabel,destructive:o.requiresConfirm.destructive,onConfirm:g}):null,e.jsx($t,{open:h,onClose:()=>{m(!1),d(null)},onUnlocked:()=>{const N=o;m(!1),d(null),N&&w(N)},reason:o?`"${o.title}" requires the dispatch token.`:void 0})]})}const uo="_shell_2db09_1",ho="_body_2db09_9",mo="_main_2db09_17",Bt={shell:uo,body:ho,main:mo};function po(){const t=c.useRef(null),s=ue(),[n,a]=c.useState(!1);return Ne(s.pathname,t),io(a),e.jsxs("div",{className:Bt.shell,children:[e.jsx(Wr,{}),e.jsxs("div",{className:Bt.body,children:[e.jsx(Ul,{onOpenPalette:()=>a(!0)}),e.jsx("main",{ref:t,className:Bt.main,id:"main-content",tabIndex:-1,children:e.jsx(Jn,{resetKey:s.pathname,children:e.jsx(tr,{})})})]}),e.jsx(co,{open:n,onClose:()=>a(!1)})]})}const fo="_wrap_152mr_1",_o="_title_152mr_6",xo="_description_152mr_13",go="_note_152mr_19",pt={wrap:fo,title:_o,description:xo,note:go};function jo({title:t,description:s}){return e.jsxs("div",{className:pt.wrap,children:[e.jsx("h1",{className:pt.title,children:t}),e.jsx("p",{className:pt.description,children:s}),e.jsx("p",{className:pt.note,children:"Not built yet — this route, its nav entry, and its ⌘K command all already work."})]})}const vo="_grid_1exd8_1",bo="_stat_1exd8_7",yo="_statLabel_1exd8_17",wo="_statValue_1exd8_24",No="_statCaption_1exd8_30",nt={grid:vo,stat:bo,statLabel:yo,statValue:wo,statCaption:No};function ko(){return e.jsx(rt,{count:6})}function Fe({label:t,value:s,caption:n}){return e.jsxs("div",{className:nt.stat,children:[e.jsx("span",{className:nt.statLabel,children:t}),e.jsx("span",{className:nt.statValue,children:s}),n?e.jsx("span",{className:nt.statCaption,children:n}):null]})}function $o({snapshot:t}){const s=t.mcp.filter(n=>n.ok).length;return e.jsxs("div",{className:nt.grid,children:[e.jsx(Fe,{label:"Repos",value:String(t.repos.total),caption:`${t.repos.dirty} dirty · ${t.repos.stale} stale`}),e.jsx(Fe,{label:"Tools",value:`${t.tools.installed}/${t.tools.total}`,caption:"installed"}),e.jsx(Fe,{label:"Activity",value:String(t.activity.sessions),caption:`${t.activity.tokens.toLocaleString()} tok · $${t.activity.estCostUsd.toFixed(2)}`}),e.jsx(Fe,{label:"MCP",value:`${s}/${t.mcp.length}`,caption:"reachable"}),e.jsx(Fe,{label:"Genome",value:String(t.genome.entries),caption:`${t.genome.projects} projects`}),e.jsx(Fe,{label:"Inbox",value:String(t.inbox.pending),caption:"pending"})]})}const So="_panel_1gx0q_3",Co="_panelHeader_1gx0q_10",Ro="_panelTitle_1gx0q_25",Lo="_panelBody_1gx0q_33",To="_emptyState_1gx0q_37",Z={panel:So,panelHeader:Co,panelTitle:Ro,panelBody:Lo,emptyState:To},Eo="_table_78j3m_1",Ao="_statusCol_78j3m_27",Do="_tokensCol_78j3m_31",Mo="_goalLink_78j3m_35",Io="_tokens_78j3m_31",Ke={table:Eo,statusCol:Ao,tokensCol:Do,goalLink:Mo,tokens:Io};function Po(){return e.jsxs("details",{className:Z.panel,open:!0,"data-state-key":"fleet-dashboard-runs",children:[e.jsx("summary",{className:Z.panelHeader,children:e.jsx("span",{className:Z.panelTitle,children:"Recent runs"})}),e.jsxs("div",{className:Z.panelBody,children:[e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{})]})]})}function qo({runs:t}){return e.jsxs("details",{className:Z.panel,open:!0,"data-state-key":"fleet-dashboard-runs",children:[e.jsxs("summary",{className:Z.panelHeader,children:[e.jsx("span",{className:Z.panelTitle,children:"Recent runs"}),e.jsx("span",{className:"text-tertiary text-xs",children:t.length})]}),e.jsx("div",{className:Z.panelBody,children:t.length===0?e.jsx("p",{className:Z.emptyState,children:"No runs yet."}):e.jsxs("table",{className:Ke.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Goal"}),e.jsx("th",{scope:"col",className:Ke.statusCol,children:"Status"}),e.jsx("th",{scope:"col",className:Ke.tokensCol,children:"Tokens"})]})}),e.jsx("tbody",{children:t.map(s=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx("a",{href:`#/work/runs/${s.id}`,"data-focus-key":`run-${s.id}`,className:Ke.goalLink,title:s.goal,children:s.goal})}),e.jsx("td",{children:e.jsx(U,{status:s.status})}),e.jsx("td",{className:Ke.tokens,children:s.tokens.toLocaleString()})]},s.id))})]})})]})}const Bo="_list_1fq6m_1",Oo="_item_1fq6m_7",Fo="_itemHeader_1fq6m_13",Uo="_goal_1fq6m_21",Ho="_burndown_1fq6m_42",Go="_burndownTrack_1fq6m_48",Wo="_burndownFill_1fq6m_56",Qo="_burndownLabel_1fq6m_63",Re={list:Bo,item:Oo,itemHeader:Fo,goal:Uo,burndown:Ho,burndownTrack:Go,burndownFill:Wo,burndownLabel:Qo};function Vo({swarms:t}){return e.jsxs("details",{className:Z.panel,open:!0,"data-state-key":"fleet-dashboard-swarms",children:[e.jsxs("summary",{className:Z.panelHeader,children:[e.jsx("span",{className:Z.panelTitle,children:"Swarms"}),e.jsx("span",{className:"text-tertiary text-xs",children:t.length})]}),e.jsx("div",{className:Z.panelBody,children:t.length===0?e.jsx("p",{className:Z.emptyState,children:"No active swarms."}):e.jsx("ul",{className:Re.list,children:t.map((s,n)=>{const a=s.tasksTotal>0?Math.round(s.tasksDone/s.tasksTotal*100):0;return e.jsxs("li",{className:Re.item,children:[e.jsxs("a",{href:`#/work/swarms/${s.id}`,"data-focus-key":`swarm-${s.id}`,className:Re.itemHeader,title:s.goal,children:[s.phase?e.jsx(In,{index:n}):null,e.jsx("span",{className:Re.goal,children:s.goal}),e.jsx(U,{status:s.status})]}),e.jsxs("div",{className:Re.burndown,children:[e.jsx("div",{className:Re.burndownTrack,children:e.jsx("div",{className:Re.burndownFill,style:{width:`${a}%`}})}),e.jsxs("span",{className:Re.burndownLabel,children:[s.tasksDone,"/",s.tasksTotal,s.phase?` · ${s.phase}`:""]})]})]},s.id)})})})]})}const zo="_grid_qy4m7_1",Ko={grid:zo};function Jo(){return e.jsxs("details",{className:Z.panel,open:!0,"data-state-key":"fleet-dashboard-daemon",children:[e.jsx("summary",{className:Z.panelHeader,children:e.jsx("span",{className:Z.panelTitle,children:"Daemon"})}),e.jsx("div",{className:Z.panelBody,children:e.jsx(K,{width:"40%"})})]})}function Yo({daemon:t}){return e.jsxs("details",{className:Z.panel,open:!0,"data-state-key":"fleet-dashboard-daemon",children:[e.jsxs("summary",{className:Z.panelHeader,children:[e.jsx("span",{className:Z.panelTitle,children:"Daemon"}),e.jsx(O,{quality:t.sourceQuality,label:"daemon state",children:e.jsx(U,{status:t.running?"running":"pending",children:t.running?"running":"stopped"})})]}),e.jsx("div",{className:Z.panelBody,children:e.jsxs("dl",{className:Ko.grid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Runtime state"}),e.jsx("dd",{children:e.jsx(O,{quality:t.sourceQuality,label:"runtime state",children:t.runtimeState})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"PID"}),e.jsx("dd",{children:e.jsx(O,{quality:t.sourceQuality,label:"pid",children:t.pid??"—"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Today's spend"}),e.jsx("dd",{children:e.jsxs(O,{quality:t.sourceQuality,label:"spend",children:["$",t.todaySpentUsd.toFixed(2)]})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Direction mode"}),e.jsx("dd",{children:e.jsx(O,{quality:t.sourceQuality,label:"direction mode",children:t.activeDirectionMode??"none"})})]})]})})]})}const Xo="_view_1nttk_1",Zo="_header_1nttk_8",ei="_title_1nttk_14",ti="_freshness_1nttk_20",si="_freshnessLabel_1nttk_26",ni="_panels_1nttk_32",ai="_error_1nttk_39",De={view:Xo,header:Zo,title:ei,freshness:ti,freshnessLabel:si,panels:ni,error:ai};function ri(){const t=q(Me),s=q(kt);return e.jsxs("div",{className:De.view,children:[e.jsxs("header",{className:De.header,children:[e.jsx("h1",{className:De.title,children:"Fleet Dashboard"}),e.jsxs("div",{className:De.freshness,"aria-live":"polite",children:[t.status==="refreshing"?e.jsx(ae,{}):null,t.updatedAt?e.jsxs("span",{className:De.freshnessLabel,children:["Updated ",li(t.updatedAt)]}):null]})]}),t.status==="loading"?e.jsx(ko,{}):t.status==="error"?e.jsx(ws,{message:t.error?.message??"Failed to load snapshot."}):t.data?e.jsx($o,{snapshot:t.data}):null,e.jsxs("div",{className:De.panels,children:[t.status==="loading"?e.jsx(Po,{}):t.data?e.jsx(qo,{runs:t.data.runs}):null,t.data?e.jsx(Vo,{swarms:t.data.swarms}):null,s.status==="loading"?e.jsx(Jo,{}):s.status==="error"?e.jsx(ws,{message:s.error?.message??"Failed to load control snapshot."}):s.data?e.jsx(Yo,{daemon:s.data.daemon}):null]})]})}function ws({message:t}){return e.jsx("div",{className:De.error,role:"alert",children:t})}function li(t){const s=Math.max(0,Math.round((Date.now()-t)/1e3));return s<5?"just now":s<60?`${s}s ago`:`${Math.round(s/60)}m ago`}const Ot={status:"connecting",chunks:[],outputChunks:[],starts:[],stall:null,runDone:null,version:0};function Je(t){const s=t;try{return JSON.parse(s.data)}catch{return null}}function oi(t,s){const[n,a]=c.useState(Ot);return c.useEffect(()=>{if(!s){a(Ot);return}if(a(Ot),typeof EventSource>"u"){a(o=>({...o,status:"unavailable"}));return}const r=`/api/run/${encodeURIComponent(t)}/events?client=${encodeURIComponent(Rn())}`,l=new EventSource(r,{withCredentials:!0});return l.onopen=()=>{a(o=>o.status==="unavailable"?o:{...o,status:"open"})},l.onerror=()=>{a(o=>o.status==="open"?o:{...o,status:"unavailable"})},l.addEventListener("step-started",o=>{const d=Je(o);d&&a(i=>({...i,starts:[...i.starts,d],version:i.version+1}))}),l.addEventListener("step-output-chunk",o=>{const d=Je(o);d&&a(i=>({...i,chunks:[...i.chunks,d],version:i.version+1}))}),l.addEventListener("step-done",()=>{a(o=>({...o,stall:null,version:o.version+1}))}),l.addEventListener("output-chunk",o=>{const d=Je(o);d&&a(i=>({...i,outputChunks:[...i.outputChunks,d],version:i.version+1}))}),l.addEventListener("stall",o=>{const d=Je(o);d&&a(i=>({...i,stall:{ageMs:d.ageMs,at:Date.now()},version:i.version+1}))}),l.addEventListener("run-done",o=>{const d=Je(o);a(i=>({...i,runDone:d??{status:"done",result:null,terminationReason:null},stall:null,version:i.version+1}))}),()=>{l.close()}},[t,s]),n}const it=2e3,ii=it*4;function ci(t){return t?`${t.status}:${t.steps.length}:${t.updatedAt}`:null}function di(t){const s=c.useMemo(()=>Gs(t),[t]),n=q(s),a=Os(s),[r,l]=c.useState(null),[o,d]=c.useState(null),[,i]=c.useState(0),u=n.data?n.data.status!=="running":!1,h=n.error instanceof Ln&&n.error.status===404,f=oi(t,!u&&!h),j=f.status==="open"?"sse":"polling",b=ci(n.data);c.useEffect(()=>{b!==null&&l(Date.now())},[b]),c.useEffect(()=>{if(u||h||j==="sse")return;const v=setInterval(()=>{a(),d(Date.now()),i(w=>w+1)},it);return()=>clearInterval(v)},[a,u,h,j]),c.useEffect(()=>{j!=="sse"||f.version===0||(a(),d(Date.now()))},[f.version,j,a]);const _=it*6,p=j==="sse"&&f.stall!==null&&Date.now()-f.stall.at<_;let x;return h?x="not-found":n.status==="error"&&n.data===void 0?x="error":n.status==="loading"?x="connecting":n.data?n.data.status!=="running"?x="done":j==="sse"?x=p?"stalled":"live":r!==null&&Date.now()-r>ii?x="stalled":x="live":x="connecting",{phase:x,run:n.data,error:n.error,lastChangedAt:r,lastPolledAt:o,pollNow:()=>{a(),d(Date.now())},transport:j,chunks:f.chunks,outputChunks:f.outputChunks,stallAgeMs:p?f.stall.ageMs:null}}const ui="_panel_z6jlr_1",hi="_header_z6jlr_12",mi="_headerTop_z6jlr_18",pi="_title_z6jlr_25",fi="_statRow_z6jlr_35",_i="_banner_z6jlr_53",xi="_bannerWarning_z6jlr_64",gi="_bannerDanger_z6jlr_69",ji="_bannerDot_z6jlr_74",vi="_transcriptWrap_z6jlr_102",bi="_transcript_z6jlr_102",yi="_followButton_z6jlr_122",wi="_empty_z6jlr_151",Ni="_step_z6jlr_158",ki="_stepKind_z6jlr_171",$i="_stepTime_z6jlr_191",Si="_stepTask_z6jlr_195",Ci="_stepSummary_z6jlr_202",Ri="_stepUsage_z6jlr_207",E={panel:ui,header:hi,headerTop:mi,title:pi,statRow:fi,banner:_i,bannerWarning:xi,bannerDanger:gi,bannerDot:ji,transcriptWrap:vi,transcript:bi,followButton:yi,empty:wi,step:Ni,stepKind:ki,stepTime:$i,stepTask:Si,stepSummary:Ci,stepUsage:Ri},Li={plan:"Plan",model:"Model",tool:"Tool",synthesize:"Synthesize"};function Ti(t,s){const n=new Date(t).getTime(),a=s?new Date(s).getTime():Date.now(),r=Math.max(0,Math.round((a-n)/1e3));if(r<60)return`${r}s`;const l=Math.floor(r/60),o=r%60;return`${l}m ${o}s`}function Ns(t){try{return new Date(t).toLocaleTimeString(void 0,{hour12:!1})}catch{return t}}function Ei({phase:t,lastChangedAt:s,stallAgeMs:n,transport:a,error:r}){if(t==="connecting")return e.jsxs("div",{className:E.banner,role:"status",children:[e.jsx("span",{className:E.bannerDot,"data-tone":"connecting","aria-hidden":"true"}),"Connecting to run…"]});if(t==="not-found")return e.jsxs("div",{className:`${E.banner} ${E.bannerDanger}`,role:"alert",children:[e.jsx("span",{className:E.bannerDot,"data-tone":"danger","aria-hidden":"true"}),"Run not found. It may have been pruned from disk since this link was opened."]});if(t==="error")return e.jsxs("div",{className:`${E.banner} ${E.bannerDanger}`,role:"alert",children:[e.jsx("span",{className:E.bannerDot,"data-tone":"danger","aria-hidden":"true"}),"Stream disconnected",r?`: ${r.message}`:"",". Retrying every ",it/1e3,"s…"]});if(t==="stalled"){const l=n!==null?Math.round(n/1e3):s!==null?Math.round((Date.now()-s)/1e3):null;return e.jsxs("div",{className:`${E.banner} ${E.bannerWarning}`,role:"status","aria-live":"polite",children:[e.jsx("span",{className:E.bannerDot,"data-tone":"warning","aria-hidden":"true"}),"No change observed",l!==null?` in ${l}s`:""," — this run may be stalled, or is simply quiet between steps. Still ",a==="sse"?"watching":"polling","."]})}return t==="live"?e.jsxs("div",{className:E.banner,role:"status",children:[e.jsx("span",{className:E.bannerDot,"data-tone":"live","aria-hidden":"true"}),a==="sse"?"Live · streaming (server tail ~500ms)":`Live · polling every ${it/1e3}s (server refresh floor ~1.5s — this cannot be faster than that)`]}):e.jsxs("div",{className:E.banner,role:"status",children:[e.jsx("span",{className:E.bannerDot,"data-tone":"done","aria-hidden":"true"}),"Run finished — no longer ",a==="sse"?"streaming":"polling","."]})}function Ai(){return e.jsxs("div",{className:E.panel,children:[e.jsx(K,{width:"40%"}),e.jsx(K,{width:"90%"}),e.jsx(K,{width:"70%"})]})}function yn({runId:t}){const s=di(t),{phase:n,run:a,error:r,lastChangedAt:l,transport:o,stallAgeMs:d,outputChunks:i}=s,u=c.useRef(null),h=c.useRef(!0),[m,f]=c.useState(!0),j=c.useRef(null),b=c.useRef(!0),[_,p]=c.useState(!0);c.useEffect(()=>{const g=u.current;!g||!h.current||(g.scrollTop=g.scrollHeight)},[a?.steps.length]),c.useEffect(()=>{const g=j.current;!g||!b.current||(g.scrollTop=g.scrollHeight)},[i.length]);function x(){const g=u.current;if(!g)return;const A=g.scrollHeight-g.scrollTop-g.clientHeight<48;h.current=A,f(A)}function v(){const g=j.current;if(!g)return;const A=g.scrollHeight-g.scrollTop-g.clientHeight<48;b.current=A,p(A)}function w(){h.current=!0,f(!0);const g=u.current;g&&(g.scrollTop=g.scrollHeight)}function L(){b.current=!0,p(!0);const g=j.current;g&&(g.scrollTop=g.scrollHeight)}return!a&&n==="connecting"?e.jsx(Ai,{}):e.jsxs("div",{className:E.panel,children:[e.jsxs("header",{className:E.header,children:[e.jsxs("div",{className:E.headerTop,children:[e.jsx("h3",{className:E.title,children:a?.goal??`Run ${t}`}),a?e.jsx(U,{status:a.status}):null]}),a?e.jsxs("dl",{className:E.statRow,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Elapsed"}),e.jsx("dd",{children:Ti(a.createdAt,a.status==="running"?void 0:a.updatedAt)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Tokens"}),e.jsxs("dd",{children:[a.usage.tokensIn.toLocaleString()," in / ",a.usage.tokensOut.toLocaleString()," out"]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Cost"}),e.jsxs("dd",{children:["$",a.usage.estCostUsd.toFixed(3)]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Steps"}),e.jsx("dd",{children:a.steps.length})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Tasks"}),e.jsxs("dd",{children:[a.tasks.filter(g=>g.status==="done").length,"/",a.tasks.length]})]})]}):null]}),e.jsx(Ei,{phase:n,lastChangedAt:l,stallAgeMs:d,transport:o,error:r}),i.length>0?e.jsxs("div",{className:E.transcriptWrap,children:[e.jsx("div",{ref:j,className:E.transcript,onScroll:v,tabIndex:0,role:"log","aria-label":"Live engine output","aria-live":_?"polite":"off",children:i.map((g,H)=>e.jsxs("div",{className:E.step,"data-focus-key":`run-output-chunk-${H}`,children:[e.jsx("span",{className:E.stepKind,"data-kind":g.kind,children:g.kind}),e.jsx("span",{className:E.stepTime,title:g.ts,children:Ns(g.ts)}),e.jsx("span",{className:E.stepTask,children:g.taskId??""}),e.jsx("span",{className:E.stepSummary,children:g.text})]},`${g.ts}-${H}`))}),_?null:e.jsx("button",{type:"button",className:E.followButton,onClick:L,children:"↓ Follow"})]}):null,e.jsxs("div",{className:E.transcriptWrap,children:[e.jsx("div",{ref:u,className:E.transcript,onScroll:x,tabIndex:0,role:"log","aria-label":"Run step transcript","aria-live":m?"polite":"off",children:!a||a.steps.length===0?e.jsx("p",{className:E.empty,children:"No steps recorded yet."}):a.steps.map((g,H)=>e.jsxs("div",{className:E.step,"data-focus-key":`run-stream-step-${H}`,children:[e.jsx("span",{className:E.stepKind,"data-kind":g.kind,children:Li[g.kind]??g.kind}),e.jsx("span",{className:E.stepTime,title:g.ts,children:Ns(g.ts)}),e.jsx("span",{className:E.stepTask,children:g.taskId}),e.jsx("span",{className:E.stepSummary,children:g.summary}),g.usage?e.jsxs("span",{className:E.stepUsage,children:[(g.usage.tokensIn+g.usage.tokensOut).toLocaleString()," tok"]}):null]},`${g.ts}-${H}`))}),m?null:e.jsx("button",{type:"button",className:E.followButton,onClick:w,children:"↓ Follow"})]})]})}const Di="_strip_21e8x_1",Mi="_label_21e8x_11",Ii="_list_21e8x_20",Pi="_watchBtn_21e8x_29",qi="_pulse_21e8x_46",Bi="_dialogWidth_21e8x_70",Ue={strip:Di,label:Mi,list:Ii,watchBtn:Pi,pulse:qi,dialogWidth:Bi};function Oi(){const t=q(Me),[s,n]=c.useState(null),a=(t.data?.runs??[]).filter(r=>r.status==="running");return a.length===0?null:e.jsxs("div",{className:Ue.strip,children:[e.jsx("span",{className:Ue.label,children:"Live now"}),e.jsx("ul",{className:Ue.list,"aria-live":"polite","aria-label":"Currently running",children:a.map(r=>e.jsx("li",{children:e.jsxs("button",{type:"button",className:Ue.watchBtn,onClick:()=>n(r.id),children:[e.jsx("span",{className:Ue.pulse,"aria-hidden":"true"}),r.goal]})},r.id))}),e.jsx(Jt,{open:s!==null,onClose:()=>n(null),titleId:"live-now-title",title:"Watching live",widthClassName:Ue.dialogWidth,children:s?e.jsx(yn,{runId:s}):null})]})}function Fi(t){switch(t){case"merge":return"merged";case"dispatch":return"running";case"tick":return"info";case"info":default:return"pending"}}function Ui(t){const s=[];for(const[n,a]of(t.logs?.entries??[]).entries())s.push({id:`log-${a.ts}-${n}`,ts:a.ts,source:"daemon-tick",title:a.kind==="merge"?"Daemon merge":a.kind==="dispatch"?"Daemon dispatch":"Daemon tick",detail:a.msg+(a.dryRun?" (dry run)":""),statusLabel:Fi(a.kind),sourceQuality:t.logs?.sourceQuality});for(const[n,a]of(t.fleetActivity?.recentTicks??[]).entries())s.push({id:`fleet-tick-${a.ts}-${n}`,ts:a.ts,source:"daemon-tick",title:"Fleet tick",detail:[a.reason,a.directionReason].filter(Boolean).join(" — ")||`${a.merged} merged, $${a.spentUsd.toFixed(2)} spent`,statusLabel:a.dryRun?"pending":"info",sourceQuality:t.fleetActivity?.recentTicksSourceQuality});for(const[n,a]of(t.fleetActivity?.recentMerges??[]).entries())s.push({id:`merge-${a.ts}-${n}`,ts:a.ts,source:"merge",title:`Merged in ${a.repo??"unknown repo"}`,detail:`${a.engine??"unknown engine"}${a.proposalId?` · proposal ${a.proposalId}`:""}`,repo:a.repo??void 0,statusLabel:"merged",sourceQuality:t.fleetActivity?.recentMergesSourceQuality,drillIn:a.proposalId?{proposalId:a.proposalId}:void 0});for(const[n,a]of(t.fleetActivity?.recentActions??[]).entries())s.push({id:`action-${a.ts}-${n}`,ts:a.ts,source:"agent-action",title:a.proseDigest??a.summary??a.action,detail:a.summary,repo:a.repo,statusLabel:a.outcome,sourceQuality:t.fleetActivity?.recentActionsSource,drillIn:a.proposalId?{proposalId:a.proposalId}:a.runId?{runId:a.runId}:void 0});for(const n of t.runs??[])s.push({id:`run-${n.id}`,ts:n.updatedAt,source:"run",title:n.goal,detail:n.result??n.terminationReason??`${n.steps.length} step(s), ${n.tasks.length} task(s)`,statusLabel:n.status,drillIn:{runId:n.id}});for(const n of t.inbox?.proposals??[])s.push({id:`proposal-pending-${n.id}`,ts:n.createdAt,source:"proposal",title:n.title,detail:`${n.kind} · ${n.origin}`,repo:n.repo,statusLabel:"pending",drillIn:{proposalId:n.id}});return s.sort((n,a)=>new Date(a.ts).getTime()-new Date(n.ts).getTime()),s}function wn(t=new Date){const s=new Date(t.getFullYear(),t.getMonth(),t.getDate());return t.getTime()-s.getTime()}function Hi(t,s){const n=Date.now(),a=s.query.trim().toLowerCase();return t.filter(r=>!(!s.sources.has(r.source)||s.windowMs!==null&&n-new Date(r.ts).getTime()>s.windowMs||a&&!`${r.title} ${r.detail} ${r.repo??""} ${r.statusLabel}`.toLowerCase().includes(a)))}function Gi(t,s){const n=Date.now(),a=3600*1e3,r=[];for(let l=s-1;l>=0;l--)r.push({bucketStartMs:n-l*a,count:0});for(const l of t){const o=new Date(l.ts).getTime(),d=n-o;if(d<0||d>s*a)continue;const i=s-1-Math.floor(d/a);i>=0&&i<r.length&&(r[i].count+=1)}return r}const Wi="_bar_1kce8_1",Qi="_search_1kce8_12",Vi="_sources_1kce8_28",zi="_sourceOption_1kce8_34",Ki="_windowSelect_1kce8_43",Ye={bar:Wi,search:Qi,sources:Vi,sourceOption:zi,windowSelect:Ki},Nn=[{value:"run",label:"Runs"},{value:"merge",label:"Merges"},{value:"proposal",label:"Proposals"},{value:"agent-action",label:"Agent actions"},{value:"daemon-tick",label:"Daemon ticks"}],ks=[{value:"1h",label:"Last hour",ms:3600*1e3},{value:"today",label:"Today",ms:null,dynamic:!0},{value:"24h",label:"Last 24h",ms:1440*60*1e3},{value:"7d",label:"Last 7 days",ms:10080*60*1e3},{value:"all",label:"All available",ms:null}];function Ji({sources:t,onSourcesChange:s,query:n,onQueryChange:a,windowValue:r,onWindowChange:l}){function o(d){const i=new Set(t);i.has(d)?i.delete(d):i.add(d),s(i)}return e.jsxs("div",{className:Ye.bar,children:[e.jsx("input",{type:"search",className:Ye.search,placeholder:"Search title, detail, repo…",value:n,onChange:d=>a(d.target.value),"aria-label":"Search the work journal"}),e.jsx("div",{className:Ye.sources,role:"group","aria-label":"Filter by source",children:Nn.map(d=>e.jsxs("label",{className:Ye.sourceOption,children:[e.jsx("input",{type:"checkbox",checked:t.has(d.value),onChange:()=>o(d.value)}),d.label]},d.value))}),e.jsx("select",{className:Ye.windowSelect,value:r,onChange:d=>{const i=ks.find(u=>u.value===d.target.value);l(d.target.value,i?.dynamic?wn():i?.ms??null)},"aria-label":"Time window",children:ks.map(d=>e.jsx("option",{value:d.value,children:d.label},d.value))})]})}const Yi=new Set(Nn.map(t=>t.value)),Xi="_strip_h22ae_1",Zi="_bar_h22ae_12",ec="_fill_h22ae_33",Ft={strip:Xi,bar:Zi,fill:ec};function tc({entries:t,hours:s,onScrubTo:n}){const a=Gi(t,s),r=Math.max(1,...a.map(l=>l.count));return e.jsx("div",{className:Ft.strip,role:"group","aria-label":`Activity density over the last ${s} hours`,children:a.map(l=>{const o=Math.round(l.count/r*100),d=new Date(l.bucketStartMs).toLocaleTimeString(void 0,{hour:"numeric"});return e.jsx("button",{type:"button",className:Ft.bar,onClick:()=>n(l.bucketStartMs),disabled:l.count===0,title:`${d}: ${l.count} entr${l.count===1?"y":"ies"}`,"aria-label":`${d}: ${l.count} entries`,children:e.jsx("span",{className:Ft.fill,style:{height:`${Math.max(o,l.count>0?8:0)}%`}})},l.bucketStartMs)})})}const sc="_detailBody_bgyq9_1",nc="_grid_bgyq9_10",ac="_rationale_bgyq9_27",rc="_diffDetails_bgyq9_34",lc="_diff_bgyq9_34",oc="_error_bgyq9_56",Ae={detailBody:sc,grid:nc,rationale:ac,diffDetails:rc,diff:lc,error:oc};function ic({proposalId:t}){const s=q(Ws(t));if(s.status==="loading")return e.jsx(K,{width:"80%"});if(s.status==="error")return e.jsxs("p",{className:Ae.error,children:["Could not load proposal ",t,": ",s.error?.message??"not found on disk (it may have been pruned)."]});const n=s.data;return n?e.jsxs("div",{className:Ae.detailBody,children:[e.jsxs("dl",{className:Ae.grid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Status"}),e.jsx("dd",{children:e.jsx(U,{status:n.status})})]}),n.riskClass?e.jsxs("div",{children:[e.jsx("dt",{children:"Risk"}),e.jsx("dd",{children:n.riskClass})]}):null,n.taste?e.jsxs("div",{children:[e.jsx("dt",{children:"Judge verdict"}),e.jsxs("dd",{children:[n.taste.verdict," · alignment ",n.taste.alignment,"/10 · ambition ",n.taste.ambition,"/10 · design"," ",n.taste.design,"/10"]})]}):null,n.decisionReason?e.jsxs("div",{children:[e.jsx("dt",{children:"Decision"}),e.jsx("dd",{children:n.decisionReason})]}):null,n.learningSource?e.jsxs("div",{children:[e.jsx("dt",{children:"Learning source"}),e.jsx("dd",{children:n.learningSource})]}):null]}),n.taste?.rationale?e.jsx("p",{className:Ae.rationale,children:n.taste.rationale}):null,n.diff?e.jsxs("details",{className:Ae.diffDetails,children:[e.jsxs("summary",{children:["Diff (",n.diff.split(`
13
- `).length," lines)"]}),e.jsx("pre",{className:Ae.diff,children:n.diff})]}):e.jsx("p",{className:Ae.error,children:"No diff recorded for this proposal."})]}):null}function cc({drillIn:t}){return t.runId?e.jsx(yn,{runId:t.runId}):t.proposalId?e.jsx(ic,{proposalId:t.proposalId}):null}const dc="_row_194dy_1",uc="_summary_194dy_9",hc="_sourceTag_194dy_31",mc="_when_194dy_53",pc="_repo_194dy_61",fc="_title_194dy_70",_c="_expandHint_194dy_80",xc="_body_194dy_86",gc="_detailText_194dy_90",$e={row:dc,summary:uc,sourceTag:hc,when:mc,repo:pc,title:fc,expandHint:_c,body:xc,detailText:gc},jc={"daemon-tick":"Daemon",merge:"Merge","agent-action":"Agent",run:"Run",proposal:"Proposal"};function vc(t){const s=new Date(t);return`${s.toLocaleDateString(void 0,{month:"short",day:"numeric"})} ${s.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}`}function bc({entry:t}){const s=!!t.drillIn,[n,a]=c.useState(!1);return e.jsxs("details",{className:$e.row,"data-state-key":`journal-${t.id}`,onToggle:r=>a(r.currentTarget.open),children:[e.jsxs("summary",{className:$e.summary,"data-focus-key":`journal-${t.id}`,children:[e.jsx("span",{className:$e.sourceTag,"data-source":t.source,children:jc[t.source]}),e.jsx("span",{className:$e.when,title:t.ts,children:vc(t.ts)}),e.jsx(U,{status:t.statusLabel}),t.repo?e.jsx("span",{className:$e.repo,children:t.repo}):null,e.jsx("span",{className:$e.title,children:t.title}),e.jsx(Mn,{quality:t.sourceQuality}),s?e.jsx("span",{className:$e.expandHint,"aria-hidden":"true",children:"why? ▾"}):null]}),e.jsxs("div",{className:$e.body,children:[e.jsx("p",{className:$e.detailText,children:t.detail}),n&&t.drillIn?e.jsx(cc,{drillIn:t.drillIn}):null]})]})}const yc="_view_1omi1_1",wc="_header_1omi1_9",Nc="_title_1omi1_16",kc="_windowNote_1omi1_23",$c="_freshness_1omi1_30",Sc="_freshnessLabel_1omi1_37",Cc="_errorBanner_1omi1_42",Rc="_panel_1omi1_50",Lc="_list_1omi1_57",Tc="_empty_1omi1_63",xe={view:yc,header:wc,title:Nc,windowNote:kc,freshness:$c,freshnessLabel:Sc,errorBanner:Cc,panel:Rc,list:Lc,empty:Tc},Ec=8e3;function Ac(t){const s=Math.max(0,Math.round((Date.now()-t)/1e3));return s<5?"just now":s<60?`${s}s ago`:`${Math.round(s/60)}m ago`}function Dc(){const s=ue().state?.windowToday===!0,n=q(hs),a=q(Qs),r=q(Ge),l=q(Hs),o=Os(hs);c.useEffect(()=>{const A=setInterval(o,Ec);return()=>clearInterval(A)},[o]);const[d,i]=c.useState(new Set(Yi)),[u,h]=c.useState(""),[m,f]=c.useState(s?"today":"24h"),[j,b]=c.useState(s?wn():1440*60*1e3),_=c.useMemo(()=>Ui({logs:n.data,fleetActivity:a.data,runs:r.data,inbox:l.data}),[n.data,a.data,r.data,l.data]),p=c.useMemo(()=>Hi(_,{sources:d,query:u,windowMs:j}),[_,d,u,j]),x=c.useRef(new Map);function v(A){const C=p.find(oe=>new Date(oe.ts).getTime()<=A+36e5);C&&x.current.get(C.id)?.scrollIntoView({behavior:"smooth",block:"center"})}const w=n.status==="loading"&&a.status==="loading"&&r.status==="loading"&&l.status==="loading",L=[n,a,r,l].some(A=>A.status==="refreshing"),g=Math.max(n.updatedAt??0,a.updatedAt??0,r.updatedAt??0,l.updatedAt??0),H=[n.status==="error"?`daemon log: ${n.error?.message}`:null,a.status==="error"?`fleet activity: ${a.error?.message}`:null,r.status==="error"?`runs: ${r.error?.message}`:null,l.status==="error"?`inbox: ${l.error?.message}`:null].filter(A=>A!==null);return e.jsxs("div",{className:xe.view,children:[e.jsxs("header",{className:xe.header,children:[e.jsxs("div",{children:[e.jsx("h1",{className:xe.title,children:"Work Journal"}),e.jsx("p",{className:xe.windowNote,children:"Merges the daemon log (last 200 lines), fleet activity (last ~20 merges/ticks/agent actions), recent runs (last 200), and the pending-proposal inbox. The read API does not expose the full on-disk history beyond this window."})]}),e.jsxs("div",{className:xe.freshness,"aria-live":"polite",children:[L?e.jsx(ae,{}):null,g>0?e.jsxs("span",{className:xe.freshnessLabel,children:["Updated ",Ac(g)]}):null]})]}),H.length>0?e.jsxs("div",{className:xe.errorBanner,role:"alert",children:["Some sources failed to load: ",H.join("; ")]}):null,e.jsx(Oi,{}),w?e.jsxs("div",{className:xe.panel,children:[e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{})]}):e.jsxs(e.Fragment,{children:[e.jsx(tc,{entries:_,hours:24,onScrubTo:v}),e.jsx(Ji,{sources:d,onSourcesChange:i,query:u,onQueryChange:h,windowValue:m,onWindowChange:(A,N)=>{f(A),b(N)}}),e.jsx("div",{className:xe.panel,children:p.length===0?e.jsx("p",{className:xe.empty,children:"Nothing matches the current filters in this window."}):e.jsx("ul",{className:xe.list,children:p.map(A=>e.jsx("li",{ref:N=>{N?x.current.set(A.id,N):x.current.delete(A.id)},children:e.jsx(bc,{entry:A})},A.id))})})]})]})}const Mc="_view_7836g_1",Ic="_header_7836g_7",Pc="_title_7836g_15",qc="_freshness_7836g_21",Bc="_freshnessLabel_7836g_27",Oc="_filterRow_7836g_32",Fc="_windowGroup_7836g_38",Uc="_windowButton_7836g_45",Hc="_windowButtonActive_7836g_64",Gc="_kpiGrid_7836g_70",Wc="_chartsGrid_7836g_76",Qc="_error_7836g_82",me={view:Mc,header:Ic,title:Pc,freshness:qc,freshnessLabel:Bc,filterRow:Oc,windowGroup:Fc,windowButton:Uc,windowButtonActive:Hc,kpiGrid:Gc,chartsGrid:Wc,error:Qc},Vc=["1d","7d","30d"],zc={ok:"success",warn:"warning",over:"danger"};function $s(t){const s=t.replace(/\/+$/,"").split("/");return s[s.length-1]||t}function Kc(){const[t,s]=c.useState("7d"),n=q(qn(t));return e.jsxs("div",{className:me.view,children:[e.jsxs("header",{className:me.header,children:[e.jsx("h1",{className:me.title,children:"Pulse"}),e.jsxs("div",{className:me.freshness,"aria-live":"polite",children:[n.status==="refreshing"?e.jsx(ae,{}):null,n.updatedAt?e.jsxs("span",{className:me.freshnessLabel,children:["Updated ",Yc(n.updatedAt)]}):null]})]}),e.jsxs("div",{className:me.filterRow,role:"group","aria-label":"Time window",children:[e.jsx("div",{className:me.windowGroup,children:Vc.map(a=>e.jsx("button",{type:"button",className:`${me.windowButton} ${a===t?me.windowButtonActive:""}`,"aria-pressed":a===t,onClick:()=>s(a),children:a},a))}),n.data?e.jsx(U,{status:n.data.budget.level,tone:zc[n.data.budget.level],children:n.data.budget.message}):null]}),n.status==="loading"?e.jsx(rt,{count:4}):n.status==="error"?e.jsx("div",{className:me.error,role:"alert",children:n.error?.message??"Failed to load pulse data."}):n.data?e.jsx(Jc,{rollup:n.data}):null]})}function Jc({rollup:t}){const s=[{id:"cost",label:"Est. cost (USD)",points:t.byDay.map(i=>({x:Date.parse(`${i.day}T00:00:00Z`),y:i.estCostUsd}))}],n=[...t.byProject].sort((i,u)=>u.estCostUsd-i.estCostUsd).slice(0,8),a=n.map(i=>({label:$s(i.project),value:i.estCostUsd})),r=[...t.byModel].sort((i,u)=>u.estCostUsd-i.estCostUsd).slice(0,8),l=r.map(i=>({label:i.model,value:i.estCostUsd})),o=[{key:"project",label:"Project",render:i=>$s(i.project)},{key:"sessions",label:"Sessions",numeric:!0,render:i=>String(i.sessions)},{key:"commits",label:"Commits",numeric:!0,render:i=>String(i.commits)},{key:"cost",label:"Cost",numeric:!0,render:i=>ge(i.estCostUsd)}],d=[{key:"model",label:"Model",render:i=>i.model},{key:"calls",label:"Calls",numeric:!0,render:i=>String(i.calls)},{key:"tokens",label:"Tokens",numeric:!0,render:i=>st(i.tokensIn+i.tokensOut)},{key:"cost",label:"Cost",numeric:!0,render:i=>ge(i.estCostUsd)}];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:me.kpiGrid,children:[e.jsx(re,{label:"Est. cost",value:ge(t.totals.estCostUsd),caption:t.window}),e.jsx(re,{label:"Tokens",value:st(t.totals.tokensIn+t.totals.tokensOut),caption:`${st(t.totals.tokensIn)} in / ${st(t.totals.tokensOut)} out`}),e.jsx(re,{label:"Sessions",value:String(t.totals.sessions)}),e.jsx(re,{label:"Commits",value:String(t.totals.commits)})]}),e.jsxs("div",{className:me.chartsGrid,children:[e.jsx(Le,{title:"Cost over time",description:`since ${new Date(t.since).toLocaleDateString()}`,empty:t.byDay.length===0,emptyMessage:"No activity recorded in this window.",table:e.jsx(Ie,{caption:"Daily cost",rowKey:i=>i.day,rows:t.byDay,columns:[{key:"day",label:"Day",render:i=>i.day},{key:"cost",label:"Cost",numeric:!0,render:i=>ge(i.estCostUsd)},{key:"sessions",label:"Sessions",numeric:!0,render:i=>String(i.sessions)}]}),children:e.jsx(Zn,{series:s,area:!0,ariaLabel:"Estimated cost over time",formatX:i=>new Date(i).toLocaleDateString(void 0,{month:"short",day:"numeric"}),formatY:i=>ge(i)})}),e.jsx(Le,{title:"Top projects by cost",empty:a.length===0,emptyMessage:"No project activity in this window.",table:e.jsx(Ie,{caption:"Cost by project",rowKey:i=>i.project,rows:n,columns:o}),children:e.jsx(Pe,{data:a,orientation:"horizontal",ariaLabel:"Top projects by estimated cost",formatValue:i=>ge(i)})}),e.jsx(Le,{title:"Cost by model",empty:l.length===0,emptyMessage:"No model activity in this window.",table:e.jsx(Ie,{caption:"Cost by model",rowKey:i=>i.model,rows:r,columns:d}),children:e.jsx(Pe,{data:l,ariaLabel:"Cost by model",formatValue:i=>ge(i)})})]})]})}function Yc(t){const s=Math.max(0,Math.round((Date.now()-t)/1e3));return s<5?"just now":s<60?`${s}s ago`:`${Math.round(s/60)}m ago`}const Xc="_view_44i9i_1",Zc="_header_44i9i_7",ed="_title_44i9i_15",td="_searchRow_44i9i_21",sd="_searchInput_44i9i_27",nd="_resultCount_44i9i_43",ad="_results_44i9i_48",rd="_row_44i9i_57",ld="_rowHeader_44i9i_64",od="_rowTitle_44i9i_72",id="_rowMeta_44i9i_78",cd="_badge_44i9i_87",dd="_snippet_44i9i_97",ud="_tags_44i9i_107",hd="_tag_44i9i_107",md="_skeletons_44i9i_123",pd="_empty_44i9i_129",fd="_error_44i9i_136",ee={view:Xc,header:Zc,title:ed,searchRow:td,searchInput:sd,resultCount:nd,results:ad,row:rd,rowHeader:ld,rowTitle:od,rowMeta:id,badge:cd,snippet:dd,tags:ud,tag:hd,skeletons:md,empty:pd,error:fd},_d=50,xd=300;function gd(t,s){const[n,a]=c.useState(t);return c.useEffect(()=>{const r=setTimeout(()=>a(t),s);return()=>clearTimeout(r)},[t,s]),n}function jd(t,s=220){const n=t.trim();return n.length>s?`${n.slice(0,s-1)}…`:n}function vd(t){const s=Date.parse(t);if(Number.isNaN(s))return t;const n=Math.floor((Date.now()-s)/864e5);return n<=0?"today":n===1?"yesterday":n<30?`${n}d ago`:`${Math.floor(n/30)}mo ago`}function bd(){const[t,s]=c.useState(""),n=gd(t,xd),a=q(Bn(n)),r=n.trim().length>0,l=a.data,{rows:o,totalCount:d}=c.useMemo(()=>{if(!l)return{rows:[],totalCount:0};if(r)return{rows:l,totalCount:l.length};const u=l;return{rows:[...u].sort((m,f)=>Date.parse(f.ts)-Date.parse(m.ts)).slice(0,_d),totalCount:u.length}},[l,r]),i=c.useMemo(()=>{if(!l||r)return[];const u=l,h=new Map;for(const m of u){const f=m.project??"(unscoped)";h.set(f,(h.get(f)??0)+1)}return[...h.entries()].sort((m,f)=>f[1]-m[1]).slice(0,8).map(([m,f])=>({label:m,value:f}))},[l,r]);return e.jsxs("div",{className:ee.view,children:[e.jsxs("header",{className:ee.header,children:[e.jsx("h1",{className:ee.title,children:"Genome"}),e.jsx("div",{"aria-live":"polite",children:a.status==="refreshing"?e.jsx(ae,{}):null})]}),e.jsxs("div",{className:ee.searchRow,children:[e.jsx("input",{type:"search",className:ee.searchInput,placeholder:"Search the genome (title, tags, body text)…",value:t,onChange:u=>s(u.target.value),"aria-label":"Search cross-repo knowledge"}),l?e.jsx("span",{className:ee.resultCount,children:r?`${d} match${d===1?"":"es"}`:`showing ${o.length} of ${d}`}):null]}),!r&&i.length>0?e.jsx(Le,{title:"Top projects by genome entries",description:"browse mode — all loaded entries",children:e.jsx(Pe,{data:i,orientation:"horizontal",ariaLabel:"Top projects by genome entry count",formatValue:u=>st(u)})}):null,a.status==="loading"?e.jsxs("div",{className:ee.skeletons,"aria-hidden":"true",children:[e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{})]}):a.status==="error"?e.jsx("div",{className:ee.error,role:"alert",children:a.error?.message??"Failed to load genome data."}):o.length===0?e.jsx("p",{className:ee.empty,children:r?`No genome entries match "${n}".`:"No genome entries recorded yet."}):e.jsx("ul",{className:ee.results,children:o.map(u=>{const h=On(u)?u:null,m=h?h.entry:u;return e.jsxs("li",{className:ee.row,children:[e.jsxs("div",{className:ee.rowHeader,children:[e.jsx("span",{className:ee.rowTitle,children:m.title}),e.jsxs("span",{className:ee.rowMeta,children:[h?e.jsxs("span",{className:ee.badge,children:[h.method," · ",h.score.toFixed(2)]}):null,e.jsx("span",{children:vd(m.ts)})]})]}),e.jsxs("div",{className:ee.rowMeta,children:[e.jsx("span",{className:ee.badge,children:m.project??"unscoped"}),e.jsx("span",{className:ee.badge,children:m.source})]}),e.jsx("p",{className:ee.snippet,children:jd(m.text)}),m.tags.length>0?e.jsx("div",{className:ee.tags,children:m.tags.map(f=>e.jsx("span",{className:ee.tag,children:f},f))}):null]},m.id)})})]})}const yd="_view_1frm3_1",wd="_header_1frm3_7",Nd="_title_1frm3_15",kd="_filterRow_1frm3_21",$d="_windowGroup_1frm3_27",Sd="_windowButton_1frm3_34",Cd="_windowButtonActive_1frm3_53",Rd="_kpiGrid_1frm3_59",Ld="_chartsGrid_1frm3_65",Td="_section_1frm3_71",Ed="_sectionTitle_1frm3_77",Ad="_goalsList_1frm3_83",Dd="_goalRow_1frm3_92",Md="_goalObjective_1frm3_102",Id="_meterTrack_1frm3_107",Pd="_meterFill_1frm3_115",qd="_goalMeta_1frm3_121",Bd="_error_1frm3_126",Od="_notAvailable_1frm3_135",J={view:yd,header:wd,title:Nd,filterRow:kd,windowGroup:$d,windowButton:Sd,windowButtonActive:Cd,kpiGrid:Rd,chartsGrid:Ld,section:Td,sectionTitle:Ed,goalsList:Ad,goalRow:Dd,goalObjective:Md,meterTrack:Id,meterFill:Pd,goalMeta:qd,error:Bd,notAvailable:Od},Fd=["7d","30d","all"];function Ut(t){return`${t.engine}:${t.model}`}function Ud(){const[t,s]=c.useState("30d"),n=q(Me),a=q(Fn(t)),r=n.data?.production;return e.jsxs("div",{className:J.view,children:[e.jsxs("header",{className:J.header,children:[e.jsx("h1",{className:J.title,children:"Production"}),e.jsx("div",{"aria-live":"polite",children:n.status==="refreshing"||a.status==="refreshing"?e.jsx(ae,{}):null})]}),n.status==="loading"?e.jsx(rt,{count:4}):n.status==="error"?e.jsx("div",{className:J.error,role:"alert",children:n.error?.message??"Failed to load production summary."}):r?e.jsx(Hd,{production:r}):e.jsx("p",{className:J.notAvailable,children:"Production summary not available on this server (older producer, or not yet populated)."}),e.jsx("div",{className:J.filterRow,role:"group","aria-label":"Model stats window",children:e.jsx("div",{className:J.windowGroup,children:Fd.map(l=>e.jsx("button",{type:"button",className:`${J.windowButton} ${l===t?J.windowButtonActive:""}`,"aria-pressed":l===t,onClick:()=>s(l),children:l},l))})}),a.status==="loading"?e.jsx(rt,{count:3}):a.status==="error"?e.jsx("div",{className:J.error,role:"alert",children:a.error?.message??"Failed to load per-model stats."}):a.data?e.jsx(Gd,{result:a.data}):null]})}function Hd({production:t}){const s=t.judgeVerdicts24h,n=t.judgeFailures24h??{total:0,parse:0,network:0},a=[{label:"ship",value:s.ship},{label:"review",value:s.review},{label:"noise",value:s.noise},{label:"harmful",value:s.harmful}],r=t.shipsPerDayTrend.map(i=>({label:ea(i.date),value:i.count})),l=t.shipsPerDayTrend.reduce((i,u)=>i+u.count,0),o=_t(t.proposalSourceQuality),d=_t(t.judgeTraceSourceQuality);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:J.kpiGrid,children:[e.jsx(re,{label:"Proposals (24h)",value:e.jsx(O,{quality:t.proposalSourceQuality,label:"proposals",children:String(t.proposals24h.total)}),caption:e.jsx(O,{quality:t.proposalSourceQuality,label:"pending proposals",children:`${t.proposals24h.pending} pending`})}),e.jsx(re,{label:"Auto-merges today",value:e.jsx(O,{quality:t.proposalSourceQuality,label:"auto-merges",children:String(t.autoMergesToday.count)})}),e.jsx(re,{label:"Judged (24h)",value:e.jsx(O,{quality:t.judgeTraceSourceQuality,label:"judge verdicts",children:String(s.total)})}),e.jsx(re,{label:"Judge failures (24h)",value:e.jsx(O,{quality:t.judgeFailureSourceQuality,label:"judge failures",children:String(n.total)}),caption:e.jsx(O,{quality:t.judgeFailureSourceQuality,children:`${n.parse} parse · ${n.network} network`})}),e.jsx(re,{label:"Active goals",value:e.jsx(O,{quality:t.activeGoalsSourceQuality,label:"active goals",children:String(t.activeGoals.length)})})]}),e.jsxs("div",{className:J.chartsGrid,children:[e.jsxs(Le,{title:"Ships per day",description:"last 7 days",empty:o&&r.length===0,emptyMessage:"No ship history recorded yet.",table:o?e.jsx(Ie,{caption:"Ships per day",rowKey:i=>i.label,rows:r,columns:[{key:"day",label:"Day",render:i=>i.label},{key:"count",label:"Ships",numeric:!0,render:i=>String(i.value??0)}]}):void 0,children:[o?l===0?e.jsx("p",{className:J.notAvailable,children:"0 ships in the last 7 days — this is the real number, not a loading state."}):null:e.jsx(O,{quality:t.proposalSourceQuality,label:"ship history",children:"ship history"}),o?e.jsx(Pe,{data:r,ariaLabel:"Ships per day, last 7 days",formatValue:i=>String(i)}):null]}),e.jsx(Le,{title:"Judge verdict breakdown",description:"last 24h",empty:d&&s.total===0,emptyMessage:"No judge verdicts recorded in the last 24h.",children:d?e.jsx(Pe,{data:a,ariaLabel:"Judge verdict breakdown, last 24h",formatValue:i=>String(i)}):e.jsx(O,{quality:t.judgeTraceSourceQuality,label:"judge verdicts",children:"judge verdicts"})})]}),_t(t.activeGoalsSourceQuality)?t.activeGoals.length>0?e.jsxs("div",{className:J.section,children:[e.jsx("h2",{className:J.sectionTitle,children:"Active goals"}),e.jsx("ul",{className:J.goalsList,children:t.activeGoals.map(i=>{const u=i.totalMilestones>0?i.doneMilestones/i.totalMilestones:0;return e.jsxs("li",{className:J.goalRow,children:[e.jsx("span",{className:J.goalObjective,children:i.objective}),e.jsx("div",{className:J.meterTrack,children:e.jsx("div",{className:J.meterFill,style:{width:`${Math.round(u*100)}%`}})}),e.jsxs("span",{className:J.goalMeta,children:[i.doneMilestones," / ",i.totalMilestones," milestones"]})]},i.goalId)})})]}):null:e.jsxs("div",{className:J.section,children:[e.jsx("h2",{className:J.sectionTitle,children:"Active goals"}),e.jsx(O,{quality:t.activeGoalsSourceQuality,label:"active goals",children:"active goals"})]})]})}function Gd({result:t}){const s=[...t.models].sort((r,l)=>l.dispatches-r.dispatches).slice(0,12),n=s.map(r=>({label:Ut(r),value:r.judged>0?r.shipRate:null})),a=[{key:"model",label:"Model",render:r=>Ut(r)},{key:"dispatches",label:"Dispatches",numeric:!0,render:r=>String(r.dispatches)},{key:"shipRate",label:"Ship rate",numeric:!0,render:r=>r.judged>0?xt(r.shipRate):"—"},{key:"merged",label:"Merged",numeric:!0,render:r=>String(r.merged)},{key:"costPerMerged",label:"Cost / merge",numeric:!0,render:r=>r.costPerMergedUsd!==null?ge(r.costPerMergedUsd):"—"},{key:"bestOfN",label:"Best-of-N win rate",numeric:!0,render:r=>r.bestOfNAvailable?e.jsx(O,{quality:t.bestOfNSource,label:"best-of-N win rate",children:xt(r.bestOfN.winRate)}):"—"}];return e.jsx("div",{className:J.chartsGrid,children:e.jsx(Le,{title:"Ship rate by model",description:"judged proposals in the selected window",empty:s.length===0,emptyMessage:"No dispatch history for this window.",table:e.jsx(Ie,{caption:"Per-model economics",rowKey:Ut,rows:s,columns:a}),children:e.jsx(Pe,{data:n,ariaLabel:"Ship rate by model",formatValue:r=>xt(r)})})})}const Wd="_view_ruego_1",Qd="_header_ruego_7",Vd="_title_ruego_15",zd="_freshness_ruego_21",Kd="_freshnessLabel_ruego_27",Jd="_kpiGrid_ruego_32",Yd="_chartsGrid_ruego_38",Xd="_section_ruego_44",Zd="_sectionTitle_ruego_50",eu="_list_ruego_56",tu="_row_ruego_65",su="_rowTitle_ruego_75",nu="_meterTrack_ruego_84",au="_meterFill_ruego_92",ru="_rowMeta_ruego_98",lu="_effectiveness_ruego_103",ou="_effectivenessHeadline_ruego_110",iu="_error_ruego_116",cu="_notAvailable_ruego_125",z={view:Wd,header:Qd,title:Vd,freshness:zd,freshnessLabel:Kd,kpiGrid:Jd,chartsGrid:Yd,section:Xd,sectionTitle:Zd,list:eu,row:tu,rowTitle:su,meterTrack:nu,meterFill:au,rowMeta:ru,effectiveness:lu,effectivenessHeadline:ou,error:iu,notAvailable:cu};function du(t){const s=Math.max(0,Math.round((Date.now()-t)/1e3));return s<5?"just now":s<60?`${s}s ago`:`${Math.round(s/60)}m ago`}function uu(){const t=q(Un),s=q(Me);return e.jsxs("div",{className:z.view,children:[e.jsxs("header",{className:z.header,children:[e.jsx("h1",{className:z.title,children:"Portfolio"}),e.jsxs("div",{className:z.freshness,"aria-live":"polite",children:[t.status==="refreshing"||s.status==="refreshing"?e.jsx(ae,{}):null,t.updatedAt?e.jsxs("span",{className:z.freshnessLabel,children:["Updated ",du(t.updatedAt)]}):null]})]}),t.status==="loading"?e.jsx(rt,{count:6}):t.status==="error"?e.jsx("div",{className:z.error,role:"alert",children:t.error?.message??"Failed to load portfolio."}):t.data===null?e.jsx("p",{className:z.notAvailable,children:"No portfolio roll-up available — either this server has no enrolled repos, or it predates the portfolio feature."}):t.data?e.jsx(hu,{portfolio:t.data}):null]})}function hu({portfolio:t}){const{health:s,goalsInFlight:n,backlogTop:a,cost:r,effectiveness:l,today:o}=t,d=s.worstRepos.map(u=>({label:u.repo.split("/").filter(Boolean).pop()??u.repo,value:u.score})),i=[{key:"title",label:"Item",render:u=>u.title},{key:"repo",label:"Repo",render:u=>u.repo??"—"},{key:"score",label:"Score",numeric:!0,render:u=>u.score.toFixed(1)}];return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:z.kpiGrid,children:[e.jsx(re,{label:"Portfolio health",value:`${s.averageScore.toFixed(0)} (${s.averageGrade})`,caption:`${s.reposScored} repos scored`,delta:o.healthScoreDelta!==null?{value:o.healthScoreDelta,goodWhenPositive:!0}:null}),e.jsx(re,{label:"Goals in flight",value:String(n.length)}),e.jsx(re,{label:"Backlog top items",value:String(a.length),delta:o.pendingProposalsDelta!==null?{value:o.pendingProposalsDelta,versus:"pending proposals"}:null}),e.jsx(re,{label:"Spend",value:ge(r.spentUsd),caption:`${r.window} window`,delta:o.spendUsdDelta!==null?{value:o.spendUsdDelta,goodWhenPositive:!1}:null}),e.jsx(re,{label:"Local savings",value:ge(r.localSavingsUsd)}),e.jsx(re,{label:"Projected monthly",value:ge(r.projectedMonthlyUsd)})]}),l?e.jsxs("div",{className:z.effectiveness,children:[e.jsx("p",{className:z.effectivenessHeadline,children:l.headline}),e.jsxs("span",{className:z.rowMeta,children:["Success rate ",xt(l.successRate),l.effectivenessDeltaPct!==null?` (${l.effectivenessDeltaPct>=0?"+":""}${l.effectivenessDeltaPct.toFixed(1)}pp)`:""]})]}):null,e.jsxs("div",{className:z.chartsGrid,children:[e.jsx(Le,{title:"Worst-scoring repos",empty:d.length===0,emptyMessage:"No enrolled repos scored yet.",table:e.jsx(Ie,{caption:"Worst-scoring repos",rowKey:u=>u.repo,rows:s.worstRepos,columns:[{key:"repo",label:"Repo",render:u=>u.repo},{key:"score",label:"Score",numeric:!0,render:u=>u.score.toFixed(0)},{key:"grade",label:"Grade",render:u=>u.grade}]}),children:e.jsx(Pe,{data:d,orientation:"horizontal",ariaLabel:"Worst-scoring repos by health score",formatValue:u=>u.toFixed(0)})}),e.jsxs("div",{className:z.section,children:[e.jsx("h2",{className:z.sectionTitle,children:"In-flight goals"}),n.length===0?e.jsx("p",{className:z.notAvailable,children:"No goals currently in flight."}):e.jsx("ul",{className:z.list,children:n.map(u=>e.jsxs("li",{className:z.row,children:[e.jsxs("span",{className:z.rowTitle,children:[u.objective,e.jsxs("span",{className:z.rowMeta,children:[Math.round(u.fractionDone*100),"%"]})]}),e.jsx("div",{className:z.meterTrack,children:e.jsx("div",{className:z.meterFill,style:{width:`${Math.round(u.fractionDone*100)}%`}})}),e.jsx("span",{className:z.rowMeta,children:u.nextActionable?`Next: ${u.nextActionable}`:"Nothing actionable queued"})]},u.goalId))})]})]}),e.jsxs("div",{className:z.section,children:[e.jsx("h2",{className:z.sectionTitle,children:"Top backlog"}),a.length===0?e.jsx("p",{className:z.notAvailable,children:"Backlog is empty."}):e.jsx(Ie,{caption:"Top backlog items",rowKey:u=>u.title,rows:a,columns:i})]})]})}const mu="_view_1eb19_1",pu="_header_1eb19_8",fu="_title_1eb19_16",_u="_freshness_1eb19_22",xu="_count_1eb19_28",gu="_filters_1eb19_34",ju="_field_1eb19_45",vu="_fieldLabel_1eb19_51",bu="_input_1eb19_56",yu="_select_1eb19_57",wu="_clear_1eb19_74",Nu="_tableWrap_1eb19_87",ku="_table_1eb19_87",$u="_statusCol_1eb19_101",Su="_engineCol_1eb19_104",Cu="_providerCol_1eb19_107",Ru="_tokensCol_1eb19_110",Lu="_costCol_1eb19_113",Tu="_stepsCol_1eb19_116",Eu="_createdCol_1eb19_119",Au="_row_1eb19_143",Du="_sortHeader_1eb19_151",Mu="_goalLink_1eb19_168",Iu="_numeric_1eb19_180",Pu="_date_1eb19_186",qu="_empty_1eb19_192",Bu="_error_1eb19_199",$={view:mu,header:pu,title:fu,freshness:_u,count:xu,filters:gu,field:ju,fieldLabel:vu,input:bu,select:yu,clear:wu,tableWrap:Nu,table:ku,statusCol:$u,engineCol:Su,providerCol:Cu,tokensCol:Ru,costCol:Lu,stepsCol:Tu,createdCol:Eu,row:Au,sortHeader:Du,goalLink:Mu,numeric:Iu,date:Pu,empty:qu,error:Bu};function Ss(t){return t.usage.tokensIn+t.usage.tokensOut}function Ou(t,s){if(!s)return!0;const n=s.toLowerCase();return t.id.toLowerCase().includes(n)||t.goal.toLowerCase().includes(n)}function Fu(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Uu(){const t=c.useRef(null);Ne("/work/runs",t);const s=dt(),n=q(Ge),[a,r]=c.useState(0),l=c.useRef(new Map),[o,d]=c.useState(""),[i,u]=c.useState("all"),[h,m]=c.useState("all"),[f,j]=c.useState("all"),[b,_]=c.useState(""),[p,x]=c.useState("createdAt"),[v,w]=c.useState("desc"),L=c.useMemo(()=>n.data??[],[n.data]),{statuses:g,engines:H,providers:A}=c.useMemo(()=>{const y=new Set,P=new Set,G=new Set;for(const le of L)y.add(le.status),P.add(le.engine),G.add(le.provider);return{statuses:Array.from(y).sort(),engines:Array.from(P).sort(),providers:Array.from(G).sort()}},[L]),N=b?new Date(b).getTime():null,C=c.useMemo(()=>{let y=L.filter(P=>{if(i!=="all"&&P.status!==i||h!=="all"&&P.engine!==h||f!=="all"&&P.provider!==f)return!1;if(N!==null){const G=new Date(P.createdAt).getTime();if(Number.isNaN(G)||G<N)return!1}return!!Ou(P,o.trim())});return y=[...y].sort((P,G)=>{let le=0;switch(p){case"createdAt":le=P.createdAt.localeCompare(G.createdAt);break;case"updatedAt":le=P.updatedAt.localeCompare(G.updatedAt);break;case"tokens":le=Ss(P)-Ss(G);break;case"estCostUsd":le=P.usage.estCostUsd-G.usage.estCostUsd;break;case"steps":le=P.steps.length-G.steps.length;break;case"status":le=P.status.localeCompare(G.status);break}return v==="asc"?le:-le}),y},[L,i,h,f,N,o,p,v]);c.useEffect(()=>{r(y=>Math.min(y,Math.max(C.length-1,0)))},[C.length]);function oe(y){if(C.length!==0){if(y.key==="ArrowDown"){y.preventDefault();const P=Math.min(a+1,C.length-1);r(P),l.current.get(C[P].id)?.focus()}else if(y.key==="ArrowUp"){y.preventDefault();const P=Math.max(a-1,0);r(P),l.current.get(C[P].id)?.focus()}else if(y.key==="Enter"){const P=C[a];P&&s(`/work/runs/${P.id}`)}}}function ne(y){y===p?w(P=>P==="asc"?"desc":"asc"):(x(y),w("desc"))}function se(y){return y!==p?"":v==="asc"?" ↑":" ↓"}return e.jsxs("div",{ref:t,className:$.view,children:[e.jsxs("header",{className:$.header,children:[e.jsx("h1",{className:$.title,children:"Runs"}),e.jsxs("div",{className:$.freshness,"aria-live":"polite",children:[n.status==="refreshing"?e.jsx(ae,{}):null,e.jsxs("span",{className:$.count,children:[C.length," of ",L.length," runs (server caps at 200 most recent)"]})]})]}),e.jsxs("form",{className:$.filters,role:"search","aria-label":"Filter runs",onSubmit:y=>y.preventDefault(),children:[e.jsxs("label",{className:$.field,children:[e.jsx("span",{className:$.fieldLabel,children:"Search"}),e.jsx("input",{type:"text",className:$.input,placeholder:"goal or run id (e.g. repo/project name)",value:o,onChange:y=>d(y.target.value)})]}),e.jsxs("label",{className:$.field,children:[e.jsx("span",{className:$.fieldLabel,children:"Status"}),e.jsxs("select",{className:$.select,value:i,onChange:y=>u(y.target.value),children:[e.jsx("option",{value:"all",children:"All"}),g.map(y=>e.jsx("option",{value:y,children:y},y))]})]}),e.jsxs("label",{className:$.field,children:[e.jsx("span",{className:$.fieldLabel,children:"Engine"}),e.jsxs("select",{className:$.select,value:h,onChange:y=>m(y.target.value),children:[e.jsx("option",{value:"all",children:"All"}),H.map(y=>e.jsx("option",{value:y,children:y},y))]})]}),e.jsxs("label",{className:$.field,children:[e.jsx("span",{className:$.fieldLabel,children:"Provider"}),e.jsxs("select",{className:$.select,value:f,onChange:y=>j(y.target.value),children:[e.jsx("option",{value:"all",children:"All"}),A.map(y=>e.jsx("option",{value:y,children:y},y))]})]}),e.jsxs("label",{className:$.field,children:[e.jsx("span",{className:$.fieldLabel,children:"Since"}),e.jsx("input",{type:"date",className:$.input,value:b,onChange:y=>_(y.target.value)})]}),(i!=="all"||h!=="all"||f!=="all"||b||o)&&e.jsx("button",{type:"button",className:$.clear,onClick:()=>{d(""),u("all"),m("all"),j("all"),_("")},children:"Clear filters"})]}),n.status==="loading"?e.jsxs("div",{className:$.tableWrap,children:[e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{})]}):n.status==="error"?e.jsx("div",{className:$.error,role:"alert",children:n.error?.message??"Failed to load runs."}):C.length===0?e.jsx("p",{className:$.empty,children:"No runs match the current filters."}):e.jsx("div",{className:$.tableWrap,children:e.jsxs("table",{className:$.table,onKeyDown:oe,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Goal"}),e.jsx("th",{scope:"col",className:$.statusCol,children:e.jsxs("button",{type:"button",className:$.sortHeader,onClick:()=>ne("status"),children:["Status",se("status")]})}),e.jsx("th",{scope:"col",className:$.engineCol,children:"Engine"}),e.jsx("th",{scope:"col",className:$.providerCol,children:"Provider"}),e.jsx("th",{scope:"col",className:$.tokensCol,children:e.jsxs("button",{type:"button",className:$.sortHeader,onClick:()=>ne("tokens"),children:["Tokens in/out",se("tokens")]})}),e.jsx("th",{scope:"col",className:$.costCol,children:e.jsxs("button",{type:"button",className:$.sortHeader,onClick:()=>ne("estCostUsd"),children:["Est cost",se("estCostUsd")]})}),e.jsx("th",{scope:"col",className:$.stepsCol,children:e.jsxs("button",{type:"button",className:$.sortHeader,onClick:()=>ne("steps"),children:["Steps",se("steps")]})}),e.jsx("th",{scope:"col",className:$.createdCol,children:e.jsxs("button",{type:"button",className:$.sortHeader,onClick:()=>ne("createdAt"),children:["Created",se("createdAt")]})})]})}),e.jsx("tbody",{children:C.map((y,P)=>e.jsxs("tr",{ref:G=>{G?l.current.set(y.id,G):l.current.delete(y.id)},tabIndex:P===a?0:-1,onFocus:()=>r(P),"aria-current":P===a?"true":void 0,className:$.row,children:[e.jsx("td",{children:e.jsx(ht,{to:`/work/runs/${y.id}`,"data-focus-key":`run-${y.id}`,className:$.goalLink,title:y.goal,tabIndex:-1,children:y.goal})}),e.jsx("td",{children:e.jsx(U,{status:y.status})}),e.jsx("td",{children:y.engine}),e.jsx("td",{children:y.provider}),e.jsxs("td",{className:$.numeric,children:[y.usage.tokensIn.toLocaleString()," / ",y.usage.tokensOut.toLocaleString()]}),e.jsxs("td",{className:$.numeric,children:["$",y.usage.estCostUsd.toFixed(4)]}),e.jsx("td",{className:$.numeric,children:y.steps.length}),e.jsx("td",{className:$.date,children:Fu(y.createdAt)})]},y.id))})]})})]})}const Hu="_view_16nop_1",Gu="_header_16nop_8",Wu="_eyebrow_16nop_16",Qu="_title_16nop_22",Vu="_freshness_16nop_29",zu="_metaGrid_16nop_35",Ku="_numeric_16nop_55",Ju="_section_16nop_59",Yu="_sectionTitle_16nop_65",Xu="_resultText_16nop_70",Zu="_taskList_16nop_79",eh="_taskItem_16nop_85",th="_taskHeader_16nop_98",sh="_taskId_16nop_105",nh="_taskGoal_16nop_111",ah="_taskDeps_16nop_116",rh="_depLink_16nop_122",lh="_depMissing_16nop_127",oh="_taskError_16nop_132",ih="_taskUsage_16nop_141",ch="_stepList_16nop_148",dh="_stepItem_16nop_155",uh="_stepTs_16nop_164",hh="_stepKind_16nop_170",mh="_stepTask_16nop_176",ph="_stepSummary_16nop_180",fh="_empty_16nop_185",_h="_error_16nop_190",R={view:Hu,header:Gu,eyebrow:Wu,title:Qu,freshness:Vu,metaGrid:zu,numeric:Ku,section:Ju,sectionTitle:Yu,resultText:Xu,taskList:Zu,taskItem:eh,taskHeader:th,taskId:sh,taskGoal:nh,taskDeps:ah,depLink:rh,depMissing:lh,taskError:oh,taskUsage:ih,stepList:ch,stepItem:dh,stepTs:uh,stepKind:hh,stepTask:mh,stepSummary:ph,empty:fh,error:_h};function Ht(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString()}function Gt(t){return`task-${encodeURIComponent(t)}`}function xh(){const{id:t}=as(),s=c.useRef(null);Ne(`/work/runs/${t??""}`,s);const n=q(Gs(t??""));if(!t)return e.jsx("div",{className:R.view,children:e.jsx("p",{className:R.error,role:"alert",children:"No run id in URL."})});if(n.status==="loading")return e.jsxs("div",{ref:s,className:R.view,children:[e.jsx(K,{width:"60%"}),e.jsx(K,{width:"30%"}),e.jsx(K,{width:"80%"})]});if(n.status==="error"||!n.data)return e.jsx("div",{ref:s,className:R.view,children:e.jsx("p",{className:R.error,role:"alert",children:n.error?.message??`Run ${t} not found.`})});const a=n.data,r=new Map(a.tasks.map(l=>[l.id,l]));return e.jsxs("div",{ref:s,className:R.view,children:[e.jsxs("header",{className:R.header,children:[e.jsxs("div",{children:[e.jsxs("p",{className:R.eyebrow,children:["Run ",a.id]}),e.jsx("h1",{className:R.title,children:a.goal})]}),e.jsxs("div",{className:R.freshness,"aria-live":"polite",children:[n.status==="refreshing"?e.jsx(ae,{}):null,e.jsx(U,{status:a.status})]})]}),e.jsxs("dl",{className:R.metaGrid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Engine"}),e.jsx("dd",{children:a.engine})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Provider"}),e.jsx("dd",{children:a.provider})]}),a.engineModel?e.jsxs("div",{children:[e.jsx("dt",{children:"Model"}),e.jsx("dd",{children:a.engineModel})]}):null,e.jsxs("div",{children:[e.jsx("dt",{children:"Tokens in / out"}),e.jsxs("dd",{className:R.numeric,children:[a.usage.tokensIn.toLocaleString()," / ",a.usage.tokensOut.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Est cost"}),e.jsxs("dd",{className:R.numeric,children:["$",a.usage.estCostUsd.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Steps"}),e.jsx("dd",{className:R.numeric,children:a.usage.steps})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Budget (tokens / steps)"}),e.jsxs("dd",{className:R.numeric,children:[a.budget.maxTokens.toLocaleString()," / ",a.budget.maxSteps]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Created"}),e.jsx("dd",{children:Ht(a.createdAt)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Updated"}),e.jsx("dd",{children:Ht(a.updatedAt)})]}),a.terminationReason?e.jsxs("div",{children:[e.jsx("dt",{children:"Termination reason"}),e.jsx("dd",{children:a.terminationReason})]}):null]}),a.result?e.jsxs("section",{className:R.section,children:[e.jsx("h2",{className:R.sectionTitle,children:"Result"}),e.jsx("p",{className:R.resultText,children:a.result})]}):null,e.jsxs("section",{className:R.section,children:[e.jsxs("h2",{className:R.sectionTitle,children:["Tasks (",a.tasks.length,")"]}),a.tasks.length===0?e.jsx("p",{className:R.empty,children:"No tasks recorded."}):e.jsx("ul",{className:R.taskList,children:a.tasks.map(l=>e.jsxs("li",{id:Gt(l.id),className:R.taskItem,tabIndex:-1,children:[e.jsxs("div",{className:R.taskHeader,children:[e.jsx("span",{className:R.taskId,children:l.id}),e.jsx(U,{status:l.status})]}),e.jsx("p",{className:R.taskGoal,children:l.goal}),l.deps.length>0?e.jsxs("p",{className:R.taskDeps,children:["depends on:"," ",l.deps.map((o,d)=>e.jsxs("span",{children:[d>0?", ":"",r.has(o)?e.jsx("a",{href:`#${Gt(o)}`,className:R.depLink,children:o}):e.jsxs("span",{className:R.depMissing,children:[o," (unresolved)"]})]},o))]}):null,l.error?e.jsx("p",{className:R.taskError,role:"alert",children:l.error}):null,l.usage?e.jsxs("p",{className:R.taskUsage,children:[l.usage.tokensIn.toLocaleString()," / ",l.usage.tokensOut.toLocaleString()," tokens · $",l.usage.estCostUsd.toFixed(4)]}):null]},l.id))})]}),e.jsxs("section",{className:R.section,children:[e.jsxs("h2",{className:R.sectionTitle,children:["Step log (",a.steps.length,")"]}),a.steps.length===0?e.jsx("p",{className:R.empty,children:"No steps recorded."}):e.jsx("ol",{className:R.stepList,children:a.steps.map((l,o)=>e.jsxs("li",{className:R.stepItem,children:[e.jsx("span",{className:R.stepTs,children:Ht(l.ts)}),e.jsx("span",{className:R.stepKind,children:l.kind}),e.jsx("span",{className:R.stepTask,children:l.taskId?e.jsx("a",{href:`#${Gt(l.taskId)}`,className:R.depLink,children:l.taskId}):null}),e.jsx("span",{className:R.stepSummary,children:l.summary})]},`${l.ts}-${o}`))})]})]})}const gh="_view_1kj6a_1",jh="_header_1kj6a_8",vh="_title_1kj6a_16",bh="_freshness_1kj6a_22",yh="_count_1kj6a_28",wh="_filters_1kj6a_34",Nh="_field_1kj6a_45",kh="_fieldLabel_1kj6a_51",$h="_input_1kj6a_56",Sh="_select_1kj6a_57",Ch="_listWrap_1kj6a_73",Rh="_listHeader_1kj6a_80",Lh="_sortHeader_1kj6a_90",Th="_list_1kj6a_73",Eh="_item_1kj6a_112",Ah="_goalLink_1kj6a_124",Dh="_goalText_1kj6a_140",Mh="_burndown_1kj6a_150",Ih="_burndownTrack_1kj6a_156",Ph="_burndownFill_1kj6a_164",qh="_burndownLabel_1kj6a_170",Bh="_numeric_1kj6a_177",Oh="_date_1kj6a_184",Fh="_empty_1kj6a_191",Uh="_error_1kj6a_198",B={view:gh,header:jh,title:vh,freshness:bh,count:yh,filters:wh,field:Nh,fieldLabel:kh,input:$h,select:Sh,listWrap:Ch,listHeader:Rh,sortHeader:Lh,list:Th,item:Eh,goalLink:Ah,goalText:Dh,burndown:Mh,burndownTrack:Ih,burndownFill:Ph,burndownLabel:qh,numeric:Bh,date:Oh,empty:Fh,error:Uh};function Wt(t){return t.tasks.filter(s=>s.status==="done").length}function Xe(t){return Math.max(t.plan?.tasks.length??0,t.tasks.length)}function vt(t){return t.usage??{tokensIn:0,tokensOut:0,estCostUsd:0}}function Cs(t){const s=vt(t);return s.tokensIn+s.tokensOut}function Hh(t){const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Gh(){const t=c.useRef(null);Ne("/work/swarms",t);const s=q(Hn),n=c.useMemo(()=>s.data??[],[s.data]),[a,r]=c.useState(""),[l,o]=c.useState("all"),[d,i]=c.useState("createdAt"),[u,h]=c.useState("desc"),m=c.useMemo(()=>Array.from(new Set(n.map(_=>_.status))).sort(),[n]),f=c.useMemo(()=>{let _=n.filter(p=>{if(l!=="all"&&p.status!==l)return!1;if(!a.trim())return!0;const x=a.trim().toLowerCase();return p.id.toLowerCase().includes(x)||p.goal.toLowerCase().includes(x)});return _=[..._].sort((p,x)=>{let v=0;switch(d){case"createdAt":v=p.createdAt.localeCompare(x.createdAt);break;case"updatedAt":v=p.updatedAt.localeCompare(x.updatedAt);break;case"progress":{const w=Xe(p)>0?Wt(p)/Xe(p):0,L=Xe(x)>0?Wt(x)/Xe(x):0;v=w-L;break}case"tokens":v=Cs(p)-Cs(x);break;case"estCostUsd":v=vt(p).estCostUsd-vt(x).estCostUsd;break}return u==="asc"?v:-v}),_},[n,l,a,d,u]);function j(_){_===d?h(p=>p==="asc"?"desc":"asc"):(i(_),h("desc"))}function b(_){return _!==d?"":u==="asc"?" ↑":" ↓"}return e.jsxs("div",{ref:t,className:B.view,children:[e.jsxs("header",{className:B.header,children:[e.jsx("h1",{className:B.title,children:"Swarms"}),e.jsxs("div",{className:B.freshness,"aria-live":"polite",children:[s.status==="refreshing"?e.jsx(ae,{}):null,e.jsxs("span",{className:B.count,children:[f.length," of ",n.length," swarms"]})]})]}),e.jsxs("form",{className:B.filters,role:"search","aria-label":"Filter swarms",onSubmit:_=>_.preventDefault(),children:[e.jsxs("label",{className:B.field,children:[e.jsx("span",{className:B.fieldLabel,children:"Search"}),e.jsx("input",{type:"text",className:B.input,placeholder:"goal or swarm id",value:a,onChange:_=>r(_.target.value)})]}),e.jsxs("label",{className:B.field,children:[e.jsx("span",{className:B.fieldLabel,children:"Status"}),e.jsxs("select",{className:B.select,value:l,onChange:_=>o(_.target.value),children:[e.jsx("option",{value:"all",children:"All"}),m.map(_=>e.jsx("option",{value:_,children:_},_))]})]})]}),s.status==="loading"?e.jsxs("div",{className:B.listWrap,children:[e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{})]}):s.status==="error"?e.jsx("div",{className:B.error,role:"alert",children:s.error?.message??"Failed to load swarms."}):f.length===0?e.jsx("p",{className:B.empty,children:"No swarms match the current filters."}):e.jsxs("div",{className:B.listWrap,children:[e.jsxs("div",{className:B.listHeader,children:[e.jsx("span",{children:"Goal"}),e.jsxs("button",{type:"button",className:B.sortHeader,onClick:()=>j("progress"),children:["Progress",b("progress")]}),e.jsxs("button",{type:"button",className:B.sortHeader,onClick:()=>j("tokens"),children:["Tokens",b("tokens")]}),e.jsxs("button",{type:"button",className:B.sortHeader,onClick:()=>j("estCostUsd"),children:["Cost",b("estCostUsd")]}),e.jsxs("button",{type:"button",className:B.sortHeader,onClick:()=>j("createdAt"),children:["Created",b("createdAt")]})]}),e.jsx("ul",{className:B.list,children:f.map(_=>{const p=Wt(_),x=Xe(_),v=x>0?Math.round(p/x*100):0,w=vt(_);return e.jsxs("li",{className:B.item,children:[e.jsxs(ht,{to:`/work/swarms/${_.id}`,"data-focus-key":`swarm-${_.id}`,className:B.goalLink,title:_.goal,children:[e.jsx("span",{className:B.goalText,children:_.goal}),e.jsx(U,{status:_.status})]}),e.jsxs("div",{className:B.burndown,children:[e.jsx("div",{className:B.burndownTrack,children:e.jsx("div",{className:B.burndownFill,style:{width:`${v}%`}})}),e.jsxs("span",{className:B.burndownLabel,children:[p,"/",x]})]}),e.jsxs("span",{className:B.numeric,children:[w.tokensIn.toLocaleString(),"/",w.tokensOut.toLocaleString()]}),e.jsxs("span",{className:B.numeric,children:["$",w.estCostUsd.toFixed(4)]}),e.jsx("span",{className:B.date,children:Hh(_.createdAt)})]},_.id)})})]})]})}const Wh="_svg_2w2xr_1",Qh="_phaseLabel_2w2xr_7",Vh="_edge_2w2xr_14",zh="_arrowHead_2w2xr_19",Kh="_nodeLink_2w2xr_23",Jh="_nodeRect_2w2xr_26",Yh="_nodeId_2w2xr_31",Xh="_nodeGoal_2w2xr_37",Zh="_neutral_2w2xr_45",em="_statusDot_2w2xr_49",tm="_info_2w2xr_53",sm="_running_2w2xr_61",nm="_success_2w2xr_69",am="_warning_2w2xr_77",rm="_danger_2w2xr_85",lm="_unknown_2w2xr_93",om="_empty_2w2xr_105",he={svg:Wh,phaseLabel:Qh,edge:Vh,arrowHead:zh,nodeLink:Kh,nodeRect:Jh,nodeId:Yh,nodeGoal:Xh,neutral:Zh,statusDot:em,info:tm,running:sm,success:nm,warning:am,danger:rm,unknown:lm,empty:om},Rs={scaffold:0,build:1,integrate:2,verify:3,review:4};function im(t,s){const n=new Map;for(const a of t?.tasks??[])n.set(a.id,{id:a.id,phase:a.phase,goal:a.goal,deps:a.deps,status:"pending"});for(const a of s){const r=n.get(a.id);n.set(a.id,{id:a.id,phase:a.phase||r?.phase||"build",goal:r?.goal??"",deps:r?.deps??[],status:a.status})}return Array.from(n.values())}function Ls(t,s){return t.length>s?`${t.slice(0,s-1)}…`:t}const Ze=140,et=48,cm=60,dm=20,tt=20;function um({tasks:t,taskAnchorPrefix:s="dag-task"}){if(t.length===0)return e.jsx("p",{className:he.empty,children:"No tasks in this swarm."});const n=new Map;for(const h of t){const m=h.phase||"build",f=n.get(m)??[];f.push(h),n.set(m,f)}const a=Array.from(n.keys()).sort((h,m)=>(Rs[h]??99)-(Rs[m]??99)),r=new Map;let l=tt;for(const h of a)r.set(h,l),l+=Ze+cm;const o=l+tt,d=new Map;for(const h of a){let m=tt;for(const f of n.get(h)){const j=r.get(h);d.set(f.id,{x:j,y:m,cx:j+Ze/2,cy:m+et/2}),m+=et+dm}}const i=Math.max(...Array.from(d.values()).map(h=>h.y+et))+tt*2,u=[];for(const h of t){const m=d.get(h.id);if(m)for(const f of h.deps){const j=d.get(f);if(!j)continue;const b=j.x+Ze,_=j.cy,p=m.x,x=m.cy,v=(b+p)/2;u.push({key:`${f}->${h.id}`,d:`M ${b} ${_} C ${v} ${_}, ${v} ${x}, ${p} ${x}`})}}return e.jsxs("svg",{width:o,height:i,viewBox:`0 0 ${o} ${i}`,className:he.svg,role:"img","aria-label":"Swarm task dependency graph",children:[e.jsx("defs",{children:e.jsx("marker",{id:"dag-arrow",markerWidth:"8",markerHeight:"8",refX:"6",refY:"3",orient:"auto",children:e.jsx("path",{d:"M0,0 L0,6 L8,3 z",className:he.arrowHead})})}),a.map(h=>e.jsx("text",{x:r.get(h)+Ze/2,y:tt-6,textAnchor:"middle",className:he.phaseLabel,children:h},h)),u.map(h=>e.jsx("path",{d:h.d,className:he.edge,fill:"none",markerEnd:"url(#dag-arrow)"},h.key)),t.map(h=>{const m=d.get(h.id);if(!m)return null;const f=Pn(h.status);return e.jsx("g",{transform:`translate(${m.x},${m.y})`,children:e.jsxs("a",{href:`#${s}-${encodeURIComponent(h.id)}`,className:he.nodeLink,children:[e.jsx("title",{children:`${h.id} — ${h.goal} (${h.status})`}),e.jsx("rect",{width:Ze,height:et,rx:6,ry:6,className:`${he.nodeRect} ${he[f]}`}),e.jsx("circle",{cx:10,cy:et/2,r:4,className:`${he.statusDot} ${he[f]}`}),e.jsx("text",{x:20,y:17,className:he.nodeId,children:Ls(h.id,18)}),e.jsx("text",{x:20,y:33,className:he.nodeGoal,children:Ls(h.goal,20)})]})},h.id)})]})}const hm="_view_19up6_1",mm="_header_19up6_8",pm="_eyebrow_19up6_16",fm="_title_19up6_22",_m="_freshness_19up6_29",xm="_burndownRow_19up6_35",gm="_burndownTrack_19up6_41",jm="_burndownFill_19up6_49",vm="_burndownLabel_19up6_55",bm="_metaGrid_19up6_62",ym="_numeric_19up6_80",wm="_mono_19up6_84",Nm="_section_19up6_90",km="_sectionTitle_19up6_96",$m="_resultText_19up6_101",Sm="_escalationList_19up6_110",Cm="_escalationItem_19up6_115",Rm="_escalationJson_19up6_120",Lm="_dagWrap_19up6_130",Tm="_taskList_19up6_138",Em="_taskItem_19up6_144",Am="_taskHeader_19up6_157",Dm="_taskId_19up6_163",Mm="_taskPhase_19up6_169",Im="_taskGoal_19up6_176",Pm="_taskDeps_19up6_181",qm="_error_19up6_188",T={view:hm,header:mm,eyebrow:pm,title:fm,freshness:_m,burndownRow:xm,burndownTrack:gm,burndownFill:jm,burndownLabel:vm,metaGrid:bm,numeric:ym,mono:wm,section:Nm,sectionTitle:km,resultText:$m,escalationList:Sm,escalationItem:Cm,escalationJson:Rm,dagWrap:Lm,taskList:Tm,taskItem:Em,taskHeader:Am,taskId:Dm,taskPhase:Mm,taskGoal:Im,taskDeps:Pm,error:qm},Ts="dag-task";function Es(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString()}function Bm(){const{id:t}=as(),s=c.useRef(null);Ne(`/work/swarms/${t??""}`,s);const n=q(Gn(t??""));if(!t)return e.jsx("div",{className:T.view,children:e.jsx("p",{className:T.error,role:"alert",children:"No swarm id in URL."})});if(n.status==="loading")return e.jsxs("div",{ref:s,className:T.view,children:[e.jsx(K,{width:"60%"}),e.jsx(K,{width:"30%"}),e.jsx(K,{width:"80%"})]});if(n.status==="error"||!n.data)return e.jsx("div",{ref:s,className:T.view,children:e.jsx("p",{className:T.error,role:"alert",children:n.error?.message??`Swarm ${t} not found.`})});const a=n.data,r=a.tasks.filter(u=>u.status==="done").length,l=Math.max(a.plan?.tasks.length??0,a.tasks.length),o=l>0?Math.round(r/l*100):0,d=im(a.plan,a.tasks),i=a.usage??{tokensIn:0,tokensOut:0,estCostUsd:0};return e.jsxs("div",{ref:s,className:T.view,children:[e.jsxs("header",{className:T.header,children:[e.jsxs("div",{children:[e.jsxs("p",{className:T.eyebrow,children:["Swarm ",a.id]}),e.jsx("h1",{className:T.title,children:a.goal})]}),e.jsxs("div",{className:T.freshness,"aria-live":"polite",children:[n.status==="refreshing"?e.jsx(ae,{}):null,e.jsx(U,{status:a.status})]})]}),e.jsxs("div",{className:T.burndownRow,children:[e.jsx("div",{className:T.burndownTrack,children:e.jsx("div",{className:T.burndownFill,style:{width:`${o}%`}})}),e.jsxs("span",{className:T.burndownLabel,children:[r,"/",l," tasks done (",o,"%)"]})]}),e.jsxs("dl",{className:T.metaGrid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Tokens in / out"}),e.jsxs("dd",{className:T.numeric,children:[i.tokensIn.toLocaleString()," / ",i.tokensOut.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Est cost"}),e.jsxs("dd",{className:T.numeric,children:["$",i.estCostUsd.toFixed(4)]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Parallelism"}),e.jsx("dd",{className:T.numeric,children:a.parallel})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Created"}),e.jsx("dd",{children:Es(a.createdAt)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Updated"}),e.jsx("dd",{children:Es(a.updatedAt)})]}),a.project?e.jsxs("div",{children:[e.jsx("dt",{children:"Project"}),e.jsx("dd",{className:T.mono,children:a.project})]}):null]}),a.escalations&&a.escalations.length>0?e.jsxs("section",{className:T.section,children:[e.jsxs("h2",{className:T.sectionTitle,children:["Escalations (",a.escalations.length,")"]}),e.jsx("ul",{className:T.escalationList,children:a.escalations.map((u,h)=>e.jsx("li",{className:T.escalationItem,children:e.jsx("pre",{className:T.escalationJson,children:JSON.stringify(u,null,2)})},h))})]}):null,a.result?e.jsxs("section",{className:T.section,children:[e.jsx("h2",{className:T.sectionTitle,children:"Result"}),e.jsx("p",{className:T.resultText,children:a.result})]}):null,e.jsxs("section",{className:T.section,children:[e.jsx("h2",{className:T.sectionTitle,children:"Task graph"}),e.jsx("div",{className:T.dagWrap,children:e.jsx(um,{tasks:d,taskAnchorPrefix:Ts})})]}),e.jsxs("section",{className:T.section,children:[e.jsxs("h2",{className:T.sectionTitle,children:["Tasks (",d.length,")"]}),e.jsx("ul",{className:T.taskList,children:d.map(u=>e.jsxs("li",{id:`${Ts}-${u.id}`,"data-focus-key":`swarm-task-${u.id}`,className:T.taskItem,tabIndex:-1,children:[e.jsxs("div",{className:T.taskHeader,children:[e.jsx("span",{className:T.taskId,children:u.id}),e.jsx("span",{className:T.taskPhase,children:u.phase}),e.jsx(U,{status:u.status})]}),e.jsx("p",{className:T.taskGoal,children:u.goal}),u.deps.length>0?e.jsxs("p",{className:T.taskDeps,children:["depends on: ",u.deps.join(", ")]}):null]},u.id))})]})]})}const Om="_view_1bwoy_1",Fm="_header_1bwoy_8",Um="_title_1bwoy_16",Hm="_freshness_1bwoy_22",Gm="_callout_1bwoy_28",Wm="_calloutTitle_1bwoy_39",Qm="_calloutBody_1bwoy_44",Vm="_calloutCommand_1bwoy_48",zm="_metaGrid_1bwoy_59",Km="_section_1bwoy_77",Jm="_sectionTitle_1bwoy_83",Ym="_serviceError_1bwoy_88",Xm="_tickTableWrap_1bwoy_96",Zm="_tickTable_1bwoy_96",ep="_date_1bwoy_124",tp="_numeric_1bwoy_130",sp="_dryRun_1bwoy_135",np="_empty_1bwoy_140",ap="_error_1bwoy_145",W={view:Om,header:Fm,title:Um,freshness:Hm,callout:Gm,calloutTitle:Wm,calloutBody:Qm,calloutCommand:Vm,metaGrid:zm,section:Km,sectionTitle:Jm,serviceError:Ym,tickTableWrap:Xm,tickTable:Zm,date:ep,numeric:tp,dryRun:sp,empty:np,error:ap},rp={missing:"No daemon state file has been written yet — the daemon may never have run on this machine.",malformed:"The daemon state file exists but failed to parse.",unreadable:'The daemon state file could not be read. This is also the exact signal produced when a state-recovery marker is present (a prior repair left a quarantine in progress) — the API does not distinguish the two cases, so treat this as "inspect before trusting displayed daemon state."',inconsistent:"The daemon state file and the live lock/activity check disagree — the daemon may be mid-restart.",unavailable:"The daemon state read path itself failed (I/O error or similar)."};function As(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString()}function lp({quality:t}){const s=t.reason,n=rp[s]??"Daemon state could not be verified.";return e.jsxs("section",{className:W.callout,role:"alert",children:[e.jsxs("p",{className:W.calloutTitle,children:["Daemon state is unknown (",s,")"]}),e.jsx("p",{className:W.calloutBody,children:n}),e.jsx("p",{className:W.calloutBody,children:"Real remedy — preview or execute a state recovery from a terminal on this machine:"}),e.jsx("pre",{className:W.calloutCommand,children:`ashlr daemon recover-state --dry-run --expected-sha256 <sha256> [--json]
14
- ashlr daemon recover-state --execute --plan-id <uuid> --plan-sha256 <sha256> --authorize <plan-sha256> [--json]`}),e.jsx("p",{className:W.calloutBody,children:"If a quarantine already exists and needs resolving instead:"}),e.jsx("pre",{className:W.calloutCommand,children:`ashlr daemon resolve-state --dry-run --quarantine-plan-id <uuid> --quarantine-receipt-sha256 <sha256> [--json]
15
- ashlr daemon resolve-state --execute --plan-id <uuid> --plan-sha256 <sha256> --authorize <plan-sha256> --confirm <plan-sha256> [--json]`})]})}function op(){const t=c.useRef(null);Ne("/control/daemon",t);const s=q(kt),n=q(Wn),a=s.data?.daemon,r=n.data;return e.jsxs("div",{ref:t,className:W.view,children:[e.jsxs("header",{className:W.header,children:[e.jsx("h1",{className:W.title,children:"Daemon"}),e.jsxs("div",{className:W.freshness,"aria-live":"polite",children:[s.status==="refreshing"||n.status==="refreshing"?e.jsx(ae,{}):null,a?e.jsx(O,{quality:a.sourceQuality,label:"daemon state",children:e.jsx(U,{status:a.running?"running":"pending",children:a.running?"running":"stopped"})}):null]})]}),s.status==="loading"?e.jsx(K,{width:"60%"}):s.status==="error"||!a?e.jsx("p",{className:W.error,role:"alert",children:s.error?.message??"Failed to load control snapshot."}):e.jsxs(e.Fragment,{children:[_t(a.sourceQuality)?null:e.jsx(lp,{quality:a.sourceQuality}),e.jsxs("dl",{className:W.metaGrid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Runtime state"}),e.jsx("dd",{children:e.jsx(O,{quality:a.sourceQuality,label:"runtime state",children:a.runtimeState})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"PID"}),e.jsx("dd",{children:e.jsx(O,{quality:a.sourceQuality,label:"pid",children:a.pid??"—"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Last tick"}),e.jsx("dd",{children:e.jsx(O,{quality:a.sourceQuality,label:"last tick",children:As(a.lastTickAt)})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Today's spend"}),e.jsx("dd",{children:e.jsxs(O,{quality:a.sourceQuality,label:"spend",children:["$",a.todaySpentUsd.toFixed(2)]})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Direction mode"}),e.jsx("dd",{children:e.jsx(O,{quality:a.sourceQuality,label:"direction mode",children:a.activeDirectionMode??"none"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Direction reason"}),e.jsx("dd",{children:e.jsx(O,{quality:a.sourceQuality,label:"direction reason",children:a.activeDirectionReason??"—"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Autonomy control loop"}),e.jsx("dd",{children:e.jsx(O,{quality:a.sourceQuality,label:"autonomy control loop",children:a.autonomyControlLoop?"enabled":"disabled"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Autonomy control mode"}),e.jsx("dd",{children:e.jsx(O,{quality:a.sourceQuality,label:"autonomy control mode",children:a.autonomyControlMode})})]})]}),e.jsxs("section",{className:W.section,children:[e.jsx("h2",{className:W.sectionTitle,children:"OS service"}),e.jsxs("dl",{className:W.metaGrid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Registration state"}),e.jsx("dd",{children:a.service.registrationState})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Installed"}),e.jsx("dd",{children:a.service.installed?"yes":"no"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Running"}),e.jsx("dd",{children:a.service.running?"yes":"no"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Runtime state"}),e.jsx("dd",{children:a.service.runtimeState??"unknown"})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Platform"}),e.jsx("dd",{children:a.service.platformSpec})]})]}),a.service.errorLog?e.jsx("p",{className:W.serviceError,role:"alert",children:a.service.errorLog}):null]})]}),e.jsxs("section",{className:W.section,children:[e.jsx("h2",{className:W.sectionTitle,children:"Recent ticks"}),n.status==="loading"?e.jsx(K,{width:"80%"}):!r||!r.ticks||r.ticks.length===0?e.jsx("p",{className:W.empty,children:"No tick history available."}):e.jsx("div",{className:W.tickTableWrap,children:e.jsxs("table",{className:W.tickTable,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Time"}),e.jsx("th",{scope:"col",children:"Reason"}),e.jsx("th",{scope:"col",children:"Items"}),e.jsx("th",{scope:"col",children:"Proposals"}),e.jsx("th",{scope:"col",children:"Spend"})]})}),e.jsx("tbody",{children:[...r.ticks].reverse().slice(0,20).map((l,o)=>e.jsxs("tr",{children:[e.jsx("td",{className:W.date,children:As(l.ts)}),e.jsxs("td",{children:[l.reason,l.dryRun?e.jsx("span",{className:W.dryRun,children:" (dry-run)"}):null]}),e.jsx("td",{className:W.numeric,children:l.itemsConsidered}),e.jsx("td",{className:W.numeric,children:l.proposalsCreated}),e.jsxs("td",{className:W.numeric,children:["$",l.spentUsd.toFixed(4)]})]},`${l.ts}-${o}`))})]})})]})]})}const ip="_view_ssrhq_1",cp="_header_ssrhq_8",dp="_title_ssrhq_14",up="_freshness_ssrhq_20",hp="_section_ssrhq_26",mp="_sectionTitle_ssrhq_32",pp="_killSwitchRow_ssrhq_37",fp="_pauseButton_ssrhq_47",_p="_resumeButton_ssrhq_65",xp="_mutationError_ssrhq_83",gp="_metaGrid_ssrhq_91",jp="_numeric_ssrhq_109",vp="_lockWarning_ssrhq_113",bp="_tableWrap_ssrhq_117",yp="_table_ssrhq_117",wp="_mono_ssrhq_144",Np="_empty_ssrhq_149",kp="_error_ssrhq_154",$p="_confirmBody_ssrhq_162",Sp="_confirmActions_ssrhq_168",Cp="_cancelButton_ssrhq_174",Rp="_confirmButton_ssrhq_186",S={view:ip,header:cp,title:dp,freshness:up,section:hp,sectionTitle:mp,killSwitchRow:pp,pauseButton:fp,resumeButton:_p,mutationError:xp,metaGrid:gp,numeric:jp,lockWarning:vp,tableWrap:bp,table:yp,mono:wp,empty:Np,error:kp,confirmBody:$p,confirmActions:Sp,cancelButton:Cp,confirmButton:Rp};function Ds(t){if(!t)return"—";const s=new Date(t);return Number.isNaN(s.getTime())?t:s.toLocaleString()}function Lp(){const t=c.useRef(null);Ne("/control/fleet",t);const s=q(Us),n=q(Qs),a=Bs(),[r,l]=c.useState(null),[o,d]=c.useState(!1),[i,u]=c.useState(!1),[h,m]=c.useState(!1),[f,j]=c.useState(null);async function b(g){m(!0),j(null);try{g==="pause"?await Vs():await zs()}catch(H){j(H instanceof Error?H.message:String(H))}finally{m(!1),l(null)}}function _(g){j(null),l(g),d(!0)}function p(){d(!1),a.hasHold?r&&b(r):u(!0)}c.useEffect(()=>{i||r&&(a.hasHold?b(r):l(null))},[i]);const x=s.data,v=x?.killSwitch,w=v?{sourceState:v.sourceState,complete:v.sourceState==="healthy",reason:v.reason}:void 0,L=x?.killed===!0;return e.jsxs("div",{ref:t,className:S.view,children:[e.jsxs("header",{className:S.header,children:[e.jsx("h1",{className:S.title,children:"Fleet"}),e.jsx("div",{className:S.freshness,"aria-live":"polite",children:s.status==="refreshing"||n.status==="refreshing"?e.jsx(ae,{}):null})]}),s.status==="loading"?e.jsx(K,{width:"60%"}):s.status==="error"||!x?e.jsx("p",{className:S.error,role:"alert",children:s.error?.message??"Failed to load fleet status."}):e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:S.section,children:[e.jsx("h2",{className:S.sectionTitle,children:"Kill switch"}),e.jsx("div",{className:S.killSwitchRow,children:e.jsx(O,{quality:w,label:"kill switch",renderControl:()=>e.jsx("button",{type:"button",className:L?S.resumeButton:S.pauseButton,onClick:()=>_(L?"resume":"pause"),disabled:h,children:h?"Working…":L?"Resume fleet":"Pause fleet"}),children:e.jsx(U,{status:L?"paused":"running",children:L?"engaged — fleet paused":"clear — fleet active"})})}),f?e.jsx("p",{className:S.mutationError,role:"alert",children:f}):null]}),e.jsxs("section",{className:S.section,children:[e.jsx("h2",{className:S.sectionTitle,children:"Queue depth"}),e.jsxs("dl",{className:S.metaGrid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Backlog items"}),e.jsx("dd",{className:S.numeric,children:x.queue.backlogItems})]}),x.queue.eligibleBacklogItems!==void 0?e.jsxs("div",{children:[e.jsx("dt",{children:"Eligible"}),e.jsx("dd",{className:S.numeric,children:x.queue.eligibleBacklogItems})]}):null,x.queue.cooldownItems!==void 0?e.jsxs("div",{children:[e.jsx("dt",{children:"Cooldown"}),e.jsx("dd",{className:S.numeric,children:x.queue.cooldownItems})]}):null,x.queue.pendingItems!==void 0?e.jsxs("div",{children:[e.jsx("dt",{children:"Pending"}),e.jsx("dd",{className:S.numeric,children:x.queue.pendingItems})]}):null,x.queue.nextEligibleAt!==void 0?e.jsxs("div",{children:[e.jsx("dt",{children:"Next eligible"}),e.jsx("dd",{children:Ds(x.queue.nextEligibleAt)})]}):null]})]}),e.jsxs("section",{className:S.section,children:[e.jsx("h2",{className:S.sectionTitle,children:"Lease health"}),x.queue.shared?e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:S.metaGrid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Active claims"}),e.jsx("dd",{className:S.numeric,children:x.queue.shared.activeClaims})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Owned by this machine"}),e.jsx("dd",{className:S.numeric,children:x.queue.shared.ownedClaims})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Reclaimable (expired)"}),e.jsx("dd",{className:S.numeric,children:x.queue.shared.reclaimableClaims})]}),x.queue.shared.executingClaims!==void 0?e.jsxs("div",{children:[e.jsx("dt",{children:"Executing"}),e.jsx("dd",{className:S.numeric,children:x.queue.shared.executingClaims})]}):null,x.queue.shared.ambiguousClaims!==void 0?e.jsxs("div",{children:[e.jsx("dt",{children:"Ambiguous (needs reconciliation)"}),e.jsx("dd",{className:S.numeric,children:x.queue.shared.ambiguousClaims})]}):null,e.jsxs("div",{children:[e.jsx("dt",{children:"Next lease expiry"}),e.jsx("dd",{children:Ds(x.queue.shared.nextLeaseExpiryAt)})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Advisory lock"}),e.jsxs("dd",{children:[x.queue.shared.lock.present?x.queue.shared.lock.stale?"present, stale":"present, healthy":"absent",x.queue.shared.lock.recoveryRequired?e.jsx("span",{className:S.lockWarning,children:" — recovery required"}):null]})]})]}),x.queue.shared.claimsByMachine.length>0?e.jsx("div",{className:S.tableWrap,children:e.jsxs("table",{className:S.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Machine"}),e.jsx("th",{scope:"col",children:"Active"}),e.jsx("th",{scope:"col",children:"Expired"}),e.jsx("th",{scope:"col",children:"Executing"})]})}),e.jsx("tbody",{children:x.queue.shared.claimsByMachine.map(g=>e.jsxs("tr",{children:[e.jsx("td",{className:S.mono,children:g.machineId}),e.jsx("td",{className:S.numeric,children:g.active}),e.jsx("td",{className:S.numeric,children:g.expired}),e.jsx("td",{className:S.numeric,children:g.executing??"—"})]},g.machineId))})]})}):null]}):e.jsx("p",{className:S.empty,children:"Shared fleet queue is not in use on this deployment."})]})]}),e.jsxs("section",{className:S.section,children:[e.jsx("h2",{className:S.sectionTitle,children:"Recent activity"}),n.status==="loading"?e.jsx(K,{width:"70%"}):n.status==="error"||!n.data?e.jsx("p",{className:S.error,role:"alert",children:n.error?.message??"Failed to load fleet activity."}):e.jsxs("dl",{className:S.metaGrid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Cooldown items"}),e.jsx("dd",{className:S.numeric,children:n.data.cooldownCount})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Engines ready"}),e.jsxs("dd",{className:S.numeric,children:[n.data.engineReadiness.filter(g=>g.installed&&g.authed===!0).length," /"," ",n.data.engineReadiness.length]})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Recent auto-merges"}),e.jsx("dd",{className:S.numeric,children:x?.merges.recent??"—"})]})]})]}),e.jsxs(Jt,{open:o,onClose:()=>{d(!1),l(null)},titleId:"fleet-kill-switch-confirm",title:r==="resume"?"Resume the fleet?":"Pause the fleet?",children:[e.jsx("p",{className:S.confirmBody,children:r==="resume"?"This clears the global kill switch. Autonomous dispatch will resume across the fleet.":"This engages the global kill switch. Autonomous dispatch halts fleet-wide until explicitly resumed."}),e.jsxs("div",{className:S.confirmActions,children:[e.jsx("button",{type:"button",className:S.cancelButton,onClick:()=>{d(!1),l(null)},children:"Cancel"}),e.jsx("button",{type:"button",className:S.confirmButton,onClick:p,children:r==="resume"?"Yes, resume":"Yes, pause"})]})]}),e.jsx($t,{open:i,onClose:()=>u(!1),reason:r==="resume"?"Resuming the fleet requires the dispatch token.":"Pausing the fleet requires the dispatch token."})]})}const Tp="_view_1fet3_1",Ep="_header_1fet3_8",Ap="_title_1fet3_14",Dp="_freshness_1fet3_20",Mp="_unavailable_1fet3_26",Ip="_counts_1fet3_35",Pp="_countTile_1fet3_41",qp="_countValue_1fet3_51",Bp="_countLabel_1fet3_57",Op="_critical_1fet3_64",Fp="_high_1fet3_65",Up="_medium_1fet3_68",Hp="_low_1fet3_71",Gp="_filters_1fet3_75",Wp="_field_1fet3_86",Qp="_fieldLabel_1fet3_92",Vp="_input_1fet3_97",zp="_select_1fet3_98",Kp="_tableWrap_1fet3_114",Jp="_table_1fet3_114",Yp="_mono_1fet3_141",Xp="_empty_1fet3_146",Zp="_error_1fet3_153",D={view:Tp,header:Ep,title:Ap,freshness:Dp,unavailable:Mp,counts:Ip,countTile:Pp,countValue:qp,countLabel:Bp,critical:Op,high:Fp,medium:Up,low:Hp,filters:Gp,field:Wp,fieldLabel:Qp,input:Vp,select:zp,tableWrap:Kp,table:Jp,mono:Yp,empty:Xp,error:Zp},ef={critical:"danger",high:"danger",medium:"warning",low:"neutral"},Ms={critical:0,high:1,medium:2,low:3};function tf(){const t=c.useRef(null);Ne("/control/security",t);const s=q(kt),n=s.data?.security,[a,r]=c.useState(""),[l,o]=c.useState("all"),[d,i]=c.useState("all"),u=c.useMemo(()=>Array.from(new Set((n?.findings??[]).map(m=>m.repo))).sort(),[n]),h=c.useMemo(()=>(n?.findings??[]).filter(f=>l==="all"?!0:f.severity===l).filter(f=>d==="all"?!0:f.repo===d).filter(f=>{if(!a.trim())return!0;const j=a.trim().toLowerCase();return f.title.toLowerCase().includes(j)||f.repo.toLowerCase().includes(j)}).sort((f,j)=>(Ms[f.severity]??9)-(Ms[j.severity]??9)),[n,l,d,a]);return e.jsxs("div",{ref:t,className:D.view,children:[e.jsxs("header",{className:D.header,children:[e.jsx("h1",{className:D.title,children:"Security"}),e.jsx("div",{className:D.freshness,"aria-live":"polite",children:s.status==="refreshing"?e.jsx(ae,{}):null})]}),s.status==="loading"?e.jsx(K,{width:"60%"}):s.status==="error"||!n?e.jsx("p",{className:D.error,role:"alert",children:s.error?.message??"Failed to load control snapshot."}):n.available?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:D.counts,children:[e.jsxs("div",{className:`${D.countTile} ${D.critical}`,children:[e.jsx("span",{className:D.countValue,children:n.counts.critical}),e.jsx("span",{className:D.countLabel,children:"Critical"})]}),e.jsxs("div",{className:`${D.countTile} ${D.high}`,children:[e.jsx("span",{className:D.countValue,children:n.counts.high}),e.jsx("span",{className:D.countLabel,children:"High"})]}),e.jsxs("div",{className:`${D.countTile} ${D.medium}`,children:[e.jsx("span",{className:D.countValue,children:n.counts.medium}),e.jsx("span",{className:D.countLabel,children:"Medium"})]}),e.jsxs("div",{className:`${D.countTile} ${D.low}`,children:[e.jsx("span",{className:D.countValue,children:n.counts.low}),e.jsx("span",{className:D.countLabel,children:"Low"})]})]}),e.jsxs("form",{className:D.filters,role:"search","aria-label":"Filter findings",onSubmit:m=>m.preventDefault(),children:[e.jsxs("label",{className:D.field,children:[e.jsx("span",{className:D.fieldLabel,children:"Search"}),e.jsx("input",{type:"text",className:D.input,placeholder:"title or repo",value:a,onChange:m=>r(m.target.value)})]}),e.jsxs("label",{className:D.field,children:[e.jsx("span",{className:D.fieldLabel,children:"Severity"}),e.jsxs("select",{className:D.select,value:l,onChange:m=>o(m.target.value),children:[e.jsx("option",{value:"all",children:"All"}),e.jsx("option",{value:"critical",children:"Critical"}),e.jsx("option",{value:"high",children:"High"}),e.jsx("option",{value:"medium",children:"Medium"}),e.jsx("option",{value:"low",children:"Low"})]})]}),e.jsxs("label",{className:D.field,children:[e.jsx("span",{className:D.fieldLabel,children:"Repo"}),e.jsxs("select",{className:D.select,value:d,onChange:m=>i(m.target.value),children:[e.jsx("option",{value:"all",children:"All"}),u.map(m=>e.jsx("option",{value:m,children:m},m))]})]})]}),h.length===0?e.jsx("p",{className:D.empty,children:"No findings match the current filters."}):e.jsx("div",{className:D.tableWrap,children:e.jsxs("table",{className:D.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"Severity"}),e.jsx("th",{scope:"col",children:"Repo"}),e.jsx("th",{scope:"col",children:"Finding"})]})}),e.jsx("tbody",{children:h.map((m,f)=>e.jsxs("tr",{children:[e.jsx("td",{children:e.jsx(U,{status:m.severity,tone:ef[m.severity]??"neutral"})}),e.jsx("td",{className:D.mono,children:m.repo}),e.jsx("td",{children:m.title})]},`${m.repo}-${m.title}-${f}`))})]})})]}):e.jsx("p",{className:D.unavailable,children:`No cached security data available — the backlog is absent, empty, or has no security-source findings. This is not the same as "clean": it means binshield hasn't produced cached findings for this fleet yet.`})]})}const sf="_view_1yeql_1",nf="_header_1yeql_8",af="_title_1yeql_14",rf="_freshness_1yeql_20",lf="_count_1yeql_26",of="_missionCard_1yeql_31",cf="_sectionTitle_1yeql_41",df="_missionState_1yeql_49",uf="_sourceGrid_1yeql_54",hf="_list_1yeql_68",mf="_goalCard_1yeql_74",pf="_goalHeader_1yeql_88",ff="_goalObjective_1yeql_95",_f="_progressRow_1yeql_100",xf="_progressTrack_1yeql_106",gf="_progressFill_1yeql_114",jf="_progressLabel_1yeql_120",vf="_nextActionable_1yeql_127",bf="_mono_1yeql_132",yf="_milestoneList_1yeql_136",wf="_milestoneItem_1yeql_142",Nf="_milestoneTitle_1yeql_149",kf="_noMilestones_1yeql_153",$f="_empty_1yeql_158",Sf="_error_1yeql_165",V={view:sf,header:nf,title:af,freshness:rf,count:lf,missionCard:of,sectionTitle:cf,missionState:df,sourceGrid:uf,list:hf,goalCard:mf,goalHeader:pf,goalObjective:ff,progressRow:_f,progressTrack:xf,progressFill:gf,progressLabel:jf,nextActionable:vf,mono:bf,milestoneList:yf,milestoneItem:wf,milestoneTitle:Nf,noMilestones:kf,empty:$f,error:Sf};function Cf(){const t=c.useRef(null);Ne("/goals",t);const s=q(bt),n=q(Qn),a=s.data??[],r=n.data;return e.jsxs("div",{ref:t,className:V.view,children:[e.jsxs("header",{className:V.header,children:[e.jsx("h1",{className:V.title,children:"Goals"}),e.jsxs("div",{className:V.freshness,"aria-live":"polite",children:[s.status==="refreshing"||n.status==="refreshing"?e.jsx(ae,{}):null,e.jsxs("span",{className:V.count,children:[a.length," goals"]})]})]}),n.status==="loading"?e.jsx(K,{width:"50%"}):n.status==="success"&&r?e.jsxs("section",{className:V.missionCard,children:[e.jsx("h2",{className:V.sectionTitle,children:"Mission state"}),e.jsx("p",{className:V.missionState,children:r.state}),e.jsxs("dl",{className:V.sourceGrid,children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Briefing"}),e.jsx("dd",{children:e.jsx(O,{quality:r.sources.briefing??void 0,label:"briefing source",children:"available"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Goals source"}),e.jsx("dd",{children:e.jsx(O,{quality:r.sources.goals??void 0,label:"goals source",children:"available"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Enrollment"}),e.jsx("dd",{children:e.jsx(O,{quality:r.sources.enrollment??void 0,label:"enrollment source",children:"available"})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Proposals"}),e.jsx("dd",{children:e.jsx(O,{quality:r.sources.proposals??void 0,label:"proposals source",children:"available"})})]})]})]}):null,s.status==="loading"?e.jsxs("div",{className:V.list,children:[e.jsx(K,{width:"90%"}),e.jsx(K,{width:"70%"})]}):s.status==="error"?e.jsx("p",{className:V.error,role:"alert",children:s.error?.message??"Failed to load goals."}):a.length===0?e.jsx("p",{className:V.empty,children:"No active goals."}):e.jsx("ul",{className:V.list,children:a.map(l=>{const o=Math.round((l.progress.fractionDone??0)*100);return e.jsxs("li",{className:V.goalCard,"data-focus-key":`goal-${l.id}`,tabIndex:0,children:[e.jsxs("div",{className:V.goalHeader,children:[e.jsx("h3",{className:V.goalObjective,children:l.objective}),e.jsx(U,{status:l.status})]}),e.jsxs("div",{className:V.progressRow,children:[e.jsx("div",{className:V.progressTrack,children:e.jsx("div",{className:V.progressFill,style:{width:`${o}%`}})}),e.jsxs("span",{className:V.progressLabel,children:[o,"%"]})]}),l.progress.nextActionableId?e.jsxs("p",{className:V.nextActionable,children:["Next actionable milestone id: ",e.jsx("span",{className:V.mono,children:l.progress.nextActionableId})]}):null,l.milestones.length>0?e.jsx("ol",{className:V.milestoneList,children:[...l.milestones].sort((d,i)=>d.order-i.order).map(d=>e.jsxs("li",{className:V.milestoneItem,children:[e.jsx(U,{status:d.status}),e.jsx("span",{className:V.milestoneTitle,children:d.title})]},d.title))}):e.jsx("p",{className:V.noMilestones,children:"No milestones yet."})]},l.id)})})]})}const Rf="_list_1nh33_1",Lf="_filters_1nh33_8",Tf="_filterField_1nh33_14",Ef="_filterLabel_1nh33_21",Af="_summary_1nh33_36",Df="_batchBar_1nh33_44",Mf="_batchApprove_1nh33_61",If="_batchReject_1nh33_66",Pf="_skeletons_1nh33_71",qf="_error_1nh33_77",Bf="_empty_1nh33_85",Of="_table_1nh33_94",Ff="_checkboxCol_1nh33_121",Uf="_repoCol_1nh33_125",Hf="_kindCol_1nh33_129",Gf="_ageCol_1nh33_133",Wf="_statusCol_1nh33_137",Qf="_whyCol_1nh33_141",Vf="_row_1nh33_145",zf="_rowActive_1nh33_155",Kf="_titleLink_1nh33_159",Jf="_repoCell_1nh33_172",Yf="_age_1nh33_133",Xf="_why_1nh33_141",F={list:Rf,filters:Lf,filterField:Tf,filterLabel:Ef,summary:Af,batchBar:Df,batchApprove:Mf,batchReject:If,skeletons:Pf,error:qf,empty:Bf,table:Of,checkboxCol:Ff,repoCol:Uf,kindCol:Hf,ageCol:Gf,statusCol:Wf,whyCol:Qf,row:Vf,rowActive:zf,titleLink:Kf,repoCell:Jf,age:Yf,why:Xf},Zf=[{value:"pending",label:"Pending"},{value:"rejected",label:"Rejected"},{value:"approved",label:"Approved"},{value:"applied",label:"Applied"},{value:"failed",label:"Failed"},{value:"awaiting-host-merge",label:"Awaiting host merge"},{value:"all",label:"All statuses"}];function e_(t){const s=Date.parse(t);if(Number.isNaN(s))return"—";const n=Math.max(0,Math.round((Date.now()-s)/1e3));if(n<60)return`${n}s`;const a=Math.round(n/60);if(a<60)return`${a}m`;const r=Math.round(a/60);return r<24?`${r}h`:`${Math.round(r/24)}d`}function t_({selectedId:t,onDispatchDisabled:s}){const[n,a]=c.useState("pending"),[r,l]=c.useState(""),[o,d]=c.useState(""),[i,u]=c.useState(""),[h,m]=c.useState(new Set),[f,j]=c.useState(0),[b,_]=c.useState(null),[p,x]=c.useState(!1),[v,w]=c.useState(!1),[L,g]=c.useState(!1),[H,A]=c.useState(null),N=c.useRef(null),C=c.useRef(new Map),oe=dt(),ne=q(Yt({status:n,since:r||void 0,limit:500})),se=c.useMemo(()=>{const k=ne.data?.proposals??[],Q=o.trim().toLowerCase(),ie=i.trim().toLowerCase();return k.filter(ve=>!(Q&&!ve.title.toLowerCase().includes(Q)&&!(ve.summary??"").toLowerCase().includes(Q)||ie&&!(ve.repo??"").toLowerCase().includes(ie)))},[ne.data,o,i]);c.useEffect(()=>{j(k=>Math.min(k,Math.max(se.length-1,0)))},[se.length]);function y(k,Q){Q==="pending"&&m(ie=>{const ve=new Set(ie);return ve.has(k)?ve.delete(k):ve.add(k),ve})}function P(k){if(se.length!==0)if(k.key==="ArrowDown"){k.preventDefault();const Q=Math.min(f+1,se.length-1);j(Q),C.current.get(se[Q].id)?.focus()}else if(k.key==="ArrowUp"){k.preventDefault();const Q=Math.max(f-1,0);j(Q),C.current.get(se[Q].id)?.focus()}else if(k.key==="Enter"){const Q=se[f];Q&&oe(`/inbox/${encodeURIComponent(Q.id)}`)}else if(k.key===" "){const Q=se[f];Q&&(k.preventDefault(),y(Q.id,Q.status))}else k.key==="/"&&(k.preventDefault(),N.current?.focus())}function G(k){h.size!==0&&(A(null),_(k),He()?w(!0):x(!0))}function le(){x(!1),He()?w(!0):_(null)}async function $n(){if(!b)return;g(!0),A(null);const k=Array.from(h),Q=[];for(const ie of k)try{b==="approve"?await Xt(ie):await Zt(ie)}catch(ve){if(ve instanceof Fs){g(!1),w(!1),_(null),s();return}Q.push(ie)}g(!1),Q.length>0?(A(`${Q.length} of ${k.length} failed (already decided, or a transient error). Selection kept for retry.`),m(new Set(Q))):(w(!1),_(null),m(new Set))}const _e=h.size;return e.jsxs("div",{className:F.list,children:[e.jsxs("div",{className:F.filters,children:[e.jsxs("label",{className:F.filterField,children:[e.jsx("span",{className:F.filterLabel,children:"Status"}),e.jsx("select",{value:n,onChange:k=>a(k.target.value),children:Zf.map(k=>e.jsx("option",{value:k.value,children:k.label},k.value))})]}),e.jsxs("label",{className:F.filterField,children:[e.jsx("span",{className:F.filterLabel,children:"Since"}),e.jsx("input",{type:"date",value:r,onChange:k=>l(k.target.value)})]}),e.jsxs("label",{className:F.filterField,children:[e.jsx("span",{className:F.filterLabel,children:"Repo"}),e.jsx("input",{type:"text",placeholder:"filter by repo",value:i,onChange:k=>u(k.target.value)})]}),e.jsxs("label",{className:F.filterField,children:[e.jsx("span",{className:F.filterLabel,children:"Search"}),e.jsx("input",{ref:N,type:"search",placeholder:"title or summary — press / to focus",value:o,onChange:k=>d(k.target.value)})]})]}),e.jsxs("div",{className:F.summary,"aria-live":"polite",children:[ne.status==="refreshing"?e.jsx(ae,{}):null,ne.data?e.jsxs("span",{children:[se.length," shown of ",ne.data.total," total",ne.data.truncated?" · narrow filters to see more":""]}):null]}),_e>0?e.jsxs("div",{className:F.batchBar,children:[e.jsxs("span",{children:[_e," selected"]}),e.jsx("button",{type:"button",onClick:()=>m(new Set),children:"Clear"}),e.jsxs("button",{type:"button",className:F.batchReject,onClick:()=>G("reject"),children:["Reject ",_e]}),e.jsxs("button",{type:"button",className:F.batchApprove,onClick:()=>G("approve"),children:["Approve ",_e]})]}):null,ne.status==="loading"?e.jsxs("div",{className:F.skeletons,children:[e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{}),e.jsx(te,{})]}):ne.status==="error"?e.jsx("div",{className:F.error,role:"alert",children:ne.error?.message??"Failed to load proposals."}):se.length===0?e.jsxs("p",{className:F.empty,children:["No ",n==="all"?"":n+" ","proposals match",o||i?" this filter":"","."]}):e.jsxs("table",{className:F.table,role:"grid","aria-label":"Proposals",onKeyDown:P,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:F.checkboxCol}),e.jsx("th",{scope:"col",children:"Title"}),e.jsx("th",{scope:"col",className:F.repoCol,children:"Repo"}),e.jsx("th",{scope:"col",className:F.kindCol,children:"Kind"}),e.jsx("th",{scope:"col",className:F.ageCol,children:"Age"}),e.jsx("th",{scope:"col",className:F.statusCol,children:"Status"}),e.jsx("th",{scope:"col",className:F.whyCol,children:"Why"})]})}),e.jsx("tbody",{children:se.map((k,Q)=>e.jsxs("tr",{ref:ie=>{ie?C.current.set(k.id,ie):C.current.delete(k.id)},"data-focus-key":`proposal-${k.id}`,tabIndex:Q===f?0:-1,className:`${F.row} ${k.id===t?F.rowActive:""}`,onFocus:()=>j(Q),"aria-selected":k.id===t,children:[e.jsx("td",{className:F.checkboxCol,children:e.jsx("input",{type:"checkbox",checked:h.has(k.id),disabled:k.status!=="pending",title:k.status!=="pending"?"Only pending proposals can be approved/rejected":void 0,onChange:()=>y(k.id,k.status),onClick:ie=>ie.stopPropagation()})}),e.jsx("td",{children:e.jsx(ht,{to:`/inbox/${encodeURIComponent(k.id)}`,className:F.titleLink,title:k.title,children:k.title})}),e.jsx("td",{className:F.repoCell,title:k.repo??void 0,children:k.repo?k.repo.split("/").pop():"—"}),e.jsx("td",{children:k.kind}),e.jsx("td",{className:F.age,children:e_(k.createdAt)}),e.jsx("td",{children:e.jsx(U,{status:k.status})}),e.jsx("td",{className:F.why,title:k.decisionReason??void 0,children:k.decisionReason??"—"})]},k.id))})]}),e.jsx($t,{open:p,onClose:le,reason:`${b==="approve"?"Approving":"Rejecting"} ${_e} proposals requires the dispatch token.`}),e.jsx(es,{open:v,onClose:()=>{w(!1),_(null),A(null)},title:b==="approve"?`Approve ${_e} proposals?`:`Reject ${_e} proposals?`,body:b==="approve"?e.jsxs(e.Fragment,{children:["This applies all ",_e," selected proposals to their repos now, one at a time. This cannot be undone from this dialog."]}):e.jsxs(e.Fragment,{children:["This rejects all ",_e," selected proposals. They stay visible in history as rejected."]}),confirmLabel:b==="approve"?`Approve ${_e}`:`Reject ${_e}`,destructive:b==="reject",busy:L,error:H,onConfirm:()=>void $n()})]})}const s_="_panel_1n6q8_1",n_="_error_1n6q8_8",a_="_header_1n6q8_16",r_="_titleRow_1n6q8_22",l_="_title_1n6q8_22",o_="_metaRow_1n6q8_35",i_="_metaItem_1n6q8_44",c_="_riskBadge_1n6q8_48",d_="_risk_low_1n6q8_54",u_="_risk_medium_1n6q8_55",h_="_risk_high_1n6q8_56",m_="_summary_1n6q8_58",p_="_evidence_1n6q8_64",f_="_evidenceRow_1n6q8_74",__="_evidenceLabel_1n6q8_81",x_="_muted_1n6q8_89",g_="_rationaleNote_1n6q8_94",j_="_failedChecks_1n6q8_101",v_="_diffSection_1n6q8_107",b_="_actions_1n6q8_111",y_="_actionConsequence_1n6q8_124",w_="_actionError_1n6q8_133",N_="_rejectButton_1n6q8_144",k_="_approveButton_1n6q8_165",$_="_decided_1n6q8_176",M={panel:s_,error:n_,header:a_,titleRow:r_,title:l_,metaRow:o_,metaItem:i_,riskBadge:c_,risk_low:d_,risk_medium:u_,risk_high:h_,summary:m_,evidence:p_,evidenceRow:f_,evidenceLabel:__,muted:x_,rationaleNote:g_,failedChecks:j_,diffSection:v_,actions:b_,actionConsequence:y_,actionError:w_,rejectButton:N_,approveButton:k_,decided:$_},S_={"judge-ship-would-merge":{label:"Ship (would merge)",tone:"success"},"judge-ship-review-required":{label:"Ship (review required)",tone:"success"},"judge-review":{label:"Review",tone:"warning"},"judge-noise":{label:"Noise",tone:"neutral"},"judge-harmful":{label:"Harmful",tone:"danger"},"judge-verdict-unrecognized":{label:"Unrecognized verdict",tone:"unknown"},"judge-parse-failure":{label:"Judge parse failure — not a review",tone:"unknown"},"judge-network-failure":{label:"Judge network failure — not a review",tone:"unknown"}};function C_(t){const s=t.filter(n=>n.action==="judged"&&n.judgeReasonCode);return s.length===0?null:s.reduce((n,a)=>Date.parse(a.ts)>Date.parse(n.ts)?a:n)}function Is(t){if(!t)return"—";const s=Date.parse(t);if(Number.isNaN(s))return"—";const n=Math.max(0,Math.round((Date.now()-s)/1e3));if(n<60)return`${n}s ago`;const a=Math.round(n/60);if(a<60)return`${a}m ago`;const r=Math.round(a/60);return r<24?`${r}h ago`:`${Math.round(r/24)}d ago`}function Ps(t,s){const n=s&&s.length>0?s:"the target repository";return t==="pr"?`Approving pushes a branch to ${n}'s remote and opens a real pull request. Other people can see it immediately, and it cannot be undone from here.`:t==="patch"?`Approving writes this diff to ${n} on disk now. Nothing is pushed, but the working tree changes.`:`Approving applies this ${t} proposal to ${n} now.`}function R_({id:t,onDispatchDisabled:s}){const n=q(Ws(t)),[a,r]=c.useState(null),[l,o]=c.useState(!1),[d,i]=c.useState(!1),[u,h]=c.useState(!1),[m,f]=c.useState(null);function j(g){f(null),r(g),He()?i(!0):o(!0)}function b(){o(!1),He()?i(!0):r(null)}async function _(){if(a){h(!0),f(null);try{a==="approve"?await Xt(t):await Zt(t),i(!1),r(null)}catch(g){g instanceof Fs?(i(!1),r(null),s()):f(g instanceof Error?g.message:"Action failed. Try again.")}finally{h(!1)}}}if(n.status==="loading")return e.jsxs("div",{className:M.panel,children:[e.jsx(K,{width:"60%"}),e.jsx(K,{width:"30%"}),e.jsx(K,{width:"90%"})]});if(n.status==="error"||!n.data)return e.jsx("div",{className:M.error,role:"alert",children:n.error?.message??"Failed to load this proposal."});const p=n.data,x=p.decisionEvidence,v=C_(x.decisions),w=v?.judgeReasonCode?S_[v.judgeReasonCode]:null,L=p.status==="pending";return e.jsxs("div",{className:M.panel,children:[e.jsxs("header",{className:M.header,children:[e.jsxs("div",{className:M.titleRow,children:[e.jsx("h2",{className:M.title,children:p.title}),n.status==="refreshing"?e.jsx(ae,{}):null]}),e.jsxs("div",{className:M.metaRow,children:[e.jsx(U,{status:p.status}),e.jsx("span",{className:M.metaItem,children:p.kind}),e.jsx("span",{className:M.metaItem,title:p.repo??void 0,children:p.repo??"no repo"}),e.jsxs("span",{className:M.metaItem,children:["created ",Is(p.createdAt)]}),p.decidedAt?e.jsxs("span",{className:M.metaItem,children:["decided ",Is(p.decidedAt)]}):null,p.riskClass?e.jsxs("span",{className:`${M.riskBadge} ${M[`risk_${p.riskClass}`]}`,children:[p.riskClass," risk"]}):null]}),p.summary?e.jsx("p",{className:M.summary,children:p.summary}):null]}),e.jsxs("section",{className:M.evidence,"aria-label":"Evidence",children:[e.jsxs("div",{className:M.evidenceRow,children:[e.jsx("span",{className:M.evidenceLabel,children:"Judge verdict"}),e.jsx(O,{quality:x.sourceQuality,label:"judge verdict",children:w?e.jsx(U,{status:v.judgeReasonCode,tone:w.tone,children:w.label}):e.jsx("span",{className:M.muted,children:"not yet judged"})})]}),v?.judgeRationaleState?e.jsxs("p",{className:M.rationaleNote,children:["Model rationale:"," ",v.judgeRationaleState==="not-persisted"?"not persisted":"legacy (redacted)"]}):null,p.decisionReason?e.jsxs("div",{className:M.evidenceRow,children:[e.jsx("span",{className:M.evidenceLabel,children:"Decision reason"}),e.jsx("span",{children:p.decisionReason})]}):null,p.verifyResult?e.jsxs("div",{className:M.evidenceRow,children:[e.jsx("span",{className:M.evidenceLabel,children:"Verification"}),e.jsxs("div",{children:[e.jsx(U,{status:p.verifyResult.passed?"success":"failed",children:p.verifyResult.passed?"passed":"failed"}),p.verifyResult.ran&&p.verifyResult.ran.length>0?e.jsxs("span",{className:M.muted,children:[" · ran ",p.verifyResult.ran.map(g=>g.kind).join(", ")]}):null,p.verifyResult.failed&&p.verifyResult.failed.length>0?e.jsxs("p",{className:M.failedChecks,children:["Failed: ",p.verifyResult.failed.join(", ")]}):null]})]}):null,p.evidenceOutcome?e.jsxs("div",{className:M.evidenceRow,children:[e.jsx("span",{className:M.evidenceLabel,children:"Gates"}),e.jsxs("span",{className:M.muted,children:[p.evidenceOutcome.gateCount??0," gate",p.evidenceOutcome.gateCount===1?"":"s",p.evidenceOutcome.policyAction?` · policy: ${p.evidenceOutcome.policyAction}`:"",p.evidenceOutcome.trustBasis?` · trust: ${p.evidenceOutcome.trustBasis}`:""]})]}):null,p.result?e.jsxs("div",{className:M.evidenceRow,children:[e.jsx("span",{className:M.evidenceLabel,children:"Result"}),e.jsx("span",{children:p.result})]}):null]}),e.jsx("section",{className:M.diffSection,"aria-label":"Diff",children:e.jsx(ta,{diff:p.diff,proposalKind:p.kind})}),L?e.jsxs("footer",{className:M.actions,children:[m&&!d?e.jsx("p",{className:M.actionError,role:"alert",children:m}):null,e.jsx("p",{className:M.actionConsequence,children:Ps(p.kind,p.repo)}),e.jsx("button",{type:"button",className:M.rejectButton,onClick:()=>j("reject"),children:"Reject"}),e.jsx("button",{type:"button",className:M.approveButton,onClick:()=>j("approve"),children:"Approve"})]}):e.jsxs("footer",{className:M.decided,children:["This proposal is already ",e.jsx("strong",{children:p.status})," — no further action available."]}),e.jsx($t,{open:l,onClose:b,reason:a==="approve"?"Approving a proposal mutates the fleet and requires the dispatch token.":"Rejecting a proposal requires the dispatch token."}),e.jsx(es,{open:d,onClose:()=>{i(!1),r(null),f(null)},title:a==="approve"?"Approve this proposal?":"Reject this proposal?",body:a==="approve"?e.jsxs(e.Fragment,{children:["This applies ",e.jsx("strong",{children:p.title})," to ",e.jsx("code",{children:p.repo})," now."," ",Ps(p.kind,p.repo)," Review the diff above before confirming."]}):e.jsxs(e.Fragment,{children:["This rejects ",e.jsx("strong",{children:p.title})," and discards it. It stays visible in history (status: rejected) but will never be applied. Nothing is written to ",e.jsx("code",{children:p.repo}),"."]}),confirmLabel:a==="approve"?p.kind==="pr"?"Approve and open the pull request":"Approve and apply":"Reject",destructive:a==="approve",busy:u,error:m,onConfirm:()=>void _()})]})}const L_="_view_19z5m_1",T_="_header_19z5m_8",E_="_title_19z5m_14",A_="_subtitle_19z5m_20",D_="_dispatchBanner_19z5m_25",M_="_layout_19z5m_39",I_="_listPane_19z5m_57",P_="_detailPane_19z5m_61",q_="_emptyDetail_19z5m_69",B_="_hint_19z5m_81",we={view:L_,header:T_,title:E_,subtitle:A_,dispatchBanner:D_,layout:M_,listPane:I_,detailPane:P_,emptyDetail:q_,hint:B_};function qs(){const{id:t}=as(),[s,n]=c.useState(!1);return e.jsxs("div",{className:we.view,children:[e.jsxs("header",{className:we.header,children:[e.jsx("h1",{className:we.title,children:"Inbox"}),e.jsx("p",{className:we.subtitle,children:"Review proposals, inspect diffs and judge evidence, approve or reject."})]}),s?e.jsxs("div",{className:we.dispatchBanner,role:"alert",children:["This server was started without ",e.jsx("code",{children:"--allow-dispatch"}),", so approve/reject are read-only right now. Restart ",e.jsx("code",{children:"ashlr serve --allow-dispatch"})," to enable them. Browsing and diff review still work."]}):null,e.jsxs("div",{className:we.layout,children:[e.jsx("div",{className:we.listPane,children:e.jsx(t_,{selectedId:t??null,onDispatchDisabled:()=>n(!0)})}),e.jsx("div",{className:we.detailPane,children:t?e.jsx(R_,{id:t,onDispatchDisabled:()=>n(!0)}):e.jsxs("div",{className:we.emptyDetail,children:[e.jsx("p",{children:"Select a proposal to review its diff and evidence."}),e.jsx("p",{className:we.hint,children:"↑/↓ to move · Enter to open · Space to select · / to search"})]})})]})]})}const O_="_cockpit_1km3b_1",F_="_decisionSpine_1km3b_9",U_="_mission_1km3b_18",H_="_titleLine_1km3b_25",G_="_revision_1km3b_39",W_="_northStar_1km3b_44",Q_="_bottleneck_1km3b_52",V_="_nextActionLabel_1km3b_60",z_="_fieldLabel_1km3b_61",K_="_nextAction_1km3b_60",J_="_exception_1km3b_79",Y_="_attention_1km3b_84",X_="_clear_1km3b_89",Z_="_spectrum_1km3b_106",ex="_bets_1km3b_107",tx="_sectionHeading_1km3b_113",sx="_capabilityList_1km3b_133",nx="_betList_1km3b_134",ax="_capabilityLane_1km3b_141",rx="_bet_1km3b_107",lx="_laneIdentity_1km3b_155",ox="_laneName_1km3b_162",ix="_headroomTrack_1km3b_167",cx="_headroomFill_1km3b_174",dx="_ample_1km3b_181",ux="_usable_1km3b_182",hx="_tight_1km3b_183",mx="_none_1km3b_184",px="_unknown_1km3b_185",fx="_allocation_1km3b_187",_x="_reset_1km3b_188",xx="_betAllocation_1km3b_189",gx="_assurance_1km3b_190",jx="_betDecision_1km3b_216",vx="_betEvidence_1km3b_217",bx="_betThesis_1km3b_227",yx="_empty_1km3b_251",wx="_omitted_1km3b_252",Nx="_authorityNote_1km3b_253",I={cockpit:O_,decisionSpine:F_,mission:U_,titleLine:H_,revision:G_,northStar:W_,bottleneck:Q_,nextActionLabel:V_,fieldLabel:z_,nextAction:K_,exception:J_,attention:Y_,clear:X_,spectrum:Z_,bets:ex,sectionHeading:tx,capabilityList:sx,betList:nx,capabilityLane:ax,bet:rx,laneIdentity:lx,laneName:ox,headroomTrack:ix,headroomFill:cx,ample:dx,usable:ux,tight:hx,none:mx,unknown:px,allocation:fx,reset:_x,betAllocation:xx,assurance:gx,betDecision:jx,betEvidence:vx,betThesis:bx,empty:yx,omitted:wx,authorityNote:Nx},kx=3;function kn(t){return t==="complete"?"success":t==="pending"?"running":t==="incomplete"?"warning":"unknown"}function $x(t){return t==="ready"?"success":t==="tight"?"warning":t==="unavailable"?"danger":"unknown"}function Sx(t){return t==="continue"?"running":t==="observing"?"info":"warning"}function Cx(t){return t==="effective"?"success":t==="refuted"?"danger":t==="pending"?"running":"unknown"}function Rx({capability:t}){return e.jsxs("li",{className:I.capabilityLane,children:[e.jsxs("div",{className:I.laneIdentity,children:[e.jsx("span",{className:I.laneName,children:t.label}),e.jsx(U,{status:t.state,tone:$x(t.state)})]}),e.jsx("div",{className:I.headroomTrack,role:"img","aria-label":`${t.label} headroom: ${t.headroom}`,children:e.jsx("span",{className:`${I.headroomFill} ${I[t.headroom]}`})}),e.jsx("span",{className:I.allocation,children:t.allocationLabel}),e.jsx("span",{className:I.reset,"data-urgency":t.resetUrgency,children:t.resetLabel})]})}function Lx({bet:t}){return e.jsxs("li",{className:I.bet,children:[e.jsxs("div",{className:I.betDecision,children:[e.jsx(U,{status:t.decision,tone:Sx(t.decision)}),e.jsx("span",{className:I.assurance,children:t.assurance})]}),e.jsxs("div",{className:I.betThesis,children:[e.jsx("h3",{children:t.title}),e.jsx("p",{children:t.valueCase})]}),e.jsx("span",{className:I.betAllocation,children:t.allocationLabel}),e.jsxs("div",{className:I.betEvidence,children:[e.jsxs("span",{children:[e.jsx("span",{className:I.fieldLabel,children:"Outcome"}),e.jsx(U,{status:t.outcome.state,tone:Cx(t.outcome.state),children:t.outcome.label})]}),e.jsxs("span",{children:[e.jsx("span",{className:I.fieldLabel,children:"Evidence"}),e.jsx(U,{status:t.evidence.state,tone:kn(t.evidence.state),children:t.evidence.label})]})]})]})}function Tx({snapshot:t}){const s=t.activeValueBets.slice(0,kx),n=Math.max(0,t.activeValueBets.length-s.length),a=t.nextAction;return e.jsxs("section",{className:I.cockpit,"aria-labelledby":"agent-os-title",children:[e.jsxs("header",{className:I.decisionSpine,children:[e.jsxs("div",{className:I.mission,children:[e.jsxs("div",{className:I.titleLine,children:[e.jsx("h2",{id:"agent-os-title",children:"Agent OS"}),e.jsx(U,{status:t.sourceState,tone:t.sourceState==="healthy"?"success":t.sourceState==="degraded"?"warning":"unknown"}),e.jsx("span",{className:I.revision,children:t.livingEndState.revisionLabel})]}),e.jsx("p",{className:I.northStar,children:t.livingEndState.northStar}),e.jsxs("p",{className:I.bottleneck,children:[e.jsx("span",{children:"Current bottleneck"}),t.livingEndState.currentBottleneck]})]}),e.jsxs("aside",{className:`${I.nextAction} ${a?I[a.kind]:I.clear}`,"aria-label":"Exception-first next action",children:[e.jsx("span",{className:I.nextActionLabel,children:"Next action"}),e.jsx("strong",{children:a?.title??"No verified next action available"}),e.jsx("p",{children:a?.reason??"No exception or clearance evidence was provided."}),a?e.jsxs(U,{status:a.evidenceState,tone:kn(a.evidenceState),children:[a.evidenceState," evidence"]}):null]})]}),e.jsxs("section",{className:I.spectrum,"aria-labelledby":"capability-spectrum-title",children:[e.jsxs("div",{className:I.sectionHeading,children:[e.jsx("h3",{id:"capability-spectrum-title",children:"Capability spectrum"}),e.jsx("p",{children:"Usable model runway, ordered by reset urgency"})]}),t.capabilitySpectrum.length>0?e.jsx("ul",{className:I.capabilityList,children:t.capabilitySpectrum.map(r=>e.jsx(Rx,{capability:r},r.lane))}):e.jsx("p",{className:I.empty,children:"Capability evidence is not available."})]}),e.jsxs("section",{className:I.bets,"aria-labelledby":"active-value-bets-title",children:[e.jsxs("div",{className:I.sectionHeading,children:[e.jsx("h3",{id:"active-value-bets-title",children:"Active value bets"}),e.jsxs("p",{children:[s.length," of 3 portfolio slots visible"]})]}),s.length>0?e.jsx("ol",{className:I.betList,children:s.map(r=>e.jsx(Lx,{bet:r},r.key))}):e.jsx("p",{className:I.empty,children:"No active value bet is verified."}),n>0?e.jsxs("p",{className:I.omitted,children:[n," lower-ranked ",n===1?"bet is":"bets are"," held outside this view."]}):null]}),e.jsx("p",{className:I.authorityNote,children:"Observation only. This view cannot dispatch, merge, release, deploy, or change policy."})]})}const Ex="_view_k4f4y_1",Ax="_header_k4f4y_8",Dx="_eyebrow_k4f4y_15",Mx="_title_k4f4y_24",Ix="_subtitle_k4f4y_31",Px="_freshness_k4f4y_37",qx="_loading_k4f4y_44",Bx="_unavailable_k4f4y_45",Ox="_unavailableHeading_k4f4y_75",Fx="_boundary_k4f4y_82",ce={view:Ex,header:Ax,eyebrow:Dx,title:Mx,subtitle:Ix,freshness:Px,loading:qx,unavailable:Bx,unavailableHeading:Ox,boundary:Fx};function Nt(t){return t.authority==="observation-only"&&t.sameUserTamperResistant===!1&&t.rollbackProtected===!1&&t.historicalAuthority===!1&&t.executionAuthority===!1&&t.proposalAuthority===!1&&t.mergeAuthority===!1&&t.deployAuthority===!1&&t.publicationAuthority===!1&&t.externalMutationAuthority===!1}function Ux(t){return t.reason?t.reason:t.sourceState==="missing"?"No authenticated Agent OS snapshot has been recorded.":t.authentication!=="authenticated"?"Snapshot authentication is unavailable or invalid.":t.sameUserTamperResistant!==!1?"The response made an unsupported same-user tamper-resistance claim.":Nt(t)?t.complete?t.snapshot?"The Agent OS snapshot is degraded.":"No verified Agent OS snapshot is available.":"The snapshot chain is incomplete.":"The response crossed the observation-only authority boundary."}function Hx(t){return t.sourceState==="healthy"&&t.complete&&t.authentication==="authenticated"&&Nt(t)&&t.snapshot!==null?"success":t.sourceState==="degraded"||t.authentication==="invalid"||!Nt(t)?"warning":"unknown"}function Gx(){const t=c.useRef(null);Ne("/agent-os",t);const s=q(Vn),n=s.data,a=n?.sourceState==="healthy"&&n.complete&&n.authentication==="authenticated"&&Nt(n)&&n.snapshot!==null;return e.jsxs("div",{ref:t,className:ce.view,children:[e.jsxs("header",{className:ce.header,children:[e.jsxs("div",{children:[e.jsx("p",{className:ce.eyebrow,children:"Overview"}),e.jsx("h1",{className:ce.title,children:"Agent-native engineering OS"}),e.jsx("p",{className:ce.subtitle,children:"Authenticated fleet intelligence. Observation only."})]}),e.jsxs("div",{className:ce.freshness,"aria-live":"polite",children:[s.status==="refreshing"?e.jsx(ae,{}):null,n?e.jsx(U,{status:n.sourceState,tone:Hx(n),children:n.sourceState}):null]})]}),s.status==="loading"?e.jsxs("section",{className:ce.loading,"aria-label":"Loading Agent OS snapshot",children:[e.jsx(K,{width:"65%"}),e.jsx(K,{width:"90%"}),e.jsx(K,{width:"75%"})]}):s.status==="error"?e.jsxs("section",{className:ce.unavailable,role:"alert",children:[e.jsx("h2",{children:"Agent OS snapshot unavailable"}),e.jsx("p",{children:s.error?.message??"The read-only Agent OS endpoint could not be reached."}),e.jsx("p",{className:ce.boundary,children:"No capability, value, or next-action values are inferred when the source cannot be read."})]}):n&&a&&n.snapshot?e.jsx(Tx,{snapshot:n.snapshot}):n?e.jsxs("section",{className:ce.unavailable,role:"status",children:[e.jsxs("div",{className:ce.unavailableHeading,children:[e.jsx("h2",{children:n.sourceState==="missing"?"No Agent OS snapshot yet":"Agent OS snapshot degraded"}),e.jsx(U,{status:n.authentication,tone:n.authentication==="authenticated"?"success":"warning"})]}),e.jsx("p",{children:Ux(n)}),e.jsx("p",{className:ce.boundary,children:"The cockpit remains hidden until a complete authenticated observation-only snapshot is available."})]}):e.jsxs("section",{className:ce.unavailable,role:"status",children:[e.jsx("h2",{children:"Agent OS snapshot unavailable"}),e.jsx("p",{children:"No response was provided by the read-only Agent OS endpoint."})]})]})}function Wx(){return e.jsx(nr,{children:e.jsxs(X,{element:e.jsx(po,{}),children:[e.jsx(X,{index:!0,element:e.jsx(js,{to:"/overview",replace:!0})}),gn.map(t=>t.implemented?null:e.jsx(X,{path:t.path,element:e.jsx(jo,{title:t.label,description:t.description})},t.path)),e.jsx(X,{path:"/overview",element:e.jsx(ri,{})}),e.jsx(X,{path:"/agent-os",element:e.jsx(Gx,{})}),e.jsx(X,{path:"/universe",element:e.jsx(Xn,{})}),e.jsx(X,{path:"/journal",element:e.jsx(Dc,{})}),e.jsx(X,{path:"/intelligence/pulse",element:e.jsx(Kc,{})}),e.jsx(X,{path:"/intelligence/genome",element:e.jsx(bd,{})}),e.jsx(X,{path:"/intelligence/production",element:e.jsx(Ud,{})}),e.jsx(X,{path:"/portfolio",element:e.jsx(uu,{})}),e.jsx(X,{path:"/work/runs",element:e.jsx(Uu,{})}),e.jsx(X,{path:"/work/runs/:id",element:e.jsx(xh,{})}),e.jsx(X,{path:"/work/swarms",element:e.jsx(Gh,{})}),e.jsx(X,{path:"/work/swarms/:id",element:e.jsx(Bm,{})}),e.jsx(X,{path:"/control/daemon",element:e.jsx(op,{})}),e.jsx(X,{path:"/control/fleet",element:e.jsx(Lp,{})}),e.jsx(X,{path:"/control/security",element:e.jsx(tf,{})}),e.jsx(X,{path:"/goals",element:e.jsx(Cf,{})}),e.jsx(X,{path:"/inbox",element:e.jsx(qs,{})}),e.jsx(X,{path:"/inbox/:id",element:e.jsx(qs,{})}),e.jsx(X,{path:"*",element:e.jsx(js,{to:"/overview",replace:!0})})]})})}function Qx(t){c.useEffect(()=>{if(t!=="checking")return;let s=!1;return ft(Me.key,Me.fetch).then(()=>{if(s)return;const n=at(Me.key);Dn(n.status==="success")}),()=>{s=!0}},[t])}function ig(){const t=Tn();return Qx(t),e.jsx(Yn,{children:t==="checking"?e.jsx("div",{"aria-live":"polite",className:"visually-hidden",children:"Checking for an existing session…"}):t==="unauthenticated"?e.jsx(En,{}):e.jsxs(Sr,{children:[e.jsx(An,{}),e.jsx(Wx,{})]})})}export{ig as App};
16
- //# sourceMappingURL=App-CsbPYQqy.js.map