@usine/server 0.4.1-next.325.g79174da.1.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/README.md +7 -1
  2. package/dist/auth/api.d.ts +108 -0
  3. package/dist/auth/api.d.ts.map +1 -0
  4. package/dist/auth/api.js +109 -0
  5. package/dist/auth/api.js.map +1 -0
  6. package/dist/auth/http.d.ts.map +1 -1
  7. package/dist/auth/http.js +26 -33
  8. package/dist/auth/http.js.map +1 -1
  9. package/dist/http.d.ts.map +1 -1
  10. package/dist/http.js +2 -1
  11. package/dist/http.js.map +1 -1
  12. package/dist/openapi.d.ts +6 -0
  13. package/dist/openapi.d.ts.map +1 -0
  14. package/dist/openapi.js +68 -0
  15. package/dist/openapi.js.map +1 -0
  16. package/dist/web/assets/_agent-DduvwaVK.js +1 -0
  17. package/dist/web/assets/_label-CeJTfdyr.js +1 -0
  18. package/dist/web/assets/{_loop-CI8wT73I.js → _loop-xu3sbDMH.js} +1 -1
  19. package/dist/web/assets/{_name-BIiHdJIM.js → _name-DHJA0DfK.js} +1 -1
  20. package/dist/web/assets/{_number-DOftkarN.js → _number-CxL2Fcpl.js} +1 -1
  21. package/dist/web/assets/_number-DAq4EEnO.js +1 -0
  22. package/dist/web/assets/{_number-zDnuidOW.js → _number-DlcNbQyC.js} +1 -1
  23. package/dist/web/assets/_project-DAq4EEnO.js +1 -0
  24. package/dist/web/assets/{_project-DwYWqZaq.js → _project-DwpEglrZ.js} +1 -1
  25. package/dist/web/assets/{_project-CVPqKw8_.js → _project-GK2-urBn.js} +1 -1
  26. package/dist/web/assets/_run-DAq4EEnO.js +1 -0
  27. package/dist/web/assets/{_run-B4-87ibA.js → _run-jX-octY4.js} +1 -1
  28. package/dist/web/assets/{_worker-BBfkUdTZ.js → _worker-C_Nw6Vto.js} +1 -1
  29. package/dist/web/assets/{action-CAwzK5mk.js → action-CniC234z.js} +1 -1
  30. package/dist/web/assets/{actions-BXWVnBF3.js → actions-BJ8FViiC.js} +1 -1
  31. package/dist/web/assets/{agents-BStm1azV.js → agents-BD_MpjbH.js} +1 -1
  32. package/dist/web/assets/agents-Csj7pU8B.js +1 -0
  33. package/dist/web/assets/api-D3RWLycx.js +335 -0
  34. package/dist/web/assets/{code-block-CgYM2MuQ.js → code-block-d5zwBZo-.js} +1 -1
  35. package/dist/web/assets/{drawer-BB7jwe-O.js → drawer-D6KxeZBZ.js} +1 -1
  36. package/dist/web/assets/{edit-and-retry-B0OIPvbt.js → edit-and-retry-BKxt-FIG.js} +1 -1
  37. package/dist/web/assets/{file-error-DeQv_cj8.js → file-error-LMdCcTon.js} +1 -1
  38. package/dist/web/assets/{history-Dg2dL6yf.js → history-34nvr9sY.js} +1 -1
  39. package/dist/web/assets/{index-BGr-Cg-z.js → index-B_6qmKij.js} +3 -3
  40. package/dist/web/assets/{label-badge-C3PtxhEk.js → label-badge-cRUT7_pk.js} +1 -1
  41. package/dist/web/assets/{labels-DFfLQe0K.js → labels-BGCA9v1C.js} +1 -1
  42. package/dist/web/assets/{list-CHD0VbJL.js → list-qM2KUYvo.js} +1 -1
  43. package/dist/web/assets/loops-BXqvj3ko.js +1 -0
  44. package/dist/web/assets/{members-Cl_WCHwt.js → members-B14AFaH7.js} +1 -1
  45. package/dist/web/assets/{model-D9QKZ_Hk.js → model-C6gErpq3.js} +1 -1
  46. package/dist/web/assets/{moves-BQl144Rz.js → moves-BYTLKqNE.js} +1 -1
  47. package/dist/web/assets/{not-found-C8JhxsFV.js → not-found-CCicx33l.js} +1 -1
  48. package/dist/web/assets/{outcome-Bmu_N2Ni.js → outcome-D5IWnu4P.js} +1 -1
  49. package/dist/web/assets/{overview-CUn9OtUH.js → overview-DLYaCoiG.js} +1 -1
  50. package/dist/web/assets/{page-CmRQu9F2.js → page-BEpkTOW0.js} +1 -1
  51. package/dist/web/assets/{projects-D7j8WXJK.js → projects-B6PO2z2B.js} +1 -1
  52. package/dist/web/assets/{queries-Cvt0xQVN.js → queries-Bhp4FeLT.js} +1 -1
  53. package/dist/web/assets/{queries-CKjxlPEk.js → queries-CU77zJnf.js} +1 -1
  54. package/dist/web/assets/{queries-D5TGw8Nr.js → queries-C_qC_nGu.js} +1 -1
  55. package/dist/web/assets/{queries-Cdfj6CtB.js → queries-ESTqS3FK.js} +1 -1
  56. package/dist/web/assets/{repositories-B_mXysRY.js → repositories-Db6PsyxS.js} +1 -1
  57. package/dist/web/assets/{repository-link-B7-4fVcX.js → repository-link-OOfhq6c8.js} +1 -1
  58. package/dist/web/assets/route-D8Nd9ZwI.js +1 -0
  59. package/dist/web/assets/route-DjjbuG-J.js +1 -0
  60. package/dist/web/assets/{route-status-tny9_oCm.js → route-status-Cxocu6W_.js} +1 -1
  61. package/dist/web/assets/routes-DAq4EEnO.js +1 -0
  62. package/dist/web/assets/{routes-DRogv1gQ.js → routes-Dq3R4rSX.js} +1 -1
  63. package/dist/web/assets/{run-again-DVg9Ncn3.js → run-again-DHlW6Dcb.js} +1 -1
  64. package/dist/web/assets/{section-CjCP4gvu.js → section-C75aUrac.js} +1 -1
  65. package/dist/web/assets/{section-Du_ZZiFG.js → section-Db-f1liW.js} +1 -1
  66. package/dist/web/assets/{section-BjpSGYua.js → section-Wflvjspx.js} +1 -1
  67. package/dist/web/assets/{settings-DlN91oPk.js → settings-CpA5zhaC.js} +1 -1
  68. package/dist/web/assets/{sign-in-i_b9opnw.js → sign-in-D5kDf9C5.js} +1 -1
  69. package/dist/web/assets/{strings-DhGEKt5X.js → strings-DmAVtEUC.js} +1 -1
  70. package/dist/web/assets/tasks-DAq4EEnO.js +1 -0
  71. package/dist/web/assets/{tasks-DG6D0ByG.js → tasks-Dmzf4nUy.js} +1 -1
  72. package/dist/web/assets/{tokens-Dfsm5C2T.js → tokens-BHREcyDp.js} +1 -1
  73. package/dist/web/assets/{usage-cNWB4RMb.js → usage-ZTnmWdRP.js} +1 -1
  74. package/dist/web/assets/{use-project-links-C3F9c85T.js → use-project-links-CdgpfpoU.js} +1 -1
  75. package/dist/web/assets/{useTriggerFocusGuards-BEdypEdV.js → useTriggerFocusGuards-u-Jz4hr2.js} +1 -1
  76. package/dist/web/assets/{workers-DkgWKjiI.js → workers-D8lcf3zo.js} +1 -1
  77. package/dist/web/index.html +12 -12
  78. package/package.json +11 -10
  79. package/dist/web/assets/_agent-DIZrJ2oZ.js +0 -1
  80. package/dist/web/assets/_label-DMFWLPtF.js +0 -1
  81. package/dist/web/assets/_number-Bn_57si9.js +0 -1
  82. package/dist/web/assets/_project-Bn_57si9.js +0 -1
  83. package/dist/web/assets/_run-Bn_57si9.js +0 -1
  84. package/dist/web/assets/agents-BZV7-W7e.js +0 -1
  85. package/dist/web/assets/api-CoJQoiOc.js +0 -335
  86. package/dist/web/assets/loops-CRPsfOzn.js +0 -1
  87. package/dist/web/assets/route-Di3rgfZ0.js +0 -1
  88. package/dist/web/assets/route-DjL-s2L0.js +0 -1
  89. package/dist/web/assets/routes-Bn_57si9.js +0 -1
  90. package/dist/web/assets/tasks-Bn_57si9.js +0 -1
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{w as t}from"./index-BGr-Cg-z.js";var n=e(),r=(e,t)=>parseInt(e.slice(t,t+2),16),i=e=>{let t=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(r(e,0))+.7152*t(r(e,2))+.0722*t(r(e,4))},a=e=>{let t=Math.max(0,.55-i(e))/.55;if(t===0)return`#${e}`;let n=n=>Math.round(r(e,n)+(255-r(e,n))*t*.7);return`rgb(${n(0)} ${n(2)} ${n(4)})`},o=({name:e,label:r,className:i})=>r===void 0||r.color===null?(0,n.jsx)(t,{variant:`outline`,className:i,children:e}):(0,n.jsx)(t,{variant:`outline`,className:i,title:r.description??void 0,style:{color:a(r.color),borderColor:`#${r.color}66`,backgroundColor:`#${r.color}1f`},children:e});export{o as t};
1
+ import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{w as t}from"./index-B_6qmKij.js";var n=e(),r=(e,t)=>parseInt(e.slice(t,t+2),16),i=e=>{let t=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(r(e,0))+.7152*t(r(e,2))+.0722*t(r(e,4))},a=e=>{let t=Math.max(0,.55-i(e))/.55;if(t===0)return`#${e}`;let n=n=>Math.round(r(e,n)+(255-r(e,n))*t*.7);return`rgb(${n(0)} ${n(2)} ${n(4)})`},o=({name:e,label:r,className:i})=>r===void 0||r.color===null?(0,n.jsx)(t,{variant:`outline`,className:i,children:e}):(0,n.jsx)(t,{variant:`outline`,className:i,title:r.description??void 0,style:{color:a(r.color),borderColor:`#${r.color}66`,backgroundColor:`#${r.color}1f`},children:e});export{o as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{s as t,t as n,x as r}from"./section-Du_ZZiFG.js";import{t as i}from"./useSuspenseQuery-ajaZl96Y.js";import{t as a}from"./link-3oQYoIpm.js";import{kn as o}from"./api-CoJQoiOc.js";import{n as s}from"./queries-D5TGw8Nr.js";import{t as c}from"./label-badge-C3PtxhEk.js";var l=e(),u=()=>{let{data:e}=i(s());return(0,l.jsxs)(n,{title:`Labels`,createKind:`label`,children:[e.labels.length===0&&(0,l.jsx)(t,{title:r.noLabels,children:r.addLabel}),(0,l.jsx)(`ul`,{className:`divide-y border-y`,children:e.labels.map(e=>(0,l.jsxs)(`li`,{className:`flex min-w-0 flex-wrap gap-x-4 gap-y-1 py-3 wrap-anywhere`,children:[(0,l.jsx)(a,{to:`/configuration/labels/$label`,params:{label:e.name},className:`text-primary hover:underline`,children:(0,l.jsx)(c,{name:e.name,label:{name:e.name,color:o(e.color),description:o(e.description)}})}),(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:o(e.description)})]},e.name))})]})};export{u as component};
1
+ import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{s as t,t as n,x as r}from"./section-Db-f1liW.js";import{t as i}from"./useSuspenseQuery-ajaZl96Y.js";import{t as a}from"./link-3oQYoIpm.js";import{kn as o}from"./api-D3RWLycx.js";import{n as s}from"./queries-C_qC_nGu.js";import{t as c}from"./label-badge-cRUT7_pk.js";var l=e(),u=()=>{let{data:e}=i(s());return(0,l.jsxs)(n,{title:`Labels`,createKind:`label`,children:[e.labels.length===0&&(0,l.jsx)(t,{title:r.noLabels,children:r.addLabel}),(0,l.jsx)(`ul`,{className:`divide-y border-y`,children:e.labels.map(e=>(0,l.jsxs)(`li`,{className:`flex min-w-0 flex-wrap gap-x-4 gap-y-1 py-3 wrap-anywhere`,children:[(0,l.jsx)(a,{to:`/configuration/labels/$label`,params:{label:e.name},className:`text-primary hover:underline`,children:(0,l.jsx)(c,{name:e.name,label:{name:e.name,color:o(e.color),description:o(e.description)}})}),(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:o(e.description)})]},e.name))})]})};export{u as component};
@@ -1 +1 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{T as r,Z as i,c as a,d as o,h as s,l as c,s as l,t as u,v as d,w as f}from"./section-Du_ZZiFG.js";import{n as p}from"./use-project-links-C3F9c85T.js";import{a as m,n as h}from"./queries-Cvt0xQVN.js";import{n as g}from"./useNavigate-I5E4IRt2.js";import{t as _}from"./link-3oQYoIpm.js";import{W as v,t as y}from"./button-CzVqBv_O.js";import{i as b,n as x,o as S,r as C,t as w}from"./dialog-CkviH6m-.js";import{l as T}from"./api-CoJQoiOc.js";import{x as E}from"./strings-BIVdGoBr.js";import{t as D}from"./error-alert-Bq-SD6of.js";import{E as O}from"./index-BGr-Cg-z.js";import{r as k}from"./status-badge-B2-vzEoZ.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./table-CKp2wE4u.js";import{t as I}from"./fill-cell-BtM3J7oO.js";var L=e(t(),1),R=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,28H160a20,20,0,0,0-20,20V208a20,20,0,0,0,20,20h40a20,20,0,0,0,20-20V48A20,20,0,0,0,200,28Zm-4,176H164V52h32ZM96,28H56A20,20,0,0,0,36,48V208a20,20,0,0,0,20,20H96a20,20,0,0,0,20-20V48A20,20,0,0,0,96,28ZM92,204H60V52H92Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M208,48V208a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8h40A8,8,0,0,1,208,48ZM96,40H56a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,34H160a14,14,0,0,0-14,14V208a14,14,0,0,0,14,14h40a14,14,0,0,0,14-14V48A14,14,0,0,0,200,34Zm2,174a2,2,0,0,1-2,2H160a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2h40a2,2,0,0,1,2,2ZM96,34H56A14,14,0,0,0,42,48V208a14,14,0,0,0,14,14H96a14,14,0,0,0,14-14V48A14,14,0,0,0,96,34Zm2,174a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H96a2,2,0,0,1,2,2Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,36H160a12,12,0,0,0-12,12V208a12,12,0,0,0,12,12h40a12,12,0,0,0,12-12V48A12,12,0,0,0,200,36Zm4,172a4,4,0,0,1-4,4H160a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4h40a4,4,0,0,1,4,4ZM96,36H56A12,12,0,0,0,44,48V208a12,12,0,0,0,12,12H96a12,12,0,0,0,12-12V48A12,12,0,0,0,96,36Zm4,172a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H96a4,4,0,0,1,4,4Z`}))]]),z=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M234.49,111.07,90.41,22.94A20,20,0,0,0,60,39.87V216.13a20,20,0,0,0,30.41,16.93l144.08-88.13a19.82,19.82,0,0,0,0-33.86ZM84,208.85V47.15L216.16,128Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M228.23,134.69,84.15,222.81A8,8,0,0,1,72,216.12V39.88a8,8,0,0,1,12.15-6.69l144.08,88.12A7.82,7.82,0,0,1,228.23,134.69Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M231.36,116.19,87.28,28.06a14,14,0,0,0-14.18-.27A13.69,13.69,0,0,0,66,39.87V216.13a13.69,13.69,0,0,0,7.1,12.08,14,14,0,0,0,14.18-.27l144.08-88.13a13.82,13.82,0,0,0,0-23.62Zm-6.26,13.38L81,217.7a2,2,0,0,1-2.06,0,1.78,1.78,0,0,1-1-1.61V39.87a1.78,1.78,0,0,1,1-1.61A2.06,2.06,0,0,1,80,38a2,2,0,0,1,1,.31L225.1,126.43a1.82,1.82,0,0,1,0,3.14Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M230.32,117.9,86.24,29.79a11.91,11.91,0,0,0-12.17-.23A11.71,11.71,0,0,0,68,39.89V216.11a11.71,11.71,0,0,0,6.07,10.33,11.91,11.91,0,0,0,12.17-.23L230.32,138.1a11.82,11.82,0,0,0,0-20.2Zm-4.18,13.37L82.06,219.39a4,4,0,0,1-4.07.07,3.77,3.77,0,0,1-2-3.35V39.89a3.77,3.77,0,0,1,2-3.35,4,4,0,0,1,4.07.07l144.08,88.12a3.8,3.8,0,0,1,0,6.54Z`}))]]),B=L.forwardRef((e,t)=>L.createElement(v,{ref:t,...e,weights:R}));B.displayName=`PauseIcon`;var V=L.forwardRef((e,t)=>L.createElement(v,{ref:t,...e,weights:z}));V.displayName=`PlayIcon`;var H=n(),U=({paused:e})=>(0,H.jsx)(k,{state:e?`paused`:`live`,label:e?`Paused`:`Active`}),W=({name:e,pause:t,close:n})=>{let a=p({...h(i(`loop`,e)),staleTime:0}),o=p({...m(new T({name:e,value:a.data?.value??null})),enabled:a.isSuccess&&!a.isFetching}),s=a.isSuccess&&!a.isFetching&&o.isSuccess&&!o.isFetching;return(0,H.jsx)(w,{open:!0,onOpenChange:e=>{!e&&!t.isPending&&n()},children:(0,H.jsxs)(x,{onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(S,{children:[r.confirm,`: `,e]}),(0,H.jsx)(C,{children:r.resumeHint}),a.isError&&(0,H.jsx)(D,{message:a.error.message}),o.isError&&(0,H.jsx)(D,{message:o.error.message}),t.isError&&(0,H.jsx)(D,{message:t.error.message}),!s&&!a.isError&&!o.isError&&(0,H.jsx)(`p`,{role:`status`,children:r.previewing}),s&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{children:r.count(o.data.total,o.data.total)}),o.data.stream===`schedule`&&(0,H.jsx)(`p`,{children:r.schedule}),o.data.repositoriesWithoutItems.length>0&&(0,H.jsx)(`p`,{children:r.noData(o.data.repositoriesWithoutItems)}),o.data.failures.map((e,t)=>(0,H.jsx)(D,{message:e.message},`${e.itemKey}:${t}`))]}),(0,H.jsxs)(b,{children:[(0,H.jsx)(y,{variant:`ghost`,disabled:t.isPending,onClick:n,children:r.cancel}),(0,H.jsx)(y,{disabled:!s||t.isPending,onClick:()=>t.mutate({loop:e,paused:!0},{onSuccess:n}),children:r.resume})]})]})})},G=({loop:e,pause:t,variant:n})=>{let[r,i]=(0,L.useState)(!1),a=t.isPending&&t.variables.loop===e.name;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(O,{command:`${e.paused?`Resume`:`Pause`} ${e.name}`,variant:n,disabled:t.isPending,className:n===`ghost`?`text-muted-foreground`:void 0,onClick:n=>{n.stopPropagation(),e.paused?i(!0):t.mutate({loop:e.name,paused:!1})},children:[e.paused?(0,H.jsx)(V,{"data-icon":`inline-start`,"aria-hidden":`true`}):(0,H.jsx)(B,{"data-icon":`inline-start`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:n===`ghost`?`max-sm:sr-only`:void 0,children:a?e.paused?`Resuming…`:`Pausing…`:e.paused?`Resume`:`Pause`}),n===`ghost`&&(0,H.jsxs)(`span`,{className:`sr-only`,children:[` `,e.name]})]}),r&&(0,H.jsx)(W,{name:e.name,pause:t,close:()=>i(!1)})]})},K=({loop:e,pause:t,projects:n})=>{let r=n.find(t=>e.name.startsWith(`${t.id}/`)),i=g(),a={loop:e.name};return(0,H.jsxs)(c,{open:()=>void i({to:`/configuration/loops/$loop`,params:a}),children:[(0,H.jsx)(P,{className:`py-3`,children:(0,H.jsx)(_,{to:`/configuration/loops/$loop`,params:a,onClick:e=>e.stopPropagation(),className:o,children:e.name.split(`/`).at(-1)})}),(0,H.jsx)(P,{className:`max-w-40 whitespace-normal`,children:r===void 0?`—`:(0,H.jsx)(_,{to:`/configuration/projects/$project`,params:{project:r.id},onClick:e=>e.stopPropagation(),className:`text-primary hover:underline`,children:r.name})}),(0,H.jsx)(P,{children:E(e.stream)}),(0,H.jsx)(I,{className:`hidden lg:table-cell`,children:(0,H.jsx)(`code`,{className:`block truncate font-mono text-xs text-muted-foreground [font-variant-ligatures:none]`,title:e.condition,children:e.condition})}),(0,H.jsx)(P,{className:`hidden sm:table-cell`,children:e.agent}),(0,H.jsx)(P,{className:`hidden md:table-cell`,children:d[e.approval]}),(0,H.jsx)(P,{children:(0,H.jsx)(U,{paused:e.paused})}),(0,H.jsx)(P,{className:`text-right`,children:t!==null&&(0,H.jsx)(G,{loop:e,pause:t,variant:`ghost`})})]})},q=({loop:e})=>{let t=g(),n={loop:e.name};return(0,H.jsxs)(c,{open:()=>void t({to:`/configuration/loops/$loop`,params:n}),children:[(0,H.jsx)(P,{className:`py-3`,children:(0,H.jsx)(_,{to:`/configuration/loops/$loop`,params:n,onClick:e=>e.stopPropagation(),className:o,children:e.name})}),(0,H.jsx)(P,{colSpan:5,className:`max-w-0`,children:(0,H.jsx)(`p`,{className:`truncate text-destructive`,title:e.error.message,children:e.error.message})}),(0,H.jsx)(P,{children:(0,H.jsx)(a,{})}),(0,H.jsx)(P,{})]})},J=({configuration:e,pause:t})=>(0,H.jsxs)(u,{title:`Loops`,createKind:`loop`,counts:f(e),children:[t?.isError===!0&&(0,H.jsx)(D,{message:t.error.message}),e.loops.length===0&&e.quarantinedLoops.length===0?(0,H.jsx)(l,{title:`No loops`,children:s}):(0,H.jsx)(`div`,{className:`-mx-2`,children:(0,H.jsxs)(F,{children:[(0,H.jsx)(A,{children:(0,H.jsxs)(N,{className:`hover:bg-transparent`,children:[(0,H.jsx)(j,{className:`lg:w-56`,children:`Loop`}),(0,H.jsx)(j,{children:`Project`}),(0,H.jsx)(j,{children:`Trigger`}),(0,H.jsx)(j,{className:`hidden lg:table-cell`,children:`Condition`}),(0,H.jsx)(j,{className:`hidden sm:table-cell`,children:`Agent`}),(0,H.jsx)(j,{className:`hidden md:table-cell`,children:`Approval`}),(0,H.jsx)(j,{children:`State`}),(0,H.jsx)(j,{children:(0,H.jsx)(`span`,{className:`sr-only`,children:`Action`})})]})}),(0,H.jsxs)(M,{children:[e.quarantinedLoops.map(e=>(0,H.jsx)(q,{loop:e},e.file)),e.loops.map(n=>(0,H.jsx)(K,{loop:n,pause:t,projects:e.projects},n.name))]})]})})]});export{G as n,U as r,J as t};
1
+ import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{T as r,Z as i,c as a,d as o,h as s,l as c,s as l,t as u,v as d,w as f}from"./section-Db-f1liW.js";import{n as p}from"./use-project-links-CdgpfpoU.js";import{a as m,n as h}from"./queries-Bhp4FeLT.js";import{n as g}from"./useNavigate-I5E4IRt2.js";import{t as _}from"./link-3oQYoIpm.js";import{W as v,t as y}from"./button-CzVqBv_O.js";import{i as b,n as x,o as S,r as C,t as w}from"./dialog-CkviH6m-.js";import{l as T}from"./api-D3RWLycx.js";import{x as E}from"./strings-BIVdGoBr.js";import{t as D}from"./error-alert-Bq-SD6of.js";import{E as O}from"./index-B_6qmKij.js";import{r as k}from"./status-badge-B2-vzEoZ.js";import{a as A,i as j,n as M,o as N,r as P,t as F}from"./table-CKp2wE4u.js";import{t as I}from"./fill-cell-BtM3J7oO.js";var L=e(t(),1),R=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,28H160a20,20,0,0,0-20,20V208a20,20,0,0,0,20,20h40a20,20,0,0,0,20-20V48A20,20,0,0,0,200,28Zm-4,176H164V52h32ZM96,28H56A20,20,0,0,0,36,48V208a20,20,0,0,0,20,20H96a20,20,0,0,0,20-20V48A20,20,0,0,0,96,28ZM92,204H60V52H92Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M208,48V208a8,8,0,0,1-8,8H160a8,8,0,0,1-8-8V48a8,8,0,0,1,8-8h40A8,8,0,0,1,208,48ZM96,40H56a8,8,0,0,0-8,8V208a8,8,0,0,0,8,8H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M216,48V208a16,16,0,0,1-16,16H160a16,16,0,0,1-16-16V48a16,16,0,0,1,16-16h40A16,16,0,0,1,216,48ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,34H160a14,14,0,0,0-14,14V208a14,14,0,0,0,14,14h40a14,14,0,0,0,14-14V48A14,14,0,0,0,200,34Zm2,174a2,2,0,0,1-2,2H160a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2h40a2,2,0,0,1,2,2ZM96,34H56A14,14,0,0,0,42,48V208a14,14,0,0,0,14,14H96a14,14,0,0,0,14-14V48A14,14,0,0,0,96,34Zm2,174a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V48a2,2,0,0,1,2-2H96a2,2,0,0,1,2,2Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,32H160a16,16,0,0,0-16,16V208a16,16,0,0,0,16,16h40a16,16,0,0,0,16-16V48A16,16,0,0,0,200,32Zm0,176H160V48h40ZM96,32H56A16,16,0,0,0,40,48V208a16,16,0,0,0,16,16H96a16,16,0,0,0,16-16V48A16,16,0,0,0,96,32Zm0,176H56V48H96Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M200,36H160a12,12,0,0,0-12,12V208a12,12,0,0,0,12,12h40a12,12,0,0,0,12-12V48A12,12,0,0,0,200,36Zm4,172a4,4,0,0,1-4,4H160a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4h40a4,4,0,0,1,4,4ZM96,36H56A12,12,0,0,0,44,48V208a12,12,0,0,0,12,12H96a12,12,0,0,0,12-12V48A12,12,0,0,0,96,36Zm4,172a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V48a4,4,0,0,1,4-4H96a4,4,0,0,1,4,4Z`}))]]),z=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M234.49,111.07,90.41,22.94A20,20,0,0,0,60,39.87V216.13a20,20,0,0,0,30.41,16.93l144.08-88.13a19.82,19.82,0,0,0,0-33.86ZM84,208.85V47.15L216.16,128Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M228.23,134.69,84.15,222.81A8,8,0,0,1,72,216.12V39.88a8,8,0,0,1,12.15-6.69l144.08,88.12A7.82,7.82,0,0,1,228.23,134.69Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M240,128a15.74,15.74,0,0,1-7.6,13.51L88.32,229.65a16,16,0,0,1-16.2.3A15.86,15.86,0,0,1,64,216.13V39.87a15.86,15.86,0,0,1,8.12-13.82,16,16,0,0,1,16.2.3L232.4,114.49A15.74,15.74,0,0,1,240,128Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M231.36,116.19,87.28,28.06a14,14,0,0,0-14.18-.27A13.69,13.69,0,0,0,66,39.87V216.13a13.69,13.69,0,0,0,7.1,12.08,14,14,0,0,0,14.18-.27l144.08-88.13a13.82,13.82,0,0,0,0-23.62Zm-6.26,13.38L81,217.7a2,2,0,0,1-2.06,0,1.78,1.78,0,0,1-1-1.61V39.87a1.78,1.78,0,0,1,1-1.61A2.06,2.06,0,0,1,80,38a2,2,0,0,1,1,.31L225.1,126.43a1.82,1.82,0,0,1,0,3.14Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M232.4,114.49,88.32,26.35a16,16,0,0,0-16.2-.3A15.86,15.86,0,0,0,64,39.87V216.13A15.94,15.94,0,0,0,80,232a16.07,16.07,0,0,0,8.36-2.35L232.4,141.51a15.81,15.81,0,0,0,0-27ZM80,215.94V40l143.83,88Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M230.32,117.9,86.24,29.79a11.91,11.91,0,0,0-12.17-.23A11.71,11.71,0,0,0,68,39.89V216.11a11.71,11.71,0,0,0,6.07,10.33,11.91,11.91,0,0,0,12.17-.23L230.32,138.1a11.82,11.82,0,0,0,0-20.2Zm-4.18,13.37L82.06,219.39a4,4,0,0,1-4.07.07,3.77,3.77,0,0,1-2-3.35V39.89a3.77,3.77,0,0,1,2-3.35,4,4,0,0,1,4.07.07l144.08,88.12a3.8,3.8,0,0,1,0,6.54Z`}))]]),B=L.forwardRef((e,t)=>L.createElement(v,{ref:t,...e,weights:R}));B.displayName=`PauseIcon`;var V=L.forwardRef((e,t)=>L.createElement(v,{ref:t,...e,weights:z}));V.displayName=`PlayIcon`;var H=n(),U=({paused:e})=>(0,H.jsx)(k,{state:e?`paused`:`live`,label:e?`Paused`:`Active`}),W=({name:e,pause:t,close:n})=>{let a=p({...h(i(`loop`,e)),staleTime:0}),o=p({...m(new T({name:e,value:a.data?.value??null})),enabled:a.isSuccess&&!a.isFetching}),s=a.isSuccess&&!a.isFetching&&o.isSuccess&&!o.isFetching;return(0,H.jsx)(w,{open:!0,onOpenChange:e=>{!e&&!t.isPending&&n()},children:(0,H.jsxs)(x,{onClick:e=>e.stopPropagation(),children:[(0,H.jsxs)(S,{children:[r.confirm,`: `,e]}),(0,H.jsx)(C,{children:r.resumeHint}),a.isError&&(0,H.jsx)(D,{message:a.error.message}),o.isError&&(0,H.jsx)(D,{message:o.error.message}),t.isError&&(0,H.jsx)(D,{message:t.error.message}),!s&&!a.isError&&!o.isError&&(0,H.jsx)(`p`,{role:`status`,children:r.previewing}),s&&(0,H.jsxs)(`div`,{className:`space-y-2`,children:[(0,H.jsx)(`p`,{children:r.count(o.data.total,o.data.total)}),o.data.stream===`schedule`&&(0,H.jsx)(`p`,{children:r.schedule}),o.data.repositoriesWithoutItems.length>0&&(0,H.jsx)(`p`,{children:r.noData(o.data.repositoriesWithoutItems)}),o.data.failures.map((e,t)=>(0,H.jsx)(D,{message:e.message},`${e.itemKey}:${t}`))]}),(0,H.jsxs)(b,{children:[(0,H.jsx)(y,{variant:`ghost`,disabled:t.isPending,onClick:n,children:r.cancel}),(0,H.jsx)(y,{disabled:!s||t.isPending,onClick:()=>t.mutate({loop:e,paused:!0},{onSuccess:n}),children:r.resume})]})]})})},G=({loop:e,pause:t,variant:n})=>{let[r,i]=(0,L.useState)(!1),a=t.isPending&&t.variables.loop===e.name;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(O,{command:`${e.paused?`Resume`:`Pause`} ${e.name}`,variant:n,disabled:t.isPending,className:n===`ghost`?`text-muted-foreground`:void 0,onClick:n=>{n.stopPropagation(),e.paused?i(!0):t.mutate({loop:e.name,paused:!1})},children:[e.paused?(0,H.jsx)(V,{"data-icon":`inline-start`,"aria-hidden":`true`}):(0,H.jsx)(B,{"data-icon":`inline-start`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:n===`ghost`?`max-sm:sr-only`:void 0,children:a?e.paused?`Resuming…`:`Pausing…`:e.paused?`Resume`:`Pause`}),n===`ghost`&&(0,H.jsxs)(`span`,{className:`sr-only`,children:[` `,e.name]})]}),r&&(0,H.jsx)(W,{name:e.name,pause:t,close:()=>i(!1)})]})},K=({loop:e,pause:t,projects:n})=>{let r=n.find(t=>e.name.startsWith(`${t.id}/`)),i=g(),a={loop:e.name};return(0,H.jsxs)(c,{open:()=>void i({to:`/configuration/loops/$loop`,params:a}),children:[(0,H.jsx)(P,{className:`py-3`,children:(0,H.jsx)(_,{to:`/configuration/loops/$loop`,params:a,onClick:e=>e.stopPropagation(),className:o,children:e.name.split(`/`).at(-1)})}),(0,H.jsx)(P,{className:`max-w-40 whitespace-normal`,children:r===void 0?`—`:(0,H.jsx)(_,{to:`/configuration/projects/$project`,params:{project:r.id},onClick:e=>e.stopPropagation(),className:`text-primary hover:underline`,children:r.name})}),(0,H.jsx)(P,{children:E(e.stream)}),(0,H.jsx)(I,{className:`hidden lg:table-cell`,children:(0,H.jsx)(`code`,{className:`block truncate font-mono text-xs text-muted-foreground [font-variant-ligatures:none]`,title:e.condition,children:e.condition})}),(0,H.jsx)(P,{className:`hidden sm:table-cell`,children:e.agent}),(0,H.jsx)(P,{className:`hidden md:table-cell`,children:d[e.approval]}),(0,H.jsx)(P,{children:(0,H.jsx)(U,{paused:e.paused})}),(0,H.jsx)(P,{className:`text-right`,children:t!==null&&(0,H.jsx)(G,{loop:e,pause:t,variant:`ghost`})})]})},q=({loop:e})=>{let t=g(),n={loop:e.name};return(0,H.jsxs)(c,{open:()=>void t({to:`/configuration/loops/$loop`,params:n}),children:[(0,H.jsx)(P,{className:`py-3`,children:(0,H.jsx)(_,{to:`/configuration/loops/$loop`,params:n,onClick:e=>e.stopPropagation(),className:o,children:e.name})}),(0,H.jsx)(P,{colSpan:5,className:`max-w-0`,children:(0,H.jsx)(`p`,{className:`truncate text-destructive`,title:e.error.message,children:e.error.message})}),(0,H.jsx)(P,{children:(0,H.jsx)(a,{})}),(0,H.jsx)(P,{})]})},J=({configuration:e,pause:t})=>(0,H.jsxs)(u,{title:`Loops`,createKind:`loop`,counts:f(e),children:[t?.isError===!0&&(0,H.jsx)(D,{message:t.error.message}),e.loops.length===0&&e.quarantinedLoops.length===0?(0,H.jsx)(l,{title:`No loops`,children:s}):(0,H.jsx)(`div`,{className:`-mx-2`,children:(0,H.jsxs)(F,{children:[(0,H.jsx)(A,{children:(0,H.jsxs)(N,{className:`hover:bg-transparent`,children:[(0,H.jsx)(j,{className:`lg:w-56`,children:`Loop`}),(0,H.jsx)(j,{children:`Project`}),(0,H.jsx)(j,{children:`Trigger`}),(0,H.jsx)(j,{className:`hidden lg:table-cell`,children:`Condition`}),(0,H.jsx)(j,{className:`hidden sm:table-cell`,children:`Agent`}),(0,H.jsx)(j,{className:`hidden md:table-cell`,children:`Approval`}),(0,H.jsx)(j,{children:`State`}),(0,H.jsx)(j,{children:(0,H.jsx)(`span`,{className:`sr-only`,children:`Action`})})]})}),(0,H.jsxs)(M,{children:[e.quarantinedLoops.map(e=>(0,H.jsx)(q,{loop:e},e.file)),e.loops.map(n=>(0,H.jsx)(K,{loop:n,pause:t,projects:e.projects},n.name))]})]})})]});export{G as n,U as r,J as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{t}from"./useSuspenseQuery-ajaZl96Y.js";import{t as n}from"./list-qM2KUYvo.js";import{n as r}from"./queries-C_qC_nGu.js";import{v as i}from"./index-B_6qmKij.js";var a=e(),o=()=>{let{data:e}=t(r());return(0,a.jsx)(n,{configuration:e,pause:i()})};export{o as component};
@@ -1 +1 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{I as r}from"./queryOptions-Bavh4JFe.js";import{t as i}from"./useSuspenseQuery-ajaZl96Y.js";import{t as a}from"./button-CzVqBv_O.js";import{_t as o,gt as s,n as c}from"./api-CoJQoiOc.js";import{i as l}from"./page-CmRQu9F2.js";import{t as u}from"./error-alert-Bq-SD6of.js";import{E as d,Z as f,h as p}from"./index-BGr-Cg-z.js";import{t as m}from"./label-DcQGgkXe.js";var h=e(t(),1),g=`Members`,_=`Every member has admin access to this instance.`,v=`GitHub login`,y=`Add member`,b=`Saving…`,x=`Remove`,S=`Confirm removal`,C=`Keep member`,w=`Added by`,T=n(),E=()=>{let e=r(),{data:t}=i(p()),[n,E]=(0,h.useState)(``),[D,O]=(0,h.useState)(),[k,A]=(0,h.useState)(!1),[j,M]=(0,h.useState)(),N=async(t,n,r)=>{A(!0),M(void 0);try{let i={method:n};r!==void 0&&(i.body=r),await o(t,s,i),E(``),O(void 0),await e.invalidateQueries(p())}catch(e){M(c(e))}finally{A(!1)}};return(0,T.jsxs)(`section`,{className:`space-y-6 p-4 md:p-5`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(l,{title:g}),(0,T.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:_})]}),j!==void 0&&(0,T.jsx)(u,{message:j}),(0,T.jsxs)(`form`,{className:`flex max-w-lg flex-wrap items-end gap-3`,onSubmit:e=>{e.preventDefault(),N(`/api/members`,`POST`,{login:n})},children:[(0,T.jsxs)(`div`,{className:`min-w-48 flex-1 space-y-2`,children:[(0,T.jsx)(m,{htmlFor:`member-login`,children:v}),(0,T.jsx)(f,{id:`member-login`,value:n,onChange:e=>E(e.target.value),autoComplete:`off`,required:!0,maxLength:39})]}),(0,T.jsx)(d,{type:`submit`,command:y,disabled:k||n.trim()===``,children:k?b:y})]}),(0,T.jsx)(`ul`,{className:`divide-y divide-border`,children:t.map(e=>(0,T.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 py-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-sm font-medium`,children:e.login}),(0,T.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[w,` `,e.addedBy,` · `,new Date(e.addedAt).toLocaleDateString()]})]}),(0,T.jsx)(`div`,{className:`flex gap-2`,children:D===e.id?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(a,{variant:`destructive`,disabled:k,onClick:()=>void N(`/api/members/${e.id}`,`DELETE`),children:S}),(0,T.jsx)(a,{variant:`ghost`,onClick:()=>O(void 0),children:C})]}):(0,T.jsx)(d,{command:`${x} · ${e.login}`,variant:`ghost`,disabled:k||t.length===1,onClick:()=>O(e.id),"aria-label":`${x} ${e.login}`,children:x})})]},e.id))})]})};export{E as component};
1
+ import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{I as r}from"./queryOptions-Bavh4JFe.js";import{t as i}from"./useSuspenseQuery-ajaZl96Y.js";import{t as a}from"./button-CzVqBv_O.js";import{_t as o,gt as s,n as c}from"./api-D3RWLycx.js";import{i as l}from"./page-BEpkTOW0.js";import{t as u}from"./error-alert-Bq-SD6of.js";import{E as d,Z as f,h as p}from"./index-B_6qmKij.js";import{t as m}from"./label-DcQGgkXe.js";var h=e(t(),1),g=`Members`,_=`Every member has admin access to this instance.`,v=`GitHub login`,y=`Add member`,b=`Saving…`,x=`Remove`,S=`Confirm removal`,C=`Keep member`,w=`Added by`,T=n(),E=()=>{let e=r(),{data:t}=i(p()),[n,E]=(0,h.useState)(``),[D,O]=(0,h.useState)(),[k,A]=(0,h.useState)(!1),[j,M]=(0,h.useState)(),N=async(t,n,r)=>{A(!0),M(void 0);try{let i={method:n};r!==void 0&&(i.body=r),await o(t,s,i),E(``),O(void 0),await e.invalidateQueries(p())}catch(e){M(c(e))}finally{A(!1)}};return(0,T.jsxs)(`section`,{className:`space-y-6 p-4 md:p-5`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(l,{title:g}),(0,T.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:_})]}),j!==void 0&&(0,T.jsx)(u,{message:j}),(0,T.jsxs)(`form`,{className:`flex max-w-lg flex-wrap items-end gap-3`,onSubmit:e=>{e.preventDefault(),N(`/api/members`,`POST`,{login:n})},children:[(0,T.jsxs)(`div`,{className:`min-w-48 flex-1 space-y-2`,children:[(0,T.jsx)(m,{htmlFor:`member-login`,children:v}),(0,T.jsx)(f,{id:`member-login`,value:n,onChange:e=>E(e.target.value),autoComplete:`off`,required:!0,maxLength:39})]}),(0,T.jsx)(d,{type:`submit`,command:y,disabled:k||n.trim()===``,children:k?b:y})]}),(0,T.jsx)(`ul`,{className:`divide-y divide-border`,children:t.map(e=>(0,T.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 py-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-sm font-medium`,children:e.login}),(0,T.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[w,` `,e.addedBy,` · `,new Date(e.addedAt).toLocaleDateString()]})]}),(0,T.jsx)(`div`,{className:`flex gap-2`,children:D===e.id?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(a,{variant:`destructive`,disabled:k,onClick:()=>void N(`/api/members/${e.id}`,`DELETE`),children:S}),(0,T.jsx)(a,{variant:`ghost`,onClick:()=>O(void 0),children:C})]}):(0,T.jsx)(d,{command:`${x} · ${e.login}`,variant:`ghost`,disabled:k||t.length===1,onClick:()=>O(e.id),"aria-label":`${x} ${e.login}`,children:x})})]},e.id))})]})};export{E as component};
@@ -1 +1 @@
1
- import{a as e}from"./useTriggerFocusGuards-BEdypEdV.js";import{Fn as t,Ln as n,St as r,X as i}from"./api-CoJQoiOc.js";import{C as a,s as o,y as s}from"./strings-BIVdGoBr.js";var c=(e,r)=>{if(e.attempts.length===0)return t();let i=0;for(let n of e.attempts){let e=n.outcome===null?r:n.endedAt===null?NaN:Date.parse(n.endedAt);if(Number.isNaN(e))return t();i+=Math.max(0,e-Date.parse(n.startedAt))}return n(i)},l=e=>{let r=e.attempts.at(-1)?.outcome;return e.state===`Failed`&&r?._tag===`Failed`?n(r.failure):t()},u=e=>{let t=e.attempts.at(-1);return e.closedAt??t?.endedAt??t?.startedAt??e.openedAt},d=(e,t)=>{let n=new Set(t.items.map(({itemKey:e})=>e));return e.filter(({item:e})=>n.has(e.itemKey))},f=(e,t)=>d(e,t)[0]??null,p=({reason:e})=>`run`in e?e.run:null,m=t=>String(e(t).origin.number),h=({reason:e})=>r(e,{AwaitingApproval:()=>!0,WaitingForStop:()=>!0,QueuedForWorker:()=>!0,SuppressedForOperator:()=>!0,CycleBudgetUsedUp:()=>!0,RunFailed:({run:e})=>e.canResolveFailure,ClosedUnchanged:()=>!1,LoopPaused:()=>!1,AwaitingPoll:()=>!1}),g=(e,...t)=>[...e].reverse().find(({state:e})=>t.includes(e)),_=(e,t,n)=>{let r=g(e.runs,`Running`);if(r!==void 0)return{_tag:`Running`,run:r};let a=g(e.runs,`Waiting`);if(a!==void 0)return{_tag:`AwaitingApproval`,run:a};let o=g(e.runs,`Pending`,`Queued`);if(o!==void 0){let e=n.find(e=>p(e)?.id===o.id);return e===void 0?{_tag:`Queued`,run:o}:{_tag:`Stalled`,stall:e,run:o}}if(i(e.state))return{_tag:`Done`};let s=d(n,e),c=s.find(h);if(c!==void 0)return{_tag:`Stalled`,stall:c,run:p(c)??t};let[l]=s;return l===void 0?e.needsYou?{_tag:`NeedsAttention`}:{_tag:`Ended`,run:t}:{_tag:`Idle`,stall:l}},v=({status:e,last:t})=>{switch(e._tag){case`Running`:return[0,Date.parse(e.run.openedAt)];case`AwaitingApproval`:return[1,Date.parse(e.run.openedAt)];case`Queued`:case`Stalled`:return[2,Date.parse(e.run.openedAt)];case`Idle`:case`NeedsAttention`:case`Done`:case`Ended`:return[3,Date.parse(u(t))]}},y=(e,t)=>e.flatMap(({items:e})=>e).flatMap(e=>{let n=e.runs.at(-1);return n===void 0?[]:[{task:e,last:n,status:_(e,n,t)}]}).map(e=>({row:e,place:v(e)})).sort(({row:e,place:[t,n]},{row:r,place:[i,a]})=>t-i||a-n||r.task.number-e.task.number).map(({row:e})=>e),b=[`in flight`,`needs attention`,`done`],x=({task:e,status:t})=>{switch(t._tag){case`Running`:case`AwaitingApproval`:case`Queued`:case`Stalled`:return`in flight`;case`Idle`:return e.needsYou?`needs attention`:null;case`NeedsAttention`:return`needs attention`;case`Done`:return`done`;case`Ended`:return null}},S=e=>{let t=b.flatMap(t=>{let n=e.filter(e=>x(e)===t).length;return n===0?[]:[`${n} ${t}`]});return t.length===0?void 0:t.join(`, `)},C=(e,t)=>e.runningSince.reduce((e,n)=>e+Math.max(0,t-Date.parse(n)),e.durationMillis),w=e=>e.pools.some(({unpriced:e})=>e),T=(e,t)=>{let n=e.flatMap(({task:e})=>e.usage.cost===null?[]:[e.usage.cost]);return{runs:e.reduce((e,{task:t})=>e+t.runs.length,0),durationMillis:e.reduce((e,{task:n})=>e+C(n.usage,t),0),unmeasured:e.reduce((e,{task:t})=>e+t.usage.unmeasured,0),tokens:e.reduce((e,{task:t})=>e+t.usage.tokens,0),unpriced:e.some(({task:e})=>w(e.usage)),usd:n.length===0?null:n.reduce((e,{usd:t})=>e+t,0)}},E=`Some attempts have no recorded timing; the real figure is higher`,D=`Some sessions have no price yet; the real figure is higher`,O=e=>[{figure:String(e.runs),words:e.runs===1?`run`:`runs`,lowerBound:null},{figure:o(e.durationMillis),words:`elapsed`,lowerBound:e.unmeasured>0?E:null},{figure:s(e.tokens),words:`tokens`,lowerBound:null},...e.usd===null?[]:[{figure:a(e.usd),words:`estimated`,lowerBound:e.unpriced?D:null}]],k=e=>{let t=new Map;for(let{loop:n,state:r}of e.runs)t.set(n,r);return[...t].map(([e,t])=>({loop:e,state:t}))},A=e=>{switch(e){case`issue-comment`:return`Comment`;case`review`:return`Review`;case`review-comment`:return`Review comment`}};export{l as a,C as c,y as d,f,E as g,D as h,u as i,k as l,O as m,A as n,p as o,T as p,w as r,S as s,c as t,m as u};
1
+ import{a as e}from"./useTriggerFocusGuards-u-Jz4hr2.js";import{Fn as t,Ln as n,St as r,X as i}from"./api-D3RWLycx.js";import{C as a,s as o,y as s}from"./strings-BIVdGoBr.js";var c=(e,r)=>{if(e.attempts.length===0)return t();let i=0;for(let n of e.attempts){let e=n.outcome===null?r:n.endedAt===null?NaN:Date.parse(n.endedAt);if(Number.isNaN(e))return t();i+=Math.max(0,e-Date.parse(n.startedAt))}return n(i)},l=e=>{let r=e.attempts.at(-1)?.outcome;return e.state===`Failed`&&r?._tag===`Failed`?n(r.failure):t()},u=e=>{let t=e.attempts.at(-1);return e.closedAt??t?.endedAt??t?.startedAt??e.openedAt},d=(e,t)=>{let n=new Set(t.items.map(({itemKey:e})=>e));return e.filter(({item:e})=>n.has(e.itemKey))},f=(e,t)=>d(e,t)[0]??null,p=({reason:e})=>`run`in e?e.run:null,m=t=>String(e(t).origin.number),h=({reason:e})=>r(e,{AwaitingApproval:()=>!0,WaitingForStop:()=>!0,QueuedForWorker:()=>!0,SuppressedForOperator:()=>!0,CycleBudgetUsedUp:()=>!0,RunFailed:({run:e})=>e.canResolveFailure,ClosedUnchanged:()=>!1,LoopPaused:()=>!1,AwaitingPoll:()=>!1}),g=(e,...t)=>[...e].reverse().find(({state:e})=>t.includes(e)),_=(e,t,n)=>{let r=g(e.runs,`Running`);if(r!==void 0)return{_tag:`Running`,run:r};let a=g(e.runs,`Waiting`);if(a!==void 0)return{_tag:`AwaitingApproval`,run:a};let o=g(e.runs,`Pending`,`Queued`);if(o!==void 0){let e=n.find(e=>p(e)?.id===o.id);return e===void 0?{_tag:`Queued`,run:o}:{_tag:`Stalled`,stall:e,run:o}}if(i(e.state))return{_tag:`Done`};let s=d(n,e),c=s.find(h);if(c!==void 0)return{_tag:`Stalled`,stall:c,run:p(c)??t};let[l]=s;return l===void 0?e.needsYou?{_tag:`NeedsAttention`}:{_tag:`Ended`,run:t}:{_tag:`Idle`,stall:l}},v=({status:e,last:t})=>{switch(e._tag){case`Running`:return[0,Date.parse(e.run.openedAt)];case`AwaitingApproval`:return[1,Date.parse(e.run.openedAt)];case`Queued`:case`Stalled`:return[2,Date.parse(e.run.openedAt)];case`Idle`:case`NeedsAttention`:case`Done`:case`Ended`:return[3,Date.parse(u(t))]}},y=(e,t)=>e.flatMap(({items:e})=>e).flatMap(e=>{let n=e.runs.at(-1);return n===void 0?[]:[{task:e,last:n,status:_(e,n,t)}]}).map(e=>({row:e,place:v(e)})).sort(({row:e,place:[t,n]},{row:r,place:[i,a]})=>t-i||a-n||r.task.number-e.task.number).map(({row:e})=>e),b=[`in flight`,`needs attention`,`done`],x=({task:e,status:t})=>{switch(t._tag){case`Running`:case`AwaitingApproval`:case`Queued`:case`Stalled`:return`in flight`;case`Idle`:return e.needsYou?`needs attention`:null;case`NeedsAttention`:return`needs attention`;case`Done`:return`done`;case`Ended`:return null}},S=e=>{let t=b.flatMap(t=>{let n=e.filter(e=>x(e)===t).length;return n===0?[]:[`${n} ${t}`]});return t.length===0?void 0:t.join(`, `)},C=(e,t)=>e.runningSince.reduce((e,n)=>e+Math.max(0,t-Date.parse(n)),e.durationMillis),w=e=>e.pools.some(({unpriced:e})=>e),T=(e,t)=>{let n=e.flatMap(({task:e})=>e.usage.cost===null?[]:[e.usage.cost]);return{runs:e.reduce((e,{task:t})=>e+t.runs.length,0),durationMillis:e.reduce((e,{task:n})=>e+C(n.usage,t),0),unmeasured:e.reduce((e,{task:t})=>e+t.usage.unmeasured,0),tokens:e.reduce((e,{task:t})=>e+t.usage.tokens,0),unpriced:e.some(({task:e})=>w(e.usage)),usd:n.length===0?null:n.reduce((e,{usd:t})=>e+t,0)}},E=`Some attempts have no recorded timing; the real figure is higher`,D=`Some sessions have no price yet; the real figure is higher`,O=e=>[{figure:String(e.runs),words:e.runs===1?`run`:`runs`,lowerBound:null},{figure:o(e.durationMillis),words:`elapsed`,lowerBound:e.unmeasured>0?E:null},{figure:s(e.tokens),words:`tokens`,lowerBound:null},...e.usd===null?[]:[{figure:a(e.usd),words:`estimated`,lowerBound:e.unpriced?D:null}]],k=e=>{let t=new Map;for(let{loop:n,state:r}of e.runs)t.set(n,r);return[...t].map(([e,t])=>({loop:e,state:t}))},A=e=>{switch(e){case`issue-comment`:return`Comment`;case`review`:return`Review`;case`review-comment`:return`Review comment`}};export{l as a,C as c,y as d,f,E as g,D as h,u as i,k as l,O as m,A as n,p as o,T as p,w as r,S as s,c as t,m as u};
@@ -1 +1 @@
1
- import{a as e,n as t}from"./jsx-runtime-Wy9s6hX0.js";import{I as n,P as r}from"./queryOptions-Bavh4JFe.js";import{o as i}from"./queries-CKjxlPEk.js";import{n as a}from"./use-project-links-C3F9c85T.js";import{W as o}from"./button-CzVqBv_O.js";import{X as s,ct as c,t as l,xt as u}from"./api-CoJQoiOc.js";import{E as d,i as f,n as p}from"./overview-CUn9OtUH.js";var m=e(t(),1),h=new Map([[`bold`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z`}))],[`duotone`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z`,opacity:`0.2`}),m.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`fill`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z`}))],[`light`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z`}))],[`regular`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`thin`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z`}))]]),g=m.forwardRef((e,t)=>m.createElement(o,{ref:t,...e,weights:h}));g.displayName=`ArrowSquareOutIcon`;var _=e=>e===`saving`?`Moving…`:`Saved on GitHub · syncing…`,v=e=>`Move to ${e}`,y=(e,t)=>`${t?`Open`:`Fold`} ${e} lane`,b=(e,t)=>t.canResolveFailure&&!e.items.some(({itemKey:e,state:n})=>e===t.itemKey&&s(n)),x=e=>{let t=[...e.runs].reverse().find(t=>b(e,t));if(t===void 0)return null;let n=t.attempts;for(let e=n.length-1;e>=0;--e){let r=n[e]?.outcome;if(r?._tag===`Failed`)return{run:t,message:d(r.failure)}}return null},S=new Set(c),C=e=>{let t=e.run;return t!==null&&(S.has(t.state)||b(e,t))?t:null},w=e=>{let t=e.attempts.at(-1);switch(e.state){case`Pending`:case`Waiting`:case`Queued`:return e.openedAt;case`Running`:return t!==void 0&&t.outcome===null?t.startedAt:null;case`Failed`:return t?.endedAt??null;case`Succeeded`:case`Canceled`:return null}},T=(e,t)=>{let n=new Set(t._tag===`WritableBoardLane`?t.labels:[]);for(let e of t.sources)`label`in e&&n.add(e.label);return e.labels.filter(e=>!n.has(e))},E=e=>[`board-moves`,e],D=(e,t)=>{if(e.phase===`saving`)return!0;let n=t.flatMap(({items:e})=>e).find(({itemKey:t})=>t===e.itemKey);if(n===void 0||n.state!==e.source.state)return!1;let r=n.labels.filter(t=>e.laneLabels.includes(t));return r.length===e.source.labels.length&&r.every(t=>e.source.labels.includes(t))},O=e=>{let t=n(),{data:o=[]}=a({queryKey:E(f(e)),queryFn:r,initialData:[],gcTime:1/0}),s=(e,n)=>t.setQueryData(E(e),(e=[])=>n(e)),c=o.filter(t=>D(t,e.board.lanes));a({...p(),enabled:c.length>0,refetchInterval:1e3}),(0,m.useEffect)(()=>{t.setQueryData(E(f(e)),t=>{let n=t?.filter(t=>D(t,e.board.lanes));return n?.length===t?.length?t:n})},[t,e,e.board.lanes,o]);let d=i({mutationFn:({repository:e,item:t,toLane:n})=>{let{owner:r,name:i}=u(e);return l(e=>e.moveBoardItem({params:{owner:r,repository:i,item:t},payload:{toLane:n}}))},onSuccess:(e,{boardProject:n,itemKey:r})=>(s(n,e=>e.map(e=>e.itemKey===r?{...e,phase:`syncing`}:e)),t.invalidateQueries({queryKey:p().queryKey})),onError:(e,{boardProject:n,itemKey:r})=>(s(n,e=>e.filter(e=>e.itemKey!==r)),t.invalidateQueries({queryKey:p().queryKey}))}),h=(t,n)=>{let r=e.board.lanes.find(({items:e})=>e.some(({itemKey:e})=>e===t.itemKey)),i=r?.items.find(({itemKey:e})=>e===t.itemKey);if(n._tag!==`WritableBoardLane`||i===void 0||r?.id===n.id||c.some(({itemKey:e})=>e===t.itemKey))return;let a=e.board.lanes.flatMap(e=>e._tag===`WritableBoardLane`?e.labels:[]);s(f(e),e=>[...e,{itemKey:t.itemKey,toLane:n.id,source:{state:i.state,labels:i.labels.filter(e=>a.includes(e))},laneLabels:a,phase:`saving`}]),d.mutate({repository:t.repository,boardProject:f(e),itemKey:t.itemKey,item:t.number,toLane:n.id})},g=d.variables?.boardProject===f(e);return{moves:c,moveItem:h,isPending:g&&d.isPending,error:g?d.error:null}};export{x as a,v as c,w as i,g as l,T as n,y as o,C as r,_ as s,O as t};
1
+ import{a as e,n as t}from"./jsx-runtime-Wy9s6hX0.js";import{I as n,P as r}from"./queryOptions-Bavh4JFe.js";import{o as i}from"./queries-CU77zJnf.js";import{n as a}from"./use-project-links-CdgpfpoU.js";import{W as o}from"./button-CzVqBv_O.js";import{X as s,ct as c,t as l,xt as u}from"./api-D3RWLycx.js";import{E as d,i as f,n as p}from"./overview-DLYaCoiG.js";var m=e(t(),1),h=new Map([[`bold`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M228,104a12,12,0,0,1-24,0V69l-59.51,59.51a12,12,0,0,1-17-17L187,52H152a12,12,0,0,1,0-24h64a12,12,0,0,1,12,12Zm-44,24a12,12,0,0,0-12,12v64H52V84h64a12,12,0,0,0,0-24H48A20,20,0,0,0,28,80V208a20,20,0,0,0,20,20H176a20,20,0,0,0,20-20V140A12,12,0,0,0,184,128Z`}))],[`duotone`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M184,80V208a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V80a8,8,0,0,1,8-8H176A8,8,0,0,1,184,80Z`,opacity:`0.2`}),m.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`fill`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M192,136v72a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V80A16,16,0,0,1,48,64h72a8,8,0,0,1,0,16H48V208H176V136a8,8,0,0,1,16,0Zm32-96a8,8,0,0,0-8-8H152a8,8,0,0,0-5.66,13.66L172.69,72l-42.35,42.34a8,8,0,0,0,11.32,11.32L184,83.31l26.34,26.35A8,8,0,0,0,224,104Z`}))],[`light`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M222,104a6,6,0,0,1-12,0V54.49l-69.75,69.75a6,6,0,0,1-8.48-8.48L201.51,46H152a6,6,0,0,1,0-12h64a6,6,0,0,1,6,6Zm-38,26a6,6,0,0,0-6,6v72a2,2,0,0,1-2,2H48a2,2,0,0,1-2-2V80a2,2,0,0,1,2-2h72a6,6,0,0,0,0-12H48A14,14,0,0,0,34,80V208a14,14,0,0,0,14,14H176a14,14,0,0,0,14-14V136A6,6,0,0,0,184,130Z`}))],[`regular`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z`}))],[`thin`,m.createElement(m.Fragment,null,m.createElement(`path`,{d:`M220,104a4,4,0,0,1-8,0V49.66l-73.16,73.17a4,4,0,0,1-5.66-5.66L206.34,44H152a4,4,0,0,1,0-8h64a4,4,0,0,1,4,4Zm-36,28a4,4,0,0,0-4,4v72a4,4,0,0,1-4,4H48a4,4,0,0,1-4-4V80a4,4,0,0,1,4-4h72a4,4,0,0,0,0-8H48A12,12,0,0,0,36,80V208a12,12,0,0,0,12,12H176a12,12,0,0,0,12-12V136A4,4,0,0,0,184,132Z`}))]]),g=m.forwardRef((e,t)=>m.createElement(o,{ref:t,...e,weights:h}));g.displayName=`ArrowSquareOutIcon`;var _=e=>e===`saving`?`Moving…`:`Saved on GitHub · syncing…`,v=e=>`Move to ${e}`,y=(e,t)=>`${t?`Open`:`Fold`} ${e} lane`,b=(e,t)=>t.canResolveFailure&&!e.items.some(({itemKey:e,state:n})=>e===t.itemKey&&s(n)),x=e=>{let t=[...e.runs].reverse().find(t=>b(e,t));if(t===void 0)return null;let n=t.attempts;for(let e=n.length-1;e>=0;--e){let r=n[e]?.outcome;if(r?._tag===`Failed`)return{run:t,message:d(r.failure)}}return null},S=new Set(c),C=e=>{let t=e.run;return t!==null&&(S.has(t.state)||b(e,t))?t:null},w=e=>{let t=e.attempts.at(-1);switch(e.state){case`Pending`:case`Waiting`:case`Queued`:return e.openedAt;case`Running`:return t!==void 0&&t.outcome===null?t.startedAt:null;case`Failed`:return t?.endedAt??null;case`Succeeded`:case`Canceled`:return null}},T=(e,t)=>{let n=new Set(t._tag===`WritableBoardLane`?t.labels:[]);for(let e of t.sources)`label`in e&&n.add(e.label);return e.labels.filter(e=>!n.has(e))},E=e=>[`board-moves`,e],D=(e,t)=>{if(e.phase===`saving`)return!0;let n=t.flatMap(({items:e})=>e).find(({itemKey:t})=>t===e.itemKey);if(n===void 0||n.state!==e.source.state)return!1;let r=n.labels.filter(t=>e.laneLabels.includes(t));return r.length===e.source.labels.length&&r.every(t=>e.source.labels.includes(t))},O=e=>{let t=n(),{data:o=[]}=a({queryKey:E(f(e)),queryFn:r,initialData:[],gcTime:1/0}),s=(e,n)=>t.setQueryData(E(e),(e=[])=>n(e)),c=o.filter(t=>D(t,e.board.lanes));a({...p(),enabled:c.length>0,refetchInterval:1e3}),(0,m.useEffect)(()=>{t.setQueryData(E(f(e)),t=>{let n=t?.filter(t=>D(t,e.board.lanes));return n?.length===t?.length?t:n})},[t,e,e.board.lanes,o]);let d=i({mutationFn:({repository:e,item:t,toLane:n})=>{let{owner:r,name:i}=u(e);return l(e=>e.moveBoardItem({params:{owner:r,repository:i,item:t},payload:{toLane:n}}))},onSuccess:(e,{boardProject:n,itemKey:r})=>(s(n,e=>e.map(e=>e.itemKey===r?{...e,phase:`syncing`}:e)),t.invalidateQueries({queryKey:p().queryKey})),onError:(e,{boardProject:n,itemKey:r})=>(s(n,e=>e.filter(e=>e.itemKey!==r)),t.invalidateQueries({queryKey:p().queryKey}))}),h=(t,n)=>{let r=e.board.lanes.find(({items:e})=>e.some(({itemKey:e})=>e===t.itemKey)),i=r?.items.find(({itemKey:e})=>e===t.itemKey);if(n._tag!==`WritableBoardLane`||i===void 0||r?.id===n.id||c.some(({itemKey:e})=>e===t.itemKey))return;let a=e.board.lanes.flatMap(e=>e._tag===`WritableBoardLane`?e.labels:[]);s(f(e),e=>[...e,{itemKey:t.itemKey,toLane:n.id,source:{state:i.state,labels:i.labels.filter(e=>a.includes(e))},laneLabels:a,phase:`saving`}]),d.mutate({repository:t.repository,boardProject:f(e),itemKey:t.itemKey,item:t.number,toLane:n.id})},g=d.variables?.boardProject===f(e);return{moves:c,moveItem:h,isPending:g&&d.isPending,error:g?d.error:null}};export{x as a,v as c,w as i,g as l,T as n,y as o,C as r,_ as s,O as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{t}from"./use-project-links-C3F9c85T.js";import{t as n}from"./link-3oQYoIpm.js";import{t as r}from"./button-CzVqBv_O.js";import{t as i}from"./boot-screen-Cqtn8Ter.js";var a=`Task not found`,o=(e,t)=>`#${t} is not among the newest items on the ${e} board`,s=`Back to the board`,c=e(),l=({repository:e,number:l})=>{let u=t();return(0,c.jsx)(i,{title:a,description:o(e,l),tone:`error`,inPanel:!0,children:(0,c.jsx)(r,{variant:`outline`,nativeButton:!1,render:(0,c.jsx)(n,{...u.board(e)}),children:s})})};export{a as n,l as t};
1
+ import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{t}from"./use-project-links-CdgpfpoU.js";import{t as n}from"./link-3oQYoIpm.js";import{t as r}from"./button-CzVqBv_O.js";import{t as i}from"./boot-screen-Cqtn8Ter.js";var a=`Task not found`,o=(e,t)=>`#${t} is not among the newest items on the ${e} board`,s=`Back to the board`,c=e(),l=({repository:e,number:l})=>{let u=t();return(0,c.jsx)(i,{title:a,description:o(e,l),tone:`error`,inPanel:!0,children:(0,c.jsx)(r,{variant:`outline`,nativeButton:!1,render:(0,c.jsx)(n,{...u.board(e)}),children:s})})};export{a as n,l as t};
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{a as r}from"./queries-CKjxlPEk.js";import{a as i,c as a,h as o,i as s,l as c,n as l,o as u,s as d,v as f}from"./actions-BXWVnBF3.js";import{W as p,r as m,t as h}from"./button-CzVqBv_O.js";import{a as ee,c as g,s as _}from"./useTriggerFocusGuards-BEdypEdV.js";import{i as te}from"./context-8jHKzDOY.js";import{An as v,At as ne,Bt as y,Ct as b,Dn as x,Dt as S,En as C,Et as w,Fn as T,Ft as E,In as D,Ln as O,Lt as re,Mn as ie,Mt as ae,Nn as k,Nt as oe,On as se,Pn as A,Pt as j,Rn as ce,St as M,Tn as N,Wt as P,Zt as le,en as ue,jt as de,kn as fe,m as pe,qt as me,rn as he,wn as ge}from"./api-CoJQoiOc.js";import{i as _e,r as ve,s as ye,v as be}from"./strings-BIVdGoBr.js";import{A as xe,D as Se,E as F,G as Ce,K as we,L as Te,M as Ee,N as I,T as De}from"./overview-CUn9OtUH.js";import{a as L,n as R,r as Oe}from"./page-CmRQu9F2.js";import{t as ke}from"./error-alert-Bq-SD6of.js";import{t as Ae}from"./usine-mark-B7sGtLae.js";import{R as je,ft as Me,st as Ne,ut as Pe}from"./index-BGr-Cg-z.js";import{t as Fe}from"./pull-request-marks-_FfWkWIz.js";import{n as Ie}from"./status-badge-B2-vzEoZ.js";import{n as Le}from"./usage-cNWB4RMb.js";import{t as Re}from"./markdown-DQ2LWxl6.js";var z=e(t(),1),ze=new Map([[`bold`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M188,86.11V84c0-14.62-10.83-27.55-30.51-36.4C140.87,40.12,119,36,96,36S51.13,40.12,34.51,47.6C14.83,56.45,4,69.38,4,84v40c0,14.62,10.83,27.55,30.51,36.4A131.67,131.67,0,0,0,68,169.88V172c0,14.62,10.83,27.55,30.51,36.4C115.13,215.88,137,220,160,220s44.87-4.12,61.49-11.6C241.17,199.55,252,186.62,252,172V132C252,109.86,226.71,92.08,188,86.11ZM228,132c0,7.75-21.77,22.48-61.81,23.88C180.33,147.4,188,136.3,188,124V110.44C213.88,115.15,228,125.48,228,132ZM107.37,147.63c-3.63.24-7.42.37-11.37.37-5.08,0-9.89-.22-14.43-.61a10.94,10.94,0,0,0-1.14-.09c-1.51-.14-3-.3-4.43-.48V130.93A187,187,0,0,0,96,132a187,187,0,0,0,20-1.07v15.89c-2.49.3-5.07.56-7.75.75C108,147.58,107.66,147.6,107.37,147.63ZM164,117.14V124c0,4.78-8.28,12.21-24,17.54v-15a115.32,115.32,0,0,0,17.49-6.13Q160.93,118.86,164,117.14ZM96,60c44,0,68,15.85,68,24s-24,24-68,24S28,92.15,28,84,52,60,96,60ZM28,124v-6.86q3.08,1.71,6.51,3.26A115.32,115.32,0,0,0,52,126.53v15C36.28,136.21,28,128.78,28,124Zm64,48v0c1.33,0,2.66,0,4,0q5.44,0,10.77-.32,4.45,1.57,9.23,2.86v15C100.28,184.21,92,176.78,92,172Zm48,22.82V178.94A186.45,186.45,0,0,0,160,180a187,187,0,0,0,20-1.07v15.89a170.08,170.08,0,0,1-40,0Zm64-5.28v-15a115.32,115.32,0,0,0,17.49-6.13q3.44-1.54,6.51-3.26V172C228,176.78,219.72,184.21,204,189.54Z`}))],[`duotone`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M240,132c0,19.88-35.82,36-80,36-19.6,0-37.56-3.17-51.47-8.44h0C146.76,156.85,176,142,176,124V96.72h0C212.52,100.06,240,114.58,240,132ZM176,84c0-19.88-35.82-36-80-36S16,64.12,16,84s35.82,36,80,36S176,103.88,176,84Z`,opacity:`0.2`}),z.createElement(`path`,{d:`M184,89.57V84c0-25.08-37.83-44-88-44S8,58.92,8,84v40c0,20.89,26.25,37.49,64,42.46V172c0,25.08,37.83,44,88,44s88-18.92,88-44V132C248,111.3,222.58,94.68,184,89.57ZM232,132c0,13.22-30.79,28-72,28-3.73,0-7.43-.13-11.08-.37C170.49,151.77,184,139,184,124V105.74C213.87,110.19,232,122.27,232,132ZM72,150.25V126.46A183.74,183.74,0,0,0,96,128a183.74,183.74,0,0,0,24-1.54v23.79A163,163,0,0,1,96,152,163,163,0,0,1,72,150.25Zm96-40.32V124c0,8.39-12.41,17.4-32,22.87V123.5C148.91,120.37,159.84,115.71,168,109.93ZM96,56c41.21,0,72,14.78,72,28s-30.79,28-72,28S24,97.22,24,84,54.79,56,96,56ZM24,124V109.93c8.16,5.78,19.09,10.44,32,13.57v23.37C36.41,141.4,24,132.39,24,124Zm64,48v-4.17c2.63.1,5.29.17,8,.17,3.88,0,7.67-.13,11.39-.35A121.92,121.92,0,0,0,120,171.41v23.46C100.41,189.4,88,180.39,88,172Zm48,26.25V174.4a179.48,179.48,0,0,0,24,1.6,183.74,183.74,0,0,0,24-1.54v23.79a165.45,165.45,0,0,1-48,0Zm64-3.38V171.5c12.91-3.13,23.84-7.79,32-13.57V172C232,180.39,219.59,189.4,200,194.87Z`}))],[`fill`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M184,89.57V84c0-25.08-37.83-44-88-44S8,58.92,8,84v40c0,20.89,26.25,37.49,64,42.46V172c0,25.08,37.83,44,88,44s88-18.92,88-44V132C248,111.3,222.58,94.68,184,89.57ZM56,146.87C36.41,141.4,24,132.39,24,124V109.93c8.16,5.78,19.09,10.44,32,13.57Zm80-23.37c12.91-3.13,23.84-7.79,32-13.57V124c0,8.39-12.41,17.4-32,22.87Zm-16,71.37C100.41,189.4,88,180.39,88,172v-4.17c2.63.1,5.29.17,8,.17,3.88,0,7.67-.13,11.39-.35A121.92,121.92,0,0,0,120,171.41Zm0-44.62A163,163,0,0,1,96,152a163,163,0,0,1-24-1.75V126.46A183.74,183.74,0,0,0,96,128a183.74,183.74,0,0,0,24-1.54Zm64,48a165.45,165.45,0,0,1-48,0V174.4a179.48,179.48,0,0,0,24,1.6,183.74,183.74,0,0,0,24-1.54ZM232,172c0,8.39-12.41,17.4-32,22.87V171.5c12.91-3.13,23.84-7.79,32-13.57Z`}))],[`light`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M224.56,103.81C213.43,97.75,198.47,93.39,182,91.34V84c0-12.12-9.58-23.1-27-30.93C139.16,45.93,118.2,42,96,42S52.84,45.93,37,53.07C19.58,60.9,10,71.88,10,84v40c0,12.12,9.58,23.1,27,30.93,10.49,4.72,23.21,8,37,9.73V172c0,12.12,9.58,23.1,27,30.93C116.84,210.07,137.8,214,160,214s43.16-3.93,59-11.07c17.39-7.83,27-18.81,27-30.93V132C246,121.35,238.39,111.34,224.56,103.81Zm-5.74,10.54C228.61,119.68,234,126,234,132c0,14.19-30.39,30-74,30a166.9,166.9,0,0,1-21.21-1.34A110.79,110.79,0,0,0,155,154.93c17.39-7.83,27-18.81,27-30.93V103.43C196.4,105.36,209.3,109.16,218.82,114.35ZM108.16,153.58c-3.92.27-8,.42-12.16.42-5.3,0-10.4-.24-15.28-.67a2.22,2.22,0,0,0-.37,0c-3.58-.33-7-.77-10.35-1.3V124.12A178,178,0,0,0,96,126a178,178,0,0,0,26-1.88V152c-4.34.69-8.91,1.22-13.69,1.56ZM170,105.89V124c0,9.54-13.75,19.8-36,25.51V121.85a115,115,0,0,0,21-6.92A66.2,66.2,0,0,0,170,105.89ZM96,54c43.61,0,74,15.81,74,30s-30.39,30-74,30S22,98.19,22,84,52.39,54,96,54ZM22,124V105.89a66.2,66.2,0,0,0,15,9,115,115,0,0,0,21,6.92v27.66C35.75,143.8,22,133.54,22,124Zm64,48v-6.28c3.3.18,6.63.28,10,.28q5.91,0,11.66-.37A123.17,123.17,0,0,0,122,169.84v27.67C99.75,191.8,86,181.54,86,172Zm48,28V172.1a177.84,177.84,0,0,0,26,1.9,178,178,0,0,0,26-1.88V200a170,170,0,0,1-52,0Zm64-2.49V169.85a115,115,0,0,0,21-6.92,66.2,66.2,0,0,0,15-9V172C234,181.54,220.25,191.8,198,197.51Z`}))],[`regular`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M184,89.57V84c0-25.08-37.83-44-88-44S8,58.92,8,84v40c0,20.89,26.25,37.49,64,42.46V172c0,25.08,37.83,44,88,44s88-18.92,88-44V132C248,111.3,222.58,94.68,184,89.57ZM232,132c0,13.22-30.79,28-72,28-3.73,0-7.43-.13-11.08-.37C170.49,151.77,184,139,184,124V105.74C213.87,110.19,232,122.27,232,132ZM72,150.25V126.46A183.74,183.74,0,0,0,96,128a183.74,183.74,0,0,0,24-1.54v23.79A163,163,0,0,1,96,152,163,163,0,0,1,72,150.25Zm96-40.32V124c0,8.39-12.41,17.4-32,22.87V123.5C148.91,120.37,159.84,115.71,168,109.93ZM96,56c41.21,0,72,14.78,72,28s-30.79,28-72,28S24,97.22,24,84,54.79,56,96,56ZM24,124V109.93c8.16,5.78,19.09,10.44,32,13.57v23.37C36.41,141.4,24,132.39,24,124Zm64,48v-4.17c2.63.1,5.29.17,8,.17,3.88,0,7.67-.13,11.39-.35A121.92,121.92,0,0,0,120,171.41v23.46C100.41,189.4,88,180.39,88,172Zm48,26.25V174.4a179.48,179.48,0,0,0,24,1.6,183.74,183.74,0,0,0,24-1.54v23.79a165.45,165.45,0,0,1-48,0Zm64-3.38V171.5c12.91-3.13,23.84-7.79,32-13.57V172C232,180.39,219.59,189.4,200,194.87Z`}))],[`thin`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M180,93.11V84c0-22.43-36.9-40-84-40S12,61.57,12,84v40c0,19.14,26.86,34.72,64,38.89V172c0,22.43,36.9,40,84,40s84-17.57,84-40V132C244,113.12,217.87,97.37,180,93.11ZM236,132c0,15.45-30.54,32-76,32a165.71,165.71,0,0,1-28-2.34v-1.39c28.61-6.31,48-20,48-36.27V101.17C212.22,105,236,117.93,236,132ZM108.19,155.59Q102.3,156,96,156c-5.47,0-10.72-.25-15.73-.69l-.27,0h0c-4.16-.38-8.16-.9-12-1.56V121.8A174.87,174.87,0,0,0,96,124a174.87,174.87,0,0,0,28-2.2v31.92a155,155,0,0,1-15.52,1.85ZM172,101.32V124c0,10.88-15.16,22.3-40,28.11V120.27C149.63,116.38,163.75,109.69,172,101.32ZM96,52c45.46,0,76,16.55,76,32s-30.54,32-76,32S20,99.45,20,84,50.54,52,96,52ZM20,124V101.32c8.25,8.37,22.37,15.06,40,19v31.84C35.16,146.3,20,134.88,20,124Zm64,48v-8.4c3.91.26,7.92.4,12,.4s8.06-.14,12-.39a123.93,123.93,0,0,0,16,4.63v31.87C99.16,194.3,84,182.88,84,172Zm48,29.72V169.77A174.48,174.48,0,0,0,160,172a174.87,174.87,0,0,0,28-2.2v31.92a173.07,173.07,0,0,1-56,0ZM236,172c0,10.88-15.16,22.3-40,28.11V168.27c17.63-3.89,31.75-10.58,40-19Z`}))]]),Be=new Map([[`bold`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,44a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,44Zm0,168a72,72,0,1,1,72-72A72.08,72.08,0,0,1,128,212ZM164.49,99.51a12,12,0,0,1,0,17l-28,28a12,12,0,0,1-17-17l28-28A12,12,0,0,1,164.49,99.51ZM92,16A12,12,0,0,1,104,4h48a12,12,0,0,1,0,24H104A12,12,0,0,1,92,16Z`}))],[`duotone`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M216,136a88,88,0,1,1-88-88A88,88,0,0,1,216,136Z`,opacity:`0.2`}),z.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`fill`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm45.66,61.66-40,40a8,8,0,0,1-11.32-11.32l40-40a8,8,0,0,1,11.32,11.32ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`light`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,42a94,94,0,1,0,94,94A94.11,94.11,0,0,0,128,42Zm0,176a82,82,0,1,1,82-82A82.1,82.1,0,0,1,128,218ZM172.24,91.76a6,6,0,0,1,0,8.48l-40,40a6,6,0,1,1-8.48-8.48l40-40A6,6,0,0,1,172.24,91.76ZM98,16a6,6,0,0,1,6-6h48a6,6,0,0,1,0,12H104A6,6,0,0,1,98,16Z`}))],[`regular`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`thin`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,44a92,92,0,1,0,92,92A92.1,92.1,0,0,0,128,44Zm0,176a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,220ZM170.83,93.17a4,4,0,0,1,0,5.66l-40,40a4,4,0,1,1-5.66-5.66l40-40A4,4,0,0,1,170.83,93.17ZM100,16a4,4,0,0,1,4-4h48a4,4,0,0,1,0,8H104A4,4,0,0,1,100,16Z`}))]]),Ve=z.forwardRef((e,t)=>z.createElement(p,{ref:t,...e,weights:ze}));Ve.displayName=`CoinsIcon`;var He=z.forwardRef((e,t)=>z.createElement(p,{ref:t,...e,weights:Be}));He.displayName=`TimerIcon`;var Ue=E({number:ae,title:j,url:j,state:j,body:le(de(j)),author:le(de(E({login:j}))),labels:le(E({nodes:b(E({name:j}))}))}),We=re(pe),Ge=y(Ue),Ke=e=>k(Ge(e),e=>({kind:e.url.includes(`/pull/`)?`Pull request`:`Issue`,number:e.number,title:e.title,url:e.url,state:e.state.charAt(0)+e.state.slice(1).toLowerCase(),author:x(e.author?.login),labels:e.labels?.nodes.map(({name:e})=>e)??[],body:N(x(e.body),e=>e.trim()!==``)})),qe=new Map([[`Issue Open`,`issue-open`],[`Issue Closed`,`issue-closed`],[`Pull request Open`,`pr-open`],[`Pull request Closed`,`pr-closed`],[`Pull request Merged`,`pr-merged`]]),Je=({kind:e,number:t,url:n,state:r})=>({kind:e===`Pull request`?`pr`:`issue`,number:t,url:n,state:qe.get(`${e} ${r}`)??null}),Ye=(e,t,n)=>k(We(e.itemKey),([,r,i])=>{let a=v(C(g(t,e.itemKey),({items:t})=>x(t.find(({itemKey:t})=>t===e.itemKey)))),o=v(N(n===void 0?T():Ke(n),e=>e.number===i));return{number:i,url:a?.url??o?.url??`https://github.com/${r}/issues/${i}`,title:x(a?.title??o?.title),pullRequest:a===void 0?o?.kind===`Pull request`:a.kind===`pr`}}),Xe=(e,t)=>A(Ke(t),{onNone:()=>`Opened by ${e}`,onSome:({kind:t,number:n,state:r,labels:i})=>`${e} matched ${t.toLowerCase()} #${n}: ${r.toLowerCase()}${i.length===0?``:`, labeled ${i.join(`, `)}`}`}),Ze=(e,t,n,r)=>{let i=k(n,ee),a=A(n,{onNone:()=>[],onSome:({items:e})=>e}),o=C(x(e.pullRequestUrl),e=>_(e,a)),s=k(t,({number:e,url:t,pullRequest:n})=>a.find(t=>t.number===e)??{kind:r===null?n||ge(o,t=>t.number===e)?`pr`:`issue`:r.startsWith(`pr-`)?`pr`:`issue`,number:e,url:t,state:r}),c=A(i,{onNone:()=>s,onSome:({origin:e})=>O(e)});return{heading:c,title:k(i,({origin:e})=>e.title),pullRequest:N(D(o,()=>N(s,({kind:e})=>e===`pr`)),e=>!ge(c,({number:t})=>t===e.number))}},B=n(),Qe=(e,t)=>se(C(t,({title:e})=>e),()=>`${e.loop} on ${e.repository}`),$e=({endedMillis:e,since:t})=>{let n=L(1e3);return(0,B.jsx)(B.Fragment,{children:ye(e+Math.max(0,n-Date.parse(t)))})},et=({duration:e})=>(0,B.jsxs)(`span`,{title:e.unmeasured===0?`Total attempt time`:`${e.unmeasured} ${e.unmeasured===1?`attempt`:`attempts`} not counted: no recorded end time`,className:`font-mono text-xs tabular-nums`,children:[e.unmeasured>0&&`at least `,e.runningSince===null?ye(e.endedMillis):(0,B.jsx)($e,{endedMillis:e.endedMillis,since:e.runningSince})]}),tt=({detail:e})=>{let{machine:t,run:n}=e;return t===null||t.state!==`ready`||t.id===null||t.attemptId===null||t.attemptId!==n.attempts.at(-1)?.id?null:(0,B.jsx)(`span`,{className:`font-mono text-xs`,title:`${Ce[t.provider]} ${we[t.provider]} ${t.id}`,children:t.id})},nt=({detail:e,overview:t,placement:n,shared:r,actions:i,as:a,className:o})=>{let{run:s}=e,c=Ye(s,t,e.eventPayload),l=Ze(s,c,g(t,s.itemKey),e.settledItemState);return(0,B.jsx)(Oe,{actionsBeside:n===`page`?`lg`:`never`,...o===void 0?{}:{className:o},eyebrow:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(R,{icon:Me,title:`Loop`,children:s.loop}),(0,B.jsx)(R,{icon:Ne,title:`Agent`,children:s.agent})]}),heading:(0,B.jsx)(je,{variant:`page`,item:l.heading,title:se(l.title,()=>Qe(s,c)),...a===void 0?{}:{as:a},...r?{style:{viewTransitionName:`run-title`}}:{}}),facts:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2 font-medium text-foreground`,style:r?{viewTransitionName:`run-state`}:void 0,children:[(0,B.jsx)(Ie,{state:s.state,className:`ml-0.75`}),Te(s,e.unconfirmedStop,e.machine)]}),(0,B.jsx)(Fe,{pullRequests:ce(l.pullRequest)}),e.worker!==null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(R,{icon:He,children:(0,B.jsx)(et,{duration:e.duration})}),n===`page`&&e.usage.sessions.length>0&&(0,B.jsx)(R,{icon:Ve,children:(0,B.jsx)(Le,{usage:e.usage,attempts:s.attempts})}),(0,B.jsxs)(R,{icon:Pe,title:`Worker`,children:[e.worker,(0,B.jsx)(tt,{detail:e})]})]}),s.loopPaused&&(0,B.jsx)(`span`,{children:`Loop paused`})]}),actions:i})},V=e=>M(e,{Approve:()=>I.approve,Retry:()=>I.retry,EditRetry:()=>`Edit and retry`,RunAgain:()=>I.runAgain,EditRunAgain:()=>`Edit and run again`,Resolve:({question:e})=>e?`Mark answered`:`Mark resolved`,Cancel:()=>I.cancel}),rt=e=>{let t=e.attempts.at(-1),n=t?.outcome?._tag===`Failed`?t.outcome.failure._tag:null,r=[...e.canApprove?[{_tag:`Approve`}]:[],...e.canRetry?[{_tag:`Retry`},{_tag:`EditRetry`}]:[],...e.canRunAgain?[{_tag:`RunAgain`},{_tag:`EditRunAgain`}]:[],...e.canResolveFailure&&t!==void 0?[{_tag:`Resolve`,attemptId:t.id,question:n===`QuestionFailure`}]:[],...e.canCancel?[{_tag:`Cancel`}]:[]],i=e=>e.flatMap(e=>r.filter(t=>t._tag===e)),a=(()=>{if(e.canApprove){let[e=null]=i([`Approve`]);return{primary:e,secondary:null,more:i([`Cancel`])}}if(e.state===`Failed`){let t=e.canResolveFailure&&(n===`QuestionFailure`||n===`BlockedFailure`),[r=null,a=null,...o]=i(t?[`Resolve`,`EditRetry`,`Retry`]:[`Retry`,`EditRetry`,`Resolve`]);return{primary:r,secondary:a,more:o}}let[t=null,...r]=i(e.canRunAgain?[`RunAgain`,`EditRunAgain`]:[`Cancel`]);return{primary:null,secondary:t,more:r}})(),o=new Set([a.primary,a.secondary,...a.more]);return{...a,more:[...a.more,...r.filter(e=>!o.has(e))]}},it=({detail:e,onEdit:t,openRun:n,className:r})=>{let{run:p,agentDefinitionChanged:ee}=e,g=(0,z.useId)(),_=s(),v=i(),[ne,y]=(0,z.useState)(!1),b=_.isPending||v.isPending,x=e=>_.mutate({runId:p.id,request:e},{onSuccess:()=>y(!1)}),S=e=>M(e,{Approve:()=>x({action:`approve`}),Retry:()=>x({action:`retry`}),EditRetry:()=>t(`retry`),RunAgain:()=>v.mutate(l(p),{onSuccess:e=>{e._tag===`Claimed`&&n(e.runId)}}),EditRunAgain:()=>t(`runAgain`),Resolve:({attemptId:e})=>x({action:`resolveFailure`,attemptId:e}),Cancel:()=>y(!0)}),{primary:C,secondary:w,more:T}=rt(p);return te(b||ne?[]:[C,w,...T].flatMap(e=>e===null?[]:[{label:`${V(e)} · ${p.id}`,run:()=>S(e)}])),C===null&&w===null&&T.length===0?null:(0,B.jsxs)(`div`,{className:m(`max-w-sm space-y-2`,r),children:[(0,B.jsx)(`div`,{role:`group`,"aria-label":`Run actions`,className:`flex flex-wrap items-center gap-2`,children:ne?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(h,{variant:`destructive`,disabled:b,onClick:()=>x({action:`cancel`}),children:I.confirmCancel}),(0,B.jsx)(h,{variant:`ghost`,disabled:b,onClick:()=>y(!1),children:I.keepRunning})]}):(0,B.jsxs)(B.Fragment,{children:[C!==null&&(0,B.jsx)(h,{disabled:b,"aria-describedby":C._tag===`Retry`?g:void 0,onClick:()=>S(C),children:V(C)}),w!==null&&(0,B.jsx)(h,{variant:w._tag===`Cancel`?`ghost`:`outline`,disabled:b,"aria-describedby":w._tag===`Retry`?g:void 0,onClick:()=>S(w),children:V(w)}),T.length>0&&(0,B.jsxs)(u,{children:[(0,B.jsx)(o,{disabled:b,render:(0,B.jsx)(h,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-foreground aria-expanded:text-foreground`}),"aria-label":`More actions`,children:(0,B.jsx)(f,{weight:`bold`,className:`size-4`,"aria-hidden":`true`})}),(0,B.jsx)(d,{align:`end`,className:`w-auto min-w-44`,children:(0,B.jsx)(a,{children:T.map(e=>(0,B.jsx)(c,{"aria-describedby":e._tag===`Retry`?g:void 0,variant:e._tag===`Cancel`?`destructive`:`default`,onClick:()=>S(e),children:V(e)},e._tag))})})]})]})}),p.canRetry&&(0,B.jsxs)(`div`,{className:`space-y-1 text-xs wrap-anywhere text-muted-foreground`,children:[(0,B.jsx)(`p`,{id:g,children:Ee(p.agentBrain)}),ee&&(0,B.jsxs)(`p`,{children:[`The loaded definition of `,p.agent,` has changed. Edit and retry uses the current definition.`]})]}),v.data?._tag===`CycleBlocked`&&(0,B.jsx)(`p`,{role:`status`,className:`text-xs text-needs-you`,children:`No run opened: cycle budget used up. Reset it in Needs attention`}),_.isError&&(0,B.jsx)(ke,{message:_.error.message}),v.isError&&(0,B.jsx)(ke,{message:v.error.message})]})},at=(e,t,n)=>{let r=new Set(e.map(({sequence:e})=>e)),i=[...new Map([...t,...e].map(e=>[e.sequence,e])).values()].sort((e,t)=>e.sequence-t.sequence),a=new Map,o=new Map,s=(e,t)=>JSON.stringify([e,t]);for(let e of i){let t=e.payload;if(t._tag!==`SessionEvent`)continue;let i=t.event;if(i._tag===`PoolRateLimitsUpdated`||i._tag===`SessionTokensUpdated`)continue;let c=s(e.attemptId,i.session.id),l=a.get(c);l===void 0&&(l={attemptId:e.attemptId,session:i.session,first:e,harnessSession:T(),latestSequence:e.sequence,status:n.has(e.attemptId)?`Stopped`:`Live`,held:!1,paused:!1,idle:!1,events:[],interventions:[]},a.set(c,l),i.session._tag===`ParentSession`&&o.set(e.attemptId,l)),l.latestSequence=e.sequence,i._tag===`SessionStarted`&&(l.harnessSession=i.harnessSession),i._tag===`SessionFinished`&&(l.status=`Finished`),i._tag===`SessionIdle`&&(l.idle=!0),i._tag===`SessionResumed`&&(l.idle=!1),r.has(e.sequence)&&l.events.push({sequence:e.sequence,receivedAt:e.receivedAt,event:i})}let c=[],l=(e,t)=>JSON.stringify([e,t.inputSequence]),u=new Map;for(let{attemptId:e,payload:t}of i)(t._tag===`InterventionApplied`||t._tag===`InterventionRejected`)&&u.set(l(e,t),t);let d=new Set;for(let e of i){let t=e.payload;if(t._tag!==`InterventionApplied`&&t._tag!==`InterventionRejected`)continue;let n=l(e.attemptId,t),i={...e,payload:u.get(n)??t},f=t.intervention.target,p=f._tag===`Parent`?o.get(e.attemptId):a.get(s(e.attemptId,f.sessionId)),m=r.has(e.sequence)&&!d.has(n);m&&d.add(n),p===void 0?m&&c.push(i):(e.sequence>p.latestSequence&&(p.latestSequence=e.sequence),t._tag===`InterventionApplied`&&(p.held=t.state.held,p.paused=t.state.paused),m&&p.interventions.push(i))}return{groups:a,unmatched:c}},ot=e=>({key:`event:${e.sequence}`,attemptId:e.attemptId,sequence:e.sequence,latestSequence:e.sequence,receivedAt:e.receivedAt}),H=(e,t,n)=>({_tag:`Notice`,...ot(e),...t,origin:n,queued:null}),U=e=>`${e} ${e===1?`retry`:`retries`}`,st=(e,t)=>{let n=[],r=new Map;for(let i of e.events){let a=i.event,o={...i,attemptId:e.attemptId};if(a._tag===`ToolStarted`||a._tag===`ToolFinished`){let n=JSON.stringify([e.attemptId,e.session.id,a.callId]),s=r.get(n),c=s?.start??T();r.set(n,{_tag:`Tool`,...ot(o),key:n,sequence:s?.sequence??i.sequence,receivedAt:s?.receivedAt??i.receivedAt,name:a.tool,start:a._tag===`ToolStarted`?O({receivedAt:i.receivedAt,input:a.input}):c,state:a._tag===`ToolFinished`?{_tag:a.isError?`Error`:`Finished`,receivedAt:i.receivedAt,output:a.output}:s?.state??{_tag:t===`Live`?`Running`:`Stopped`}});continue}if(a._tag===`ProviderRetrying`||a._tag===`ProviderRecovered`){n.push(H(o,a._tag===`ProviderRetrying`?{kind:`status`,label:`${e.session.agent}: provider unreachable`,detail:a.message,format:`plain`,tone:`warning`}:{kind:`status`,label:`${e.session.agent}: provider reachable again`,detail:`After ${U(a.retries)}`,format:`plain`,tone:`plain`},{_tag:`Provider`,session:e.session,event:a}));continue}let s=M(a,{TextOutput:({text:t})=>({kind:`message`,label:e.session.agent,detail:t,format:`markdown`,tone:`plain`}),SessionStarted:()=>({kind:`status`,label:`${e.session.agent} started`,detail:ve(e.session.brain),format:`plain`,tone:`plain`}),SessionIdle:()=>({kind:`status`,label:`${e.session.agent} idle`,detail:`Session open for operator input`,format:`plain`,tone:`plain`}),SessionResumed:()=>({kind:`status`,label:`${e.session.agent} resumed`,detail:``,format:`plain`,tone:`plain`}),SessionFinished:()=>({kind:`status`,label:`${e.session.agent} finished`,detail:``,format:`plain`,tone:`plain`})});n.push(H(o,s,{_tag:`Session`,session:e.session,event:a._tag}))}return[...n,...r.values()].sort((e,t)=>e.sequence-t.sequence)},ct=e=>{let{action:t,operator:n,target:r}=e.payload.intervention,i=e.payload._tag===`InterventionRejected`,a=t._tag===`OperatorMessage`||t._tag===`Steer`,o=e.payload._tag===`InterventionApplied`&&e.payload.state.queued?r._tag===`Parent`?`parent`:`child`:null,s=`${n} released the ${r._tag===`Parent`?`parent`:`child`}`;return{...H(e,{kind:a?`message`:`status`,label:i?`${n} · not delivered`:a?n:t._tag===`Release`?s:`${n} paused the session`,detail:i?`${a?`${t.message}\n\n`:``}${e.payload.message}`:a?t.message:``,format:a?`markdown`:`plain`,tone:i?`failed`:`plain`},{_tag:`Operator`,operator:n}),queued:o}},lt=(e,t,n=[])=>{let r=new Set(t.filter(({outcome:e})=>e!==null).map(({id:e})=>e));for(let{attemptId:t,payload:n}of e)(n._tag===`Final`||n._tag===`Failed`||n._tag===`Interrupted`)&&r.add(t);let{groups:i,unmatched:a}=at(e,n,r),o=[];for(let t of[...e].sort((e,t)=>e.sequence-t.sequence)){let e=t.payload;e._tag!==`InterventionApplied`&&e._tag!==`InterventionRejected`&&(t.direction!==`inbound`||t.operator===void 0||e._tag===`Cancel`)&&e._tag!==`SessionEvent`&&o.push(H(t,M(e,{Started:({parentModel:e,conflictingSalvage:t})=>({kind:`status`,label:`Attempt started`,detail:A(t,{onNone:()=>e,onSome:t=>`${e}. ${De(t)}`}),format:`plain`,tone:`plain`}),Final:({result:e})=>({kind:`status`,label:`Attempt finished`,detail:e.message,format:`markdown`,tone:`plain`}),Failed:({failure:e})=>({kind:`status`,label:`Attempt failed`,detail:F(e),format:`plain`,tone:`failed`}),Cancel:()=>({kind:`status`,label:`Cancel requested`,detail:`Attempt stopping`,format:`plain`,tone:`plain`}),Interrupted:()=>({kind:`status`,label:`Interrupted`,detail:`Acknowledged by the parent session`,format:`plain`,tone:`plain`}),Steer:({message:e})=>({kind:`message`,label:`Operator`,detail:e,format:`markdown`,tone:`plain`}),Interrupt:()=>({kind:`status`,label:`Interrupt requested`,detail:`Sent by the operator`,format:`plain`,tone:`plain`}),OperatorMessage:({message:e})=>({kind:`message`,label:`Operator`,detail:e,format:`markdown`,tone:`plain`}),Release:()=>({kind:`status`,label:`Released`,detail:`Held child released by the operator`,format:`plain`,tone:`plain`}),WorkerUnresponsive:({worker:e,lastAnsweredAt:t,reason:n})=>({kind:`status`,label:`${e} silent since ${_e(ue(t))}`,detail:n,format:`plain`,tone:`warning`}),WorkerResponsive:({worker:e,lastAnsweredAt:n,recovered:r})=>({kind:`status`,label:r?`${e} answering again`:`${e} answering`,detail:r?`Silent for ${ye(Date.parse(t.receivedAt)-he(n))}`:``,format:`plain`,tone:`plain`})}),{_tag:`Envelope`,payload:e}))}let s=[];for(let[e,t]of i)s.push({_tag:`Session`,...ot(t.first),key:e,latestSequence:t.latestSequence,session:t.session,harnessSession:t.harnessSession,status:t.status,held:t.status===`Live`&&t.held,paused:t.status===`Live`&&t.paused,idle:t.status===`Live`&&t.idle,entries:[...st(t,t.status),...t.interventions.map(e=>ct(e))].sort((e,t)=>e.sequence-t.sequence)});return o.push(...a.map(e=>{let t=ct(e),n=e.payload.intervention.target;return{...t,label:`${t.label} · ${n._tag===`Parent`?`parent`:n.sessionId}`}})),{sessions:s,terminalAttempts:r,items:[...o,...s.flatMap(e=>e.session._tag===`ChildSession`?[e]:e.entries)].sort((e,t)=>e.sequence-t.sequence)}},ut=e=>{if(e.status!==`Live`)return e.status;if(e.paused)return`Paused`;if(e.held)return e.idle?`Held, waiting for input`:`Held, working`;if(e.idle)return`Waiting for input`;let t=[...e.entries].reverse().find(e=>e._tag===`Tool`&&e.state._tag===`Running`);return t?._tag===`Tool`?`Running ${t.name}`:`Working`},W=oe(j,S),dt=E({type:ne([`text`,`inputText`]),text:j}),G=e=>P(W)(e)?e:{},K=e=>P(j)(e)?e:void 0,ft=e=>{if(e===`cwd`)return`Working directory`;if(e===`durationMs`)return`Duration (ms)`;let t=e.replace(/([a-z])([A-Z])/gu,`$1 $2`).replaceAll(`_`,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)},q=(e,t,n=`text`)=>({_tag:`Code`,label:e,text:t,language:n}),J=(e,t,n=[])=>{let r=Object.entries(t).filter(([e])=>!n.includes(e)).map(([e,t])=>({label:ft(e),value:t}));return r.length===0?[]:[{_tag:`Fields`,label:e,fields:r}]},Y=(e,t,n=`text`)=>{if(e==null)return[];if(P(j)(e))return[q(t,e,n)];if(Array.isArray(e))return e.flatMap(e=>P(dt)(e)?[q(t,e.text,n)]:Y(e,t,n));if(!P(W)(e))return[{_tag:`Fields`,label:t,fields:[{label:`Value`,value:e}]}];let r=[],i={};for(let[a,o]of Object.entries(e))a===`content`&&Array.isArray(o)?r.push(...Y(o,t,n)):[`text`,`stdout`,`stderr`,`aggregatedOutput`,`message`].includes(a)?r.push(...Y(o,a===`text`?t:ft(a),n)):a===`error`?r.push(...Y(o,`Error`)):i[a]=o;return[...r,...J(t,i)]},pt=E({oldText:j,newText:j}),mt=E({path:j,diff:j,kind:E({type:j})}),ht=y(b(mt)),gt=w.check(me(1)),X=e=>/\.[cm]?tsx?$/iu.test(e)?`typescript`:/\.json$/iu.test(e)?`json`:`text`,_t=e=>Y(e,`Confirmation`).map(e=>e._tag===`Code`?{_tag:`Text`,label:e.label,text:e.text}:e),vt=(e,t,n)=>{let r=G(e),i=G(t),a=ht(i.changes??r.changes),o=K(r.path)??K(r.file_path),s=P(gt)(r.offset)?r.offset:void 0,c=P(gt)(r.limit)?r.limit:void 0,l=s??(r.offset===void 0?1:void 0),u=n===`read`&&(s!==void 0||c!==void 0)?[l===void 0?``:`From line ${l}`,c===void 0?``:`up to ${c} ${c===1?`line`:`lines`}`].filter(e=>e!==``).join(` · `):``,d=[o??`File details unavailable`,u].filter(e=>e!==``).join(` · `),f=K(G(i.details).patch)??K(G(i.details).diff),p=y(b(pt))(r.edits),m=se(p,()=>P(j)(r.old_string)&&P(j)(r.new_string)?[{oldText:r.old_string,newText:r.new_string}]:[]);return{activity:{_tag:`Files`,operation:i.type===`fileChange`||r.type===`fileChange`?`change`:n,paths:A(a,{onNone:()=>o===void 0?[]:[o],onSome:e=>e.map(({path:e})=>e)})},title:{read:`Read file`,edit:`Edit file`,write:`Write file`}[n],subject:n===`read`?d:o??A(a,{onNone:()=>`File details unavailable`,onSome:e=>e.length===1?e[0]?.path??`File details unavailable`:`${e.length} files`}),input:[...J(`Options`,r,[`path`,`file_path`,`edits`,`old_string`,`new_string`,`content`,`changes`,`type`,`id`,`status`,...n===`read`&&s!==void 0?[`offset`]:[],...n===`read`&&c!==void 0?[`limit`]:[]]),...(f===void 0?m:[]).flatMap(({oldText:e,newText:t},n)=>[q(m.length===1?`Before`:`Before ${n+1}`,e,X(o??``)),q(m.length===1?`After`:`After ${n+1}`,t,X(o??``))]),...P(j)(r.content)?[q(`Content`,r.content,X(o??``))]:[],...t===void 0?A(ht(r.changes),{onNone:()=>[],onSome:e=>e.map(({path:e,diff:t})=>q(e,t,`diff`))}):[]],output:A(ht(i.changes),{onNone:()=>f===void 0?n===`read`?Y(t,o??`Output`,X(o??``)):_t(t):[q(o??`Changes`,f,`diff`),..._t(Object.fromEntries(Object.entries(i).filter(([e])=>e!==`details`))),...J(`Metadata`,G(i.details),[`patch`,`diff`])],onSome:e=>e.map(({path:e,diff:t,kind:n})=>q(`${e} · ${n.type}`,t,`diff`))})}},yt=e=>{switch(e.toLowerCase()){case`bash`:case`powershell`:case`shell`:case`command`:return`command`;case`read`:return`read`;case`edit`:case`file_change`:return`edit`;case`write`:return`write`;case`grep`:case`glob`:case`find`:case`ls`:case`web_search`:return`search`;case`subagent`:case`agent`:case`task`:return`agent`;default:return`tool`}},bt=({input:e,output:t})=>{let n=G(e??t),r=G(t),i=K(n.command)??K(r.command);return{activity:{_tag:`Command`,command:i},title:`Command`,subject:i??`Command details unavailable`,input:[...i===void 0?[]:[q(`Command`,i,`bash`)],...J(`Options`,n,[`command`,`type`,`id`,`status`,`aggregatedOutput`,`exitCode`,`durationMs`,`processId`,`source`,`commandActions`])],output:r.type===`commandExecution`?[...Y(r.aggregatedOutput,`Output`),...J(`Execution`,r,[`type`,`id`,`status`,`command`,`cwd`,`aggregatedOutput`,`processId`,`source`,`commandActions`])]:Y(t,`Output`)}},xt=({input:e,output:t,name:n})=>{let r=G(e??t),i=G(t),a=G(r.action);return{activity:{_tag:`Search`},title:n.toLowerCase()===`ls`?`List files`:`Search`,subject:K(r.pattern)??K(r.query)??K(a.query)??K(a.url)??K(r.path)??`Search details unavailable`,input:J(`Search`,r,[`type`,`id`]),output:i.type===`webSearch`?J(`Search`,i,[`type`,`id`]):Y(t,`Results`)}},St=({input:e,output:t})=>{let n=G(e),r=K(n.task)??K(n.prompt);return{activity:{_tag:`Delegation`},title:`Delegate`,subject:K(n.description)??r??`Delegated task`,input:[...r===void 0?[]:[{_tag:`Text`,label:`Task`,text:r}],...J(`Agent`,n,[`task`,`prompt`])],output:Y(t,`Report`).map(e=>e._tag===`Code`?{_tag:`Text`,label:e.label,text:e.text}:e)}},Ct=({input:e,output:t,name:n})=>{let r=G(e),i=G(t),a=r.type===`mcpToolCall`||r.type===`dynamicToolCall`||i.type===`mcpToolCall`||i.type===`dynamicToolCall`,o=a?r.arguments??i.arguments:e;return{activity:{_tag:`Tool`},title:(a?[K(r.server)??K(i.server)??K(r.namespace)??K(i.namespace),K(r.tool)??K(i.tool)].filter(e=>e!==void 0).join(` · `):n)||n,subject:P(W)(o)?`${Object.keys(o).length} parameters`:P(j)(o)?o:`Tool details`,input:Y(o,`Parameters`),output:a?[...Y(i.result??i.contentItems,`Output`),...Y(i.error,`Error`)]:Y(t,`Output`)}},wt=e=>{let t={name:e.name,input:A(e.start,{onNone:()=>void 0,onSome:({input:e})=>e}),output:M(e.state,{Running:()=>void 0,Stopped:()=>void 0,Finished:({output:e})=>e,Error:({output:e})=>e})},n=yt(e.name);return{category:n,...{command:bt,read:({input:e,output:t})=>vt(e,t,`read`),edit:({input:e,output:t})=>vt(e,t,`edit`),write:({input:e,output:t})=>vt(e,t,`write`),search:xt,agent:St,tool:Ct}[n](t)}},Z=(e,t)=>{let n=Math.max(0,Math.floor((t-Date.parse(e))/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m ${n%60}s`:`${Math.floor(r/60)}h ${r%60}m`},Tt=({since:e,className:t})=>{let n=L(1e3);return(0,B.jsx)(`time`,{dateTime:e,"aria-live":`off`,className:m(`font-mono tabular-nums`,t),title:`Since ${be(e)}`,children:Z(e,n)})},Et=e=>{if(e.status!==`Live`)return{label:e.status,detail:``,since:T()};if(e.paused||e.held||e.idle)return{label:ut(e),detail:``,since:T()};let t=[...e.entries].reverse().find(e=>e._tag===`Tool`&&e.state._tag===`Running`);if(t?._tag!==`Tool`)return{label:`Working`,detail:``,since:T()};let n=wt(t);return{label:{command:`Running command`,read:`Reading file`,edit:`Editing file`,write:`Writing file`,search:`Searching`,agent:`Delegating`,tool:`Running ${n.title}`}[n.category],detail:n.subject,since:k(t.start,({receivedAt:e})=>e)}},Dt=e=>{let t=e.filter(({status:e})=>e===`Live`);return t.filter(({session:e})=>e._tag===`ChildSession`).sort((e,t)=>t.latestSequence-e.latestSequence)[0]??t.find(({session:e})=>e._tag===`ParentSession`)},Ot=({chapter:e})=>{let t=L(1e3),n=Dt(e.sessions),r=n===void 0?{label:`Parent session starting`,detail:``,since:T()}:Et(n);return(0,B.jsxs)(`div`,{role:`status`,"aria-label":`Current activity`,className:`min-w-0 space-y-0.5 text-xs`,children:[(0,B.jsxs)(`p`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(Ae,{running:!0,className:`size-3 text-run-active`}),n!==void 0&&(0,B.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:n.session._tag===`ParentSession`?`Parent`:n.session.agent}),(0,B.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:r.label}),A(r.since,{onNone:()=>null,onSome:e=>(0,B.jsx)(`span`,{"aria-live":`off`,className:`ml-auto shrink-0 font-mono tabular-nums text-muted-foreground`,title:`Started ${be(e)}`,children:Z(e,t)})})]}),r.detail!==``&&(0,B.jsx)(`p`,{className:`truncate pl-5 font-mono text-muted-foreground`,title:r.detail,children:r.detail}),A(e.lastActivityAt,{onNone:()=>null,onSome:e=>(0,B.jsxs)(`p`,{"aria-live":`off`,className:`pl-5 text-muted-foreground`,children:[`Last activity `,Z(e,t),` ago`]})}),e.connectivity.map(e=>(0,B.jsx)(kt,{warning:e,now:t},e._tag===`WorkerSilent`?e.worker:`${e.agent}:${e.since}`))]})},kt=({warning:e,now:t})=>{let n=M(e,{WorkerSilent:({worker:e,lastAnsweredAt:t})=>({text:`${e} silent since ${_e(t)}`,since:t,detail:null}),ProviderRetrying:({agent:e,retries:t,since:n,message:r})=>({text:`${e}: provider unreachable, ${U(t)} since ${_e(n)}`,since:n,detail:r})});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-2 pl-5`,children:[(0,B.jsxs)(`span`,{className:`min-w-0 text-warning`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:`Warning: `}),n.text]}),(0,B.jsx)(`span`,{"aria-live":`off`,className:`ml-auto shrink-0 font-mono tabular-nums text-muted-foreground`,title:`Since ${be(n.since)}`,children:Z(n.since,t)})]}),n.detail!==null&&(0,B.jsx)(`p`,{className:`truncate pl-5 text-muted-foreground`,title:n.detail,children:n.detail})]})},At=e=>{let t=null,n=new Map;for(let{payload:r,receivedAt:i}of e)if(r._tag===`WorkerUnresponsive`)t={_tag:`WorkerSilent`,worker:r.worker,lastAnsweredAt:ue(r.lastAnsweredAt)};else if(r._tag===`WorkerResponsive`)t=null;else if(r._tag===`SessionEvent`){let e=r.event;e._tag===`ProviderRetrying`?n.set(e.session.id,{_tag:`ProviderRetrying`,sessionId:e.session.id,agent:e.session.agent,message:e.message,retries:e.retries,since:n.get(e.session.id)?.since??i}):(e._tag===`ProviderRecovered`||e._tag===`SessionIdle`||e._tag===`SessionFinished`)&&n.delete(e.session.id)}return[...t===null?[]:[t],...n.values()]},jt=/^\s*\[usine:(blocked|question|failed|provider-capacity)\]/u,Mt=e=>{let t=jt.exec(e)?.[1];return t===`blocked`||t===`question`?t:null},Q=e=>e.replace(jt,``).trimStart(),Nt=e=>Q(e).replace(/\s+/gu,` `).trim(),Pt=e=>e.replace(/^\s{0,3}(?:#{1,6}\s+|[-*+]\s+|\d+[.)]\s+|>\s?)/u,``).replace(/!?\[([^\]]*)\]\([^)]*\)/gu,`$1`).replace(/`([^`]*)`/gu,`$1`).replace(/(\*\*|__)(.+?)\1/gu,`$2`).replace(/(^|[\s(])\*(\S(?:.*?\S)?)\*(?=[\s).,;:!?]|$)/gu,`$1$2`).trim(),Ft=e=>e.replace(/```[\s\S]*?(?:```|$)/gu,`
1
+ import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{a as r}from"./queries-CU77zJnf.js";import{a as i,c as a,h as o,i as s,l as c,n as l,o as u,s as d,v as f}from"./actions-BJ8FViiC.js";import{W as p,r as m,t as h}from"./button-CzVqBv_O.js";import{a as ee,c as g,s as _}from"./useTriggerFocusGuards-u-Jz4hr2.js";import{i as te}from"./context-8jHKzDOY.js";import{An as v,At as ne,Bt as y,Ct as b,Dn as x,Dt as S,En as C,Et as w,Fn as T,Ft as E,In as D,Ln as O,Lt as re,Mn as ie,Mt as ae,Nn as k,Nt as oe,On as se,Pn as A,Pt as j,Rn as ce,St as M,Tn as N,Wt as P,Zt as le,en as ue,jt as de,kn as fe,m as pe,qt as me,rn as he,wn as ge}from"./api-D3RWLycx.js";import{i as _e,r as ve,s as ye,v as be}from"./strings-BIVdGoBr.js";import{A as xe,D as Se,E as F,G as Ce,K as we,L as Te,M as Ee,N as I,T as De}from"./overview-DLYaCoiG.js";import{a as L,n as R,r as Oe}from"./page-BEpkTOW0.js";import{t as ke}from"./error-alert-Bq-SD6of.js";import{t as Ae}from"./usine-mark-B7sGtLae.js";import{R as je,ft as Me,st as Ne,ut as Pe}from"./index-B_6qmKij.js";import{t as Fe}from"./pull-request-marks-_FfWkWIz.js";import{n as Ie}from"./status-badge-B2-vzEoZ.js";import{n as Le}from"./usage-ZTnmWdRP.js";import{t as Re}from"./markdown-DQ2LWxl6.js";var z=e(t(),1),ze=new Map([[`bold`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M188,86.11V84c0-14.62-10.83-27.55-30.51-36.4C140.87,40.12,119,36,96,36S51.13,40.12,34.51,47.6C14.83,56.45,4,69.38,4,84v40c0,14.62,10.83,27.55,30.51,36.4A131.67,131.67,0,0,0,68,169.88V172c0,14.62,10.83,27.55,30.51,36.4C115.13,215.88,137,220,160,220s44.87-4.12,61.49-11.6C241.17,199.55,252,186.62,252,172V132C252,109.86,226.71,92.08,188,86.11ZM228,132c0,7.75-21.77,22.48-61.81,23.88C180.33,147.4,188,136.3,188,124V110.44C213.88,115.15,228,125.48,228,132ZM107.37,147.63c-3.63.24-7.42.37-11.37.37-5.08,0-9.89-.22-14.43-.61a10.94,10.94,0,0,0-1.14-.09c-1.51-.14-3-.3-4.43-.48V130.93A187,187,0,0,0,96,132a187,187,0,0,0,20-1.07v15.89c-2.49.3-5.07.56-7.75.75C108,147.58,107.66,147.6,107.37,147.63ZM164,117.14V124c0,4.78-8.28,12.21-24,17.54v-15a115.32,115.32,0,0,0,17.49-6.13Q160.93,118.86,164,117.14ZM96,60c44,0,68,15.85,68,24s-24,24-68,24S28,92.15,28,84,52,60,96,60ZM28,124v-6.86q3.08,1.71,6.51,3.26A115.32,115.32,0,0,0,52,126.53v15C36.28,136.21,28,128.78,28,124Zm64,48v0c1.33,0,2.66,0,4,0q5.44,0,10.77-.32,4.45,1.57,9.23,2.86v15C100.28,184.21,92,176.78,92,172Zm48,22.82V178.94A186.45,186.45,0,0,0,160,180a187,187,0,0,0,20-1.07v15.89a170.08,170.08,0,0,1-40,0Zm64-5.28v-15a115.32,115.32,0,0,0,17.49-6.13q3.44-1.54,6.51-3.26V172C228,176.78,219.72,184.21,204,189.54Z`}))],[`duotone`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M240,132c0,19.88-35.82,36-80,36-19.6,0-37.56-3.17-51.47-8.44h0C146.76,156.85,176,142,176,124V96.72h0C212.52,100.06,240,114.58,240,132ZM176,84c0-19.88-35.82-36-80-36S16,64.12,16,84s35.82,36,80,36S176,103.88,176,84Z`,opacity:`0.2`}),z.createElement(`path`,{d:`M184,89.57V84c0-25.08-37.83-44-88-44S8,58.92,8,84v40c0,20.89,26.25,37.49,64,42.46V172c0,25.08,37.83,44,88,44s88-18.92,88-44V132C248,111.3,222.58,94.68,184,89.57ZM232,132c0,13.22-30.79,28-72,28-3.73,0-7.43-.13-11.08-.37C170.49,151.77,184,139,184,124V105.74C213.87,110.19,232,122.27,232,132ZM72,150.25V126.46A183.74,183.74,0,0,0,96,128a183.74,183.74,0,0,0,24-1.54v23.79A163,163,0,0,1,96,152,163,163,0,0,1,72,150.25Zm96-40.32V124c0,8.39-12.41,17.4-32,22.87V123.5C148.91,120.37,159.84,115.71,168,109.93ZM96,56c41.21,0,72,14.78,72,28s-30.79,28-72,28S24,97.22,24,84,54.79,56,96,56ZM24,124V109.93c8.16,5.78,19.09,10.44,32,13.57v23.37C36.41,141.4,24,132.39,24,124Zm64,48v-4.17c2.63.1,5.29.17,8,.17,3.88,0,7.67-.13,11.39-.35A121.92,121.92,0,0,0,120,171.41v23.46C100.41,189.4,88,180.39,88,172Zm48,26.25V174.4a179.48,179.48,0,0,0,24,1.6,183.74,183.74,0,0,0,24-1.54v23.79a165.45,165.45,0,0,1-48,0Zm64-3.38V171.5c12.91-3.13,23.84-7.79,32-13.57V172C232,180.39,219.59,189.4,200,194.87Z`}))],[`fill`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M184,89.57V84c0-25.08-37.83-44-88-44S8,58.92,8,84v40c0,20.89,26.25,37.49,64,42.46V172c0,25.08,37.83,44,88,44s88-18.92,88-44V132C248,111.3,222.58,94.68,184,89.57ZM56,146.87C36.41,141.4,24,132.39,24,124V109.93c8.16,5.78,19.09,10.44,32,13.57Zm80-23.37c12.91-3.13,23.84-7.79,32-13.57V124c0,8.39-12.41,17.4-32,22.87Zm-16,71.37C100.41,189.4,88,180.39,88,172v-4.17c2.63.1,5.29.17,8,.17,3.88,0,7.67-.13,11.39-.35A121.92,121.92,0,0,0,120,171.41Zm0-44.62A163,163,0,0,1,96,152a163,163,0,0,1-24-1.75V126.46A183.74,183.74,0,0,0,96,128a183.74,183.74,0,0,0,24-1.54Zm64,48a165.45,165.45,0,0,1-48,0V174.4a179.48,179.48,0,0,0,24,1.6,183.74,183.74,0,0,0,24-1.54ZM232,172c0,8.39-12.41,17.4-32,22.87V171.5c12.91-3.13,23.84-7.79,32-13.57Z`}))],[`light`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M224.56,103.81C213.43,97.75,198.47,93.39,182,91.34V84c0-12.12-9.58-23.1-27-30.93C139.16,45.93,118.2,42,96,42S52.84,45.93,37,53.07C19.58,60.9,10,71.88,10,84v40c0,12.12,9.58,23.1,27,30.93,10.49,4.72,23.21,8,37,9.73V172c0,12.12,9.58,23.1,27,30.93C116.84,210.07,137.8,214,160,214s43.16-3.93,59-11.07c17.39-7.83,27-18.81,27-30.93V132C246,121.35,238.39,111.34,224.56,103.81Zm-5.74,10.54C228.61,119.68,234,126,234,132c0,14.19-30.39,30-74,30a166.9,166.9,0,0,1-21.21-1.34A110.79,110.79,0,0,0,155,154.93c17.39-7.83,27-18.81,27-30.93V103.43C196.4,105.36,209.3,109.16,218.82,114.35ZM108.16,153.58c-3.92.27-8,.42-12.16.42-5.3,0-10.4-.24-15.28-.67a2.22,2.22,0,0,0-.37,0c-3.58-.33-7-.77-10.35-1.3V124.12A178,178,0,0,0,96,126a178,178,0,0,0,26-1.88V152c-4.34.69-8.91,1.22-13.69,1.56ZM170,105.89V124c0,9.54-13.75,19.8-36,25.51V121.85a115,115,0,0,0,21-6.92A66.2,66.2,0,0,0,170,105.89ZM96,54c43.61,0,74,15.81,74,30s-30.39,30-74,30S22,98.19,22,84,52.39,54,96,54ZM22,124V105.89a66.2,66.2,0,0,0,15,9,115,115,0,0,0,21,6.92v27.66C35.75,143.8,22,133.54,22,124Zm64,48v-6.28c3.3.18,6.63.28,10,.28q5.91,0,11.66-.37A123.17,123.17,0,0,0,122,169.84v27.67C99.75,191.8,86,181.54,86,172Zm48,28V172.1a177.84,177.84,0,0,0,26,1.9,178,178,0,0,0,26-1.88V200a170,170,0,0,1-52,0Zm64-2.49V169.85a115,115,0,0,0,21-6.92,66.2,66.2,0,0,0,15-9V172C234,181.54,220.25,191.8,198,197.51Z`}))],[`regular`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M184,89.57V84c0-25.08-37.83-44-88-44S8,58.92,8,84v40c0,20.89,26.25,37.49,64,42.46V172c0,25.08,37.83,44,88,44s88-18.92,88-44V132C248,111.3,222.58,94.68,184,89.57ZM232,132c0,13.22-30.79,28-72,28-3.73,0-7.43-.13-11.08-.37C170.49,151.77,184,139,184,124V105.74C213.87,110.19,232,122.27,232,132ZM72,150.25V126.46A183.74,183.74,0,0,0,96,128a183.74,183.74,0,0,0,24-1.54v23.79A163,163,0,0,1,96,152,163,163,0,0,1,72,150.25Zm96-40.32V124c0,8.39-12.41,17.4-32,22.87V123.5C148.91,120.37,159.84,115.71,168,109.93ZM96,56c41.21,0,72,14.78,72,28s-30.79,28-72,28S24,97.22,24,84,54.79,56,96,56ZM24,124V109.93c8.16,5.78,19.09,10.44,32,13.57v23.37C36.41,141.4,24,132.39,24,124Zm64,48v-4.17c2.63.1,5.29.17,8,.17,3.88,0,7.67-.13,11.39-.35A121.92,121.92,0,0,0,120,171.41v23.46C100.41,189.4,88,180.39,88,172Zm48,26.25V174.4a179.48,179.48,0,0,0,24,1.6,183.74,183.74,0,0,0,24-1.54v23.79a165.45,165.45,0,0,1-48,0Zm64-3.38V171.5c12.91-3.13,23.84-7.79,32-13.57V172C232,180.39,219.59,189.4,200,194.87Z`}))],[`thin`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M180,93.11V84c0-22.43-36.9-40-84-40S12,61.57,12,84v40c0,19.14,26.86,34.72,64,38.89V172c0,22.43,36.9,40,84,40s84-17.57,84-40V132C244,113.12,217.87,97.37,180,93.11ZM236,132c0,15.45-30.54,32-76,32a165.71,165.71,0,0,1-28-2.34v-1.39c28.61-6.31,48-20,48-36.27V101.17C212.22,105,236,117.93,236,132ZM108.19,155.59Q102.3,156,96,156c-5.47,0-10.72-.25-15.73-.69l-.27,0h0c-4.16-.38-8.16-.9-12-1.56V121.8A174.87,174.87,0,0,0,96,124a174.87,174.87,0,0,0,28-2.2v31.92a155,155,0,0,1-15.52,1.85ZM172,101.32V124c0,10.88-15.16,22.3-40,28.11V120.27C149.63,116.38,163.75,109.69,172,101.32ZM96,52c45.46,0,76,16.55,76,32s-30.54,32-76,32S20,99.45,20,84,50.54,52,96,52ZM20,124V101.32c8.25,8.37,22.37,15.06,40,19v31.84C35.16,146.3,20,134.88,20,124Zm64,48v-8.4c3.91.26,7.92.4,12,.4s8.06-.14,12-.39a123.93,123.93,0,0,0,16,4.63v31.87C99.16,194.3,84,182.88,84,172Zm48,29.72V169.77A174.48,174.48,0,0,0,160,172a174.87,174.87,0,0,0,28-2.2v31.92a173.07,173.07,0,0,1-56,0ZM236,172c0,10.88-15.16,22.3-40,28.11V168.27c17.63-3.89,31.75-10.58,40-19Z`}))]]),Be=new Map([[`bold`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,44a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,44Zm0,168a72,72,0,1,1,72-72A72.08,72.08,0,0,1,128,212ZM164.49,99.51a12,12,0,0,1,0,17l-28,28a12,12,0,0,1-17-17l28-28A12,12,0,0,1,164.49,99.51ZM92,16A12,12,0,0,1,104,4h48a12,12,0,0,1,0,24H104A12,12,0,0,1,92,16Z`}))],[`duotone`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M216,136a88,88,0,1,1-88-88A88,88,0,0,1,216,136Z`,opacity:`0.2`}),z.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`fill`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm45.66,61.66-40,40a8,8,0,0,1-11.32-11.32l40-40a8,8,0,0,1,11.32,11.32ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`light`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,42a94,94,0,1,0,94,94A94.11,94.11,0,0,0,128,42Zm0,176a82,82,0,1,1,82-82A82.1,82.1,0,0,1,128,218ZM172.24,91.76a6,6,0,0,1,0,8.48l-40,40a6,6,0,1,1-8.48-8.48l40-40A6,6,0,0,1,172.24,91.76ZM98,16a6,6,0,0,1,6-6h48a6,6,0,0,1,0,12H104A6,6,0,0,1,98,16Z`}))],[`regular`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,40a96,96,0,1,0,96,96A96.11,96.11,0,0,0,128,40Zm0,176a80,80,0,1,1,80-80A80.09,80.09,0,0,1,128,216ZM173.66,90.34a8,8,0,0,1,0,11.32l-40,40a8,8,0,0,1-11.32-11.32l40-40A8,8,0,0,1,173.66,90.34ZM96,16a8,8,0,0,1,8-8h48a8,8,0,0,1,0,16H104A8,8,0,0,1,96,16Z`}))],[`thin`,z.createElement(z.Fragment,null,z.createElement(`path`,{d:`M128,44a92,92,0,1,0,92,92A92.1,92.1,0,0,0,128,44Zm0,176a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,220ZM170.83,93.17a4,4,0,0,1,0,5.66l-40,40a4,4,0,1,1-5.66-5.66l40-40A4,4,0,0,1,170.83,93.17ZM100,16a4,4,0,0,1,4-4h48a4,4,0,0,1,0,8H104A4,4,0,0,1,100,16Z`}))]]),Ve=z.forwardRef((e,t)=>z.createElement(p,{ref:t,...e,weights:ze}));Ve.displayName=`CoinsIcon`;var He=z.forwardRef((e,t)=>z.createElement(p,{ref:t,...e,weights:Be}));He.displayName=`TimerIcon`;var Ue=E({number:ae,title:j,url:j,state:j,body:le(de(j)),author:le(de(E({login:j}))),labels:le(E({nodes:b(E({name:j}))}))}),We=re(pe),Ge=y(Ue),Ke=e=>k(Ge(e),e=>({kind:e.url.includes(`/pull/`)?`Pull request`:`Issue`,number:e.number,title:e.title,url:e.url,state:e.state.charAt(0)+e.state.slice(1).toLowerCase(),author:x(e.author?.login),labels:e.labels?.nodes.map(({name:e})=>e)??[],body:N(x(e.body),e=>e.trim()!==``)})),qe=new Map([[`Issue Open`,`issue-open`],[`Issue Closed`,`issue-closed`],[`Pull request Open`,`pr-open`],[`Pull request Closed`,`pr-closed`],[`Pull request Merged`,`pr-merged`]]),Je=({kind:e,number:t,url:n,state:r})=>({kind:e===`Pull request`?`pr`:`issue`,number:t,url:n,state:qe.get(`${e} ${r}`)??null}),Ye=(e,t,n)=>k(We(e.itemKey),([,r,i])=>{let a=v(C(g(t,e.itemKey),({items:t})=>x(t.find(({itemKey:t})=>t===e.itemKey)))),o=v(N(n===void 0?T():Ke(n),e=>e.number===i));return{number:i,url:a?.url??o?.url??`https://github.com/${r}/issues/${i}`,title:x(a?.title??o?.title),pullRequest:a===void 0?o?.kind===`Pull request`:a.kind===`pr`}}),Xe=(e,t)=>A(Ke(t),{onNone:()=>`Opened by ${e}`,onSome:({kind:t,number:n,state:r,labels:i})=>`${e} matched ${t.toLowerCase()} #${n}: ${r.toLowerCase()}${i.length===0?``:`, labeled ${i.join(`, `)}`}`}),Ze=(e,t,n,r)=>{let i=k(n,ee),a=A(n,{onNone:()=>[],onSome:({items:e})=>e}),o=C(x(e.pullRequestUrl),e=>_(e,a)),s=k(t,({number:e,url:t,pullRequest:n})=>a.find(t=>t.number===e)??{kind:r===null?n||ge(o,t=>t.number===e)?`pr`:`issue`:r.startsWith(`pr-`)?`pr`:`issue`,number:e,url:t,state:r}),c=A(i,{onNone:()=>s,onSome:({origin:e})=>O(e)});return{heading:c,title:k(i,({origin:e})=>e.title),pullRequest:N(D(o,()=>N(s,({kind:e})=>e===`pr`)),e=>!ge(c,({number:t})=>t===e.number))}},B=n(),Qe=(e,t)=>se(C(t,({title:e})=>e),()=>`${e.loop} on ${e.repository}`),$e=({endedMillis:e,since:t})=>{let n=L(1e3);return(0,B.jsx)(B.Fragment,{children:ye(e+Math.max(0,n-Date.parse(t)))})},et=({duration:e})=>(0,B.jsxs)(`span`,{title:e.unmeasured===0?`Total attempt time`:`${e.unmeasured} ${e.unmeasured===1?`attempt`:`attempts`} not counted: no recorded end time`,className:`font-mono text-xs tabular-nums`,children:[e.unmeasured>0&&`at least `,e.runningSince===null?ye(e.endedMillis):(0,B.jsx)($e,{endedMillis:e.endedMillis,since:e.runningSince})]}),tt=({detail:e})=>{let{machine:t,run:n}=e;return t===null||t.state!==`ready`||t.id===null||t.attemptId===null||t.attemptId!==n.attempts.at(-1)?.id?null:(0,B.jsx)(`span`,{className:`font-mono text-xs`,title:`${Ce[t.provider]} ${we[t.provider]} ${t.id}`,children:t.id})},nt=({detail:e,overview:t,placement:n,shared:r,actions:i,as:a,className:o})=>{let{run:s}=e,c=Ye(s,t,e.eventPayload),l=Ze(s,c,g(t,s.itemKey),e.settledItemState);return(0,B.jsx)(Oe,{actionsBeside:n===`page`?`lg`:`never`,...o===void 0?{}:{className:o},eyebrow:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(R,{icon:Me,title:`Loop`,children:s.loop}),(0,B.jsx)(R,{icon:Ne,title:`Agent`,children:s.agent})]}),heading:(0,B.jsx)(je,{variant:`page`,item:l.heading,title:se(l.title,()=>Qe(s,c)),...a===void 0?{}:{as:a},...r?{style:{viewTransitionName:`run-title`}}:{}}),facts:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2 font-medium text-foreground`,style:r?{viewTransitionName:`run-state`}:void 0,children:[(0,B.jsx)(Ie,{state:s.state,className:`ml-0.75`}),Te(s,e.unconfirmedStop,e.machine)]}),(0,B.jsx)(Fe,{pullRequests:ce(l.pullRequest)}),e.worker!==null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(R,{icon:He,children:(0,B.jsx)(et,{duration:e.duration})}),n===`page`&&e.usage.sessions.length>0&&(0,B.jsx)(R,{icon:Ve,children:(0,B.jsx)(Le,{usage:e.usage,attempts:s.attempts})}),(0,B.jsxs)(R,{icon:Pe,title:`Worker`,children:[e.worker,(0,B.jsx)(tt,{detail:e})]})]}),s.loopPaused&&(0,B.jsx)(`span`,{children:`Loop paused`})]}),actions:i})},V=e=>M(e,{Approve:()=>I.approve,Retry:()=>I.retry,EditRetry:()=>`Edit and retry`,RunAgain:()=>I.runAgain,EditRunAgain:()=>`Edit and run again`,Resolve:({question:e})=>e?`Mark answered`:`Mark resolved`,Cancel:()=>I.cancel}),rt=e=>{let t=e.attempts.at(-1),n=t?.outcome?._tag===`Failed`?t.outcome.failure._tag:null,r=[...e.canApprove?[{_tag:`Approve`}]:[],...e.canRetry?[{_tag:`Retry`},{_tag:`EditRetry`}]:[],...e.canRunAgain?[{_tag:`RunAgain`},{_tag:`EditRunAgain`}]:[],...e.canResolveFailure&&t!==void 0?[{_tag:`Resolve`,attemptId:t.id,question:n===`QuestionFailure`}]:[],...e.canCancel?[{_tag:`Cancel`}]:[]],i=e=>e.flatMap(e=>r.filter(t=>t._tag===e)),a=(()=>{if(e.canApprove){let[e=null]=i([`Approve`]);return{primary:e,secondary:null,more:i([`Cancel`])}}if(e.state===`Failed`){let t=e.canResolveFailure&&(n===`QuestionFailure`||n===`BlockedFailure`),[r=null,a=null,...o]=i(t?[`Resolve`,`EditRetry`,`Retry`]:[`Retry`,`EditRetry`,`Resolve`]);return{primary:r,secondary:a,more:o}}let[t=null,...r]=i(e.canRunAgain?[`RunAgain`,`EditRunAgain`]:[`Cancel`]);return{primary:null,secondary:t,more:r}})(),o=new Set([a.primary,a.secondary,...a.more]);return{...a,more:[...a.more,...r.filter(e=>!o.has(e))]}},it=({detail:e,onEdit:t,openRun:n,className:r})=>{let{run:p,agentDefinitionChanged:ee}=e,g=(0,z.useId)(),_=s(),v=i(),[ne,y]=(0,z.useState)(!1),b=_.isPending||v.isPending,x=e=>_.mutate({runId:p.id,request:e},{onSuccess:()=>y(!1)}),S=e=>M(e,{Approve:()=>x({action:`approve`}),Retry:()=>x({action:`retry`}),EditRetry:()=>t(`retry`),RunAgain:()=>v.mutate(l(p),{onSuccess:e=>{e._tag===`Claimed`&&n(e.runId)}}),EditRunAgain:()=>t(`runAgain`),Resolve:({attemptId:e})=>x({action:`resolveFailure`,attemptId:e}),Cancel:()=>y(!0)}),{primary:C,secondary:w,more:T}=rt(p);return te(b||ne?[]:[C,w,...T].flatMap(e=>e===null?[]:[{label:`${V(e)} · ${p.id}`,run:()=>S(e)}])),C===null&&w===null&&T.length===0?null:(0,B.jsxs)(`div`,{className:m(`max-w-sm space-y-2`,r),children:[(0,B.jsx)(`div`,{role:`group`,"aria-label":`Run actions`,className:`flex flex-wrap items-center gap-2`,children:ne?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(h,{variant:`destructive`,disabled:b,onClick:()=>x({action:`cancel`}),children:I.confirmCancel}),(0,B.jsx)(h,{variant:`ghost`,disabled:b,onClick:()=>y(!1),children:I.keepRunning})]}):(0,B.jsxs)(B.Fragment,{children:[C!==null&&(0,B.jsx)(h,{disabled:b,"aria-describedby":C._tag===`Retry`?g:void 0,onClick:()=>S(C),children:V(C)}),w!==null&&(0,B.jsx)(h,{variant:w._tag===`Cancel`?`ghost`:`outline`,disabled:b,"aria-describedby":w._tag===`Retry`?g:void 0,onClick:()=>S(w),children:V(w)}),T.length>0&&(0,B.jsxs)(u,{children:[(0,B.jsx)(o,{disabled:b,render:(0,B.jsx)(h,{variant:`ghost`,size:`icon`,className:`text-muted-foreground hover:text-foreground aria-expanded:text-foreground`}),"aria-label":`More actions`,children:(0,B.jsx)(f,{weight:`bold`,className:`size-4`,"aria-hidden":`true`})}),(0,B.jsx)(d,{align:`end`,className:`w-auto min-w-44`,children:(0,B.jsx)(a,{children:T.map(e=>(0,B.jsx)(c,{"aria-describedby":e._tag===`Retry`?g:void 0,variant:e._tag===`Cancel`?`destructive`:`default`,onClick:()=>S(e),children:V(e)},e._tag))})})]})]})}),p.canRetry&&(0,B.jsxs)(`div`,{className:`space-y-1 text-xs wrap-anywhere text-muted-foreground`,children:[(0,B.jsx)(`p`,{id:g,children:Ee(p.agentBrain)}),ee&&(0,B.jsxs)(`p`,{children:[`The loaded definition of `,p.agent,` has changed. Edit and retry uses the current definition.`]})]}),v.data?._tag===`CycleBlocked`&&(0,B.jsx)(`p`,{role:`status`,className:`text-xs text-needs-you`,children:`No run opened: cycle budget used up. Reset it in Needs attention`}),_.isError&&(0,B.jsx)(ke,{message:_.error.message}),v.isError&&(0,B.jsx)(ke,{message:v.error.message})]})},at=(e,t,n)=>{let r=new Set(e.map(({sequence:e})=>e)),i=[...new Map([...t,...e].map(e=>[e.sequence,e])).values()].sort((e,t)=>e.sequence-t.sequence),a=new Map,o=new Map,s=(e,t)=>JSON.stringify([e,t]);for(let e of i){let t=e.payload;if(t._tag!==`SessionEvent`)continue;let i=t.event;if(i._tag===`PoolRateLimitsUpdated`||i._tag===`SessionTokensUpdated`)continue;let c=s(e.attemptId,i.session.id),l=a.get(c);l===void 0&&(l={attemptId:e.attemptId,session:i.session,first:e,harnessSession:T(),latestSequence:e.sequence,status:n.has(e.attemptId)?`Stopped`:`Live`,held:!1,paused:!1,idle:!1,events:[],interventions:[]},a.set(c,l),i.session._tag===`ParentSession`&&o.set(e.attemptId,l)),l.latestSequence=e.sequence,i._tag===`SessionStarted`&&(l.harnessSession=i.harnessSession),i._tag===`SessionFinished`&&(l.status=`Finished`),i._tag===`SessionIdle`&&(l.idle=!0),i._tag===`SessionResumed`&&(l.idle=!1),r.has(e.sequence)&&l.events.push({sequence:e.sequence,receivedAt:e.receivedAt,event:i})}let c=[],l=(e,t)=>JSON.stringify([e,t.inputSequence]),u=new Map;for(let{attemptId:e,payload:t}of i)(t._tag===`InterventionApplied`||t._tag===`InterventionRejected`)&&u.set(l(e,t),t);let d=new Set;for(let e of i){let t=e.payload;if(t._tag!==`InterventionApplied`&&t._tag!==`InterventionRejected`)continue;let n=l(e.attemptId,t),i={...e,payload:u.get(n)??t},f=t.intervention.target,p=f._tag===`Parent`?o.get(e.attemptId):a.get(s(e.attemptId,f.sessionId)),m=r.has(e.sequence)&&!d.has(n);m&&d.add(n),p===void 0?m&&c.push(i):(e.sequence>p.latestSequence&&(p.latestSequence=e.sequence),t._tag===`InterventionApplied`&&(p.held=t.state.held,p.paused=t.state.paused),m&&p.interventions.push(i))}return{groups:a,unmatched:c}},ot=e=>({key:`event:${e.sequence}`,attemptId:e.attemptId,sequence:e.sequence,latestSequence:e.sequence,receivedAt:e.receivedAt}),H=(e,t,n)=>({_tag:`Notice`,...ot(e),...t,origin:n,queued:null}),U=e=>`${e} ${e===1?`retry`:`retries`}`,st=(e,t)=>{let n=[],r=new Map;for(let i of e.events){let a=i.event,o={...i,attemptId:e.attemptId};if(a._tag===`ToolStarted`||a._tag===`ToolFinished`){let n=JSON.stringify([e.attemptId,e.session.id,a.callId]),s=r.get(n),c=s?.start??T();r.set(n,{_tag:`Tool`,...ot(o),key:n,sequence:s?.sequence??i.sequence,receivedAt:s?.receivedAt??i.receivedAt,name:a.tool,start:a._tag===`ToolStarted`?O({receivedAt:i.receivedAt,input:a.input}):c,state:a._tag===`ToolFinished`?{_tag:a.isError?`Error`:`Finished`,receivedAt:i.receivedAt,output:a.output}:s?.state??{_tag:t===`Live`?`Running`:`Stopped`}});continue}if(a._tag===`ProviderRetrying`||a._tag===`ProviderRecovered`){n.push(H(o,a._tag===`ProviderRetrying`?{kind:`status`,label:`${e.session.agent}: provider unreachable`,detail:a.message,format:`plain`,tone:`warning`}:{kind:`status`,label:`${e.session.agent}: provider reachable again`,detail:`After ${U(a.retries)}`,format:`plain`,tone:`plain`},{_tag:`Provider`,session:e.session,event:a}));continue}let s=M(a,{TextOutput:({text:t})=>({kind:`message`,label:e.session.agent,detail:t,format:`markdown`,tone:`plain`}),SessionStarted:()=>({kind:`status`,label:`${e.session.agent} started`,detail:ve(e.session.brain),format:`plain`,tone:`plain`}),SessionIdle:()=>({kind:`status`,label:`${e.session.agent} idle`,detail:`Session open for operator input`,format:`plain`,tone:`plain`}),SessionResumed:()=>({kind:`status`,label:`${e.session.agent} resumed`,detail:``,format:`plain`,tone:`plain`}),SessionFinished:()=>({kind:`status`,label:`${e.session.agent} finished`,detail:``,format:`plain`,tone:`plain`})});n.push(H(o,s,{_tag:`Session`,session:e.session,event:a._tag}))}return[...n,...r.values()].sort((e,t)=>e.sequence-t.sequence)},ct=e=>{let{action:t,operator:n,target:r}=e.payload.intervention,i=e.payload._tag===`InterventionRejected`,a=t._tag===`OperatorMessage`||t._tag===`Steer`,o=e.payload._tag===`InterventionApplied`&&e.payload.state.queued?r._tag===`Parent`?`parent`:`child`:null,s=`${n} released the ${r._tag===`Parent`?`parent`:`child`}`;return{...H(e,{kind:a?`message`:`status`,label:i?`${n} · not delivered`:a?n:t._tag===`Release`?s:`${n} paused the session`,detail:i?`${a?`${t.message}\n\n`:``}${e.payload.message}`:a?t.message:``,format:a?`markdown`:`plain`,tone:i?`failed`:`plain`},{_tag:`Operator`,operator:n}),queued:o}},lt=(e,t,n=[])=>{let r=new Set(t.filter(({outcome:e})=>e!==null).map(({id:e})=>e));for(let{attemptId:t,payload:n}of e)(n._tag===`Final`||n._tag===`Failed`||n._tag===`Interrupted`)&&r.add(t);let{groups:i,unmatched:a}=at(e,n,r),o=[];for(let t of[...e].sort((e,t)=>e.sequence-t.sequence)){let e=t.payload;e._tag!==`InterventionApplied`&&e._tag!==`InterventionRejected`&&(t.direction!==`inbound`||t.operator===void 0||e._tag===`Cancel`)&&e._tag!==`SessionEvent`&&o.push(H(t,M(e,{Started:({parentModel:e,conflictingSalvage:t})=>({kind:`status`,label:`Attempt started`,detail:A(t,{onNone:()=>e,onSome:t=>`${e}. ${De(t)}`}),format:`plain`,tone:`plain`}),Final:({result:e})=>({kind:`status`,label:`Attempt finished`,detail:e.message,format:`markdown`,tone:`plain`}),Failed:({failure:e})=>({kind:`status`,label:`Attempt failed`,detail:F(e),format:`plain`,tone:`failed`}),Cancel:()=>({kind:`status`,label:`Cancel requested`,detail:`Attempt stopping`,format:`plain`,tone:`plain`}),Interrupted:()=>({kind:`status`,label:`Interrupted`,detail:`Acknowledged by the parent session`,format:`plain`,tone:`plain`}),Steer:({message:e})=>({kind:`message`,label:`Operator`,detail:e,format:`markdown`,tone:`plain`}),Interrupt:()=>({kind:`status`,label:`Interrupt requested`,detail:`Sent by the operator`,format:`plain`,tone:`plain`}),OperatorMessage:({message:e})=>({kind:`message`,label:`Operator`,detail:e,format:`markdown`,tone:`plain`}),Release:()=>({kind:`status`,label:`Released`,detail:`Held child released by the operator`,format:`plain`,tone:`plain`}),WorkerUnresponsive:({worker:e,lastAnsweredAt:t,reason:n})=>({kind:`status`,label:`${e} silent since ${_e(ue(t))}`,detail:n,format:`plain`,tone:`warning`}),WorkerResponsive:({worker:e,lastAnsweredAt:n,recovered:r})=>({kind:`status`,label:r?`${e} answering again`:`${e} answering`,detail:r?`Silent for ${ye(Date.parse(t.receivedAt)-he(n))}`:``,format:`plain`,tone:`plain`})}),{_tag:`Envelope`,payload:e}))}let s=[];for(let[e,t]of i)s.push({_tag:`Session`,...ot(t.first),key:e,latestSequence:t.latestSequence,session:t.session,harnessSession:t.harnessSession,status:t.status,held:t.status===`Live`&&t.held,paused:t.status===`Live`&&t.paused,idle:t.status===`Live`&&t.idle,entries:[...st(t,t.status),...t.interventions.map(e=>ct(e))].sort((e,t)=>e.sequence-t.sequence)});return o.push(...a.map(e=>{let t=ct(e),n=e.payload.intervention.target;return{...t,label:`${t.label} · ${n._tag===`Parent`?`parent`:n.sessionId}`}})),{sessions:s,terminalAttempts:r,items:[...o,...s.flatMap(e=>e.session._tag===`ChildSession`?[e]:e.entries)].sort((e,t)=>e.sequence-t.sequence)}},ut=e=>{if(e.status!==`Live`)return e.status;if(e.paused)return`Paused`;if(e.held)return e.idle?`Held, waiting for input`:`Held, working`;if(e.idle)return`Waiting for input`;let t=[...e.entries].reverse().find(e=>e._tag===`Tool`&&e.state._tag===`Running`);return t?._tag===`Tool`?`Running ${t.name}`:`Working`},W=oe(j,S),dt=E({type:ne([`text`,`inputText`]),text:j}),G=e=>P(W)(e)?e:{},K=e=>P(j)(e)?e:void 0,ft=e=>{if(e===`cwd`)return`Working directory`;if(e===`durationMs`)return`Duration (ms)`;let t=e.replace(/([a-z])([A-Z])/gu,`$1 $2`).replaceAll(`_`,` `).toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)},q=(e,t,n=`text`)=>({_tag:`Code`,label:e,text:t,language:n}),J=(e,t,n=[])=>{let r=Object.entries(t).filter(([e])=>!n.includes(e)).map(([e,t])=>({label:ft(e),value:t}));return r.length===0?[]:[{_tag:`Fields`,label:e,fields:r}]},Y=(e,t,n=`text`)=>{if(e==null)return[];if(P(j)(e))return[q(t,e,n)];if(Array.isArray(e))return e.flatMap(e=>P(dt)(e)?[q(t,e.text,n)]:Y(e,t,n));if(!P(W)(e))return[{_tag:`Fields`,label:t,fields:[{label:`Value`,value:e}]}];let r=[],i={};for(let[a,o]of Object.entries(e))a===`content`&&Array.isArray(o)?r.push(...Y(o,t,n)):[`text`,`stdout`,`stderr`,`aggregatedOutput`,`message`].includes(a)?r.push(...Y(o,a===`text`?t:ft(a),n)):a===`error`?r.push(...Y(o,`Error`)):i[a]=o;return[...r,...J(t,i)]},pt=E({oldText:j,newText:j}),mt=E({path:j,diff:j,kind:E({type:j})}),ht=y(b(mt)),gt=w.check(me(1)),X=e=>/\.[cm]?tsx?$/iu.test(e)?`typescript`:/\.json$/iu.test(e)?`json`:`text`,_t=e=>Y(e,`Confirmation`).map(e=>e._tag===`Code`?{_tag:`Text`,label:e.label,text:e.text}:e),vt=(e,t,n)=>{let r=G(e),i=G(t),a=ht(i.changes??r.changes),o=K(r.path)??K(r.file_path),s=P(gt)(r.offset)?r.offset:void 0,c=P(gt)(r.limit)?r.limit:void 0,l=s??(r.offset===void 0?1:void 0),u=n===`read`&&(s!==void 0||c!==void 0)?[l===void 0?``:`From line ${l}`,c===void 0?``:`up to ${c} ${c===1?`line`:`lines`}`].filter(e=>e!==``).join(` · `):``,d=[o??`File details unavailable`,u].filter(e=>e!==``).join(` · `),f=K(G(i.details).patch)??K(G(i.details).diff),p=y(b(pt))(r.edits),m=se(p,()=>P(j)(r.old_string)&&P(j)(r.new_string)?[{oldText:r.old_string,newText:r.new_string}]:[]);return{activity:{_tag:`Files`,operation:i.type===`fileChange`||r.type===`fileChange`?`change`:n,paths:A(a,{onNone:()=>o===void 0?[]:[o],onSome:e=>e.map(({path:e})=>e)})},title:{read:`Read file`,edit:`Edit file`,write:`Write file`}[n],subject:n===`read`?d:o??A(a,{onNone:()=>`File details unavailable`,onSome:e=>e.length===1?e[0]?.path??`File details unavailable`:`${e.length} files`}),input:[...J(`Options`,r,[`path`,`file_path`,`edits`,`old_string`,`new_string`,`content`,`changes`,`type`,`id`,`status`,...n===`read`&&s!==void 0?[`offset`]:[],...n===`read`&&c!==void 0?[`limit`]:[]]),...(f===void 0?m:[]).flatMap(({oldText:e,newText:t},n)=>[q(m.length===1?`Before`:`Before ${n+1}`,e,X(o??``)),q(m.length===1?`After`:`After ${n+1}`,t,X(o??``))]),...P(j)(r.content)?[q(`Content`,r.content,X(o??``))]:[],...t===void 0?A(ht(r.changes),{onNone:()=>[],onSome:e=>e.map(({path:e,diff:t})=>q(e,t,`diff`))}):[]],output:A(ht(i.changes),{onNone:()=>f===void 0?n===`read`?Y(t,o??`Output`,X(o??``)):_t(t):[q(o??`Changes`,f,`diff`),..._t(Object.fromEntries(Object.entries(i).filter(([e])=>e!==`details`))),...J(`Metadata`,G(i.details),[`patch`,`diff`])],onSome:e=>e.map(({path:e,diff:t,kind:n})=>q(`${e} · ${n.type}`,t,`diff`))})}},yt=e=>{switch(e.toLowerCase()){case`bash`:case`powershell`:case`shell`:case`command`:return`command`;case`read`:return`read`;case`edit`:case`file_change`:return`edit`;case`write`:return`write`;case`grep`:case`glob`:case`find`:case`ls`:case`web_search`:return`search`;case`subagent`:case`agent`:case`task`:return`agent`;default:return`tool`}},bt=({input:e,output:t})=>{let n=G(e??t),r=G(t),i=K(n.command)??K(r.command);return{activity:{_tag:`Command`,command:i},title:`Command`,subject:i??`Command details unavailable`,input:[...i===void 0?[]:[q(`Command`,i,`bash`)],...J(`Options`,n,[`command`,`type`,`id`,`status`,`aggregatedOutput`,`exitCode`,`durationMs`,`processId`,`source`,`commandActions`])],output:r.type===`commandExecution`?[...Y(r.aggregatedOutput,`Output`),...J(`Execution`,r,[`type`,`id`,`status`,`command`,`cwd`,`aggregatedOutput`,`processId`,`source`,`commandActions`])]:Y(t,`Output`)}},xt=({input:e,output:t,name:n})=>{let r=G(e??t),i=G(t),a=G(r.action);return{activity:{_tag:`Search`},title:n.toLowerCase()===`ls`?`List files`:`Search`,subject:K(r.pattern)??K(r.query)??K(a.query)??K(a.url)??K(r.path)??`Search details unavailable`,input:J(`Search`,r,[`type`,`id`]),output:i.type===`webSearch`?J(`Search`,i,[`type`,`id`]):Y(t,`Results`)}},St=({input:e,output:t})=>{let n=G(e),r=K(n.task)??K(n.prompt);return{activity:{_tag:`Delegation`},title:`Delegate`,subject:K(n.description)??r??`Delegated task`,input:[...r===void 0?[]:[{_tag:`Text`,label:`Task`,text:r}],...J(`Agent`,n,[`task`,`prompt`])],output:Y(t,`Report`).map(e=>e._tag===`Code`?{_tag:`Text`,label:e.label,text:e.text}:e)}},Ct=({input:e,output:t,name:n})=>{let r=G(e),i=G(t),a=r.type===`mcpToolCall`||r.type===`dynamicToolCall`||i.type===`mcpToolCall`||i.type===`dynamicToolCall`,o=a?r.arguments??i.arguments:e;return{activity:{_tag:`Tool`},title:(a?[K(r.server)??K(i.server)??K(r.namespace)??K(i.namespace),K(r.tool)??K(i.tool)].filter(e=>e!==void 0).join(` · `):n)||n,subject:P(W)(o)?`${Object.keys(o).length} parameters`:P(j)(o)?o:`Tool details`,input:Y(o,`Parameters`),output:a?[...Y(i.result??i.contentItems,`Output`),...Y(i.error,`Error`)]:Y(t,`Output`)}},wt=e=>{let t={name:e.name,input:A(e.start,{onNone:()=>void 0,onSome:({input:e})=>e}),output:M(e.state,{Running:()=>void 0,Stopped:()=>void 0,Finished:({output:e})=>e,Error:({output:e})=>e})},n=yt(e.name);return{category:n,...{command:bt,read:({input:e,output:t})=>vt(e,t,`read`),edit:({input:e,output:t})=>vt(e,t,`edit`),write:({input:e,output:t})=>vt(e,t,`write`),search:xt,agent:St,tool:Ct}[n](t)}},Z=(e,t)=>{let n=Math.max(0,Math.floor((t-Date.parse(e))/1e3));if(n<60)return`${n}s`;let r=Math.floor(n/60);return r<60?`${r}m ${n%60}s`:`${Math.floor(r/60)}h ${r%60}m`},Tt=({since:e,className:t})=>{let n=L(1e3);return(0,B.jsx)(`time`,{dateTime:e,"aria-live":`off`,className:m(`font-mono tabular-nums`,t),title:`Since ${be(e)}`,children:Z(e,n)})},Et=e=>{if(e.status!==`Live`)return{label:e.status,detail:``,since:T()};if(e.paused||e.held||e.idle)return{label:ut(e),detail:``,since:T()};let t=[...e.entries].reverse().find(e=>e._tag===`Tool`&&e.state._tag===`Running`);if(t?._tag!==`Tool`)return{label:`Working`,detail:``,since:T()};let n=wt(t);return{label:{command:`Running command`,read:`Reading file`,edit:`Editing file`,write:`Writing file`,search:`Searching`,agent:`Delegating`,tool:`Running ${n.title}`}[n.category],detail:n.subject,since:k(t.start,({receivedAt:e})=>e)}},Dt=e=>{let t=e.filter(({status:e})=>e===`Live`);return t.filter(({session:e})=>e._tag===`ChildSession`).sort((e,t)=>t.latestSequence-e.latestSequence)[0]??t.find(({session:e})=>e._tag===`ParentSession`)},Ot=({chapter:e})=>{let t=L(1e3),n=Dt(e.sessions),r=n===void 0?{label:`Parent session starting`,detail:``,since:T()}:Et(n);return(0,B.jsxs)(`div`,{role:`status`,"aria-label":`Current activity`,className:`min-w-0 space-y-0.5 text-xs`,children:[(0,B.jsxs)(`p`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(Ae,{running:!0,className:`size-3 text-run-active`}),n!==void 0&&(0,B.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:n.session._tag===`ParentSession`?`Parent`:n.session.agent}),(0,B.jsx)(`span`,{className:`min-w-0 truncate text-muted-foreground`,children:r.label}),A(r.since,{onNone:()=>null,onSome:e=>(0,B.jsx)(`span`,{"aria-live":`off`,className:`ml-auto shrink-0 font-mono tabular-nums text-muted-foreground`,title:`Started ${be(e)}`,children:Z(e,t)})})]}),r.detail!==``&&(0,B.jsx)(`p`,{className:`truncate pl-5 font-mono text-muted-foreground`,title:r.detail,children:r.detail}),A(e.lastActivityAt,{onNone:()=>null,onSome:e=>(0,B.jsxs)(`p`,{"aria-live":`off`,className:`pl-5 text-muted-foreground`,children:[`Last activity `,Z(e,t),` ago`]})}),e.connectivity.map(e=>(0,B.jsx)(kt,{warning:e,now:t},e._tag===`WorkerSilent`?e.worker:`${e.agent}:${e.since}`))]})},kt=({warning:e,now:t})=>{let n=M(e,{WorkerSilent:({worker:e,lastAnsweredAt:t})=>({text:`${e} silent since ${_e(t)}`,since:t,detail:null}),ProviderRetrying:({agent:e,retries:t,since:n,message:r})=>({text:`${e}: provider unreachable, ${U(t)} since ${_e(n)}`,since:n,detail:r})});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{className:`flex min-w-0 items-baseline gap-2 pl-5`,children:[(0,B.jsxs)(`span`,{className:`min-w-0 text-warning`,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:`Warning: `}),n.text]}),(0,B.jsx)(`span`,{"aria-live":`off`,className:`ml-auto shrink-0 font-mono tabular-nums text-muted-foreground`,title:`Since ${be(n.since)}`,children:Z(n.since,t)})]}),n.detail!==null&&(0,B.jsx)(`p`,{className:`truncate pl-5 text-muted-foreground`,title:n.detail,children:n.detail})]})},At=e=>{let t=null,n=new Map;for(let{payload:r,receivedAt:i}of e)if(r._tag===`WorkerUnresponsive`)t={_tag:`WorkerSilent`,worker:r.worker,lastAnsweredAt:ue(r.lastAnsweredAt)};else if(r._tag===`WorkerResponsive`)t=null;else if(r._tag===`SessionEvent`){let e=r.event;e._tag===`ProviderRetrying`?n.set(e.session.id,{_tag:`ProviderRetrying`,sessionId:e.session.id,agent:e.session.agent,message:e.message,retries:e.retries,since:n.get(e.session.id)?.since??i}):(e._tag===`ProviderRecovered`||e._tag===`SessionIdle`||e._tag===`SessionFinished`)&&n.delete(e.session.id)}return[...t===null?[]:[t],...n.values()]},jt=/^\s*\[usine:(blocked|question|failed|provider-capacity)\]/u,Mt=e=>{let t=jt.exec(e)?.[1];return t===`blocked`||t===`question`?t:null},Q=e=>e.replace(jt,``).trimStart(),Nt=e=>Q(e).replace(/\s+/gu,` `).trim(),Pt=e=>e.replace(/^\s{0,3}(?:#{1,6}\s+|[-*+]\s+|\d+[.)]\s+|>\s?)/u,``).replace(/!?\[([^\]]*)\]\([^)]*\)/gu,`$1`).replace(/`([^`]*)`/gu,`$1`).replace(/(\*\*|__)(.+?)\1/gu,`$2`).replace(/(^|[\s(])\*(\S(?:.*?\S)?)\*(?=[\s).,;:!?]|$)/gu,`$1$2`).trim(),Ft=e=>e.replace(/```[\s\S]*?(?:```|$)/gu,`
2
2
  `).split(`
3
3
  `).map(Pt).filter(e=>e!==``).join(` `),$=e=>{let t=Q(e).replace(/```[\s\S]*?(?:```|$)/gu,`
4
4
  `).split(`
@@ -1 +1 @@
1
- import{t as e}from"./queryOptions-Bavh4JFe.js";import{On as t,Pn as n,St as r,bt as i,en as a,t as o,vt as s}from"./api-CoJQoiOc.js";import{o as c,p as l,t as u,v as d}from"./strings-BIVdGoBr.js";var f={hetzner:`Hetzner`,boat:`Boat`},p={hetzner:`server`,boat:`sandbox`},m=(e,t)=>`Creating a ${f[e.provider]} machine, started ${u(e.since,t)}`,ee={capacity:`no capacity`,quota:`quota reached`,refused:`refused by the provider`,provider:`provider error`,unreachable:`unreachable`,timeout:`SSH timeout`},h=({reason:e})=>e===`check`?`Preflight failed on the first machine of the day`:`Machine creation failed: ${ee[e]}`,g=(e,t)=>new Date(e).toDateString()===new Date(t).toDateString()?d(e).slice(11):c(e),te=({blocked:e,retryAt:t},n)=>`${e?`Next try`:`Pause ended`} at ${g(t,n)}`,_=({failures:e,failedAt:t},n)=>`${e===1?`Failed once`:`Failed ${e} times in a row`}, last at ${g(t,n)}`,v={approve:`Approve`,retry:`Retry`,runAgain:`Run again`,cancel:`Cancel run`,confirmCancel:`Confirm cancel`,keepRunning:`Keep running`},y=`Opening a run…`,b=`No run opened: cycle budget used up. Reset it in Needs attention`,x=e=>r(e,{Event:()=>`From the event`,OperatorRetry:({operator:e})=>n(e,{onNone:()=>`Retried`,onSome:e=>`Retried by ${e}`}),EditAndRetry:({operator:e})=>n(e,{onNone:()=>`Edited and retried`,onSome:e=>`Edited and retried by ${e}`}),InfraRetry:()=>`Retried after an infrastructure failure`,ProviderRetry:()=>`Retried after a provider capacity refusal`,AfterRestart:()=>`Started again after a restart`}),S=(e,{runId:t,attemptNumber:n,worker:r})=>t===e?`Waiting for attempt ${n} to stop on ${r}`:`Waiting for attempt ${n} of an earlier run to stop on ${r}`,C=({worker:e,message:t})=>`Waiting for ${e}: ${t}`,w=(e,t=null,n=null)=>{if(t!==null)return S(e.id,t);if(e.machineWait!==null)return C(e.machineWait);if(e.state===`Queued`&&n?.state===`creating`)return`Queued, creating a ${f[n.provider]} machine`;if(e.providerRetry!==null){let{message:t,nextAttempt:n,retryAt:r}=e.providerRetry;return`Provider at capacity: ${t} Next try: attempt ${n} at ${d(a(r))}.`}let r=e.attempts.length,i=r===0?``:` after ${r} ${r===1?`attempt`:`attempts`}`;switch(e.state){case`Pending`:return`Pending`;case`Waiting`:return`Waiting for approval`;case`Queued`:return`Queued, no free worker`;case`Running`:return`Running, attempt ${e.attempts.at(-1)?.number??1}`;case`Succeeded`:return r>1?`Succeeded${i}`:`Succeeded`;case`Failed`:return`Failed${i}`;case`Canceled`:return`Canceled${i}`}},T=e=>r(e,{GitHubPushFailure:()=>`GitHub refused push`,InfraFailure:()=>`Infrastructure failure`,ProviderCapacityFailure:()=>`Provider at capacity`,DefectFailure:()=>`Executor defect`,AgentFailure:()=>`Agent failure`,BlockedFailure:()=>`Agent blocked`,QuestionFailure:()=>`Question from the agent`,RunawayFailure:()=>`Runaway guard`,ChildSessionBudgetFailure:()=>`Child session budget exhausted`}),E=e=>`Opened ${d(e)}`,D={ui:`from the UI`},O={approve:`Approving…`,retry:`Retrying…`,cancel:`Canceling…`,resolveFailure:`Marking resolved…`},k=e=>r(e,{GitHubPushFailure:({message:e})=>e,InfraFailure:({message:e})=>e,ProviderCapacityFailure:({message:e})=>e,DefectFailure:({message:e})=>e,AgentFailure:({message:e})=>e,BlockedFailure:({message:e})=>e,QuestionFailure:({question:e})=>e,RunawayFailure:({ceiling:e})=>e===`wall-clock`?`Time limit reached: settings.max_attempt_minutes`:`Token limit reached: settings.max_attempt_tokens`,ChildSessionBudgetFailure:({attemptedChildren:e,maxChildren:t})=>`Child session budget of ${t} used; child ${e} did not start`}),A=e=>e===`parent`?`Queued until the delegated task ends`:`Queued until the current child step ends`,j=({ref:e,commit:t})=>`Not applied: the previous attempt's work on ${e} at ${t.slice(0,7)} conflicts with the current revision. It is still on ${e}`,M=({kills:e,memoryMib:t})=>`The kernel killed ${e} ${e===1?`process`:`processes`} for memory across containers in this attempt. The last container with recorded kills had a ${t} MiB memory limit`,N=e=>`Retry uses ${e.harness} · ${e.model} from the saved agent definition.`,P={loading:`Loading…`,loadEarlier:`Load earlier`,empty:`No activity recorded`},F=e=>n(e,{onNone:()=>`Attempt`,onSome:({number:e})=>`Attempt ${e}`}),I=e=>`${e.completedCycles} completed rounds. ${e.counts.map(({loop:e,admitted:t})=>`${e}: ${t} ${t===1?`run`:`runs`}`).join(`; `)}`,L=e=>r(e,{WebhookSilenceNeed:({publicUrl:e,startedAt:t})=>({title:`No webhook delivery received`,detail:`No verified delivery since startup at ${t}. Check ${e}, the App webhook active setting, and USINE_GITHUB_WEBHOOK_SECRET. Polling continues.`,repository:null,runId:null}),PoolLimitNeed:({pool:e,login:n,window:r,usedPercent:i,resetsAt:o})=>({title:`${l(e)}: rate window at ${i}%`,detail:`${t(n,()=>`Login unavailable`)} · ${r} window · resets ${a(o)}`,repository:null,runId:null}),CycleBudgetNeed:({ask:e,itemLabel:t})=>({title:`Cycle budget exhausted`,detail:`${t}: ${I(e)}`,repository:e.repository,runId:null}),ApprovalNeed:({loop:e,repository:t,runId:n,item:r})=>({title:`${e}: approval needed`,detail:r===null?`Open the run for the task text`:r.title,repository:t,runId:n}),RunFailureNeed:({failure:e,loop:t,repository:n,runId:r})=>({title:e._tag===`QuestionFailure`?`Question from ${t}`:e._tag===`BlockedFailure`?`${t}: blocked`:`${t}: ${T(e).toLowerCase()}`,detail:k(e),repository:n,runId:r}),BoardProjectionNeed:({failure:e})=>({title:`Item not shown on the board`,detail:e.message,repository:e.repository,runId:null}),PollFailureNeed:({failure:e})=>({title:e.errorTag,detail:e.message,repository:e.repository,runId:null}),PreflightFindingNeed:({finding:e})=>({title:`Label preflight failed`,detail:`${e.label}: ${e.message}`,repository:e.repository,runId:null}),ScheduleFailureNeed:({failure:e})=>({title:r(e,{ScheduleTickFailure:({errorTag:e})=>e,ScheduleAgentFailure:({loop:e})=>`${e}: agent not loaded`,ScheduleCronFailure:({loop:e})=>`${e}: schedule not computed`}),detail:e.message,repository:e._tag===`ScheduleTickFailure`?e.repository:null,runId:null}),ConfigFileNeed:({kind:e,error:t})=>({title:e===`loop`?`Loop file not loaded`:`Agent file not loaded`,detail:`${t.file}: ${t.message.replace(/\.$/u,``)}. Fix the file, then reload the configuration from Configuration > Loops`,repository:null,runId:null}),WorkerQuotaNeed:({worker:e,message:t})=>({title:`${e}: cloud quota reached`,detail:`${t} Request a limit increase in the provider console, choose a smaller server_type (size on Boat), or free capacity. Machine creation retries automatically.`,repository:null,runId:null}),WorkerPreflightNeed:({worker:e,message:t})=>({title:`${e}: preflight failed`,detail:`${t} This worker takes no new attempts while preflight retries automatically.`,repository:null,runId:null}),UnconfiguredWorkerNeed:({worker:e,attempts:t,running:n})=>({title:`Worker not configured`,detail:n>0?`${e} is not in usine.yaml. ${n} ${n===1?`attempt`:`attempts`} still running on it. Discard the leftovers after they end`:`${e} is not in usine.yaml. Startup does not reconcile the ${t} recorded ${t===1?`attempt`:`attempts`} on it. Add the worker back and restart usine up, or discard the leftovers`,repository:null,runId:null}),UnresponsiveWorkerNeed:({worker:e,lastAnsweredAt:t,attempts:n})=>({title:`${e}: worker not responding`,detail:`Last answered ${t}. ${n.length} ${n.length===1?`attempt is`:`attempts are`} still running. Check the worker or open an affected run.`,repository:null,runId:null}),UnconfirmedStopNeed:({loop:e,repository:t,runId:n,attemptNumber:r,worker:i})=>({title:`${e}: parent task not stopped`,detail:`Attempt ${r} still ending on ${i}, using one slot. No new attempt on this item until it stops. Stop retried every few minutes`,repository:t,runId:n})}),R={dismissNeed:`Dismiss`,undoDismissNeed:`Undo`},z={dismissNeed:`Dismissing…`,undoDismissNeed:`Undoing…`},B=`Dismissed`,V=({repository:e,loop:t,attemptNumber:n})=>`${e} · ${t} · attempt ${n}`,H=`Open worker`,U=`Needs attention`,W=`Nothing needs attention`,G=`View all on Overview`,K=e=>`Needs attention (${e})`,q={WebhookSilenceNeed:`Webhook endpoint silent`,PoolLimitNeed:`Pool rate window`,ApprovalNeed:`Approval needed`,CycleBudgetNeed:`Cycle budget exhausted`,WorkerPreflightNeed:`Worker preflight failed`,WorkerQuotaNeed:`Cloud quota reached`,UnconfiguredWorkerNeed:`Unconfigured worker`,UnresponsiveWorkerNeed:`Unresponsive worker`,RunFailureNeed:`Run failed`,BoardProjectionNeed:`Board item unavailable`,PollFailureNeed:`Poll failed`,PreflightFindingNeed:`Label preflight failed`,ScheduleFailureNeed:`Schedule failed`,ConfigFileNeed:`Configuration file not loaded`,UnconfirmedStopNeed:`Parent task not stopped`},J=`Details`,Y=`Open item`,X=`Open run`,Z=e=>`Actions for ${e}`,Q=(e,t)=>e.find(e=>[e.repository,...e.repositories].some(e=>i(e)===i(t))),ne=(e,t)=>{let n=new Map;for(let r of e){let e=r._tag===`UnresponsiveWorkerNeed`?r.attempts.map(({repository:e})=>e):[L(r).repository],i=new Set(e.flatMap(e=>{let n=e===null?void 0:Q(t,e);return n===void 0?[]:[$(n)]}));for(let e of i)n.set(e,(n.get(e)??0)+1)}return n},re=2e3,ie=15e3,ae=()=>e({queryKey:[`overview`],queryFn:()=>o(e=>e.overview()),meta:{refreshLabel:`Overview`},refetchInterval:e=>{let t=e.state.data;return t?._tag===`NeedsSetup`?!1:t?.projects.some(e=>e.runs.some(({canCancel:e})=>e))===!0?re:ie}}),$=e=>e.id??s.make(e.repository.toLowerCase().replace(/[^a-z0-9]+/gu,`-`).replace(/^-|-$/gu,``)),oe=e=>e.name??e.repository,se=(e,t)=>{let n=Q(e,t);return n===void 0?void 0:{project:$(n)}};export{M as A,P as B,D as C,T as D,k as E,b as F,f as G,_ as H,y as I,p as K,w as L,N as M,v as N,C as O,O as P,S as R,V as S,j as T,m as U,h as V,te as W,J as _,oe as a,X as b,z as c,G as d,U as f,L as g,Z as h,$ as i,A as j,E as k,K as l,B as m,ae as n,se as o,I as p,Q as r,R as s,ne as t,W as u,q as v,x as w,H as x,Y as y,F as z};
1
+ import{t as e}from"./queryOptions-Bavh4JFe.js";import{On as t,Pn as n,St as r,bt as i,en as a,t as o,vt as s}from"./api-D3RWLycx.js";import{o as c,p as l,t as u,v as d}from"./strings-BIVdGoBr.js";var f={hetzner:`Hetzner`,boat:`Boat`},p={hetzner:`server`,boat:`sandbox`},m=(e,t)=>`Creating a ${f[e.provider]} machine, started ${u(e.since,t)}`,ee={capacity:`no capacity`,quota:`quota reached`,refused:`refused by the provider`,provider:`provider error`,unreachable:`unreachable`,timeout:`SSH timeout`},h=({reason:e})=>e===`check`?`Preflight failed on the first machine of the day`:`Machine creation failed: ${ee[e]}`,g=(e,t)=>new Date(e).toDateString()===new Date(t).toDateString()?d(e).slice(11):c(e),te=({blocked:e,retryAt:t},n)=>`${e?`Next try`:`Pause ended`} at ${g(t,n)}`,_=({failures:e,failedAt:t},n)=>`${e===1?`Failed once`:`Failed ${e} times in a row`}, last at ${g(t,n)}`,v={approve:`Approve`,retry:`Retry`,runAgain:`Run again`,cancel:`Cancel run`,confirmCancel:`Confirm cancel`,keepRunning:`Keep running`},y=`Opening a run…`,b=`No run opened: cycle budget used up. Reset it in Needs attention`,x=e=>r(e,{Event:()=>`From the event`,OperatorRetry:({operator:e})=>n(e,{onNone:()=>`Retried`,onSome:e=>`Retried by ${e}`}),EditAndRetry:({operator:e})=>n(e,{onNone:()=>`Edited and retried`,onSome:e=>`Edited and retried by ${e}`}),InfraRetry:()=>`Retried after an infrastructure failure`,ProviderRetry:()=>`Retried after a provider capacity refusal`,AfterRestart:()=>`Started again after a restart`}),S=(e,{runId:t,attemptNumber:n,worker:r})=>t===e?`Waiting for attempt ${n} to stop on ${r}`:`Waiting for attempt ${n} of an earlier run to stop on ${r}`,C=({worker:e,message:t})=>`Waiting for ${e}: ${t}`,w=(e,t=null,n=null)=>{if(t!==null)return S(e.id,t);if(e.machineWait!==null)return C(e.machineWait);if(e.state===`Queued`&&n?.state===`creating`)return`Queued, creating a ${f[n.provider]} machine`;if(e.providerRetry!==null){let{message:t,nextAttempt:n,retryAt:r}=e.providerRetry;return`Provider at capacity: ${t} Next try: attempt ${n} at ${d(a(r))}.`}let r=e.attempts.length,i=r===0?``:` after ${r} ${r===1?`attempt`:`attempts`}`;switch(e.state){case`Pending`:return`Pending`;case`Waiting`:return`Waiting for approval`;case`Queued`:return`Queued, no free worker`;case`Running`:return`Running, attempt ${e.attempts.at(-1)?.number??1}`;case`Succeeded`:return r>1?`Succeeded${i}`:`Succeeded`;case`Failed`:return`Failed${i}`;case`Canceled`:return`Canceled${i}`}},T=e=>r(e,{GitHubPushFailure:()=>`GitHub refused push`,InfraFailure:()=>`Infrastructure failure`,ProviderCapacityFailure:()=>`Provider at capacity`,DefectFailure:()=>`Executor defect`,AgentFailure:()=>`Agent failure`,BlockedFailure:()=>`Agent blocked`,QuestionFailure:()=>`Question from the agent`,RunawayFailure:()=>`Runaway guard`,ChildSessionBudgetFailure:()=>`Child session budget exhausted`}),E=e=>`Opened ${d(e)}`,D={ui:`from the UI`},O={approve:`Approving…`,retry:`Retrying…`,cancel:`Canceling…`,resolveFailure:`Marking resolved…`},k=e=>r(e,{GitHubPushFailure:({message:e})=>e,InfraFailure:({message:e})=>e,ProviderCapacityFailure:({message:e})=>e,DefectFailure:({message:e})=>e,AgentFailure:({message:e})=>e,BlockedFailure:({message:e})=>e,QuestionFailure:({question:e})=>e,RunawayFailure:({ceiling:e})=>e===`wall-clock`?`Time limit reached: settings.max_attempt_minutes`:`Token limit reached: settings.max_attempt_tokens`,ChildSessionBudgetFailure:({attemptedChildren:e,maxChildren:t})=>`Child session budget of ${t} used; child ${e} did not start`}),A=e=>e===`parent`?`Queued until the delegated task ends`:`Queued until the current child step ends`,j=({ref:e,commit:t})=>`Not applied: the previous attempt's work on ${e} at ${t.slice(0,7)} conflicts with the current revision. It is still on ${e}`,M=({kills:e,memoryMib:t})=>`The kernel killed ${e} ${e===1?`process`:`processes`} for memory across containers in this attempt. The last container with recorded kills had a ${t} MiB memory limit`,N=e=>`Retry uses ${e.harness} · ${e.model} from the saved agent definition.`,P={loading:`Loading…`,loadEarlier:`Load earlier`,empty:`No activity recorded`},F=e=>n(e,{onNone:()=>`Attempt`,onSome:({number:e})=>`Attempt ${e}`}),I=e=>`${e.completedCycles} completed rounds. ${e.counts.map(({loop:e,admitted:t})=>`${e}: ${t} ${t===1?`run`:`runs`}`).join(`; `)}`,L=e=>r(e,{WebhookSilenceNeed:({publicUrl:e,startedAt:t})=>({title:`No webhook delivery received`,detail:`No verified delivery since startup at ${t}. Check ${e}, the App webhook active setting, and USINE_GITHUB_WEBHOOK_SECRET. Polling continues.`,repository:null,runId:null}),PoolLimitNeed:({pool:e,login:n,window:r,usedPercent:i,resetsAt:o})=>({title:`${l(e)}: rate window at ${i}%`,detail:`${t(n,()=>`Login unavailable`)} · ${r} window · resets ${a(o)}`,repository:null,runId:null}),CycleBudgetNeed:({ask:e,itemLabel:t})=>({title:`Cycle budget exhausted`,detail:`${t}: ${I(e)}`,repository:e.repository,runId:null}),ApprovalNeed:({loop:e,repository:t,runId:n,item:r})=>({title:`${e}: approval needed`,detail:r===null?`Open the run for the task text`:r.title,repository:t,runId:n}),RunFailureNeed:({failure:e,loop:t,repository:n,runId:r})=>({title:e._tag===`QuestionFailure`?`Question from ${t}`:e._tag===`BlockedFailure`?`${t}: blocked`:`${t}: ${T(e).toLowerCase()}`,detail:k(e),repository:n,runId:r}),BoardProjectionNeed:({failure:e})=>({title:`Item not shown on the board`,detail:e.message,repository:e.repository,runId:null}),PollFailureNeed:({failure:e})=>({title:e.errorTag,detail:e.message,repository:e.repository,runId:null}),PreflightFindingNeed:({finding:e})=>({title:`Label preflight failed`,detail:`${e.label}: ${e.message}`,repository:e.repository,runId:null}),ScheduleFailureNeed:({failure:e})=>({title:r(e,{ScheduleTickFailure:({errorTag:e})=>e,ScheduleAgentFailure:({loop:e})=>`${e}: agent not loaded`,ScheduleCronFailure:({loop:e})=>`${e}: schedule not computed`}),detail:e.message,repository:e._tag===`ScheduleTickFailure`?e.repository:null,runId:null}),ConfigFileNeed:({kind:e,error:t})=>({title:e===`loop`?`Loop file not loaded`:`Agent file not loaded`,detail:`${t.file}: ${t.message.replace(/\.$/u,``)}. Fix the file, then reload the configuration from Configuration > Loops`,repository:null,runId:null}),WorkerQuotaNeed:({worker:e,message:t})=>({title:`${e}: cloud quota reached`,detail:`${t} Request a limit increase in the provider console, choose a smaller server_type (size on Boat), or free capacity. Machine creation retries automatically.`,repository:null,runId:null}),WorkerPreflightNeed:({worker:e,message:t})=>({title:`${e}: preflight failed`,detail:`${t} This worker takes no new attempts while preflight retries automatically.`,repository:null,runId:null}),UnconfiguredWorkerNeed:({worker:e,attempts:t,running:n})=>({title:`Worker not configured`,detail:n>0?`${e} is not in usine.yaml. ${n} ${n===1?`attempt`:`attempts`} still running on it. Discard the leftovers after they end`:`${e} is not in usine.yaml. Startup does not reconcile the ${t} recorded ${t===1?`attempt`:`attempts`} on it. Add the worker back and restart usine up, or discard the leftovers`,repository:null,runId:null}),UnresponsiveWorkerNeed:({worker:e,lastAnsweredAt:t,attempts:n})=>({title:`${e}: worker not responding`,detail:`Last answered ${t}. ${n.length} ${n.length===1?`attempt is`:`attempts are`} still running. Check the worker or open an affected run.`,repository:null,runId:null}),UnconfirmedStopNeed:({loop:e,repository:t,runId:n,attemptNumber:r,worker:i})=>({title:`${e}: parent task not stopped`,detail:`Attempt ${r} still ending on ${i}, using one slot. No new attempt on this item until it stops. Stop retried every few minutes`,repository:t,runId:n})}),R={dismissNeed:`Dismiss`,undoDismissNeed:`Undo`},z={dismissNeed:`Dismissing…`,undoDismissNeed:`Undoing…`},B=`Dismissed`,V=({repository:e,loop:t,attemptNumber:n})=>`${e} · ${t} · attempt ${n}`,H=`Open worker`,U=`Needs attention`,W=`Nothing needs attention`,G=`View all on Overview`,K=e=>`Needs attention (${e})`,q={WebhookSilenceNeed:`Webhook endpoint silent`,PoolLimitNeed:`Pool rate window`,ApprovalNeed:`Approval needed`,CycleBudgetNeed:`Cycle budget exhausted`,WorkerPreflightNeed:`Worker preflight failed`,WorkerQuotaNeed:`Cloud quota reached`,UnconfiguredWorkerNeed:`Unconfigured worker`,UnresponsiveWorkerNeed:`Unresponsive worker`,RunFailureNeed:`Run failed`,BoardProjectionNeed:`Board item unavailable`,PollFailureNeed:`Poll failed`,PreflightFindingNeed:`Label preflight failed`,ScheduleFailureNeed:`Schedule failed`,ConfigFileNeed:`Configuration file not loaded`,UnconfirmedStopNeed:`Parent task not stopped`},J=`Details`,Y=`Open item`,X=`Open run`,Z=e=>`Actions for ${e}`,Q=(e,t)=>e.find(e=>[e.repository,...e.repositories].some(e=>i(e)===i(t))),ne=(e,t)=>{let n=new Map;for(let r of e){let e=r._tag===`UnresponsiveWorkerNeed`?r.attempts.map(({repository:e})=>e):[L(r).repository],i=new Set(e.flatMap(e=>{let n=e===null?void 0:Q(t,e);return n===void 0?[]:[$(n)]}));for(let e of i)n.set(e,(n.get(e)??0)+1)}return n},re=2e3,ie=15e3,ae=()=>e({queryKey:[`overview`],queryFn:()=>o(e=>e.overview()),meta:{refreshLabel:`Overview`},refetchInterval:e=>{let t=e.state.data;return t?._tag===`NeedsSetup`?!1:t?.projects.some(e=>e.runs.some(({canCancel:e})=>e))===!0?re:ie}}),$=e=>e.id??s.make(e.repository.toLowerCase().replace(/[^a-z0-9]+/gu,`-`).replace(/^-|-$/gu,``)),oe=e=>e.name??e.repository,se=(e,t)=>{let n=Q(e,t);return n===void 0?void 0:{project:$(n)}};export{M as A,P as B,D as C,T as D,k as E,b as F,f as G,_ as H,y as I,p as K,w as L,N as M,v as N,C as O,O as P,S as R,V as S,j as T,m as U,h as V,te as W,J as _,oe as a,X as b,z as c,G as d,U as f,L as g,Z as h,$ as i,A as j,E as k,K as l,B as m,ae as n,se as o,I as p,Q as r,R as s,ne as t,W as u,q as v,x as w,H as x,Y as y,F as z};
@@ -1 +1 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{I as r,y as i}from"./queryOptions-Bavh4JFe.js";import{r as a}from"./button-CzVqBv_O.js";import{zn as o}from"./api-CoJQoiOc.js";import{m as s}from"./strings-BIVdGoBr.js";var c=e(t(),1),l=n(),u=(0,c.createContext)([]),d=({children:e})=>{let t=r(),[n,a]=(0,c.useState)([]);return(0,c.useEffect)(()=>{let e=t.getQueryCache(),n=new Map,r=!0,s=()=>{let t=[];for(let r of e.getAll()){let e=r.meta?.refreshLabel;e!==void 0&&(r.state.status===`success`?n.delete(r.queryHash):r.state.status===`error`&&!n.has(r.queryHash)&&n.set(r.queryHash,r.state.errorUpdatedAt),r.observers.some(({options:e})=>{let t=o(e.enabled)?e.enabled(r):e.enabled,n=o(e.refetchInterval)?e.refetchInterval(r):e.refetchInterval;return t!==!1&&n!==!1&&n!==void 0&&n>0&&Number.isFinite(n)})&&t.push({label:e,updatedAt:r.state.dataUpdatedAt,failedSince:n.get(r.queryHash)??null}))}i.schedule(()=>{r&&a(e=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.label===r?.label&&e.updatedAt===r.updatedAt&&e.failedSince===r.failedSince})?e:t)})},c=e.subscribe(e=>{e.type===`removed`&&n.delete(e.query.queryHash),s()});return s(),()=>{r=!1,c()}},[t]),(0,l.jsx)(u,{value:n,children:e})},f=e=>{let[t,n]=(0,c.useState)(Date.now);return(0,c.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t},p=()=>{let e=(0,c.useContext)(u),t=f(1e3);if(e.length===0)return null;let n=e.map(e=>e.updatedAt).filter(e=>e>0),r=n.length===0?0:Math.max(...n),i=[...new Set(e.filter(({failedSince:e})=>e!==null&&t-e>6e4).map(({label:e})=>e))];return(0,l.jsxs)(`p`,{className:`w-full text-xs text-muted-foreground`,"aria-label":s.label,children:[r===0?s.waiting:(0,l.jsxs)(l.Fragment,{children:[s.label,` `,(0,l.jsx)(`time`,{dateTime:new Date(r).toISOString(),title:new Date(r).toLocaleString(),className:`font-mono tabular-nums`,children:new Date(r).toLocaleTimeString()})]}),i.length>0&&(0,l.jsx)(`span`,{role:`status`,children:s.failed(i.join(`, `))})]})},m=({title:e,leading:t,counts:n,children:r,actions:i,className:o})=>(0,l.jsxs)(`header`,{className:a(`flex flex-wrap items-baseline gap-x-3 gap-y-1`,o),children:[(0,l.jsxs)(`h1`,{className:`flex items-baseline gap-2 text-xl font-semibold wrap-anywhere`,children:[t!==void 0&&(0,l.jsx)(`span`,{className:`flex h-7 shrink-0 items-center self-start`,children:t}),(0,l.jsx)(`span`,{className:`min-w-0`,children:e})]}),n!==void 0&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground tabular-nums`,children:n}),r,i!==void 0&&(0,l.jsx)(`div`,{className:`ml-auto flex items-center gap-2 self-center`,children:i}),(0,l.jsx)(p,{})]}),h=({children:e,width:t=`prose`})=>(0,l.jsx)(`main`,{className:`px-4 pt-5 pb-6 md:px-5`,children:(0,l.jsx)(`div`,{className:a(`flex flex-col gap-4`,t===`prose`&&`max-w-3xl`),children:e})}),g={lg:`lg:flex-row lg:items-start lg:justify-between lg:gap-6`,sm:`sm:flex-row sm:items-start sm:justify-between sm:gap-6`,never:``},_=({eyebrow:e,heading:t,facts:n,actions:r,actionsBeside:i,className:o})=>(0,l.jsxs)(`header`,{className:a(`flex flex-col gap-3`,g[i],o),children:[(0,l.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[e!==void 0&&(0,l.jsx)(`p`,{className:`flex flex-wrap items-center gap-x-3.5 gap-y-1 text-xs text-muted-foreground`,children:e}),t,(0,l.jsx)(p,{}),n!==void 0&&(0,l.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-1.5 pt-0.5 text-sm text-muted-foreground`,children:n})]}),r!==void 0&&(0,l.jsx)(`div`,{className:`shrink-0`,children:r})]}),v=({icon:e,title:t,children:n})=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:t,children:[(0,l.jsx)(e,{"aria-hidden":`true`,className:`size-[1em] shrink-0 text-faint`}),n]});export{f as a,m as i,v as n,d as o,_ as r,h as t};
1
+ import{a as e,n as t,t as n}from"./jsx-runtime-Wy9s6hX0.js";import{I as r,y as i}from"./queryOptions-Bavh4JFe.js";import{r as a}from"./button-CzVqBv_O.js";import{zn as o}from"./api-D3RWLycx.js";import{m as s}from"./strings-BIVdGoBr.js";var c=e(t(),1),l=n(),u=(0,c.createContext)([]),d=({children:e})=>{let t=r(),[n,a]=(0,c.useState)([]);return(0,c.useEffect)(()=>{let e=t.getQueryCache(),n=new Map,r=!0,s=()=>{let t=[];for(let r of e.getAll()){let e=r.meta?.refreshLabel;e!==void 0&&(r.state.status===`success`?n.delete(r.queryHash):r.state.status===`error`&&!n.has(r.queryHash)&&n.set(r.queryHash,r.state.errorUpdatedAt),r.observers.some(({options:e})=>{let t=o(e.enabled)?e.enabled(r):e.enabled,n=o(e.refetchInterval)?e.refetchInterval(r):e.refetchInterval;return t!==!1&&n!==!1&&n!==void 0&&n>0&&Number.isFinite(n)})&&t.push({label:e,updatedAt:r.state.dataUpdatedAt,failedSince:n.get(r.queryHash)??null}))}i.schedule(()=>{r&&a(e=>e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.label===r?.label&&e.updatedAt===r.updatedAt&&e.failedSince===r.failedSince})?e:t)})},c=e.subscribe(e=>{e.type===`removed`&&n.delete(e.query.queryHash),s()});return s(),()=>{r=!1,c()}},[t]),(0,l.jsx)(u,{value:n,children:e})},f=e=>{let[t,n]=(0,c.useState)(Date.now);return(0,c.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t},p=()=>{let e=(0,c.useContext)(u),t=f(1e3);if(e.length===0)return null;let n=e.map(e=>e.updatedAt).filter(e=>e>0),r=n.length===0?0:Math.max(...n),i=[...new Set(e.filter(({failedSince:e})=>e!==null&&t-e>6e4).map(({label:e})=>e))];return(0,l.jsxs)(`p`,{className:`w-full text-xs text-muted-foreground`,"aria-label":s.label,children:[r===0?s.waiting:(0,l.jsxs)(l.Fragment,{children:[s.label,` `,(0,l.jsx)(`time`,{dateTime:new Date(r).toISOString(),title:new Date(r).toLocaleString(),className:`font-mono tabular-nums`,children:new Date(r).toLocaleTimeString()})]}),i.length>0&&(0,l.jsx)(`span`,{role:`status`,children:s.failed(i.join(`, `))})]})},m=({title:e,leading:t,counts:n,children:r,actions:i,className:o})=>(0,l.jsxs)(`header`,{className:a(`flex flex-wrap items-baseline gap-x-3 gap-y-1`,o),children:[(0,l.jsxs)(`h1`,{className:`flex items-baseline gap-2 text-xl font-semibold wrap-anywhere`,children:[t!==void 0&&(0,l.jsx)(`span`,{className:`flex h-7 shrink-0 items-center self-start`,children:t}),(0,l.jsx)(`span`,{className:`min-w-0`,children:e})]}),n!==void 0&&(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground tabular-nums`,children:n}),r,i!==void 0&&(0,l.jsx)(`div`,{className:`ml-auto flex items-center gap-2 self-center`,children:i}),(0,l.jsx)(p,{})]}),h=({children:e,width:t=`prose`})=>(0,l.jsx)(`main`,{className:`px-4 pt-5 pb-6 md:px-5`,children:(0,l.jsx)(`div`,{className:a(`flex flex-col gap-4`,t===`prose`&&`max-w-3xl`),children:e})}),g={lg:`lg:flex-row lg:items-start lg:justify-between lg:gap-6`,sm:`sm:flex-row sm:items-start sm:justify-between sm:gap-6`,never:``},_=({eyebrow:e,heading:t,facts:n,actions:r,actionsBeside:i,className:o})=>(0,l.jsxs)(`header`,{className:a(`flex flex-col gap-3`,g[i],o),children:[(0,l.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[e!==void 0&&(0,l.jsx)(`p`,{className:`flex flex-wrap items-center gap-x-3.5 gap-y-1 text-xs text-muted-foreground`,children:e}),t,(0,l.jsx)(p,{}),n!==void 0&&(0,l.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-5 gap-y-1.5 pt-0.5 text-sm text-muted-foreground`,children:n})]}),r!==void 0&&(0,l.jsx)(`div`,{className:`shrink-0`,children:r})]}),v=({icon:e,title:t,children:n})=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:t,children:[(0,l.jsx)(e,{"aria-hidden":`true`,className:`size-[1em] shrink-0 text-faint`}),n]});export{f as a,m as i,v as n,d as o,_ as r,h as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{A as t,s as n,t as r}from"./section-Du_ZZiFG.js";import{t as i}from"./useSuspenseQuery-ajaZl96Y.js";import{t as a}from"./link-3oQYoIpm.js";import{n as o}from"./queries-D5TGw8Nr.js";import{Y as s}from"./index-BGr-Cg-z.js";var c=e(),l=({configuration:e})=>(0,c.jsx)(r,{title:t.title,createKind:`project`,children:e.projects.length===0?(0,c.jsx)(n,{title:t.empty,children:null}):(0,c.jsx)(`ul`,{className:`divide-y`,children:e.projects.map(e=>(0,c.jsxs)(`li`,{className:`min-w-0 py-3`,children:[(0,c.jsx)(a,{to:`/configuration/projects/$project`,params:{project:e.id},className:`font-medium text-primary hover:underline`,children:e.name}),(0,c.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-2 text-xs text-muted-foreground`,children:e.repositories.map(e=>(0,c.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,c.jsx)(s,{repository:e}),(0,c.jsx)(`span`,{className:`wrap-anywhere`,children:e})]},e))})]},e.id))})}),u=()=>{let{data:e}=i(o());return(0,c.jsx)(l,{configuration:e})};export{u as component};
1
+ import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{A as t,s as n,t as r}from"./section-Db-f1liW.js";import{t as i}from"./useSuspenseQuery-ajaZl96Y.js";import{t as a}from"./link-3oQYoIpm.js";import{n as o}from"./queries-C_qC_nGu.js";import{Y as s}from"./index-B_6qmKij.js";var c=e(),l=({configuration:e})=>(0,c.jsx)(r,{title:t.title,createKind:`project`,children:e.projects.length===0?(0,c.jsx)(n,{title:t.empty,children:null}):(0,c.jsx)(`ul`,{className:`divide-y`,children:e.projects.map(e=>(0,c.jsxs)(`li`,{className:`min-w-0 py-3`,children:[(0,c.jsx)(a,{to:`/configuration/projects/$project`,params:{project:e.id},className:`font-medium text-primary hover:underline`,children:e.name}),(0,c.jsx)(`ul`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-2 text-xs text-muted-foreground`,children:e.repositories.map(e=>(0,c.jsxs)(`li`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,c.jsx)(s,{repository:e}),(0,c.jsx)(`span`,{className:`wrap-anywhere`,children:e})]},e))})]},e.id))})}),u=()=>{let{data:e}=i(o());return(0,c.jsx)(l,{configuration:e})};export{u as component};
@@ -1 +1 @@
1
- import{I as e,t}from"./queryOptions-Bavh4JFe.js";import{n,o as r}from"./queries-CKjxlPEk.js";import{E as i,Fn as a,I as o,L as s,Qt as c,T as l,c as u,dn as d,g as f,h as p,hn as m,pn as h,t as g,un as _,w as v,x as y,y as b,zt as x}from"./api-CoJQoiOc.js";import{n as S}from"./overview-CUn9OtUH.js";import{t as C}from"./queries-Cdfj6CtB.js";import{n as w,t as T}from"./queries-D5TGw8Nr.js";function E(e){return e}var D=c(l),O=c(i),k=e=>(e.key.kind===`agent`?x(D)(e.value).pipe(_(p)):e.key.kind===`loop`?x(O)(e.value).pipe(_(f)):m(b(e.value))).pipe(d(t=>new v({problems:[new o({file:s.make(e.key.key),stage:`schema`,expression:a(),message:t.message})]}))),A=5e3,j=()=>{let t=e();return r({mutationFn:({loop:e,paused:t})=>g(n=>n[t?`unpause`:`pause`]({params:{loop:e}})),onSuccess:()=>Promise.all([t.invalidateQueries({queryKey:w().queryKey}),t.invalidateQueries({queryKey:S().queryKey})])})},M=()=>t({queryKey:[`upgrade`],queryFn:()=>g(e=>e.upgradeStatus({})),meta:{refreshLabel:`Upgrades`},refetchInterval:A,retry:3}),N=[`configuration-editor`],P=e=>t({queryKey:[...N,`entity`,e.kind,e.identifier],queryFn:()=>g(t=>t.configurationEntity({params:e}))}),F=e=>E({queryKey:[...N,`history`,e?.kind,e?.identifier],initialPageParam:void 0,queryFn:({pageParam:t})=>g(n=>n.configurationRevisions({query:t===void 0?{...e,limit:50}:{...e,before:t,limit:50}})),getNextPageParam:e=>e.nextBefore??void 0}),I=e=>t({queryKey:[...N,`revision`,e],queryFn:async()=>{let t=await g(t=>t.configurationRevision({params:{number:e}})),n=await Promise.all(t.changes.map(async e=>({...e,beforeText:e.before===null?``:await h(k(new y({key:e.key,value:e.before}))),afterText:e.after===null?``:await h(k(new y({key:e.key,value:e.after})))})));return{...t,changes:n}}}),L=()=>{let t=e();return r({mutationFn:e=>{switch(e.action){case`save`:return g(t=>t.replaceConfigurationEntity({params:e.key,payload:e.payload}));case`delete`:return g(t=>t.deleteConfigurationEntity({params:e.key,payload:new u(e.payload)}));case`revert`:return g(t=>t.revertConfigurationRevision({params:{number:e.number},payload:new u(e.payload)}))}},onSuccess:()=>Promise.all([N,w().queryKey,S().queryKey,T().queryKey,C().queryKey,n].map(e=>t.invalidateQueries({queryKey:e}))),onError:()=>Promise.all([t.invalidateQueries({queryKey:w().queryKey}),t.invalidateQueries({queryKey:N})])})},R=()=>t({queryKey:[...N,`capabilities`],queryFn:()=>g(e=>e.configurationCapabilities({})),staleTime:1/0}),z=()=>t({queryKey:[...N,`installation-repositories`],queryFn:()=>g(e=>e.configurationRepositories({}))}),B=e=>t({queryKey:[...N,`labels`,e],queryFn:()=>g(t=>t.configurationLabels({params:{repository:e}}))}),V=e=>t({queryKey:[...N,`loop-check`,e],queryFn:()=>g(t=>t.checkLoop({payload:e})),retry:!1}),H=e=>t({queryKey:[...N,`loop-preview`,e],queryFn:()=>g(t=>t.previewLoop({payload:e})),retry:!1,staleTime:0});export{H as a,F as c,j as d,D as f,V as i,M as l,P as n,B as o,O as p,z as r,I as s,R as t,L as u};
1
+ import{I as e,t}from"./queryOptions-Bavh4JFe.js";import{n,o as r}from"./queries-CU77zJnf.js";import{E as i,Fn as a,I as o,L as s,Qt as c,T as l,c as u,dn as d,g as f,h as p,hn as m,pn as h,t as g,un as _,w as v,x as y,y as b,zt as x}from"./api-D3RWLycx.js";import{n as S}from"./overview-DLYaCoiG.js";import{t as C}from"./queries-ESTqS3FK.js";import{n as w,t as T}from"./queries-C_qC_nGu.js";function E(e){return e}var D=c(l),O=c(i),k=e=>(e.key.kind===`agent`?x(D)(e.value).pipe(_(p)):e.key.kind===`loop`?x(O)(e.value).pipe(_(f)):m(b(e.value))).pipe(d(t=>new v({problems:[new o({file:s.make(e.key.key),stage:`schema`,expression:a(),message:t.message})]}))),A=5e3,j=()=>{let t=e();return r({mutationFn:({loop:e,paused:t})=>g(n=>n[t?`unpause`:`pause`]({params:{loop:e}})),onSuccess:()=>Promise.all([t.invalidateQueries({queryKey:w().queryKey}),t.invalidateQueries({queryKey:S().queryKey})])})},M=()=>t({queryKey:[`upgrade`],queryFn:()=>g(e=>e.upgradeStatus({})),meta:{refreshLabel:`Upgrades`},refetchInterval:A,retry:3}),N=[`configuration-editor`],P=e=>t({queryKey:[...N,`entity`,e.kind,e.identifier],queryFn:()=>g(t=>t.configurationEntity({params:e}))}),F=e=>E({queryKey:[...N,`history`,e?.kind,e?.identifier],initialPageParam:void 0,queryFn:({pageParam:t})=>g(n=>n.configurationRevisions({query:t===void 0?{...e,limit:50}:{...e,before:t,limit:50}})),getNextPageParam:e=>e.nextBefore??void 0}),I=e=>t({queryKey:[...N,`revision`,e],queryFn:async()=>{let t=await g(t=>t.configurationRevision({params:{number:e}})),n=await Promise.all(t.changes.map(async e=>({...e,beforeText:e.before===null?``:await h(k(new y({key:e.key,value:e.before}))),afterText:e.after===null?``:await h(k(new y({key:e.key,value:e.after})))})));return{...t,changes:n}}}),L=()=>{let t=e();return r({mutationFn:e=>{switch(e.action){case`save`:return g(t=>t.replaceConfigurationEntity({params:e.key,payload:e.payload}));case`delete`:return g(t=>t.deleteConfigurationEntity({params:e.key,payload:new u(e.payload)}));case`revert`:return g(t=>t.revertConfigurationRevision({params:{number:e.number},payload:new u(e.payload)}))}},onSuccess:()=>Promise.all([N,w().queryKey,S().queryKey,T().queryKey,C().queryKey,n].map(e=>t.invalidateQueries({queryKey:e}))),onError:()=>Promise.all([t.invalidateQueries({queryKey:w().queryKey}),t.invalidateQueries({queryKey:N})])})},R=()=>t({queryKey:[...N,`capabilities`],queryFn:()=>g(e=>e.configurationCapabilities({})),staleTime:1/0}),z=()=>t({queryKey:[...N,`installation-repositories`],queryFn:()=>g(e=>e.configurationRepositories({}))}),B=e=>t({queryKey:[...N,`labels`,e],queryFn:()=>g(t=>t.configurationLabels({params:{repository:e}}))}),V=e=>t({queryKey:[...N,`loop-check`,e],queryFn:()=>g(t=>t.checkLoop({payload:e})),retry:!1}),H=e=>t({queryKey:[...N,`loop-preview`,e],queryFn:()=>g(t=>t.previewLoop({payload:e})),retry:!1,staleTime:0});export{H as a,F as c,j as d,D as f,V as i,M as l,P as n,B as o,O as p,z as r,I as s,R as t,L as u};
@@ -1 +1 @@
1
- import{a as e,n as t}from"./jsx-runtime-Wy9s6hX0.js";import{C as n,I as r,M as i,N as a,O as o,_ as s,g as c,t as l,x as u,y as d}from"./queryOptions-Bavh4JFe.js";import{G as f,U as p,q as m,t as h,vn as g}from"./api-CoJQoiOc.js";var _=class extends c{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||v(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=s({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),d.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function v(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var y=class extends u{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),i(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&n(t.mutationKey)!==n(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??v();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){d.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},b=e(t(),1);function x(e,t){let n=r(t),[i]=b.useState(()=>new y(n,e));b.useEffect(()=>{i.setOptions(e)},[i,e]);let s=b.useSyncExternalStore(b.useCallback(e=>i.subscribe(d.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),c=b.useCallback((...e)=>{i.mutate(e[0],e[1]).catch(o)},[i]);if(s.error&&a(i.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:c,mutateAsync:s.mutate}}var S=(e,t)=>{let n=new Map(e.map(e=>[e.sequence,e]));for(let e of t)n.has(e.sequence)||n.set(e.sequence,e);return[...n.values()].sort((e,t)=>e.sequence-t.sequence)},C=(e,t,n)=>[...e.filter(({attemptId:e})=>e!==t),...n].sort((e,t)=>e.before-t.before),w=(e,t,n)=>new p({...e,transcript:S(e.transcript,t.transcript),earlierTranscript:C(e.earlierTranscript,n.attemptId,t.earlierTranscript)}),T=e=>{let t=new Map;for(let n of e){if(n.payload._tag!==`SessionEvent`)continue;let e=n.payload.event;e._tag===`PoolRateLimitsUpdated`&&t.set(e.pool,{pool:e.pool,windows:g([e.rateLimits.primary,e.rateLimits.secondary])})}return[...t.values()]},E=async(e,t)=>{let n=await t(e);if(e._tag===`ColdTranscriptRequest`)return n;let r=n.transcript;for(;!n.run.canCancel;){let e=n.transcript.at(-1);if(e===void 0)break;n=await t(new m({after:e.sequence})),r=S(r,n.transcript)}return new p({...n,transcript:r})},D=[`run`],O=e=>[...D,e],k=(e,t)=>{let n=O(t);return l({queryKey:n,queryFn:async()=>{let r=e.getQueryData(n)?.transcript.at(-1)?.sequence,i=await E(r===void 0?new f:new m({after:r}),e=>h(n=>n.detail({params:{runId:t},query:e}))),a=e.getQueryData(n);return r===void 0||a===void 0?i:new p({...i,transcript:S(a.transcript,i.transcript),earlierTranscript:a.earlierTranscript})},staleTime:1e3,structuralSharing:!1,meta:{refreshLabel:`Run`},refetchInterval:e=>e.state.data?.run.canCancel===!0&&1e3})};export{T as a,w as i,D as n,x as o,k as r,_ as s,O as t};
1
+ import{a as e,n as t}from"./jsx-runtime-Wy9s6hX0.js";import{C as n,I as r,M as i,N as a,O as o,_ as s,g as c,t as l,x as u,y as d}from"./queryOptions-Bavh4JFe.js";import{G as f,U as p,q as m,t as h,vn as g}from"./api-D3RWLycx.js";var _=class extends c{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||v(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=s({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),d.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function v(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var y=class extends u{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),i(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&n(t.mutationKey)!==n(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??v();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){d.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},b=e(t(),1);function x(e,t){let n=r(t),[i]=b.useState(()=>new y(n,e));b.useEffect(()=>{i.setOptions(e)},[i,e]);let s=b.useSyncExternalStore(b.useCallback(e=>i.subscribe(d.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),c=b.useCallback((...e)=>{i.mutate(e[0],e[1]).catch(o)},[i]);if(s.error&&a(i.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:c,mutateAsync:s.mutate}}var S=(e,t)=>{let n=new Map(e.map(e=>[e.sequence,e]));for(let e of t)n.has(e.sequence)||n.set(e.sequence,e);return[...n.values()].sort((e,t)=>e.sequence-t.sequence)},C=(e,t,n)=>[...e.filter(({attemptId:e})=>e!==t),...n].sort((e,t)=>e.before-t.before),w=(e,t,n)=>new p({...e,transcript:S(e.transcript,t.transcript),earlierTranscript:C(e.earlierTranscript,n.attemptId,t.earlierTranscript)}),T=e=>{let t=new Map;for(let n of e){if(n.payload._tag!==`SessionEvent`)continue;let e=n.payload.event;e._tag===`PoolRateLimitsUpdated`&&t.set(e.pool,{pool:e.pool,windows:g([e.rateLimits.primary,e.rateLimits.secondary])})}return[...t.values()]},E=async(e,t)=>{let n=await t(e);if(e._tag===`ColdTranscriptRequest`)return n;let r=n.transcript;for(;!n.run.canCancel;){let e=n.transcript.at(-1);if(e===void 0)break;n=await t(new m({after:e.sequence})),r=S(r,n.transcript)}return new p({...n,transcript:r})},D=[`run`],O=e=>[...D,e],k=(e,t)=>{let n=O(t);return l({queryKey:n,queryFn:async()=>{let r=e.getQueryData(n)?.transcript.at(-1)?.sequence,i=await E(r===void 0?new f:new m({after:r}),e=>h(n=>n.detail({params:{runId:t},query:e}))),a=e.getQueryData(n);return r===void 0||a===void 0?i:new p({...i,transcript:S(a.transcript,i.transcript),earlierTranscript:a.earlierTranscript})},staleTime:1e3,structuralSharing:!1,meta:{refreshLabel:`Run`},refetchInterval:e=>e.state.data?.run.canCancel===!0&&1e3})};export{T as a,w as i,D as n,x as o,k as r,_ as s,O as t};
@@ -1 +1 @@
1
- import{t as e}from"./queryOptions-Bavh4JFe.js";import{t}from"./api-CoJQoiOc.js";var n=5e3,r=()=>e({queryKey:[`configuration`],queryFn:()=>t(e=>e.configuration()),meta:{refreshLabel:`Configuration`},refetchInterval:n}),i=()=>e({queryKey:[`agents`],queryFn:()=>t(e=>e.agents())});export{r as n,i as t};
1
+ import{t as e}from"./queryOptions-Bavh4JFe.js";import{t}from"./api-D3RWLycx.js";var n=5e3,r=()=>e({queryKey:[`configuration`],queryFn:()=>t(e=>e.configuration()),meta:{refreshLabel:`Configuration`},refetchInterval:n}),i=()=>e({queryKey:[`agents`],queryFn:()=>t(e=>e.agents())});export{r as n,i as t};
@@ -1 +1 @@
1
- import{t as e}from"./queryOptions-Bavh4JFe.js";import{t}from"./api-CoJQoiOc.js";var n=3e3,r=15e3,i=()=>e({queryKey:[`desk`],queryFn:()=>t(e=>e.desk()),meta:{refreshLabel:`Activity`},refetchInterval:e=>{let t=e.state.data;return t!==void 0&&(t.running.length>0||t.notMoving.some(({reason:e})=>e._tag===`QueuedForWorker`))?n:r}});export{i as t};
1
+ import{t as e}from"./queryOptions-Bavh4JFe.js";import{t}from"./api-D3RWLycx.js";var n=3e3,r=15e3,i=()=>e({queryKey:[`desk`],queryFn:()=>t(e=>e.desk()),meta:{refreshLabel:`Activity`},refetchInterval:e=>{let t=e.state.data;return t!==void 0&&(t.running.length>0||t.notMoving.some(({reason:e})=>e._tag===`QueuedForWorker`))?n:r}});export{i as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{d as t,g as n,l as r,s as i,t as a}from"./section-Du_ZZiFG.js";import{t as o}from"./useSuspenseQuery-ajaZl96Y.js";import{n as s}from"./useNavigate-I5E4IRt2.js";import{t as c}from"./link-3oQYoIpm.js";import{r as l}from"./button-CzVqBv_O.js";import{xt as u}from"./api-CoJQoiOc.js";import{n as d}from"./queries-D5TGw8Nr.js";import{Y as f}from"./index-BGr-Cg-z.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./table-CKp2wE4u.js";import{t as y}from"./fill-cell-BtM3J7oO.js";var b=e=>e.lanes.flatMap(({sources:e})=>e.flatMap(e=>e._tag===`Label`?[e.label]:[])),x=e(),S=e=>{let t=[...e.declaredLabels,...b(e)];if(t.length===0)return{text:`No labels`,problem:!1};if(t.some(({onGitHub:e})=>e===null))return{text:`Not polled yet`,problem:!1};let n=e=>new Set(e.map(({name:e})=>e.toLowerCase())).size,r=n(t.filter(({failure:e})=>e!==null)),i=n(t.filter(({onGitHub:e})=>e===!1)),a=[...r>0?[`${r} failed`]:[],...i>0?[`${i} missing on GitHub`]:[]];return a.length===0?{text:`All on GitHub`,problem:!1}:{text:a.join(`, `),problem:!0}},C=({repository:e})=>{let n=s(),i=u(e.name),a=S(e);return(0,x.jsxs)(r,{open:()=>void n({to:`/configuration/repositories/$owner/$name`,params:i}),children:[(0,x.jsx)(_,{className:`py-3`,children:(0,x.jsxs)(c,{to:`/configuration/repositories/$owner/$name`,params:i,onClick:e=>e.stopPropagation(),className:l(t,`flex w-fit items-center gap-2`),children:[(0,x.jsx)(f,{repository:e.name}),e.name]})}),(0,x.jsx)(_,{className:`hidden @2xl:table-cell`,children:e.tags.length===0?(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):e.tags.join(`, `)}),(0,x.jsx)(_,{className:`text-right tabular-nums`,children:e.lanes.length===0?(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`Proposed`}):e.lanes.length}),(0,x.jsx)(_,{className:l(`max-sm:whitespace-normal`,a.problem?`text-destructive`:`text-muted-foreground`),children:a.text}),(0,x.jsx)(y,{className:`hidden whitespace-normal text-muted-foreground sm:table-cell`,children:e.loops.length===0?`No loop`:e.loops.join(`, `)})]})},w=({configuration:e})=>(0,x.jsx)(a,{title:`Repositories`,createKind:`repository`,counts:`${e.repositories.length} ${e.repositories.length===1?`repository`:`repositories`}`,children:e.repositories.length===0?(0,x.jsx)(i,{title:`No repositories registered`,children:n}):(0,x.jsx)(`div`,{className:`@container -mx-2`,children:(0,x.jsxs)(v,{children:[(0,x.jsx)(p,{children:(0,x.jsxs)(g,{className:`hover:bg-transparent`,children:[(0,x.jsx)(m,{children:`Repository`}),(0,x.jsx)(m,{className:`hidden @2xl:table-cell`,children:`Tags`}),(0,x.jsx)(m,{className:`text-right`,children:`Lanes`}),(0,x.jsx)(m,{children:`Labels`}),(0,x.jsx)(m,{className:`hidden sm:table-cell`,children:`Loops`})]})}),(0,x.jsx)(h,{children:e.repositories.map(e=>(0,x.jsx)(C,{repository:e},e.name))})]})})}),T=()=>{let{data:e}=o(d());return(0,x.jsx)(w,{configuration:e})};export{T as component};
1
+ import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{d as t,g as n,l as r,s as i,t as a}from"./section-Db-f1liW.js";import{t as o}from"./useSuspenseQuery-ajaZl96Y.js";import{n as s}from"./useNavigate-I5E4IRt2.js";import{t as c}from"./link-3oQYoIpm.js";import{r as l}from"./button-CzVqBv_O.js";import{xt as u}from"./api-D3RWLycx.js";import{n as d}from"./queries-C_qC_nGu.js";import{Y as f}from"./index-B_6qmKij.js";import{a as p,i as m,n as h,o as g,r as _,t as v}from"./table-CKp2wE4u.js";import{t as y}from"./fill-cell-BtM3J7oO.js";var b=e=>e.lanes.flatMap(({sources:e})=>e.flatMap(e=>e._tag===`Label`?[e.label]:[])),x=e(),S=e=>{let t=[...e.declaredLabels,...b(e)];if(t.length===0)return{text:`No labels`,problem:!1};if(t.some(({onGitHub:e})=>e===null))return{text:`Not polled yet`,problem:!1};let n=e=>new Set(e.map(({name:e})=>e.toLowerCase())).size,r=n(t.filter(({failure:e})=>e!==null)),i=n(t.filter(({onGitHub:e})=>e===!1)),a=[...r>0?[`${r} failed`]:[],...i>0?[`${i} missing on GitHub`]:[]];return a.length===0?{text:`All on GitHub`,problem:!1}:{text:a.join(`, `),problem:!0}},C=({repository:e})=>{let n=s(),i=u(e.name),a=S(e);return(0,x.jsxs)(r,{open:()=>void n({to:`/configuration/repositories/$owner/$name`,params:i}),children:[(0,x.jsx)(_,{className:`py-3`,children:(0,x.jsxs)(c,{to:`/configuration/repositories/$owner/$name`,params:i,onClick:e=>e.stopPropagation(),className:l(t,`flex w-fit items-center gap-2`),children:[(0,x.jsx)(f,{repository:e.name}),e.name]})}),(0,x.jsx)(_,{className:`hidden @2xl:table-cell`,children:e.tags.length===0?(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`None`}):e.tags.join(`, `)}),(0,x.jsx)(_,{className:`text-right tabular-nums`,children:e.lanes.length===0?(0,x.jsx)(`span`,{className:`text-muted-foreground`,children:`Proposed`}):e.lanes.length}),(0,x.jsx)(_,{className:l(`max-sm:whitespace-normal`,a.problem?`text-destructive`:`text-muted-foreground`),children:a.text}),(0,x.jsx)(y,{className:`hidden whitespace-normal text-muted-foreground sm:table-cell`,children:e.loops.length===0?`No loop`:e.loops.join(`, `)})]})},w=({configuration:e})=>(0,x.jsx)(a,{title:`Repositories`,createKind:`repository`,counts:`${e.repositories.length} ${e.repositories.length===1?`repository`:`repositories`}`,children:e.repositories.length===0?(0,x.jsx)(i,{title:`No repositories registered`,children:n}):(0,x.jsx)(`div`,{className:`@container -mx-2`,children:(0,x.jsxs)(v,{children:[(0,x.jsx)(p,{children:(0,x.jsxs)(g,{className:`hover:bg-transparent`,children:[(0,x.jsx)(m,{children:`Repository`}),(0,x.jsx)(m,{className:`hidden @2xl:table-cell`,children:`Tags`}),(0,x.jsx)(m,{className:`text-right`,children:`Lanes`}),(0,x.jsx)(m,{children:`Labels`}),(0,x.jsx)(m,{className:`hidden sm:table-cell`,children:`Loops`})]})}),(0,x.jsx)(h,{children:e.repositories.map(e=>(0,x.jsx)(C,{repository:e},e.name))})]})})}),T=()=>{let{data:e}=o(d());return(0,x.jsx)(w,{configuration:e})};export{T as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{t}from"./link-3oQYoIpm.js";import{xt as n}from"./api-CoJQoiOc.js";import{Y as r}from"./index-BGr-Cg-z.js";var i=e(),a=({repository:e})=>{let{owner:a,name:o}=n(e);return(0,i.jsxs)(t,{to:`/configuration/repositories/$owner/$name`,params:{owner:a,name:o},className:`flex w-fit items-center gap-2 text-primary hover:underline`,children:[(0,i.jsx)(r,{repository:e}),e]})};export{a as t};
1
+ import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{t}from"./link-3oQYoIpm.js";import{xt as n}from"./api-D3RWLycx.js";import{Y as r}from"./index-B_6qmKij.js";var i=e(),a=({repository:e})=>{let{owner:a,name:o}=n(e);return(0,i.jsxs)(t,{to:`/configuration/repositories/$owner/$name`,params:{owner:a,name:o},className:`flex w-fit items-center gap-2 text-primary hover:underline`,children:[(0,i.jsx)(r,{repository:e}),e]})};export{a as t};
@@ -0,0 +1 @@
1
+ import{_ as e}from"./index-B_6qmKij.js";var t=e;export{t as errorComponent};
@@ -0,0 +1 @@
1
+ import{g as e}from"./index-B_6qmKij.js";var t=e;export{t as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{t}from"./useRouter-DAYosDT2.js";import{t as n}from"./button-CzVqBv_O.js";import{n as r}from"./api-CoJQoiOc.js";import{S as i,f as a,u as o}from"./strings-BIVdGoBr.js";import{t as s}from"./boot-screen-Cqtn8Ter.js";var c=e(),l=()=>(0,c.jsx)(s,{title:`usine`,description:o,inPanel:!0}),u=({error:e})=>{let o=t();return(0,c.jsx)(s,{title:a,description:r(e),tone:`error`,inPanel:!0,children:(0,c.jsx)(n,{variant:`outline`,onClick:()=>void o.invalidate(),children:i})})};export{l as n,u as t};
1
+ import{t as e}from"./jsx-runtime-Wy9s6hX0.js";import{t}from"./useRouter-DAYosDT2.js";import{t as n}from"./button-CzVqBv_O.js";import{n as r}from"./api-D3RWLycx.js";import{S as i,f as a,u as o}from"./strings-BIVdGoBr.js";import{t as s}from"./boot-screen-Cqtn8Ter.js";var c=e(),l=()=>(0,c.jsx)(s,{title:`usine`,description:o,inPanel:!0}),u=({error:e})=>{let o=t();return(0,c.jsx)(s,{title:a,description:r(e),tone:`error`,inPanel:!0,children:(0,c.jsx)(n,{variant:`outline`,onClick:()=>void o.invalidate(),children:i})})};export{l as n,u as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./route-status-Cxocu6W_.js";var t=e;export{t as errorComponent};