dorkos 0.126.2 → 0.126.3

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 +133 -38
  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-BQ66xWcJ.js → AboutPage-ycWTfXI8.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-CPbfgXjw.js → ActivityErrorState-DBecAo4-.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-CesljfZn.js → ActivityPage-CGuIeDGm.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-DzhwE0ht.js → ActivityRow-BRiUvjHA.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-BXJkyF5g.js → AdapterIcon-z6z9LKwd.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-CwKYl1vG.js → AdapterSetupWizard-Cp56Zx24.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-0VdNzXCF.js → AgentOptionRow-BLuSwpNh.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-Ldh64iOA.js → AgentPicker-DazquIgR.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-CmAlDGTr.js → AgentRequestCard-BoRmxLKy.js} +1 -1
  13. package/dist/client/assets/{AppearancePage-DmsZPHst.js → AppearancePage-BMiVpe48.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-Ct1W283T.js → ApplyToOverridesDialog-BHIrnfPf.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-B7gezgzA.js → AttentionSignalRow-CjN8lCWI.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Nqvr65_g.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BMBnO0fv.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-CpBZoSZU.js → BindingDialog-Bw55sMTh.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-BCtfZPrs.js → BlintzCanvas-Dd3bC9vw.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-DYksqzaf.js → CanvasCsvContent-B2S75f6B.js} +1 -1
  20. package/dist/client/assets/{CanvasFileContent-CqEqSxuJ.js → CanvasFileContent-CVSfg4MO.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-vR6ze4IR.js → CanvasModel3dContent-CNmJsBTS.js} +2 -2
  22. package/dist/client/assets/{ChannelComposer-BVACOdph.js → ChannelComposer-7KpffyFv.js} +3 -3
  23. package/dist/client/assets/{ChatAppsOff-VsPP2Hye.js → ChatAppsOff-D7anOG3n.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorDiff-CmKjH03N.js → CodeMirrorDiff-CfOmRCky.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-BtNgazuc.js → CodeMirrorEditor-Cyz227_1.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-D9I-CmNy.js → CommitmentList-DKo1Fb1A.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-BORMYDZb.js → CommitmentsPage-DIcEZ2ka.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-BZ9BxgOi.js → ComputerResourceView-Ck7rJ-SP.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-CbuU9tXK.js → ComputerViewer-Dw_VpNjD.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-uE-Fzp6Y.js → ConnectionAccessLists-CETLVH7o.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-D7QTHeQQ.js → ConnectionsPage-ZVWDffcl.js} +1 -1
  32. package/dist/client/assets/{ConventionPage-PS2WWCyB.js → ConventionPage-DkJ91wrN.js} +1 -1
  33. package/dist/client/assets/{ExtensionPageRoute-Cn7bYxGB.js → ExtensionPageRoute-FbJo1Qc0.js} +1 -1
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DKGNSXVz.js → FloatingTanStackRouterDevtools-CqogiFob-DCLR3iKw.js} +1 -1
  35. package/dist/client/assets/{ForwardConsentHost-CLIHtWwq.js → ForwardConsentHost-Buy5XlH7.js} +1 -1
  36. package/dist/client/assets/HandlePage-CByGC3B8.js +1 -0
  37. package/dist/client/assets/{HeartbeatPage-7MTowke-.js → HeartbeatPage-GXBEcZoJ.js} +1 -1
  38. package/dist/client/assets/{KeyEntry-Cf7D0Oo6.js → KeyEntry-g2VQ33KW.js} +1 -1
  39. package/dist/client/assets/{LexicalField-DqvzeMr3.js → LexicalField-CLd77PuB.js} +1 -1
  40. package/dist/client/assets/{ManagesPage-DxR4zWMf.js → ManagesPage-qCwzJ4Cx.js} +1 -1
  41. package/dist/client/assets/{Marketplace-V_92jKOn.js → Marketplace-DdkdIVPQ.js} +1 -1
  42. package/dist/client/assets/{MarketplaceSourcesView-CjCVMP_d.js → MarketplaceSourcesView-D44G21ff.js} +1 -1
  43. package/dist/client/assets/{McpAppFrame-4JDJsrmg.js → McpAppFrame-DVNWJHrn.js} +1 -1
  44. package/dist/client/assets/{McpSigninBody-DG1XX7XT.js → McpSigninBody-BO0OkvOw.js} +1 -1
  45. package/dist/client/assets/{Model3dViewer-DedBFHsl.js → Model3dViewer-Cvcyx2yv.js} +1 -1
  46. package/dist/client/assets/NamePage-5VUtswMH.js +1 -0
  47. package/dist/client/assets/{NewDirectMessageMenu-C8t7x-sB.js → NewDirectMessageMenu-C_hXtliM.js} +1 -1
  48. package/dist/client/assets/{NotificationsPage-DwGFE3F6.js → NotificationsPage-DP4HAVMA.js} +1 -1
  49. package/dist/client/assets/{OpenMeshSwitch-DPmTA9eg.js → OpenMeshSwitch-0Mkl8abo.js} +1 -1
  50. package/dist/client/assets/{OperatorIdentityForm-Cu0h8Xqy.js → OperatorIdentityForm-BRftJqRq.js} +1 -1
  51. package/dist/client/assets/{PermissionHistory-zD6ksrl2.js → PermissionHistory-Czl5PWN3.js} +1 -1
  52. package/dist/client/assets/{PermissionsPage-Durcnmie.js → PermissionsPage-DAsbrl6Q.js} +1 -1
  53. package/dist/client/assets/{PersonalityPopover-DuRjJuLj.js → PersonalityPopover-liTJ0Lns.js} +1 -1
  54. package/dist/client/assets/PhotoPage-DDcbiGjb.js +1 -0
  55. package/dist/client/assets/{PreviewRefusedNotice-hlYrFDQM.js → PreviewRefusedNotice-DcD1EY2c.js} +1 -1
  56. package/dist/client/assets/{ProfileFields-x-x8vgNo.js → ProfileFields-Bi_AfHOE.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-8WxopRj2.js → ProfilePanelContainer-BIbOulLu.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-BfciiNpr.js → ProfileRolePicker-BadkFi4V.js} +1 -1
  59. package/dist/client/assets/{PromptSuggestionChips-D34Zeaq_.js → PromptSuggestionChips-C653MlaU.js} +1 -1
  60. package/dist/client/assets/{ReportsToPopover-BhqA5qXi.js → ReportsToPopover-dIbt6aes.js} +1 -1
  61. package/dist/client/assets/{RoomSurface-BlMNuQsT.js → RoomSurface-CssMcozl.js} +1 -1
  62. package/dist/client/assets/{RoomsPage-C52AOHIE.js → RoomsPage-CxwTRRNu.js} +1 -1
  63. package/dist/client/assets/{RunsOnPopover-DLhEKwXF.js → RunsOnPopover-lp8n4lgI.js} +1 -1
  64. package/dist/client/assets/{RuntimeConnectFlow-D3H5Fpkc.js → RuntimeConnectFlow-BAqkzthF.js} +1 -1
  65. package/dist/client/assets/{RuntimeSetupDialog-DPU4QIY9.js → RuntimeSetupDialog-E6f7Rd2W.js} +1 -1
  66. package/dist/client/assets/{SeenDevices-CDSHTsL7.js → SeenDevices-xdR3YQNr.js} +1 -1
  67. package/dist/client/assets/{SessionsPage-Crh3D3Jj.js → SessionsPage-BNZTufty.js} +1 -1
  68. package/dist/client/assets/{SettingsDialog-D0Oh-ku1.js → SettingsDialog-d7SQTDNy.js} +1 -1
  69. package/dist/client/assets/{SkillsPage-BPexZwnJ.js → SkillsPage-DiqUOZup.js} +1 -1
  70. package/dist/client/assets/{TaskDialogWrapper-D6RB8E59.js → TaskDialogWrapper-5gb-f-Uo.js} +1 -1
  71. package/dist/client/assets/{TasksEmptyState-Di3SbhJM.js → TasksEmptyState-g-CavcMv.js} +1 -1
  72. package/dist/client/assets/{TasksPage-CDLsY1Ww.js → TasksPage-BexV_pxB.js} +1 -1
  73. package/dist/client/assets/{TeamComputerEntry-B_q-oVSs.js → TeamComputerEntry-BFYqGL-G.js} +1 -1
  74. package/dist/client/assets/{ToolsPage-gvIVTnwf.js → ToolsPage-Dxt6qOdF.js} +1 -1
  75. package/dist/client/assets/{TopologyGraph-Bp8aL_qw.js → TopologyGraph-Cx_6gdbV.js} +1 -1
  76. package/dist/client/assets/{TourHost-Cg8EHvod.js → TourHost-DvAjpsug.js} +1 -1
  77. package/dist/client/assets/{UnlinkDialog-Ddd1Yxfk.js → UnlinkDialog-fgubvOUd.js} +1 -1
  78. package/dist/client/assets/{UnreadDivider-LL4_YtF0.js → UnreadDivider-BoLcTO_Z.js} +1 -1
  79. package/dist/client/assets/{WidgetErrorCard-BA3P7hNv.js → WidgetErrorCard-CgRMeAEO.js} +1 -1
  80. package/dist/client/assets/{WithheldExtensionsNotice-quqWNbus.js → WithheldExtensionsNotice-CFHBDyIh.js} +1 -1
  81. package/dist/client/assets/{WorkView-C_h8sclU.js → WorkView-5jzcnod5.js} +1 -1
  82. package/dist/client/assets/{_shell-D9q8zLfr.js → _shell-DFfXd1ys.js} +1 -1
  83. package/dist/client/assets/{_shell._home-CrTxBB3h.js → _shell._home-D2GJeGbi.js} +1 -1
  84. package/dist/client/assets/{_shell._home.activity-2M0BJkbQ.js → _shell._home.activity-DRXBBtAq.js} +1 -1
  85. package/dist/client/assets/{_shell._home.index-BTJhhEWN.js → _shell._home.index-CA_GnaUK.js} +1 -1
  86. package/dist/client/assets/{_shell._home.tasks-Dfrqv2nl.js → _shell._home.tasks-Cr4gak8T.js} +1 -1
  87. package/dist/client/assets/{_shell._home.workspaces-DPLQXDdH.js → _shell._home.workspaces-DbWciI1g.js} +1 -1
  88. package/dist/client/assets/{_shell.channels-CJqfUTZ1.js → _shell.channels-C31Txlqh.js} +1 -1
  89. package/dist/client/assets/{_shell.connections-Cpe1hru3.js → _shell.connections-gfevZyC-.js} +1 -1
  90. package/dist/client/assets/{_shell.feedback-requests-BeWCqScf.js → _shell.feedback-requests-CQc7aVrV.js} +1 -1
  91. package/dist/client/assets/_shell.marketplace-BepG1fJe.js +1 -0
  92. package/dist/client/assets/_shell.marketplace_.sources-BBQESbqU.js +1 -0
  93. package/dist/client/assets/_shell.session-DzeI9YIK.js +1 -0
  94. package/dist/client/assets/{_shell.team-EPvcS7RS.js → _shell.team-BlLU5BMC.js} +3 -3
  95. package/dist/client/assets/{_shell.threads-NJDzq9dv.js → _shell.threads-YmF9dQnZ.js} +1 -1
  96. package/dist/client/assets/_shell.x._extensionId-ByRocZjS.js +1 -0
  97. package/dist/client/assets/_shell.x._extensionId_._-ByRocZjS.js +1 -0
  98. package/dist/client/assets/{abnfDiagram-WEYOIA3C-DUHshdrR.js → abnfDiagram-WEYOIA3C-DLiXaMmC.js} +1 -1
  99. package/dist/client/assets/{access-copy-DHfPjN3G.js → access-copy-xWnaUps1.js} +1 -1
  100. package/dist/client/assets/{arc-sP6zNsGB.js → arc-AndXXvZc.js} +1 -1
  101. package/dist/client/assets/{architectureDiagram-ZHVYKT53-C8PTjsPx.js → architectureDiagram-ZHVYKT53-CM4tGveM.js} +1 -1
  102. package/dist/client/assets/{banner-CVrzHqOT.js → banner-BH1gXPTc.js} +1 -1
  103. package/dist/client/assets/{blockDiagram-RJAE7QA3-Cydde2fz.js → blockDiagram-RJAE7QA3-DenkdFXV.js} +1 -1
  104. package/dist/client/assets/{c4Diagram-XDPPPE54-DbM6KAK7.js → c4Diagram-XDPPPE54-DMAlFuoX.js} +1 -1
  105. package/dist/client/assets/{card-DA_Z-FYX.js → card-TbpEl6EH.js} +1 -1
  106. package/dist/client/assets/channel-5-dQamNX.js +1 -0
  107. package/dist/client/assets/{chunk-2E7WHVMD-CEbspaNh.js → chunk-2E7WHVMD-u0q5vCEc.js} +1 -1
  108. package/dist/client/assets/{chunk-2Q5K7J3B-DDP1SiE0.js → chunk-2Q5K7J3B-DBTggfjR.js} +1 -1
  109. package/dist/client/assets/{chunk-4EMNKR2T-BFjozJqd.js → chunk-4EMNKR2T-zu55wq-c.js} +1 -1
  110. package/dist/client/assets/{chunk-55XCU76K-0JSp6acZ.js → chunk-55XCU76K-XLIA3Qss.js} +1 -1
  111. package/dist/client/assets/{chunk-5VM5RSS4-DswTXnmp.js → chunk-5VM5RSS4-DmGjbtZg.js} +1 -1
  112. package/dist/client/assets/{chunk-JWPE2WC7-D0PYncYV.js → chunk-JWPE2WC7-ikMrk6md.js} +1 -1
  113. package/dist/client/assets/{chunk-VQ5W62QI-r5T-ZVBs.js → chunk-VQ5W62QI-cfwin8SC.js} +1 -1
  114. package/dist/client/assets/{chunk-XXDRQBXY-D8kkjktE.js → chunk-XXDRQBXY-Cn3e0QEQ.js} +1 -1
  115. package/dist/client/assets/{chunk-ZCHMQSOR-D6XtRzln.js → chunk-ZCHMQSOR-7RkBP94K.js} +2 -2
  116. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-DUPDMGfm.js → classDiagram-v2-4MYWR3UA-CqVol7t8.js} +1 -1
  117. package/dist/client/assets/{command-BvXBgZfv.js → command-2pl_Cn7b.js} +1 -1
  118. package/dist/client/assets/{cose-bilkent-JH36ORCC-tiQpE-Q8.js → cose-bilkent-JH36ORCC-m0tmlDnx.js} +1 -1
  119. package/dist/client/assets/{cpu-mx7zDf7k.js → cpu-CdCfSlSR.js} +1 -1
  120. package/dist/client/assets/{cynefin-EF2NZ3EQ-BjAUxFfb.js → cynefin-EF2NZ3EQ-Cf7ajLou.js} +1 -1
  121. package/dist/client/assets/{cynefinDiagram-WF24UDRP-PmlyltXR.js → cynefinDiagram-WF24UDRP-Dl8GJr0l.js} +1 -1
  122. package/dist/client/assets/{dagre-NK4GIZVX-DDePjPkn.js → dagre-NK4GIZVX-2yAF6nW_.js} +1 -1
  123. package/dist/client/assets/{diagram-CBK3MWTC-D7N3T4Fx.js → diagram-CBK3MWTC-DaBb9JFm.js} +1 -1
  124. package/dist/client/assets/{diagram-I5XIIV2D-BfZHSbR2.js → diagram-I5XIIV2D-BMeCfhD1.js} +1 -1
  125. package/dist/client/assets/{diagram-ODIL2UCW-sXAa9bzN.js → diagram-ODIL2UCW-ClVKCieB.js} +1 -1
  126. package/dist/client/assets/{diagram-PFBEJUXE-Dfd_61WO.js → diagram-PFBEJUXE-DFIKk-tB.js} +1 -1
  127. package/dist/client/assets/{diagram-RJA3I4VV-BCzdEfnM.js → diagram-RJA3I4VV-DzC_xtYu.js} +1 -1
  128. package/dist/client/assets/{diagram-TYUNFSNR-BMqtz6sZ.js → diagram-TYUNFSNR-BroMVHm2.js} +1 -1
  129. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-CyWj1615.js → ebnfDiagram-V4P3TTPT-GMsyIh86.js} +1 -1
  130. package/dist/client/assets/{elk-QONTBCTQ-BkQMBXse.js → elk-QONTBCTQ-DIpw6SW5.js} +1 -1
  131. package/dist/client/assets/{empty-state-Dv5iV4jb.js → empty-state-B7ufhAFk.js} +1 -1
  132. package/dist/client/assets/{erDiagram-KYQIGQAA-DiPsX7uU.js → erDiagram-KYQIGQAA-CsezeWpx.js} +1 -1
  133. package/dist/client/assets/{execution-config-Bej0Ot8e.js → execution-config-DRqIsff0.js} +1 -1
  134. package/dist/client/assets/{file-DXbyb23e.js → file-DHPgnMgj.js} +1 -1
  135. package/dist/client/assets/{file-exclamation-point-C8XqHyzY.js → file-exclamation-point-DtjBa2XX.js} +1 -1
  136. package/dist/client/assets/{file-text-CRTgqqkn.js → file-text-wmrSy3Io.js} +1 -1
  137. package/dist/client/assets/{find-latest-widget-fence-D1i7qNny.js → find-latest-widget-fence-Bv9D10ve.js} +1 -1
  138. package/dist/client/assets/{flowDiagram-IUGLLWBU-BSM44aJP.js → flowDiagram-IUGLLWBU-BGwNqglr.js} +1 -1
  139. package/dist/client/assets/{form-DYSiVEri.js → form-CA_eiUg-.js} +1 -1
  140. package/dist/client/assets/{format-cron-DYYwmo-o.js → format-cron-YPhIy57w.js} +1 -1
  141. package/dist/client/assets/{ganttDiagram-R7GPNTJY-BWCjYexX.js → ganttDiagram-R7GPNTJY-4IlzTCzA.js} +1 -1
  142. package/dist/client/assets/{git-branch-1zYKSuur.js → git-branch-BLIYLcM4.js} +1 -1
  143. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-ULC7Zunc.js → gitGraphDiagram-PDYL7XHY-HeaC8vlP.js} +1 -1
  144. package/dist/client/assets/{graph-BsZzo5TN.js → graph-Ch9lnHSS.js} +1 -1
  145. package/dist/client/assets/{heart-C4CSHUW7.js → heart-D4fTvM5q.js} +1 -1
  146. package/dist/client/assets/{highlighted-body-KPVGNVTW-CFECg7iB.js → highlighted-body-KPVGNVTW-KPma22SA.js} +1 -1
  147. package/dist/client/assets/{image-lightbox-M9t3Wulc.js → image-lightbox-DI18fB2Q.js} +1 -1
  148. package/dist/client/assets/{image-off-c01kxBAm.js → image-off-DRgXXpgv.js} +1 -1
  149. package/dist/client/assets/{index-BScgHCO_.js → index--2mMmier.js} +1 -1
  150. package/dist/client/assets/{index-DG13Cp5o.js → index-2J89pJxF.js} +1 -1
  151. package/dist/client/assets/{index-C1XazYWZ.js → index-3UGWygRZ.js} +1 -1
  152. package/dist/client/assets/{index-Dt7RONID.js → index-B-4XmK5Q.js} +1 -1
  153. package/dist/client/assets/index-B9X2-pzp.js +1 -0
  154. package/dist/client/assets/{index-Du4HX97h.js → index-BAd8jUzo.js} +2 -2
  155. package/dist/client/assets/{index-UJq1qaku.js → index-BMYGo6Ki.js} +1 -1
  156. package/dist/client/assets/{index-B3xeyV6n.js → index-BY0SKYuc.js} +1 -1
  157. package/dist/client/assets/{index-DIDUjTkq.js → index-B_56Srtt.js} +1 -1
  158. package/dist/client/assets/{index-uLbyd6YP.js → index-BmlBYrxT.js} +1 -1
  159. package/dist/client/assets/{index-Br35Gqfz.js → index-BtRM2yox.js} +1 -1
  160. package/dist/client/assets/{index-DyN65ufd.js → index-ButY6gKr.js} +1 -1
  161. package/dist/client/assets/{index-BYY8HEOz.js → index-C-X6jaVm.js} +1 -1
  162. package/dist/client/assets/{index-XEE1k4cl.js → index-C3IsCAxA.js} +1 -1
  163. package/dist/client/assets/{index-BTGRc0hC.js → index-COoO8dzi.js} +1 -1
  164. package/dist/client/assets/{index-BIVIHPoe.js → index-CRCfkwyN.js} +1 -1
  165. package/dist/client/assets/{index-BRH6C3LJ.js → index-CTTaeOCw.js} +1 -1
  166. package/dist/client/assets/index-CgpRBcA4.js +1 -0
  167. package/dist/client/assets/{index-DrENuQdJ.js → index-ClbMjgcZ.js} +1 -1
  168. package/dist/client/assets/{index-CnltS8ym.js → index-CucieFDK.js} +1 -1
  169. package/dist/client/assets/{index-DQTTC52E.js → index-D0cIffaH.js} +1 -1
  170. package/dist/client/assets/{index-B-7P1Q9s.js → index-D9w0FBQG.js} +1 -1
  171. package/dist/client/assets/{index-BqwCOIbF.js → index-DHZS9Lod.js} +1 -1
  172. package/dist/client/assets/{index-DsasLE1l.js → index-DSIdPh8G.js} +1 -1
  173. package/dist/client/assets/{index-CAAsqmfP.js → index-DTRAR0KK.js} +1 -1
  174. package/dist/client/assets/{index-LpaxG4VS.js → index-DbV3-jog.js} +1 -1
  175. package/dist/client/assets/{index-JG_0k1NX.js → index-Dbujw1c2.js} +1 -1
  176. package/dist/client/assets/{index-C3swXqWW.js → index-DpvGUFpV.js} +1 -1
  177. package/dist/client/assets/{index-CAjKQnAd.js → index-DuvW22xi.js} +1 -1
  178. package/dist/client/assets/{index-D847rJXW.js → index-Dy9bWvna.js} +1 -1
  179. package/dist/client/assets/{index-B_he44rF.js → index-EDXuyCOT.js} +1 -1
  180. package/dist/client/assets/{index-FwAvbbet.js → index-Ix2nCAz0.js} +1 -1
  181. package/dist/client/assets/{index-BSxkprTm.js → index-JoxvTUfo.js} +3 -3
  182. package/dist/client/assets/{index-YXyEu3Ia.js → index-QSo53dH-.js} +1 -1
  183. package/dist/client/assets/{index-DhkfALZp.js → index-bzM-k5lI.js} +1 -1
  184. package/dist/client/assets/{index-Ce3HZQem.js → index-jk2K24il.js} +1 -1
  185. package/dist/client/assets/{index-DzHj8lCz.js → index-mRMaqxu5.js} +9 -9
  186. package/dist/client/assets/{index-B6Scr7KJ.js → index-p3WivF1M.js} +226 -226
  187. package/dist/client/assets/{index-DrQqkQq_.js → index-qEI7Rsr1.js} +1 -1
  188. package/dist/client/assets/{index-DhoaVQXu.js → index-rPJ8b_DO.js} +1 -1
  189. package/dist/client/assets/{index-jLIoULQt.js → index-uG06zgQo.js} +1 -1
  190. package/dist/client/assets/{index-DhYnXLRT.js → index-uy36h8lC.js} +1 -1
  191. package/dist/client/assets/{index-BnXWm8Db.js → index-zvAbU6ah.js} +1 -1
  192. package/dist/client/assets/{index.esm-CZ68Qd2t.js → index.esm-CxXuMuQv.js} +1 -1
  193. package/dist/client/assets/{infoDiagram-MVDRKAX5-BCjhXqIT.js → infoDiagram-MVDRKAX5-g9EeD2xH.js} +1 -1
  194. package/dist/client/assets/{inline-code-BKPMIXZR.js → inline-code-14c1Gacs.js} +1 -1
  195. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-C9rsv2nh.js → ishikawaDiagram-HPEHV2GE-Zv5DrRnv.js} +1 -1
  196. package/dist/client/assets/{journeyDiagram-BOSHW7O7-BRYr1XL1.js → journeyDiagram-BOSHW7O7-COiWWTez.js} +1 -1
  197. package/dist/client/assets/{kanban-definition-FNSA4HC5-2ey8FXEn.js → kanban-definition-FNSA4HC5-DnQa8qXB.js} +1 -1
  198. package/dist/client/assets/{layers-DE3wjQuk.js → layers-D_NEJsnH.js} +1 -1
  199. package/dist/client/assets/{lightbulb-BXJIRUdm.js → lightbulb-EadQi_Lr.js} +1 -1
  200. package/dist/client/assets/{link-2-DzWm9OxA.js → link-2-DugR2HHU.js} +1 -1
  201. package/dist/client/assets/{list-runtime-types-BhkZkTrB.js → list-runtime-types-iJaKcim4.js} +1 -1
  202. package/dist/client/assets/{markdown-content-Bk9lCksw.js → markdown-content-BFHUHPgi.js} +1 -1
  203. package/dist/client/assets/{mention-pill-os_7QQu2.js → mention-pill-DXBno6EY.js} +1 -1
  204. package/dist/client/assets/{mermaid.core-BcRUBvZd.js → mermaid.core-C6ckWvkG.js} +4 -4
  205. package/dist/client/assets/{message-square-off-DuOiETNI.js → message-square-off-BH8wbm2a.js} +1 -1
  206. package/dist/client/assets/{mindmap-definition-6OY57UG3-DBhXkS2i.js → mindmap-definition-6OY57UG3-DV4PNLc-.js} +1 -1
  207. package/dist/client/assets/{more-details-Bt9nlPmS.js → more-details-DhdX4DGU.js} +1 -1
  208. package/dist/client/assets/{owner-notice-4ZSBxa2K.js → owner-notice-FMj3k7-f.js} +1 -1
  209. package/dist/client/assets/{package-BmOMrNwc.js → package-0mI7-RiJ.js} +1 -1
  210. package/dist/client/assets/{page-container-LomhzyuS.js → page-container-DRyYoDkA.js} +1 -1
  211. package/dist/client/assets/{pane-resize-handle-BOtzx5Q4.js → pane-resize-handle-OBc3uYxQ.js} +1 -1
  212. package/dist/client/assets/{paperclip-C1tkiT74.js → paperclip-BsTJpkyE.js} +1 -1
  213. package/dist/client/assets/{path-input-JHTlL97W.js → path-input-CFm1b1pk.js} +1 -1
  214. package/dist/client/assets/{pegDiagram-ECIUJNBX-B01fb3t0.js → pegDiagram-ECIUJNBX-Cboo0f6B.js} +1 -1
  215. package/dist/client/assets/{pieDiagram-GNMPY74T-BJ7JYrTk.js → pieDiagram-GNMPY74T-CiihSor1.js} +1 -1
  216. package/dist/client/assets/{plug-CsqfQsYq.js → plug-BdnJAo1j.js} +1 -1
  217. package/dist/client/assets/{primer-trigger-DLdK7lVr.js → primer-trigger-BV4xZfFz.js} +1 -1
  218. package/dist/client/assets/{profile-errors-CpvSy5wY.js → profile-errors-B08zStmk.js} +1 -1
  219. package/dist/client/assets/{progress-qB87L0zJ.js → progress-CpiQE0rv.js} +1 -1
  220. package/dist/client/assets/{quadrantDiagram-D57K4MC3-mJYGGmOV.js → quadrantDiagram-D57K4MC3-dF0oKeMn.js} +1 -1
  221. package/dist/client/assets/{query-error-state-MyJ1ivia.js → query-error-state-B0RUeb10.js} +1 -1
  222. package/dist/client/assets/{radio-DJV7l0fv.js → radio-CAGXbJK_.js} +1 -1
  223. package/dist/client/assets/{railroadDiagram-Y72NRBL7-BlXWwQe2.js → railroadDiagram-Y72NRBL7-ClkFJVq1.js} +1 -1
  224. package/dist/client/assets/{registry-tJrGs7kB.js → registry-Cog_2xvt.js} +4 -4
  225. package/dist/client/assets/registry-DLWJMbtY.js +1 -0
  226. package/dist/client/assets/{relay-trace-schemas-TH0-GYCB.js → relay-trace-schemas-CNDSmhcJ.js} +1 -1
  227. package/dist/client/assets/{repeat-CBnopqBr.js → repeat-Dag80z5v.js} +1 -1
  228. package/dist/client/assets/{requirementDiagram-EQYSW5RA-Dqr1Y74x.js → requirementDiagram-EQYSW5RA-Cey6FmFd.js} +1 -1
  229. package/dist/client/assets/{room-files-source-BFo0FEUP.js → room-files-source-BKUFMU_b.js} +1 -1
  230. package/dist/client/assets/{rotate-ccw-clock-D9XRHj5E.js → rotate-ccw-clock-egrvXlKX.js} +1 -1
  231. package/dist/client/assets/{rotate-cw-DNa7ENG3.js → rotate-cw-Po-L3HFe.js} +1 -1
  232. package/dist/client/assets/{sankeyDiagram-SY24JHO5-DGYZs_kW.js → sankeyDiagram-SY24JHO5-BsIuHjbJ.js} +1 -1
  233. package/dist/client/assets/{scroll-area-Bf6IGziJ.js → scroll-area-C7vKp2H4.js} +1 -1
  234. package/dist/client/assets/{search-x-DFBBEouE.js → search-x-C_BEqIuX.js} +1 -1
  235. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BW3u4L9y.js → sequenceDiagram-BLEHNHQU-BJZXJxwu.js} +1 -1
  236. package/dist/client/assets/{shield-x-WGxwrtNV.js → shield-x-hHpT8rAA.js} +1 -1
  237. package/dist/client/assets/{signed-in-eV4_EXuv.js → signed-in-BhArfIJC.js} +1 -1
  238. package/dist/client/assets/{sizeCapture-INFHLROL-C1TpueOu.js → sizeCapture-INFHLROL-DYCQyn7S.js} +1 -1
  239. package/dist/client/assets/{soul-file-e1iYX9IV.js → soul-file-Doekkv7n.js} +1 -1
  240. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DvrHUauN.js → stateDiagram-v2-A6IESKWZ-C6bUDAO7.js} +1 -1
  241. package/dist/client/assets/{swimlanes-B3ENRKFQ-BUbTcoId.js → swimlanes-B3ENRKFQ-DGyTrJBT.js} +1 -1
  242. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-DrZ99xGr.js +8 -0
  243. package/dist/client/assets/{table-DsxLk3Gx.js → table-9KRGRv_s.js} +1 -1
  244. package/dist/client/assets/{timeline-definition-JXYKGLGB-CzbVpGxn.js → timeline-definition-JXYKGLGB-CHAJwSq6.js} +1 -1
  245. package/dist/client/assets/{trust-posture-Blofy7eE.js → trust-posture-BQE9NSf_.js} +1 -1
  246. package/dist/client/assets/{unplug-B6dUhqA7.js → unplug-CklGWwz7.js} +1 -1
  247. package/dist/client/assets/untrusted-text-BDygHCRk.js +1 -0
  248. package/dist/client/assets/{unverified-catalog-notice-6pwZtIjx.js → unverified-catalog-notice-9mykZSlO.js} +1 -1
  249. package/dist/client/assets/{use-adapter-catalog-J43bUHJu.js → use-adapter-catalog-CDxy08u_.js} +1 -1
  250. package/dist/client/assets/{use-bindings-BgXZ0D7k.js → use-bindings-CPbqKyo6.js} +1 -1
  251. package/dist/client/assets/{use-composer-prefs--zO2mm_M.js → use-composer-prefs-C7v03Xx_.js} +1 -1
  252. package/dist/client/assets/{use-connector-management-9Q7wHb06.js → use-connector-management-COqWo76Y.js} +1 -1
  253. package/dist/client/assets/{use-deep-link-scroll-CXqwdwGr.js → use-deep-link-scroll-BuYR3PaO.js} +1 -1
  254. package/dist/client/assets/{use-delete-binding-BBQNMtUY.js → use-delete-binding-Dfz8BlLn.js} +1 -1
  255. package/dist/client/assets/{use-dev-links-C643CCcq.js → use-dev-links-Cu2JmM-_.js} +1 -1
  256. package/dist/client/assets/{use-direct-message-panel-BD_daG2E.js → use-direct-message-panel-DobIp_O4.js} +1 -1
  257. package/dist/client/assets/{use-external-adapter-catalog-BjbC1V6t.js → use-external-adapter-catalog-OLn4l20Q.js} +1 -1
  258. package/dist/client/assets/{use-full-activity-feed-DUH8r8jx.js → use-full-activity-feed-DNrhQueu.js} +1 -1
  259. package/dist/client/assets/use-is-below-desktop-7gY1n-47.js +1 -0
  260. package/dist/client/assets/{use-local-browser-P93oA-F5.js → use-local-browser-DPdkgs06.js} +1 -1
  261. package/dist/client/assets/{use-mesh-topology-B0k0gLoW.js → use-mesh-topology-Ci7r-pAi.js} +1 -1
  262. package/dist/client/assets/{use-mounted-ref-DE7EQsBF.js → use-mounted-ref-CWXhSyZ8.js} +1 -1
  263. package/dist/client/assets/{use-notification-prefs-B8JtshQ0.js → use-notification-prefs-GJ2coibL.js} +1 -1
  264. package/dist/client/assets/use-pending-read-DcVJ8fZb.js +1 -0
  265. package/dist/client/assets/{use-personality-commit-Dh5Sejj_.js → use-personality-commit-Da2BJ_58.js} +1 -1
  266. package/dist/client/assets/{use-promo-activation-C9FWA7ru.js → use-promo-activation-D4PAd7pd.js} +1 -1
  267. package/dist/client/assets/{use-promo-dismissals-BIfafj9f.js → use-promo-dismissals-BCBu0s3k.js} +1 -1
  268. package/dist/client/assets/{use-pulse-freshness-CxzVMmVK.js → use-pulse-freshness-CHLSUL-h.js} +1 -1
  269. package/dist/client/assets/{use-relay-config-DQE3dmJ2.js → use-relay-config-C6rPlEud.js} +1 -1
  270. package/dist/client/assets/{use-room-follow-claim-B1QPFaUb.js → use-room-follow-claim-BSijPV3c.js} +1 -1
  271. package/dist/client/assets/{use-room-sessions-CdjzO67_.js → use-room-sessions-CNqHgLVa.js} +1 -1
  272. package/dist/client/assets/{use-roving-tab-list-Nu-MIapD.js → use-roving-tab-list-EsqX22Ik.js} +1 -1
  273. package/dist/client/assets/use-session-canvas-DAGOz8a6.js +27 -0
  274. package/dist/client/assets/{use-status-budget-DgeTxC3h.js → use-status-budget-CHln-8aP.js} +1 -1
  275. package/dist/client/assets/{use-transform-CiJqtMBf.js → use-transform-BmyqpcvO.js} +1 -1
  276. package/dist/client/assets/{use-unclaimed-chats-Blkq6U4D.js → use-unclaimed-chats-9Clj_rwl.js} +1 -1
  277. package/dist/client/assets/use-update-config-T78vOnRy.js +1 -0
  278. package/dist/client/assets/{useMutationState-lbcdmnfE.js → useMutationState-B61VoWtY.js} +1 -1
  279. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-BM36oESm.js → usecaseDiagram-WPOLBNNX-BUqj8rIH.js} +1 -1
  280. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Zrybcs91.js → vennDiagram-Q3Y3IDCW-B09oli-Z.js} +1 -1
  281. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-CO4pzGG0.js → wardleyDiagram-IVAIDKWA-BE7gzLdw.js} +1 -1
  282. package/dist/client/assets/{xychartDiagram-4URNHDU4-pi_wF1CM.js → xychartDiagram-4URNHDU4-CbGKfmuW.js} +1 -1
  283. package/dist/client/index.html +1 -1
  284. package/dist/server/index.js +5692 -4710
  285. package/dist/server/index.js.map +2 -2
  286. package/package.json +4 -4
  287. package/dist/client/assets/HandlePage-BjlcYr_l.js +0 -1
  288. package/dist/client/assets/NamePage-A8X09lY7.js +0 -1
  289. package/dist/client/assets/PhotoPage-DP5WoeFd.js +0 -1
  290. package/dist/client/assets/_shell.marketplace-CzLqm8iR.js +0 -1
  291. package/dist/client/assets/_shell.marketplace_.sources-DtraxnMx.js +0 -1
  292. package/dist/client/assets/_shell.session-72JEfodU.js +0 -1
  293. package/dist/client/assets/_shell.x._extensionId-CcJi8pKR.js +0 -1
  294. package/dist/client/assets/_shell.x._extensionId_._-CcJi8pKR.js +0 -1
  295. package/dist/client/assets/channel-DMgpNBDz.js +0 -1
  296. package/dist/client/assets/index-e6oawwKv.js +0 -1
  297. package/dist/client/assets/index-j30EyYIU.js +0 -1
  298. package/dist/client/assets/registry-BrjQCdmG.js +0 -1
  299. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-wkooBe_N.js +0 -8
  300. package/dist/client/assets/untrusted-text-pHjcUwfI.js +0 -1
  301. package/dist/client/assets/use-is-below-desktop-DAZnwJGB.js +0 -1
  302. package/dist/client/assets/use-pending-read-DeGO1wGC.js +0 -1
  303. package/dist/client/assets/use-session-canvas-BfKGOpNy.js +0 -27
  304. package/dist/client/assets/use-update-config-BFFW_6Mc.js +0 -1
@@ -1 +1 @@
1
- import{aN as Ee,a1 as b,a3 as D,r as x,a4 as R,jN as F,jO as T,jP as Be,a2 as z,j as e,jQ as Ge,ig as we,er as We,es as Y,Q as Re,T as Ie,V as Le,B as C,hU as Ye,G as V,eQ as Ve,eb as He,jR as Je,jS as Xe,e4 as Ae,ar as te,x as de,by as Ze,J as ue,ef as me,eo as S,ep as ne,aI as es,jT as ss,I as _,jU as ts,jV as Ke,jW as ns,_ as De,fB as rs,eh as as,ei as is,ej as os,ek as ls,el as be,e7 as cs,C as ds,jX as us,jY as ms,jZ as xs,U as hs}from"./index-B6Scr7KJ.js";import{I as fs}from"./inline-code-BKPMIXZR.js";import{u as gs}from"./useMutationState-lbcdmnfE.js";import{O as ps,a as W}from"./runtime-connect-Dn0T5YWv.js";function ys(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function St(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Ct(s){var u,d;const t=b(),n=D(),[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:[...T]}))}}),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 Te(s){return["runtime-key-status",s]}function js(s,t=!0){const n=b();return z({queryKey:Te(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function vs(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 ks(s){var o,c,u;const t=b(),n=D(),[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:[...T]}),n.invalidateQueries({queryKey:[...Te(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 Ns(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function bs(s,t){var M,I,w,P;const n=b(),i=D(),{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:Be.all}),i.invalidateQueries({queryKey:[...F]}),i.invalidateQueries({queryKey:[...T]}))}}),u=gs({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,p=d||m==null?void 0:m.id,g=!d&&((h==null?void 0:h.status)==="error"||((M=h==null?void 0:h.data)==null?void 0:M.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||p===void 0)return;const N=Ns(i);N.has(p)||(N.add(p),(L=O.current)==null||L.call(O))},[v,p,i]),{login:()=>{d||c.mutate()},isPending:d,isSuccess:v,isError:g,errorMessage:g?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 Ss(s){return Ce[s]??Ce["claude-code"]}function Cs({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(Ge,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(we,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(We,{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 Ot({command:s,runtimeLabel:t}){const[n,i]=x.useState(!1);return e.jsxs(Re,{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(Ie,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Le,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(fs,{children:s}),e.jsx(we,{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(Ye,{className:"size-3"}),"Retry"]})]})}function Os({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 Ps(s){const t=Ve(),{data:n}=He();return s?Je(Xe(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",Es={title:xe,body:`Frontier models are unlocked. ${he}`},ws={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 Rs(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=Ae();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(Ze,{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 Q({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 Is({type:s,onConnected:t,asOtherWay:n=!1}){const i=Ss(s),a=bs(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(Q,{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(Ls,{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 Ls({type:s,copy:t,onConnected:n}){var g,y;const[i,a]=x.useState(""),r=ks(s),l=js(s),o=vs(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=(g=l.data)!=null&&g.key.saved?l.data.key:null,m=i.trim().length>0,h=r.isPending||o.isPending,p=()=>{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),p()},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 As(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(Ks,{saved:n.data,...s},JSON.stringify(n.data))}function Ks({saved:s,onConnected:t,onSave:n}){var K,J,G,X,j,$,fe,ge,pe,ye,je,ve;const i=b(),a=D(),r=x.useId(),l=((K=s.inference)==null?void 0:K.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)??""),[p,g]=x.useState(((X=s.inference)==null?void 0:X.provider)??""),[y,v]=x.useState(((j=s.inference)==null?void 0:j.model)??""),[O,M]=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"?(ge=k.data)==null?void 0:ge.models.find(f=>f.id===y):void 0,ee=s.hasKey&&((pe=s.inference)==null?void 0:pe.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,T,es.all,ss.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=ts.safeParse({source:o,protocol:u,provider:o==="dorkos-credits"?"dorkos":p,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 B="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:B,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:B,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:B,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:p,onChange:f=>g(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=>M(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 Ts(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 (${Ts(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function qs(s){const t=b();return z({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function Fs(){const s=b(),t=D(),n=R({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]})}});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 $e=["runtime-connect","opencode","direct"];function $s(){const s=b();return z({queryKey:$e,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 Us(){var l,o,c;const s=b(),t=D(),[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 p=await s.checkProviderCredential(u,d.trim().length>0?d:null,h);return p.ok?(i("saving"),await s.storeProviderCredential(u,d,h),{saved:!0,message:null}):{saved:!1,message:p.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:u=>{u.saved&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}),t.invalidateQueries({queryKey:[...$e]}))}}),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 zs(s){const t=b();return z({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Qs(){var o,c;const s=b(),t=D(),[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:qe}}}),d},onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))}}),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=D(),[n,i]=x.useState(null),a=R({mutationFn:()=>(i(null),s.provisionOllama(u=>i(u))),onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...T]}))}}),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 Gs="https://ollama.com/download",Ws="curl -fsSL https://ollama.com/install.sh | sh";function Ys({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(Vs,{}),n?e.jsx(Hs,{provision:t}):e.jsx(Js,{}),e.jsx(Xs,{})]})}function Vs(){const s=Ke();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 Hs({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(Q,{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 Js(){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(Cs,{command:Ws,copyLabel:"Copy the Ollama install command"})]})}function Xs(){return e.jsxs("a",{href:Gs,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 Zs="https://ollama.com/library",et={"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"}},st={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function tt({active:s,onConnected:t,onConnectDirectly:n}){var I,w,P,N,L,E;const i=qs(s),a=Fs(),r=Qs(),l=((I=i.data)==null?void 0:I.running)??!1,o=zs(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)},p=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(Ys,{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(ns,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const g=i.data,y=(g==null?void 0:g.installed)??[],v=((L=g==null?void 0:g.installed)==null?void 0:L.length)??(g==null?void 0:g.models.length)??0,O=((E=o.data)==null?void 0:E.models.some(k=>k.model.id===d))??!1,M=d!==null&&!O?d:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(nt,{count:v}),y.length>0&&e.jsx(rt,{installed:y,connect:a,connectingId:c,onUse:h}),e.jsx(at,{catalogQuery:o,pull:r,pullingId:d,onGet:p}),e.jsx(it,{pull:r,activePull:M,onSubmit:p}),e.jsx(ot,{}),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 nt({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=et[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 Ue({tier:s}){return e.jsx(De,{size:"xs",variant:"outline",className:"font-normal",children:st[s]})}function rt({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(Q,{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(Ue,{tier:a.assessment.model.tier})]}),e.jsx(_e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function at({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(ze,{progress:t.progress}):e.jsx(Q,{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(Ue,{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 it({pull:s,activePull:t,onSubmit:n}){const[i,a]=x.useState(""),r=i.trim(),l=ps.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(ze,{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(Q,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function ot(){return e.jsxs("a",{href:Zs,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 ze({progress:s}){const t=Ae(),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 lt(){var r,l,o;const s=b(),t=D(),n=R({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))}}),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 ct(){var h,p;const s=b(),t=D(),[n,i]=x.useState(null),[a,r]=x.useState(null),l=R({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:g,state:y})=>{if(!rs(g)){r("Couldn’t open the OpenRouter sign-in page.");return}i(y)},onError:g=>r(g.message??"Couldn’t start OpenRouter sign-in.")}),o=z({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:g=>{var y;return((y=g.state.data)==null?void 0:y.status)==="pending"?1500:!1},refetchOnWindowFocus:g=>{var y;return((y=g.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:[...T]}))},[c,t]);const u=l.isPending||n!==null&&c==="pending",d=!!a||c==="error",m=d?a??((p=o.data)==null?void 0:p.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:u,isSuccess:c==="connected",isError:d,errorMessage:m}}const dt="https://openrouter.ai/keys";function ut({onConnected:s}){const[t,n]=x.useState(""),i=lt(),a=ct(),r=i.isSuccess||a.isSuccess;return x.useEffect(()=>{r&&(s==null||s(Es))},[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(Q,{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:dt,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 mt(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 Qe(s){return W.some(t=>t.id===s.providerId)}function ie(s){return Qe(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function xt({onConnected:s}){const t=$s();return t.isError&&!t.data?e.jsx(Q,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ht,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ht({setup:s,onConnected:t}){var X;const n=Qe(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=Us(),h=_s(),p=Z(i),g=mt(i),y=n!=null&&n.key.saved&&n.providerId===g?n.key.last4:null,v=o.trim(),O=i===se,M=!O||v.length>0,I=ce(g),w=v||I,P=w===I?"":w,N=n===null?null:n.baseURL??ce(n.providerId),L=g!==((n==null?void 0:n.providerId)??null)||w!==N,E=r.trim().length>0,q=(E||y!==null&&!L)&&M,ee=E&&M,H=!E&&y!==null&&L,re=w.startsWith("http://"),B={providerId:g,key:r,baseURL:P},K=m.isPending||h.isPending,J=x.useRef(null),G=()=>{h.reset(),m.reset()};return x.useEffect(()=>{m.isSuccess&&(t==null||t(ws))},[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(B)},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(as,{value:i,disabled:K,onValueChange:j=>{var $;a(j),c((($=Z(j))==null?void 0:$.defaultBaseURL)??""),G()},children:[e.jsx(is,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(os,{})}),e.jsxs(ls,{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:K,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:K,"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:K,onChange:j=>{l(j.target.value),G()},placeholder:y===null?(p==null?void 0:p.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:[p===void 0?e.jsx("span",{}):e.jsxs("a",{href:p.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||K,"data-testid":"direct-provider-test",onClick:()=>{m.reset(),h.reset(),h.check(B)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",disabled:!ee||K,children:"Save & connect"})]})]}),K?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 ft({currentProvider:s,onConnected:t}){const[n,i]=x.useState("choose"),a=gt();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(ut,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(tt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(xt,{onConnected:t})})}function gt(){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 ${Ke()}. 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(yt,{source:i,onChoose:t},i.step))]})}function yt({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(ds,{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(cs,{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 jt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=ys(),r=Ps(s),l=us(),o=ms(),c=xs([s]);if(s==="doe")return a?e.jsx(As,{onConnected:i}):e.jsx(Oe,{});const u=r==="lead"&&l!==null,d=a?t.kind==="provider-picker"?e.jsx(ft,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Is,{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(g=>` ${g}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:d})]});const p=g=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:g,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Rs(m))}});return u?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[p(!0),e.jsx(le,{children:d}),e.jsx(Os,{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:p(!1)})]}):d}function le({collapsed:s=!1,children:t}){const[n,i]=x.useState(!s);return s?e.jsxs(Re,{open:n,onOpenChange:i,children:[e.jsxs(Ie,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(hs,{className:V("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Le,{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 Pt=s=>e.jsx(jt,{...s});export{Ot as C,Cs as D,Os as K,Oe as R,bs as a,ys as b,St as c,Ms as d,Ps as e,As as f,Ss as g,Pt as r,Ct as u};
1
+ import{aN as Ee,a1 as b,a3 as D,r as x,a4 as R,jN as F,jO as T,jP as Be,a2 as z,j as e,jQ as Ge,ig as we,er as We,es as Y,Q as Re,T as Ie,V as Le,B as C,hU as Ye,G as V,eQ as Ve,eb as He,jR as Je,jS as Xe,e4 as Ae,ar as te,x as de,by as Ze,J as ue,ef as me,eo as S,ep as ne,aI as es,jT as ss,I as _,jU as ts,jV as Ke,jW as ns,_ as De,fB as rs,eh as as,ei as is,ej as os,ek as ls,el as be,e7 as cs,C as ds,jX as us,jY as ms,jZ as xs,U as hs}from"./index-p3WivF1M.js";import{I as fs}from"./inline-code-14c1Gacs.js";import{u as gs}from"./useMutationState-B61VoWtY.js";import{O as ps,a as W}from"./runtime-connect-Dn0T5YWv.js";function ys(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function St(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Ct(s){var u,d;const t=b(),n=D(),[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:[...T]}))}}),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 Te(s){return["runtime-key-status",s]}function js(s,t=!0){const n=b();return z({queryKey:Te(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function vs(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 ks(s){var o,c,u;const t=b(),n=D(),[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:[...T]}),n.invalidateQueries({queryKey:[...Te(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 Ns(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function bs(s,t){var M,I,w,P;const n=b(),i=D(),{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:Be.all}),i.invalidateQueries({queryKey:[...F]}),i.invalidateQueries({queryKey:[...T]}))}}),u=gs({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,p=d||m==null?void 0:m.id,g=!d&&((h==null?void 0:h.status)==="error"||((M=h==null?void 0:h.data)==null?void 0:M.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||p===void 0)return;const N=Ns(i);N.has(p)||(N.add(p),(L=O.current)==null||L.call(O))},[v,p,i]),{login:()=>{d||c.mutate()},isPending:d,isSuccess:v,isError:g,errorMessage:g?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 Ss(s){return Ce[s]??Ce["claude-code"]}function Cs({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(Ge,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(we,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(We,{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 Ot({command:s,runtimeLabel:t}){const[n,i]=x.useState(!1);return e.jsxs(Re,{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(Ie,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Le,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(fs,{children:s}),e.jsx(we,{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(Ye,{className:"size-3"}),"Retry"]})]})}function Os({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 Ps(s){const t=Ve(),{data:n}=He();return s?Je(Xe(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",Es={title:xe,body:`Frontier models are unlocked. ${he}`},ws={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 Rs(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=Ae();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(Ze,{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 Q({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 Is({type:s,onConnected:t,asOtherWay:n=!1}){const i=Ss(s),a=bs(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(Q,{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(Ls,{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 Ls({type:s,copy:t,onConnected:n}){var g,y;const[i,a]=x.useState(""),r=ks(s),l=js(s),o=vs(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=(g=l.data)!=null&&g.key.saved?l.data.key:null,m=i.trim().length>0,h=r.isPending||o.isPending,p=()=>{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),p()},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 As(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(Ks,{saved:n.data,...s},JSON.stringify(n.data))}function Ks({saved:s,onConnected:t,onSave:n}){var K,J,G,X,j,$,fe,ge,pe,ye,je,ve;const i=b(),a=D(),r=x.useId(),l=((K=s.inference)==null?void 0:K.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)??""),[p,g]=x.useState(((X=s.inference)==null?void 0:X.provider)??""),[y,v]=x.useState(((j=s.inference)==null?void 0:j.model)??""),[O,M]=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"?(ge=k.data)==null?void 0:ge.models.find(f=>f.id===y):void 0,ee=s.hasKey&&((pe=s.inference)==null?void 0:pe.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,T,es.all,ss.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=ts.safeParse({source:o,protocol:u,provider:o==="dorkos-credits"?"dorkos":p,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 B="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:B,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:B,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:B,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:p,onChange:f=>g(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=>M(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 Ts(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 (${Ts(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function qs(s){const t=b();return z({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function Fs(){const s=b(),t=D(),n=R({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]})}});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 $e=["runtime-connect","opencode","direct"];function $s(){const s=b();return z({queryKey:$e,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 Us(){var l,o,c;const s=b(),t=D(),[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 p=await s.checkProviderCredential(u,d.trim().length>0?d:null,h);return p.ok?(i("saving"),await s.storeProviderCredential(u,d,h),{saved:!0,message:null}):{saved:!1,message:p.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:u=>{u.saved&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}),t.invalidateQueries({queryKey:[...$e]}))}}),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 zs(s){const t=b();return z({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Qs(){var o,c;const s=b(),t=D(),[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:qe}}}),d},onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))}}),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=D(),[n,i]=x.useState(null),a=R({mutationFn:()=>(i(null),s.provisionOllama(u=>i(u))),onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...T]}))}}),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 Gs="https://ollama.com/download",Ws="curl -fsSL https://ollama.com/install.sh | sh";function Ys({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(Vs,{}),n?e.jsx(Hs,{provision:t}):e.jsx(Js,{}),e.jsx(Xs,{})]})}function Vs(){const s=Ke();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 Hs({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(Q,{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 Js(){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(Cs,{command:Ws,copyLabel:"Copy the Ollama install command"})]})}function Xs(){return e.jsxs("a",{href:Gs,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 Zs="https://ollama.com/library",et={"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"}},st={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function tt({active:s,onConnected:t,onConnectDirectly:n}){var I,w,P,N,L,E;const i=qs(s),a=Fs(),r=Qs(),l=((I=i.data)==null?void 0:I.running)??!1,o=zs(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)},p=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(Ys,{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(ns,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const g=i.data,y=(g==null?void 0:g.installed)??[],v=((L=g==null?void 0:g.installed)==null?void 0:L.length)??(g==null?void 0:g.models.length)??0,O=((E=o.data)==null?void 0:E.models.some(k=>k.model.id===d))??!1,M=d!==null&&!O?d:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(nt,{count:v}),y.length>0&&e.jsx(rt,{installed:y,connect:a,connectingId:c,onUse:h}),e.jsx(at,{catalogQuery:o,pull:r,pullingId:d,onGet:p}),e.jsx(it,{pull:r,activePull:M,onSubmit:p}),e.jsx(ot,{}),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 nt({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=et[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 Ue({tier:s}){return e.jsx(De,{size:"xs",variant:"outline",className:"font-normal",children:st[s]})}function rt({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(Q,{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(Ue,{tier:a.assessment.model.tier})]}),e.jsx(_e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function at({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(ze,{progress:t.progress}):e.jsx(Q,{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(Ue,{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 it({pull:s,activePull:t,onSubmit:n}){const[i,a]=x.useState(""),r=i.trim(),l=ps.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(ze,{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(Q,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function ot(){return e.jsxs("a",{href:Zs,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 ze({progress:s}){const t=Ae(),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 lt(){var r,l,o;const s=b(),t=D(),n=R({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))}}),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 ct(){var h,p;const s=b(),t=D(),[n,i]=x.useState(null),[a,r]=x.useState(null),l=R({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:g,state:y})=>{if(!rs(g)){r("Couldn’t open the OpenRouter sign-in page.");return}i(y)},onError:g=>r(g.message??"Couldn’t start OpenRouter sign-in.")}),o=z({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:g=>{var y;return((y=g.state.data)==null?void 0:y.status)==="pending"?1500:!1},refetchOnWindowFocus:g=>{var y;return((y=g.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:[...T]}))},[c,t]);const u=l.isPending||n!==null&&c==="pending",d=!!a||c==="error",m=d?a??((p=o.data)==null?void 0:p.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:u,isSuccess:c==="connected",isError:d,errorMessage:m}}const dt="https://openrouter.ai/keys";function ut({onConnected:s}){const[t,n]=x.useState(""),i=lt(),a=ct(),r=i.isSuccess||a.isSuccess;return x.useEffect(()=>{r&&(s==null||s(Es))},[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(Q,{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:dt,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 mt(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 Qe(s){return W.some(t=>t.id===s.providerId)}function ie(s){return Qe(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function xt({onConnected:s}){const t=$s();return t.isError&&!t.data?e.jsx(Q,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ht,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ht({setup:s,onConnected:t}){var X;const n=Qe(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=Us(),h=_s(),p=Z(i),g=mt(i),y=n!=null&&n.key.saved&&n.providerId===g?n.key.last4:null,v=o.trim(),O=i===se,M=!O||v.length>0,I=ce(g),w=v||I,P=w===I?"":w,N=n===null?null:n.baseURL??ce(n.providerId),L=g!==((n==null?void 0:n.providerId)??null)||w!==N,E=r.trim().length>0,q=(E||y!==null&&!L)&&M,ee=E&&M,H=!E&&y!==null&&L,re=w.startsWith("http://"),B={providerId:g,key:r,baseURL:P},K=m.isPending||h.isPending,J=x.useRef(null),G=()=>{h.reset(),m.reset()};return x.useEffect(()=>{m.isSuccess&&(t==null||t(ws))},[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(B)},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(as,{value:i,disabled:K,onValueChange:j=>{var $;a(j),c((($=Z(j))==null?void 0:$.defaultBaseURL)??""),G()},children:[e.jsx(is,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(os,{})}),e.jsxs(ls,{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:K,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:K,"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:K,onChange:j=>{l(j.target.value),G()},placeholder:y===null?(p==null?void 0:p.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:[p===void 0?e.jsx("span",{}):e.jsxs("a",{href:p.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||K,"data-testid":"direct-provider-test",onClick:()=>{m.reset(),h.reset(),h.check(B)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",disabled:!ee||K,children:"Save & connect"})]})]}),K?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 ft({currentProvider:s,onConnected:t}){const[n,i]=x.useState("choose"),a=gt();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(ut,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(tt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(xt,{onConnected:t})})}function gt(){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 ${Ke()}. 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(yt,{source:i,onChoose:t},i.step))]})}function yt({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(ds,{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(cs,{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 jt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=ys(),r=Ps(s),l=us(),o=ms(),c=xs([s]);if(s==="doe")return a?e.jsx(As,{onConnected:i}):e.jsx(Oe,{});const u=r==="lead"&&l!==null,d=a?t.kind==="provider-picker"?e.jsx(ft,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Is,{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(g=>` ${g}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:d})]});const p=g=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:g,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Rs(m))}});return u?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[p(!0),e.jsx(le,{children:d}),e.jsx(Os,{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:p(!1)})]}):d}function le({collapsed:s=!1,children:t}){const[n,i]=x.useState(!s);return s?e.jsxs(Re,{open:n,onOpenChange:i,children:[e.jsxs(Ie,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(hs,{className:V("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Le,{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 Pt=s=>e.jsx(jt,{...s});export{Ot as C,Cs as D,Os as K,Oe as R,bs as a,ys as b,St as c,Ms as d,Ps as e,As as f,Ss as g,Pt as r,Ct as u};
@@ -1 +1 @@
1
- import{r as l,bq as Y,eH as U,eI as G,j as e,eJ as J,eK as Q,bp as W,bn as C,bm as M,eL as V,bo as X,eM as Z,eN as q,eO as ee,bv as te,eP as ne,aJ as se,a9 as re,eQ as ae,ea as oe,eR as z,d2 as ie,d3 as ce,d5 as le,d6 as de,d7 as ue,eD as fe,ef as k,J as D,B as S,e4 as A,eS as me,G as E,Q as xe,T as pe,U as ve,V as he,bX as ge,ar as I,x as Ce,by as be}from"./index-B6Scr7KJ.js";import{I as je}from"./inline-code-BKPMIXZR.js";import{l as Re}from"./list-runtime-types-BhkZkTrB.js";import{D as O,u as Ne,C as Pe}from"./RuntimeConnectFlow-D3H5Fpkc.js";var Se=Object.defineProperty,b=(t,n)=>Se(t,"name",{value:n,configurable:!0}),T,_="HoverCard",[F,Ze]=Y(_,[U]),L=U(),[we,H]=F(_),He=b(t=>{const{__scopeHoverCard:n,children:r,open:o,defaultOpen:s,onOpenChange:c,openDelay:a=700,closeDelay:f=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,m]=G({prop:o,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>m(!0),a)},[a,m]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>m(!1),f))},[f,m]),h=l.useCallback(()=>m(!1),[m]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(we,{scope:n,open:u,onOpenChange:m,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(J,{...x,children:r})})},"HoverCard"),Te="HoverCardTrigger",ye=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,...s}=n,c=H(Te,o),a=L(o);return e.jsx(Q,{asChild:!0,...a,children:e.jsx(W.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,w(c.onOpen)),onPointerLeave:C(n.onPointerLeave,w(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,f=>f.preventDefault())})})},"HoverCardTrigger")),B="HoverCardPortal",[ke,De]=F(B,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:o,container:s}=t,c=H(B,n);return e.jsx(ke,{scope:n,forceMount:r,children:e.jsx(M,{present:r||c.open,children:e.jsx(V,{asChild:!0,container:s,children:o})})})},"HoverCardPortal"),y="HoverCardContent",Oe=l.forwardRef(b(function(n,r){const o=De(y,n.__scopeHoverCard),{forceMount:s=o.forceMount,...c}=n,a=H(y,n.__scopeHoverCard);return e.jsx(M,{present:s||a.open,children:e.jsx(_e,{"data-state":a.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,w(a.onOpen)),onPointerLeave:C(n.onPointerLeave,w(a.onClose)),ref:r})})},"HoverCardContent")),_e=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:a,onInteractOutside:f,...x}=n,i=H(y,o),p=L(o),v=l.useRef(null),g=X(r,v),[u,m]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return T=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=T,d.style.webkitUserSelect=T}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{m(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&K(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(Z,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(a,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(q,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&m(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function w(t){return n=>n.pointerType==="touch"?void 0:t()}b(w,"excludeTouch");function K(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(o=>o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(K,"getTabbableNodes");var Le=He,$e=ye,Ie=Ee,Ue=Oe;function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card",...t})}function et({...t}){return e.jsx($e,{"data-slot":"hover-card-trigger",...t})}function tt({className:t,align:n="center",sideOffset:r=4,...o}){const s=ee();return e.jsx(Ie,{"data-slot":"hover-card-portal",container:s,children:e.jsx(Ue,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:te("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-dui-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden motion-reduce:animate-none!",t),...o})})}function Me(t,n,r){return r?ne(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:se.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${re(t)}`}}:null:null}function ze(t,n,r){return t?[t]:n||Re(r)}function Ae({runtime:t,types:n,requirements:r,registeredTypes:o=[],onRecheck:s,isRechecking:c=!1,renderConnect:a}){const f=A(),x=ze(t,n,o);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Fe,{type:i,requirements:r,registered:o.includes(i),renderConnect:a},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(me,{className:E("size-3.5",c&&!f&&"animate-spin")}),"Check again"]})]})]})}function Fe({type:t,requirements:n,registered:r,renderConnect:o}){var N,P,$;const s=k(t),c=s.icon,a=n==null?void 0:n.runtimes[t],f=z(n,t,r),x=f.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?Me(t,a==null?void 0:a.provider,!!o):null,m=a==null?void 0:a.dependencies.find(R=>R.status!=="satisfied"&&R.installHint),d=(m==null?void 0:m.installHint)??((N=s.setup)==null?void 0:N.installCommand),j=(m==null?void 0:m.infoUrl)??((P=s.setup)==null?void 0:P.infoUrl),h=!!a||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(D,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[o==null?void 0:o({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),f.state==="unknown"&&e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:($=a==null?void 0:a.dependencies.find(R=>R.status==="unknown"))==null?void 0:$.description}),!x&&f.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Be,{type:t,connect:f.connect,renderConnect:o,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(xe,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(pe,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ve,{className:E("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(he,{className:"mt-3 space-y-3",children:a?a.dependencies.map(R=>e.jsx(Ge,{dep:R},R.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(je,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Be({type:t,connect:n,renderConnect:r,installCommand:o,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Ke,{type:t,label:n.label,installCommand:o,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Ke({type:t,label:n,installCommand:r,installInfoUrl:o}){const s=k(t),{provision:c,isPending:a,isError:f,errorMessage:x,progress:i,result:p}=Ne(t);return a||p!=null&&p.ok?e.jsx(Ye,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):f?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:o,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(Pe,{command:r,runtimeLabel:s.label})]})}function Ye({message:t}){const n=A();return e.jsxs(I.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(Ce,{size:"xs",className:E("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(be,{mode:"wait",children:e.jsx(I.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ge({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(D,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(ge,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function nt({runtime:t,open:n,onOpenChange:r,renderConnect:o,onRuntimeReady:s,showConnectSuccess:c=!1}){const a=ae(),{data:f}=oe(),x=t?k(t):null,i=z(a.data,t??"",f?t!==void 0&&t in f.capabilities:!0),p=a.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,m]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&m(null),d.current=n},[n]);const j=o&&(c?h=>o({...h,onConnected:N=>{var P;(P=h.onConnected)==null||P.call(h,N),m(N)}}):o);return e.jsx(ie,{open:n,onOpenChange:r,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(de,{children:x?x.label:"Your runtimes"}),e.jsx(ue,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(fe,{children:u?e.jsx(Je,{success:u,onDone:()=>r(!1)}):e.jsx(Ae,{runtime:t,requirements:a.data,registeredTypes:f?Object.keys(f.capabilities):void 0,onRecheck:()=>void a.refetch(),isRechecking:a.isFetching,renderConnect:j})})]})})}function Je({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(D,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{qe as H,nt as R,et as a,tt as b,Ae as c};
1
+ import{r as l,bq as Y,eH as U,eI as G,j as e,eJ as J,eK as Q,bp as W,bn as C,bm as M,eL as V,bo as X,eM as Z,eN as q,eO as ee,bv as te,eP as ne,aJ as se,a9 as re,eQ as ae,ea as oe,eR as z,d2 as ie,d3 as ce,d5 as le,d6 as de,d7 as ue,eD as fe,ef as k,J as D,B as S,e4 as A,eS as me,G as E,Q as xe,T as pe,U as ve,V as he,bX as ge,ar as I,x as Ce,by as be}from"./index-p3WivF1M.js";import{I as je}from"./inline-code-14c1Gacs.js";import{l as Re}from"./list-runtime-types-iJaKcim4.js";import{D as O,u as Ne,C as Pe}from"./RuntimeConnectFlow-BAqkzthF.js";var Se=Object.defineProperty,b=(t,n)=>Se(t,"name",{value:n,configurable:!0}),T,_="HoverCard",[F,Ze]=Y(_,[U]),L=U(),[we,H]=F(_),He=b(t=>{const{__scopeHoverCard:n,children:r,open:o,defaultOpen:s,onOpenChange:c,openDelay:a=700,closeDelay:f=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,m]=G({prop:o,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>m(!0),a)},[a,m]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>m(!1),f))},[f,m]),h=l.useCallback(()=>m(!1),[m]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(we,{scope:n,open:u,onOpenChange:m,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(J,{...x,children:r})})},"HoverCard"),Te="HoverCardTrigger",ye=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,...s}=n,c=H(Te,o),a=L(o);return e.jsx(Q,{asChild:!0,...a,children:e.jsx(W.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,w(c.onOpen)),onPointerLeave:C(n.onPointerLeave,w(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,f=>f.preventDefault())})})},"HoverCardTrigger")),B="HoverCardPortal",[ke,De]=F(B,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:o,container:s}=t,c=H(B,n);return e.jsx(ke,{scope:n,forceMount:r,children:e.jsx(M,{present:r||c.open,children:e.jsx(V,{asChild:!0,container:s,children:o})})})},"HoverCardPortal"),y="HoverCardContent",Oe=l.forwardRef(b(function(n,r){const o=De(y,n.__scopeHoverCard),{forceMount:s=o.forceMount,...c}=n,a=H(y,n.__scopeHoverCard);return e.jsx(M,{present:s||a.open,children:e.jsx(_e,{"data-state":a.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,w(a.onOpen)),onPointerLeave:C(n.onPointerLeave,w(a.onClose)),ref:r})})},"HoverCardContent")),_e=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:a,onInteractOutside:f,...x}=n,i=H(y,o),p=L(o),v=l.useRef(null),g=X(r,v),[u,m]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return T=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=T,d.style.webkitUserSelect=T}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{m(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&K(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(Z,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(a,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(q,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&m(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function w(t){return n=>n.pointerType==="touch"?void 0:t()}b(w,"excludeTouch");function K(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(o=>o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(K,"getTabbableNodes");var Le=He,$e=ye,Ie=Ee,Ue=Oe;function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card",...t})}function et({...t}){return e.jsx($e,{"data-slot":"hover-card-trigger",...t})}function tt({className:t,align:n="center",sideOffset:r=4,...o}){const s=ee();return e.jsx(Ie,{"data-slot":"hover-card-portal",container:s,children:e.jsx(Ue,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:te("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-dui-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden motion-reduce:animate-none!",t),...o})})}function Me(t,n,r){return r?ne(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:se.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${re(t)}`}}:null:null}function ze(t,n,r){return t?[t]:n||Re(r)}function Ae({runtime:t,types:n,requirements:r,registeredTypes:o=[],onRecheck:s,isRechecking:c=!1,renderConnect:a}){const f=A(),x=ze(t,n,o);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Fe,{type:i,requirements:r,registered:o.includes(i),renderConnect:a},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(me,{className:E("size-3.5",c&&!f&&"animate-spin")}),"Check again"]})]})]})}function Fe({type:t,requirements:n,registered:r,renderConnect:o}){var N,P,$;const s=k(t),c=s.icon,a=n==null?void 0:n.runtimes[t],f=z(n,t,r),x=f.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?Me(t,a==null?void 0:a.provider,!!o):null,m=a==null?void 0:a.dependencies.find(R=>R.status!=="satisfied"&&R.installHint),d=(m==null?void 0:m.installHint)??((N=s.setup)==null?void 0:N.installCommand),j=(m==null?void 0:m.infoUrl)??((P=s.setup)==null?void 0:P.infoUrl),h=!!a||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(D,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[o==null?void 0:o({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),f.state==="unknown"&&e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:($=a==null?void 0:a.dependencies.find(R=>R.status==="unknown"))==null?void 0:$.description}),!x&&f.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Be,{type:t,connect:f.connect,renderConnect:o,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(xe,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(pe,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ve,{className:E("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(he,{className:"mt-3 space-y-3",children:a?a.dependencies.map(R=>e.jsx(Ge,{dep:R},R.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(je,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Be({type:t,connect:n,renderConnect:r,installCommand:o,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Ke,{type:t,label:n.label,installCommand:o,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Ke({type:t,label:n,installCommand:r,installInfoUrl:o}){const s=k(t),{provision:c,isPending:a,isError:f,errorMessage:x,progress:i,result:p}=Ne(t);return a||p!=null&&p.ok?e.jsx(Ye,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):f?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:o,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(Pe,{command:r,runtimeLabel:s.label})]})}function Ye({message:t}){const n=A();return e.jsxs(I.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(Ce,{size:"xs",className:E("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(be,{mode:"wait",children:e.jsx(I.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ge({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(D,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(ge,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function nt({runtime:t,open:n,onOpenChange:r,renderConnect:o,onRuntimeReady:s,showConnectSuccess:c=!1}){const a=ae(),{data:f}=oe(),x=t?k(t):null,i=z(a.data,t??"",f?t!==void 0&&t in f.capabilities:!0),p=a.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,m]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&m(null),d.current=n},[n]);const j=o&&(c?h=>o({...h,onConnected:N=>{var P;(P=h.onConnected)==null||P.call(h,N),m(N)}}):o);return e.jsx(ie,{open:n,onOpenChange:r,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(de,{children:x?x.label:"Your runtimes"}),e.jsx(ue,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(fe,{children:u?e.jsx(Je,{success:u,onDone:()=>r(!1)}):e.jsx(Ae,{runtime:t,requirements:a.data,registeredTypes:f?Object.keys(f.capabilities):void 0,onRecheck:()=>void a.refetch(),isRechecking:a.isFetching,renderConnect:j})})]})})}function Je({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(D,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{qe as H,nt as R,et as a,tt as b,Ae as c};
@@ -1,4 +1,4 @@
1
- import{O as at,r as C,j as d,I as Qt,G as P,U as Xt,k$ as Jt,l0 as en,l1 as tn,B as ne,er as nn,l2 as sn,a1 as M,aN as an,ea as rn,b_ as on,ij as cn,ee as dn,a8 as X,l3 as ln,eb as un,ju as hn,ik as mn,ef as pn,a2 as K,l4 as gn,l5 as bn,l6 as it,l7 as rt,fJ as n,fR as ot,fI as a,fH as g,fP as x,fM as A,fL as E,fS as ie,fT as l,l8 as O,l9 as fn,la as m,lb as yn,a3 as we,ap as ct,hp as Ye,lc as dt,hq as Ge,e as wn,gV as Sn,hV as vn,ct as lt,ku as ut,a4 as ht,ld as xn,le as An,fQ as mt,lf as kn,lg as In,b8 as Tn}from"./index-B6Scr7KJ.js";import{u as En}from"./use-promo-dismissals-BIfafj9f.js";import{a as Cn,b as _n,c as pt}from"./RuntimeConnectFlow-D3H5Fpkc.js";import{a as Rn,d as Nn,k as Pn}from"./execution-config-Bej0Ot8e.js";import{s as On}from"./settings-for-runtime-BoOa-ZFG.js";import{u as $n,a as Wn,e as R,c as jn,h as Mn,P as qn,A as Ln,d as Dn,r as Kn}from"./ApplyToOverridesDialog-Ct1W283T.js";/**
1
+ import{O as at,r as C,j as d,I as Qt,G as P,U as Xt,k$ as Jt,l0 as en,l1 as tn,B as ne,er as nn,l2 as sn,a1 as M,aN as an,ea as rn,b_ as on,ij as cn,ee as dn,a8 as X,l3 as ln,eb as un,ju as hn,ik as mn,ef as pn,a2 as K,l4 as gn,l5 as bn,l6 as it,l7 as rt,fJ as n,fR as ot,fI as a,fH as g,fP as x,fM as A,fL as E,fS as ie,fT as l,l8 as O,l9 as fn,la as m,lb as yn,a3 as we,ap as ct,hp as Ye,lc as dt,hq as Ge,e as wn,gV as Sn,hV as vn,ct as lt,ku as ut,a4 as ht,ld as xn,le as An,fQ as mt,lf as kn,lg as In,b8 as Tn}from"./index-p3WivF1M.js";import{u as En}from"./use-promo-dismissals-BCBu0s3k.js";import{a as Cn,b as _n,c as pt}from"./RuntimeConnectFlow-BAqkzthF.js";import{a as Rn,d as Nn,k as Pn}from"./execution-config-DRqIsff0.js";import{s as On}from"./settings-for-runtime-BoOa-ZFG.js";import{u as $n,a as Wn,e as R,c as jn,h as Mn,P as qn,A as Ln,d as Dn,r as Kn}from"./ApplyToOverridesDialog-BHIrnfPf.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{h as g,o as p,r as i,q as c,s as f,j as d,v as S}from"./index-B6Scr7KJ.js";function N({member:t}){var o,r;const e=((o=t.agent)==null?void 0:o.projectPath)??null,s=g(),n=p(),u=i.useCallback(a=>{!s||e===null||(c.getState().recordOpened("agent",e),s(f({dir:e,session:a})))},[s,e]),l=i.useCallback(()=>{var a;e!==null&&(c.getState().recordOpened("agent",e),n(e,{runtime:(a=t.agent)==null?void 0:a.effectiveRuntimeId}))},[e,n,(r=t.agent)==null?void 0:r.effectiveRuntimeId]);return d.jsx(S,{agentPath:e,agentName:t.displayName,onOpenChat:u,onNewChat:l,searchable:!0,className:"flex-1"})}export{N as SessionsPage};
1
+ import{h as g,o as p,r as i,q as c,s as f,j as d,v as S}from"./index-p3WivF1M.js";function N({member:t}){var o,r;const e=((o=t.agent)==null?void 0:o.projectPath)??null,s=g(),n=p(),u=i.useCallback(a=>{!s||e===null||(c.getState().recordOpened("agent",e),s(f({dir:e,session:a})))},[s,e]),l=i.useCallback(()=>{var a;e!==null&&(c.getState().recordOpened("agent",e),n(e,{runtime:(a=t.agent)==null?void 0:a.effectiveRuntimeId}))},[e,n,(r=t.agent)==null?void 0:r.effectiveRuntimeId]);return d.jsx(S,{agentPath:e,agentName:t.displayName,onOpenChat:u,onNewChat:l,searchable:!0,className:"flex-1"})}export{N as SessionsPage};
@@ -1,4 +1,4 @@
1
- import{r as m,O as pn,oP as It,oQ as pa,hl as gn,j as e,oR as ga,oS as fa,d2 as et,d3 as st,oT as ja,d4 as ya,oU as ba,d6 as tt,d7 as nt,oV as va,oW as Na,oX as ka,oY as wa,oZ as Ca,o_ as Sa,G as L,o$ as Aa,aN as Se,by as Le,ar as Te,p0 as Ta,p1 as Ea,e as ee,bg as R,bh as D,hI as fe,b8 as we,B as b,x as fs,eS as at,bi as _,bJ as me,h1 as Fe,p2 as Oa,lk as Ra,X as rt,bK as xe,bL as te,bM as ne,bN as ae,bO as re,bP as ie,bR as pe,a0 as Me,fC as Da,gQ as fn,p3 as it,a2 as Y,a3 as V,lq as js,eo as X,I as J,eh as oe,ei as le,ej as ce,ek as de,el as P,jr as ot,J as Ke,iq as jn,fi as ds,a1 as U,a4 as ge,p4 as Ia,_ as se,p5 as yn,ku as lt,p6 as Pa,p7 as La,$ as He,fj as bn,fk as vn,fl as zs,fm as Us,fn as Ks,p8 as _a,p9 as $a,bS as Fa,ap as as,bE as Ee,C as Be,Q as Ye,T as Ve,f as Ma,V as Qe,l5 as za,mM as Ua,eX as $,ef as je,eb as ys,jY as bs,ea as Ge,ed as vs,l3 as Ka,pa as Nn,l4 as ct,md as Ba,pb as ze,pc as Wa,pd as qa,pe as Ha,pf as Ya,a7 as _e,pg as Va,es as Ns,ph as us,d5 as kn,eD as wn,dO as Cn,pi as Qa,pj as Ga,pk as Xa,pl as Ja,pm as Za,pn as er,po as sr,pp as tr,pq as nr,jZ as ar,pr as rr,gs as Ts,aY as Oe,dH as dt,aI as G,U as We,eg as ir,hp as ks,hq as $e,m7 as Sn,gR as or,gY as lr,gV as An,bX as ue,gX as ws,hV as cr,gU as dr,ps as ur,aS as mr,mx as Bs,pt as Ws,cO as xr,e8 as hr,am as ms,jP as Pe,pu as pr,ll as Tn,lm as qs,bz as gr,bA as fr,pv as jr,bB as yr,bD as br,pw as vr,h2 as Nr,px as kr,py as ut,pz as En,pA as ke,pB as wr,pC as Cr,ee as On,nF as Sr,a8 as Rn,pD as Dn,eQ as mt,a9 as xt,ai as Ar,aj as Tr,c1 as Er,gM as Or,e9 as Rr,pE as Dr,c$ as Ir,ga as Pr,gb as Lr,gc as _r,ak as $r,kE as In,kF as Fr,jD as Mr,pF as zr,dV as Ur,h8 as Kr,dl as Br,dm as Wr,dn as qr,pG as Hr,ep as ht,it as Yr,js as pt,pH as Vr,pI as Qr,pJ as De,pK as rs,pL as Pt,pM as Lt,pN as Gr,pO as Xr,gd as Jr,cu as Pn,l as Ln,y as Zr,pP as ei,pQ as si,eR as ti,pR as ni,ik as ai,e4 as _n,eP as ri,aJ as ii,fB as oi,ig as Ce,bf as li,pS as ci,pT as di,pU as ui,pV as mi,pW as xi,cx as hi,l2 as pi,cj as gi,ck as fi,pX as ji,ji as yi,pY as bi,pZ as vi,g6 as Ni,n as ki,ba as wi,ic as Ci,eq as Si,mL as Ai,ib as Ti,kg as Ei}from"./index-B6Scr7KJ.js";import{a as Oi}from"./ProfilePanelContainer-8WxopRj2.js";import{u as ye}from"./use-update-config-BFFW_6Mc.js";import{u as Ri,a as Di}from"./use-composer-prefs--zO2mm_M.js";import{I as qe}from"./trust-posture-Blofy7eE.js";import{u as $n,a as Ii,i as Pi}from"./use-notification-prefs-B8JtshQ0.js";import{u as Fn}from"./use-bindings-BgXZ0D7k.js";import{T as Li,a as _i,B as xs,u as $i,i as hs,f as ls,r as Fi,b as _t,w as Es,c as gt,d as Hs,C as Mn,e as Mi,K as zi,U as Ui,S as Ki,g as Bi,h as Wi,A as zn,j as qi,W as $t,k as Hi,l as Yi,m as Vi,P as Qi,O as Gi,n as Xi}from"./SeenDevices-CDSHTsL7.js";import{M as Cs}from"./more-details-Bt9nlPmS.js";import{u as Un}from"./use-deep-link-scroll-CXqwdwGr.js";import{a as Ji,u as ft}from"./use-relay-config-DQE3dmJ2.js";import{Q as Xe}from"./query-error-state-MyJ1ivia.js";import{b as Zi,C as eo,u as so,a as to,K as no}from"./KeyEntry-Cf7D0Oo6.js";import{s as ao,e as jt}from"./access-copy-DHfPjN3G.js";import{c as Kn,W as Ft,a as Bn}from"./connection-copy--MA7AN04.js";import{u as Wn,b as ro}from"./use-adapter-catalog-J43bUHJu.js";import{C as io,R as oo,g as lo,u as co,r as uo}from"./ChatAppsOff-VsPP2Hye.js";import{a as mo,B as xo}from"./BindingDialog-CpBZoSZU.js";import{D as ho,a as po}from"./dead-letter-reasons-DtBHju9v.js";import{C as go}from"./relay-trace-schemas-TH0-GYCB.js";import{u as qn,B as fo,R as Mt}from"./ApplyToOverridesDialog-Ct1W283T.js";import{P as jo,a as yo,D as bo}from"./PermissionHistory-zD6ksrl2.js";import{s as Hn}from"./settings-for-runtime-BoOa-ZFG.js";import{l as vo}from"./list-runtime-types-BhkZkTrB.js";import{I as No}from"./inline-code-BKPMIXZR.js";import{r as Ys,d as Yn,b as ko,D as yt,u as wo,C as Co}from"./RuntimeConnectFlow-D3H5Fpkc.js";import{k as So,e as cs}from"./execution-config-Bej0Ot8e.js";import{U as Ao}from"./unverified-catalog-notice-6pwZtIjx.js";import{P as To}from"./path-input-JHTlL97W.js";import{C as Eo}from"./runtime-connect-Dn0T5YWv.js";import{U as Oo}from"./unplug-B6dUhqA7.js";import{L as Ro}from"./link-2-DzWm9OxA.js";import{P as Do,S as Io}from"./progress-qB87L0zJ.js";import{C as Po,a as Lo}from"./cpu-mx7zDf7k.js";import"./ProfileFields-x-x8vgNo.js";import"./profile-errors-CpvSy5wY.js";import"./use-mounted-ref-DE7EQsBF.js";import"./ProfileRolePicker-BfciiNpr.js";import"./use-promo-dismissals-BIfafj9f.js";import"./empty-state-Dv5iV4jb.js";import"./form-DYSiVEri.js";import"./useMutationState-lbcdmnfE.js";function _o({open:s,initialTab:t,defaultTab:n}){const[a,r]=m.useState(t??n),[i,o]=m.useState(s);return s!==i&&(o(s),s&&t&&r(t)),[a,r]}/**
1
+ import{r as m,O as pn,oP as It,oQ as pa,hl as gn,j as e,oR as ga,oS as fa,d2 as et,d3 as st,oT as ja,d4 as ya,oU as ba,d6 as tt,d7 as nt,oV as va,oW as Na,oX as ka,oY as wa,oZ as Ca,o_ as Sa,G as L,o$ as Aa,aN as Se,by as Le,ar as Te,p0 as Ta,p1 as Ea,e as ee,bg as R,bh as D,hI as fe,b8 as we,B as b,x as fs,eS as at,bi as _,bJ as me,h1 as Fe,p2 as Oa,lk as Ra,X as rt,bK as xe,bL as te,bM as ne,bN as ae,bO as re,bP as ie,bR as pe,a0 as Me,fC as Da,gQ as fn,p3 as it,a2 as Y,a3 as V,lq as js,eo as X,I as J,eh as oe,ei as le,ej as ce,ek as de,el as P,jr as ot,J as Ke,iq as jn,fi as ds,a1 as U,a4 as ge,p4 as Ia,_ as se,p5 as yn,ku as lt,p6 as Pa,p7 as La,$ as He,fj as bn,fk as vn,fl as zs,fm as Us,fn as Ks,p8 as _a,p9 as $a,bS as Fa,ap as as,bE as Ee,C as Be,Q as Ye,T as Ve,f as Ma,V as Qe,l5 as za,mM as Ua,eX as $,ef as je,eb as ys,jY as bs,ea as Ge,ed as vs,l3 as Ka,pa as Nn,l4 as ct,md as Ba,pb as ze,pc as Wa,pd as qa,pe as Ha,pf as Ya,a7 as _e,pg as Va,es as Ns,ph as us,d5 as kn,eD as wn,dO as Cn,pi as Qa,pj as Ga,pk as Xa,pl as Ja,pm as Za,pn as er,po as sr,pp as tr,pq as nr,jZ as ar,pr as rr,gs as Ts,aY as Oe,dH as dt,aI as G,U as We,eg as ir,hp as ks,hq as $e,m7 as Sn,gR as or,gY as lr,gV as An,bX as ue,gX as ws,hV as cr,gU as dr,ps as ur,aS as mr,mx as Bs,pt as Ws,cO as xr,e8 as hr,am as ms,jP as Pe,pu as pr,ll as Tn,lm as qs,bz as gr,bA as fr,pv as jr,bB as yr,bD as br,pw as vr,h2 as Nr,px as kr,py as ut,pz as En,pA as ke,pB as wr,pC as Cr,ee as On,nF as Sr,a8 as Rn,pD as Dn,eQ as mt,a9 as xt,ai as Ar,aj as Tr,c1 as Er,gM as Or,e9 as Rr,pE as Dr,c$ as Ir,ga as Pr,gb as Lr,gc as _r,ak as $r,kE as In,kF as Fr,jD as Mr,pF as zr,dV as Ur,h8 as Kr,dl as Br,dm as Wr,dn as qr,pG as Hr,ep as ht,it as Yr,js as pt,pH as Vr,pI as Qr,pJ as De,pK as rs,pL as Pt,pM as Lt,pN as Gr,pO as Xr,gd as Jr,cu as Pn,l as Ln,y as Zr,pP as ei,pQ as si,eR as ti,pR as ni,ik as ai,e4 as _n,eP as ri,aJ as ii,fB as oi,ig as Ce,bf as li,pS as ci,pT as di,pU as ui,pV as mi,pW as xi,cx as hi,l2 as pi,cj as gi,ck as fi,pX as ji,ji as yi,pY as bi,pZ as vi,g6 as Ni,n as ki,ba as wi,ic as Ci,eq as Si,mL as Ai,ib as Ti,kg as Ei}from"./index-p3WivF1M.js";import{a as Oi}from"./ProfilePanelContainer-BIbOulLu.js";import{u as ye}from"./use-update-config-T78vOnRy.js";import{u as Ri,a as Di}from"./use-composer-prefs-C7v03Xx_.js";import{I as qe}from"./trust-posture-BQE9NSf_.js";import{u as $n,a as Ii,i as Pi}from"./use-notification-prefs-GJ2coibL.js";import{u as Fn}from"./use-bindings-CPbqKyo6.js";import{T as Li,a as _i,B as xs,u as $i,i as hs,f as ls,r as Fi,b as _t,w as Es,c as gt,d as Hs,C as Mn,e as Mi,K as zi,U as Ui,S as Ki,g as Bi,h as Wi,A as zn,j as qi,W as $t,k as Hi,l as Yi,m as Vi,P as Qi,O as Gi,n as Xi}from"./SeenDevices-xdR3YQNr.js";import{M as Cs}from"./more-details-DhdX4DGU.js";import{u as Un}from"./use-deep-link-scroll-BuYR3PaO.js";import{a as Ji,u as ft}from"./use-relay-config-C6rPlEud.js";import{Q as Xe}from"./query-error-state-B0RUeb10.js";import{b as Zi,C as eo,u as so,a as to,K as no}from"./KeyEntry-g2VQ33KW.js";import{s as ao,e as jt}from"./access-copy-xWnaUps1.js";import{c as Kn,W as Ft,a as Bn}from"./connection-copy--MA7AN04.js";import{u as Wn,b as ro}from"./use-adapter-catalog-CDxy08u_.js";import{C as io,R as oo,g as lo,u as co,r as uo}from"./ChatAppsOff-D7anOG3n.js";import{a as mo,B as xo}from"./BindingDialog-Bw55sMTh.js";import{D as ho,a as po}from"./dead-letter-reasons-DtBHju9v.js";import{C as go}from"./relay-trace-schemas-CNDSmhcJ.js";import{u as qn,B as fo,R as Mt}from"./ApplyToOverridesDialog-BHIrnfPf.js";import{P as jo,a as yo,D as bo}from"./PermissionHistory-Czl5PWN3.js";import{s as Hn}from"./settings-for-runtime-BoOa-ZFG.js";import{l as vo}from"./list-runtime-types-iJaKcim4.js";import{I as No}from"./inline-code-14c1Gacs.js";import{r as Ys,d as Yn,b as ko,D as yt,u as wo,C as Co}from"./RuntimeConnectFlow-BAqkzthF.js";import{k as So,e as cs}from"./execution-config-DRqIsff0.js";import{U as Ao}from"./unverified-catalog-notice-9mykZSlO.js";import{P as To}from"./path-input-CFm1b1pk.js";import{C as Eo}from"./runtime-connect-Dn0T5YWv.js";import{U as Oo}from"./unplug-CklGWwz7.js";import{L as Ro}from"./link-2-DugR2HHU.js";import{P as Do,S as Io}from"./progress-CpiQE0rv.js";import{C as Po,a as Lo}from"./cpu-CdCfSlSR.js";import"./ProfileFields-Bi_AfHOE.js";import"./profile-errors-B08zStmk.js";import"./use-mounted-ref-CWXhSyZ8.js";import"./ProfileRolePicker-BadkFi4V.js";import"./use-promo-dismissals-BCBu0s3k.js";import"./empty-state-B7ufhAFk.js";import"./form-CA_eiUg-.js";import"./useMutationState-B61VoWtY.js";function _o({open:s,initialTab:t,defaultTab:n}){const[a,r]=m.useState(t??n),[i,o]=m.useState(s);return s!==i&&(o(s),s&&t&&r(t)),[a,r]}/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{a1 as S,a2 as z,i8 as h,i9 as g,a3 as w,a4 as A,a7 as M,ap as I,j as e,r as d,U as O,G as N,B as j,a0 as K,e8 as y,bJ as q,bK as U,bL as W,bM as Q,bN as G,bO as J,bP as Y,bR as X,h as H,l as E,eo as V,$ as Z,e as $,er as ee,ia as se,gX as R,_ as L}from"./index-B6Scr7KJ.js";import{B as P}from"./banner-CVrzHqOT.js";import{I as C}from"./inline-code-BKPMIXZR.js";import{P as _}from"./package-BmOMrNwc.js";function D(s){const t=S();return z({queryKey:h.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const te={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},ne={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},b="\0",ae=new Set(["native","projected"]);function T(s){return`${s.scope??"project"}${b}${s.artifact}${b}${s.source??""}${b}${s.name}`}function re(s,t){return`${g[s]} ${te[t]}`}function ie(s){return s.reason??s.target}function B(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function le(s,t){if(t.length===0)return!1;const n=B(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return ae.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function k(s){return`${s} ${s===1?"file":"files"}`}function oe(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function ce(s){return`Shared with all ${s}`}function de(s){return s===1?"1 agent file":`${s} agent files`}function ue(s){return`Agent files ${s} can’t see: skills, rules, commands and more.`}function xe(s){return s===1?"1 entry":`${s} entries`}function fe(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const i=r.cells[n];return i===void 0||i.state!=="dropped"?[]:[{key:T(r),artifact:r.artifact,name:r.name,...i.reason===void 0?{}:{reason:i.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const me={drop:"Not shared",warning:"Couldn’t read",write:"Will be written",notice:"Notice"};function pe(s){return`${me[s.kind]} · ${s.artifact} ${s.name}`}function he(s){const t=S(),n=w();return A({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),M.success("Agent files updated.")}})}function ge(s){const t=w();I("approval_resolved",()=>{t.invalidateQueries({queryKey:h.status(s)})})}function je({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(P,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",k(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",k(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:i,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:i}),e.jsx("span",{className:"opacity-80",children:c})]},i))})]}),r.length>0&&e.jsx("p",{children:oe(r.length)})]})})}function ve(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something blocks them.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills only reach a few of your agents.",variant:"info",actionable:!1}:null}function Ne({projectPath:s}){return ge(s),null}function ye({projectPath:s}){const{data:t}=D(s),n=he(s),[a,r]=d.useState(!1),[i,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(Ne,{projectPath:s});if(n.data!==void 0&&!i)return e.jsxs(e.Fragment,{children:[u,e.jsx(je,{result:n.data,onDismiss:()=>c(!0)})]});const o=ve(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,l=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(P,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:l===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),l>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",k(l)," DorkOS put here",e.jsx(O,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function be(s){const t=S(),n=w();return A({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),n.setQueriesData({queryKey:h.all,predicate:r=>{var i;return((i=r.state.data)==null?void 0:i.projectPath)===a.status.projectPath}},a.status)}})}const ke={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function Se({harness:s,cell:t}){var i;const n=re(s,t.state),a=ie(t),r=(i=t.warnings)!=null&&i.length?t.warnings.join(" · "):void 0;return e.jsxs("li",{"aria-label":n,...a===void 0?{}:{title:a},className:N("text-3xs inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight",ke[ne[t.state]]),children:[n,r!==void 0&&e.jsx("span",{role:"img","aria-label":"May not work",title:r,className:"inline-flex",children:e.jsx(K,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function we(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Only some agents can see it. Move it to .agents/skills to share it.":`Lives in ${n}. Move it to .agents/skills to share it.`}function Ce(s,t){return`dorkos harness adopt ${s} --project ${t}`}const De="Share with every agent";function $e(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}. A link stays behind for Claude Code.`:`${a}, where every agent reads it.`}const Ae="for all your projects";function Oe({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,i]=d.useState(!1),[c,u]=d.useState(!1),o=be(n),x=B(s,t),m=le(s,t)&&!a,l=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:Ae}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!l,title:x.map(({harness:p})=>g[p]).join(" · "),onClick:()=>i(p=>!p),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[ce(x.length),e.jsx(O,{"aria-hidden":!0,className:N("size-2.5 transition-transform",l&&"-rotate-90")})]})}),!l&&x.map(({harness:p,cell:F})=>e.jsx(Se,{harness:p,cell:F},p))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||we(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(C,{children:Ce(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:De})}),e.jsx(q,{open:c,onOpenChange:u,children:e.jsxs(U,{children:[e.jsxs(W,{children:[e.jsxs(Q,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(G,{children:$e(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(J,{children:[e.jsx(Y,{children:"Cancel"}),e.jsx(X,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const He=se("/guides/cli-usage#agent-files");function Ee(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{className:"h-3 w-32"}),e.jsx($,{className:"h-3 w-48"})]},s))})]})}function Re({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:i}=D(s),[c,u]=d.useState(!1),o=d.useId(),x=H();if(a)return e.jsx(Ee,{});if(r)return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsx("p",{className:"text-destructive text-xs",children:"Couldn’t load skills."}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>void i(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Le,{status:n});const m=n.rows.filter(l=>l.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(Z,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(l=>e.jsx(Oe,{row:l,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},T(l)))})]})}function Le({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(C,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(ee,{href:He,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Pe({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ue(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function _e({rows:s,enabled:t}){const n=fe(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Pe,{group:a},a.harness))})}function Te({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:xe(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:pe(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function Be({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Fe({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but isn’t sharing to it.`:`${g[t]} files are here, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(Be,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function ze({projectPath:s}){const t=H(),{data:n}=D(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(ye,{projectPath:s}),a&&e.jsx(Fe,{notEnabled:a.notEnabled}),e.jsx(Re,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(_e,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Te,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function Ue({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(ze,{projectPath:t})}export{Ue as SkillsPage};
1
+ import{a1 as S,a2 as z,i8 as h,i9 as g,a3 as w,a4 as A,a7 as M,ap as I,j as e,r as d,U as O,G as N,B as j,a0 as K,e8 as y,bJ as q,bK as U,bL as W,bM as Q,bN as G,bO as J,bP as Y,bR as X,h as H,l as E,eo as V,$ as Z,e as $,er as ee,ia as se,gX as R,_ as L}from"./index-p3WivF1M.js";import{B as P}from"./banner-BH1gXPTc.js";import{I as C}from"./inline-code-14c1Gacs.js";import{P as _}from"./package-0mI7-RiJ.js";function D(s){const t=S();return z({queryKey:h.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const te={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},ne={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},b="\0",ae=new Set(["native","projected"]);function T(s){return`${s.scope??"project"}${b}${s.artifact}${b}${s.source??""}${b}${s.name}`}function re(s,t){return`${g[s]} ${te[t]}`}function ie(s){return s.reason??s.target}function B(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function le(s,t){if(t.length===0)return!1;const n=B(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return ae.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function k(s){return`${s} ${s===1?"file":"files"}`}function oe(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function ce(s){return`Shared with all ${s}`}function de(s){return s===1?"1 agent file":`${s} agent files`}function ue(s){return`Agent files ${s} can’t see: skills, rules, commands and more.`}function xe(s){return s===1?"1 entry":`${s} entries`}function fe(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const i=r.cells[n];return i===void 0||i.state!=="dropped"?[]:[{key:T(r),artifact:r.artifact,name:r.name,...i.reason===void 0?{}:{reason:i.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const me={drop:"Not shared",warning:"Couldn’t read",write:"Will be written",notice:"Notice"};function pe(s){return`${me[s.kind]} · ${s.artifact} ${s.name}`}function he(s){const t=S(),n=w();return A({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),M.success("Agent files updated.")}})}function ge(s){const t=w();I("approval_resolved",()=>{t.invalidateQueries({queryKey:h.status(s)})})}function je({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(P,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",k(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",k(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:i,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:i}),e.jsx("span",{className:"opacity-80",children:c})]},i))})]}),r.length>0&&e.jsx("p",{children:oe(r.length)})]})})}function ve(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something blocks them.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills only reach a few of your agents.",variant:"info",actionable:!1}:null}function Ne({projectPath:s}){return ge(s),null}function ye({projectPath:s}){const{data:t}=D(s),n=he(s),[a,r]=d.useState(!1),[i,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(Ne,{projectPath:s});if(n.data!==void 0&&!i)return e.jsxs(e.Fragment,{children:[u,e.jsx(je,{result:n.data,onDismiss:()=>c(!0)})]});const o=ve(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,l=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(P,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:l===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),l>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",k(l)," DorkOS put here",e.jsx(O,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function be(s){const t=S(),n=w();return A({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),n.setQueriesData({queryKey:h.all,predicate:r=>{var i;return((i=r.state.data)==null?void 0:i.projectPath)===a.status.projectPath}},a.status)}})}const ke={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function Se({harness:s,cell:t}){var i;const n=re(s,t.state),a=ie(t),r=(i=t.warnings)!=null&&i.length?t.warnings.join(" · "):void 0;return e.jsxs("li",{"aria-label":n,...a===void 0?{}:{title:a},className:N("text-3xs inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight",ke[ne[t.state]]),children:[n,r!==void 0&&e.jsx("span",{role:"img","aria-label":"May not work",title:r,className:"inline-flex",children:e.jsx(K,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function we(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Only some agents can see it. Move it to .agents/skills to share it.":`Lives in ${n}. Move it to .agents/skills to share it.`}function Ce(s,t){return`dorkos harness adopt ${s} --project ${t}`}const De="Share with every agent";function $e(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}. A link stays behind for Claude Code.`:`${a}, where every agent reads it.`}const Ae="for all your projects";function Oe({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,i]=d.useState(!1),[c,u]=d.useState(!1),o=be(n),x=B(s,t),m=le(s,t)&&!a,l=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:Ae}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!l,title:x.map(({harness:p})=>g[p]).join(" · "),onClick:()=>i(p=>!p),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[ce(x.length),e.jsx(O,{"aria-hidden":!0,className:N("size-2.5 transition-transform",l&&"-rotate-90")})]})}),!l&&x.map(({harness:p,cell:F})=>e.jsx(Se,{harness:p,cell:F},p))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||we(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(C,{children:Ce(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:De})}),e.jsx(q,{open:c,onOpenChange:u,children:e.jsxs(U,{children:[e.jsxs(W,{children:[e.jsxs(Q,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(G,{children:$e(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(J,{children:[e.jsx(Y,{children:"Cancel"}),e.jsx(X,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const He=se("/guides/cli-usage#agent-files");function Ee(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{className:"h-3 w-32"}),e.jsx($,{className:"h-3 w-48"})]},s))})]})}function Re({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:i}=D(s),[c,u]=d.useState(!1),o=d.useId(),x=H();if(a)return e.jsx(Ee,{});if(r)return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsx("p",{className:"text-destructive text-xs",children:"Couldn’t load skills."}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>void i(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Le,{status:n});const m=n.rows.filter(l=>l.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(Z,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(l=>e.jsx(Oe,{row:l,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},T(l)))})]})}function Le({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(C,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(ee,{href:He,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Pe({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ue(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function _e({rows:s,enabled:t}){const n=fe(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Pe,{group:a},a.harness))})}function Te({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:xe(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:pe(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function Be({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Fe({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but isn’t sharing to it.`:`${g[t]} files are here, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(Be,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function ze({projectPath:s}){const t=H(),{data:n}=D(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(ye,{projectPath:s}),a&&e.jsx(Fe,{notEnabled:a.notEnabled}),e.jsx(Re,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(_e,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Te,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function Ue({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(ze,{projectPath:t})}export{Ue as SkillsPage};
@@ -1 +1 @@
1
- import{bf as I,a$ as F,r as i,aY as c,c$ as R,b2 as P,j as e,by as O,ar as B,d0 as M,d1 as W,d2 as L,d3 as $,d4 as z,d5 as H,d6 as Y,d7 as q}from"./index-B6Scr7KJ.js";import{F as G,T as J,C as S}from"./TasksEmptyState-Di3SbhJM.js";import{i as K}from"./registry-BrjQCdmG.js";import"./inline-code-BKPMIXZR.js";import"./form-DYSiVEri.js";import"./command-BvXBgZfv.js";import"./AgentPicker-Ldh64iOA.js";import"./AgentOptionRow-0VdNzXCF.js";import"./execution-config-Bej0Ot8e.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./list-runtime-types-BhkZkTrB.js";import"./format-cron-DYYwmo-o.js";function Q(){const l=I(),{data:n=[],isLoading:m}=F(l),[h,a]=i.useState(!1),[g,r]=i.useState(),[f,w]=i.useState(null),[v,u]=i.useState(null),t=c(s=>s.tasksAgentFilter),j=c(s=>s.setTasksAgentFilter),x=c(s=>s.tasksEditScheduleId),b=c(s=>s.setTasksEditScheduleId),N=t?n.filter(s=>s.agentId===t):n,E=n.some(s=>s.agentId),{data:o}=R(void 0,E),p=i.useMemo(()=>{const s=new Map;for(const d of(o==null?void 0:o.agents)??[])s.set(d.id,d);return s},[o]);i.useEffect(()=>{if(!x||m)return;const s=n.find(d=>d.id===x);s&&(r(s),a(!0)),b(null)},[x,n,m,b]);const k=i.useMemo(()=>{var s;return t?((s=p.get(t))==null?void 0:s.name)??t:null},[t,p]),{externalTrigger:y}=P();i.useEffect(()=>{y&&(r(void 0),a(!0))},[y]);const A=s=>{u(s),r(void 0),a(!0)},T=()=>{u(null),r(void 0),a(!0)},D=s=>{a(s),s||u(null)};return l?m?e.jsx("div",{className:"space-y-2 p-4",children:[1,2,3].map(s=>e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-muted animate-breath size-2 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"bg-muted animate-breath h-4 w-32 rounded"}),e.jsx("div",{className:"bg-muted animate-breath h-3 w-48 rounded"})]})]})},s))}):N.length===0?e.jsxs(e.Fragment,{children:[t?e.jsxs("div",{className:"flex flex-col items-center gap-3 p-8",children:[e.jsx(C,{name:k,onClear:()=>j(null)}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No schedules for this agent."}),e.jsx("button",{onClick:T,className:"border-input hover:bg-accent hover:text-accent-foreground inline-flex items-center rounded-md border bg-transparent px-3 py-1.5 text-sm font-medium shadow-xs transition-colors",children:"New schedule"})]}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pt-6",children:e.jsx(J,{onCreateWithPreset:A,onCreateBlank:T})}),e.jsx(S,{open:h,onOpenChange:D,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"space-y-2 p-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:"Schedules"}),t&&e.jsx(C,{name:k,onClear:()=>j(null)})]}),e.jsx("button",{onClick:()=>{r(void 0),a(!0)},className:"border-input hover:bg-accent hover:text-accent-foreground inline-flex items-center rounded-md border bg-transparent px-3 py-1.5 text-sm font-medium shadow-xs transition-colors",children:"New schedule"})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:e.jsx(O,{initial:!1,children:N.map(s=>e.jsx(B.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.2,ease:[0,0,.2,1]},className:"mb-2",children:e.jsx(M,{task:s,agent:s.agentId?p.get(s.agentId)??null:null,expanded:f===s.id,onToggleExpand:()=>w(f===s.id?null:s.id),onEdit:()=>{r(s),a(!0)}})},s.id))})}),e.jsx(S,{open:h,onOpenChange:a,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsx(G,{icon:K.tasks,name:"Scheduling",description:"Scheduled tasks let your agents work on a timer, even when you’re not here.",command:"dorkos --tasks"})}function C({name:l,onClear:n}){return e.jsx(W,{onRemove:n,removeLabel:"Clear agent filter",children:l??"Agent"})}function re({open:l,onOpenChange:n}){return e.jsx(L,{open:l,onOpenChange:n,children:e.jsxs($,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[e.jsx(z,{}),e.jsxs(H,{className:"border-b px-4 py-3",children:[e.jsx(Y,{className:"text-sm font-medium",children:"Scheduled tasks"}),e.jsx(q,{className:"sr-only",children:"See and change your scheduled tasks"})]}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx(Q,{})})]})})}export{re as TasksDialogWrapper};
1
+ import{bf as I,a$ as F,r as i,aY as c,c$ as R,b2 as P,j as e,by as O,ar as B,d0 as M,d1 as W,d2 as L,d3 as $,d4 as z,d5 as H,d6 as Y,d7 as q}from"./index-p3WivF1M.js";import{F as G,T as J,C as S}from"./TasksEmptyState-g-CavcMv.js";import{i as K}from"./registry-DLWJMbtY.js";import"./inline-code-14c1Gacs.js";import"./form-CA_eiUg-.js";import"./command-2pl_Cn7b.js";import"./AgentPicker-DazquIgR.js";import"./AgentOptionRow-BLuSwpNh.js";import"./execution-config-DRqIsff0.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./list-runtime-types-iJaKcim4.js";import"./format-cron-YPhIy57w.js";function Q(){const l=I(),{data:n=[],isLoading:m}=F(l),[h,a]=i.useState(!1),[g,r]=i.useState(),[f,w]=i.useState(null),[v,u]=i.useState(null),t=c(s=>s.tasksAgentFilter),j=c(s=>s.setTasksAgentFilter),x=c(s=>s.tasksEditScheduleId),b=c(s=>s.setTasksEditScheduleId),N=t?n.filter(s=>s.agentId===t):n,E=n.some(s=>s.agentId),{data:o}=R(void 0,E),p=i.useMemo(()=>{const s=new Map;for(const d of(o==null?void 0:o.agents)??[])s.set(d.id,d);return s},[o]);i.useEffect(()=>{if(!x||m)return;const s=n.find(d=>d.id===x);s&&(r(s),a(!0)),b(null)},[x,n,m,b]);const k=i.useMemo(()=>{var s;return t?((s=p.get(t))==null?void 0:s.name)??t:null},[t,p]),{externalTrigger:y}=P();i.useEffect(()=>{y&&(r(void 0),a(!0))},[y]);const A=s=>{u(s),r(void 0),a(!0)},T=()=>{u(null),r(void 0),a(!0)},D=s=>{a(s),s||u(null)};return l?m?e.jsx("div",{className:"space-y-2 p-4",children:[1,2,3].map(s=>e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-muted animate-breath size-2 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"bg-muted animate-breath h-4 w-32 rounded"}),e.jsx("div",{className:"bg-muted animate-breath h-3 w-48 rounded"})]})]})},s))}):N.length===0?e.jsxs(e.Fragment,{children:[t?e.jsxs("div",{className:"flex flex-col items-center gap-3 p-8",children:[e.jsx(C,{name:k,onClear:()=>j(null)}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No schedules for this agent."}),e.jsx("button",{onClick:T,className:"border-input hover:bg-accent hover:text-accent-foreground inline-flex items-center rounded-md border bg-transparent px-3 py-1.5 text-sm font-medium shadow-xs transition-colors",children:"New schedule"})]}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pt-6",children:e.jsx(J,{onCreateWithPreset:A,onCreateBlank:T})}),e.jsx(S,{open:h,onOpenChange:D,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"space-y-2 p-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-muted-foreground text-sm font-medium",children:"Schedules"}),t&&e.jsx(C,{name:k,onClear:()=>j(null)})]}),e.jsx("button",{onClick:()=>{r(void 0),a(!0)},className:"border-input hover:bg-accent hover:text-accent-foreground inline-flex items-center rounded-md border bg-transparent px-3 py-1.5 text-sm font-medium shadow-xs transition-colors",children:"New schedule"})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:e.jsx(O,{initial:!1,children:N.map(s=>e.jsx(B.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.2,ease:[0,0,.2,1]},className:"mb-2",children:e.jsx(M,{task:s,agent:s.agentId?p.get(s.agentId)??null:null,expanded:f===s.id,onToggleExpand:()=>w(f===s.id?null:s.id),onEdit:()=>{r(s),a(!0)}})},s.id))})}),e.jsx(S,{open:h,onOpenChange:a,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsx(G,{icon:K.tasks,name:"Scheduling",description:"Scheduled tasks let your agents work on a timer, even when you’re not here.",command:"dorkos --tasks"})}function C({name:l,onClear:n}){return e.jsx(W,{onRemove:n,removeLabel:"Clear agent filter",children:l??"Agent"})}function re({open:l,onOpenChange:n}){return e.jsx(L,{open:l,onOpenChange:n,children:e.jsxs($,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[e.jsx(z,{}),e.jsxs(H,{className:"border-b px-4 py-3",children:[e.jsx(Y,{className:"text-sm font-medium",children:"Scheduled tasks"}),e.jsx(q,{className:"sr-only",children:"See and change your scheduled tasks"})]}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx(Q,{})})]})})}export{re as TasksDialogWrapper};