dorkos 0.131.0 → 0.133.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/dist/bin/cli.js +499 -314
  2. package/dist/browser/fresh-verifier.mjs +13 -13
  3. package/dist/browser/native/darwin-supervisor-worker.mjs +3 -3
  4. package/dist/browser/native/package-manifest.json +1 -1
  5. package/dist/browser/source-manifest.json +1 -1
  6. package/dist/client/assets/{AboutPage-BZ2LLJ0k.js → AboutPage-D-EHHVPa.js} +1 -1
  7. package/dist/client/assets/{ActivityErrorState-BnqAwUiy.js → ActivityErrorState-BTHnE1vP.js} +1 -1
  8. package/dist/client/assets/{ActivityPage-BlZKrSVo.js → ActivityPage-BfSLPIdR.js} +1 -1
  9. package/dist/client/assets/{ActivityRow-Ch8HxQ2m.js → ActivityRow-PwUBjQw8.js} +1 -1
  10. package/dist/client/assets/{AdapterIcon-CfocFMw-.js → AdapterIcon-DgkNN6bi.js} +1 -1
  11. package/dist/client/assets/{AdapterSetupWizard-Dtjx1Oad.js → AdapterSetupWizard-DX0dzp7q.js} +2 -2
  12. package/dist/client/assets/{AgentOptionRow-BGRvUeF7.js → AgentOptionRow-ApuDEKqq.js} +1 -1
  13. package/dist/client/assets/{AgentPicker-BcURPZQp.js → AgentPicker-BDci-9aL.js} +1 -1
  14. package/dist/client/assets/{AgentRequestCard-kNq5A_IN.js → AgentRequestCard-B2gxCMGi.js} +3 -3
  15. package/dist/client/assets/{AppearancePage-Cd-k7dcc.js → AppearancePage-8SVnFe0k.js} +1 -1
  16. package/dist/client/assets/ApplyToOverridesDialog-CnL1ubxL.js +1 -0
  17. package/dist/client/assets/{AttentionSignalRow-QY8AIjf9.js → AttentionSignalRow-CCKhUtil.js} +1 -1
  18. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Cgkvajbw.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-B7wFPzG4.js} +3 -3
  19. package/dist/client/assets/BindingDialog-C4BHVXno.js +1 -0
  20. package/dist/client/assets/{BlintzCanvas-CMzZnmWK.js → BlintzCanvas-7E5uwVms.js} +3 -3
  21. package/dist/client/assets/{CanvasCsvContent-uxMaHePf.js → CanvasCsvContent-l7lfyDGn.js} +4 -4
  22. package/dist/client/assets/CanvasFileContent-Bqd0IEfK.js +2 -0
  23. package/dist/client/assets/CanvasModel3dContent-DqL0Sy4r.js +2 -0
  24. package/dist/client/assets/{ChannelComposer-BAg0a29Q.js → ChannelComposer-CAYvz_ZB.js} +12 -17
  25. package/dist/client/assets/{ChatAppsOff-DD28V0vX.js → ChatAppsOff-CNeKBVNz.js} +2 -2
  26. package/dist/client/assets/{CodeMirrorDiff-CyoduBgM.js → CodeMirrorDiff-BZRcNFsS.js} +1 -1
  27. package/dist/client/assets/{CodeMirrorEditor-DGccoZ8Q.js → CodeMirrorEditor-DD5tArRn.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-Dk98shko.js → ComputerResourceView-BUmsVssG.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-Broprz4q.js → ComputerViewer-BKMR5LkF.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-C_qLz8GJ.js → ConnectionAccessLists-DYUiFmPY.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-CmGgGmDO.js → ConnectionsPage-DR2Kfm9Q.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-BxWLIUUC.js → ConventionPage-Do6q8873.js} +2 -2
  33. package/dist/client/assets/{ExtensionPageRoute-CyfIRaGs.js → ExtensionPageRoute-CP7NM7fw.js} +2 -2
  34. package/dist/client/assets/{FeatureDisabledState-By2dhVpu.js → FeatureDisabledState-Bi23k3rg.js} +1 -1
  35. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-B6wKQpLR.js → FloatingTanStackRouterDevtools-CqogiFob-lRlmDXYz.js} +1 -1
  36. package/dist/client/assets/{ForwardConsentHost-kDdpyBgA.js → ForwardConsentHost-DSR1pEEK.js} +1 -1
  37. package/dist/client/assets/HandlePage-aHId3bYX.js +1 -0
  38. package/dist/client/assets/HeartbeatPage-BTNVcHOI.js +1 -0
  39. package/dist/client/assets/{KeyEntry-Ctc1zp2J.js → KeyEntry-67acsEG2.js} +1 -1
  40. package/dist/client/assets/{LexicalField-7zd4B8f1.js → LexicalField-Cb68LIar.js} +2 -2
  41. package/dist/client/assets/{ManagesPage-BG1TIMP3.js → ManagesPage-ChPlBF42.js} +1 -1
  42. package/dist/client/assets/{Marketplace-C9r4jRJf.js → Marketplace-CzPhJEE1.js} +4 -4
  43. package/dist/client/assets/{MarketplaceSourcesView-C01Cdrge.js → MarketplaceSourcesView-CmQgxQmU.js} +1 -1
  44. package/dist/client/assets/{McpAppFrame-Dm7MqOhc.js → McpAppFrame-z5JUaCSA.js} +2 -2
  45. package/dist/client/assets/{McpSigninBody-CsXP_7lE.js → McpSigninBody-ZrnzwrOH.js} +1 -1
  46. package/dist/client/assets/{Model3dViewer-DOl8ZkrU.js → Model3dViewer-HJpWK-JI.js} +1 -1
  47. package/dist/client/assets/NamePage-C7F-SotG.js +1 -0
  48. package/dist/client/assets/{NewDirectMessageMenu-Dj-Qw8zA.js → NewDirectMessageMenu-CjBjzsDe.js} +1 -1
  49. package/dist/client/assets/{NotificationsPage-UExs4YE2.js → NotificationsPage-DwNUI0Z3.js} +1 -1
  50. package/dist/client/assets/{OpenMeshSwitch-Dx3M3wwS.js → OpenMeshSwitch-RNAZY1vn.js} +2 -2
  51. package/dist/client/assets/{OperatorIdentityForm-Bz5570RF.js → OperatorIdentityForm-B7S2C_eT.js} +1 -1
  52. package/dist/client/assets/PermissionHistory-D0chstxf.js +1 -0
  53. package/dist/client/assets/PermissionsPage-ToK0DZVV.js +1 -0
  54. package/dist/client/assets/{PersonalityPopover-Do-k_Hhw.js → PersonalityPopover-BvMtUQRM.js} +1 -1
  55. package/dist/client/assets/PhotoPage-Cqo3PNO_.js +1 -0
  56. package/dist/client/assets/{PreviewRefusedNotice-B-yyzQZP.js → PreviewRefusedNotice-DzbkMrUo.js} +1 -1
  57. package/dist/client/assets/{ProfileFields-DiarOK2y.js → ProfileFields-DU8dTGHT.js} +1 -1
  58. package/dist/client/assets/{ProfilePanelContainer-33Xkwoc3.js → ProfilePanelContainer-BfT-ufV7.js} +1 -1
  59. package/dist/client/assets/{ProfileRolePicker-BI6T4hj8.js → ProfileRolePicker-DrOtV-0N.js} +1 -1
  60. package/dist/client/assets/{PromptSuggestionChips-v5MScpZF.js → PromptSuggestionChips-CEnhme_V.js} +1 -1
  61. package/dist/client/assets/{ReportsToPopover-BALADuTO.js → ReportsToPopover-CwjpR1Tw.js} +1 -1
  62. package/dist/client/assets/{RoomSurface-BatV7gf5.js → RoomSurface-CChzNJKw.js} +1 -1
  63. package/dist/client/assets/{RoomsPage-DCCC3Dst.js → RoomsPage-Dbf6ijKr.js} +1 -1
  64. package/dist/client/assets/{RunsOnPopover-C7hMPyrb.js → RunsOnPopover-Bh5sSsSC.js} +1 -1
  65. package/dist/client/assets/{RuntimeConnectFlow-Dc5a8dlJ.js → RuntimeConnectFlow-BYQnY5vv.js} +1 -1
  66. package/dist/client/assets/{RuntimeSetupDialog-w90VGjJ4.js → RuntimeSetupDialog-DTO5v0dP.js} +1 -1
  67. package/dist/client/assets/{SeenDevices-BIMmbMWC.js → SeenDevices-cuY7ASEy.js} +3 -3
  68. package/dist/client/assets/{SessionsPage-0lwvSYHB.js → SessionsPage-BrqpVx-t.js} +1 -1
  69. package/dist/client/assets/{SettingsDialog-CrP6JzPg.js → SettingsDialog-DCAZX_1d.js} +4 -4
  70. package/dist/client/assets/{SkillsPage-BDgKWTfe.js → SkillsPage-D5who_ZH.js} +1 -1
  71. package/dist/client/assets/TaskDialogWrapper-BJ6XtOC5.js +1 -0
  72. package/dist/client/assets/TasksEmptyState-B3SjsxQa.js +3 -0
  73. package/dist/client/assets/{TasksPage-DjGbMGvn.js → TasksPage-B72w7J87.js} +1 -1
  74. package/dist/client/assets/{TeamComputerEntry-B_sM9Fik.js → TeamComputerEntry-B9ma5j-X.js} +1 -1
  75. package/dist/client/assets/TodoPromiseList-DDKWAfmv.js +1 -0
  76. package/dist/client/assets/TodoPromisesPage-BNXpvXzS.js +1 -0
  77. package/dist/client/assets/{ToolsPage-CeETRCd8.js → ToolsPage-DbJykCG3.js} +2 -2
  78. package/dist/client/assets/{TopologyGraph-CnpH2NjE.js → TopologyGraph-DKZS3nlr.js} +3 -3
  79. package/dist/client/assets/{TourHost-BQHrS47S.js → TourHost-Bw3Uoea5.js} +1 -1
  80. package/dist/client/assets/{UnlinkDialog-DOQLeNx4.js → UnlinkDialog-B-XCFNSd.js} +1 -1
  81. package/dist/client/assets/{UnreadDivider-DhyK6uGG.js → UnreadDivider-1aPVzwd7.js} +1 -1
  82. package/dist/client/assets/{WidgetErrorCard-Bwlfu514.js → WidgetErrorCard-C5ieVv_9.js} +6 -6
  83. package/dist/client/assets/{WithheldExtensionsNotice-BDc-CM2t.js → WithheldExtensionsNotice-CCO4ClRZ.js} +1 -1
  84. package/dist/client/assets/{WorkQueuePage-iO_DO1YK.js → WorkQueuePage-BbPKNwDg.js} +1 -1
  85. package/dist/client/assets/WorkView-BRcytACJ.js +51 -0
  86. package/dist/client/assets/_shell-EwFeSIGp.js +80 -0
  87. package/dist/client/assets/{_shell._home-BWi5YPaR.js → _shell._home-DD2mg-iK.js} +1 -1
  88. package/dist/client/assets/{_shell._home.activity-BU1NIGb7.js → _shell._home.activity-Z1QuU2M4.js} +1 -1
  89. package/dist/client/assets/_shell._home.index-BzTYr8Bw.js +3 -0
  90. package/dist/client/assets/_shell._home.tasks-BtC85Iut.js +1 -0
  91. package/dist/client/assets/{_shell._home.workspaces-wbnqJ58w.js → _shell._home.workspaces-qMG5OJYR.js} +1 -1
  92. package/dist/client/assets/{_shell.channels-D1KdvWZF.js → _shell.channels-BE4EK-iM.js} +2 -2
  93. package/dist/client/assets/_shell.connections-CBx0ogzx.js +1 -0
  94. package/dist/client/assets/{_shell.feedback-requests-DzHWC1fJ.js → _shell.feedback-requests-CwKSkkuD.js} +2 -2
  95. package/dist/client/assets/_shell.marketplace-CgWBUKSA.js +1 -0
  96. package/dist/client/assets/_shell.marketplace_.sources-8HZpKFDI.js +1 -0
  97. package/dist/client/assets/_shell.session-D6HcVbnm.js +1 -0
  98. package/dist/client/assets/{_shell.team-BMNSUpQQ.js → _shell.team-Dm5a4f8_.js} +4 -4
  99. package/dist/client/assets/_shell.threads-BavVtQOE.js +1 -0
  100. package/dist/client/assets/_shell.todos-B6uWr0zA.js +6 -0
  101. package/dist/client/assets/_shell.x._extensionId-DaELdkCH.js +1 -0
  102. package/dist/client/assets/_shell.x._extensionId_._-DaELdkCH.js +1 -0
  103. package/dist/client/assets/{abnfDiagram-WEYOIA3C-Co2k29JX.js → abnfDiagram-WEYOIA3C-Bu2T3jVw.js} +1 -1
  104. package/dist/client/assets/{access-copy-D6BUySpp.js → access-copy-tkiFMhRf.js} +1 -1
  105. package/dist/client/assets/{arc-DLZZpkuJ.js → arc-5q4SfXO9.js} +1 -1
  106. package/dist/client/assets/{architectureDiagram-ZHVYKT53-ClS9xqK5.js → architectureDiagram-ZHVYKT53-BnDMOBhV.js} +1 -1
  107. package/dist/client/assets/{banner-B8iMuXCP.js → banner-CSKUrrI0.js} +2 -2
  108. package/dist/client/assets/{blockDiagram-RJAE7QA3-DheoOELu.js → blockDiagram-RJAE7QA3-CtushlEs.js} +1 -1
  109. package/dist/client/assets/{c4Diagram-XDPPPE54-VWWZJ5x4.js → c4Diagram-XDPPPE54-7L-qYwKH.js} +1 -1
  110. package/dist/client/assets/channel-A3XT7_2L.js +1 -0
  111. package/dist/client/assets/{chunk-2E7WHVMD-BqPLJVkv.js → chunk-2E7WHVMD-ksBVyqQ3.js} +1 -1
  112. package/dist/client/assets/{chunk-2Q5K7J3B-DZn6OnKe.js → chunk-2Q5K7J3B-Bfqdkihb.js} +1 -1
  113. package/dist/client/assets/{chunk-4EMNKR2T-Dl9Poajp.js → chunk-4EMNKR2T-Brf2dH9x.js} +1 -1
  114. package/dist/client/assets/{chunk-55XCU76K-RoKuZPUc.js → chunk-55XCU76K-BlE7Cq40.js} +1 -1
  115. package/dist/client/assets/{chunk-5VM5RSS4-DV_1XHtU.js → chunk-5VM5RSS4-Bkgg3j7L.js} +1 -1
  116. package/dist/client/assets/{chunk-JWPE2WC7-B_IuS45y.js → chunk-JWPE2WC7-B9TRpN4O.js} +1 -1
  117. package/dist/client/assets/{chunk-VQ5W62QI-DkLNi45x.js → chunk-VQ5W62QI-ZoILnIYi.js} +1 -1
  118. package/dist/client/assets/{chunk-XXDRQBXY-ISM-1Dpw.js → chunk-XXDRQBXY-r2xNhaKz.js} +1 -1
  119. package/dist/client/assets/{chunk-ZCHMQSOR-MKaLMW8o.js → chunk-ZCHMQSOR-DfV3cF7d.js} +2 -2
  120. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-CIWuu4ht.js → classDiagram-v2-4MYWR3UA-VOVqMNNP.js} +1 -1
  121. package/dist/client/assets/{command-CxGYZKco.js → command-CaUEAy3b.js} +1 -1
  122. package/dist/client/assets/{copy-button-DjAoGwds.js → copy-button-BOznikwM.js} +1 -1
  123. package/dist/client/assets/{cose-bilkent-JH36ORCC-HiCifRyi.js → cose-bilkent-JH36ORCC-CAdBvyLz.js} +1 -1
  124. package/dist/client/assets/{cpu-DHHTTvp_.js → cpu-j9vX9Wfk.js} +1 -1
  125. package/dist/client/assets/{cynefin-EF2NZ3EQ-DjJGZrPz.js → cynefin-EF2NZ3EQ-DcH1A9Oo.js} +1 -1
  126. package/dist/client/assets/{cynefinDiagram-WF24UDRP-DE2NdiJ2.js → cynefinDiagram-WF24UDRP-DJuKBXHi.js} +1 -1
  127. package/dist/client/assets/{dagre-NK4GIZVX-C6gDOD26.js → dagre-NK4GIZVX-D099H_0S.js} +1 -1
  128. package/dist/client/assets/{detail-row-CjwI1iuc.js → detail-row-Crl89jnh.js} +1 -1
  129. package/dist/client/assets/{diagram-CBK3MWTC-38LckcsL.js → diagram-CBK3MWTC-Cd_4W9XO.js} +1 -1
  130. package/dist/client/assets/{diagram-I5XIIV2D--8L6D9Ra.js → diagram-I5XIIV2D-Bc7aQKt3.js} +1 -1
  131. package/dist/client/assets/{diagram-ODIL2UCW-DGC2Inhd.js → diagram-ODIL2UCW-awVJZ4Bg.js} +1 -1
  132. package/dist/client/assets/{diagram-PFBEJUXE-BDHp0AyR.js → diagram-PFBEJUXE-dhsj9aeU.js} +1 -1
  133. package/dist/client/assets/{diagram-RJA3I4VV-uBatJYPi.js → diagram-RJA3I4VV-Dm59CbiV.js} +1 -1
  134. package/dist/client/assets/{diagram-TYUNFSNR-C8e1EH9X.js → diagram-TYUNFSNR-BhvcIjA9.js} +1 -1
  135. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-DimRzU5B.js → ebnfDiagram-V4P3TTPT-C4wT_MTC.js} +1 -1
  136. package/dist/client/assets/{elk-QONTBCTQ-Dz6_Y2-G.js → elk-QONTBCTQ-CPI0zjmW.js} +1 -1
  137. package/dist/client/assets/{empty-state-saV209Il.js → empty-state-BHcmkSzu.js} +1 -1
  138. package/dist/client/assets/{erDiagram-KYQIGQAA-JeuTF8w6.js → erDiagram-KYQIGQAA-C_vGcbOB.js} +1 -1
  139. package/dist/client/assets/{execution-config-ClQZyDs9.js → execution-config-BS5rtvTZ.js} +1 -1
  140. package/dist/client/assets/{file-BIF-4ARS.js → file-CQGljfDT.js} +1 -1
  141. package/dist/client/assets/{file-exclamation-point-DxadH2b-.js → file-exclamation-point-B0a55VME.js} +1 -1
  142. package/dist/client/assets/{file-text-C_NPIQr4.js → file-text-Cycq_S0e.js} +1 -1
  143. package/dist/client/assets/{find-latest-widget-fence-CXai_zs0.js → find-latest-widget-fence-B6sJdG3Q.js} +4 -4
  144. package/dist/client/assets/{flowDiagram-IUGLLWBU-9FHDdK4j.js → flowDiagram-IUGLLWBU-_VNfmnxx.js} +1 -1
  145. package/dist/client/assets/{form-D3VdAYl4.js → form-BL14vwyB.js} +1 -1
  146. package/dist/client/assets/{format-cron-BqRDcFZM.js → format-cron-meJMgYNe.js} +1 -1
  147. package/dist/client/assets/{ganttDiagram-R7GPNTJY-CLMuXlHt.js → ganttDiagram-R7GPNTJY-o0gGU7X_.js} +1 -1
  148. package/dist/client/assets/{git-branch-Df7a5_fb.js → git-branch-CsLE6G0Y.js} +1 -1
  149. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-sE7Rlpr6.js → gitGraphDiagram-PDYL7XHY-DjXjUpJo.js} +1 -1
  150. package/dist/client/assets/{graph-iNVyFhBQ.js → graph-BMYee_VK.js} +1 -1
  151. package/dist/client/assets/{heart-BHMhDZ0K.js → heart-Cn3a-UQI.js} +1 -1
  152. package/dist/client/assets/{highlighted-body-KPVGNVTW-VvvsrJbu.js → highlighted-body-KPVGNVTW-DsX5yCC0.js} +1 -1
  153. package/dist/client/assets/{image-lightbox-CGEIRguA.js → image-lightbox-BZ_eBZgA.js} +1 -1
  154. package/dist/client/assets/{image-off-C5-TmSq8.js → image-off-DjR7LI5G.js} +1 -1
  155. package/dist/client/assets/{index-C3zS0ghJ.js → index-1MwES_vb.js} +1 -1
  156. package/dist/client/assets/{index-ClyRhxV_.js → index-47--OGKJ.js} +1 -1
  157. package/dist/client/assets/{index-CTgUh4p3.js → index-4rSR8lau.js} +1 -1
  158. package/dist/client/assets/{index-D9bEy8X-.js → index-B4TxpTKD.js} +1 -1
  159. package/dist/client/assets/{index-Dw-4S640.js → index-B8LqLhq7.js} +1 -1
  160. package/dist/client/assets/index-BJRgbiEd.js +1 -0
  161. package/dist/client/assets/{index-DWZ5M321.js → index-BOCclWF3.js} +1 -1
  162. package/dist/client/assets/index-BR1m9FON.js +1066 -0
  163. package/dist/client/assets/index-BcFn_S6b.js +1 -0
  164. package/dist/client/assets/{index-DRtg_sGG.js → index-BcnwvTnt.js} +1 -1
  165. package/dist/client/assets/index-BdVQOlVQ.css +1 -0
  166. package/dist/client/assets/{index-DEvpdTo6.js → index-BmKHO-FD.js} +1 -1
  167. package/dist/client/assets/{index-Bd0PAkxf.js → index-BsZkXHsH.js} +1 -1
  168. package/dist/client/assets/{index-Cudi8rs6.js → index-BxWr8Mrf.js} +1 -1
  169. package/dist/client/assets/index-C5EvpXcq.js +1 -0
  170. package/dist/client/assets/{index-CExh9cKN.js → index-Cb_p_ynP.js} +1 -1
  171. package/dist/client/assets/{index-YZbu9tke.js → index-CczLBUKI.js} +1 -1
  172. package/dist/client/assets/{index-264YDu-W.js → index-Cf4Gtxf9.js} +1 -1
  173. package/dist/client/assets/{index-Dpu2CORc.js → index-CfKSlYjb.js} +1 -1
  174. package/dist/client/assets/{index-Bzm9YMbr.js → index-Cgjq7a-8.js} +1 -1
  175. package/dist/client/assets/{index-Ci_J5Q-6.js → index-CpWxcN5D.js} +1 -1
  176. package/dist/client/assets/{index-BK5QrGfQ.js → index-Cv67OXfk.js} +1 -1
  177. package/dist/client/assets/{index-Di-MIFQG.js → index-D5Qmx1JR.js} +3 -3
  178. package/dist/client/assets/{index-LPrq0pOA.js → index-DARchye_.js} +1 -1
  179. package/dist/client/assets/{index-DMwivStD.js → index-DFb4kOjm.js} +2 -2
  180. package/dist/client/assets/{index-WeLoaNzW.js → index-DLN0kcME.js} +1 -1
  181. package/dist/client/assets/{index-BMLCfTba.js → index-DMSSN08i.js} +1 -1
  182. package/dist/client/assets/{index-Y6BDhuGt.js → index-DQ8uADJF.js} +1 -1
  183. package/dist/client/assets/index-DZhMvc9m.js +1 -0
  184. package/dist/client/assets/{index-CLsoFUml.js → index-Dfko0tSp.js} +1 -1
  185. package/dist/client/assets/{index-BgdYXP8E.js → index-DiM3QX-4.js} +3 -3
  186. package/dist/client/assets/{index-BxFLHNLg.js → index-DlvUENo4.js} +1 -1
  187. package/dist/client/assets/{index-BLUUshO9.js → index-DqZmnJED.js} +1 -1
  188. package/dist/client/assets/{index-D_bAtIJZ.js → index-DrlB9RSk.js} +1 -1
  189. package/dist/client/assets/{index-CgWzzIbx.js → index-H4e5Wpmi.js} +1 -1
  190. package/dist/client/assets/{index-k67dvyau.js → index-Joav7LQU.js} +1 -1
  191. package/dist/client/assets/{index-B0FHRkHM.js → index-KganLhU1.js} +2 -2
  192. package/dist/client/assets/{index-DFkofTx1.js → index-Kt6r3DQg.js} +1 -1
  193. package/dist/client/assets/{index-B8I1k-z9.js → index-Z2ApBQt4.js} +1 -1
  194. package/dist/client/assets/index-dY7IFpet.js +1 -0
  195. package/dist/client/assets/{index-DYVNSRDk.js → index-faSyUc2q.js} +1 -1
  196. package/dist/client/assets/{index-BgRYuqWs.js → index-gmyiXkmr.js} +1 -1
  197. package/dist/client/assets/{index-BZTLFzJp.js → index-o6kGmVGx.js} +1 -1
  198. package/dist/client/assets/{index-C_0JoCV6.js → index-vHKVYcH7.js} +1 -1
  199. package/dist/client/assets/{index.esm-CYmalBux.js → index.esm-CJIDYBqd.js} +1 -1
  200. package/dist/client/assets/{infoDiagram-MVDRKAX5-0aR9wjgO.js → infoDiagram-MVDRKAX5-B1mMyUlp.js} +1 -1
  201. package/dist/client/assets/{inline-code-DyTKSC5b.js → inline-code-mh48Uhbi.js} +1 -1
  202. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-D1lN8x2t.js → ishikawaDiagram-HPEHV2GE-efEMQ0_X.js} +1 -1
  203. package/dist/client/assets/{journeyDiagram-BOSHW7O7-CkXITXiJ.js → journeyDiagram-BOSHW7O7-DSAywiVk.js} +1 -1
  204. package/dist/client/assets/{kanban-definition-FNSA4HC5-ge33IiSq.js → kanban-definition-FNSA4HC5-B9pbU4zK.js} +1 -1
  205. package/dist/client/assets/{layers-Bx3K7OUm.js → layers-B0Z5Od3N.js} +1 -1
  206. package/dist/client/assets/{lightbulb-C5LvXkvM.js → lightbulb-Cfb5ecEd.js} +1 -1
  207. package/dist/client/assets/{link-2-Bj0_Zkvr.js → link-2-Dzy5BUL3.js} +1 -1
  208. package/dist/client/assets/{list-runtime-types-VNj1C8TB.js → list-runtime-types-DLmjtBMq.js} +1 -1
  209. package/dist/client/assets/{markdown-content-BRaPEOC7.js → markdown-content-DhAtZOfj.js} +1 -1
  210. package/dist/client/assets/{mention-pill-B_MiJWfo.js → mention-pill-DmA8FxL4.js} +1 -1
  211. package/dist/client/assets/{mermaid.core-B2hil_4a.js → mermaid.core-DUIkdbeL.js} +4 -4
  212. package/dist/client/assets/{message-square-off-T33FHpr7.js → message-square-off-BowIzJUV.js} +1 -1
  213. package/dist/client/assets/{mindmap-definition-6OY57UG3-Bu_Ia4Xz.js → mindmap-definition-6OY57UG3-Dz7ZOR4C.js} +1 -1
  214. package/dist/client/assets/{more-details-oDazWBxm.js → more-details-DV7LmY0E.js} +1 -1
  215. package/dist/client/assets/{owner-notice-VepbAQhj.js → owner-notice-DdFc2P8z.js} +1 -1
  216. package/dist/client/assets/{package-DBsl3ao5.js → package-BhKXbvU_.js} +1 -1
  217. package/dist/client/assets/{page-container-Bkarym6m.js → page-container-0sWZ3xh9.js} +1 -1
  218. package/dist/client/assets/{pane-resize-handle-gBlb5k1v.js → pane-resize-handle-Bjy4udre.js} +1 -1
  219. package/dist/client/assets/{paperclip-BeFttiUK.js → paperclip-C-7LhBfl.js} +1 -1
  220. package/dist/client/assets/{path-input-NY_yCBHb.js → path-input-BPVyI72G.js} +1 -1
  221. package/dist/client/assets/{pegDiagram-ECIUJNBX-0KmJlW0E.js → pegDiagram-ECIUJNBX-C4EOP-Fa.js} +1 -1
  222. package/dist/client/assets/{pieDiagram-GNMPY74T-IjeZXicv.js → pieDiagram-GNMPY74T-CQ1OxRkv.js} +1 -1
  223. package/dist/client/assets/{plug-CTqOZ7cA.js → plug-CIZ-wWL8.js} +1 -1
  224. package/dist/client/assets/{primer-trigger-CjaGrT2u.js → primer-trigger-XA5fLzR5.js} +2 -2
  225. package/dist/client/assets/{profile-errors-B8XkL2Rp.js → profile-errors-C1XACbc9.js} +1 -1
  226. package/dist/client/assets/{progress-Cr-4myw6.js → progress-BA2JPtb6.js} +1 -1
  227. package/dist/client/assets/{quadrantDiagram-D57K4MC3-CP6kLJKa.js → quadrantDiagram-D57K4MC3-Cw4BdkpS.js} +1 -1
  228. package/dist/client/assets/{query-error-state-DvhY-YKM.js → query-error-state-Cm-Lozlb.js} +1 -1
  229. package/dist/client/assets/{radio-CmDmmJy6.js → radio-DQ29H26H.js} +1 -1
  230. package/dist/client/assets/{railroadDiagram-Y72NRBL7-Bcto__oE.js → railroadDiagram-Y72NRBL7-CSKtYLmm.js} +1 -1
  231. package/dist/client/assets/registry-Tbt9pcZl.js +39 -0
  232. package/dist/client/assets/registry-jD9zw538.js +1 -0
  233. package/dist/client/assets/{relay-trace-schemas-ZLR1S8ft.js → relay-trace-schemas-4AAUf-Zl.js} +2 -2
  234. package/dist/client/assets/{repeat-DVTM8et8.js → repeat-B8g-x-Sc.js} +1 -1
  235. package/dist/client/assets/{requirementDiagram-EQYSW5RA-DNJrds3m.js → requirementDiagram-EQYSW5RA-BPSBZr7X.js} +1 -1
  236. package/dist/client/assets/{room-files-source-9Wdtc-bG.js → room-files-source-BkiK4-ZI.js} +2 -2
  237. package/dist/client/assets/{rotate-ccw-clock-qJSWqifh.js → rotate-ccw-clock-DRtL-2nr.js} +1 -1
  238. package/dist/client/assets/{rotate-cw-uoeBxIeM.js → rotate-cw-BbHkWN-J.js} +1 -1
  239. package/dist/client/assets/{sankeyDiagram-SY24JHO5-DNlU7xGI.js → sankeyDiagram-SY24JHO5-DVlHablQ.js} +1 -1
  240. package/dist/client/assets/{scroll-area-B1d3NfEn.js → scroll-area-DAC7NrVU.js} +1 -1
  241. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-CRk71coF.js → sequenceDiagram-BLEHNHQU--wZkN8xk.js} +1 -1
  242. package/dist/client/assets/{shield-x-BpQmg1qz.js → shield-x-CEWfkzDN.js} +1 -1
  243. package/dist/client/assets/{signed-in-CTmJ3OqM.js → signed-in-CMhCR-m8.js} +1 -1
  244. package/dist/client/assets/{sizeCapture-INFHLROL-cihX3QNq.js → sizeCapture-INFHLROL-CLXc7d3S.js} +1 -1
  245. package/dist/client/assets/{soul-file-BwiyiI5v.js → soul-file-CbX7rNqz.js} +1 -1
  246. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BAwwRsnH.js → stateDiagram-v2-A6IESKWZ-5xa1FM_X.js} +1 -1
  247. package/dist/client/assets/{swimlanes-B3ENRKFQ-CpDB6CUC.js → swimlanes-B3ENRKFQ-DKgxJxjE.js} +1 -1
  248. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-f6MOc3pl.js +8 -0
  249. package/dist/client/assets/{table-dWrfPeX-.js → table-D0EJT0uP.js} +1 -1
  250. package/dist/client/assets/{tabs-D4txthOi.js → tabs-Ctjzrm8t.js} +1 -1
  251. package/dist/client/assets/{timeline-definition-JXYKGLGB-RDrKgCoU.js → timeline-definition-JXYKGLGB-B9P7ituI.js} +1 -1
  252. package/dist/client/assets/trust-dial-D__tIhzt.js +11 -0
  253. package/dist/client/assets/{trust-posture-atZIh8tf.js → trust-posture-DaHHtOZn.js} +1 -1
  254. package/dist/client/assets/{unplug-CnevV4yX.js → unplug-B-ipHefz.js} +1 -1
  255. package/dist/client/assets/{unverified-catalog-notice-BQwT36FA.js → unverified-catalog-notice-C8swqaTn.js} +1 -1
  256. package/dist/client/assets/{use-bindings-CltfjAWW.js → use-bindings-gLHRNAFU.js} +1 -1
  257. package/dist/client/assets/{use-composer-prefs-D-Zlt6z2.js → use-composer-prefs-CjpxcBIe.js} +1 -1
  258. package/dist/client/assets/{use-connector-management-C3CLnOOt.js → use-connector-management-BLiCJMgU.js} +1 -1
  259. package/dist/client/assets/{use-deep-link-scroll-DQlz-scx.js → use-deep-link-scroll-r2nKjzA-.js} +1 -1
  260. package/dist/client/assets/{use-delete-binding-D73CLm_7.js → use-delete-binding-BSiOik_K.js} +1 -1
  261. package/dist/client/assets/{use-dev-links-BqVFsMKU.js → use-dev-links-DXcIlMf-.js} +1 -1
  262. package/dist/client/assets/use-direct-message-panel-BbH8N4mE.js +1 -0
  263. package/dist/client/assets/{use-external-adapter-catalog-DrnksH0t.js → use-external-adapter-catalog-mmKni5ui.js} +1 -1
  264. package/dist/client/assets/{use-filter-state-D4i-hDOk.js → use-filter-state-CiPZ0AIH.js} +2 -2
  265. package/dist/client/assets/{use-full-activity-feed-DdDsRg8s.js → use-full-activity-feed-DXroUzfN.js} +1 -1
  266. package/dist/client/assets/use-is-below-desktop-LUZL5z5t.js +1 -0
  267. package/dist/client/assets/{use-mesh-topology-B7aLtPkZ.js → use-mesh-topology-upehQ5Cv.js} +1 -1
  268. package/dist/client/assets/{use-mounted-ref-DSSTCJfY.js → use-mounted-ref-IHwyriaF.js} +1 -1
  269. package/dist/client/assets/{use-notification-prefs-DaF3kwmq.js → use-notification-prefs-BHOK2P2l.js} +1 -1
  270. package/dist/client/assets/use-pending-read-mVsOBTzn.js +1 -0
  271. package/dist/client/assets/{use-personality-commit-D5b90JPX.js → use-personality-commit-Chf3UX8P.js} +1 -1
  272. package/dist/client/assets/{use-promo-activation-CPAOQpfe.js → use-promo-activation-Dlw6bg7G.js} +2 -2
  273. package/dist/client/assets/{use-promo-dismissals-Bx1gz1R1.js → use-promo-dismissals-Dx_fli7I.js} +1 -1
  274. package/dist/client/assets/{use-pulse-freshness-DeulB37O.js → use-pulse-freshness-CG_I6a-O.js} +1 -1
  275. package/dist/client/assets/{use-room-follow-claim-Dwke6RFQ.js → use-room-follow-claim-Bgrpr3bO.js} +1 -1
  276. package/dist/client/assets/{use-room-sessions-iepVrIMm.js → use-room-sessions-DecGrP3E.js} +1 -1
  277. package/dist/client/assets/{use-roving-tab-list-pCPKNQKv.js → use-roving-tab-list-CDkh-Ujm.js} +1 -1
  278. package/dist/client/assets/{use-session-canvas-BvvO-_V1.js → use-session-canvas-tvLLPQcm.js} +6 -6
  279. package/dist/client/assets/{use-status-budget-Bs7MMriS.js → use-status-budget-BBl2yxLR.js} +2 -2
  280. package/dist/client/assets/{use-todos-C-eREuDS.js → use-todos-BzRauzdQ.js} +1 -1
  281. package/dist/client/assets/{use-transform-lj3TkjYO.js → use-transform-DzJeHpxm.js} +1 -1
  282. package/dist/client/assets/{use-unclaimed-chats-BF3-0jHC.js → use-unclaimed-chats--HZdmq4F.js} +1 -1
  283. package/dist/client/assets/use-update-config-DjL7-nUR.js +1 -0
  284. package/dist/client/assets/{useMutationState-B_x_4f2K.js → useMutationState-DIywUTDG.js} +1 -1
  285. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-DBsRYa4J.js → usecaseDiagram-WPOLBNNX-C9aLJ03F.js} +1 -1
  286. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-rFAXvcQI.js → vennDiagram-Q3Y3IDCW-ChBIWbL0.js} +1 -1
  287. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-bI0JZkO3.js → wardleyDiagram-IVAIDKWA-DvQDOaTm.js} +1 -1
  288. package/dist/client/assets/{xychartDiagram-4URNHDU4-DZUd8iln.js → xychartDiagram-4URNHDU4-8FxLPP2c.js} +1 -1
  289. package/dist/client/assets/zap-DSllMMHe.js +6 -0
  290. package/dist/client/index.html +2 -2
  291. package/dist/drizzle/20261104060919_package_approval_request.sql +1 -0
  292. package/dist/drizzle/20261104081935_hook_decline_review.sql +3 -0
  293. package/dist/drizzle/20261107183323_dor3933_todos_rename.sql +64 -0
  294. package/dist/drizzle/20261108014418_dor3938_cross_agent_writer.sql +4 -0
  295. package/dist/drizzle/meta/20261104060919_snapshot.json +14889 -0
  296. package/dist/drizzle/meta/20261104081935_snapshot.json +14910 -0
  297. package/dist/drizzle/meta/20261107183323_snapshot.json +14910 -0
  298. package/dist/drizzle/meta/20261108014418_snapshot.json +14938 -0
  299. package/dist/drizzle/meta/_journal.json +28 -0
  300. package/dist/server/index.js +24875 -21931
  301. package/dist/server/index.js.map +2 -2
  302. package/package.json +5 -5
  303. package/dist/client/assets/ApplyToOverridesDialog-DE9VVQCA.js +0 -1
  304. package/dist/client/assets/BindingDialog-C_yflKOE.js +0 -1
  305. package/dist/client/assets/CanvasFileContent-C3ZKszxn.js +0 -2
  306. package/dist/client/assets/CanvasModel3dContent-CsNUuaj6.js +0 -2
  307. package/dist/client/assets/CommitmentList-DOvfnyDA.js +0 -1
  308. package/dist/client/assets/CommitmentsPage-D81vxHUk.js +0 -1
  309. package/dist/client/assets/HandlePage-vsG04kBg.js +0 -1
  310. package/dist/client/assets/HeartbeatPage-CMj1SS30.js +0 -1
  311. package/dist/client/assets/NamePage-DdX2yQ5f.js +0 -1
  312. package/dist/client/assets/PermissionHistory-Bhl2kr1R.js +0 -1
  313. package/dist/client/assets/PermissionsPage-DUbenFkt.js +0 -1
  314. package/dist/client/assets/PhotoPage-CExABoHA.js +0 -1
  315. package/dist/client/assets/TaskDialogWrapper-BVb8gAr0.js +0 -1
  316. package/dist/client/assets/TasksEmptyState-RkUEEU2r.js +0 -3
  317. package/dist/client/assets/WorkView-BDk_vwu3.js +0 -51
  318. package/dist/client/assets/_shell-CMNFxZKJ.js +0 -80
  319. package/dist/client/assets/_shell._home.index-BjR-d3_s.js +0 -3
  320. package/dist/client/assets/_shell._home.tasks-CqURPMQD.js +0 -1
  321. package/dist/client/assets/_shell.connections-D3gJrBTQ.js +0 -1
  322. package/dist/client/assets/_shell.marketplace-HdefWdN_.js +0 -1
  323. package/dist/client/assets/_shell.marketplace_.sources-wAZKfDQF.js +0 -1
  324. package/dist/client/assets/_shell.session-C0utZeSI.js +0 -1
  325. package/dist/client/assets/_shell.threads-TvzYRNMt.js +0 -1
  326. package/dist/client/assets/_shell.todos-sOFmsIPE.js +0 -6
  327. package/dist/client/assets/_shell.x._extensionId-DiEQZIvl.js +0 -1
  328. package/dist/client/assets/_shell.x._extensionId_._-DiEQZIvl.js +0 -1
  329. package/dist/client/assets/channel-B0WiEIVe.js +0 -1
  330. package/dist/client/assets/index-BwTGkJbK.js +0 -1071
  331. package/dist/client/assets/index-CCHGVclj.js +0 -1
  332. package/dist/client/assets/index-CiUmx-i3.js +0 -1
  333. package/dist/client/assets/index-Dd4JoHFP.js +0 -1
  334. package/dist/client/assets/index-DlmGvYpy.js +0 -1
  335. package/dist/client/assets/index-EXJsA5kw.js +0 -1
  336. package/dist/client/assets/index-MpS13vhQ.css +0 -1
  337. package/dist/client/assets/registry-BQTcAm5U.js +0 -39
  338. package/dist/client/assets/registry-HencHRXy.js +0 -1
  339. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-nJfOIWYW.js +0 -8
  340. package/dist/client/assets/use-direct-message-panel-B3qfpDjY.js +0 -1
  341. package/dist/client/assets/use-is-below-desktop-BXHT3oPL.js +0 -1
  342. package/dist/client/assets/use-local-browser-DDWknHZE.js +0 -1
  343. package/dist/client/assets/use-pending-read-uvmEJ7H9.js +0 -1
  344. package/dist/client/assets/use-update-config-D-OGlXGR.js +0 -1
@@ -1 +1 @@
1
- import{a5 as S,a6 as z,iL as h,iM as g,a7 as w,a8 as $,dS as M,ar as I,j as e,r as d,U as O,G as N,B as j,a4 as U,iN as y,bP as q,bQ as K,bR as Q,bS as W,bT as G,bU as Y,bV as J,bX as V,h as H,l as E,eE as X,a3 as Z,e as A,eH as ee,iO as se,h3 as R,a2 as L}from"./index-BwTGkJbK.js";import{B as P}from"./banner-B8iMuXCP.js";import{I as C}from"./inline-code-DyTKSC5b.js";import{P as T}from"./package-DBsl3ao5.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 _(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:_(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 $({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 $({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(U,{"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 Ae(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 $e="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:$e}),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(K,{children:[e.jsxs(Q,{children:[e.jsxs(W,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(G,{children:Ae(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(Y,{children:[e.jsx(J,{children:"Cancel"}),e.jsx(V,{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(A,{className:"h-3 w-32"}),e.jsx(A,{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(T,{"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(X,{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},_(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 Te({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 _e({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(Te,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(_e,{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(T,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function Ke({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{Ke as SkillsPage};
1
+ import{a5 as S,a6 as z,ik as h,il as g,a7 as w,a8 as $,dR as M,ar as I,j as e,r as d,U as O,G as N,B as j,a4 as U,im as y,bO as W,bP as q,bQ as K,bR as Q,bS as G,bT as Y,bU as J,bW as V,h as H,l as R,eL as X,a3 as Z,e as A,eO as ee,io as se,h3 as E,a2 as L}from"./index-BR1m9FON.js";import{B as P}from"./banner-CSKUrrI0.js";import{I as C}from"./inline-code-mh48Uhbi.js";import{P as T}from"./package-BhKXbvU_.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 _(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:_(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 $({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 $({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(U,{"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 Ae(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 $e="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:$e}),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(W,{open:c,onOpenChange:u,children:e.jsxs(q,{children:[e.jsxs(K,{children:[e.jsxs(Q,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(G,{children:Ae(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(Y,{children:[e.jsx(J,{children:"Cancel"}),e.jsx(V,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const He=se("/guides/cli-usage#agent-files");function Re(){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(A,{className:"h-3 w-32"}),e.jsx(A,{className:"h-3 w-48"})]},s))})]})}function Ee({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(Re,{});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({...R.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(T,{"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(X,{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},_(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(E,{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 Te({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 _e({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(E,{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(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Te,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(_e,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...R.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(T,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function qe({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{qe as SkillsPage};
@@ -0,0 +1 @@
1
+ import{bg as I,b0 as F,r as i,aZ as c,c$ as R,b3 as P,j as e,Z as O,_ as B,d0 as M,d1 as W,d2 as L,d3 as Z,d4 as z,d5 as H,d6 as _,d7 as $}from"./index-BR1m9FON.js";import{F as q}from"./FeatureDisabledState-Bi23k3rg.js";import{i as G}from"./registry-jD9zw538.js";import{T as J,C as S}from"./TasksEmptyState-B3SjsxQa.js";import"./copy-button-BOznikwM.js";import"./inline-code-mh48Uhbi.js";import"./zap-DSllMMHe.js";import"./form-BL14vwyB.js";import"./trust-dial-D__tIhzt.js";import"./command-CaUEAy3b.js";import"./AgentPicker-BDci-9aL.js";import"./AgentOptionRow-ApuDEKqq.js";import"./execution-config-BS5rtvTZ.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./list-runtime-types-DLmjtBMq.js";import"./format-cron-meJMgYNe.js";function K(){const r=I(),{data:n=[],isLoading:m}=F(r),[h,a]=i.useState(!1),[g,l]=i.useState(),[f,w]=i.useState(null),[v,u]=i.useState(null),t=c(s=>s.tasksAgentFilter),j=c(s=>s.setTasksAgentFilter),p=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),x=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(!p||m)return;const s=n.find(d=>d.id===p);s&&(l(s),a(!0)),b(null)},[p,n,m,b]);const k=i.useMemo(()=>{var s;return t?((s=x.get(t))==null?void 0:s.name)??t:null},[t,x]),{externalTrigger:y}=P();i.useEffect(()=>{y&&(l(void 0),a(!0))},[y]);const A=s=>{u(s),l(void 0),a(!0)},T=()=>{u(null),l(void 0),a(!0)},D=s=>{a(s),s||u(null)};return r?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:()=>{l(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?x.get(s.agentId)??null:null,expanded:f===s.id,onToggleExpand:()=>w(f===s.id?null:s.id),onEdit:()=>{l(s),a(!0)}})},s.id))})}),e.jsx(S,{open:h,onOpenChange:a,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsx(q,{icon:G.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:r,onClear:n}){return e.jsx(W,{onRemove:n,removeLabel:"Clear agent filter",children:r??"Agent"})}function me({open:r,onOpenChange:n}){return e.jsx(L,{open:r,onOpenChange:n,children:e.jsxs(Z,{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(_,{className:"text-sm font-medium",children:"Scheduled tasks"}),e.jsx($,{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(K,{})})]})})}export{me as TasksDialogWrapper};
@@ -0,0 +1,3 @@
1
+ import{r as m,ej as Ve,j as e,a3 as fe,G as Y,I as Be,ew as q,ex as U,ey as G,ez as K,eA as L,Z as le,_ as ce,iV as de,iW as ue,e2 as Re,an as We,J as me,eL as R,e as ge,ak as qe,al as Ue,am as Ge,iX as Ke,a5 as Ye,ep as xe,a6 as He,iY as Qe,eu as ne,ev as Xe,iZ as Ze,a4 as Je,i_ as Ee,i$ as Me,j0 as es,j1 as ss,j2 as ts,B as W,$ as ns,h3 as je,a2 as ve,eJ as rs,h2 as as,d$ as os,fL as is,j3 as ls,j4 as cs,c3 as ds,aO as us,y as ms,h4 as hs,h5 as fs,b0 as xs,b3 as ps,d2 as gs,d3 as js,d5 as vs,em as ys,d6 as bs,d7 as Ns,h0 as ws,fM as Ss,fN as Cs,fO as ks,fP as Rs,fQ as Es,fR as Ms}from"./index-BR1m9FON.js";import{a as Os,u as As}from"./form-BL14vwyB.js";import{a as Fs}from"./trust-dial-D__tIhzt.js";import{C as Ds,a as $s,b as Ls,c as zs,d as ye,e as he}from"./command-CaUEAy3b.js";import{A as Is}from"./AgentPicker-BDci-9aL.js";import{d as _s,k as Ps,e as be}from"./execution-config-BS5rtvTZ.js";import{s as Ts}from"./settings-for-runtime-BoOa-ZFG.js";import{l as Vs}from"./list-runtime-types-DLmjtBMq.js";import{f as Bs,u as Ws}from"./format-cron-meJMgYNe.js";const I=(s,r=i=>i,t)=>Os(s,r,{compare:t});function qs(){const[s,r]=m.useState({x:0,y:0}),[t,i]=m.useState(!1),a=Ve(),l=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(hover: none)").matches,c=a||l,d=m.useCallback(x=>{if(c)return;const j=x.currentTarget.getBoundingClientRect();r({x:x.clientX-j.left,y:x.clientY-j.top}),i(!0)},[c]),h=m.useCallback(()=>{i(!1)},[]),v=!c&&t?{background:`radial-gradient(350px circle at ${s.x}px ${s.y}px, rgba(59,130,246,0.06), transparent 80%)`}:void 0;return{position:s,isActive:t,onMouseMove:d,onMouseLeave:h,spotlightStyle:v}}function Us({preset:s,variant:r,checked:t,onCheckedChange:i,onSelect:a,selected:l=!1,className:c}){const{onMouseMove:d,onMouseLeave:h,spotlightStyle:v}=qs(),x=()=>{r==="toggle"?i==null||i(!t):a==null||a(s)};return e.jsxs("button",{type:"button",onClick:x,onMouseMove:d,onMouseLeave:h,"aria-label":`${s.name}: ${s.description}`,className:Y("relative flex w-full items-start gap-4 rounded-lg border p-4 text-left transition","hover:bg-accent/50 focus-ring","min-h-11",r==="toggle"&&t&&"border-primary/40 bg-accent/30",r==="selectable"&&l&&"border-primary ring-primary bg-accent/30 ring-1",c),children:[v&&e.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-lg",style:v}),r==="toggle"&&e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center",children:e.jsx(fe,{checked:t??!1,onCheckedChange:i,"aria-label":`Enable ${s.name}`,onClick:j=>j.stopPropagation()})}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-muted-foreground text-sm",children:s.description}),e.jsx("p",{"aria-hidden":"true",className:"text-muted-foreground text-xs",children:Bs(s.cron)}),e.jsx("p",{"aria-hidden":"true",className:"text-muted-foreground/80 line-clamp-2 text-sm",children:s.prompt})]})]})}function Oe({onSelect:s,selectedId:r,className:t}){const{data:i,isLoading:a,isError:l}=Ws();return a?e.jsx("div",{className:Y("grid grid-cols-2 gap-3",t),children:[0,1,2,3].map(c=>e.jsx("div",{className:"bg-muted animate-breath h-28 rounded-lg border"},c))}):l?e.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load ready-made tasks. Start from scratch instead."}):!i||i.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No ready-made tasks yet."}):e.jsx("div",{className:Y("grid grid-cols-2 gap-3",t),children:i.map(c=>e.jsx(Us,{preset:c,variant:"selectable",selected:c.id===r,onSelect:s},c.id))})}const B={frequency:"daily",hour:9,days:[1,2,3,4,5],dayOfMonth:1},Gs=[{value:"15m",label:"Every 15 minutes"},{value:"hourly",label:"Every hour"},{value:"daily",label:"Every day"},{value:"weekly",label:"Every week"},{value:"monthly",label:"Every month"}],Ks=[{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"},{value:0,label:"Sun"}],Ys=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Hs=[1,2,3,4,5],Qs=[0,6];function Ne(s){const r=s.trim();if(!r)return null;const t=r.split(/\s+/);if(t.length!==5)return null;const[i,a,l,c,d]=t;if(c!=="*")return null;if(i==="*/15"&&a==="*"&&l==="*"&&d==="*")return{...B,frequency:"15m"};if(i!=="0")return null;if(a==="*"&&l==="*"&&d==="*")return{...B,frequency:"hourly"};const h=Number(a);if(!Number.isInteger(h)||h<0||h>23)return null;if(l!=="*"&&d==="*"){const v=Number(l);return!Number.isInteger(v)||v<1||v>31?null:{...B,frequency:"monthly",hour:h,dayOfMonth:v}}if(l==="*"&&d==="*")return{...B,frequency:"daily",hour:h};if(l==="*"&&d!=="*"){const v=Xs(d);return v?{...B,frequency:"weekly",hour:h,days:v}:null}return null}function Xs(s){const r=[];for(const t of s.split(",")){const i=t.match(/^(\d)-(\d)$/);if(i){const a=Number(i[1]),l=Number(i[2]);if(a>6||l>6||a>l)return null;for(let c=a;c<=l;c++)r.push(c)}else{const a=Number(t);if(!Number.isInteger(a)||a<0||a>6)return null;r.push(a)}}return r.length>0?r.sort((t,i)=>t-i):null}function we(s){switch(s.frequency){case"15m":return"*/15 * * * *";case"hourly":return"0 * * * *";case"daily":return`0 ${s.hour} * * *`;case"weekly":return`0 ${s.hour} * * ${s.days.join(",")}`;case"monthly":return`0 ${s.hour} ${s.dayOfMonth} * *`}}function Ae(s){const r=s<12?"AM":"PM";return`${s%12||12}:00 ${r}`}function Fe(s){const r=s%100;if(r>=11&&r<=13)return`${s}th`;const t=s%10;return t===1?`${s}st`:t===2?`${s}nd`:t===3?`${s}rd`:`${s}th`}function Se(s,r){return s.length===r.length&&s.every((t,i)=>t===r[i])}function Zs(s){const r=Ae(s.hour);switch(s.frequency){case"15m":return"Runs every 15 minutes";case"hourly":return"Runs every hour, on the hour";case"daily":return`Runs every day at ${r}`;case"weekly":{const t=[...s.days].sort((c,d)=>c-d);if(Se(t,Hs))return`Runs every weekday at ${r}`;if(Se(t,Qs))return`Runs every Saturday and Sunday at ${r}`;const a=t.filter(c=>c!==0).concat(t.includes(0)?[0]:[]).map(c=>Ys[c]);if(a.length===1)return`Runs every ${a[0]} at ${r}`;if(a.length===2)return`Runs every ${a[0]} and ${a[1]} at ${r}`;const l=a.pop();return`Runs every ${a.join(", ")}, and ${l} at ${r}`}case"monthly":return`Runs on the ${Fe(s.dayOfMonth)} of every month at ${r}`}}const Js="Can’t read this timing. Check the format.";function oe(s){const r=s.trim();if(!r)return!0;try{return Re.toString(r),!0}catch{return!1}}function et(s){const r=s.trim();return r?oe(r)?Re.toString(r):Js:""}function st({value:s,onChange:r}){const t=Ne(s),[i,a]=m.useState(t?"simple":s.trim()?"cron":"simple"),[l,c]=m.useState(t??B),d=m.useRef(s);m.useEffect(()=>{if(s===d.current)return;d.current=s;const o=Ne(s);o?(a("simple"),c(o)):s.trim()&&a("cron")},[s]);function h(o){c(o);const g=we(o);d.current=g,r(g)}function v(o){h({...l,frequency:o})}function x(o){h({...l,hour:Number(o)})}function j(o){const g=l.days.includes(o);if(g&&l.days.length<=1)return;const w=g?l.days.filter(C=>C!==o):[...l.days,o].sort((C,N)=>C-N);h({...l,days:w})}function p(o){h({...l,dayOfMonth:Number(o)})}function k(){a("cron")}function S(){a("simple");const o=we(l);d.current=o,r(o)}const u=l.frequency!=="15m"&&l.frequency!=="hourly";return i==="cron"?e.jsxs("div",{className:"space-y-2",children:[e.jsx("button",{type:"button",onClick:S,className:"text-muted-foreground hover:text-foreground text-xs underline-offset-4 hover:underline",children:"Back to simple schedule"}),e.jsx(Be,{className:"font-mono",value:s,onChange:o=>r(o.target.value),placeholder:"0 9 * * 1-5"}),s.trim()&&e.jsx("p",{className:Y("text-xs",oe(s)?"text-muted-foreground":"text-destructive"),children:et(s)}),e.jsx("a",{href:"https://crontab.guru",target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground block text-xs hover:underline",children:"Learn about cron expressions"})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs(q,{value:l.frequency,onValueChange:v,children:[e.jsx(U,{"aria-label":"Frequency",children:e.jsx(G,{})}),e.jsx(K,{children:Gs.map(o=>e.jsx(L,{value:o.value,children:o.label},o.value))})]}),e.jsx(le,{initial:!1,mode:"wait",children:u&&e.jsx(ce.div,{variants:ue,initial:"initial",animate:"animate",exit:"exit",transition:de,className:"overflow-hidden",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground text-sm",children:"at"}),e.jsxs(q,{value:String(l.hour),onValueChange:x,children:[e.jsx(U,{className:"w-32","aria-label":"Time",children:e.jsx(G,{})}),e.jsx(K,{children:Array.from({length:24},(o,g)=>e.jsx(L,{value:String(g),children:Ae(g)},g))})]})]})},"time")}),e.jsx(le,{initial:!1,children:l.frequency==="weekly"&&e.jsx(ce.div,{variants:ue,initial:"initial",animate:"animate",exit:"exit",transition:de,className:"overflow-hidden",children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:Ks.map(o=>{const g=l.days.includes(o.value);return e.jsx("button",{type:"button","aria-label":o.label,"aria-pressed":g,className:Y("inline-flex min-h-11 items-center justify-center rounded-md border px-2.5 py-1 text-xs font-medium transition-colors md:min-h-0",g?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:bg-accent hover:text-accent-foreground"),onClick:()=>j(o.value),children:o.label},o.value)})})},"days")}),e.jsx(le,{initial:!1,children:l.frequency==="monthly"&&e.jsx(ce.div,{variants:ue,initial:"initial",animate:"animate",exit:"exit",transition:de,className:"overflow-hidden",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-muted-foreground text-sm",children:"on day"}),e.jsxs(q,{value:String(l.dayOfMonth),onValueChange:p,children:[e.jsx(U,{className:"w-20","aria-label":"Day of month",children:e.jsx(G,{})}),e.jsx(K,{children:Array.from({length:31},(o,g)=>e.jsx(L,{value:String(g+1),children:Fe(g+1)},g+1))})]})]})},"dom")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:Zs(l)}),e.jsx("button",{type:"button",onClick:k,className:"text-muted-foreground hover:text-foreground text-xs underline-offset-4 hover:underline",children:"Use a cron expression"})]})}function tt(s){const r=new Map;for(const t of s){const[i]=t.split("/");r.has(i)||r.set(i,[]),r.get(i).push(t)}return r}function nt({value:s,onChange:r}){const[t,i]=m.useState(!1),a=m.useRef(null),l=m.useMemo(()=>{try{return Intl.supportedValuesOf("timeZone")}catch{return[]}},[]),c=m.useMemo(()=>tt(l),[l]),d=m.useMemo(()=>Intl.DateTimeFormat().resolvedOptions().timeZone,[]);m.useEffect(()=>{if(!t)return;function x(j){a.current&&!a.current.contains(j.target)&&i(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[t]);const h=s||"System default";function v(x){r(x),i(!1)}return e.jsxs("div",{ref:a,className:"relative w-full",children:[e.jsxs("button",{type:"button","aria-expanded":t,"aria-haspopup":"listbox",className:Y("border-input ring-offset-background flex h-9 w-full items-center justify-between rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs transition-colors","focus-visible:ring-ring focus-visible:ring-1 focus-visible:outline-none","hover:bg-accent/50"),onClick:()=>i(x=>!x),children:[e.jsx("span",{className:"truncate",children:h}),e.jsx(We,{className:"ml-2 size-4 shrink-0 opacity-50"})]}),t&&e.jsx("div",{className:"bg-popover text-popover-foreground absolute top-full left-0 z-50 mt-1 w-full rounded-md border shadow-md",children:e.jsxs(Ds,{children:[e.jsx($s,{placeholder:"Search timezone…"}),e.jsxs(Ls,{className:"max-h-60",children:[e.jsx(zs,{children:"No timezone found."}),e.jsxs(ye,{heading:"Default",children:[e.jsxs(he,{value:"system-default",onSelect:()=>v(""),children:[e.jsx("span",{children:"System default"}),s===""&&e.jsx(me,{className:"ml-auto size-4"})]}),d&&e.jsxs(he,{value:`${d}-detected`,onSelect:()=>v(d),children:[e.jsxs("span",{children:[d," (detected)"]}),s===d&&e.jsx(me,{className:"ml-auto size-4"})]})]}),[...c.entries()].map(([x,j])=>e.jsx(ye,{heading:x,children:j.map(p=>e.jsxs(he,{value:p,onSelect:()=>v(p),children:[e.jsx("span",{children:p.replace(`${x}/`,"").replace(/_/g," ")}),p===s&&e.jsx(me,{className:"ml-auto size-4"})]},p))},x))]})]})})]})}function rt({roster:s,value:r}){const t="flex h-9 w-full items-center gap-2 text-sm";if(!r)return e.jsx("p",{"data-testid":"settled-agent",className:`${t} text-muted-foreground`,children:"No agent"});if(s.unreadable)return e.jsx("p",{"data-testid":"settled-agent",className:`${t} text-muted-foreground`,children:"Couldn’t load your agents to show this one."});if(!s.answered)return e.jsxs("div",{"data-testid":"settled-agent-loading",className:t,"aria-hidden":!0,children:[e.jsx(ge,{className:"size-5 rounded-full"}),e.jsx(ge,{className:"h-4 w-32"})]});const i=s.agents.find(l=>l.id===r);if(!i)return e.jsx("p",{"data-testid":"settled-agent",className:`${t} text-muted-foreground`,children:"This agent isn’t registered any more."});const a=qe(i);return e.jsxs("p",{"data-testid":"settled-agent",className:t,children:[e.jsx(Ue,{color:a.color,emoji:a.emoji,size:"xs"}),e.jsx("span",{className:"truncate",children:Ge(i)})]})}function at({roster:s,value:r,locked:t,onChange:i}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{children:"Agent"}),t?e.jsxs(e.Fragment,{children:[e.jsx(rt,{roster:s,value:r}),e.jsx("p",{"data-testid":"agent-locked-note",className:"text-muted-foreground text-xs leading-relaxed",children:"The agent is set once. For another agent, make a new task."})]}):e.jsx(Is,{agents:s.agents,value:r||void 0,onValueChange:a=>i(a??"")})]})}function De(s,r){var c,d;const t=s.map(h=>h.projectPath).join(`
2
+ `),i=m.useMemo(()=>t?t.split(`
3
+ `):[],[t]),{data:a}=Ke(i),l=r?(c=s.find(h=>h.id===r))==null?void 0:c.projectPath:void 0;return l?((d=a==null?void 0:a[l])==null?void 0:d.runtime)??null:null}const $="__inherit__";function ot(s){var P;const{runtime:r,model:t,effort:i,agentRuntime:a}=s,l=Ye(),{data:c}=xe(),d=c?Object.keys(c.capabilities):void 0,h=(c==null?void 0:c.defaultRuntime)??null,x=(y=>y!==null&&d!==void 0&&d.includes(y))(a),j=x?a:h,p=r||j,k=p??void 0,S=k!==void 0&&d!==void 0&&d.includes(k),{data:u}=He({...Qe(l,k?{runtime:k}:{}),enabled:S,retry:!1}),o=t?u==null?void 0:u.find(y=>y.value===t):void 0,g=(P=Ts(c,p))==null?void 0:P.supportsEffort,w=p?_s({agent:{runtime:p,model:t||null,effort:i||null},defaultRuntime:p,knownRuntimes:d,knownModels:Ps(u),modelSupportsEffort:o?o.supportsEffort??!1:void 0,runtimeSupportsEffort:g,runtimeLabel:y=>ne(y).label}):null,C=y=>{var b;return((b=w==null?void 0:w.breakages.find(O=>y.includes(O.kind)))==null?void 0:b.message)??null},N=d==null?void 0:d.join(","),_=m.useMemo(()=>{const y=N===void 0?[]:N.split(",").filter(Boolean),b=Vs(y).filter(O=>y.includes(O));return r&&!b.includes(r)&&b.push(r),b.map(O=>({value:O,label:ne(O).label}))},[N,r]),F=m.useMemo(()=>{const y=(u??[]).map(b=>({value:b.value,label:b.displayName}));return t&&!y.some(b=>b.value===t)&&y.push({value:t,label:t}),y},[u,t]),H=m.useMemo(()=>{const y=Xe.filter(b=>!(o!=null&&o.supportedEffortLevels)||o.supportedEffortLevels.includes(b)).map(b=>({value:b,label:be(b)}));return i&&!y.some(b=>b.value===i)&&y.push({value:i,label:be(i)}),y},[o,i]),D=j===null?"Same as agent":x?`Same as agent (${ne(j).label})`:`Server default (${ne(j).label})`;return{effectiveRuntime:p,runtimeOptions:_,inheritRuntimeLabel:D,modelOptions:F,supportsEffort:g===!0,effortOptions:H,runtimeWarning:C(["runtime-not-connected"]),modelWarning:C(["model-unavailable"]),effortWarning:C(["effort-unsupported-runtime","effort-unsupported-model"])}}const re="text-xs text-status-warning-fg";function it({runtime:s,model:r,effort:t,execution:i,onRuntimeChange:a,onModelChange:l,onEffortChange:c}){const{runtimeOptions:d,inheritRuntimeLabel:h,modelOptions:v,supportsEffort:x,effortOptions:j,runtimeWarning:p,modelWarning:k,effortWarning:S}=i;return e.jsxs("fieldset",{className:"space-y-3",children:[e.jsx("legend",{className:"mb-1.5 text-sm font-medium",children:"Runs on"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{htmlFor:"schedule-runtime",children:"Runs on"}),e.jsxs(q,{value:s||$,onValueChange:u=>a(u===$?"":u),children:[e.jsx(U,{id:"schedule-runtime",responsive:!1,className:"text-sm","data-testid":"task-runtime-select",children:e.jsx(G,{})}),e.jsxs(K,{children:[e.jsx(L,{value:$,children:h}),d.map(u=>e.jsx(L,{value:u.value,children:u.label},u.value))]})]}),p&&e.jsx("p",{"data-testid":"task-runtime-warning",className:re,children:p})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{htmlFor:"schedule-model",children:"Model"}),e.jsxs(q,{value:r||$,onValueChange:u=>l(u===$?"":u),children:[e.jsx(U,{id:"schedule-model",responsive:!1,className:"text-sm","data-testid":"task-model-select",children:e.jsx(G,{})}),e.jsxs(K,{children:[e.jsx(L,{value:$,children:"Agent default"}),v.map(u=>e.jsx(L,{value:u.value,children:u.label},u.value))]})]}),k&&e.jsx("p",{"data-testid":"task-model-warning",className:re,children:k})]}),x?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{htmlFor:"schedule-effort",children:"Effort"}),e.jsxs(q,{value:t||$,onValueChange:u=>c(u===$?"":u),children:[e.jsx(U,{id:"schedule-effort",responsive:!1,className:"text-sm","data-testid":"task-effort-select",children:e.jsx(G,{})}),e.jsxs(K,{children:[e.jsx(L,{value:$,children:"Agent default"}),j.map(u=>e.jsx(L,{value:u.value,children:u.label},u.value))]})]}),S&&e.jsx("p",{"data-testid":"task-effort-warning",className:re,children:S})]}):t&&e.jsxs("div",{className:"space-y-1.5","data-testid":"task-effort-stranded",children:[e.jsx(R,{children:"Effort"}),e.jsx("p",{className:re,children:S??"No effort setting here, so this does nothing."}),e.jsx("button",{type:"button",onClick:()=>c(""),className:"focus-ring text-status-warning-fg rounded-sm text-xs underline-offset-2 hover:underline","data-testid":"task-effort-clear",children:"Clear it"})]})]})}function lt(s){return s.asks!=="never"&&s.id!==Ze}function ct(){return e.jsxs("div",{role:"note","data-testid":"task-unattended-warning",className:"bg-status-warning-bg border-status-warning-border text-status-warning-fg flex gap-2 rounded-md border px-2.5 py-2 text-xs leading-relaxed",children:[e.jsx(Je,{className:"mt-0.5 size-5 shrink-0 sm:size-3.5","aria-hidden":!0}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"Nobody is there to approve asks on a scheduled run."}),e.jsx("p",{children:"Each ask is refused, so the run will need attention."}),e.jsx("p",{children:"Use Never ask with an allow list for the commands it needs."}),e.jsx("p",{children:"“Run now” still asks you."})]})]})}const ae="10m";function dt(s){return`${Math.round(s/6e4)}m`}function T(s,r,t,i="acceptEdits"){return s?{name:s.name,description:s.description??"",prompt:s.prompt,cron:s.cron??"",agentId:s.agentId??"",timezone:s.timezone??"",permissionMode:s.permissionMode,maxRuntime:s.maxRuntime?dt(s.maxRuntime):ae,sticky:s.sticky,runtime:s.runtime??"",model:s.model??"",effort:s.effort??""}:r?{name:r.name,description:r.description,prompt:r.prompt,cron:r.cron,agentId:t??"",timezone:r.timezone??"",permissionMode:i,maxRuntime:ae,sticky:!1,runtime:"",model:"",effort:""}:{name:"",description:"",prompt:"",cron:"",agentId:t??"",timezone:"",permissionMode:i,maxRuntime:ae,sticky:!1,runtime:"",model:"",effort:""}}function Ce(s){const r=s.cron.trim();return{name:s.name.trim(),description:s.description.trim(),prompt:s.prompt.trim(),cron:r||null,...r&&s.timezone?{timezone:s.timezone}:{},permissionMode:s.permissionMode,maxRuntime:s.maxRuntime.trim()||void 0,sticky:s.sticky,runtime:s.runtime||null,model:s.model||null,effort:s.effort||null}}function ut(s,r){const t=Ce(s),i=Ce(r);return Object.fromEntries(Object.entries(i).filter(([a,l])=>l!==t[a]))}const $e=100;function mt(s,r=[]){const t=new Set([...r].map(a=>a.toLowerCase())),i=s.name.trim();for(let a=1;;a++){const l=a===1?"-copy":`-copy-${a}`,c=`${i.slice(0,$e-l.length)}${l}`;if(!t.has(c.toLowerCase()))return{...s,name:c}}}const ht={record:["This schedule came with a package. Only the package can change what it does.","You can still turn it on or off, or change when it runs."],legacy:["This schedule came with a package from an older DorkOS.","DorkOS can’t yet tell its files from yours.","You can still turn it on or off, or change when it runs.","To edit the rest, choose Check files on its package in Marketplace › Installed."]};function ke(s){var t;const r=s;return(r==null?void 0:r.code)!==ls?null:{message:r.message,ownedBy:((t=r.body)==null?void 0:t.ownedBy)==="legacy"?"legacy":"record"}}function ft({defaultValues:s,roster:r,editTask:t,onSubmitSuccess:i,onCancel:a,onDeleteClick:l,isPending:c,onMakeCopy:d,leading:h}){var ee,se;const v=Ee(),x=m.useRef(!0);m.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]);const j=Me({isShownInline:n=>x.current&&ke(n)!==null}),p=t?ke(j.error):null,k=(t==null?void 0:t.packageOwned)??null,S=k??(p==null?void 0:p.ownedBy)??null,u=k!==null,o=As({defaultValues:s,onSubmit:({value:n})=>{const f=n.agentId.trim()||void 0,A=n.cron.trim();if(t){const M=ut(s,n);if(Object.keys(M).length===0){i();return}j.mutate({id:t.id,...M},{onSuccess:i})}else{const M=f??"global",te={name:n.name.trim(),description:n.description.trim()||n.name.trim(),prompt:n.prompt.trim(),target:M,cron:A||void 0,...A&&n.timezone?{timezone:n.timezone}:{},permissionMode:n.permissionMode,maxRuntime:n.maxRuntime.trim()||void 0,...n.sticky?{sticky:!0}:{},...n.runtime?{runtime:n.runtime}:{},...n.model?{model:n.model}:{},...n.effort?{effort:n.effort}:{}};v.mutate(te,{onSuccess:i})}}}),g=I(o.store,n=>n.values.agentId),w=I(o.store,n=>n.values.runtime),C=I(o.store,n=>n.values.model),N=I(o.store,n=>n.values.effort),_=I(o.store,n=>n.values.permissionMode),F=I(o.store,n=>n.values.cron),[H,D]=m.useState(!!s.cron),[P,y]=m.useState(!1),b=I(o.store,n=>n.values.maxRuntime),O=I(o.store,n=>n.values.sticky),z=[w!=="",C!=="",N!=="",b!==ae,O,es(_)].filter(Boolean).length,J=De(r.agents,g),V=ot({runtime:w,model:C,effort:N,agentRuntime:J}),{data:Q}=xe(),X=(V.effectiveRuntime?(se=(ee=Q==null?void 0:Q.capabilities[V.effectiveRuntime])==null?void 0:ee.permissionModes)==null?void 0:se.values:void 0)??[];return e.jsxs(o.AppForm,{children:[e.jsx("form",{onSubmit:n=>{n.preventDefault(),o.handleSubmit()},id:"schedule-form",className:"min-h-0 flex-1 overflow-y-auto",children:e.jsxs("div",{className:"space-y-5 px-4 py-5",children:[t&&ss(t)&&e.jsx(ts,{}),S!==null&&e.jsxs("div",{role:"status","data-slot":"package-owned-notice",className:"bg-muted/40 space-y-2 rounded-md border px-3 py-2 text-xs",children:[p?e.jsx("p",{children:p.message}):ht[S].map(n=>e.jsx("p",{children:n},n)),S==="record"&&d&&e.jsxs(W,{type:"button",variant:"outline",size:"xs",onClick:()=>d(o.state.values),children:[e.jsx(ns,{}),"Make a copy"]})]}),h,e.jsx(at,{roster:r,value:g,locked:t!==void 0,onChange:n=>o.setFieldValue("agentId",n)}),e.jsxs("fieldset",{disabled:u,className:"min-w-0 space-y-5",children:[e.jsx(o.AppField,{name:"name",children:n=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{htmlFor:"schedule-name",children:"Name *"}),e.jsx("input",{id:"schedule-name",className:"border-input focus-visible:ring-ring disabled:bg-muted/40 w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:ring-1 focus-visible:outline-none disabled:cursor-default",value:n.state.value,onChange:f=>n.handleChange(f.target.value),onBlur:n.handleBlur,maxLength:$e,placeholder:"Daily code review"}),n.state.meta.isTouched&&n.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(n.state.meta.errors[0])})]})}),e.jsx(o.AppField,{name:"description",children:n=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{htmlFor:"schedule-description",children:"Description *"}),e.jsx("input",{id:"schedule-description",className:"border-input focus-visible:ring-ring disabled:bg-muted/40 w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:ring-1 focus-visible:outline-none disabled:cursor-default",value:n.state.value,onChange:f=>n.handleChange(f.target.value),onBlur:n.handleBlur,placeholder:"A short description of this schedule"}),n.state.meta.isTouched&&n.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(n.state.meta.errors[0])})]})}),e.jsx(o.AppField,{name:"prompt",children:n=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{htmlFor:"schedule-prompt",children:"Prompt *"}),e.jsx("textarea",{id:"schedule-prompt",className:"border-input focus-visible:ring-ring disabled:bg-muted/40 w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:ring-1 focus-visible:outline-none disabled:cursor-default",value:n.state.value,onChange:f=>n.handleChange(f.target.value),onBlur:n.handleBlur,rows:4,placeholder:"Review all pending PRs and summarize findings…"}),n.state.meta.isTouched&&n.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(n.state.meta.errors[0])})]})})]}),e.jsx(je,{open:H,onOpenChange:D,trigger:"Schedule",badge:e.jsx(ve,{variant:"secondary",className:"text-xs",children:F?"On a schedule":"Optional"}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(o.AppField,{name:"cron",children:n=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{children:"When it runs"}),e.jsx(st,{value:n.state.value,onChange:f=>n.handleChange(f)})]})}),e.jsx(o.AppField,{name:"timezone",children:n=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{children:"Timezone"}),e.jsx(nt,{value:n.state.value,onChange:f=>n.handleChange(f)})]})})]})}),e.jsx(o.Subscribe,{selector:n=>!oe(n.values.cron),children:n=>n?e.jsx("p",{role:"alert","data-testid":"cron-blocks-save",className:"text-destructive text-xs",children:"Fix the timing under Schedule before saving."}):null}),e.jsx(je,{open:P,onOpenChange:y,trigger:"Advanced settings",badge:z>0?e.jsxs(ve,{variant:"secondary",className:"text-xs",children:[z," changed"]}):void 0,children:e.jsxs("fieldset",{disabled:u,className:"min-w-0 space-y-4",children:[e.jsx(it,{runtime:w,model:C,effort:N,execution:V,onRuntimeChange:n=>o.setFieldValue("runtime",n),onModelChange:n=>o.setFieldValue("model",n),onEffortChange:n=>o.setFieldValue("effort",n)}),e.jsx(o.AppField,{name:"permissionMode",children:n=>{const f=X.find(M=>M.id===n.state.value),A=(f==null?void 0:f.label)??rs(n.state.value);return X.length===0?e.jsxs("fieldset",{className:"space-y-2",children:[e.jsx("legend",{className:"mb-1.5 text-sm font-medium",children:"Permissions"}),e.jsxs("p",{"data-testid":"trust-dial-unavailable",className:"text-muted-foreground px-1 text-xs leading-relaxed",children:["Set to “",A,"”. No other options to choose yet. Saving keeps it."]})]}):e.jsxs("fieldset",{className:"space-y-2",children:[e.jsx("legend",{className:"mb-1.5 text-sm font-medium",children:"Permissions"}),e.jsx(Fs,{mode:n.state.value,descriptors:X,onChangeMode:M=>n.handleChange(M),strandsWorkingMode:!0,strandedNote:e.jsxs(e.Fragment,{children:["Set to “",A,"”, which isn’t listed. Saving keeps it. Pick a stop to change it."]})}),f!==void 0&&lt(f)&&e.jsx(ct,{}),e.jsx(as,{mode:n.state.value,...f?{descriptor:f}:{},className:"px-1"})]})}}),e.jsx(o.AppField,{name:"maxRuntime",children:n=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{htmlFor:"schedule-max-runtime",children:"Stop after"}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Ends the run if it takes longer."}),e.jsx("input",{id:"schedule-max-runtime",className:"border-input focus-visible:ring-ring disabled:bg-muted/40 w-24 rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs focus-visible:ring-1 focus-visible:outline-none disabled:cursor-default",value:n.state.value,onChange:f=>n.handleChange(f.target.value),onBlur:n.handleBlur,placeholder:"10m"})]})}),e.jsx(o.AppField,{name:"sticky",children:n=>e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(R,{htmlFor:"schedule-sticky",children:"Remember the last run"}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Pick up where the last run left off. Off starts fresh each time."})]}),e.jsx(fe,{id:"schedule-sticky",checked:n.state.value,onCheckedChange:f=>n.handleChange(f)})]})})]})})]})}),e.jsxs(os,{className:"shrink-0 border-t px-4 py-3",children:[t&&e.jsxs(W,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive mr-auto",onClick:l,children:[e.jsx(is,{className:"mr-1.5 size-4"}),"Delete"]}),e.jsx(W,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsx(o.Subscribe,{selector:n=>n.values.name.trim()!==""&&n.values.prompt.trim()!==""&&oe(n.values.cron),children:n=>e.jsx(W,{type:"submit",size:"sm",form:"schedule-form",disabled:!n||c,children:c?"Saving…":t?"Save":"Create task"})})]})]})}function St({open:s,onOpenChange:r,editTask:t,initialPreset:i,initialAgentId:a}){var pe;const l=cs(),c=Me(),d=Ee(),{data:h,isError:v}=ds(),x={agents:(h==null?void 0:h.agents)??[],answered:h!==void 0,unreadable:v},{data:j}=xe(),p=De(x.agents,a),S=p!==null&&j!==void 0&&Object.hasOwn(j.capabilities,p)?p:(j==null?void 0:j.defaultRuntime)??null,{data:u}=us(),o=ms(S),g=hs(S?fs(u==null?void 0:u.executionDefaults,S):null,((pe=o==null?void 0:o.permissionModes)==null?void 0:pe.values)??[]),w=m.useRef(g);m.useLayoutEffect(()=>{w.current=g},[g]);const[C,N]=m.useState(()=>t?"form":"preset-picker"),[_,F]=m.useState(null),[H,D]=m.useState(!1),[P,y]=m.useState((t==null?void 0:t.enabled)??!0),[b,O]=m.useState(!1),z=b?void 0:t,[J,V]=m.useState(!0),{data:Q}=xs(),[X,ee]=m.useState(()=>T(t,void 0,a,g)),[se,n]=m.useState(0);function f(E,ie=!1){ee(E),n(Z=>Z+1),O(ie)}m.useEffect(()=>{if(!s){f(T(t,void 0,a,w.current)),F(null),D(!1),N(t?"form":"preset-picker");return}t?(f(T(t)),y(t.enabled),N("form")):i?(f(T(void 0,i,a,w.current)),F(i),N("form")):(f(T(void 0,void 0,a,w.current)),N("preset-picker"))},[t,s,i,a]);const{pendingTemplate:A,externalTrigger:M,clear:te}=ps();m.useEffect(()=>{M&&A&&(f(T(void 0,A,a,w.current)),F(A),N("form"),te())},[M,A,te,a]);function Le(E){f(T(void 0,E,a,w.current)),F(E),N("form")}function ze(E){const ie=(Q??[]).filter(Z=>(Z.agentId??"")===E.agentId).map(Z=>Z.name);V(!0),f(mt(E,ie),!0)}function Ie(){b&&J&&t&&c.mutate({id:t.id,enabled:!1}),r(!1)}function _e(){t&&l.mutate(t.id,{onSuccess:()=>{D(!1),r(!1)}})}function Pe(E){t&&(y(E),c.mutate({id:t.id,enabled:E},{onError:()=>y(t.enabled)}))}const Te=d.isPending||c.isPending;return e.jsxs(gs,{open:s,onOpenChange:r,children:[e.jsxs(js,{className:"flex max-h-[85vh] max-w-lg flex-col gap-0 p-0",children:[e.jsxs(vs,{className:"shrink-0 border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[C==="form"&&!z&&!b&&e.jsxs("button",{type:"button",onClick:()=>N("preset-picker"),className:"text-muted-foreground hover:text-foreground flex items-center gap-1 text-sm","aria-label":"Back to preset picker",children:[e.jsx(ys,{className:"size-4"}),"Back"]}),e.jsx(bs,{children:z?"Edit schedule":"New schedule"}),z&&e.jsx(fe,{className:"ml-auto",checked:P,onCheckedChange:Pe,disabled:c.isPending,"aria-label":P?"Disable schedule":"Enable schedule"})]}),e.jsx(Ns,{className:"sr-only",children:z?"Edit an existing schedule":"Create a new schedule"})]}),C==="preset-picker"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsxs("div",{className:"space-y-4 px-4 py-5",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Start from a template"}),e.jsx(Oe,{onSelect:Le,selectedId:_==null?void 0:_.id}),e.jsx("button",{type:"button",onClick:()=>{F(null),N("form")},className:"text-muted-foreground hover:text-foreground w-full text-center text-sm transition-colors",children:"Start from scratch"})]})}),C==="form"&&e.jsx(ft,{defaultValues:X,roster:x,editTask:z,onSubmitSuccess:Ie,onCancel:()=>r(!1),onDeleteClick:()=>D(!0),isPending:Te,onMakeCopy:ze,leading:b&&t?e.jsxs("div",{className:"flex items-start gap-2 rounded-md border px-3 py-2",children:[e.jsx(ws,{id:"copy-switch-off-original",checked:J,onCheckedChange:E=>V(E===!0)}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(R,{htmlFor:"copy-switch-off-original",className:"text-sm font-normal",children:"Switch off the package’s schedule"}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:["So “",t.name,"” and your copy don’t both run."]})]})]}):void 0},se)]}),t&&e.jsx(Ss,{open:H,onOpenChange:D,children:e.jsxs(Cs,{children:[e.jsxs(ks,{children:[e.jsxs(Rs,{children:["Delete “",t.name,"”?"]}),e.jsx(Es,{children:"Its run history is deleted too. This can’t be undone."})]}),e.jsxs(Ms,{children:[e.jsx("button",{onClick:()=>D(!1),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:"Cancel"}),e.jsx(W,{variant:"destructive",size:"sm",onClick:_e,loading:l.isPending,loadingLabel:"Deleting…",children:"Delete task"})]})]})})]})}function Ct({onCreateWithPreset:s,onCreateBlank:r}){return e.jsxs("div",{className:"flex flex-col items-center pb-8 md:pb-12",children:[e.jsx("h3",{className:"mb-2 text-lg font-medium",children:"No schedules yet"}),e.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm text-center text-sm",children:"Put a skill on a timer and it runs without you."}),e.jsx("div",{className:"w-full max-w-lg",children:e.jsx(Oe,{onSelect:s})}),e.jsx(W,{variant:"ghost",className:"mt-4",onClick:r,children:"New custom schedule"})]})}export{St as C,Ct as T};
@@ -1 +1 @@
1
- import{b0 as F,a_ as E,b1 as U,b2 as D,b3 as L,b4 as _,r as l,j as e,b5 as f,b6 as p,b7 as j,b8 as g,b9 as k,x as w,ba as N,bb as $,bc as B,bd as G,be as O,bf as P,bg as X,bh as V}from"./index-BwTGkJbK.js";import{u as W,f as q}from"./format-cron-BqRDcFZM.js";import{S as H}from"./scroll-area-B1d3NfEn.js";const J=5;function K({status:t}){switch(t){case"running":return e.jsx(w,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(X,{className:"text-foreground size-3 shrink-0","aria-hidden":!0});case"failed":return e.jsx(P,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(O,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"skipped":return e.jsx(G,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"needs_attention":return e.jsx(B,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});default:return null}}function Q(t){if(t===null)return"";if(t<1e3)return"< 1s";const n=Math.floor(t/1e3);if(n<60)return`${n}s`;const a=Math.floor(n/60),i=n%60;return`${a}m ${i}s`}function Y({run:t,scheduleName:n}){return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(w,{size:"xs",className:"text-status-info shrink-0"}),e.jsx("span",{className:"truncate",children:n}),t.startedAt&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:N(t.startedAt)})]})})}function Z({schedule:t,onEdit:n}){return e.jsx(g,{children:e.jsxs(k,{onClick:()=>n(t.id),className:"text-sm",children:[e.jsx($,{className:"text-muted-foreground/50 size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:t.name}),t.nextRun&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:N(t.nextRun)})]})})}function ee({run:t,scheduleName:n}){const a=t.status==="running"&&t.finishedAt?t.error?"failed":"completed":t.status;return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(K,{status:a}),e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"text-muted-foreground/50 ml-auto flex shrink-0 items-center gap-1.5 text-xs",children:[t.durationMs!==null&&e.jsx("span",{children:Q(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:N(t.finishedAt)})]})]})})}function se({available:t,agentId:n}){const a=F(),i=E(s=>s.setTasksAgentFilter),b=E(s=>s.setTasksEditScheduleId),u=t,{data:x=[]}=U(u),{data:I=0}=D(u),{data:R=[]}=L(void 0,u),{data:T=[]}=W(),{openWithTemplate:y}=_(),v=[T[0],T[2]].filter(Boolean),o=l.useMemo(()=>n?x.filter(s=>s.agentId===n):x,[n,x]),d=l.useMemo(()=>{const s=new Map;for(const r of o)s.set(r.id,r.name);return s},[o]),S=l.useMemo(()=>R.filter(s=>d.has(s.scheduleId)),[R,d]),{runningRuns:A,recentRuns:M}=l.useMemo(()=>{const s=[],r=[];for(const c of S)c.finishedAt!=null||c.status!=="running"?r.push(c):s.push(c);return r.sort((c,h)=>(h.finishedAt??h.createdAt).localeCompare(c.finishedAt??c.createdAt)),{runningRuns:s,recentRuns:r.slice(0,J)}},[S]),C=l.useMemo(()=>o.filter(s=>s.enabled&&s.status==="active"&&s.nextRun).sort((s,r)=>(s.nextRun??"").localeCompare(r.nextRun??"")),[o]),m=()=>{n&&(i(n),b(null)),a.open()},z=s=>{b(s),i(null),a.open()};return o.length===0?e.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:"No schedules yet."}),v.length>0&&e.jsx("div",{className:"space-y-2",children:v.map(s=>e.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:q(s.cron)}),e.jsx("button",{type:"button",onClick:()=>{y(s),m()},className:"text-primary mt-2 text-xs hover:underline",children:"+ Use preset"})]},s.id))}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open schedules →"})]}):e.jsx(H,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[A.length>0&&e.jsxs(f,{children:[e.jsxs(p,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Running",e.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:I})]}),e.jsx(j,{children:A.map(s=>e.jsx(Y,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),C.length>0&&e.jsxs(f,{children:[e.jsx(p,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(j,{children:C.map(s=>e.jsx(Z,{schedule:s,onEdit:z},s.id))})]}),M.length>0&&e.jsxs(f,{children:[e.jsx(p,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Recent runs"}),e.jsx(j,{children:M.map(s=>e.jsx(ee,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),e.jsx("div",{className:"px-3 py-2",children:e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open schedules →"})})]})})}function re({member:t}){var i;const n=V(),a=((i=t.agent)==null?void 0:i.manifestId)??null;return e.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-tasks",children:e.jsx(se,{available:n,agentId:a})})}export{re as TasksPage};
1
+ import{a$ as F,aZ as E,b0 as U,b1 as D,b2 as L,b3 as $,r as l,j as e,b4 as f,b5 as p,b6 as j,b7 as g,b8 as k,x as w,b9 as N,ba as _,bb as B,bc as G,bd as O,be as P,bf as X,bg as V}from"./index-BR1m9FON.js";import{u as W,f as Z}from"./format-cron-meJMgYNe.js";import{S as q}from"./scroll-area-DAC7NrVU.js";const H=5;function J({status:t}){switch(t){case"running":return e.jsx(w,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(X,{className:"text-foreground size-3 shrink-0","aria-hidden":!0});case"failed":return e.jsx(P,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(O,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"skipped":return e.jsx(G,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"needs_attention":return e.jsx(B,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});default:return null}}function K(t){if(t===null)return"";if(t<1e3)return"< 1s";const n=Math.floor(t/1e3);if(n<60)return`${n}s`;const a=Math.floor(n/60),i=n%60;return`${a}m ${i}s`}function Q({run:t,scheduleName:n}){return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(w,{size:"xs",className:"text-status-info shrink-0"}),e.jsx("span",{className:"truncate",children:n}),t.startedAt&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:N(t.startedAt)})]})})}function Y({schedule:t,onEdit:n}){return e.jsx(g,{children:e.jsxs(k,{onClick:()=>n(t.id),className:"text-sm",children:[e.jsx(_,{className:"text-muted-foreground/50 size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:t.name}),t.nextRun&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:N(t.nextRun)})]})})}function ee({run:t,scheduleName:n}){const a=t.status==="running"&&t.finishedAt?t.error?"failed":"completed":t.status;return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(J,{status:a}),e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"text-muted-foreground/50 ml-auto flex shrink-0 items-center gap-1.5 text-xs",children:[t.durationMs!==null&&e.jsx("span",{children:K(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:N(t.finishedAt)})]})]})})}function se({available:t,agentId:n}){const a=F(),i=E(s=>s.setTasksAgentFilter),b=E(s=>s.setTasksEditScheduleId),u=t,{data:x=[]}=U(u),{data:I=0}=D(u),{data:R=[]}=L(void 0,u),{data:T=[]}=W(),{openWithTemplate:y}=$(),v=[T[0],T[2]].filter(Boolean),o=l.useMemo(()=>n?x.filter(s=>s.agentId===n):x,[n,x]),d=l.useMemo(()=>{const s=new Map;for(const r of o)s.set(r.id,r.name);return s},[o]),S=l.useMemo(()=>R.filter(s=>d.has(s.scheduleId)),[R,d]),{runningRuns:A,recentRuns:M}=l.useMemo(()=>{const s=[],r=[];for(const c of S)c.finishedAt!=null||c.status!=="running"?r.push(c):s.push(c);return r.sort((c,h)=>(h.finishedAt??h.createdAt).localeCompare(c.finishedAt??c.createdAt)),{runningRuns:s,recentRuns:r.slice(0,H)}},[S]),C=l.useMemo(()=>o.filter(s=>s.enabled&&s.status==="active"&&s.nextRun).sort((s,r)=>(s.nextRun??"").localeCompare(r.nextRun??"")),[o]),m=()=>{n&&(i(n),b(null)),a.open()},z=s=>{b(s),i(null),a.open()};return o.length===0?e.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:"No schedules yet."}),v.length>0&&e.jsx("div",{className:"space-y-2",children:v.map(s=>e.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:Z(s.cron)}),e.jsx("button",{type:"button",onClick:()=>{y(s),m()},className:"text-primary mt-2 text-xs hover:underline",children:"+ Use preset"})]},s.id))}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open schedules →"})]}):e.jsx(q,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[A.length>0&&e.jsxs(f,{children:[e.jsxs(p,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Running",e.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:I})]}),e.jsx(j,{children:A.map(s=>e.jsx(Q,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),C.length>0&&e.jsxs(f,{children:[e.jsx(p,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(j,{children:C.map(s=>e.jsx(Y,{schedule:s,onEdit:z},s.id))})]}),M.length>0&&e.jsxs(f,{children:[e.jsx(p,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Recent runs"}),e.jsx(j,{children:M.map(s=>e.jsx(ee,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),e.jsx("div",{className:"px-3 py-2",children:e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open schedules →"})})]})})}function re({member:t}){var i;const n=V(),a=((i=t.agent)==null?void 0:i.manifestId)??null;return e.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-tasks",children:e.jsx(se,{available:n,agentId:a})})}export{re as TasksPage};
@@ -1 +1 @@
1
- import{a5 as v,a7 as N,r as p,j as n,B as r,cz as b,cA as S,cB as w,s as E}from"./index-BwTGkJbK.js";import{u as R,C as k,a as f}from"./ComputerViewer-Broprz4q.js";const A={disabled:"Off",unsupported:"Unavailable",missing:"Not created",provisioning:"Setting up…",stopped:"Stopped",starting:"Starting…",ready:"Ready",stopping:"Stopping…",failed:"Needs attention",uncertain:"Needs attention"};function T({onOpenSession:o}){var x,g;const t=v(),a=N(),c=R(),[i,m]=p.useState(!1),[C,u]=p.useState(!1),[j,l]=p.useState(!1),e=c.data,y=e&&["provisioning","starting","stopping"].includes(e.phase),s=async d=>{m(!0),u(!1);try{const h=await d();h&&a.setQueryData(f,h),await a.invalidateQueries({queryKey:f})}catch{u(!0)}finally{m(!1)}};return n.jsxs("section",{"data-slot":"agent-computer-panel","aria-label":"Agent computer",className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("h3",{className:"text-sm font-medium",children:"Agent computer"}),n.jsx("span",{role:"status",className:"text-muted-foreground text-xs",children:e?A[e.phase]:"Connecting…"})]}),(C||c.isError)&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t reach the computer. Reconnect and try again."}),(e==null?void 0:e.phase)==="unsupported"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Requires an Apple Silicon Mac."}),(e==null?void 0:e.phase)==="disabled"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Turn on Agent computer in Experiments."}),(e==null?void 0:e.phase)==="missing"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Create a separate computer for your agent."}),(e==null?void 0:e.phase)==="provisioning"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Downloading and setting up the computer…"}),(e==null?void 0:e.phase)==="stopped"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Its files and sign-ins are kept."}),(e==null?void 0:e.phase)==="uncertain"&&n.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t confirm its state. Reconnect before continuing."}),((x=e==null?void 0:e.error)==null?void 0:x.code)==="cleanup-uncertain"&&e.phase!=="uncertain"&&n.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t confirm its state. Reconnect before continuing."}),(e==null?void 0:e.phase)==="failed"&&n.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t set up the computer. Try again."}),((g=e==null?void 0:e.error)==null?void 0:g.code)==="sign-in-required"&&n.jsx("p",{className:"text-sm",children:"Sign in before chatting."}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[(e==null?void 0:e.phase)==="missing"&&n.jsx(r,{disabled:i,onClick:()=>void s(()=>t.createComputer()),children:"Create computer"}),(e==null?void 0:e.phase)==="failed"&&n.jsx(r,{disabled:i,onClick:()=>void s(()=>t.createComputer()),children:"Try again"}),(e==null?void 0:e.phase)==="stopped"&&n.jsx(r,{disabled:i,onClick:()=>void s(()=>t.startComputer()),children:"Start"}),(e==null?void 0:e.ready)&&e.phase==="ready"&&n.jsxs(n.Fragment,{children:[n.jsx(r,{disabled:i,onClick:()=>void s(async()=>{o(await t.createComputerSession())}),children:"Chat"}),n.jsx(r,{variant:"outline",disabled:i,onClick:()=>void s(async()=>{const d=await t.signInComputer();return l(!0),d}),children:"Sign in"}),n.jsx(r,{variant:"outline",onClick:()=>l(!0),children:"View"})]}),e&&["ready","provisioning","starting","failed","uncertain"].includes(e.phase)&&n.jsx(r,{variant:"outline",disabled:i,onClick:()=>void s(()=>t.stopComputer()),children:"Stop"}),!y&&n.jsx(r,{variant:"ghost",disabled:i,onClick:()=>void s(async()=>{await c.refetch()}),children:"Reconnect"})]}),j&&(e==null?void 0:e.ready)&&e.phase==="ready"&&n.jsx(k,{generation:e.generation,onClose:()=>l(!1)},e.generation)]})}function Q(){const{enabled:o}=b("computers.enabled"),t=S();return o?n.jsx("div",{"data-slot":"team-computer-entry",className:"px-4 py-4 sm:px-6",children:n.jsx(T,{onOpenSession:a=>{w(a.id,{cwd:a.cwd,runtime:a.runtime,draft:!1}),t(E({session:a.id,runtime:a.runtime}))}})}):null}export{T as A,Q as T};
1
+ import{a5 as v,a7 as N,r as p,j as n,B as r,cy as b,cz as S,cA as w,s as E}from"./index-BR1m9FON.js";import{u as R,C as k,a as f}from"./ComputerViewer-BKMR5LkF.js";const A={disabled:"Off",unsupported:"Unavailable",missing:"Not created",provisioning:"Setting up…",stopped:"Stopped",starting:"Starting…",ready:"Ready",stopping:"Stopping…",failed:"Needs attention",uncertain:"Needs attention"};function T({onOpenSession:o}){var x,g;const t=v(),a=N(),c=R(),[i,m]=p.useState(!1),[C,u]=p.useState(!1),[j,l]=p.useState(!1),e=c.data,y=e&&["provisioning","starting","stopping"].includes(e.phase),s=async d=>{m(!0),u(!1);try{const h=await d();h&&a.setQueryData(f,h),await a.invalidateQueries({queryKey:f})}catch{u(!0)}finally{m(!1)}};return n.jsxs("section",{"data-slot":"agent-computer-panel","aria-label":"Agent computer",className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx("h3",{className:"text-sm font-medium",children:"Agent computer"}),n.jsx("span",{role:"status",className:"text-muted-foreground text-xs",children:e?A[e.phase]:"Connecting…"})]}),(C||c.isError)&&n.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t reach the computer. Reconnect and try again."}),(e==null?void 0:e.phase)==="unsupported"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Requires an Apple Silicon Mac."}),(e==null?void 0:e.phase)==="disabled"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Turn on Agent computer in Experiments."}),(e==null?void 0:e.phase)==="missing"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Create a separate computer for your agent."}),(e==null?void 0:e.phase)==="provisioning"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Downloading and setting up the computer…"}),(e==null?void 0:e.phase)==="stopped"&&n.jsx("p",{className:"text-muted-foreground text-sm",children:"Its files and sign-ins are kept."}),(e==null?void 0:e.phase)==="uncertain"&&n.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t confirm its state. Reconnect before continuing."}),((x=e==null?void 0:e.error)==null?void 0:x.code)==="cleanup-uncertain"&&e.phase!=="uncertain"&&n.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t confirm its state. Reconnect before continuing."}),(e==null?void 0:e.phase)==="failed"&&n.jsx("p",{role:"alert",className:"text-sm",children:"Couldn’t set up the computer. Try again."}),((g=e==null?void 0:e.error)==null?void 0:g.code)==="sign-in-required"&&n.jsx("p",{className:"text-sm",children:"Sign in before chatting."}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[(e==null?void 0:e.phase)==="missing"&&n.jsx(r,{disabled:i,onClick:()=>void s(()=>t.createComputer()),children:"Create computer"}),(e==null?void 0:e.phase)==="failed"&&n.jsx(r,{disabled:i,onClick:()=>void s(()=>t.createComputer()),children:"Try again"}),(e==null?void 0:e.phase)==="stopped"&&n.jsx(r,{disabled:i,onClick:()=>void s(()=>t.startComputer()),children:"Start"}),(e==null?void 0:e.ready)&&e.phase==="ready"&&n.jsxs(n.Fragment,{children:[n.jsx(r,{disabled:i,onClick:()=>void s(async()=>{o(await t.createComputerSession())}),children:"Chat"}),n.jsx(r,{variant:"outline",disabled:i,onClick:()=>void s(async()=>{const d=await t.signInComputer();return l(!0),d}),children:"Sign in"}),n.jsx(r,{variant:"outline",onClick:()=>l(!0),children:"View"})]}),e&&["ready","provisioning","starting","failed","uncertain"].includes(e.phase)&&n.jsx(r,{variant:"outline",disabled:i,onClick:()=>void s(()=>t.stopComputer()),children:"Stop"}),!y&&n.jsx(r,{variant:"ghost",disabled:i,onClick:()=>void s(async()=>{await c.refetch()}),children:"Reconnect"})]}),j&&(e==null?void 0:e.ready)&&e.phase==="ready"&&n.jsx(k,{generation:e.generation,onClose:()=>l(!1)},e.generation)]})}function Q(){const{enabled:o}=b("computers.enabled"),t=S();return o?n.jsx("div",{"data-slot":"team-computer-entry",className:"px-4 py-4 sm:px-6",children:n.jsx(T,{onOpenSession:a=>{w(a.id,{cwd:a.cwd,runtime:a.runtime,draft:!1}),t(E({session:a.id,runtime:a.runtime}))}})}):null}export{T as A,Q as T};
@@ -0,0 +1 @@
1
+ import{a5 as w,a7 as C,a8 as k,fE as E,fF as y,r as x,j as t,I as b,fG as A,B as v,G as S,fH as L,e as $,Q as M,T as _,C as I,V as z,f as F,dR as q}from"./index-BR1m9FON.js";function R(){const e=w(),s=C();return k({mutationFn:({agentId:n,body:a})=>e.createTodoPromise(n,a),onSettled:()=>s.invalidateQueries({queryKey:E.all})})}function W(){const e=w(),s=C();return k({mutationFn:({id:n,body:a})=>e.updateTodoPromise(n,a),onSettled:()=>s.invalidateQueries({queryKey:E.all})})}function K(e,s=new Date){if(!e)return null;const n=new Date(e);if(Number.isNaN(n.getTime()))return null;const a=n.getTime()<s.getTime()?"Overdue ·":"Due",l=n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"});return n.toDateString()===s.toDateString()?`${a} ${l}`:Math.abs(n.getTime()-s.getTime())/864e5<6?`${a} ${n.toLocaleDateString(void 0,{weekday:"short"})} ${l}`:`${a} ${n.toLocaleDateString(void 0,{month:"short",day:"numeric"})}`}function U(e,s){return e?e.startsWith(y)?`To ${e.slice(y.length)}`:`To ${(s==null?void 0:s(e))??e}`:null}function B(e){return{open:e.filter(s=>s.state==="open"),closed:e.filter(s=>s.state!=="open")}}const H={kept:"Kept",missed:"Missed",dropped:"Dropped"};function Y(e){var n;const s=new Map;for(const a of e)s.set(a.id,a.displayName),(n=a.agent)!=null&&n.manifestId&&s.set(a.agent.manifestId,a.displayName);return a=>s.get(a)}const Q=6e4;function X(){const e=new Date;return new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function G({agentId:e,onDone:s}){var u;const n=R(),[a,l]=x.useState(""),[o,i]=x.useState(""),d=x.useId(),f=x.useId(),p=a.trim(),j=n.isError&&((u=n.error)==null?void 0:u.code)==="PAST_DUE",m=o?new Date(o).getTime():null,[c,N]=x.useState(!1),[T]=x.useState(X);function r(g){if(g.preventDefault(),!p||c)return;const h=m!==null?new Date(m).toISOString():void 0;n.mutate({agentId:e,body:{what:p,...h?{dueAt:h}:{}}},{onSuccess:s})}return t.jsxs("form",{onSubmit:r,"data-slot":"add-todo-form",className:"flex flex-col gap-2 rounded-md border p-3",children:[t.jsx("label",{htmlFor:d,className:"text-xs font-medium",children:"What was promised"}),t.jsx(b,{id:d,value:a,maxLength:A,onChange:g=>l(g.target.value),placeholder:"Send Acme the revised quote"}),t.jsx("label",{htmlFor:f,className:"text-xs font-medium",children:"Due (optional)"}),t.jsx(b,{id:f,type:"datetime-local",value:o,min:T,"aria-invalid":c||void 0,onChange:g=>{const h=g.target.value;i(h),N(h!==""&&new Date(h).getTime()<Date.now()-Q)}}),(c||j)&&t.jsx("p",{className:"text-destructive text-xs",children:"That time has passed."}),n.isError&&!j&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t save the to-do. Try again."}),t.jsxs("div",{className:"flex justify-end gap-2",children:[t.jsx(v,{type:"button",size:"sm",variant:"ghost",onClick:s,children:"Cancel"}),t.jsx(v,{type:"submit",size:"sm",disabled:!p||c||n.isPending,children:"Add to-do"})]})]})}function D({todoPromise:e,agentName:s,nameOf:n,onClose:a,busy:l}){const o=e.state==="open",i=[s,U(e.to,n)].filter(Boolean).join(" · "),d=o?K(e.dueAt):null;return t.jsxs("li",{"data-slot":"todo-promise-row","data-state":e.state,"data-overdue":e.overdue||void 0,className:"flex flex-col gap-2 rounded-md px-2 py-2 sm:flex-row sm:items-center sm:gap-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:S("text-sm break-words",!o&&"text-muted-foreground",e.state==="dropped"&&"line-through"),children:e.what}),(i||d||!o)&&t.jsxs("div",{className:"text-muted-foreground mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs",children:[e.state!=="open"&&t.jsx("span",{children:H[e.state]}),i&&t.jsx("span",{className:"min-w-0 truncate",children:i}),d&&t.jsx("span",{className:S(e.overdue&&"text-destructive font-medium"),children:d})]})]}),o&&a&&t.jsxs("div",{className:"flex shrink-0 gap-1",children:[t.jsx(v,{size:"xs",variant:"outline",disabled:l,onClick:()=>a("kept"),"aria-label":`Mark kept: ${e.what}`,children:"Mark kept"}),t.jsx(v,{size:"xs",variant:"ghost",disabled:l,onClick:()=>a("dropped"),"aria-label":`Drop: ${e.what}`,children:"Drop"})]})]})}const V={kept:"Marked kept",dropped:"To-do dropped"};function Z({agentId:e,nameOf:s,canAdd:n=!1,readOnly:a=!1,canChange:l}){var T;const o=L(e?{agentId:e}:{}),i=W(),[d,f]=x.useState(!1),p=e===void 0;function j(r,u){i.mutate({id:r.id,body:{state:u}},{onSuccess:()=>q.success(V[u],{action:{label:"Undo",onClick:()=>i.mutate({id:r.id,body:{state:"open",from:u}})}})})}if(o.isPending)return t.jsx($,{className:"h-16 w-full"});if(o.isError)return t.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read to-dos."});const{open:m,closed:c}=B(o.data),N=i.isPending?(T=i.variables)==null?void 0:T.id:void 0;return t.jsxs("div",{"data-slot":"todo-promise-list",className:"flex flex-col gap-2",children:[m.length===0&&c.length===0&&!d&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"No to-dos yet."}),m.length>0&&t.jsx("ul",{className:"flex flex-col","aria-label":"Open to-dos",children:m.map(r=>t.jsx(D,{todoPromise:r,agentName:p?s==null?void 0:s(r.agentId):void 0,nameOf:s,busy:N===r.id,...a||l&&!l(r)?{}:{onClose:u=>j(r,u)}},r.id))}),i.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t change that to-do. Try again."}),c.length>0&&t.jsxs(M,{children:[t.jsxs(_,{className:"focus-ring text-muted-foreground hover:text-foreground group flex items-center gap-1 rounded-md px-2 py-1 text-xs",children:[t.jsx(I,{"aria-hidden":!0,className:"size-3.5 transition-transform group-data-[state=open]:rotate-90"}),"Closed (",c.length,")"]}),t.jsx(z,{children:t.jsx("ul",{className:"flex flex-col","aria-label":"Closed to-dos",children:c.map(r=>t.jsx(D,{todoPromise:r,agentName:p?s==null?void 0:s(r.agentId):void 0,nameOf:s},r.id))})})]}),n&&!a&&e&&d&&t.jsx(G,{agentId:e,onDone:()=>f(!1)}),n&&!a&&e&&!d&&t.jsxs(v,{size:"sm",variant:"ghost",className:"self-start",onClick:()=>f(!0),children:[t.jsx(F,{"aria-hidden":!0}),"Add to-do"]})]})}export{Z as T,Y as r};
@@ -0,0 +1 @@
1
+ import{r as d,d as m,j as r}from"./index-BR1m9FON.js";import{r as l,T as c}from"./TodoPromiseList-DDKWAfmv.js";function u({member:o,roster:s}){var n;const e=(n=o.agent)==null?void 0:n.manifestId,i=d.useMemo(()=>l(s),[s]),t=m(o,s),a=t==="managed"||t==="system";return e?r.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-todos",children:r.jsx(c,{agentId:e,nameOf:i,canAdd:a,readOnly:!a})}):null}export{u as TodoPromisesPage};
@@ -1,2 +1,2 @@
1
- import{a5 as G,a6 as Le,a8 as ae,a7 as pe,eD as Ke,r as o,j as n,bi as K,bj as $,B as f,gX as $e,j2 as Ue,f as fe,j3 as xe,gz as J,bc as Be,eE as D,I as W,ex as Ve,ey as qe,ez as Ye,eA as He,eB as We,dD as de,cD as Qe,fS as Ge,C as ne,G as ue,W as re,dp as je,dq as Ne,a2 as Xe,dr as ve,eG as Ze,j4 as me,x as te,g7 as Je,g8 as en,g9 as nn,ga as tn,gb as ee,gd as sn,a3 as an,j5 as rn,y as on,e as se,hS as cn,b as ln}from"./index-BwTGkJbK.js";import"./relay-trace-schemas-ZLR1S8ft.js";import{u as Se,M as be}from"./McpSigninBody-CsXP_7lE.js";import{D as _}from"./detail-row-CjwI1iuc.js";import{R as dn}from"./rotate-cw-uoeBxIeM.js";import"./form-D3VdAYl4.js";import"./copy-button-DjAoGwds.js";function un(e,t){const s=G();return Le({queryKey:["mcp-config",e,t??null],queryFn:()=>s.getMcpConfig(e,{runtime:t??void 0}),enabled:!!e,staleTime:3e4})}function ye(e,t){e.invalidateQueries({queryKey:Ke.mcpServers(t)}),e.invalidateQueries({queryKey:["mcp-config"]})}function Ce(e){const t=G(),s=pe();return ae({mutationFn:async({input:i,approval:r})=>r?(await t.grantApproval(r.approvalId),e(t,i,r.approvalToken)):e(t,i),onSuccess:(i,{input:r})=>{i.status==="ok"&&ye(s,r.agentId)}})}function mn(){return Ce((e,t,s)=>e.addAgentMcpServer(t,s?{approvalToken:s}:void 0))}function gn(){return Ce((e,t,s)=>e.importAgentMcpServer(t,s?{approvalToken:s}:void 0))}function ie(e){const t=G(),s=pe();return ae({mutationFn:({agentId:i,name:r})=>e(t,i,r),onSuccess:(i,{agentId:r})=>ye(s,r)})}function hn(){return ie((e,t,s)=>e.removeAgentMcpServer(t,s))}function pn(){return ie((e,t,s)=>e.enableAgentMcpServer(t,s))}function fn(){return ie((e,t,s)=>e.disableAgentMcpServer(t,s))}function xn(){const e=G();return ae({mutationFn:({agentId:t,name:s})=>e.testAgentMcpServer(t,s)})}function jn({agentId:e,serverName:t,onDone:s}){const i=Se(e,t),{start:r}=i,a=o.useRef(!1);return o.useEffect(()=>{a.current||(a.current=!0,r())},[r]),n.jsx(K,{children:n.jsxs($,{className:"space-y-2",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Sign in to ",t]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Sign in so your agent can use this server."}),n.jsx(be,{flow:i,serverName:t,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>i.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:s,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:s,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&n.jsx(f,{variant:"ghost",size:"sm",onClick:s,className:"focus-visible:ring-2",children:"Later"})]})})}const Nn=["stdio","http","sse"],vn=/^[a-zA-Z0-9_-]+$/;function ge(e){const t={};for(const s of e.split(`
2
- `)){const i=s.trim();if(!i)continue;const r=i.indexOf("=");if(r===-1)continue;const a=i.slice(0,r).trim();a&&(t[a]=i.slice(r+1).trim())}return t}function he(e){return e.trim().length?e.trim().split(/\s+/):[]}function Sn(e,t){if(e.status!=="ok")return!1;const s=e.servers.find(r=>r.name===t),i=s==null?void 0:s.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function bn({agentId:e,agentLabel:t,supportedTransports:s,onAdded:i,oauthDetectedFor:r=null}){const a=mn(),[l,h]=o.useState(!1),[m,S]=o.useState(""),[p,g]=o.useState(s[0]??"stdio"),c=s.includes(p)?p:s[0]??"stdio",[b,C]=o.useState(""),[N,k]=o.useState(""),[x,z]=o.useState(""),[y,M]=o.useState(""),[R,A]=o.useState(""),[O,P]=o.useState(null),[w,I]=o.useState(null),[F,B]=o.useState(!1),U=o.useCallback(d=>{const v=$e(d);B(v!==null),I(v??(d instanceof Error?d.message:"Couldn’t add the server."))},[]),[V,u]=o.useState(null),[j,T]=o.useState(null),E=vn.test(m)&&m.length<=64,ze=c==="stdio"?b.trim().length>0:y.trim().length>0,X=Ue(),Re=E&&ze&&!a.isPending&&!X,ce=o.useCallback(()=>c==="stdio"?{transport:"stdio",command:b.trim(),args:he(N),env:ge(x)}:{transport:c,url:y.trim(),headers:ge(R)},[c,b,N,x,y,R]),q=o.useCallback(()=>({agentId:e,name:m.trim(),connection:ce()}),[e,m,ce]),Z=o.useCallback(()=>{h(!1),P(null),I(null),S(""),g(s[0]??"stdio"),C(""),k(""),z(""),M(""),A("")},[s]),le=o.useCallback(d=>{i({name:d.name,transport:d.connection.transport}),Z()},[i,Z]),Y=o.useCallback((d,v)=>{const _e=Sn(d,v.name);le(v),_e&&u(v.name)},[le]),Pe=o.useCallback(async()=>{I(null);const d=q();try{const v=await a.mutateAsync({input:d});v.status==="approval_required"?P(v.approval):Y(v,d)}catch(v){U(v)}},[a,q,Y,U]),Ie=o.useCallback(async()=>{if(!O)return;I(null);const d=q();try{const v=await a.mutateAsync({input:d,approval:O});v.status==="ok"?Y(v,d):(B(!1),I("The server still needs approval. Try again."))}catch(v){U(v)}},[a,q,O,Y,U]),H=V??(r&&r!==j?r:null),Fe=o.useCallback(()=>{T(H),u(null)},[H]),De=o.useMemo(()=>[b.trim(),...he(N)].filter(Boolean).join(" "),[b,N]);return H?n.jsx(jn,{agentId:e,serverName:H,onDone:Fe}):l?O?n.jsx(K,{children:n.jsxs($,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(xe,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add this server to ",t,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:c==="stdio"?"Runs on this computer when a chat starts.":"The agent connects here when a chat starts."})]})]}),n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:c==="stdio"?De:y.trim()}),w&&(F?n.jsx(J,{tone:"info",role:"status",className:"text-xs",children:w}):n.jsx("p",{className:"text-destructive text-xs",children:w})),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>P(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{size:"sm",onClick:Ie,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add server"})]})]})}):n.jsx(K,{children:n.jsxs($,{className:"space-y-3",children:[X&&n.jsx(J,{tone:"info",role:"status",className:"text-xs",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Be,{className:"size-3.5 shrink-0","aria-hidden":!0}),"Adding a server only works at this computer. You’re on Wi-Fi."]})}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-name",children:"Name"}),n.jsx(W,{id:"mcp-name",value:m,onChange:d=>S(d.target.value),placeholder:"my-server","aria-invalid":m.length>0&&!E}),m.length>0&&!E&&n.jsx("p",{className:"text-destructive text-xs",children:"Letters, numbers, dashes, underscores only."})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-transport",children:"Transport"}),n.jsxs(Ve,{value:c,onValueChange:d=>g(d),children:[n.jsx(qe,{id:"mcp-transport",className:"w-full",children:n.jsx(Ye,{})}),n.jsx(He,{children:s.map(d=>n.jsx(We,{value:d,children:d},d))})]})]}),c==="stdio"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-command",children:"Command"}),n.jsx(W,{id:"mcp-command",value:b,onChange:d=>C(d.target.value),placeholder:"npx",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-args",children:"Arguments"}),n.jsx(W,{id:"mcp-args",value:N,onChange:d=>k(d.target.value),placeholder:"-y @modelcontextprotocol/server-filesystem",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-env",children:"Environment (KEY=VALUE per line)"}),n.jsx(de,{id:"mcp-env",value:x,onChange:d=>z(d.target.value),placeholder:"API_KEY=…",rows:2,className:"font-mono text-xs"})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-url",children:"URL"}),n.jsx(W,{id:"mcp-url",value:y,onChange:d=>M(d.target.value),placeholder:"https://example.com/mcp",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-headers",children:"Headers (KEY=VALUE per line)"}),n.jsx(de,{id:"mcp-headers",value:R,onChange:d=>A(d.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),w&&!(X&&F)&&(F?n.jsx(J,{tone:"info",role:"status",className:"text-xs",children:w}):n.jsx("p",{className:"text-destructive text-xs",children:w})),n.jsx(Qe,{}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:Z,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:Pe,disabled:!Re,className:"focus-visible:ring-2",children:"Continue"})]})]})}):n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>h(!0),className:"focus-visible:ring-2",children:[n.jsx(fe,{className:"size-4"}),"Add server"]})}const yn={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},Cn=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function oe(e){if(!e)return"cant-reach";const t=e.toLowerCase();return Cn.some(s=>t.includes(s))?"setup-problem":"cant-reach"}function we(e){return e.transport==="stdio"||e.authKind==="oauth2"?!1:Object.keys(e.headers).some(t=>t.toLowerCase()==="authorization")}function wn(e){const{connection:t,authStatus:s}=e;return t.transport!=="stdio"&&t.authKind==="oauth2"?!0:s!==void 0}function ke(e){const{enabled:t,testedOk:s,signedInNow:i,runtimeStatus:r,runtimeError:a,authStatus:l,ownKey:h}=e;return t?s?"connected":i?"signed-in":r==="failed"?oe(a):l==="connected"&&r==="needs-auth"?"signed-in":l==="needs-auth"&&(r==="connected"||r==="pending")?"needs-sign-in":r?yn[r]:l==="connected"?"signed-in":l==="needs-auth"?"needs-sign-in":h?"uses-your-key":"not-checked":"off"}function kn(e){const{statusKey:t,testResult:s,signedInNow:i}=e;return t==="off"||i?!1:(s==null?void 0:s.needsAuth)===!0?!0:t==="needs-sign-in"}function An(e){const{stamped:t,signedInNow:s,authStatus:i,rosterUpdatedAt:r}=e;if(!t)return;const{result:a}=t;if(!(s&&a.needsAuth===!0)&&!(t.at<=r&&(i==="needs-auth"&&a.ok||i==="connected"&&a.needsAuth===!0)))return a}function Tn(e){const{status:t,probe:s}=e;return t==="off"||!s||s.ok?t:s.needsAuth===!0?"needs-sign-in":oe(s.error)}const Q={attention:0,working:1,elsewhere:2,off:3};function Mn(e){return e==="off"?Q.off:e==="needs-sign-in"||e==="cant-reach"||e==="setup-problem"?Q.attention:Q.working}function On(e){const{managed:t,live:s,discovered:i}=e;return[...t.map(a=>{var l,h;return{name:a.name,band:Mn(ke({enabled:a.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(l=s.get(a.name))==null?void 0:l.status,runtimeError:(h=s.get(a.name))==null?void 0:h.error,authStatus:a.authStatus,ownKey:we(a.connection)}))}}),...i.map(a=>({name:a.name,band:Q.elsewhere}))].map((a,l)=>({entry:a,index:l})).sort((a,l)=>a.entry.band-l.entry.band||a.index-l.index).map(({entry:a})=>a.name)}function En(e){const{frozen:t,present:s}=e,i=new Set(s),r=new Set(t);return{ordered:t.filter(a=>i.has(a)),added:s.filter(a=>!r.has(a))}}function zn(){const e=Ge(null);return({bothSettled:t,managed:s,live:i,discovered:r,present:a})=>{e.read()===null&&t&&a.length>0&&e.write(On({managed:s,live:i,discovered:r}));const{ordered:l,added:h}=En({frozen:e.read()??[],present:a});return h.length>0&&e.read()!==null&&e.write([...l,...h]),[...l,...h]}}const Ae={"needs-sign-in":{label:"Needs sign-in",tooltip:"Sign in to use it.",tone:"attention"},"signing-in":{label:"Signing in…",tooltip:"Finish in the new tab.",tone:"attention"},connected:{label:"Connected",tooltip:"It answered. Its tools are ready.",tone:"calm"},"signed-in":{label:"Signed in",tooltip:"Signed in, not tested yet.",tone:"calm"},"uses-your-key":{label:"Uses your key",tooltip:"Uses a key you added.",tone:"calm"},"cant-reach":{label:"Can’t reach",tooltip:"No answer. See Details.",tone:"error"},"setup-problem":{label:"Setup problem",tooltip:"Couldn’t start. See Details.",tone:"error"},connecting:{label:"Connecting…",tooltip:"Connecting to this server.",tone:"calm"},"not-checked":{label:"Not checked yet",tooltip:"Nothing has checked it yet.",tone:"calm"},off:{label:"Off",tooltip:"Hidden from the agent.",tone:"calm"}},Rn={"needs-sign-in":"sign-in","signing-in":"none",connected:"none","signed-in":"test","uses-your-key":"test","cant-reach":"try-again","setup-problem":"try-again",connecting:"none","not-checked":"test",off:"none"};function Pn(e){return Rn[e]}function In({toolCount:e,justSignedIn:t}){const s=t?"Signed in just now. ":"";return e===null?`${s||"This server answered. "}Its tools are available.`:`${s}${e} tool${e===1?"":"s"} available.`}function Fn(e,t){switch(e){case"needs-sign-in":return`Sign in to ${t.displayName} to use its tools.`;case"signing-in":return null;case"connected":return In(t);case"signed-in":return t.justSignedIn?"Signed in just now. Test to check it answers.":"Signed in. Test to check it answers.";case"uses-your-key":return"You added an access key when setting this up.";case"cant-reach":return"This server didn’t answer. It may be down.";case"setup-problem":return"This server’s setup has a problem.";case"connecting":return"Connecting to this server.";case"not-checked":return"Nothing has checked this server yet.";case"off":return"Turned off. The agent doesn’t see this server."}}function Dn(e){const{connection:t,authStatus:s,clientOrigin:i}=e;return t.transport==="stdio"?"None. This server doesn’t need one.":t.authKind==="oauth2"?i==="manual"?`Your own app credentials, ${s==="connected"?"signed in, renews automatically":"not signed in yet"}. DorkOS holds the key, not the agent.`:s==="connected"?"Signed in, and it renews automatically. DorkOS holds the key, not the agent.":"DorkOS will hold the key, not the agent.":Object.keys(t.headers).some(a=>a.toLowerCase()==="authorization")?"Access key: you added a key when setting this up.":s===void 0?"Nothing has checked this yet.":"None. This server doesn’t need one."}function _n(e){if(e.transport==="stdio")return`Runs \`${e.command}\` on this computer`;const t=Ln(e.url);return t?`${t} (web service)`:`${e.url} (web service)`}function Ln(e){try{return new URL(e).host}catch{return null}}const Kn={agent:"Added to this agent through DorkOS",project:"From this project’s config files",plugin:"Comes with a plugin",computer:"From your computer-wide config"},$n={agent:"Added to this agent through DorkOS.",project:"From this project’s config. Add it to manage it here.",plugin:"Comes with a plugin. Add it to manage it here.",computer:"From your computer-wide config. Add it to manage it here."},Un=[{runtime:"claude-code",pattern:/^plugin:([^:]+):(.+)$/,read:e=>({pluginName:e[1],displayName:e[2]})},{runtime:"claude-code",pattern:/^plugin:(.+)$/,read:e=>({pluginName:e[1],displayName:e[1]})}];function Te(e){for(const t of Un){const s=e.match(t.pattern);if(!s)continue;const{displayName:i,pluginName:r}=t.read(s);if(!(!i||!r))return{displayName:i,pluginName:r,rawName:e}}return{displayName:e,pluginName:null,rawName:e}}function Bn(e,t){return t.pluginName?"plugin":e.scope==="project"||e.scope==="local"?"project":e.scope==="user"?"computer":null}const Vn="Loaded from outside DorkOS. Add it to manage it here.";function Me(e,t){return e==="plugin"&&t?`Comes with the ${t} plugin`:Kn[e]}function qn(e,t){return e===null?Vn:e==="plugin"&&t?`Comes with the ${t} plugin. Add it to manage it here.`:$n[e]}const Yn=re("border-border/60 relative overflow-hidden rounded-md border px-3 py-2.5 transition-colors",{variants:{managed:{true:"bg-card",false:"bg-muted/30"},dimmed:{true:"opacity-65",false:""}},defaultVariants:{managed:!0,dimmed:!1}}),Hn=re("pointer-events-none absolute inset-y-0 left-0 w-0.5",{variants:{tone:{calm:"hidden",attention:"bg-status-warning",error:"bg-status-error"}},defaultVariants:{tone:"calm"}}),Wn=re("shrink-0 rounded-full px-2 py-0.5 text-2xs leading-4 font-medium whitespace-nowrap",{variants:{chip:{success:"bg-status-success-bg text-status-success-fg",info:"bg-status-info-bg text-status-info-fg",warning:"bg-status-warning-bg text-status-warning-fg",error:"bg-status-error-bg text-status-error-fg",neutral:"bg-muted text-muted-foreground"}},defaultVariants:{chip:"neutral"}}),Qn={connected:"success","signed-in":"info","needs-sign-in":"warning","signing-in":"warning","cant-reach":"error","setup-problem":"error","uses-your-key":"neutral",connecting:"neutral","not-checked":"neutral",off:"neutral"};function Gn({status:e}){const t=Ae[e];return n.jsxs(je,{children:[n.jsx(Ne,{asChild:!0,children:n.jsx("span",{className:Wn({chip:Qn[e]}),children:t.label})}),n.jsx(ve,{children:t.tooltip})]})}function Xn({scope:e,pluginName:t}){return n.jsxs(je,{children:[n.jsx(Ne,{asChild:!0,children:n.jsx(Xe,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:e})}),n.jsx(ve,{children:Me(e,t)})]})}function Oe({displayName:e,rawName:t,scope:s,pluginName:i,status:r,sentence:a,managed:l,toggle:h,actions:m,children:S,details:p,defaultDetailsOpen:g=!1}){const[c,b]=o.useState(g),C=o.useId(),N=Ae[r].tone;return n.jsxs("div",{"data-mcp-server":t,className:ue(Yn({managed:l,dimmed:r==="off"}),"mb-2 last:mb-0"),children:[n.jsx("span",{className:Hn({tone:N}),"aria-hidden":!0}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e}),s&&n.jsx(Xn,{scope:s,pluginName:i}),n.jsx(Gn,{status:r}),h]}),a&&n.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:a}),S,m&&n.jsx("div",{className:"mt-2 flex items-center gap-1",children:m}),p&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>b(k=>!k),"aria-expanded":c,"aria-controls":C,className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(ne,{className:ue("size-3 transition-transform",c&&"rotate-90"),"aria-hidden":!0}),"Details"]}),c&&n.jsxs("div",{id:C,children:[p,n.jsxs("button",{type:"button",onClick:()=>b(!1),className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(ne,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const Zn=3,L="text-muted-foreground/70";function Jn({tools:e}){const[t,s]=o.useState(!1),i=t?e:e.slice(0,Zn),r=e.length-i.length;return n.jsxs("div",{className:"mt-1.5",children:[i.map(a=>n.jsxs("div",{className:"border-border/40 flex items-baseline gap-2 border-b py-1 last:border-b-0",children:[n.jsx("code",{className:"text-foreground text-2xs shrink-0 font-mono",children:a.name}),a.description&&n.jsx("span",{className:"text-muted-foreground text-2xs truncate",children:a.description})]},a.name)),r>0&&n.jsxs("button",{type:"button",onClick:()=>s(!0),className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(ne,{className:"size-3","aria-hidden":!0}),"Show ",r," more"]})]})}function et(e){const{scope:t,pluginName:s,connection:i}=e;return t==="plugin"&&s?`Comes with the ${s} plugin`:i?_n(i):t?Me(t,s):null}function Ee({connection:e,authStatus:t,authClientOrigin:s,scope:i,pluginName:r,rawName:a,displayName:l,toolCount:h,tools:m,serverInfo:S,alsoUsedBy:p,error:g}){const c=et({scope:i,pluginName:r,connection:e});return n.jsxs("div",{className:"border-border/60 text-muted-foreground mt-2 space-y-1 border-t pt-2 text-xs leading-relaxed",children:[e&&n.jsx(_,{label:"Sign-in",align:"start",wrap:!0,labelClassName:L,children:n.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[n.jsx(Ze,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),Dn({connection:e,authStatus:t,clientOrigin:s})]})}),c&&n.jsx(_,{label:"Source",align:"start",wrap:!0,labelClassName:L,children:c}),a!==l&&n.jsx(_,{label:"Raw id",align:"start",wrap:!0,labelClassName:L,children:n.jsx("code",{className:"text-2xs font-mono",children:a})}),S&&n.jsx(_,{label:"Server",align:"start",wrap:!0,labelClassName:L,children:S}),p&&n.jsx(_,{label:"Also used by",align:"start",wrap:!0,labelClassName:L,children:p}),typeof h=="number"&&n.jsx(_,{label:"Tools",align:"start",labelClassName:L,children:h}),m&&m.length>0&&n.jsx(Jn,{tools:m}),g&&n.jsx(_,{label:"Error",align:"start",wrap:!0,labelClassName:L,children:n.jsx("code",{className:"text-2xs font-mono break-all",children:g})})]})}function nt({flow:e,serverName:t}){return n.jsxs(n.Fragment,{children:[n.jsx(be,{flow:e,serverName:t,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>e.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})}),(e.state.step==="disclosure"||e.state.step==="waiting")&&n.jsx("div",{className:"mt-2",children:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),"aria-label":`Cancel signing in to ${t}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function tt({server:e,agentId:t,live:s,testResult:i,rosterUpdatedAt:r,testing:a,busy:l,onToggle:h,onTest:m,onRemove:S}){const p=Se(t,e.name),g=p.state.step==="connected",c=An({stamped:i,signedInNow:g,authStatus:e.authStatus,rosterUpdatedAt:r}),b=we(e.connection),C=ke({enabled:e.enabled,testedOk:(c==null?void 0:c.ok)===!0,signedInNow:g,runtimeStatus:s==null?void 0:s.status,runtimeError:s==null?void 0:s.error,authStatus:e.authStatus,ownKey:b}),N=p.state.step==="starting",k=p.state.step==="disclosure"||p.state.step==="waiting"||N,x=k?"signing-in":C,z=kn({statusKey:C,testResult:c,signedInNow:g})&&(p.state.step==="idle"||N),y=Te(e.name),M=c!=null&&c.ok?c.toolCount??null:p.state.toolCount,R=k?x:Tn({status:x,probe:c}),A=Fn(R,{displayName:y.displayName,toolCount:M,justSignedIn:g}),O=k?"none":Pn(R),P=wn({connection:e.connection,authStatus:e.authStatus});return n.jsx(Oe,{displayName:y.displayName,rawName:e.name,scope:"agent",pluginName:y.pluginName,status:x,sentence:A,managed:!0,toggle:n.jsx(an,{checked:e.enabled,onCheckedChange:w=>h(e.name,w),disabled:l,"aria-label":`Enable ${e.name}`}),actions:n.jsxs(n.Fragment,{children:[z&&n.jsxs(f,{variant:"default",size:"sm",onClick:()=>p.start(),disabled:l||N,"aria-label":`Sign in to ${e.name}`,className:"gap-1.5 focus-visible:ring-2",children:[n.jsx(me,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!z&&O==="try-again"&&n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>m(e.name),disabled:a||l,"aria-label":`Try ${e.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[a?n.jsx(te,{size:"xs"}):null,"Try again"]}),!z&&O==="test"&&n.jsx(f,{variant:"outline",size:"sm",onClick:()=>m(e.name),disabled:a||l,className:"focus-visible:ring-2",children:a?n.jsx(te,{size:"xs"}):"Test"}),n.jsxs(Je,{children:[n.jsx(en,{asChild:!0,children:n.jsx(f,{variant:"ghost",size:"sm","aria-label":`More actions for ${e.name}`,className:"ml-auto focus-visible:ring-2",children:n.jsx(nn,{className:"size-4","aria-hidden":!0})})}),n.jsxs(tn,{align:"end",children:[n.jsxs(ee,{onSelect:()=>m(e.name),disabled:a||l,children:[n.jsx(dn,{className:"size-3.5","aria-hidden":!0}),"Test"]}),P&&n.jsxs(ee,{onSelect:()=>p.start(),disabled:l,children:[n.jsx(me,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),n.jsx(sn,{}),n.jsx(ee,{variant:"destructive",onSelect:()=>S(e.name),disabled:l,children:"Remove"})]})]})]}),details:n.jsx(Ee,{connection:e.connection,authStatus:e.authStatus,authClientOrigin:e.authClientOrigin,scope:"agent",pluginName:y.pluginName,rawName:y.rawName,displayName:y.displayName,toolCount:M,error:(c==null?void 0:c.ok)===!1?c.error:s==null?void 0:s.error}),children:n.jsx(nt,{flow:p,serverName:y.displayName})})}function st(e){switch(e.status){case"connected":return"connected";case"failed":return oe(e.error);case"needs-auth":return"needs-sign-in";case"pending":return"connecting";case"disabled":return"off";default:return"not-checked"}}function at(e){const{displayName:t,scope:s,pluginName:i}=e,r=rt(s,i);return`${t} ${r}. Manage it here to enable, disable, or sign in from DorkOS.`}function rt(e,t){return e==="plugin"&&t?`comes with the ${t} plugin`:e==="project"?"comes from this project’s own config":e==="computer"?"comes from your computer-wide config":"is loaded from outside DorkOS"}function it({entry:e,agentId:t,agentLabel:s,canImport:i}){const r=gn(),[a,l]=o.useState(null),[h,m]=o.useState(null),S=o.useCallback(async()=>{m(null);try{const x=await r.mutateAsync({input:{agentId:t,name:e.name}});x.status==="approval_required"&&l(x.approval)}catch(x){m(x instanceof Error?x.message:"Couldn’t add the server.")}},[r,t,e.name]),p=o.useCallback(async()=>{if(a){m(null);try{(await r.mutateAsync({input:{agentId:t,name:e.name},approval:a})).status!=="ok"&&m("Adding it still needs approval. Try again.")}catch(x){m(x instanceof Error?x.message:"Couldn’t add the server.")}}},[r,t,e.name,a]),g=Te(e.name),c=Bn(e,g),b=c!==null,C=g.rawName!==g.displayName,N=e.error!==void 0,k=b||C||N;return a?n.jsxs("div",{className:"border-border/60 mb-2 space-y-3 rounded-md border p-3 last:mb-0",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(xe,{className:"text-status-warning mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add “",g.displayName,"” to ",s,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:at({displayName:g.displayName,scope:c,pluginName:g.pluginName})})]})]}),h&&n.jsx("p",{className:"text-destructive text-xs",children:h}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>l(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:p,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Add to agent"})]})]}):n.jsx(Oe,{displayName:g.displayName,rawName:e.name,scope:c,pluginName:g.pluginName,status:st(e),sentence:qn(c,g.pluginName),managed:!1,actions:i?n.jsxs(n.Fragment,{children:[n.jsxs(f,{variant:"outline",size:"sm",onClick:S,disabled:r.isPending,"aria-label":`Add ${e.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[r.isPending?n.jsx(te,{size:"xs"}):n.jsx(fe,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),h&&n.jsx("p",{className:"text-destructive text-xs",children:h})]}):void 0,details:k?n.jsx(Ee,{scope:c,pluginName:g.pluginName,rawName:g.rawName,displayName:g.displayName,error:e.error}):void 0})}const ot={codex:["stdio","http"],opencode:["stdio","http"]};function ct(e){return ot[e]??Nn}function lt(){const{open:e}=cn();return n.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Want other apps to use DorkOS’s tools?"," ",n.jsx(f,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>e("tools","external-mcp"),children:"See Settings → Advanced → Tools"})]})}function dt({agent:e,projectPath:t}){var V;const s=rn(e.id),i=un(t,e.runtime),r=i.data,a=on(e.runtime),l=(a==null?void 0:a.supportsManagedMcpServers)??!0,h=pn(),m=fn(),S=hn(),p=xn(),[g,c]=o.useState({}),[b,C]=o.useState(null),[N,k]=o.useState(null),x=zn(),z=o.useCallback((u,j)=>{(j?h:m).mutate({agentId:e.id,name:u})},[e.id,h,m]),y=o.useCallback(u=>{S.mutate({agentId:e.id,name:u}),c(j=>{const T={...j};return delete T[u],T})},[e.id,S]),M=o.useCallback(async u=>{C(u);try{const j=await p.mutateAsync({agentId:e.id,name:u});c(T=>({...T,[u]:{result:j,at:Date.now()}}))}finally{C(null)}},[e.id,p]),R=o.useCallback(({name:u,transport:j})=>{k(u),j!=="stdio"&&M(u).catch(()=>{})},[M]),A=s.data??[],O=new Set(A.map(u=>u.name)),P=new Map(((r==null?void 0:r.servers)??[]).map(u=>[u.name,u])),w=((r==null?void 0:r.servers)??[]).filter(u=>!O.has(u.name)),I=h.isPending||m.isPending||S.isPending,F=new Map;A.forEach((u,j)=>F.set(u.name,{kind:"managed",index:j})),w.forEach((u,j)=>F.set(u.name,{kind:"discovered",index:j}));const B=x({bothSettled:!s.isPending&&!i.isPending,managed:A,live:P,discovered:w,present:[...A.map(u=>u.name),...w.map(u=>u.name)]});function U(u){const j=F.get(u);if(!j)return null;if(j.kind==="managed"){const E=A[j.index];return n.jsx(tt,{server:E,agentId:e.id,live:P.get(E.name),testResult:g[E.name],rosterUpdatedAt:s.dataUpdatedAt,testing:b===E.name,busy:I,onToggle:z,onTest:M,onRemove:y},E.name)}const T=w[j.index];return n.jsx(it,{entry:T,agentId:e.id,agentLabel:e.displayName??e.name,canImport:l},T.name)}return n.jsxs("section",{className:"space-y-3","aria-label":"MCP servers",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-semibold",children:"MCP Servers"}),l&&n.jsx(bn,{agentId:e.id,agentLabel:e.displayName??e.name,supportedTransports:ct(e.runtime),onAdded:R,oauthDetectedFor:N&&((V=g[N])==null?void 0:V.result.needsAuth)===!0?N:null})]}),n.jsx(lt,{}),!l&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"This agent can’t use added servers yet. View only."}),s.isLoading?n.jsx(K,{children:n.jsxs($,{className:"space-y-2",children:[n.jsx(se,{className:"h-5 w-full"}),n.jsx(se,{className:"h-5 w-3/4"})]})}):s.isError?n.jsx(K,{children:n.jsxs($,{className:"flex items-center justify-between gap-2",children:[n.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load managed servers."}),n.jsx(f,{variant:"outline",size:"sm",onClick:()=>s.refetch(),className:"focus-visible:ring-2",children:"Try again"})]})}):B.length===0?n.jsx(K,{children:n.jsx($,{children:n.jsxs("p",{className:"text-muted-foreground text-sm",children:["No MCP servers yet."," ",l?"Add one for more tools.":"This agent can’t use them yet."]})})}):n.jsx(K,{children:n.jsx($,{children:B.map(U)})})]})}function jt({member:e}){const{agent:t,projectPath:s,isPending:i}=ln(e);return i?n.jsx(se,{className:"h-32 w-full"}):!t||s===null?n.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s MCP servers."}):n.jsx(dt,{agent:t,projectPath:s})}export{jt as ToolsPage};
1
+ import{a5 as G,a6 as _e,a8 as ae,a7 as pe,eK as Ke,r as o,j as n,bh as K,bi as $,B as f,g$ as $e,j5 as Ue,f as fe,j6 as xe,gE as X,bb as Ve,eL as D,I as W,ew as Be,ex as qe,ey as Ye,ez as He,eA as We,dC as de,cC as Qe,fZ as Ge,C as ne,G as ue,W as re,dn as je,dp as Ne,a2 as Ze,dq as ve,eN as Je,j7 as me,x as te,ge as Xe,gf as en,gg as nn,gh as tn,gi as ee,gk as sn,a3 as an,j8 as rn,y as on,e as se,hS as cn,b as ln}from"./index-BR1m9FON.js";import"./relay-trace-schemas-4AAUf-Zl.js";import{u as Se,M as be}from"./McpSigninBody-ZrnzwrOH.js";import{D as L}from"./detail-row-Crl89jnh.js";import{R as dn}from"./rotate-cw-BbHkWN-J.js";import"./form-BL14vwyB.js";import"./copy-button-BOznikwM.js";function un(e,t){const s=G();return _e({queryKey:["mcp-config",e,t??null],queryFn:()=>s.getMcpConfig(e,{runtime:t??void 0}),enabled:!!e,staleTime:3e4})}function ye(e,t){e.invalidateQueries({queryKey:Ke.mcpServers(t)}),e.invalidateQueries({queryKey:["mcp-config"]})}function Ce(e){const t=G(),s=pe();return ae({mutationFn:async({input:i,approval:r})=>r?(await t.grantApproval(r.approvalId),e(t,i,r.approvalToken)):e(t,i),onSuccess:(i,{input:r})=>{i.status==="ok"&&ye(s,r.agentId)}})}function mn(){return Ce((e,t,s)=>e.addAgentMcpServer(t,s?{approvalToken:s}:void 0))}function gn(){return Ce((e,t,s)=>e.importAgentMcpServer(t,s?{approvalToken:s}:void 0))}function ie(e){const t=G(),s=pe();return ae({mutationFn:({agentId:i,name:r})=>e(t,i,r),onSuccess:(i,{agentId:r})=>ye(s,r)})}function hn(){return ie((e,t,s)=>e.removeAgentMcpServer(t,s))}function pn(){return ie((e,t,s)=>e.enableAgentMcpServer(t,s))}function fn(){return ie((e,t,s)=>e.disableAgentMcpServer(t,s))}function xn(){const e=G();return ae({mutationFn:({agentId:t,name:s})=>e.testAgentMcpServer(t,s)})}function jn({agentId:e,serverName:t,onDone:s}){const i=Se(e,t),{start:r}=i,a=o.useRef(!1);return o.useEffect(()=>{a.current||(a.current=!0,r())},[r]),n.jsx(K,{children:n.jsxs($,{className:"space-y-2",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Sign in to ",t]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Sign in so your agent can use this server."}),n.jsx(be,{flow:i,serverName:t,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>i.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:s,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:s,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&n.jsx(f,{variant:"ghost",size:"sm",onClick:s,className:"focus-visible:ring-2",children:"Later"})]})})}const Nn=["stdio","http","sse"],vn=/^[a-zA-Z0-9_-]+$/;function ge(e){const t={};for(const s of e.split(`
2
+ `)){const i=s.trim();if(!i)continue;const r=i.indexOf("=");if(r===-1)continue;const a=i.slice(0,r).trim();a&&(t[a]=i.slice(r+1).trim())}return t}function he(e){return e.trim().length?e.trim().split(/\s+/):[]}function Sn(e,t){if(e.status!=="ok")return!1;const s=e.servers.find(r=>r.name===t),i=s==null?void 0:s.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function bn({agentId:e,agentLabel:t,supportedTransports:s,onAdded:i,oauthDetectedFor:r=null}){const a=mn(),[l,h]=o.useState(!1),[m,S]=o.useState(""),[p,g]=o.useState(s[0]??"stdio"),c=s.includes(p)?p:s[0]??"stdio",[b,C]=o.useState(""),[N,k]=o.useState(""),[x,z]=o.useState(""),[y,M]=o.useState(""),[R,A]=o.useState(""),[O,P]=o.useState(null),[w,I]=o.useState(null),[F,V]=o.useState(!1),U=o.useCallback(d=>{const v=$e(d);V(v!==null),I(v??(d instanceof Error?d.message:"Couldn’t add the server."))},[]),[B,u]=o.useState(null),[j,T]=o.useState(null),E=vn.test(m)&&m.length<=64,ze=c==="stdio"?b.trim().length>0:y.trim().length>0,Z=Ue(),Re=E&&ze&&!a.isPending&&!Z,ce=o.useCallback(()=>c==="stdio"?{transport:"stdio",command:b.trim(),args:he(N),env:ge(x)}:{transport:c,url:y.trim(),headers:ge(R)},[c,b,N,x,y,R]),q=o.useCallback(()=>({agentId:e,name:m.trim(),connection:ce()}),[e,m,ce]),J=o.useCallback(()=>{h(!1),P(null),I(null),S(""),g(s[0]??"stdio"),C(""),k(""),z(""),M(""),A("")},[s]),le=o.useCallback(d=>{i({name:d.name,transport:d.connection.transport}),J()},[i,J]),Y=o.useCallback((d,v)=>{const Le=Sn(d,v.name);le(v),Le&&u(v.name)},[le]),Pe=o.useCallback(async()=>{I(null);const d=q();try{const v=await a.mutateAsync({input:d});v.status==="approval_required"?P(v.approval):Y(v,d)}catch(v){U(v)}},[a,q,Y,U]),Ie=o.useCallback(async()=>{if(!O)return;I(null);const d=q();try{const v=await a.mutateAsync({input:d,approval:O});v.status==="ok"?Y(v,d):(V(!1),I("The server still needs approval. Try again."))}catch(v){U(v)}},[a,q,O,Y,U]),H=B??(r&&r!==j?r:null),Fe=o.useCallback(()=>{T(H),u(null)},[H]),De=o.useMemo(()=>[b.trim(),...he(N)].filter(Boolean).join(" "),[b,N]);return H?n.jsx(jn,{agentId:e,serverName:H,onDone:Fe}):l?O?n.jsx(K,{children:n.jsxs($,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(xe,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add this server to ",t,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:c==="stdio"?"Runs on this computer when a chat starts.":"The agent connects here when a chat starts."})]})]}),n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:c==="stdio"?De:y.trim()}),w&&(F?n.jsx(X,{tone:"info",role:"status",className:"text-xs",children:w}):n.jsx("p",{className:"text-destructive text-xs",children:w})),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>P(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{size:"sm",onClick:Ie,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add server"})]})]})}):n.jsx(K,{children:n.jsxs($,{className:"space-y-3",children:[Z&&n.jsx(X,{tone:"info",role:"status",className:"text-xs",children:n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(Ve,{className:"size-3.5 shrink-0","aria-hidden":!0}),"Adding a server only works at this computer. You’re on Wi-Fi."]})}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-name",children:"Name"}),n.jsx(W,{id:"mcp-name",value:m,onChange:d=>S(d.target.value),placeholder:"my-server","aria-invalid":m.length>0&&!E}),m.length>0&&!E&&n.jsx("p",{className:"text-destructive text-xs",children:"Letters, numbers, dashes, underscores only."})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-transport",children:"Transport"}),n.jsxs(Be,{value:c,onValueChange:d=>g(d),children:[n.jsx(qe,{id:"mcp-transport",className:"w-full",children:n.jsx(Ye,{})}),n.jsx(He,{children:s.map(d=>n.jsx(We,{value:d,children:d},d))})]})]}),c==="stdio"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-command",children:"Command"}),n.jsx(W,{id:"mcp-command",value:b,onChange:d=>C(d.target.value),placeholder:"npx",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-args",children:"Arguments"}),n.jsx(W,{id:"mcp-args",value:N,onChange:d=>k(d.target.value),placeholder:"-y @modelcontextprotocol/server-filesystem",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-env",children:"Environment (KEY=VALUE per line)"}),n.jsx(de,{id:"mcp-env",value:x,onChange:d=>z(d.target.value),placeholder:"API_KEY=…",rows:2,className:"font-mono text-xs"})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-url",children:"URL"}),n.jsx(W,{id:"mcp-url",value:y,onChange:d=>M(d.target.value),placeholder:"https://example.com/mcp",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(D,{htmlFor:"mcp-headers",children:"Headers (KEY=VALUE per line)"}),n.jsx(de,{id:"mcp-headers",value:R,onChange:d=>A(d.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),w&&!(Z&&F)&&(F?n.jsx(X,{tone:"info",role:"status",className:"text-xs",children:w}):n.jsx("p",{className:"text-destructive text-xs",children:w})),n.jsx(Qe,{}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:J,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:Pe,disabled:!Re,className:"focus-visible:ring-2",children:"Continue"})]})]})}):n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>h(!0),className:"focus-visible:ring-2",children:[n.jsx(fe,{className:"size-4"}),"Add server"]})}const yn={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},Cn=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function oe(e){if(!e)return"cant-reach";const t=e.toLowerCase();return Cn.some(s=>t.includes(s))?"setup-problem":"cant-reach"}function we(e){return e.transport==="stdio"||e.authKind==="oauth2"?!1:Object.keys(e.headers).some(t=>t.toLowerCase()==="authorization")}function wn(e){const{connection:t,authStatus:s}=e;return t.transport!=="stdio"&&t.authKind==="oauth2"?!0:s!==void 0}function ke(e){const{enabled:t,testedOk:s,signedInNow:i,runtimeStatus:r,runtimeError:a,authStatus:l,ownKey:h}=e;return t?s?"connected":i?"signed-in":r==="failed"?oe(a):l==="connected"&&r==="needs-auth"?"signed-in":l==="needs-auth"&&(r==="connected"||r==="pending")?"needs-sign-in":r?yn[r]:l==="connected"?"signed-in":l==="needs-auth"?"needs-sign-in":h?"uses-your-key":"not-checked":"off"}function kn(e){const{statusKey:t,testResult:s,signedInNow:i}=e;return t==="off"||i?!1:(s==null?void 0:s.needsAuth)===!0?!0:t==="needs-sign-in"}function An(e){const{stamped:t,signedInNow:s,authStatus:i,rosterUpdatedAt:r}=e;if(!t)return;const{result:a}=t;if(!(s&&a.needsAuth===!0)&&!(t.at<=r&&(i==="needs-auth"&&a.ok||i==="connected"&&a.needsAuth===!0)))return a}function Tn(e){const{status:t,probe:s}=e;return t==="off"||!s||s.ok?t:s.needsAuth===!0?"needs-sign-in":oe(s.error)}const Q={attention:0,working:1,elsewhere:2,off:3};function Mn(e){return e==="off"?Q.off:e==="needs-sign-in"||e==="cant-reach"||e==="setup-problem"?Q.attention:Q.working}function On(e){const{managed:t,live:s,discovered:i}=e;return[...t.map(a=>{var l,h;return{name:a.name,band:Mn(ke({enabled:a.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(l=s.get(a.name))==null?void 0:l.status,runtimeError:(h=s.get(a.name))==null?void 0:h.error,authStatus:a.authStatus,ownKey:we(a.connection)}))}}),...i.map(a=>({name:a.name,band:Q.elsewhere}))].map((a,l)=>({entry:a,index:l})).sort((a,l)=>a.entry.band-l.entry.band||a.index-l.index).map(({entry:a})=>a.name)}function En(e){const{frozen:t,present:s}=e,i=new Set(s),r=new Set(t);return{ordered:t.filter(a=>i.has(a)),added:s.filter(a=>!r.has(a))}}function zn(){const e=Ge(null);return({bothSettled:t,managed:s,live:i,discovered:r,present:a})=>{e.read()===null&&t&&a.length>0&&e.write(On({managed:s,live:i,discovered:r}));const{ordered:l,added:h}=En({frozen:e.read()??[],present:a});return h.length>0&&e.read()!==null&&e.write([...l,...h]),[...l,...h]}}const Ae={"needs-sign-in":{label:"Needs sign-in",tooltip:"Sign in to use it.",tone:"attention"},"signing-in":{label:"Signing in…",tooltip:"Finish in the new tab.",tone:"attention"},connected:{label:"Connected",tooltip:"It answered. Its tools are ready.",tone:"calm"},"signed-in":{label:"Signed in",tooltip:"Signed in, not tested yet.",tone:"calm"},"uses-your-key":{label:"Uses your key",tooltip:"Uses a key you added.",tone:"calm"},"cant-reach":{label:"Can’t reach",tooltip:"No answer. See Details.",tone:"error"},"setup-problem":{label:"Setup problem",tooltip:"Couldn’t start. See Details.",tone:"error"},connecting:{label:"Connecting…",tooltip:"Connecting to this server.",tone:"calm"},"not-checked":{label:"Not checked yet",tooltip:"Nothing has checked it yet.",tone:"calm"},off:{label:"Off",tooltip:"Hidden from the agent.",tone:"calm"}},Rn={"needs-sign-in":"sign-in","signing-in":"none",connected:"none","signed-in":"test","uses-your-key":"test","cant-reach":"try-again","setup-problem":"try-again",connecting:"none","not-checked":"test",off:"none"};function Pn(e){return Rn[e]}function In({toolCount:e,justSignedIn:t}){const s=t?"Signed in just now. ":"";return e===null?`${s||"This server answered. "}Its tools are available.`:`${s}${e} tool${e===1?"":"s"} available.`}function Fn(e,t){switch(e){case"needs-sign-in":return`Sign in to ${t.displayName} to use its tools.`;case"signing-in":return null;case"connected":return In(t);case"signed-in":return t.justSignedIn?"Signed in just now. Test to check it answers.":"Signed in. Test to check it answers.";case"uses-your-key":return"You added an access key when setting this up.";case"cant-reach":return"This server didn’t answer. It may be down.";case"setup-problem":return"This server’s setup has a problem.";case"connecting":return"Connecting to this server.";case"not-checked":return"Nothing has checked this server yet.";case"off":return"Turned off. The agent doesn’t see this server."}}function Dn(e){const{connection:t,authStatus:s,clientOrigin:i}=e;return t.transport==="stdio"?"None. This server doesn’t need one.":t.authKind==="oauth2"?i==="manual"?`Your own app credentials, ${s==="connected"?"signed in, renews automatically":"not signed in yet"}. DorkOS holds the key, not the agent.`:s==="connected"?"Signed in, and it renews automatically. DorkOS holds the key, not the agent.":"DorkOS will hold the key, not the agent.":Object.keys(t.headers).some(a=>a.toLowerCase()==="authorization")?"Access key: you added a key when setting this up.":s===void 0?"Nothing has checked this yet.":"None. This server doesn’t need one."}function Ln(e){if(e.transport==="stdio")return`Runs \`${e.command}\` on this computer`;const t=_n(e.url);return t?`${t} (web service)`:`${e.url} (web service)`}function _n(e){try{return new URL(e).host}catch{return null}}const Kn={agent:"Added to this agent through DorkOS",project:"From this project’s config files",plugin:"Comes with a plugin",computer:"From your computer-wide config"},$n={agent:"Added to this agent through DorkOS.",project:"From this project’s config. Add it to manage it here.",plugin:"Comes with a plugin. Add it to manage it here.",computer:"From your computer-wide config. Add it to manage it here."},Un=[{runtime:"claude-code",pattern:/^plugin:([^:]+):(.+)$/,read:e=>({pluginName:e[1],displayName:e[2]})},{runtime:"claude-code",pattern:/^plugin:(.+)$/,read:e=>({pluginName:e[1],displayName:e[1]})}];function Te(e){for(const t of Un){const s=e.match(t.pattern);if(!s)continue;const{displayName:i,pluginName:r}=t.read(s);if(!(!i||!r))return{displayName:i,pluginName:r,rawName:e}}return{displayName:e,pluginName:null,rawName:e}}function Vn(e,t){return t.pluginName?"plugin":e.scope==="project"||e.scope==="local"?"project":e.scope==="user"?"computer":null}const Bn="Loaded from outside DorkOS. Add it to manage it here.";function Me(e,t){return e==="plugin"&&t?`Comes with the ${t} plugin`:Kn[e]}function qn(e,t){return e===null?Bn:e==="plugin"&&t?`Comes with the ${t} plugin. Add it to manage it here.`:$n[e]}const Yn=re("border-border/60 relative overflow-hidden rounded-md border px-3 py-2.5 transition-colors",{variants:{managed:{true:"bg-card",false:"bg-muted/30"},dimmed:{true:"opacity-65",false:""}},defaultVariants:{managed:!0,dimmed:!1}}),Hn=re("pointer-events-none absolute inset-y-0 left-0 w-0.5",{variants:{tone:{calm:"hidden",attention:"bg-status-warning",error:"bg-status-error"}},defaultVariants:{tone:"calm"}}),Wn=re("shrink-0 rounded-full px-2 py-0.5 text-2xs leading-4 font-medium whitespace-nowrap",{variants:{chip:{success:"bg-status-success-bg text-status-success-fg",info:"bg-status-info-bg text-status-info-fg",warning:"bg-status-warning-bg text-status-warning-fg",error:"bg-status-error-bg text-status-error-fg",neutral:"bg-muted text-muted-foreground"}},defaultVariants:{chip:"neutral"}}),Qn={connected:"success","signed-in":"info","needs-sign-in":"warning","signing-in":"warning","cant-reach":"error","setup-problem":"error","uses-your-key":"neutral",connecting:"neutral","not-checked":"neutral",off:"neutral"};function Gn({status:e}){const t=Ae[e];return n.jsxs(je,{children:[n.jsx(Ne,{asChild:!0,children:n.jsx("span",{className:Wn({chip:Qn[e]}),children:t.label})}),n.jsx(ve,{children:t.tooltip})]})}function Zn({scope:e,pluginName:t}){return n.jsxs(je,{children:[n.jsx(Ne,{asChild:!0,children:n.jsx(Ze,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:e})}),n.jsx(ve,{children:Me(e,t)})]})}function Oe({displayName:e,rawName:t,scope:s,pluginName:i,status:r,sentence:a,managed:l,toggle:h,actions:m,children:S,details:p,defaultDetailsOpen:g=!1}){const[c,b]=o.useState(g),C=o.useId(),N=Ae[r].tone;return n.jsxs("div",{"data-mcp-server":t,className:ue(Yn({managed:l,dimmed:r==="off"}),"mb-2 last:mb-0"),children:[n.jsx("span",{className:Hn({tone:N}),"aria-hidden":!0}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e}),s&&n.jsx(Zn,{scope:s,pluginName:i}),n.jsx(Gn,{status:r}),h]}),a&&n.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:a}),S,m&&n.jsx("div",{className:"mt-2 flex items-center gap-1",children:m}),p&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>b(k=>!k),"aria-expanded":c,"aria-controls":C,className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(ne,{className:ue("size-3 transition-transform",c&&"rotate-90"),"aria-hidden":!0}),"Details"]}),c&&n.jsxs("div",{id:C,children:[p,n.jsxs("button",{type:"button",onClick:()=>b(!1),className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(ne,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const Jn=3,_="text-muted-foreground/70";function Xn({tools:e}){const[t,s]=o.useState(!1),i=t?e:e.slice(0,Jn),r=e.length-i.length;return n.jsxs("div",{className:"mt-1.5",children:[i.map(a=>n.jsxs("div",{className:"border-border/40 flex items-baseline gap-2 border-b py-1 last:border-b-0",children:[n.jsx("code",{className:"text-foreground text-2xs shrink-0 font-mono",children:a.name}),a.description&&n.jsx("span",{className:"text-muted-foreground text-2xs truncate",children:a.description})]},a.name)),r>0&&n.jsxs("button",{type:"button",onClick:()=>s(!0),className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(ne,{className:"size-3","aria-hidden":!0}),"Show ",r," more"]})]})}function et(e){const{scope:t,pluginName:s,connection:i}=e;return t==="plugin"&&s?`Comes with the ${s} plugin`:i?Ln(i):t?Me(t,s):null}function Ee({connection:e,authStatus:t,authClientOrigin:s,scope:i,pluginName:r,rawName:a,displayName:l,toolCount:h,tools:m,serverInfo:S,alsoUsedBy:p,error:g}){const c=et({scope:i,pluginName:r,connection:e});return n.jsxs("div",{className:"border-border/60 text-muted-foreground mt-2 space-y-1 border-t pt-2 text-xs leading-relaxed",children:[e&&n.jsx(L,{label:"Sign-in",align:"start",wrap:!0,labelClassName:_,children:n.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[n.jsx(Je,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),Dn({connection:e,authStatus:t,clientOrigin:s})]})}),c&&n.jsx(L,{label:"Source",align:"start",wrap:!0,labelClassName:_,children:c}),a!==l&&n.jsx(L,{label:"Raw id",align:"start",wrap:!0,labelClassName:_,children:n.jsx("code",{className:"text-2xs font-mono",children:a})}),S&&n.jsx(L,{label:"Server",align:"start",wrap:!0,labelClassName:_,children:S}),p&&n.jsx(L,{label:"Also used by",align:"start",wrap:!0,labelClassName:_,children:p}),typeof h=="number"&&n.jsx(L,{label:"Tools",align:"start",labelClassName:_,children:h}),m&&m.length>0&&n.jsx(Xn,{tools:m}),g&&n.jsx(L,{label:"Error",align:"start",wrap:!0,labelClassName:_,children:n.jsx("code",{className:"text-2xs font-mono break-all",children:g})})]})}function nt({flow:e,serverName:t}){return n.jsxs(n.Fragment,{children:[n.jsx(be,{flow:e,serverName:t,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>e.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})}),(e.state.step==="disclosure"||e.state.step==="waiting")&&n.jsx("div",{className:"mt-2",children:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),"aria-label":`Cancel signing in to ${t}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function tt({server:e,agentId:t,live:s,testResult:i,rosterUpdatedAt:r,testing:a,busy:l,onToggle:h,onTest:m,onRemove:S}){const p=Se(t,e.name),g=p.state.step==="connected",c=An({stamped:i,signedInNow:g,authStatus:e.authStatus,rosterUpdatedAt:r}),b=we(e.connection),C=ke({enabled:e.enabled,testedOk:(c==null?void 0:c.ok)===!0,signedInNow:g,runtimeStatus:s==null?void 0:s.status,runtimeError:s==null?void 0:s.error,authStatus:e.authStatus,ownKey:b}),N=p.state.step==="starting",k=p.state.step==="disclosure"||p.state.step==="waiting"||N,x=k?"signing-in":C,z=kn({statusKey:C,testResult:c,signedInNow:g})&&(p.state.step==="idle"||N),y=Te(e.name),M=c!=null&&c.ok?c.toolCount??null:p.state.toolCount,R=k?x:Tn({status:x,probe:c}),A=Fn(R,{displayName:y.displayName,toolCount:M,justSignedIn:g}),O=k?"none":Pn(R),P=wn({connection:e.connection,authStatus:e.authStatus});return n.jsx(Oe,{displayName:y.displayName,rawName:e.name,scope:"agent",pluginName:y.pluginName,status:x,sentence:A,managed:!0,toggle:n.jsx(an,{checked:e.enabled,onCheckedChange:w=>h(e.name,w),disabled:l,"aria-label":`Enable ${e.name}`}),actions:n.jsxs(n.Fragment,{children:[z&&n.jsxs(f,{variant:"default",size:"sm",onClick:()=>p.start(),disabled:l||N,"aria-label":`Sign in to ${e.name}`,className:"gap-1.5 focus-visible:ring-2",children:[n.jsx(me,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!z&&O==="try-again"&&n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>m(e.name),disabled:a||l,"aria-label":`Try ${e.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[a?n.jsx(te,{size:"xs"}):null,"Try again"]}),!z&&O==="test"&&n.jsx(f,{variant:"outline",size:"sm",onClick:()=>m(e.name),disabled:a||l,className:"focus-visible:ring-2",children:a?n.jsx(te,{size:"xs"}):"Test"}),n.jsxs(Xe,{children:[n.jsx(en,{asChild:!0,children:n.jsx(f,{variant:"ghost",size:"sm","aria-label":`More actions for ${e.name}`,className:"ml-auto focus-visible:ring-2",children:n.jsx(nn,{className:"size-4","aria-hidden":!0})})}),n.jsxs(tn,{align:"end",children:[n.jsxs(ee,{onSelect:()=>m(e.name),disabled:a||l,children:[n.jsx(dn,{className:"size-3.5","aria-hidden":!0}),"Test"]}),P&&n.jsxs(ee,{onSelect:()=>p.start(),disabled:l,children:[n.jsx(me,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),n.jsx(sn,{}),n.jsx(ee,{variant:"destructive",onSelect:()=>S(e.name),disabled:l,children:"Remove"})]})]})]}),details:n.jsx(Ee,{connection:e.connection,authStatus:e.authStatus,authClientOrigin:e.authClientOrigin,scope:"agent",pluginName:y.pluginName,rawName:y.rawName,displayName:y.displayName,toolCount:M,error:(c==null?void 0:c.ok)===!1?c.error:s==null?void 0:s.error}),children:n.jsx(nt,{flow:p,serverName:y.displayName})})}function st(e){switch(e.status){case"connected":return"connected";case"failed":return oe(e.error);case"needs-auth":return"needs-sign-in";case"pending":return"connecting";case"disabled":return"off";default:return"not-checked"}}function at(e){const{displayName:t,scope:s,pluginName:i}=e,r=rt(s,i);return`${t} ${r}. Manage it here to enable, disable, or sign in from DorkOS.`}function rt(e,t){return e==="plugin"&&t?`comes with the ${t} plugin`:e==="project"?"comes from this project’s own config":e==="computer"?"comes from your computer-wide config":"is loaded from outside DorkOS"}function it({entry:e,agentId:t,agentLabel:s,canImport:i}){const r=gn(),[a,l]=o.useState(null),[h,m]=o.useState(null),S=o.useCallback(async()=>{m(null);try{const x=await r.mutateAsync({input:{agentId:t,name:e.name}});x.status==="approval_required"&&l(x.approval)}catch(x){m(x instanceof Error?x.message:"Couldn’t add the server.")}},[r,t,e.name]),p=o.useCallback(async()=>{if(a){m(null);try{(await r.mutateAsync({input:{agentId:t,name:e.name},approval:a})).status!=="ok"&&m("Adding it still needs approval. Try again.")}catch(x){m(x instanceof Error?x.message:"Couldn’t add the server.")}}},[r,t,e.name,a]),g=Te(e.name),c=Vn(e,g),b=c!==null,C=g.rawName!==g.displayName,N=e.error!==void 0,k=b||C||N;return a?n.jsxs("div",{className:"border-border/60 mb-2 space-y-3 rounded-md border p-3 last:mb-0",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(xe,{className:"text-status-warning mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add “",g.displayName,"” to ",s,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:at({displayName:g.displayName,scope:c,pluginName:g.pluginName})})]})]}),h&&n.jsx("p",{className:"text-destructive text-xs",children:h}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>l(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:p,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Add to agent"})]})]}):n.jsx(Oe,{displayName:g.displayName,rawName:e.name,scope:c,pluginName:g.pluginName,status:st(e),sentence:qn(c,g.pluginName),managed:!1,actions:i?n.jsxs(n.Fragment,{children:[n.jsxs(f,{variant:"outline",size:"sm",onClick:S,disabled:r.isPending,"aria-label":`Add ${e.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[r.isPending?n.jsx(te,{size:"xs"}):n.jsx(fe,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),h&&n.jsx("p",{className:"text-destructive text-xs",children:h})]}):void 0,details:k?n.jsx(Ee,{scope:c,pluginName:g.pluginName,rawName:g.rawName,displayName:g.displayName,error:e.error}):void 0})}const ot={codex:["stdio","http"],opencode:["stdio","http"]};function ct(e){return ot[e]??Nn}function lt(){const{open:e}=cn();return n.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Want other apps to use DorkOS’s tools?"," ",n.jsx(f,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>e("tools","external-mcp"),children:"See Settings → Advanced → Tools"})]})}function dt({agent:e,projectPath:t}){var B;const s=rn(e.id),i=un(t,e.runtime),r=i.data,a=on(e.runtime),l=(a==null?void 0:a.supportsManagedMcpServers)??!0,h=pn(),m=fn(),S=hn(),p=xn(),[g,c]=o.useState({}),[b,C]=o.useState(null),[N,k]=o.useState(null),x=zn(),z=o.useCallback((u,j)=>{(j?h:m).mutate({agentId:e.id,name:u})},[e.id,h,m]),y=o.useCallback(u=>{S.mutate({agentId:e.id,name:u}),c(j=>{const T={...j};return delete T[u],T})},[e.id,S]),M=o.useCallback(async u=>{C(u);try{const j=await p.mutateAsync({agentId:e.id,name:u});c(T=>({...T,[u]:{result:j,at:Date.now()}}))}finally{C(null)}},[e.id,p]),R=o.useCallback(({name:u,transport:j})=>{k(u),j!=="stdio"&&M(u).catch(()=>{})},[M]),A=s.data??[],O=new Set(A.map(u=>u.name)),P=new Map(((r==null?void 0:r.servers)??[]).map(u=>[u.name,u])),w=((r==null?void 0:r.servers)??[]).filter(u=>!O.has(u.name)),I=h.isPending||m.isPending||S.isPending,F=new Map;A.forEach((u,j)=>F.set(u.name,{kind:"managed",index:j})),w.forEach((u,j)=>F.set(u.name,{kind:"discovered",index:j}));const V=x({bothSettled:!s.isPending&&!i.isPending,managed:A,live:P,discovered:w,present:[...A.map(u=>u.name),...w.map(u=>u.name)]});function U(u){const j=F.get(u);if(!j)return null;if(j.kind==="managed"){const E=A[j.index];return n.jsx(tt,{server:E,agentId:e.id,live:P.get(E.name),testResult:g[E.name],rosterUpdatedAt:s.dataUpdatedAt,testing:b===E.name,busy:I,onToggle:z,onTest:M,onRemove:y},E.name)}const T=w[j.index];return n.jsx(it,{entry:T,agentId:e.id,agentLabel:e.displayName??e.name,canImport:l},T.name)}return n.jsxs("section",{className:"space-y-3","aria-label":"MCP servers",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-semibold",children:"MCP Servers"}),l&&n.jsx(bn,{agentId:e.id,agentLabel:e.displayName??e.name,supportedTransports:ct(e.runtime),onAdded:R,oauthDetectedFor:N&&((B=g[N])==null?void 0:B.result.needsAuth)===!0?N:null})]}),n.jsx(lt,{}),!l&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"This agent can’t use added servers yet. View only."}),s.isLoading?n.jsx(K,{children:n.jsxs($,{className:"space-y-2",children:[n.jsx(se,{className:"h-5 w-full"}),n.jsx(se,{className:"h-5 w-3/4"})]})}):s.isError?n.jsx(K,{children:n.jsxs($,{className:"flex items-center justify-between gap-2",children:[n.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load managed servers."}),n.jsx(f,{variant:"outline",size:"sm",onClick:()=>s.refetch(),className:"focus-visible:ring-2",children:"Try again"})]})}):V.length===0?n.jsx(K,{children:n.jsx($,{children:n.jsxs("p",{className:"text-muted-foreground text-sm",children:["No MCP servers yet."," ",l?"Add one for more tools.":"This agent can’t use them yet."]})})}):n.jsx(K,{children:n.jsx($,{children:V.map(U)})})]})}function jt({member:e}){const{agent:t,projectPath:s,isPending:i}=ln(e);return i?n.jsx(se,{className:"h-32 w-full"}):!t||s===null?n.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s MCP servers."}):n.jsx(dt,{agent:t,projectPath:s})}export{jt as ToolsPage};