dorkos 0.124.0 → 0.124.1

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 (311) hide show
  1. package/dist/bin/cli.js +935 -551
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-BH8Ndn3e.js → AboutPage-DHaZvsJE.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-K5Mew9EX.js → ActivityErrorState-BP-qFk2S.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-BB20L5HU.js → ActivityPage-Bme3TzdQ.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-C5O7rnmS.js → ActivityRow-BRZyW9MA.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-Bmybvrzb.js → AdapterIcon-BcfquTja.js} +1 -1
  9. package/dist/client/assets/{AdapterSetupWizard-CkdV7Hhh.js → AdapterSetupWizard-B4I23pBg.js} +1 -1
  10. package/dist/client/assets/{AgentOptionRow-BA2cDa7r.js → AgentOptionRow-Cb34LtmH.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-CsIIPGZJ.js → AgentPicker-ouNRFSDh.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-0fOxvaoe.js → AgentRequestCard-B6MHIsxa.js} +2 -2
  13. package/dist/client/assets/{AppearancePage-XOjkkoli.js → AppearancePage-CutehigK.js} +1 -1
  14. package/dist/client/assets/ApplyToOverridesDialog-B-wIUI27.js +1 -0
  15. package/dist/client/assets/{AttentionSignalRow-CjjZobp7.js → AttentionSignalRow-B1aMjgX_.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-9TVHyRPJ.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CdWF4WLz.js} +1 -1
  17. package/dist/client/assets/{BindingDialog-DLoAQauL.js → BindingDialog-BAdueON5.js} +1 -1
  18. package/dist/client/assets/{BlintzCanvas-CYHsXAcY.js → BlintzCanvas-b30dG4gx.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent--Gr7Fe_U.js → CanvasCsvContent-DGHgSikG.js} +1 -1
  20. package/dist/client/assets/{CanvasFileContent-estXyAbr.js → CanvasFileContent-D1bFaUeh.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-CkOo930M.js → CanvasModel3dContent-dST7g1v2.js} +2 -2
  22. package/dist/client/assets/{ChatAppsOff-D4L1zJVN.js → ChatAppsOff-DiObvmJS.js} +1 -1
  23. package/dist/client/assets/{CodeMirrorDiff-DY_6ju-z.js → CodeMirrorDiff-BncI1OY1.js} +1 -1
  24. package/dist/client/assets/{CodeMirrorEditor-BUoDBsBv.js → CodeMirrorEditor-DV6psv19.js} +1 -1
  25. package/dist/client/assets/{CommitmentList-wDkcVP9c.js → CommitmentList-Dx_Ek_Gl.js} +1 -1
  26. package/dist/client/assets/{CommitmentsPage-CzSM6b8R.js → CommitmentsPage-Bca8NMUa.js} +1 -1
  27. package/dist/client/assets/{ComputerResourceView-cERD9H2L.js → ComputerResourceView-DNVNFTdn.js} +1 -1
  28. package/dist/client/assets/{ComputerViewer-rMcfbk2_.js → ComputerViewer-D8SxJdMm.js} +1 -1
  29. package/dist/client/assets/{ConnectionAccessLists-f7QeQbQo.js → ConnectionAccessLists-Bhj1YT15.js} +1 -1
  30. package/dist/client/assets/{ConnectionsPage-BmjtA6pw.js → ConnectionsPage-B20JZxoK.js} +1 -1
  31. package/dist/client/assets/{ConventionPage-CH-ah6nI.js → ConventionPage-De645wxU.js} +1 -1
  32. package/dist/client/assets/{ExtensionPageRoute-CJIxa6ST.js → ExtensionPageRoute-nTeiOBRQ.js} +1 -1
  33. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BP7EJ2JL.js → FloatingTanStackRouterDevtools-CqogiFob-DM79UITv.js} +1 -1
  34. package/dist/client/assets/HandlePage-B08V-om7.js +1 -0
  35. package/dist/client/assets/{HeartbeatPage-BUsf-qrU.js → HeartbeatPage-CBoUxz6t.js} +1 -1
  36. package/dist/client/assets/{KeyEntry-C2kWdN8q.js → KeyEntry-Cug8ocpX.js} +1 -1
  37. package/dist/client/assets/{LexicalField-CR8ulsI_.js → LexicalField-Bv_ogmAq.js} +1 -1
  38. package/dist/client/assets/{ManagesPage-DTtsIOGi.js → ManagesPage-DfJBQKK3.js} +1 -1
  39. package/dist/client/assets/{Marketplace-iaV5XAzv.js → Marketplace-swCVUbdY.js} +2 -2
  40. package/dist/client/assets/{MarketplaceSourcesView-6tgzUfFj.js → MarketplaceSourcesView-CDZDChpV.js} +1 -1
  41. package/dist/client/assets/{McpAppFrame-C7eYYdI9.js → McpAppFrame-BM9cNPPd.js} +1 -1
  42. package/dist/client/assets/{McpSigninBody-BDyGbJ7I.js → McpSigninBody-DKyUKrEE.js} +1 -1
  43. package/dist/client/assets/{Model3dViewer-BujDNuVS.js → Model3dViewer-rXSL5y2P.js} +1 -1
  44. package/dist/client/assets/NamePage-JwMDK1JD.js +1 -0
  45. package/dist/client/assets/{NewDirectMessageMenu-D4e-z2Jt.js → NewDirectMessageMenu-GCEMS5oV.js} +1 -1
  46. package/dist/client/assets/{NotificationsPage-CkDeTaJp.js → NotificationsPage-DSWsOVLa.js} +1 -1
  47. package/dist/client/assets/{OpenMeshSwitch-CtbOt3r5.js → OpenMeshSwitch-BTuctDj4.js} +1 -1
  48. package/dist/client/assets/{OperatorIdentityForm-Vr4qZnmM.js → OperatorIdentityForm-ODDMd2YN.js} +1 -1
  49. package/dist/client/assets/PermissionHistory-41a58Se7.js +1 -0
  50. package/dist/client/assets/{PermissionsPage-f4QaX8oM.js → PermissionsPage-DefmymZ6.js} +1 -1
  51. package/dist/client/assets/{PersonalityPopover-BkZruwF-.js → PersonalityPopover-7zPVBI1I.js} +1 -1
  52. package/dist/client/assets/PhotoPage-DlOVhkW9.js +1 -0
  53. package/dist/client/assets/{PreviewRefusedNotice-BXC2K0tx.js → PreviewRefusedNotice-CwGlBJ7U.js} +1 -1
  54. package/dist/client/assets/{ProfileFields-BebX5oiv.js → ProfileFields-DVMkpJSb.js} +1 -1
  55. package/dist/client/assets/{ProfilePanelContainer-DZoL65zQ.js → ProfilePanelContainer-RrhoPD3T.js} +1 -1
  56. package/dist/client/assets/{ProfileRolePicker-D9H7wsuT.js → ProfileRolePicker-CXRVBCAu.js} +1 -1
  57. package/dist/client/assets/{PromptSuggestionChips-B5fDmc-g.js → PromptSuggestionChips-bBroJdTi.js} +1 -1
  58. package/dist/client/assets/{ReportsToPopover-uVYhSqj7.js → ReportsToPopover-CfPatsWM.js} +1 -1
  59. package/dist/client/assets/{RoomSurface-Bg5WV4Ep.js → RoomSurface-CdgCdV6h.js} +11 -11
  60. package/dist/client/assets/{RoomsPage-yflYFulU.js → RoomsPage-C3dDp1Mb.js} +1 -1
  61. package/dist/client/assets/{RunsOnPopover-DtGrX1Vq.js → RunsOnPopover-BcKjfQi-.js} +1 -1
  62. package/dist/client/assets/{RuntimeConnectFlow-DjReuQ-T.js → RuntimeConnectFlow-DCIRnvOH.js} +1 -1
  63. package/dist/client/assets/{RuntimeSetupDialog-Cr4GRi8c.js → RuntimeSetupDialog-Bg-0b-LC.js} +1 -1
  64. package/dist/client/assets/SeenDevices-nMsGUQTv.js +19 -0
  65. package/dist/client/assets/{SessionsPage-BWu-en78.js → SessionsPage-Cqfx4FGW.js} +1 -1
  66. package/dist/client/assets/SettingsDialog-C8r2igJ_.js +12 -0
  67. package/dist/client/assets/{SkillsPage-BdUb9SZy.js → SkillsPage-BleHQavF.js} +1 -1
  68. package/dist/client/assets/{TaskDialogWrapper-qYJPEoSR.js → TaskDialogWrapper-BhTEvf-u.js} +1 -1
  69. package/dist/client/assets/{TasksEmptyState-Bgcg9vxF.js → TasksEmptyState-Bprx1k8M.js} +2 -2
  70. package/dist/client/assets/{TasksPage-Ch5W2WQS.js → TasksPage-Dub39yEJ.js} +1 -1
  71. package/dist/client/assets/{TeamComputerEntry-CPwSIMRw.js → TeamComputerEntry-CJ-NG0u5.js} +1 -1
  72. package/dist/client/assets/ToolsPage-IsD6M-ZW.js +2 -0
  73. package/dist/client/assets/{TopologyGraph-I4_mkMHM.js → TopologyGraph-CwyasvFI.js} +14 -14
  74. package/dist/client/assets/{TourHost-BPaSwh9I.js → TourHost-BYfztuPb.js} +1 -1
  75. package/dist/client/assets/{UnlinkDialog-BUWZUu5P.js → UnlinkDialog-BKhgxVdF.js} +1 -1
  76. package/dist/client/assets/{WidgetErrorCard-cS8yMCxU.js → WidgetErrorCard-1NyzIJBj.js} +6 -6
  77. package/dist/client/assets/_shell-Ct2Bz7D0.js +80 -0
  78. package/dist/client/assets/{_shell._home-DCA5k-jb.js → _shell._home-xWj7wO5z.js} +1 -1
  79. package/dist/client/assets/{_shell._home.activity-BX4nFLna.js → _shell._home.activity-BqcLoaB1.js} +1 -1
  80. package/dist/client/assets/{_shell._home.index-C8t8cw72.js → _shell._home.index-D4sQsKKk.js} +1 -1
  81. package/dist/client/assets/{_shell._home.tasks-BgUeEvhK.js → _shell._home.tasks--UhQB6h3.js} +1 -1
  82. package/dist/client/assets/{_shell._home.workspaces-BPBdnkRt.js → _shell._home.workspaces-BPFD8Of2.js} +1 -1
  83. package/dist/client/assets/{_shell.channels-CX4kki7G.js → _shell.channels-CnFdvRzc.js} +4 -4
  84. package/dist/client/assets/{_shell.connections-0vP7g7E4.js → _shell.connections-Ik01wS5M.js} +1 -1
  85. package/dist/client/assets/{_shell.feedback-requests-TsuaO4eR.js → _shell.feedback-requests-Czu42kzo.js} +1 -1
  86. package/dist/client/assets/_shell.marketplace-Cezv-i16.js +1 -0
  87. package/dist/client/assets/_shell.marketplace_.sources-BTENmr4W.js +1 -0
  88. package/dist/client/assets/_shell.session-BjevHF_O.js +63 -0
  89. package/dist/client/assets/{_shell.team-Bm6cOBhR.js → _shell.team-UfaJqohh.js} +3 -3
  90. package/dist/client/assets/_shell.x._extensionId-0OO_Xr72.js +1 -0
  91. package/dist/client/assets/_shell.x._extensionId_._-0OO_Xr72.js +1 -0
  92. package/dist/client/assets/{abnfDiagram-WEYOIA3C-CrvoN15x.js → abnfDiagram-WEYOIA3C-oxkfGyl6.js} +1 -1
  93. package/dist/client/assets/{access-copy-B3yNZ7Gz.js → access-copy-Dggxx2cX.js} +1 -1
  94. package/dist/client/assets/{arc-CuT6QA_y.js → arc-CqQdP0Qe.js} +1 -1
  95. package/dist/client/assets/{architectureDiagram-ZHVYKT53-CPXCZ9H4.js → architectureDiagram-ZHVYKT53-89xM7zJD.js} +1 -1
  96. package/dist/client/assets/{banner-DRumuw3F.js → banner-DqJ2pM0Y.js} +1 -1
  97. package/dist/client/assets/{blockDiagram-RJAE7QA3-CM0rka9p.js → blockDiagram-RJAE7QA3-CcxwDmZC.js} +1 -1
  98. package/dist/client/assets/{c4Diagram-XDPPPE54-D4j2cXRy.js → c4Diagram-XDPPPE54-DCIhIyXa.js} +1 -1
  99. package/dist/client/assets/{card-B3CtfC3R.js → card-DT-vFAns.js} +1 -1
  100. package/dist/client/assets/channel-Ngk70nQZ.js +1 -0
  101. package/dist/client/assets/{chunk-2E7WHVMD-KGyqhVpO.js → chunk-2E7WHVMD-BfWEXcCj.js} +1 -1
  102. package/dist/client/assets/{chunk-2Q5K7J3B-Dl0BHoqK.js → chunk-2Q5K7J3B-KLXLZXlR.js} +1 -1
  103. package/dist/client/assets/{chunk-4EMNKR2T-Da7vH6Kv.js → chunk-4EMNKR2T-CL5Gttmj.js} +1 -1
  104. package/dist/client/assets/{chunk-55XCU76K-DgBUEROO.js → chunk-55XCU76K-cfAl84Mv.js} +1 -1
  105. package/dist/client/assets/{chunk-5VM5RSS4-BQ4mn-_I.js → chunk-5VM5RSS4-BqUyGgoH.js} +1 -1
  106. package/dist/client/assets/{chunk-JWPE2WC7-8LPR3mXf.js → chunk-JWPE2WC7-BWr2ST9i.js} +1 -1
  107. package/dist/client/assets/{chunk-VQ5W62QI-BkIVXi4W.js → chunk-VQ5W62QI-V5zYx50O.js} +1 -1
  108. package/dist/client/assets/{chunk-XXDRQBXY-DQXJx06h.js → chunk-XXDRQBXY-gnvheN_J.js} +1 -1
  109. package/dist/client/assets/{chunk-ZCHMQSOR-DzCE7qlD.js → chunk-ZCHMQSOR-ClGxxZvV.js} +2 -2
  110. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-C_cZra7c.js → classDiagram-v2-4MYWR3UA-DvmHzDb5.js} +1 -1
  111. package/dist/client/assets/{command-CDKbyppr.js → command-CNx4L11m.js} +1 -1
  112. package/dist/client/assets/{cose-bilkent-JH36ORCC-DlXHdGwT.js → cose-bilkent-JH36ORCC-Df8nXBRj.js} +1 -1
  113. package/dist/client/assets/{cpu-B7xLO7jn.js → cpu-D8KJEkdh.js} +1 -1
  114. package/dist/client/assets/{cynefin-EF2NZ3EQ-HhP4ArLc.js → cynefin-EF2NZ3EQ-CAn6ufHs.js} +1 -1
  115. package/dist/client/assets/{cynefinDiagram-WF24UDRP-D4GgWnZV.js → cynefinDiagram-WF24UDRP-Cep_NrRw.js} +1 -1
  116. package/dist/client/assets/{dagre-NK4GIZVX-SZ_OI2Zi.js → dagre-NK4GIZVX-sWD3z9wf.js} +1 -1
  117. package/dist/client/assets/{diagram-CBK3MWTC-BN-_Ja5m.js → diagram-CBK3MWTC-CUpaBATr.js} +1 -1
  118. package/dist/client/assets/{diagram-I5XIIV2D-t7AK6xnL.js → diagram-I5XIIV2D-BejWB2ry.js} +1 -1
  119. package/dist/client/assets/{diagram-ODIL2UCW-C1V7szSc.js → diagram-ODIL2UCW-BGKJfNk9.js} +1 -1
  120. package/dist/client/assets/{diagram-PFBEJUXE-DPtraQ2g.js → diagram-PFBEJUXE-V0dP8H8k.js} +1 -1
  121. package/dist/client/assets/{diagram-RJA3I4VV-D2XNRB2b.js → diagram-RJA3I4VV-Bf5dVsFX.js} +1 -1
  122. package/dist/client/assets/{diagram-TYUNFSNR-BieaRy38.js → diagram-TYUNFSNR-CLrMSqb4.js} +1 -1
  123. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bwki86UY.js → ebnfDiagram-V4P3TTPT-BGG4CWA0.js} +1 -1
  124. package/dist/client/assets/{elk-QONTBCTQ-WEXSAyHB.js → elk-QONTBCTQ-bf9D6f0w.js} +1 -1
  125. package/dist/client/assets/{empty-state-J-UJ0BUU.js → empty-state-CDoXnrKn.js} +1 -1
  126. package/dist/client/assets/{erDiagram-KYQIGQAA-DIKASnoc.js → erDiagram-KYQIGQAA-fEUv-33P.js} +1 -1
  127. package/dist/client/assets/{execution-config-ILQiJAmy.js → execution-config-Ca9MDOtV.js} +1 -1
  128. package/dist/client/assets/{file-D40js1Zx.js → file-CiyVL55_.js} +1 -1
  129. package/dist/client/assets/{file-exclamation-point-Dg3ZpiAe.js → file-exclamation-point-DaFRIKco.js} +1 -1
  130. package/dist/client/assets/{file-text-DgdvRfMk.js → file-text-DsnD-A8g.js} +1 -1
  131. package/dist/client/assets/{find-latest-widget-fence-D4kBWC_1.js → find-latest-widget-fence-CNsnCgbB.js} +1 -1
  132. package/dist/client/assets/{flowDiagram-IUGLLWBU-CoavNw0M.js → flowDiagram-IUGLLWBU-CRbeSDod.js} +1 -1
  133. package/dist/client/assets/{form-DlPwEgQH.js → form-Cru78aT-.js} +1 -1
  134. package/dist/client/assets/{format-cron-BrK8RzgT.js → format-cron-9K38-tn1.js} +1 -1
  135. package/dist/client/assets/{ganttDiagram-R7GPNTJY-DccKAz7f.js → ganttDiagram-R7GPNTJY-Mkk7zgs_.js} +1 -1
  136. package/dist/client/assets/{git-branch-BpxhecMq.js → git-branch-CONwEYiR.js} +1 -1
  137. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DEbo_dgQ.js → gitGraphDiagram-PDYL7XHY-Drre0vyA.js} +1 -1
  138. package/dist/client/assets/{graph-DROgI3M3.js → graph-BJlnKWgo.js} +1 -1
  139. package/dist/client/assets/{heart-c7u4Ezxt.js → heart-CqwUlIUG.js} +1 -1
  140. package/dist/client/assets/{highlighted-body-KPVGNVTW-CrATNdTR.js → highlighted-body-KPVGNVTW-e4LXC_pS.js} +1 -1
  141. package/dist/client/assets/{image-lightbox-DE_fHkw-.js → image-lightbox-DHDtzoja.js} +1 -1
  142. package/dist/client/assets/{image-off-BExgZjfM.js → image-off-DZuLkaRJ.js} +1 -1
  143. package/dist/client/assets/{index-D0eJtRlK.js → index-1yEXEZiH.js} +1 -1
  144. package/dist/client/assets/{index-Be0OJLWK.js → index-A41zxoWk.js} +1 -1
  145. package/dist/client/assets/{index-DeRDq7bD.js → index-B25gvCK_.js} +1 -1
  146. package/dist/client/assets/index-B9bZYNKR.js +1 -0
  147. package/dist/client/assets/{index-DaZ1I8s-.js → index-BBmkfbXd.js} +1 -1
  148. package/dist/client/assets/{index-DNGNMW3c.js → index-BDD2EyoW.js} +1 -1
  149. package/dist/client/assets/{index-Ccf1XBTs.js → index-BFNy-Yp3.js} +1 -1
  150. package/dist/client/assets/{index-DksjixUS.js → index-BIB-maE5.js} +1 -1
  151. package/dist/client/assets/{index-CbHCZsbE.js → index-BKp2B9JS.js} +1 -1
  152. package/dist/client/assets/{index-DCJQGDZk.js → index-BLP5O7X9.js} +1 -1
  153. package/dist/client/assets/{index-DhHobJd3.js → index-BTjZIgFn.js} +1 -1
  154. package/dist/client/assets/{index-BVqSmajJ.js → index-BV2Ezdxv.js} +1 -1
  155. package/dist/client/assets/{index-C7B3eSOP.js → index-B_0LYi32.js} +1 -1
  156. package/dist/client/assets/{index-DDgOoXP1.js → index-Bd7vUYhr.js} +1 -1
  157. package/dist/client/assets/{index-BlyoyIck.js → index-Bo7x9IkO.js} +1 -1
  158. package/dist/client/assets/{index-D150FXCC.js → index-BtDxwJsM.js} +1 -1
  159. package/dist/client/assets/{index-DswGXheF.js → index-By58MgcZ.js} +1 -1
  160. package/dist/client/assets/index-C3cvP8Fo.js +1033 -0
  161. package/dist/client/assets/{index-C5or4L_3.js → index-CVuEUzi5.js} +1 -1
  162. package/dist/client/assets/{index-BkoMsjtM.js → index-CoWJD3Jg.js} +2 -2
  163. package/dist/client/assets/{index-CqPRAM_6.js → index-CyVH876g.js} +1 -1
  164. package/dist/client/assets/{index-BGqvci3k.js → index-D67Kfy-M.js} +1 -1
  165. package/dist/client/assets/{index-D3YeRrne.js → index-DAlpmAIA.js} +1 -1
  166. package/dist/client/assets/{index-BEkYBuOq.js → index-DDNwNOHF.js} +1 -1
  167. package/dist/client/assets/{index-CD8aw6Jb.js → index-DL8ISRMH.js} +1 -1
  168. package/dist/client/assets/{index-AzyLwYS_.js → index-DabU6r9W.js} +3 -3
  169. package/dist/client/assets/{index-CT_pFeX_.js → index-DdJBZE0H.js} +1 -1
  170. package/dist/client/assets/{index-B3eeEDWj.js → index-DijWcSDZ.js} +1 -1
  171. package/dist/client/assets/index-DyRGZyur.css +1 -0
  172. package/dist/client/assets/{index-DINk1YfD.js → index-DzwZJuO1.js} +1 -1
  173. package/dist/client/assets/{index-CZmqtJWZ.js → index-HR8BYVRQ.js} +1 -1
  174. package/dist/client/assets/{index-J3Hh1MnL.js → index-LEcodwyW.js} +1 -1
  175. package/dist/client/assets/index-UPF8suf2.js +1 -0
  176. package/dist/client/assets/{index-DT7pv2iW.js → index-Vz7VUm9l.js} +1 -1
  177. package/dist/client/assets/index-YW-v746p.js +1 -0
  178. package/dist/client/assets/{index-2wezsLA_.js → index-cI2u8WZS.js} +1 -1
  179. package/dist/client/assets/{index-InEBtYxw.js → index-iTQUa_b2.js} +6 -6
  180. package/dist/client/assets/{index-CYy1cjtq.js → index-mZqojApH.js} +1 -1
  181. package/dist/client/assets/{index-dyAahqKe.js → index-pVFjKNjX.js} +1 -1
  182. package/dist/client/assets/{index-DxiRRZRo.js → index-skAhJyIF.js} +1 -1
  183. package/dist/client/assets/{index-BizvylBV.js → index-vJy88bwb.js} +1 -1
  184. package/dist/client/assets/index-wY5OcS4a.js +43 -0
  185. package/dist/client/assets/{index-mwf7ZNk2.js → index-x1yAu9zJ.js} +1 -1
  186. package/dist/client/assets/{index-F-vqXYqa.js → index-xAgihCJ7.js} +1 -1
  187. package/dist/client/assets/{index.esm-BFJ9SG0n.js → index.esm-BUPoRUaG.js} +1 -1
  188. package/dist/client/assets/{infoDiagram-MVDRKAX5-VL8q5pKx.js → infoDiagram-MVDRKAX5-B_Wyzufh.js} +1 -1
  189. package/dist/client/assets/{inline-code-BE9ckzPs.js → inline-code-BIzGDx6z.js} +1 -1
  190. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BLKkPYF-.js → ishikawaDiagram-HPEHV2GE-BDk2-6Pd.js} +1 -1
  191. package/dist/client/assets/{journeyDiagram-BOSHW7O7-CSYpRobu.js → journeyDiagram-BOSHW7O7-7qf9KWEQ.js} +1 -1
  192. package/dist/client/assets/{kanban-definition-FNSA4HC5-HilAqtZo.js → kanban-definition-FNSA4HC5-CFYDQmXn.js} +1 -1
  193. package/dist/client/assets/{layers-Cm7coqdo.js → layers-C9tVVcXg.js} +1 -1
  194. package/dist/client/assets/{lightbulb-DqdWS75d.js → lightbulb-f4jtsAh0.js} +1 -1
  195. package/dist/client/assets/{link-2-CDJapTSa.js → link-2-ZNlK1BG1.js} +1 -1
  196. package/dist/client/assets/{list-runtime-types-CP82p1u4.js → list-runtime-types-CqO-QFYD.js} +1 -1
  197. package/dist/client/assets/{markdown-content-m_qereFc.js → markdown-content-DaEVxezf.js} +1 -1
  198. package/dist/client/assets/{mention-pill-DV5HIG5Q.js → mention-pill-BiCPflY-.js} +1 -1
  199. package/dist/client/assets/{mermaid.core-zxW6MBr-.js → mermaid.core-SX8SzrsU.js} +4 -4
  200. package/dist/client/assets/{message-square-off-YVtpbaJ0.js → message-square-off-_qbedNGF.js} +1 -1
  201. package/dist/client/assets/{mindmap-definition-6OY57UG3-IAYemvOg.js → mindmap-definition-6OY57UG3-BloJIArH.js} +1 -1
  202. package/dist/client/assets/{more-details-ReA2ZFBn.js → more-details-CdJT0Ehl.js} +1 -1
  203. package/dist/client/assets/{owner-notice-M4hn_1ep.js → owner-notice-BDafFD_I.js} +1 -1
  204. package/dist/client/assets/{package-CUuTl39E.js → package-Cb7lEm7t.js} +1 -1
  205. package/dist/client/assets/{page-container-BnmNikNZ.js → page-container-DsRgIMAL.js} +1 -1
  206. package/dist/client/assets/{paperclip-C6fYq5Zf.js → paperclip-DNu1VtoX.js} +1 -1
  207. package/dist/client/assets/{path-input-DHn9-XaE.js → path-input-D3O71b-X.js} +1 -1
  208. package/dist/client/assets/{pegDiagram-ECIUJNBX-CojaUwe7.js → pegDiagram-ECIUJNBX-Di48kPNu.js} +1 -1
  209. package/dist/client/assets/{pieDiagram-GNMPY74T-CjP3pw6V.js → pieDiagram-GNMPY74T-DY8B_SPD.js} +1 -1
  210. package/dist/client/assets/{plug-DHQcxt7N.js → plug-IIS_cL9-.js} +1 -1
  211. package/dist/client/assets/{primer-trigger-BmV5wjek.js → primer-trigger-DurKYe8C.js} +2 -2
  212. package/dist/client/assets/{profile-errors-BSCuj3rT.js → profile-errors-BdhZfdvZ.js} +1 -1
  213. package/dist/client/assets/{progress-4FQQfnS6.js → progress-g5kkqvlR.js} +1 -1
  214. package/dist/client/assets/{quadrantDiagram-D57K4MC3-OP0Z8zcR.js → quadrantDiagram-D57K4MC3-Depv_dON.js} +1 -1
  215. package/dist/client/assets/{query-error-state-BkUdxenP.js → query-error-state-PuLGD7Jp.js} +1 -1
  216. package/dist/client/assets/{radio-ta5Bw763.js → radio-QOLZSBz1.js} +1 -1
  217. package/dist/client/assets/{railroadDiagram-Y72NRBL7-CT3NCb9b.js → railroadDiagram-Y72NRBL7-BfD2AiZM.js} +1 -1
  218. package/dist/client/assets/registry-Ck8p6n1T.js +1 -0
  219. package/dist/client/assets/{relay-trace-schemas-DwUuyxao.js → relay-trace-schemas-DF_DfZ7s.js} +1 -1
  220. package/dist/client/assets/{requirementDiagram-EQYSW5RA-tde4lYGp.js → requirementDiagram-EQYSW5RA-B1iTjrkD.js} +1 -1
  221. package/dist/client/assets/{room-files-source-CZWhaaOy.js → room-files-source-g1th8mWs.js} +2 -2
  222. package/dist/client/assets/{rotate-ccw-clock-RfbbgUa4.js → rotate-ccw-clock-BGwYMaGL.js} +1 -1
  223. package/dist/client/assets/{rotate-cw-B3rB_YSw.js → rotate-cw-B4Y0q4GY.js} +1 -1
  224. package/dist/client/assets/{sankeyDiagram-SY24JHO5-sdCzIA7-.js → sankeyDiagram-SY24JHO5-D5TzVJrQ.js} +1 -1
  225. package/dist/client/assets/{scroll-area-B4WB7Q40.js → scroll-area-BvScZKSa.js} +1 -1
  226. package/dist/client/assets/{search-x-DCUmWW2_.js → search-x-CqN5twBj.js} +1 -1
  227. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-DvzTJcKu.js → sequenceDiagram-BLEHNHQU-BhUahaNf.js} +1 -1
  228. package/dist/client/assets/{shield-x-CANziVLc.js → shield-x-DHJrwtKp.js} +1 -1
  229. package/dist/client/assets/signed-in-BmywDpR5.js +1 -0
  230. package/dist/client/assets/{sizeCapture-INFHLROL-DuDA7TKE.js → sizeCapture-INFHLROL-D2Vi1Kq9.js} +1 -1
  231. package/dist/client/assets/{soul-file-Co_8f1qw.js → soul-file-BMpVFN7U.js} +1 -1
  232. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BJPX5JTC.js → stateDiagram-v2-A6IESKWZ-b9gSbZnF.js} +1 -1
  233. package/dist/client/assets/{swimlanes-B3ENRKFQ-CiLSffGv.js → swimlanes-B3ENRKFQ-i47jxLY6.js} +1 -1
  234. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CA9gW19w.js +8 -0
  235. package/dist/client/assets/{table-BSAvOYPp.js → table-CN2HCi4p.js} +1 -1
  236. package/dist/client/assets/{terminal-6CdY-T1V.js → terminal-BORQniao.js} +1 -1
  237. package/dist/client/assets/{timeline-definition-JXYKGLGB-5oq8sl82.js → timeline-definition-JXYKGLGB-eY5gj0js.js} +1 -1
  238. package/dist/client/assets/{trust-posture-D-Yjm6ot.js → trust-posture-Bcyy5Fub.js} +1 -1
  239. package/dist/client/assets/{unplug-Bq_1WdV7.js → unplug-lkD35Rwp.js} +1 -1
  240. package/dist/client/assets/{unverified-catalog-notice-CEzu54YH.js → unverified-catalog-notice-DiCIrrhU.js} +1 -1
  241. package/dist/client/assets/{use-adapter-catalog-Tn3ZbPAj.js → use-adapter-catalog-BrqVd-47.js} +1 -1
  242. package/dist/client/assets/{use-bindings-Bz9YRgO7.js → use-bindings-CU2RSXOy.js} +1 -1
  243. package/dist/client/assets/{use-composer-prefs-D9oKJSQN.js → use-composer-prefs-Dy2oTM8Y.js} +1 -1
  244. package/dist/client/assets/{use-connector-management-CLYFraXN.js → use-connector-management-5oRqzydY.js} +1 -1
  245. package/dist/client/assets/{use-deep-link-scroll-DkS713kG.js → use-deep-link-scroll-Bg5nW8qq.js} +1 -1
  246. package/dist/client/assets/{use-delete-binding-CukKpHBK.js → use-delete-binding-qeyRkvR1.js} +1 -1
  247. package/dist/client/assets/{use-dev-links-DQ32IcGe.js → use-dev-links-FY4J_PjA.js} +1 -1
  248. package/dist/client/assets/{use-external-adapter-catalog-D-FO_XW6.js → use-external-adapter-catalog-HiWFZZrW.js} +1 -1
  249. package/dist/client/assets/{use-full-activity-feed-BNxcyb1j.js → use-full-activity-feed-K1uk9Wya.js} +1 -1
  250. package/dist/client/assets/use-is-below-desktop-Cu_jKnft.js +1 -0
  251. package/dist/client/assets/use-is-hub-BX7ypNRJ.js +1 -0
  252. package/dist/client/assets/{use-jump-back-in-Bibj5tVk.js → use-jump-back-in-BjZ8EswV.js} +1 -1
  253. package/dist/client/assets/{use-local-browser-xg7WXAVK.js → use-local-browser-CTFiF0wf.js} +1 -1
  254. package/dist/client/assets/{use-mesh-topology-BgCSFw8s.js → use-mesh-topology-CafidaIH.js} +1 -1
  255. package/dist/client/assets/{use-mounted-ref-qRbdZfOU.js → use-mounted-ref-B38uSLCx.js} +1 -1
  256. package/dist/client/assets/{use-notification-prefs-B-4kZR7I.js → use-notification-prefs-m9XSNB6W.js} +1 -1
  257. package/dist/client/assets/{use-panel-tab-placements-CCq-mZlY.js → use-panel-tab-placements-D9n6rNJ1.js} +1 -1
  258. package/dist/client/assets/use-pending-read-BoV-UI1E.js +1 -0
  259. package/dist/client/assets/{use-personality-commit-DwSisUfF.js → use-personality-commit-ChLQfLrK.js} +1 -1
  260. package/dist/client/assets/{use-promo-activation-Botoso6l.js → use-promo-activation-DbJDgp4_.js} +1 -1
  261. package/dist/client/assets/{use-promo-dismissals-RJXp-r_J.js → use-promo-dismissals-Csw0j0N0.js} +1 -1
  262. package/dist/client/assets/{use-pulse-freshness-B3390hGg.js → use-pulse-freshness-BIZ7daHW.js} +1 -1
  263. package/dist/client/assets/{use-relay-config-BV0xcLwS.js → use-relay-config-hUB3lVFv.js} +1 -1
  264. package/dist/client/assets/{use-room-follow-claim-Du4hKHIJ.js → use-room-follow-claim-BpKzhniV.js} +1 -1
  265. package/dist/client/assets/{use-roving-tab-list-g2hO6Ruz.js → use-roving-tab-list-BtM0bZL7.js} +1 -1
  266. package/dist/client/assets/{use-session-canvas-i30oMO_Q.js → use-session-canvas-DRrkNRcL.js} +3 -3
  267. package/dist/client/assets/use-session-diagnostics-BTNgouum.js +16 -0
  268. package/dist/client/assets/{use-unclaimed-chats-B92om889.js → use-unclaimed-chats-BbMZtNG9.js} +1 -1
  269. package/dist/client/assets/use-update-config-CkWwKNkY.js +1 -0
  270. package/dist/client/assets/{useMutationState-DdOGdpjP.js → useMutationState-CVpvw27W.js} +1 -1
  271. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Di5pJvcw.js → usecaseDiagram-WPOLBNNX-CHcpeLg4.js} +1 -1
  272. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-K7KAf26T.js → vennDiagram-Q3Y3IDCW-gQbZL_A6.js} +1 -1
  273. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-DVTaxQt9.js → wardleyDiagram-IVAIDKWA-BFH_WHzZ.js} +1 -1
  274. package/dist/client/assets/{xychartDiagram-4URNHDU4-x-lSJm_B.js → xychartDiagram-4URNHDU4-B0QpyqeZ.js} +1 -1
  275. package/dist/client/index.html +2 -2
  276. package/dist/drizzle/20261019185620_dor3037_wifi_holds.sql +8 -0
  277. package/dist/drizzle/meta/20261019185620_snapshot.json +14079 -0
  278. package/dist/drizzle/meta/_journal.json +7 -0
  279. package/dist/server/extension-child.cjs +18 -2
  280. package/dist/server/index.js +55523 -26605
  281. package/dist/server/index.js.map +2 -2
  282. package/package.json +6 -6
  283. package/dist/client/assets/ApplyToOverridesDialog-CoO6V1G4.js +0 -1
  284. package/dist/client/assets/HandlePage-Cg8H3mQS.js +0 -1
  285. package/dist/client/assets/NamePage-Bx8T98OF.js +0 -1
  286. package/dist/client/assets/PermissionHistory-DzU1rf2B.js +0 -1
  287. package/dist/client/assets/PhotoPage-CmrOIRjf.js +0 -1
  288. package/dist/client/assets/SeenDevices-SPWkdzoK.js +0 -19
  289. package/dist/client/assets/SettingsDialog-_dEXUhHe.js +0 -12
  290. package/dist/client/assets/ToolsPage-Idimrn3o.js +0 -2
  291. package/dist/client/assets/_shell-ClVN2pUj.js +0 -80
  292. package/dist/client/assets/_shell.marketplace-CiL6YRbl.js +0 -1
  293. package/dist/client/assets/_shell.marketplace_.sources-C0sI8e21.js +0 -1
  294. package/dist/client/assets/_shell.session-_hhBvFc6.js +0 -63
  295. package/dist/client/assets/_shell.x._extensionId-BWy5v1YE.js +0 -1
  296. package/dist/client/assets/_shell.x._extensionId_._-BWy5v1YE.js +0 -1
  297. package/dist/client/assets/channel-DjBlTcCV.js +0 -1
  298. package/dist/client/assets/index-7jby-RRg.js +0 -1
  299. package/dist/client/assets/index-BqIHtiaE.js +0 -1
  300. package/dist/client/assets/index-Cga0qx1T.js +0 -1033
  301. package/dist/client/assets/index-Ct4At33X.js +0 -1
  302. package/dist/client/assets/index-DITPwUa9.js +0 -38
  303. package/dist/client/assets/index-DUZrTFYD.css +0 -1
  304. package/dist/client/assets/registry-Dc102rws.js +0 -1
  305. package/dist/client/assets/signed-in-DctJ2IWe.js +0 -1
  306. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Dv1-QS9J.js +0 -8
  307. package/dist/client/assets/use-is-below-desktop-gTvJDvw4.js +0 -1
  308. package/dist/client/assets/use-is-hub-B1vPpkYU.js +0 -1
  309. package/dist/client/assets/use-pending-read-C8L_v4Zw.js +0 -1
  310. package/dist/client/assets/use-session-diagnostics-a4b83F5J.js +0 -16
  311. package/dist/client/assets/use-update-config-Tbn3SodN.js +0 -1
@@ -1 +1 @@
1
- import{a1 as b,a2 as z,hv as p,hw as g,a3 as w,a4 as A,a7 as M,ap as I,j as e,r as d,T as O,G as N,B as j,a0 as q,dP as y,gc as K,gd as W,ge as Q,gf as U,gg as G,gh as Y,gi as J,gj as V,h as H,l as E,e1 as X,$ as Z,e as $,e4 as ee,hx as se,gY as R,_ as L}from"./index-Cga0qx1T.js";import{B as P}from"./banner-DRumuw3F.js";import{I as C}from"./inline-code-BE9ckzPs.js";import{P as _}from"./package-CUuTl39E.js";function D(s){const t=b();return z({queryKey:p.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"},k="\0",ae=new Set(["native","projected"]);function T(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function re(s,t){return`${g[s]} ${te[t]}`}function le(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 ie(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 S(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 l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:T(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.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 he(s){return`${me[s.kind]} · ${s.artifact} ${s.name}`}function pe(s){const t=b(),n=w();return A({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),M.success("Agent files updated.")}})}function ge(s){const t=w();I("approval_resolved",()=>{t.invalidateQueries({queryKey:p.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:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),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=pe(s),[a,r]=d.useState(!1),[l,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&&!l)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,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(P,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===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}),i>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 ",S(i)," DorkOS put here",e.jsx(O,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function ke(s){const t=b(),n=w();return A({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),n.setQueriesData({queryKey:p.all,predicate:r=>{var l;return((l=r.state.data)==null?void 0:l.projectPath)===a.status.projectPath}},a.status)}})}const Se={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function be({harness:s,cell:t}){var l;const n=re(s,t.state),a=le(t),r=(l=t.warnings)!=null&&l.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",Se[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(q,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function we(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Only some agents can see it. Move it to .agents/skills to share it.":`Lives in ${n}. Move it to .agents/skills to share it.`}function Ce(s,t){return`dorkos harness adopt ${s} --project ${t}`}const De="Share with every agent";function $e(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}. A link stays behind for Claude Code.`:`${a}, where every agent reads it.`}const Ae="for all your projects";function Oe({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,l]=d.useState(!1),[c,u]=d.useState(!1),o=ke(n),x=B(s,t),m=ie(s,t)&&!a,i=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:Ae}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!i,title:x.map(({harness:h})=>g[h]).join(" · "),onClick:()=>l(h=>!h),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",i&&"-rotate-90")})]})}),!i&&x.map(({harness:h,cell:F})=>e.jsx(be,{harness:h,cell:F},h))]}),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(K,{open:c,onOpenChange:u,children:e.jsxs(W,{children:[e.jsxs(Q,{children:[e.jsxs(U,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(G,{children:$e(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(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($,{className:"h-3 w-32"}),e.jsx($,{className:"h-3 w-48"})]},s))})]})}function Re({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=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 l(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Le,{status:n});const m=n.rows.filter(i=>i.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(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(i=>e.jsx(Oe,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},T(i)))})]})}function Le({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(C,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(ee,{href:He,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Pe({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ue(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function _e({rows:s,enabled:t}){const n=fe(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Pe,{group:a},a.harness))})}function Te({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:xe(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:he(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function Be({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Fe({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but isn’t sharing to it.`:`${g[t]} files are here, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(Be,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function ze({projectPath:s}){const t=H(),{data:n}=D(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(ye,{projectPath:s}),a&&e.jsx(Fe,{notEnabled:a.notEnabled}),e.jsx(Re,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(_e,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Te,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function We({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{We as SkillsPage};
1
+ import{a1 as b,a2 as z,hA as p,hB as g,a3 as C,a4 as $,a7 as M,ap as I,j as e,r as d,T as O,G as N,B as j,a0 as q,dP as y,gc as K,gd as W,ge as Q,gf as U,gg as G,gh as Y,gi as J,gj as Z,h as H,l as E,e1 as V,$ as X,e as D,e4 as ee,hC as se,gZ as R,_ as L}from"./index-C3cvP8Fo.js";import{B as P}from"./banner-DqJ2pM0Y.js";import{I as w}from"./inline-code-BIzGDx6z.js";import{P as _}from"./package-Cb7lEm7t.js";function A(s){const t=b();return z({queryKey:p.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"},k="\0",ae=new Set(["native","projected"]);function T(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function re(s,t){return`${g[s]} ${te[t]}`}function le(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 ie(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 S(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 l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:T(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.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 he(s){return`${me[s.kind]} · ${s.artifact} ${s.name}`}function pe(s){const t=b(),n=C();return $({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),M.success("Agent files updated.")}})}function ge(s){const t=C();I("approval_resolved",()=>{t.invalidateQueries({queryKey:p.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:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),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}=A(s),n=pe(s),[a,r]=d.useState(!1),[l,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&&!l)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,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(P,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===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}),i>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 ",S(i)," DorkOS put here",e.jsx(O,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function ke(s){const t=b(),n=C();return $({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),n.setQueriesData({queryKey:p.all,predicate:r=>{var l;return((l=r.state.data)==null?void 0:l.projectPath)===a.status.projectPath}},a.status)}})}const Se={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function be({harness:s,cell:t}){var l;const n=re(s,t.state),a=le(t),r=(l=t.warnings)!=null&&l.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",Se[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(q,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function Ce(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 we(s,t){return`dorkos harness adopt ${s} --project ${t}`}const Ae="Share with every agent";function De(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,l]=d.useState(!1),[c,u]=d.useState(!1),o=ke(n),x=B(s,t),m=ie(s,t)&&!a,i=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":!i,title:x.map(({harness:h})=>g[h]).join(" · "),onClick:()=>l(h=>!h),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",i&&"-rotate-90")})]})}),!i&&x.map(({harness:h,cell:F})=>e.jsx(be,{harness:h,cell:F},h))]}),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)||Ce(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(w,{children:we(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:Ae})}),e.jsx(K,{open:c,onOpenChange:u,children:e.jsxs(W,{children:[e.jsxs(Q,{children:[e.jsxs(U,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(G,{children:De(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(Y,{children:[e.jsx(J,{children:"Cancel"}),e.jsx(Z,{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(D,{className:"h-3 w-32"}),e.jsx(D,{className:"h-3 w-48"})]},s))})]})}function Re({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=A(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 l(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Le,{status:n});const m=n.rows.filter(i=>i.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(X,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(i=>e.jsx(Oe,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},T(i)))})]})}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(w,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(ee,{href:He,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Pe({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ue(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function _e({rows:s,enabled:t}){const n=fe(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Pe,{group:a},a.harness))})}function Te({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:xe(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:he(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(w,{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}=A(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(ye,{projectPath:s}),a&&e.jsx(Fe,{notEnabled:a.notEnabled}),e.jsx(Re,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(_e,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Te,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function We({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{We as SkillsPage};
@@ -1 +1 @@
1
- import{bd as I,aZ as F,r as i,aW as c,cv as R,b0 as P,j as e,bx as O,ar as B,cw as W,cx as M,cy as z,cz as L,cA as H,cB as Z,cC as q,cD as G}from"./index-Cga0qx1T.js";import{F as J,T as K,C}from"./TasksEmptyState-Bgcg9vxF.js";import{i as Q}from"./registry-Dc102rws.js";import"./inline-code-BE9ckzPs.js";import"./form-DlPwEgQH.js";import"./command-CDKbyppr.js";import"./AgentPicker-CsIIPGZJ.js";import"./AgentOptionRow-BA2cDa7r.js";import"./execution-config-ILQiJAmy.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./list-runtime-types-CP82p1u4.js";import"./format-cron-BrK8RzgT.js";function U(){const l=I(),{data:n=[],isLoading:m}=F(l),[h,a]=i.useState(!1),[g,r]=i.useState(),[f,w]=i.useState(null),[v,u]=i.useState(null),t=c(s=>s.tasksAgentFilter),j=c(s=>s.setTasksAgentFilter),x=c(s=>s.tasksEditScheduleId),b=c(s=>s.setTasksEditScheduleId),N=t?n.filter(s=>s.agentId===t):n,A=n.some(s=>s.agentId),{data:o}=R(void 0,A),p=i.useMemo(()=>{const s=new Map;for(const d of(o==null?void 0:o.agents)??[])s.set(d.id,d);return s},[o]);i.useEffect(()=>{if(!x||m)return;const s=n.find(d=>d.id===x);s&&(r(s),a(!0)),b(null)},[x,n,m,b]);const k=i.useMemo(()=>{var s;return t?((s=p.get(t))==null?void 0:s.name)??t:null},[t,p]),{externalTrigger:y}=P();i.useEffect(()=>{y&&(r(void 0),a(!0))},[y]);const D=s=>{u(s),r(void 0),a(!0)},T=()=>{u(null),r(void 0),a(!0)},E=s=>{a(s),s||u(null)};return l?m?e.jsx("div",{className:"space-y-2 p-4",children:[1,2,3].map(s=>e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-muted animate-breath size-2 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"bg-muted animate-breath h-4 w-32 rounded"}),e.jsx("div",{className:"bg-muted animate-breath h-3 w-48 rounded"})]})]})},s))}):N.length===0?e.jsxs(e.Fragment,{children:[t?e.jsxs("div",{className:"flex flex-col items-center gap-3 p-8",children:[e.jsx(S,{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(K,{onCreateWithPreset:D,onCreateBlank:T})}),e.jsx(C,{open:h,onOpenChange:E,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(S,{name:k,onClear:()=>j(null)})]}),e.jsx("button",{onClick:()=>{r(void 0),a(!0)},className:"border-input hover:bg-accent hover:text-accent-foreground inline-flex items-center rounded-md border bg-transparent px-3 py-1.5 text-sm font-medium shadow-xs transition-colors",children:"New schedule"})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:e.jsx(O,{initial:!1,children:N.map(s=>e.jsx(B.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.2,ease:[0,0,.2,1]},className:"mb-2",children:e.jsx(W,{task:s,agent:s.agentId?p.get(s.agentId)??null:null,expanded:f===s.id,onToggleExpand:()=>w(f===s.id?null:s.id),onEdit:()=>{r(s),a(!0)}})},s.id))})}),e.jsx(C,{open:h,onOpenChange:a,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsx(J,{icon:Q.tasks,name:"Scheduling",description:"Scheduled tasks let your agents work on a timer, even when you’re not here.",command:"dorkos --tasks"})}function S({name:l,onClear:n}){return e.jsx(M,{onRemove:n,removeLabel:"Clear agent filter",children:l??"Agent"})}function re({open:l,onOpenChange:n}){return e.jsx(z,{open:l,onOpenChange:n,children:e.jsxs(L,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[e.jsx(H,{}),e.jsxs(Z,{className:"border-b px-4 py-3",children:[e.jsx(q,{className:"text-sm font-medium",children:"Scheduled tasks"}),e.jsx(G,{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(U,{})})]})})}export{re as TasksDialogWrapper};
1
+ import{bd as I,aZ as F,r as i,aW as c,cv as R,b0 as P,j as e,bx as O,ar as B,cw as W,cx as M,cy as z,cz as L,cA as H,cB as Z,cC as q,cD as G}from"./index-C3cvP8Fo.js";import{F as J,T as K,C}from"./TasksEmptyState-Bprx1k8M.js";import{i as Q}from"./registry-Ck8p6n1T.js";import"./inline-code-BIzGDx6z.js";import"./form-Cru78aT-.js";import"./command-CNx4L11m.js";import"./AgentPicker-ouNRFSDh.js";import"./AgentOptionRow-Cb34LtmH.js";import"./execution-config-Ca9MDOtV.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./list-runtime-types-CqO-QFYD.js";import"./format-cron-9K38-tn1.js";function U(){const l=I(),{data:n=[],isLoading:m}=F(l),[h,a]=i.useState(!1),[g,r]=i.useState(),[f,w]=i.useState(null),[v,u]=i.useState(null),t=c(s=>s.tasksAgentFilter),j=c(s=>s.setTasksAgentFilter),x=c(s=>s.tasksEditScheduleId),b=c(s=>s.setTasksEditScheduleId),N=t?n.filter(s=>s.agentId===t):n,A=n.some(s=>s.agentId),{data:o}=R(void 0,A),p=i.useMemo(()=>{const s=new Map;for(const d of(o==null?void 0:o.agents)??[])s.set(d.id,d);return s},[o]);i.useEffect(()=>{if(!x||m)return;const s=n.find(d=>d.id===x);s&&(r(s),a(!0)),b(null)},[x,n,m,b]);const k=i.useMemo(()=>{var s;return t?((s=p.get(t))==null?void 0:s.name)??t:null},[t,p]),{externalTrigger:y}=P();i.useEffect(()=>{y&&(r(void 0),a(!0))},[y]);const D=s=>{u(s),r(void 0),a(!0)},T=()=>{u(null),r(void 0),a(!0)},E=s=>{a(s),s||u(null)};return l?m?e.jsx("div",{className:"space-y-2 p-4",children:[1,2,3].map(s=>e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-muted animate-breath size-2 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"bg-muted animate-breath h-4 w-32 rounded"}),e.jsx("div",{className:"bg-muted animate-breath h-3 w-48 rounded"})]})]})},s))}):N.length===0?e.jsxs(e.Fragment,{children:[t?e.jsxs("div",{className:"flex flex-col items-center gap-3 p-8",children:[e.jsx(S,{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(K,{onCreateWithPreset:D,onCreateBlank:T})}),e.jsx(C,{open:h,onOpenChange:E,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(S,{name:k,onClear:()=>j(null)})]}),e.jsx("button",{onClick:()=>{r(void 0),a(!0)},className:"border-input hover:bg-accent hover:text-accent-foreground inline-flex items-center rounded-md border bg-transparent px-3 py-1.5 text-sm font-medium shadow-xs transition-colors",children:"New schedule"})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:e.jsx(O,{initial:!1,children:N.map(s=>e.jsx(B.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.2,ease:[0,0,.2,1]},className:"mb-2",children:e.jsx(W,{task:s,agent:s.agentId?p.get(s.agentId)??null:null,expanded:f===s.id,onToggleExpand:()=>w(f===s.id?null:s.id),onEdit:()=>{r(s),a(!0)}})},s.id))})}),e.jsx(C,{open:h,onOpenChange:a,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsx(J,{icon:Q.tasks,name:"Scheduling",description:"Scheduled tasks let your agents work on a timer, even when you’re not here.",command:"dorkos --tasks"})}function S({name:l,onClear:n}){return e.jsx(M,{onRemove:n,removeLabel:"Clear agent filter",children:l??"Agent"})}function re({open:l,onOpenChange:n}){return e.jsx(z,{open:l,onOpenChange:n,children:e.jsxs(L,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[e.jsx(H,{}),e.jsxs(Z,{className:"border-b px-4 py-3",children:[e.jsx(q,{className:"text-sm font-medium",children:"Scheduled tasks"}),e.jsx(G,{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(U,{})})]})})}export{re as TasksDialogWrapper};
@@ -1,3 +1,3 @@
1
- import{j as e,hC as _e,G as _,r as m,dA as Ve,$ as fe,I as We,dW as q,dX as U,dY as G,dZ as K,d_ as L,bx as le,ar as ce,hD as de,hE as ue,eI as Re,al as qe,J as me,e1 as R,e as ge,ai as Ue,aj as Ge,ak as Ke,hF as Ye,a1 as He,dw as xe,a2 as Xe,hG as Ze,dz as ne,dV as Qe,hH as Ee,hI as Oe,hJ as Je,B as Q,hK as et,gY as je,_ as ve,gX as tt,gZ as st,gW as nt,de as rt,ev as at,hL as ot,hM as it,bO as lt,as as ct,y as dt,g$ as ut,h0 as mt,aZ as ht,b0 as ft,cy as xt,cz as pt,cB as gt,dO as jt,cC as vt,cD as yt,go as bt,ew as Nt,ex as wt,ey as Ct,ez as St,eA as kt,eB as Rt}from"./index-Cga0qx1T.js";import{I as Et}from"./inline-code-BE9ckzPs.js";import{a as Ot,u as Mt}from"./form-DlPwEgQH.js";import{C as Ft,a as At,b as Dt,c as $t,d as ye,e as he}from"./command-CDKbyppr.js";import{A as Lt}from"./AgentPicker-CsIIPGZJ.js";import{d as It,k as zt,e as be}from"./execution-config-ILQiJAmy.js";import{s as Tt}from"./settings-for-runtime-BoOa-ZFG.js";import{l as Bt}from"./list-runtime-types-CP82p1u4.js";import{f as Pt,u as _t}from"./format-cron-BrK8RzgT.js";function ys({icon:t,name:n,description:s,command:o,commandHint:a="Restart DorkOS from your terminal with:",className:l,...c}){return e.jsxs("div",{"data-slot":"feature-disabled-state",className:_("flex flex-col items-center justify-center gap-3 p-8 text-center",l),...c,children:[e.jsx(t,{className:"text-muted-foreground/50 size-8"}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:[n," is off"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s})]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:a}),e.jsxs("div",{className:"flex max-w-full items-center gap-1.5",children:[e.jsx(Et,{className:"min-w-0 px-3 py-1.5 text-sm break-all",children:o}),e.jsx(_e,{value:o,label:`Copy the command for ${n}`})]})]})}const z=(t,n=o=>o,s)=>Ot(t,n,{compare:s});function Vt(){const[t,n]=m.useState({x:0,y:0}),[s,o]=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();n({x:x.clientX-j.left,y:x.clientY-j.top}),o(!0)},[c]),h=m.useCallback(()=>{o(!1)},[]),v=!c&&s?{background:`radial-gradient(350px circle at ${t.x}px ${t.y}px, rgba(59,130,246,0.06), transparent 80%)`}:void 0;return{position:t,isActive:s,onMouseMove:d,onMouseLeave:h,spotlightStyle:v}}function Wt({preset:t,variant:n,checked:s,onCheckedChange:o,onSelect:a,selected:l=!1,className:c}){const{onMouseMove:d,onMouseLeave:h,spotlightStyle:v}=Vt(),x=()=>{n==="toggle"?o==null||o(!s):a==null||a(t)};return e.jsxs("button",{type:"button",onClick:x,onMouseMove:d,onMouseLeave:h,"aria-label":`${t.name}: ${t.description}`,className:_("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",n==="toggle"&&s&&"border-primary/40 bg-accent/30",n==="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}),n==="toggle"&&e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center",children:e.jsx(fe,{checked:s??!1,onCheckedChange:o,"aria-label":`Enable ${t.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:t.name}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t.description}),e.jsx("p",{"aria-hidden":"true",className:"text-muted-foreground text-xs",children:Pt(t.cron)}),e.jsx("p",{"aria-hidden":"true",className:"text-muted-foreground/80 line-clamp-2 text-sm",children:t.prompt})]})]})}function Me({onSelect:t,selectedId:n,className:s}){const{data:o,isLoading:a,isError:l}=_t();return a?e.jsx("div",{className:_("grid grid-cols-2 gap-3",s),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."}):!o||o.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No ready-made tasks yet."}):e.jsx("div",{className:_("grid grid-cols-2 gap-3",s),children:o.map(c=>e.jsx(Wt,{preset:c,variant:"selectable",selected:c.id===n,onSelect:t},c.id))})}const W={frequency:"daily",hour:9,days:[1,2,3,4,5],dayOfMonth:1},qt=[{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"}],Ut=[{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"}],Gt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Kt=[1,2,3,4,5],Yt=[0,6];function Ne(t){const n=t.trim();if(!n)return null;const s=n.split(/\s+/);if(s.length!==5)return null;const[o,a,l,c,d]=s;if(c!=="*")return null;if(o==="*/15"&&a==="*"&&l==="*"&&d==="*")return{...W,frequency:"15m"};if(o!=="0")return null;if(a==="*"&&l==="*"&&d==="*")return{...W,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:{...W,frequency:"monthly",hour:h,dayOfMonth:v}}if(l==="*"&&d==="*")return{...W,frequency:"daily",hour:h};if(l==="*"&&d!=="*"){const v=Ht(d);return v?{...W,frequency:"weekly",hour:h,days:v}:null}return null}function Ht(t){const n=[];for(const s of t.split(",")){const o=s.match(/^(\d)-(\d)$/);if(o){const a=Number(o[1]),l=Number(o[2]);if(a>6||l>6||a>l)return null;for(let c=a;c<=l;c++)n.push(c)}else{const a=Number(s);if(!Number.isInteger(a)||a<0||a>6)return null;n.push(a)}}return n.length>0?n.sort((s,o)=>s-o):null}function we(t){switch(t.frequency){case"15m":return"*/15 * * * *";case"hourly":return"0 * * * *";case"daily":return`0 ${t.hour} * * *`;case"weekly":return`0 ${t.hour} * * ${t.days.join(",")}`;case"monthly":return`0 ${t.hour} ${t.dayOfMonth} * *`}}function Fe(t){const n=t<12?"AM":"PM";return`${t%12||12}:00 ${n}`}function Ae(t){const n=t%100;if(n>=11&&n<=13)return`${t}th`;const s=t%10;return s===1?`${t}st`:s===2?`${t}nd`:s===3?`${t}rd`:`${t}th`}function Ce(t,n){return t.length===n.length&&t.every((s,o)=>s===n[o])}function Xt(t){const n=Fe(t.hour);switch(t.frequency){case"15m":return"Runs every 15 minutes";case"hourly":return"Runs every hour, on the hour";case"daily":return`Runs every day at ${n}`;case"weekly":{const s=[...t.days].sort((c,d)=>c-d);if(Ce(s,Kt))return`Runs every weekday at ${n}`;if(Ce(s,Yt))return`Runs every Saturday and Sunday at ${n}`;const a=s.filter(c=>c!==0).concat(s.includes(0)?[0]:[]).map(c=>Gt[c]);if(a.length===1)return`Runs every ${a[0]} at ${n}`;if(a.length===2)return`Runs every ${a[0]} and ${a[1]} at ${n}`;const l=a.pop();return`Runs every ${a.join(", ")}, and ${l} at ${n}`}case"monthly":return`Runs on the ${Ae(t.dayOfMonth)} of every month at ${n}`}}const Zt="Can’t read this timing. Check the format.";function oe(t){const n=t.trim();if(!n)return!0;try{return Re.toString(n),!0}catch{return!1}}function Qt(t){const n=t.trim();return n?oe(n)?Re.toString(n):Zt:""}function Jt({value:t,onChange:n}){const s=Ne(t),[o,a]=m.useState(s?"simple":t.trim()?"cron":"simple"),[l,c]=m.useState(s??W),d=m.useRef(t);m.useEffect(()=>{if(t===d.current)return;d.current=t;const i=Ne(t);i?(a("simple"),c(i)):t.trim()&&a("cron")},[t]);function h(i){c(i);const g=we(i);d.current=g,n(g)}function v(i){h({...l,frequency:i})}function x(i){h({...l,hour:Number(i)})}function j(i){const g=l.days.includes(i);if(g&&l.days.length<=1)return;const w=g?l.days.filter(S=>S!==i):[...l.days,i].sort((S,N)=>S-N);h({...l,days:w})}function p(i){h({...l,dayOfMonth:Number(i)})}function k(){a("cron")}function C(){a("simple");const i=we(l);d.current=i,n(i)}const u=l.frequency!=="15m"&&l.frequency!=="hourly";return o==="cron"?e.jsxs("div",{className:"space-y-2",children:[e.jsx("button",{type:"button",onClick:C,className:"text-muted-foreground hover:text-foreground text-xs underline-offset-4 hover:underline",children:"Back to simple schedule"}),e.jsx(We,{className:"font-mono",value:t,onChange:i=>n(i.target.value),placeholder:"0 9 * * 1-5"}),t.trim()&&e.jsx("p",{className:_("text-xs",oe(t)?"text-muted-foreground":"text-destructive"),children:Qt(t)}),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:qt.map(i=>e.jsx(L,{value:i.value,children:i.label},i.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},(i,g)=>e.jsx(L,{value:String(g),children:Fe(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:Ut.map(i=>{const g=l.days.includes(i.value);return e.jsx("button",{type:"button","aria-label":i.label,"aria-pressed":g,className:_("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(i.value),children:i.label},i.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},(i,g)=>e.jsx(L,{value:String(g+1),children:Ae(g+1)},g+1))})]})]})},"dom")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:Xt(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 es(t){const n=new Map;for(const s of t){const[o]=s.split("/");n.has(o)||n.set(o,[]),n.get(o).push(s)}return n}function ts({value:t,onChange:n}){const[s,o]=m.useState(!1),a=m.useRef(null),l=m.useMemo(()=>{try{return Intl.supportedValuesOf("timeZone")}catch{return[]}},[]),c=m.useMemo(()=>es(l),[l]),d=m.useMemo(()=>Intl.DateTimeFormat().resolvedOptions().timeZone,[]);m.useEffect(()=>{if(!s)return;function x(j){a.current&&!a.current.contains(j.target)&&o(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]);const h=t||"System default";function v(x){n(x),o(!1)}return e.jsxs("div",{ref:a,className:"relative w-full",children:[e.jsxs("button",{type:"button","aria-expanded":s,"aria-haspopup":"listbox",className:_("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:()=>o(x=>!x),children:[e.jsx("span",{className:"truncate",children:h}),e.jsx(qe,{className:"ml-2 size-4 shrink-0 opacity-50"})]}),s&&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(Ft,{children:[e.jsx(At,{placeholder:"Search timezone…"}),e.jsxs(Dt,{className:"max-h-60",children:[e.jsx($t,{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"}),t===""&&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)"]}),t===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===t&&e.jsx(me,{className:"ml-auto size-4"})]},p))},x))]})]})})]})}function ss({roster:t,value:n}){const s="flex h-9 w-full items-center gap-2 text-sm";if(!n)return e.jsx("p",{"data-testid":"settled-agent",className:`${s} text-muted-foreground`,children:"No agent"});if(t.unreadable)return e.jsx("p",{"data-testid":"settled-agent",className:`${s} text-muted-foreground`,children:"Couldn’t load your agents to show this one."});if(!t.answered)return e.jsxs("div",{"data-testid":"settled-agent-loading",className:s,"aria-hidden":!0,children:[e.jsx(ge,{className:"size-5 rounded-full"}),e.jsx(ge,{className:"h-4 w-32"})]});const o=t.agents.find(l=>l.id===n);if(!o)return e.jsx("p",{"data-testid":"settled-agent",className:`${s} text-muted-foreground`,children:"This agent isn’t registered any more."});const a=Ue(o);return e.jsxs("p",{"data-testid":"settled-agent",className:s,children:[e.jsx(Ge,{color:a.color,emoji:a.emoji,size:"xs"}),e.jsx("span",{className:"truncate",children:Ke(o)})]})}function ns({roster:t,value:n,locked:s,onChange:o}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{children:"Agent"}),s?e.jsxs(e.Fragment,{children:[e.jsx(ss,{roster:t,value:n}),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(Lt,{agents:t.agents,value:n||void 0,onValueChange:a=>o(a??"")})]})}function De(t,n){var c,d;const s=t.map(h=>h.projectPath).join(`
1
+ import{j as e,hD as Pe,G as P,r as m,dA as Ve,$ as fe,I as qe,dW as W,dX as U,dY as G,dZ as K,d_ as L,bx as le,ar as ce,hE as de,hF as ue,eI as Re,al as We,J as me,e1 as R,e as ge,ai as Ue,aj as Ge,ak as Ke,hG as Ye,a1 as He,dw as xe,a2 as Xe,hH as Ze,dz as ne,dV as Qe,hI as Ee,hJ as Oe,hK as Je,B as Q,hL as et,gZ as je,_ as ve,gY as tt,g_ as st,gX as nt,de as rt,ev as at,hM as ot,hN as it,bO as lt,as as ct,y as dt,h0 as ut,h1 as mt,aZ as ht,b0 as ft,cy as xt,cz as pt,cB as gt,dO as jt,cC as vt,cD as yt,gS as bt,ew as Nt,ex as wt,ey as Ct,ez as St,eA as kt,eB as Rt}from"./index-C3cvP8Fo.js";import{I as Et}from"./inline-code-BIzGDx6z.js";import{a as Ot,u as Mt}from"./form-Cru78aT-.js";import{C as Ft,a as At,b as Dt,c as $t,d as ye,e as he}from"./command-CNx4L11m.js";import{A as Lt}from"./AgentPicker-ouNRFSDh.js";import{d as It,k as zt,e as be}from"./execution-config-Ca9MDOtV.js";import{s as Tt}from"./settings-for-runtime-BoOa-ZFG.js";import{l as _t}from"./list-runtime-types-CqO-QFYD.js";import{f as Bt,u as Pt}from"./format-cron-9K38-tn1.js";function ys({icon:t,name:n,description:s,command:o,commandHint:a="Restart DorkOS from your terminal with:",className:l,...c}){return e.jsxs("div",{"data-slot":"feature-disabled-state",className:P("flex flex-col items-center justify-center gap-3 p-8 text-center",l),...c,children:[e.jsx(t,{className:"text-muted-foreground/50 size-8"}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium",children:[n," is off"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s})]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:a}),e.jsxs("div",{className:"flex max-w-full items-center gap-1.5",children:[e.jsx(Et,{className:"min-w-0 px-3 py-1.5 text-sm break-all",children:o}),e.jsx(Pe,{value:o,label:`Copy the command for ${n}`})]})]})}const z=(t,n=o=>o,s)=>Ot(t,n,{compare:s});function Vt(){const[t,n]=m.useState({x:0,y:0}),[s,o]=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();n({x:x.clientX-j.left,y:x.clientY-j.top}),o(!0)},[c]),h=m.useCallback(()=>{o(!1)},[]),v=!c&&s?{background:`radial-gradient(350px circle at ${t.x}px ${t.y}px, rgba(59,130,246,0.06), transparent 80%)`}:void 0;return{position:t,isActive:s,onMouseMove:d,onMouseLeave:h,spotlightStyle:v}}function qt({preset:t,variant:n,checked:s,onCheckedChange:o,onSelect:a,selected:l=!1,className:c}){const{onMouseMove:d,onMouseLeave:h,spotlightStyle:v}=Vt(),x=()=>{n==="toggle"?o==null||o(!s):a==null||a(t)};return e.jsxs("button",{type:"button",onClick:x,onMouseMove:d,onMouseLeave:h,"aria-label":`${t.name}: ${t.description}`,className:P("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",n==="toggle"&&s&&"border-primary/40 bg-accent/30",n==="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}),n==="toggle"&&e.jsx("div",{className:"flex size-11 shrink-0 items-center justify-center",children:e.jsx(fe,{checked:s??!1,onCheckedChange:o,"aria-label":`Enable ${t.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:t.name}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t.description}),e.jsx("p",{"aria-hidden":"true",className:"text-muted-foreground text-xs",children:Bt(t.cron)}),e.jsx("p",{"aria-hidden":"true",className:"text-muted-foreground/80 line-clamp-2 text-sm",children:t.prompt})]})]})}function Me({onSelect:t,selectedId:n,className:s}){const{data:o,isLoading:a,isError:l}=Pt();return a?e.jsx("div",{className:P("grid grid-cols-2 gap-3",s),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."}):!o||o.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No ready-made tasks yet."}):e.jsx("div",{className:P("grid grid-cols-2 gap-3",s),children:o.map(c=>e.jsx(qt,{preset:c,variant:"selectable",selected:c.id===n,onSelect:t},c.id))})}const q={frequency:"daily",hour:9,days:[1,2,3,4,5],dayOfMonth:1},Wt=[{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"}],Ut=[{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"}],Gt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],Kt=[1,2,3,4,5],Yt=[0,6];function Ne(t){const n=t.trim();if(!n)return null;const s=n.split(/\s+/);if(s.length!==5)return null;const[o,a,l,c,d]=s;if(c!=="*")return null;if(o==="*/15"&&a==="*"&&l==="*"&&d==="*")return{...q,frequency:"15m"};if(o!=="0")return null;if(a==="*"&&l==="*"&&d==="*")return{...q,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:{...q,frequency:"monthly",hour:h,dayOfMonth:v}}if(l==="*"&&d==="*")return{...q,frequency:"daily",hour:h};if(l==="*"&&d!=="*"){const v=Ht(d);return v?{...q,frequency:"weekly",hour:h,days:v}:null}return null}function Ht(t){const n=[];for(const s of t.split(",")){const o=s.match(/^(\d)-(\d)$/);if(o){const a=Number(o[1]),l=Number(o[2]);if(a>6||l>6||a>l)return null;for(let c=a;c<=l;c++)n.push(c)}else{const a=Number(s);if(!Number.isInteger(a)||a<0||a>6)return null;n.push(a)}}return n.length>0?n.sort((s,o)=>s-o):null}function we(t){switch(t.frequency){case"15m":return"*/15 * * * *";case"hourly":return"0 * * * *";case"daily":return`0 ${t.hour} * * *`;case"weekly":return`0 ${t.hour} * * ${t.days.join(",")}`;case"monthly":return`0 ${t.hour} ${t.dayOfMonth} * *`}}function Fe(t){const n=t<12?"AM":"PM";return`${t%12||12}:00 ${n}`}function Ae(t){const n=t%100;if(n>=11&&n<=13)return`${t}th`;const s=t%10;return s===1?`${t}st`:s===2?`${t}nd`:s===3?`${t}rd`:`${t}th`}function Ce(t,n){return t.length===n.length&&t.every((s,o)=>s===n[o])}function Xt(t){const n=Fe(t.hour);switch(t.frequency){case"15m":return"Runs every 15 minutes";case"hourly":return"Runs every hour, on the hour";case"daily":return`Runs every day at ${n}`;case"weekly":{const s=[...t.days].sort((c,d)=>c-d);if(Ce(s,Kt))return`Runs every weekday at ${n}`;if(Ce(s,Yt))return`Runs every Saturday and Sunday at ${n}`;const a=s.filter(c=>c!==0).concat(s.includes(0)?[0]:[]).map(c=>Gt[c]);if(a.length===1)return`Runs every ${a[0]} at ${n}`;if(a.length===2)return`Runs every ${a[0]} and ${a[1]} at ${n}`;const l=a.pop();return`Runs every ${a.join(", ")}, and ${l} at ${n}`}case"monthly":return`Runs on the ${Ae(t.dayOfMonth)} of every month at ${n}`}}const Zt="Can’t read this timing. Check the format.";function oe(t){const n=t.trim();if(!n)return!0;try{return Re.toString(n),!0}catch{return!1}}function Qt(t){const n=t.trim();return n?oe(n)?Re.toString(n):Zt:""}function Jt({value:t,onChange:n}){const s=Ne(t),[o,a]=m.useState(s?"simple":t.trim()?"cron":"simple"),[l,c]=m.useState(s??q),d=m.useRef(t);m.useEffect(()=>{if(t===d.current)return;d.current=t;const i=Ne(t);i?(a("simple"),c(i)):t.trim()&&a("cron")},[t]);function h(i){c(i);const g=we(i);d.current=g,n(g)}function v(i){h({...l,frequency:i})}function x(i){h({...l,hour:Number(i)})}function j(i){const g=l.days.includes(i);if(g&&l.days.length<=1)return;const w=g?l.days.filter(S=>S!==i):[...l.days,i].sort((S,N)=>S-N);h({...l,days:w})}function p(i){h({...l,dayOfMonth:Number(i)})}function k(){a("cron")}function C(){a("simple");const i=we(l);d.current=i,n(i)}const u=l.frequency!=="15m"&&l.frequency!=="hourly";return o==="cron"?e.jsxs("div",{className:"space-y-2",children:[e.jsx("button",{type:"button",onClick:C,className:"text-muted-foreground hover:text-foreground text-xs underline-offset-4 hover:underline",children:"Back to simple schedule"}),e.jsx(qe,{className:"font-mono",value:t,onChange:i=>n(i.target.value),placeholder:"0 9 * * 1-5"}),t.trim()&&e.jsx("p",{className:P("text-xs",oe(t)?"text-muted-foreground":"text-destructive"),children:Qt(t)}),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(W,{value:l.frequency,onValueChange:v,children:[e.jsx(U,{"aria-label":"Frequency",children:e.jsx(G,{})}),e.jsx(K,{children:Wt.map(i=>e.jsx(L,{value:i.value,children:i.label},i.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(W,{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},(i,g)=>e.jsx(L,{value:String(g),children:Fe(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:Ut.map(i=>{const g=l.days.includes(i.value);return e.jsx("button",{type:"button","aria-label":i.label,"aria-pressed":g,className:P("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(i.value),children:i.label},i.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(W,{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},(i,g)=>e.jsx(L,{value:String(g+1),children:Ae(g+1)},g+1))})]})]})},"dom")}),e.jsx("p",{className:"text-muted-foreground text-xs",children:Xt(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 es(t){const n=new Map;for(const s of t){const[o]=s.split("/");n.has(o)||n.set(o,[]),n.get(o).push(s)}return n}function ts({value:t,onChange:n}){const[s,o]=m.useState(!1),a=m.useRef(null),l=m.useMemo(()=>{try{return Intl.supportedValuesOf("timeZone")}catch{return[]}},[]),c=m.useMemo(()=>es(l),[l]),d=m.useMemo(()=>Intl.DateTimeFormat().resolvedOptions().timeZone,[]);m.useEffect(()=>{if(!s)return;function x(j){a.current&&!a.current.contains(j.target)&&o(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[s]);const h=t||"System default";function v(x){n(x),o(!1)}return e.jsxs("div",{ref:a,className:"relative w-full",children:[e.jsxs("button",{type:"button","aria-expanded":s,"aria-haspopup":"listbox",className:P("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:()=>o(x=>!x),children:[e.jsx("span",{className:"truncate",children:h}),e.jsx(We,{className:"ml-2 size-4 shrink-0 opacity-50"})]}),s&&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(Ft,{children:[e.jsx(At,{placeholder:"Search timezone…"}),e.jsxs(Dt,{className:"max-h-60",children:[e.jsx($t,{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"}),t===""&&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)"]}),t===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===t&&e.jsx(me,{className:"ml-auto size-4"})]},p))},x))]})]})})]})}function ss({roster:t,value:n}){const s="flex h-9 w-full items-center gap-2 text-sm";if(!n)return e.jsx("p",{"data-testid":"settled-agent",className:`${s} text-muted-foreground`,children:"No agent"});if(t.unreadable)return e.jsx("p",{"data-testid":"settled-agent",className:`${s} text-muted-foreground`,children:"Couldn’t load your agents to show this one."});if(!t.answered)return e.jsxs("div",{"data-testid":"settled-agent-loading",className:s,"aria-hidden":!0,children:[e.jsx(ge,{className:"size-5 rounded-full"}),e.jsx(ge,{className:"h-4 w-32"})]});const o=t.agents.find(l=>l.id===n);if(!o)return e.jsx("p",{"data-testid":"settled-agent",className:`${s} text-muted-foreground`,children:"This agent isn’t registered any more."});const a=Ue(o);return e.jsxs("p",{"data-testid":"settled-agent",className:s,children:[e.jsx(Ge,{color:a.color,emoji:a.emoji,size:"xs"}),e.jsx("span",{className:"truncate",children:Ke(o)})]})}function ns({roster:t,value:n,locked:s,onChange:o}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx(R,{children:"Agent"}),s?e.jsxs(e.Fragment,{children:[e.jsx(ss,{roster:t,value:n}),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(Lt,{agents:t.agents,value:n||void 0,onValueChange:a=>o(a??"")})]})}function De(t,n){var c,d;const s=t.map(h=>h.projectPath).join(`
2
2
  `),o=m.useMemo(()=>s?s.split(`
3
- `):[],[s]),{data:a}=Ye(o),l=n?(c=t.find(h=>h.id===n))==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 rs(t){var B;const{runtime:n,model:s,effort:o,agentRuntime:a}=t,l=He(),{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=n||j,k=p??void 0,C=k!==void 0&&d!==void 0&&d.includes(k),{data:u}=Xe({...Ze(l,k?{runtime:k}:{}),enabled:C,retry:!1}),i=s?u==null?void 0:u.find(y=>y.value===s):void 0,g=(B=Tt(c,p))==null?void 0:B.supportsEffort,w=p?It({agent:{runtime:p,model:s||null,effort:o||null},defaultRuntime:p,knownRuntimes:d,knownModels:zt(u),modelSupportsEffort:i?i.supportsEffort??!1:void 0,runtimeSupportsEffort:g,runtimeLabel:y=>ne(y).label}):null,S=y=>{var b;return((b=w==null?void 0:w.breakages.find(M=>y.includes(M.kind)))==null?void 0:b.message)??null},N=d==null?void 0:d.join(","),T=m.useMemo(()=>{const y=N===void 0?[]:N.split(",").filter(Boolean),b=Bt(y).filter(M=>y.includes(M));return n&&!b.includes(n)&&b.push(n),b.map(M=>({value:M,label:ne(M).label}))},[N,n]),A=m.useMemo(()=>{const y=(u??[]).map(b=>({value:b.value,label:b.displayName}));return s&&!y.some(b=>b.value===s)&&y.push({value:s,label:s}),y},[u,s]),Y=m.useMemo(()=>{const y=Qe.filter(b=>!(i!=null&&i.supportedEffortLevels)||i.supportedEffortLevels.includes(b)).map(b=>({value:b,label:be(b)}));return o&&!y.some(b=>b.value===o)&&y.push({value:o,label:be(o)}),y},[i,o]),D=j===null?"Same as agent":x?`Same as agent (${ne(j).label})`:`Server default (${ne(j).label})`;return{effectiveRuntime:p,runtimeOptions:T,inheritRuntimeLabel:D,modelOptions:A,supportsEffort:g===!0,effortOptions:Y,runtimeWarning:S(["runtime-not-connected"]),modelWarning:S(["model-unavailable"]),effortWarning:S(["effort-unsupported-runtime","effort-unsupported-model"])}}const re="text-xs text-status-warning-fg";function as({runtime:t,model:n,effort:s,execution:o,onRuntimeChange:a,onModelChange:l,onEffortChange:c}){const{runtimeOptions:d,inheritRuntimeLabel:h,modelOptions:v,supportsEffort:x,effortOptions:j,runtimeWarning:p,modelWarning:k,effortWarning:C}=o;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:t||$,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:n||$,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:s||$,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))]})]}),C&&e.jsx("p",{"data-testid":"task-effort-warning",className:re,children:C})]}):s&&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:C??"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"})]})]})}const ae="10m";function os(t){return`${Math.round(t/6e4)}m`}function P(t,n,s,o="acceptEdits"){return t?{name:t.name,description:t.description??"",prompt:t.prompt,cron:t.cron??"",agentId:t.agentId??"",timezone:t.timezone??"",permissionMode:t.permissionMode,maxRuntime:t.maxRuntime?os(t.maxRuntime):ae,sticky:t.sticky,runtime:t.runtime??"",model:t.model??"",effort:t.effort??""}:n?{name:n.name,description:n.description,prompt:n.prompt,cron:n.cron,agentId:s??"",timezone:n.timezone??"",permissionMode:o,maxRuntime:ae,sticky:!1,runtime:"",model:"",effort:""}:{name:"",description:"",prompt:"",cron:"",agentId:s??"",timezone:"",permissionMode:o,maxRuntime:ae,sticky:!1,runtime:"",model:"",effort:""}}function Se(t){const n=t.cron.trim();return{name:t.name.trim(),description:t.description.trim(),prompt:t.prompt.trim(),cron:n||null,...n&&t.timezone?{timezone:t.timezone}:{},permissionMode:t.permissionMode,maxRuntime:t.maxRuntime.trim()||void 0,sticky:t.sticky,runtime:t.runtime||null,model:t.model||null,effort:t.effort||null}}function is(t,n){const s=Se(t),o=Se(n);return Object.fromEntries(Object.entries(o).filter(([a,l])=>l!==s[a]))}const $e=100;function ls(t,n=[]){const s=new Set([...n].map(a=>a.toLowerCase())),o=t.name.trim();for(let a=1;;a++){const l=a===1?"-copy":`-copy-${a}`,c=`${o.slice(0,$e-l.length)}${l}`;if(!s.has(c.toLowerCase()))return{...t,name:c}}}const cs={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(t){var s;const n=t;return(n==null?void 0:n.code)!==ot?null:{message:n.message,ownedBy:((s=n.body)==null?void 0:s.ownedBy)==="legacy"?"legacy":"record"}}function ds({defaultValues:t,roster:n,editTask:s,onSubmitSuccess:o,onCancel:a,onDeleteClick:l,isPending:c,onMakeCopy:d,leading:h}){var ee,te;const v=Ee(),x=m.useRef(!0);m.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]);const j=Oe({isShownInline:r=>x.current&&ke(r)!==null}),p=s?ke(j.error):null,k=(s==null?void 0:s.packageOwned)??null,C=k??(p==null?void 0:p.ownedBy)??null,u=k!==null,i=Mt({defaultValues:t,onSubmit:({value:r})=>{const f=r.agentId.trim()||void 0,F=r.cron.trim();if(s){const O=is(t,r);if(Object.keys(O).length===0){o();return}j.mutate({id:s.id,...O},{onSuccess:o})}else{const O=f??"global",se={name:r.name.trim(),description:r.description.trim()||r.name.trim(),prompt:r.prompt.trim(),target:O,cron:F||void 0,...F&&r.timezone?{timezone:r.timezone}:{},permissionMode:r.permissionMode,maxRuntime:r.maxRuntime.trim()||void 0,...r.sticky?{sticky:!0}:{},...r.runtime?{runtime:r.runtime}:{},...r.model?{model:r.model}:{},...r.effort?{effort:r.effort}:{}};v.mutate(se,{onSuccess:o})}}}),g=z(i.store,r=>r.values.agentId),w=z(i.store,r=>r.values.runtime),S=z(i.store,r=>r.values.model),N=z(i.store,r=>r.values.effort),T=z(i.store,r=>r.values.permissionMode),A=z(i.store,r=>r.values.cron),[Y,D]=m.useState(!!t.cron),[B,y]=m.useState(!1),b=z(i.store,r=>r.values.maxRuntime),M=z(i.store,r=>r.values.sticky),I=[w!=="",S!=="",N!=="",b!==ae,M,Je(T)].filter(Boolean).length,J=De(n.agents,g),V=rs({runtime:w,model:S,effort:N,agentRuntime:J}),{data:H}=xe(),X=(V.effectiveRuntime?(te=(ee=H==null?void 0:H.capabilities[V.effectiveRuntime])==null?void 0:ee.permissionModes)==null?void 0:te.values:void 0)??[];return e.jsxs(i.AppForm,{children:[e.jsx("form",{onSubmit:r=>{r.preventDefault(),i.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:[C!==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}):cs[C].map(r=>e.jsx("p",{children:r},r)),C==="record"&&d&&e.jsxs(Q,{type:"button",variant:"outline",size:"xs",onClick:()=>d(i.state.values),children:[e.jsx(et,{}),"Make a copy"]})]}),h,e.jsx(ns,{roster:n,value:g,locked:s!==void 0,onChange:r=>i.setFieldValue("agentId",r)}),e.jsxs("fieldset",{disabled:u,className:"min-w-0 space-y-5",children:[e.jsx(i.AppField,{name:"name",children:r=>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:r.state.value,onChange:f=>r.handleChange(f.target.value),onBlur:r.handleBlur,maxLength:$e,placeholder:"Daily code review"}),r.state.meta.isTouched&&r.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(r.state.meta.errors[0])})]})}),e.jsx(i.AppField,{name:"description",children:r=>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:r.state.value,onChange:f=>r.handleChange(f.target.value),onBlur:r.handleBlur,placeholder:"A short description of this schedule"}),r.state.meta.isTouched&&r.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(r.state.meta.errors[0])})]})}),e.jsx(i.AppField,{name:"prompt",children:r=>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:r.state.value,onChange:f=>r.handleChange(f.target.value),onBlur:r.handleBlur,rows:4,placeholder:"Review all pending PRs and summarize findings…"}),r.state.meta.isTouched&&r.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(r.state.meta.errors[0])})]})})]}),e.jsx(je,{open:Y,onOpenChange:D,trigger:"Schedule",badge:e.jsx(ve,{variant:"secondary",className:"text-xs",children:A?"On a schedule":"Optional"}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(i.AppField,{name:"cron",children:r=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{children:"When it runs"}),e.jsx(Jt,{value:r.state.value,onChange:f=>r.handleChange(f)})]})}),e.jsx(i.AppField,{name:"timezone",children:r=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{children:"Timezone"}),e.jsx(ts,{value:r.state.value,onChange:f=>r.handleChange(f)})]})})]})}),e.jsx(i.Subscribe,{selector:r=>!oe(r.values.cron),children:r=>r?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:B,onOpenChange:y,trigger:"Advanced settings",badge:I>0?e.jsxs(ve,{variant:"secondary",className:"text-xs",children:[I," changed"]}):void 0,children:e.jsxs("fieldset",{disabled:u,className:"min-w-0 space-y-4",children:[e.jsx(as,{runtime:w,model:S,effort:N,execution:V,onRuntimeChange:r=>i.setFieldValue("runtime",r),onModelChange:r=>i.setFieldValue("model",r),onEffortChange:r=>i.setFieldValue("effort",r)}),e.jsx(i.AppField,{name:"permissionMode",children:r=>{const f=X.find(O=>O.id===r.state.value),F=(f==null?void 0:f.label)??tt(r.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 “",F,"”. 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(st,{mode:r.state.value,descriptors:X,onChangeMode:O=>r.handleChange(O),strandsWorkingMode:!0,strandedNote:e.jsxs(e.Fragment,{children:["Set to “",F,"”, which isn’t listed. Saving keeps it. Pick a stop to change it."]})}),f!==void 0&&f.asks!=="never"&&e.jsxs("div",{"data-testid":"task-unattended-note",className:"text-muted-foreground space-y-1 px-1 text-xs leading-relaxed",children:[e.jsx("p",{children:"Nobody watches a scheduled run, so any ask is turned down."}),e.jsx("p",{children:"The run carries on without that tool and says so. “Run now” still asks you."})]}),e.jsx(nt,{mode:r.state.value,...f?{descriptor:f}:{},className:"px-1"})]})}}),e.jsx(i.AppField,{name:"maxRuntime",children:r=>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:r.state.value,onChange:f=>r.handleChange(f.target.value),onBlur:r.handleBlur,placeholder:"10m"})]})}),e.jsx(i.AppField,{name:"sticky",children:r=>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:r.state.value,onCheckedChange:f=>r.handleChange(f)})]})})]})})]})}),e.jsxs(rt,{className:"shrink-0 border-t px-4 py-3",children:[s&&e.jsxs(Q,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive mr-auto",onClick:l,children:[e.jsx(at,{className:"mr-1.5 size-4"}),"Delete"]}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsx(i.Subscribe,{selector:r=>r.values.name.trim()!==""&&r.values.prompt.trim()!==""&&oe(r.values.cron),children:r=>e.jsx(Q,{type:"submit",size:"sm",form:"schedule-form",disabled:!r||c,children:c?"Saving…":s?"Save":"Create task"})})]})]})}function bs({open:t,onOpenChange:n,editTask:s,initialPreset:o,initialAgentId:a}){var pe;const l=it(),c=Oe(),d=Ee(),{data:h,isError:v}=lt(),x={agents:(h==null?void 0:h.agents)??[],answered:h!==void 0,unreadable:v},{data:j}=xe(),p=De(x.agents,a),C=p!==null&&j!==void 0&&Object.hasOwn(j.capabilities,p)?p:(j==null?void 0:j.defaultRuntime)??null,{data:u}=ct(),i=dt(C),g=ut(C?mt(u==null?void 0:u.executionDefaults,C):null,((pe=i==null?void 0:i.permissionModes)==null?void 0:pe.values)??[]),w=m.useRef(g);m.useLayoutEffect(()=>{w.current=g},[g]);const[S,N]=m.useState(()=>s?"form":"preset-picker"),[T,A]=m.useState(null),[Y,D]=m.useState(!1),[B,y]=m.useState((s==null?void 0:s.enabled)??!0),[b,M]=m.useState(!1),I=b?void 0:s,[J,V]=m.useState(!0),{data:H}=ht(),[X,ee]=m.useState(()=>P(s,void 0,a,g)),[te,r]=m.useState(0);function f(E,ie=!1){ee(E),r(Z=>Z+1),M(ie)}m.useEffect(()=>{if(!t){f(P(s,void 0,a,w.current)),A(null),D(!1),N(s?"form":"preset-picker");return}s?(f(P(s)),y(s.enabled),N("form")):o?(f(P(void 0,o,a,w.current)),A(o),N("form")):(f(P(void 0,void 0,a,w.current)),N("preset-picker"))},[s,t,o,a]);const{pendingTemplate:F,externalTrigger:O,clear:se}=ft();m.useEffect(()=>{O&&F&&(f(P(void 0,F,a,w.current)),A(F),N("form"),se())},[O,F,se,a]);function Le(E){f(P(void 0,E,a,w.current)),A(E),N("form")}function Ie(E){const ie=(H??[]).filter(Z=>(Z.agentId??"")===E.agentId).map(Z=>Z.name);V(!0),f(ls(E,ie),!0)}function ze(){b&&J&&s&&c.mutate({id:s.id,enabled:!1}),n(!1)}function Te(){s&&l.mutate(s.id,{onSuccess:()=>{D(!1),n(!1)}})}function Be(E){s&&(y(E),c.mutate({id:s.id,enabled:E},{onError:()=>y(s.enabled)}))}const Pe=d.isPending||c.isPending;return e.jsxs(xt,{open:t,onOpenChange:n,children:[e.jsxs(pt,{className:"flex max-h-[85vh] max-w-lg flex-col gap-0 p-0",children:[e.jsxs(gt,{className:"shrink-0 border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[S==="form"&&!I&&!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(jt,{className:"size-4"}),"Back"]}),e.jsx(vt,{children:I?"Edit schedule":"New schedule"}),I&&e.jsx(fe,{className:"ml-auto",checked:B,onCheckedChange:Be,disabled:c.isPending,"aria-label":B?"Disable schedule":"Enable schedule"})]}),e.jsx(yt,{className:"sr-only",children:I?"Edit an existing schedule":"Create a new schedule"})]}),S==="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(Me,{onSelect:Le,selectedId:T==null?void 0:T.id}),e.jsx("button",{type:"button",onClick:()=>{A(null),N("form")},className:"text-muted-foreground hover:text-foreground w-full text-center text-sm transition-colors",children:"Start from scratch"})]})}),S==="form"&&e.jsx(ds,{defaultValues:X,roster:x,editTask:I,onSubmitSuccess:ze,onCancel:()=>n(!1),onDeleteClick:()=>D(!0),isPending:Pe,onMakeCopy:Ie,leading:b&&s?e.jsxs("div",{className:"flex items-start gap-2 rounded-md border px-3 py-2",children:[e.jsx(bt,{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 “",s.name,"” and your copy don’t both run."]})]})]}):void 0},te)]}),s&&e.jsx(Nt,{open:Y,onOpenChange:D,children:e.jsxs(wt,{children:[e.jsxs(Ct,{children:[e.jsxs(St,{children:["Delete “",s.name,"”?"]}),e.jsx(kt,{children:"Its run history is deleted too. This can’t be undone."})]}),e.jsxs(Rt,{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("button",{onClick:Te,disabled:l.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 dark:bg-destructive/60 inline-flex items-center rounded-md px-3 py-1.5 text-sm font-medium shadow-sm transition-colors",children:l.isPending?"Deleting…":"Delete task"})]})]})})]})}function Ns({onCreateWithPreset:t,onCreateBlank:n}){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(Me,{onSelect:t})}),e.jsx(Q,{variant:"ghost",className:"mt-4",onClick:n,children:"New custom schedule"})]})}export{bs as C,ys as F,Ns as T};
3
+ `):[],[s]),{data:a}=Ye(o),l=n?(c=t.find(h=>h.id===n))==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 rs(t){var _;const{runtime:n,model:s,effort:o,agentRuntime:a}=t,l=He(),{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=n||j,k=p??void 0,C=k!==void 0&&d!==void 0&&d.includes(k),{data:u}=Xe({...Ze(l,k?{runtime:k}:{}),enabled:C,retry:!1}),i=s?u==null?void 0:u.find(y=>y.value===s):void 0,g=(_=Tt(c,p))==null?void 0:_.supportsEffort,w=p?It({agent:{runtime:p,model:s||null,effort:o||null},defaultRuntime:p,knownRuntimes:d,knownModels:zt(u),modelSupportsEffort:i?i.supportsEffort??!1:void 0,runtimeSupportsEffort:g,runtimeLabel:y=>ne(y).label}):null,S=y=>{var b;return((b=w==null?void 0:w.breakages.find(M=>y.includes(M.kind)))==null?void 0:b.message)??null},N=d==null?void 0:d.join(","),T=m.useMemo(()=>{const y=N===void 0?[]:N.split(",").filter(Boolean),b=_t(y).filter(M=>y.includes(M));return n&&!b.includes(n)&&b.push(n),b.map(M=>({value:M,label:ne(M).label}))},[N,n]),A=m.useMemo(()=>{const y=(u??[]).map(b=>({value:b.value,label:b.displayName}));return s&&!y.some(b=>b.value===s)&&y.push({value:s,label:s}),y},[u,s]),Y=m.useMemo(()=>{const y=Qe.filter(b=>!(i!=null&&i.supportedEffortLevels)||i.supportedEffortLevels.includes(b)).map(b=>({value:b,label:be(b)}));return o&&!y.some(b=>b.value===o)&&y.push({value:o,label:be(o)}),y},[i,o]),D=j===null?"Same as agent":x?`Same as agent (${ne(j).label})`:`Server default (${ne(j).label})`;return{effectiveRuntime:p,runtimeOptions:T,inheritRuntimeLabel:D,modelOptions:A,supportsEffort:g===!0,effortOptions:Y,runtimeWarning:S(["runtime-not-connected"]),modelWarning:S(["model-unavailable"]),effortWarning:S(["effort-unsupported-runtime","effort-unsupported-model"])}}const re="text-xs text-status-warning-fg";function as({runtime:t,model:n,effort:s,execution:o,onRuntimeChange:a,onModelChange:l,onEffortChange:c}){const{runtimeOptions:d,inheritRuntimeLabel:h,modelOptions:v,supportsEffort:x,effortOptions:j,runtimeWarning:p,modelWarning:k,effortWarning:C}=o;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(W,{value:t||$,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(W,{value:n||$,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(W,{value:s||$,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))]})]}),C&&e.jsx("p",{"data-testid":"task-effort-warning",className:re,children:C})]}):s&&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:C??"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"})]})]})}const ae="10m";function os(t){return`${Math.round(t/6e4)}m`}function B(t,n,s,o="acceptEdits"){return t?{name:t.name,description:t.description??"",prompt:t.prompt,cron:t.cron??"",agentId:t.agentId??"",timezone:t.timezone??"",permissionMode:t.permissionMode,maxRuntime:t.maxRuntime?os(t.maxRuntime):ae,sticky:t.sticky,runtime:t.runtime??"",model:t.model??"",effort:t.effort??""}:n?{name:n.name,description:n.description,prompt:n.prompt,cron:n.cron,agentId:s??"",timezone:n.timezone??"",permissionMode:o,maxRuntime:ae,sticky:!1,runtime:"",model:"",effort:""}:{name:"",description:"",prompt:"",cron:"",agentId:s??"",timezone:"",permissionMode:o,maxRuntime:ae,sticky:!1,runtime:"",model:"",effort:""}}function Se(t){const n=t.cron.trim();return{name:t.name.trim(),description:t.description.trim(),prompt:t.prompt.trim(),cron:n||null,...n&&t.timezone?{timezone:t.timezone}:{},permissionMode:t.permissionMode,maxRuntime:t.maxRuntime.trim()||void 0,sticky:t.sticky,runtime:t.runtime||null,model:t.model||null,effort:t.effort||null}}function is(t,n){const s=Se(t),o=Se(n);return Object.fromEntries(Object.entries(o).filter(([a,l])=>l!==s[a]))}const $e=100;function ls(t,n=[]){const s=new Set([...n].map(a=>a.toLowerCase())),o=t.name.trim();for(let a=1;;a++){const l=a===1?"-copy":`-copy-${a}`,c=`${o.slice(0,$e-l.length)}${l}`;if(!s.has(c.toLowerCase()))return{...t,name:c}}}const cs={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(t){var s;const n=t;return(n==null?void 0:n.code)!==ot?null:{message:n.message,ownedBy:((s=n.body)==null?void 0:s.ownedBy)==="legacy"?"legacy":"record"}}function ds({defaultValues:t,roster:n,editTask:s,onSubmitSuccess:o,onCancel:a,onDeleteClick:l,isPending:c,onMakeCopy:d,leading:h}){var ee,te;const v=Ee(),x=m.useRef(!0);m.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]);const j=Oe({isShownInline:r=>x.current&&ke(r)!==null}),p=s?ke(j.error):null,k=(s==null?void 0:s.packageOwned)??null,C=k??(p==null?void 0:p.ownedBy)??null,u=k!==null,i=Mt({defaultValues:t,onSubmit:({value:r})=>{const f=r.agentId.trim()||void 0,F=r.cron.trim();if(s){const O=is(t,r);if(Object.keys(O).length===0){o();return}j.mutate({id:s.id,...O},{onSuccess:o})}else{const O=f??"global",se={name:r.name.trim(),description:r.description.trim()||r.name.trim(),prompt:r.prompt.trim(),target:O,cron:F||void 0,...F&&r.timezone?{timezone:r.timezone}:{},permissionMode:r.permissionMode,maxRuntime:r.maxRuntime.trim()||void 0,...r.sticky?{sticky:!0}:{},...r.runtime?{runtime:r.runtime}:{},...r.model?{model:r.model}:{},...r.effort?{effort:r.effort}:{}};v.mutate(se,{onSuccess:o})}}}),g=z(i.store,r=>r.values.agentId),w=z(i.store,r=>r.values.runtime),S=z(i.store,r=>r.values.model),N=z(i.store,r=>r.values.effort),T=z(i.store,r=>r.values.permissionMode),A=z(i.store,r=>r.values.cron),[Y,D]=m.useState(!!t.cron),[_,y]=m.useState(!1),b=z(i.store,r=>r.values.maxRuntime),M=z(i.store,r=>r.values.sticky),I=[w!=="",S!=="",N!=="",b!==ae,M,Je(T)].filter(Boolean).length,J=De(n.agents,g),V=rs({runtime:w,model:S,effort:N,agentRuntime:J}),{data:H}=xe(),X=(V.effectiveRuntime?(te=(ee=H==null?void 0:H.capabilities[V.effectiveRuntime])==null?void 0:ee.permissionModes)==null?void 0:te.values:void 0)??[];return e.jsxs(i.AppForm,{children:[e.jsx("form",{onSubmit:r=>{r.preventDefault(),i.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:[C!==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}):cs[C].map(r=>e.jsx("p",{children:r},r)),C==="record"&&d&&e.jsxs(Q,{type:"button",variant:"outline",size:"xs",onClick:()=>d(i.state.values),children:[e.jsx(et,{}),"Make a copy"]})]}),h,e.jsx(ns,{roster:n,value:g,locked:s!==void 0,onChange:r=>i.setFieldValue("agentId",r)}),e.jsxs("fieldset",{disabled:u,className:"min-w-0 space-y-5",children:[e.jsx(i.AppField,{name:"name",children:r=>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:r.state.value,onChange:f=>r.handleChange(f.target.value),onBlur:r.handleBlur,maxLength:$e,placeholder:"Daily code review"}),r.state.meta.isTouched&&r.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(r.state.meta.errors[0])})]})}),e.jsx(i.AppField,{name:"description",children:r=>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:r.state.value,onChange:f=>r.handleChange(f.target.value),onBlur:r.handleBlur,placeholder:"A short description of this schedule"}),r.state.meta.isTouched&&r.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(r.state.meta.errors[0])})]})}),e.jsx(i.AppField,{name:"prompt",children:r=>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:r.state.value,onChange:f=>r.handleChange(f.target.value),onBlur:r.handleBlur,rows:4,placeholder:"Review all pending PRs and summarize findings…"}),r.state.meta.isTouched&&r.state.meta.errors.length>0&&e.jsx("p",{className:"text-destructive text-xs",children:String(r.state.meta.errors[0])})]})})]}),e.jsx(je,{open:Y,onOpenChange:D,trigger:"Schedule",badge:e.jsx(ve,{variant:"secondary",className:"text-xs",children:A?"On a schedule":"Optional"}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(i.AppField,{name:"cron",children:r=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{children:"When it runs"}),e.jsx(Jt,{value:r.state.value,onChange:f=>r.handleChange(f)})]})}),e.jsx(i.AppField,{name:"timezone",children:r=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(R,{children:"Timezone"}),e.jsx(ts,{value:r.state.value,onChange:f=>r.handleChange(f)})]})})]})}),e.jsx(i.Subscribe,{selector:r=>!oe(r.values.cron),children:r=>r?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:_,onOpenChange:y,trigger:"Advanced settings",badge:I>0?e.jsxs(ve,{variant:"secondary",className:"text-xs",children:[I," changed"]}):void 0,children:e.jsxs("fieldset",{disabled:u,className:"min-w-0 space-y-4",children:[e.jsx(as,{runtime:w,model:S,effort:N,execution:V,onRuntimeChange:r=>i.setFieldValue("runtime",r),onModelChange:r=>i.setFieldValue("model",r),onEffortChange:r=>i.setFieldValue("effort",r)}),e.jsx(i.AppField,{name:"permissionMode",children:r=>{const f=X.find(O=>O.id===r.state.value),F=(f==null?void 0:f.label)??tt(r.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 “",F,"”. 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(st,{mode:r.state.value,descriptors:X,onChangeMode:O=>r.handleChange(O),strandsWorkingMode:!0,strandedNote:e.jsxs(e.Fragment,{children:["Set to “",F,"”, which isn’t listed. Saving keeps it. Pick a stop to change it."]})}),f!==void 0&&f.asks!=="never"&&e.jsxs("div",{"data-testid":"task-unattended-note",className:"text-muted-foreground space-y-1 px-1 text-xs leading-relaxed",children:[e.jsx("p",{children:"Nobody watches a scheduled run, so any ask is turned down."}),e.jsx("p",{children:"The run carries on without that tool and says so. “Run now” still asks you."})]}),e.jsx(nt,{mode:r.state.value,...f?{descriptor:f}:{},className:"px-1"})]})}}),e.jsx(i.AppField,{name:"maxRuntime",children:r=>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:r.state.value,onChange:f=>r.handleChange(f.target.value),onBlur:r.handleBlur,placeholder:"10m"})]})}),e.jsx(i.AppField,{name:"sticky",children:r=>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:r.state.value,onCheckedChange:f=>r.handleChange(f)})]})})]})})]})}),e.jsxs(rt,{className:"shrink-0 border-t px-4 py-3",children:[s&&e.jsxs(Q,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive mr-auto",onClick:l,children:[e.jsx(at,{className:"mr-1.5 size-4"}),"Delete"]}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:a,children:"Cancel"}),e.jsx(i.Subscribe,{selector:r=>r.values.name.trim()!==""&&r.values.prompt.trim()!==""&&oe(r.values.cron),children:r=>e.jsx(Q,{type:"submit",size:"sm",form:"schedule-form",disabled:!r||c,children:c?"Saving…":s?"Save":"Create task"})})]})]})}function bs({open:t,onOpenChange:n,editTask:s,initialPreset:o,initialAgentId:a}){var pe;const l=it(),c=Oe(),d=Ee(),{data:h,isError:v}=lt(),x={agents:(h==null?void 0:h.agents)??[],answered:h!==void 0,unreadable:v},{data:j}=xe(),p=De(x.agents,a),C=p!==null&&j!==void 0&&Object.hasOwn(j.capabilities,p)?p:(j==null?void 0:j.defaultRuntime)??null,{data:u}=ct(),i=dt(C),g=ut(C?mt(u==null?void 0:u.executionDefaults,C):null,((pe=i==null?void 0:i.permissionModes)==null?void 0:pe.values)??[]),w=m.useRef(g);m.useLayoutEffect(()=>{w.current=g},[g]);const[S,N]=m.useState(()=>s?"form":"preset-picker"),[T,A]=m.useState(null),[Y,D]=m.useState(!1),[_,y]=m.useState((s==null?void 0:s.enabled)??!0),[b,M]=m.useState(!1),I=b?void 0:s,[J,V]=m.useState(!0),{data:H}=ht(),[X,ee]=m.useState(()=>B(s,void 0,a,g)),[te,r]=m.useState(0);function f(E,ie=!1){ee(E),r(Z=>Z+1),M(ie)}m.useEffect(()=>{if(!t){f(B(s,void 0,a,w.current)),A(null),D(!1),N(s?"form":"preset-picker");return}s?(f(B(s)),y(s.enabled),N("form")):o?(f(B(void 0,o,a,w.current)),A(o),N("form")):(f(B(void 0,void 0,a,w.current)),N("preset-picker"))},[s,t,o,a]);const{pendingTemplate:F,externalTrigger:O,clear:se}=ft();m.useEffect(()=>{O&&F&&(f(B(void 0,F,a,w.current)),A(F),N("form"),se())},[O,F,se,a]);function Le(E){f(B(void 0,E,a,w.current)),A(E),N("form")}function Ie(E){const ie=(H??[]).filter(Z=>(Z.agentId??"")===E.agentId).map(Z=>Z.name);V(!0),f(ls(E,ie),!0)}function ze(){b&&J&&s&&c.mutate({id:s.id,enabled:!1}),n(!1)}function Te(){s&&l.mutate(s.id,{onSuccess:()=>{D(!1),n(!1)}})}function _e(E){s&&(y(E),c.mutate({id:s.id,enabled:E},{onError:()=>y(s.enabled)}))}const Be=d.isPending||c.isPending;return e.jsxs(xt,{open:t,onOpenChange:n,children:[e.jsxs(pt,{className:"flex max-h-[85vh] max-w-lg flex-col gap-0 p-0",children:[e.jsxs(gt,{className:"shrink-0 border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[S==="form"&&!I&&!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(jt,{className:"size-4"}),"Back"]}),e.jsx(vt,{children:I?"Edit schedule":"New schedule"}),I&&e.jsx(fe,{className:"ml-auto",checked:_,onCheckedChange:_e,disabled:c.isPending,"aria-label":_?"Disable schedule":"Enable schedule"})]}),e.jsx(yt,{className:"sr-only",children:I?"Edit an existing schedule":"Create a new schedule"})]}),S==="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(Me,{onSelect:Le,selectedId:T==null?void 0:T.id}),e.jsx("button",{type:"button",onClick:()=>{A(null),N("form")},className:"text-muted-foreground hover:text-foreground w-full text-center text-sm transition-colors",children:"Start from scratch"})]})}),S==="form"&&e.jsx(ds,{defaultValues:X,roster:x,editTask:I,onSubmitSuccess:ze,onCancel:()=>n(!1),onDeleteClick:()=>D(!0),isPending:Be,onMakeCopy:Ie,leading:b&&s?e.jsxs("div",{className:"flex items-start gap-2 rounded-md border px-3 py-2",children:[e.jsx(bt,{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 “",s.name,"” and your copy don’t both run."]})]})]}):void 0},te)]}),s&&e.jsx(Nt,{open:Y,onOpenChange:D,children:e.jsxs(wt,{children:[e.jsxs(Ct,{children:[e.jsxs(St,{children:["Delete “",s.name,"”?"]}),e.jsx(kt,{children:"Its run history is deleted too. This can’t be undone."})]}),e.jsxs(Rt,{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("button",{onClick:Te,disabled:l.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 dark:bg-destructive/60 inline-flex items-center rounded-md px-3 py-1.5 text-sm font-medium shadow-sm transition-colors",children:l.isPending?"Deleting…":"Delete task"})]})]})})]})}function Ns({onCreateWithPreset:t,onCreateBlank:n}){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(Me,{onSelect:t})}),e.jsx(Q,{variant:"ghost",className:"mt-4",onClick:n,children:"New custom schedule"})]})}export{bs as C,ys as F,Ns as T};
@@ -1 +1 @@
1
- import{aY as F,aW as w,aZ as U,a_ as D,a$ as L,b0 as $,r as l,j as e,b1 as p,b2 as f,b3 as j,b4 as g,b5 as k,x as E,b6 as N,b7 as _,b8 as B,b9 as G,ba as O,bb as P,bc as W,bd as X}from"./index-Cga0qx1T.js";import{u as V,f as Y}from"./format-cron-BrK8RzgT.js";import{S as Z}from"./scroll-area-B4WB7Q40.js";const q=5;function H({status:t}){switch(t){case"running":return e.jsx(E,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(W,{className:"text-status-success 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"blocked":return e.jsx(B,{className:"text-status-warning-dot size-3 shrink-0","aria-hidden":!0});default:return null}}function J(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 K({run:t,scheduleName:n}){return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(E,{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 Q({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(H,{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:J(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:N(t.finishedAt)})]})]})})}function se({available:t,agentId:n}){const a=F(),i=w(s=>s.setTasksAgentFilter),b=w(s=>s.setTasksEditScheduleId),u=t,{data:x=[]}=U(u),{data:I=0}=D(u),{data:R=[]}=L(void 0,u),{data:T=[]}=V(),{openWithTemplate:y}=$(),S=[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]),v=l.useMemo(()=>R.filter(s=>d.has(s.scheduleId)),[R,d]),{runningRuns:A,recentRuns:M}=l.useMemo(()=>{const s=[],r=[];for(const c of v)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,q)}},[v]),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."}),S.length>0&&e.jsx("div",{className:"space-y-2",children:S.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:Y(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(Z,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[A.length>0&&e.jsxs(p,{children:[e.jsxs(f,{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(K,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),C.length>0&&e.jsxs(p,{children:[e.jsx(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(j,{children:C.map(s=>e.jsx(Q,{schedule:s,onEdit:z},s.id))})]}),M.length>0&&e.jsxs(p,{children:[e.jsx(f,{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=X(),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{aY as F,aW as w,aZ as U,a_ as D,a$ as L,b0 as $,r as l,j as e,b1 as p,b2 as f,b3 as j,b4 as g,b5 as k,x as E,b6 as N,b7 as _,b8 as B,b9 as G,ba as O,bb as P,bc as W,bd as X}from"./index-C3cvP8Fo.js";import{u as V,f as Y}from"./format-cron-9K38-tn1.js";import{S as Z}from"./scroll-area-BvScZKSa.js";const q=5;function H({status:t}){switch(t){case"running":return e.jsx(E,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(W,{className:"text-status-success 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"blocked":return e.jsx(B,{className:"text-status-warning-dot size-3 shrink-0","aria-hidden":!0});default:return null}}function J(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 K({run:t,scheduleName:n}){return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(E,{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 Q({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(H,{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:J(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:N(t.finishedAt)})]})]})})}function se({available:t,agentId:n}){const a=F(),i=w(s=>s.setTasksAgentFilter),b=w(s=>s.setTasksEditScheduleId),u=t,{data:x=[]}=U(u),{data:I=0}=D(u),{data:R=[]}=L(void 0,u),{data:T=[]}=V(),{openWithTemplate:y}=$(),S=[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]),v=l.useMemo(()=>R.filter(s=>d.has(s.scheduleId)),[R,d]),{runningRuns:A,recentRuns:M}=l.useMemo(()=>{const s=[],r=[];for(const c of v)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,q)}},[v]),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."}),S.length>0&&e.jsx("div",{className:"space-y-2",children:S.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:Y(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(Z,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[A.length>0&&e.jsxs(p,{children:[e.jsxs(f,{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(K,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),C.length>0&&e.jsxs(p,{children:[e.jsx(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(j,{children:C.map(s=>e.jsx(Q,{schedule:s,onEdit:z},s.id))})]}),M.length>0&&e.jsxs(p,{children:[e.jsx(f,{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=X(),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{a1 as v,a3 as N,r as p,j as n,B as r,c5 as b,c6 as S,c7 as w,s as E}from"./index-Cga0qx1T.js";import{u as R,C as k,a as f}from"./ComputerViewer-rMcfbk2_.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{a1 as v,a3 as N,r as p,j as n,B as r,c5 as b,c6 as S,c7 as w,s as E}from"./index-C3cvP8Fo.js";import{u as R,C as k,a as f}from"./ComputerViewer-D8SxJdMm.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,2 @@
1
+ import{a1 as G,a2 as Le,a4 as ae,a3 as pe,e0 as $e,r as o,j as n,be as $,bf as K,B as f,gR as Ke,hS as Ue,f as fe,hT as xe,gz as J,b8 as Ve,e1 as D,I as W,dW as Be,dX as Ye,dY as qe,dZ as He,d_ as We,hr as de,c9 as Qe,ft as Ge,C as ne,G as ue,V as re,cO as je,cP as Ne,_ as Ze,cQ as ve,ca as _,e3 as Xe,hU as me,x as se,g3 as Je,g4 as en,g5 as nn,g6 as sn,g7 as ee,g9 as tn,$ as an,hV as rn,y as on,e as te,f9 as cn,b as ln}from"./index-C3cvP8Fo.js";import"./relay-trace-schemas-DF_DfZ7s.js";import{u as Se,M as be}from"./McpSigninBody-DKyUKrEE.js";import{R as dn}from"./rotate-cw-B4Y0q4GY.js";import"./form-Cru78aT-.js";function un(e,s){const t=G();return Le({queryKey:["mcp-config",e,s??null],queryFn:()=>t.getMcpConfig(e,{runtime:s??void 0}),enabled:!!e,staleTime:3e4})}function ye(e,s){e.invalidateQueries({queryKey:$e.mcpServers(s)}),e.invalidateQueries({queryKey:["mcp-config"]})}function Ce(e){const s=G(),t=pe();return ae({mutationFn:async({input:i,approval:r})=>r?(await s.grantApproval(r.approvalId),e(s,i,r.approvalToken)):e(s,i),onSuccess:(i,{input:r})=>{i.status==="ok"&&ye(t,r.agentId)}})}function mn(){return Ce((e,s,t)=>e.addAgentMcpServer(s,t?{approvalToken:t}:void 0))}function hn(){return Ce((e,s,t)=>e.importAgentMcpServer(s,t?{approvalToken:t}:void 0))}function ie(e){const s=G(),t=pe();return ae({mutationFn:({agentId:i,name:r})=>e(s,i,r),onSuccess:(i,{agentId:r})=>ye(t,r)})}function gn(){return ie((e,s,t)=>e.removeAgentMcpServer(s,t))}function pn(){return ie((e,s,t)=>e.enableAgentMcpServer(s,t))}function fn(){return ie((e,s,t)=>e.disableAgentMcpServer(s,t))}function xn(){const e=G();return ae({mutationFn:({agentId:s,name:t})=>e.testAgentMcpServer(s,t)})}function jn({agentId:e,serverName:s,onDone:t}){const i=Se(e,s),{start:r}=i,a=o.useRef(!1);return o.useEffect(()=>{a.current||(a.current=!0,r())},[r]),n.jsx($,{children:n.jsxs(K,{className:"space-y-2",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Sign in to ",s]}),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:s,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:t,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]})})}const Nn=["stdio","http","sse"],vn=/^[a-zA-Z0-9_-]+$/;function he(e){const s={};for(const t of e.split(`
2
+ `)){const i=t.trim();if(!i)continue;const r=i.indexOf("=");if(r===-1)continue;const a=i.slice(0,r).trim();a&&(s[a]=i.slice(r+1).trim())}return s}function ge(e){return e.trim().length?e.trim().split(/\s+/):[]}function Sn(e,s){if(e.status!=="ok")return!1;const t=e.servers.find(r=>r.name===s),i=t==null?void 0:t.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function bn({agentId:e,agentLabel:s,supportedTransports:t,onAdded:i,oauthDetectedFor:r=null}){const a=mn(),[l,g]=o.useState(!1),[m,S]=o.useState(""),[p,h]=o.useState(t[0]??"stdio"),c=t.includes(p)?p:t[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=Ke(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:ge(N),env:he(x)}:{transport:c,url:y.trim(),headers:he(R)},[c,b,N,x,y,R]),Y=o.useCallback(()=>({agentId:e,name:m.trim(),connection:ce()}),[e,m,ce]),X=o.useCallback(()=>{g(!1),P(null),I(null),S(""),h(t[0]??"stdio"),C(""),k(""),z(""),M(""),A("")},[t]),le=o.useCallback(d=>{i({name:d.name,transport:d.connection.transport}),X()},[i,X]),q=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=Y();try{const v=await a.mutateAsync({input:d});v.status==="approval_required"?P(v.approval):q(v,d)}catch(v){U(v)}},[a,Y,q,U]),Ie=o.useCallback(async()=>{if(!O)return;I(null);const d=Y();try{const v=await a.mutateAsync({input:d,approval:O});v.status==="ok"?q(v,d):(V(!1),I("The server still needs approval. Try again."))}catch(v){U(v)}},[a,Y,O,q,U]),H=B??(r&&r!==j?r:null),Fe=o.useCallback(()=>{T(H),u(null)},[H]),De=o.useMemo(()=>[b.trim(),...ge(N)].filter(Boolean).join(" "),[b,N]);return H?n.jsx(jn,{agentId:e,serverName:H,onDone:Fe}):l?O?n.jsx($,{children:n.jsxs(K,{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 ",s,"?"]}),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($,{children:n.jsxs(K,{className:"space-y-3",children:[Z&&n.jsx(J,{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=>h(d),children:[n.jsx(Ye,{id:"mcp-transport",className:"w-full",children:n.jsx(qe,{})}),n.jsx(He,{children:t.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(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:X,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:()=>g(!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 s=e.toLowerCase();return Cn.some(t=>s.includes(t))?"setup-problem":"cant-reach"}function we(e){return e.transport==="stdio"||e.authKind==="oauth2"?!1:Object.keys(e.headers).some(s=>s.toLowerCase()==="authorization")}function wn(e){const{connection:s,authStatus:t}=e;return s.transport!=="stdio"&&s.authKind==="oauth2"?!0:t!==void 0}function ke(e){const{enabled:s,testedOk:t,signedInNow:i,runtimeStatus:r,runtimeError:a,authStatus:l,ownKey:g}=e;return s?t?"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":g?"uses-your-key":"not-checked":"off"}function kn(e){const{statusKey:s,testResult:t,signedInNow:i}=e;return s==="off"||i?!1:(t==null?void 0:t.needsAuth)===!0?!0:s==="needs-sign-in"}function An(e){const{stamped:s,signedInNow:t,authStatus:i,rosterUpdatedAt:r}=e;if(!s)return;const{result:a}=s;if(!(t&&a.needsAuth===!0)&&!(s.at<=r&&(i==="needs-auth"&&a.ok||i==="connected"&&a.needsAuth===!0)))return a}function Tn(e){const{status:s,probe:t}=e;return s==="off"||!t||t.ok?s:t.needsAuth===!0?"needs-sign-in":oe(t.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:s,live:t,discovered:i}=e;return[...s.map(a=>{var l,g;return{name:a.name,band:Mn(ke({enabled:a.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(l=t.get(a.name))==null?void 0:l.status,runtimeError:(g=t.get(a.name))==null?void 0:g.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:s,present:t}=e,i=new Set(t),r=new Set(s);return{ordered:s.filter(a=>i.has(a)),added:t.filter(a=>!r.has(a))}}function zn(){const e=Ge(null);return({bothSettled:s,managed:t,live:i,discovered:r,present:a})=>{e.read()===null&&s&&a.length>0&&e.write(On({managed:t,live:i,discovered:r}));const{ordered:l,added:g}=En({frozen:e.read()??[],present:a});return g.length>0&&e.read()!==null&&e.write([...l,...g]),[...l,...g]}}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:s}){const t=s?"Signed in just now. ":"";return e===null?`${t||"This server answered. "}Its tools are available.`:`${t}${e} tool${e===1?"":"s"} available.`}function Fn(e,s){switch(e){case"needs-sign-in":return`Sign in to ${s.displayName} to use its tools.`;case"signing-in":return null;case"connected":return In(s);case"signed-in":return s.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:s,authStatus:t,clientOrigin:i}=e;return s.transport==="stdio"?"None. This server doesn’t need one.":s.authKind==="oauth2"?i==="manual"?`Your own app credentials, ${t==="connected"?"signed in, renews automatically":"not signed in yet"}. DorkOS holds the key, not the agent.`:t==="connected"?"Signed in, and it renews automatically. DorkOS holds the key, not the agent.":"DorkOS will hold the key, not the agent.":Object.keys(s.headers).some(a=>a.toLowerCase()==="authorization")?"Access key: you added a key when setting this up.":t===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 s=Ln(e.url);return s?`${s} (web service)`:`${e.url} (web service)`}function Ln(e){try{return new URL(e).host}catch{return null}}const $n={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"},Kn={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 s of Un){const t=e.match(s.pattern);if(!t)continue;const{displayName:i,pluginName:r}=s.read(t);if(!(!i||!r))return{displayName:i,pluginName:r,rawName:e}}return{displayName:e,pluginName:null,rawName:e}}function Vn(e,s){return s.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,s){return e==="plugin"&&s?`Comes with the ${s} plugin`:$n[e]}function Yn(e,s){return e===null?Bn:e==="plugin"&&s?`Comes with the ${s} plugin. Add it to manage it here.`:Kn[e]}const qn=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 s=Ae[e];return n.jsxs(je,{children:[n.jsx(Ne,{asChild:!0,children:n.jsx("span",{className:Wn({chip:Qn[e]}),children:s.label})}),n.jsx(ve,{children:s.tooltip})]})}function Zn({scope:e,pluginName:s}){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,s)})]})}function Oe({displayName:e,rawName:s,scope:t,pluginName:i,status:r,sentence:a,managed:l,toggle:g,actions:m,children:S,details:p,defaultDetailsOpen:h=!1}){const[c,b]=o.useState(h),C=o.useId(),N=Ae[r].tone;return n.jsxs("div",{"data-mcp-server":s,className:ue(qn({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}),t&&n.jsx(Zn,{scope:t,pluginName:i}),n.jsx(Gn,{status:r}),g]}),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 Xn=3,L="text-muted-foreground/70";function Jn({tools:e}){const[s,t]=o.useState(!1),i=s?e:e.slice(0,Xn),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:()=>t(!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 es(e){const{scope:s,pluginName:t,connection:i}=e;return s==="plugin"&&t?`Comes with the ${t} plugin`:i?_n(i):s?Me(s,t):null}function Ee({connection:e,authStatus:s,authClientOrigin:t,scope:i,pluginName:r,rawName:a,displayName:l,toolCount:g,tools:m,serverInfo:S,alsoUsedBy:p,error:h}){const c=es({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(Xe,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),Dn({connection:e,authStatus:s,clientOrigin:t})]})}),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 g=="number"&&n.jsx(_,{label:"Tools",align:"start",labelClassName:L,children:g}),m&&m.length>0&&n.jsx(Jn,{tools:m}),h&&n.jsx(_,{label:"Error",align:"start",wrap:!0,labelClassName:L,children:n.jsx("code",{className:"text-2xs font-mono break-all",children:h})})]})}function ns({flow:e,serverName:s}){return n.jsxs(n.Fragment,{children:[n.jsx(be,{flow:e,serverName:s,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 ${s}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function ss({server:e,agentId:s,live:t,testResult:i,rosterUpdatedAt:r,testing:a,busy:l,onToggle:g,onTest:m,onRemove:S}){const p=Se(s,e.name),h=p.state.step==="connected",c=An({stamped:i,signedInNow:h,authStatus:e.authStatus,rosterUpdatedAt:r}),b=we(e.connection),C=ke({enabled:e.enabled,testedOk:(c==null?void 0:c.ok)===!0,signedInNow:h,runtimeStatus:t==null?void 0:t.status,runtimeError:t==null?void 0:t.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:h})&&(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:h}),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=>g(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(se,{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(se,{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(sn,{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(tn,{}),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:t==null?void 0:t.error}),children:n.jsx(ns,{flow:p,serverName:y.displayName})})}function ts(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 as(e){const{displayName:s,scope:t,pluginName:i}=e,r=rs(t,i);return`${s} ${r}. Manage it here to enable, disable, or sign in from DorkOS.`}function rs(e,s){return e==="plugin"&&s?`comes with the ${s} plugin`:e==="project"?"comes from this project’s own config":e==="computer"?"comes from your computer-wide config":"is loaded from outside DorkOS"}function is({entry:e,agentId:s,agentLabel:t,canImport:i}){const r=hn(),[a,l]=o.useState(null),[g,m]=o.useState(null),S=o.useCallback(async()=>{m(null);try{const x=await r.mutateAsync({input:{agentId:s,name:e.name}});x.status==="approval_required"&&l(x.approval)}catch(x){m(x instanceof Error?x.message:"Couldn’t add the server.")}},[r,s,e.name]),p=o.useCallback(async()=>{if(a){m(null);try{(await r.mutateAsync({input:{agentId:s,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,s,e.name,a]),h=Te(e.name),c=Vn(e,h),b=c!==null,C=h.rawName!==h.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 “",h.displayName,"” to ",t,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:as({displayName:h.displayName,scope:c,pluginName:h.pluginName})})]})]}),g&&n.jsx("p",{className:"text-destructive text-xs",children:g}),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:h.displayName,rawName:e.name,scope:c,pluginName:h.pluginName,status:ts(e),sentence:Yn(c,h.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(se,{size:"xs"}):n.jsx(fe,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),g&&n.jsx("p",{className:"text-destructive text-xs",children:g})]}):void 0,details:k?n.jsx(Ee,{scope:c,pluginName:h.pluginName,rawName:h.rawName,displayName:h.displayName,error:e.error}):void 0})}const os={codex:["stdio","http"],opencode:["stdio","http"]};function cs(e){return os[e]??Nn}function ls(){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 ds({agent:e,projectPath:s}){var B;const t=rn(e.id),i=un(s,e.runtime),r=i.data,a=on(e.runtime),l=(a==null?void 0:a.supportsManagedMcpServers)??!0,g=pn(),m=fn(),S=gn(),p=xn(),[h,c]=o.useState({}),[b,C]=o.useState(null),[N,k]=o.useState(null),x=zn(),z=o.useCallback((u,j)=>{(j?g:m).mutate({agentId:e.id,name:u})},[e.id,g,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=t.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=g.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:!t.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(ss,{server:E,agentId:e.id,live:P.get(E.name),testResult:h[E.name],rosterUpdatedAt:t.dataUpdatedAt,testing:b===E.name,busy:I,onToggle:z,onTest:M,onRemove:y},E.name)}const T=w[j.index];return n.jsx(is,{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:cs(e.runtime),onAdded:R,oauthDetectedFor:N&&((B=h[N])==null?void 0:B.result.needsAuth)===!0?N:null})]}),n.jsx(ls,{}),!l&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"This agent can’t use added servers yet. View only."}),t.isLoading?n.jsx($,{children:n.jsxs(K,{className:"space-y-2",children:[n.jsx(te,{className:"h-5 w-full"}),n.jsx(te,{className:"h-5 w-3/4"})]})}):t.isError?n.jsx($,{children:n.jsxs(K,{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:()=>t.refetch(),className:"focus-visible:ring-2",children:"Try again"})]})}):V.length===0?n.jsx($,{children:n.jsx(K,{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($,{children:n.jsx(K,{children:V.map(U)})})]})}function fs({member:e}){const{agent:s,projectPath:t,isPending:i}=ln(e);return i?n.jsx(te,{className:"h-32 w-full"}):!s||t===null?n.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s MCP servers."}):n.jsx(ds,{agent:s,projectPath:t})}export{fs as ToolsPage};