factory-factory 0.5.4 → 0.5.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 (141) hide show
  1. package/README.md +5 -4
  2. package/dist/client/assets/{DotsThree.es-C6Viu7Dq.js → DotsThree.es-Dx8TXzzQ.js} +1 -1
  3. package/dist/client/assets/{abnfDiagram-WEYOIA3C-BvoNpMV8.js → abnfDiagram-WEYOIA3C-D-WiX0ND.js} +1 -1
  4. package/dist/client/assets/admin-page-BdYXlEfi.js +3 -0
  5. package/dist/client/assets/{agent-authoring-CpHhrhUY.js → agent-authoring-CzgCC7xn.js} +1 -1
  6. package/dist/client/assets/{agents-D3hs4uZa.js → agents-B6BxITMg.js} +1 -1
  7. package/dist/client/assets/{agents-DXQtyo3W.js → agents-CIGVR3Yk.js} +1 -1
  8. package/dist/client/assets/{architectureDiagram-ZHVYKT53-DADHUMQq.js → architectureDiagram-ZHVYKT53-D-Nk4IRx.js} +1 -1
  9. package/dist/client/assets/{chat-DRiQa69b.js → chat-BsZewCkt.js} +9 -9
  10. package/dist/client/assets/{chunk-2E7WHVMD-9C12vK98.js → chunk-2E7WHVMD-DsLW-8KW.js} +1 -1
  11. package/dist/client/assets/{chunk-NQOKRVIF-e5eOBOjh.js → chunk-NQOKRVIF-CMnJ0k4D.js} +1 -1
  12. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-DK39tSL-.js → classDiagram-v2-4MYWR3UA-BRoc4t8Q.js} +1 -1
  13. package/dist/client/assets/client-modules.json +1 -1
  14. package/dist/client/assets/{codex-accounts-CIydK7Ct.js → codex-accounts-C8imj_4P.js} +1 -1
  15. package/dist/client/assets/{cynefinDiagram-WF24UDRP-C6ju021L.js → cynefinDiagram-WF24UDRP-6T3PH0XT.js} +1 -1
  16. package/dist/client/assets/{data-import-button-BjOuUjwj.js → data-import-button-BH9f-Pg6.js} +2 -2
  17. package/dist/client/assets/detail-C4NZBe6t.js +2 -0
  18. package/dist/client/assets/{diagram-CBK3MWTC-BSLMYsvN.js → diagram-CBK3MWTC-YepopftI.js} +1 -1
  19. package/dist/client/assets/{diagram-I5XIIV2D-BHRlglbz.js → diagram-I5XIIV2D-BJli7Wmv.js} +1 -1
  20. package/dist/client/assets/{diagram-ODIL2UCW-DICHNEuG.js → diagram-ODIL2UCW-CSqmCku9.js} +1 -1
  21. package/dist/client/assets/{diagram-RJA3I4VV-kweKZM0T.js → diagram-RJA3I4VV-Din95BTu.js} +1 -1
  22. package/dist/client/assets/{diagram-TYUNFSNR-y7cp79Fa.js → diagram-TYUNFSNR-DDVwAmk7.js} +1 -1
  23. package/dist/client/assets/{diff-viewer-CQ5fdsbf.js → diff-viewer-DNUPJg_G.js} +1 -1
  24. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-DOyGRL5U.js → ebnfDiagram-V4P3TTPT-Bt8SCelN.js} +1 -1
  25. package/dist/client/assets/{erDiagram-KYQIGQAA-Buk9_J49.js → erDiagram-KYQIGQAA-BDYCjid-.js} +1 -1
  26. package/dist/client/assets/{event-agent-workspace-form-Ce0YvIUR.js → event-agent-workspace-form-CWmktyXd.js} +1 -1
  27. package/dist/client/assets/{file-viewer-B5G20aK5.js → file-viewer-CbXNMHbC.js} +2 -2
  28. package/dist/client/assets/{flowDiagram-IUGLLWBU-DBktJqHn.js → flowDiagram-IUGLLWBU-CJN9xdYn.js} +1 -1
  29. package/dist/client/assets/{highlighted-body-JLMTFACH-DmN1qi-X.js → highlighted-body-JLMTFACH-Dy-R6Y8r.js} +1 -1
  30. package/dist/client/assets/{home-BVRkf5ch.js → home-pNFIyVOJ.js} +1 -1
  31. package/dist/client/assets/index-BHTworEd.js +12 -0
  32. package/dist/client/assets/index-sK2DBc7b.css +2 -0
  33. package/dist/client/assets/{infoDiagram-MVDRKAX5-Cgzpr3uK.js → infoDiagram-MVDRKAX5-CZx5KLLZ.js} +1 -1
  34. package/dist/client/assets/{inline-workspace-form-D6xdIaBy.js → inline-workspace-form-DvVz3qgr.js} +1 -1
  35. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-CcHiSetf.js → ishikawaDiagram-HPEHV2GE-C0ax8nAT.js} +1 -1
  36. package/dist/client/assets/{issue-launch-sheet-CKo_zY4c.js → issue-launch-sheet-Cvig-i15.js} +1 -1
  37. package/dist/client/assets/kanban-CWhDBIAX.js +1 -0
  38. package/dist/client/assets/{kanban-card-CbQlf6VY.js → kanban-card-xzqAUkmg.js} +1 -1
  39. package/dist/client/assets/{kanban-definition-FNSA4HC5-CLutHwHv.js → kanban-definition-FNSA4HC5-FG4uAvnN.js} +1 -1
  40. package/dist/client/assets/{legacy-DySuWaHY.js → legacy-COQTLf7j.js} +1 -1
  41. package/dist/client/assets/{legacy-CAnW-mmw.js → legacy-xGT-esX6.js} +1 -1
  42. package/dist/client/assets/list-DhQWjiv0.js +1 -0
  43. package/dist/client/assets/{list-Dwyy4ZeD.js → list-sOGdiDXi.js} +1 -1
  44. package/dist/client/assets/live-session-control-B9Xbg14T.js +1 -0
  45. package/dist/client/assets/{logs-D6YR0UM3.js → logs-DOOyulI5.js} +1 -1
  46. package/dist/client/assets/mermaid-WFAXDIZX-Bb-EeuSh.js +1 -0
  47. package/dist/client/assets/{mermaid-diagram-DVBoFQ1A.js → mermaid-diagram-DHR-LEin.js} +4 -4
  48. package/dist/client/assets/{mindmap-definition-6OY57UG3-BsB3S8oa.js → mindmap-definition-6OY57UG3-B3bdhe56.js} +1 -1
  49. package/dist/client/assets/{mobile-baseline-C__U8yjC.js → mobile-baseline-C2AnUNW1.js} +1 -1
  50. package/dist/client/assets/{new-QfYZfsm5.js → new-BJg9Bigj.js} +1 -1
  51. package/dist/client/assets/{new-DIe-8ZWK.js → new-DUJNL_Jv.js} +1 -1
  52. package/dist/client/assets/{pegDiagram-ECIUJNBX-CZoilMoR.js → pegDiagram-ECIUJNBX-DOYkHKRd.js} +1 -1
  53. package/dist/client/assets/{pieDiagram-GNMPY74T-C92sG3rK.js → pieDiagram-GNMPY74T-8JeV6xrB.js} +1 -1
  54. package/dist/client/assets/{pr-inbox-item-C4H2DEff.js → pr-inbox-item-BGuMexFr.js} +2 -2
  55. package/dist/client/assets/project-CTLOJEoH.js +1 -0
  56. package/dist/client/assets/{project-header-DHUYBtI9.js → project-header-cDqQN0Dp.js} +1 -1
  57. package/dist/client/assets/{project-repo-form-BNi6PhCE.js → project-repo-form-8h-x4Jm-.js} +1 -1
  58. package/dist/client/assets/{provider-cli-warning-CLUHnJ0J.js → provider-cli-warning-B6YVtj_C.js} +1 -1
  59. package/dist/client/assets/{query-state-BOVEVxkI.js → query-state-DeXwsPfq.js} +1 -1
  60. package/dist/client/assets/{railroadDiagram-Y72NRBL7-CXr1mcVz.js → railroadDiagram-Y72NRBL7-D6nXF23_.js} +1 -1
  61. package/dist/client/assets/{requirementDiagram-EQYSW5RA-Bw_gunq2.js → requirementDiagram-EQYSW5RA-CjjGJH_A.js} +1 -1
  62. package/dist/client/assets/{reviews-odv0m9-3.js → reviews-r5Fft2S9.js} +1 -1
  63. package/dist/client/assets/{right-panel-BToKIMdI.js → right-panel-BUm-IUuW.js} +3 -3
  64. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-1BM-vvrr.js → sequenceDiagram-BLEHNHQU-X8vRIVgX.js} +1 -1
  65. package/dist/client/assets/{settings-page-layout-BxEsjJKT.js → settings-page-layout-Cyc2QcuG.js} +1 -1
  66. package/dist/client/assets/{setup-terminal-modal-DB_JVpmh.js → setup-terminal-modal-CRZrWgCt.js} +2 -2
  67. package/dist/client/assets/{startup-script-form-DHmnfAlm.js → startup-script-form-edXnfByI.js} +1 -1
  68. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-6OizLvv3.js → stateDiagram-v2-A6IESKWZ-Bum1zshG.js} +1 -1
  69. package/dist/client/assets/{swimlanesDiagram-AYQRV4AK-BXIL2gMl.js → swimlanesDiagram-AYQRV4AK-DBKC7Yfq.js} +1 -1
  70. package/dist/client/assets/{terminal-instance-Dyp3Ei--.js → terminal-instance-Y05XGV6V.js} +2 -2
  71. package/dist/client/assets/{timeline-definition-JXYKGLGB-CJlCgrZG.js → timeline-definition-JXYKGLGB-CLF-s_Xn.js} +1 -1
  72. package/dist/client/assets/transcript-scroll-fixture-DNVPzw5t.js +1 -0
  73. package/dist/client/assets/{use-project-header-navigation-CiQaJOL1.js → use-project-header-navigation-CGIZMabH.js} +1 -1
  74. package/dist/client/assets/{use-workspace-creation-draft-C3RiRR8k.js → use-workspace-creation-draft-Bl2dlNzf.js} +1 -1
  75. package/dist/client/assets/{use-workspace-project-navigation-CbZn30IF.js → use-workspace-project-navigation-B0LZj578.js} +1 -1
  76. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-CHObj7X3.js → usecaseDiagram-WPOLBNNX-CUYfjlrO.js} +1 -1
  77. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Xd-dPIKj.js → vennDiagram-Q3Y3IDCW-B9Upmplw.js} +1 -1
  78. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-BokIExdY.js → wardleyDiagram-IVAIDKWA-C9_DfFfF.js} +1 -1
  79. package/dist/client/assets/{websocket-5-7OEZJC.js → websocket-BT8C-OBP.js} +1 -1
  80. package/dist/client/assets/{workspace-creation-drop-drain-CIzVwNin.js → workspace-creation-drop-drain-BcuDXdq-.js} +1 -1
  81. package/dist/client/assets/{xychartDiagram-4URNHDU4-DylS60pI.js → xychartDiagram-4URNHDU4-wRTlHEa4.js} +1 -1
  82. package/dist/client/index.html +2 -2
  83. package/dist/src/backend/orchestration/testing/event-delivery.test-support.d.ts +1 -0
  84. package/dist/src/backend/orchestration/testing/event-delivery.test-support.d.ts.map +1 -1
  85. package/dist/src/backend/orchestration/testing/event-delivery.test-support.js +5 -3
  86. package/dist/src/backend/orchestration/testing/event-delivery.test-support.js.map +1 -1
  87. package/dist/src/backend/orchestration/testing/event-delivery.test-support.test.js +24 -1
  88. package/dist/src/backend/orchestration/testing/event-delivery.test-support.test.js.map +1 -1
  89. package/dist/src/backend/orchestration/testing/event-provider.test-support.d.ts +68 -0
  90. package/dist/src/backend/orchestration/testing/event-provider.test-support.d.ts.map +1 -1
  91. package/dist/src/backend/orchestration/testing/event-provider.test-support.js +24 -2
  92. package/dist/src/backend/orchestration/testing/event-provider.test-support.js.map +1 -1
  93. package/dist/src/backend/services/workspace/service/worktree/git-ops.service.d.ts.map +1 -1
  94. package/dist/src/backend/services/workspace/service/worktree/git-ops.service.js +3 -3
  95. package/dist/src/backend/services/workspace/service/worktree/git-ops.service.js.map +1 -1
  96. package/dist/src/backend/services/workspace/service/worktree/git-ops.service.test.js +30 -6
  97. package/dist/src/backend/services/workspace/service/worktree/git-ops.service.test.js.map +1 -1
  98. package/dist/src/backend/services/workspace/service/worktree/git-ops.symlink.integration.test.js +1 -4
  99. package/dist/src/backend/services/workspace/service/worktree/git-ops.symlink.integration.test.js.map +1 -1
  100. package/dist/src/backend/services/workspace-git-state.concurrency.test.js +6 -1
  101. package/dist/src/backend/services/workspace-git-state.concurrency.test.js.map +1 -1
  102. package/dist/src/backend/services/workspace-git-state.linux.test.d.ts +2 -0
  103. package/dist/src/backend/services/workspace-git-state.linux.test.d.ts.map +1 -0
  104. package/dist/src/backend/services/workspace-git-state.linux.test.js +68 -0
  105. package/dist/src/backend/services/workspace-git-state.linux.test.js.map +1 -0
  106. package/dist/src/backend/services/workspace-git-state.service.d.ts +4 -0
  107. package/dist/src/backend/services/workspace-git-state.service.d.ts.map +1 -1
  108. package/dist/src/backend/services/workspace-git-state.service.js +39 -7
  109. package/dist/src/backend/services/workspace-git-state.service.js.map +1 -1
  110. package/dist/src/backend/services/workspace-git-state.service.test.js +104 -3
  111. package/dist/src/backend/services/workspace-git-state.service.test.js.map +1 -1
  112. package/dist/src/backend/services/workspace-git-state.untracked.test.d.ts +2 -0
  113. package/dist/src/backend/services/workspace-git-state.untracked.test.d.ts.map +1 -0
  114. package/dist/src/backend/services/workspace-git-state.untracked.test.js +32 -0
  115. package/dist/src/backend/services/workspace-git-state.untracked.test.js.map +1 -0
  116. package/dist/src/backend/testing/event-fixture-teardown.integration.test.d.ts +2 -0
  117. package/dist/src/backend/testing/event-fixture-teardown.integration.test.d.ts.map +1 -0
  118. package/dist/src/backend/testing/event-fixture-teardown.integration.test.js +34 -0
  119. package/dist/src/backend/testing/event-fixture-teardown.integration.test.js.map +1 -0
  120. package/dist/src/backend/testing/event-generic-retry-claim-replacement.integration.test.js +2 -2
  121. package/dist/src/backend/testing/event-generic-retry-claim-replacement.integration.test.js.map +1 -1
  122. package/dist/src/backend/testing/event-generic-retry-recovery.integration.test.js +11 -10
  123. package/dist/src/backend/testing/event-generic-retry-recovery.integration.test.js.map +1 -1
  124. package/dist/src/backend/testing/event-run-recovery.integration.test.js +16 -13
  125. package/dist/src/backend/testing/event-run-recovery.integration.test.js.map +1 -1
  126. package/dist/src/test-utils/event-generic-retry.test-support.d.ts +2 -1
  127. package/dist/src/test-utils/event-generic-retry.test-support.d.ts.map +1 -1
  128. package/dist/src/test-utils/event-generic-retry.test-support.js +13 -11
  129. package/dist/src/test-utils/event-generic-retry.test-support.js.map +1 -1
  130. package/dist/tsconfig.backend.tsbuildinfo +1 -1
  131. package/package.json +3 -3
  132. package/dist/client/assets/admin-page-BKs0XqzO.js +0 -3
  133. package/dist/client/assets/detail-DqvApf5o.js +0 -2
  134. package/dist/client/assets/index-Ce6ptdgo.css +0 -2
  135. package/dist/client/assets/index-gfTO5SZD.js +0 -12
  136. package/dist/client/assets/kanban-D_X7dSIH.js +0 -1
  137. package/dist/client/assets/list-52S6CAc2.js +0 -1
  138. package/dist/client/assets/live-session-control-UXgPv9KX.js +0 -1
  139. package/dist/client/assets/mermaid-WFAXDIZX-BwPbxP76.js +0 -1
  140. package/dist/client/assets/project-BOC8jlMK.js +0 -1
  141. package/dist/client/assets/transcript-scroll-fixture-C9U3lgTX.js +0 -1
@@ -1 +1 @@
1
- import{i as e,n as t}from"./rolldown-runtime-COiEfhsA.js";import{n,t as r}from"./jsx-runtime-CldxteV5.js";import{D as i,n as a}from"./trpc-D9WuCSM1.js";import{r as o,t as s}from"./background-task-2TNZSSC3.js";import{_ as c,f as l,g as u,h as d,m as f,p}from"./status-indicators-Dvz22Kk_.js";import{t as m}from"./button-Dslj7pht.js";import{f as h}from"./use-persistent-scroll-DMRAfhA7.js";import{H as g,I as _,L as v,N as y,O as b,V as x,j as S,k as C,z as w}from"./index-gfTO5SZD.js";import{n as T}from"./workspace-cache-helpers-BGMIBN4v.js";import{n as E}from"./issue-start-prompt-DnjhUjO6.js";var D=t({IssueLaunchSheet:()=>j}),O=e(n(),1),k=r();function A(e){return e.provider===`linear`?`Linear`:`GitHub`}function j({issue:e,projectId:t,open:n,onOpenChange:r,onStarted:D}){let j=a.useUtils(),M=i(),{data:N,isLoading:P}=a.userSettings.get.useQuery(),F=(0,O.useMemo)(()=>E({url:e.url,prompt:N?.ticketDispatchPrompt}),[e.url,N?.ticketDispatchPrompt]),[I,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)(`non_interactive`),[B,V]=(0,O.useState)(`CLAUDE`),[H,U]=(0,O.useState)(F),W=(0,O.useRef)(!1),G=(0,O.useRef)(null),K=(0,O.useRef)(F),q=`kanban:issue-ratchet:${t}:${e.id}`,J=A(e),Y=`${e.provider}:${e.id}`,X=n&&G.current===Y&&K.current!==F&&H===K.current;(0,O.useEffect)(()=>{if(!n){W.current=!1,G.current=null,K.current=F;return}let e=K.current;G.current===Y?e!==F&&U(t=>t===e?F:t):(U(F),G.current=Y),K.current=F,N&&!W.current&&(V(N.defaultSessionProvider??`CLAUDE`),W.current=!0)},[n,F,N,Y]),(0,O.useEffect)(()=>{if(N){try{let e=window.localStorage.getItem(q);if(e===`true`||e===`false`){L(e===`true`);return}}catch{}L(N.ratchetEnabled)}},[q,N]);let Z=a.workspace.create.useMutation({onSuccess:e=>{T(M,e),s(j.workspace.listForProject.invalidate({projectId:t}),`Couldn't refresh data.`),r(!1),D?.()},onError:e=>{o.error(e.message||`Couldn't start workspace.`)}});return(0,k.jsx)(l,{open:n,onOpenChange:r,children:(0,k.jsxs)(p,{side:`right`,className:`w-full sm:max-w-md flex flex-col`,children:[(0,k.jsxs)(u,{children:[(0,k.jsx)(c,{className:`pr-6`,children:`Start issue`}),(0,k.jsxs)(f,{className:`line-clamp-2`,children:[e.displayId,` · `,e.title]})]}),(0,k.jsxs)(`div`,{className:`flex-1 min-h-0 space-y-4 overflow-y-auto`,children:[(0,k.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,k.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,k.jsx)(C,{htmlFor:`issue-mode-${e.id}`,className:`text-xs`,children:`Mode`}),(0,k.jsxs)(_,{value:R,onValueChange:e=>z(e),disabled:Z.isPending||P,children:[(0,k.jsx)(x,{id:`issue-mode-${e.id}`,className:`h-8 text-xs`,children:(0,k.jsx)(g,{})}),(0,k.jsxs)(v,{children:[(0,k.jsx)(w,{value:`non_interactive`,children:`Autonomous`}),(0,k.jsx)(w,{value:`plan`,children:`Planning`})]})]})]}),(0,k.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,k.jsx)(C,{htmlFor:`issue-provider-${e.id}`,className:`text-xs`,children:`Provider`}),(0,k.jsxs)(_,{value:B,onValueChange:e=>V(e),disabled:Z.isPending||P,children:[(0,k.jsx)(x,{id:`issue-provider-${e.id}`,className:`h-8 text-xs`,children:(0,k.jsx)(g,{})}),(0,k.jsxs)(v,{children:[(0,k.jsx)(w,{value:`CLAUDE`,children:`Claude`}),(0,k.jsx)(w,{value:`CODEX`,children:`Codex`})]})]})]})]}),(0,k.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border px-3 py-2`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`text-sm font-medium`,children:`Ratchet`}),(0,k.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:I?`On`:`Off`})]}),(0,k.jsx)(y,{enabled:I,state:`IDLE`,className:`h-6 w-6`,stopPropagation:!1,disabled:P||Z.isPending,onToggle:e=>{L(e);try{window.localStorage.setItem(q,String(e))}catch{}}})]}),(0,k.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,k.jsx)(C,{htmlFor:`issue-prompt-${e.id}`,className:`text-xs`,children:`Prompt`}),(0,k.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,asChild:!0,children:(0,k.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,k.jsx)(h,{className:`h-3.5 w-3.5`}),J]})})]}),(0,k.jsx)(b,{id:`issue-prompt-${e.id}`,value:H,onChange:e=>U(e.target.value),disabled:Z.isPending||P,className:`min-h-64 resize-y whitespace-pre-wrap bg-muted/20 font-mono text-xs leading-relaxed text-muted-foreground`})]})]}),(0,k.jsx)(d,{className:`pt-2`,children:(0,k.jsxs)(m,{onClick:()=>{let n=(X?F:H).trim();if(e.provider===`linear`&&e.linearIssueId&&e.linearIssueIdentifier)Z.mutate({type:`LINEAR_ISSUE`,projectId:t,issueId:e.linearIssueId,issueIdentifier:e.linearIssueIdentifier,issueUrl:e.url,name:e.title,ratchetEnabled:I,initialPrompt:n,startupModePreset:R,provider:B});else if(e.githubIssueNumber){if(!n){o.error(`Couldn't start workspace. Enter a prompt.`);return}Z.mutate({type:`GITHUB_ISSUE`,projectId:t,issueNumber:e.githubIssueNumber,issueUrl:e.url,name:e.title,ratchetEnabled:I,initialPrompt:n,startupModePreset:R,provider:B})}},disabled:Z.isPending||P||X||e.provider===`github`&&!H.trim(),className:`w-full sm:w-auto`,children:[(0,k.jsx)(S,{className:`h-4 w-4 mr-2`}),Z.isPending?`Starting…`:`Start`]})})]})})}export{D as n,j as t};
1
+ import{i as e,n as t}from"./rolldown-runtime-COiEfhsA.js";import{n,t as r}from"./jsx-runtime-CldxteV5.js";import{D as i,n as a}from"./trpc-D9WuCSM1.js";import{r as o,t as s}from"./background-task-2TNZSSC3.js";import{_ as c,f as l,g as u,h as d,m as f,p}from"./status-indicators-Dvz22Kk_.js";import{t as m}from"./button-Dslj7pht.js";import{f as h}from"./use-persistent-scroll-DMRAfhA7.js";import{H as g,I as _,L as v,N as y,O as b,V as x,j as S,k as C,z as w}from"./index-BHTworEd.js";import{n as T}from"./workspace-cache-helpers-BGMIBN4v.js";import{n as E}from"./issue-start-prompt-DnjhUjO6.js";var D=t({IssueLaunchSheet:()=>j}),O=e(n(),1),k=r();function A(e){return e.provider===`linear`?`Linear`:`GitHub`}function j({issue:e,projectId:t,open:n,onOpenChange:r,onStarted:D}){let j=a.useUtils(),M=i(),{data:N,isLoading:P}=a.userSettings.get.useQuery(),F=(0,O.useMemo)(()=>E({url:e.url,prompt:N?.ticketDispatchPrompt}),[e.url,N?.ticketDispatchPrompt]),[I,L]=(0,O.useState)(!1),[R,z]=(0,O.useState)(`non_interactive`),[B,V]=(0,O.useState)(`CLAUDE`),[H,U]=(0,O.useState)(F),W=(0,O.useRef)(!1),G=(0,O.useRef)(null),K=(0,O.useRef)(F),q=`kanban:issue-ratchet:${t}:${e.id}`,J=A(e),Y=`${e.provider}:${e.id}`,X=n&&G.current===Y&&K.current!==F&&H===K.current;(0,O.useEffect)(()=>{if(!n){W.current=!1,G.current=null,K.current=F;return}let e=K.current;G.current===Y?e!==F&&U(t=>t===e?F:t):(U(F),G.current=Y),K.current=F,N&&!W.current&&(V(N.defaultSessionProvider??`CLAUDE`),W.current=!0)},[n,F,N,Y]),(0,O.useEffect)(()=>{if(N){try{let e=window.localStorage.getItem(q);if(e===`true`||e===`false`){L(e===`true`);return}}catch{}L(N.ratchetEnabled)}},[q,N]);let Z=a.workspace.create.useMutation({onSuccess:e=>{T(M,e),s(j.workspace.listForProject.invalidate({projectId:t}),`Couldn't refresh data.`),r(!1),D?.()},onError:e=>{o.error(e.message||`Couldn't start workspace.`)}});return(0,k.jsx)(l,{open:n,onOpenChange:r,children:(0,k.jsxs)(p,{side:`right`,className:`w-full sm:max-w-md flex flex-col`,children:[(0,k.jsxs)(u,{children:[(0,k.jsx)(c,{className:`pr-6`,children:`Start issue`}),(0,k.jsxs)(f,{className:`line-clamp-2`,children:[e.displayId,` · `,e.title]})]}),(0,k.jsxs)(`div`,{className:`flex-1 min-h-0 space-y-4 overflow-y-auto`,children:[(0,k.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,k.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,k.jsx)(C,{htmlFor:`issue-mode-${e.id}`,className:`text-xs`,children:`Mode`}),(0,k.jsxs)(_,{value:R,onValueChange:e=>z(e),disabled:Z.isPending||P,children:[(0,k.jsx)(x,{id:`issue-mode-${e.id}`,className:`h-8 text-xs`,children:(0,k.jsx)(g,{})}),(0,k.jsxs)(v,{children:[(0,k.jsx)(w,{value:`non_interactive`,children:`Autonomous`}),(0,k.jsx)(w,{value:`plan`,children:`Planning`})]})]})]}),(0,k.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,k.jsx)(C,{htmlFor:`issue-provider-${e.id}`,className:`text-xs`,children:`Provider`}),(0,k.jsxs)(_,{value:B,onValueChange:e=>V(e),disabled:Z.isPending||P,children:[(0,k.jsx)(x,{id:`issue-provider-${e.id}`,className:`h-8 text-xs`,children:(0,k.jsx)(g,{})}),(0,k.jsxs)(v,{children:[(0,k.jsx)(w,{value:`CLAUDE`,children:`Claude`}),(0,k.jsx)(w,{value:`CODEX`,children:`Codex`})]})]})]})]}),(0,k.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border px-3 py-2`,children:[(0,k.jsxs)(`div`,{children:[(0,k.jsx)(`div`,{className:`text-sm font-medium`,children:`Ratchet`}),(0,k.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:I?`On`:`Off`})]}),(0,k.jsx)(y,{enabled:I,state:`IDLE`,className:`h-6 w-6`,stopPropagation:!1,disabled:P||Z.isPending,onToggle:e=>{L(e);try{window.localStorage.setItem(q,String(e))}catch{}}})]}),(0,k.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,k.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,k.jsx)(C,{htmlFor:`issue-prompt-${e.id}`,className:`text-xs`,children:`Prompt`}),(0,k.jsx)(m,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,asChild:!0,children:(0,k.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:[(0,k.jsx)(h,{className:`h-3.5 w-3.5`}),J]})})]}),(0,k.jsx)(b,{id:`issue-prompt-${e.id}`,value:H,onChange:e=>U(e.target.value),disabled:Z.isPending||P,className:`min-h-64 resize-y whitespace-pre-wrap bg-muted/20 font-mono text-xs leading-relaxed text-muted-foreground`})]})]}),(0,k.jsx)(d,{className:`pt-2`,children:(0,k.jsxs)(m,{onClick:()=>{let n=(X?F:H).trim();if(e.provider===`linear`&&e.linearIssueId&&e.linearIssueIdentifier)Z.mutate({type:`LINEAR_ISSUE`,projectId:t,issueId:e.linearIssueId,issueIdentifier:e.linearIssueIdentifier,issueUrl:e.url,name:e.title,ratchetEnabled:I,initialPrompt:n,startupModePreset:R,provider:B});else if(e.githubIssueNumber){if(!n){o.error(`Couldn't start workspace. Enter a prompt.`);return}Z.mutate({type:`GITHUB_ISSUE`,projectId:t,issueNumber:e.githubIssueNumber,issueUrl:e.url,name:e.title,ratchetEnabled:I,initialPrompt:n,startupModePreset:R,provider:B})}},disabled:Z.isPending||P||X||e.provider===`github`&&!H.trim(),className:`w-full sm:w-auto`,children:[(0,k.jsx)(S,{className:`h-4 w-4 mr-2`}),Z.isPending?`Starting…`:`Start`]})})]})})}export{D as n,j as t};
@@ -0,0 +1 @@
1
+ import{i as e,n as t}from"./rolldown-runtime-COiEfhsA.js";import{n,t as r}from"./jsx-runtime-CldxteV5.js";import{n as i}from"./trpc-D9WuCSM1.js";import{r as a,t as o}from"./background-task-2TNZSSC3.js";import{r as s,t as c}from"./utils-DQeSPVda.js";import{_ as l,f as u,g as d,m as f,p}from"./status-indicators-Dvz22Kk_.js";import{t as m}from"./spinner-BxeSV-Bb.js";import{t as h}from"./pending-request-presentation-BqY92kUN.js";import{t as g}from"./button-Dslj7pht.js";import{n as _,r as v}from"./image-drop-zone-NvcW7wXO.js";import{t as y}from"./loading-SklnwAL1.js";import{t as b}from"./input-uo3fNc4V.js";import{a as x,n as S,r as C,t as w}from"./Plus.es-wnPcLFe1.js";import{t as T}from"./use-mobile-Di9JSXG3.js";import{i as ee}from"./github-pr-preview-B2sd2tDg.js";import{C as E,b as D,i as O,m as k,n as A,r as j,s as M,t as N,v as te,y as ne}from"./chat-BsZewCkt.js";import{$ as P,Bt as F,Dt as I,Et as L,J as re,Jt as R,Kt as z,Ot as B,P as V,Q as H,Y as ie,Z as U,_ as W,ct as G,dt as K,et as q,j as J,nt as Y,on as ae,pt as X,rt as oe,u as se,vt as ce,xt as le,zt as ue}from"./index-BHTworEd.js";import{a as de,i as fe,n as pe,t as me}from"./card-D16by-Fq.js";import{t as he}from"./inline-workspace-form-DvVz3qgr.js";import{t as ge}from"./issue-launch-sheet-Cvig-i15.js";import{l as _e,n as ve,t as ye}from"./DotsThree.es-Dx8TXzzQ.js";import{n as be,t as xe}from"./kanban-card-xzqAUkmg.js";import{t as Se}from"./live-session-control-B9Xbg14T.js";var Z=e(n(),1);function Ce(e,t){let n=t.trim().toLocaleLowerCase();return n?e.filter(e=>[e.name,e.branchName,e.conversationSummary?.summary].some(e=>e?.toLocaleLowerCase().includes(n))):e}function we(e,t=`latest-message`){return[...e].sort((e,n)=>{let r=new Date(n.createdAt).getTime()-new Date(e.createdAt).getTime();if(t===`latest-message`&&e.kanbanColumn===`WAITING`&&n.kanbanColumn===`WAITING`){let t=e=>{let t=e.lastActivityAt?Date.parse(e.lastActivityAt):NaN;return Number.isFinite(t)?t:new Date(e.createdAt).getTime()};return t(n)-t(e)||r}return r})}var Q=r();function Te({search:e,onSearchChange:t}){let n=T(),r=(0,Q.jsx)(`div`,{className:n?`min-w-0 flex-1`:`ml-2 min-w-0 w-64 shrink`,children:(0,Q.jsx)(b,{className:`w-full min-w-0 h-8`,"aria-label":`Filter board`,placeholder:n?`Filter board…`:`Filter issues and workspaces…`,value:e,onChange:e=>t(e.target.value)})});return n?(0,Q.jsx)(ue,{children:r}):(0,Q.jsx)(F,{children:r})}var Ee=new Map([[`regular`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M230.92,212c-15.23-26.33-38.7-45.21-66.09-54.16a72,72,0,1,0-73.66,0C63.78,166.78,40.31,185.66,25.08,212a8,8,0,1,0,13.85,8c18.84-32.56,52.14-52,89.07-52s70.23,19.44,89.07,52a8,8,0,1,0,13.85-8ZM72,96a56,56,0,1,1,56,56A56.06,56.06,0,0,1,72,96Z`}))]]),De=Z.forwardRef((e,t)=>Z.createElement(s,{ref:t,...e,weights:Ee}));De.displayName=`UserIcon`;function Oe({issue:e,projectId:t}){let[n,r]=(0,Z.useState)(!1),i=e=>{e.preventDefault(),e.stopPropagation(),r(!0)},a=()=>{r(!0)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(me,{onClick:a,"data-testid":`issue-card`,className:`cursor-pointer hover:border-primary/50 transition-colors overflow-hidden border-dashed`,children:[(0,Q.jsx)(fe,{className:`pb-3`,children:(0,Q.jsx)(de,{className:`text-sm font-medium leading-tight line-clamp-2`,children:(0,Q.jsx)(`button`,{type:`button`,className:`text-left hover:underline`,onClick:a,"aria-label":`Start ${e.title}`,children:e.title})})}),(0,Q.jsx)(pe,{className:`pt-0`,children:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground min-w-0`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 shrink-0`,children:[(0,Q.jsx)(v,{className:`h-3 w-3 text-success`}),(0,Q.jsx)(`span`,{children:e.displayId})]}),(0,Q.jsxs)(S,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 truncate`,children:[(0,Q.jsx)(De,{className:`h-3 w-3 shrink-0`}),e.author]})}),(0,Q.jsxs)(C,{children:[`Opened by `,e.author,` on `,new Date(e.createdAt).toLocaleDateString()]})]})]}),(0,Q.jsx)(`a`,{onClick:e=>e.stopPropagation(),href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-xs text-muted-foreground hover:underline`,"aria-label":`Open ${e.displayId} externally`,children:`Open issue ↗`}),(0,Q.jsxs)(g,{size:`sm`,variant:`outline`,className:`h-6 px-2 text-xs shrink-0`,onClick:i,children:[(0,Q.jsx)(J,{className:`h-3 w-3 mr-1`}),`Start`]})]})})]}),n?(0,Q.jsx)(ge,{issue:e,projectId:t,open:n,onOpenChange:r}):null]})}var ke=(0,Z.createContext)(null);function $(){let e=(0,Z.useContext)(ke);if(!e)throw Error(`useKanban must be used within a KanbanProvider`);return e}function Ae({projectId:e,projectSlug:t,issueProvider:n,children:r}){let s=i.useUtils(),c=ee(e),{data:l,isLoading:u,isError:d,error:f,refetch:p}=ce(e),m=(0,Z.useMemo)(()=>l?.workspaces.filter(e=>e.kanbanColumn!==null),[l]),h=i.workspace.syncAllPRStatuses.useMutation({onError:e=>a.error(`Couldn't sync PR statuses. ${e.message}`)}),g=W(e),_=i.workspace.rename.useMutation({onError:e=>a.error(`Couldn't rename workspace. ${e.message}`)}),v=se(),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)([]),[C,w]=(0,Z.useState)(new Map),T=(0,Z.useMemo)(()=>new Map([...C.values()].flatMap(e=>[...e])),[C]),E=e=>{let t=Symbol(`issue suppression`);return w(n=>new Map(n).set(t,e)),()=>w(e=>{let n=new Map(e);return n.delete(t),n})},{issues:D,isFetching:O,status:k,error:A,refetch:j}=X(e,n,{workspaceIssueLinks:l?.workspaces,optimisticWorkspaceIssueLinks:T}),[M,N]=(0,Z.useState)(!1),[te,ne]=(0,Z.useState)(0),P=(0,Z.useCallback)(()=>{N(!0),ne(e=>e+1)},[]),[F,I]=(0,Z.useState)(null),L=(0,Z.useCallback)(e=>I(e),[]),re=(0,Z.useCallback)(()=>I(null),[]),R=(e,t)=>{if(_e(e)){S(e=>[...new Set([...e,...t])]);return}let n=typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?e.message:`Couldn't archive workspace`;a.error(n)},z=e=>{let t=new Map;for(let n of e)n.success||t.set(n.error,[...t.get(n.error)??[],n.id]);for(let[e,n]of t)R(e,n)},B=()=>{h.mutate({projectId:e,force:!0}),o(p(),`Couldn't refresh data.`),o(j(),`Couldn't refresh data.`)},V=async(e,t)=>{b(e);try{await g.mutateAsync({workspaceId:e,enabled:t})}catch{}finally{b(null)}},H=async(e,t)=>{await _.mutateAsync({id:e,name:t}),await Promise.all([p(),s.workspace.get.invalidate({id:e})])},ie=async(t,n=!1)=>{let r=m?.find(e=>e.id===t),i=E(new Map([[t,{githubIssueNumber:r?.githubIssueNumber??T.get(t)?.githubIssueNumber??null,linearIssueId:r?.linearIssueId??T.get(t)?.linearIssueId??null}]]));try{let r=await v.archiveWorkspace({projectId:e,id:t,removeGitIndexLock:n});z(r)}finally{i()}},U=async t=>{let n=(m??[]).filter(e=>e.kanbanColumn===t),r=n.map(e=>e.id),i=E(new Map(n.map(e=>[e.id,{githubIssueNumber:e.githubIssueNumber??null,linearIssueId:e.linearIssueId??null}])));try{let n=await v.archiveColumn({projectId:e,ids:r,kanbanColumn:t});z(n)}finally{i()}},G=()=>S([]),K=async e=>{let t=x;S([]);for(let n of t)await ie(n,e)},q=()=>{o(p(),`Couldn't refresh data.`),o(j(),`Couldn't refresh data.`)},J=(0,Z.useMemo)(()=>m?.filter(e=>!T.has(e.id)),[m,T]);return(0,Q.jsxs)(ke.Provider,{value:{projectId:e,projectSlug:t,unreadMailCounts:c.data,issueProvider:n,workspaces:J,issues:D,issuesStatus:k,isFetchingIssues:O,issuesError:A,refetchIssues:()=>{j()},isLoading:u,isError:d,error:f?{message:f.message}:null,refetch:q,syncAndRefetch:B,isSyncing:h.isPending,toggleWorkspaceRatcheting:V,togglingWorkspaceId:y,renameWorkspace:H,archiveWorkspace:ie,bulkArchiveColumn:U,archiveGitLockWorkspaceIds:x,dismissArchiveGitLock:G,retryGitLockedArchives:K,isBulkArchiving:v.isBulkArchiving,isArchiving:C.size>0||v.isArchiving||v.isBulkArchiving,showInlineForm:M,setShowInlineForm:N,inlineFormRequest:te,requestInlineForm:P,quickChatWorkspaceId:F,openQuickChat:L,closeQuickChat:re},children:[r,g.recipientPicker]})}function je({column:e,issues:t,projectId:n,onWorkspaceCreated:r,filtered:i}){let{workspaces:a,showInlineForm:o,setShowInlineForm:s,requestInlineForm:c,issuesStatus:l,isFetchingIssues:u,issuesError:d,refetchIssues:f,projectSlug:p}=$(),m=(0,Z.useMemo)(()=>a?.map(e=>e.name)??[],[a]),h=t.length===0,_=T();return(0,Q.jsxs)(`div`,{"data-todo-column":!0,className:`flex flex-col w-full md:flex-1 md:min-w-[280px] md:max-w-[440px] md:h-full`,children:[(0,Q.jsx)(`div`,{className:`flex h-13 shrink-0 items-center justify-between px-3 py-3 bg-muted/50 rounded-t-lg`,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.label}),(0,Q.jsx)(K,{variant:`secondary`,className:`h-5 min-w-5 justify-center text-xs`,children:t.length})]})}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 flex-1 md:overflow-y-auto p-3 min-h-0 rounded-b-lg bg-muted/50`,children:[!(_||o)&&(0,Q.jsxs)(g,{variant:`outline`,size:`sm`,className:`shrink-0 w-full justify-start`,onClick:c,children:[(0,Q.jsx)(w,{className:`h-4 w-4`}),`New workspace`]}),o?(0,Q.jsx)(he,{projectId:n,existingNames:m,onCancel:()=>s(!1),onCreated:()=>{s(!1),r?.()}},n):null,(h||l===`error`)&&(0,Q.jsx)(L,{status:l,isRetrying:u,filtered:i,error:d,projectSlug:p,onRetry:f}),!h&&t.map(e=>(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(Oe,{issue:e,projectId:n})},e.id))]})]})}var Me=new Map([[`regular`,Z.createElement(Z.Fragment,null,Z.createElement(`path`,{d:`M40,128a8,8,0,0,1,8-8h72a8,8,0,0,1,0,16H48A8,8,0,0,1,40,128Zm8-56h56a8,8,0,0,0,0-16H48a8,8,0,0,0,0,16ZM184,184H48a8,8,0,0,0,0,16H184a8,8,0,0,0,0-16ZM229.66,82.34l-40-40a8,8,0,0,0-11.32,0l-40,40a8,8,0,0,0,11.32,11.32L176,67.31V144a8,8,0,0,0,16,0V67.31l26.34,26.35a8,8,0,0,0,11.32-11.32Z`}))]]),Ne=Z.forwardRef((e,t)=>Z.createElement(s,{ref:t,...e,weights:Me}));Ne.displayName=`SortDescendingIcon`;function Pe({value:e,onChange:t}){return(0,Q.jsxs)(U,{children:[(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-7 w-7`,"aria-label":`Waiting sort order`,children:(0,Q.jsx)(Ne,{className:`h-4 w-4`})})}),(0,Q.jsxs)(H,{align:`end`,children:[(0,Q.jsx)(q,{children:`Sort by · newest first`}),(0,Q.jsxs)(Y,{value:e,onValueChange:e=>{(e===`latest-message`||e===`created`)&&t(e)},children:[(0,Q.jsx)(oe,{value:`latest-message`,children:`Latest message`}),(0,Q.jsx)(oe,{value:`created`,children:`Created`})]})]})]})}function Fe(e){return[{id:`ISSUES`,label:e===`LINEAR`?`Todo · My Linear Issues`:`Todo · My GitHub Issues`,shortLabel:`Todo`,description:`Issues assigned to you`},{id:`WORKING`,label:`Working`,description:`Agent is working`},{id:`WAITING`,label:`Waiting`,description:`Waiting for input`},{id:`DONE`,label:`Done`,description:`PR merged or closed`}]}function Ie({column:e,workspaces:t,projectSlug:n,waitingSortOrder:r,onWaitingSortOrderChange:i,unreadMailCounts:a,onToggleRatcheting:o,togglingWorkspaceId:s,onArchive:c,onBulkArchive:l,isBulkArchiving:u,onOpenQuickChat:d,onRename:f}){let p=e.id===`WAITING`&&r&&i,m=t.length===0,h=e.id===`DONE`&&!m;return(0,Q.jsxs)(`div`,{className:`flex flex-col w-full md:flex-1 md:min-w-[280px] md:max-w-[440px] md:h-full`,children:[(0,Q.jsxs)(`div`,{className:`flex h-13 shrink-0 items-center justify-between px-3 py-3 bg-muted/50 rounded-t-lg`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.label}),(0,Q.jsx)(K,{variant:`secondary`,className:`h-5 min-w-5 justify-center text-xs`,children:t.length})]}),p&&(0,Q.jsx)(Pe,{value:r,onChange:i}),h&&(0,Q.jsxs)(S,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsxs)(g,{variant:`ghost`,size:`sm`,onClick:l,disabled:u,className:`h-7 px-2`,children:[(0,Q.jsx)(R,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`ml-1 text-xs`,children:`Archive All`})]})}),(0,Q.jsx)(C,{children:`Archive all workspaces in this column`})]})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-3 flex-1 md:overflow-y-auto p-3 min-h-0 rounded-b-lg bg-muted/50`,children:m?(0,Q.jsx)(`div`,{className:`flex items-center justify-center h-[60px] md:h-[150px] text-muted-foreground text-sm`,children:e.description}):t.map(e=>(0,Q.jsx)(`div`,{className:`shrink-0 space-y-1`,children:(0,Q.jsx)(xe,{workspace:e,projectSlug:n,unreadCount:a?.[e.id],onToggleRatcheting:o,isTogglePending:s===e.id,onArchive:c,onOpenQuickChat:d,onRename:f})},e.id))})]})}function Le({sections:e,showInlineForm:t,inlineFormRequest:n,workspaceCreationRequest:r}){let i=(0,Z.useId)(),a=(0,Z.useRef)(null),o=(0,Z.useRef)(null),s=(0,Z.useRef)(new Map),l=(0,Z.useRef)(r),u=(0,Z.useRef)(null),[d,f]=(0,Z.useState)(`ISSUES`),p=e.filter(e=>e.visible),m=_(e=>{let t=e.filter(e=>e.visible),n=a.current,r=o.current,i=t[0];if(!(n&&r&&i))return;let c=n.getBoundingClientRect().top+r.offsetHeight+16,l=i.column.id;for(let{column:e}of t){let t=s.current.get(e.id);t&&t.getBoundingClientRect().top<=c&&(l=e.id)}f(l)}),h=_(e=>{let t=a.current,n=s.current.get(e);if(!(t&&n))return;let r=t.scrollTop+n.getBoundingClientRect().top-t.getBoundingClientRect().top-(o.current?.offsetHeight??0)-12;t.scrollTo?.({top:Math.max(0,r),behavior:`instant`}),n.contains(n.ownerDocument.activeElement)||n.focus({preventScroll:!0}),f(e)});return(0,Z.useEffect)(()=>{m(e)},[e,m]),(0,Z.useEffect)(()=>{t?u.current!==n&&(u.current=n,h(`ISSUES`)):u.current=null},[t,n,h]),(0,Z.useEffect)(()=>{r>l.current&&h(`WORKING`),l.current=r},[r,h]),(0,Q.jsxs)(`div`,{ref:a,"data-mobile-board":!0,style:{containerType:`size`},className:`min-h-0 flex-1 overflow-y-auto`,onScroll:()=>m(e),children:[(0,Q.jsx)(`nav`,{ref:o,"aria-label":`Board sections`,className:`sticky top-0 z-10 grid grid-cols-4 border-b bg-background`,children:e.map(({column:e,count:t,visible:n})=>(0,Q.jsxs)(`a`,{href:`#${i}-${e.id}`,"aria-current":n&&d===e.id?`location`:void 0,"aria-disabled":!n,onClick:t=>{t.preventDefault(),n&&h(e.id)},className:c(`flex h-10 min-w-0 items-center justify-center gap-1 border-b-2 px-1 text-xs font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,n&&d===e.id?`border-primary text-foreground`:`border-transparent text-muted-foreground`,!n&&`opacity-50`),children:[e.shortLabel??e.label,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:t})]},e.id))}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-4 pt-3 pb-4`,children:p.map(({column:e,content:t})=>(0,Q.jsx)(`section`,{id:`${i}-${e.id}`,"aria-label":e.shortLabel??e.label,tabIndex:-1,ref:t=>{t?s.current.set(e.id,t):s.current.delete(e.id)},className:`shrink-0 last:min-h-[calc(100cqh-3.25rem)] outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:t},e.id))})]})}function Re({workspaceId:e,codexAccountId:t,chatState:n,transcriptScroll:r,onRunQuickActionInNewChat:i,newChatUnavailableReason:a}){let{sendMessage:o,transcriptScroll:s}=N(n.sendMessage,r),c=ve(n.messages,n.runtimeSessionId,n.connected,n.sessionStatus.phase===`loading`),l=j(c.messages,{filterDuplicateResults:!0,groupBoundaries:n.transcriptPageBoundaries}),u=(0,Z.useMemo)(()=>new Set(n.queuedMessages.map(e=>e.id)),[n.queuedMessages]),d=n.sessionStatus.phase===`running`,f=n.sessionRuntime.work?.promptInFlight??d,p=n.sessionStatus.phase===`stopping`,m=n.sessionStatus.phase===`loading`,g=n.sessionStatus.phase===`starting`,_=ne(n.pendingRequest,n.sessionRuntime),v=f?`Message will be queued…`:`Type a message…`;return p?v=`Stopping…`:_&&d&&(v=h(_).composerPlaceholder),(0,Q.jsxs)(`div`,{className:`relative flex h-full flex-col overflow-hidden`,children:[(0,Q.jsx)(E,{sessionId:n.runtimeSessionId,thinkingInFooter:!0,pendingRequestType:d?_:null,workspaceId:e,messages:l,pendingMessages:n.pendingMessages,history:n.transcriptHistory,subagentTimelineError:c.error,runningSubagentIconIndices:c.runningSubagentIconIndices,acpPlan:n.acpPlan,running:d,work:n.sessionRuntime.work,controlSessionId:Se(n.runtimeSessionId,n.connected&&n.controlsHydrated,n.sessionRuntime),startingSession:g,loadingSession:m,latestThinking:n.latestThinking,scroll:s,isCompacting:n.isCompacting,queuedMessageIds:u,onRemoveQueuedMessage:n.removeQueuedMessage,onSteerQueuedMessage:n.connected&&f&&!p&&!n.isCompacting?n.steerQueuedMessage:void 0}),(0,Q.jsxs)(`div`,{className:`z-20 border-t bg-background pb-safe`,children:[(0,Q.jsx)(te,{permission:n.pendingRequest.type===`permission`?n.pendingRequest.request:null,onApprove:n.approvePermission}),(0,Q.jsx)(k,{question:n.pendingRequest.type===`question`?n.pendingRequest.request:null,onAnswer:n.answerQuestion}),(0,Q.jsx)(D,{onSend:o,onStop:n.stopChat,disabled:!n.connected||m,running:d,stopping:p,promptInFlight:f,inputRef:n.inputRef,placeholder:v,settings:n.chatSettings,capabilities:n.chatCapabilities,capabilitiesLoaded:n.chatCapabilitiesLoaded,onSettingsChange:n.updateSettings,slashCommands:n.slashCommands,slashCommandsLoaded:n.slashCommandsLoaded,value:n.inputDraft,onChange:n.setInputDraft,attachments:n.inputAttachments,onAttachmentsChange:n.setInputAttachments,pendingMessageCount:n.pendingMessages.size,workspaceId:e,codexAccountId:t,acpConfigOptions:n.acpConfigOptions,onSetConfigOption:n.setConfigOption,onRunQuickActionInNewChat:i,newChatUnavailableReason:a})]})]})}function ze(e,t,n){let r=(0,Z.useRef)(new Map),i=(0,Z.useRef)(new Map),a=`${e??`none`}/quick/${t??`none`}`,o=i.current.get(a)??0,s=(0,Z.useMemo)(()=>({active:!1,identity:a,revision:o}),[a,o]),c=(0,Z.useRef)(!1);(0,Z.useLayoutEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]),(0,Z.useLayoutEffect)(()=>(s.active=!0,()=>{s.active=!1}),[s]);let l=(0,Z.useCallback)(e=>{c.current&&s.active&&(i.current.get(a)??0)===o&&r.current.set(a,e)},[a,o,s]),u=(0,Z.useCallback)(t=>{let n=`${e??`none`}/quick/${t}`;i.current.set(n,(i.current.get(n)??0)+1)},[e]),d=(0,Z.useCallback)(t=>{let n=`${e??`none`}/quick/${t}`;u(t),r.current.delete(n)},[e,u]);return{transcriptScroll:{identity:a,active:e!==null,ready:e!==null&&t!==null&&n===t,initialIntent:`following`,initialPosition:r.current.get(a)??null,onPositionChange:l},clearSession:d,revokeSession:u}}function Be(e,t,n){return e?.workspaceId===t&&e.id===n}function Ve(e,t){let{data:n,error:r,refetch:a,isFetching:o}=i.session.listSessions.useQuery({workspaceId:e??``},{enabled:!!e,staleTime:0,refetchOnWindowFocus:!1}),[s,c]=(0,Z.useState)(null),l=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{if(!e){l.current=null,c(null);return}if(!n)return;let t=n.some(e=>e.id===s),r=l.current,i=Be(r,e,s);if(t&&i&&(l.current=null),t||i)return;if(n.length===0){c(null);return}let a=n[0];a&&c(a.id)},[e,n,s]);let u=O({dbSessionId:e?s:null}),{transcriptScroll:d,clearSession:f,revokeSession:p}=ze(e,s,u.runtimeSessionId),m=(0,Z.useRef)(e);(0,Z.useLayoutEffect)(()=>{m.current=e},[e]);let{createSession:h,deleteSession:g,createChat:_,createQuickAction:v}=A({workspaceId:e,workspaceProvider:t,sessions:n,onCreated:(e,t)=>{m.current===t&&(l.current={id:e.id,workspaceId:t,codexAccountId:e.codexAccountId},c(e.id))}}),y=(0,Z.useCallback)(e=>{if(!n||n.length===0)return;let t=n.findIndex(t=>t.id===e);if(t===-1)return;p(e);let r=e===s;if(g.mutate({id:e},{onSuccess:()=>f(e)}),r&&n.length>1){let e=n[t+1]??n[t-1];c(e?.id??null)}else n.length===1&&c(null)},[n,s,g,f,p]),b=n?.find(e=>e.id===s);return{sessions:n??[],sessionsLoaded:n!==void 0,sessionsError:r,refetchSessions:a,isFetchingSessions:o,selectedSessionId:s,selectedCodexAccountId:b?b.codexAccountId:e&&Be(l.current,e,s)?l.current?.codexAccountId:void 0,setSelectedSessionId:c,chatState:u,transcriptScroll:d,handleNewChat:_,handleCloseSession:y,handleQuickAction:v,isCreatingSession:h.isPending,isDeletingSession:g.isPending}}function He({sessionsLoaded:e,hasSessions:t,creating:n,disabled:r,disabledReason:i,onCreate:a,error:o,retrying:s,onRetry:c}){return!e&&o?(0,Q.jsx)(I,{title:`Couldn't load chats`,error:o,onRetry:c,isRetrying:s}):!e||n||t?(0,Q.jsx)(y,{size:`compact`,message:n?`Creating chat…`:`Loading sessions…`}):(0,Q.jsx)(B,{size:`compact`,title:`No chats yet`,description:i,action:(0,Q.jsx)(g,{variant:`outline`,size:`sm`,onClick:a,disabled:r,children:`New chat`})})}function Ue(e){return e.isError?`Couldn't load the chat limit.`:e.data===void 0?`Loading chat limit…`:null}function We({visible:e,retrying:t,onRetry:n}){return e?(0,Q.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-2 border-b px-4 py-2 text-sm`,children:[(0,Q.jsx)(`span`,{children:`Couldn't load the chat limit.`}),(0,Q.jsx)(g,{size:`sm`,variant:`outline`,disabled:t,onClick:n,children:`Retry chat limit`})]}):null}function Ge({workspaceId:e,onClose:t}){let{workspaces:n}=$(),r=(0,Z.useMemo)(()=>n?.find(t=>t.id===e)??null,[n,e]),a=r?.defaultSessionProvider===`CODEX`||r?.defaultSessionProvider===`CLAUDE`?r.defaultSessionProvider:void 0,o=i.userSettings.get.useQuery(void 0,{enabled:!!e&&!a,staleTime:3e4}),s=i.session.getMaxSessionsPerWorkspace.useQuery(void 0,{enabled:!!e}),c=a??o.data?.defaultSessionProvider,{sessions:m,selectedSessionId:h,selectedCodexAccountId:g,setSelectedSessionId:_,chatState:v,transcriptScroll:y,handleNewChat:b,handleCloseSession:x,handleQuickAction:S,isCreatingSession:C,isDeletingSession:w,sessionsLoaded:T,sessionsError:ee,refetchSessions:E,isFetchingSessions:D}=Ve(e,c),O=(0,Z.useMemo)(()=>m.map(e=>({id:e.id,status:e.status,name:e.name??null,workflow:e.workflow,provider:e.provider,createdAt:new Date(e.createdAt)})),[m]),k=(0,Z.useMemo)(()=>m.find(e=>e.isWorking)?.id??null,[m]),A=C||!e||!T,j=s.data,N=Ue(s)??V({sessions:T&&j!==void 0?m:void 0,maxSessions:j,hasWorktreePath:!!r?.worktreePath,isCreatingSession:C,isDeletingSession:w});return(0,Q.jsx)(u,{open:!!e,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(p,{side:`right`,className:`w-full sm:max-w-2xl flex flex-col p-0`,children:[(0,Q.jsxs)(d,{className:`px-4 pt-4 pb-0 shrink-0`,children:[(0,Q.jsx)(l,{className:`text-base leading-tight pr-8 truncate`,children:r?.name??`Quick Chat`}),(0,Q.jsx)(f,{className:`sr-only`,children:`Chat with the agent for this workspace`})]}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1 px-4 py-2 border-b shrink-0`,children:(0,Q.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,Q.jsx)(M,{sessions:O,workspaceProvider:c,currentSessionId:h,runningSessionId:k,onSelectSession:_,onCreateSession:b,onCloseSession:x,disabled:A,createDisabled:!!N})})}),(0,Q.jsx)(We,{visible:s.isError,retrying:s.isFetching,onRetry:()=>void s.refetch()}),(0,Q.jsx)(`div`,{className:`flex-1 min-h-0`,children:e&&h?(0,Q.jsx)(Re,{workspaceId:e,codexAccountId:g,chatState:v,transcriptScroll:y,onRunQuickActionInNewChat:S,newChatUnavailableReason:N}):e?(0,Q.jsx)(He,{sessionsLoaded:T,hasSessions:m.length>0,creating:C,disabled:A||!!N,disabledReason:N,onCreate:()=>b(),error:ee,retrying:D,onRetry:()=>{E()}}):null})]})})}var Ke=`kanban-waiting-sort-order`;function qe(){try{if(localStorage.getItem(Ke)===`created`)return`created`}catch{}return`latest-message`}function Je(){let[e,t]=(0,Z.useState)(qe);return(0,Z.useEffect)(()=>{let e=e=>{e.key!==Ke&&e.key!==null||e.storageArea!==null&&e.storageArea!==localStorage||t(qe())};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),[e,e=>{t(e);try{localStorage.setItem(Ke,e)}catch{}}]}var Ye=[];function Xe(){let{workspaces:e,projectId:t}=$();return(0,Q.jsx)(be,{workspaces:e??Ye,children:(0,Q.jsx)(Ze,{})},t)}function Ze(){let{unreadMailCounts:e,projectId:t,projectSlug:n,issueProvider:r,workspaces:i,issues:a,isLoading:s,isError:c,error:l,refetch:u,toggleWorkspaceRatcheting:d,togglingWorkspaceId:f,renameWorkspace:p,archiveWorkspace:m,bulkArchiveColumn:h,archiveGitLockWorkspaceIds:v,dismissArchiveGitLock:y,retryGitLockedArchives:b,isBulkArchiving:x,isArchiving:S,requestInlineForm:C,showInlineForm:w,inlineFormRequest:ee,quickChatWorkspaceId:E,openQuickChat:D,closeQuickChat:O}=$(),k=_((e,t)=>{o(d(e,t),`Couldn't update workspace.`)}),A=_(e=>{o(m(e),`Couldn't archive workspace.`)}),j=_(p),M=_(e=>{e||y()}),N=_(()=>{b(!1)}),te=_(()=>{b(!0)}),ne=T(),P=(0,Z.useMemo)(()=>Fe(r),[r]),[F,I]=(0,Z.useState)(0),[L,R]=(0,Z.useState)(``),[B,V]=Je(),[H,U]=(0,Z.useState)(!1),[W,G]=(0,Z.useState)(null),K=e=>{G(e),U(!0)},q=async()=>{W&&await h(W)},J=(0,Z.useMemo)(()=>{let e={WORKING:[],WAITING:[],DONE:[]};if(i)for(let t of Ce(i,L)){let n=t.kanbanColumn;n in e&&e[n].push(t)}for(let t of Object.keys(e))e[t]=we(e[t],B);return e},[i,L,B]),Y=(a??[]).filter(e=>`${e.title} ${e.displayId}`.toLocaleLowerCase().includes(L.trim().toLocaleLowerCase())),X=e=>e===`ISSUES`?Y.length:J[e]?.length??0,oe=(0,Q.jsx)(ie,{open:v.length>0,onOpenChange:M,workspaceCount:v.length,onRetry:N,onRemoveLockAndArchive:te});if(s)return(0,Q.jsx)(`div`,{className:`flex flex-col md:flex-row gap-3 md:gap-4 pb-4 h-full overflow-y-auto md:overflow-y-hidden md:overflow-x-auto mx-auto w-full max-w-[1800px]`,children:P.map(e=>(0,Q.jsxs)(`div`,{className:`flex flex-col w-full md:flex-1 md:min-w-[280px] md:max-w-[440px] md:h-full`,children:[(0,Q.jsx)(z,{className:`h-10 w-full rounded-t-lg rounded-b-none`}),(0,Q.jsx)(z,{className:`flex-1 w-full rounded-b-lg rounded-t-none`})]},e.id))});if(c)return(0,Q.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-center`,children:[(0,Q.jsxs)(`p`,{className:`text-destructive mb-4`,children:[`Couldn't load workspaces. `,l?.message??`Unknown error`]}),(0,Q.jsxs)(g,{variant:`outline`,onClick:()=>u(),children:[(0,Q.jsx)(ae,{className:`h-4 w-4 mr-2`}),`Retry`]})]});let se=r=>r.id===`ISSUES`?(0,Q.jsx)(je,{column:r,issues:Y,filtered:L.trim().length>0,projectId:t,onWorkspaceCreated:()=>{R(``),I(e=>e+1)}},r.id):(0,Q.jsx)(Ie,{column:r,workspaces:J[r.id]??[],projectSlug:n,waitingSortOrder:B,onWaitingSortOrderChange:V,unreadMailCounts:e,onToggleRatcheting:k,togglingWorkspaceId:f,onArchive:A,onBulkArchive:()=>K(r.id),isBulkArchiving:x,onOpenQuickChat:D,onRename:j},r.id),ce=W?(i??[]).filter(e=>e.kanbanColumn===W).length:0;return(0,Q.jsxs)(`div`,{className:`flex flex-col h-full min-h-0 gap-3`,children:[i?.length===0&&!w&&!S&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border p-4`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`font-medium`,children:`Create your first workspace`}),(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Start from an issue in Todo or describe a new task.`})]}),(0,Q.jsx)(g,{size:`sm`,onClick:C,children:`New workspace`})]}),(0,Q.jsx)(Te,{search:L,onSearchChange:R}),L&&Object.values(J).every(e=>e.length===0)&&Y.length===0&&(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No matching issues or workspaces`}),ne?(0,Q.jsx)(Le,{sections:P.map(e=>({column:e,count:X(e.id),visible:!L.trim()||X(e.id)>0||e.id===`ISSUES`&&w,content:se(e)})),showInlineForm:w,inlineFormRequest:ee,workspaceCreationRequest:F}):(0,Q.jsx)(`div`,{className:`flex flex-row gap-4 pb-4 flex-1 min-h-0 overflow-y-hidden overflow-x-auto mx-auto w-full max-w-[1800px]`,children:P.map(se)}),(0,Q.jsx)(re,{open:H,onOpenChange:U,onConfirm:()=>o(q(),`Couldn't archive workspaces.`),description:`This will archive all ${ce} ${ce===1?`workspace`:`workspaces`} in this column, including any hidden by filters. Running agents and processes will stop. Uncommitted changes will be committed before the worktrees are removed. Chat history and branches are kept. Worktree removal cannot be undone in the app.`}),oe,(0,Q.jsx)(Ge,{workspaceId:E,onClose:O})]})}function Qe({isMobile:e,isSyncing:t,onNewWorkspace:n,onRefresh:r}){return(0,Q.jsxs)(Q.Fragment,{children:[e&&(0,Q.jsxs)(g,{size:`sm`,className:`h-9 shrink-0`,onClick:n,children:[(0,Q.jsx)(w,{className:`h-4 w-4`}),`New workspace`]}),(0,Q.jsxs)(U,{children:[(0,Q.jsxs)(S,{children:[(0,Q.jsx)(x,{asChild:!0,children:(0,Q.jsx)(G,{asChild:!0,children:(0,Q.jsx)(g,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,"aria-label":`Board actions`,children:(0,Q.jsx)(ye,{className:`h-5 w-5`})})})}),(0,Q.jsx)(C,{children:`Board actions`})]}),(0,Q.jsx)(H,{align:`end`,children:(0,Q.jsxs)(P,{onSelect:r,disabled:t,children:[t?(0,Q.jsx)(m,{className:`h-4 w-4`,"aria-hidden":`true`}):(0,Q.jsx)(ae,{className:`h-4 w-4`}),t?`Syncing…`:`Sync now`]})})]})]})}function $e(){let{syncAndRefetch:e,isSyncing:t,requestInlineForm:n}=$(),r=T();return(0,Q.jsx)(Qe,{isMobile:r,isSyncing:t,onNewWorkspace:n,onRefresh:()=>e()})}function et({children:e}){let{projectId:t,setShowInlineForm:n}=$();return(0,Q.jsx)(le,{projectId:t,onDropAccepted:()=>n(!0),children:e})}var tt=t({IssueLaunchSheet:()=>ge});export{Ae as a,Xe as i,et as n,$ as o,$e as r,tt as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{t as r}from"./lib-D-JAPasO.js";import{n as i}from"./trpc-D9WuCSM1.js";import{t as a}from"./utils-DQeSPVda.js";import{t as o}from"./CheckCircle.es-WUl0_Fqk.js";import{d as s,l as c,o as l,s as u,u as d,y as f}from"./status-indicators-Dvz22Kk_.js";import{t as p}from"./Warning.es-BRY0GI4S.js";import{n as m}from"./pending-request-presentation-BqY92kUN.js";import{t as h}from"./button-Dslj7pht.js";import{r as g}from"./image-drop-zone-NvcW7wXO.js";import{_}from"./workspace-cache-reconciler-TKQHxUsu.js";import{a as v,n as y,r as b}from"./Plus.es-wnPcLFe1.js";import{a as x}from"./github-pr-preview-B2sd2tDg.js";import{J as S,M as C,N as w,Yt as T,d as E,dt as D,f as O,ft as k,j as A,kt as j,m as M,p as ee}from"./index-gfTO5SZD.js";import{a as N,i as P,n as F,t as I}from"./card-D16by-Fq.js";import{c as L,s as R,u as z}from"./DotsThree.es-C6Viu7Dq.js";import{t as B}from"./CircleDashed.es-Q7XmyA0_.js";var V=e(t(),1);function H({workspaceId:e,projectId:t,name:n,onRename:r}){let[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(n),[c,l]=(0,V.useState)(!1),u=(0,V.useRef)(null),d=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>(d.current={workspaceId:e,projectId:t,editing:!1,saving:!1},a(!1),l(!1),()=>{d.current=null}),[e,t]),(0,V.useLayoutEffect)(()=>{i&&u.current?.select()},[i]);let f=()=>{let e=d.current;e&&!e.editing&&!e.saving&&r&&(e.editing=!0,s(n),a(!0))},p=()=>{d.current&&(d.current.editing=!1),a(!1),s(n)};return{isEditing:i,editValue:o,setEditValue:s,isSaving:c,inputRef:u,handleStartEdit:f,handleSaveRename:async()=>{let t=d.current;if(!t?.editing||t.saving)return;let i=o.trim();if(!i||i===n||!r)p();else{t.saving=!0,l(!0);try{await r(e,i)}catch{d.current===t&&s(n)}finally{d.current===t&&(t.editing=!1,t.saving=!1,a(!1),l(!1))}}},handleCancelRename:p}}var U=n();function W(e){return e.code===`WAITING_FOR_CI`?`CI Running`:e.label}function G({statusReason:e}){return(0,U.jsx)(D,{variant:`outline`,"data-testid":`kanban-status-chip`,"data-status-tone":e.tone,className:a(`w-fit px-1.5 py-0.5 text-[10px] font-medium tracking-wide`,u(e.tone).chip),children:W(e)})}function K(){let e=null,t=new Set;return{get:()=>e,set:n=>{if(n!==e){e=n;for(let e of t)e()}},subscribe:e=>(t.add(e),()=>t.delete(e))}}var q=(0,V.createContext)(null),J=()=>()=>void 0;function Y({workspaces:e,children:t}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o]=(0,V.useState)(K),s=(0,V.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]);(0,V.useEffect)(()=>{n&&!s.has(n)&&r(null),i&&!s.has(i)&&a(null)},[s,n,i]);let c=s.get(n??``)??s.get(i??``),l=c&&(c.parentWorkspace||c.childWorkspaceCount||e.some(e=>e.parentWorkspace?.id===c.id))?c.parentWorkspace?.id??c.id:null;(0,V.useLayoutEffect)(()=>o.set(l),[o,l]);let u=(0,V.useMemo)(()=>({rootStore:o,setHovered:r,setFocused:a}),[o]);return(0,U.jsx)(q,{value:u,children:t})}function X(e){let t=e.id,n=e.parentWorkspace?.id??e.id,r=(0,V.useContext)(q),i=r?.rootStore,a=r?.setHovered,o=r?.setFocused,s=(0,V.useRef)(!1),c=(0,V.useSyncExternalStore)(i?.subscribe??J,()=>i?.get()===n);return(0,V.useEffect)(()=>()=>{a?.(e=>e===t?null:e),o?.(e=>e===t?null:e)},[t,a,o]),{highlighted:c,onMouseEnter:()=>a?.(t),onMouseLeave:()=>a?.(null),onPointerDownCapture:()=>{s.current=!0,o?.(null)},onKeyDownCapture:()=>{s.current=!1,o?.(t)},onFocusCapture:e=>{!s.current&&e.target.matches(`:focus-visible`)&&o?.(t)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(s.current=!1,o?.(null))}}}var Z={NONE:d,OPEN:s,DRAFT:B,APPROVED:o,CHANGES_REQUESTED:f,MERGED:c,CLOSED:R};function Q({prs:e}){let t=new Map;for(let n of e){let e=t.get(n.state)??[];e.push(n),t.set(n.state,e)}return[...t].map(([e,t])=>{let n=l(e)??{tone:`neutral`,label:`Syncing`},r=Z[e],i=`${t.map(e=>e.number?`#${e.number}`:e.url).join(`, `)}: ${n.label}`;return(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-label":i,className:a(`pointer-events-auto inline-flex items-center gap-0.5 rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,u(n.tone).text),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,U.jsx)(r,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),t.length>1&&(0,U.jsx)(`span`,{className:`text-[10px] font-medium`,children:t.length})]})}),(0,U.jsx)(b,{className:`max-w-xs break-words`,children:i})]},e)})}function te({status:e,errorMessage:t}){return e===`NEW`||e===`PROVISIONING`?null:(0,U.jsx)(ee,{status:e,errorMessage:t})}function ne(e){return e.linearIssueIdentifier&&e.linearIssueUrl?{label:e.linearIssueIdentifier,url:e.linearIssueUrl}:e.githubIssueNumber!=null&&e.githubIssueUrl?{label:`#${e.githubIssueNumber}`,url:e.githubIssueUrl}:null}function re({workspace:e,issue:t,showPR:n}){let r=k(e);return t||n||e.prs?.length?(0,U.jsxs)(`div`,{"data-testid":`issue-pr-row`,className:`pointer-events-none relative z-10 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground min-w-0 [&_button]:pointer-events-auto [&_a]:pointer-events-auto`,children:[t&&(0,U.jsxs)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),window.open(t.url,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(g,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:t.label})]}),e.prs?.length?(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(M,{workspaceId:e.id,projectId:e.projectId,prs:e.prs,monitoring:e.prMonitoring,reviewEnabled:!!e.worktreePath,readOnly:e.status===`ARCHIVED`||e.status===`ARCHIVING`,compact:!0}),(0,U.jsx)(Q,{prs:e.prs})]}):n&&r&&(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),window.open(r.url,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(s,{className:`h-3 w-3 shrink-0`}),(0,U.jsxs)(`span`,{children:[`#`,r.number]})]}),(0,U.jsx)(Q,{prs:[r]})]})]}):null}function ie({branchName:e}){return e?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground min-w-0`,children:[(0,U.jsx)(m,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{className:`font-mono truncate`,children:e})]}):null}function $({workspace:e,onArchive:t}){let[n,r]=(0,V.useState)(!1),o=!z(e),s=e.creationSource!==`CHILD_WORKSPACE`,{data:c}=i.workspace.listChildren.useQuery({parentWorkspaceId:e.id},{enabled:o&&n&&s}),l=c?.length??0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(h,{variant:`ghost`,size:`icon`,className:a(`h-6 w-6 hover:bg-destructive/10 hover:text-destructive shrink-0`,o&&`hover-reveal transition-opacity`),onClick:n=>{n.preventDefault(),n.stopPropagation(),o?r(!0):t(e.id)},"aria-label":`Archive workspace`,children:(0,U.jsx)(T,{className:`h-3 w-3`})})}),(0,U.jsx)(b,{children:`Archive workspace`})]}),o&&(0,U.jsx)(S,{open:n,onOpenChange:r,onConfirm:()=>t(e.id),activeChildCount:l})]})}function ae({workspace:e,ratchetEnabled:t,isTogglePending:n,isArchived:r,sessionRuntimeError:i,onToggleRatcheting:o,onArchive:s,onOpenQuickChat:c,onStartEdit:l}){let u=!r&&e.status!==`NEW`&&e.status!==`PROVISIONING`&&c;return(0,U.jsxs)(`div`,{className:`relative z-10 flex items-center gap-1.5 shrink-0`,children:[l&&!r&&(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0 hover-reveal transition-opacity`,"aria-label":`Rename workspace`,onClick:e=>{e.preventDefault(),e.stopPropagation(),l()},children:(0,U.jsx)(C,{className:`h-3 w-3`})})}),(0,U.jsx)(b,{children:`Rename workspace`})]}),u&&(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(h,{variant:`ghost`,size:`icon`,className:a(`h-6 w-6 shrink-0 relative`,!e.pendingRequestType&&`hover-reveal transition-opacity`),"aria-label":`Quick Chat`,onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e.id)},children:[(0,U.jsx)(L,{className:`h-3 w-3`}),e.pendingRequestType&&(0,U.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-warning`})]})}),(0,U.jsx)(b,{children:`Quick Chat`})]}),(0,U.jsx)(w,{enabled:t,state:e.ratchetState,animated:e.ratchetButtonAnimated??!1,className:`h-5 w-5 shrink-0`,disabled:n||r||!o,stopPropagation:!0,onToggle:t=>{o?.(e.id,t)}}),e.runScriptStatus===`RUNNING`&&(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(`span`,{children:(0,U.jsx)(A,{className:`h-3 w-3 text-running animate-pulse motion-reduce:animate-none`,weight:`fill`})})}),(0,U.jsx)(b,{children:`Dev server running`})]}),i&&(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(`span`,{children:(0,U.jsx)(p,{className:`h-3 w-3 text-destructive`})})}),(0,U.jsx)(b,{children:i})]}),(0,U.jsx)(te,{status:e.status,errorMessage:e.initErrorMessage}),!r&&s&&(0,U.jsx)($,{workspace:e,onArchive:s})]})}function oe(e){let t=k(e),n=!!(t&&t.state!==`NONE`&&t.number),r=ne(e),i=e.status===`ARCHIVING`||e.status===`ARCHIVED`,a=e.ratchetEnabled??!0,o=_(e.sessionSummaries)?.message,s=!!e.branchName,c=!!e.conversationSummary||!!e.statusReason||s||n||!!e.prs?.length||!!r||!!o||e.creationSource===`CHILD_WORKSPACE`||!!(e.parentWorkspace||e.childWorkspaceCount);return{showPR:n,issue:r,isArchived:i,ratchetEnabled:a,sessionRuntimeError:o??null,showBranch:s,hasMetadata:c}}function se({workspace:e,projectSlug:t}){return(0,U.jsx)(U.Fragment,{children:e.parentWorkspace||e.childWorkspaceCount?(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[e.parentWorkspace&&(0,U.jsx)(O,{parent:e.parentWorkspace,projectId:e.projectId}),(0,U.jsx)(E,{workspace:e,projectSlug:t,compact:!0},e.id)]}):e.creationSource===`CHILD_WORKSPACE`&&(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Child workspace`})})}var ce=(0,V.memo)(function({workspace:e,projectSlug:t,unreadCount:n,onToggleRatcheting:i,isTogglePending:o=!1,onArchive:s,onOpenQuickChat:c,onRename:l}){let{highlighted:u,...d}=X(e),{showPR:f,issue:m,isArchived:h,ratchetEnabled:g,sessionRuntimeError:_,showBranch:v,hasMetadata:y}=oe(e),{isEditing:b,editValue:S,setEditValue:C,isSaving:w,inputRef:T,handleStartEdit:E,handleSaveRename:D,handleCancelRename:O}=H({workspaceId:e.id,projectId:e.projectId,name:e.name,onRename:l});return(0,U.jsxs)(I,{...d,"data-workspace-id":e.id,"data-family-highlighted":u||void 0,className:a(`group cursor-pointer hover:border-primary/50 transition-colors overflow-hidden relative`,_&&`border-destructive/40 bg-destructive/5 hover:border-destructive/60`,e.isWorking&&`border-running-accent/80 dark:border-running/50 dark:bg-running/5`,e.pendingRequestType&&`border-warning/40 bg-warning/5 hover:border-warning/60`,h&&`opacity-60 border-dashed`,u&&`ring-2 ring-info/70 ring-inset`),children:[(0,U.jsx)(P,{className:`pb-2`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[b?(0,U.jsx)(`input`,{ref:T,readOnly:w,"aria-busy":w,"aria-label":`Workspace name`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),O()),e.stopPropagation()},onBlur:()=>void D(),onClick:e=>{e.preventDefault(),e.stopPropagation()},className:`relative z-10 flex-1 min-w-0 text-sm font-medium leading-tight bg-transparent border-b border-primary outline-none`}):(0,U.jsxs)(N,{className:`flex flex-1 items-start gap-1.5 min-w-0 text-sm font-medium leading-tight`,children:[e.creationSource===`PERIODIC_TASK`&&(0,U.jsx)(j,{role:`img`,"aria-label":`Agent workspace`,className:`h-3 w-3 mt-0.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(r,{to:`/projects/${t}/workspaces/${e.id}`,className:`min-w-0 line-clamp-2 [overflow-wrap:anywhere] after:absolute after:inset-0 after:rounded-xl focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:e.name}),(0,U.jsx)(x,{count:n})]}),(0,U.jsx)(ae,{workspace:e,ratchetEnabled:g,isTogglePending:o,isArchived:h,sessionRuntimeError:_,onToggleRatcheting:i,onArchive:s,onOpenQuickChat:c,onStartEdit:l&&!w?E:void 0})]})}),y&&(0,U.jsxs)(F,{className:`space-y-1`,children:[e.conversationSummary&&(0,U.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,title:`${e.conversationSummary.summary}\nSummary updated ${new Date(e.conversationSummary.generatedAt).toLocaleString()}`,children:e.conversationSummary.summary}),e.statusReason&&(0,U.jsx)(G,{statusReason:e.statusReason}),(0,U.jsx)(re,{workspace:e,issue:m,showPR:f}),v&&(0,U.jsx)(`div`,{className:`flex items-center`,children:(0,U.jsx)(ie,{branchName:e.branchName})}),(0,U.jsx)(se,{workspace:e,projectSlug:t}),_&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-destructive min-w-0`,children:[(0,U.jsx)(p,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:_})]})]})]})});export{Y as n,ce as t};
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{t as r}from"./lib-D-JAPasO.js";import{n as i}from"./trpc-D9WuCSM1.js";import{t as a}from"./utils-DQeSPVda.js";import{t as o}from"./CheckCircle.es-WUl0_Fqk.js";import{d as s,l as c,o as l,s as u,u as d,y as f}from"./status-indicators-Dvz22Kk_.js";import{t as p}from"./Warning.es-BRY0GI4S.js";import{n as m}from"./pending-request-presentation-BqY92kUN.js";import{t as h}from"./button-Dslj7pht.js";import{r as g}from"./image-drop-zone-NvcW7wXO.js";import{_}from"./workspace-cache-reconciler-TKQHxUsu.js";import{a as v,n as y,r as b}from"./Plus.es-wnPcLFe1.js";import{a as x}from"./github-pr-preview-B2sd2tDg.js";import{J as S,Jt as C,M as w,N as T,d as E,dt as D,f as O,ft as k,j as A,kt as j,m as M,p as ee}from"./index-BHTworEd.js";import{a as N,i as P,n as F,t as I}from"./card-D16by-Fq.js";import{c as L,s as R,u as z}from"./DotsThree.es-Dx8TXzzQ.js";import{t as B}from"./CircleDashed.es-Q7XmyA0_.js";var V=e(t(),1);function H({workspaceId:e,projectId:t,name:n,onRename:r}){let[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(n),[c,l]=(0,V.useState)(!1),u=(0,V.useRef)(null),d=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>(d.current={workspaceId:e,projectId:t,editing:!1,saving:!1},a(!1),l(!1),()=>{d.current=null}),[e,t]),(0,V.useLayoutEffect)(()=>{i&&u.current?.select()},[i]);let f=()=>{let e=d.current;e&&!e.editing&&!e.saving&&r&&(e.editing=!0,s(n),a(!0))},p=()=>{d.current&&(d.current.editing=!1),a(!1),s(n)};return{isEditing:i,editValue:o,setEditValue:s,isSaving:c,inputRef:u,handleStartEdit:f,handleSaveRename:async()=>{let t=d.current;if(!t?.editing||t.saving)return;let i=o.trim();if(!i||i===n||!r)p();else{t.saving=!0,l(!0);try{await r(e,i)}catch{d.current===t&&s(n)}finally{d.current===t&&(t.editing=!1,t.saving=!1,a(!1),l(!1))}}},handleCancelRename:p}}var U=n();function W(e){return e.code===`WAITING_FOR_CI`?`CI Running`:e.label}function G({statusReason:e}){return(0,U.jsx)(D,{variant:`outline`,"data-testid":`kanban-status-chip`,"data-status-tone":e.tone,className:a(`w-fit px-1.5 py-0.5 text-[10px] font-medium tracking-wide`,u(e.tone).chip),children:W(e)})}function K(){let e=null,t=new Set;return{get:()=>e,set:n=>{if(n!==e){e=n;for(let e of t)e()}},subscribe:e=>(t.add(e),()=>t.delete(e))}}var q=(0,V.createContext)(null),J=()=>()=>void 0;function Y({workspaces:e,children:t}){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o]=(0,V.useState)(K),s=(0,V.useMemo)(()=>new Map(e.map(e=>[e.id,e])),[e]);(0,V.useEffect)(()=>{n&&!s.has(n)&&r(null),i&&!s.has(i)&&a(null)},[s,n,i]);let c=s.get(n??``)??s.get(i??``),l=c&&(c.parentWorkspace||c.childWorkspaceCount||e.some(e=>e.parentWorkspace?.id===c.id))?c.parentWorkspace?.id??c.id:null;(0,V.useLayoutEffect)(()=>o.set(l),[o,l]);let u=(0,V.useMemo)(()=>({rootStore:o,setHovered:r,setFocused:a}),[o]);return(0,U.jsx)(q,{value:u,children:t})}function X(e){let t=e.id,n=e.parentWorkspace?.id??e.id,r=(0,V.useContext)(q),i=r?.rootStore,a=r?.setHovered,o=r?.setFocused,s=(0,V.useRef)(!1),c=(0,V.useSyncExternalStore)(i?.subscribe??J,()=>i?.get()===n);return(0,V.useEffect)(()=>()=>{a?.(e=>e===t?null:e),o?.(e=>e===t?null:e)},[t,a,o]),{highlighted:c,onMouseEnter:()=>a?.(t),onMouseLeave:()=>a?.(null),onPointerDownCapture:()=>{s.current=!0,o?.(null)},onKeyDownCapture:()=>{s.current=!1,o?.(t)},onFocusCapture:e=>{!s.current&&e.target.matches(`:focus-visible`)&&o?.(t)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||(s.current=!1,o?.(null))}}}var Z={NONE:d,OPEN:s,DRAFT:B,APPROVED:o,CHANGES_REQUESTED:f,MERGED:c,CLOSED:R};function Q({prs:e}){let t=new Map;for(let n of e){let e=t.get(n.state)??[];e.push(n),t.set(n.state,e)}return[...t].map(([e,t])=>{let n=l(e)??{tone:`neutral`,label:`Syncing`},r=Z[e],i=`${t.map(e=>e.number?`#${e.number}`:e.url).join(`, `)}: ${n.label}`;return(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"aria-label":i,className:a(`pointer-events-auto inline-flex items-center gap-0.5 rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,u(n.tone).text),onClick:e=>{e.preventDefault(),e.stopPropagation()},children:[(0,U.jsx)(r,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),t.length>1&&(0,U.jsx)(`span`,{className:`text-[10px] font-medium`,children:t.length})]})}),(0,U.jsx)(b,{className:`max-w-xs break-words`,children:i})]},e)})}function te({status:e,errorMessage:t}){return e===`NEW`||e===`PROVISIONING`?null:(0,U.jsx)(ee,{status:e,errorMessage:t})}function ne(e){return e.linearIssueIdentifier&&e.linearIssueUrl?{label:e.linearIssueIdentifier,url:e.linearIssueUrl}:e.githubIssueNumber!=null&&e.githubIssueUrl?{label:`#${e.githubIssueNumber}`,url:e.githubIssueUrl}:null}function re({workspace:e,issue:t,showPR:n}){let r=k(e);return t||n||e.prs?.length?(0,U.jsxs)(`div`,{"data-testid":`issue-pr-row`,className:`pointer-events-none relative z-10 flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-muted-foreground min-w-0 [&_button]:pointer-events-auto [&_a]:pointer-events-auto`,children:[t&&(0,U.jsxs)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),window.open(t.url,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(g,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:t.label})]}),e.prs?.length?(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsx)(M,{workspaceId:e.id,projectId:e.projectId,prs:e.prs,monitoring:e.prMonitoring,reviewEnabled:!!e.worktreePath,readOnly:e.status===`ARCHIVED`||e.status===`ARCHIVING`,compact:!0}),(0,U.jsx)(Q,{prs:e.prs})]}):n&&r&&(0,U.jsxs)(`div`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:e=>{e.preventDefault(),e.stopPropagation(),window.open(r.url,`_blank`,`noopener,noreferrer`)},className:`inline-flex items-center gap-1 text-muted-foreground hover:text-foreground`,children:[(0,U.jsx)(s,{className:`h-3 w-3 shrink-0`}),(0,U.jsxs)(`span`,{children:[`#`,r.number]})]}),(0,U.jsx)(Q,{prs:[r]})]})]}):null}function ie({branchName:e}){return e?(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted-foreground min-w-0`,children:[(0,U.jsx)(m,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{className:`font-mono truncate`,children:e})]}):null}function $({workspace:e,onArchive:t}){let[n,r]=(0,V.useState)(!1),o=!z(e),s=e.creationSource!==`CHILD_WORKSPACE`,{data:c}=i.workspace.listChildren.useQuery({parentWorkspaceId:e.id},{enabled:o&&n&&s}),l=c?.length??0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(h,{variant:`ghost`,size:`icon`,className:a(`h-6 w-6 hover:bg-destructive/10 hover:text-destructive shrink-0`,o&&`hover-reveal transition-opacity`),onClick:n=>{n.preventDefault(),n.stopPropagation(),o?r(!0):t(e.id)},"aria-label":`Archive workspace`,children:(0,U.jsx)(C,{className:`h-3 w-3`})})}),(0,U.jsx)(b,{children:`Archive workspace`})]}),o&&(0,U.jsx)(S,{open:n,onOpenChange:r,onConfirm:()=>t(e.id),activeChildCount:l})]})}function ae({workspace:e,ratchetEnabled:t,isTogglePending:n,isArchived:r,sessionRuntimeError:i,onToggleRatcheting:o,onArchive:s,onOpenQuickChat:c,onStartEdit:l}){let u=!r&&e.status!==`NEW`&&e.status!==`PROVISIONING`&&c;return(0,U.jsxs)(`div`,{className:`relative z-10 flex items-center gap-1.5 shrink-0`,children:[l&&!r&&(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-6 w-6 shrink-0 hover-reveal transition-opacity`,"aria-label":`Rename workspace`,onClick:e=>{e.preventDefault(),e.stopPropagation(),l()},children:(0,U.jsx)(w,{className:`h-3 w-3`})})}),(0,U.jsx)(b,{children:`Rename workspace`})]}),u&&(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsxs)(h,{variant:`ghost`,size:`icon`,className:a(`h-6 w-6 shrink-0 relative`,!e.pendingRequestType&&`hover-reveal transition-opacity`),"aria-label":`Quick Chat`,onClick:t=>{t.preventDefault(),t.stopPropagation(),c(e.id)},children:[(0,U.jsx)(L,{className:`h-3 w-3`}),e.pendingRequestType&&(0,U.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 h-2 w-2 rounded-full bg-warning`})]})}),(0,U.jsx)(b,{children:`Quick Chat`})]}),(0,U.jsx)(T,{enabled:t,state:e.ratchetState,animated:e.ratchetButtonAnimated??!1,className:`h-5 w-5 shrink-0`,disabled:n||r||!o,stopPropagation:!0,onToggle:t=>{o?.(e.id,t)}}),e.runScriptStatus===`RUNNING`&&(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(`span`,{children:(0,U.jsx)(A,{className:`h-3 w-3 text-running animate-pulse motion-reduce:animate-none`,weight:`fill`})})}),(0,U.jsx)(b,{children:`Dev server running`})]}),i&&(0,U.jsxs)(y,{children:[(0,U.jsx)(v,{asChild:!0,children:(0,U.jsx)(`span`,{children:(0,U.jsx)(p,{className:`h-3 w-3 text-destructive`})})}),(0,U.jsx)(b,{children:i})]}),(0,U.jsx)(te,{status:e.status,errorMessage:e.initErrorMessage}),!r&&s&&(0,U.jsx)($,{workspace:e,onArchive:s})]})}function oe(e){let t=k(e),n=!!(t&&t.state!==`NONE`&&t.number),r=ne(e),i=e.status===`ARCHIVING`||e.status===`ARCHIVED`,a=e.ratchetEnabled??!0,o=_(e.sessionSummaries)?.message,s=!!e.branchName,c=!!e.conversationSummary||!!e.statusReason||s||n||!!e.prs?.length||!!r||!!o||e.creationSource===`CHILD_WORKSPACE`||!!(e.parentWorkspace||e.childWorkspaceCount);return{showPR:n,issue:r,isArchived:i,ratchetEnabled:a,sessionRuntimeError:o??null,showBranch:s,hasMetadata:c}}function se({workspace:e,projectSlug:t}){return(0,U.jsx)(U.Fragment,{children:e.parentWorkspace||e.childWorkspaceCount?(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[e.parentWorkspace&&(0,U.jsx)(O,{parent:e.parentWorkspace,projectId:e.projectId}),(0,U.jsx)(E,{workspace:e,projectSlug:t,compact:!0},e.id)]}):e.creationSource===`CHILD_WORKSPACE`&&(0,U.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Child workspace`})})}var ce=(0,V.memo)(function({workspace:e,projectSlug:t,unreadCount:n,onToggleRatcheting:i,isTogglePending:o=!1,onArchive:s,onOpenQuickChat:c,onRename:l}){let{highlighted:u,...d}=X(e),{showPR:f,issue:m,isArchived:h,ratchetEnabled:g,sessionRuntimeError:_,showBranch:v,hasMetadata:y}=oe(e),{isEditing:b,editValue:S,setEditValue:C,isSaving:w,inputRef:T,handleStartEdit:E,handleSaveRename:D,handleCancelRename:O}=H({workspaceId:e.id,projectId:e.projectId,name:e.name,onRename:l});return(0,U.jsxs)(I,{...d,"data-workspace-id":e.id,"data-family-highlighted":u||void 0,className:a(`group cursor-pointer hover:border-primary/50 transition-colors overflow-hidden relative`,_&&`border-destructive/40 bg-destructive/5 hover:border-destructive/60`,e.isWorking&&`border-running-accent/80 dark:border-running/50 dark:bg-running/5`,e.pendingRequestType&&`border-warning/40 bg-warning/5 hover:border-warning/60`,h&&`opacity-60 border-dashed`,u&&`ring-2 ring-info/70 ring-inset`),children:[(0,U.jsx)(P,{className:`pb-2`,children:(0,U.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[b?(0,U.jsx)(`input`,{ref:T,readOnly:w,"aria-busy":w,"aria-label":`Workspace name`,value:S,onChange:e=>C(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing?(e.preventDefault(),e.currentTarget.blur()):e.key===`Escape`&&(e.preventDefault(),O()),e.stopPropagation()},onBlur:()=>void D(),onClick:e=>{e.preventDefault(),e.stopPropagation()},className:`relative z-10 flex-1 min-w-0 text-sm font-medium leading-tight bg-transparent border-b border-primary outline-none`}):(0,U.jsxs)(N,{className:`flex flex-1 items-start gap-1.5 min-w-0 text-sm font-medium leading-tight`,children:[e.creationSource===`PERIODIC_TASK`&&(0,U.jsx)(j,{role:`img`,"aria-label":`Agent workspace`,className:`h-3 w-3 mt-0.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(r,{to:`/projects/${t}/workspaces/${e.id}`,className:`min-w-0 line-clamp-2 [overflow-wrap:anywhere] after:absolute after:inset-0 after:rounded-xl focus-visible:outline-none focus-visible:after:ring-2 focus-visible:after:ring-ring`,children:e.name}),(0,U.jsx)(x,{count:n})]}),(0,U.jsx)(ae,{workspace:e,ratchetEnabled:g,isTogglePending:o,isArchived:h,sessionRuntimeError:_,onToggleRatcheting:i,onArchive:s,onOpenQuickChat:c,onStartEdit:l&&!w?E:void 0})]})}),y&&(0,U.jsxs)(F,{className:`space-y-1`,children:[e.conversationSummary&&(0,U.jsx)(`p`,{className:`line-clamp-2 text-xs text-muted-foreground`,title:`${e.conversationSummary.summary}\nSummary updated ${new Date(e.conversationSummary.generatedAt).toLocaleString()}`,children:e.conversationSummary.summary}),e.statusReason&&(0,U.jsx)(G,{statusReason:e.statusReason}),(0,U.jsx)(re,{workspace:e,issue:m,showPR:f}),v&&(0,U.jsx)(`div`,{className:`flex items-center`,children:(0,U.jsx)(ie,{branchName:e.branchName})}),(0,U.jsx)(se,{workspace:e,projectSlug:t}),_&&(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-destructive min-w-0`,children:[(0,U.jsx)(p,{className:`h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{className:`truncate`,children:_})]})]})]})});export{Y as n,ce as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-BWF7jMDv.js";import{Y as n,b as r,f as i,it as a,nt as o,tt as s,z as c}from"./chunk-DSNLSHJZ-CSSZ0uRv.js";import"./chunk-7S6XSTFO-v9BVbuJB.js";import"./chunk-YZO67HFG-DrH1RXFI.js";import"./chunk-AQDTSKZB-Bh2e4nVN.js";import{t as l}from"./chunk-5VM5RSS4-ZNzvKenW.js";import"./chunk-UHW7PFBP-FWZD9983.js";import"./chunk-HAGFOTED-CTCHAkn7.js";import{i as u,r as d}from"./chunk-ZAUX2LTX-slbBeHT4.js";import{r as f}from"./chunk-HNE4Q36P-SXol6mIL.js";import{n as p,o as m,r as h}from"./mermaid-diagram-DVBoFQ1A.js";var g=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,13],i=[1,12],a=[1,15],o=[1,16],s=[1,20],c=[1,19],l=[6,7,8],u=[1,26],d=[1,24],f=[1,25],p=[6,7,11],m=[1,31],h=[6,7,11,24],g=[1,6,13,16,17,20,23],_=[1,35],v=[1,36],y=[1,6,7,11,13,16,17,20,23],b=[1,38],x={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`KANBAN`,11:`EOF`,13:`SPACELIST`,16:`ICON`,17:`CLASS`,20:`NODE_DSTART`,21:`NODE_DESCR`,22:`NODE_DEND`,23:`NODE_ID`,24:`SHAPE_DATA`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace(`Stop NL `);break;case 9:r.getLogger().trace(`Stop EOF `);break;case 11:r.getLogger().trace(`Stop NL2 `);break;case 12:r.getLogger().trace(`Stop EOF2 `);break;case 15:r.getLogger().info(`Node: `,a[s-1].id),r.addNode(a[s-2].length,a[s-1].id,a[s-1].descr,a[s-1].type,a[s]);break;case 16:r.getLogger().info(`Node: `,a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 17:r.getLogger().trace(`Icon: `,a[s]),r.decorateNode({icon:a[s]});break;case 18:case 23:r.decorateNode({class:a[s]});break;case 19:r.getLogger().trace(`SPACELIST`);break;case 20:r.getLogger().trace(`Node: `,a[s-1].id),r.addNode(0,a[s-1].id,a[s-1].descr,a[s-1].type,a[s]);break;case 21:r.getLogger().trace(`Node: `,a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 22:r.decorateNode({icon:a[s]});break;case 27:r.getLogger().trace(`node found ..`,a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 28:this.$={id:a[s],descr:a[s],type:0};break;case 29:r.getLogger().trace(`node found ..`,a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 30:this.$=a[s-1]+a[s];break;case 31:this.$=a[s]}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},{6:r,9:22,12:11,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},{6:u,7:d,10:23,11:f},t(p,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:s,23:c}),t(p,[2,19]),t(p,[2,21],{15:30,24:m}),t(p,[2,22]),t(p,[2,23]),t(h,[2,25]),t(h,[2,26]),t(h,[2,28],{20:[1,32]}),{21:[1,33]},{6:u,7:d,10:34,11:f},{1:[2,7],6:r,12:21,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},t(g,[2,14],{7:_,11:v}),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(p,[2,16],{15:37,24:m}),t(p,[2,17]),t(p,[2,18]),t(p,[2,20],{24:b}),t(h,[2,31]),{21:[1,39]},{22:[1,40]},t(g,[2,13],{7:_,11:v}),t(y,[2,11]),t(y,[2,12]),t(p,[2,15],{24:b}),t(h,[2,30]),{22:[1,41]},t(h,[2,27]),t(h,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-BWF7jMDv.js";import{Y as n,b as r,f as i,it as a,nt as o,tt as s,z as c}from"./chunk-DSNLSHJZ-CSSZ0uRv.js";import"./chunk-7S6XSTFO-v9BVbuJB.js";import"./chunk-YZO67HFG-DrH1RXFI.js";import"./chunk-AQDTSKZB-Bh2e4nVN.js";import{t as l}from"./chunk-5VM5RSS4-ZNzvKenW.js";import"./chunk-UHW7PFBP-FWZD9983.js";import"./chunk-HAGFOTED-CTCHAkn7.js";import{i as u,r as d}from"./chunk-ZAUX2LTX-slbBeHT4.js";import{r as f}from"./chunk-HNE4Q36P-SXol6mIL.js";import{n as p,o as m,r as h}from"./mermaid-diagram-DHR-LEin.js";var g=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,4],r=[1,13],i=[1,12],a=[1,15],o=[1,16],s=[1,20],c=[1,19],l=[6,7,8],u=[1,26],d=[1,24],f=[1,25],p=[6,7,11],m=[1,31],h=[6,7,11,24],g=[1,6,13,16,17,20,23],_=[1,35],v=[1,36],y=[1,6,7,11,13,16,17,20,23],b=[1,38],x={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:`error`,6:`SPACELINE`,7:`NL`,8:`KANBAN`,11:`EOF`,13:`SPACELIST`,16:`ICON`,17:`CLASS`,20:`NODE_DSTART`,21:`NODE_DESCR`,22:`NODE_DEND`,23:`NODE_ID`,24:`SHAPE_DATA`},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace(`Stop NL `);break;case 9:r.getLogger().trace(`Stop EOF `);break;case 11:r.getLogger().trace(`Stop NL2 `);break;case 12:r.getLogger().trace(`Stop EOF2 `);break;case 15:r.getLogger().info(`Node: `,a[s-1].id),r.addNode(a[s-2].length,a[s-1].id,a[s-1].descr,a[s-1].type,a[s]);break;case 16:r.getLogger().info(`Node: `,a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 17:r.getLogger().trace(`Icon: `,a[s]),r.decorateNode({icon:a[s]});break;case 18:case 23:r.decorateNode({class:a[s]});break;case 19:r.getLogger().trace(`SPACELIST`);break;case 20:r.getLogger().trace(`Node: `,a[s-1].id),r.addNode(0,a[s-1].id,a[s-1].descr,a[s-1].type,a[s]);break;case 21:r.getLogger().trace(`Node: `,a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 22:r.decorateNode({icon:a[s]});break;case 27:r.getLogger().trace(`node found ..`,a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 28:this.$={id:a[s],descr:a[s],type:0};break;case 29:r.getLogger().trace(`node found ..`,a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 30:this.$=a[s-1]+a[s];break;case 31:this.$=a[s]}},`anonymous`),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:r,7:[1,10],9:9,12:11,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},{6:r,9:22,12:11,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},{6:u,7:d,10:23,11:f},t(p,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:s,23:c}),t(p,[2,19]),t(p,[2,21],{15:30,24:m}),t(p,[2,22]),t(p,[2,23]),t(h,[2,25]),t(h,[2,26]),t(h,[2,28],{20:[1,32]}),{21:[1,33]},{6:u,7:d,10:34,11:f},{1:[2,7],6:r,12:21,13:i,14:14,16:a,17:o,18:17,19:18,20:s,23:c},t(g,[2,14],{7:_,11:v}),t(y,[2,8]),t(y,[2,9]),t(y,[2,10]),t(p,[2,16],{15:37,24:m}),t(p,[2,17]),t(p,[2,18]),t(p,[2,20],{24:b}),t(h,[2,31]),{21:[1,39]},{22:[1,40]},t(g,[2,13],{7:_,11:v}),t(y,[2,11]),t(y,[2,12]),t(p,[2,15],{24:b}),t(h,[2,30]),{22:[1,41]},t(h,[2,27]),t(h,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};x.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CldxteV5.js";import{s as t}from"./hooks-CZYZW9i_.js";import{t as n}from"./components-Be4xRGcU.js";import{i as r}from"./lib-D-JAPasO.js";import{n as i}from"./trpc-D9WuCSM1.js";import{t as a}from"./loading-SklnwAL1.js";import{t as o}from"./github-pr-preview-B2sd2tDg.js";import{Ft as s,_t as c,gt as l,yt as u}from"./index-gfTO5SZD.js";import{t as d}from"./route-state-Df9dg6K0.js";var f=e();function p(){let e=l(),[i]=r(),o=t(),u=i.get(`repo`);if(e.projectsError)return(0,f.jsx)(d,{error:e.projectsError.message,onRetry:()=>{e.refetchProjects()}});if(!e.projects)return(0,f.jsx)(a,{message:`Loading projects…`});if(u!==null)return(0,f.jsx)(m,{repo:u});let p=e.projects.find(t=>t.slug===e.selectedProjectSlug)?.slug??c(e.projects);return(0,f.jsx)(n,{replace:!0,to:p?s(p,`reviews`)+o.search:`/projects/new`})}function m({repo:e}){let r=l(),c=t(),p=o.shape.repo.safeParse(e),m=p.success?p.data.toLowerCase():null,h=r.projects?.find(e=>e.slug===r.selectedProjectSlug),g=m?[h,...r.projects??[]].find(e=>e&&u(e)===m):void 0,_=!!m&&!g,v=i.project.list.useQuery({isArchived:!0},{enabled:_});if(!m)return(0,f.jsx)(d,{error:`Invalid GitHub repository in review link`});if(_&&v.error)return(0,f.jsx)(d,{error:v.error.message,onRetry:()=>{v.refetch()}});if(_&&!v.data)return(0,f.jsx)(a,{message:`Loading review project…`});let y=g??v.data?.find(e=>u(e)===m);return y?(0,f.jsx)(n,{replace:!0,to:s(y.slug,`reviews`)+c.search}):(0,f.jsx)(d,{error:`No configured project owns this review repository`})}export{p as default};
1
+ import{t as e}from"./jsx-runtime-CldxteV5.js";import{s as t}from"./hooks-CZYZW9i_.js";import{t as n}from"./components-Be4xRGcU.js";import{i as r}from"./lib-D-JAPasO.js";import{n as i}from"./trpc-D9WuCSM1.js";import{t as a}from"./loading-SklnwAL1.js";import{t as o}from"./github-pr-preview-B2sd2tDg.js";import{Ft as s,_t as c,gt as l,yt as u}from"./index-BHTworEd.js";import{t as d}from"./route-state-Df9dg6K0.js";var f=e();function p(){let e=l(),[i]=r(),o=t(),u=i.get(`repo`);if(e.projectsError)return(0,f.jsx)(d,{error:e.projectsError.message,onRetry:()=>{e.refetchProjects()}});if(!e.projects)return(0,f.jsx)(a,{message:`Loading projects…`});if(u!==null)return(0,f.jsx)(m,{repo:u});let p=e.projects.find(t=>t.slug===e.selectedProjectSlug)?.slug??c(e.projects);return(0,f.jsx)(n,{replace:!0,to:p?s(p,`reviews`)+o.search:`/projects/new`})}function m({repo:e}){let r=l(),c=t(),p=o.shape.repo.safeParse(e),m=p.success?p.data.toLowerCase():null,h=r.projects?.find(e=>e.slug===r.selectedProjectSlug),g=m?[h,...r.projects??[]].find(e=>e&&u(e)===m):void 0,_=!!m&&!g,v=i.project.list.useQuery({isArchived:!0},{enabled:_});if(!m)return(0,f.jsx)(d,{error:`Invalid GitHub repository in review link`});if(_&&v.error)return(0,f.jsx)(d,{error:v.error.message,onRetry:()=>{v.refetch()}});if(_&&!v.data)return(0,f.jsx)(a,{message:`Loading review project…`});let y=g??v.data?.find(e=>u(e)===m);return y?(0,f.jsx)(n,{replace:!0,to:s(y.slug,`reviews`)+c.search}):(0,f.jsx)(d,{error:`No configured project owns this review repository`})}export{p as default};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CldxteV5.js";import{f as t,s as n}from"./hooks-CZYZW9i_.js";import{t as r}from"./components-Be4xRGcU.js";import{n as i}from"./trpc-D9WuCSM1.js";import{t as a}from"./button-Dslj7pht.js";import{t as o}from"./loading-SklnwAL1.js";import{Ft as s,Mt as c,_t as l,gt as u,jt as d}from"./index-gfTO5SZD.js";var f=e();function p({id:e}){let t=u(),n=i.periodicTask.get.useQuery({id:e},{retry:!1}),s=t.projects?.find(e=>e.id===n.data?.projectId),l=i.project.getById.useQuery({id:n.data?.projectId??``},{enabled:!!n.data&&!s,retry:!1});if(n.error)return(0,f.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6`,children:[(0,f.jsx)(`p`,{children:n.error.data?.code===`NOT_FOUND`?`Agent not found. This agent is no longer available.`:`Couldn't load agent. ${n.error.message}`}),(0,f.jsx)(a,{onClick:()=>{n.refetch()},children:`Retry agent`})]});if(l.error&&!s)return(0,f.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6`,children:[(0,f.jsxs)(`p`,{children:[`Couldn't load agent project. `,l.error.message]}),(0,f.jsx)(a,{onClick:()=>{l.refetch()},children:`Retry project`})]});let d=s??l.data;return d?(0,f.jsx)(r,{replace:!0,to:c(d.slug,e)}):(0,f.jsx)(o,{message:`Loading agent project…`})}function m(){let e=u();if(e.projectsError)return(0,f.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6`,children:[(0,f.jsxs)(`p`,{children:[`Couldn't load projects. `,e.projectsError.message]}),(0,f.jsx)(a,{onClick:()=>{e.refetchProjects()},children:`Retry projects`})]});if(!e.projects)return(0,f.jsx)(o,{message:`Loading projects…`});let t=l(e.projects);return(0,f.jsx)(r,{replace:!0,to:t?s(t,`agents`):`/projects/new`})}function h(){let{id:e}=t(),r=n(),i=d(r.search);return!i||i===`event`?(0,f.jsx)(`p`,{role:`alert`,className:`p-6`,children:`Event agent links require an explicit project owner and a valid kind.`}):e?(0,f.jsx)(p,{id:e},e):(0,f.jsx)(m,{})}export{h as default};
1
+ import{t as e}from"./jsx-runtime-CldxteV5.js";import{f as t,s as n}from"./hooks-CZYZW9i_.js";import{t as r}from"./components-Be4xRGcU.js";import{n as i}from"./trpc-D9WuCSM1.js";import{t as a}from"./button-Dslj7pht.js";import{t as o}from"./loading-SklnwAL1.js";import{Ft as s,Mt as c,_t as l,gt as u,jt as d}from"./index-BHTworEd.js";var f=e();function p({id:e}){let t=u(),n=i.periodicTask.get.useQuery({id:e},{retry:!1}),s=t.projects?.find(e=>e.id===n.data?.projectId),l=i.project.getById.useQuery({id:n.data?.projectId??``},{enabled:!!n.data&&!s,retry:!1});if(n.error)return(0,f.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6`,children:[(0,f.jsx)(`p`,{children:n.error.data?.code===`NOT_FOUND`?`Agent not found. This agent is no longer available.`:`Couldn't load agent. ${n.error.message}`}),(0,f.jsx)(a,{onClick:()=>{n.refetch()},children:`Retry agent`})]});if(l.error&&!s)return(0,f.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6`,children:[(0,f.jsxs)(`p`,{children:[`Couldn't load agent project. `,l.error.message]}),(0,f.jsx)(a,{onClick:()=>{l.refetch()},children:`Retry project`})]});let d=s??l.data;return d?(0,f.jsx)(r,{replace:!0,to:c(d.slug,e)}):(0,f.jsx)(o,{message:`Loading agent project…`})}function m(){let e=u();if(e.projectsError)return(0,f.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-6`,children:[(0,f.jsxs)(`p`,{children:[`Couldn't load projects. `,e.projectsError.message]}),(0,f.jsx)(a,{onClick:()=>{e.refetchProjects()},children:`Retry projects`})]});if(!e.projects)return(0,f.jsx)(o,{message:`Loading projects…`});let t=l(e.projects);return(0,f.jsx)(r,{replace:!0,to:t?s(t,`agents`):`/projects/new`})}function h(){let{id:e}=t(),r=n(),i=d(r.search);return!i||i===`event`?(0,f.jsx)(`p`,{role:`alert`,className:`p-6`,children:`Event agent links require an explicit project owner and a valid kind.`}):e?(0,f.jsx)(p,{id:e},e):(0,f.jsx)(m,{})}export{h as default};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{i as r}from"./lib-D-JAPasO.js";import{n as i}from"./trpc-D9WuCSM1.js";import{t as a}from"./loading-SklnwAL1.js";import{Ht as o}from"./index-BHTworEd.js";import{a as s,i as c,n as l,o as u,r as d}from"./kanban-CWhDBIAX.js";import{t as f}from"./project-header-cDqQN0Dp.js";import{t as p}from"./use-workspace-project-navigation-B0LZj578.js";var m=e(t(),1),h=n();function g({project:e}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(f,{project:e}),(0,h.jsx)(o,{children:(0,h.jsx)(d,{})})]})}function _({onOpened:e}){let{requestInlineForm:t}=u();return(0,m.useEffect)(()=>{t(),e?.()},[t,e]),null}function v({projectId:e,projects:t,projectName:n,slug:r,issueProvider:i,openNewWorkspaceForm:a=!1,onNewWorkspaceFormOpened:o}){return(0,h.jsxs)(s,{projectId:e,projectSlug:r,issueProvider:i,children:[(0,h.jsx)(g,{project:t?.find(t=>t.id===e)??{id:e,slug:r,name:n??r}}),a?(0,h.jsx)(_,{onOpened:o}):null,(0,h.jsx)(l,{children:(0,h.jsx)(`div`,{className:`flex flex-col h-full p-3 md:p-6 gap-3 md:gap-4`,children:(0,h.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,h.jsx)(c,{})})})})]},e)}function y(){let{slug:e,projects:t}=p(),[n,o]=r(),s=n.has(`new`),c=(0,m.useCallback)(()=>{o(e=>{let t=new URLSearchParams(e);return t.delete(`new`),t},{replace:!0})},[o]),{data:l}=i.project.getBySlug.useQuery({slug:e});return l?(0,h.jsx)(v,{projectId:l.id,projectName:l.name,projects:t,slug:e,issueProvider:l.issueProvider,openNewWorkspaceForm:s,onNewWorkspaceFormOpened:c}):(0,h.jsx)(a,{message:`Loading project…`})}export{y as default};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{t as r}from"./lib-D-JAPasO.js";import{n as i}from"./trpc-D9WuCSM1.js";import{r as a,t as o}from"./background-task-2TNZSSC3.js";import{t as s}from"./spinner-BxeSV-Bb.js";import{t as c}from"./button-Dslj7pht.js";import{t as l}from"./loading-SklnwAL1.js";import{a as u,c as d,i as f,o as p,r as m,s as h,t as g}from"./dialog-LD_zPUYD.js";import{a as _,n as v,r as y,t as b}from"./Plus.es-wnPcLFe1.js";import{t as x}from"./use-mobile-Di9JSXG3.js";import{At as S,Dt as C,Ot as w,Wt as T,Yt as E,dt as D,g as O,k}from"./index-gfTO5SZD.js";import{t as A}from"./Folder.es-BA68BESp.js";import{a as j,i as M,n as N,o as P,r as F,t as I}from"./table-C-FjdTfP.js";import{n as L,t as R}from"./alert-XLfUZIWL.js";import{t as z}from"./startup-script-form-DHmnfAlm.js";var B=e(t(),1),V=n();function H({projectId:e,projectName:t,currentStartupScriptCommand:n,currentStartupScriptPath:r}){let[a,l]=(0,B.useState)(!1),[b,x]=(0,B.useState)(``),[C,w]=(0,B.useState)(`command`),[T,E]=(0,B.useState)(``),D=i.useUtils(),O=i.project.update.useMutation({onSuccess:()=>{o(D.project.list.invalidate(),`Couldn't refresh data.`),o(D.project.getById.invalidate({id:e}),`Couldn't refresh data.`),l(!1)},onError:e=>{E(e.message)}});return(0,B.useEffect)(()=>{a&&(w(r?`path`:`command`),x(r??n??``),E(``))},[a,n,r]),(0,V.jsxs)(g,{open:a,onOpenChange:l,children:[(0,V.jsxs)(v,{children:[(0,V.jsx)(_,{asChild:!0,children:(0,V.jsx)(d,{asChild:!0,children:(0,V.jsx)(c,{variant:`ghost`,size:`icon`,"aria-label":`Project settings`,children:(0,V.jsx)(S,{className:`h-4 w-4`})})})}),(0,V.jsx)(y,{children:`Settings`})]}),(0,V.jsxs)(m,{className:`px-3 py-4 sm:max-w-[500px] sm:p-4`,children:[(0,V.jsxs)(p,{children:[(0,V.jsx)(h,{children:`Project settings`}),(0,V.jsx)(f,{children:t})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-4`,children:[T&&(0,V.jsx)(R,{variant:`destructive`,children:(0,V.jsx)(L,{children:T})}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(k,{children:`Startup Script`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Runs automatically when a new workspace is created to set up the environment.`}),(0,V.jsx)(z,{scriptType:C,onScriptTypeChange:w,startupScript:b,onStartupScriptChange:x,idPrefix:`settings`,hideHeader:!0}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:C===`command`?`Enter a shell command to run (e.g., npm install)`:`Enter a path to a script file relative to the repository root`})]})]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(c,{variant:`outline`,onClick:()=>l(!1),children:`Cancel`}),(0,V.jsxs)(c,{onClick:()=>{E(``);let t=b.trim();O.mutate({id:e,startupScriptCommand:C===`command`&&t||null,startupScriptPath:C===`path`&&t||null})},disabled:O.isPending,children:[O.isPending&&(0,V.jsx)(s,{className:`mr-2`}),`Save Changes`]})]})]})]})}function U({projectId:e,projectName:t,startupScriptCommand:n,startupScriptPath:r,archivePending:i,onArchive:a}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(H,{projectId:e,projectName:t,currentStartupScriptCommand:n,currentStartupScriptPath:r}),(0,V.jsxs)(v,{children:[(0,V.jsx)(_,{asChild:!0,children:(0,V.jsx)(c,{variant:`ghost`,size:`icon`,"aria-label":`Archive ${t}`,onClick:a,disabled:i,className:`hover:bg-destructive/10 hover:text-destructive`,children:i?(0,V.jsx)(s,{className:`size-4`}):(0,V.jsx)(E,{className:`size-4`})})}),(0,V.jsx)(y,{children:`Archive`})]})]})}function W(){T({title:`Projects`});let[e,t]=(0,B.useState)(!1),[n,s]=(0,B.useState)(null),u=x(),{data:d,isLoading:f,error:p,isFetching:m,refetch:h}=i.project.list.useQuery({isArchived:!1},{refetchInterval:1e4}),g=i.project.archive.useMutation({onSuccess:()=>{t(!1),o(h({throwOnError:!0}),`Couldn't refresh data.`)},onError:e=>{a.error(e.message||`Couldn't archive project.`)}});return f?(0,V.jsx)(l,{message:`Loading projects…`}):(0,V.jsxs)(`div`,{className:`space-y-4 p-3 md:p-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Projects`}),(0,V.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:`Manage your repositories`})]}),(0,V.jsx)(c,{asChild:!0,size:u?`sm`:`default`,children:(0,V.jsxs)(r,{to:`/projects/new`,children:[(0,V.jsx)(b,{className:`size-5`}),`New Project`]})})]}),(0,V.jsx)(`div`,{className:`bg-card rounded-lg shadow-sm overflow-hidden border`,children:p&&!d?(0,V.jsx)(C,{title:`Couldn't load projects`,error:p,onRetry:()=>{h()},isRetrying:m}):!d||d.length===0?(0,V.jsx)(w,{icon:A,title:`No projects yet`,description:`Add a repository to start creating workspaces.`,action:(0,V.jsx)(c,{asChild:!0,variant:`outline`,size:`sm`,children:(0,V.jsxs)(r,{to:`/projects/new`,children:[(0,V.jsx)(b,{"aria-hidden":`true`}),`Create your first project`]})}),className:`p-8`}):u?(0,V.jsx)(`div`,{className:`space-y-2 p-2`,children:d.map(e=>(0,V.jsxs)(`div`,{className:`rounded-md border bg-background p-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,V.jsxs)(r,{to:`/projects/${e.slug}/workspaces`,className:`block min-w-0 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[(0,V.jsx)(`div`,{className:`font-medium text-foreground truncate hover:text-primary`,children:e.name}),(0,V.jsx)(`div`,{className:`text-sm text-muted-foreground truncate`,children:e.slug})]}),(0,V.jsx)(D,{variant:`secondary`,className:`max-w-full truncate font-mono text-xs`,children:e.repoPath})]}),(0,V.jsx)(U,{projectId:e.id,projectName:e.name,startupScriptCommand:e.startupScriptCommand,startupScriptPath:e.startupScriptPath,archivePending:g.isPending,onArchive:()=>{s(e.id),t(!0)}})]}),(0,V.jsxs)(`div`,{className:`mt-2 flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,V.jsxs)(`span`,{className:`truncate`,children:[`Branch: `,e.defaultBranch]}),(0,V.jsxs)(`span`,{children:[`Workspaces:`,` `,`_count`in e?e._count.workspaces:`-`]})]})]},e.id))}):(0,V.jsxs)(I,{children:[(0,V.jsx)(j,{children:(0,V.jsxs)(P,{children:[(0,V.jsx)(M,{children:`Name`}),(0,V.jsx)(M,{children:`Repository Path`}),(0,V.jsx)(M,{children:`Default Branch`}),(0,V.jsx)(M,{children:`Workspaces`}),(0,V.jsx)(M,{className:`w-[80px]`})]})}),(0,V.jsx)(N,{children:d.map(e=>(0,V.jsxs)(P,{children:[(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`font-medium text-foreground`,children:e.name}),(0,V.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.slug})]})}),(0,V.jsx)(F,{children:(0,V.jsx)(D,{variant:`secondary`,className:`font-mono text-xs`,children:e.repoPath})}),(0,V.jsx)(F,{className:`text-sm text-muted-foreground`,children:e.defaultBranch}),(0,V.jsx)(F,{className:`text-sm text-muted-foreground`,children:`_count`in e?e._count.workspaces:`-`}),(0,V.jsx)(F,{children:(0,V.jsx)(U,{projectId:e.id,projectName:e.name,startupScriptCommand:e.startupScriptCommand,startupScriptPath:e.startupScriptPath,archivePending:g.isPending,onArchive:()=>{s(e.id),t(!0)}})})]},e.id))})]})}),(0,V.jsx)(O,{open:e,onOpenChange:e=>{(e||!g.isPending)&&t(e)},title:`Archive project?`,description:`The project will be hidden from the project list. Its repository and workspaces are kept. There is no restore action in the app.`,confirmText:`Archive`,variant:`destructive`,onConfirm:()=>{n&&g.mutate({id:n})},isPending:g.isPending})]})}export{W as default};
1
+ import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{n as t,t as n}from"./jsx-runtime-CldxteV5.js";import{t as r}from"./lib-D-JAPasO.js";import{n as i}from"./trpc-D9WuCSM1.js";import{r as a,t as o}from"./background-task-2TNZSSC3.js";import{t as s}from"./spinner-BxeSV-Bb.js";import{t as c}from"./button-Dslj7pht.js";import{t as l}from"./loading-SklnwAL1.js";import{a as u,c as d,i as f,o as p,r as m,s as h,t as g}from"./dialog-LD_zPUYD.js";import{a as _,n as v,r as y,t as b}from"./Plus.es-wnPcLFe1.js";import{t as x}from"./use-mobile-Di9JSXG3.js";import{At as S,Dt as C,Jt as w,Ot as T,Ut as E,dt as D,g as O,k}from"./index-BHTworEd.js";import{t as A}from"./Folder.es-BA68BESp.js";import{a as j,i as M,n as N,o as P,r as F,t as I}from"./table-C-FjdTfP.js";import{n as L,t as R}from"./alert-XLfUZIWL.js";import{t as z}from"./startup-script-form-edXnfByI.js";var B=e(t(),1),V=n();function H({projectId:e,projectName:t,currentStartupScriptCommand:n,currentStartupScriptPath:r}){let[a,l]=(0,B.useState)(!1),[b,x]=(0,B.useState)(``),[C,w]=(0,B.useState)(`command`),[T,E]=(0,B.useState)(``),D=i.useUtils(),O=i.project.update.useMutation({onSuccess:()=>{o(D.project.list.invalidate(),`Couldn't refresh data.`),o(D.project.getById.invalidate({id:e}),`Couldn't refresh data.`),l(!1)},onError:e=>{E(e.message)}});return(0,B.useEffect)(()=>{a&&(w(r?`path`:`command`),x(r??n??``),E(``))},[a,n,r]),(0,V.jsxs)(g,{open:a,onOpenChange:l,children:[(0,V.jsxs)(v,{children:[(0,V.jsx)(_,{asChild:!0,children:(0,V.jsx)(d,{asChild:!0,children:(0,V.jsx)(c,{variant:`ghost`,size:`icon`,"aria-label":`Project settings`,children:(0,V.jsx)(S,{className:`h-4 w-4`})})})}),(0,V.jsx)(y,{children:`Settings`})]}),(0,V.jsxs)(m,{className:`px-3 py-4 sm:max-w-[500px] sm:p-4`,children:[(0,V.jsxs)(p,{children:[(0,V.jsx)(h,{children:`Project settings`}),(0,V.jsx)(f,{children:t})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-4`,children:[T&&(0,V.jsx)(R,{variant:`destructive`,children:(0,V.jsx)(L,{children:T})}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(k,{children:`Startup Script`}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Runs automatically when a new workspace is created to set up the environment.`}),(0,V.jsx)(z,{scriptType:C,onScriptTypeChange:w,startupScript:b,onStartupScriptChange:x,idPrefix:`settings`,hideHeader:!0}),(0,V.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:C===`command`?`Enter a shell command to run (e.g., npm install)`:`Enter a path to a script file relative to the repository root`})]})]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(c,{variant:`outline`,onClick:()=>l(!1),children:`Cancel`}),(0,V.jsxs)(c,{onClick:()=>{E(``);let t=b.trim();O.mutate({id:e,startupScriptCommand:C===`command`&&t||null,startupScriptPath:C===`path`&&t||null})},disabled:O.isPending,children:[O.isPending&&(0,V.jsx)(s,{className:`mr-2`}),`Save Changes`]})]})]})]})}function U({projectId:e,projectName:t,startupScriptCommand:n,startupScriptPath:r,archivePending:i,onArchive:a}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(H,{projectId:e,projectName:t,currentStartupScriptCommand:n,currentStartupScriptPath:r}),(0,V.jsxs)(v,{children:[(0,V.jsx)(_,{asChild:!0,children:(0,V.jsx)(c,{variant:`ghost`,size:`icon`,"aria-label":`Archive ${t}`,onClick:a,disabled:i,className:`hover:bg-destructive/10 hover:text-destructive`,children:i?(0,V.jsx)(s,{className:`size-4`}):(0,V.jsx)(w,{className:`size-4`})})}),(0,V.jsx)(y,{children:`Archive`})]})]})}function W(){E({title:`Projects`});let[e,t]=(0,B.useState)(!1),[n,s]=(0,B.useState)(null),u=x(),{data:d,isLoading:f,error:p,isFetching:m,refetch:h}=i.project.list.useQuery({isArchived:!1},{refetchInterval:1e4}),g=i.project.archive.useMutation({onSuccess:()=>{t(!1),o(h({throwOnError:!0}),`Couldn't refresh data.`)},onError:e=>{a.error(e.message||`Couldn't archive project.`)}});return f?(0,V.jsx)(l,{message:`Loading projects…`}):(0,V.jsxs)(`div`,{className:`space-y-4 p-3 md:p-6`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h1`,{className:`text-2xl font-bold text-foreground`,children:`Projects`}),(0,V.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:`Manage your repositories`})]}),(0,V.jsx)(c,{asChild:!0,size:u?`sm`:`default`,children:(0,V.jsxs)(r,{to:`/projects/new`,children:[(0,V.jsx)(b,{className:`size-5`}),`New Project`]})})]}),(0,V.jsx)(`div`,{className:`bg-card rounded-lg shadow-sm overflow-hidden border`,children:p&&!d?(0,V.jsx)(C,{title:`Couldn't load projects`,error:p,onRetry:()=>{h()},isRetrying:m}):!d||d.length===0?(0,V.jsx)(T,{icon:A,title:`No projects yet`,description:`Add a repository to start creating workspaces.`,action:(0,V.jsx)(c,{asChild:!0,variant:`outline`,size:`sm`,children:(0,V.jsxs)(r,{to:`/projects/new`,children:[(0,V.jsx)(b,{"aria-hidden":`true`}),`Create your first project`]})}),className:`p-8`}):u?(0,V.jsx)(`div`,{className:`space-y-2 p-2`,children:d.map(e=>(0,V.jsxs)(`div`,{className:`rounded-md border bg-background p-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,V.jsxs)(r,{to:`/projects/${e.slug}/workspaces`,className:`block min-w-0 rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,children:[(0,V.jsx)(`div`,{className:`font-medium text-foreground truncate hover:text-primary`,children:e.name}),(0,V.jsx)(`div`,{className:`text-sm text-muted-foreground truncate`,children:e.slug})]}),(0,V.jsx)(D,{variant:`secondary`,className:`max-w-full truncate font-mono text-xs`,children:e.repoPath})]}),(0,V.jsx)(U,{projectId:e.id,projectName:e.name,startupScriptCommand:e.startupScriptCommand,startupScriptPath:e.startupScriptPath,archivePending:g.isPending,onArchive:()=>{s(e.id),t(!0)}})]}),(0,V.jsxs)(`div`,{className:`mt-2 flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,V.jsxs)(`span`,{className:`truncate`,children:[`Branch: `,e.defaultBranch]}),(0,V.jsxs)(`span`,{children:[`Workspaces:`,` `,`_count`in e?e._count.workspaces:`-`]})]})]},e.id))}):(0,V.jsxs)(I,{children:[(0,V.jsx)(j,{children:(0,V.jsxs)(P,{children:[(0,V.jsx)(M,{children:`Name`}),(0,V.jsx)(M,{children:`Repository Path`}),(0,V.jsx)(M,{children:`Default Branch`}),(0,V.jsx)(M,{children:`Workspaces`}),(0,V.jsx)(M,{className:`w-[80px]`})]})}),(0,V.jsx)(N,{children:d.map(e=>(0,V.jsxs)(P,{children:[(0,V.jsx)(F,{children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`font-medium text-foreground`,children:e.name}),(0,V.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:e.slug})]})}),(0,V.jsx)(F,{children:(0,V.jsx)(D,{variant:`secondary`,className:`font-mono text-xs`,children:e.repoPath})}),(0,V.jsx)(F,{className:`text-sm text-muted-foreground`,children:e.defaultBranch}),(0,V.jsx)(F,{className:`text-sm text-muted-foreground`,children:`_count`in e?e._count.workspaces:`-`}),(0,V.jsx)(F,{children:(0,V.jsx)(U,{projectId:e.id,projectName:e.name,startupScriptCommand:e.startupScriptCommand,startupScriptPath:e.startupScriptPath,archivePending:g.isPending,onArchive:()=>{s(e.id),t(!0)}})})]},e.id))})]})}),(0,V.jsx)(O,{open:e,onOpenChange:e=>{(e||!g.isPending)&&t(e)},title:`Archive project?`,description:`The project will be hidden from the project list. Its repository and workspaces are kept. There is no restore action in the app.`,confirmText:`Archive`,variant:`destructive`,onConfirm:()=>{n&&g.mutate({id:n})},isPending:g.isPending})]})}export{W as default};
@@ -0,0 +1 @@
1
+ function e(e,t,n){if(t&&n.processState===`alive`&&[`running`,`idle`].includes(n.phase))return e??void 0}export{e as t};