dorkos 0.121.0 → 0.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) hide show
  1. package/dist/bin/cli.js +392 -347
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-CtI8gbER.js → AboutPage-ClN3P9B8.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-CHTXfBS7.js → ActivityErrorState-B2lq1pyE.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-B8p4yYJL.js → ActivityPage-htTkSy18.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-CSuSz-92.js → ActivityRow-BqV0B1T0.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-Qnxn0cE5.js → AdapterIcon-DlkN0YJo.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-BG8H-Lld.js → AdapterSetupWizard-RyNPjSmU.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-BWFQFynn.js → AgentOptionRow-DSievGfL.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-CL93SET3.js → AgentPicker-BCtWrhsA.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-CamX7Tvr.js → AgentRequestCard-BHIHWNRz.js} +1 -1
  13. package/dist/client/assets/{AppearancePage-rN70_7ih.js → AppearancePage-B2eduuT0.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-DeWaXbgm.js → ApplyToOverridesDialog-C7G2t3X2.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-CKcSWExi.js → AttentionSignalRow-_8thTHYX.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BwYaLf2P.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-WpZU5xiO.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-DqPDLYbF.js → BindingDialog-BAwbHFq3.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-DoAZs5bz.js → BlintzCanvas-BEtRmEbL.js} +3 -3
  19. package/dist/client/assets/{BlintzCanvas-xZ3u3nk7.css → BlintzCanvas-DCXOV_yN.css} +1 -1
  20. package/dist/client/assets/{CanvasCsvContent-ViqRJuhW.js → CanvasCsvContent--6i2ETyZ.js} +2 -2
  21. package/dist/client/assets/CanvasFileContent-C86nyLbI.js +2 -0
  22. package/dist/client/assets/CanvasModel3dContent-wYHHAovt.js +2 -0
  23. package/dist/client/assets/{ChatAppsOff-D0PbHYqF.js → ChatAppsOff-2Wvch1rr.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-DFNSXeuV.js → CodeMirrorDiff-s1TWguZ8.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-AgkgsSqN.js → CodeMirrorEditor-1ndoTbcZ.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-0V6QivXH.js → CommitmentList-BK97ndab.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-i3XoHwBj.js → CommitmentsPage-_nd37gVX.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-RPoBc-km.js → ComputerResourceView-C2Broer4.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-2ugaCd0H.js → ComputerViewer-DgG7t2KZ.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-DaPP4U96.js → ConnectionAccessLists-Pbo2lft8.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-BVqYvfk5.js → ConnectionsPage-Dm2d9owX.js} +1 -1
  32. package/dist/client/assets/{ConventionPage-BoqncrFd.js → ConventionPage-BUltejHJ.js} +1 -1
  33. package/dist/client/assets/{ExtensionPageRoute-BrOEeNX3.js → ExtensionPageRoute-DAomCiMw.js} +1 -1
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DLwix3K7.js → FloatingTanStackRouterDevtools-CqogiFob-5fT29ZEV.js} +1 -1
  35. package/dist/client/assets/HandlePage-BoBFGnUB.js +1 -0
  36. package/dist/client/assets/{HeartbeatPage-DgXhbaBJ.js → HeartbeatPage-BW0X4YAL.js} +1 -1
  37. package/dist/client/assets/{KeyEntry-CRr32Ae5.js → KeyEntry-ClqAj0dS.js} +1 -1
  38. package/dist/client/assets/{LexicalField-DeAoA6yr.js → LexicalField-CbswpPQ7.js} +1 -1
  39. package/dist/client/assets/{ManagesPage-ZBWYLTZx.js → ManagesPage-Daqs8hys.js} +1 -1
  40. package/dist/client/assets/{Marketplace-iL5p8Omt.js → Marketplace-BNMIm8g_.js} +4 -4
  41. package/dist/client/assets/{MarketplaceSourcesView-CsNLVOdP.js → MarketplaceSourcesView-B4WpzVpr.js} +1 -1
  42. package/dist/client/assets/{McpAppFrame-B1WPswgk.js → McpAppFrame-Dbg_Ni39.js} +1 -1
  43. package/dist/client/assets/{McpSigninBody-CJ28yu0o.js → McpSigninBody-ZmmY1BZ4.js} +1 -1
  44. package/dist/client/assets/{Model3dViewer-BIZWdK8g.js → Model3dViewer-DT8x0h7T.js} +1 -1
  45. package/dist/client/assets/NamePage-bC_9FOtD.js +1 -0
  46. package/dist/client/assets/{NewDirectMessageMenu-DRx9e9kM.js → NewDirectMessageMenu-BbehZd6I.js} +1 -1
  47. package/dist/client/assets/{NotificationsPage-cfqgSuVy.js → NotificationsPage-B9zEN26O.js} +1 -1
  48. package/dist/client/assets/{OpenMeshSwitch-BIIuKDku.js → OpenMeshSwitch-D-AYDXjH.js} +1 -1
  49. package/dist/client/assets/{OperatorIdentityForm-BKUSGrs6.js → OperatorIdentityForm-BdAqzVEG.js} +1 -1
  50. package/dist/client/assets/{PermissionHistory-Ctdqhib6.js → PermissionHistory-IOgLQ7qN.js} +1 -1
  51. package/dist/client/assets/{PermissionsPage-CYA_zdrV.js → PermissionsPage-CKfDf5Pj.js} +1 -1
  52. package/dist/client/assets/{PersonalityPopover-BR4Cpr2C.js → PersonalityPopover-CHPTuHIH.js} +1 -1
  53. package/dist/client/assets/PhotoPage-BOe3xwyN.js +1 -0
  54. package/dist/client/assets/{PresetPicker-zGvDOqTf.js → PresetPicker-BcKF2ds8.js} +1 -1
  55. package/dist/client/assets/{PreviewRefusedNotice-D1Tl265t.js → PreviewRefusedNotice-BuVUhjq3.js} +1 -1
  56. package/dist/client/assets/{ProfileFields-T3vVbHRC.js → ProfileFields-DimHNpR4.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-CParzTPA.js → ProfilePanelContainer-FRZ5Px2L.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-BU4eiMKn.js → ProfileRolePicker-UWhM5yuR.js} +1 -1
  59. package/dist/client/assets/{PromptSuggestionChips-CGNQc2Tf.js → PromptSuggestionChips-DQaDSd7Y.js} +1 -1
  60. package/dist/client/assets/{ReportsToPopover-Dj5U_Ppi.js → ReportsToPopover-BOuCM8il.js} +1 -1
  61. package/dist/client/assets/RoomSurface-Dhv-LkWz.js +44 -0
  62. package/dist/client/assets/{RoomsPage-Cvs3h6f0.js → RoomsPage-glKYJBpq.js} +1 -1
  63. package/dist/client/assets/{RunsOnPopover-BUlYwRW4.js → RunsOnPopover-BvxoHUeo.js} +1 -1
  64. package/dist/client/assets/{RuntimeConnectFlow-ChrvjC84.js → RuntimeConnectFlow-CgB_X5wo.js} +1 -1
  65. package/dist/client/assets/{RuntimeSetupDialog-BK9yo7YF.js → RuntimeSetupDialog-r1Ss_YQW.js} +1 -1
  66. package/dist/client/assets/{SessionsPage-CWUwU3US.js → SessionsPage-CFLDx-aF.js} +1 -1
  67. package/dist/client/assets/{SettingsDialog-BApzy0J8.js → SettingsDialog-BT5rYJUm.js} +1 -1
  68. package/dist/client/assets/{SkillsPage-z3XnApNX.js → SkillsPage-CUQZ4I_r.js} +1 -1
  69. package/dist/client/assets/{TaskDialogWrapper-BEWUpAlk.js → TaskDialogWrapper-DWpxyxBb.js} +1 -1
  70. package/dist/client/assets/{TasksEmptyState-CLwpLnIO.js → TasksEmptyState-B4TjUm8G.js} +1 -1
  71. package/dist/client/assets/{TasksPage-CyHjr9OZ.js → TasksPage-D_vFBDA1.js} +1 -1
  72. package/dist/client/assets/{TeamComputerEntry-BHHIofx3.js → TeamComputerEntry-EQ1fjMRb.js} +1 -1
  73. package/dist/client/assets/{ToolsPage-CckCco8x.js → ToolsPage-CyNXCe2l.js} +1 -1
  74. package/dist/client/assets/{TopologyGraph-Dox7aWP3.js → TopologyGraph-DsPEpDjt.js} +1 -1
  75. package/dist/client/assets/{TourHost-CTBewD-a.js → TourHost-D1z2mH5S.js} +1 -1
  76. package/dist/client/assets/{UnlinkDialog-CFRgExId.js → UnlinkDialog-q-6B4Ftt.js} +1 -1
  77. package/dist/client/assets/{WidgetErrorCard-Dx5oPMlF.js → WidgetErrorCard-BYMiUiAf.js} +1 -1
  78. package/dist/client/assets/_shell-scIpUrVY.js +80 -0
  79. package/dist/client/assets/{_shell._home-DnBkgWs4.js → _shell._home-D-8JcUYq.js} +1 -1
  80. package/dist/client/assets/{_shell._home.activity-CVCC-EEI.js → _shell._home.activity-xJKxWbtL.js} +1 -1
  81. package/dist/client/assets/{_shell._home.index-Ck6jxwIx.js → _shell._home.index-C74gh1aE.js} +1 -1
  82. package/dist/client/assets/{_shell._home.tasks-B7QQAZnA.js → _shell._home.tasks-Bh8jwRYJ.js} +1 -1
  83. package/dist/client/assets/{_shell._home.workspaces-DlrRd9tv.js → _shell._home.workspaces-BKkUl6wW.js} +1 -1
  84. package/dist/client/assets/{_shell.channels-CiWehoyl.js → _shell.channels-B2A1G9n8.js} +4 -4
  85. package/dist/client/assets/{_shell.connections-CGP5hZHq.js → _shell.connections-eDlPXmuG.js} +1 -1
  86. package/dist/client/assets/{_shell.feedback-requests-BxxNvw6j.js → _shell.feedback-requests-Cdbl3oKj.js} +1 -1
  87. package/dist/client/assets/_shell.marketplace-FHQpZxgB.js +1 -0
  88. package/dist/client/assets/_shell.marketplace_.sources-DXv90Z-v.js +1 -0
  89. package/dist/client/assets/_shell.session-BNeYm91q.js +63 -0
  90. package/dist/client/assets/{_shell.team-CsXH3NkS.js → _shell.team-Consxq97.js} +3 -3
  91. package/dist/client/assets/_shell.x._extensionId-DirEl_qN.js +1 -0
  92. package/dist/client/assets/_shell.x._extensionId_._-DirEl_qN.js +1 -0
  93. package/dist/client/assets/{abnfDiagram-WEYOIA3C-CMdkyiQ3.js → abnfDiagram-WEYOIA3C-DXTlLd8s.js} +1 -1
  94. package/dist/client/assets/{access-copy-CW-z1oMH.js → access-copy-B1SlOYEi.js} +1 -1
  95. package/dist/client/assets/{arc-Bw7tftQk.js → arc-B3IW5TXq.js} +1 -1
  96. package/dist/client/assets/{architectureDiagram-ZHVYKT53-BhpXALtX.js → architectureDiagram-ZHVYKT53-Bx-4szWe.js} +1 -1
  97. package/dist/client/assets/{banner-EomQNDOH.js → banner-RKoWGrEp.js} +1 -1
  98. package/dist/client/assets/{blockDiagram-RJAE7QA3-Bxk_BuZv.js → blockDiagram-RJAE7QA3-D_B3EDQ1.js} +1 -1
  99. package/dist/client/assets/{c4Diagram-XDPPPE54-CYN0FwR8.js → c4Diagram-XDPPPE54-CSBl4ROD.js} +1 -1
  100. package/dist/client/assets/{card-ww4ebz8h.js → card-DTMhLU7B.js} +1 -1
  101. package/dist/client/assets/channel-BlEJg4XA.js +1 -0
  102. package/dist/client/assets/{chunk-2E7WHVMD-IPDvYcPa.js → chunk-2E7WHVMD-QSgLcVHQ.js} +1 -1
  103. package/dist/client/assets/{chunk-2Q5K7J3B-DZ5bU5Ax.js → chunk-2Q5K7J3B-CAEYyBSj.js} +1 -1
  104. package/dist/client/assets/{chunk-4EMNKR2T-DrsWxa6Y.js → chunk-4EMNKR2T-CQ_90aiz.js} +1 -1
  105. package/dist/client/assets/{chunk-55XCU76K-CiBbKG0b.js → chunk-55XCU76K-jsUyUA3N.js} +1 -1
  106. package/dist/client/assets/{chunk-5VM5RSS4-B3K3MUav.js → chunk-5VM5RSS4-JHkf15PA.js} +1 -1
  107. package/dist/client/assets/{chunk-JWPE2WC7-CjV5RcIh.js → chunk-JWPE2WC7-BT-3krv8.js} +1 -1
  108. package/dist/client/assets/{chunk-VQ5W62QI-CWoRr0H2.js → chunk-VQ5W62QI-CJP11I5o.js} +1 -1
  109. package/dist/client/assets/{chunk-XXDRQBXY-E0nvzXiG.js → chunk-XXDRQBXY-BpqBecnj.js} +1 -1
  110. package/dist/client/assets/{chunk-ZCHMQSOR-DFop6Lvt.js → chunk-ZCHMQSOR-BLb4KcT4.js} +2 -2
  111. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-B7JJfc9z.js → classDiagram-v2-4MYWR3UA-DwLyYGkw.js} +1 -1
  112. package/dist/client/assets/{command-D4fLpJxA.js → command-DDSiiJlP.js} +1 -1
  113. package/dist/client/assets/{cose-bilkent-JH36ORCC-BjNppl29.js → cose-bilkent-JH36ORCC-CxYTET88.js} +1 -1
  114. package/dist/client/assets/{cpu-DCe0Yyml.js → cpu--56q_Ey0.js} +1 -1
  115. package/dist/client/assets/{cynefin-EF2NZ3EQ-PmRntJwW.js → cynefin-EF2NZ3EQ-9fHLZRHz.js} +1 -1
  116. package/dist/client/assets/{cynefinDiagram-WF24UDRP-Ctdbp_Vg.js → cynefinDiagram-WF24UDRP-DpfQecff.js} +1 -1
  117. package/dist/client/assets/{dagre-NK4GIZVX-5tvLY2ZW.js → dagre-NK4GIZVX-DuV6buEQ.js} +1 -1
  118. package/dist/client/assets/{diagram-CBK3MWTC-DZO-XBOO.js → diagram-CBK3MWTC-B-A9Sx5n.js} +1 -1
  119. package/dist/client/assets/{diagram-I5XIIV2D-CWBbA1Pv.js → diagram-I5XIIV2D-Ds5Hq9aV.js} +1 -1
  120. package/dist/client/assets/{diagram-ODIL2UCW-hP5A1tGl.js → diagram-ODIL2UCW-UUfSjM-R.js} +1 -1
  121. package/dist/client/assets/{diagram-PFBEJUXE-EI_-RoN7.js → diagram-PFBEJUXE-CUzSSYf9.js} +1 -1
  122. package/dist/client/assets/{diagram-RJA3I4VV-TrYq9A4Z.js → diagram-RJA3I4VV-Cgp6U3q1.js} +1 -1
  123. package/dist/client/assets/{diagram-TYUNFSNR-BAQq2OM5.js → diagram-TYUNFSNR-BxVgzMNE.js} +1 -1
  124. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-cKbeW9dQ.js → ebnfDiagram-V4P3TTPT-BgDiHzoi.js} +1 -1
  125. package/dist/client/assets/{elk-QONTBCTQ-wpfNPp0q.js → elk-QONTBCTQ-BCCN6mFs.js} +1 -1
  126. package/dist/client/assets/{empty-state-DXWQsHMf.js → empty-state-BsA3jcrO.js} +1 -1
  127. package/dist/client/assets/{erDiagram-KYQIGQAA-Dk0OrvjE.js → erDiagram-KYQIGQAA-5RkmUbLz.js} +1 -1
  128. package/dist/client/assets/{execution-config-CAyT2Qoo.js → execution-config-CRkSeCj7.js} +1 -1
  129. package/dist/client/assets/{file-Bf7D_47y.js → file-Bg_qGvWR.js} +1 -1
  130. package/dist/client/assets/{file-exclamation-point-DZXE9_8o.js → file-exclamation-point-BWsLZQVN.js} +1 -1
  131. package/dist/client/assets/{file-text-C1ougnBY.js → file-text-DQThCdY3.js} +1 -1
  132. package/dist/client/assets/{find-latest-widget-fence-B1_-pC-Z.js → find-latest-widget-fence-DFpYPIlS.js} +1 -1
  133. package/dist/client/assets/{flowDiagram-IUGLLWBU-CdlOoRZV.js → flowDiagram-IUGLLWBU-C2FFT_4u.js} +1 -1
  134. package/dist/client/assets/{form-D7kF-U0d.js → form-DjMe15QR.js} +1 -1
  135. package/dist/client/assets/{format-cron-ZtliseYi.js → format-cron-Bo3D4N9C.js} +1 -1
  136. package/dist/client/assets/{ganttDiagram-R7GPNTJY-x0MJLv5d.js → ganttDiagram-R7GPNTJY-BHG-HNDj.js} +1 -1
  137. package/dist/client/assets/{git-branch-B2k77X3Q.js → git-branch-CJ1NlVLY.js} +1 -1
  138. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-CruCvk7w.js → gitGraphDiagram-PDYL7XHY-D4bvs6_J.js} +1 -1
  139. package/dist/client/assets/{graph-5PBe05F8.js → graph-D8MBmHRU.js} +1 -1
  140. package/dist/client/assets/{heart-CmqGJPDc.js → heart-Beze5rli.js} +1 -1
  141. package/dist/client/assets/{highlighted-body-KPVGNVTW-Bqu2cQDj.js → highlighted-body-KPVGNVTW-B-za1R0D.js} +1 -1
  142. package/dist/client/assets/{image-lightbox-BBbz-ThL.js → image-lightbox-a4gqhNXS.js} +1 -1
  143. package/dist/client/assets/{image-off-BCtWIY4q.js → image-off-dQCXn9D_.js} +1 -1
  144. package/dist/client/assets/{index-8IAr9b71.js → index--vwACals.js} +1 -1
  145. package/dist/client/assets/{index-rWZWP3Wh.js → index-B3VKw60l.js} +1 -1
  146. package/dist/client/assets/index-B3ybVnXe.js +23 -0
  147. package/dist/client/assets/{index-DIxzqCwG.js → index-BJv8b9cZ.js} +1 -1
  148. package/dist/client/assets/{index-Cv0GsC4n.js → index-BMhblg3s.js} +1 -1
  149. package/dist/client/assets/{index-yI1r4pSP.js → index-BMktWriw.js} +1 -1
  150. package/dist/client/assets/{index-BIIH5CXj.js → index-BPa0ZczY.js} +1 -1
  151. package/dist/client/assets/{index-ClBIPuLA.js → index-BTVsyrd0.js} +1 -1
  152. package/dist/client/assets/{index-EdJm7ZN-.js → index-BTfwunle.js} +1 -1
  153. package/dist/client/assets/{index-DrA03bMq.js → index-BaocSCDH.js} +1 -1
  154. package/dist/client/assets/{index-BpmmNapD.js → index-Bk6YahnN.js} +1 -1
  155. package/dist/client/assets/{index-B5rRtvWx.js → index-BqwfU5a7.js} +1 -1
  156. package/dist/client/assets/index-BydIKjk5.js +1 -0
  157. package/dist/client/assets/{index-BfRW2WTx.js → index-C38pc-JE.js} +1 -1
  158. package/dist/client/assets/{index-BuGQxHrf.js → index-C9qjJR0B.js} +1 -1
  159. package/dist/client/assets/{index-C11Ssk2u.js → index-CAGOE4EU.js} +2 -2
  160. package/dist/client/assets/{index-DsJWzmWw.js → index-CDm1XkU1.js} +1 -1
  161. package/dist/client/assets/{index-JxeBJIuE.js → index-CGVRWEpN.js} +1 -1
  162. package/dist/client/assets/{index-BXMxoWrk.js → index-CMlVfxJv.js} +1 -1
  163. package/dist/client/assets/{index-Do6eeFps.js → index-CPxcbKL6.js} +2 -2
  164. package/dist/client/assets/{index-CMNc_OrC.js → index-CU-gekzq.js} +1 -1
  165. package/dist/client/assets/{index-CJ5v2_Cz.js → index-Ckv0K82u.js} +1 -1
  166. package/dist/client/assets/{index-mFOJXyAE.js → index-CocSe_I3.js} +3 -3
  167. package/dist/client/assets/{index-B6dEbNhI.js → index-CodC2rG4.js} +1 -1
  168. package/dist/client/assets/{index-DbDI5BAA.js → index-CxWJDJW7.js} +1 -1
  169. package/dist/client/assets/index-D18FqQKB.js +1 -0
  170. package/dist/client/assets/{index-ChwNEkM8.js → index-D4mYlxG0.js} +1 -1
  171. package/dist/client/assets/{index-DcZPWi_I.js → index-DBdO-_iL.js} +247 -247
  172. package/dist/client/assets/{index-BrQGZ6iF.js → index-DFN-GU8r.js} +1 -1
  173. package/dist/client/assets/{index-t4Ud6YTX.js → index-DLdpa3d4.js} +1 -1
  174. package/dist/client/assets/{index-8TfzCkKR.js → index-DNlhbCX_.js} +1 -1
  175. package/dist/client/assets/{index-DAdo_yIq.js → index-D_KBdkA4.js} +1 -1
  176. package/dist/client/assets/{index-BCk4wW-T.js → index-Dbt6ttQb.js} +1 -1
  177. package/dist/client/assets/{index-BXZlDqvy.js → index-DfSOcv9s.js} +1 -1
  178. package/dist/client/assets/{index-Dmn03xST.js → index-DnfhvN3q.js} +1 -1
  179. package/dist/client/assets/{index-CQ0VLZf-.js → index-DpX_xwGs.js} +1 -1
  180. package/dist/client/assets/{index-xmk9Ohv9.js → index-DqD-Sg0W.js} +1 -1
  181. package/dist/client/assets/{index-xaMF1mrN.js → index-Ds-LCBb6.js} +1 -1
  182. package/dist/client/assets/index-dnaC3n0i.js +17 -0
  183. package/dist/client/assets/{index-CtycM8wY.js → index-hKY0860x.js} +1 -1
  184. package/dist/client/assets/{index-BzPgsdPn.js → index-vNaWkS8Y.js} +1 -1
  185. package/dist/client/assets/{index-1ShgR_xt.js → index-vieeLeZH.js} +1 -1
  186. package/dist/client/assets/{index-Cml5572f.js → index-yDf4EVDy.js} +1 -1
  187. package/dist/client/assets/{index.esm-CZZtbPRj.js → index.esm-Ruqz-OsH.js} +1 -1
  188. package/dist/client/assets/{infoDiagram-MVDRKAX5-Bj9DD77n.js → infoDiagram-MVDRKAX5-CmDlX3lx.js} +1 -1
  189. package/dist/client/assets/{inline-code-g9PVHZI2.js → inline-code-plzdKGm9.js} +1 -1
  190. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DckI6dhS.js → ishikawaDiagram-HPEHV2GE-DZFRAvrx.js} +1 -1
  191. package/dist/client/assets/{journeyDiagram-BOSHW7O7-Ce1GAVa0.js → journeyDiagram-BOSHW7O7-B140KXYu.js} +1 -1
  192. package/dist/client/assets/{kanban-definition-FNSA4HC5-Kq5O9rZa.js → kanban-definition-FNSA4HC5-QCZgRJic.js} +1 -1
  193. package/dist/client/assets/{layers-D3lEdRF0.js → layers-Br3LALac.js} +1 -1
  194. package/dist/client/assets/{lightbulb-BFE-KkFU.js → lightbulb-CeJgUDoT.js} +1 -1
  195. package/dist/client/assets/{link-2-Dvb6g-2Q.js → link-2-BXcZwTAC.js} +1 -1
  196. package/dist/client/assets/{list-runtime-types-8YGEK3Al.js → list-runtime-types-CqKIrt9D.js} +1 -1
  197. package/dist/client/assets/{markdown-content-Cqq_QMXA.js → markdown-content-BKbjOTI2.js} +1 -1
  198. package/dist/client/assets/{mention-pill-Bnzt4u2l.js → mention-pill-B-FgNE6o.js} +1 -1
  199. package/dist/client/assets/{mermaid.core-dpp59v7L.js → mermaid.core-Br9hJ7FR.js} +4 -4
  200. package/dist/client/assets/{message-square-off-BX2XnEDx.js → message-square-off-Co0W--np.js} +1 -1
  201. package/dist/client/assets/{mindmap-definition-6OY57UG3-CFdfJO6g.js → mindmap-definition-6OY57UG3-BxjSZAec.js} +1 -1
  202. package/dist/client/assets/{more-details-B4lBMpKi.js → more-details-BsdCkGTg.js} +1 -1
  203. package/dist/client/assets/{owner-notice-ByjrIRmX.js → owner-notice-BxltHzJH.js} +1 -1
  204. package/dist/client/assets/{package-6Rbxg35g.js → package-DPgmy9lP.js} +1 -1
  205. package/dist/client/assets/{page-container-DoZzad36.js → page-container-HokGbFg_.js} +1 -1
  206. package/dist/client/assets/{paperclip-B-jDXtxw.js → paperclip-BDnApT-_.js} +1 -1
  207. package/dist/client/assets/{path-input-DpqUD8hN.js → path-input-C22n3ghr.js} +1 -1
  208. package/dist/client/assets/{pegDiagram-ECIUJNBX-eVnSw2Ma.js → pegDiagram-ECIUJNBX-utA2pUiu.js} +1 -1
  209. package/dist/client/assets/{pieDiagram-GNMPY74T-BYG7LY5Q.js → pieDiagram-GNMPY74T-DjEry_VP.js} +1 -1
  210. package/dist/client/assets/{plug-DnaAhcy4.js → plug-tLTAmXis.js} +1 -1
  211. package/dist/client/assets/{primer-trigger-Da5ECjY8.js → primer-trigger-CfVHNFbe.js} +1 -1
  212. package/dist/client/assets/{profile-errors-GbTNc2-M.js → profile-errors-Dvm4O6MR.js} +1 -1
  213. package/dist/client/assets/{progress-DlIRjXIA.js → progress-BduTwXMX.js} +1 -1
  214. package/dist/client/assets/{quadrantDiagram-D57K4MC3-CRgNKuHR.js → quadrantDiagram-D57K4MC3-DO9NgnEq.js} +1 -1
  215. package/dist/client/assets/{query-error-state-DB-Jby7_.js → query-error-state-puwJHnzi.js} +1 -1
  216. package/dist/client/assets/query-keys-DeYqUDia.js +1 -0
  217. package/dist/client/assets/{radio-CaaE60ws.js → radio-DR4E05zZ.js} +1 -1
  218. package/dist/client/assets/{railroadDiagram-Y72NRBL7-DGL-Hqz9.js → railroadDiagram-Y72NRBL7-BTilAS9p.js} +1 -1
  219. package/dist/client/assets/registry-B3Ss4ItQ.js +1 -0
  220. package/dist/client/assets/{relay-trace-schemas-CcCqyOrA.js → relay-trace-schemas-DwqIIDB9.js} +1 -1
  221. package/dist/client/assets/{requirementDiagram-EQYSW5RA-DKsFpU3l.js → requirementDiagram-EQYSW5RA-C6rzY7GK.js} +1 -1
  222. package/dist/client/assets/{room-files-source-CbbVpvSW.js → room-files-source-Duo4oiqX.js} +1 -1
  223. package/dist/client/assets/{rotate-ccw-clock-CeY00nlZ.js → rotate-ccw-clock-RJuoRE3k.js} +1 -1
  224. package/dist/client/assets/{rotate-cw-Djl5J_x9.js → rotate-cw-C0EpbK5k.js} +1 -1
  225. package/dist/client/assets/{sankeyDiagram-SY24JHO5-BFRkDxic.js → sankeyDiagram-SY24JHO5-BqpJRY1t.js} +1 -1
  226. package/dist/client/assets/{scroll-area-BOqrziJf.js → scroll-area-07T90PR6.js} +1 -1
  227. package/dist/client/assets/{search-x-B_mHjnlo.js → search-x-DQabogEL.js} +1 -1
  228. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-fHea3KOI.js → sequenceDiagram-BLEHNHQU-BHfzZpFt.js} +1 -1
  229. package/dist/client/assets/{shield-check-Csnr5rFy.js → shield-check-DbbCy17l.js} +1 -1
  230. package/dist/client/assets/{shield-x-Dhl4YvvW.js → shield-x-Cuo1GTv4.js} +1 -1
  231. package/dist/client/assets/{signed-in-BMqAss8c.js → signed-in-CFtA8gTK.js} +1 -1
  232. package/dist/client/assets/{sizeCapture-INFHLROL-CztsD3qF.js → sizeCapture-INFHLROL-U0MO-4ua.js} +1 -1
  233. package/dist/client/assets/{soul-file-DOfamgB5.js → soul-file-wKTqbR0Y.js} +1 -1
  234. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-CWyOqZ9S.js → stateDiagram-v2-A6IESKWZ-fzo1sDsX.js} +1 -1
  235. package/dist/client/assets/{swimlanes-B3ENRKFQ-0EfOxSAX.js → swimlanes-B3ENRKFQ-B7QcCUBU.js} +1 -1
  236. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CgZZnzbW.js +8 -0
  237. package/dist/client/assets/{table-L7FvN6Or.js → table-BjHA85BX.js} +1 -1
  238. package/dist/client/assets/{terminal-C9M5a_PS.js → terminal-qfxxVZaa.js} +1 -1
  239. package/dist/client/assets/{timeline-definition-JXYKGLGB-sFyYvZ20.js → timeline-definition-JXYKGLGB-okVlmef4.js} +1 -1
  240. package/dist/client/assets/{trust-posture-dl6qwDtI.js → trust-posture-BmW0KVP6.js} +1 -1
  241. package/dist/client/assets/{unplug-CFUEVRbc.js → unplug-BYKBdSMl.js} +1 -1
  242. package/dist/client/assets/{unverified-catalog-notice-CdYU3WEJ.js → unverified-catalog-notice-CQHA4Cst.js} +1 -1
  243. package/dist/client/assets/{use-adapter-catalog-YTofdqDJ.js → use-adapter-catalog-rB4qQQ5D.js} +1 -1
  244. package/dist/client/assets/{use-bindings-CpyT6kNu.js → use-bindings-DiFC7kWg.js} +1 -1
  245. package/dist/client/assets/{use-composer-prefs-CK_EK_QJ.js → use-composer-prefs-DHY5vJ0l.js} +1 -1
  246. package/dist/client/assets/{use-connector-management-DwoK8kon.js → use-connector-management-CoinXIID.js} +1 -1
  247. package/dist/client/assets/{use-deep-link-scroll-CgRjt48R.js → use-deep-link-scroll-Cm8BRFAE.js} +1 -1
  248. package/dist/client/assets/{use-delete-binding-CfsnMXrL.js → use-delete-binding-FtM6qPfF.js} +1 -1
  249. package/dist/client/assets/{use-dev-links-B3I-ZK34.js → use-dev-links-TQFCV3vk.js} +1 -1
  250. package/dist/client/assets/{use-external-adapter-catalog-aGlZNRrp.js → use-external-adapter-catalog-Lx8LZDAa.js} +1 -1
  251. package/dist/client/assets/{use-full-activity-feed-B61Olhdw.js → use-full-activity-feed-CmcBAvUM.js} +1 -1
  252. package/dist/client/assets/use-is-below-desktop-BB9kHnYm.js +1 -0
  253. package/dist/client/assets/use-is-hub-ab4UGRdN.js +1 -0
  254. package/dist/client/assets/{use-jump-back-in-C39GOTHa.js → use-jump-back-in-V8G_6fYj.js} +1 -1
  255. package/dist/client/assets/{use-local-browser-DCwzB4D8.js → use-local-browser-CbS4typW.js} +1 -1
  256. package/dist/client/assets/{use-mesh-topology-LRYxFuZp.js → use-mesh-topology-DZ1qMT3J.js} +1 -1
  257. package/dist/client/assets/{use-mounted-ref-CZaegwTr.js → use-mounted-ref-DUbNzP-m.js} +1 -1
  258. package/dist/client/assets/{use-notification-prefs-FtOiUS5H.js → use-notification-prefs-BAsICJ96.js} +1 -1
  259. package/dist/client/assets/{use-panel-tab-placements-Dv2OPvKh.js → use-panel-tab-placements-ymrpuL_s.js} +1 -1
  260. package/dist/client/assets/use-pending-read-BkCvAuX4.js +1 -0
  261. package/dist/client/assets/{use-personality-commit-BB5aeh6p.js → use-personality-commit-rJOmDgC2.js} +1 -1
  262. package/dist/client/assets/{use-promo-activation-BW0u7n7m.js → use-promo-activation-BKeBloMI.js} +1 -1
  263. package/dist/client/assets/{use-promo-dismissals-BOXzW4kD.js → use-promo-dismissals-Cio8QMjL.js} +1 -1
  264. package/dist/client/assets/{use-pulse-freshness-ClW-MLMo.js → use-pulse-freshness-DZkMVbSM.js} +1 -1
  265. package/dist/client/assets/{use-relay-config-hItHtkSr.js → use-relay-config-CbZQKFhZ.js} +1 -1
  266. package/dist/client/assets/{use-room-follow-claim-wotzxUWc.js → use-room-follow-claim-DbJIsuWz.js} +1 -1
  267. package/dist/client/assets/{use-roving-tab-list-DkbO6xSs.js → use-roving-tab-list-B4nZ7trj.js} +1 -1
  268. package/dist/client/assets/use-session-canvas-sAwc2L1A.js +25 -0
  269. package/dist/client/assets/{use-session-diagnostics-DmxvD-wy.js → use-session-diagnostics-0gcI762B.js} +2 -2
  270. package/dist/client/assets/{use-unclaimed-chats-DKpexDm3.js → use-unclaimed-chats-BWIqOrvs.js} +1 -1
  271. package/dist/client/assets/use-update-config-DTL7WyZV.js +1 -0
  272. package/dist/client/assets/{useMutationState-Btf2Hp1a.js → useMutationState-C9Q5lRej.js} +1 -1
  273. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-DRngjDUq.js → usecaseDiagram-WPOLBNNX-CMjVaeX9.js} +1 -1
  274. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-iK-dlS1-.js → vennDiagram-Q3Y3IDCW-BajZBf0H.js} +1 -1
  275. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-sOS67Cks.js → wardleyDiagram-IVAIDKWA-BN4xF6JT.js} +1 -1
  276. package/dist/client/assets/{xychartDiagram-4URNHDU4-EgnLiIao.js → xychartDiagram-4URNHDU4-Cy0Z9a28.js} +1 -1
  277. package/dist/client/index.html +1 -1
  278. package/dist/server/index.js +30173 -28514
  279. package/dist/server/index.js.map +2 -2
  280. package/package.json +6 -6
  281. package/dist/client/assets/CanvasFileContent-ClcHZ_l-.js +0 -2
  282. package/dist/client/assets/CanvasModel3dContent-Cm3msNdQ.js +0 -2
  283. package/dist/client/assets/HandlePage-B_5GLHsp.js +0 -1
  284. package/dist/client/assets/NamePage-0nr288eM.js +0 -1
  285. package/dist/client/assets/PhotoPage-C3Ir3wlA.js +0 -1
  286. package/dist/client/assets/RoomSurface-BIyjtxKD.js +0 -44
  287. package/dist/client/assets/_shell-BHUZq_8C.js +0 -80
  288. package/dist/client/assets/_shell.marketplace-BoAmyvPt.js +0 -1
  289. package/dist/client/assets/_shell.marketplace_.sources-BpqWjkGL.js +0 -1
  290. package/dist/client/assets/_shell.session-KyPj3OxK.js +0 -61
  291. package/dist/client/assets/_shell.x._extensionId-CfiAgtoq.js +0 -1
  292. package/dist/client/assets/_shell.x._extensionId_._-CfiAgtoq.js +0 -1
  293. package/dist/client/assets/channel-DZpRF3QJ.js +0 -1
  294. package/dist/client/assets/index-Cl8trmnL.js +0 -1
  295. package/dist/client/assets/index-Cp3yShS8.js +0 -23
  296. package/dist/client/assets/index-DKDK-3KH.js +0 -17
  297. package/dist/client/assets/index-DPNBHwcQ.js +0 -1
  298. package/dist/client/assets/registry-DS1Ghdft.js +0 -1
  299. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C7fkUKrq.js +0 -8
  300. package/dist/client/assets/use-is-below-desktop-Qwyg-mFb.js +0 -1
  301. package/dist/client/assets/use-is-hub-CSz6NDaP.js +0 -1
  302. package/dist/client/assets/use-pending-read-DBOl1ee_.js +0 -1
  303. package/dist/client/assets/use-session-canvas-C_fuAgW_.js +0 -24
  304. package/dist/client/assets/use-update-config-CSYwg557.js +0 -1
@@ -0,0 +1,44 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-dnaC3n0i.js","assets/index-DBdO-_iL.js","assets/index-CrflCTqO.css","assets/room-files-source-Duo4oiqX.js","assets/markdown-content-BKbjOTI2.js","assets/file-exclamation-point-BWsLZQVN.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-BMktWriw.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-C0EpbK5k.js","assets/link-2-BXcZwTAC.js","assets/file-Bg_qGvWR.js","assets/git-branch-CJ1NlVLY.js","assets/more-details-BsdCkGTg.js"])))=>i.map(i=>d[i]);
2
+ import{W as Z,r as i,mM as qt,j as a,g as Ut,ic as Wt,G as V,a1 as ne,a2 as Kt,bk as ee,a4 as re,a3 as Se,mN as Gt,mO as ye,mP as Be,mQ as Vt,mR as Xt,mS as Yt,lC as Qt,mT as Jt,lE as Zt,mU as en,dz as tn,g8 as nn,mJ as sn,mV as on,a0 as rn,bw as an,mW as ln,mX as dn,iR as cn,hF as un,ir as X,kr as qe,mY as ot,bK as mn,kq as le,kv as rt,mZ as fn,kw as at,ai as pn,bO as it,hA as lt,B as Ae,x as hn,m_ as gn,c4 as Me,m$ as xn,s as ce,ep as yn,jQ as dt,n0 as ct,aX as bn,e as se,n1 as he,hb as ut,ku as mt,n2 as vn,n3 as kn,n as Rn,q as Re,kt as wn,n4 as ft,eN as te,a7 as pt,fm as In,n5 as Nn,n6 as jn,n7 as Sn,n8 as An,l as ht,ar as Ce,ke as Mn,aj as Cn,n9 as On,na as Tn,nb as _n,b6 as En,bW as Pn,nc as $n,nd as Dn,ne as Fn,nf as Ln,bx as we,dH as zn,kk as Hn,kp as Bn,ki as qn,ng as Un,nh as Wn,ni as Kn,nj as Gn,eM as Vn,kl as Xn,nk as Yn,nl as Qn,nm as Jn,dM as Zn,X as es,nn as ts,no as Ue,np as ns,ad as ss,nq as os,iq as rs,nr as as,ns as is,aH as We}from"./index-DBdO-_iL.js";import{R as ls,A as ds,u as cs,P as us,a as ms}from"./use-jump-back-in-V8G_6fYj.js";import{a as Ke,m as Ge,f as Oe,b as Te,d as gt,e as xt,g as yt,E as fs,h as ps,i as hs,M as G,F as gs,D as xs,U as ys,C as Q,u as bs,j as vs,k as ks,l as Rs}from"./index-B3ybVnXe.js";import{a as ws}from"./use-room-follow-claim-DbJIsuWz.js";import"./WidgetErrorCard-BYMiUiAf.js";import{M as Is}from"./markdown-content-BKbjOTI2.js";import{W as Ns,a as js}from"./find-latest-widget-fence-DFpYPIlS.js";import{f as Ss}from"./format-duration-BCr6uzby.js";import{H as As,a as Ms,b as Cs}from"./RuntimeSetupDialog-r1Ss_YQW.js";import{M as Ve}from"./mention-pill-B-FgNE6o.js";import{R as Os}from"./rotate-ccw-clock-RJuoRE3k.js";import{U as Ts}from"./unplug-BYKBdSMl.js";import{M as _s}from"./message-square-off-Co0W--np.js";import{i as Es}from"./registry-B3Ss4ItQ.js";import{f as Ps}from"./use-connector-management-CoinXIID.js";import{A as $s}from"./AgentRequestCard-BHIHWNRz.js";/**
3
+ * @license lucide-react v1.48.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const bt={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};bt.node;const Ds=Z(bt);/**
8
+ * @license lucide-react v1.48.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const vt={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};vt.node;const Fs=Z(vt);/**
13
+ * @license lucide-react v1.48.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const kt={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};kt.node;const Ls=Z(kt);/**
18
+ * @license lucide-react v1.48.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const Rt={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};Rt.node;const zs=Z(Rt);/**
23
+ * @license lucide-react v1.48.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const wt={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};wt.node;const Hs=Z(wt);/**
28
+ * @license lucide-react v1.48.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const It={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};It.node;const Bs=Z(It);/**
33
+ * @license lucide-react v1.48.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */const Nt={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};Nt.node;const Xe=Z(Nt);/**
38
+ * @license lucide-react v1.48.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const jt={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};jt.node;const qs=Z(jt),Us=300;function ae({className:e,children:n}){return a.jsx("span",{className:V("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:n})}function St({identity:e,children:n,onViewProfile:s,className:t}){const{kind:o,displayName:r,handle:l,color:d,emoji:m,imageUrl:f,origin:u,agent:c}=e,w=d??"hsl(var(--muted-foreground))",h=typeof u=="object"&&u!==null,g=o==="agent"&&(c==null?void 0:c.working)!=null?c.working:null,[k,x]=i.useState(!1),N=i.useRef(!1),p=i.useRef(null),b=qt({onLongPress:()=>{N.current&&x(!0)}});return a.jsxs(As,{open:k,onOpenChange:x,openDelay:Us,children:[a.jsx(Ms,{asChild:!0,ref:p,"data-gesture-priority":"",...b,onPointerDown:_=>{N.current=_.pointerType==="touch"||_.pointerType==="pen",b.onPointerDown(_)},children:n}),a.jsxs(Cs,{"data-slot":"identity-hover-card",align:"start",className:V("flex w-64 flex-col gap-0 overflow-hidden p-0",t),children:[a.jsxs("div",{className:"flex items-center gap-3 p-3",children:[a.jsx(Ut,{"aria-hidden":!0,color:w,emoji:m,imageUrl:f,fallback:Wt(r),kind:o,origin:u,status:g?"working":"idle",size:"md"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:r}),l&&a.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",l]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[o==="agent"&&((c==null?void 0:c.runtime)||(c==null?void 0:c.model))&&a.jsx(ae,{children:[c.runtime,c.model].filter(Boolean).join(" · ")}),g&&a.jsxs(ae,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Ss(g.forMs)]}),o==="human"&&a.jsx(ae,{children:h?u.platform:"On this machine"}),o==="agent"&&(c==null?void 0:c.managedBy)&&a.jsxs(ae,{children:["Managed by"," ",c.managedBy.handle?`@${c.managedBy.handle}`:c.managedBy.displayName]})]}),s?a.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var _;(_=p.current)==null||_.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):a.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[a.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),a.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function At(e,n={}){const s=ne();return Kt({queryKey:ee.sessions(e??""),queryFn:()=>s.listRoomSessions(e),enabled:e!==null&&n.enabled===!0})}function Ws(){const e=ne();return re({mutationFn:({roomId:n,authorId:s})=>e.haltRoomAgent(n,s),meta:{errorLabel:"Couldn’t stop this agent"}})}function Ks(){const e=ne();return re({mutationFn:({roomId:n,authorId:s})=>e.promoteHold(n,s),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function Gs(){const e=ne(),n=Se();return re({onMutate:({roomId:s,entryId:t,emoji:o,viewerAuthorId:r})=>{var u;const l=n.getQueryData(ee.entries(s)),d=(u=l==null?void 0:l.find(c=>c.id===t))==null?void 0:u.reactions,{reactions:m,on:f}=Ke(d,o,r);return n.setQueryData(ee.entries(s),c=>Ge(c,t,m)),{on:f}},mutationFn:({roomId:s,entryId:t,emoji:o,viewerAuthorId:r})=>{var m,f;const l=n.getQueryData(ee.entries(s)),d=((f=(m=l==null?void 0:l.find(u=>u.id===t))==null?void 0:m.reactions)==null?void 0:f.some(u=>u.emoji===o&&u.authorIds.includes(r)))??!1;return e.toggleReaction(s,t,{emoji:o,on:d})},onError:(s,{roomId:t,entryId:o,emoji:r,viewerAuthorId:l},d)=>{d!==void 0&&n.setQueryData(ee.entries(t),m=>{var c;const f=(c=m==null?void 0:m.find(w=>w.id===o))==null?void 0:c.reactions,{reactions:u}=Ke(f,r,l,!d.on);return Ge(m,o,u)})},onSuccess:({frequents:s},{roomId:t})=>{n.setQueryData(ee.detail(t),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function J(e){return e.threadRootEntryId??e.parentEntryId}function Mt(e){return J(e)??e.id}function _e(e,n){return Math.max(n??0,e)}function Vs(e,n,s){let t=e[0],o=0;for(const r of e)r.seq>t.seq&&(t=r),n!==null&&r.seq>n&&(o+=1);return{count:_e(e.length,s),lastAt:t.createdAt,unread:o}}function Xs(e){const n=ne(),s=Se(),t=Gt(e),o=ye(u=>{var c;return e===null?null:((c=u.paging[e])==null?void 0:c.cursor)??null}),r=re({mutationFn:async u=>{var x;const c=(x=ye.getState().paging[u])==null?void 0:x.cursor;if(c==null)return;const w=await n.listRoomEntries(u,{before:c,limit:Be}),h=ee.entries(u),g=s.getQueryData(h),k=Vt(g,w);s.setQueryData(h,k),ye.getState().notePage(u,Xt(w)??c,Yt(w,Be)||k.length===((g==null?void 0:g.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:l,isPending:d}=r,m=i.useRef(!1),f=i.useCallback(async()=>{if(!(e===null||m.current)){m.current=!0;try{await l(e).catch(()=>{})}finally{m.current=!1}}},[e,l]);return{canLoadOlder:t,isLoadingOlder:d,cursor:o,loadOlder:f}}function Ys(e){return a.jsx(js,{code:e.code,isIncomplete:e.isIncomplete})}const Qs=[{language:Ns,component:Ys}],Js={turn_failed:{Icon:rn,tone:"text-status-warning"},agent_busy:{Icon:on},agent_gone:{Icon:qs,tone:"text-status-warning"},agent_left:{Icon:Xe,tone:"text-status-warning"},room_archived:{Icon:sn},runtime_gone:{Icon:zs,tone:"text-status-warning"},agent_paused:{Icon:nn},agent_declined:{Icon:_s},agent_unavailable:{Icon:tn},awaiting_approval:{Icon:Ds,tone:"text-status-warning"},halted:{Icon:en},budget_reached:{Icon:Zt},cascade_stopped:{Icon:Jt},addressing_changed:{Icon:Ls},bridge_blocked:{Icon:Ts,tone:"text-status-warning"},bridge_undelivered:{Icon:Qt,tone:"text-status-warning"},bridge_rate_limited:{Icon:Bs},bridge_second_agent_refused:{Icon:Xe},bridge_disconnected:{Icon:Fs},bridge_agent_swapped:{Icon:ls},bridge_history_note:{Icon:Os}},Zs={Icon:an},be=80;function eo(e){const n=e.trim();if(n.length<=be)return n;const s=n.slice(0,be),t=s.lastIndexOf(" ");return`${(t>be/2?s.slice(0,t):s).trimEnd()}…`}function to(e,n,s){const t=no(e,s),o=r=>a.jsx("a",{href:n.href,onClick:n.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:r});return t===null?a.jsxs(a.Fragment,{children:[e," ",o("Open chat")]}):a.jsxs(a.Fragment,{children:[e.slice(0,t.index),o(t.words),e.slice(t.index+t.words.length)]})}function no(e,n){if(n!==void 0){const t=ln(n),o=e.lastIndexOf(t);if(o!==-1)return{index:o,words:t}}const s=dn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function so({entry:e,feedPosition:n,rowId:s,sessionLink:t,subjectName:o}){const{Icon:r,tone:l}=(e.body.notice&&Js[e.body.notice])??Zs;return a.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...n&&{role:"article","aria-label":eo(e.body.text)},...Oe(n),className:V("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",l??"text-muted-foreground"),children:[a.jsx(r,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{children:t?to(e.body.text,t,o):e.body.text})]})}const oo=Es.moment;function ro({entry:e,moment:n,subject:s,subjectIdentity:t,feedPosition:o,rowId:r}){const l=Te(e.createdAt);return a.jsx("div",{id:r,"data-slot":"moment-row","data-testid":"room-moment","data-moment":n.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...Oe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:a.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[a.jsx(St,{identity:{kind:s.kind,displayName:s.displayName,handle:t==null?void 0:t.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:t==null?void 0:t.origin,agent:t==null?void 0:t.agent},children:a.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[a.jsx(gt,{author:s}),a.jsx("span",{className:"sr-only",children:s.displayName})]})}),a.jsx(oo,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),a.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),l.length>0&&a.jsx("time",{dateTime:e.createdAt,title:xt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:l})]})})}function ao({id:e,summary:n,open:s,onOpen:t}){const{capabilities:o}=yt(),{count:r,lastAt:l,unread:d}=n,m=Te(l),[f,u]=i.useState({count:r,bumped:!1});f.count!==r&&u({count:r,bumped:!0});const c=f.count===r&&f.bumped;return o.threads?a.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":d>0?"":void 0,"aria-expanded":s,onClick:t,className:V("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","mb-1 w-fit rounded text-left text-xs transition-colors","px-2 py-2 md:px-1 md:py-0.5",d>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[a.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),a.jsx("span",{className:V(c&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:r},r),r===1?" reply":" replies",m.length>0&&a.jsxs(a.Fragment,{children:[" · last ",a.jsx("time",{dateTime:l,title:xt(l),children:m})]}),d>0&&` · ${d} new`]}):null}function io(e,n){const s=le.getState(),t=s.drafts[e]??"",o=t===""||t.endsWith(" ")||t.endsWith(`
43
+ `)?"":" ";s.set(e,`${t}${o}@${n} `)}function lo({roomId:e,entry:n,author:s,viewerAuthorId:t,onViewProfile:o}){const r=Mt(n),l=n.body.text,d=(s==null?void 0:s.id)===t?void 0:(s==null?void 0:s.handle)??void 0,m=s==null?void 0:s.displayName,{copy:f}=cn({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Hs,run:()=>{X.getState().openThread(e,r,!0),qe.getState().requestFocus(ot(e,r))}},copy:{id:"copy",label:"Copy text",icon:un,run:()=>void f(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:mn,run:o}),d!==void 0&&(u.mention={id:"mention",label:m===void 0?"Mention author":`Mention ${m}`,icon:ds,run:()=>{io(e,d),qe.getState().requestFocus(e)}}),fs.map(c=>u[c]).filter(c=>c!==void 0)},[e,r,l,d,m,o,f])}function co(e){if(e.kind==="notice")return{kind:"notice"};const n=e.body.moment;return n?{kind:"moment",moment:n}:{kind:"message"}}function Ee(e,n=[]){return new Map([...n.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function ue(e,n){const s=e.body.subjectAuthorId;return s===void 0||n.has(e.authorId)?e.authorId:s}function Y(e,n,s){const t=n.get(e),o=rt({record:{kind:(t==null?void 0:t.kind)??"system",id:e,displayName:(t==null?void 0:t.displayName)??"Unknown",emoji:t==null?void 0:t.emoji,color:t==null?void 0:t.color,imageUrl:t==null?void 0:t.imageUrl},override:(t==null?void 0:t.agentRef)===void 0?null:s==null?void 0:s.get(t.agentRef)});return{kind:o.kind,id:e,displayName:(t==null?void 0:t.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(t==null?void 0:t.origin)=="object"&&(t==null?void 0:t.origin)!==null,...(t==null?void 0:t.retired)===!0?{retired:!0}:{}}}function uo(e){const n=new Set;for(const r of e)J(r)===null&&n.add(r.id);const s=[],t=new Map,o=new Set;for(const r of e){const l=J(r);if(l===null){s.push(r);continue}if(!n.has(l)){s.push(r),o.add(r.id);continue}const d=t.get(l);d?d.push(r):t.set(l,[r])}return{topLevel:s,repliesByRoot:t,orphaned:o}}function Ct(e){return`thread-${e}`}function me(e){return`thread-row-${e}`}function Ie(e){return`thread-panel-entry-${e}`}function fe(e){return`room-entry-${e}`}function Pe(e,n){const s=e.find(d=>d.id===n);if(s===void 0)return null;const t=J(s)??null,o={rowId:n,domId:fe(n)};if(t===null)return o;const r=e.find(d=>d.id===t);return r!==void 0&&(J(r)??null)===null?{rowId:Ct(t),domId:me(t)}:o}function mo(e,n){if(n===null)return null;const s=e.find(t=>t.seq===n);return s===void 0?null:Pe(e,s.id)}const Ye=48;function Ot(e,n,s){const t=e.body.answersEntryId;if(t===void 0||t===e.id||n!==void 0&&n.id===t)return null;const o=s(t);if(o===void 0)return null;const r=o.body.text.replace(/\s+/gu," ").trim();return r.length===0?null:{entryId:t,excerpt:r.length>Ye?`${r.slice(0,Ye).trimEnd()}…`:r}}function fo(e,n){const s=new Map;for(const t of e){const o=n[t.projectPath];if(!o)continue;const r=fn({runtime:o.runtime,model:o.model});s.set(at(t.projectPath),{memberId:t.id,visual:pn(o),runtime:r.label,...r.modelLabel!==null&&{model:r.modelLabel}})}return s}function po(e){const n=new Map;for(const[s,t]of e)n.set(s,t.visual);return n}const ho={info:new Map,faces:new Map},$e=i.createContext(ho);function Tt({known:e,children:n}){return a.jsx($e.Provider,{value:e,children:n})}function De(){const e=it(),n=i.useMemo(()=>{var l;return((l=e.data)==null?void 0:l.agents)??[]},[e.data]),s=i.useMemo(()=>n.map(l=>l.projectPath),[n]),t=lt(s),o=i.useMemo(()=>fo(n,t.data??{}),[n,t.data]),r=i.useMemo(()=>po(o),[o]);return i.useMemo(()=>({info:o,faces:r}),[o,r])}function Ne(e){const n=i.useContext($e);return e===void 0?void 0:n.info.get(e)}function go(){return i.useContext($e).faces}function xo({loading:e,onLoad:n}){return a.jsx("div",{className:"flex justify-center px-4 py-3",children:a.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&a.jsx(hn,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}function yo({showAuthorHeader:e,headerId:n,displayName:s,time:t,summary:o,contentId:r,summaryId:l,feedPosition:d}){return{...e?{"aria-labelledby":n}:{"aria-label":t.length>0?`${s}, ${t}`:s},"aria-describedby":o===null?r:l,...Oe(d)}}const de=120,bo="code block";function vo(e){if(e.length<=de&&!e.includes("```"))return null;const n=ko(e);return n.length===0?null:n}function ko(e){const n=e.replace(/```[\s\S]*?(?:```|$)/g,` ${bo} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(n.length<=de)return n;const s=Ro(n,de),t=s.lastIndexOf(" ");return`${(t>de/2?s.slice(0,t):s).trimEnd()}…`}function Ro(e,n){if(typeof Intl.Segmenter=="function"){const t=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:r}of t.segment(e)){if(o.length+r.length>n)break;o+=r}return o}let s="";for(const t of e){if(s.length+t.length>n)break;s+=t}return s}function wo({roomId:e,entry:n,viewerAuthorId:s,reactionFrequents:t,streamStalled:o,isMember:r=!0}){const l=Gs(),d=o===!0||!r,m=i.useMemo(()=>n.reactions??[],[n.reactions]),f=i.useMemo(()=>m.filter(w=>ps(w,s)).map(w=>w.emoji),[m,s]),u=i.useCallback(w=>l.mutate({roomId:e,entryId:n.id,emoji:w,viewerAuthorId:s}),[l,e,n.id,s]),c=i.useMemo(()=>({quick:t,mine:f,onToggle:u,disabled:d}),[t,f,u,d]);return{reactions:m,toggle:u,quickRow:c}}function Io({barRef:e,pillsRef:n,hasReactions:s}){return t=>{var r,l;if(t.target!==t.currentTarget)return;const{key:o}=t;if(o==="ArrowDown"&&s){t.preventDefault(),(r=n.current)==null||r.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(t.preventDefault(),(l=e.current)==null||l.focusFirst())}}function No(e,n){var c,w;const s=n.body.subjectAuthorId,t=n.body.notice,o=n.kind==="notice"&&t!==void 0&&s!==void 0&&gn.includes(t),r=At(e,{enabled:o}),l=Me(),d=Se(),m=ne(),f=o?((w=(c=r.data)==null?void 0:c.bindings.find(h=>h.authorId===s))==null?void 0:w.sessionId)??null:null,u=i.useCallback(h=>{h.button!==0||h.metaKey||h.ctrlKey||h.shiftKey||h.altKey||(h.preventDefault(),!(f===null||s===void 0)&&xn({queryClient:d,transport:m},e,s).then(g=>{g.kind!=="none"&&l(ce({session:g.kind==="bound"?g.sessionId:f}))}))},[s,l,d,e,f,m]);return i.useMemo(()=>f===null?null:{href:yn({session:f}),onOpen:u},[u,f])}const pe="mention",Fe="author_id",jo={[pe]:[Fe]},So=[pe];function Ao(e,n){if(!n||n.length===0)return e;const s=Mo(e,n);if(s.length===0)return e;let t=e;for(let o=s.length-1;o>=0;o--){const{offset:r,length:l,authorId:d}=s[o],m=t.slice(0,r),f=t.slice(r,r+l),u=t.slice(r+l);t=`${m}<${pe} ${Fe}="${d}">${f}</${pe}>${u}`}return t}function Mo(e,n){const s=[...n].sort((r,l)=>r.offset-l.offset),t=[];let o=0;for(const r of s)r.offset<o||r.offset+r.length>e.length||(t.push(r),o=r.offset+r.length);return t}const Co=new Map,_t=i.createContext(Co);function Oo({authors:e,children:n}){return a.jsx(_t.Provider,{value:e,children:n})}function To(e){const n=i.useContext(_t);return e===void 0?void 0:n.get(e)}function _o(e){return typeof e=="string"?e.replace(/^@/,""):""}function Eo({authorId:e,children:n}){const s=To(e),t=Ne(s==null?void 0:s.agentRef),{open:o}=dt();if(!s)return a.jsx(Ve,{kind:"human",label:_o(n),resolved:!1});const r=rt({record:s,override:t==null?void 0:t.visual}),l=ct(s,t==null?void 0:t.memberId),d=l===void 0?void 0:()=>o(l),m=d?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:d,onKeyDown:f=>{f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),d())}}:{};return a.jsx(St,{onViewProfile:d,identity:{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:r.color,emoji:r.emoji,imageUrl:r.imageUrl,origin:s.origin,agent:t&&{runtime:t.runtime,...t.model&&{model:t.model}}},children:a.jsx(Ve,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:d!==void 0,...m})})}function Po(e){return{mention:n=>{const s=n[Fe],t=typeof s=="string"?s:void 0;return!t||!e.has(t)?a.jsx(a.Fragment,{children:n.children}):a.jsx(Eo,{authorId:t,children:n.children})}}}function $o({entry:e,authors:n}){const s=i.useMemo(()=>Ao(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),t=i.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(l=>l.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Po(t),[t]);return a.jsx(Oo,{authors:n,children:a.jsx(Is,{content:s,className:"msg-prose",allowedTags:jo,literalTagContent:So,components:o,renderers:Qs})})}function Do(e){return function(s){return a.jsx($o,{entry:s,authors:e})}}const Et="the top folder";function Qe(e){return e.slice(e.lastIndexOf("/")+1)}function Fo(e){const n=e.lastIndexOf("/");return n===-1?"":e.slice(0,n)}function Lo(e){return e===""?Et:`${e}/`}function ve(e){return e.target!==void 0?e.target===""?Et:e.target:Lo(Fo(e.paths[0]??""))}function zo(e,n){const s=e.paths[0]??"",t=e.target;switch(e.kind){case"edit":return`${n} edited ${t??s}`;case"add":return`${n} added ${t??s}`;case"upload":return e.pathCount===1?`${n} uploaded ${Qe(s)} to ${ve(e)}`:`${n} uploaded ${e.pathCount} files to ${ve(e)}`;case"rename":{const o=e.from??"";return t!==void 0?`${n} renamed ${o} to ${t}`:o.endsWith("/")?`${n} renamed ${o}`:`${n} renamed ${o} to ${s}`}case"delete":return t!==void 0?`${n} deleted ${t}`:e.pathCount===1?`${n} deleted ${s}`:`${n} deleted ${e.pathCount} files`;case"from-attachment":return`${n} saved ${Qe(s)} from the chat to ${ve(e)}`}}const Ho=i.lazy(()=>bn(()=>import("./index-dnaC3n0i.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function Pt({roomId:e,entry:n,author:s,authorRef:t,authors:o,viewerAuthorId:r,authorNames:l,reactionFrequents:d,streamStalled:m,isMember:f=!0,grouping:u,orphanedReply:c,answers:w,feedPosition:h,rowId:g}){const k=Te(n.createdAt),x=i.useMemo(()=>{const K=vo(n.body.text),xe=hs(n.attachments??[]);if(xe===null)return K;const He=K??n.body.text.trim();return He.length>0?`${He} ${xe}`:xe},[n.body.text,n.attachments]),N=i.useId(),p=`${N}-author`,b=`${N}-content`,_=`${N}-summary`,T=i.useRef(null),$=i.useRef(null),C=i.useRef(null),{reactions:E,toggle:P,quickRow:I}=wo({roomId:e,entry:n,viewerAuthorId:r,reactionFrequents:d,streamStalled:m,isMember:f}),F=Ne(t==null?void 0:t.agentRef),{open:D}=dt(),M=t===void 0?void 0:ct(t,F==null?void 0:F.memberId),H=i.useCallback(()=>{M!==void 0&&D(M)},[D,M]),L=M===void 0?void 0:H,B=lo({roomId:e,entry:n,author:t,viewerAuthorId:r,onViewProfile:L}),W=Io({barRef:$,pillsRef:C,hasReactions:E.length>0}),z=i.useCallback(()=>{var K;return(K=T.current)==null?void 0:K.focus()},[]),q=i.useMemo(()=>Do(o),[o]),R=i.useCallback(K=>a.jsx(i.Suspense,{fallback:null,children:a.jsx(Ho,{roomId:e,attachment:K})}),[e]),y=go(),O=n.body.subjectAuthorId??n.authorId,A=o.get(O),v=Ne(A==null?void 0:A.agentRef),S=No(e,n),j=co(n);if(j.kind==="notice")return a.jsx(so,{entry:n,feedPosition:h,rowId:g,sessionLink:S,subjectName:A==null?void 0:A.displayName});if(j.kind==="moment")return a.jsx(ro,{entry:n,moment:j.moment,subject:O===n.authorId?s:Y(O,o,y),subjectIdentity:{handle:(A==null?void 0:A.handle)??void 0,origin:A==null?void 0:A.origin,agent:v&&{runtime:v.runtime,...v.model&&{model:v.model}}},feedPosition:h,rowId:g});const U=u.position==="first"||u.position==="only";return a.jsxs(G.Root,{ref:T,id:g,position:u.position,actions:B,reactions:I,"data-testid":"room-entry",tabIndex:0,...yo({showAuthorHeader:U,headerId:p,displayName:s.displayName,time:k,summary:x,contentId:b,summaryId:_,feedPosition:h}),onKeyDown:W,children:[a.jsx(G.Gutter,{author:s,at:n.createdAt,onViewProfile:L,isSelf:n.authorId===r}),a.jsxs(G.Body,{children:[a.jsx(G.Author,{id:p,author:s,at:n.createdAt,origin:t==null?void 0:t.origin}),c===!0&&a.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),w!=null&&a.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${w.excerpt}”`}),a.jsx(G.Content,{id:b,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:n.body.fileChange?a.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:zo(n.body.fileChange,(A==null?void 0:A.displayName)??"Somebody")}):q(n,{rowId:n.id,isStreaming:!1})}),x!==null&&a.jsx("span",{id:_,className:"hidden",children:x}),a.jsx(G.Attachments,{items:n.attachments??[],renderAction:f?R:void 0}),a.jsx(G.Reactions,{ref:C,reactions:E,viewerAuthorId:r,names:l,frequents:d,onToggle:P,disabled:m===!0||!f,onExit:z}),a.jsx(G.Actions,{actions:B,reactions:I,barRef:$,onExit:z})]})]})}const Bo="room-load-older",qo=4;function $t({roomName:e}){return a.jsx(gs,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:qo},(n,s)=>a.jsxs("div",{className:"flex gap-3",children:[a.jsx(se,{className:"size-7 shrink-0 rounded-full"}),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[a.jsx(se,{className:"h-3 w-24"}),a.jsx(se,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${s}`))})}function Uo({roomId:e,roomName:n,viewerAuthorId:s,entries:t,members:o,formerAuthors:r,lastReadSeq:l,reactionFrequents:d,streamStalled:m,isLoading:f,error:u,onAddAgents:c,openThreadId:w,onOpenThread:h,resumeRow:g,landOnRow:k,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:p=!1,onLoadOlder:b,ref:_}){const T=i.useMemo(()=>Ee(o,r),[o,r]),$=he(o,s),C=De(),E=i.useMemo(()=>new Map([...T].map(([y,O])=>[y,O.displayName])),[T]),P=ut(),I=mt(e,null),{topLevel:F,repliesByRoot:D,orphaned:M}=i.useMemo(()=>uo(t),[t]),H=i.useMemo(()=>new Map(t.map(y=>[y.id,y])),[t]),L=i.useMemo(()=>{const y=vn(F,l),O=kn(F.map(v=>({id:v.id,authorId:v.body.moment?`moment:${v.id}`:v.authorId,timestamp:v.createdAt})),{now:P,lastSeenId:y.lastSeenId,unreadFromStart:y.fromStart}),A=[];N&&!f&&A.push({kind:"load-older",id:Bo});for(const v of O){if(v.kind==="day-divider"){A.push({kind:"day-divider",id:v.key,label:v.label});continue}if(v.kind==="unread-divider"){A.push({kind:"unread-divider",id:v.key});continue}const S=F[v.index];A.push({kind:"message",id:S.id,entry:S,grouping:v.grouping,position:v.index+1,answers:Ot(S,F[v.index-1],H.get.bind(H))});const j=D.get(S.id);j&&A.push({kind:"thread-reply",id:Ct(S.id),rootId:S.id,replies:j,totalReplies:S.threadReplyCount})}return A},[F,D,H,l,P,N,f]),B=i.useMemo(()=>L.map(y=>y.kind==="load-older"?{kind:"notice",id:y.id,at:"",body:null}:y.kind==="day-divider"?{kind:"day-divider",id:y.id,label:y.label}:y.kind==="unread-divider"?{kind:"unread-divider",id:y.id}:y.kind==="thread-reply"?{kind:"thread-reply",id:y.id,rootId:y.rootId,replyCount:_e(y.replies.length,y.totalReplies),lastAt:y.replies[y.replies.length-1].createdAt}:{kind:"message",id:y.id,payload:y.entry,grouping:y.grouping,author:Y(ue(y.entry,T),T,C.faces),at:y.entry.createdAt}),[L,T,C.faces]),W=i.useCallback((y,O)=>{const A=L[O.index];if(A.kind==="load-older")return b===void 0?null:a.jsx(xo,{loading:p,onLoad:b});if(A.kind==="day-divider")return a.jsx(xs,{label:A.label});if(A.kind==="unread-divider")return a.jsx(ys,{});if(A.kind==="thread-reply"){if(O.onOpenThread===void 0)return null;const S=O.onOpenThread;return a.jsx(ao,{id:me(A.rootId),summary:Vs(A.replies,l,A.totalReplies),open:w===A.rootId,onOpen:()=>S(A.rootId)})}const v=ue(A.entry,T);return a.jsx(Pt,{roomId:e,entry:A.entry,author:Y(v,T,C.faces),authorRef:T.get(v),authors:T,viewerAuthorId:s,authorNames:E,reactionFrequents:d,streamStalled:m,isMember:$,grouping:A.grouping,orphanedReply:M.has(A.entry.id),answers:A.answers,feedPosition:{index:A.position,total:-1},rowId:fe(A.entry.id)})},[L,e,T,C.faces,s,E,d,m,$,M,l,w,p,b]),z=i.useCallback(y=>{if(y.kind==="message")return fe(y.id);if(y.kind==="thread-reply")return me(y.rootId)},[]);if(u)return a.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[a.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),a.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const q=o.some(y=>y.author.kind==="agent"),R=a.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[a.jsx(Rn,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),a.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),a.jsx("p",{className:"max-w-sm",children:q?"Say something to get it going.":"Nothing answers until you add an agent."}),a.jsx(Ae,{type:"button",size:"sm",variant:q?"ghost":"default",onClick:c,className:"mt-1",children:q?"Add more agents":"Add agents"})]});return a.jsx(Tt,{known:C,children:a.jsx(Q.Timeline,{ref:_,conversationId:e,label:`Messages in ${n}`,rows:B,renderRow:W,onOpenThread:h,domIdOf:z,...g===void 0?{}:{resumeRow:g},...k===void 0?{}:{landOnRow:k},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:f?a.jsx($t,{roomName:n}):void 0,empty:R,feedTestId:"room-timeline"})})}const Le={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function Wo(e){const n=ne(),[s,t]=i.useState([]),o=i.useRef(new Map),r=i.useCallback(h=>{const g=h.map(k=>({id:crypto.randomUUID(),file:k,status:"pending",progress:0}));t(k=>[...k,...g])},[]),l=i.useCallback(h=>{o.current.delete(h),t(g=>g.filter(k=>k.id!==h))},[]),d=i.useCallback(h=>{if(!h){o.current.clear(),t([]);return}const g=new Set(h);for(const k of g)o.current.delete(k);t(k=>k.filter(x=>!g.has(x.id)))},[]),m=i.useCallback(h=>{o.current.delete(h),t(g=>g.map(k=>k.id===h&&k.status==="error"?{...k,status:"pending",progress:0,error:void 0}:k))},[]),f=i.useRef(null),u=re({meta:{suppressErrorToast:!0},mutationFn:async h=>{t(N=>N.map(p=>h.some(b=>b.id===p.id)?{...p,status:"uploading"}:p));const g=N=>{t(p=>p.map(b=>b.status==="uploading"?{...b,progress:N.percentage}:b))},k=new AbortController;f.current=k;const x=h.map(N=>N.file);return n.uploadRoomAttachments(e,x,g,k.signal)},onSettled:()=>{f.current=null},onSuccess:(h,g)=>{g.forEach((k,x)=>{const N=h[x];N&&o.current.set(k.id,N.id)}),t(k=>k.map(x=>g.findIndex(p=>p.id===x.id)===-1?x:{...x,status:"uploaded",progress:100}))},onError:h=>{t(g=>g.map(k=>k.status==="uploading"?{...k,status:"error",error:h.message}:k))}}),c=i.useCallback(()=>{var h;(h=f.current)==null||h.abort()},[]),w=i.useCallback(async()=>{const h=s.filter(k=>k.status==="error");if(h.length>0)throw new Error(h.length===1?`${h[0].file.name} didn’t upload. Try again or remove it.`:`${h.length} files didn’t upload. Try again or remove them.`);const g=s.filter(k=>k.status==="pending");return g.length>0&&await u.mutateAsync(g),s.map(k=>o.current.get(k.id)).filter(k=>k!==void 0)},[s,u]);return{pendingFiles:s,addFiles:r,removeFile:l,retryFile:m,clearFiles:d,cancelUpload:c,uploadAndGetIds:w,hasPendingFiles:s.length>0,hasFailedUpload:s.some(h=>h.status==="error"),isUploading:u.isPending}}function Dt(e){const{room:n,threadRootId:s}=e,t=bs(),o=vs(),r=Wo((n==null?void 0:n.id)??""),l=n!==void 0&&he(n.members,n.viewerAuthorId),d=i.useRef({attachments:r,post:t,reply:o,room:n,threadRootId:s});i.useEffect(()=>{d.current={attachments:r,post:t,reply:o,room:n,threadRootId:s}});const m=i.useCallback(p=>d.current.attachments.addFiles(p),[]),f=i.useCallback(p=>d.current.attachments.removeFile(p),[]),u=i.useCallback(p=>d.current.attachments.retryFile(p),[]),c=i.useCallback(()=>d.current.attachments.cancelUpload(),[]),{pendingFiles:w,hasFailedUpload:h,isUploading:g}=r,k=i.useMemo(()=>({staged:w,add:m,remove:f,retry:u,cancel:c,hasFailed:h,isUploading:g,holdsSendWhileUploading:!1}),[w,h,g,m,f,u,c]),x=i.useCallback(async p=>{const{attachments:b,post:_,reply:T,room:$,threadRootId:C}=d.current;if($===void 0)throw new Error("That room isn’t loaded yet.");if($.archived)throw new Error("This room is archived.");Re.getState().recordOpened("room",$.id);const E=wn(),P=b.pendingFiles.map(M=>M.file.name),I=b.pendingFiles.map(M=>M.id),F=await b.uploadAndGetIds();b.clearFiles(I);const D=p.parentEntryId??C;if(D!==void 0){T.mutate({roomId:$.id,rootEntryId:D,text:p.text,clientId:E,attachmentIds:F,attachmentNames:P});return}_.mutate({roomId:$.id,text:p.text,clientId:E,attachmentIds:F,attachmentNames:P})},[]);return{target:i.useMemo(()=>({kind:"room",id:(n==null?void 0:n.id)??"",placeholder:n===void 0?"Message…":s===void 0?`Message ${te(n)}…`:"Reply in this thread…",canSend:n!==void 0&&!n.archived&&l,...n===void 0?{canSendReason:"Still opening this room…"}:n.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:l?{}:{canSendReason:ft},send:x,attachments:k}),[n,s,l,k,x]),attachments:r}}function Ko(e){const{roomId:n,entrySeq:s,entries:t,historyLoaded:o}=e,r=s===void 0?null:`${n}:${s}`,l=i.useMemo(()=>{if(s===void 0)return null;const g=t.find(p=>p.seq===s);if(g===void 0)return null;const k=Pe(t,g.id);if(k===null)return null;const x=J(g)??null,N=x!==null&&k.rowId!==g.id;return{roomRowId:k.rowId,threadRootId:N?x:null,entryId:g.id}},[t,s]),d=i.useRef(null),m=(l==null?void 0:l.threadRootId)??null;i.useEffect(()=>{r===null||m===null||d.current!==r&&(d.current=r,X.getState().openThread(n,m))},[r,n,m]);const f=i.useRef(null);i.useEffect(()=>{r===null||!o||l===null&&f.current!==r&&(f.current=r,pt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=i.useRef(null),c=i.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),w=i.useRef(null),h=i.useCallback(()=>{if(!(r===null||w.current===r))return w.current=r,(l==null?void 0:l.threadRootId)===null||l==null?void 0:l.entryId},[r,l]);return{roomRow:s===void 0?void 0:c,threadRow:s===void 0?void 0:h}}function Go(e,n){const[s,t]=i.useState({roomId:null,seq:null});return s.roomId===e?s.seq:e===null?(t({roomId:null,seq:null}),null):n===null?null:(t({roomId:e,seq:n}),n)}const Vo=600;function Xo(e){return document.getElementById(me(e))??document.getElementById(fe(e))}function Yo(){const e=i.useRef(null);return i.useEffect(()=>()=>{var s;return(s=e.current)==null?void 0:s.call(e)},[]),{arm:i.useCallback(s=>{var d;(d=e.current)==null||d.call(e);let t=0;const o=Date.now()+Vo;let r=!1;const l=()=>{if(r)return;const m=document.activeElement;if(m===null||m===document.body||!m.isConnected){const u=Xo(s);if(u!==null){u.focus();return}}Date.now()>=o||(t=requestAnimationFrame(l))};t=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(t)}},[])}}function Qo({roomId:e,route:n,urlThreadId:s,openThreadId:t,entries:o,historyLoaded:r}){const l=In(),d=i.useRef(null);i.useEffect(()=>{if(e!==null){if(d.current!==e&&(d.current=e,s!==void 0)){X.getState().openThread(e,s);return}if(r&&t!==void 0){const m=o.find(u=>u.id===t),f=m===void 0?void 0:Mt(m);if(f!==void 0&&f!==t){const u=X.getState().open[e];X.getState().openThread(e,f,(u==null?void 0:u.focusComposer)??!1);return}}t!==s&&(l==null||l({to:n,search:m=>({...m,thread:t}),replace:!0}))}},[e,n,t,s,o,r,l])}const Jo=6,Ft="jump-back-in-listbox";function ze(e){return`jump-back-in-item-${e}`}const Zo='[role="combobox"]';function oe(e){return e instanceof Element&&e.matches(Zo)}function er({value:e,yieldToPalette:n=!1,enabled:s=!0}){const t=Me(),o=Nn(),[r,l]=i.useState(!1),[d,m]=i.useState({stamp:"",index:0}),[f,u]=i.useState(!1),[c,w]=i.useState(!1);e.length>0&&!c&&w(!0);const h=i.useRef(!1);i.useEffect(()=>{h.current=!0},[]);const{data:g}=it({enabled:s}),k=i.useMemo(()=>((g==null?void 0:g.agents)??[]).map(R=>R.projectPath),[g]),{data:x}=lt(k,{enabled:s}),N=i.useMemo(()=>x??{},[x]),p=i.useMemo(()=>jn(k,N),[k,N]),b=i.useMemo(()=>new Map(k.map(R=>[at(R),R])),[k]),_=i.useCallback(R=>Sn({room:R,agentsByPath:N,pathByAgentRef:b}),[N,b]),T=i.useMemo(()=>An(o.muted),[o.muted]),{items:$}=cs({mutedRoomIds:T,enabled:s}),C=i.useMemo(()=>$.slice(0,Jo),[$]),E=s&&r&&!f&&!c&&!n&&e.length===0&&C.length>0,P=`${E}:${C.length}`,I=d.stamp===P?d.index:0,F=i.useCallback(R=>{h.current&&oe(R.target)&&(u(!1),w(!1),l(!0))},[]),D=i.useCallback(R=>{oe(R.target)&&l(!0)},[]),M=i.useCallback(R=>{oe(R.target)&&l(!1)},[]),H=i.useCallback(R=>{C.length!==0&&m(y=>{const O=y.stamp===P?y.index:0;return{stamp:P,index:(O+R+C.length)%C.length}})},[C.length,P]),L=i.useCallback(()=>H(1),[H]),B=i.useCallback(()=>H(-1),[H]),W=i.useCallback(()=>{u(!0)},[]),z=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Re.getState().recordOpened("agent",R.session.cwd),t(ce({dir:R.session.cwd??void 0,session:R.session.id}));return}Re.getState().recordOpened("room",R.room.id),t({...ht.channels(),search:{id:R.room.id}})},[t]),q=i.useCallback(()=>{const R=C[I];!E||!R||z(R)},[E,C,I,z]);return{isOpen:E,hasRows:C.length>0,rows:C,agents:N,displayNames:p,visualOf:_,selectedIndex:I,activeDescendantId:E&&C[I]!==void 0?ze(I):void 0,listboxId:E?Ft:void 0,handleFocus:F,handleBlur:M,handlePointerDown:D,moveDown:L,moveUp:B,selectHighlighted:q,selectRow:z,dismiss:W}}function Lt({mark:e,label:n,title:s,summary:t,lastActivityAt:o,index:r,isSelected:l,now:d,onSelect:m}){const f=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:En(o),[o,d]);return a.jsxs("div",{id:ze(r),role:"option","aria-selected":l,"data-selected":l,title:s,onClick:m,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[a.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),a.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[a.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[a.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:n}),f!==null&&a.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:f})]}),t!==null&&a.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:t})]})]})}function tr({item:e,agent:n,displayName:s,index:t,isSelected:o,now:r,onSelect:l}){const d=Mn(n,e.session.cwd??s);return a.jsx(Lt,{mark:a.jsx(Cn,{color:d.color,emoji:d.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:t,isSelected:o,now:r,onSelect:l})}function nr({item:e,visual:n,index:s,isSelected:t,now:o,onSelect:r}){return a.jsx(Lt,{mark:a.jsx(Tn,{room:e.room,participants:e.room.participants,visuals:_n(n)}),label:a.jsx(On,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:t,now:o,onSelect:r})}function sr({rows:e,selectedIndex:n,agents:s={},displayNames:t={},visualOf:o,onSelect:r}){const l=ut(6e4);return i.useEffect(()=>{var d,m;(m=(d=document.getElementById(ze(n)))==null?void 0:d.scrollIntoView)==null||m.call(d,{block:"nearest"})},[n]),a.jsx(Ce.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:d=>d.preventDefault(),children:a.jsx("div",{id:Ft,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((d,m)=>{var f;return d.kind==="session"?a.jsx(tr,{item:d,agent:d.session.cwd&&s[d.session.cwd]||null,displayName:d.session.cwd&&t[d.session.cwd]||((f=d.session.cwd)==null?void 0:f.split("/").pop())||"Agent",index:m,isSelected:m===n,now:l,onSelect:()=>r(d)},`session-${d.id}`):a.jsx(nr,{item:d,visual:o(d.room),index:m,isSelected:m===n,now:l,onSelect:()=>r(d)},`room-${d.id}`)})})})}const Je={people:"People",agents:"Agents"},or=["people","agents"];function rr(e,n){const s=[];for(const{author:t}of e){if(t.kind==="system"||t.id===n||t.retired)continue;const o=t.handle;s.push({section:t.kind==="agent"?"agents":"people",authorId:t.id,label:t.displayName,...o?{handle:o}:{},...t.emoji?{emoji:t.emoji}:{},...t.color?{color:t.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function ar(e,n,s){const t=n.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:ir(r,t)})).filter(r=>r.tier!==null).sort((r,l)=>r.tier-l.tier||r.position-l.position);return s.flatMap(r=>o.filter(l=>l.row.section===r).map(({row:l})=>l))}function ir(e,n){var o;if(n==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(r=>r!==void 0);let t=null;for(const r of s){const l=r===n?0:r.startsWith(n)?1:r.includes(n)?2:null;l!==null&&(t===null||l<t)&&(t=l)}return t}function ie(e,n,s){var r;const t=e.length;if(t===0)return 0;let o=(n%t+t)%t;for(let l=0;l<t;l++){if(!((r=e[o])!=null&&r.disabled))return o;o=(o+s+t)%t}return 0}function lr(e,n,s,t){const o=e.slice(0,n),r=e.slice(n+1+s.length),l=`@${t}`,d=r.startsWith(" ")?"":" ";return{value:o+l+d+r,cursorPos:o.length+l.length+1}}const dr=/(^|\s)@([A-Za-z0-9_.-]*)$/,zt="mention-palette-listbox";function je(e){return`mention-item-${e}`}function cr({members:e,viewerAuthorId:n,text:s,sectionOrder:t=or}){var D;const[o,r]=i.useState(!1),[l,d]=i.useState(""),[m,f]=i.useState(-1),u=Pn(s),c=i.useRef(!1),w=i.useMemo(()=>rr(e,n),[e,n]),h=i.useMemo(()=>o?ar(w,l,t):[],[w,l,o,t]),[g,k]=i.useState(null),x=g!==null&&g.query===l&&g.open===o?g.index:ie(h,0,1),N=h[x],p=h.length===0||N!==void 0&&!N.disabled?x:ie(h,0,1),b=i.useCallback((M,H)=>{const L=M.slice(0,H).match(dr);if(!L){r(!1);return}r(!0),d(L[2]),f((L.index??0)+L[1].length)},[]),_=i.useCallback(M=>{u.write(M),c.current=!1},[u]),T=i.useCallback(M=>{c.current||b(u.read(),M)},[b,u]),$=i.useCallback(()=>{k({query:l,open:o,index:ie(h,p+1,1)})},[h,p,l,o]),C=i.useCallback(()=>{k({query:l,open:o,index:ie(h,p-1,-1)})},[h,p,l,o]),E=i.useCallback(M=>M.disabled||M.handle===void 0?null:(c.current=!0,r(!1),lr(u.read(),m,l,M.handle)),[m,l,u]),P=i.useCallback(()=>{const M=h[p];return M?E(M):(r(!1),null)},[h,p,E]),I=i.useCallback(()=>{c.current=!0,r(!1)},[]),F=h.some(M=>!M.disabled);return{isOpen:o,hasSelectableRows:F,rows:h,selectedIndex:p,activeDescendantId:o&&((D=h[p])==null?void 0:D.disabled)===!1?je(p):void 0,listboxId:o?zt:void 0,noteTextChange:_,handleCursorChange:T,moveDown:$,moveUp:C,selectHighlighted:P,selectRow:E,dismiss:I}}function ur({rows:e,selectedIndex:n,onSelect:s}){const t=i.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const d=o[o.length-1];d&&d.section===r.section?d.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(je(n)))==null||o.scrollIntoView({block:"nearest"})},[n]),a.jsx(Ce.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:a.jsx("div",{id:zt,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?a.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):t.map(({section:o,items:r},l)=>a.jsxs("div",{role:"group","aria-label":Je[o],children:[l>0&&a.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),a.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:Je[o]}),r.map(({row:d,index:m})=>{const f=m===n;return a.jsxs("div",{id:je(m),role:"option","aria-selected":f,"aria-disabled":d.disabled,"data-selected":f,"data-disabled":d.disabled,onClick:()=>{d.disabled||s(d)},className:d.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[a.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:d.emoji}),a.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:d.label}),d.handle!==void 0&&a.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",d.handle]}),d.disabledReason!==void 0&&a.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:d.disabledReason})]},d.authorId)})]},o))})})}function Ht({room:e,threadRootId:n,focusOnMount:s,offerJumpBackIn:t,onFocusChange:o,attachments:r}){const l=n===void 0?e.id:ot(e.id,n),d=$n(l),{target:m}=yt(),f=Dn(),u=Fn(l),c=i.useRef(null),w=he(e.members,e.viewerAuthorId),h=i.useRef(!1),g=cr({members:e.members,viewerAuthorId:e.viewerAuthorId,text:d}),k=t===!0,x=er({value:d,yieldToPalette:g.isOpen,enabled:k}),N=i.useRef(u);i.useEffect(()=>{var I;u!==N.current&&(N.current=u,(I=c.current)==null||I.focus())},[u]),i.useEffect(()=>{var I;s===!0&&((I=c.current)==null||I.focusUnlessTouch())},[]);const p=i.useCallback(I=>le.getState().set(l,I),[l]),[b,_]=i.useState(null);i.useLayoutEffect(()=>{var I;b!==null&&((I=c.current)==null||I.focusAt(b.pos))},[b]);const T=i.useCallback(I=>{I&&(p(I.value),_({pos:I.cursorPos}))},[p]),$=i.useCallback(I=>T(g.selectRow(I)),[g,T]),C=i.useCallback(()=>T(g.selectHighlighted()),[g,T]),E=()=>{if(m===null||!m.canSend||h.current)return;g.dismiss();const I=le.getState().take(l).trim();if(I==="")return;const F=r.pendingFiles.length>0;F&&(h.current=!0),m.send({text:I}).catch(()=>{const D=le.getState(),M=D.drafts[l]??"";D.set(l,M===""?I:`${I}
44
+ ${M}`)}).finally(()=>{F&&(h.current=!1)})};if(!w)return a.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[a.jsx("p",{className:"text-muted-foreground text-sm",children:ft}),a.jsx(Ae,{type:"button",size:"sm",variant:"outline",disabled:f.isPending,onClick:()=>f.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>pt.success(`You joined ${te(e)}`)}),children:Ln})]});const P=a.jsx(Q.Composer,{inputRef:c,value:d,onChange:I=>{p(I),g.noteTextChange(I)},onSubmit:E,head:a.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g.isOpen&&g.rows.length===0?"No one by that name.":""}),mentionPicker:a.jsx(we,{children:g.isOpen&&a.jsx(ur,{rows:g.rows,selectedIndex:g.selectedIndex,onSelect:$})}),overlays:a.jsx(a.Fragment,{children:a.jsx(we,{children:x.isOpen&&a.jsx(sr,{rows:x.rows,selectedIndex:x.selectedIndex,agents:x.agents,displayNames:x.displayNames,visualOf:x.visualOf,onSelect:x.selectRow})})}),input:{onCursorChange:g.handleCursorChange,isStreaming:!1,isPaletteOpen:g.isOpen||x.isOpen,paletteHasResults:x.isOpen?x.hasRows:g.hasSelectableRows,onArrowUp:x.isOpen?x.moveUp:g.moveUp,onArrowDown:x.isOpen?x.moveDown:g.moveDown,onCommandSelect:x.isOpen?x.selectHighlighted:C,onEscape:x.isOpen?x.dismiss:g.dismiss,tabPicks:!x.isOpen,onClear:()=>{p(""),g.dismiss()},activeDescendantId:x.isOpen?x.activeDescendantId:g.activeDescendantId,paletteListboxId:x.isOpen?x.listboxId:g.listboxId,contextKey:l,...r.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!k&&o===void 0?P:a.jsx("section",{className:"flex flex-col","data-testid":zn.homeComposer,onFocus:I=>{x.handleFocus(I),oe(I.target)&&(o==null||o(!0))},onBlur:I=>{x.handleBlur(I),oe(I.target)&&(o==null||o(!1))},onPointerDown:x.handlePointerDown,children:P})}function mr(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(n=>n.author.kind==="agent")}function fr({room:e,hasEntries:n,onAddAgents:s}){return!n||!mr(e)?null:a.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",a.jsx("button",{type:"button",onClick:s,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function pr({roomId:e}){const{approvals:n}=Hn(),s=Bn(n).filter(t=>t.roomId===e);return s.length===0?null:a.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:a.jsx(qn,{approvals:s})})}function hr({roomId:e}){const{data:n}=Ps("pending"),s=(n??[]).filter(t=>t.roomId===e);return s.length===0?null:a.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:s.map(t=>a.jsx($s,{request:t},t.requestId))})}const gr="An agent",Ze=64,ke=3,xr=new Set;function Bt({room:e,entries:n,scope:s,laneScope:t,stalled:o,unavailable:r=!1,onRetry:l,onScrollToRow:d}){const m=Me(),f=Un(e.id,s),u=Wn(e.id,s),c=Kn(e.id,s),[w,h]=i.useState(!1),g=At(e.id,{enabled:w}),k=Gn(),{mutate:x}=Ws(),[N,p]=i.useState(xr),b=i.useCallback(v=>{p(S=>new Set(S).add(v)),x({roomId:e.id,authorId:v},{onSettled:()=>p(S=>{const j=new Set(S);return j.delete(v),j})})},[x,e.id]),_=Ks(),[T,$]=i.useState(()=>new Map),C=Vn(),E=De(),P=i.useMemo(()=>Ee(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=i.useCallback(v=>{var S;return((S=P.get(v))==null?void 0:S.displayName)??gr},[P]),{interactions:F}=Xn(),D=i.useMemo(()=>F.filter(v=>v.roomId===e.id),[F,e.id]),M=i.useMemo(()=>{var S;const v={};for(const j of D){if(j.roomAuthorId===void 0)continue;const U=(S=P.get(j.roomAuthorId))==null?void 0:S.displayName;U!==void 0&&(v[j.sessionId]=U)}return v},[D,P]),H=i.useMemo(()=>f.map(v=>({authorId:v.authorId,name:I(v.authorId),state:v.state,since:v.since,activity:v.activity??null})),[f,I]),L=i.useMemo(()=>u.map(v=>{var j;const S=(j=C.data)==null?void 0:j.find(U=>U.id===v.behindRoomId);return{authorId:v.authorId,name:I(v.authorId),since:v.since,behind:{roomId:v.behindRoomId,title:S===void 0?null:te(S)},othersWaiting:v.othersWaiting,severalInTheWay:v.severalInTheWay}}),[u,I,C.data]),B=i.useMemo(()=>{const v=new Set;for(const S of u)T.get(S.authorId)===S.entryId&&v.add(S.authorId);return v},[u,T]),W=i.useMemo(()=>c===null?null:{authorId:c.authorId,name:I(c.authorId)},[c,I]),z=i.useMemo(()=>ks({capabilities:Le,asks:D,agentNames:M,stalled:o,presence:H,held:L,silentFinish:W,turn:null}),[D,M,H,L,W,o]),q=i.useMemo(()=>{var S;const v=new Map;for(const j of((S=g.data)==null?void 0:S.bindings)??[])v.set(j.authorId,j.sessionId);return v},[g.data]),R=i.useCallback(v=>{const S=n.find(U=>U.id===v);if(S===void 0)return null;const j=S.body.text.replace(/\s+/gu," ").trim();return j.length===0?null:j.length>Ze?`${j.slice(0,Ze).trimEnd()}…`:j},[n]),y=i.useCallback(v=>{var S;return t==="thread"?Ie(v):((S=Pe(n,v))==null?void 0:S.domId)??null},[n,t]),O=i.useMemo(()=>{const v=f.map(j=>{const U=R(j.entryId),K=y(j.entryId);return{authorId:j.authorId,author:Y(j.authorId,P,E.faces),state:j.state,since:j.since,doing:Yn(j.activity),replyingTo:U===null||K===null?null:{entryId:j.entryId,excerpt:U,rowId:K},sessionId:q.get(j.authorId)??null}}),S=L.map(j=>({authorId:j.authorId,author:Y(j.authorId,P,E.faces),state:"held",since:j.since,doing:null,replyingTo:null,sessionId:null,behind:j.behind,othersWaiting:j.othersWaiting}));return[...v,...S]},[f,L,P,E.faces,R,y,q]),A=i.useMemo(()=>{if(f.length===0)return null;const v=f.slice(0,ke);return a.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[v.map(S=>a.jsx(gt,{author:Y(S.authorId,P,E.faces),className:"ring-background size-4 ring-2"},S.authorId)),f.length>ke&&a.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${f.length-ke}`})]})},[f,P,E.faces]);return a.jsx(Q.LiveLane,{state:z,scope:t,onRetry:l,unavailable:r,faces:A,onPeekOpenChange:h,askCard:z.kind==="ask"?a.jsx(Qn,{ask:z.ask,...M[z.ask.sessionId]?{agentName:M[z.ask.sessionId]}:{},onOpenSession:v=>{m(ce({session:v}))},className:"border-l-0"}):void 0,peek:a.jsx(Q.LivePeek,{rows:O,onScrollToRow:d,onOpenSession:v=>{m(ce({session:v}))},onOpenRoom:v=>{m({...ht.channels(),search:{id:v}})},onAnswerFirst:v=>{const S=u.find(j=>j.authorId===v);S!==void 0&&$(j=>new Map(j).set(v,S.entryId)),_.mutate({roomId:e.id,authorId:v})},promoted:B,onStopAll:()=>k.mutate({roomId:e.id}),stopping:k.isPending,onStopAgent:b,stoppingAgents:N})})}const et=3e3;function yr(e,n,s,t=Date.now){const o=i.useRef(null),r=i.useRef(new Map),l=i.useRef(new Map),d=o.current,m=r.current,f=l.current,u=t();for(const c of e){if(f.has(c.id))continue;if(d===null){f.set(c.id,"at-rest");continue}const w=m.get(c.authorId);f.set(c.id,w!==void 0&&u-w<et?"handed-off":"dropped")}return i.useEffect(()=>{if(!s)return;o.current=new Set(e.map(w=>w.id));const c=t();for(const w of n)r.current.set(w,c);for(const[w,h]of r.current)c-h>et&&r.current.delete(w);for(const w of l.current.keys())o.current.has(w)||l.current.delete(w)}),f}function br({kind:e}){return e==="thread-error"?a.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[a.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),a.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?a.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[a.jsx(se,{className:"h-3 w-24"}),a.jsx(se,{className:"h-3 w-full max-w-sm"})]}):a.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function vr({room:e,rootEntryId:n,focusComposer:s,entries:t,reactionFrequents:o,streamStalled:r,streamUnavailable:l,onRetryStream:d,historyLoaded:m,historyFailed:f=!1,landOnRow:u,pushed:c,onClose:w}){const h=i.useMemo(()=>Ee(e.members,e.formerAuthors),[e.members,e.formerAuthors]),g=Dt({room:e,threadRootId:n}),k=he(e.members,e.viewerAuthorId),x=De(),N=i.useMemo(()=>new Map([...h].map(([R,y])=>[R,y.displayName])),[h]),{root:p,replies:b}=i.useMemo(()=>{let R;const y=[];for(const O of t)O.id===n?R=O:J(O)===n&&y.push(O);return{root:R,replies:y}},[t,n]),_=p==null?void 0:p.threadReplyCount,T=_!==void 0&&_>b.length,$=p===void 0||T?-1:1+b.length,C=_e(b.length,_),E=i.useMemo(()=>new Set(b.map(R=>R.id)),[b]),P=i.useMemo(()=>({replyIds:E,inside:!0}),[E]),I=Jn(e.id,P),F=mt(e.id,n),D=yr(b,I,m),M=i.useRef(null),H=i.useCallback(R=>{var y;(y=M.current)==null||y.scrollToRow(R)},[]),L=i.useRef(null);i.useEffect(()=>{var R;s||(R=L.current)==null||R.focus()},[n,s]);const B=R=>{R.key!=="Escape"||R.defaultPrevented||(R.stopPropagation(),w())},W=i.useMemo(()=>{const R=[];if(p===void 0){const y=f?"thread-error":m?"thread-orphan":"thread-waiting";R.push({kind:"notice",id:y,at:"",body:null})}else R.push({kind:"message",id:p.id,payload:p,grouping:{position:"only"},author:Y(ue(p,h),h,x.faces),at:p.createdAt});for(const y of b)R.push({kind:"message",id:y.id,payload:y,grouping:{position:"only"},author:Y(ue(y,h),h,x.faces),at:y.createdAt});return R},[p,b,h,x.faces,f,m]),z=i.useCallback(R=>{if(R.kind==="notice")return a.jsx(br,{kind:R.id});if(R.kind!=="message")return null;const y=R.payload,O=p!==void 0&&y.id===p.id,A=b.findIndex(j=>j.id===y.id),v=a.jsx(Pt,{roomId:e.id,entry:y,rowId:Ie(y.id),author:R.author,authorRef:h.get(y.authorId),authors:h,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:o,streamStalled:r,isMember:k,grouping:{position:"only"},answers:Ot(y,A<=0?p:b[A-1],j=>(p==null?void 0:p.id)===j?p:b.find(U=>U.id===j)),feedPosition:{index:O?1:(p===void 0?0:1)+A+1,total:$}});if(O)return C===0?v:a.jsxs(a.Fragment,{children:[v,a.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[a.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:C===1?"1 reply":`${C} replies`}),a.jsx("span",{className:"bg-border h-px flex-1"})]})]});const S=D.get(y.id)??"at-rest";return a.jsx("div",{className:V(S==="dropped"&&"motion-safe:animate-thread-reply-in",S==="handed-off"&&"motion-safe:animate-reply-settle"),children:v})},[p,b,C,D,e.id,e.viewerAuthorId,h,N,o,r,k,$]),q=i.useCallback(R=>R.kind==="message"?Ie(R.id):void 0,[]);return a.jsx(Tt,{known:x,children:a.jsx(Q.Root,{surface:"room",capabilities:Le,target:g.target,anchor:"rail",children:a.jsxs("section",{ref:L,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:B,className:V("bg-card flex min-h-0 flex-col outline-none",c?"h-full w-full":"w-full border-l"),children:[a.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[a.jsx("button",{type:"button",onClick:w,"aria-label":c?`Back to ${te(e)}`:"Close thread",className:V("focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1","after:absolute after:-inset-2.5 md:after:hidden"),children:c?a.jsx(Zn,{"aria-hidden":!0,className:"size-4"}):a.jsx(es,{"aria-hidden":!0,className:"size-4"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"Thread"}),a.jsx("p",{className:"text-muted-foreground truncate text-xs",children:te(e)})]})]}),a.jsx(Q.Timeline,{ref:M,conversationId:`thread-${n}`,label:`Thread in ${te(e)}`,busy:!m&&!f,rows:W,renderRow:z,domIdOf:q,...u===void 0?{}:{landOnRow:u},pending:F,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),a.jsx(Bt,{room:e,entries:t,scope:P,laneScope:"thread",stalled:c&&r===!0,unavailable:l,onRetry:c?d:void 0,onScrollToRow:H}),a.jsx(Ht,{room:e,threadRootId:n,attachments:g.attachments,focusOnMount:s},n)]})})})}const ge="room-thread-split",kr=320,Rr=360,wr=40,Ir=50,Nr=25;function tt(e,n){return n<=0?Nr:Math.min(Math.round(e/n*1e3)/10,Ir)}function jr(e){const n=tt(kr,e),s=Math.round((100-tt(Rr,e))*10)/10;return{minPct:n,maxPct:s,defaultPct:Math.min(Math.max(wr,n),s)}}function Sr(e,n,s){if(e===null||n===null||n<=0)return s.defaultPct;const t=e/n*100;return Math.round(Math.min(Math.max(t,s.minPct),s.maxPct)*10)/10}function Ar(e){try{const n=localStorage.getItem(e),s=n===null?NaN:Number(n);return Number.isFinite(s)&&s>0?s:null}catch{return null}}function Mr(e,n){try{localStorage.setItem(e,String(Math.round(n)))}catch{}}const Cr="react-resizable-panels:room-thread-split";function Or(){try{localStorage.removeItem(Cr)}catch{}}function Tr(){const[e,n]=i.useState(null),[s,t]=i.useState(null);return{ref:i.useCallback(r=>{if(r===null)return;n(r);const l=()=>t(r.offsetWidth);l();const d=new ResizeObserver(l);return d.observe(r),()=>{d.disconnect(),n(null),t(null)}},[]),element:e,width:s,sizing:jr(s??0)}}const _r=`${ge}-room`,nt=`${ge}-thread`,st=`${ge}-handle`,Er=4;function Pr({room:e,thread:n,storageKey:s=ns.ROOM_THREAD_WIDTH}){const{ref:t,element:o,width:r,sizing:l}=Tr(),[d,m]=i.useState(()=>Ar(s)),[f,u]=i.useState(null),c=i.useRef(null),w=Sr(d,r,l),h=r===null||(l.maxPct-l.minPct)/100*r<Er,g=n!==!1;i.useEffect(Or,[]);const k=i.useRef(!1);i.useLayoutEffect(()=>{var b;k.current&&((b=c.current)==null||b.resize(w))},[w,g]);const x=i.useRef(null),N=()=>{var $;const b=($=c.current)==null?void 0:$.getSize(),_=x.current;if(x.current=null,b===void 0||r===null||r<=0||_===b)return;const T=Math.round(b/100*r);m(T),Mr(s,T)},p=f??w;return i.useLayoutEffect(()=>{const b=o==null?void 0:o.querySelector(`[data-panel-resize-handle-id="${st}"]`);b&&(b.setAttribute("aria-controls",nt),b.setAttribute("aria-valuenow",String(Math.round(p))),b.setAttribute("aria-valuemin",String(Math.round(l.minPct))),b.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),a.jsx("div",{ref:t,className:"h-full overflow-hidden",children:a.jsxs(ts,{direction:"horizontal",id:ge,onLayout:b=>{k.current=b.length>1,u(k.current?b[1]:null)},children:[a.jsx(Ue,{id:_r,order:1,className:"flex",children:e}),g&&a.jsxs(a.Fragment,{children:[a.jsx(us,{id:st,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:h,onDragging:b=>{var _;b&&(x.current=((_=c.current)==null?void 0:_.getSize())??null)},onKeyDownCapture:b=>{var _,T;h||(x.current=((_=c.current)==null?void 0:_.getSize())??null,!(b.key!=="Home"&&b.key!=="End")&&(b.preventDefault(),(T=c.current)==null||T.resize(b.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),a.jsx(Ue,{ref:c,id:nt,order:2,defaultSize:w,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:n})]})]})})}function Jr({roomId:e,threadId:n,entrySeq:s,threadRoute:t,aboveTimeline:o,aboveComposer:r,offerJumpBackIn:l,onComposerFocusChange:d}){const m=ss(),f=ms(),u=os(e),c=u==null?void 0:u.rootEntryId,w=Yo(),h=i.useCallback(()=>{var O;const y=(O=X.getState().open[e])==null?void 0:O.rootEntryId;X.getState().closeThread(e),y!==void 0&&w.arm(y)},[e,w]),g=i.useCallback(y=>{X.getState().openThread(e,y)},[e]),k=rs(e),x=as(e),N=Rs(e,x.isSuccess);ws(e);const p=k.data,b=i.useMemo(()=>x.data??[],[x.data]),_=Dt({room:p});Qo({roomId:e,route:t,urlThreadId:n,openThreadId:c,entries:b,historyLoaded:x.isSuccess});const T=i.useMemo(()=>{var y;return((y=p==null?void 0:p.members.find(O=>O.author.id===p.viewerAuthorId))==null?void 0:y.lastReadSeq)??null},[p]),$=Go(e,T);is(p,b);const C=i.useRef(null),E=i.useRef(void 0),P=i.useCallback(y=>{E.current=y},[]),I=i.useCallback(()=>E.current,[]);i.useLayoutEffect(()=>{E.current=void 0},[e]);const F=i.useCallback(y=>{var O;(O=C.current)==null||O.scrollToRow(y)},[]),D=Xs(e),{loadOlder:M,cursor:H}=D,L=i.useCallback(()=>{const y=mo(b,H);M().then(()=>{y!==null&&requestAnimationFrame(()=>{var O;return(O=C.current)==null?void 0:O.scrollToRow(y.domId)})})},[b,H,M]),B=Ko({roomId:e,entrySeq:s,entries:b,historyLoaded:x.isSuccess}),W=i.useMemo(()=>c===void 0?void 0:{replyIds:new Set(b.filter(O=>J(O)===c).map(O=>O.id)),inside:!1},[b,c]);if(k.isLoading)return a.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:a.jsx($t,{})});if(k.isError||!p)return a.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[a.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),a.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const z=u!==void 0&&a.jsx(vr,{room:p,rootEntryId:u.rootEntryId,focusComposer:u.focusComposer,entries:b,reactionFrequents:p.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:x.isSuccess,historyFailed:x.isError,...B.threadRow===void 0?{}:{landOnRow:B.threadRow},pushed:m,onClose:h},u.rootEntryId),q=a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o,a.jsx(Uo,{ref:C,roomId:p.id,roomName:te(p),viewerAuthorId:p.viewerAuthorId,entries:b,members:p.members,formerAuthors:p.formerAuthors,lastReadSeq:$,reactionFrequents:p.reactionFrequents,streamStalled:N.stalled,isLoading:x.isLoading,error:x.error,onAddAgents:()=>We("add",p.id),openThreadId:c,onOpenThread:g,resumeRow:I,...B.roomRow===void 0?{}:{landOnRow:B.roomRow},onTopRow:P,canLoadOlder:D.canLoadOlder,isLoadingOlder:D.isLoadingOlder,onLoadOlder:L}),r,a.jsx(pr,{roomId:p.id}),a.jsx(hr,{roomId:p.id}),a.jsx(Bt,{room:p,entries:b,scope:W,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:F}),a.jsx(fr,{room:p,hasEntries:b.length>0,onAddAgents:()=>We("add",p.id)}),a.jsx(Ht,{room:p,attachments:_.attachments,offerJumpBackIn:l,onFocusChange:d},p.id)]}),R={surface:"room",capabilities:Le,target:_.target,anchor:"rail"};return m?a.jsx(Q.Root,{...R,children:a.jsx(we,{initial:!1,mode:"wait",children:a.jsx(Ce.div,{initial:{opacity:0,x:16},animate:{opacity:1,x:0},exit:{opacity:0,x:16},transition:{duration:.15,ease:[0,0,.2,1]},style:{paddingBottom:f},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:z===!1?q:z},z?`thread-${c}`:"room")})}):a.jsx(Q.Root,{...R,children:a.jsx(Pr,{room:q,thread:z})})}export{St as I,$t as R,ao as T,Jr as a,oe as i};
@@ -1 +1 @@
1
- import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-DcZPWi_I.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
1
+ import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-DBdO-_iL.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
@@ -1 +1 @@
1
- import{r as O,j as e,a0 as ye,bx as Ee,ar as we,G as N,dN as ie,by as ue,bz as fe,bA as me,bC as xe,dO as Te,a1 as Ae,a3 as ke,a4 as Oe,ad as pe,as as Le,du as he,dP as De,dQ as Ie,dR as Pe,a8 as j,dS as _e,dx as H,dT as Ue,am as be,B as $e,T as Re,b as He,e as Me,dU as Be,dV as ze,dW as Ke,dX as Qe,dY as Ve,dZ as qe}from"./index-DcZPWi_I.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as k}from"./execution-config-CAyT2Qoo.js";import{U as Fe}from"./unverified-catalog-notice-CdYU3WEJ.js";import{s as Ge}from"./settings-for-runtime-BoOa-ZFG.js";const Ze={duration:.12,ease:"easeOut"},Je={type:"spring",stiffness:320,damping:28};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=O.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?ie.warning:ie.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":d,children:[r&&e.jsx(ye,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Ee,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Je},exit:{opacity:0},transition:Ze,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",Te.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Ae(),i=ke();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:et})}})}const ge="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:L}){const w=pe(),[S,h]=O.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ge,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Re,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:L??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,le,oe,re,de;const r=pe(),{data:s}=Le(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=De(),C=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,A;return((A=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:L}=Ie({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),y=c?(m??[]).find(t=>t.isDefault):void 0,T=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=T?(m??[]).find(t=>t.value===T):void 0,D=(n==null?void 0:n.supportsEffort)??((ae=Ge(d,o))==null?void 0:ae.supportsEffort),B=D===void 0&&u,z=D!==!1,K=p?p.supportsEffort??!1:void 0,Q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:V,creditsEntry:je,resolvedAccount:q}=Pe(),W=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),v=Q&&[...Q.flatMap(t=>t.id===null?[]:[{id:t.id,label:V(t.path),path:t.path}]),...W?[{id:j,label:_e,path:W.path}]:[]],g=a.account??null,X=g!==null,Y=o==="claude-code"&&g===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&q?V(q):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=O.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:v,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:D,runtimeLabel:t=>H(t).label}),E=t=>{var b;return((b=Ne.breakages.find(A=>t.includes(A.kind)))==null?void 0:b.message)??null},U=!B&&z&&K!==!1,F=a.effort??(n==null?void 0:n.effort)??null,G=H(o).label,Ce=o==="claude-code"&&v!==void 0&&(v.length>1||X),Se=E(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=O.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??T??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:T,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:E(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:M?ce:c&&!h?y?`Use the suggested model: ${y.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Fe,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&L&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ge,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:E(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${G} supports`,warning:null}):z?U?e.jsx($,{label:"Effort",valueLabel:k(F),options:Ue.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:k(t)})),selected:F,isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:E(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${G}`,warning:E(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:Y?I??"Default":g!==null?((de=v==null?void 0:v.find(t=>t.id===g))==null?void 0:de.label)??g:I??"Default",options:(v??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:X,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),Y&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx($e,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function it({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(Me,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(Be,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(ze,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Ke,{})}),e.jsx(Qe,{children:f.map(o=>e.jsx(Ve,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(qe,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{it as RunsOnPopover};
1
+ import{r as O,j as e,a0 as ye,bx as Ee,ar as we,G as N,dN as ie,by as ue,bz as fe,bA as me,bC as xe,dO as Te,a1 as Ae,a3 as ke,a4 as Oe,ad as pe,as as Le,du as he,dP as De,dQ as Ie,dR as Pe,a8 as j,dS as _e,dx as H,dT as Ue,am as be,B as $e,T as Re,b as He,e as Me,dU as Be,dV as ze,dW as Ke,dX as Qe,dY as Ve,dZ as qe}from"./index-DBdO-_iL.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as k}from"./execution-config-CRkSeCj7.js";import{U as Fe}from"./unverified-catalog-notice-CQHA4Cst.js";import{s as Ge}from"./settings-for-runtime-BoOa-ZFG.js";const Ze={duration:.12,ease:"easeOut"},Je={type:"spring",stiffness:320,damping:28};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=O.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?ie.warning:ie.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":d,children:[r&&e.jsx(ye,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Ee,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Je},exit:{opacity:0},transition:Ze,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",Te.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Ae(),i=ke();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:et})}})}const ge="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:L}){const w=pe(),[S,h]=O.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ge,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Re,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:L??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,le,oe,re,de;const r=pe(),{data:s}=Le(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=De(),C=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,A;return((A=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:L}=Ie({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),y=c?(m??[]).find(t=>t.isDefault):void 0,T=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=T?(m??[]).find(t=>t.value===T):void 0,D=(n==null?void 0:n.supportsEffort)??((ae=Ge(d,o))==null?void 0:ae.supportsEffort),B=D===void 0&&u,z=D!==!1,K=p?p.supportsEffort??!1:void 0,Q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:V,creditsEntry:je,resolvedAccount:q}=Pe(),W=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),v=Q&&[...Q.flatMap(t=>t.id===null?[]:[{id:t.id,label:V(t.path),path:t.path}]),...W?[{id:j,label:_e,path:W.path}]:[]],g=a.account??null,X=g!==null,Y=o==="claude-code"&&g===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&q?V(q):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=O.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:v,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:D,runtimeLabel:t=>H(t).label}),E=t=>{var b;return((b=Ne.breakages.find(A=>t.includes(A.kind)))==null?void 0:b.message)??null},U=!B&&z&&K!==!1,F=a.effort??(n==null?void 0:n.effort)??null,G=H(o).label,Ce=o==="claude-code"&&v!==void 0&&(v.length>1||X),Se=E(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=O.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??T??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:T,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:E(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:M?ce:c&&!h?y?`Use the suggested model: ${y.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Fe,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&L&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ge,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:E(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${G} supports`,warning:null}):z?U?e.jsx($,{label:"Effort",valueLabel:k(F),options:Ue.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:k(t)})),selected:F,isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:E(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${G}`,warning:E(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:Y?I??"Default":g!==null?((de=v==null?void 0:v.find(t=>t.id===g))==null?void 0:de.label)??g:I??"Default",options:(v??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:X,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),Y&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx($e,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function it({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(Me,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(Be,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(ze,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Ke,{})}),e.jsx(Qe,{children:f.map(o=>e.jsx(Ve,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(qe,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{it as RunsOnPopover};
@@ -1 +1 @@
1
- import{as as Be,a1 as b,a3 as K,r as x,a4 as R,j7 as F,j8 as M,a2 as z,j as e,hx as Ee,e1 as Qe,e2 as Y,O as we,Q as Re,U as Ie,B as C,hu as Ge,G as V,dt as We,dP as Ye,j9 as Ve,ja as He,dy as Le,ar as te,x as de,bx as Je,J as ue,dx as me,d$ as S,e0 as ne,au as Xe,jb as Ze,I as _,jc as es,jd as Ae,je as ss,_ as De,fp as ts,dU as ns,dV as rs,dW as as,dX as is,dY as be,dM as os,C as ls,jf as cs,jg as ds,jh as us,T as ms}from"./index-DcZPWi_I.js";import{I as xs}from"./inline-code-g9PVHZI2.js";import{u as hs}from"./useMutationState-Btf2Hp1a.js";import{O as fs,a as W}from"./runtime-connect-Dn0T5YWv.js";import{T as ps}from"./terminal-C9M5a_PS.js";function gs(){var s;return((s=Be().data)==null?void 0:s.isLocalCaller)!==!1}function St(s){var u,d;const t=b(),n=K(),[i,a]=x.useState(null),r=R({mutationFn:()=>(a(null),t.provisionRuntime(s,m=>a(m))),onSuccess:m=>{m.ok&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((u=r.data)==null?void 0:u.ok)===!1,o=r.isError?r.error.message:((d=r.data)==null?void 0:d.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Ke(s){return["runtime-key-status",s]}function ys(s,t=!0){const n=b();return z({queryKey:Ke(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function js(s){const t=b(),n=R({mutationFn:a=>t.checkRuntimeCredential(s,a.trim().length>0?a:null),meta:{suppressErrorToast:!0}}),i=n.data??(n.isError?{ok:!1,reason:"unexpected",message:n.error.message||"Couldn’t check the key."}:null);return{check:a=>n.mutate(a),isPending:n.isPending,result:i,checkedSavedKey:i!==null&&(n.variables??"").trim().length===0,reset:n.reset}}function vs(s){var o,c,u;const t=b(),n=K(),[i,a]=x.useState(null),r=R({mutationFn:async d=>{a("checking");const m=await t.checkRuntimeCredential(s,d);return m.ok?(a("saving"),await t.storeRuntimeCredential(s,d),{saved:!0,message:null}):{saved:!1,message:m.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Ke(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:d=>{d.trim().length!==0&&r.mutate(d)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((u=r.data)==null?void 0:u.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function ks(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function Ns(s,t){var T,I,w,P;const n=b(),i=K(),{sessionId:a,accountRoot:r,onCompleted:l}=t??{},o=x.useMemo(()=>["runtime-login",s,a??"",r??""],[s,a,r]),c=R({mutationKey:o,mutationFn:()=>n.delegateRuntimeLogin(s,a===void 0&&r===void 0?void 0:{sessionId:a,accountRoot:r}),onSuccess:N=>{N.ok&&(i.invalidateQueries({queryKey:[...F]}),i.invalidateQueries({queryKey:[...M]}))}}),u=hs({filters:{mutationKey:o,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),d=u.some(N=>N.state.status==="pending"),m=u[u.length-1],h=d||m==null?void 0:m.state,g=d||m==null?void 0:m.id,p=!d&&((h==null?void 0:h.status)==="error"||((T=h==null?void 0:h.data)==null?void 0:T.ok)===!1),y=(h==null?void 0:h.status)==="error"?((I=h.error)==null?void 0:I.message)??null:((w=h==null?void 0:h.data)==null?void 0:w.error)??null,v=((P=h==null?void 0:h.data)==null?void 0:P.ok)===!0,O=x.useRef(l);return O.current=l,x.useEffect(()=>{var L;if(!v||g===void 0)return;const N=ks(i);N.has(g)||(N.add(g),(L=O.current)==null||L.call(O))},[v,g,i]),{login:()=>{d||c.mutate()},isPending:d,isSuccess:v,isError:p,errorMessage:p?y??"Couldn’t sign in. Try again.":null}}const Ce={"claude-code":{signInLabel:"Sign in",otherWayLabel:"Sign in with Claude",signInHint:"Use your Claude subscription or Anthropic account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"Anthropic API key",keyPlaceholder:"sk-ant-…",getKeyUrl:"https://console.anthropic.com/settings/keys"},codex:{signInLabel:"Sign in with ChatGPT",otherWayLabel:"Sign in with ChatGPT",signInHint:"Use your ChatGPT account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"OpenAI API key",keyPlaceholder:"sk-…",getKeyUrl:"https://platform.openai.com/api-keys"}};function bs(s){return Ce[s]??Ce["claude-code"]}function Ss({command:s,infoUrl:t,copyLabel:n}){return!s&&!t?null:e.jsxs("div",{className:"space-y-2",children:[s&&e.jsxs("div",{className:"bg-muted flex items-center justify-between gap-2 rounded-lg px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(ps,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(Ee,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(Qe,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(Y,{className:"size-3"})]})]})}function Ct({command:s,runtimeLabel:t}){const[n,i]=x.useState(!1);return e.jsxs(we,{open:n,onOpenChange:i,className:"mt-2",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["DorkOS installs ",t," for you."," ",e.jsx(Re,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Ie,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(xs,{children:s}),e.jsx(Ee,{value:s,label:`Copy command: ${s}`,className:"shrink-0"})]})]})}function Oe({onRetry:s}){return e.jsxs("div",{"data-testid":"remote-signin-notice",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Signing in needs the computer DorkOS runs on."}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s?"Sign in to DorkOS there, then press Retry.":"Sign in to DorkOS there."}),e.jsx("p",{className:"text-muted-foreground/80 mt-2 text-xs",children:"Already on that computer? Open DorkOS at localhost instead."}),s&&e.jsxs(C,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ge,{className:"size-3"}),"Retry"]})]})}function Cs({ollama:s=!1,remote:t=!1,className:n}){return e.jsxs("p",{className:V("text-muted-foreground text-xs",n),"data-testid":"keep-it-local-note",children:[t?"Prefer everything on the computer DorkOS runs on? Use your own sign-in there":"Prefer to keep everything on this computer? Use your own sign-in",s?", or Ollama":"","."]})}function Os(s){const t=We(),{data:n}=Ye();return s?Ve(He(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",Ps={title:xe,body:`Frontier models are unlocked. ${he}`},Es={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Me(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function ws(s){return{title:`${s} is ready`,body:`New work on ${s} runs on your DorkOS credits. Change it any time in Settings › Runtimes.`}}function A({message:s}){const t=Le();return e.jsxs(te.div,{role:"status",className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:t?!1:{opacity:0},animate:{opacity:1},"data-testid":"connect-progress",children:[e.jsx(de,{size:"xs",className:V("text-muted-foreground shrink-0",t&&"animate-none")}),e.jsx(Je,{mode:"wait",children:e.jsx(te.span,{className:"truncate text-xs",initial:t?!1:{opacity:0},animate:{opacity:1},exit:t?void 0:{opacity:0},transition:{duration:.2},children:s},s)})]})}function U({message:s="Connected"}){return e.jsxs("div",{role:"status",className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"connect-connected",children:[e.jsx(ue,{className:"size-3.5"}),s]})}function B({message:s,onRetry:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:s}),e.jsx(C,{size:"sm",onClick:t,children:"Try again"})]})}function Rs({type:s,onConnected:t,asOtherWay:n=!1}){const i=bs(s),a=Ns(s),[r,l]=x.useState(!1),o=x.useRef(!1);return x.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Me(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(U,{message:"Signed in"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",variant:n?"outline":"default",className:"w-full",onClick:a.login,children:n?i.otherWayLabel:i.signInLabel}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i.signInHint})]})}),r?e.jsxs("div",{className:"space-y-3","data-testid":`login-connect-key-${s}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),e.jsx(Is,{type:s,copy:i,onConnected:t}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Back to sign in"})]}):n?e.jsx(C,{size:"sm",variant:"outline",className:"w-full",onClick:()=>l(!0),"data-testid":`login-connect-use-key-${s}`,children:"Paste a key"}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors","data-testid":`login-connect-use-key-${s}`,children:"Use an API key instead"})]})}function Is({type:s,copy:t,onConnected:n}){var p,y;const[i,a]=x.useState(""),r=vs(s),l=ys(s),o=js(s),c=x.useRef(!1),u=x.useRef(null);if(x.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Me(me(s).label)))},[r.isSuccess,n,s]),x.useEffect(()=>{var v;r.isError&&((v=u.current)==null||v.focus())},[r.isError]),r.isSuccess)return e.jsx(U,{});const d=(p=l.data)!=null&&p.key.saved?l.data.key:null,m=i.trim().length>0,h=r.isPending||o.isPending,g=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:v=>{v.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(S,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:u,value:i,disabled:h,onChange:v=>{a(v.target.value),g()},placeholder:d?`Saved key ends in ${d.last4}. Paste to replace.`:t.keyPlaceholder,autoComplete:"off",spellCheck:!1}),r.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:r.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.getKeyUrl?e.jsxs("a",{href:t.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"ghost",disabled:!m&&d===null||h,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:!m||h,children:"Save key"})]})]}),h?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((y=o.result)==null?void 0:y.ok)===!0?e.jsx(U,{message:o.checkedSavedKey?"Your saved key works":"Key works"}):o.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o.result.message}):null]})}function Ls(s){const t=b(),n=z({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference()});return n.isPending?e.jsx(de,{"aria-label":"Loading model settings"}):n.isError?e.jsx("p",{role:"alert",children:"Couldn’t load model settings. Try again."}):e.jsx(As,{saved:n.data,...s},JSON.stringify(n.data))}function As({saved:s,onConnected:t,onSave:n}){var D,J,G,X,j,$,fe,pe,ge,ye,je,ve;const i=b(),a=K(),r=x.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=x.useState(n&&l==="dorkos-credits"?"api-key":l),[u,d]=x.useState(((J=s.inference)==null?void 0:J.protocol)??"openai-chat-completions"),[m,h]=x.useState(((G=s.inference)==null?void 0:G.endpoint)??""),[g,p]=x.useState(((X=s.inference)==null?void 0:X.provider)??""),[y,v]=x.useState(((j=s.inference)==null?void 0:j.model)??""),[O,T]=x.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[I,w]=x.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[P,N]=x.useState(""),[L,E]=x.useState(null),k=z({queryKey:["doe-credits-models",u],queryFn:()=>i.getDoeCreditsModels(u),enabled:o==="dorkos-credits"}),q=o==="dorkos-credits"?(pe=k.data)==null?void 0:pe.models.find(f=>f.id===y):void 0,ee=s.hasKey&&((ge=s.inference)==null?void 0:ge.endpoint)===m&&s.inference.source==="api-key",H=R({mutationFn:async f=>{if(n)return n(f,P.trim()||null);o==="api-key"&&P.trim()?await i.storeDoeCredential(f,P.trim()):await i.setDoeInference(f),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{N("");for(const f of[["doe-inference"],F,M,Xe.all,Ze.status()])a.invalidateQueries({queryKey:f});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:f=>E(n&&f instanceof Error&&f.message?f.message:"Couldn’t save model settings. Try again.")});function re(f){var ke,Ne;if(f.preventDefault(),E(null),P.trim().startsWith("sk-ant-oat")){E("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!P.trim()&&!ee){E("Enter an API key.");return}if(o==="dorkos-credits"&&(!q||!((ke=k.data)!=null&&ke.endpoint))){E("Link DorkOS credits and choose an available model.");return}const ae=es.safeParse({source:o,protocol:u,provider:o==="dorkos-credits"?"dorkos":g,endpoint:o==="dorkos-credits"?(Ne=k.data)==null?void 0:Ne.endpoint:m,model:y,contextWindow:(q==null?void 0:q.contextWindow)??Number(O),maxOutputTokens:(q==null?void 0:q.maxOutputTokens)??Number(I)});if(!ae.success){E("Check the model, endpoint, and token limits.");return}H.mutate(ae.data)}const Q="bg-background border-input focus-visible:ring-ring h-11 w-full rounded-md md:h-9 border px-3 text-sm focus-visible:ring-2";return e.jsxs("form",{onSubmit:re,className:"space-y-3","aria-label":"DorkOS model settings",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:Q,value:o,onChange:f=>{c(f.target.value),v("")},children:[e.jsx("option",{value:"api-key",children:"My API key"}),e.jsx("option",{value:"local",children:"Local model"}),!n&&e.jsx("option",{value:"dorkos-credits",children:"DorkOS credits"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:Q,value:u,onChange:f=>{d(f.target.value),o==="dorkos-credits"&&v("")},children:[e.jsx("option",{value:"openai-chat-completions",children:"OpenAI Chat Completions"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"})]})]}),o==="dorkos-credits"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:Q,value:y,onChange:f=>v(f.target.value),disabled:k.isPending||!((ye=k.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=k.data)==null?void 0:je.models.map(f=>e.jsx("option",{value:f.id,children:f.displayName},f.id))]}),!((ve=k.data)!=null&&ve.endpoint)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link DorkOS credits in Settings to choose a model."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(_,{id:`${r}-service`,value:g,onChange:f=>p(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(_,{id:`${r}-endpoint`,type:"url",value:m,onChange:f=>h(f.target.value),required:!0}),o==="local"&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Use a loopback address. No API key is needed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(_,{id:`${r}-model`,value:y,onChange:f=>v(f.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(_,{id:`${r}-context`,type:"number",min:1,value:O,onChange:f=>T(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(_,{id:`${r}-output`,type:"number",min:1,value:I,onChange:f=>w(f.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:P,onChange:f=>N(f.target.value),autoComplete:"off"}),ee&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"API key saved. Leave blank to keep it."})]})]}),L&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:L}),e.jsx(C,{type:"submit",disabled:H.isPending,children:H.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ds={openai:"OpenAI",anthropic:"Anthropic"};function Ks(s){return Ds[s]??s}function Ms(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ks(s)})`}}const Te="ollama",qe=["runtime-connect","ollama"];function Ts(s){const t=b();return z({queryKey:qe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function qs(){const s=b(),t=K(),n=R({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:Te}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]})}});return{connect:i=>n.mutate(i),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,errorMessage:n.isError?n.error.message??"Couldn’t connect to Ollama.":null}}const Fe=["runtime-connect","opencode","direct"];function Fs(){const s=b();return z({queryKey:Fe,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function $s(){var i;const s=b(),t=R({mutationFn:({providerId:a,key:r,baseURL:l})=>s.checkProviderCredential(a,r.trim().length>0?r:null,(l==null?void 0:l.trim())||null),meta:{suppressErrorToast:!0}}),n=t.data??(t.isError?{ok:!1,reason:"unexpected",message:t.error.message||"Couldn’t check the key."}:null);return{check:a=>t.mutate(a),isPending:t.isPending,result:n,checkedSavedKey:n!==null&&(((i=t.variables)==null?void 0:i.key)??"").trim().length===0,reset:t.reset}}function _s(){var l,o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:async({providerId:u,key:d,baseURL:m})=>{const h=(m==null?void 0:m.trim())||null;i("checking");const g=await s.checkProviderCredential(u,d.trim().length>0?d:null,h);return g.ok?(i("saving"),await s.storeProviderCredential(u,d,h),{saved:!0,message:null}):{saved:!1,message:g.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:u=>{u.saved&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[...Fe]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:u=>{u.providerId.trim().length!==0&&a.mutate(u)},isPending:a.isPending,phase:n,isSuccess:((o=a.data)==null?void 0:o.saved)===!0,isError:a.isError||r,errorMessage:r?((c=a.data)==null?void 0:c.message)??null:a.isError?a.error.message??"Couldn’t save your key.":null,reset:a.reset}}function Us(s){const t=b();return z({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function zs(){var o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:async u=>{i(null);const d=await s.pullOllamaModel(u,m=>i(m));return d.ok&&await s.updateConfig({runtimes:{opencode:{provider:Te}}}),d},onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{pull:u=>a.mutate(u),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Bs(){var o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:()=>(i(null),s.provisionOllama(u=>i(u))),onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:qe}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{provision:()=>a.mutate(),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t install Ollama.":null,progress:n,result:a.data}}const Qs="https://ollama.com/download",Gs="curl -fsSL https://ollama.com/install.sh | sh";function Ws({installMethod:s}){const t=Bs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Ys,{}),n?e.jsx(Vs,{provision:t}):e.jsx(Hs,{}),e.jsx(Js,{})]})}function Ys(){const s=Ae();return e.jsxs("div",{className:"space-y-1.5","data-testid":"ollama-explainer",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Run AI models on ",s]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Ollama is a free app that runs AI models on ",s,"."]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Nothing you type leaves ",s,"."]})]})}function Vs({provision:s}){var t,n,i;return s.isPending?e.jsx(A,{message:((t=s.progress)==null?void 0:t.message)??"Installing Ollama…"}):(n=s.result)!=null&&n.ok?(i=s.result.status)!=null&&i.running?e.jsx(A,{message:"Ollama is ready…"}):e.jsx("p",{className:"text-xs","data-testid":"ollama-installed-not-running",children:"Ollama isn’t running. Open the Ollama app to start it."}):s.isError?e.jsx(B,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(C,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Hs(){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-manual-install",children:[e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Installing Ollama needs administrator access. Run this in a terminal:"}),e.jsx(Ss,{command:Gs,copyLabel:"Copy the Ollama install command"})]})}function Js(){return e.jsxs("a",{href:Qs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Or download Ollama from ollama.com ",e.jsx(Y,{className:"size-3"})]})}const Xs="https://ollama.com/library",Zs={"runs-well":{label:"Runs well on your machine",tone:"text-status-success-fg"},"may-be-slow":{label:"May be slow on your machine",tone:"text-status-warning-fg"},"too-large":{label:"Too large for your machine",tone:"text-destructive"}},et={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function st({active:s,onConnected:t,onConnectDirectly:n}){var I,w,P,N,L,E;const i=Ts(s),a=qs(),r=zs(),l=((I=i.data)==null?void 0:I.running)??!1,o=Us(l),[c,u]=x.useState(null),[d,m]=x.useState(null);x.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),x.useEffect(()=>{var k;(k=r.result)!=null&&k.ok&&(t==null||t(Pe))},[(w=r.result)==null?void 0:w.ok,t]);const h=k=>{u(k),a.connect(k)},g=k=>{m(k),r.pull(k)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Ws,{installMethod:(P=i.data)==null?void 0:P.installMethod});if(a.isSuccess)return t?null:e.jsx(U,{message:"Connected to Ollama"});if((N=r.result)!=null&&N.ok)return t?null:e.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"guided-pull-connected",children:[e.jsx(ue,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Connected:"}),e.jsx(ss,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const p=i.data,y=(p==null?void 0:p.installed)??[],v=((L=p==null?void 0:p.installed)==null?void 0:L.length)??(p==null?void 0:p.models.length)??0,O=((E=o.data)==null?void 0:E.models.some(k=>k.model.id===d))??!1,T=d!==null&&!O?d:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(tt,{count:v}),y.length>0&&e.jsx(nt,{installed:y,connect:a,connectingId:c,onUse:h}),e.jsx(rt,{catalogQuery:o,pull:r,pullingId:d,onGet:g}),e.jsx(at,{pull:r,activePull:T,onSubmit:g}),e.jsx(it,{}),n&&e.jsxs("button",{type:"button",onClick:n,"data-testid":"local-connect-directly",className:"focus-ring text-muted-foreground hover:text-foreground block rounded-md text-left text-xs transition-colors",children:["Using LM Studio or another server? ",e.jsx("span",{className:"underline",children:"Connect it directly"})]})]})}function tt({count:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-xs","data-testid":"ollama-status-line",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-emerald-500","aria-hidden":!0}),e.jsxs("span",{children:["Ollama is running · ",s," ",s===1?"model":"models"," installed"]})]})}function $e({verdict:s,explanation:t}){const n=Zs[s];return e.jsxs("div",{"data-testid":"ollama-verdict","data-verdict":s,children:[e.jsx("p",{className:V("text-xs font-medium",n.tone),children:n.label}),e.jsx("p",{className:"text-muted-foreground/80 text-2xs leading-snug",children:t})]})}function _e({tier:s}){return e.jsx(De,{size:"xs",variant:"outline",className:"font-normal",children:et[s]})}function nt({installed:s,connect:t,connectingId:n,onUse:i}){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-installed",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Installed"}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>{const r=n===a.id&&t.isPending,l=n===a.id&&t.isError,o=()=>i(a.id);let c=e.jsx(C,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(B,{message:t.errorMessage??"Couldn’t connect to Ollama.",onRetry:o})),e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"ollama-installed-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:a.id}),a.assessment.model.tier&&e.jsx(_e,{tier:a.assessment.model.tier})]}),e.jsx($e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function rt({catalogQuery:s,pull:t,pullingId:n,onGet:i}){var r;if(s.isPending)return e.jsx(A,{message:"Checking which models fit your machine…"});const a=((r=s.data)==null?void 0:r.models)??[];return s.isError||a.length===0?null:e.jsxs("div",{className:"space-y-2","data-testid":"ollama-shelf",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add a model"}),e.jsx("ul",{className:"space-y-1.5",children:a.map(({model:l,verdict:o,explanation:c})=>{const u=n===l.id,d=()=>i(l.id);return u&&(t.isPending||t.isError)?e.jsxs("li",{className:"border-border rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:l.label}),t.isPending?e.jsx(Ue,{progress:t.progress}):e.jsx(B,{message:t.errorMessage??"Couldn’t download the model.",onRetry:d})]},l.id):e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:l.label}),l.tier&&e.jsx(_e,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx($e,{verdict:o,explanation:c})]}),e.jsx(C,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:d,children:"Get"})]},l.id)})})]})}function at({pull:s,activePull:t,onSubmit:n}){const[i,a]=x.useState(""),r=i.trim(),l=fs.test(r);if(t&&s.isPending)return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Downloading ",t,"…"]}),e.jsx(Ue,{progress:s.progress})]});const o=c=>{c.preventDefault(),l&&n(r)};return e.jsxs("form",{onSubmit:o,className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"ollama-pull-tag",className:"text-xs font-normal",children:"Download any model by name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{id:"ollama-pull-tag","data-testid":"ollama-pull-by-name",value:i,onChange:c=>a(c.target.value),placeholder:"qwen2.5-coder:32b","aria-invalid":r.length>0&&!l}),e.jsx(C,{type:"submit",size:"sm",disabled:!l||s.isPending,children:"Download"})]}),r.length>0&&!l&&e.jsxs("p",{className:"text-muted-foreground text-2xs",children:["Use a tag like ",e.jsx("code",{className:"text-2xs",children:"qwen2.5-coder:32b"}),"."]}),t&&s.isError&&e.jsx(B,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function it(){return e.jsxs("a",{href:Xs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Browse the library ",e.jsx(Y,{className:"size-3"})]})}function Ue({progress:s}){const t=Le(),n=s==null?void 0:s.percent,i=(s==null?void 0:s.status)??"Starting download…";return e.jsxs("div",{className:"space-y-2","data-testid":"guided-pull-progress",children:[e.jsx("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:n===void 0?e.jsx(te.div,{className:"bg-primary/70 h-full w-1/3 rounded-full",animate:t?{}:{x:["-100%","300%"]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"}}):e.jsx(te.div,{className:"bg-primary h-full rounded-full",initial:!1,animate:{width:`${Math.min(100,Math.max(0,n))}%`},transition:t?{duration:0}:{duration:.3,ease:"easeOut"},"data-testid":"guided-pull-bar"})}),e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.jsx(de,{size:"xs",className:V("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function ot(){var r,l,o;const s=b(),t=K(),n=R({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))}}),i=n.isError||((r=n.data)==null?void 0:r.ok)===!1,a=n.isError?n.error.message:((l=n.data)==null?void 0:l.error)??null;return{store:c=>{c.trim().length!==0&&n.mutate(c)},isPending:n.isPending,isSuccess:((o=n.data)==null?void 0:o.ok)===!0,isError:i,errorMessage:i?a??"Couldn’t save the OpenRouter key.":null}}function lt(){var h,g;const s=b(),t=K(),[n,i]=x.useState(null),[a,r]=x.useState(null),l=R({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:p,state:y})=>{if(!ts(p)){r("Couldn’t open the OpenRouter sign-in page.");return}i(y)},onError:p=>r(p.message??"Couldn’t start OpenRouter sign-in.")}),o=z({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="pending"?1500:!1},refetchOnWindowFocus:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="error"}}),c=(h=o.data)==null?void 0:h.status;x.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const u=l.isPending||n!==null&&c==="pending",d=!!a||c==="error",m=d?a??((g=o.data)==null?void 0:g.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:u,isSuccess:c==="connected",isError:d,errorMessage:m}}const ct="https://openrouter.ai/keys";function dt({onConnected:s}){const[t,n]=x.useState(""),i=ot(),a=lt(),r=i.isSuccess||a.isSuccess;return x.useEffect(()=>{r&&(s==null||s(Ps))},[r,s]),r?e.jsx(U,{message:"Connected to OpenRouter"}):e.jsxs("div",{className:"space-y-4","data-testid":"openrouter-gateway",children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:"Sign in to OpenRouter in the new tab…"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",className:"w-full",onClick:a.begin,children:"Connect OpenRouter"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Makes a limited key for you."})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),i.isPending?e.jsx(A,{message:"Checking your OpenRouter key…"}):e.jsxs("form",{className:"space-y-2",onSubmit:l=>{l.preventDefault(),i.store(t)},children:[e.jsx(S,{htmlFor:"openrouter-key",className:"text-xs",children:"OpenRouter key"}),e.jsx(ne,{id:"openrouter-key",value:t,onChange:l=>n(l.target.value),placeholder:"sk-or-…",autoComplete:"off",spellCheck:!1}),i.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:i.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("a",{href:ct,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an OpenRouter key ",e.jsx(Y,{className:"size-3"})]}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function Z(s){return W.find(t=>t.id===s)}function ut(s){var t;return((t=Z(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=W.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??W[0].defaultBaseURL}function ze(s){return W.some(t=>t.id===s.providerId)}function ie(s){return ze(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function mt({onConnected:s}){const t=Fs();return t.isError&&!t.data?e.jsx(B,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(xt,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function xt({setup:s,onConnected:t}){var X;const n=ze(s)?s:null,[i,a]=x.useState(()=>ie(s)),[r,l]=x.useState(""),[o,c]=x.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=Z(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[u,d]=x.useState(()=>{var $;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=Z(j))==null?void 0:$.defaultBaseURL)}),m=_s(),h=$s(),g=Z(i),p=ut(i),y=n!=null&&n.key.saved&&n.providerId===p?n.key.last4:null,v=o.trim(),O=i===se,T=!O||v.length>0,I=ce(p),w=v||I,P=w===I?"":w,N=n===null?null:n.baseURL??ce(n.providerId),L=p!==((n==null?void 0:n.providerId)??null)||w!==N,E=r.trim().length>0,q=(E||y!==null&&!L)&&T,ee=E&&T,H=!E&&y!==null&&L,re=w.startsWith("http://"),Q={providerId:p,key:r,baseURL:P},D=m.isPending||h.isPending,J=x.useRef(null),G=()=>{h.reset(),m.reset()};return x.useEffect(()=>{m.isSuccess&&(t==null||t(Es))},[m.isSuccess,t]),x.useEffect(()=>{var j;m.isError&&((j=J.current)==null||j.focus())},[m.isError]),m.isSuccess?e.jsx(U,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),h.reset(),m.connect(Q)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(ns,{value:i,disabled:D,onValueChange:j=>{var $;a(j),c((($=Z(j))==null?void 0:$.defaultBaseURL)??""),G()},children:[e.jsx(rs,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(as,{})}),e.jsxs(is,{children:[W.map(j=>e.jsx(be,{value:j.id,children:j.label},j.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(O||u)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(S,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!O&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(_,{id:"direct-provider-base-url",value:o,disabled:D,onChange:j=>{c(j.target.value),G()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!O&&!u&&e.jsx("button",{type:"button",onClick:()=>d(!0),disabled:D,"data-testid":"direct-provider-advanced",className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Advanced"}),re&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-insecure",children:"This address isn’t encrypted. Your key travels in the open."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:J,value:r,disabled:D,onChange:j=>{l(j.target.value),G()},placeholder:y===null?(g==null?void 0:g.keyPlaceholder)??W[0].keyPlaceholder:`Saved key ends in ${y}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),m.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:m.errorMessage}),H&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-repaste",children:"Paste your key again to change the address."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g===void 0?e.jsx("span",{}):e.jsxs("a",{href:g.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"outline",disabled:!q||D,"data-testid":"direct-provider-test",onClick:()=>{m.reset(),h.reset(),h.check(Q)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",disabled:!ee||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:m.phase==="saving"?"Saving…":"Checking your key…"}):((X=h.result)==null?void 0:X.ok)===!0?e.jsx(U,{message:h.checkedSavedKey?"Your saved key works":"Key works"}):h.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:h.result.message}):null]})}function ht({currentProvider:s,onConnected:t}){const[n,i]=x.useState("choose"),a=ft();if(n==="choose")return e.jsx(pt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(dt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(st,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(mt,{onConnected:t})})}function ft(){return{cloud:{step:"cloud",title:"Best models, zero setup",description:"Claude, GPT, Gemini and 300+ more, in the cloud.",sub:"One OpenRouter account covers them all. Pay for what you use.",tradeOff:"Your prompts and code are sent to the model’s provider.",recommended:!0},local:{step:"local",title:"Private and free, on your computer",description:`Models run on ${Ae()}. Nothing you type ever leaves it.`,sub:"Runs Quick helpers and Solid coders. Frontier models stay cloud-only.",tradeOff:"Smaller models: good for edits and quick help."},direct:{step:"direct",title:"Use your own API key",stepTitle:"Your own API key",description:"Anthropic, OpenAI, or any OpenAI-compatible server, like LM Studio.",sub:"",quiet:!0}}}function pt({sources:s,onChoose:t,currentProvider:n}){return e.jsxs("div",{className:"space-y-2","data-testid":"opencode-power-sources",children:[n&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"opencode-current-source",children:["Currently: ",Ms(n)]}),Object.values(s).map(i=>e.jsx(gt,{source:i,onChoose:t},i.step))]})}function gt({source:s,onChoose:t}){return e.jsxs("button",{type:"button",onClick:()=>t(s.step),"data-testid":`power-source-${s.step}`,className:V("card-interactive focus-ring group flex w-full items-start gap-3 rounded-lg border p-3 text-left",s.recommended?"border-primary/40 bg-card shadow-soft":"border-border bg-card shadow-soft",s.quiet&&"shadow-none"),children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.title}),s.recommended&&e.jsx(De,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(ls,{className:"text-muted-foreground/60 mt-0.5 size-4 shrink-0"})]})}function oe({source:s,onBack:t,children:n}){const i=!!(s.sub||s.tradeOff);return e.jsxs("div",{className:"space-y-3","data-testid":"opencode-connect-step",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:t,className:"focus-ring text-muted-foreground hover:text-foreground -ml-1 inline-flex items-center gap-1 rounded-md px-1 py-0.5 text-xs transition-colors","data-testid":"connect-step-back",children:[e.jsx(os,{className:"size-3.5"}),"Back"]}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{className:"text-sm font-medium",children:s.stepTitle??s.title})]}),i&&e.jsxs("div",{className:"space-y-1","data-testid":"connect-step-details",children:[s.sub&&e.jsx("p",{className:"text-muted-foreground/80 text-xs",children:s.sub}),s.tradeOff&&e.jsxs("p",{className:"text-muted-foreground/70 text-2xs leading-snug",children:[e.jsx("span",{className:"font-medium",children:"Trade-off:"})," ",s.tradeOff]})]}),n]})}function yt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=gs(),r=Os(s),l=cs(),o=ds(),c=us([s]);if(s==="doe")return a?e.jsx(Ls,{onConnected:i}):e.jsx(Oe,{});const u=r==="lead"&&l!==null,d=a?t.kind==="provider-picker"?e.jsx(ht,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Rs,{type:s,onConnected:i,asOtherWay:u}):null:e.jsx(Oe,{});if(d===null)return null;const m=me(s).label,h=t.kind==="provider-picker";if(r==="on-credits")return e.jsxs("div",{className:"space-y-3","data-testid":`credits-ready-${s}`,children:[e.jsxs("div",{role:"status",children:[e.jsxs("p",{className:"text-status-success-fg flex items-center gap-1.5 text-sm font-medium",children:[e.jsx(ue,{className:"size-3.5","aria-hidden":!0}),"You’re ready"]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["New work on ",m," runs on your DorkOS credits.",c.map(p=>` ${p}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:d})]});const g=p=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:p,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(ws(m))}});return u?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[g(!0),e.jsx(le,{children:d}),e.jsx(Cs,{ollama:h,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[d,e.jsx(le,{children:g(!1)})]}):d}function le({collapsed:s=!1,children:t}){const[n,i]=x.useState(!s);return s?e.jsxs(we,{open:n,onOpenChange:i,children:[e.jsxs(Re,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ms,{className:V("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Ie,{className:"mt-3",children:t})]}):e.jsxs("section",{className:"space-y-2","aria-label":"Other ways",children:[e.jsx("p",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:"Other ways"}),t]})}const Ot=s=>e.jsx(yt,{...s});export{Ct as C,Ss as D,Cs as K,Oe as R,gs as a,Os as b,Ns as c,Ms as d,Ls as e,bs as g,Ot as r,St as u};
1
+ import{as as Be,a1 as b,a3 as K,r as x,a4 as R,j7 as F,j8 as M,a2 as z,j as e,hx as Ee,e1 as Qe,e2 as Y,O as we,Q as Re,U as Ie,B as C,hu as Ge,G as V,dt as We,dP as Ye,j9 as Ve,ja as He,dy as Le,ar as te,x as de,bx as Je,J as ue,dx as me,d$ as S,e0 as ne,au as Xe,jb as Ze,I as _,jc as es,jd as Ae,je as ss,_ as De,fp as ts,dU as ns,dV as rs,dW as as,dX as is,dY as be,dM as os,C as ls,jf as cs,jg as ds,jh as us,T as ms}from"./index-DBdO-_iL.js";import{I as xs}from"./inline-code-plzdKGm9.js";import{u as hs}from"./useMutationState-C9Q5lRej.js";import{O as fs,a as W}from"./runtime-connect-Dn0T5YWv.js";import{T as ps}from"./terminal-qfxxVZaa.js";function gs(){var s;return((s=Be().data)==null?void 0:s.isLocalCaller)!==!1}function St(s){var u,d;const t=b(),n=K(),[i,a]=x.useState(null),r=R({mutationFn:()=>(a(null),t.provisionRuntime(s,m=>a(m))),onSuccess:m=>{m.ok&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((u=r.data)==null?void 0:u.ok)===!1,o=r.isError?r.error.message:((d=r.data)==null?void 0:d.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Ke(s){return["runtime-key-status",s]}function ys(s,t=!0){const n=b();return z({queryKey:Ke(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function js(s){const t=b(),n=R({mutationFn:a=>t.checkRuntimeCredential(s,a.trim().length>0?a:null),meta:{suppressErrorToast:!0}}),i=n.data??(n.isError?{ok:!1,reason:"unexpected",message:n.error.message||"Couldn’t check the key."}:null);return{check:a=>n.mutate(a),isPending:n.isPending,result:i,checkedSavedKey:i!==null&&(n.variables??"").trim().length===0,reset:n.reset}}function vs(s){var o,c,u;const t=b(),n=K(),[i,a]=x.useState(null),r=R({mutationFn:async d=>{a("checking");const m=await t.checkRuntimeCredential(s,d);return m.ok?(a("saving"),await t.storeRuntimeCredential(s,d),{saved:!0,message:null}):{saved:!1,message:m.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Ke(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:d=>{d.trim().length!==0&&r.mutate(d)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((u=r.data)==null?void 0:u.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function ks(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function Ns(s,t){var T,I,w,P;const n=b(),i=K(),{sessionId:a,accountRoot:r,onCompleted:l}=t??{},o=x.useMemo(()=>["runtime-login",s,a??"",r??""],[s,a,r]),c=R({mutationKey:o,mutationFn:()=>n.delegateRuntimeLogin(s,a===void 0&&r===void 0?void 0:{sessionId:a,accountRoot:r}),onSuccess:N=>{N.ok&&(i.invalidateQueries({queryKey:[...F]}),i.invalidateQueries({queryKey:[...M]}))}}),u=hs({filters:{mutationKey:o,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),d=u.some(N=>N.state.status==="pending"),m=u[u.length-1],h=d||m==null?void 0:m.state,g=d||m==null?void 0:m.id,p=!d&&((h==null?void 0:h.status)==="error"||((T=h==null?void 0:h.data)==null?void 0:T.ok)===!1),y=(h==null?void 0:h.status)==="error"?((I=h.error)==null?void 0:I.message)??null:((w=h==null?void 0:h.data)==null?void 0:w.error)??null,v=((P=h==null?void 0:h.data)==null?void 0:P.ok)===!0,O=x.useRef(l);return O.current=l,x.useEffect(()=>{var L;if(!v||g===void 0)return;const N=ks(i);N.has(g)||(N.add(g),(L=O.current)==null||L.call(O))},[v,g,i]),{login:()=>{d||c.mutate()},isPending:d,isSuccess:v,isError:p,errorMessage:p?y??"Couldn’t sign in. Try again.":null}}const Ce={"claude-code":{signInLabel:"Sign in",otherWayLabel:"Sign in with Claude",signInHint:"Use your Claude subscription or Anthropic account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"Anthropic API key",keyPlaceholder:"sk-ant-…",getKeyUrl:"https://console.anthropic.com/settings/keys"},codex:{signInLabel:"Sign in with ChatGPT",otherWayLabel:"Sign in with ChatGPT",signInHint:"Use your ChatGPT account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"OpenAI API key",keyPlaceholder:"sk-…",getKeyUrl:"https://platform.openai.com/api-keys"}};function bs(s){return Ce[s]??Ce["claude-code"]}function Ss({command:s,infoUrl:t,copyLabel:n}){return!s&&!t?null:e.jsxs("div",{className:"space-y-2",children:[s&&e.jsxs("div",{className:"bg-muted flex items-center justify-between gap-2 rounded-lg px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(ps,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(Ee,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(Qe,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(Y,{className:"size-3"})]})]})}function Ct({command:s,runtimeLabel:t}){const[n,i]=x.useState(!1);return e.jsxs(we,{open:n,onOpenChange:i,className:"mt-2",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["DorkOS installs ",t," for you."," ",e.jsx(Re,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Ie,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(xs,{children:s}),e.jsx(Ee,{value:s,label:`Copy command: ${s}`,className:"shrink-0"})]})]})}function Oe({onRetry:s}){return e.jsxs("div",{"data-testid":"remote-signin-notice",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Signing in needs the computer DorkOS runs on."}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s?"Sign in to DorkOS there, then press Retry.":"Sign in to DorkOS there."}),e.jsx("p",{className:"text-muted-foreground/80 mt-2 text-xs",children:"Already on that computer? Open DorkOS at localhost instead."}),s&&e.jsxs(C,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ge,{className:"size-3"}),"Retry"]})]})}function Cs({ollama:s=!1,remote:t=!1,className:n}){return e.jsxs("p",{className:V("text-muted-foreground text-xs",n),"data-testid":"keep-it-local-note",children:[t?"Prefer everything on the computer DorkOS runs on? Use your own sign-in there":"Prefer to keep everything on this computer? Use your own sign-in",s?", or Ollama":"","."]})}function Os(s){const t=We(),{data:n}=Ye();return s?Ve(He(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",Ps={title:xe,body:`Frontier models are unlocked. ${he}`},Es={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Me(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function ws(s){return{title:`${s} is ready`,body:`New work on ${s} runs on your DorkOS credits. Change it any time in Settings › Runtimes.`}}function A({message:s}){const t=Le();return e.jsxs(te.div,{role:"status",className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:t?!1:{opacity:0},animate:{opacity:1},"data-testid":"connect-progress",children:[e.jsx(de,{size:"xs",className:V("text-muted-foreground shrink-0",t&&"animate-none")}),e.jsx(Je,{mode:"wait",children:e.jsx(te.span,{className:"truncate text-xs",initial:t?!1:{opacity:0},animate:{opacity:1},exit:t?void 0:{opacity:0},transition:{duration:.2},children:s},s)})]})}function U({message:s="Connected"}){return e.jsxs("div",{role:"status",className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"connect-connected",children:[e.jsx(ue,{className:"size-3.5"}),s]})}function B({message:s,onRetry:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:s}),e.jsx(C,{size:"sm",onClick:t,children:"Try again"})]})}function Rs({type:s,onConnected:t,asOtherWay:n=!1}){const i=bs(s),a=Ns(s),[r,l]=x.useState(!1),o=x.useRef(!1);return x.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Me(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(U,{message:"Signed in"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",variant:n?"outline":"default",className:"w-full",onClick:a.login,children:n?i.otherWayLabel:i.signInLabel}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i.signInHint})]})}),r?e.jsxs("div",{className:"space-y-3","data-testid":`login-connect-key-${s}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),e.jsx(Is,{type:s,copy:i,onConnected:t}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Back to sign in"})]}):n?e.jsx(C,{size:"sm",variant:"outline",className:"w-full",onClick:()=>l(!0),"data-testid":`login-connect-use-key-${s}`,children:"Paste a key"}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors","data-testid":`login-connect-use-key-${s}`,children:"Use an API key instead"})]})}function Is({type:s,copy:t,onConnected:n}){var p,y;const[i,a]=x.useState(""),r=vs(s),l=ys(s),o=js(s),c=x.useRef(!1),u=x.useRef(null);if(x.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Me(me(s).label)))},[r.isSuccess,n,s]),x.useEffect(()=>{var v;r.isError&&((v=u.current)==null||v.focus())},[r.isError]),r.isSuccess)return e.jsx(U,{});const d=(p=l.data)!=null&&p.key.saved?l.data.key:null,m=i.trim().length>0,h=r.isPending||o.isPending,g=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:v=>{v.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(S,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:u,value:i,disabled:h,onChange:v=>{a(v.target.value),g()},placeholder:d?`Saved key ends in ${d.last4}. Paste to replace.`:t.keyPlaceholder,autoComplete:"off",spellCheck:!1}),r.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:r.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.getKeyUrl?e.jsxs("a",{href:t.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"ghost",disabled:!m&&d===null||h,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:!m||h,children:"Save key"})]})]}),h?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((y=o.result)==null?void 0:y.ok)===!0?e.jsx(U,{message:o.checkedSavedKey?"Your saved key works":"Key works"}):o.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o.result.message}):null]})}function Ls(s){const t=b(),n=z({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference()});return n.isPending?e.jsx(de,{"aria-label":"Loading model settings"}):n.isError?e.jsx("p",{role:"alert",children:"Couldn’t load model settings. Try again."}):e.jsx(As,{saved:n.data,...s},JSON.stringify(n.data))}function As({saved:s,onConnected:t,onSave:n}){var D,J,G,X,j,$,fe,pe,ge,ye,je,ve;const i=b(),a=K(),r=x.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=x.useState(n&&l==="dorkos-credits"?"api-key":l),[u,d]=x.useState(((J=s.inference)==null?void 0:J.protocol)??"openai-chat-completions"),[m,h]=x.useState(((G=s.inference)==null?void 0:G.endpoint)??""),[g,p]=x.useState(((X=s.inference)==null?void 0:X.provider)??""),[y,v]=x.useState(((j=s.inference)==null?void 0:j.model)??""),[O,T]=x.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[I,w]=x.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[P,N]=x.useState(""),[L,E]=x.useState(null),k=z({queryKey:["doe-credits-models",u],queryFn:()=>i.getDoeCreditsModels(u),enabled:o==="dorkos-credits"}),q=o==="dorkos-credits"?(pe=k.data)==null?void 0:pe.models.find(f=>f.id===y):void 0,ee=s.hasKey&&((ge=s.inference)==null?void 0:ge.endpoint)===m&&s.inference.source==="api-key",H=R({mutationFn:async f=>{if(n)return n(f,P.trim()||null);o==="api-key"&&P.trim()?await i.storeDoeCredential(f,P.trim()):await i.setDoeInference(f),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{N("");for(const f of[["doe-inference"],F,M,Xe.all,Ze.status()])a.invalidateQueries({queryKey:f});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:f=>E(n&&f instanceof Error&&f.message?f.message:"Couldn’t save model settings. Try again.")});function re(f){var ke,Ne;if(f.preventDefault(),E(null),P.trim().startsWith("sk-ant-oat")){E("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!P.trim()&&!ee){E("Enter an API key.");return}if(o==="dorkos-credits"&&(!q||!((ke=k.data)!=null&&ke.endpoint))){E("Link DorkOS credits and choose an available model.");return}const ae=es.safeParse({source:o,protocol:u,provider:o==="dorkos-credits"?"dorkos":g,endpoint:o==="dorkos-credits"?(Ne=k.data)==null?void 0:Ne.endpoint:m,model:y,contextWindow:(q==null?void 0:q.contextWindow)??Number(O),maxOutputTokens:(q==null?void 0:q.maxOutputTokens)??Number(I)});if(!ae.success){E("Check the model, endpoint, and token limits.");return}H.mutate(ae.data)}const Q="bg-background border-input focus-visible:ring-ring h-11 w-full rounded-md md:h-9 border px-3 text-sm focus-visible:ring-2";return e.jsxs("form",{onSubmit:re,className:"space-y-3","aria-label":"DorkOS model settings",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:Q,value:o,onChange:f=>{c(f.target.value),v("")},children:[e.jsx("option",{value:"api-key",children:"My API key"}),e.jsx("option",{value:"local",children:"Local model"}),!n&&e.jsx("option",{value:"dorkos-credits",children:"DorkOS credits"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:Q,value:u,onChange:f=>{d(f.target.value),o==="dorkos-credits"&&v("")},children:[e.jsx("option",{value:"openai-chat-completions",children:"OpenAI Chat Completions"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"})]})]}),o==="dorkos-credits"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:Q,value:y,onChange:f=>v(f.target.value),disabled:k.isPending||!((ye=k.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=k.data)==null?void 0:je.models.map(f=>e.jsx("option",{value:f.id,children:f.displayName},f.id))]}),!((ve=k.data)!=null&&ve.endpoint)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link DorkOS credits in Settings to choose a model."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(_,{id:`${r}-service`,value:g,onChange:f=>p(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(_,{id:`${r}-endpoint`,type:"url",value:m,onChange:f=>h(f.target.value),required:!0}),o==="local"&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Use a loopback address. No API key is needed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(_,{id:`${r}-model`,value:y,onChange:f=>v(f.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(_,{id:`${r}-context`,type:"number",min:1,value:O,onChange:f=>T(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(_,{id:`${r}-output`,type:"number",min:1,value:I,onChange:f=>w(f.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:P,onChange:f=>N(f.target.value),autoComplete:"off"}),ee&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"API key saved. Leave blank to keep it."})]})]}),L&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:L}),e.jsx(C,{type:"submit",disabled:H.isPending,children:H.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ds={openai:"OpenAI",anthropic:"Anthropic"};function Ks(s){return Ds[s]??s}function Ms(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ks(s)})`}}const Te="ollama",qe=["runtime-connect","ollama"];function Ts(s){const t=b();return z({queryKey:qe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function qs(){const s=b(),t=K(),n=R({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:Te}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]})}});return{connect:i=>n.mutate(i),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,errorMessage:n.isError?n.error.message??"Couldn’t connect to Ollama.":null}}const Fe=["runtime-connect","opencode","direct"];function Fs(){const s=b();return z({queryKey:Fe,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function $s(){var i;const s=b(),t=R({mutationFn:({providerId:a,key:r,baseURL:l})=>s.checkProviderCredential(a,r.trim().length>0?r:null,(l==null?void 0:l.trim())||null),meta:{suppressErrorToast:!0}}),n=t.data??(t.isError?{ok:!1,reason:"unexpected",message:t.error.message||"Couldn’t check the key."}:null);return{check:a=>t.mutate(a),isPending:t.isPending,result:n,checkedSavedKey:n!==null&&(((i=t.variables)==null?void 0:i.key)??"").trim().length===0,reset:t.reset}}function _s(){var l,o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:async({providerId:u,key:d,baseURL:m})=>{const h=(m==null?void 0:m.trim())||null;i("checking");const g=await s.checkProviderCredential(u,d.trim().length>0?d:null,h);return g.ok?(i("saving"),await s.storeProviderCredential(u,d,h),{saved:!0,message:null}):{saved:!1,message:g.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:u=>{u.saved&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[...Fe]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:u=>{u.providerId.trim().length!==0&&a.mutate(u)},isPending:a.isPending,phase:n,isSuccess:((o=a.data)==null?void 0:o.saved)===!0,isError:a.isError||r,errorMessage:r?((c=a.data)==null?void 0:c.message)??null:a.isError?a.error.message??"Couldn’t save your key.":null,reset:a.reset}}function Us(s){const t=b();return z({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function zs(){var o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:async u=>{i(null);const d=await s.pullOllamaModel(u,m=>i(m));return d.ok&&await s.updateConfig({runtimes:{opencode:{provider:Te}}}),d},onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{pull:u=>a.mutate(u),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Bs(){var o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:()=>(i(null),s.provisionOllama(u=>i(u))),onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:qe}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{provision:()=>a.mutate(),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t install Ollama.":null,progress:n,result:a.data}}const Qs="https://ollama.com/download",Gs="curl -fsSL https://ollama.com/install.sh | sh";function Ws({installMethod:s}){const t=Bs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Ys,{}),n?e.jsx(Vs,{provision:t}):e.jsx(Hs,{}),e.jsx(Js,{})]})}function Ys(){const s=Ae();return e.jsxs("div",{className:"space-y-1.5","data-testid":"ollama-explainer",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Run AI models on ",s]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Ollama is a free app that runs AI models on ",s,"."]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Nothing you type leaves ",s,"."]})]})}function Vs({provision:s}){var t,n,i;return s.isPending?e.jsx(A,{message:((t=s.progress)==null?void 0:t.message)??"Installing Ollama…"}):(n=s.result)!=null&&n.ok?(i=s.result.status)!=null&&i.running?e.jsx(A,{message:"Ollama is ready…"}):e.jsx("p",{className:"text-xs","data-testid":"ollama-installed-not-running",children:"Ollama isn’t running. Open the Ollama app to start it."}):s.isError?e.jsx(B,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(C,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Hs(){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-manual-install",children:[e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Installing Ollama needs administrator access. Run this in a terminal:"}),e.jsx(Ss,{command:Gs,copyLabel:"Copy the Ollama install command"})]})}function Js(){return e.jsxs("a",{href:Qs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Or download Ollama from ollama.com ",e.jsx(Y,{className:"size-3"})]})}const Xs="https://ollama.com/library",Zs={"runs-well":{label:"Runs well on your machine",tone:"text-status-success-fg"},"may-be-slow":{label:"May be slow on your machine",tone:"text-status-warning-fg"},"too-large":{label:"Too large for your machine",tone:"text-destructive"}},et={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function st({active:s,onConnected:t,onConnectDirectly:n}){var I,w,P,N,L,E;const i=Ts(s),a=qs(),r=zs(),l=((I=i.data)==null?void 0:I.running)??!1,o=Us(l),[c,u]=x.useState(null),[d,m]=x.useState(null);x.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),x.useEffect(()=>{var k;(k=r.result)!=null&&k.ok&&(t==null||t(Pe))},[(w=r.result)==null?void 0:w.ok,t]);const h=k=>{u(k),a.connect(k)},g=k=>{m(k),r.pull(k)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Ws,{installMethod:(P=i.data)==null?void 0:P.installMethod});if(a.isSuccess)return t?null:e.jsx(U,{message:"Connected to Ollama"});if((N=r.result)!=null&&N.ok)return t?null:e.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"guided-pull-connected",children:[e.jsx(ue,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Connected:"}),e.jsx(ss,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const p=i.data,y=(p==null?void 0:p.installed)??[],v=((L=p==null?void 0:p.installed)==null?void 0:L.length)??(p==null?void 0:p.models.length)??0,O=((E=o.data)==null?void 0:E.models.some(k=>k.model.id===d))??!1,T=d!==null&&!O?d:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(tt,{count:v}),y.length>0&&e.jsx(nt,{installed:y,connect:a,connectingId:c,onUse:h}),e.jsx(rt,{catalogQuery:o,pull:r,pullingId:d,onGet:g}),e.jsx(at,{pull:r,activePull:T,onSubmit:g}),e.jsx(it,{}),n&&e.jsxs("button",{type:"button",onClick:n,"data-testid":"local-connect-directly",className:"focus-ring text-muted-foreground hover:text-foreground block rounded-md text-left text-xs transition-colors",children:["Using LM Studio or another server? ",e.jsx("span",{className:"underline",children:"Connect it directly"})]})]})}function tt({count:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-xs","data-testid":"ollama-status-line",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-emerald-500","aria-hidden":!0}),e.jsxs("span",{children:["Ollama is running · ",s," ",s===1?"model":"models"," installed"]})]})}function $e({verdict:s,explanation:t}){const n=Zs[s];return e.jsxs("div",{"data-testid":"ollama-verdict","data-verdict":s,children:[e.jsx("p",{className:V("text-xs font-medium",n.tone),children:n.label}),e.jsx("p",{className:"text-muted-foreground/80 text-2xs leading-snug",children:t})]})}function _e({tier:s}){return e.jsx(De,{size:"xs",variant:"outline",className:"font-normal",children:et[s]})}function nt({installed:s,connect:t,connectingId:n,onUse:i}){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-installed",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Installed"}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>{const r=n===a.id&&t.isPending,l=n===a.id&&t.isError,o=()=>i(a.id);let c=e.jsx(C,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(B,{message:t.errorMessage??"Couldn’t connect to Ollama.",onRetry:o})),e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"ollama-installed-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:a.id}),a.assessment.model.tier&&e.jsx(_e,{tier:a.assessment.model.tier})]}),e.jsx($e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function rt({catalogQuery:s,pull:t,pullingId:n,onGet:i}){var r;if(s.isPending)return e.jsx(A,{message:"Checking which models fit your machine…"});const a=((r=s.data)==null?void 0:r.models)??[];return s.isError||a.length===0?null:e.jsxs("div",{className:"space-y-2","data-testid":"ollama-shelf",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add a model"}),e.jsx("ul",{className:"space-y-1.5",children:a.map(({model:l,verdict:o,explanation:c})=>{const u=n===l.id,d=()=>i(l.id);return u&&(t.isPending||t.isError)?e.jsxs("li",{className:"border-border rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:l.label}),t.isPending?e.jsx(Ue,{progress:t.progress}):e.jsx(B,{message:t.errorMessage??"Couldn’t download the model.",onRetry:d})]},l.id):e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:l.label}),l.tier&&e.jsx(_e,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx($e,{verdict:o,explanation:c})]}),e.jsx(C,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:d,children:"Get"})]},l.id)})})]})}function at({pull:s,activePull:t,onSubmit:n}){const[i,a]=x.useState(""),r=i.trim(),l=fs.test(r);if(t&&s.isPending)return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Downloading ",t,"…"]}),e.jsx(Ue,{progress:s.progress})]});const o=c=>{c.preventDefault(),l&&n(r)};return e.jsxs("form",{onSubmit:o,className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"ollama-pull-tag",className:"text-xs font-normal",children:"Download any model by name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{id:"ollama-pull-tag","data-testid":"ollama-pull-by-name",value:i,onChange:c=>a(c.target.value),placeholder:"qwen2.5-coder:32b","aria-invalid":r.length>0&&!l}),e.jsx(C,{type:"submit",size:"sm",disabled:!l||s.isPending,children:"Download"})]}),r.length>0&&!l&&e.jsxs("p",{className:"text-muted-foreground text-2xs",children:["Use a tag like ",e.jsx("code",{className:"text-2xs",children:"qwen2.5-coder:32b"}),"."]}),t&&s.isError&&e.jsx(B,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function it(){return e.jsxs("a",{href:Xs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Browse the library ",e.jsx(Y,{className:"size-3"})]})}function Ue({progress:s}){const t=Le(),n=s==null?void 0:s.percent,i=(s==null?void 0:s.status)??"Starting download…";return e.jsxs("div",{className:"space-y-2","data-testid":"guided-pull-progress",children:[e.jsx("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:n===void 0?e.jsx(te.div,{className:"bg-primary/70 h-full w-1/3 rounded-full",animate:t?{}:{x:["-100%","300%"]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"}}):e.jsx(te.div,{className:"bg-primary h-full rounded-full",initial:!1,animate:{width:`${Math.min(100,Math.max(0,n))}%`},transition:t?{duration:0}:{duration:.3,ease:"easeOut"},"data-testid":"guided-pull-bar"})}),e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.jsx(de,{size:"xs",className:V("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function ot(){var r,l,o;const s=b(),t=K(),n=R({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))}}),i=n.isError||((r=n.data)==null?void 0:r.ok)===!1,a=n.isError?n.error.message:((l=n.data)==null?void 0:l.error)??null;return{store:c=>{c.trim().length!==0&&n.mutate(c)},isPending:n.isPending,isSuccess:((o=n.data)==null?void 0:o.ok)===!0,isError:i,errorMessage:i?a??"Couldn’t save the OpenRouter key.":null}}function lt(){var h,g;const s=b(),t=K(),[n,i]=x.useState(null),[a,r]=x.useState(null),l=R({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:p,state:y})=>{if(!ts(p)){r("Couldn’t open the OpenRouter sign-in page.");return}i(y)},onError:p=>r(p.message??"Couldn’t start OpenRouter sign-in.")}),o=z({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="pending"?1500:!1},refetchOnWindowFocus:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="error"}}),c=(h=o.data)==null?void 0:h.status;x.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const u=l.isPending||n!==null&&c==="pending",d=!!a||c==="error",m=d?a??((g=o.data)==null?void 0:g.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:u,isSuccess:c==="connected",isError:d,errorMessage:m}}const ct="https://openrouter.ai/keys";function dt({onConnected:s}){const[t,n]=x.useState(""),i=ot(),a=lt(),r=i.isSuccess||a.isSuccess;return x.useEffect(()=>{r&&(s==null||s(Ps))},[r,s]),r?e.jsx(U,{message:"Connected to OpenRouter"}):e.jsxs("div",{className:"space-y-4","data-testid":"openrouter-gateway",children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:"Sign in to OpenRouter in the new tab…"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",className:"w-full",onClick:a.begin,children:"Connect OpenRouter"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Makes a limited key for you."})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),i.isPending?e.jsx(A,{message:"Checking your OpenRouter key…"}):e.jsxs("form",{className:"space-y-2",onSubmit:l=>{l.preventDefault(),i.store(t)},children:[e.jsx(S,{htmlFor:"openrouter-key",className:"text-xs",children:"OpenRouter key"}),e.jsx(ne,{id:"openrouter-key",value:t,onChange:l=>n(l.target.value),placeholder:"sk-or-…",autoComplete:"off",spellCheck:!1}),i.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:i.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("a",{href:ct,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an OpenRouter key ",e.jsx(Y,{className:"size-3"})]}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function Z(s){return W.find(t=>t.id===s)}function ut(s){var t;return((t=Z(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=W.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??W[0].defaultBaseURL}function ze(s){return W.some(t=>t.id===s.providerId)}function ie(s){return ze(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function mt({onConnected:s}){const t=Fs();return t.isError&&!t.data?e.jsx(B,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(xt,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function xt({setup:s,onConnected:t}){var X;const n=ze(s)?s:null,[i,a]=x.useState(()=>ie(s)),[r,l]=x.useState(""),[o,c]=x.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=Z(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[u,d]=x.useState(()=>{var $;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=Z(j))==null?void 0:$.defaultBaseURL)}),m=_s(),h=$s(),g=Z(i),p=ut(i),y=n!=null&&n.key.saved&&n.providerId===p?n.key.last4:null,v=o.trim(),O=i===se,T=!O||v.length>0,I=ce(p),w=v||I,P=w===I?"":w,N=n===null?null:n.baseURL??ce(n.providerId),L=p!==((n==null?void 0:n.providerId)??null)||w!==N,E=r.trim().length>0,q=(E||y!==null&&!L)&&T,ee=E&&T,H=!E&&y!==null&&L,re=w.startsWith("http://"),Q={providerId:p,key:r,baseURL:P},D=m.isPending||h.isPending,J=x.useRef(null),G=()=>{h.reset(),m.reset()};return x.useEffect(()=>{m.isSuccess&&(t==null||t(Es))},[m.isSuccess,t]),x.useEffect(()=>{var j;m.isError&&((j=J.current)==null||j.focus())},[m.isError]),m.isSuccess?e.jsx(U,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),h.reset(),m.connect(Q)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(ns,{value:i,disabled:D,onValueChange:j=>{var $;a(j),c((($=Z(j))==null?void 0:$.defaultBaseURL)??""),G()},children:[e.jsx(rs,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(as,{})}),e.jsxs(is,{children:[W.map(j=>e.jsx(be,{value:j.id,children:j.label},j.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(O||u)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(S,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!O&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(_,{id:"direct-provider-base-url",value:o,disabled:D,onChange:j=>{c(j.target.value),G()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!O&&!u&&e.jsx("button",{type:"button",onClick:()=>d(!0),disabled:D,"data-testid":"direct-provider-advanced",className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Advanced"}),re&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-insecure",children:"This address isn’t encrypted. Your key travels in the open."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:J,value:r,disabled:D,onChange:j=>{l(j.target.value),G()},placeholder:y===null?(g==null?void 0:g.keyPlaceholder)??W[0].keyPlaceholder:`Saved key ends in ${y}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),m.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:m.errorMessage}),H&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-repaste",children:"Paste your key again to change the address."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g===void 0?e.jsx("span",{}):e.jsxs("a",{href:g.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"outline",disabled:!q||D,"data-testid":"direct-provider-test",onClick:()=>{m.reset(),h.reset(),h.check(Q)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",disabled:!ee||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:m.phase==="saving"?"Saving…":"Checking your key…"}):((X=h.result)==null?void 0:X.ok)===!0?e.jsx(U,{message:h.checkedSavedKey?"Your saved key works":"Key works"}):h.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:h.result.message}):null]})}function ht({currentProvider:s,onConnected:t}){const[n,i]=x.useState("choose"),a=ft();if(n==="choose")return e.jsx(pt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(dt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(st,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(mt,{onConnected:t})})}function ft(){return{cloud:{step:"cloud",title:"Best models, zero setup",description:"Claude, GPT, Gemini and 300+ more, in the cloud.",sub:"One OpenRouter account covers them all. Pay for what you use.",tradeOff:"Your prompts and code are sent to the model’s provider.",recommended:!0},local:{step:"local",title:"Private and free, on your computer",description:`Models run on ${Ae()}. Nothing you type ever leaves it.`,sub:"Runs Quick helpers and Solid coders. Frontier models stay cloud-only.",tradeOff:"Smaller models: good for edits and quick help."},direct:{step:"direct",title:"Use your own API key",stepTitle:"Your own API key",description:"Anthropic, OpenAI, or any OpenAI-compatible server, like LM Studio.",sub:"",quiet:!0}}}function pt({sources:s,onChoose:t,currentProvider:n}){return e.jsxs("div",{className:"space-y-2","data-testid":"opencode-power-sources",children:[n&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"opencode-current-source",children:["Currently: ",Ms(n)]}),Object.values(s).map(i=>e.jsx(gt,{source:i,onChoose:t},i.step))]})}function gt({source:s,onChoose:t}){return e.jsxs("button",{type:"button",onClick:()=>t(s.step),"data-testid":`power-source-${s.step}`,className:V("card-interactive focus-ring group flex w-full items-start gap-3 rounded-lg border p-3 text-left",s.recommended?"border-primary/40 bg-card shadow-soft":"border-border bg-card shadow-soft",s.quiet&&"shadow-none"),children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.title}),s.recommended&&e.jsx(De,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(ls,{className:"text-muted-foreground/60 mt-0.5 size-4 shrink-0"})]})}function oe({source:s,onBack:t,children:n}){const i=!!(s.sub||s.tradeOff);return e.jsxs("div",{className:"space-y-3","data-testid":"opencode-connect-step",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:t,className:"focus-ring text-muted-foreground hover:text-foreground -ml-1 inline-flex items-center gap-1 rounded-md px-1 py-0.5 text-xs transition-colors","data-testid":"connect-step-back",children:[e.jsx(os,{className:"size-3.5"}),"Back"]}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{className:"text-sm font-medium",children:s.stepTitle??s.title})]}),i&&e.jsxs("div",{className:"space-y-1","data-testid":"connect-step-details",children:[s.sub&&e.jsx("p",{className:"text-muted-foreground/80 text-xs",children:s.sub}),s.tradeOff&&e.jsxs("p",{className:"text-muted-foreground/70 text-2xs leading-snug",children:[e.jsx("span",{className:"font-medium",children:"Trade-off:"})," ",s.tradeOff]})]}),n]})}function yt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=gs(),r=Os(s),l=cs(),o=ds(),c=us([s]);if(s==="doe")return a?e.jsx(Ls,{onConnected:i}):e.jsx(Oe,{});const u=r==="lead"&&l!==null,d=a?t.kind==="provider-picker"?e.jsx(ht,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Rs,{type:s,onConnected:i,asOtherWay:u}):null:e.jsx(Oe,{});if(d===null)return null;const m=me(s).label,h=t.kind==="provider-picker";if(r==="on-credits")return e.jsxs("div",{className:"space-y-3","data-testid":`credits-ready-${s}`,children:[e.jsxs("div",{role:"status",children:[e.jsxs("p",{className:"text-status-success-fg flex items-center gap-1.5 text-sm font-medium",children:[e.jsx(ue,{className:"size-3.5","aria-hidden":!0}),"You’re ready"]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["New work on ",m," runs on your DorkOS credits.",c.map(p=>` ${p}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:d})]});const g=p=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:p,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(ws(m))}});return u?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[g(!0),e.jsx(le,{children:d}),e.jsx(Cs,{ollama:h,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[d,e.jsx(le,{children:g(!1)})]}):d}function le({collapsed:s=!1,children:t}){const[n,i]=x.useState(!s);return s?e.jsxs(we,{open:n,onOpenChange:i,children:[e.jsxs(Re,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ms,{className:V("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Ie,{className:"mt-3",children:t})]}):e.jsxs("section",{className:"space-y-2","aria-label":"Other ways",children:[e.jsx("p",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:"Other ways"}),t]})}const Ot=s=>e.jsx(yt,{...s});export{Ct as C,Ss as D,Cs as K,Oe as R,gs as a,Os as b,Ns as c,Ms as d,Ls as e,bs as g,Ot as r,St as u};