@kingsleyweb/bun-ui 0.0.0-stage → 3.0.0-rc.2

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 (240) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -2
  3. package/app/docs/App.tsx +72 -0
  4. package/app/docs/api/client.ts +303 -0
  5. package/app/docs/api/contract.ts +24 -0
  6. package/app/docs/api/docs.ts +38 -0
  7. package/app/docs/api/errors.ts +144 -0
  8. package/app/docs/boot.tsx +58 -0
  9. package/app/docs/components/Badge.tsx +65 -0
  10. package/app/docs/components/Button.tsx +37 -0
  11. package/app/docs/components/Card.tsx +41 -0
  12. package/app/docs/components/ConfirmDialog.tsx +173 -0
  13. package/app/docs/components/CopyButton.tsx +68 -0
  14. package/app/docs/components/Dialog.tsx +230 -0
  15. package/app/docs/components/EmptyState.tsx +34 -0
  16. package/app/docs/components/ErrorView.tsx +70 -0
  17. package/app/docs/components/Field.tsx +93 -0
  18. package/app/docs/components/JsonEditor.tsx +151 -0
  19. package/app/docs/components/JsonView.tsx +338 -0
  20. package/app/docs/components/KeyValue.tsx +63 -0
  21. package/app/docs/components/ProblemBanner.tsx +116 -0
  22. package/app/docs/components/ScreenErrorBoundary.tsx +141 -0
  23. package/app/docs/components/Spinner.tsx +33 -0
  24. package/app/docs/components/Table.tsx +33 -0
  25. package/app/docs/components/Tabs.tsx +226 -0
  26. package/app/docs/components/classNames.ts +4 -0
  27. package/app/docs/components/components.css +691 -0
  28. package/app/docs/components/copy.ts +89 -0
  29. package/app/docs/components/fieldContext.ts +29 -0
  30. package/app/docs/components/inputValues.ts +142 -0
  31. package/app/docs/components/inputs.tsx +387 -0
  32. package/app/docs/components/jsonParse.ts +338 -0
  33. package/app/docs/components/listKeys.ts +30 -0
  34. package/app/docs/config.ts +86 -0
  35. package/app/docs/context.ts +33 -0
  36. package/app/docs/embed.ts +74 -0
  37. package/app/docs/env.d.ts +2 -0
  38. package/app/docs/format.ts +9 -0
  39. package/app/docs/hooks/useUrlTab.ts +16 -0
  40. package/app/docs/main.tsx +11 -0
  41. package/app/docs/queryClient.ts +54 -0
  42. package/app/docs/router.tsx +194 -0
  43. package/app/docs/routing.ts +194 -0
  44. package/app/docs/screens/docs/document.ts +27 -0
  45. package/app/docs/screens/docs/http/OperationView.tsx +407 -0
  46. package/app/docs/screens/docs/http/Sidebar.tsx +190 -0
  47. package/app/docs/screens/docs/http/TryItPanel.tsx +603 -0
  48. package/app/docs/screens/docs/http/http.css +405 -0
  49. package/app/docs/screens/docs/http/index.tsx +395 -0
  50. package/app/docs/screens/docs/http/model.ts +604 -0
  51. package/app/docs/screens/docs/http/tryIt.ts +455 -0
  52. package/app/docs/screens/docs/permissions.ts +6 -0
  53. package/app/docs/screens/docs/schema/Prose.tsx +43 -0
  54. package/app/docs/screens/docs/schema/SchemaTree.tsx +319 -0
  55. package/app/docs/screens/docs/schema/index.ts +30 -0
  56. package/app/docs/screens/docs/schema/resolve.ts +466 -0
  57. package/app/docs/screens/docs/schema/schema.css +137 -0
  58. package/app/docs/screens/docs/schema/skeleton.ts +92 -0
  59. package/app/docs/screens/docs/viewer.tsx +154 -0
  60. package/app/docs/screens/docs/ws/InlineText.tsx +25 -0
  61. package/app/docs/screens/docs/ws/PayloadSchema.tsx +39 -0
  62. package/app/docs/screens/docs/ws/format.ts +82 -0
  63. package/app/docs/screens/docs/ws/index.tsx +286 -0
  64. package/app/docs/screens/docs/ws/items.tsx +786 -0
  65. package/app/docs/screens/docs/ws/model.ts +1178 -0
  66. package/app/docs/screens/docs/ws/panels.tsx +440 -0
  67. package/app/docs/screens/docs/ws/ws.css +231 -0
  68. package/app/docs/shortcuts.ts +94 -0
  69. package/app/docs/styles/base.css +847 -0
  70. package/app/docs/styles/tokens.css +143 -0
  71. package/app/docs/theme.ts +56 -0
  72. package/app/kit/unauthorized.ts +222 -0
  73. package/dist/docs/assets/main-0rchxtv5.js +18 -0
  74. package/dist/docs/assets/main-0rchxtv5.js.map +99 -0
  75. package/dist/docs/assets/main-cqgyvs86.css +1 -0
  76. package/dist/docs/manifest.json +26 -0
  77. package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js +6 -0
  78. package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js.map +11 -0
  79. package/dist/jobs/assets/AddFlowDialog-n7gtc84v.css +1 -0
  80. package/dist/jobs/assets/added-cbwsxv3e.js +4 -0
  81. package/dist/jobs/assets/added-cbwsxv3e.js.map +11 -0
  82. package/dist/jobs/assets/bodies-yyw5hmrp.js +6 -0
  83. package/dist/jobs/assets/bodies-yyw5hmrp.js.map +10 -0
  84. package/dist/jobs/assets/channel-tgkvqm8y.js +4 -0
  85. package/dist/jobs/assets/channel-tgkvqm8y.js.map +10 -0
  86. package/dist/jobs/assets/channelChecks-s4yz4yhw.js +4 -0
  87. package/dist/jobs/assets/channelChecks-s4yz4yhw.js.map +10 -0
  88. package/dist/jobs/assets/index-02427smp.css +1 -0
  89. package/dist/jobs/assets/index-09z2cjft.js +4 -0
  90. package/dist/jobs/assets/index-09z2cjft.js.map +16 -0
  91. package/dist/jobs/assets/index-18bn0gvy.css +1 -0
  92. package/dist/jobs/assets/index-47pxmyxn.js +4 -0
  93. package/dist/jobs/assets/index-47pxmyxn.js.map +10 -0
  94. package/dist/jobs/assets/index-4e55z986.js +4 -0
  95. package/dist/jobs/assets/index-4e55z986.js.map +11 -0
  96. package/dist/jobs/assets/index-5c933424.js +4 -0
  97. package/dist/jobs/assets/index-5c933424.js.map +18 -0
  98. package/dist/jobs/assets/index-5kbyqspm.css +1 -0
  99. package/dist/jobs/assets/index-5ng37hk6.css +1 -0
  100. package/dist/jobs/assets/index-5w8w7fvc.css +1 -0
  101. package/dist/jobs/assets/index-71qs5qyx.css +1 -0
  102. package/dist/jobs/assets/index-btpg4r8b.css +1 -0
  103. package/dist/jobs/assets/index-d5r5n0mm.js +4 -0
  104. package/dist/jobs/assets/index-d5r5n0mm.js.map +23 -0
  105. package/dist/jobs/assets/index-e0yy2skq.css +1 -0
  106. package/dist/jobs/assets/index-hs60b25v.js +10 -0
  107. package/dist/jobs/assets/index-hs60b25v.js.map +62 -0
  108. package/dist/jobs/assets/index-k2smrr70.js +4 -0
  109. package/dist/jobs/assets/index-k2smrr70.js.map +9 -0
  110. package/dist/jobs/assets/index-q24jw3w9.js +4 -0
  111. package/dist/jobs/assets/index-q24jw3w9.js.map +32 -0
  112. package/dist/jobs/assets/index-qfb80xen.css +1 -0
  113. package/dist/jobs/assets/index-rtynx6wj.js +4 -0
  114. package/dist/jobs/assets/index-rtynx6wj.js.map +10 -0
  115. package/dist/jobs/assets/live-6k7s6358.js +4 -0
  116. package/dist/jobs/assets/live-6k7s6358.js.map +10 -0
  117. package/dist/jobs/assets/main-0jmeh6mq.js +6 -0
  118. package/dist/jobs/assets/main-0jmeh6mq.js.map +12 -0
  119. package/dist/jobs/assets/main-3yj6bv90.js +5 -0
  120. package/dist/jobs/assets/main-3yj6bv90.js.map +10 -0
  121. package/dist/jobs/assets/main-4g69fn3x.js +5 -0
  122. package/dist/jobs/assets/main-4g69fn3x.js.map +10 -0
  123. package/dist/jobs/assets/main-4gte3eqq.js +5 -0
  124. package/dist/jobs/assets/main-4gte3eqq.js.map +10 -0
  125. package/dist/jobs/assets/main-4j1fcevh.js +5 -0
  126. package/dist/jobs/assets/main-4j1fcevh.js.map +10 -0
  127. package/dist/jobs/assets/main-54qwkz28.css +1 -0
  128. package/dist/jobs/assets/main-5grjvsy7.js +5 -0
  129. package/dist/jobs/assets/main-5grjvsy7.js.map +11 -0
  130. package/dist/jobs/assets/main-5zbx60gq.js +5 -0
  131. package/dist/jobs/assets/main-5zbx60gq.js.map +11 -0
  132. package/dist/jobs/assets/main-9prgjhg4.js +5 -0
  133. package/dist/jobs/assets/main-9prgjhg4.js.map +10 -0
  134. package/dist/jobs/assets/main-a250ffk7.js +17 -0
  135. package/dist/jobs/assets/main-a250ffk7.js.map +115 -0
  136. package/dist/jobs/assets/main-d6ge7w08.js +5 -0
  137. package/dist/jobs/assets/main-d6ge7w08.js.map +10 -0
  138. package/dist/jobs/assets/main-gngzht43.js +5 -0
  139. package/dist/jobs/assets/main-gngzht43.js.map +10 -0
  140. package/dist/jobs/assets/main-hg0hrg8j.js +5 -0
  141. package/dist/jobs/assets/main-hg0hrg8j.js.map +10 -0
  142. package/dist/jobs/assets/main-hm1ng3yg.js +5 -0
  143. package/dist/jobs/assets/main-hm1ng3yg.js.map +12 -0
  144. package/dist/jobs/assets/main-jkvd92z9.js +5 -0
  145. package/dist/jobs/assets/main-jkvd92z9.js.map +10 -0
  146. package/dist/jobs/assets/main-jv5xqd13.js +5 -0
  147. package/dist/jobs/assets/main-jv5xqd13.js.map +21 -0
  148. package/dist/jobs/assets/main-jxre7w93.js +5 -0
  149. package/dist/jobs/assets/main-jxre7w93.js.map +23 -0
  150. package/dist/jobs/assets/main-kwmqkjfx.js +5 -0
  151. package/dist/jobs/assets/main-kwmqkjfx.js.map +11 -0
  152. package/dist/jobs/assets/main-n9cf6bxm.js +5 -0
  153. package/dist/jobs/assets/main-n9cf6bxm.js.map +11 -0
  154. package/dist/jobs/assets/main-pegp0ygb.js +5 -0
  155. package/dist/jobs/assets/main-pegp0ygb.js.map +10 -0
  156. package/dist/jobs/assets/main-qr573853.js +5 -0
  157. package/dist/jobs/assets/main-qr573853.js.map +12 -0
  158. package/dist/jobs/assets/main-rq97rdr4.js +4 -0
  159. package/dist/jobs/assets/main-rq97rdr4.js.map +22 -0
  160. package/dist/jobs/assets/main-szjdmydc.js +5 -0
  161. package/dist/jobs/assets/main-szjdmydc.js.map +13 -0
  162. package/dist/jobs/assets/main-tnbhrm9n.js +7 -0
  163. package/dist/jobs/assets/main-tnbhrm9n.js.map +11 -0
  164. package/dist/jobs/assets/main-ts19j4n0.js +5 -0
  165. package/dist/jobs/assets/main-ts19j4n0.js.map +25 -0
  166. package/dist/jobs/assets/main-w93x1dzs.js +5 -0
  167. package/dist/jobs/assets/main-w93x1dzs.js.map +10 -0
  168. package/dist/jobs/assets/sections-0ksdxs8m.css +1 -0
  169. package/dist/jobs/assets/sections-0y7w4fb4.js +4 -0
  170. package/dist/jobs/assets/sections-0y7w4fb4.js.map +10 -0
  171. package/dist/jobs/assets/sse-mn0t0fh7.js +5 -0
  172. package/dist/jobs/assets/sse-mn0t0fh7.js.map +11 -0
  173. package/dist/jobs/assets/sseChecks-t7tcm7ra.js +4 -0
  174. package/dist/jobs/assets/sseChecks-t7tcm7ra.js.map +10 -0
  175. package/dist/jobs/assets/validation-ysjfy072.js +4 -0
  176. package/dist/jobs/assets/validation-ysjfy072.js.map +9 -0
  177. package/dist/jobs/manifest.json +511 -0
  178. package/dts/docs/assets.d.ts +144 -0
  179. package/dts/docs/assets.d.ts.map +1 -0
  180. package/dts/docs/browser/config.d.ts +61 -0
  181. package/dts/docs/browser/config.d.ts.map +1 -0
  182. package/dts/docs/browser/index.d.ts +12 -0
  183. package/dts/docs/browser/index.d.ts.map +1 -0
  184. package/dts/docs/docsUi.d.ts +42 -0
  185. package/dts/docs/docsUi.d.ts.map +1 -0
  186. package/dts/docs/hosted.d.ts +22 -0
  187. package/dts/docs/hosted.d.ts.map +1 -0
  188. package/dts/docs/index.d.ts +18 -0
  189. package/dts/docs/index.d.ts.map +1 -0
  190. package/dts/docs/shell.d.ts +57 -0
  191. package/dts/docs/shell.d.ts.map +1 -0
  192. package/dts/docs/types.d.ts +137 -0
  193. package/dts/docs/types.d.ts.map +1 -0
  194. package/dts/index.d.ts +21 -0
  195. package/dts/index.d.ts.map +1 -0
  196. package/dts/jobs/assets.d.ts +157 -0
  197. package/dts/jobs/assets.d.ts.map +1 -0
  198. package/dts/jobs/browser/config.d.ts +67 -0
  199. package/dts/jobs/browser/config.d.ts.map +1 -0
  200. package/dts/jobs/browser/index.d.ts +10 -0
  201. package/dts/jobs/browser/index.d.ts.map +1 -0
  202. package/dts/jobs/browser/unauthorized.d.ts +9 -0
  203. package/dts/jobs/browser/unauthorized.d.ts.map +1 -0
  204. package/dts/jobs/index.d.ts +24 -0
  205. package/dts/jobs/index.d.ts.map +1 -0
  206. package/dts/jobs/jobsUi.d.ts +63 -0
  207. package/dts/jobs/jobsUi.d.ts.map +1 -0
  208. package/dts/jobs/shell.d.ts +77 -0
  209. package/dts/jobs/shell.d.ts.map +1 -0
  210. package/dts/jobs/types.d.ts +146 -0
  211. package/dts/jobs/types.d.ts.map +1 -0
  212. package/dts/kit/browser/shared.d.ts +10 -0
  213. package/dts/kit/browser/shared.d.ts.map +1 -0
  214. package/dts/kit/browser/unauthorized.d.ts +74 -0
  215. package/dts/kit/browser/unauthorized.d.ts.map +1 -0
  216. package/dts/kit/unauthorized.d.ts +47 -0
  217. package/dts/kit/unauthorized.d.ts.map +1 -0
  218. package/guides/docs.md +170 -0
  219. package/guides/jobs.md +1120 -0
  220. package/lib/docs/assets.ts +427 -0
  221. package/lib/docs/browser/config.ts +66 -0
  222. package/lib/docs/browser/index.ts +24 -0
  223. package/lib/docs/docsUi.ts +623 -0
  224. package/lib/docs/hosted.ts +31 -0
  225. package/lib/docs/index.ts +37 -0
  226. package/lib/docs/shell.ts +156 -0
  227. package/lib/docs/types.ts +149 -0
  228. package/lib/index.ts +27 -0
  229. package/lib/jobs/assets.ts +448 -0
  230. package/lib/jobs/browser/config.ts +65 -0
  231. package/lib/jobs/browser/index.ts +9 -0
  232. package/lib/jobs/browser/unauthorized.ts +11 -0
  233. package/lib/jobs/index.ts +41 -0
  234. package/lib/jobs/jobsUi.ts +709 -0
  235. package/lib/jobs/shell.ts +205 -0
  236. package/lib/jobs/types.ts +162 -0
  237. package/lib/kit/browser/shared.ts +11 -0
  238. package/lib/kit/browser/unauthorized.ts +114 -0
  239. package/lib/kit/unauthorized.ts +222 -0
  240. package/package.json +198 -4
@@ -0,0 +1,4 @@
1
+ import{wn,Vs}from"./main-rq97rdr4.js";import"./main-szjdmydc.js";import"./main-qr573853.js";import"./main-tnbhrm9n.js";import"./main-kwmqkjfx.js";import"./main-4g69fn3x.js";import"./main-4j1fcevh.js";import"./main-0jmeh6mq.js";import"./main-d6ge7w08.js";import"./main-jkvd92z9.js";import"./main-hm1ng3yg.js";import"./main-5grjvsy7.js";import"./main-pegp0ygb.js";import{Zr}from"./main-a250ffk7.js";export{Zr as AddFlowDialog,wn as AddJobDialog,Vs as JobScreen};
2
+
3
+ //# debugId=7A8E2E84E551C51E64756E2164756E21
4
+ //# sourceMappingURL=index-k2smrr70.js.map
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "7A8E2E84E551C51E64756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,4 @@
1
+ import{An,C,Me,c,g,r,St,vn,qr,Zn,$t,Jr,Hr,K,b,P,N,n,e,t,f,i,gt,m,y,ie,J,Y,a,s,de,E,oe,ve,ue,rt,ye,H,d,p,R,L,o,h,u,te,Ce,l,M,V,S,w,Le,I,ne,Kr}from"./main-a250ffk7.js";import{dt,dn}from"./main-qr573853.js";import{Ue,ct}from"./main-tnbhrm9n.js";import{he,Ne,mt,cn,ho,go,yo}from"./main-gngzht43.js";import{U}from"./main-hg0hrg8j.js";import{k}from"./main-4g69fn3x.js";import{Ir,O}from"./main-4j1fcevh.js";import{W,me,we}from"./main-3yj6bv90.js";import{Ie,A}from"./main-0jmeh6mq.js";import{ae}from"./main-d6ge7w08.js";import{re}from"./main-jkvd92z9.js";import{D}from"./main-hm1ng3yg.js";import{ge}from"./main-5grjvsy7.js";import{F}from"./main-pegp0ygb.js";function De(v,x){return`/runners/${P(v)}${x}`}function Sn(v,x,T={}){let _=T.force!==void 0||T.args!==void 0;return v.request("POST",De(x,"/trigger"),{body:_?T:void 0})}function Nn(v,x){return v.request("POST",De(x,"/pause"))}function Ln(v,x,T=!1){return v.request("POST",De(x,"/resume"),{body:T?{triggerNow:!0}:void 0})}function wn(v,x,T){return v.request("PUT",De(x,"/schedule"),{body:{schedule:T}})}function Tn(v,x,T={}){return v.request("POST",De(x,"/kill"),{body:Object.keys(T).length>0?T:void 0})}function Dn(v,x,T){return v.request("PUT",De(x,"/config"),{body:T})}function En(v,x){return v.request("DELETE",De(x,"/config"))}function On(v,x){return v.request("POST",De(x,"/stats/reset"))}function kn(v,x){return v.request("DELETE",De(x,"/history"))}var Pn={"child-process":"child-process — a child process per run","worker-thread":"worker-thread — a Worker thread per run","in-process":"in-process — in the runner's own process"},In=[{value:"parallel",label:"parallel — runs may overlap"},{value:"single",label:"single — one run at a time, cluster-wide"}],Ee=qr.maxConcurrency,er=["runMode","maxConcurrency"],Mn={executionMode:"Execution mode",runMode:"Run mode",maxConcurrency:"Max concurrency"};function nr(v){return er.some((x)=>v.overridden.includes(x))}function sn(v){return{executionModeOverridden:v.overridden.includes("executionMode"),executionMode:v.effective.executionMode,concurrencyOverridden:nr(v),runMode:v.effective.runMode,maxConcurrency:v.effective.maxConcurrency??void 0}}function tr(v,x){let T=x.code??x.effective;return{executionMode:v.executionModeOverridden?v.executionMode:T.executionMode,runMode:v.concurrencyOverridden?v.runMode:T.runMode,maxConcurrency:v.concurrencyOverridden?v.maxConcurrency??null:T.maxConcurrency}}function ke(v,x){if(v.code===void 0)return null;if(x==="maxConcurrency")return on(v.code.maxConcurrency);return v.code[x]}function on(v){return v===null||v===void 0?"unlimited":o(v)}function _n(v){if(!v.concurrencyOverridden||v.runMode!=="parallel")return{};let x=v.maxConcurrency;if(x===void 0)return{};if(!Number.isInteger(x))return{maxConcurrency:"A whole number of runs, or empty for unlimited."};if(x<Ee.min||x>Ee.max)return{maxConcurrency:`Between ${Ee.min} and ${o(Ee.max)}, or empty for unlimited.`};return{}}function an(v,x){let T=sn(x),_={};if(v.executionModeOverridden!==T.executionModeOverridden||v.executionModeOverridden&&v.executionMode!==T.executionMode)_.executionMode=v.executionModeOverridden?v.executionMode:null;let B=v.runMode==="parallel"&&v.maxConcurrency!==T.maxConcurrency;if(v.concurrencyOverridden!==T.concurrencyOverridden||v.concurrencyOverridden&&(v.runMode!==T.runMode||B))_.concurrency=!v.concurrencyOverridden?null:v.runMode==="single"?{runMode:"single"}:{runMode:"parallel",maxConcurrency:v.maxConcurrency??null};return _}function Fn(v,x){return Object.keys(an(v,x)).length>0}function Bn(v,x){let T=tr(v,x),_=x.effective,B=[];if(T.executionMode!==_.executionMode)B.push({id:"execution-mode",message:`A run already in flight keeps the mode it started with, so ${T.executionMode} applies from the next run.`});if(_.runMode==="parallel"&&T.runMode==="single")B.push({id:"to-single",message:"Switching from parallel to single is not immediate across processes: a parallel run holds no lock, so overlap can persist for as long as the longest run in flight, plus however long an owner takes to adopt the change. Pause the runner first if exclusivity matters."});let q=_.maxConcurrency??1/0,Q=T.maxConcurrency??1/0;if(T.runMode==="parallel"&&Q<q)B.push({id:"lower-concurrency",message:`Lowering the cap from ${on(_.maxConcurrency)} to ${on(T.maxConcurrency)} only gates new runs: runs already in flight keep going.`});return B}function He(v){let x=v.appliedSeq??0;return v.seq>0&&x<v.seq?{applied:x,seq:v.seq}:null}function $n(v){let x=v.allowed;return x===void 0?[]:vn.filter((T)=>!x.includes(T))}function Un(v){let x=v.allowed;return x===void 0?[...vn]:vn.filter((T)=>x.includes(T))}function Hn(v){if(v.overridden.length===0)return"None: as the runner's code asks";return v.overridden.map((x)=>Mn[x]??x).join(", ")}function qn(v){let x=v.error?.keys;return x===void 0||x.length===0?null:x}function rr(v,x){if(v.error===void 0)return!1;let T=qn(v);if(T!==null)return T.includes(x);return v.code!==void 0&&v.effective[x]===v.code[x]}function un(v){let x=qn(v);if(x===null)return null;let T=x.map((_)=>Mn[_]??_);return T.length===1?T[0]:`${T.slice(0,-1).join(", ")} and ${T.at(-1)}`}function qe(v,x){if(v===void 0||!v.overridden.includes(x))return;let T=ke(v,x);if(rr(v,x))return T===null?"Override refused by the owner; it runs what its code asks for":`Override refused by the owner; it runs what its code asks for, ${T}`;return T===null?"Overridden here":`Overridden here; its code asks for ${T}`}function Kn(v){if(v.error!==void 0){let T=un(v);return T===null?`The owner refused these settings: ${v.error.message}`:`The owner refused ${T}: ${v.error.message}`}let x=He(v);return x===null?null:`Version ${x.seq} has not been adopted yet (the owner is on ${x.applied}); it takes effect at its next sync`}var Gn={paused:"The runner is paused. Tick “Run even while paused” to run it anyway, or resume it.",busy:"A run is already in progress, and this runner does not queue triggers.","lock-held":"Another process holds the runner's lock (a run is in progress there), and this runner does not queue triggers.","max-concurrency":"The runner is at its concurrency limit, and it does not queue triggers.","queue-full":"The runner's trigger queue is full (maxQueuedRuns). Try again once some queued runs have started.",stopped:"The runner has stopped, so nothing runs."},or={kill:"Only the process executing a run can kill it",resetStats:"Only the process that registered the runner can reset its stats"};function ln(v,x){switch(v.code){case"RUNNER_NOT_LOCAL":return`${or[x]??"This action needs the runner registered in the API's process"}, and this runner is registered only in another process. Use the management API of the process that runs it.`;case"RUN_NOT_FOUND":return"That run is no longer active in this process: it finished, or was killed already. Refresh to see the runs in flight now.";case"RUNNER_STOPPED":return"The runner has stopped (its process is shutting down, or it was stopped), so it cannot be triggered.";case"ARGS_NOT_ALLOWED":return"This API does not accept run arguments (it was created without runnerTriggerArgs). Trigger without arguments.";case"RUNNER_NOT_CONFIGURABLE":return"This runner cannot be configured from the API yet: no process running it has started since remote configuration shipped, so a setting would be stored and never adopted. Restart the runner on the current version, or change its settings where the runner is defined.";case"CONFIG_NOT_ALLOWED":return"The runner's own code does not permit that setting — usually an execution mode outside its `allowedOverrides.executionModes`. Choose one of the modes offered, or widen the list where the runner is defined.";case"RUNNER_NOT_FOUND":return x==="clearHistory"?"The runner no longer exists in this namespace (it was unregistered, or its state was removed), so it has no history left to clear.":"The runner no longer exists in this namespace: it was unregistered, or its state was removed.";default:return null}}function Se(v,x){if(!b(v))return v;let T=ln(v,x);if(T===null)return v;return new K({kind:v.kind,status:v.status,code:v.code,title:v.title,detail:T,type:v.type,issues:v.issues,context:v.context,instance:v.instance,cause:v})}function zn(v,x){let T=x.length>0?`, kept ${o(x.length)} in progress`:"";return`Cleared ${h(v,"run")}${T}`}function Vn({runner:v,config:x,onClose:T}){let _=i(),B=c(),[q,Q]=r(()=>sn(x)),X=(be)=>Q((jt)=>({...jt,...be})),G=O({mutationFn:(be)=>Dn(_,v.id,be),successMessage:(be)=>He(be)===null?`Saved the settings of ${v.id}`:`Saved the settings of ${v.id}; its owner adopts them at its next sync`,invalidate:Ne(v.id),toastErrors:!1,onSuccess:()=>T()}),ee=O({mutationFn:()=>En(_,v.id),successMessage:`Reset ${v.id} to its code defaults`,invalidate:Ne(v.id),toastErrors:!1,onSuccess:()=>T()}),Z=G.isPending||ee.isPending,Re=_n(q),se=Bn(q,x),le=an(q,x),z=Fn(q,x),ce=He(x),fe=Un(x),xe=$n(x),pe=ke(x,"executionMode"),Te=ke(x,"runMode"),Oe=ke(x,"maxConcurrency"),Be=G.error??ee.error,$e=(fe.includes(q.executionMode)?fe:[q.executionMode,...fe]).map((be)=>({value:be,label:Pn[be]})),rn=(be)=>{if(be.preventDefault(),Object.keys(Re).length>0||!z)return;G.mutate(le)},j=()=>{if(!Z)T()};return e(oe,{open:!0,onClose:j,title:t(n,{children:["Settings of ",e("code",{children:v.id})]}),description:"Where runs execute and whether they may overlap, for every process running this runner. A setting left to the runner's code follows the code.",size:"md",closeOnEscape:!Z,closeOnBackdrop:!Z,footer:t(n,{children:[x.overridden.length>0&&e(s,{variant:"danger",onClick:()=>ee.mutate(),disabled:Z,"aria-busy":ee.isPending||void 0,children:ee.isPending?"Resetting…":"Reset to code defaults"}),e(s,{onClick:j,disabled:Z,children:"Cancel"}),e(s,{variant:"primary",type:"submit",form:B,disabled:Z||!z,"aria-busy":G.isPending||void 0,children:G.isPending?"Saving…":"Save settings"})]}),children:t("form",{id:B,className:"runner-form",onSubmit:rn,noValidate:!0,children:[ce!==null&&t("p",{className:"runner-note runner-note-pending",role:"status","data-testid":"config-pending",children:["The stored settings (version ",ce.seq,") have not been adopted yet: the owner is on version ",ce.applied,". They take effect at its next sync."]}),x.error!==void 0&&t("p",{className:"runner-note runner-note-refused",role:"note","data-testid":"config-refused",children:["The owner refused ",un(x)??"the stored settings"," ",e(A,{value:x.error.at}),": ",x.error.message]}),e(l,{label:"Execution mode",hint:pe===null?"Where each run executes. It applies from the next run.":`Where each run executes. This runner's code asks for ${pe}.`,error:G.fieldErrors.executionMode,children:e(S,{options:$e,value:q.executionMode,onChange:(be)=>X({executionMode:be,executionModeOverridden:!0}),disabled:Z})}),e(Wn,{testId:"execution-mode",overridden:q.executionModeOverridden,label:"Execution mode",canReset:x.code!==void 0,disabled:Z,onReset:()=>X({executionModeOverridden:!1,executionMode:x.code?.executionMode??q.executionMode})}),xe.length>0&&t("p",{className:"runner-note",role:"note","data-testid":"config-modes-limited",children:[xe.join(", ")," ",xe.length===1?"is":"are"," ","not offered: this runner's code permits only ",fe.join(", ")," (its"," ",e("code",{children:"allowedOverrides.executionModes"}),"). The API refuses any other with 409 ",e("code",{children:"CONFIG_NOT_ALLOWED"}),"."]}),e(l,{label:"Run mode",hint:Te===null?"Whether runs may overlap.":`Whether runs may overlap. This runner's code asks for ${Te}.`,error:G.fieldErrors["concurrency.runMode"],children:e(S,{options:In,value:q.runMode,onChange:(be)=>X({runMode:be,concurrencyOverridden:!0}),disabled:Z})}),e(l,{label:"Max concurrency",hint:q.runMode==="single"?"Only applies in parallel: single already allows one run at a time.":`Most concurrent runs, ${Ee.min} to ${Ee.max} from here. Empty means unlimited.${Oe===null?"":` This runner's code asks for ${Oe}.`}`,error:Re.maxConcurrency??G.fieldErrors["concurrency.maxConcurrency"],children:e(V,{value:q.maxConcurrency,onChange:(be)=>X({maxConcurrency:be,concurrencyOverridden:!0}),min:Ee.min,max:Ee.max,placeholder:"Unlimited",disabled:Z||q.runMode==="single"})}),e(Wn,{testId:"concurrency",overridden:q.concurrencyOverridden,label:"Run mode and max concurrency",canReset:x.code!==void 0,disabled:Z,onReset:()=>X({concurrencyOverridden:!1,runMode:x.code?.runMode??q.runMode,maxConcurrency:x.code?.maxConcurrency??q.maxConcurrency})}),se.map((be)=>e("p",{className:"runner-note runner-note-pending",role:"note","data-testid":`config-warning-${be.id}`,children:be.message},be.id)),Be!==null&&e(D,{error:Se(Be,"configure")})]})})}function Wn({testId:v,overridden:x,label:T,canReset:_,disabled:B,onReset:q}){return t("p",{className:"config-source","data-testid":`config-source-${v}`,children:[e("span",{children:x?`${T}: overridden here.`:`${T}: as the runner's code asks.`}),x&&_&&e(s,{size:"sm",onClick:q,disabled:B,children:"Use the code default"})]})}function sr(v){return v.isLocal&&(v.local?.activeRuns.length??0)>0}function Ke(v,x){let T=x("runners.kill"),_=x("runners.resetStats");return{trigger:x("runners.trigger"),pause:!v.isPaused&&x("runners.pause"),resume:v.isPaused&&x("runners.resume"),reschedule:x("runners.reschedule"),configure:v.config!==void 0&&x("runners.configure"),kill:T&&sr(v),resetStats:_&&v.isLocal,clearHistory:x("runners.clearHistory"),nonLocalOnly:!v.isLocal&&(T||_)}}function Qn(v){if(v.isLocal)return!1;return(v.config?.effective.runMode??v.runMode)!=="single"}var Ge=200;function Yn({runner:v,onClose:x}){let T=i(),[_,B]=r(!1),q=O({mutationFn:(Q)=>Ln(T,v.id,Q),successMessage:(Q,X)=>`Resumed ${v.id}${X?" and asked for a run":""}${v.isLocal?"":"; its owner picks it up at its next sync"}`,invalidate:Ne(v.id),toastErrors:!1});return e(k,{open:!0,onClose:x,title:`Resume ${v.id}?`,description:"Scheduled and manual runs start again, everywhere the runner is registered.",confirmLabel:"Resume",pendingLabel:"Resuming…",onConfirm:async()=>{try{await q.mutateAsync(_)}catch(Q){throw Se(Q,"resume")}},children:e(w,{checked:_,onChange:B,label:"Also trigger a run now"})})}function Xn({runner:v,onClose:x}){let T=i(),_=te(),B=v.local?.activeRuns??[],[q,Q]=r(""),[X,G]=r(!1),[ee,Z]=r(""),[Re,se]=r(!1),le=O({mutationFn:(fe)=>Tn(T,v.id,fe),onSuccess:(fe,xe)=>{let pe=fe.runIds.length;if(pe===0){_.info(`No run was active on ${v.id}`);return}_.success(xe.wait?`Killed ${h(pe,"run")} on ${v.id}`:`Kill requested for ${h(pe,"run")} on ${v.id}`,{description:fe.runIds.join(", ")})},invalidate:Ne(v.id),toastErrors:!1}),z=ee.trim(),ce=le.isPending&&le.variables?.wait===!0;return t(k,{open:!0,onClose:x,title:`Kill runs of ${v.id}?`,description:"Stops the chosen run (or every active run) in this process: it is asked to close, then killed once its timeouts pass. The runs are recorded as killed.",variant:"danger",confirmLabel:"Kill",pendingLabel:Re?"Waiting for the runs to settle…":"Killing…",confirmText:v.id,confirmDisabled:z.length>Ge,onConfirm:async()=>{try{await le.mutateAsync({...q?{runId:q}:{},...X?{force:!0}:{},...z?{reason:z}:{},...Re?{wait:!0}:{}})}catch(fe){throw Se(fe,"kill")}},children:[e(l,{label:"Run",children:e(S,{options:[{value:"",label:`Every active run (${B.length})`},...B.map((fe)=>({value:fe.runId,label:`${fe.runId} (${fe.source}, attempt ${fe.attempt})`}))],value:q,onChange:Q,disabled:le.isPending})}),e(w,{checked:X,onChange:G,label:"Force",hint:"Skip straight to the end of the kill escalation instead of asking the run to close first.",disabled:le.isPending}),e(l,{label:"Reason",hint:`Optional, recorded on the run. At most ${Ge} characters.`,error:le.fieldErrors.reason??(z.length>Ge?`At most ${Ge} characters.`:void 0),children:e(M,{value:ee,onChange:Z,disabled:le.isPending})}),e(w,{checked:Re,onChange:se,label:"Wait until the runs have settled",hint:"Answer only once they have stopped. This can take the runner's closeTimeout plus killTimeout.",disabled:le.isPending}),ce&&e("p",{className:"runner-note runner-note-pending",role:"status","data-testid":"kill-waiting",children:"Waiting for the runs to settle. This can take the runner's closeTimeout plus killTimeout."})]})}function Jn({runner:v,onClose:x}){let T=i(),_=O({mutationFn:()=>On(T,v.id),successMessage:`Reset the stats of ${v.id}`,invalidate:Ne(v.id),toastErrors:!1});return e(k,{open:!0,onClose:x,title:`Reset the stats of ${v.id}?`,description:"Sets every lifetime counter (success, failed, timeout, killed, skipped, queued, total) back to zero, for every process. History is kept. This cannot be undone.",variant:"danger",confirmLabel:"Reset stats",pendingLabel:"Resetting…",onConfirm:async()=>{try{await _.mutateAsync()}catch(B){throw Se(B,"resetStats")}}})}function jn({runner:v,onClose:x}){let T=i(),_=te(),B=O({mutationFn:()=>kn(T,v.id),onSuccess:(q)=>{_.success(zn(q.removed,q.kept),q.kept.length>0?{description:`Kept: ${q.kept.join(", ")}`}:void 0)},invalidate:Ne(v.id),toastErrors:!1});return t(k,{open:!0,onClose:x,title:`Clear the run history of ${v.id}?`,description:"Removes every finished run and its log, for every process. Runs still in progress are kept, record and log whole. The lifetime counters and the charts are untouched: Reset stats… is separate. This cannot be undone.",variant:"danger",confirmLabel:"Clear history",pendingLabel:"Clearing…",onConfirm:async()=>{try{await B.mutateAsync()}catch(q){throw Se(q,"clearHistory")}},children:[e("p",{className:"runner-note muted",children:"A run whose record still says running but whose process has gone (no lock names it, and it started over a day ago) counts as finished, and is removed."}),Qn(v)&&e("p",{className:"runner-note muted","data-testid":"clear-history-parallel-note",children:"This runner is registered in another process and its runs may overlap, so the API cannot ask the process running them: a parallel run still going after a day is taken for crashed and removed too."})]})}var ze={seconds:1000,minutes:60000,hours:3600000},We=200,Ve=100;function ir(v="none"){return{mode:v,cron:"",tz:"",everyAmount:void 0,everyUnit:"minutes",anchor:void 0,at:void 0}}function ar(v){for(let x of["hours","minutes","seconds"])if(v%ze[x]===0)return{amount:v/ze[x],unit:x};return{amount:v/ze.seconds,unit:"seconds"}}function et(v){let x=ir();if(v===null)return x;if("cron"in v)return{...x,mode:"cron",cron:v.cron,tz:v.tz??""};if("every"in v){let{amount:T,unit:_}=ar(v.every);return{...x,mode:"every",everyAmount:T,everyUnit:_,anchor:v.anchor}}return{...x,mode:"at",at:v.at}}function nt(v,x){if(v===void 0||!Number.isFinite(v)||v<=0)return;let T=Math.round(v*ze[x]);return T>=1?T:void 0}function Qe(){let v=Intl;if(typeof v.supportedValuesOf!=="function")return null;try{return v.supportedValuesOf("timeZone")}catch{return null}}function ur(v,x=Qe()){let T=v.trim();if(T===""||/^[+-]\d/.test(T))return!1;let _=T.toLowerCase();if(x?.some((B)=>B.toLowerCase()===_))return!0;try{return Intl.DateTimeFormat("en",{timeZone:T}).resolvedOptions().timeZone!==""}catch{return!1}}function lr(v){let x=v.trim();if(x==="")return"Enter a cron expression.";if(x.length>We)return`At most ${We} characters.`;let T=x.split(/\s+/);if(T.length===1&&x.startsWith("@"))return null;if(T.length!==5&&T.length!==6)return`${T.length} field${T.length===1?"":"s"}: expected 5, 6 with seconds first, or a nickname such as @daily.`;return null}function mn(v,x=Qe()){let T={};switch(v.mode){case"cron":{let _=lr(v.cron);if(_)T.cron=_;let B=v.tz.trim();if(B.length>Ve)T.tz=`At most ${Ve} characters.`;else if(B!==""&&!ur(B,x))T.tz=`“${B}” is not a known time zone. Use an IANA name such as Europe/London or UTC.`;break}case"every":if(nt(v.everyAmount,v.everyUnit)===void 0)T.every="Enter an interval greater than zero.";break;case"at":if(v.at===void 0)T.at="Pick a date and time.";break;case"none":break}return T}function tt(v){switch(v.mode){case"cron":{let x=v.tz.trim();return{cron:v.cron.trim(),...x?{tz:x}:{}}}case"every":return{every:nt(v.everyAmount,v.everyUnit)??0,...v.anchor===void 0?{}:{anchor:v.anchor}};case"at":return{at:v.at??0};case"none":return null}}function dr(v){switch(v){case"cron":return"cron";case"every":return"every";case"at":return"at";case"none":return null}}function ot(v){return b(v)&&v.code==="INVALID_SCHEDULE"?Ir(v.issues):{}}function st(v,x){let T={},_;for(let[B,q]of Object.entries(v)){let X=/^schedule\.(cron|tz|every|anchor|at)\b/.exec(B)?.[1]??dr(x);if(X)T[X]??=q;else _??=q}return{fields:T,other:_}}var cr=[{value:"cron",label:"Cron"},{value:"every",label:"Every"},{value:"at",label:"Once"},{value:"none",label:"None"}],mr=[{value:"seconds",label:"seconds"},{value:"minutes",label:"minutes"},{value:"hours",label:"hours"}];function it({runner:v,onClose:x}){let T=i(),_=te(),B=c(),q=c(),Q=g(()=>Qe(),[]),X=Ie(),[G,ee]=r(()=>et(v.schedule)),[Z,Re]=r(!1),se=Ce(),le=(j)=>ee((be)=>({...be,...j})),z=O({mutationFn:(j)=>wn(T,v.id,j),onSuccess:(j)=>{_.success(j.schedule===null?`${v.id} is unscheduled`:`Rescheduled ${v.id}`,{description:j.nextRunAt===null?"No run is scheduled; it runs only when triggered.":t("span",{"data-testid":"schedule-next-run",children:["Next run ",e(A,{value:j.nextRunAt})]})}),x()},invalidate:Ne(v.id),toastErrors:!1}),ce=Z?mn(G,Q):{},fe=st({...z.fieldErrors,...ot(z.error)},G.mode),xe=(j)=>(j==="anchor"||j==="at"?se.problems[j]:void 0)??ce[j]??fe.fields[j],pe=Object.keys(fe.fields).length>0,Te=z.unplacedIssues.length>0,Oe=z.error&&(!pe||Te)?(Te?void 0:fe.other)??Se(z.error,"reschedule"):null,Be=(j)=>{if(j.preventDefault(),Re(!0),se.blocked||Object.keys(mn(G,Q)).length>0)return;z.mutate(tt(G))},$e=()=>{if(!z.isPending)x()},rn=G.at!==void 0&&G.at<=X;return e(oe,{open:!0,onClose:$e,title:t(n,{children:["Reschedule ",e("code",{children:v.id})]}),description:"Replaces the stored schedule for every process running this runner.",size:"md",closeOnEscape:!z.isPending,closeOnBackdrop:!z.isPending,footer:t(n,{children:[e(s,{onClick:$e,disabled:z.isPending,children:"Cancel"}),e(s,{variant:"primary",type:"submit",form:B,disabled:z.isPending||se.blocked,"aria-busy":z.isPending||void 0,children:z.isPending?"Saving…":"Save schedule"})]}),children:t("form",{id:B,className:"runner-form",onSubmit:Be,noValidate:!0,children:[t("fieldset",{className:"schedule-modes",children:[e("legend",{children:"Schedule"}),cr.map((j)=>t("label",{className:"schedule-mode",children:[e("input",{type:"radio",name:`${B}-mode`,value:j.value,checked:G.mode===j.value,onChange:()=>le({mode:j.value})}),j.label]},j.value))]}),G.mode==="cron"&&t(n,{children:[e(l,{label:"Cron expression",required:!0,hint:"5 fields (minute hour day month weekday), 6 with seconds first, or a nickname such as @daily.",error:xe("cron"),children:e(M,{value:G.cron,onChange:(j)=>le({cron:j}),maxLength:We,autoComplete:"off",spellCheck:!1,placeholder:"0 9 * * MON-FRI"})}),e(l,{label:"Time zone",hint:"Optional IANA name, e.g. Europe/London. Empty: the owner's local time (the zone of the process that runs it).",error:xe("tz"),children:e(M,{value:G.tz,onChange:(j)=>le({tz:j}),maxLength:Ve,autoComplete:"off",spellCheck:!1,list:Q?q:void 0})}),Q&&e("datalist",{id:q,children:Q.map((j)=>e("option",{value:j},j))})]}),G.mode==="every"&&t(n,{children:[t("div",{className:"runner-form-row",children:[e(l,{label:"Interval",required:!0,error:xe("every"),children:e(V,{value:G.everyAmount,onChange:(j)=>le({everyAmount:j}),min:0,step:"any"})}),e(l,{label:"Unit",children:e(S,{options:mr,value:G.everyUnit,onChange:(j)=>le({everyUnit:j})})})]}),e(l,{label:"Anchor",hint:"Optional: runs stay on this time's grid. Without one, each interval counts from when the schedule is applied.",error:xe("anchor"),children:e(Le,{value:G.anchor,onChange:(j)=>le({anchor:j}),onProblem:(j)=>se.report("anchor",j),withSeconds:!0})})]}),G.mode==="at"&&e(l,{label:"Run at",required:!0,hint:rn?"This time has passed: the runner will not fire.":"One run at this time, then none.",error:xe("at"),children:e(Le,{value:G.at,onChange:(j)=>le({at:j}),onProblem:(j)=>se.report("at",j),withSeconds:!0})}),G.mode==="none"&&e("p",{className:"runner-note",role:"note",children:"No schedule: the runner runs only when triggered."}),Oe!==null&&e(D,{error:Oe})]})})}function at(v,x,T){switch(T.outcome){case"started":v.success(`Run started on ${x.id}`,{description:t("span",{className:"run-id",children:[t("span",{children:["Run ",e("code",{children:T.runId})]}),e(ge,{text:T.runId,ariaLabel:"Copy run id"})]})});return;case"queued":v.success(`Run queued on ${x.id}`,{description:`Position ${T.position} in the trigger queue.${x.isLocal?" It starts when the runner is free.":" The process that owns the runner starts it at its next sync."}`});return;case"skipped":v.info(`Run skipped on ${x.id}`,{description:Gn[T.reason]??T.reason})}}function ut({runner:v,onClose:x}){let T=i(),_=m(),B=te(),q=_.limits.maxJobDataBytes,[Q,X]=r(!1),[G,ee]=r(()=>Ue("",{maxBytes:q,allowEmpty:!0})),Z=O({mutationFn:(z)=>Sn(T,v.id,z),onSuccess:(z)=>at(B,v,z),invalidate:Ne(v.id),toastErrors:!1}),Re=_.runnerTriggerArgs,se=Re&&(!G.valid||G.overLimit),le=async()=>{let z={...Q?{force:!0}:{},...Re&&G.value!==void 0?{args:G.value}:{}};try{await Z.mutateAsync(z)}catch(ce){throw Se(ce,"trigger")}};return t(k,{open:!0,onClose:x,title:`Trigger ${v.id}?`,description:"Asks for a run now. It starts at once, waits in the trigger queue, or is skipped, depending on the runner's state and options.",confirmLabel:"Trigger",pendingLabel:"Triggering…",confirmDisabled:se,onConfirm:le,children:[e(w,{checked:Q,onChange:X,label:"Run even while paused",hint:"Force skips only the pause check. A busy runner, a lock held elsewhere, the concurrency cap and a full trigger queue still apply."}),Re&&e(l,{label:"Arguments",hint:"Optional JSON handed to this run; leave empty for the runner's own args.",children:e(ct,{value:G.text,onChange:ee,maxBytes:q,allowEmpty:!0,rows:6})}),!v.isLocal&&e("p",{className:"runner-note",role:"note","data-testid":"trigger-non-local-note",children:"This runner is registered in another process, so the run is queued for it: its owner starts it at its next sync."})]})}function lt({runner:v}){let x=i(),T=te(),_=re(),[B,q]=r(null),Q=()=>q(null),X=Ke(v,_),G=O({mutationFn:()=>Nn(x,v.id),successMessage:v.isLocal?`Paused ${v.id}`:`Paused ${v.id}; its owner stops at its next sync`,invalidate:Ne(v.id),toastErrors:!1,onError:(Z)=>{T.error(`Could not pause ${v.id}`,{description:b(Z)?ln(Z,"pause")??Z.detail??Z.title:Z.message})}});if(!(X.trigger||X.pause||X.resume||X.reschedule||X.configure||X.kill||X.resetStats)&&!X.nonLocalOnly)return null;return t("div",{className:"runner-actions",role:"group","aria-label":"Runner actions",children:[X.trigger&&e(s,{variant:"primary",onClick:()=>q("trigger"),children:"Trigger…"}),X.pause&&e(s,{onClick:()=>G.mutate(),disabled:G.isPending,"aria-busy":G.isPending||void 0,children:"Pause"}),X.resume&&e(s,{onClick:()=>q("resume"),children:"Resume…"}),X.reschedule&&e(s,{onClick:()=>q("schedule"),children:"Reschedule…"}),X.configure&&e(s,{onClick:()=>q("config"),children:"Settings…"}),X.resetStats&&e(s,{variant:"danger",onClick:()=>q("reset"),children:"Reset stats…"}),X.kill&&e(s,{variant:"danger",onClick:()=>q("kill"),children:"Kill…"}),X.nonLocalOnly&&e("p",{className:"runner-actions-hint","data-testid":"runner-non-local-hint",children:"Registered in another process: kill and reset stats are only available from the API of the process that runs it, and other changes reach it at its next sync."}),B==="trigger"&&e(ut,{runner:v,onClose:Q}),B==="resume"&&e(Yn,{runner:v,onClose:Q}),B==="schedule"&&e(it,{runner:v,onClose:Q}),B==="config"&&v.config!==void 0&&e(Vn,{runner:v,config:v.config,onClose:Q}),B==="kill"&&e(Xn,{runner:v,onClose:Q}),B==="reset"&&e(Jn,{runner:v,onClose:Q})]})}var Ye=2000,pr=100,pn=2000;function pt(v){return Math.max(1,Math.min(100,v))}var fn={run:(v,x)=>[...he.runner(v),"run",x],logs:(v,x,T)=>[...fn.run(v,x),"logs",{stream:T??null}]};function fr(v,x){return`/runners/${P(v)}/runs/${P(x)}/logs`}function ft(v,x,T,_={},B){return v.request("GET",fr(x,T),{query:{since:_.since,offset:_.offset,limit:_.limit,order:_.order,stream:_.stream},signal:B})}function ht(v,x){let T=new Set(v?.lines.map((ee)=>ee.seq)??[]),_=x.items.filter((ee)=>!T.has(ee.seq)),B=[...v?.lines??[],..._].sort((ee,Z)=>ee.seq-Z.seq),q=Math.max(0,B.length-pn),Q=x.items.at(-1)?.seq??0,X=x.page.hasMore,G=X?Q:Math.max(x.lastSeq,Q,v?.cursor??0);return{lines:q>0?B.slice(q):B,cursor:Math.max(v?.cursor??0,G),dropped:x.dropped,capped:x.capped,live:x.live,lastSeq:x.lastSeq,hasMore:X,trimmed:(v?.trimmed??0)+q}}function Rt(v,x=Ye){if(!v)return!1;if(v.hasMore)return pr;return v.live?x:!1}function yt(v,x,T){if(v.kind!=="runner"||v.type!=="logs"||v.target!==x||v.payload.runId!==T)return;return v.payload.lastSeq}function vt(v,x){return v===void 0||v.cursor<x}function Xe(v){return v.logLines===void 0||v.logLines>0||v.status==="running"}function gn(v){return b(v)&&v.code==="LOGS_NOT_RETAINED"}function hn(v){return b(v)&&v.code==="RUN_NOT_FOUND"}var Ze={list:1e4,busy:5000,idle:15000,history:15000};function gr(v){if(!v)return!1;return v.isRunning===!0||(v.local?.activeRuns.length??0)>0}function hr(){return Ze.list}function Rr(){return Ze.history}function bt(){let v=H(Ze.busy),x=H(Ze.idle);return C((T)=>gr(T)?v:x,[v,x])}function xt(){return H(hr())}function Ct(){return H(Rr())}var Nt=St.filter((v)=>v!=="logs");function Lt(v){ye([ue.runners],[he.all],{events:Nt,enabled:v})}function wt(v,x){ye([ue.runner(v)],[he.runner(v)],{events:Nt,enabled:x})}function Tt(v,x,T,_){rt({channels:[ue.runner(v)],events:["logs"],enabled:T,onEvent:(B)=>{let q=yt(B,v,x);if(q!==void 0)_.onHint(q)},onGap:()=>_.onGap()})}var Je={idle:{label:"Idle",tone:"neutral",hint:"Registered but not started in its process: nothing is scheduled there."},running:{label:"Running",tone:"success",hint:"Started: its schedule is armed and triggers are accepted."},paused:{label:"Paused",tone:"warning",hint:"Paused everywhere: scheduled and manual runs do not start."},stopped:{label:"Stopped",tone:"danger",hint:"Stopped in its process: it takes no more triggers."}},yr={label:"Run in flight",tone:"info",hint:"A run is executing somewhere right now (the runner's lock or active runs say so)."},vr={label:"Active",tone:"neutral",hint:"Not paused. Its owner's own status shows only on the owner's API."},Et={running:{label:"Running",tone:"info"},success:{label:"Success",tone:"success"},failed:{label:"Failed",tone:"danger"},timeout:{label:"Timed out",tone:"warning"},killed:{label:"Killed",tone:"danger"}},je={schedule:"Schedule",manual:"Manual",queued:"Queued trigger",resume:"Resume"};function Dt(v){return`${new Date(v).toISOString().slice(0,19).replace("T"," ")} UTC`}function At(v){if(v===null)return"None: runs only when triggered";if("cron"in v)return`Cron ${v.cron} in ${v.tz??"the owner's local time"}`;if("every"in v){let x=v.anchor===void 0?"from when it started":`aligned to ${Dt(v.anchor)}`;return`Every ${U(v.every)}, ${x}`}return`Once, at ${Dt(v.at)}`}function Ot(v){return v===void 0?"unlimited":o(v)}function kt(v){if(v.queueRuns===void 0)return v.maxQueuedRuns===void 0?null:`up to ${o(v.maxQueuedRuns)}`;if(!v.queueRuns)return"No";return v.maxQueuedRuns===void 0?"Yes":`Yes, up to ${o(v.maxQueuedRuns)}`}function Pt(v){let x=[v.local?Je[v.local.status]:v.isPaused?Je.paused:vr];if(v.isRunning||(v.local?.activeRuns.length??0)>0)x.push(yr);return x}var br=[10,25,50,100,200];function Rn(v){return Math.max(1,Math.min(50,v))}function It(v){let x=Math.max(1,v);return[...new Set([...br.filter((T)=>T<=x),Rn(x),x])].sort((T,_)=>T-_)}function Pe(v){return b(v)&&v.code==="RUNNER_NOT_FOUND"}function _e(v){return b(v)&&v.isAuth}function en(v){let x=v.durationMs??(v.finishedAt===void 0?void 0:v.finishedAt-v.startedAt);return x===void 0?null:U(Math.max(0,x))}var Mt="This runner is registered by another process; changes are adopted at its owner's next sync.";function _t(v){return[...v.filter((x)=>x.isLocal),...v.filter((x)=>!x.isLocal)]}function Ft(v,x){let T=x.trim().toLowerCase();if(!T)return[...v];return v.filter((_)=>_.id.toLowerCase().includes(T)||(_.name?.toLowerCase().includes(T)??!1))}function Bt(v){return[...v].sort((x,T)=>T.startedAt-x.startedAt)}function Ut({runner:v,maxHistory:x,enabled:T,openRunId:_}){let B=i(),[q,Q]=W(),X=Rn(x),G=we(me(q,"history",X),x),ee=me(q,"offset",0),Z={offset:ee,limit:G,order:"desc"},Re=Ct(),se=a({queryKey:he.history(v,Z),queryFn:({signal:ce})=>go(B,v,Z,ce),refetchInterval:Re,enabled:T,placeholderData:Y}),le=se.data?Bt(se.data.items):[],z=se.data?.page.total??0;return{query:se,rows:le,offset:ee,limit:G,total:z,paged:z>G,turning:se.isFetching&&se.isPlaceholderData,openRunOffPage:_!==null&&le.length>0&&!le.some((ce)=>ce.runId===_),onChange:(ce)=>{let fe=ce.limit===G?ce.offset:0;Q({offset:fe>0?String(fe):null,history:ce.limit===X?null:String(ce.limit)})}}}var Ht="A run's console output is captured whichever way it runs: console.log, info and debug as stdout, warn and error as stderr, beside its ctx.log() lines. Output written by native code, by a program the run launched with its own output, or, in a worker or in-process run, straight to process.stdout or process.stderr is not captured here.",qt=`Values that look like secrets are replaced with ${Hr} before a line is stored, by default, so some lines may not read exactly as the run printed them.`;function Kt(v,x){if(v===!1||v<=x)return`Following this run: re-read every ${x/1000} s. Live updates are not reaching this view, so this is a poll. While the run is going, its history row shows no line count yet: the lines here are the count.`;return`Following this run: each time its log grows the live socket says so (at most every ${Jr/1000} s), and the new lines are read at once. A re-read every ${v/1000} s is the fallback, in case a notice goes missing. While the run is going, its history row shows no line count yet: the lines here are the count.`}var yn="logStream",Ae="logs",xr={stdout:"stdout",stderr:"stderr",log:"logger"};function bn(v){return xr[v]??v}function Gt(){return[{value:"",label:"Every stream"},...Zn.map((v)=>({value:v,label:bn(v)}))]}function zt(v){return v!==null&&v!==void 0&&Zn.includes(v)}function Wt(v){let x=$t.indexOf(v);if(x<0)return"neutral";if(x>=$t.indexOf("error"))return"danger";if(x>=$t.indexOf("warn"))return"warning";return x>=$t.indexOf("info")?"info":"neutral"}function nn(v,x=2){return String(v).padStart(x,"0")}function Vt(v){let x=new Date(v);if(Number.isNaN(x.getTime()))return"--:--:--.---";return`${nn(x.getHours())}:${nn(x.getMinutes())}:${nn(x.getSeconds())}.${nn(x.getMilliseconds(),3)}`}function xn(v){let x=new Date(v);return Number.isNaN(x.getTime())?void 0:x.toISOString()}function tn(){let v=ie("runnerLogs"),x=y("runners.logs");return v&&x}var Cr="Capture cut this line at its 8 KiB limit, so it is shorter than what the run printed.";function Qt({runner:v,runId:x,enabled:T=!0}){let _=i(),{limits:B}=m(),q=J(),[Q,X]=W(),G=c(),ee=Q.get(yn),Z=zt(ee)?ee:void 0,Re=pt(B.maxLogPage),se=fn.logs(v,x,Z),le=H(Ye),z=a({queryKey:se,enabled:T,queryFn:async({signal:pe})=>{let Te=q.getQueryData(se),Oe=await ft(_,v,x,{since:Te?.cursor===0?void 0:Te?.cursor,limit:Re,order:"asc",stream:Z},pe);return ht(Te,Oe)},refetchInterval:(pe)=>gn(pe.state.error)||hn(pe.state.error)?!1:Rt(pe.state.data,le)}),ce=z.data,fe=()=>void q.refetchQueries({queryKey:se,exact:!0,type:"active"});Tt(v,x,T&&ce?.live!==!1,{onHint:(pe)=>{if(vt(q.getQueryData(se),pe))fe()},onGap:fe});let xe=t("span",{className:"run-log-filter",children:[e("label",{htmlFor:G,children:"Stream"}),e(S,{id:G,options:Gt(),value:Z??"",onChange:(pe)=>X({[yn]:pe||null})})]});return t("section",{className:"run-logs","aria-label":`Log of run ${x}`,"data-testid":`run-logs-${x}`,children:[e("div",{className:"run-log-header",children:xe}),gn(z.error)?e(d,{title:"Run logs are not retained",description:z.error.detail??"This API keeps no run logs at all, so there is none for this run to read. That is not the same as a run that logged nothing."}):hn(z.error)?e(d,{title:"No log for this run",description:"This runner has no record of the run: either it never ran here, or it has aged out of the runs this runner keeps, and its log went with it."}):!ce?z.isError?e(D,{error:z.error,title:"Could not load the run log",onRetry:()=>void z.refetch()}):e(p,{label:"Loading the run log",showLabel:!0}):t(n,{children:[z.isError&&e(D,{error:z.error,title:"Could not refresh the run log",onRetry:()=>void z.refetch()}),e(Nr,{tail:ce,poll:le}),ce.lines.length===0?e("p",{className:"muted","data-testid":"run-logs-empty",children:Sr(ce,Z!==void 0)}):e(dn,{label:`Log lines of run ${x}`,items:ce.lines.map((pe)=>({id:pe.seq,number:pe.seq,text:pe.message,className:N("run-log-line",`run-log-line-${pe.stream}`),prefix:t(n,{children:[e("time",{className:"run-log-time",dateTime:xn(pe.at),title:xn(pe.at),children:Vt(pe.at)}),e("span",{className:"run-log-stream",children:bn(pe.stream)}),pe.level!==void 0&&e(f,{className:"run-log-level",tone:Wt(pe.level),children:pe.level})]}),suffix:pe.truncated?e(f,{className:"run-log-cut",tone:"warning",title:Cr,children:"cut at 8 KiB"}):void 0}))}),e("p",{className:"muted run-log-gap",children:Ht}),e("p",{className:"muted run-log-redaction",children:qt})]})]})}function Sr(v,x){if(x)return v.live?"Nothing on this stream yet.":"This run logged nothing on this stream.";return v.live?"Nothing logged yet.":"This run logged nothing. A 200 with no lines means the log is kept and empty, not that it is missing."}function Nr({tail:v,poll:x}){let T=[];if(v.dropped>0)T.push(`${h(v.dropped,"earlier line")} dropped: this run's log keeps its most recent lines only (1,000 lines and 1 MiB per run by default). The count is the run's own, whatever this filter shows.`);if(v.capped)T.push("A cap is trimming this log now: its oldest lines go as new ones arrive.");if(v.trimmed>0)T.push(`${h(v.trimmed,"earlier line")} left this view, which keeps the last ${o(pn)}. Reopen the log to read from the start of what is kept.`);if(v.live)T.push(Kt(x,Ye));if(T.length===0)return null;return e("div",{className:"run-log-notes","data-testid":"run-log-notes",children:T.map((_)=>e("p",{className:"muted",children:_},_))})}function Yt({run:v}){let x=tn(),[T,_]=W(),B=T.get(Ae)===v.runId;if(!x)return null;if(!Xe(v))return e("p",{className:"muted run-log-section","data-testid":`run-no-logs-${v.runId}`,children:"This run logged nothing."});return t("div",{className:"run-log-section",children:[e(s,{size:"sm","aria-expanded":B,onClick:()=>_({[Ae]:B?null:v.runId}),children:B?"Hide log":"Show log"}),B&&e(Qt,{runner:v.runnerId,runId:v.runId})]})}function Cn({status:v}){let{label:x,tone:T}=Et[v];return e(f,{tone:T,children:x})}function Fe({run:v}){let x=v.host===void 0&&v.pid===void 0?null:[v.host,v.pid===void 0?void 0:`pid ${v.pid}`].filter(Boolean).join(", ");return t("div",{className:"run-record","data-testid":`run-${v.runId}`,children:[e(F,{className:"run-summary",items:[{label:"Run id",value:t("span",{className:"run-id-line",children:[e("code",{children:v.runId}),e(ge,{text:v.runId,ariaLabel:`Copy run id ${v.runId}`})]})},{label:"Status",value:e(Cn,{status:v.status})},{label:"Attempt",value:o(v.attempt)},{label:"Source",value:je[v.source]},{label:"Execution",value:v.mode},x!==null&&{label:"Where",value:x},{label:"Started",value:e(A,{value:v.startedAt})},{label:"Finished",value:v.finishedAt===void 0?null:e(A,{value:v.finishedAt})},{label:"Duration",value:en(v)},v.exitCode!==void 0&&{label:"Exit code",value:v.exitCode===null?null:String(v.exitCode)},v.signal!==void 0&&{label:"Signal",value:v.signal},v.detached!==void 0&&{label:"Detached",value:v.detached?"Yes: it outlived its owner":"No"}]}),v.error&&e(dt,{error:v.error,label:`Error of run ${v.runId}`}),v.result!==void 0&&e(ae,{value:v.result,label:`Result of run ${v.runId}`,expandDepth:1})]})}function Lr({run:v,showLogs:x}){let[T,_]=W(),[B,q]=r(!1),Q=c(),X=x&&T.get(Ae)===v.runId,G=B||X,ee=()=>{if(G){if(q(!1),X)_({[Ae]:null});return}q(!0)},Z=v.logsDropped??0;return t(An,{children:[t("tr",{"data-testid":`history-row-${v.runId}`,children:[e("td",{children:e("button",{type:"button",className:"run-toggle","aria-expanded":G,"aria-controls":G?Q:void 0,"aria-label":`${G?"Hide":"Show"} run ${v.runId}`,onClick:ee,children:e("span",{"aria-hidden":"true",children:G?"▾":"▸"})})}),e("td",{children:e(A,{value:v.startedAt})}),e("td",{children:e(Cn,{status:v.status})}),e("td",{children:je[v.source]}),e("td",{className:"numeric",children:o(v.attempt)}),e("td",{className:"numeric",children:en(v)??"—"}),e("td",{children:e("code",{className:"run-id",children:v.runId})}),x&&t("td",{className:"run-logs-cell",children:[Xe(v)&&e(s,{size:"sm",variant:"ghost","aria-expanded":X,onClick:()=>_({[Ae]:X?null:v.runId}),children:X?"Hide log":"Log"}),Z>0&&t(f,{tone:"warning",title:`${h(Z,"line")} of this run's log went to the log's cap, oldest first.`,children:[h(Z,"line")," dropped"]})]})]}),G&&e("tr",{id:Q,className:"run-details-row",children:t("td",{colSpan:x?8:7,children:[e(Fe,{run:v}),e(Yt,{run:v})]})})]})}function Xt({runner:v,enabled:x=!0,info:T}){let _=re(),B=T!==void 0&&Ke(T,_).clearHistory,[q,Q]=r(!1),{limits:X}=m(),[G,ee]=W(),Z=c(),Re=tn(),se=It(X.maxHistory),le=Re?G.get(Ae):null,z=Ut({runner:v,maxHistory:X.maxHistory,enabled:x,openRunId:le}),ce=z.query,fe=ce.data!==void 0&&z.total===0;return t(R,{title:"History",actions:t("div",{className:"history-actions",children:[B&&e(s,{size:"sm",variant:"danger",disabled:fe,title:fe?"No runs to clear.":void 0,onClick:()=>Q(!0),children:"Clear history…"}),t("div",{className:"history-limit",children:[e("label",{htmlFor:Z,children:"Runs shown"}),e(S,{id:Z,options:se.map((xe)=>({value:String(xe)})),value:String(z.limit),onChange:(xe)=>z.onChange({offset:z.offset,limit:Number(xe)})})]})]}),children:[q&&T&&e(jn,{runner:T,onClose:()=>Q(!1)}),ce.isPending?e(p,{label:"Loading the history",showLabel:!0}):ce.isError?e(D,{error:ce.error,title:"Could not load the history",onRetry:()=>void ce.refetch()}):fe?e(d,{title:"No runs yet",description:"Runs show here, newest first, once this runner has run."}):z.rows.length===0?e(d,{title:"No runs on this page",description:"This page starts past the end of the history. Go back for the runs it holds."}):t(I,{label:"Run history",className:"history-table",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:e("span",{className:"visually-hidden",children:"Details"})}),e("th",{scope:"col",children:"Started"}),e("th",{scope:"col",children:"Status"}),e("th",{scope:"col",children:"Source"}),e("th",{scope:"col",className:"numeric",children:"Attempt"}),e("th",{scope:"col",className:"numeric",children:"Duration"}),e("th",{scope:"col",children:"Run id"}),Re&&e("th",{scope:"col",children:"Log"})]})}),e("tbody",{children:z.rows.map((xe)=>e(Lr,{run:xe,showLogs:Re},xe.runId))})]}),z.openRunOffPage&&t("p",{className:"muted history-open-log-note","data-testid":"history-open-log-note",children:[`The log this link opens belongs to run ${le}, which is not on this page — it is further back in the history, or gone. `,e(s,{size:"sm",variant:"ghost",onClick:()=>ee({[Ae]:null}),children:"Close log"})]}),z.paged&&e(ne,{label:"History pages",offset:z.offset,limit:z.limit,total:z.total,itemCount:z.rows.length,pageSizes:se,maxPageSize:X.maxHistory,disabled:z.turning,onChange:z.onChange})]})}var wr=[{key:"success",label:"Success",state:"completed"},{key:"failed",label:"Failed",state:"failed"},{key:"timeout",label:"Timed out",state:"delayed"},{key:"killed",label:"Killed",state:"dead"},{key:"skipped",label:"Skipped"},{key:"queued",label:"Queued",state:"waiting"},{key:"total",label:"Total"}];function Zt({detail:v}){return e("div",{className:"screen","data-testid":"runner-hidden",children:e(d,{headingLevel:1,title:"Runner hidden",description:v??"You may not read this runner.",action:e(E,{to:"/runners",children:"Back to runners"})})})}function Tr({id:v}){return e("div",{className:"screen","data-testid":"runner-not-found",children:e(d,{headingLevel:1,title:"Runner not found",description:t(n,{children:["There is no runner ",e("code",{children:v})," in this namespace. It may have been unregistered, or its process has not started yet."]}),action:e(E,{to:"/runners",children:"Back to runners"})})})}function Dr({runner:v}){return e(F,{className:"runner-summary",items:[{label:"Namespace",value:e("code",{children:v.namespace})},{label:"Registered here",value:v.isLocal?"Yes (local)":"No (another process)",key:"isLocal"},v.file!==void 0&&{label:"File",value:e("code",{children:v.file})},{label:"Schedule",value:e("span",{"data-testid":"runner-schedule",children:At(v.schedule)})},{label:"Next run",value:v.nextRunAt===null?"Not scheduled":e(A,{value:v.nextRunAt}),hint:v.local&&v.local.nextRunAt!==null&&v.local.nextRunAt!==v.nextRunAt?t(n,{children:["This process's ticker:"," ",e(A,{value:v.local.nextRunAt})]}):void 0},{label:"Execution mode",value:v.executionMode,hint:qe(v.config,"executionMode")},{label:"Run mode",value:v.runMode,hint:qe(v.config,"runMode")},{label:"Queues triggers",value:kt(v)},{label:"Max concurrency",value:e("span",{"data-testid":"runner-concurrency",children:Ot(v.maxConcurrency)}),hint:qe(v.config,"maxConcurrency")},v.config!==void 0&&{label:"Settings override",key:"configOverride",value:e("span",{"data-testid":"runner-config-override",children:Hn(v.config)}),hint:Kn(v.config)},{label:"Queued triggers",value:o(v.queuedTriggers)},{label:"Running on",value:v.runningOn?t(n,{children:[e("code",{children:v.runningOn.runId}),v.runningOn.host!==void 0&&` on ${v.runningOn.host}`,v.runningOn.pid!==void 0&&` (pid ${v.runningOn.pid})`,", since ",e(A,{value:v.runningOn.since})]}):null},{label:"Updated",value:e(A,{value:v.updatedAt})},{label:"Last error",value:v.lastError?t("span",{className:"runner-last-error",children:[e("strong",{children:v.lastError.name}),":"," ",v.lastError.message]}):null}]})}function Er({stats:v}){return e("dl",{className:"stat-grid","aria-label":"Runs by outcome","data-testid":"runner-stats",children:wr.map(({key:x,label:T,state:_})=>t("div",{className:_?`stat stat-state state-${_}`:"stat",children:[e("dt",{className:"stat-label",children:T}),e("dd",{className:"stat-value",children:o(v[x])})]},x))})}function Ar({runner:v,stats:x,historyEnabled:T}){let _=v.local?.activeRuns??[];return t(n,{children:[t("header",{className:"runner-header",children:[t("div",{className:"runner-heading",children:[e("h1",{className:"screen-title runner-title",children:u(v.name)}),t("span",{className:"runner-badges","data-testid":"runner-status",children:[Pt(v).map((B)=>e(f,{tone:B.tone,title:B.hint,children:B.label},B.label)),!v.isLocal&&e(f,{tone:"neutral",children:"Other process"})]}),v.name!==v.id&&e("code",{className:"runner-id muted","data-testid":"runner-id",children:v.id})]}),e(lt,{runner:v})]}),!v.isLocal&&e("p",{className:"notice",role:"note","data-testid":"non-local-note",children:Mt}),e(R,{title:"Summary",children:e(Dr,{runner:v})}),e(R,{title:"Stats",children:e(Er,{stats:x})}),v.local&&e(R,{title:"Active runs",children:_.length===0?e("p",{className:"muted","data-testid":"no-active-runs",children:"Nothing is running in this process."}):e("ul",{className:"run-list","aria-label":"Active runs",children:_.map((B)=>e("li",{children:e(Fe,{run:B})},B.runId))})}),e(R,{title:"Last run",children:v.lastRun?e(Fe,{run:v.lastRun}):e("p",{className:"muted",children:"This runner has not run yet."})}),e(Xt,{runner:v.id,enabled:T,info:v})]})}function Or(){let{runner:v=""}=de(),x=i(),T=y("runners.read"),_=gt(),B=T&&_,q=bt(),Q=a({queryKey:he.detail(v),queryFn:({signal:G})=>ho(x,v,G),enabled:B,refetchInterval:(G)=>Pe(G.state.error)||_e(G.state.error)?!1:q(G.state.data)}),X=a({queryKey:he.stats(v),queryFn:({signal:G})=>yo(x,v,G),enabled:B&&Q.isSuccess,refetchInterval:(G)=>Pe(G.state.error)||_e(G.state.error)?!1:q(Q.data)});if(wt(v,B&&!_e(Q.error)&&!Pe(Q.error)),_&&!T)return e(Zt,{});if(_e(Q.error))return e(Zt,{detail:Q.error.detail});if(Pe(Q.error))return e(Tr,{id:v});return t("div",{className:"screen runner-screen","data-testid":"runner-screen",children:[e("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:t("ol",{children:[e("li",{children:e(E,{to:"/runners",children:"Runners"})}),e("li",{"aria-current":"page",children:v})]})}),Q.data?t(n,{children:[Q.isError&&e(D,{error:Q.error,title:"Could not refresh this runner",onRetry:()=>void Q.refetch()}),e(Ar,{runner:Q.data,stats:X.data??Q.data.stats,historyEnabled:B})]}):Q.isError?e(L,{headingLevel:1,error:Q.error,title:"Could not load the runner",onRetry:()=>void Q.refetch()}):e(p,{label:"Loading the runner",showLabel:!0})]})}var Jt=25;function kr({item:v}){let x=v.status?Je[v.status]:null;return t("tr",{"data-testid":`runner-row-${v.id}`,children:[t("td",{children:[e(E,{to:mt(v.id),className:"runner-link",children:v.isLocal&&v.name&&v.name!==v.id?v.name:v.id}),v.isLocal&&v.name&&v.name!==v.id&&e("code",{className:"runner-id muted",children:v.id})]}),e("td",{className:"runners-where",children:v.isLocal?e(f,{tone:"accent",children:"Local"}):e(f,{tone:"neutral",title:"Registered by another process: its name shows on its own screen.",children:"Other process"})}),t("td",{className:"runners-status",children:[x?e(f,{tone:x.tone,title:x.hint,children:x.label}):v.isPaused?e(f,{tone:"warning",title:"Paused through the shared state: its owner skips scheduled runs.",children:"Paused"}):e(f,{tone:"neutral",title:"Not paused. Its lifecycle status shows only in its own process.",children:"Active"})," ",v.isRunning&&e(f,{tone:"accent",title:"A run holds this runner's lock right now, in whichever process.",children:"Run in flight"})]})]})}function Pr(){let v=i(),x=y("runners.list"),[T,_]=W(),B=c(),q=T.get("search")??"",Q=Me(q),X=xt();Lt(x);let G=a({queryKey:he.list(),queryFn:({signal:z})=>cn(v,z),refetchInterval:X,enabled:x});if(!x)return t("div",{className:"screen",children:[e("h1",{className:"screen-title",children:"Runners"}),e(d,{title:"Nothing to show",description:"You may not list runners on this API."})]});let ee=G.data?_t(G.data.items):[],Z=Ft(ee,Q),Re=ee.filter((z)=>z.isLocal).length,se=Kr(Z.length,{offset:me(T,"offset",0),limit:me(T,"limit",Jt)}),le=Z.slice(se.offset,se.offset+se.limit);return t("div",{className:"screen","data-testid":"runners-list",children:[e("h1",{className:"screen-title",children:"Runners"}),e(R,{title:"Runners",actions:t("div",{className:"search",children:[e("label",{htmlFor:B,className:"visually-hidden",children:"Filter runners by id or name"}),e("input",{id:B,type:"search",className:"input",placeholder:"Filter runners",...ve,value:q,maxLength:200,onChange:(z)=>_({search:z.target.value,offset:null})})]}),children:G.isPending?e(p,{label:"Loading runners",showLabel:!0}):G.isError?e(L,{error:G.error,title:"Could not load runners",onRetry:()=>void G.refetch()}):ee.length===0?e(d,{title:"No runners yet",description:"Runners appear here once a process registers one in this namespace."}):Z.length===0?e(d,{title:"No runners match",description:`No runner id or name contains “${Q.trim()}”.`}):t(n,{children:[t(I,{label:"Runners",children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Runner"}),e("th",{scope:"col",className:"runners-where",children:"Where"}),e("th",{scope:"col",className:"runners-status",children:"Status"})]})}),e("tbody",{children:le.map((z)=>e(kr,{item:z},z.id))})]}),se.paged&&e(ne,{label:"Runner pages",offset:se.offset,limit:se.limit,total:Z.length,itemCount:le.length,onChange:(z)=>_({offset:z.offset>0?String(z.offset):null,limit:z.limit===Jt?null:String(z.limit)})}),t("p",{className:"muted runners-count","data-testid":"runners-count",children:[h(Re,"local runner"),","," ",h(ee.length-Re,"runner")," in other processes",Z.length<ee.length&&` (${Z.length} shown)`]})]})})]})}export{Or as RunnerScreen,Pr as RunnersListScreen};
2
+
3
+ //# debugId=A4F2192C724764E064756E2164756E21
4
+ //# sourceMappingURL=index-q24jw3w9.js.map