@baochunli/flakes 0.0.5 → 0.0.6

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 (126) hide show
  1. package/dist/node_modules/@flakes/auth/package.json +1 -1
  2. package/dist/node_modules/@flakes/console/.output/nitro.json +1 -1
  3. package/dist/node_modules/@flakes/console/.output/public/assets/{DocumentationPage-CNPk8RVl.js → DocumentationPage-CGIcMKwf.js} +1 -1
  4. package/dist/node_modules/@flakes/console/.output/public/assets/ProjectsPage-ByTl4Kyy.js +1 -0
  5. package/dist/node_modules/@flakes/console/.output/public/assets/RunPage-5MmbVpaE.js +3 -0
  6. package/dist/node_modules/@flakes/console/.output/public/assets/{RunsPage-CJbycrqM.js → RunsPage-fbDKP9kM.js} +1 -1
  7. package/dist/node_modules/@flakes/console/.output/public/assets/{SandboxesLens-BoLM52PY.js → SandboxesLens-DPG87mUE.js} +1 -1
  8. package/dist/node_modules/@flakes/console/.output/public/assets/SandboxesPage-DIpzR_Ef.js +1 -0
  9. package/dist/node_modules/@flakes/console/.output/public/assets/TranscriptPage-mCgSqfv0.js +1 -0
  10. package/dist/node_modules/@flakes/console/.output/public/assets/_-CM2hE2sZ.js +1 -0
  11. package/dist/node_modules/@flakes/console/.output/public/assets/_runId-3ZZOAqUK.js +2 -0
  12. package/dist/node_modules/@flakes/console/.output/public/assets/_taskId-cy4RxW8Y.js +2 -0
  13. package/dist/node_modules/@flakes/console/.output/public/assets/{account-BoRurhrq.js → account-BWoGGXJw.js} +1 -1
  14. package/dist/node_modules/@flakes/console/.output/public/assets/{account-forms-D4eVqOhW.js → account-forms-Dq70JDyg.js} +1 -1
  15. package/dist/node_modules/@flakes/console/.output/public/assets/{auth-layout-DBnq_eif.js → auth-layout-BFusNq3W.js} +1 -1
  16. package/dist/node_modules/@flakes/console/.output/public/assets/{bits-BOMPEHvv.js → bits-CTGNpp-v.js} +1 -1
  17. package/dist/node_modules/@flakes/console/.output/public/assets/device-BajR3eSF.js +1 -0
  18. package/dist/node_modules/@flakes/console/.output/public/assets/documentation-6ao_Ux6x.js +1 -0
  19. package/dist/node_modules/@flakes/console/.output/public/assets/{forgot-password-BSQ4TWpA.js → forgot-password-DOKn8_7P.js} +1 -1
  20. package/dist/node_modules/@flakes/console/.output/public/assets/main-DVO9gWzi.js +1215 -0
  21. package/dist/node_modules/@flakes/console/.output/public/assets/{otp-verification-CussJQT1.js → otp-verification-qolVtiom.js} +2 -2
  22. package/dist/node_modules/@flakes/console/.output/public/assets/projects-n5LSsNi3.js +2 -0
  23. package/dist/node_modules/@flakes/console/.output/public/assets/{reset-password-DwWhVkEh.js → reset-password-D-OlZeHQ.js} +1 -1
  24. package/dist/node_modules/@flakes/console/.output/public/assets/runs-BB9ogobQ.js +2 -0
  25. package/dist/node_modules/@flakes/console/.output/public/assets/sandboxes-BIimz5FI.js +2 -0
  26. package/dist/node_modules/@flakes/console/.output/public/assets/{security-MjM55vIw.js → security-DdQNcp6k.js} +1 -1
  27. package/dist/node_modules/@flakes/console/.output/public/assets/{signin-KbA1cD6o.js → signin-BoZiVxyq.js} +1 -1
  28. package/dist/node_modules/@flakes/console/.output/public/assets/{signin-form-CBF-d8iK.js → signin-form-tTBWDjhi.js} +1 -1
  29. package/dist/node_modules/@flakes/console/.output/public/assets/{signup-CbHsThKr.js → signup-CBSszmUC.js} +1 -1
  30. package/dist/node_modules/@flakes/console/.output/public/assets/styles-B8OXOvkO.css +2 -0
  31. package/dist/node_modules/@flakes/console/.output/server/{_-BULJ6utw.mjs → _-BGsKgsbF.mjs} +3 -3
  32. package/dist/node_modules/@flakes/console/.output/server/{_-_ST9QYWn.mjs → _-DtPMXzt0.mjs} +3 -3
  33. package/dist/node_modules/@flakes/console/.output/server/_chunks/ProjectsPage.mjs +1 -2
  34. package/dist/node_modules/@flakes/console/.output/server/_chunks/RunPage.mjs +1 -2
  35. package/dist/node_modules/@flakes/console/.output/server/_chunks/RunsPage.mjs +1 -2
  36. package/dist/node_modules/@flakes/console/.output/server/_chunks/SandboxesLens.mjs +1 -1
  37. package/dist/node_modules/@flakes/console/.output/server/_chunks/SandboxesPage.mjs +253 -18
  38. package/dist/node_modules/@flakes/console/.output/server/_chunks/TranscriptPage.mjs +1 -2
  39. package/dist/node_modules/@flakes/console/.output/server/_chunks/bits.mjs +1 -1
  40. package/dist/node_modules/@flakes/console/.output/server/_chunks/button.mjs +461 -3
  41. package/dist/node_modules/@flakes/console/.output/server/_chunks/card.mjs +1 -1
  42. package/dist/node_modules/@flakes/console/.output/server/_chunks/router.mjs +3 -4
  43. package/dist/node_modules/@flakes/console/.output/server/_chunks/table.mjs +1 -1
  44. package/dist/node_modules/@flakes/console/.output/server/{_runId-WZmbo654.mjs → _runId-P1u-vfcm.mjs} +2 -2
  45. package/dist/node_modules/@flakes/console/.output/server/{_runId-CmYWNL8A.mjs → _runId-vO4tlCOP.mjs} +3 -3
  46. package/dist/node_modules/@flakes/console/.output/server/_ssr/{App-CUx8Ftit.mjs → App-C-XaVKoO.mjs} +2 -2
  47. package/dist/node_modules/@flakes/console/.output/server/_ssr/{DocumentationPage-0I9oWWJT.mjs → DocumentationPage-BR2KosFz.mjs} +2 -2
  48. package/dist/node_modules/@flakes/console/.output/server/_ssr/{ProjectsPage-CGj9V2Of.mjs → ProjectsPage-BUrep1wl.mjs} +2 -2
  49. package/dist/node_modules/@flakes/console/.output/server/_ssr/{RunPage-B2vhVaj6.mjs → RunPage-BHs-v0LU.mjs} +2 -2
  50. package/dist/node_modules/@flakes/console/.output/server/_ssr/{RunsPage-BifKogQE.mjs → RunsPage-iTNYVwL0.mjs} +2 -2
  51. package/dist/node_modules/@flakes/console/.output/server/_ssr/SandboxesPage-C1Z6dVce.mjs +423 -0
  52. package/dist/node_modules/@flakes/console/.output/server/_ssr/{TranscriptPage-deSxVZaQ.mjs → TranscriptPage-BcomoTls.mjs} +2 -2
  53. package/dist/node_modules/@flakes/console/.output/server/_ssr/{account-D5y9vkAc.mjs → account-Cp0s_IQK.mjs} +2 -2
  54. package/dist/node_modules/@flakes/console/.output/server/_ssr/{documentation-C91gfyy0.mjs → documentation-BnxmM-Yo.mjs} +2 -2
  55. package/dist/node_modules/@flakes/console/.output/server/_ssr/{documentation-C69e9_eF.mjs → documentation-Cgyr3VKK.mjs} +3 -3
  56. package/dist/node_modules/@flakes/console/.output/server/_ssr/{hooks-DrgN35zn.mjs → hooks-CsVtQ1m-.mjs} +117 -51
  57. package/dist/node_modules/@flakes/console/.output/server/_ssr/{projects-lJ2tIIPj.mjs → projects-R9sxR_t4.mjs} +1 -1
  58. package/dist/node_modules/@flakes/console/.output/server/_ssr/{router-DHxFQ03L.mjs → router-CobdI6gO.mjs} +12 -12
  59. package/dist/node_modules/@flakes/console/.output/server/_ssr/{runs-dnPfp9dt.mjs → runs-D8MHe3QU.mjs} +2 -2
  60. package/dist/node_modules/@flakes/console/.output/server/_ssr/{runs-BWxEGKO_.mjs → runs-mTxbc_pm.mjs} +3 -3
  61. package/dist/node_modules/@flakes/console/.output/server/_ssr/{sandboxes-v28LJQM3.mjs → sandboxes-B2z_9JyU.mjs} +2 -2
  62. package/dist/node_modules/@flakes/console/.output/server/_ssr/{sandboxes-hxFINxDS.mjs → sandboxes-r0y6Ihg6.mjs} +3 -3
  63. package/dist/node_modules/@flakes/console/.output/server/_ssr/ssr.mjs +2 -2
  64. package/dist/node_modules/@flakes/console/.output/server/{_tanstack-start-manifest_v-DfwuEzTr.mjs → _tanstack-start-manifest_v-DpAwCFK9.mjs} +32 -33
  65. package/dist/node_modules/@flakes/console/.output/server/{_taskId-CBo95z-s.mjs → _taskId-Cz9xwj5L.mjs} +2 -2
  66. package/dist/node_modules/@flakes/console/.output/server/{_taskId-Sil3-PKh.mjs → _taskId-wQsG2CQj.mjs} +3 -3
  67. package/dist/node_modules/@flakes/console/package.json +1 -1
  68. package/dist/node_modules/@flakes/control-plane/dist/host-credentials.d.ts +1 -1
  69. package/dist/node_modules/@flakes/control-plane/dist/host-credentials.d.ts.map +1 -1
  70. package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes.js +48 -3
  71. package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes.js.map +1 -1
  72. package/dist/node_modules/@flakes/control-plane/package.json +1 -1
  73. package/dist/node_modules/@flakes/core/package.json +1 -1
  74. package/dist/node_modules/@flakes/harness-agent/package.json +1 -1
  75. package/dist/node_modules/@flakes/harness-sdk/package.json +1 -1
  76. package/dist/node_modules/@flakes/pi-agent/package.json +1 -1
  77. package/dist/node_modules/@flakes/protocol/package.json +1 -1
  78. package/dist/node_modules/@flakes/sandbox-runtime/package.json +1 -1
  79. package/dist/node_modules/@flakes/store/dist/managed-sandbox-instances-store.d.ts +9 -1
  80. package/dist/node_modules/@flakes/store/dist/managed-sandbox-instances-store.d.ts.map +1 -1
  81. package/dist/node_modules/@flakes/store/dist/managed-sandbox-instances-store.js +407 -6
  82. package/dist/node_modules/@flakes/store/dist/managed-sandbox-instances-store.js.map +1 -1
  83. package/dist/node_modules/@flakes/store/dist/mappers.d.ts.map +1 -1
  84. package/dist/node_modules/@flakes/store/dist/mappers.js +1 -0
  85. package/dist/node_modules/@flakes/store/dist/mappers.js.map +1 -1
  86. package/dist/node_modules/@flakes/store/dist/types.d.ts +30 -1
  87. package/dist/node_modules/@flakes/store/dist/types.d.ts.map +1 -1
  88. package/dist/node_modules/@flakes/store/package.json +1 -1
  89. package/package.json +1 -1
  90. package/dist/node_modules/@flakes/auth/dist/better-auth-shape.d.ts +0 -10
  91. package/dist/node_modules/@flakes/auth/dist/better-auth-shape.d.ts.map +0 -1
  92. package/dist/node_modules/@flakes/auth/dist/better-auth-shape.js +0 -16
  93. package/dist/node_modules/@flakes/auth/dist/better-auth-shape.js.map +0 -1
  94. package/dist/node_modules/@flakes/console/.output/public/assets/ProjectsPage-CKPR1nnu.js +0 -1
  95. package/dist/node_modules/@flakes/console/.output/public/assets/RunPage-BdugbnA3.js +0 -3
  96. package/dist/node_modules/@flakes/console/.output/public/assets/SandboxesPage-6KHjMeaR.js +0 -1
  97. package/dist/node_modules/@flakes/console/.output/public/assets/TranscriptPage-CHSq0_qN.js +0 -1
  98. package/dist/node_modules/@flakes/console/.output/public/assets/_-CD1Voz9h.js +0 -1
  99. package/dist/node_modules/@flakes/console/.output/public/assets/_runId-_0VPmGYe.js +0 -2
  100. package/dist/node_modules/@flakes/console/.output/public/assets/_taskId-CPAKAp4X.js +0 -2
  101. package/dist/node_modules/@flakes/console/.output/public/assets/device-FqII-S41.js +0 -1
  102. package/dist/node_modules/@flakes/console/.output/public/assets/dist-BEfdrJTS.js +0 -1
  103. package/dist/node_modules/@flakes/console/.output/public/assets/documentation-2C3ncAuV.js +0 -1
  104. package/dist/node_modules/@flakes/console/.output/public/assets/main-LpSDdT-S.js +0 -1215
  105. package/dist/node_modules/@flakes/console/.output/public/assets/projects-CLgKBrCe.js +0 -2
  106. package/dist/node_modules/@flakes/console/.output/public/assets/runs-CFYk2iRh.js +0 -2
  107. package/dist/node_modules/@flakes/console/.output/public/assets/sandboxes-mGsOcVFL.js +0 -2
  108. package/dist/node_modules/@flakes/console/.output/public/assets/styles-DtA2wbW8.css +0 -2
  109. package/dist/node_modules/@flakes/console/.output/server/_chunks/utils.mjs +0 -393
  110. package/dist/node_modules/@flakes/console/.output/server/_ssr/SandboxesPage-DGji_OdB.mjs +0 -187
  111. package/dist/node_modules/@flakes/control-plane/dist/managed-sandbox-provisioner.d.ts +0 -71
  112. package/dist/node_modules/@flakes/control-plane/dist/managed-sandbox-provisioner.d.ts.map +0 -1
  113. package/dist/node_modules/@flakes/control-plane/dist/managed-sandbox-provisioner.js +0 -243
  114. package/dist/node_modules/@flakes/control-plane/dist/managed-sandbox-provisioner.js.map +0 -1
  115. package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes-admin.d.ts +0 -3
  116. package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes-admin.d.ts.map +0 -1
  117. package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes-admin.js +0 -153
  118. package/dist/node_modules/@flakes/control-plane/dist/routes/sandboxes-admin.js.map +0 -1
  119. package/dist/node_modules/@flakes/control-plane/dist/sandbox-drain.d.ts +0 -19
  120. package/dist/node_modules/@flakes/control-plane/dist/sandbox-drain.d.ts.map +0 -1
  121. package/dist/node_modules/@flakes/control-plane/dist/sandbox-drain.js +0 -46
  122. package/dist/node_modules/@flakes/control-plane/dist/sandbox-drain.js.map +0 -1
  123. package/dist/node_modules/@flakes/store/dist/sqlite.d.ts +0 -4
  124. package/dist/node_modules/@flakes/store/dist/sqlite.d.ts.map +0 -1
  125. package/dist/node_modules/@flakes/store/dist/sqlite.js +0 -34
  126. package/dist/node_modules/@flakes/store/dist/sqlite.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flakes/auth",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,5 +1,5 @@
1
1
  {
2
- "date": "2026-07-03T22:27:58.346Z",
2
+ "date": "2026-07-04T03:41:49.592Z",
3
3
  "preset": "node-middleware",
4
4
  "framework": {
5
5
  "name": "nitro",
@@ -1 +1 @@
1
- import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./link-ll3nLBSM.js";import{t as i}from"./utils-CBxvVKOM.js";import{n as a,r as o,t as s}from"./lib-COfgMmRR.js";import{t as c}from"./external-link-BWhbbPgy.js";import{t as l}from"./file-text-DLxLJ7P1.js";import{c as u,l as d,o as f,s as p,vt as m,yt as h}from"./main-LpSDdT-S.js";var g=e(t(),1),_=n();function v(e){let t=d(e.selectedPath);return(0,_.jsxs)(`section`,{className:`grid gap-5`,children:[(0,_.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-4`,children:(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`p`,{className:`console-callout`,children:`Documentation`}),(0,_.jsx)(`h1`,{className:`mt-1 text-lg font-semibold tracking-tight`,children:`Flakes`}),(0,_.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-muted-foreground`,children:`Guides and reference for using Flakes, a harness runtime for distributed agent workflows.`})]})}),(0,_.jsxs)(`div`,{className:`grid min-w-0 gap-4 lg:grid-cols-[18rem_minmax(0,1fr)]`,children:[(0,_.jsx)(y,{selectedPath:t?.path}),t?(0,_.jsxs)(`article`,{className:`min-w-0 rounded-lg border bg-card text-card-foreground shadow-sm`,children:[(0,_.jsxs)(`header`,{className:`border-b px-5 py-5 sm:px-6`,children:[(0,_.jsx)(`p`,{className:`console-callout`,children:`Guide`}),(0,_.jsx)(`h2`,{className:`mt-2 text-xl font-semibold tracking-tight`,children:t.title}),t.description.length>0?(0,_.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm text-muted-foreground`,children:t.description}):null]}),(0,_.jsx)(`div`,{className:`min-w-0 px-5 py-5 sm:px-6`,children:(0,_.jsx)(a,{remarkPlugins:[s],components:w,children:t.body})})]}):null]})]})}function y(e){let t=p.length===1?`1 page`:`${p.length} pages`;return(0,_.jsxs)(`nav`,{"aria-label":`Documentation pages`,className:`min-w-0 overflow-hidden rounded-lg border bg-card/80 text-card-foreground shadow-sm lg:sticky lg:top-6 lg:self-start`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-muted/30 px-3 py-2.5`,children:[(0,_.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md border bg-background`,children:(0,_.jsx)(h,{className:`size-4 text-muted-foreground`})}),(0,_.jsxs)(`span`,{className:`min-w-0`,children:[(0,_.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:`Contents`}),(0,_.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-muted-foreground`,children:t})]})]}),(0,_.jsx)(`div`,{className:`grid max-h-72 gap-0.5 overflow-y-auto p-2 lg:max-h-[calc(100vh-12rem)]`,children:(0,_.jsx)(b,{items:f,selectedPath:e.selectedPath})})]})}function b(e){let t=e.depth??0;return(0,_.jsx)(_.Fragment,{children:e.items.map(n=>n.type===`page`?(0,_.jsx)(C,{page:n.page,selected:n.page.path===e.selectedPath,depth:t},n.page.path||`overview`):(0,_.jsx)(x,{item:n,selectedPath:e.selectedPath,depth:t},n.key))})}function x(e){let t=S(e.item,e.selectedPath),[n,r]=(0,g.useState)(t);return(0,g.useEffect)(()=>{t&&r(!0)},[t]),(0,_.jsxs)(`div`,{className:`grid gap-1`,children:[(0,_.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:i(`group flex h-8 w-full min-w-0 items-center gap-2 rounded-md px-2 text-left text-sm text-muted-foreground transition-state hover:bg-secondary/70 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:outline-none`,t&&`text-foreground`),children:[(0,_.jsx)(m,{className:`size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground`,"aria-hidden":`true`}),(0,_.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.item.title}),(0,_.jsx)(o,{className:i(`size-3.5 shrink-0 text-muted-foreground transition-transform group-hover:text-foreground`,n&&`rotate-90`),"aria-hidden":`true`})]}),n?(0,_.jsx)(`div`,{className:i(`ml-3 grid gap-0.5 border-l border-border/80 pl-3`,e.depth>0&&`ml-5`),children:(0,_.jsx)(b,{items:e.item.children,selectedPath:e.selectedPath,depth:e.depth+1})}):null]})}function S(e,t){return t===void 0?!1:e.type===`page`?e.page.path===t:e.children.some(e=>S(e,t))}function C(e){let t=i(`relative flex h-8 min-w-0 items-center gap-2 rounded-md px-2 text-left text-sm transition-state focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:outline-none`,e.selected?`bg-secondary text-foreground before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-primary`:`text-muted-foreground hover:bg-secondary/70 hover:text-foreground`),n=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(l,{className:i(`size-4 shrink-0 text-muted-foreground transition-colors`,e.selected&&`text-primary`),"aria-hidden":`true`}),(0,_.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.page.title})]});return e.page.path===``?(0,_.jsx)(r,{to:`/documentation`,"aria-current":e.selected?`page`:void 0,className:t,children:n}):(0,_.jsx)(r,{to:`/documentation/$`,params:{_splat:e.page.path},"aria-current":e.selected?`page`:void 0,className:t,children:n})}var w={h1({children:e}){return(0,_.jsx)(`h2`,{className:`mt-8 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0`,children:e})},h2({children:e}){return(0,_.jsx)(`h2`,{className:`mt-8 scroll-m-20 border-t pt-6 text-lg font-semibold tracking-tight first:mt-0 first:border-t-0 first:pt-0`,children:e})},h3({children:e}){return(0,_.jsx)(`h3`,{className:`mt-6 scroll-m-20 text-base font-semibold tracking-tight`,children:e})},p({children:e}){return(0,_.jsx)(`p`,{className:`mt-4 text-sm leading-7 text-foreground`,children:e})},a({href:e,children:t}){let n=u(e);return n===void 0?(0,_.jsxs)(`a`,{href:e,target:e?.startsWith(`http`)?`_blank`:void 0,rel:e?.startsWith(`http`)?`noreferrer`:void 0,className:`inline-flex items-center gap-1 font-medium text-primary underline-offset-4 hover:underline`,children:[t,e?.startsWith(`http`)?(0,_.jsx)(c,{className:`size-3`,"aria-hidden":`true`}):null]}):n===``?(0,_.jsx)(r,{to:`/documentation`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:t}):(0,_.jsx)(r,{to:`/documentation/$`,params:{_splat:n},className:`font-medium text-primary underline-offset-4 hover:underline`,children:t})},ul({children:e}){return(0,_.jsx)(`ul`,{className:`mt-4 grid gap-2 pl-5 text-sm`,children:e})},ol({children:e}){return(0,_.jsx)(`ol`,{className:`mt-4 grid list-decimal gap-3 pl-5 text-sm`,children:e})},li({children:e}){return(0,_.jsx)(`li`,{className:`pl-1 leading-7 marker:text-muted-foreground`,children:e})},code({children:e,className:t}){return t===void 0?(0,_.jsx)(`code`,{className:`rounded border bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground`,children:e}):(0,_.jsx)(`code`,{className:i(`font-mono text-xs leading-6`,t),children:e})},pre({children:e}){return(0,_.jsx)(`pre`,{className:`mt-4 max-w-full overflow-x-auto rounded-lg border bg-muted/40 p-3 text-xs text-foreground`,children:e})},blockquote({children:e}){return(0,_.jsx)(`blockquote`,{className:`mt-4 border-l-2 pl-4 text-sm text-muted-foreground`,children:e})},table({children:e}){return(0,_.jsx)(`div`,{className:`mt-4 max-w-full overflow-x-auto rounded-lg border`,children:(0,_.jsx)(`table`,{className:`w-full border-collapse text-sm`,children:e})})},thead({children:e}){return(0,_.jsx)(`thead`,{className:`bg-muted/50`,children:e})},th({children:e}){return(0,_.jsx)(`th`,{className:`border-b px-3 py-2 text-left font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground`,children:e})},td({children:e}){return(0,_.jsx)(`td`,{className:`border-b px-3 py-2 align-top`,children:e})},hr(){return(0,_.jsx)(`hr`,{className:`my-8 border-border`})}};export{v as t};
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./link-ll3nLBSM.js";import{t as i}from"./utils-CBxvVKOM.js";import{n as a,r as o,t as s}from"./lib-COfgMmRR.js";import{t as c}from"./external-link-BWhbbPgy.js";import{t as l}from"./file-text-DLxLJ7P1.js";import{Tt as u,c as d,l as f,o as p,s as m,wt as h}from"./main-DVO9gWzi.js";var g=e(t(),1),_=n();function v(e){let t=f(e.selectedPath);return(0,_.jsxs)(`section`,{className:`grid gap-5`,children:[(0,_.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-start gap-4`,children:(0,_.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`p`,{className:`console-callout`,children:`Documentation`}),(0,_.jsx)(`h1`,{className:`mt-1 text-lg font-semibold tracking-tight`,children:`Flakes`}),(0,_.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-muted-foreground`,children:`Guides and reference for using Flakes, a harness runtime for distributed agent workflows.`})]})}),(0,_.jsxs)(`div`,{className:`grid min-w-0 gap-4 lg:grid-cols-[18rem_minmax(0,1fr)]`,children:[(0,_.jsx)(y,{selectedPath:t?.path}),t?(0,_.jsxs)(`article`,{className:`min-w-0 rounded-lg border bg-card text-card-foreground shadow-sm`,children:[(0,_.jsxs)(`header`,{className:`border-b px-5 py-5 sm:px-6`,children:[(0,_.jsx)(`p`,{className:`console-callout`,children:`Guide`}),(0,_.jsx)(`h2`,{className:`mt-2 text-xl font-semibold tracking-tight`,children:t.title}),t.description.length>0?(0,_.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm text-muted-foreground`,children:t.description}):null]}),(0,_.jsx)(`div`,{className:`min-w-0 px-5 py-5 sm:px-6`,children:(0,_.jsx)(a,{remarkPlugins:[s],components:w,children:t.body})})]}):null]})]})}function y(e){let t=m.length===1?`1 page`:`${m.length} pages`;return(0,_.jsxs)(`nav`,{"aria-label":`Documentation pages`,className:`min-w-0 overflow-hidden rounded-lg border bg-card/80 text-card-foreground shadow-sm lg:sticky lg:top-6 lg:self-start`,children:[(0,_.jsxs)(`div`,{className:`flex items-center gap-2 border-b bg-muted/30 px-3 py-2.5`,children:[(0,_.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md border bg-background`,children:(0,_.jsx)(u,{className:`size-4 text-muted-foreground`})}),(0,_.jsxs)(`span`,{className:`min-w-0`,children:[(0,_.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:`Contents`}),(0,_.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-muted-foreground`,children:t})]})]}),(0,_.jsx)(`div`,{className:`grid max-h-72 gap-0.5 overflow-y-auto p-2 lg:max-h-[calc(100vh-12rem)]`,children:(0,_.jsx)(b,{items:p,selectedPath:e.selectedPath})})]})}function b(e){let t=e.depth??0;return(0,_.jsx)(_.Fragment,{children:e.items.map(n=>n.type===`page`?(0,_.jsx)(C,{page:n.page,selected:n.page.path===e.selectedPath,depth:t},n.page.path||`overview`):(0,_.jsx)(x,{item:n,selectedPath:e.selectedPath,depth:t},n.key))})}function x(e){let t=S(e.item,e.selectedPath),[n,r]=(0,g.useState)(t);return(0,g.useEffect)(()=>{t&&r(!0)},[t]),(0,_.jsxs)(`div`,{className:`grid gap-1`,children:[(0,_.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:i(`group flex h-8 w-full min-w-0 items-center gap-2 rounded-md px-2 text-left text-sm text-muted-foreground transition-state hover:bg-secondary/70 hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:outline-none`,t&&`text-foreground`),children:[(0,_.jsx)(h,{className:`size-4 shrink-0 text-muted-foreground transition-colors group-hover:text-foreground`,"aria-hidden":`true`}),(0,_.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.item.title}),(0,_.jsx)(o,{className:i(`size-3.5 shrink-0 text-muted-foreground transition-transform group-hover:text-foreground`,n&&`rotate-90`),"aria-hidden":`true`})]}),n?(0,_.jsx)(`div`,{className:i(`ml-3 grid gap-0.5 border-l border-border/80 pl-3`,e.depth>0&&`ml-5`),children:(0,_.jsx)(b,{items:e.item.children,selectedPath:e.selectedPath,depth:e.depth+1})}):null]})}function S(e,t){return t===void 0?!1:e.type===`page`?e.page.path===t:e.children.some(e=>S(e,t))}function C(e){let t=i(`relative flex h-8 min-w-0 items-center gap-2 rounded-md px-2 text-left text-sm transition-state focus-visible:ring-[3px] focus-visible:ring-ring/30 focus-visible:outline-none`,e.selected?`bg-secondary text-foreground before:absolute before:inset-y-1 before:left-0 before:w-0.5 before:rounded-full before:bg-primary`:`text-muted-foreground hover:bg-secondary/70 hover:text-foreground`),n=(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(l,{className:i(`size-4 shrink-0 text-muted-foreground transition-colors`,e.selected&&`text-primary`),"aria-hidden":`true`}),(0,_.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium`,children:e.page.title})]});return e.page.path===``?(0,_.jsx)(r,{to:`/documentation`,"aria-current":e.selected?`page`:void 0,className:t,children:n}):(0,_.jsx)(r,{to:`/documentation/$`,params:{_splat:e.page.path},"aria-current":e.selected?`page`:void 0,className:t,children:n})}var w={h1({children:e}){return(0,_.jsx)(`h2`,{className:`mt-8 scroll-m-20 text-xl font-semibold tracking-tight first:mt-0`,children:e})},h2({children:e}){return(0,_.jsx)(`h2`,{className:`mt-8 scroll-m-20 border-t pt-6 text-lg font-semibold tracking-tight first:mt-0 first:border-t-0 first:pt-0`,children:e})},h3({children:e}){return(0,_.jsx)(`h3`,{className:`mt-6 scroll-m-20 text-base font-semibold tracking-tight`,children:e})},p({children:e}){return(0,_.jsx)(`p`,{className:`mt-4 text-sm leading-7 text-foreground`,children:e})},a({href:e,children:t}){let n=d(e);return n===void 0?(0,_.jsxs)(`a`,{href:e,target:e?.startsWith(`http`)?`_blank`:void 0,rel:e?.startsWith(`http`)?`noreferrer`:void 0,className:`inline-flex items-center gap-1 font-medium text-primary underline-offset-4 hover:underline`,children:[t,e?.startsWith(`http`)?(0,_.jsx)(c,{className:`size-3`,"aria-hidden":`true`}):null]}):n===``?(0,_.jsx)(r,{to:`/documentation`,className:`font-medium text-primary underline-offset-4 hover:underline`,children:t}):(0,_.jsx)(r,{to:`/documentation/$`,params:{_splat:n},className:`font-medium text-primary underline-offset-4 hover:underline`,children:t})},ul({children:e}){return(0,_.jsx)(`ul`,{className:`mt-4 grid gap-2 pl-5 text-sm`,children:e})},ol({children:e}){return(0,_.jsx)(`ol`,{className:`mt-4 grid list-decimal gap-3 pl-5 text-sm`,children:e})},li({children:e}){return(0,_.jsx)(`li`,{className:`pl-1 leading-7 marker:text-muted-foreground`,children:e})},code({children:e,className:t}){return t===void 0?(0,_.jsx)(`code`,{className:`rounded border bg-muted px-1.5 py-0.5 font-mono text-[0.85em] text-foreground`,children:e}):(0,_.jsx)(`code`,{className:i(`font-mono text-xs leading-6`,t),children:e})},pre({children:e}){return(0,_.jsx)(`pre`,{className:`mt-4 max-w-full overflow-x-auto rounded-lg border bg-muted/40 p-3 text-xs text-foreground`,children:e})},blockquote({children:e}){return(0,_.jsx)(`blockquote`,{className:`mt-4 border-l-2 pl-4 text-sm text-muted-foreground`,children:e})},table({children:e}){return(0,_.jsx)(`div`,{className:`mt-4 max-w-full overflow-x-auto rounded-lg border`,children:(0,_.jsx)(`table`,{className:`w-full border-collapse text-sm`,children:e})})},thead({children:e}){return(0,_.jsx)(`thead`,{className:`bg-muted/50`,children:e})},th({children:e}){return(0,_.jsx)(`th`,{className:`border-b px-3 py-2 text-left font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground`,children:e})},td({children:e}){return(0,_.jsx)(`td`,{className:`border-b px-3 py-2 align-top`,children:e})},hr(){return(0,_.jsx)(`hr`,{className:`my-8 border-border`})}};export{v as t};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./link-ll3nLBSM.js";import{r as i,t as a}from"./utils-CBxvVKOM.js";import{t as o}from"./circle-alert-CM0SVfzc.js";import{t as s}from"./circle-check-CzwcEElH.js";import{t as c}from"./circle-x-C_sOQVNQ.js";import{t as l}from"./inbox-BVu38EN6.js";import{A as u,Ct as d,Et as f,J as p,M as m,St as h,X as g,Y as _,Z as v,ft as y,ht as b,k as x,mt as S,pt as C,rt as w,st as T,wt as E}from"./main-DVO9gWzi.js";import{a as D,i as O,n as k,t as A}from"./card-37qs8AAd.js";import{c as ee,d as j,f as M,l as N}from"./bits-CTGNpp-v.js";var P=i(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),F=i(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),I=i(`folder-cog`,[[`path`,{d:`M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.98a2 2 0 0 1 1.69.9l.66 1.2A2 2 0 0 0 12 6h8a2 2 0 0 1 2 2v3.3`,key:`128dxu`}],[`path`,{d:`m14.305 19.53.923-.382`,key:`3m78fa`}],[`path`,{d:`m15.228 16.852-.923-.383`,key:`npixar`}],[`path`,{d:`m16.852 15.228-.383-.923`,key:`5xggr7`}],[`path`,{d:`m16.852 20.772-.383.924`,key:`dpfhf9`}],[`path`,{d:`m19.148 15.228.383-.923`,key:`1reyyz`}],[`path`,{d:`m19.53 21.696-.382-.924`,key:`1goivc`}],[`path`,{d:`m20.772 16.852.924-.383`,key:`htqkph`}],[`path`,{d:`m20.772 19.148.924.383`,key:`9w9pjp`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),L=i(`hard-drive`,[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]),R=e(t(),1),z=n();function B(){let e=v(),t=w(),n=e.data?.projects??[],r=(t.data?.pages??[]).flatMap(e=>e.runs),{active:i,archived:a}=u(n);return N(3e4),e.isPending&&e.data===void 0?(0,z.jsxs)(`section`,{className:`grid gap-5`,children:[(0,z.jsx)(Q,{}),(0,z.jsx)(re,{})]}):e.isError&&e.data===void 0?(0,z.jsxs)(`section`,{className:`grid gap-5`,children:[(0,z.jsx)(Q,{}),(0,z.jsx)(A,{className:`py-10 text-center`,children:(0,z.jsxs)(k,{className:`grid justify-items-center gap-2`,children:[(0,z.jsx)(o,{className:`size-8 text-status-failed`}),(0,z.jsx)(`p`,{className:`font-medium`,children:`Cannot list projects`}),(0,z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:String(e.error)})]})})]}):n.length===0?(0,z.jsxs)(`section`,{className:`grid gap-5`,children:[(0,z.jsx)(Q,{}),(0,z.jsx)(A,{className:`py-12 text-center`,children:(0,z.jsxs)(k,{className:`grid justify-items-center gap-2`,children:[(0,z.jsx)(l,{className:`size-8 text-muted-foreground`}),(0,z.jsx)(`p`,{className:`font-medium`,children:`No projects yet`}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create a project from the CLI or API and it will appear here.`})]})})]}):(0,z.jsxs)(`section`,{className:`grid gap-5`,children:[(0,z.jsx)(Q,{}),(0,z.jsx)($,{title:`Active projects`,projects:i,runs:r}),(0,z.jsx)(V,{projects:i}),a.length>0?(0,z.jsx)($,{title:`Archived projects`,projects:a,runs:r,archived:!0}):null]})}function V(e){let t=g(),n=t.data?.hosts??[],[r,i]=(0,R.useState)(null),[a,s]=(0,R.useState)(null);if((0,R.useEffect)(()=>{let e=n.some(e=>e.hostId===r)?r:n[0]?.hostId??null;e!==r&&i(e)},[n,r]),(0,R.useEffect)(()=>{let t=e.projects.some(e=>e.projectKey===a)?a:e.projects[0]?.projectKey??null;t!==a&&s(t)},[e.projects,a]),e.projects.length===0)return(0,z.jsx)(A,{className:`border-dashed`,children:(0,z.jsxs)(k,{className:`flex items-center gap-3 p-4 text-sm text-muted-foreground`,children:[(0,z.jsx)(I,{className:`size-4`}),`No active projects to place on hosts.`]})});if(t.isPending&&t.data===void 0)return(0,z.jsx)(Y,{});if(t.isError&&t.data===void 0)return(0,z.jsx)(A,{className:`py-8 text-center`,children:(0,z.jsxs)(k,{className:`grid justify-items-center gap-2`,children:[(0,z.jsx)(o,{className:`size-8 text-status-failed`}),(0,z.jsx)(`p`,{className:`font-medium`,children:`Cannot list hosts`}),(0,z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:String(t.error)})]})});if(n.length===0)return(0,z.jsx)(A,{className:`border-dashed py-8 text-center`,children:(0,z.jsxs)(k,{className:`grid justify-items-center gap-2`,children:[(0,z.jsx)(h,{className:`size-8 text-muted-foreground`}),(0,z.jsx)(`p`,{className:`font-medium`,children:`No hosts available`}),(0,z.jsx)(`p`,{className:`max-w-md text-sm text-muted-foreground`,children:`Add a host before assigning project workspace roots or pool bindings.`})]})});let c=n.find(e=>e.hostId===r)??n[0],l=e.projects.find(e=>e.projectKey===a)??e.projects[0];return(0,z.jsxs)(A,{children:[(0,z.jsxs)(O,{className:`gap-4`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,z.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-md border bg-background`,children:(0,z.jsx)(I,{className:`size-4 text-muted-foreground`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(D,{className:`text-base`,children:`Host placement`}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Manage project workspace roots and host pool bindings.`})]})]}),(0,z.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,z.jsx)(`span`,{className:`console-callout`,children:`Host`}),(0,z.jsx)(`select`,{value:c?.hostId??``,onChange:e=>i(e.target.value),className:`h-9 min-w-0 rounded-md border bg-background px-2 text-sm`,children:n.map(e=>(0,z.jsxs)(`option`,{value:e.hostId,children:[e.name,` (`,e.hostId,`)`]},e.hostId))})]}),(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,z.jsx)(`span`,{className:`console-callout`,children:`Project`}),(0,z.jsx)(`select`,{value:l?.projectKey??``,onChange:e=>s(e.target.value),className:`h-9 min-w-0 rounded-md border bg-background px-2 text-sm`,children:e.projects.map(e=>(0,z.jsxs)(`option`,{value:e.projectKey,children:[e.name,` (`,e.projectKey,`)`]},e.projectId))})]})]})]}),c&&l?(0,z.jsx)(H,{host:c,project:l},`${c.hostId}:${l.projectKey}`):null]})}function H(e){let t=T(),n=y(),r=p(e.host.hostId),i=e.host.projectWorkspaceRoot,a=typeof i==`string`&&i.trim().length>0,c=_(e.host.hostId,a),l=a&&c.isPending&&c.data===void 0,u=c.data?.bindings.find(t=>t.projectKey===e.project.projectKey),f=(u?.poolKeys??[]).join(`\0`),[g,v]=(0,R.useState)(i??``),[b,x]=(0,R.useState)([]);(0,R.useEffect)(()=>{v(i??``)},[i]),(0,R.useEffect)(()=>{x(f===``?[]:f.split(`\0`))},[f]);let C=r.data?.hostPools??[],w=new Set(C.map(e=>e.poolKey)),E=b.filter(e=>w.has(e)),D=g!==(i??``),O=u?.workspacePath??(a?S(i,e.project.projectKey):void 0);function A(e){x(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}return(0,z.jsxs)(k,{className:`grid gap-4`,children:[(0,z.jsxs)(`form`,{className:`grid gap-3 rounded-md border p-3`,onSubmit:n=>{n.preventDefault(),t.mutate({hostId:e.host.hostId,path:g})},children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,z.jsx)(L,{className:`size-4 text-muted-foreground`}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Project workspace root`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.host.hostId})]}),(0,z.jsx)(U,{host:e.host})]}),(0,z.jsxs)(`div`,{className:`grid gap-2 md:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,z.jsx)(`input`,{value:g,onChange:e=>v(e.target.value),placeholder:`/srv/flakes/projects`,className:`h-9 min-w-0 rounded-md border bg-background px-3 font-mono text-sm`}),(0,z.jsxs)(m,{type:`submit`,size:`sm`,disabled:t.isPending||g.trim().length===0||!D,children:[t.isPending?(0,z.jsx)(d,{className:`size-4 animate-spin`}):(0,z.jsx)(s,{className:`size-4`}),`Save root`]})]}),t.isError?(0,z.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot save root: `,String(t.error)]}):null]}),(0,z.jsxs)(`div`,{className:`grid gap-3 rounded-md border p-3`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,z.jsx)(I,{className:`size-4 text-muted-foreground`}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-medium`,children:`Project host binding`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-xs text-muted-foreground`,children:e.project.projectKey})]}),(0,z.jsx)(W,{binding:u,loading:l})]}),(0,z.jsx)(q,{label:`Workspace path`,value:O??`Root required`,muted:O===void 0}),a?r.isPending&&r.data===void 0?(0,z.jsx)(X,{}):r.isError&&r.data===void 0?(0,z.jsx)(J,{icon:o,title:`Cannot list pools`,detail:String(r.error),tone:`error`}):C.length===0?(0,z.jsx)(J,{icon:h,title:`No host pools`,detail:`This host has not reported any pool keys.`}):l?(0,z.jsx)(G,{}):c.isError&&c.data===void 0?(0,z.jsx)(J,{icon:o,title:`Cannot list bindings`,detail:String(c.error),tone:`error`}):(0,z.jsxs)(`form`,{className:`grid gap-3`,onSubmit:t=>{t.preventDefault(),n.mutate({hostId:e.host.hostId,projectKey:e.project.projectKey,poolKeys:E})},children:[(0,z.jsx)(K,{pools:C,binding:{poolKeys:b},onToggle:A}),(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,z.jsxs)(m,{type:`submit`,size:`sm`,disabled:n.isPending||E.length===0,children:[n.isPending?(0,z.jsx)(d,{className:`size-4 animate-spin`}):(0,z.jsx)(s,{className:`size-4`}),`Save binding`]}),(0,z.jsxs)(`p`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-muted-foreground`,children:[E.length,` selected pool`,E.length===1?``:`s`]})]}),n.isError?(0,z.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot save binding: `,String(n.error)]}):null]}):(0,z.jsx)(J,{icon:L,title:`Workspace root required`,detail:`Set a host project workspace root before creating bindings.`})]})]})}function U(e){return(0,z.jsxs)(M,{variant:`outline`,className:`gap-1.5 font-mono text-[11px]`,children:[(0,z.jsx)(`span`,{className:a(`size-1.5 rounded-full`,e.host.status===`online`?`bg-status-succeeded`:e.host.status===`disabled`?`bg-status-failed`:`bg-status-idle`)}),e.host.status.toUpperCase()]})}function W(e){if(e.loading===!0)return(0,z.jsxs)(M,{variant:`outline`,className:`gap-1.5 font-mono text-[11px] uppercase tracking-[0.08em] text-status-warn`,children:[(0,z.jsx)(d,{className:`size-3.5 animate-spin`}),`Loading binding`]});let t=C(e.binding),n=Z(t.tone);return(0,z.jsxs)(M,{variant:`outline`,className:a(`gap-1.5 font-mono text-[11px] uppercase tracking-[0.08em]`,te(t.tone)),title:t.detail,children:[(0,z.jsx)(n,{className:`size-3.5`}),t.label]})}function G(){return(0,z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 rounded-md border border-dashed p-3`,children:[(0,z.jsx)(d,{className:`mt-0.5 size-4 shrink-0 animate-spin text-status-warn`}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`text-sm font-medium`,children:`Loading bindings`}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Loading current host project bindings before edits are enabled.`})]})]})}function K(e){return(0,z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:b(e.pools,e.binding).map(t=>(0,z.jsxs)(`label`,{className:a(`flex min-w-0 items-center gap-3 rounded-md border p-3 text-sm transition-colors`,t.selected?`bg-secondary/70`:`hover:bg-secondary/40`),children:[(0,z.jsx)(`input`,{type:`checkbox`,checked:t.selected,onChange:()=>e.onToggle(t.poolKey),className:`size-4 shrink-0 accent-primary`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs`,children:t.poolKey}),(0,z.jsx)(M,{variant:`outline`,className:`font-mono text-[10px]`,children:t.statusLabel})]},t.poolKey))})}function q(e){return(0,z.jsxs)(`label`,{className:`grid gap-1.5 text-sm`,children:[(0,z.jsx)(`span`,{className:`console-callout`,children:e.label}),(0,z.jsx)(`input`,{readOnly:!0,value:e.value,className:a(`h-9 min-w-0 rounded-md border bg-muted px-3 font-mono text-sm`,e.muted&&`text-muted-foreground`)})]})}function J(e){let t=e.icon;return(0,z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 rounded-md border border-dashed p-3`,children:[(0,z.jsx)(t,{className:a(`mt-0.5 size-4 shrink-0`,e.tone===`error`?`text-status-failed`:`text-muted-foreground`)}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`p`,{className:`text-sm font-medium`,children:e.title}),(0,z.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:e.detail})]})]})}function Y(){return(0,z.jsxs)(A,{children:[(0,z.jsxs)(O,{children:[(0,z.jsx)(j,{className:`h-5 w-40`}),(0,z.jsx)(j,{className:`h-4 w-80 max-w-full`})]}),(0,z.jsxs)(k,{className:`grid gap-3`,children:[(0,z.jsx)(j,{className:`h-24 w-full`}),(0,z.jsx)(j,{className:`h-36 w-full`})]})]})}function X(){return(0,z.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[0,1].map(e=>(0,z.jsx)(j,{className:`h-12 w-full`},e))})}function Z(e){switch(e){case`available`:return s;case`unavailable`:return c;case`pending`:return F;case`idle`:return P}}function te(e){switch(e){case`available`:return`text-status-succeeded`;case`unavailable`:return`text-status-failed`;case`pending`:return`text-status-warn`;case`idle`:return`text-muted-foreground`}}function Q(){return(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Projects`}),(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Project-scoped run history for this account.`})]})}function $(e){return e.projects.length===0?(0,z.jsx)(A,{className:`py-8 text-center`,children:(0,z.jsx)(k,{className:`text-sm text-muted-foreground`,children:`No active projects.`})}):(0,z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,z.jsx)(`h2`,{className:`console-callout`,children:e.title}),(0,z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:e.projects.map(t=>(0,z.jsx)(ne,{project:t,runCount:ie(t,e.runs),archived:e.archived===!0},t.projectId))})]})}function ne(e){return(0,z.jsxs)(A,{className:e.archived?`border-dashed opacity-80`:void 0,children:[(0,z.jsx)(O,{className:`gap-3`,children:(0,z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,z.jsx)(`span`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-md border bg-background`,children:e.archived?(0,z.jsx)(f,{className:`size-4 text-muted-foreground`}):(0,z.jsx)(E,{className:`size-4 text-muted-foreground`})}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,z.jsx)(D,{className:`truncate text-base`,children:e.project.name}),(0,z.jsx)(M,{variant:e.archived?`outline`:`secondary`,children:e.project.status})]}),(0,z.jsx)(`div`,{className:`mt-1 font-mono text-xs text-muted-foreground`,children:e.project.projectKey})]})]})}),(0,z.jsxs)(k,{className:`flex flex-wrap items-center gap-3`,children:[(0,z.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,"data-num":!0,children:[e.runCount,` loaded runs`]}),(0,z.jsxs)(`span`,{className:`font-mono text-xs text-muted-foreground`,title:e.project.updatedAt,"data-num":!0,children:[`Updated `,ee(e.project.updatedAt)]}),(0,z.jsx)(m,{asChild:!0,size:`sm`,variant:`outline`,className:`ml-auto`,children:(0,z.jsx)(r,{to:`/runs`,search:{project:e.project.projectKey},children:`Runs`})})]})]})}function re(){return(0,z.jsx)(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[0,1,2,3].map(e=>(0,z.jsxs)(A,{children:[(0,z.jsxs)(O,{children:[(0,z.jsx)(j,{className:`h-5 w-40`}),(0,z.jsx)(j,{className:`h-4 w-24`})]}),(0,z.jsx)(k,{children:(0,z.jsx)(j,{className:`h-8 w-full`})})]},e))})}function ie(e,t){return t.filter(t=>x(e,t)).length}export{B as ProjectsPage};
@@ -0,0 +1,3 @@
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./react-dom-ki7NpxV4.js";import{r as i,t as a}from"./utils-CBxvVKOM.js";import{t as o}from"./file-text-DLxLJ7P1.js";import{t as s}from"./lock-Ck2SfQA2.js";import{t as c}from"./x-Bdsfqbi3.js";import{$ as l,B as u,Ct as d,F as f,H as p,I as m,L as h,M as g,N as _,O as ee,P as v,Q as te,R as y,V as ne,W as b,Z as re,bt as ie,et as ae,kt as oe,nt as se,q as ce,tt as le,yt as ue,z as de}from"./main-DVO9gWzi.js";import{n as x,t as S}from"./card-37qs8AAd.js";import{a as C,c as fe,d as w,f as T,i as E,l as pe,n as me,o as he,r as D,t as ge,u as _e}from"./bits-CTGNpp-v.js";import{a as O,i as k,n as A,o as j,r as M,t as N}from"./table-WMIs2m3R.js";import{t as ve}from"./SandboxesLens-DPG87mUE.js";var ye=i(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),be=i(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),xe=i(`expand`,[[`path`,{d:`m15 15 6 6`,key:`1s409w`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}],[`path`,{d:`M21 16v5h-5`,key:`1ck2sf`}],[`path`,{d:`M21 8V3h-5`,key:`1qoq8a`}],[`path`,{d:`M3 16v5h5`,key:`1t08am`}],[`path`,{d:`m3 21 6-6`,key:`wwnumi`}],[`path`,{d:`M3 8V3h5`,key:`1ln10m`}],[`path`,{d:`M9 9 3 3`,key:`v551iv`}]]),Se=i(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Ce=i(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),we=i(`zoom-out`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),P=e(t(),1),F=n(),I=`Tabs`,[Te,Ee]=ne(I,[f]),De=f(),[Oe,L]=Te(I),ke=P.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=m(s),[d,f]=de({prop:r,onChange:i,defaultProp:a??``,caller:I});return(0,F.jsx)(Oe,{scope:n,baseId:h(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,F.jsx)(p.div,{dir:u,"data-orientation":o,...l,ref:t})})});ke.displayName=I;var Ae=`TabsList`,je=P.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=L(Ae,n),o=De(n);return(0,F.jsx)(v,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,F.jsx)(p.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});je.displayName=Ae;var Me=`TabsTrigger`,Ne=P.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=L(Me,n),s=De(n),c=Ie(o.baseId,r),l=Le(o.baseId,r),d=r===o.value;return(0,F.jsx)(_,{asChild:!0,...s,focusable:!i,active:d,children:(0,F.jsx)(p.button,{type:`button`,role:`tab`,"aria-selected":d,"aria-controls":l,"data-state":d?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:u(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:u(e.onFocus,()=>{let e=o.activationMode!==`manual`;!d&&!i&&e&&o.onValueChange(r)})})})});Ne.displayName=Me;var Pe=`TabsContent`,Fe=P.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=L(Pe,n),c=Ie(s.baseId,r),l=Le(s.baseId,r),u=r===s.value,d=P.useRef(u);return P.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,F.jsx)(y,{present:i||u,children:({present:n})=>(0,F.jsx)(p.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});Fe.displayName=Pe;function Ie(e,t){return`${e}-trigger-${t}`}function Le(e,t){return`${e}-content-${t}`}var Re=ke,ze=je,Be=Ne,Ve=Fe;function He({className:e,orientation:t=`horizontal`,...n}){return(0,F.jsx)(Re,{"data-slot":`tabs`,"data-orientation":t,orientation:t,className:a(`group/tabs flex gap-2 data-[orientation=horizontal]:flex-col`,e),...n})}var Ue=b(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-[orientation=horizontal]/tabs:h-9 group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function We({className:e,variant:t=`default`,...n}){return(0,F.jsx)(ze,{"data-slot":`tabs-list`,"data-variant":t,className:a(Ue({variant:t}),e),...n})}function R({className:e,...t}){return(0,F.jsx)(Be,{"data-slot":`tabs-trigger`,className:a(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 group-data-[variant=default]/tabs-list:data-[state=active]:shadow-sm group-data-[variant=line]/tabs-list:data-[state=active]:shadow-none dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:border-transparent dark:group-data-[variant=line]/tabs-list:data-[state=active]:bg-transparent`,`data-[state=active]:bg-background data-[state=active]:text-foreground dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 dark:data-[state=active]:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-[state=active]:after:opacity-100`,e),...t})}function z({className:e,...t}){return(0,F.jsx)(Ve,{"data-slot":`tabs-content`,className:a(`flex-1 outline-none`,e),...t})}var Ge=e(r(),1),B=192,V=60,H=248,U=76,Ke=2,qe=18,Je=16,Ye=1e4,W=new Set([`SUCCEEDED`,`FAILED`,`CANCELLED`]),Xe=new Set([`CREATED`,`QUEUED`,`BLOCKED`]);function G(e){let t=Math.max(0,Math.floor(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m${String(t%60).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}function Ze(e){if(e.length===0)return{positions:new Map,width:0,height:0};let t=new Map(e.map(e=>[e.id,e])),n=new Map,r=new Set,i=e=>{let a=n.get(e);if(a!==void 0)return a;if(r.has(e))return 0;r.add(e);let o=t.get(e)?.deps.filter(e=>t.has(e))??[],s=o.length===0?0:1+Math.max(...o.map(e=>i(e)));return r.delete(e),n.set(e,s),s},a=[];for(let t of e){let e=i(t.id);for(;a.length<=e;)a.push([]);a[e]?.push(t.id)}let o=new Map;for(let e of a){let n=e=>{let n=(t.get(e)?.deps??[]).map(e=>o.get(e)).filter(e=>e!==void 0).sort((e,t)=>e-t);return n[Math.floor((n.length-1)/2)]??2**53-1};e.sort((e,t)=>n(e)-n(t)||e.localeCompare(t)),e.forEach((e,t)=>{o.set(e,t)})}let s=Math.max(1,...a.map(e=>e.length)),c=new Map;return a.forEach((e,t)=>{let n=(s-e.length)*U/2;e.forEach((e,r)=>{c.set(e,{x:t*H,y:r*U+n})})}),{positions:c,width:(a.length-1)*H+B,height:(s-1)*U+V}}function Qe(e,t){return $e(e,t)>=2&&Math.abs(t.y-e.y)<U*.5}function $e(e,t){return Math.max(1,Math.round((t.x-e.x)/H))}function et(e,t,n){let r=e.x+B,i=e.y+V/2,a=t.x,o=t.y+V/2;if(n!==null){let s=Math.min(e.y,t.y)-n,c=Math.min(40,(a-r)/2-8),l=r+c,u=a-c,d=c*.6;return`M ${r} ${i} C ${r+d} ${i}, ${l-d} ${s}, ${l} ${s} L ${u} ${s} C ${u+d} ${s}, ${a-d} ${o}, ${a} ${o}`}let s=Math.max(16,Math.min(90,(a-r)*.45));return`M ${r} ${i} C ${r+s} ${i}, ${a-s} ${o}, ${a} ${o}`}function tt(e){let t=e===``?[]:e.split(`
2
+ `).map(e=>{let[t=``,n=``]=e.split(`>`);return{id:t,deps:n===``?[]:n.split(`,`)}}),n=Ze(t),r=new Map,i=new Map,a=[];for(let e of t){let t=e.deps.filter(e=>n.positions.has(e)),o=[];for(let r of t){let t=n.positions.get(r),s=n.positions.get(e.id);if(t===void 0||s===void 0||$e(t,s)>Ke)continue;o.push(r);let c=i.get(r);c===void 0?i.set(r,[e.id]):c.push(e.id),a.push({source:r,target:e.id,from:t,to:s})}r.set(e.id,o)}let o=new Map,s=[],c=a.map((e,t)=>({edge:e,index:t})).filter(e=>Qe(e.edge.from,e.edge.to)).sort((e,t)=>e.edge.from.x-t.edge.from.x||e.edge.to.x-t.edge.to.x);for(let{edge:e,index:t}of c){let n=e.from.x+B,r=s.findIndex(e=>e<=n);r===-1&&(r=s.length),s[r]=e.to.x,o.set(t,qe+r*Je)}let l=0;for(let{edge:e,index:t}of c){let n=o.get(t)??0;l=Math.max(l,n-Math.min(e.from.y,e.to.y))}l=l>0?Math.ceil(l)+6:0;let u=l===0?n.positions:new Map(Array.from(n.positions,([e,t])=>[e,{x:t.x,y:t.y+l}]));return{layout:{...n,positions:u,height:n.height+l},edges:a.map((e,t)=>({key:`${e.source}->${e.target}`,source:e.source,target:e.target,d:et({x:e.from.x,y:e.from.y+l},{x:e.to.x,y:e.to.y+l},o.get(t)??null)})),parents:r,children:i}}function K(e,t){let n=new Set,r=[...t.get(e)??[]];for(;r.length>0;){let e=r.pop();if(!(e===void 0||n.has(e))){n.add(e);for(let i of t.get(e)??[])n.has(i)||r.push(i)}}return n}function nt(e){let[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(!1),[a,o]=(0,P.useState)(new Map),[s,c]=(0,P.useState)(new Map),l=(0,P.useRef)(null),u=e.tasks.map(e=>`${e.taskId}>${e.dependsOn.join(`,`)}`).join(`
3
+ `),d=(0,P.useMemo)(()=>tt(u),[u]);(0,P.useEffect)(()=>{let t=l.current;if(l.current=new Map(e.tasks.map(e=>[e.taskId,e.status])),t===null)return;let n=[],r=[];for(let i of e.tasks){let e=t.get(i.taskId);e===void 0||e===i.status||(i.status===`SUCCEEDED`&&n.push(i.taskId),W.has(i.status)&&r.push(i.taskId))}if(r.length>0){let e=Date.now();c(t=>{let n=new Map(t);for(let t of r)n.set(t,e);return n})}if(n.length>0){let e=Date.now();o(t=>{let r=new Map(t);for(let t of n)r.set(t,e);return r}),setTimeout(()=>{o(t=>{let r=new Map(t);for(let t of n)r.get(t)===e&&r.delete(t);return r})},800)}},[e.tasks]);let f=(0,P.useMemo)(()=>{let t=new Set;for(let n of e.tasks)if(n.status===`FAILED`)for(let e of K(n.taskId,d.children))t.add(e);return t},[e.tasks,d]),p=e.selectedTaskId??t,m=(0,P.useMemo)(()=>{if(p===null||!d.layout.positions.has(p))return null;let e=new Set([p]);for(let t of K(p,d.parents))e.add(t);for(let t of K(p,d.children))e.add(t);return e},[p,d]);if(e.pending)return(0,F.jsx)(pt,{});if(e.tasks.length===0)return(0,F.jsx)(`p`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No tasks in this run.`});let h=new Map(e.tasks.map(e=>[e.taskId,e.status])),g=Date.now(),_=(0,F.jsx)(rt,{graph:d,tasks:e.tasks,ordinals:e.ordinals,now:g,statusById:h,ignitions:a,terminalFlashes:s,blastSet:f,focusSet:m,selectedTaskId:e.selectedTaskId,onSelect:e.onSelect,onHover:n});return(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`p`,{className:`sr-only`,children:`Task dependency map. The manifest table below lists the same tasks.`}),(0,F.jsx)(at,{width:d.layout.width,height:d.layout.height,onExpand:()=>i(!0),collapsed:r,children:_}),r?(0,F.jsx)(ot,{width:d.layout.width,height:d.layout.height,onClose:()=>i(!1),children:_}):null]})}function rt(e){let{graph:t,statusById:n,focusSet:r,blastSet:i}=e,a=e=>{let t=n.get(e);if(t===void 0)throw Error(`DAG edge references missing task ${e}`);return t};return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 overflow-visible`,width:t.layout.width,height:t.layout.height,children:t.edges.map(t=>(0,F.jsx)(ct,{edge:t,sourceStatus:a(t.source),targetStatus:a(t.target),igniteNonce:e.ignitions.get(t.source),blast:n.get(t.source)===`FAILED`||i.has(t.source),dimmed:r!==null&&!(r.has(t.source)&&r.has(t.target))},t.key))}),e.tasks.map((n,a)=>{let o=t.layout.positions.get(n.taskId);return o===void 0?null:(0,F.jsx)(dt,{task:n,ordinal:e.ordinals.get(n.taskId)??a+1,x:o.x,y:o.y,now:e.now,flashNonce:e.terminalFlashes.get(n.taskId),dimmed:r!==null&&!r.has(n.taskId),blast:i.has(n.taskId),selected:e.selectedTaskId===n.taskId,onSelect:e.onSelect,onHover:e.onHover},n.taskId)})]})}var q={backgroundImage:`radial-gradient(var(--border) 1px, transparent 1px)`,backgroundSize:`24px 24px`};function it(e,t,n){return Math.min(n,Math.max(t,e))}function at(e){return e.collapsed?(0,F.jsxs)(`div`,{className:`flex min-h-[420px] w-full min-w-0 flex-col items-center justify-center gap-2 rounded-lg border bg-card/40 text-sm text-muted-foreground`,style:q,children:[(0,F.jsx)(xe,{className:`size-5`,"aria-hidden":!0}),(0,F.jsx)(`span`,{children:`Dependency map open in fullscreen — press Esc to return`})]}):(0,F.jsxs)(`div`,{className:`relative h-[min(56vh,34rem)] min-h-[420px] w-full min-w-0 rounded-lg border bg-card/40`,children:[e.onExpand?(0,F.jsx)(`button`,{type:`button`,"aria-label":`Open dependency map in fullscreen`,onClick:e.onExpand,className:`absolute top-3 right-3 z-10 flex size-8 items-center justify-center rounded-md border bg-card/80 text-muted-foreground backdrop-blur transition-state hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:(0,F.jsx)(xe,{className:`size-4`,"aria-hidden":!0})}):null,(0,F.jsx)(`div`,{className:`flex size-full min-w-0 overflow-auto overscroll-contain rounded-lg p-6`,style:q,children:(0,F.jsx)(`div`,{className:`relative m-auto shrink-0`,style:{width:e.width,height:e.height},children:e.children})})]})}function ot(e){let{onClose:t}=e;return(0,P.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};window.addEventListener(`keydown`,e);let n=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{window.removeEventListener(`keydown`,e),document.body.style.overflow=n}},[t]),(0,Ge.createPortal)((0,F.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background/95 backdrop-blur-sm`,children:(0,F.jsx)(st,{width:e.width,height:e.height,onClose:t,children:e.children})}),document.body)}function st(e){let t=(0,P.useRef)(null),[n,r]=(0,P.useState)({scale:1,x:0,y:0}),i=(0,P.useRef)(null),a=(0,P.useCallback)(()=>{let n=t.current;if(!n)return;let i=it(Math.min((n.clientWidth-80)/e.width,(n.clientHeight-80)/e.height),.1,1.6);r({scale:i,x:(n.clientWidth-e.width*i)/2,y:(n.clientHeight-e.height*i)/2})},[e.width,e.height]);(0,P.useEffect)(()=>{a()},[a]);let o=(e,t,n)=>{r(r=>{let i=it(r.scale*e,.1,4),a=i/r.scale;return{scale:i,x:t-(t-r.x)*a,y:n-(n-r.y)*a}})},s=e=>{let n=t.current;if(!n)return;let r=n.getBoundingClientRect();o(Math.exp(-e.deltaY*.0015),e.clientX-r.left,e.clientY-r.top)},l=e=>{let n=t.current;n&&o(e,n.clientWidth/2,n.clientHeight/2)},u=e=>{e.button===0&&(e.target instanceof Element&&e.target.closest(`button`)!==null||(i.current={px:e.clientX,py:e.clientY,ox:n.x,oy:n.y},e.currentTarget.setPointerCapture(e.pointerId)))},d=e=>{let t=i.current;t&&r(n=>({...n,x:t.ox+(e.clientX-t.px),y:t.oy+(e.clientY-t.py)}))},f=()=>{i.current=null};return(0,F.jsxs)(`div`,{ref:t,className:`absolute inset-0 cursor-grab touch-none overflow-hidden active:cursor-grabbing`,style:q,onWheel:s,onPointerDown:u,onPointerMove:d,onPointerUp:f,onPointerLeave:f,children:[(0,F.jsx)(`div`,{style:{transform:`translate(${n.x}px, ${n.y}px) scale(${n.scale})`,transformOrigin:`0 0`},children:(0,F.jsx)(`div`,{className:`relative`,style:{width:e.width,height:e.height},children:e.children})}),(0,F.jsxs)(`div`,{className:`absolute top-4 right-4 flex items-center gap-1.5`,onPointerDown:e=>e.stopPropagation(),children:[(0,F.jsx)(J,{label:`Zoom out`,onClick:()=>l(1/1.2),children:(0,F.jsx)(we,{className:`size-4`,"aria-hidden":!0})}),(0,F.jsxs)(`span`,{className:`w-11 text-center font-mono text-xs text-muted-foreground`,"data-num":!0,children:[Math.round(n.scale*100),`%`]}),(0,F.jsx)(J,{label:`Zoom in`,onClick:()=>l(1.2),children:(0,F.jsx)(Ce,{className:`size-4`,"aria-hidden":!0})}),(0,F.jsx)(J,{label:`Fit to screen`,onClick:a,children:(0,F.jsx)(Se,{className:`size-4`,"aria-hidden":!0})}),(0,F.jsx)(J,{label:`Close fullscreen`,onClick:e.onClose,children:(0,F.jsx)(c,{className:`size-4`,"aria-hidden":!0})})]}),(0,F.jsx)(`div`,{className:`pointer-events-none absolute bottom-4 left-4 font-mono text-[11px] text-muted-foreground/70`,children:`scroll to zoom · drag to pan · esc to close`})]})}function J(e){return(0,F.jsx)(`button`,{type:`button`,"aria-label":e.label,onClick:e.onClick,className:`flex size-8 items-center justify-center rounded-md border bg-card text-muted-foreground transition-state hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:e.children})}function ct(e){let t=e.dimmed?.35:void 0,n={d:e.edge.d,fill:`none`};return e.blast?(0,F.jsx)(`path`,{...n,strokeWidth:1.5,className:`stroke-status-failed transition-state`,style:{opacity:t??.4}}):e.targetStatus===`RUNNING`?(0,F.jsx)(`path`,{...n,strokeWidth:2,className:`edge-flow stroke-status-running transition-state`,style:{...E(e.edge.key,1200),opacity:t??1}}):e.igniteNonce===void 0?e.sourceStatus===`SUCCEEDED`&&W.has(e.targetStatus)?(0,F.jsx)(`path`,{...n,strokeWidth:1.5,className:`stroke-status-succeeded transition-state`,style:{opacity:t??.5}}):W.has(e.sourceStatus)&&Xe.has(e.targetStatus)?(0,F.jsx)(`path`,{...n,strokeWidth:1.5,className:`stroke-status-idle transition-state`,style:{opacity:t??1}}):(0,F.jsx)(`path`,{...n,strokeWidth:1.5,strokeDasharray:`4 6`,className:`stroke-border transition-state`,style:{opacity:t??.4}}):(0,P.createElement)(`path`,{...n,key:`${e.edge.key}:${e.igniteNonce}`,strokeWidth:2,pathLength:1,className:`edge-ignite stroke-status-succeeded`,style:{opacity:t??1}})}var lt={RUNNING:`border-status-running bg-status-running/5`,SUCCEEDED:`border-l-status-succeeded`,FAILED:`border-status-failed`,CANCELLED:`border-status-warn`,QUEUED:`border-dashed border-status-idle/60 bg-transparent text-muted-foreground`,CREATED:`border-dashed border-status-idle/60 bg-transparent text-muted-foreground`,BLOCKED:`border-dashed border-status-blocked/60 bg-transparent text-muted-foreground`},ut={SUCCEEDED:`var(--status-succeeded)`,FAILED:`var(--status-failed)`,CANCELLED:`var(--status-warn)`};function dt(e){let t=e.task,n=t.status.toUpperCase(),r=n===`RUNNING`,i=C(t),o=t.assignmentHeartbeatAt,s=r&&o!==void 0&&e.now-Date.parse(o)>Ye,c=e.dimmed?.35:e.blast?.4:n===`CANCELLED`?.7:1,l=t.assignedSandboxId??t.lastSandboxId,u=l??t.agentId,d=`text-muted-foreground`;n===`FAILED`?(u=t.error?.code??`FAILED`,d=`text-status-failed`):r&&t.startedAt!==void 0?u=`${l??t.agentId} · ${G(e.now-Date.parse(t.startedAt))}`:n===`SUCCEEDED`&&t.startedAt!==void 0&&t.completedAt!==void 0&&(u=`${l??t.agentId} · ${G(Date.parse(t.completedAt)-Date.parse(t.startedAt))}`);let f={left:e.x,top:e.y,width:B,height:V,opacity:c,...r?E(t.taskId):void 0,...s?{"--glow-level":.3}:void 0};return(0,F.jsxs)(`button`,{type:`button`,className:a(`absolute rounded-md border border-l-2 bg-card px-2.5 py-1.5 text-left transition-state`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,lt[n]??`border-status-idle/60 text-muted-foreground`,r&&`glow`,r&&!s&&`pulse-running`,e.selected&&`ring-1 ring-ring`),style:f,onClick:()=>e.onSelect(t.taskId),onMouseEnter:()=>e.onHover(t.taskId),onMouseLeave:()=>e.onHover(null),onFocus:()=>e.onHover(t.taskId),onBlur:()=>e.onHover(null),children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(ft,{status:n}),(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground`,"data-num":!0,children:[`#`,e.ordinal]}),(0,F.jsx)(`span`,{className:a(`min-w-0 flex-1 truncate`,i===void 0?`font-mono text-[11px]`:`text-xs font-medium`),children:i??t.taskId}),(t.currentAttemptNumber??1)>1?(0,F.jsxs)(`span`,{className:`shrink-0 rounded-sm border border-status-warn/50 px-1 font-mono text-[9px] leading-4 text-status-warn`,"data-num":!0,children:[`A`,t.currentAttemptNumber,t.maxAttempts===void 0?``:`/${t.maxAttempts}`]}):null]}),(0,F.jsx)(`span`,{className:a(`mt-1 block truncate font-mono text-[10px]`,d),"data-num":!0,children:u}),r?(0,F.jsx)(`span`,{"aria-hidden":!0,className:a(`absolute top-1.5 right-1.5 size-1 rounded-full`,s?`bg-status-warn`:`bg-status-running`),children:!s&&o!==void 0?(0,F.jsx)(`span`,{className:`blip absolute inset-0 rounded-full border border-status-running`},o):null}):null,e.flashNonce===void 0?null:(0,F.jsx)(`span`,{"aria-hidden":!0,className:`glow flash-terminal pointer-events-none absolute inset-0 rounded-md`,style:{"--glow-color":ut[n]??`var(--status-idle)`}},e.flashNonce)]})}function ft(e){switch(e.status){case`RUNNING`:return(0,F.jsx)(d,{className:`size-3.5 shrink-0 animate-spin text-status-running`});case`SUCCEEDED`:return(0,F.jsx)(`svg`,{viewBox:`0 0 16 16`,className:`size-3.5 shrink-0`,fill:`none`,"aria-hidden":`true`,children:(0,F.jsx)(`path`,{d:`M3 8.5 6.5 12 13 4.5`,pathLength:1,className:`stroke-draw stroke-status-succeeded`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`})});case`FAILED`:return(0,F.jsx)(c,{className:`size-3.5 shrink-0 text-status-failed`});case`CANCELLED`:return(0,F.jsx)(c,{className:`size-3.5 shrink-0 text-status-warn`});case`BLOCKED`:return(0,F.jsx)(s,{className:`size-3.5 shrink-0 text-status-blocked`});default:return(0,F.jsx)(ye,{className:`size-3.5 shrink-0 text-status-idle`})}}var Y=[{x:0,y:U},{x:H,y:0},{x:H,y:U*2}];function pt(){return(0,F.jsxs)(at,{width:440,height:212,children:[(0,F.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 overflow-visible`,width:440,height:212,children:[Y[1],Y[2]].map(e=>e!==void 0&&Y[0]!==void 0?(0,F.jsx)(`path`,{d:et(Y[0],e,null),fill:`none`,strokeWidth:1.5,strokeDasharray:`4 6`,className:`stroke-border`,opacity:.6},e.y):null)}),Y.map(e=>(0,F.jsxs)(`div`,{className:`absolute rounded-md border border-dashed`,style:{left:e.x,top:e.y,width:B,height:V},children:[(0,F.jsx)(`div`,{className:`mx-2.5 mt-3.5 h-2 w-24 rounded-sm bg-muted`}),(0,F.jsx)(`div`,{className:`mx-2.5 mt-2 h-2 w-16 rounded-sm bg-muted/60`})]},`${e.x}:${e.y}`))]})}function mt(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`}function X(e){return e===void 0?`—`:e<1e3?`${Math.round(e)}ms`:G(e)}function ht(e){if(e.error!==null)return(0,F.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot load metrics: `,e.error]});let t=e.metrics;if(t===void 0)return(0,F.jsx)(w,{className:`h-40 w-full`});let n=[{label:`TASK LATENCY`,dist:t.timing?.taskLatencyMs},{label:`QUEUE WAIT`,dist:t.timing?.queueWaitMs},{label:`ASSIGNMENT`,dist:t.timing?.assignmentDurationMs}],r=Math.max(1,...n.map(e=>e.dist?.max??0)),i=t.timing?.runDurationMs;return(0,F.jsxs)(`div`,{className:`grid gap-4`,children:[(0,F.jsxs)(`div`,{className:`grid gap-4 rounded-lg border bg-card p-4`,children:[(0,F.jsx)(`h3`,{className:`console-callout`,children:`Latency distributions`}),n.map(e=>(0,F.jsx)(gt,{label:e.label,dist:e.dist,scaleMax:r},e.label))]}),(0,F.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,F.jsx)(Z,{label:`Success rate`,rate:t.tasks?.successRate}),(0,F.jsx)(Z,{label:`Locality hit`,rate:t.locality?.localityHitRate}),(0,F.jsx)(Z,{label:`Compliance`,rate:t.policy?.complianceRate})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 lg:grid-cols-4`,children:[(0,F.jsx)(Q,{label:`Bytes moved`,value:mt(t.artifacts?.bytesTransferred??0)}),(0,F.jsx)(Q,{label:`Movements`,value:String(t.artifacts?.movementCount??0)}),(0,F.jsx)(Q,{label:`Policy denials`,value:String(t.policy?.denialCount??0)}),(0,F.jsx)(Q,{label:`Run duration`,value:typeof i==`number`?G(i):`—`})]})]})}function gt(e){let t=e.dist?.count??0,n=e.dist?.min,r=e.dist?.max,i=e.dist!==void 0&&t>0?e.dist.total/t:void 0,a=t=>e.scaleMax>0?Math.min(100,t/e.scaleMax*100):0;return(0,F.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,F.jsx)(`span`,{className:`console-callout`,children:e.label}),(0,F.jsxs)(`span`,{className:`font-mono text-[10px] text-muted-foreground`,"data-num":!0,children:[t,` SAMPLES`]})]}),(0,F.jsxs)(`div`,{className:`relative h-2 rounded-full bg-muted`,children:[n!==void 0&&r!==void 0?(0,F.jsx)(`div`,{className:`absolute inset-y-0 rounded-full bg-primary/30 transition-all duration-500 ease-out-fast`,style:{left:`${a(n)}%`,width:`${Math.max(a(r)-a(n),.5)}%`}}):null,i===void 0?null:(0,F.jsx)(`div`,{className:`absolute inset-y-0 w-[3px] rounded-full bg-primary transition-all duration-500 ease-out-fast`,style:{left:`calc(${a(i)}% - 1.5px)`}})]}),(0,F.jsxs)(`div`,{className:`flex justify-between font-mono text-[10px] text-muted-foreground`,"data-num":!0,children:[(0,F.jsx)(`span`,{children:X(n)}),(0,F.jsxs)(`span`,{children:[`μ `,X(i)]}),(0,F.jsx)(`span`,{children:X(r)})]})]})}function Z(e){let t=e.rate===void 0?void 0:Math.round(Math.min(1,Math.max(0,e.rate))*100);return(0,F.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border bg-card px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`relative size-11 shrink-0`,children:[(0,F.jsxs)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 44 44`,className:`size-11 -rotate-90`,children:[(0,F.jsx)(`circle`,{cx:22,cy:22,r:19,fill:`none`,strokeWidth:4,className:`stroke-muted`}),(0,F.jsx)(`circle`,{cx:22,cy:22,r:19,fill:`none`,strokeWidth:4,strokeLinecap:`round`,pathLength:100,strokeDasharray:100,strokeDashoffset:100-(t??0),className:a(`transition-[stroke-dashoffset] duration-500 ease-out-fast`,(t??0)>=90?`stroke-status-succeeded`:`stroke-status-warn`)})]}),(0,F.jsx)(`span`,{className:`absolute inset-0 grid place-items-center font-mono text-[10px]`,"data-num":!0,children:t===void 0?`—`:`${t}%`})]}),(0,F.jsx)(`span`,{className:`console-callout`,children:e.label})]})}function Q(e){return(0,F.jsxs)(`div`,{className:`rounded-lg border bg-card px-4 py-3`,"data-flash":_e(e.value),children:[(0,F.jsx)(`div`,{className:`console-callout`,children:e.label}),(0,F.jsx)(`div`,{className:`mt-1 font-mono text-xl font-medium`,"data-num":!0,children:e.value})]})}var _t=new Set([`SUCCEEDED`,`FAILED`,`CANCELLED`]),vt={RUNNING:`bg-status-running`,SUCCEEDED:`bg-status-succeeded`,FAILED:`bg-status-failed`,CANCELLED:`bg-status-warn`},yt=`repeating-linear-gradient(45deg, var(--status-idle) 0 3px, transparent 3px 6px)`,bt=`grid-cols-[minmax(8rem,12rem)_1fr_4.5rem]`;function $(e){if(e===void 0)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function xt(e){let t=(0,P.useMemo)(()=>{let t=e.tasks.map(e=>({task:e,queuedAt:$(e.queuedAt??e.createdAt),startedAt:$(e.startedAt),completedAt:$(e.completedAt)}));t.sort((e,t)=>(e.startedAt??e.queuedAt??2**53-1)-(t.startedAt??t.queuedAt??2**53-1)||e.task.taskId.localeCompare(t.task.taskId));let n=$(e.runCreatedAt)??2**53-1,r=0;for(let e of t)n=Math.min(n,e.queuedAt??e.startedAt??n),r=Math.max(r,e.completedAt??e.startedAt??e.queuedAt??0);return n===2**53-1&&(n=r>0?r:Date.now()),{rows:t,start:n,end:r}},[e.tasks,e.runCreatedAt]);if(e.pending)return(0,F.jsx)(`div`,{className:`rounded-lg border bg-card/40 p-4`,children:(0,F.jsx)(`div`,{className:`grid gap-2.5`,children:[0,1,2].map(e=>(0,F.jsxs)(`div`,{className:a(`grid items-center gap-3 px-1.5`,bt),children:[(0,F.jsx)(`div`,{className:`h-3 w-24 rounded-sm bg-muted`}),(0,F.jsx)(`div`,{className:`h-2 rounded-sm bg-muted/50`}),(0,F.jsx)(`div`,{className:`h-3 w-10 justify-self-end rounded-sm bg-muted`})]},e))})});if(t.rows.length===0)return(0,F.jsx)(`p`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No tasks in this run.`});let n=Date.now(),r=e.runActive?Math.max(t.end,n):Math.max(t.end,t.start+1),i=Math.max(1,r-t.start),o=e=>(e-t.start)/i*100;return(0,F.jsx)(`div`,{className:`rounded-lg border bg-card/40 p-4`,children:(0,F.jsx)(`div`,{className:`grid gap-1`,children:t.rows.map(t=>{let r=t.task.status,i=_t.has(r),s=t.startedAt??(i?t.completedAt??t.queuedAt:n),c=t.completedAt??(t.startedAt===void 0?void 0:n),l=t.startedAt!==void 0&&c!==void 0?c-t.startedAt:void 0;return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>e.onSelect(t.task.taskId),className:a(`grid w-full items-center gap-3 rounded-sm px-1.5 py-0.5 text-left hover:bg-accent/50`,bt),children:[(0,F.jsx)(`span`,{className:`truncate font-mono text-[11px]`,children:C(t.task)??t.task.taskId}),(0,F.jsxs)(`span`,{className:`relative block h-4`,children:[t.queuedAt!==void 0&&s!==void 0&&s>t.queuedAt?(0,F.jsx)(`span`,{className:`absolute inset-y-1 rounded-[1px]`,style:{left:`${o(t.queuedAt)}%`,width:`${Math.max(o(s)-o(t.queuedAt),.3)}%`,backgroundImage:yt}}):null,t.startedAt!==void 0&&c!==void 0?(0,F.jsx)(`span`,{className:a(`absolute inset-y-0.5 rounded-[2px]`,vt[r]??`bg-status-idle`),style:{left:`${o(t.startedAt)}%`,width:`${Math.max(o(c)-o(t.startedAt),.4)}%`}}):null]}),(0,F.jsx)(`span`,{className:`text-right font-mono text-[10px] text-muted-foreground`,"data-num":!0,children:l===void 0?`—`:G(l)})]},t.task.taskId)})})})}var St=[`SUCCEEDED`,`FAILED`,`CANCELLED`],Ct=new Set([`SUCCEEDED`,`FAILED`,`CANCELLED`,`STALLED`]),wt=40;function Tt(e){if(e===void 0)return;let t=Date.parse(e.createdAt),n=e.completedAt===void 0?Ct.has(e.state)?Date.parse(e.updatedAt):Date.now():Date.parse(e.completedAt);return Number.isFinite(t)&&Number.isFinite(n)?n-t:void 0}function Et(e){let t=te(e.runId),n=re(),r=se(e.runId),i=l(e.runId),a=le(e.runId),o=ae(e.runId),s=ce(),c=oe(),u=e.view,[d,f]=(0,P.useState)(null),[p,m]=(0,P.useState)(null),h=t.data?.state===`RUNNING`;pe(h?1e3:3e4);let g=r.data?.tasks??[],_=he(g),v=t=>c({to:`/runs/$runId/t/$taskId`,params:{runId:e.runId,taskId:t}}),y={};if(g.length>0)for(let e of g)y[e.status]=(y[e.status]??0)+1;else t.data?.taskStatusCounts!==void 0&&Object.assign(y,t.data.taskStatusCounts);let ne=Object.values(y).reduce((e,t)=>e+t,0),b=St.reduce((e,t)=>e+(y[t]??0),0),de=_e(b),x=Tt(t.data),S=t.data===void 0?void 0:ee(n.data?.projects??[],t.data),C=d??g.length<=wt,w=t.data!==void 0&&Ct.has(t.data.state);async function E(){if(t.data!==void 0&&window.confirm(`Delete "${t.data.name}" from run history?`)){m(null);try{await s.mutateAsync(e.runId),c({to:`/runs`})}catch(e){m(e instanceof Error?e.message:`Failed to delete run`)}}}return(0,F.jsxs)(`section`,{className:`grid gap-5`,children:[(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2`,children:[(0,F.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:t.data?.name??e.runId}),t.data?(0,F.jsx)(ge,{state:t.data.state,id:e.runId}):null,(0,F.jsx)(me,{counts:y,className:`h-2 w-40 max-w-md flex-1`,segmentClassName:`duration-300`}),(0,F.jsxs)(`span`,{className:`font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground`,"data-num":!0,"data-flash":de,children:[b,`/`,ne,` TASKS TERMINAL`]}),x===void 0?null:(0,F.jsxs)(`span`,{className:`font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground`,"data-num":!0,children:[G(x),` ELAPSED`]}),(0,F.jsxs)(`button`,{type:`button`,title:`Download the run history as NDJSON`,onClick:()=>{ue(`/v1/runs/${encodeURIComponent(e.runId)}/history.jsonl`,`${e.runId}.jsonl`).catch(()=>{})},className:`ml-auto flex items-center gap-1.5 rounded-md border px-2.5 py-1 font-mono text-[11px] tracking-[0.08em] text-muted-foreground uppercase transition-colors hover:bg-secondary/60 hover:text-foreground`,children:[(0,F.jsx)(be,{className:`size-3.5`}),`History`]}),(0,F.jsxs)(`button`,{type:`button`,title:w?`Delete this run from history`:`Delete is available after the run finishes`,disabled:!w||s.isPending,onClick:()=>{E()},className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1 font-mono text-[11px] tracking-[0.08em] text-destructive uppercase transition-colors hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-40`,children:[(0,F.jsx)(ie,{className:`size-3.5`}),s.isPending?`Deleting`:`Delete`]})]}),(0,F.jsxs)(`p`,{className:`font-mono text-xs text-muted-foreground`,children:[e.runId,S===void 0?null:(0,F.jsxs)(F.Fragment,{children:[` · `,S]}),t.data?(0,F.jsxs)(F.Fragment,{children:[` · created `,(0,F.jsx)(`span`,{title:t.data.createdAt,children:fe(t.data.createdAt)})]}):null]}),p?(0,F.jsx)(`p`,{className:`text-xs text-destructive`,children:p}):null]}),(0,F.jsxs)(He,{value:e.tab,onValueChange:e.onTabChange,children:[(0,F.jsxs)(We,{children:[(0,F.jsx)(R,{value:`overview`,children:`Overview`}),(0,F.jsxs)(R,{value:`artifacts`,children:[`Artifacts`,i.data?.artifacts.length?(0,F.jsx)(T,{variant:`secondary`,"data-num":!0,children:i.data.artifacts.length}):null]}),(0,F.jsx)(R,{value:`metrics`,children:`Metrics`}),(0,F.jsxs)(R,{value:`files`,children:[`Files`,o.data?.reservations.length?(0,F.jsx)(T,{variant:`secondary`,"data-num":!0,children:o.data.reservations.length}):null]})]}),(0,F.jsxs)(z,{value:`overview`,className:`grid min-w-0 gap-4 pt-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,F.jsx)(Dt,{active:u===`map`,onClick:()=>e.onViewChange(`map`),children:`Map`}),(0,F.jsx)(Dt,{active:u===`timeline`,onClick:()=>e.onViewChange(`timeline`),children:`Timeline`}),(0,F.jsx)(Dt,{active:u===`sandboxes`,onClick:()=>e.onViewChange(`sandboxes`),children:`By Sandbox`}),u!==`sandboxes`&&g.length>wt?(0,F.jsx)(`button`,{type:`button`,onClick:()=>f(!C),className:`ml-2 rounded-md border border-transparent px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.14em] text-muted-foreground hover:bg-secondary/60`,children:C?`Collapse`:`Expand (${g.length} tasks)`}):null]}),u===`sandboxes`?(0,F.jsxs)(`div`,{className:`grid gap-3`,children:[(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Tasks grouped by the sandbox assigned to run them. This is run context, not the global fleet page.`}),(0,F.jsx)(ve,{tasks:g,ordinals:_,pending:r.isPending,onSelect:v})]}):(0,F.jsxs)(F.Fragment,{children:[C&&!r.isError?u===`map`?(0,F.jsx)(nt,{tasks:g,ordinals:_,pending:r.isPending,selectedTaskId:null,onSelect:v}):(0,F.jsx)(xt,{tasks:g,pending:r.isPending,runCreatedAt:t.data?.createdAt,runActive:h,onSelect:v}):null,(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[(0,F.jsx)(`h2`,{className:`console-callout`,children:`Tasks`}),(0,F.jsx)(Ot,{tasks:g,ordinals:_,pending:r.isPending,error:r.isError?String(r.error):null,onOpen:v})]})]})]}),(0,F.jsx)(z,{value:`artifacts`,className:`pt-3`,children:(0,F.jsx)(Nt,{artifacts:i.data?.artifacts,error:i.isError?String(i.error):null})}),(0,F.jsx)(z,{value:`metrics`,className:`pt-3`,children:(0,F.jsx)(ht,{metrics:a.data,error:a.isError?String(a.error):null})}),(0,F.jsx)(z,{value:`files`,className:`pt-3`,children:(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[(0,F.jsx)(`h2`,{className:`console-callout`,children:`Active file reservations`}),(0,F.jsx)(kt,{reservations:o.data?.reservations,tasks:g,ordinals:_,pending:o.isPending,error:o.isError?String(o.error):null,onOpen:v})]})})]})]})}function Dt(e){return(0,F.jsx)(`button`,{type:`button`,onClick:e.onClick,className:a(`rounded-md border px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.14em] transition-state`,e.active?`border-primary/40 bg-secondary text-foreground`:`border-transparent text-muted-foreground hover:bg-secondary/60`),children:e.children})}function Ot(e){if(e.error!==null)return(0,F.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot load tasks: `,e.error]});let t=[...e.tasks].sort((t,n)=>(e.ordinals.get(t.taskId)??0)-(e.ordinals.get(n.taskId)??0));return(0,F.jsx)(S,{className:`py-0`,children:(0,F.jsx)(x,{className:`p-0`,children:(0,F.jsxs)(N,{children:[(0,F.jsx)(O,{children:(0,F.jsxs)(j,{children:[(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`#`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Task`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Status`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Workpad`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Sandbox`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Depends on`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Accepted`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Finished`}),(0,F.jsx)(k,{className:`console-callout pr-4 text-right text-muted-foreground`,children:`Open`})]})}),(0,F.jsx)(A,{children:e.pending?(0,F.jsx)(j,{children:[0,1,2,3,4,5,6,7,8].map(e=>(0,F.jsx)(M,{children:(0,F.jsx)(w,{className:`h-4 w-full max-w-28`})},e))}):t.map(t=>{let n=C(t);return(0,F.jsxs)(j,{className:`cursor-pointer`,onClick:()=>e.onOpen(t.taskId),children:[(0,F.jsxs)(M,{className:`font-mono text-xs text-muted-foreground`,"data-num":!0,children:[`#`,e.ordinals.get(t.taskId)]}),(0,F.jsx)(M,{children:(0,F.jsx)(`button`,{type:`button`,className:n===void 0?`block text-left font-mono text-xs hover:underline`:`block text-left text-sm font-medium hover:underline`,onClick:()=>e.onOpen(t.taskId),title:t.taskId,children:n??t.taskId})}),(0,F.jsx)(M,{children:(0,F.jsxs)(`div`,{className:`grid gap-1`,children:[(0,F.jsx)(ge,{state:t.status,id:t.taskId}),(0,F.jsx)(At,{task:t})]})}),(0,F.jsx)(M,{children:t.workpad?(0,F.jsxs)(T,{variant:`outline`,className:`font-mono text-[10px] uppercase tracking-[0.08em]`,title:`Updated ${t.workpad.updatedAt}`,children:[`v`,t.workpad.version,` ·`,` `,D(t.workpad.updatedAt)]}):(0,F.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:`—`})}),(0,F.jsx)(M,{className:`font-mono text-xs`,children:t.assignedSandboxId??t.lastSandboxId??`—`}),(0,F.jsx)(M,{className:`space-x-1`,children:t.dependsOn.length===0?`—`:t.dependsOn.map(t=>(0,F.jsxs)(T,{variant:`secondary`,className:`font-mono text-[11px]`,title:t,children:[`#`,e.ordinals.get(t)??`?`]},t))}),(0,F.jsx)(M,{className:`font-mono text-xs text-muted-foreground`,title:t.assignmentAcceptedAt,"data-num":!0,children:D(t.assignmentAcceptedAt)}),(0,F.jsx)(M,{className:`font-mono text-xs text-muted-foreground`,title:t.lastFinishedAt,"data-num":!0,children:D(t.lastFinishedAt)}),(0,F.jsx)(M,{className:`pr-4 text-right`,children:(0,F.jsxs)(g,{type:`button`,size:`xs`,variant:`outline`,title:`Open this task's workpad and agent transcript`,onClick:n=>{n.stopPropagation(),e.onOpen(t.taskId)},children:[(0,F.jsx)(o,{}),`Task`]})})]},t.taskId)})})]})})})}function kt(e){if(e.error!==null)return(0,F.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot load file reservations: `,e.error]});let t=e.reservations??[],n=new Map(e.tasks.map(e=>[e.taskId,e]));return!e.pending&&t.length===0?(0,F.jsx)(`p`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No active file reservations in this run.`}):(0,F.jsx)(S,{className:`py-0`,children:(0,F.jsx)(x,{className:`p-0`,children:(0,F.jsxs)(N,{className:`min-w-[960px] table-fixed`,children:[(0,F.jsxs)(`colgroup`,{children:[(0,F.jsx)(`col`,{style:{width:`22%`}}),(0,F.jsx)(`col`,{style:{width:`27%`}}),(0,F.jsx)(`col`,{style:{width:`13%`}}),(0,F.jsx)(`col`,{style:{width:`28%`}}),(0,F.jsx)(`col`,{style:{width:`10%`}})]}),(0,F.jsx)(O,{children:(0,F.jsxs)(j,{children:[(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Path`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Task`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Sandbox`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Reason`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Reserved`})]})}),(0,F.jsx)(A,{children:e.pending&&t.length===0?(0,F.jsx)(j,{children:[0,1,2,3,4].map(e=>(0,F.jsx)(M,{children:(0,F.jsx)(w,{className:`h-4 w-full max-w-28`})},e))}):t.map(t=>{let r=n.get(t.taskId),i=r?C(r):void 0;return(0,F.jsxs)(j,{children:[(0,F.jsx)(M,{className:`overflow-hidden`,children:(0,F.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,F.jsx)(T,{variant:`outline`,className:`shrink-0 font-mono text-[10px] uppercase`,children:t.selector.kind}),(0,F.jsx)(`div`,{className:`min-w-0 flex-1 overflow-x-auto whitespace-nowrap font-mono text-xs`,title:jt(t),children:t.selector.path})]})}),(0,F.jsxs)(M,{className:`overflow-hidden`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`block max-w-full truncate text-left text-sm font-medium hover:underline`,title:t.taskId,onClick:()=>e.onOpen(t.taskId),children:[e.ordinals.has(t.taskId)?`#${e.ordinals.get(t.taskId)} `:``,i??t.taskId]}),(0,F.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-muted-foreground`,children:t.assignmentId})]}),(0,F.jsx)(M,{className:`overflow-hidden truncate font-mono text-xs`,title:t.sandboxId,children:t.sandboxId}),(0,F.jsx)(M,{className:`overflow-hidden text-sm`,children:(0,F.jsx)(`div`,{className:`max-w-full overflow-x-auto whitespace-nowrap`,title:t.reason??`No reason`,children:t.reason??`No reason`})}),(0,F.jsx)(M,{className:`font-mono text-xs text-muted-foreground`,title:t.createdAt,"data-num":!0,children:D(t.createdAt)})]},t.reservationId)})})]})})})}function At(e){let t=e.task.live;if(!t)return null;let n=t.idleTimeout?.graceExpiresAt??t.idleTimeout?.expiresAt;return(0,F.jsxs)(`div`,{className:`flex max-w-56 flex-wrap items-center gap-1`,children:[t.state?.liveStatus===void 0?null:(0,F.jsx)(T,{variant:`outline`,className:`font-mono text-[10px] uppercase tracking-[0.08em]`,title:`Live task round state`,children:t.state.liveStatus}),t.latestRoundKey===void 0?null:(0,F.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted-foreground`,title:`Latest round ${t.latestRoundKey}`,children:t.latestRoundKey}),n===void 0?null:(0,F.jsxs)(T,{variant:`secondary`,className:`font-mono text-[10px] uppercase tracking-[0.08em]`,title:`Idle timeout ${n}`,children:[`idle `,D(n)]})]})}function jt(e){return`${e.selector.kind}:${e.selector.path}`}function Mt(e){return e===`allow`?`border-status-idle/40 text-status-idle`:e===`deny`?`border-status-failed/40 text-status-failed`:`border-status-warn/40 text-status-warn`}function Nt(e){let[t,n]=(0,P.useState)(null),[r,i]=(0,P.useState)(null);if(e.error!==null)return(0,F.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot load artifacts: `,e.error]});let o=e.artifacts??[];if(o.length===0)return(0,F.jsx)(`p`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No artifacts declared in this run.`});async function s(e){n(e.artifactId),i(null);try{await ue(`/v1/artifacts/${encodeURIComponent(e.artifactId)}/fetch`,Pt(e))}catch(e){i(e instanceof Error?e.message:String(e))}finally{n(null)}}return(0,F.jsxs)(`div`,{className:`grid gap-2`,children:[r===null?null:(0,F.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot download artifact: `,r]}),(0,F.jsx)(S,{className:`py-0`,children:(0,F.jsx)(x,{className:`p-0`,children:(0,F.jsxs)(N,{children:[(0,F.jsx)(O,{children:(0,F.jsxs)(j,{children:[(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Descriptor`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Kind`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Policy`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Size`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Locations`}),(0,F.jsx)(k,{className:`console-callout text-muted-foreground`,children:`Download`})]})}),(0,F.jsx)(A,{children:o.map(e=>{let n=e.locations.some(e=>It(e)),r=t===e.artifactId;return(0,F.jsxs)(j,{children:[(0,F.jsxs)(M,{children:[(0,F.jsx)(`div`,{className:`font-mono text-xs`,children:e.artifactId}),e.metadata===void 0?null:(0,F.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:zt(e.metadata)})]}),(0,F.jsx)(M,{children:(0,F.jsx)(T,{variant:`secondary`,className:`font-mono text-[10px] uppercase tracking-[0.08em]`,children:e.kind})}),(0,F.jsx)(M,{children:(0,F.jsx)(T,{variant:`outline`,className:a(`font-mono text-[10px] uppercase tracking-[0.08em]`,Mt(e.movementPolicy)),children:e.movementPolicy})}),(0,F.jsx)(M,{className:`font-mono text-xs text-muted-foreground`,"data-num":!0,children:e.sizeBytes===void 0?`—`:mt(e.sizeBytes)}),(0,F.jsx)(M,{className:`min-w-44`,children:(0,F.jsx)(Lt,{locations:e.locations})}),(0,F.jsx)(M,{children:n?(0,F.jsxs)(g,{type:`button`,size:`xs`,variant:`outline`,disabled:r,title:`Download artifact bytes through the control plane`,onClick:()=>void s(e),children:[(0,F.jsx)(be,{}),r?`Saving`:`Download`]}):(0,F.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,title:`This descriptor has no produced artifact bytes.`,children:`not produced`})})]},e.artifactId)})})]})})})]})}function Pt(e){return Ft(e.metadata)??e.locations.map(e=>Ft(e.metadata)).find(e=>e!==void 0)??e.artifactId}function Ft(e){for(let t of[`filename`,`fileName`,`name`,`path`,`relativePath`]){let n=e?.[t];if(typeof n!=`string`)continue;let r=n.split(/[\\/]/).filter(Boolean).at(-1);if(r!==void 0&&r.length>0)return r}}function It(e){return e.storageKind===`sandbox-local`&&e.bytesAvailable}function Lt(e){return e.locations.length===0?(0,F.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:`none`}):(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.locations.map(e=>(0,F.jsxs)(T,{variant:e.bytesAvailable?`outline`:`secondary`,className:a(`font-mono text-[10px] uppercase tracking-[0.08em]`,e.storageKind===`sandbox-local`&&e.bytesAvailable&&`border-status-succeeded/40 text-status-succeeded`),title:Rt(e),children:[e.storageKind,e.sandboxId?` · ${e.sandboxId}`:``,e.bytesAvailable?``:` · unavailable`]},e.artifactLocationId))})}function Rt(e){let t=[e.artifactLocationId,e.location,e.site,e.region,e.network,e.substrate,e.uri].filter(e=>typeof e==`string`);return t.length>0?t.join(` · `):e.storageKind}function zt(e){let t=Object.entries(e).filter(([e])=>e!==`clientScope`);return t.length===0?`descriptor`:t.slice(0,2).map(([e,t])=>`${e}=${Bt(t)}`).join(` · `)}function Bt(e){return typeof e==`string`||typeof e==`number`?String(e):typeof e==`boolean`?e?`true`:`false`:JSON.stringify(e)}export{Et as RunPage};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./utils-CBxvVKOM.js";import{t as i}from"./inbox-BVu38EN6.js";import{t as a}from"./x-Bdsfqbi3.js";import{J as o,M as s,O as c,et as l}from"./main-LpSDdT-S.js";import{a as u,i as d,n as f,r as p,t as m}from"./card-37qs8AAd.js";import{c as h,d as g,f as _,l as v,n as y,s as b,t as x,u as S}from"./bits-BOMPEHvv.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-WMIs2m3R.js";var k=e(t(),1),A=n(),j=[{label:`All`,value:void 0},{label:`Running`,value:`RUNNING`},{label:`Succeeded`,value:`SUCCEEDED`},{label:`Failed`,value:`FAILED`}];function M(e){let t=e.filter,n=o().data?.projects??[],i=e.projectKey===void 0?void 0:n.find(t=>t.projectKey===e.projectKey),c=e.projectKey===void 0?{state:t}:{state:t,projectKey:e.projectKey},u=l(e.projectKey===void 0?void 0:{projectKey:e.projectKey}),d=l(c),p=(u.data?.pages??[]).flatMap(e=>e.runs),h=(d.data?.pages??[]).flatMap(e=>e.runs);v();let g=(0,k.useRef)(null),y=new Set;if(g.current!==null)for(let e of h){if(g.current.has(e.runId))break;y.add(e.runId)}(0,k.useEffect)(()=>{if(d.isPending)return;let e=g.current??new Set;g.current=e;for(let t of h)e.add(t.runId)});let b=F(p);return(0,A.jsxs)(`section`,{className:`grid gap-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Runs`}),e.projectKey===void 0?null:(0,A.jsx)(_,{variant:`secondary`,children:i?.name??e.projectKey})]}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Every run your account can read, newest first.`})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,A.jsx)(P,{label:`Active runs`,hint:`of ${p.length} loaded`,value:String(p.filter(e=>e.state===`RUNNING`).length)}),(0,A.jsx)(P,{label:`Success rate`,hint:`of ${p.length} loaded`,value:b===void 0?`—`:`${b}%`,baseline:b??0})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[j.map(n=>(0,A.jsx)(s,{size:`sm`,"aria-pressed":t===n.value,variant:t===n.value?`secondary`:`ghost`,className:r(`h-7 px-2.5 font-mono text-xs uppercase tracking-[0.08em]`,t!==n.value&&`text-muted-foreground`),onClick:()=>e.onFilterChange(n.value),children:n.label},n.label)),e.projectKey===void 0?null:(0,A.jsxs)(s,{size:`sm`,variant:`ghost`,className:`h-7 px-2.5 font-mono text-xs uppercase tracking-[0.08em] text-muted-foreground`,onClick:()=>e.onProjectChange(void 0),children:[(0,A.jsx)(a,{className:`size-3`}),`All projects`]})]}),d.isError?(0,A.jsxs)(`p`,{className:`text-sm text-status-failed`,children:[`Cannot list runs: `,String(d.error)]}):h.length===0&&!d.isPending?(0,A.jsx)(L,{filtered:t!==void 0}):(0,A.jsx)(m,{className:`py-0`,children:(0,A.jsx)(f,{className:`p-0`,children:(0,A.jsxs)(O,{children:[(0,A.jsx)(C,{children:(0,A.jsxs)(E,{children:[(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Run`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Project`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`State`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Tasks`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Created`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Updated`})]})}),(0,A.jsx)(T,{children:d.isPending?(0,A.jsx)(I,{}):h.map(t=>(0,A.jsx)(N,{run:t,projects:n,rising:y.has(t.runId),onOpen:()=>e.onOpenRun(t.runId)},t.runId))})]})})}),d.hasNextPage?(0,A.jsx)(s,{variant:`outline`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:`Load more`}):null]})}function N(e){let t=S(e.run.updatedAt),n=c(e.projects,e.run);return(0,A.jsxs)(E,{"data-flash":t,className:r(`cursor-pointer`,e.rising&&`animate-in fade-in slide-in-from-bottom-1 duration-200`),onClick:e.onOpen,children:[(0,A.jsxs)(D,{className:`relative`,children:[t===void 0?null:(0,A.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0 left-0 w-[3px] bg-primary animate-out fade-out fill-mode-forwards duration-700`}),(0,A.jsx)(`button`,{type:`button`,className:`block text-left font-medium hover:underline`,onClick:e.onOpen,children:e.run.name}),(0,A.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground`,children:e.run.runId})]}),(0,A.jsx)(D,{children:(0,A.jsx)(`span`,{className:`block max-w-40 truncate font-mono text-xs text-muted-foreground`,title:n,children:n??`—`})}),(0,A.jsx)(D,{children:(0,A.jsx)(x,{state:e.run.state,id:e.run.runId})}),(0,A.jsx)(D,{children:(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,A.jsx)(`span`,{className:`font-mono text-xs`,"data-num":!0,children:b(e.run.taskStatusCounts)}),(0,A.jsx)(y,{counts:e.run.taskStatusCounts})]})}),(0,A.jsx)(D,{"data-num":!0,className:`font-mono text-xs text-muted-foreground`,title:e.run.createdAt,children:h(e.run.createdAt)}),(0,A.jsx)(D,{"data-num":!0,className:`font-mono text-xs text-muted-foreground`,title:e.run.updatedAt,children:h(e.run.updatedAt)})]})}function P(e){let t=S(e.value);return(0,A.jsx)(m,{className:`gap-1 py-4`,children:(0,A.jsxs)(d,{className:`gap-1.5 py-0`,children:[(0,A.jsxs)(p,{className:`console-callout`,children:[e.label,e.hint===void 0?null:(0,A.jsxs)(`span`,{className:`ml-1 opacity-70`,"data-num":!0,children:[`· `,e.hint]})]}),(0,A.jsx)(u,{"data-num":!0,"data-flash":t,className:`-mx-1 w-fit rounded-sm px-1 font-mono text-2xl font-medium`,children:e.value}),e.baseline===void 0?null:(0,A.jsx)(`div`,{"aria-hidden":!0,className:`h-px w-full bg-border`,children:(0,A.jsx)(`div`,{className:`h-full bg-status-succeeded transition-state`,style:{width:`${e.baseline}%`}})})]})})}function F(e){let t=e.filter(e=>[`SUCCEEDED`,`FAILED`,`CANCELLED`,`STALLED`].includes(e.state));if(t.length===0)return;let n=t.filter(e=>e.state===`SUCCEEDED`).length;return Math.round(n/t.length*100)}function I(){return(0,A.jsx)(A.Fragment,{children:[0,1,2].map(e=>(0,A.jsx)(E,{children:[0,1,2,3,4,5].map(e=>(0,A.jsx)(D,{children:(0,A.jsx)(g,{className:`h-4 w-full max-w-32`})},e))},e))})}function L(e){return(0,A.jsx)(m,{className:`py-12 text-center`,children:(0,A.jsxs)(f,{className:`grid justify-items-center gap-2`,children:[(0,A.jsx)(i,{className:`size-8 text-muted-foreground`}),(0,A.jsx)(`p`,{className:`font-medium`,children:e.filtered?`No runs match this filter`:`No runs yet`}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.filtered?`Try another state.`:`Create a run and it will appear here within a second.`})]})})}export{M as RunsPage};
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./utils-CBxvVKOM.js";import{t as i}from"./inbox-BVu38EN6.js";import{t as a}from"./x-Bdsfqbi3.js";import{M as o,O as s,Z as c,rt as l}from"./main-DVO9gWzi.js";import{a as u,i as d,n as f,r as p,t as m}from"./card-37qs8AAd.js";import{c as h,d as g,f as _,l as v,n as y,s as b,t as x,u as S}from"./bits-CTGNpp-v.js";import{a as C,i as w,n as T,o as E,r as D,t as O}from"./table-WMIs2m3R.js";var k=e(t(),1),A=n(),j=[{label:`All`,value:void 0},{label:`Running`,value:`RUNNING`},{label:`Succeeded`,value:`SUCCEEDED`},{label:`Failed`,value:`FAILED`}];function M(e){let t=e.filter,n=c().data?.projects??[],i=e.projectKey===void 0?void 0:n.find(t=>t.projectKey===e.projectKey),s=e.projectKey===void 0?{state:t}:{state:t,projectKey:e.projectKey},u=l(e.projectKey===void 0?void 0:{projectKey:e.projectKey}),d=l(s),p=(u.data?.pages??[]).flatMap(e=>e.runs),h=(d.data?.pages??[]).flatMap(e=>e.runs);v();let g=(0,k.useRef)(null),y=new Set;if(g.current!==null)for(let e of h){if(g.current.has(e.runId))break;y.add(e.runId)}(0,k.useEffect)(()=>{if(d.isPending)return;let e=g.current??new Set;g.current=e;for(let t of h)e.add(t.runId)});let b=F(p);return(0,A.jsxs)(`section`,{className:`grid gap-5`,children:[(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,A.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Runs`}),e.projectKey===void 0?null:(0,A.jsx)(_,{variant:`secondary`,children:i?.name??e.projectKey})]}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Every run your account can read, newest first.`})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,A.jsx)(P,{label:`Active runs`,hint:`of ${p.length} loaded`,value:String(p.filter(e=>e.state===`RUNNING`).length)}),(0,A.jsx)(P,{label:`Success rate`,hint:`of ${p.length} loaded`,value:b===void 0?`—`:`${b}%`,baseline:b??0})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[j.map(n=>(0,A.jsx)(o,{size:`sm`,"aria-pressed":t===n.value,variant:t===n.value?`secondary`:`ghost`,className:r(`h-7 px-2.5 font-mono text-xs uppercase tracking-[0.08em]`,t!==n.value&&`text-muted-foreground`),onClick:()=>e.onFilterChange(n.value),children:n.label},n.label)),e.projectKey===void 0?null:(0,A.jsxs)(o,{size:`sm`,variant:`ghost`,className:`h-7 px-2.5 font-mono text-xs uppercase tracking-[0.08em] text-muted-foreground`,onClick:()=>e.onProjectChange(void 0),children:[(0,A.jsx)(a,{className:`size-3`}),`All projects`]})]}),d.isError?(0,A.jsxs)(`p`,{className:`text-sm text-status-failed`,children:[`Cannot list runs: `,String(d.error)]}):h.length===0&&!d.isPending?(0,A.jsx)(L,{filtered:t!==void 0}):(0,A.jsx)(m,{className:`py-0`,children:(0,A.jsx)(f,{className:`p-0`,children:(0,A.jsxs)(O,{children:[(0,A.jsx)(C,{children:(0,A.jsxs)(E,{children:[(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Run`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Project`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`State`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Tasks`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Created`}),(0,A.jsx)(w,{className:`console-callout text-muted-foreground`,children:`Updated`})]})}),(0,A.jsx)(T,{children:d.isPending?(0,A.jsx)(I,{}):h.map(t=>(0,A.jsx)(N,{run:t,projects:n,rising:y.has(t.runId),onOpen:()=>e.onOpenRun(t.runId)},t.runId))})]})})}),d.hasNextPage?(0,A.jsx)(o,{variant:`outline`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:`Load more`}):null]})}function N(e){let t=S(e.run.updatedAt),n=s(e.projects,e.run);return(0,A.jsxs)(E,{"data-flash":t,className:r(`cursor-pointer`,e.rising&&`animate-in fade-in slide-in-from-bottom-1 duration-200`),onClick:e.onOpen,children:[(0,A.jsxs)(D,{className:`relative`,children:[t===void 0?null:(0,A.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0 left-0 w-[3px] bg-primary animate-out fade-out fill-mode-forwards duration-700`}),(0,A.jsx)(`button`,{type:`button`,className:`block text-left font-medium hover:underline`,onClick:e.onOpen,children:e.run.name}),(0,A.jsx)(`div`,{className:`font-mono text-xs text-muted-foreground`,children:e.run.runId})]}),(0,A.jsx)(D,{children:(0,A.jsx)(`span`,{className:`block max-w-40 truncate font-mono text-xs text-muted-foreground`,title:n,children:n??`—`})}),(0,A.jsx)(D,{children:(0,A.jsx)(x,{state:e.run.state,id:e.run.runId})}),(0,A.jsx)(D,{children:(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,A.jsx)(`span`,{className:`font-mono text-xs`,"data-num":!0,children:b(e.run.taskStatusCounts)}),(0,A.jsx)(y,{counts:e.run.taskStatusCounts})]})}),(0,A.jsx)(D,{"data-num":!0,className:`font-mono text-xs text-muted-foreground`,title:e.run.createdAt,children:h(e.run.createdAt)}),(0,A.jsx)(D,{"data-num":!0,className:`font-mono text-xs text-muted-foreground`,title:e.run.updatedAt,children:h(e.run.updatedAt)})]})}function P(e){let t=S(e.value);return(0,A.jsx)(m,{className:`gap-1 py-4`,children:(0,A.jsxs)(d,{className:`gap-1.5 py-0`,children:[(0,A.jsxs)(p,{className:`console-callout`,children:[e.label,e.hint===void 0?null:(0,A.jsxs)(`span`,{className:`ml-1 opacity-70`,"data-num":!0,children:[`· `,e.hint]})]}),(0,A.jsx)(u,{"data-num":!0,"data-flash":t,className:`-mx-1 w-fit rounded-sm px-1 font-mono text-2xl font-medium`,children:e.value}),e.baseline===void 0?null:(0,A.jsx)(`div`,{"aria-hidden":!0,className:`h-px w-full bg-border`,children:(0,A.jsx)(`div`,{className:`h-full bg-status-succeeded transition-state`,style:{width:`${e.baseline}%`}})})]})})}function F(e){let t=e.filter(e=>[`SUCCEEDED`,`FAILED`,`CANCELLED`,`STALLED`].includes(e.state));if(t.length===0)return;let n=t.filter(e=>e.state===`SUCCEEDED`).length;return Math.round(n/t.length*100)}function I(){return(0,A.jsx)(A.Fragment,{children:[0,1,2].map(e=>(0,A.jsx)(E,{children:[0,1,2,3,4,5].map(e=>(0,A.jsx)(D,{children:(0,A.jsx)(g,{className:`h-4 w-full max-w-32`})},e))},e))})}function L(e){return(0,A.jsx)(m,{className:`py-12 text-center`,children:(0,A.jsxs)(f,{className:`grid justify-items-center gap-2`,children:[(0,A.jsx)(i,{className:`size-8 text-muted-foreground`}),(0,A.jsx)(`p`,{className:`font-medium`,children:e.filtered?`No runs match this filter`:`No runs yet`}),(0,A.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.filtered?`Try another state.`:`Create a run and it will appear here within a second.`})]})})}export{M as RunsPage};
@@ -1 +1 @@
1
- import{m as e}from"./tiny-invariant-CO5X59di.js";import{t}from"./utils-CBxvVKOM.js";import{a as n,t as r}from"./bits-BOMPEHvv.js";var i=e();function a(e){if(e.pending)return(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`});let t=o(e.tasks);return t.length===0?(0,i.jsx)(`p`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No sandbox assignment activity yet.`}):(0,i.jsx)(`div`,{className:`grid min-w-0 gap-3 lg:grid-cols-2`,children:t.map(t=>(0,i.jsx)(s,{sandbox:t.sandbox,tasks:t.tasks,ordinals:e.ordinals,onSelect:e.onSelect},t.sandbox))})}function o(e){let t=new Map;for(let n of e){let e=n.assignedSandboxId??n.lastSandboxId??`unassigned`,r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.entries()].map(([e,t])=>({sandbox:e,tasks:t})).sort((e,t)=>e.sandbox===`unassigned`?1:t.sandbox===`unassigned`||e.sandbox<t.sandbox?-1:+(e.sandbox>t.sandbox))}function s(e){let a=e.tasks.some(e=>e.status===`RUNNING`),o=[...e.tasks].sort((t,n)=>(e.ordinals.get(t.taskId)??0)-(e.ordinals.get(n.taskId)??0));return(0,i.jsxs)(`div`,{className:`min-w-0 rounded-lg border bg-card/40 p-3`,children:[(0,i.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,i.jsx)(`span`,{className:t(`size-1.5 shrink-0 rounded-full`,a?`glow pulse-running animate-pulse bg-status-running`:`bg-status-idle`)}),(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-medium text-foreground`,children:e.sandbox}),(0,i.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,"data-num":!0,children:[e.tasks.length,` `,e.tasks.length===1?`task`:`tasks`]})]}),(0,i.jsx)(`div`,{className:`mt-2 grid min-w-0 gap-1`,children:o.map(t=>{let a=n(t);return(0,i.jsxs)(`button`,{type:`button`,onClick:()=>e.onSelect(t.taskId),className:`flex w-full min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 py-1 text-left transition-colors hover:bg-secondary/50`,children:[(0,i.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground`,"data-num":!0,children:[`#`,e.ordinals.get(t.taskId)]}),(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,title:a??t.taskId,children:a??t.taskId}),(0,i.jsx)(r,{state:t.status,id:t.taskId})]},t.taskId)})})]})}export{a as t};
1
+ import{m as e}from"./tiny-invariant-CO5X59di.js";import{t}from"./utils-CBxvVKOM.js";import{a as n,t as r}from"./bits-CTGNpp-v.js";var i=e();function a(e){if(e.pending)return(0,i.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Loading…`});let t=o(e.tasks);return t.length===0?(0,i.jsx)(`p`,{className:`py-6 text-center text-sm text-muted-foreground`,children:`No sandbox assignment activity yet.`}):(0,i.jsx)(`div`,{className:`grid min-w-0 gap-3 lg:grid-cols-2`,children:t.map(t=>(0,i.jsx)(s,{sandbox:t.sandbox,tasks:t.tasks,ordinals:e.ordinals,onSelect:e.onSelect},t.sandbox))})}function o(e){let t=new Map;for(let n of e){let e=n.assignedSandboxId??n.lastSandboxId??`unassigned`,r=t.get(e)??[];r.push(n),t.set(e,r)}return[...t.entries()].map(([e,t])=>({sandbox:e,tasks:t})).sort((e,t)=>e.sandbox===`unassigned`?1:t.sandbox===`unassigned`||e.sandbox<t.sandbox?-1:+(e.sandbox>t.sandbox))}function s(e){let a=e.tasks.some(e=>e.status===`RUNNING`),o=[...e.tasks].sort((t,n)=>(e.ordinals.get(t.taskId)??0)-(e.ordinals.get(n.taskId)??0));return(0,i.jsxs)(`div`,{className:`min-w-0 rounded-lg border bg-card/40 p-3`,children:[(0,i.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,i.jsx)(`span`,{className:t(`size-1.5 shrink-0 rounded-full`,a?`glow pulse-running animate-pulse bg-status-running`:`bg-status-idle`)}),(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs font-medium text-foreground`,children:e.sandbox}),(0,i.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,"data-num":!0,children:[e.tasks.length,` `,e.tasks.length===1?`task`:`tasks`]})]}),(0,i.jsx)(`div`,{className:`mt-2 grid min-w-0 gap-1`,children:o.map(t=>{let a=n(t);return(0,i.jsxs)(`button`,{type:`button`,onClick:()=>e.onSelect(t.taskId),className:`flex w-full min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 py-1 text-left transition-colors hover:bg-secondary/50`,children:[(0,i.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-muted-foreground`,"data-num":!0,children:[`#`,e.ordinals.get(t.taskId)]}),(0,i.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs`,title:a??t.taskId,children:a??t.taskId}),(0,i.jsx)(r,{state:t.status,id:t.taskId})]},t.taskId)})})]})}export{a as t};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{r,t as i}from"./utils-CBxvVKOM.js";import{t as a}from"./arrow-right-QzVbRzF_.js";import{t as o}from"./external-link-BWhbbPgy.js";import{t as s}from"./x-Bdsfqbi3.js";import{Ct as c,K as l,M as u,_t as d,bt as f,gt as p,it as m,nt as h,rt as g}from"./main-DVO9gWzi.js";import{n as _,t as v}from"./card-37qs8AAd.js";import{c as y,d as b,l as x,o as S,t as C}from"./bits-CTGNpp-v.js";import{a as w,i as T,n as E,o as D,r as O,t as k}from"./table-WMIs2m3R.js";import{t as A}from"./SandboxesLens-DPG87mUE.js";var j=r(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),M=e(t(),1),N=n();function P(e){let t=g();x();let n=(t.data?.pages??[]).flatMap(e=>e.runs),r=n.find(t=>t.runId===e.selectedRunId)??n[0];return(0,N.jsxs)(`section`,{className:`grid gap-5`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Sandboxes`}),(0,N.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Managed fleet state and sandbox placement by run.`})]}),(0,N.jsx)(F,{}),(0,N.jsx)(z,{runs:t,loadedRuns:n,selectedRun:r,onSelectRun:e.onSelectRun,onOpenRun:e.onOpenRun,onOpenTask:e.onOpenTask})]})}function F(){let e=m(),t=l(),[n,r]=(0,M.useState)(null),[a,o]=(0,M.useState)(null),[s,c]=(0,M.useState)(null);async function u(e){o(e.sandboxId),c(null);try{let n=await t.mutateAsync(e.sandboxId);r(null),c(R(n))}catch(t){c({tone:`error`,sandboxId:e.sandboxId,message:d(t)})}finally{o(null)}}let f=e.data?.sandboxes??[];return(0,N.jsx)(v,{className:`py-0`,children:(0,N.jsxs)(_,{className:`grid gap-3 p-4`,children:[(0,N.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:(0,N.jsxs)(`div`,{className:`min-w-0`,children:[(0,N.jsx)(`h2`,{className:`console-callout`,children:`Managed fleet`}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,"data-num":!0,children:e.isPending?`Loading`:`${f.length} sandboxes`})]})}),e.isError?(0,N.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot list managed sandboxes: `,String(e.error)]}):e.isPending?(0,N.jsx)(`div`,{className:`grid gap-2`,children:[0,1,2].map(e=>(0,N.jsx)(b,{className:`h-10 w-full`},e))}):f.length===0?(0,N.jsxs)(`div`,{className:`rounded-md border border-dashed py-8 text-center`,children:[(0,N.jsx)(j,{className:`mx-auto size-5 text-muted-foreground`}),(0,N.jsx)(`p`,{className:`mt-3 text-sm font-medium`,children:`No managed sandboxes`})]}):(0,N.jsxs)(k,{children:[(0,N.jsx)(w,{children:(0,N.jsxs)(D,{children:[(0,N.jsx)(T,{children:`Sandbox`}),(0,N.jsx)(T,{children:`Lifecycle`}),(0,N.jsx)(T,{children:`Liveness`}),(0,N.jsx)(T,{children:`Host`}),(0,N.jsx)(T,{children:`Updated`}),(0,N.jsx)(T,{className:`text-right`,children:`Delete`})]})}),(0,N.jsx)(E,{children:f.map(e=>(0,N.jsx)(I,{sandbox:e,confirming:n===e.sandboxId,pending:a===e.sandboxId,disabled:t.isPending,onRequestDelete:()=>{c(null),r(e.sandboxId)},onCancelDelete:()=>r(null),onConfirmDelete:()=>void u(e)},e.sandboxId))})]}),s?(0,N.jsxs)(`p`,{role:s.tone===`error`?`alert`:`status`,className:i(`text-xs`,s.tone===`error`?`text-destructive`:`text-muted-foreground`),children:[s.sandboxId?(0,N.jsxs)(`span`,{className:`font-mono`,"data-num":!0,children:[s.sandboxId,`:`,` `]}):null,s.message]}):null]})})}function I(e){let t=p(e.sandbox,e.pending,e.confirming);return(0,N.jsxs)(D,{children:[(0,N.jsxs)(O,{className:`max-w-[16rem]`,children:[(0,N.jsx)(`div`,{className:`truncate font-mono text-xs text-foreground`,title:e.sandbox.sandboxId,"data-num":!0,children:e.sandbox.sandboxId}),(0,N.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,title:e.sandbox.instanceId,"data-num":!0,children:e.sandbox.instanceId})]}),(0,N.jsx)(O,{children:(0,N.jsx)(C,{state:e.sandbox.status,id:e.sandbox.sandboxId})}),(0,N.jsx)(O,{children:(0,N.jsx)(C,{state:e.sandbox.sandboxStatus??`unknown`,id:e.sandbox.sandboxId})}),(0,N.jsxs)(O,{className:`max-w-[13rem]`,children:[(0,N.jsx)(`div`,{className:`truncate font-mono text-xs`,title:e.sandbox.hostId,"data-num":!0,children:e.sandbox.hostId}),e.sandbox.hostPoolId?(0,N.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,title:e.sandbox.hostPoolId,"data-num":!0,children:e.sandbox.hostPoolId}):null]}),(0,N.jsx)(O,{className:`font-mono text-[11px] text-muted-foreground`,title:e.sandbox.updatedAt,"data-num":!0,children:y(e.sandbox.updatedAt)}),(0,N.jsx)(O,{className:`text-right`,children:(0,N.jsx)(L,{action:t,cleanupQueued:e.sandbox.status===`deleting`,disabled:e.disabled,sandboxId:e.sandbox.sandboxId,onRequestDelete:e.onRequestDelete,onCancelDelete:e.onCancelDelete,onConfirmDelete:e.onConfirmDelete})})]})}function L(e){return e.action===`pending`?(0,N.jsxs)(u,{size:`xs`,variant:`outline`,disabled:!0,children:[(0,N.jsx)(c,{className:`size-3 animate-spin`}),`Deleting`]}):e.action===`confirm`?(0,N.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,N.jsxs)(u,{type:`button`,size:`xs`,variant:`destructive`,disabled:e.disabled,onClick:e.onConfirmDelete,children:[(0,N.jsx)(f,{className:`size-3`}),`Confirm delete`]}),(0,N.jsx)(u,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":`Cancel deleting ${e.sandboxId}`,title:`Cancel`,disabled:e.disabled,onClick:e.onCancelDelete,children:(0,N.jsx)(s,{className:`size-3`})})]}):e.action===`request`?(0,N.jsx)(u,{type:`button`,size:`icon-xs`,variant:`ghost`,"aria-label":`Delete stale managed sandbox ${e.sandboxId}`,title:`Delete stale sandbox`,disabled:e.disabled,onClick:e.onRequestDelete,children:(0,N.jsx)(f,{className:`size-3`})}):(0,N.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.cleanupQueued?`Cleanup queued`:`—`})}function R(e){return e.status===`cleanup_queued`?{tone:`info`,sandboxId:e.sandboxId,message:`Cleanup queued.`}:{tone:`info`,sandboxId:e.sandboxId,message:`Deleted.`}}function z(e){return(0,N.jsxs)(`div`,{className:`grid gap-3`,children:[(0,N.jsx)(`div`,{children:(0,N.jsx)(`h2`,{className:`console-callout`,children:`Run placement history`})}),e.runs.isError?(0,N.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot list runs: `,String(e.runs.error)]}):e.runs.isPending?(0,N.jsx)(B,{}):e.loadedRuns.length===0?(0,N.jsx)(V,{}):(0,N.jsxs)(`div`,{className:`grid min-w-0 gap-4 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[(0,N.jsx)(H,{runs:e.loadedRuns,selectedRunId:e.selectedRun?.runId,hasMore:e.runs.hasNextPage,loadingMore:e.runs.isFetchingNextPage,onLoadMore:()=>void e.runs.fetchNextPage(),onSelect:e.onSelectRun}),e.selectedRun?(0,N.jsx)(W,{run:e.selectedRun,onOpenRun:e.onOpenRun,onOpenTask:e.onOpenTask}):null]})]})}function B(){return(0,N.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[(0,N.jsx)(v,{className:`gap-2 p-3`,children:[0,1,2].map(e=>(0,N.jsx)(b,{className:`h-12 w-full`},e))}),(0,N.jsxs)(v,{className:`p-4`,children:[(0,N.jsx)(b,{className:`h-5 w-40`}),(0,N.jsx)(b,{className:`mt-4 h-32 w-full`})]})]})}function V(){return(0,N.jsxs)(`div`,{className:`rounded-lg border border-dashed py-12 text-center`,children:[(0,N.jsx)(j,{className:`mx-auto size-5 text-muted-foreground`}),(0,N.jsx)(`p`,{className:`mt-3 console-callout`,children:`No runs yet`}),(0,N.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Sandbox placement appears after your account has task runs.`})]})}function H(e){return(0,N.jsxs)(v,{className:`gap-2 p-2`,children:[(0,N.jsx)(`div`,{className:`px-2 py-1`,children:(0,N.jsx)(`h2`,{className:`console-callout`,children:`Recent runs`})}),(0,N.jsx)(`div`,{className:`grid gap-1`,children:e.runs.map(t=>(0,N.jsx)(U,{run:t,selected:t.runId===e.selectedRunId,onSelect:e.onSelect},t.runId))}),e.hasMore?(0,N.jsx)(`button`,{type:`button`,disabled:e.loadingMore,onClick:e.onLoadMore,className:`mt-1 rounded-md px-2 py-1.5 text-left font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground transition-colors hover:bg-secondary/60 disabled:cursor-wait disabled:opacity-60`,children:e.loadingMore?`Loading`:`Load more`}):null]})}function U(e){return(0,N.jsxs)(`button`,{type:`button`,"aria-pressed":e.selected,onClick:()=>e.onSelect(e.run.runId),className:i(`grid min-w-0 gap-1 rounded-md px-2 py-2 text-left transition-colors`,e.selected?`bg-secondary text-foreground`:`text-muted-foreground hover:bg-secondary/60 hover:text-foreground`),children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium`,children:e.run.name}),(0,N.jsx)(C,{state:e.run.state,id:e.run.runId})]}),(0,N.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 font-mono text-[11px]`,children:[(0,N.jsx)(`span`,{className:`truncate`,title:e.run.runId,children:e.run.runId}),(0,N.jsx)(`span`,{className:`shrink-0`,title:e.run.updatedAt,"data-num":!0,children:y(e.run.updatedAt)})]})]})}function W(e){let t=h(e.run.runId),n=t.data?.tasks??[],r=S(n);return(0,N.jsxs)(`div`,{className:`grid min-w-0 gap-3`,children:[(0,N.jsx)(v,{className:`py-0`,children:(0,N.jsxs)(_,{className:`flex min-w-0 flex-wrap items-center gap-3 p-4`,children:[(0,N.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,N.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,N.jsx)(`h2`,{className:`min-w-0 truncate text-base font-semibold`,children:e.run.name}),(0,N.jsx)(C,{state:e.run.state,id:e.run.runId})]}),(0,N.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-muted-foreground`,children:e.run.runId})]}),(0,N.jsxs)(`button`,{type:`button`,onClick:()=>e.onOpenRun(e.run.runId),className:`flex items-center gap-1.5 rounded-md border px-2.5 py-1 font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground`,children:[(0,N.jsx)(o,{className:`size-3.5`}),`Open run`]})]})}),t.isError?(0,N.jsxs)(`p`,{className:`text-sm text-destructive`,children:[`Cannot load tasks: `,String(t.error)]}):(0,N.jsx)(A,{tasks:n,ordinals:r,pending:t.isPending,onSelect:t=>e.onOpenTask(e.run.runId,t)}),!t.isPending&&n.length>0?(0,N.jsxs)(`button`,{type:`button`,onClick:()=>e.onOpenRun(e.run.runId),className:`inline-flex w-fit items-center gap-1.5 rounded-md px-2 py-1 font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground`,children:[`Open run by sandbox`,(0,N.jsx)(a,{className:`size-3.5`})]}):null]})}export{P as SandboxesPage};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./link-ll3nLBSM.js";import{r as i,t as a}from"./utils-CBxvVKOM.js";import{n as o,r as s,t as c}from"./lib-COfgMmRR.js";import{t as l}from"./save-Bte_1tnN.js";import{t as u}from"./x-Bdsfqbi3.js";import{M as d,at as f,ct as p,dt as m,lt as h,nt as ee,ot as g,ut as te,vt as _}from"./main-DVO9gWzi.js";import{a as v,d as y,f as b,l as x,o as ne,r as S,t as re}from"./bits-CTGNpp-v.js";var ie=i(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),C=i(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),w=i(`message-square-plus`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]),T=i(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),E=i(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),D=i(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),O=e(t(),1),k=n();function A(e){let t=M(e.outbound??[],e.session);if(e.session===null&&t.length===0)return(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.running?`Waiting for Pi session...`:`No Pi session.`});let n=e.session===null?[]:j(e.session.transcript);return n.length===0&&t.length===0?(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.running?`Waiting for Pi session...`:`Pi session has no transcript messages.`}):(0,k.jsxs)(`div`,{className:`grid gap-2.5`,children:[n.map(e=>e.kind===`message`?(0,k.jsx)(F,{text:e.text},e.key):e.kind===`user`?(0,k.jsx)(P,{text:e.text},e.key):e.kind===`tool`?(0,k.jsx)(L,{name:e.name,args:e.args,output:e.output,status:e.status},e.key):e.kind===`thinking`?(0,k.jsx)(R,{text:e.text},e.key):(0,k.jsx)(ae,{level:e.level,text:e.text},e.key)),t.map(e=>(0,k.jsx)(P,{text:e.text,label:`${e.mode===`steer`?`Steer`:`Follow up`} · ${N(e.status)}`,muted:e.status!==`accepted`},e.id)),e.running?(0,k.jsx)(`span`,{className:`caret-blink inline-block h-3.5 w-2 bg-primary`}):null]})}function j(e){let t=[];for(let n of e)switch(n.kind){case`user_message`:t.push({kind:`user`,key:n.id,text:n.text});break;case`assistant_message`:t.push({kind:`message`,key:n.id,text:n.text});break;case`assistant_thinking`:t.push({kind:`thinking`,key:n.id,text:n.text});break;case`tool`:t.push({kind:`tool`,key:n.id,name:n.name,args:n.argsText??(n.args===void 0?void 0:JSON.stringify(n.args)),output:n.resultText,status:n.status===`unknown`?`running`:n.status});break;case`system_notice`:t.push({kind:`system`,key:n.id,level:n.level,text:n.text});break}return t}function M(e,t){return t===null?e:e.filter(e=>!t.transcript.some(t=>t.kind===`user_message`&&t.text===e.text))}function N(e){switch(e){case`sending`:return`sending`;case`accepted`:return`sent to agent`;case`failed`:return`failed`}}function P(e){return(0,k.jsxs)(`div`,{className:a(`ml-auto max-w-[92%] rounded-md px-3.5 py-2.5 text-sm leading-relaxed`,e.muted?`border bg-card/60 text-foreground`:`bg-primary text-primary-foreground`),children:[e.label===void 0?null:(0,k.jsx)(`div`,{className:a(`mb-1 font-mono text-[10px] uppercase tracking-[0.08em]`,e.muted?`text-muted-foreground`:`text-primary-foreground/70`),children:e.label}),(0,k.jsx)(`pre`,{className:`max-h-[24rem] overflow-auto font-sans break-words whitespace-pre-wrap`,children:e.text})]})}function F(e){return(0,k.jsx)(`div`,{className:`rounded-md border bg-card/40 px-3.5 py-2.5 text-sm leading-relaxed`,children:(0,k.jsx)(`div`,{className:`transcript-md`,children:(0,k.jsx)(o,{remarkPlugins:[c],components:se,children:e.text})})})}var I={running:`bg-status-running`,ok:`bg-status-succeeded`,error:`bg-status-failed`};function L(e){return(0,k.jsxs)(`details`,{className:`group rounded-md border bg-muted/30`,children:[(0,k.jsxs)(`summary`,{className:`flex w-full cursor-pointer list-none items-center gap-2 px-3 py-1.5 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:ring-[3px] focus-visible:ring-ring/40 [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(s,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-open:rotate-90`}),(0,k.jsx)(`span`,{className:a(`size-1.5 shrink-0 rounded-full`,I[e.status],e.status===`running`&&`animate-pulse`)}),(0,k.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:`used`}),(0,k.jsx)(`span`,{className:`font-mono text-xs font-medium text-foreground`,children:e.name})]}),e.args===void 0?null:(0,k.jsx)(`pre`,{className:`overflow-x-auto border-t px-3 py-2 font-mono text-[11px] break-all whitespace-pre-wrap text-muted-foreground`,children:e.args}),e.output===void 0?null:(0,k.jsx)(`pre`,{className:`max-h-64 overflow-auto border-t bg-background/40 px-3 py-2 font-mono text-[11px] break-words whitespace-pre-wrap text-foreground/80`,children:e.output})]})}function R(e){return(0,k.jsxs)(`details`,{className:`group rounded-md border border-dashed bg-muted/20`,children:[(0,k.jsxs)(`summary`,{className:`flex w-full cursor-pointer list-none items-center gap-2 px-3 py-1.5 text-left outline-none transition-colors hover:bg-muted/35 focus-visible:ring-[3px] focus-visible:ring-ring/40 [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(s,{className:`size-3 shrink-0 text-muted-foreground transition-transform group-open:rotate-90`}),(0,k.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:`thinking`})]}),(0,k.jsx)(`pre`,{className:`max-h-64 overflow-auto border-t px-3 py-2 font-mono text-[11px] break-words whitespace-pre-wrap text-foreground/75`,children:e.text})]})}function ae(e){return(0,k.jsx)(`div`,{className:a(`px-1 font-mono text-[11px]`,e.level===`error`?`text-status-failed`:e.level===`warn`?`text-status-warn`:`text-muted-foreground/70`),children:e.text})}var oe=/^(https?:|mailto:)/i,se={a({href:e,children:t}){return e===void 0||!oe.test(e)?(0,k.jsx)(`span`,{children:t}):(0,k.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:t})},img({alt:e}){return(0,k.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground`,children:[`image blocked`,e?`: ${e}`:``]})}},ce=new Set([`SUCCEEDED`,`FAILED`,`CANCELLED`]);function le(e){let t=ee(e.runId),[n,i]=(0,O.useState)([]),o=(0,O.useRef)(null),[s,c]=(0,O.useState)(!0),l=t.data?.tasks??[],u=ne(l),f=[...l].sort((e,t)=>(u.get(e.taskId)??0)-(u.get(t.taskId)??0)),g=f.findIndex(t=>t.taskId===e.taskId),_=g>=0?f[g]:void 0,C=g>0?f[g-1]:void 0,w=g>=0&&g<f.length-1?f[g+1]:void 0,T=_?.status===`RUNNING`,E=_!==void 0&&ce.has(_.status),D=e.transcriptMode,A=h(_===void 0?null:e.taskId,T),j=te(_===void 0?null:e.taskId,D===`raw`,T),M=m(_===void 0?null:e.taskId,T),N=p(_===void 0?null:e.taskId,T);x(T?1e3:3e4);let P=_===void 0?void 0:v(_),F=g>=0?g+1:void 0,I=A.data??null;(0,O.useEffect)(()=>{e.taskId.length>0&&(c(!0),i([]))},[e.taskId]),(0,O.useEffect)(()=>{if(!s)return;let e=requestAnimationFrame(()=>{let e=o.current;e&&(e.scrollTop=e.scrollHeight)});return()=>cancelAnimationFrame(e)});function L(){let e=o.current;e&&c(we(e))}function R(){let e=o.current;e&&(e.scrollTop=e.scrollHeight,c(!0))}return t.isError?(0,k.jsxs)(`p`,{className:`text-sm text-status-failed`,children:[`Cannot load this run: `,String(t.error)]}):_===void 0&&!t.isPending?(0,k.jsxs)(`div`,{className:`grid gap-3`,children:[(0,k.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`No task `,(0,k.jsx)(`span`,{className:`font-mono`,children:e.taskId}),` in this run.`]}),(0,k.jsx)(r,{to:`/runs/$runId`,params:{runId:e.runId},className:`font-mono text-xs text-primary hover:underline`,children:`← back to run`})]}):(0,k.jsxs)(`section`,{className:`flex h-[calc(100dvh-3.5rem-3rem)] min-h-[32rem] flex-col gap-4`,children:[(0,k.jsxs)(`div`,{className:`grid shrink-0 gap-3`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[F===void 0?null:(0,k.jsxs)(`span`,{className:`font-mono text-sm text-muted-foreground`,"data-num":!0,children:[`#`,F]}),(0,k.jsx)(`h1`,{className:a(`text-lg font-semibold tracking-tight`,P===void 0&&`font-mono text-base`),children:P??e.taskId}),_===void 0?null:(0,k.jsx)(re,{state:_.status,id:_.taskId}),(0,k.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[F===void 0?null:(0,k.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground tabular-nums`,"data-num":!0,children:[F,` / `,l.length]}),(0,k.jsx)(Z,{dir:`prev`,runId:e.runId,task:C}),(0,k.jsx)(Z,{dir:`next`,runId:e.runId,task:w})]})]}),_===void 0?(0,k.jsx)(y,{className:`h-12 w-full max-w-xl`}):(0,k.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-1.5 sm:grid-cols-3`,children:[(0,k.jsx)(Q,{label:`sandbox`,value:_.assignedSandboxId??_.lastSandboxId??`—`}),(0,k.jsx)(Q,{label:`attempt`,value:String(_.currentAttemptNumber??_.attemptCount??`—`),num:!0}),(0,k.jsx)(Q,{label:`agent`,value:_.agentId}),(0,k.jsx)(Q,{label:`accepted`,value:S(_.assignmentAcceptedAt),num:!0}),(0,k.jsx)(Te,{heartbeatAt:_.assignmentHeartbeatAt,running:_.status===`RUNNING`}),(0,k.jsx)(Q,{label:`finished`,value:S(_.lastFinishedAt),num:!0})]}),_!==void 0&&_.dependsOn.length>0?(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,k.jsx)(`span`,{className:`console-callout`,children:`depends on`}),_.dependsOn.map(t=>(0,k.jsx)(r,{to:`/runs/$runId/t/$taskId`,params:{runId:e.runId,taskId:t},title:t,children:(0,k.jsxs)(b,{variant:`secondary`,className:`font-mono text-[11px] transition-colors hover:bg-secondary/70`,children:[`#`,u.get(t)??`?`]})},t))]}):null]}),(0,k.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-4 lg:grid-cols-[minmax(0,1fr)_minmax(22rem,0.86fr)]`,children:[(0,k.jsx)(`section`,{className:`min-h-0 overflow-y-auto pr-2`,"aria-label":`Task and workpad`,children:(0,k.jsxs)(`div`,{className:`grid gap-3 pb-4`,children:[(0,k.jsx)(de,{task:_}),(0,k.jsx)(V,{taskId:_===void 0?null:e.taskId,workpad:M.data??null,pending:_===void 0||M.isPending,error:M.isError?String(M.error):null},_?.taskId??e.taskId),(0,k.jsx)(fe,{activity:N.data?.activity??[],pending:N.isPending,error:N.isError?String(N.error):null})]})}),(0,k.jsxs)(`section`,{className:`flex min-h-[28rem] min-w-0 flex-col rounded-md border bg-card/35`,"aria-label":`Agent transcript`,children:[(0,k.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b px-3 py-2`,children:[(0,k.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,k.jsx)(`h2`,{className:`console-callout`,children:`Agent transcript`}),T?(0,k.jsx)(b,{variant:`secondary`,className:`font-mono text-[11px]`,children:`live`}):null,I===null?null:(0,k.jsxs)(`span`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:[I.session.lineCount,` lines ·`,` `,Se(I.session.sizeBytes),I.session.threadId?` · thread ${I.session.threadId}`:``]})]}),(0,k.jsxs)(`div`,{className:`ml-auto flex rounded-md border bg-background p-0.5`,children:[(0,k.jsx)(G,{active:D===`parsed`,onClick:()=>e.onTranscriptModeChange(`parsed`),children:`Parsed`}),(0,k.jsx)(G,{active:D===`raw`,onClick:()=>e.onTranscriptModeChange(`raw`),children:`Raw`})]})]}),(0,k.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[(0,k.jsx)(`div`,{ref:o,onScroll:L,className:`h-full overflow-y-auto p-3`,children:D===`raw`?(0,k.jsx)(_e,{raw:j.data??null,pending:j.isPending,error:j.isError?String(j.error):null,running:T,terminal:E,expectsSession:_!==void 0&&K(_)}):(0,k.jsx)(ge,{session:I,error:I===null&&A.isError?String(A.error):null,pending:I===null&&A.isPending,running:T,terminal:E,expectsSession:_!==void 0&&K(_),outbound:n})}),s?null:(0,k.jsxs)(d,{type:`button`,size:`xs`,variant:`secondary`,className:`absolute right-3 bottom-3 shadow-md`,onClick:R,children:[(0,k.jsx)(ie,{className:`size-3`}),`Jump to latest`]})]}),(0,k.jsx)(`div`,{className:`shrink-0 border-t bg-background/95 p-3`,children:(0,k.jsx)(ue,{taskId:_===void 0?null:e.taskId,running:T,supported:_!==void 0,onMessageQueued:e=>{i(t=>[...t,e])},onMessageStatus:(e,t)=>{i(n=>n.map(n=>n.id===e?{...n,status:t}:n))}},_?.taskId??e.taskId)})]})]})]})}function ue(e){let[t,n]=(0,O.useState)(`follow_up`),[r,i]=(0,O.useState)(``),a=g(e.taskId),o=e.supported&&e.running&&e.taskId!==null&&r.trim().length>0&&!a.isPending;async function s(){let n=r.trim();if(!o||n.length===0)return;let s=`local-${Date.now()}-${Math.random().toString(16).slice(2)}`;e.onMessageQueued({id:s,mode:t,text:n,status:`sending`}),i(``);try{await a.mutateAsync({mode:t,message:n}),e.onMessageStatus(s,`accepted`)}catch{e.onMessageStatus(s,`failed`),i(n)}}return(0,k.jsxs)(`section`,{className:`grid gap-2 rounded-md border bg-card/35 p-2.5`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,k.jsxs)(d,{type:`button`,variant:t===`follow_up`?`secondary`:`ghost`,size:`xs`,onClick:()=>n(`follow_up`),children:[(0,k.jsx)(w,{className:`size-3.5`}),`Follow up`]}),(0,k.jsxs)(d,{type:`button`,variant:t===`steer`?`secondary`:`ghost`,size:`xs`,onClick:()=>n(`steer`),children:[(0,k.jsx)(E,{className:`size-3.5`}),`Steer`]})]}),(0,k.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,k.jsx)(`textarea`,{value:r,onChange:e=>i(e.currentTarget.value),placeholder:e.supported?e.running?t===`follow_up`?`Add a follow-up message…`:`Steer the agent…`:`Task is no longer running.`:`No task selected.`,disabled:!e.supported||!e.running,"aria-label":t===`follow_up`?`Follow-up message`:`Steer message`,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),s())},className:`min-h-16 flex-1 resize-y rounded-md border bg-background px-3 py-2 text-sm leading-relaxed outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50`}),(0,k.jsx)(d,{type:`button`,size:`icon-sm`,disabled:!o,onClick:()=>void s(),"aria-label":`Send agent message`,title:e.supported?e.running?`Send to running agent`:`Task is not running.`:`No task selected.`,children:(0,k.jsx)(D,{className:`size-4`})})]}),a.isError?(0,k.jsx)(`p`,{className:`text-xs text-destructive`,children:String(a.error)}):null]})}function de(e){if(e.task===void 0)return(0,k.jsx)(y,{className:`h-24 w-full`});let t=ye(e.task),n=ve(e.task),r=xe(e.task.input),i=t.bodyMarkdown;return(0,k.jsxs)(`section`,{className:`rounded-md border bg-card/45 p-3`,children:[(0,k.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,k.jsx)(`h2`,{className:`console-callout`,children:`Task`}),t.title===void 0?null:(0,k.jsx)(`span`,{className:`text-sm font-medium`,children:t.title})]}),i===void 0?(0,k.jsx)(`p`,{className:`mb-3 rounded-md border border-dashed bg-background/40 p-3 text-sm text-muted-foreground`,children:`No task description was provided for this task.`}):(0,k.jsx)(`div`,{className:`mb-3 rounded-md border bg-background/60 p-3`,children:(0,k.jsx)(U,{markdown:i})}),t.acceptanceCriteria.length>0?(0,k.jsxs)(`div`,{className:`mb-3`,children:[(0,k.jsx)(`h3`,{className:`console-callout mb-1.5`,children:`Acceptance criteria`}),(0,k.jsx)(`ul`,{className:`grid gap-1 text-sm`,children:Ce(t.acceptanceCriteria).map(e=>(0,k.jsxs)(`li`,{className:`flex gap-2`,children:[(0,k.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-muted-foreground/60`}),(0,k.jsx)(`span`,{children:e.text})]},e.key))})]}):null,(0,k.jsxs)(`dl`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2`,children:[n===void 0?null:(0,k.jsx)(W,{label:`adapter`,value:n}),e.task.live?.state?.liveStatus===void 0?null:(0,k.jsx)(W,{label:`live state`,value:e.task.live.state.liveStatus}),e.task.live?.latestRoundKey===void 0?null:(0,k.jsx)(W,{label:`latest round`,value:e.task.live.latestRoundKey}),e.task.live?.idleTimeout===void 0?null:(0,k.jsx)(W,{label:`idle timeout`,value:B(e.task)}),t.workspaceKey===void 0?null:(0,k.jsx)(W,{label:`project key`,value:t.workspaceKey}),t.externalSource?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(W,{label:`source`,value:be(t.externalSource)}),(0,k.jsx)(W,{label:`source url`,value:t.externalSource.url??`—`,href:X(t.externalSource.url)})]}):null]}),(0,k.jsx)(z,{task:e.task}),r===void 0?null:(0,k.jsxs)(`details`,{className:`mt-3 rounded-md border bg-background/60`,children:[(0,k.jsx)(`summary`,{className:`cursor-pointer px-3 py-2 font-mono text-[11px] uppercase tracking-[0.12em] text-muted-foreground`,children:`Adapter input`}),(0,k.jsx)(`pre`,{className:`max-h-48 overflow-auto border-t px-3 py-2 text-xs whitespace-pre-wrap`,children:r})]})]})}function z(e){let t=e.task.live?.rounds??[];if(t.length===0)return null;let n=[...t].sort((e,t)=>e.sequence-t.sequence);return(0,k.jsxs)(`div`,{className:`mt-3`,children:[(0,k.jsx)(`h3`,{className:`console-callout mb-1.5`,children:`Round history`}),(0,k.jsx)(`ol`,{className:`grid gap-2`,children:n.map(e=>(0,k.jsxs)(`li`,{className:`rounded-md border bg-background/60 p-2`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,k.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:[`#`,e.sequence]}),(0,k.jsx)(`span`,{className:`font-mono text-xs font-medium`,children:e.roundKey}),(0,k.jsx)(b,{variant:`outline`,className:`font-mono text-[10px] uppercase tracking-[0.08em]`,children:e.status}),e.completedAt===void 0?(0,k.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:S(e.promptedAt)}):(0,k.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:S(e.completedAt)})]}),e.summary!==void 0||e.terminalReason!==void 0?(0,k.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.summary,e.terminalReason].filter(e=>!!e).join(` · `)}):null,e.outputs!==void 0&&e.outputs.length>0?(0,k.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:e.outputs.map(t=>(0,k.jsxs)(`a`,{href:t.href,className:`inline-flex items-center gap-1 rounded-sm border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground`,title:`${t.kind} output ${t.outputKey}`,children:[t.outputKey,(0,k.jsx)(`span`,{className:`text-[10px] uppercase`,children:t.kind})]},`${e.roundKey}:${t.outputKey}`))}):null]},`${e.sequence}:${e.roundKey}`))})]})}function B(e){let t=e.live?.idleTimeout;if(!t)return`—`;let n=t.graceExpiresAt??t.expiresAt;return[t.action,n?S(n):void 0].filter(e=>!!e).join(` · `)}function V(e){let t=f(e.taskId),[n,r]=(0,O.useState)(!1),[i,a]=(0,O.useState)(``),[o,s]=(0,O.useState)(null),c=e.workpad?.bodyMarkdown??``;(0,O.useEffect)(()=>{n||a(c)},[c,n]);async function p(){if(e.taskId!==null)try{await t.mutateAsync({bodyMarkdown:i,baseVersion:o?.version??e.workpad?.version??0}),r(!1),s(null)}catch{}}let m=e.taskId!==null&&e.workpad!==null&&!e.pending&&e.error===null,h=m&&o!==null&&i!==o.body&&!t.isPending;return(0,k.jsxs)(`section`,{className:`rounded-md border bg-card/45 p-3`,children:[(0,k.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:[(0,k.jsx)(`h2`,{className:`console-callout`,children:`Workpad`}),e.workpad?(0,k.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,"data-num":!0,children:[`v`,e.workpad.version,` · updated`,` `,S(e.workpad.updatedAt)]}):null,(0,k.jsx)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:n?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(d,{type:`button`,size:`xs`,variant:`ghost`,disabled:t.isPending,onClick:()=>{a(c),s(null),r(!1)},children:[(0,k.jsx)(u,{className:`size-3`}),`Cancel`]}),(0,k.jsxs)(d,{type:`button`,size:`xs`,disabled:!h,onClick:()=>void p(),children:[(0,k.jsx)(l,{className:`size-3`}),t.isPending?`Saving`:`Save`]})]}):(0,k.jsxs)(d,{type:`button`,size:`xs`,variant:`outline`,disabled:!m,onClick:()=>{a(c),s({body:c,version:e.workpad?.version??0}),r(!0)},children:[(0,k.jsx)(T,{className:`size-3`}),e.workpad===null?`Write`:`Edit`]})})]}),e.error===null?e.pending?(0,k.jsx)($,{}):n?(0,k.jsx)(`textarea`,{value:i,onChange:e=>a(e.currentTarget.value),rows:10,className:`min-h-56 w-full resize-y rounded-md border bg-background px-3 py-2 font-mono text-sm leading-relaxed outline-none transition-colors placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/40`,placeholder:`Write the task workpad…`}):e.workpad===null?(0,k.jsx)(`p`,{className:`rounded-md border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive`,children:`Workpad missing for this task.`}):(0,k.jsx)(U,{markdown:e.workpad.bodyMarkdown}):(0,k.jsx)(`p`,{className:`text-sm text-destructive`,children:e.error}),t.isError?(0,k.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:he(t.error)}):null]})}function fe(e){return(0,k.jsxs)(`section`,{className:`rounded-md border bg-card/45 p-3`,children:[(0,k.jsx)(`div`,{className:`mb-2 flex items-center gap-2`,children:(0,k.jsx)(`h2`,{className:`console-callout`,children:`Activity`})}),e.error===null?e.pending?(0,k.jsx)($,{}):e.activity.length===0?(0,k.jsx)(`p`,{className:`rounded-md border border-dashed bg-background/40 p-3 text-sm text-muted-foreground`,children:`No task activity yet.`}):(0,k.jsx)(`ol`,{className:`grid gap-2`,children:e.activity.map(e=>(0,k.jsxs)(`li`,{className:`rounded-md border bg-background/50 p-2`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,k.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:S(e.createdAt)}),(0,k.jsx)(`span`,{className:`font-mono text-xs font-medium`,children:pe(e)}),(0,k.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground`,children:[e.actorKind,e.actorId?` · ${e.actorId}`:``]})]}),H(e)?(0,k.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:H(e)}):null]},e.activityId))}):(0,k.jsx)(`p`,{className:`text-sm text-destructive`,children:e.error})]})}function pe(e){switch(e.type){case`workpad.updated`:return`updated workpad`;case`human_input.queued`:return e.data?.mode===`steer`?`queued steer`:`queued follow-up`;case`live_round.prompted`:return`round prompt`;case`live_round.steer_queued`:return`round steer`;case`live_round.completed`:return`round completed`;case`live_round.failed`:return`round failed`;case`live_round.cancelled`:return`round cancelled`;case`live_round.finish_requested`:return`finish requested`;default:return e.type}}function H(e){if(e.type===`workpad.updated`){let t=e.data?.version;return typeof t==`number`?`workpad v${t}`:void 0}if(e.type===`human_input.queued`){let t=e.data?.messagePreview;return typeof t==`string`?t:void 0}if(e.type.startsWith(`live_round.`))return me(e)}function me(e){let t=[],n=e.data?.roundKey;typeof n==`string`&&t.push(n);let r=e.data?.childKey;typeof r==`string`&&t.push(r);let i=e.data?.summary;typeof i==`string`&&t.push(i);let a=e.data?.terminalReason;typeof a==`string`&&t.push(a);let o=e.data?.messagePreview;typeof o==`string`&&t.push(o);let s=e.data?.outputKeys;return Array.isArray(s)&&s.length>0&&t.push(`outputs ${s.join(`, `)}`),t.length>0?t.join(` · `):void 0}function he(e){return e instanceof _&&e.status===409?`Workpad changed since you started editing. Cancel and reopen to review the latest version before saving.`:String(e)}function U(e){let t=e.markdown.replace(/^<!--\s*flakes:task-workpad:v1\s*-->\s*/,``);return(0,k.jsx)(`div`,{className:`space-y-3 text-sm leading-relaxed`,children:(0,k.jsx)(o,{remarkPlugins:[c],components:{h1:({children:e})=>(0,k.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:e}),h2:({children:e})=>(0,k.jsx)(`h2`,{className:`mt-4 border-b pb-1 text-base font-semibold first:mt-0`,children:e}),h3:({children:e})=>(0,k.jsx)(`h3`,{className:`mt-3 text-sm font-semibold`,children:e}),p:({children:e})=>(0,k.jsx)(`p`,{children:e}),ul:({children:e})=>(0,k.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:e}),ol:({children:e})=>(0,k.jsx)(`ol`,{className:`list-decimal space-y-1 pl-5`,children:e}),li:({children:e})=>(0,k.jsx)(`li`,{children:e}),code:({children:e})=>(0,k.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-[0.9em]`,children:e}),pre:({children:e})=>(0,k.jsx)(`pre`,{className:`overflow-auto rounded-md bg-muted p-3 text-xs`,children:e}),a:({children:e,href:t})=>{let n=X(t);return n?(0,k.jsx)(`a`,{href:n,target:`_blank`,rel:`noreferrer`,className:`text-primary underline underline-offset-2`,children:e}):e},img:({alt:e})=>(0,k.jsxs)(`span`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground`,children:[`image blocked`,e?`: ${e}`:``]}),blockquote:({children:e})=>(0,k.jsx)(`blockquote`,{className:`border-l-2 pl-3 text-muted-foreground`,children:e})},children:t})})}function W(e){return(0,k.jsxs)(`div`,{className:`min-w-0`,children:[(0,k.jsx)(`dt`,{className:`console-callout`,children:e.label}),(0,k.jsx)(`dd`,{className:`truncate font-mono text-xs text-foreground`,children:e.href?(0,k.jsx)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`text-primary hover:underline`,children:e.value}):e.value})]})}function ge(e){return e.error===null?e.pending&&e.outbound.length===0?(0,k.jsx)($,{}):e.session===null&&e.terminal&&e.expectsSession?(0,k.jsx)(`p`,{className:`text-sm text-destructive`,children:`Pi session missing after task finished.`}):(0,k.jsx)(A,{session:e.session,running:e.running,outbound:e.outbound}):(0,k.jsx)(`p`,{className:`text-sm text-destructive`,children:e.error})}function _e(e){return e.error===null?e.pending?(0,k.jsx)($,{}):e.raw===null?e.terminal&&e.expectsSession?(0,k.jsx)(`p`,{className:`text-sm text-destructive`,children:`Raw Pi session missing after task finished.`}):(0,k.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.running?`Waiting for raw Pi session...`:`No raw Pi session.`}):(0,k.jsx)(`pre`,{className:`min-h-full overflow-auto rounded-md bg-background/70 p-3 font-mono text-[11px] break-words whitespace-pre-wrap text-foreground/80`,children:e.raw}):(0,k.jsx)(`p`,{className:`text-sm text-destructive`,children:e.error})}function G(e){return(0,k.jsx)(`button`,{type:`button`,className:a(`rounded px-2 py-1 font-mono text-[11px] transition-colors`,e.active?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted hover:text-foreground`),onClick:e.onClick,children:e.children})}function ve(e){return e.target?.adapter}function K(e){return e.target?.adapter===`pi`}function ye(e){let t=e.metadata??{},n=q(t.externalSource);return{title:J(t.title),bodyMarkdown:J(t.bodyMarkdown),acceptanceCriteria:Y(t.acceptanceCriteria),externalSource:n?{kind:J(n.kind),provider:J(n.provider),externalId:J(n.externalId),identifier:J(n.identifier),url:J(n.url)}:void 0,workspaceKey:J(t.workspaceKey)}}function be(e){return[e.provider,e.identifier??e.externalId,e.kind&&!e.provider?e.kind:void 0].filter(Boolean).join(` · `)||`—`}function xe(e){if(e==null)return;let t=q(e),n=t?J(t.prompt):void 0;return n===void 0?JSON.stringify(e,null,2):n}function q(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:void 0}function J(e){return typeof e==`string`&&e.length>0?e:void 0}function Y(e){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.length>0):[]}function Se(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function Ce(e){let t=new Map;return e.map(e=>{let n=t.get(e)??0;return t.set(e,n+1),{text:e,key:n===0?e:`${e}#${n+1}`}})}function X(e){if(e)try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`?t.toString():void 0}catch{return}}function we(e){return e.scrollHeight-e.scrollTop-e.clientHeight<72}function Z(e){let t=e.dir===`prev`?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(C,{className:`size-3.5`}),` Prev`]}):(0,k.jsxs)(k.Fragment,{children:[`Next `,(0,k.jsx)(s,{className:`size-3.5`})]});return e.task===void 0?(0,k.jsx)(`span`,{className:`flex items-center gap-1 rounded-md border border-transparent px-2 py-1 font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground/30`,children:t}):(0,k.jsx)(r,{to:`/runs/$runId/t/$taskId`,params:{runId:e.runId,taskId:e.task.taskId},title:v(e.task)??e.task.taskId,className:`flex items-center gap-1 rounded-md border px-2 py-1 font-mono text-[11px] uppercase tracking-[0.08em] text-muted-foreground transition-colors hover:bg-secondary/60 hover:text-foreground`,children:t})}function Q(e){return(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(`dt`,{className:`console-callout`,children:e.label}),(0,k.jsx)(`dd`,{className:`truncate font-mono text-xs text-foreground`,"data-num":e.num?``:void 0,children:e.value})]})}function Te(e){x(1e3);let t=e.heartbeatAt!==void 0&&Date.now()-Date.parse(e.heartbeatAt)>1e4;return(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(`dt`,{className:`console-callout`,children:`heartbeat`}),(0,k.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-1.5 font-mono text-xs text-foreground`,children:[e.running&&e.heartbeatAt!==void 0?(0,k.jsxs)(`span`,{className:`relative size-1.5 shrink-0`,children:[(0,k.jsx)(`span`,{className:a(`absolute inset-0 rounded-full`,t?`bg-status-warn`:`bg-status-running`)}),t?null:(0,k.jsx)(`span`,{className:`blip absolute inset-0 rounded-full border border-status-running`},e.heartbeatAt)]}):null,(0,k.jsx)(`span`,{className:a(`truncate`,e.running&&t&&`text-status-warn`),"data-num":!0,children:S(e.heartbeatAt)})]})]})}function $(){return(0,k.jsxs)(`div`,{className:`grid gap-1 rounded-md bg-muted p-3`,children:[(0,k.jsx)(y,{className:`h-3 w-3/4 bg-foreground/10`}),(0,k.jsx)(y,{className:`h-3 w-full bg-foreground/10`}),(0,k.jsx)(y,{className:`h-3 w-5/6 bg-foreground/10`}),(0,k.jsx)(y,{className:`h-3 w-1/2 bg-foreground/10`}),(0,k.jsx)(y,{className:`h-3 w-11/12 bg-foreground/10`})]})}export{le as TranscriptPage};
@@ -0,0 +1 @@
1
+ import{m as e}from"./tiny-invariant-CO5X59di.js";import{n as t}from"./main-DVO9gWzi.js";import{t as n}from"./DocumentationPage-CGIcMKwf.js";var r=e();function i(){let{path:e}=t.useLoaderData();return(0,r.jsx)(n,{selectedPath:e})}export{i as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RunPage-5MmbVpaE.js","assets/react-B8IZ02wI.js","assets/main-DVO9gWzi.js","assets/link-ll3nLBSM.js","assets/react-dom-ki7NpxV4.js","assets/tiny-invariant-CO5X59di.js","assets/matchContext-puEkI9BI.js","assets/redirect-Cu9zBy04.js","assets/qss-4JXuaDtg.js","assets/utils-CBxvVKOM.js","assets/file-text-DLxLJ7P1.js","assets/lock-Ck2SfQA2.js","assets/x-Bdsfqbi3.js","assets/bits-CTGNpp-v.js","assets/card-37qs8AAd.js","assets/table-WMIs2m3R.js","assets/SandboxesLens-DPG87mUE.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{Dt as r,Ot as i,kt as a,r as o,w as s}from"./main-DVO9gWzi.js";var c=e(t()),l=n(),u=(0,c.lazy)(()=>s(()=>import(`./RunPage-5MmbVpaE.js`).then(e=>({default:e.RunPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function d(){let{runId:e}=o.useParams(),{tab:t,view:n}=o.useSearch(),s=r(),c=a();return f(s.pathname)===`/runs/${encodeURIComponent(e)}`?(0,l.jsx)(u,{runId:e,tab:t??`overview`,onTabChange:t=>c({to:`/runs/$runId`,params:{runId:e},search:e=>({...e,tab:t===`overview`?void 0:t}),replace:!0}),view:n??`map`,onViewChange:t=>c({to:`/runs/$runId`,params:{runId:e},search:e=>({...e,view:t===`map`?void 0:t}),replace:!0})}):(0,l.jsx)(i,{})}function f(e){return e===`/`?e:e.replace(/\/$/,``)}export{d as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TranscriptPage-mCgSqfv0.js","assets/react-B8IZ02wI.js","assets/main-DVO9gWzi.js","assets/link-ll3nLBSM.js","assets/react-dom-ki7NpxV4.js","assets/tiny-invariant-CO5X59di.js","assets/matchContext-puEkI9BI.js","assets/redirect-Cu9zBy04.js","assets/qss-4JXuaDtg.js","assets/utils-CBxvVKOM.js","assets/lib-COfgMmRR.js","assets/save-Bte_1tnN.js","assets/x-Bdsfqbi3.js","assets/bits-CTGNpp-v.js"])))=>i.map(i=>d[i]);
2
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{kt as r,t as i,w as a}from"./main-DVO9gWzi.js";var o=e(t()),s=n(),c=(0,o.lazy)(()=>a(()=>import(`./TranscriptPage-mCgSqfv0.js`).then(e=>({default:e.TranscriptPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function l(){let{runId:e,taskId:t}=i.useParams(),{transcript:n}=i.useSearch(),a=r();return(0,s.jsx)(c,{runId:e,taskId:t,transcriptMode:n??`parsed`,onTranscriptModeChange:n=>a({to:`/runs/$runId/t/$taskId`,params:{runId:e,taskId:t},search:n===`raw`?{transcript:`raw`}:{},replace:!0})})}export{l as component};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{D as r,T as i,f as a}from"./main-LpSDdT-S.js";import{t as o}from"./account-forms-D4eVqOhW.js";import{a as s,i as c,n as l,r as u,t as d}from"./card-37qs8AAd.js";var f=e(t()),p=n();function m(){let{user:e,refreshSession:t}=i(),[n,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(null);async function y(e){m(!0),g(null),v(null);let n=await r.updateUser({name:e.name});return m(!1),n.error?(g(a(n.error,`Could not update profile.`)),!1):(await t(),v(`Profile updated.`),!0)}let b=e.name??``,x=e.email??`No email recorded`;return(0,p.jsxs)(`section`,{className:`grid max-w-3xl gap-6`,children:[(0,p.jsxs)(`header`,{className:`grid gap-1`,children:[(0,p.jsx)(`p`,{className:`font-mono text-xs uppercase tracking-[0.14em] text-muted-foreground`,children:`Account`}),(0,p.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Profile`}),(0,p.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:`Manage the identity shown on your Flakes account.`})]}),(0,p.jsxs)(d,{className:`rounded-md`,children:[(0,p.jsxs)(c,{children:[(0,p.jsx)(s,{children:`Account details`}),(0,p.jsx)(u,{children:`Your email address is managed by the authentication provider.`})]}),(0,p.jsx)(l,{children:(0,p.jsx)(o,{name:b,email:x,pending:n,error:h,success:_,onSubmit:y})})]})]})}export{m as component};
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{D as r,T as i,f as a}from"./main-DVO9gWzi.js";import{t as o}from"./account-forms-Dq70JDyg.js";import{a as s,i as c,n as l,r as u,t as d}from"./card-37qs8AAd.js";var f=e(t()),p=n();function m(){let{user:e,refreshSession:t}=i(),[n,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(null),[_,v]=(0,f.useState)(null);async function y(e){m(!0),g(null),v(null);let n=await r.updateUser({name:e.name});return m(!1),n.error?(g(a(n.error,`Could not update profile.`)),!1):(await t(),v(`Profile updated.`),!0)}let b=e.name??``,x=e.email??`No email recorded`;return(0,p.jsxs)(`section`,{className:`grid max-w-3xl gap-6`,children:[(0,p.jsxs)(`header`,{className:`grid gap-1`,children:[(0,p.jsx)(`p`,{className:`font-mono text-xs uppercase tracking-[0.14em] text-muted-foreground`,children:`Account`}),(0,p.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:`Profile`}),(0,p.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:`Manage the identity shown on your Flakes account.`})]}),(0,p.jsxs)(d,{className:`rounded-md`,children:[(0,p.jsxs)(c,{children:[(0,p.jsx)(s,{children:`Account details`}),(0,p.jsx)(u,{children:`Your email address is managed by the authentication provider.`})]}),(0,p.jsx)(l,{children:(0,p.jsx)(o,{name:b,email:x,pending:n,error:h,success:_,onSubmit:y})})]})]})}export{m as component};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./circle-check-CzwcEElH.js";import{t as i}from"./lock-Ck2SfQA2.js";import{n as a,t as o}from"./signin-form-CBF-d8iK.js";import{t as s}from"./save-Bte_1tnN.js";import{t as c}from"./user-Bt9z7sSI.js";import{M as l,_t as u,g as d,h as f,ht as p}from"./main-LpSDdT-S.js";var m=e(t(),1),h=n();function g(e){let t=(0,m.useId)(),[n,r]=(0,m.useState)({name:e.name}),[i,a]=(0,m.useState)({});(0,m.useEffect)(()=>{r({name:e.name})},[e.name]);async function d(t){if(t.preventDefault(),e.pending)return;let r=f(n);if(!r.ok){a(r.errors);return}a({}),await e.onSubmit(r.data)}return(0,h.jsxs)(`form`,{className:`grid gap-4`,onSubmit:d,noValidate:!0,children:[(0,h.jsx)(o,{id:t,icon:c,label:`Name`,type:`text`,autoComplete:`name`,value:n.name,error:i.name,onChange:e=>r({name:e})}),(0,h.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,h.jsx)(`span`,{className:`console-callout`,children:`Email`}),(0,h.jsx)(`div`,{className:`rounded-md border bg-muted/25 px-3 py-2 font-mono text-sm text-muted-foreground`,children:e.email})]}),(0,h.jsx)(v,{error:e.error,success:e.success}),(0,h.jsx)(l,{type:`submit`,disabled:e.pending,className:`w-fit font-mono`,children:e.pending?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(u,{className:`size-4 animate-spin`}),` Saving`]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{className:`size-4`}),` Save profile`]})})]})}function _(e){let t=(0,m.useId)(),n=(0,m.useId)(),r=(0,m.useId)(),[a,s]=(0,m.useState)({currentPassword:``,newPassword:``,confirmPassword:``}),[c,f]=(0,m.useState)({});async function g(t){if(t.preventDefault(),e.pending)return;let n=d(a);if(!n.ok){f(n.errors);return}f({}),await e.onSubmit(n.data)&&s({currentPassword:``,newPassword:``,confirmPassword:``})}return(0,h.jsxs)(`form`,{className:`grid gap-4`,onSubmit:g,noValidate:!0,children:[(0,h.jsx)(o,{id:t,icon:i,label:`Current password`,type:`password`,autoComplete:`current-password`,value:a.currentPassword,error:c.currentPassword,onChange:e=>s(t=>({...t,currentPassword:e}))}),(0,h.jsx)(o,{id:n,icon:p,label:`New password`,type:`password`,autoComplete:`new-password`,value:a.newPassword,error:c.newPassword,onChange:e=>s(t=>({...t,newPassword:e}))}),(0,h.jsx)(o,{id:r,icon:p,label:`Confirm password`,type:`password`,autoComplete:`new-password`,value:a.confirmPassword,error:c.confirmPassword,onChange:e=>s(t=>({...t,confirmPassword:e}))}),(0,h.jsx)(v,{error:e.error,success:e.success}),(0,h.jsx)(l,{type:`submit`,disabled:e.pending,className:`w-fit font-mono`,children:e.pending?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(u,{className:`size-4 animate-spin`}),` Updating`]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p,{className:`size-4`}),` Change password`]})})]})}function v(e){return e.error===null?(0,h.jsx)(`p`,{className:`flex min-h-5 items-start gap-1.5 text-sm text-primary`,children:e.success?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(r,{className:`mt-0.5 size-4 shrink-0`}),(0,h.jsx)(`span`,{children:e.success})]}):null}):(0,h.jsx)(a,{message:e.error})}export{_ as n,g as t};
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./circle-check-CzwcEElH.js";import{t as i}from"./lock-Ck2SfQA2.js";import{n as a,t as o}from"./signin-form-tTBWDjhi.js";import{t as s}from"./save-Bte_1tnN.js";import{t as c}from"./user-Bt9z7sSI.js";import{Ct as l,M as u,g as d,h as f,xt as p}from"./main-DVO9gWzi.js";var m=e(t(),1),h=n();function g(e){let t=(0,m.useId)(),[n,r]=(0,m.useState)({name:e.name}),[i,a]=(0,m.useState)({});(0,m.useEffect)(()=>{r({name:e.name})},[e.name]);async function d(t){if(t.preventDefault(),e.pending)return;let r=f(n);if(!r.ok){a(r.errors);return}a({}),await e.onSubmit(r.data)}return(0,h.jsxs)(`form`,{className:`grid gap-4`,onSubmit:d,noValidate:!0,children:[(0,h.jsx)(o,{id:t,icon:c,label:`Name`,type:`text`,autoComplete:`name`,value:n.name,error:i.name,onChange:e=>r({name:e})}),(0,h.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,h.jsx)(`span`,{className:`console-callout`,children:`Email`}),(0,h.jsx)(`div`,{className:`rounded-md border bg-muted/25 px-3 py-2 font-mono text-sm text-muted-foreground`,children:e.email})]}),(0,h.jsx)(v,{error:e.error,success:e.success}),(0,h.jsx)(u,{type:`submit`,disabled:e.pending,className:`w-fit font-mono`,children:e.pending?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l,{className:`size-4 animate-spin`}),` Saving`]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(s,{className:`size-4`}),` Save profile`]})})]})}function _(e){let t=(0,m.useId)(),n=(0,m.useId)(),r=(0,m.useId)(),[a,s]=(0,m.useState)({currentPassword:``,newPassword:``,confirmPassword:``}),[c,f]=(0,m.useState)({});async function g(t){if(t.preventDefault(),e.pending)return;let n=d(a);if(!n.ok){f(n.errors);return}f({}),await e.onSubmit(n.data)&&s({currentPassword:``,newPassword:``,confirmPassword:``})}return(0,h.jsxs)(`form`,{className:`grid gap-4`,onSubmit:g,noValidate:!0,children:[(0,h.jsx)(o,{id:t,icon:i,label:`Current password`,type:`password`,autoComplete:`current-password`,value:a.currentPassword,error:c.currentPassword,onChange:e=>s(t=>({...t,currentPassword:e}))}),(0,h.jsx)(o,{id:n,icon:p,label:`New password`,type:`password`,autoComplete:`new-password`,value:a.newPassword,error:c.newPassword,onChange:e=>s(t=>({...t,newPassword:e}))}),(0,h.jsx)(o,{id:r,icon:p,label:`Confirm password`,type:`password`,autoComplete:`new-password`,value:a.confirmPassword,error:c.confirmPassword,onChange:e=>s(t=>({...t,confirmPassword:e}))}),(0,h.jsx)(v,{error:e.error,success:e.success}),(0,h.jsx)(u,{type:`submit`,disabled:e.pending,className:`w-fit font-mono`,children:e.pending?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(l,{className:`size-4 animate-spin`}),` Updating`]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(p,{className:`size-4`}),` Change password`]})})]})}function v(e){return e.error===null?(0,h.jsx)(`p`,{className:`flex min-h-5 items-start gap-1.5 text-sm text-primary`,children:e.success?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(r,{className:`mt-0.5 size-4 shrink-0`}),(0,h.jsx)(`span`,{children:e.success})]}):null}):(0,h.jsx)(a,{message:e.error})}export{_ as n,g as t};
@@ -1 +1 @@
1
- import{m as e}from"./tiny-invariant-CO5X59di.js";import{U as t,j as n}from"./main-LpSDdT-S.js";import{a as r,i,n as a,r as o,t as s}from"./card-37qs8AAd.js";var c=e();function l(e){return(0,c.jsxs)(`main`,{className:`relative flex min-h-screen items-center justify-center bg-muted/40 p-4 sm:p-6`,style:{backgroundImage:`radial-gradient(var(--border) 1px, transparent 1px)`,backgroundSize:`24px 24px`},children:[(0,c.jsx)(`div`,{className:`absolute right-4 top-4 sm:right-6 sm:top-6`,children:(0,c.jsx)(n,{})}),(0,c.jsxs)(s,{className:`w-full max-w-sm gap-4 rounded-md py-5 shadow-sm`,children:[(0,c.jsxs)(i,{className:`gap-3 px-5`,children:[(0,c.jsx)(r,{className:`text-base`,children:(0,c.jsx)(t,{})}),(0,c.jsxs)(`div`,{className:`grid gap-1`,children:[(0,c.jsx)(`h1`,{className:`text-xl font-semibold leading-tight tracking-tight`,children:e.title}),(0,c.jsx)(o,{children:e.description})]})]}),(0,c.jsx)(a,{className:`px-5`,children:e.children}),e.footer?(0,c.jsx)(`div`,{className:`border-t px-5 pt-4 text-sm text-muted-foreground`,children:e.footer}):null]})]})}export{l as t};
1
+ import{m as e}from"./tiny-invariant-CO5X59di.js";import{G as t,j as n}from"./main-DVO9gWzi.js";import{a as r,i,n as a,r as o,t as s}from"./card-37qs8AAd.js";var c=e();function l(e){return(0,c.jsxs)(`main`,{className:`relative flex min-h-screen items-center justify-center bg-muted/40 p-4 sm:p-6`,style:{backgroundImage:`radial-gradient(var(--border) 1px, transparent 1px)`,backgroundSize:`24px 24px`},children:[(0,c.jsx)(`div`,{className:`absolute right-4 top-4 sm:right-6 sm:top-6`,children:(0,c.jsx)(n,{})}),(0,c.jsxs)(s,{className:`w-full max-w-sm gap-4 rounded-md py-5 shadow-sm`,children:[(0,c.jsxs)(i,{className:`gap-3 px-5`,children:[(0,c.jsx)(r,{className:`text-base`,children:(0,c.jsx)(t,{})}),(0,c.jsxs)(`div`,{className:`grid gap-1`,children:[(0,c.jsx)(`h1`,{className:`text-xl font-semibold leading-tight tracking-tight`,children:e.title}),(0,c.jsx)(o,{children:e.description})]})]}),(0,c.jsx)(a,{className:`px-5`,children:e.children}),e.footer?(0,c.jsx)(`div`,{className:`border-t px-5 pt-4 text-sm text-muted-foreground`,children:e.footer}):null]})]})}export{l as t};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./utils-CBxvVKOM.js";import{a as i,t as a}from"./dist-BEfdrJTS.js";var o=e(t(),1),s=n(),c=i(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function l({className:e,variant:t=`default`,asChild:n=!1,...i}){return(0,s.jsx)(n?a:`span`,{"data-slot":`badge`,"data-variant":t,className:r(c({variant:t}),e),...i})}function u({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`skeleton`,className:r(`animate-pulse rounded-md bg-accent`,e),...t})}function d(e){let t=e.metadata?.name;if(typeof t==`string`&&t.length>0)return t;let n=e.metadata?.title;return typeof n==`string`&&n.length>0?n:void 0}var f=new Set([`SUCCEEDED`,`FAILED`,`CANCELLED`]),p={running:{dot:`bg-status-running`,text:`text-status-running`,pulse:!0},succeeded:{dot:`bg-status-succeeded`,text:`text-status-succeeded`},active:{dot:`bg-status-succeeded`,text:`text-status-succeeded`},failed:{dot:`bg-status-failed`,text:`text-status-failed`},cancelled:{dot:`bg-status-warn`,text:`text-status-warn`},stalled:{dot:`bg-status-warn`,text:`text-status-warn`},draining:{dot:`bg-status-warn`,text:`text-status-warn`},created:{dot:`bg-status-idle`,text:`text-status-idle`},queued:{dot:`bg-status-idle`,text:`text-status-idle`},offline:{dot:`bg-status-idle`,text:`text-status-idle`},blocked:{dot:`bg-status-blocked`,text:`text-status-blocked`}},m={dot:`bg-status-idle`,text:`text-status-idle`};function h(e){let t=p[e.state.toLowerCase()]??m;return(0,s.jsxs)(l,{variant:`outline`,className:r(`gap-1.5 font-mono text-[11px] font-medium uppercase tracking-[0.08em]`,t.text),children:[(0,s.jsx)(`span`,{className:r(`size-1.5 rounded-full`,t.dot,t.pulse&&`glow pulse-running animate-pulse`),style:t.pulse&&e.id!==void 0?y(e.id):void 0}),e.state.toUpperCase()]})}var g=[{status:`SUCCEEDED`,color:`bg-status-succeeded`},{status:`FAILED`,color:`bg-status-failed`},{status:`CANCELLED`,color:`bg-status-warn`},{status:`RUNNING`,color:`bg-status-running`},{status:`QUEUED`,color:`bg-status-idle`},{status:`BLOCKED`,color:`bg-status-blocked`},{status:`CREATED`,color:`bg-status-idle`}];function _(e){let t=e.counts??{};return(0,s.jsx)(`div`,{"aria-hidden":!0,className:r(`flex h-1.5 w-40 overflow-hidden rounded-full bg-muted`,e.className),children:g.map(n=>{let i=t[n.status]??0;return(0,s.jsx)(`div`,{className:r(`relative min-w-0 basis-0 transition-[flex-grow] duration-500`,n.color,e.segmentClassName),style:{flexGrow:i},children:n.status===`RUNNING`&&i>0?(0,s.jsx)(`div`,{className:`shimmer-running absolute inset-0`}):null},n.status)})})}function v(e){let[t,n]=(0,o.useState)(!1),r=(0,o.useRef)(void 0),i=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!i.current){i.current=!0,r.current=e;return}if(Object.is(r.current,e))return;r.current=e,n(!0);let t=setTimeout(()=>n(!1),700);return()=>clearTimeout(t)},[e]),t?`true`:void 0}function y(e,t=1600){let n=0;for(let t=0;t<e.length;t++)n=n*31+e.charCodeAt(t)|0;let r=`${-(Math.abs(n)%8*(t/8))}ms`;return{animationDelay:r,"--anim-delay":r}}function b(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:`${t.toISOString().slice(11,19)}Z`}function x(e){if(!e)return`—`;let t=Date.now()-Date.parse(e);if(t<0)return`now`;let n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<48?`${i}h ago`:`${Math.floor(i/24)}d ago`}function S(e){let t=0,n=0;for(let[r,i]of Object.entries(e))t+=i,f.has(r)&&(n+=i);return{finished:n,total:t}}function C(e){if(!e)return`—`;let{finished:t,total:n}=S(e);return n===0?`0/0`:`${t}/${n}`}function w(e=3e4){let[,t]=(0,o.useState)(0);(0,o.useEffect)(()=>{let n=setInterval(()=>t(e=>e+1),e);return()=>clearInterval(n)},[e])}function T(e){let t=new Map(e.map(e=>[e.taskId,e])),n=new Map,r=(e,i)=>{let a=n.get(e);if(a!==void 0)return a;let o=t.get(e);if(o===void 0||o.dependsOn.length===0||i.has(e))return n.set(e,0),0;i.add(e);let s=0;for(let e of o.dependsOn)t.has(e)&&(s=Math.max(s,r(e,i)+1));return i.delete(e),n.set(e,s),s},i=e.map((e,t)=>({id:e.taskId,depth:r(e.taskId,new Set),index:t})).sort((e,t)=>e.depth-t.depth||e.index-t.index);return new Map(i.map((e,t)=>[e.id,t+1]))}export{d as a,x as c,u as d,l as f,y as i,w as l,_ as n,T as o,b as r,C as s,h as t,v as u};
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./utils-CBxvVKOM.js";import{U as i,W as a}from"./main-DVO9gWzi.js";var o=e(t(),1),s=n(),c=a(`inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:`bg-primary text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90`,destructive:`bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90`,outline:`border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,ghost:`[a&]:hover:bg-accent [a&]:hover:text-accent-foreground`,link:`text-primary underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function l({className:e,variant:t=`default`,asChild:n=!1,...a}){return(0,s.jsx)(n?i:`span`,{"data-slot":`badge`,"data-variant":t,className:r(c({variant:t}),e),...a})}function u({className:e,...t}){return(0,s.jsx)(`div`,{"data-slot":`skeleton`,className:r(`animate-pulse rounded-md bg-accent`,e),...t})}function d(e){let t=e.metadata?.name;if(typeof t==`string`&&t.length>0)return t;let n=e.metadata?.title;return typeof n==`string`&&n.length>0?n:void 0}var f=new Set([`SUCCEEDED`,`FAILED`,`CANCELLED`]),p={running:{dot:`bg-status-running`,text:`text-status-running`,pulse:!0},succeeded:{dot:`bg-status-succeeded`,text:`text-status-succeeded`},active:{dot:`bg-status-succeeded`,text:`text-status-succeeded`},failed:{dot:`bg-status-failed`,text:`text-status-failed`},cancelled:{dot:`bg-status-warn`,text:`text-status-warn`},stalled:{dot:`bg-status-warn`,text:`text-status-warn`},draining:{dot:`bg-status-warn`,text:`text-status-warn`},created:{dot:`bg-status-idle`,text:`text-status-idle`},queued:{dot:`bg-status-idle`,text:`text-status-idle`},offline:{dot:`bg-status-idle`,text:`text-status-idle`},blocked:{dot:`bg-status-blocked`,text:`text-status-blocked`}},m={dot:`bg-status-idle`,text:`text-status-idle`};function h(e){let t=p[e.state.toLowerCase()]??m;return(0,s.jsxs)(l,{variant:`outline`,className:r(`gap-1.5 font-mono text-[11px] font-medium uppercase tracking-[0.08em]`,t.text),children:[(0,s.jsx)(`span`,{className:r(`size-1.5 rounded-full`,t.dot,t.pulse&&`glow pulse-running animate-pulse`),style:t.pulse&&e.id!==void 0?y(e.id):void 0}),e.state.toUpperCase()]})}var g=[{status:`SUCCEEDED`,color:`bg-status-succeeded`},{status:`FAILED`,color:`bg-status-failed`},{status:`CANCELLED`,color:`bg-status-warn`},{status:`RUNNING`,color:`bg-status-running`},{status:`QUEUED`,color:`bg-status-idle`},{status:`BLOCKED`,color:`bg-status-blocked`},{status:`CREATED`,color:`bg-status-idle`}];function _(e){let t=e.counts??{};return(0,s.jsx)(`div`,{"aria-hidden":!0,className:r(`flex h-1.5 w-40 overflow-hidden rounded-full bg-muted`,e.className),children:g.map(n=>{let i=t[n.status]??0;return(0,s.jsx)(`div`,{className:r(`relative min-w-0 basis-0 transition-[flex-grow] duration-500`,n.color,e.segmentClassName),style:{flexGrow:i},children:n.status===`RUNNING`&&i>0?(0,s.jsx)(`div`,{className:`shimmer-running absolute inset-0`}):null},n.status)})})}function v(e){let[t,n]=(0,o.useState)(!1),r=(0,o.useRef)(void 0),i=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!i.current){i.current=!0,r.current=e;return}if(Object.is(r.current,e))return;r.current=e,n(!0);let t=setTimeout(()=>n(!1),700);return()=>clearTimeout(t)},[e]),t?`true`:void 0}function y(e,t=1600){let n=0;for(let t=0;t<e.length;t++)n=n*31+e.charCodeAt(t)|0;let r=`${-(Math.abs(n)%8*(t/8))}ms`;return{animationDelay:r,"--anim-delay":r}}function b(e){if(!e)return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:`${t.toISOString().slice(11,19)}Z`}function x(e){if(!e)return`—`;let t=Date.now()-Date.parse(e);if(t<0)return`now`;let n=Math.floor(t/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<48?`${i}h ago`:`${Math.floor(i/24)}d ago`}function S(e){let t=0,n=0;for(let[r,i]of Object.entries(e))t+=i,f.has(r)&&(n+=i);return{finished:n,total:t}}function C(e){if(!e)return`—`;let{finished:t,total:n}=S(e);return n===0?`0/0`:`${t}/${n}`}function w(e=3e4){let[,t]=(0,o.useState)(0);(0,o.useEffect)(()=>{let n=setInterval(()=>t(e=>e+1),e);return()=>clearInterval(n)},[e])}function T(e){let t=new Map(e.map(e=>[e.taskId,e])),n=new Map,r=(e,i)=>{let a=n.get(e);if(a!==void 0)return a;let o=t.get(e);if(o===void 0||o.dependsOn.length===0||i.has(e))return n.set(e,0),0;i.add(e);let s=0;for(let e of o.dependsOn)t.has(e)&&(s=Math.max(s,r(e,i)+1));return i.delete(e),n.set(e,s),s},i=e.map((e,t)=>({id:e.taskId,depth:r(e.taskId,new Set),index:t})).sort((e,t)=>e.depth-t.depth||e.index-t.index);return new Map(i.map((e,t)=>[e.id,t+1]))}export{d as a,x as c,u as d,l as f,y as i,w as l,_ as n,T as o,b as r,C as s,h as t,v as u};
@@ -0,0 +1 @@
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./link-ll3nLBSM.js";import{r as i,t as a}from"./utils-CBxvVKOM.js";import{t as o}from"./arrow-right-QzVbRzF_.js";import{t as s}from"./circle-check-CzwcEElH.js";import{t as c}from"./circle-x-C_sOQVNQ.js";import{r as ee}from"./signin-form-tTBWDjhi.js";import{t as l}from"./otp-verification-qolVtiom.js";import{t as u}from"./user-Bt9z7sSI.js";import{Ct as d,D as f,E as p,M as m,f as h,i as te,kt as g,p as _,xt as v}from"./main-DVO9gWzi.js";import{t as y}from"./auth-layout-BFusNq3W.js";var b=i(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),x=e(t(),1);function S(e){return(e??``).trim().replace(/[\s-]+/g,``).toUpperCase()}function C(e){return S(E(e)??e)}function w(e){let t=e??``,n=(t.includes(`user_code=`)?C(t):void 0)??t.toUpperCase(),r=[];for(let e of n){if(r.length>=8)break;if(e===`-`)continue;if(e.trim()===``){r.push(` `);continue}let t=C(e);t.length>0&&r.push(t[0]??` `)}return r.concat(Array(8).fill(` `)).slice(0,8)}function T(e){let t=S(e);return t.length<=4?t:`${t.slice(0,4)}-${t.slice(4)}`}function E(e){let t=e?.trim();if(t?.includes(`user_code=`))try{return new URL(t,`http://console.invalid`).searchParams.get(`user_code`)??void 0}catch{return}}function D(e){let t=S(e);return t.length===0?`/device`:`/device?user_code=${encodeURIComponent(t)}`}async function O(e,t){let n=S(t);if(n.length===0)return N(n,{title:`Device code missing`,message:`Start login again from the Flakes CLI.`});let r=await e.verify(n);if(r.error)return M(n,r.error);switch(r.data?.status){case`pending`:return{state:`ready`,userCode:n,displayUserCode:T(n)};case`approved`:return A(n);case`denied`:return j(n);default:return N(n,{title:`Device code not found`,message:`Start login again from the Flakes CLI.`})}}async function k(e,t,n){let r=S(n);if(r.length===0)return N(r,{title:`Device code missing`,message:`Start login again from the Flakes CLI.`});let i=t===`approve`?await e.approve(r):await e.deny(r);return i.error?M(r,i.error):t===`approve`?A(r):j(r)}function A(e){return{state:`approved`,userCode:e,displayUserCode:T(e),title:`CLI session authorized`,message:`Open the console to continue.`}}function j(e){return{state:`denied`,userCode:e,displayUserCode:T(e),title:`CLI session denied`,message:`The waiting login request has been rejected.`}}function M(e,t){switch(P(t)){case`expired_token`:return N(e,{title:`Device code expired`,message:`Start login again from the Flakes CLI.`});case`device_code_already_processed`:return N(e,{title:`Device code already used`,message:`This login request has already been completed.`});case`unauthorized`:return N(e,{title:`Sign-in required`,message:`Sign in again before authorizing the CLI.`});case`access_denied`:return N(e,{title:`Device code belongs to another user`,message:`Use the same account that opened the device request.`});default:return N(e,{title:`Device code not found`,message:`Start login again from the Flakes CLI.`})}}function N(e,t){return{state:`invalid`,userCode:e,displayUserCode:T(e),...t}}function P(e){if(typeof e!=`object`||!e)return``;let t=e;for(let e of[`code`,`error`,`status`,`statusText`]){let n=t[e];if(typeof n==`string`&&n.length>0)return n.toLowerCase()}return``}var F=n(),I=[`device-code-slot-1`,`device-code-slot-2`,`device-code-slot-3`,`device-code-slot-4`,`device-code-slot-5`,`device-code-slot-6`,`device-code-slot-7`,`device-code-slot-8`];function L(e){let t=(0,x.useRef)([]),n=(0,x.useRef)(void 0),r=w(e.value);(0,x.useEffect)(()=>{if(!e.error){n.current=void 0;return}if(n.current!==e.errorPulse){n.current=e.errorPulse;for(let e of t.current)e&&(e.classList.remove(`device-code-slot-error`),e.offsetWidth,e.classList.add(`device-code-slot-error`))}},[e.error,e.errorPulse]);function i(n,r){e.onChange(n.slice(0,8).join(``)),r!==void 0&&requestAnimationFrame(()=>{t.current[R(r)]?.focus()})}function a(e,t){let n=C(t.currentTarget.value);if(n.length===0){let t=r.slice();t[e]=` `,i(t);return}let a=r.slice();for(let t=0;t<n.length;t+=1){let r=e+t;if(r>=8)break;a[r]=n[t]??` `}i(a,e+n.length)}function o(e,t){t.preventDefault();let n=C(t.clipboardData.getData(`text`));if(n.length===0)return;let a=r.slice();for(let t=0;t<n.length;t+=1){let r=e+t;if(r>=8)break;a[r]=n[t]??` `}i(a,e+n.length)}function s(e,n){if(n.key===`Backspace`){n.preventDefault();let t=r.slice();if(r[e]!==` `){t[e]=` `,i(t,e);return}e>0&&(t[e-1]=` `,i(t,e-1));return}if(n.key===`Delete`){n.preventDefault();let t=r.slice();t[e]=` `,i(t,e);return}if(n.key===`ArrowLeft`&&e>0){n.preventDefault(),t.current[e-1]?.focus();return}n.key===`ArrowRight`&&e<7&&(n.preventDefault(),t.current[e+1]?.focus())}return(0,F.jsxs)(`fieldset`,{className:`grid gap-2`,"aria-describedby":`${e.id}-error`,children:[(0,F.jsx)(`legend`,{className:`console-callout pb-2`,children:e.label}),(0,F.jsx)(`div`,{className:`flex items-center gap-1.5`,children:I.map((n,i)=>(0,F.jsx)(z,{ref:e=>{t.current[i]=e},id:i===0?e.id:void 0,value:r[i]?.trim()??``,error:e.error!==void 0,index:i,onChange:e=>a(i,e),onPaste:e=>o(i,e),onKeyDown:e=>s(i,e)},n))}),(0,F.jsx)(`p`,{id:`${e.id}-error`,className:`min-h-4 text-xs text-destructive`,children:e.error??``})]})}function R(e){return Math.max(0,Math.min(e,7))}function z(e){return(0,F.jsxs)(F.Fragment,{children:[e.index===4?(0,F.jsx)(`span`,{className:`px-0.5 font-mono text-sm text-muted-foreground`,children:`-`}):null,(0,F.jsx)(`input`,{ref:e.ref,id:e.id,value:e.value,"aria-label":`Device code character ${e.index+1}`,inputMode:`text`,autoComplete:e.index===0?`one-time-code`:`off`,autoCapitalize:`characters`,maxLength:8,onChange:e.onChange,onPaste:e.onPaste,onKeyDown:e.onKeyDown,className:a(`h-11 w-8 rounded-md border bg-background text-center font-mono text-lg font-semibold outline-none transition-colors sm:w-9`,`focus:border-primary focus:ring-[3px] focus:ring-ring/30`,e.error&&`device-code-slot-error focus:border-destructive focus:ring-destructive/20`)})]})}function B(){let{user_code:e}=te.useSearch(),t=g(),n=f.useSession(),i=S(e),a=(0,x.useMemo)(ne,[]),[o,s]=(0,x.useState)(()=>Y(i)),[c,u]=(0,x.useState)(()=>T(i)),[d,m]=(0,x.useState)(),[v,b]=(0,x.useState)(0),[w,E]=(0,x.useState)(!1),[A,j]=(0,x.useState)(null),[M,N]=(0,x.useState)(`signin`),[P,I]=(0,x.useState)(``),[L,R]=(0,x.useState)(``),[z,B]=(0,x.useState)(null);(0,x.useEffect)(()=>{u(T(i)),m(void 0),b(0),N(`signin`),j(null)},[i]),(0,x.useEffect)(()=>{if(n.isPending||i.length===0||n.data===null)return;let e=!0;return s(Y(i)),O(a,i).then(t=>{e&&s(t)}),()=>{e=!1}},[a,n.data,n.isPending,i]);function X(e){e.preventDefault();let n=C(c);if(n.length!==8){m(`Enter the 8-character code shown in your terminal.`),b(e=>e+1);return}if(o.state===`invalid`&&n===i){m(o.title),b(e=>e+1);return}m(void 0),t({to:`/device`,search:{user_code:n},replace:!0})}function Z(e){u(e),m(void 0)}async function Q(e){z||(B(e),s(await k(a,e,i)),B(null))}async function re(e){E(!0),j(null),I(e.email),R(e.password);let t=await f.signIn.email({email:e.email,password:e.password});if(t.error){if(_(t.error)){let t=await f.emailOtp.sendVerificationOtp({email:e.email,type:`email-verification`});if(E(!1),t.error){j(h(t.error,`Could not send verification code.`));return}N(`verify`);return}E(!1),j(h(t.error));return}E(!1),window.location.assign(p(D(i)))}async function ie(e){if(E(!0),j(null),(await f.emailOtp.verifyEmail({email:P,otp:e})).error){E(!1),j(`Verification failed: the six-digit code is incorrect.`);return}let t=await f.signIn.email({email:P,password:L});if(E(!1),t.error){j(`Verification succeeded, but failed to sign in: ${h(t.error)}`),N(`signin`);return}window.location.assign(p(D(i)))}if(n.isPending)return(0,F.jsx)(y,{title:`Authorize CLI session`,description:`Flakes is checking your account session.`,children:(0,F.jsx)(q,{displayUserCode:T(i)})});if(i.length===0)return(0,F.jsx)(y,{title:`Authorize CLI session`,description:`Enter the code shown by the Flakes CLI.`,footer:n.data?(0,F.jsx)(W,{userLabel:K(n.data.user)}):(0,F.jsx)(`p`,{children:`Sign in after entering a code to authorize the CLI session.`}),children:(0,F.jsx)(H,{value:c,error:d,errorPulse:v,onChange:Z,onSubmit:X})});let ae=n.data?.user.email??n.data?.user.name??`Signed-in account`;if(n.data===null)return(0,F.jsx)(y,{title:`Authorize CLI session`,description:`Sign in to authorize this CLI login.`,footer:(0,F.jsxs)(`p`,{children:[`Need access?`,` `,(0,F.jsx)(r,{to:`/signup`,search:{redirect:D(i)},className:`text-foreground underline-offset-4 hover:underline`,children:`Create an account`})]}),children:(0,F.jsxs)(`div`,{className:`grid gap-4`,children:[(0,F.jsx)(U,{displayUserCode:T(i)}),M===`signin`?(0,F.jsx)(ee,{error:A,pending:w,redirectTarget:D(i),onSubmit:re}):(0,F.jsx)(l,{email:P,error:A,pending:w,onVerify:ie,onBack:()=>{j(null),N(`signin`)}})]})});if(o.state===`invalid`){let e=C(c)===i?o.title:void 0;return(0,F.jsx)(y,{title:`Authorize CLI session`,description:`Enter the code shown by the Flakes CLI.`,footer:(0,F.jsxs)(`p`,{children:[`Wrong account?`,` `,(0,F.jsx)(r,{to:`/signin`,search:{redirect:D(i)},className:`text-foreground underline-offset-4 hover:underline`,children:`Sign in again`})]}),children:(0,F.jsx)(H,{value:c,error:d??e,errorPulse:v,onChange:Z,onSubmit:X})})}let $=V(o);return(0,F.jsx)(y,{title:$.title,description:$.description,footer:(0,F.jsxs)(`p`,{children:[`Wrong account?`,` `,(0,F.jsx)(r,{to:`/signin`,search:{redirect:D(i)},className:`text-foreground underline-offset-4 hover:underline`,children:`Sign in again`})]}),children:(0,F.jsxs)(`div`,{className:`grid gap-4`,children:[(0,F.jsx)(U,{displayUserCode:o.displayUserCode}),n.data?(0,F.jsx)(W,{userLabel:ae}):null,o.state===`checking`?(0,F.jsx)(q,{displayUserCode:o.displayUserCode}):o.state===`ready`?(0,F.jsx)(G,{pendingDecision:z,onApprove:()=>Q(`approve`),onDeny:()=>Q(`deny`)}):(0,F.jsx)(J,{view:o})]})})}function V(e){switch(e.state){case`approved`:return{title:`CLI session authorized`,description:`Open the console to continue.`};case`denied`:return{title:`CLI session denied`,description:`This login request was rejected.`};case`invalid`:return{title:`Cannot authorize CLI session`,description:`This device code cannot be authorized.`};default:return{title:`Authorize CLI session`,description:`Review the code before authorizing this CLI login.`}}}function H(e){return(0,F.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e.onSubmit,noValidate:!0,children:[(0,F.jsx)(L,{id:`device-user-code`,label:`Device code`,value:e.value,error:e.error,errorPulse:e.errorPulse,onChange:e.onChange}),(0,F.jsxs)(m,{type:`submit`,className:`font-mono`,children:[(0,F.jsx)(o,{className:`size-4`}),` Continue`]})]})}function U(e){return(0,F.jsxs)(`section`,{className:`rounded-md border bg-background p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,F.jsx)(`p`,{className:`console-callout`,children:`Device code`}),(0,F.jsx)(b,{className:`size-4 text-muted-foreground`})]}),(0,F.jsx)(`p`,{className:`mt-2 break-all font-mono text-2xl font-semibold tracking-[0.12em] text-foreground`,children:e.displayUserCode})]})}function W(e){return(0,F.jsxs)(`p`,{className:`flex items-center gap-2 rounded-md border bg-background px-3 py-2 text-sm text-muted-foreground`,children:[(0,F.jsx)(u,{className:`size-4 shrink-0`}),(0,F.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Signed in as `,e.userLabel]})]})}function G(e){return(0,F.jsxs)(`div`,{className:`grid gap-3`,children:[(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Authorizing will let this CLI session use your Flakes account.`}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,F.jsxs)(m,{type:`button`,disabled:e.pendingDecision!==null,className:`font-mono`,onClick:e.onApprove,children:[e.pendingDecision===`approve`?(0,F.jsx)(d,{className:`size-4 animate-spin`}):(0,F.jsx)(s,{className:`size-4`}),`Authorize`]}),(0,F.jsxs)(m,{type:`button`,variant:`outline`,disabled:e.pendingDecision!==null,className:`font-mono`,onClick:e.onDeny,children:[e.pendingDecision===`deny`?(0,F.jsx)(d,{className:`size-4 animate-spin`}):(0,F.jsx)(c,{className:`size-4`}),`Deny`]})]})]})}function K(e){return e.email??e.name??`Signed-in account`}function q(e){return(0,F.jsxs)(`p`,{className:`flex min-h-10 items-center gap-2 text-sm text-muted-foreground`,children:[(0,F.jsx)(d,{className:`size-4 animate-spin`}),(0,F.jsxs)(`span`,{children:[`Checking `,e.displayUserCode?e.displayUserCode:`device code`]})]})}function J(e){let t=e.view.state===`approved`;return(0,F.jsxs)(`section`,{className:a(`grid gap-2 rounded-md border p-4`,t?`border-primary/30 bg-primary/10`:`bg-muted/40`),children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t?(0,F.jsx)(v,{className:`size-4 text-primary`}):(0,F.jsx)(c,{className:`size-4 text-muted-foreground`}),(0,F.jsx)(`h2`,{className:`text-sm font-medium`,children:e.view.title})]}),(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.view.message}),t?(0,F.jsx)(m,{asChild:!0,className:`mt-1 font-mono`,children:(0,F.jsxs)(r,{to:`/runs`,children:[(0,F.jsx)(o,{className:`size-4`}),` Open Console`]})}):null]})}function Y(e){return{state:`checking`,userCode:e,displayUserCode:T(e)}}function ne(){return{verify:async e=>{let t=await f.device({query:{user_code:e}});return{...t.data?{data:X(t.data)}:{},...t.error?{error:t.error}:{}}},approve:async e=>Z(await f.device.approve({userCode:e})),deny:async e=>Z(await f.device.deny({userCode:e}))}}function X(e){let t=e.status===`pending`||e.status===`approved`||e.status===`denied`?e.status:void 0;return{...e.user_code?{user_code:e.user_code}:{},...t?{status:t}:{}}}function Z(e){return{...e.data?{data:e.data}:{},...e.error?{error:e.error}:{}}}export{B as component};
@@ -0,0 +1 @@
1
+ import{m as e}from"./tiny-invariant-CO5X59di.js";import{Dt as t,Ot as n,a as r}from"./main-DVO9gWzi.js";import{t as i}from"./DocumentationPage-CGIcMKwf.js";var a=e();function o(){return s(t().pathname)===`/documentation`?(0,a.jsx)(i,{selectedPath:r}):(0,a.jsx)(n,{})}function s(e){return e===`/`?e:e.replace(/\/$/,``)}export{o as component};
@@ -1 +1 @@
1
- import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./link-ll3nLBSM.js";import{r as i}from"./utils-CBxvVKOM.js";import{i as a,n as o,t as s}from"./signin-form-CBF-d8iK.js";import{D as c,M as l,_t as u,f as d,u as f,v as p}from"./main-LpSDdT-S.js";import{t as m}from"./auth-layout-DBnq_eif.js";var h=i(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),g=e(t(),1),_=n();function v(e){let t=(0,g.useId)(),[n,i]=(0,g.useState)(``),[c,d]=(0,g.useState)();async function f(t){if(t.preventDefault(),e.pending||e.sent)return;let r=p({email:n,password:`placeholder`});if(!r.ok){d(r.errors.email);return}d(void 0),await e.onSubmit(r.data.email)}return e.sent?(0,_.jsxs)(`div`,{className:`grid gap-4`,children:[(0,_.jsx)(`p`,{className:`rounded-md border bg-background p-3 text-sm text-muted-foreground`,children:`If an account exists for that address, a reset link will arrive shortly.`}),(0,_.jsx)(l,{asChild:!0,variant:`outline`,children:(0,_.jsx)(r,{to:`/signin`,search:{redirect:e.redirectTarget},children:`Return to sign in`})})]}):(0,_.jsxs)(`form`,{className:`grid gap-4`,onSubmit:f,noValidate:!0,children:[(0,_.jsx)(s,{id:t,icon:a,label:`Email`,type:`email`,autoComplete:`email`,value:n,error:c,onChange:i}),(0,_.jsx)(o,{message:e.error}),(0,_.jsx)(l,{type:`submit`,disabled:e.pending,className:`font-mono`,children:e.pending?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(u,{className:`size-4 animate-spin`}),` Sending link`]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(h,{className:`size-4`}),` Send reset link`]})})]})}function y(){let{redirect:e}=f.useSearch(),[t,n]=(0,g.useState)(!1),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null);async function l(t){n(!0),s(null);let r=await c.requestPasswordReset({email:t,redirectTo:`/console/reset-password?redirect=${encodeURIComponent(e)}`});if(n(!1),r.error){s(d(r.error,`Could not send reset link.`));return}a(!0)}return(0,_.jsx)(m,{title:`Reset password`,description:`Request a password reset link for your Flakes account.`,footer:(0,_.jsxs)(`p`,{children:[`Remembered it?`,` `,(0,_.jsx)(r,{to:`/signin`,search:{redirect:e},className:`text-foreground underline-offset-4 hover:underline`,children:`Sign in`})]}),children:(0,_.jsx)(v,{error:o,pending:t,sent:i,redirectTarget:e,onSubmit:l})})}export{y as component};
1
+ import{i as e,t}from"./react-B8IZ02wI.js";import{m as n}from"./tiny-invariant-CO5X59di.js";import{t as r}from"./link-ll3nLBSM.js";import{r as i}from"./utils-CBxvVKOM.js";import{i as a,n as o,t as s}from"./signin-form-tTBWDjhi.js";import{Ct as c,D as l,M as u,f as d,u as f,v as p}from"./main-DVO9gWzi.js";import{t as m}from"./auth-layout-BFusNq3W.js";var h=i(`send`,[[`path`,{d:`M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z`,key:`1ffxy3`}],[`path`,{d:`m21.854 2.147-10.94 10.939`,key:`12cjpa`}]]),g=e(t(),1),_=n();function v(e){let t=(0,g.useId)(),[n,i]=(0,g.useState)(``),[l,d]=(0,g.useState)();async function f(t){if(t.preventDefault(),e.pending||e.sent)return;let r=p({email:n,password:`placeholder`});if(!r.ok){d(r.errors.email);return}d(void 0),await e.onSubmit(r.data.email)}return e.sent?(0,_.jsxs)(`div`,{className:`grid gap-4`,children:[(0,_.jsx)(`p`,{className:`rounded-md border bg-background p-3 text-sm text-muted-foreground`,children:`If an account exists for that address, a reset link will arrive shortly.`}),(0,_.jsx)(u,{asChild:!0,variant:`outline`,children:(0,_.jsx)(r,{to:`/signin`,search:{redirect:e.redirectTarget},children:`Return to sign in`})})]}):(0,_.jsxs)(`form`,{className:`grid gap-4`,onSubmit:f,noValidate:!0,children:[(0,_.jsx)(s,{id:t,icon:a,label:`Email`,type:`email`,autoComplete:`email`,value:n,error:l,onChange:i}),(0,_.jsx)(o,{message:e.error}),(0,_.jsx)(u,{type:`submit`,disabled:e.pending,className:`font-mono`,children:e.pending?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c,{className:`size-4 animate-spin`}),` Sending link`]}):(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(h,{className:`size-4`}),` Send reset link`]})})]})}function y(){let{redirect:e}=f.useSearch(),[t,n]=(0,g.useState)(!1),[i,a]=(0,g.useState)(!1),[o,s]=(0,g.useState)(null);async function c(t){n(!0),s(null);let r=await l.requestPasswordReset({email:t,redirectTo:`/console/reset-password?redirect=${encodeURIComponent(e)}`});if(n(!1),r.error){s(d(r.error,`Could not send reset link.`));return}a(!0)}return(0,_.jsx)(m,{title:`Reset password`,description:`Request a password reset link for your Flakes account.`,footer:(0,_.jsxs)(`p`,{children:[`Remembered it?`,` `,(0,_.jsx)(r,{to:`/signin`,search:{redirect:e},className:`text-foreground underline-offset-4 hover:underline`,children:`Sign in`})]}),children:(0,_.jsx)(v,{error:o,pending:t,sent:i,redirectTarget:e,onSubmit:c})})}export{y as component};