dorkos 0.128.0 → 0.129.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/dist/bin/cli.js +84 -16
  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-CmQERFxo.js → AboutPage-CML_SdU1.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-Dw231W2w.js → ActivityErrorState-TuQRJopr.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-DVfeyA9u.js → ActivityPage-CmSxeVSK.js} +1 -1
  7. package/dist/client/assets/ActivityRow-DJhDehIR.js +1 -0
  8. package/dist/client/assets/{AdapterIcon-NqCDzgCI.js → AdapterIcon-CeRDpZGz.js} +1 -1
  9. package/dist/client/assets/AdapterSetupWizard-B6KkTuJo.js +2 -0
  10. package/dist/client/assets/{AgentOptionRow-BRJfZo2y.js → AgentOptionRow-388OJkPc.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-B7upjYRk.js → AgentPicker-C51wqToQ.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-DXJnLk6q.js → AgentRequestCard-Bz31ewIs.js} +4 -4
  13. package/dist/client/assets/AppearancePage-DSVeowGb.js +1 -0
  14. package/dist/client/assets/{ApplyToOverridesDialog-C_QQhNIf.js → ApplyToOverridesDialog-DRtcLrVY.js} +1 -1
  15. package/dist/client/assets/AttentionSignalRow-CqKZyoxB.js +1 -0
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-G7vrCqeA.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-DA1jhqFy.js} +3 -3
  17. package/dist/client/assets/BindingDialog-D25PAed0.js +1 -0
  18. package/dist/client/assets/{BlintzCanvas-DruVZcDU.js → BlintzCanvas-BgIQdpTx.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-CtLpZnTs.js → CanvasCsvContent-ZWHWmb88.js} +4 -4
  20. package/dist/client/assets/CanvasFileContent-DR5pUgca.js +2 -0
  21. package/dist/client/assets/CanvasModel3dContent-OP1ZOMui.js +2 -0
  22. package/dist/client/assets/ChannelComposer-BJ0nNzQb.js +45 -0
  23. package/dist/client/assets/{ChatAppsOff-CCZUzDIH.js → ChatAppsOff-ByitL4Xt.js} +2 -2
  24. package/dist/client/assets/{CodeMirrorDiff-BCpYdhgZ.js → CodeMirrorDiff-JsV_vWBa.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-BeCubxHV.js → CodeMirrorEditor-BfCJG9hQ.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-BZtfTnwg.js → CommitmentList-yFV3_m00.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-DmurDgxV.js → CommitmentsPage-DeERVg-2.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-Bik6GLKp.js → ComputerResourceView-CYMMSE8Y.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-CksBDqdu.js → ComputerViewer-H7kJSIj7.js} +1 -1
  30. package/dist/client/assets/ConnectionAccessLists-SRkf7-Y6.js +1 -0
  31. package/dist/client/assets/{ConnectionsPage-Cgg36gDY.js → ConnectionsPage-D6e3hd4L.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-CNhpF6Z1.js → ConventionPage-CpvRMcSG.js} +2 -2
  33. package/dist/client/assets/{ExtensionPageRoute-C2zue_Pw.js → ExtensionPageRoute-CiFv6we8.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-3v1TfY1P.js → FloatingTanStackRouterDevtools-CqogiFob-D-8CeYC7.js} +1 -1
  35. package/dist/client/assets/{ForwardConsentHost-Mbo0D-zk.js → ForwardConsentHost-ml3b_fsX.js} +1 -1
  36. package/dist/client/assets/HandlePage-Bq5qdCfY.js +1 -0
  37. package/dist/client/assets/HeartbeatPage-C0zSvWH4.js +1 -0
  38. package/dist/client/assets/{KeyEntry-C43vkwpA.js → KeyEntry-Dq6eKAbX.js} +1 -1
  39. package/dist/client/assets/{LexicalField-iAHcvRmI.js → LexicalField-CYOqOLpV.js} +1 -1
  40. package/dist/client/assets/{ManagesPage-BUIJvLmv.js → ManagesPage-DZTMD3Al.js} +1 -1
  41. package/dist/client/assets/Marketplace-buSfuVrY.js +36 -0
  42. package/dist/client/assets/{MarketplaceSourcesView-BZODwhxu.js → MarketplaceSourcesView-BxwvBWgh.js} +1 -1
  43. package/dist/client/assets/{McpAppFrame-D15nxVaI.js → McpAppFrame-CWiRFp8o.js} +2 -2
  44. package/dist/client/assets/{McpSigninBody-DmBxqgxN.js → McpSigninBody-BpYSAV1h.js} +1 -1
  45. package/dist/client/assets/{Model3dViewer-RGXeJd6a.js → Model3dViewer-B2KTvx6d.js} +1 -1
  46. package/dist/client/assets/NamePage-_yT2RQvT.js +1 -0
  47. package/dist/client/assets/{NewDirectMessageMenu-DBAdvv5p.js → NewDirectMessageMenu-CMp4ppiH.js} +1 -1
  48. package/dist/client/assets/{NotificationsPage-NRfyiinS.js → NotificationsPage-CWXIghVM.js} +1 -1
  49. package/dist/client/assets/{OpenMeshSwitch-CgQ6uefo.js → OpenMeshSwitch-C9hiAEHP.js} +2 -2
  50. package/dist/client/assets/OperatorIdentityForm-CjmMoP6n.js +1 -0
  51. package/dist/client/assets/{PermissionHistory-DPEPq8D9.js → PermissionHistory-D_Imuq02.js} +1 -1
  52. package/dist/client/assets/{PermissionsPage--k-xutbJ.js → PermissionsPage-QMLV8PfB.js} +1 -1
  53. package/dist/client/assets/{PersonalityPopover-DMMptmPS.js → PersonalityPopover-BL9DLK0Q.js} +1 -1
  54. package/dist/client/assets/PhotoPage-Djh4IZBF.js +1 -0
  55. package/dist/client/assets/PreviewRefusedNotice-Dt2hV0aJ.js +1 -0
  56. package/dist/client/assets/{ProfileFields-DbPJ7fvN.js → ProfileFields-DD6X85w2.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-CzwhrIlw.js → ProfilePanelContainer-DuFEpNJ3.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-CZEXvlJm.js → ProfileRolePicker-CT9eJ1J0.js} +1 -1
  59. package/dist/client/assets/PromptSuggestionChips-C8V611-5.js +1 -0
  60. package/dist/client/assets/{ReportsToPopover-YOwGLJy5.js → ReportsToPopover-Bs55bP7b.js} +1 -1
  61. package/dist/client/assets/RoomSurface-DXZ36tmU.js +1 -0
  62. package/dist/client/assets/{RoomsPage-CoXjZMWL.js → RoomsPage-CDiSwt-I.js} +1 -1
  63. package/dist/client/assets/RunsOnPopover-CFBDa9DO.js +1 -0
  64. package/dist/client/assets/RuntimeConnectFlow-DsawxJN7.js +1 -0
  65. package/dist/client/assets/RuntimeSetupDialog-bdf844gx.js +1 -0
  66. package/dist/client/assets/{SeenDevices-Bh2yh-PW.js → SeenDevices-Cix5nnGQ.js} +2 -2
  67. package/dist/client/assets/{SessionsPage-CFvkbT9X.js → SessionsPage-CCu8rM-J.js} +1 -1
  68. package/dist/client/assets/SettingsDialog-D7sVluoe.js +12 -0
  69. package/dist/client/assets/SkillsPage-SSq7ofgp.js +1 -0
  70. package/dist/client/assets/TaskDialogWrapper-CBIuIbmj.js +1 -0
  71. package/dist/client/assets/TasksEmptyState-C0K_NOA3.js +3 -0
  72. package/dist/client/assets/{TasksPage-D0Zi6Mve.js → TasksPage-BpSn7GmR.js} +1 -1
  73. package/dist/client/assets/{TeamComputerEntry-CY9eLVad.js → TeamComputerEntry-BAi9omUC.js} +1 -1
  74. package/dist/client/assets/{ToolsPage-0_vx5P-F.js → ToolsPage-nkGWy6MR.js} +2 -2
  75. package/dist/client/assets/{TopologyGraph-DUZLZZrB.js → TopologyGraph-D6SSv0kC.js} +14 -14
  76. package/dist/client/assets/TourHost-CrZciWIf.js +1 -0
  77. package/dist/client/assets/{UnlinkDialog-ptZy3IN4.js → UnlinkDialog-B9zw8r6F.js} +1 -1
  78. package/dist/client/assets/{UnreadDivider-Ckey1IWn.js → UnreadDivider-BnJ06LmP.js} +1 -1
  79. package/dist/client/assets/WidgetErrorCard-CQKYI7oK.js +108 -0
  80. package/dist/client/assets/{WithheldExtensionsNotice-7Vu1Jctn.js → WithheldExtensionsNotice-VMM5NjL5.js} +1 -1
  81. package/dist/client/assets/WorkView-D5d8DDxS.js +51 -0
  82. package/dist/client/assets/_shell-CTKp94uQ.js +80 -0
  83. package/dist/client/assets/{_shell._home-BRIXhYLg.js → _shell._home-CcfELPIk.js} +1 -1
  84. package/dist/client/assets/_shell._home.activity-CGKsuLq8.js +1 -0
  85. package/dist/client/assets/_shell._home.index-DrJRgJCb.js +3 -0
  86. package/dist/client/assets/_shell._home.tasks-B_lv_-fX.js +1 -0
  87. package/dist/client/assets/_shell._home.workspaces-CjBJymCW.js +1 -0
  88. package/dist/client/assets/{_shell.channels-Bx6q9xVH.js → _shell.channels-CzQFR6pU.js} +4 -4
  89. package/dist/client/assets/_shell.connections-B5hafeep.js +1 -0
  90. package/dist/client/assets/{_shell.feedback-requests-DFznTGbN.js → _shell.feedback-requests-DtD2bH-4.js} +2 -2
  91. package/dist/client/assets/_shell.marketplace-DUpaCb0r.js +1 -0
  92. package/dist/client/assets/_shell.marketplace_.sources-C3pA7zZW.js +1 -0
  93. package/dist/client/assets/_shell.session-DH_9f3AK.js +1 -0
  94. package/dist/client/assets/{_shell.team-DmA09abY.js → _shell.team-BrGo-IxK.js} +6 -6
  95. package/dist/client/assets/_shell.threads-Ceq_tmNk.js +1 -0
  96. package/dist/client/assets/_shell.x._extensionId-DaXLhYNr.js +1 -0
  97. package/dist/client/assets/_shell.x._extensionId_._-DaXLhYNr.js +1 -0
  98. package/dist/client/assets/{abnfDiagram-WEYOIA3C-DxgtVd9I.js → abnfDiagram-WEYOIA3C-BN5bqwbu.js} +1 -1
  99. package/dist/client/assets/{access-copy-Dqct36mi.js → access-copy-BAhTOOsG.js} +1 -1
  100. package/dist/client/assets/{arc-C-67Ef0p.js → arc-BfTE_VoF.js} +1 -1
  101. package/dist/client/assets/{architectureDiagram-ZHVYKT53-B7TjdT-_.js → architectureDiagram-ZHVYKT53-Dc6keeDz.js} +1 -1
  102. package/dist/client/assets/{banner-C9qTs6-C.js → banner-DOgGDCJ5.js} +2 -2
  103. package/dist/client/assets/{blockDiagram-RJAE7QA3-DNqxJ3Ww.js → blockDiagram-RJAE7QA3-B4c6U-ob.js} +1 -1
  104. package/dist/client/assets/{c4Diagram-XDPPPE54-D3jNLV0j.js → c4Diagram-XDPPPE54-CCtD8QC8.js} +1 -1
  105. package/dist/client/assets/channel-CF9_Q7CV.js +1 -0
  106. package/dist/client/assets/{chunk-2E7WHVMD-C6OKx0ty.js → chunk-2E7WHVMD-DcDNqIJG.js} +1 -1
  107. package/dist/client/assets/{chunk-2Q5K7J3B-Dr_6hHrZ.js → chunk-2Q5K7J3B-DOVVK0B8.js} +1 -1
  108. package/dist/client/assets/{chunk-4EMNKR2T-CSrZVDEt.js → chunk-4EMNKR2T-Cg-Do982.js} +1 -1
  109. package/dist/client/assets/{chunk-55XCU76K-CIazeRXO.js → chunk-55XCU76K-CDmULSeY.js} +1 -1
  110. package/dist/client/assets/{chunk-5VM5RSS4-C8IJ3zTR.js → chunk-5VM5RSS4-Bi0yIWW1.js} +1 -1
  111. package/dist/client/assets/{chunk-JWPE2WC7-D9DGXb79.js → chunk-JWPE2WC7-ZHaJh6CV.js} +1 -1
  112. package/dist/client/assets/{chunk-VQ5W62QI-B0LNYdif.js → chunk-VQ5W62QI-DZi6GyW_.js} +1 -1
  113. package/dist/client/assets/{chunk-XXDRQBXY-C7IAIbvZ.js → chunk-XXDRQBXY-D18oZOrd.js} +1 -1
  114. package/dist/client/assets/{chunk-ZCHMQSOR-C79hvjlu.js → chunk-ZCHMQSOR-BkZ0l0fE.js} +2 -2
  115. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-0Di1C2ZB.js → classDiagram-v2-4MYWR3UA-BfmK1buF.js} +1 -1
  116. package/dist/client/assets/{command-BVQb6I3_.js → command-CZqA020F.js} +1 -1
  117. package/dist/client/assets/copy-button-ByA00JGh.js +1 -0
  118. package/dist/client/assets/{cose-bilkent-JH36ORCC-rZumaV4b.js → cose-bilkent-JH36ORCC-B1NTVSbk.js} +1 -1
  119. package/dist/client/assets/{cpu-DeRuDMl4.js → cpu-DNvpMmNN.js} +1 -1
  120. package/dist/client/assets/{cynefin-EF2NZ3EQ-CI9l9xhM.js → cynefin-EF2NZ3EQ-CB_HMIZ8.js} +1 -1
  121. package/dist/client/assets/{cynefinDiagram-WF24UDRP-C8CdorJJ.js → cynefinDiagram-WF24UDRP-MmIWYdc2.js} +1 -1
  122. package/dist/client/assets/{dagre-NK4GIZVX-AHpsTq1O.js → dagre-NK4GIZVX-BQay0k4e.js} +1 -1
  123. package/dist/client/assets/detail-row-290qyusq.js +1 -0
  124. package/dist/client/assets/{diagram-CBK3MWTC-BpPLL30n.js → diagram-CBK3MWTC-C1lRH4cb.js} +1 -1
  125. package/dist/client/assets/{diagram-I5XIIV2D-D6loMn3G.js → diagram-I5XIIV2D-CnANa27A.js} +1 -1
  126. package/dist/client/assets/{diagram-ODIL2UCW-BaGNd5eN.js → diagram-ODIL2UCW-Cwt7hxes.js} +1 -1
  127. package/dist/client/assets/{diagram-PFBEJUXE-BnDdKu_g.js → diagram-PFBEJUXE-DZtAER77.js} +1 -1
  128. package/dist/client/assets/{diagram-RJA3I4VV-UXagB0_c.js → diagram-RJA3I4VV-CbVXbiGs.js} +1 -1
  129. package/dist/client/assets/{diagram-TYUNFSNR-C-whBP-S.js → diagram-TYUNFSNR-D-AcGdsL.js} +1 -1
  130. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-BbG481iS.js → ebnfDiagram-V4P3TTPT-DLkrFSAy.js} +1 -1
  131. package/dist/client/assets/{elk-QONTBCTQ-FtssIxOc.js → elk-QONTBCTQ-DQM6Glxa.js} +1 -1
  132. package/dist/client/assets/{empty-state-CACt-76q.js → empty-state-BnuM8oop.js} +1 -1
  133. package/dist/client/assets/{erDiagram-KYQIGQAA-PpFgUf4C.js → erDiagram-KYQIGQAA-C1qgB1Mn.js} +1 -1
  134. package/dist/client/assets/{execution-config-CGL73sRn.js → execution-config-BjLHHc9x.js} +1 -1
  135. package/dist/client/assets/{file-D80JE_L0.js → file-D7_QdH_S.js} +1 -1
  136. package/dist/client/assets/{file-exclamation-point-CcJ_e4_m.js → file-exclamation-point-Cdt8YqyQ.js} +1 -1
  137. package/dist/client/assets/{file-text-Ds9edaTZ.js → file-text-CB9l6Ur-.js} +1 -1
  138. package/dist/client/assets/{find-latest-widget-fence-BtqFMP_f.js → find-latest-widget-fence-SQB9WgjN.js} +5 -5
  139. package/dist/client/assets/{flowDiagram-IUGLLWBU-BIva66g9.js → flowDiagram-IUGLLWBU-DH-ePeFu.js} +1 -1
  140. package/dist/client/assets/form--HjBAzX8.js +1 -0
  141. package/dist/client/assets/{format-cron-BpGrgPLu.js → format-cron-svkfKW5b.js} +1 -1
  142. package/dist/client/assets/format-tokens-DymkROvy.js +1 -0
  143. package/dist/client/assets/{ganttDiagram-R7GPNTJY-CZqips_4.js → ganttDiagram-R7GPNTJY-fjb_iAW1.js} +1 -1
  144. package/dist/client/assets/{git-branch-B8JNwQ6q.js → git-branch-CPOwiT8a.js} +1 -1
  145. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DoIc3lda.js → gitGraphDiagram-PDYL7XHY-CcCqH5T3.js} +1 -1
  146. package/dist/client/assets/{graph-yizM0vwL.js → graph-DS3J2jnN.js} +1 -1
  147. package/dist/client/assets/{heart-BavUIV45.js → heart-C6uRnXx3.js} +1 -1
  148. package/dist/client/assets/{highlighted-body-KPVGNVTW-CGr3AgaU.js → highlighted-body-KPVGNVTW-CNygKq0i.js} +1 -1
  149. package/dist/client/assets/image-lightbox-BQV3i0WJ.js +1 -0
  150. package/dist/client/assets/{image-off-C1uTDs9-.js → image-off-B88WBkcV.js} +1 -1
  151. package/dist/client/assets/{index-SOKlO1zZ.js → index-3CJSEcZE.js} +1 -1
  152. package/dist/client/assets/index-3JL8A9YZ.css +1 -0
  153. package/dist/client/assets/{index-BJEt9R_G.js → index-57qzL_5b.js} +1 -1
  154. package/dist/client/assets/index-5RD9flqf.js +1 -0
  155. package/dist/client/assets/{index-FhWMRBQP.js → index-B6pmysqs.js} +1 -1
  156. package/dist/client/assets/{index-DEiSJbvu.js → index-BIZNH5u1.js} +1 -1
  157. package/dist/client/assets/{index-BOhSPP-6.js → index-BKdXHSbr.js} +1 -1
  158. package/dist/client/assets/{index-B36osK_S.js → index-BN3zOTbR.js} +3 -3
  159. package/dist/client/assets/{index-DYEmUa5t.js → index-BNq_mnok.js} +1 -1
  160. package/dist/client/assets/index-BPp-rj-W.js +1 -0
  161. package/dist/client/assets/{index-DW4KUPHp.js → index-BTqJGL1_.js} +1 -1
  162. package/dist/client/assets/{index-CJXMgnYp.js → index-B_YZ5cyn.js} +1 -1
  163. package/dist/client/assets/{index-Dcd4NqFB.js → index-B_rc9Pb1.js} +1 -1
  164. package/dist/client/assets/{index-56EOd-zy.js → index-B_v2l2ND.js} +1 -1
  165. package/dist/client/assets/{index-QSXJR98z.js → index-Bktc0aFV.js} +1 -1
  166. package/dist/client/assets/index-BtTqA4_d.js +1 -0
  167. package/dist/client/assets/{index-CiGYtR9O.js → index-BxsALYNM.js} +1 -1
  168. package/dist/client/assets/index-C4Uak2ha.js +1 -0
  169. package/dist/client/assets/{index-FI_y_dND.js → index-C7I0BjyX.js} +1 -1
  170. package/dist/client/assets/{index-CoNMlH37.js → index-CEicS7Zi.js} +1 -1
  171. package/dist/client/assets/{index-1QfQImuJ.js → index-CLTrC-a-.js} +3 -3
  172. package/dist/client/assets/{index-CXBYgGja.js → index-CLVvKY2v.js} +1 -1
  173. package/dist/client/assets/{index-BKWJiERs.js → index-COXdXByr.js} +1 -1
  174. package/dist/client/assets/{index-CoKNU2F9.js → index-CTJA-mZu.js} +1 -1
  175. package/dist/client/assets/{index-BOEPL6hN.js → index-CZmU-67J.js} +1 -1
  176. package/dist/client/assets/{index-LwL5BpE4.js → index-Cbbw2ByB.js} +1 -1
  177. package/dist/client/assets/{index-C4t0UTU-.js → index-Cbk19RQp.js} +1 -1
  178. package/dist/client/assets/{index-DqkFtcGQ.js → index-D0QV18E0.js} +1 -1
  179. package/dist/client/assets/{index-7XeZCCDI.js → index-D5fV4hrl.js} +1 -1
  180. package/dist/client/assets/{index-CeDn1Ak1.js → index-DBAPfYwE.js} +1 -1
  181. package/dist/client/assets/{index-Cdod8zEY.js → index-DK8zHloW.js} +1 -1
  182. package/dist/client/assets/index-DO8NbOqk.js +1 -0
  183. package/dist/client/assets/{index-C8ZpJXTQ.js → index-DXZ-w0Z9.js} +1 -1
  184. package/dist/client/assets/{index-n_pnc-CO.js → index-DYQjub9g.js} +1 -1
  185. package/dist/client/assets/index-Daoy3TZ8.js +1 -0
  186. package/dist/client/assets/{index-tgbcsB6H.js → index-DdBvjuc4.js} +1 -1
  187. package/dist/client/assets/{index-X282DRZf.js → index-DhqeMM58.js} +2 -2
  188. package/dist/client/assets/{index-YSHcMqHa.js → index-Ds9wPt9M.js} +1 -1
  189. package/dist/client/assets/{index-Br6xDNvu.js → index-RQhQx8gq.js} +1 -1
  190. package/dist/client/assets/{index-CrTmY12y.js → index-UJpgX--l.js} +2 -2
  191. package/dist/client/assets/index-YUtEyz7O.js +1053 -0
  192. package/dist/client/assets/{index-BkJlIXqM.js → index-oc-yQ5Q4.js} +1 -1
  193. package/dist/client/assets/index-tRdq7FGO.js +1 -0
  194. package/dist/client/assets/{index-ZR5f82z2.js → index-um-0KSur.js} +1 -1
  195. package/dist/client/assets/{index.esm-CAeUe7uQ.js → index.esm-B10OaB6F.js} +1 -1
  196. package/dist/client/assets/{infoDiagram-MVDRKAX5-DweUdYSy.js → infoDiagram-MVDRKAX5-CGtvYWtj.js} +1 -1
  197. package/dist/client/assets/{inline-code-SYHTKcle.js → inline-code-BL-6EKVP.js} +1 -1
  198. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DKNQIv7P.js → ishikawaDiagram-HPEHV2GE-ICsVVT2t.js} +1 -1
  199. package/dist/client/assets/{journeyDiagram-BOSHW7O7-DPD7F4VO.js → journeyDiagram-BOSHW7O7-DEmSX2Hn.js} +1 -1
  200. package/dist/client/assets/{kanban-definition-FNSA4HC5-B_uPSwxC.js → kanban-definition-FNSA4HC5-SAV5PQOr.js} +1 -1
  201. package/dist/client/assets/{layers-F4mvrI2l.js → layers-Bfdpn7ZM.js} +1 -1
  202. package/dist/client/assets/{lightbulb-a6nNsrzy.js → lightbulb-CSPTiZoi.js} +1 -1
  203. package/dist/client/assets/{link-2-yI2Tlm7Q.js → link-2-ZzmN9B9k.js} +1 -1
  204. package/dist/client/assets/{list-runtime-types-CsGil5te.js → list-runtime-types-7qV7HQ7K.js} +1 -1
  205. package/dist/client/assets/{markdown-content-Cjhsscbn.js → markdown-content-CiDXslQf.js} +1 -1
  206. package/dist/client/assets/mention-pill-CuSUdpn7.js +1 -0
  207. package/dist/client/assets/{mermaid.core-9PwG-9fN.js → mermaid.core-C-qvGQ5g.js} +4 -4
  208. package/dist/client/assets/{message-square-off-aV4NMCjd.js → message-square-off-BehEHG9c.js} +1 -1
  209. package/dist/client/assets/{mindmap-definition-6OY57UG3-BRbWmQkj.js → mindmap-definition-6OY57UG3-DzU2APoo.js} +1 -1
  210. package/dist/client/assets/{more-details-CRLU2HN4.js → more-details-DF2dJXMV.js} +1 -1
  211. package/dist/client/assets/{owner-notice-CTJbhUak.js → owner-notice-DoH-_Veh.js} +1 -1
  212. package/dist/client/assets/{package-sPggO7Dr.js → package-Fm_v1gMn.js} +1 -1
  213. package/dist/client/assets/{page-container-CnfDuiDC.js → page-container-Bcz5wJVR.js} +1 -1
  214. package/dist/client/assets/{pane-resize-handle-63OC5vfI.js → pane-resize-handle-_EuIpxzc.js} +1 -1
  215. package/dist/client/assets/{paperclip-WhPo3_WD.js → paperclip-AGN67YEM.js} +1 -1
  216. package/dist/client/assets/path-input-jrT0Ap4j.js +1 -0
  217. package/dist/client/assets/{pegDiagram-ECIUJNBX-Ct9Li_PA.js → pegDiagram-ECIUJNBX-CAyGJ7fm.js} +1 -1
  218. package/dist/client/assets/{pieDiagram-GNMPY74T-BAB5RA5v.js → pieDiagram-GNMPY74T-tmLJe1p-.js} +1 -1
  219. package/dist/client/assets/{plug-_q5iqunq.js → plug-C-4o4Kb8.js} +1 -1
  220. package/dist/client/assets/primer-trigger-CmE4Ib-X.js +3 -0
  221. package/dist/client/assets/{profile-errors-COcBx7w5.js → profile-errors-vJU1kT3U.js} +1 -1
  222. package/dist/client/assets/{progress-77FCPL2y.js → progress-BTu_QWg8.js} +1 -1
  223. package/dist/client/assets/{quadrantDiagram-D57K4MC3-BqPJVmMS.js → quadrantDiagram-D57K4MC3-CUr2zJoz.js} +1 -1
  224. package/dist/client/assets/{query-error-state-5236P3z0.js → query-error-state-BCX32dab.js} +1 -1
  225. package/dist/client/assets/{radio-C8xmfoqO.js → radio-DBitPjM1.js} +1 -1
  226. package/dist/client/assets/{railroadDiagram-Y72NRBL7-B8U11nT6.js → railroadDiagram-Y72NRBL7-Bk9OMEWz.js} +1 -1
  227. package/dist/client/assets/registry-DVPRVi8T.js +34 -0
  228. package/dist/client/assets/registry-DiFfRDdW.js +1 -0
  229. package/dist/client/assets/{relay-trace-schemas-B80E4EUn.js → relay-trace-schemas-C-1Js81V.js} +2 -2
  230. package/dist/client/assets/{repeat-CHmB_vD7.js → repeat-B1wCYWXI.js} +1 -1
  231. package/dist/client/assets/{requirementDiagram-EQYSW5RA-CzJ1gzTh.js → requirementDiagram-EQYSW5RA-B2pkljrw.js} +1 -1
  232. package/dist/client/assets/{room-files-source-B0gc97Ri.js → room-files-source-BDkq0-fd.js} +2 -2
  233. package/dist/client/assets/{rotate-ccw-clock-CCU6SVnv.js → rotate-ccw-clock-Ds8cHkxD.js} +1 -1
  234. package/dist/client/assets/{rotate-cw-B8WQa8O-.js → rotate-cw-hUzouNTK.js} +1 -1
  235. package/dist/client/assets/{sankeyDiagram-SY24JHO5-D4vQwyve.js → sankeyDiagram-SY24JHO5-DEW9eIPS.js} +1 -1
  236. package/dist/client/assets/scroll-area-RSd8NjrE.js +1 -0
  237. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BVnIsPQe.js → sequenceDiagram-BLEHNHQU-CoiCdD1D.js} +1 -1
  238. package/dist/client/assets/{shield-x-ijIbRppV.js → shield-x-KL4ZbHfz.js} +1 -1
  239. package/dist/client/assets/signed-in-Dzxe2378.js +1 -0
  240. package/dist/client/assets/{sizeCapture-INFHLROL-DGb1rAJL.js → sizeCapture-INFHLROL-BWGf0Ghs.js} +1 -1
  241. package/dist/client/assets/{soul-file-CXgYs25S.js → soul-file-BQXbWArv.js} +1 -1
  242. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DeX3IKTm.js → stateDiagram-v2-A6IESKWZ-aeqwGZMB.js} +1 -1
  243. package/dist/client/assets/{swimlanes-B3ENRKFQ-DN5ljYhG.js → swimlanes-B3ENRKFQ-BkWhAAlV.js} +1 -1
  244. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CS2DMvLi.js +8 -0
  245. package/dist/client/assets/{table-D9ww_3Ij.js → table-CfLst6CF.js} +1 -1
  246. package/dist/client/assets/{timeline-definition-JXYKGLGB-DpRthC3r.js → timeline-definition-JXYKGLGB-C1BUxIfq.js} +1 -1
  247. package/dist/client/assets/{trust-posture-Dn2ciEE0.js → trust-posture-CfEIPM4Z.js} +1 -1
  248. package/dist/client/assets/{unplug-BZ8zSvfB.js → unplug-B3eDst8L.js} +1 -1
  249. package/dist/client/assets/{unverified-catalog-notice-CGy05tAO.js → unverified-catalog-notice-BqIWxQuN.js} +1 -1
  250. package/dist/client/assets/{use-bindings-BLAWQRpe.js → use-bindings-DhOKnybh.js} +1 -1
  251. package/dist/client/assets/{use-composer-prefs-ICOpilWK.js → use-composer-prefs-_rlNL0D8.js} +1 -1
  252. package/dist/client/assets/{use-connector-management-DEMGZy9N.js → use-connector-management-CHLdhBhC.js} +1 -1
  253. package/dist/client/assets/{use-deep-link-scroll-DxGYrks3.js → use-deep-link-scroll-BVkszEn2.js} +1 -1
  254. package/dist/client/assets/{use-delete-binding-Bnv3J5Fu.js → use-delete-binding-BET7vH2R.js} +1 -1
  255. package/dist/client/assets/{use-dev-links-BOcktLiE.js → use-dev-links-BjLPuSUC.js} +1 -1
  256. package/dist/client/assets/{use-direct-message-panel-D38tSozW.js → use-direct-message-panel-ClXVf94w.js} +1 -1
  257. package/dist/client/assets/{use-external-adapter-catalog-9qiNBqpc.js → use-external-adapter-catalog-D1INoacX.js} +1 -1
  258. package/dist/client/assets/use-filter-state-BRlb3qG3.js +6 -0
  259. package/dist/client/assets/use-full-activity-feed-GWBg-_1B.js +1 -0
  260. package/dist/client/assets/use-is-below-desktop-BjWA-tqP.js +1 -0
  261. package/dist/client/assets/{use-local-browser-B1huJhdg.js → use-local-browser-C-V2n_wd.js} +1 -1
  262. package/dist/client/assets/{use-mesh-topology-BTYAy6zc.js → use-mesh-topology-BzSFyR_s.js} +1 -1
  263. package/dist/client/assets/{use-mounted-ref-CaPc6Prv.js → use-mounted-ref-1T3JbkY1.js} +1 -1
  264. package/dist/client/assets/{use-notification-prefs-u76DPoP0.js → use-notification-prefs-qcYeVmLQ.js} +1 -1
  265. package/dist/client/assets/use-pending-read-C1oA2H00.js +1 -0
  266. package/dist/client/assets/use-personality-commit-CJb-rqmM.js +1 -0
  267. package/dist/client/assets/{use-promo-activation-5HG08FlB.js → use-promo-activation-CAJItujg.js} +3 -3
  268. package/dist/client/assets/{use-promo-dismissals-CO7-qhEl.js → use-promo-dismissals-C6bPU5Rm.js} +1 -1
  269. package/dist/client/assets/{use-pulse-freshness-D07Mv-Sa.js → use-pulse-freshness-Y11Ibit1.js} +1 -1
  270. package/dist/client/assets/{use-room-follow-claim-DRQBuAIe.js → use-room-follow-claim-Di-yvoJD.js} +1 -1
  271. package/dist/client/assets/{use-room-sessions-Bzk7rM40.js → use-room-sessions-CPDRbQAW.js} +1 -1
  272. package/dist/client/assets/{use-roving-tab-list-CcznVldj.js → use-roving-tab-list-DK0OzOUz.js} +1 -1
  273. package/dist/client/assets/{use-session-canvas-CpgE7tFb.js → use-session-canvas-DA2i9Mdm.js} +6 -6
  274. package/dist/client/assets/use-status-budget-jMg_w0rF.js +21 -0
  275. package/dist/client/assets/{use-transform-ByJGn3hq.js → use-transform-BX3r518L.js} +1 -1
  276. package/dist/client/assets/{use-unclaimed-chats-C-z5fstJ.js → use-unclaimed-chats-B0nk8b84.js} +1 -1
  277. package/dist/client/assets/use-update-config-Ce7sHmp2.js +1 -0
  278. package/dist/client/assets/{useMutationState-BF1EFtIZ.js → useMutationState-Rlga1GBT.js} +1 -1
  279. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-efVKbRIX.js → usecaseDiagram-WPOLBNNX-mjIwRNL1.js} +1 -1
  280. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Bravmwce.js → vennDiagram-Q3Y3IDCW-BcDIpVa6.js} +1 -1
  281. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-fR77zByv.js → wardleyDiagram-IVAIDKWA-NFX31kox.js} +1 -1
  282. package/dist/client/assets/{xychartDiagram-4URNHDU4-BphORSLh.js → xychartDiagram-4URNHDU4-DZZY7dL1.js} +1 -1
  283. package/dist/client/index.html +2 -2
  284. package/dist/drizzle/20261031012841_dor3309_file_turn_on_offer.sql +2 -0
  285. package/dist/drizzle/20261101122330_schedule_declined_content_key.sql +1 -0
  286. package/dist/drizzle/meta/20261031012841_snapshot.json +14116 -0
  287. package/dist/drizzle/meta/20261101122330_snapshot.json +14123 -0
  288. package/dist/drizzle/meta/_journal.json +14 -0
  289. package/dist/server/index.js +6424 -4548
  290. package/dist/server/index.js.map +2 -2
  291. package/package.json +5 -5
  292. package/dist/client/assets/ActivityRow-DIBH4v9c.js +0 -1
  293. package/dist/client/assets/AdapterSetupWizard-Dle_b9qc.js +0 -2
  294. package/dist/client/assets/AppearancePage-DXbhUt2e.js +0 -1
  295. package/dist/client/assets/AttentionSignalRow-5E7TkG98.js +0 -1
  296. package/dist/client/assets/BindingDialog-q--8SDJF.js +0 -1
  297. package/dist/client/assets/CanvasFileContent-BThy5fjD.js +0 -2
  298. package/dist/client/assets/CanvasModel3dContent-BbgR73jh.js +0 -2
  299. package/dist/client/assets/ChannelComposer-qhk0KtW7.js +0 -44
  300. package/dist/client/assets/ConnectionAccessLists-DRwO1v0V.js +0 -1
  301. package/dist/client/assets/HandlePage-B4qbFi40.js +0 -1
  302. package/dist/client/assets/HeartbeatPage-BnNbQLCW.js +0 -1
  303. package/dist/client/assets/Marketplace-DbdLWz0-.js +0 -36
  304. package/dist/client/assets/NamePage-fhxyWDDY.js +0 -1
  305. package/dist/client/assets/OperatorIdentityForm-Bls5Vo_u.js +0 -1
  306. package/dist/client/assets/PhotoPage-CNHcXbz4.js +0 -1
  307. package/dist/client/assets/PreviewRefusedNotice-Ds4IO32o.js +0 -1
  308. package/dist/client/assets/PromptSuggestionChips-BXxC799Q.js +0 -1
  309. package/dist/client/assets/RoomSurface-DgH3a_Fv.js +0 -1
  310. package/dist/client/assets/RunsOnPopover-CEkkjrGg.js +0 -1
  311. package/dist/client/assets/RuntimeConnectFlow-DXWGgvCW.js +0 -1
  312. package/dist/client/assets/RuntimeSetupDialog-D6L1QhMF.js +0 -1
  313. package/dist/client/assets/SettingsDialog-BOOqWKcj.js +0 -12
  314. package/dist/client/assets/SkillsPage-ntCEhUIM.js +0 -1
  315. package/dist/client/assets/TaskDialogWrapper-vBWAWwTY.js +0 -1
  316. package/dist/client/assets/TasksEmptyState-C_3UkAbA.js +0 -3
  317. package/dist/client/assets/TourHost-B69XAKpE.js +0 -1
  318. package/dist/client/assets/WidgetErrorCard-BlqaIsPK.js +0 -108
  319. package/dist/client/assets/WorkView-BekLkR4O.js +0 -51
  320. package/dist/client/assets/_shell-Du0F-5fK.js +0 -80
  321. package/dist/client/assets/_shell._home.activity-5rihXoYF.js +0 -1
  322. package/dist/client/assets/_shell._home.index-BsLNqt4f.js +0 -3
  323. package/dist/client/assets/_shell._home.tasks-Cxs5tLWA.js +0 -1
  324. package/dist/client/assets/_shell._home.workspaces-CEHDdfbP.js +0 -1
  325. package/dist/client/assets/_shell.connections-Bm0WmgXH.js +0 -1
  326. package/dist/client/assets/_shell.marketplace-CsQ60Mlc.js +0 -1
  327. package/dist/client/assets/_shell.marketplace_.sources-DNyShS1x.js +0 -1
  328. package/dist/client/assets/_shell.session-BN42bV3w.js +0 -1
  329. package/dist/client/assets/_shell.threads-HH4EvufJ.js +0 -1
  330. package/dist/client/assets/_shell.x._extensionId-3ZlJV1iu.js +0 -1
  331. package/dist/client/assets/_shell.x._extensionId_._-3ZlJV1iu.js +0 -1
  332. package/dist/client/assets/card-DUmTNXJJ.js +0 -1
  333. package/dist/client/assets/channel-B7zgJbnU.js +0 -1
  334. package/dist/client/assets/form-D93N5lrK.js +0 -1
  335. package/dist/client/assets/image-lightbox-vgPEvSCc.js +0 -1
  336. package/dist/client/assets/index-B446r3dL.js +0 -1
  337. package/dist/client/assets/index-BGo1YiUE.js +0 -1
  338. package/dist/client/assets/index-BO3yPJt-.js +0 -1
  339. package/dist/client/assets/index-DE6uOpn4.js +0 -1
  340. package/dist/client/assets/index-Dag1qeZI.js +0 -1
  341. package/dist/client/assets/index-Dm0Tav7v.js +0 -1
  342. package/dist/client/assets/index-Dry_agqN.css +0 -1
  343. package/dist/client/assets/index-OQuvRZTD.js +0 -1058
  344. package/dist/client/assets/index-eVrGefuq.js +0 -1
  345. package/dist/client/assets/mention-pill-BsOeTJ2f.js +0 -1
  346. package/dist/client/assets/path-input-C2KIXdON.js +0 -1
  347. package/dist/client/assets/primer-trigger-B2tjuHBx.js +0 -3
  348. package/dist/client/assets/registry-BzXBOE9h.js +0 -34
  349. package/dist/client/assets/registry-sfhDu9q2.js +0 -1
  350. package/dist/client/assets/scroll-area-FwZwM74Q.js +0 -1
  351. package/dist/client/assets/search-x-Q18Wm-C5.js +0 -6
  352. package/dist/client/assets/signed-in-DEOMBWVX.js +0 -1
  353. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-D8kHFWtL.js +0 -8
  354. package/dist/client/assets/use-full-activity-feed-CtQquOBW.js +0 -1
  355. package/dist/client/assets/use-is-below-desktop-CAGEAsCC.js +0 -1
  356. package/dist/client/assets/use-pending-read-D0y6i7G9.js +0 -1
  357. package/dist/client/assets/use-personality-commit-C3h8upDo.js +0 -1
  358. package/dist/client/assets/use-status-budget-Xn2sIeM1.js +0 -16
  359. package/dist/client/assets/use-update-config-L5NCTj3t.js +0 -1
@@ -0,0 +1,36 @@
1
+ import{O as te,a5 as B,a6 as de,ac as P,a7 as ae,a8 as ue,r as p,u as ke,ny as Pe,j as s,ee as ln,ef as on,eg as cn,eh as dn,ei as un,fA as mn,el as ee,dS as hn,I as pn,nz as We,nA as be,nB as Qe,nC as us,nD as ms,fz as fn,e as W,lX as xn,a4 as me,nE as gn,B as C,e1 as kn,nF as Ke,nG as jn,nH as vn,_ as Ge,df as ye,P as bn,G as oe,dB as S,dK as K,fU as yn,hU as Nn,nI as wn,dJ as Cn,hh as Pn,nJ as Sn,nK as Je,nL as Y,nM as $n,nN as ve,J as hs,ih as Ve,jR as In,ba as Rn,f_ as qe,gX as ps,a2 as se,hC as Tn,C as Se,aO as fs,i1 as Dn,i2 as En,i3 as Ln,i4 as An,nO as xs,i5 as Un,bV as On,eo as Fn,ep as Mn,kH as zn,as as gs,aW as ks,hz as js,eP as He,ff as vs,gc as _n,aZ as bs,nP as Kn,a as Ue,bZ as ys,cY as $e,cZ as Ie,c$ as Re,d0 as Te,d1 as De,lm as Ns,ln as Ne,eA as Ee,dL as Le,x as Me,bf as ws,ax as Vn,gr as ze,gQ as qn,nQ as Hn,iw as Bn,nR as Wn,nS as Qn,jG as Gn,nT as Jn,d$ as Yn,nU as Xn,nV as Zn}from"./index-YUtEyz7O.js";import{r as et,d as st,u as Cs,P as Ps,T as nt,a as tt,b as Ye}from"./PreviewRefusedNotice-Dt2hV0aJ.js";import{E as at}from"./empty-state-BnuM8oop.js";import{M as rt}from"./markdown-content-CiDXslQf.js";import{U as lt}from"./use-unclaimed-chats-B0nk8b84.js";import{d as it,f as ot,a as ct,b as dt,c as ut,U as Ss,u as mt,e as ht}from"./UnlinkDialog-B9zw8r6F.js";import{M as pt}from"./more-details-DF2dJXMV.js";import{a as $s}from"./use-dev-links-BjLPuSUC.js";import{F as Is}from"./file-D7_QdH_S.js";import{A as Rs}from"./AgentPicker-C51wqToQ.js";import{u as ft}from"./useMutationState-Rlga1GBT.js";import{F as xt}from"./file-exclamation-point-Cdt8YqyQ.js";import{R as Ts}from"./rotate-ccw-clock-Ds8cHkxD.js";import{P as gt}from"./path-input-jrT0Ap4j.js";/**
2
+ * @license lucide-react v1.48.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Ds={name:"arrow-down-to-line",size:24,node:[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]};Ds.node;const kt=te(Ds);/**
7
+ * @license lucide-react v1.48.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Es={name:"circle-arrow-up",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],aliases:["arrow-up-circle"]};Es.node;const jt=te(Es);/**
12
+ * @license lucide-react v1.48.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Ls={name:"file-check-corner",size:24,node:[["path",{d:"M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6",key:"g5mvt7"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14 20 2 2 4-4",key:"15kota"}]],aliases:["file-check-2"]};Ls.node;const vt=te(Ls);/**
17
+ * @license lucide-react v1.48.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const As={name:"key",size:24,node:[["path",{d:"m2 21 9.6-9.6",key:"9l79m3"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19",key:"fw8biw"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5",key:"4wxmhb"}]]};As.node;const bt=te(As);/**
22
+ * @license lucide-react v1.48.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const Us={name:"package-search",size:24,node:[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"M20.27 18.27 22 20",key:"er2am"}],["path",{d:"M21 10.498V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.98-.559",key:"tok1h1"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}],["circle",{cx:"18.5",cy:"16.5",r:"2.5",key:"ke13xx"}]]};Us.node;const yt=te(Us);/**
27
+ * @license lucide-react v1.48.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const Os={name:"scale",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]]};Os.node;const Nt=te(Os);/**
32
+ * @license lucide-react v1.48.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const Fs={name:"unlink",size:24,node:[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]};Fs.node;const wt=te(Fs);function Ct(e,n){const t=B(),{enabled:r=!0,marketplace:a}=n??{};return de({queryKey:P.packageDetail(e??""),queryFn:()=>t.getMarketplacePackage(e,a),enabled:r&&e!==null,staleTime:6e4})}function je(e){const n=B();return de({queryKey:P.installed(e),queryFn:()=>n.listInstalledPackages(e),staleTime:6e4})}function Pt(e,n){const t=B();return de({queryKey:P.installedDetail(e??""),queryFn:()=>t.listPackageInstallations(e),enabled:((n==null?void 0:n.enabled)??!0)&&e!==null,staleTime:6e4})}function St(){const e=B();return de({queryKey:P.integrity(),queryFn:()=>e.listInstalledPackages(void 0,{verify:!0}),select:n=>new Map(n.flatMap(t=>t.integrity?[[t.installPath,t.integrity]]:[])),staleTime:6e4})}const $t=10*6e4;function It(e,n={}){const t=B();return de({queryKey:P.updates(e),queryFn:()=>t.checkMarketplaceUpdates(e),enabled:n.enabled??!0,staleTime:$t,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function Rt(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.installMarketplacePackage(t,r),onError:t=>{t.code==="disclosure_changed"&&n.invalidateQueries({queryKey:P.preview()})},onSuccess:(t,{name:r,options:a})=>{n.invalidateQueries({queryKey:P.installed()}),a!=null&&a.projectPath&&n.invalidateQueries({queryKey:P.installed(a.projectPath)}),n.invalidateQueries({queryKey:P.packages()}),n.invalidateQueries({queryKey:P.packageDetail(r)}),n.invalidateQueries({queryKey:["commands"]}),n.invalidateQueries({queryKey:P.updates(),refetchType:"none"})}})}function Tt(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.uninstallMarketplacePackage(t,r),onSuccess:(t,{name:r,options:a})=>{n.invalidateQueries({queryKey:P.installed()}),a!=null&&a.projectPath&&n.invalidateQueries({queryKey:P.installed(a.projectPath)}),n.invalidateQueries({queryKey:P.packageDetail(r)}),n.invalidateQueries({queryKey:["commands"]})}})}function Dt(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.checkPackageFiles(t,r),onSettled:()=>{n.invalidateQueries({queryKey:P.integrity()})}})}function Ms(e){if(!e.applied)return e;const{applied:n,applyError:t,note:r,...a}=e;return{...a,status:"current",hasUpdate:!1,installedVersion:n.version,installedVersionSource:n.version===e.latestVersion?e.latestVersionSource:"package"}}function Et(){const e=B(),n=ae();return ue({mutationKey:P.applyUpdates(),mutationFn:t=>e.applyMarketplaceUpdates(t),meta:{suppressErrorToast:!0},onError:t=>{t.code==="disclosure_changed"&&n.invalidateQueries({queryKey:P.updates()})},onSuccess:async t=>{const r=new Map(t.checks.map(l=>[l.installPath,Ms(l)]));n.setQueriesData({queryKey:P.updates()},l=>l&&{checks:l.checks.map(i=>r.get(i.installPath)??i)});const a=t.checks.filter(l=>l.applied);if(a.length!==0){for(const l of new Set(a.map(i=>i.packageName)))n.invalidateQueries({queryKey:P.installedDetail(l)}),n.invalidateQueries({queryKey:P.packageDetail(l)});n.invalidateQueries({queryKey:["commands"]}),await n.invalidateQueries({queryKey:P.installed()})}}})}function Lt(){const e=ft({filters:{mutationKey:P.applyUpdates(),status:"pending"},select:n=>{var t;return(t=n.state.variables)==null?void 0:t.targets.map(r=>r.installPath)}});return p.useMemo(()=>new Set(e.flatMap(n=>n??[])),[e])}function At(){const e=B();return ue({mutationFn:n=>e.reviewHeldBackPackage(n),meta:{suppressErrorToast:!0}})}function Ut(e){const n=B();return de({queryKey:P.heldBack(),queryFn:()=>n.listHeldBackPackages(),enabled:e})}function Ot(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.keepPackageFiles(t,r),meta:{suppressErrorToast:!0},onSettled:()=>{n.invalidateQueries({queryKey:P.installed()})}})}function Ft(e,n){return e.name.toLowerCase().includes(n)||(e.description??"").toLowerCase().includes(n)||(e.keywords??[]).some(t=>t.toLowerCase().includes(n))?!0:(e.tags??[]).some(t=>t.toLowerCase().includes(n))}const Mt=300,zt=[{value:"featured",label:"Featured"},{value:"name",label:"A–Z"},{value:"popular",label:"Popular"},{value:"recent",label:"Recent"}];function _t(){const{sort:e,setSort:n}=ke(),{data:t}=Pe(),r=p.useMemo(()=>(t??[]).some(i=>i.installCount!==void 0),[t]),a=p.useMemo(()=>(t??[]).some(i=>i.updatedAt!==void 0),[t]),l=i=>i==="popular"?!r:i==="recent"?!a:!1;return s.jsxs("header",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(Kt,{})}),s.jsxs(ln,{value:e,onValueChange:i=>n(i),children:[s.jsx(on,{"aria-label":"Sort packages",className:"w-28 shrink-0 text-xs sm:w-32",children:s.jsx(cn,{})}),s.jsx(dn,{children:zt.map(i=>s.jsx(un,{value:i.value,disabled:l(i.value),className:"text-xs",children:i.label},i.value))})]})]})}function Kt(){const{search:e,setSearch:n}=ke(),t=p.useRef(null),r=mn({value:e,generation:0});r.read().value!==e&&r.write({value:e,generation:r.read().generation+1});const a=r.read().generation,[l,i]=p.useState(null),o=l!==null&&l.generation===a?l.value:e,d=c=>i({generation:a,value:c});p.useEffect(()=>{if(o===e)return;const c=setTimeout(()=>n(o),Mt);return()=>clearTimeout(c)},[o,e,n]);const u=p.useCallback(c=>{var w;if(c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey)return;const h=c.target,f=h==null?void 0:h.tagName;f==="INPUT"||f==="TEXTAREA"||f==="SELECT"||h!=null&&h.isContentEditable||(c.preventDefault(),(w=t.current)==null||w.focus())},[]);return p.useEffect(()=>(document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)),[u]),s.jsxs("div",{className:"group/search relative",children:[s.jsx(ee,{htmlFor:"marketplace-search",className:"sr-only",children:"Search packages"}),s.jsx(hn,{className:"text-muted-foreground group-focus-within/search:text-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 transition-colors duration-200","aria-hidden":!0}),s.jsx(pn,{ref:t,id:"marketplace-search","data-testid":"marketplace-search",value:o,onChange:c=>d(c.target.value),placeholder:"Search…",className:"pl-9 transition-shadow duration-200 focus:shadow-md max-sm:pr-3 sm:pr-10"}),s.jsx("kbd",{className:"text-muted-foreground/60 text-3xs pointer-events-none absolute top-1/2 right-3 hidden -translate-y-1/2 rounded border border-current/20 px-1.5 py-0.5 font-mono leading-none group-focus-within/search:opacity-0 sm:block",children:"/"})]})}function Vt(e,n){if(n==="all")return!0;const t=e.type??"plugin";return n===We?t==="adapter"&&e.adapterType===We:t===n}function qt(e,n){const t=n.search.trim().toLowerCase();return e.filter(r=>!(!Vt(r,n.type)||n.categories.length>0&&!n.categories.some(l=>{var i;return(((i=r.categories)==null?void 0:i.includes(l))??!1)||r.category===l})||n.sources.length>0&&!n.sources.includes(r.marketplace)||t&&!Ft(r,t)))}function Ae(e,n){return be(e).localeCompare(be(n))}function Ht(e,n){const t=e.marketplace===Qe?1:0,r=n.marketplace===Qe?1:0;if(t!==r)return r-t;const a=e.featured?1:0,l=n.featured?1:0;return a!==l?l-a:Ae(e,n)}function Bt(e,n){const t=e.installCount??0,r=n.installCount??0;return t!==r?r-t:Ae(e,n)}function Wt(e,n){const t=e.updatedAt??"",r=n.updatedAt??"";return t!==r?r.localeCompare(t):Ae(e,n)}function Qt(e,n){const t=[...e];switch(n){case"featured":return t.sort(Ht);case"name":return t.sort(Ae);case"popular":return t.sort(Bt);case"recent":return t.sort(Wt)}}function zs({count:e=8}){return s.jsx("div",{className:us,children:s.jsx("div",{"data-slot":"package-grid",className:ms,"aria-busy":"true","aria-label":"Loading packages",children:Array.from({length:e}).map((n,t)=>s.jsxs(fn,{radius:"lg",gap:"none",className:"p-6",children:[s.jsx("div",{className:"mb-3 flex items-start justify-between gap-2",children:s.jsx(W,{className:"size-6 rounded-full"})}),s.jsx(W,{className:"mb-1 h-4 w-3/4"}),s.jsx(W,{className:"mb-3 h-3 w-16"}),s.jsx(W,{className:"mb-1 h-3 w-full"}),s.jsx(W,{className:"mb-4 h-3 w-2/3"}),s.jsx("div",{className:"flex items-center justify-end",children:s.jsx(W,{className:"h-7 w-16"})})]},t))})})}function xe({onResetFilters:e,resetLabel:n="Reset filters",title:t="No packages match your filters",description:r="Try another search or filter."}){return s.jsx(at,{className:"rounded-xl border border-dashed",icon:yt,headline:t,headingLevel:3,description:r,action:e?{label:n,onClick:e,variant:"outline"}:void 0})}const Gt=/network|fetch|offline/i;function _s({error:e,onRetry:n}){const t=Gt.test(e.message),r=t?xn:me,a=t?"Couldn’t reach the marketplace":"Couldn’t load packages";return s.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed py-16 text-center",children:[s.jsx(r,{className:"text-muted-foreground mb-4 size-10","aria-hidden":!0}),s.jsx("h3",{className:"mb-2 text-base font-semibold",children:a}),s.jsx("p",{className:"text-muted-foreground mb-4 max-w-sm text-sm",children:s.jsx(gn,{text:e.message})}),s.jsx(C,{variant:"outline",onClick:n,children:"Try again"})]})}const Jt={hidden:{},visible:{transition:{staggerChildren:ye.step}}},Yt={hidden:e=>({opacity:e<ye.max?0:1,y:e<ye.max?12:0}),visible:{opacity:1,y:0,transition:{duration:.25,ease:"easeOut"}}};function Xt(){const{data:e,isLoading:n,error:t,refetch:r}=Pe(),{data:a}=je(),l=kn(),{type:i,categories:o,sources:d,search:u,sort:c,resetFilters:h,clearCategories:f,clearSources:w,openDetail:T}=ke(),v=Ke(),x=p.useMemo(()=>e?Qt(qt(e,{type:i,categories:o,sources:d,search:u}),c):[],[e,i,o,d,u,c]),N=p.useMemo(()=>new Set((a??[]).map(k=>k.name)),[a]),$=p.useMemo(()=>new Set((a??[]).filter(k=>k.devLink).map(k=>k.name)),[a]);if(n)return s.jsx(zs,{});if(t)return s.jsx(_s,{error:t,onRetry:()=>void r()});if(x.length===0){const k=o.length>0&&d.length===0,I=d.length>0&&o.length===0;if(k){const A=o.length===1?o[0]:null,D=A?jn(A):void 0,E=A?D?vn[D]:A:null;return s.jsx(xe,{title:E?`No packages in ${E} yet`:"No packages in these categories yet",description:"Try another category.",resetLabel:o.length===1?"Clear category":"Clear categories",onResetFilters:f})}if(I){const A=d.length===1?d[0]:null;return s.jsx(xe,{title:A?`No packages from ${A} yet`:"No packages from these sources yet",description:"Try another source.",resetLabel:d.length===1?"Clear source":"Clear sources",onResetFilters:w})}return o.length>0&&d.length>0?s.jsx(xe,{title:"No packages match these filters",description:"Reset the filters to see everything.",onResetFilters:h}):s.jsx(xe,{onResetFilters:h})}return s.jsxs("div",{className:oe(us,"space-y-4"),children:[s.jsx("div",{className:"flex items-center justify-between gap-4",children:s.jsxs("h2",{className:"text-base font-semibold",children:["All packages",s.jsxs("span",{className:"text-muted-foreground ml-2 text-sm font-normal",children:["(",x.length,")"]})]})}),s.jsx(Ge.div,{variants:l?void 0:Jt,initial:"hidden",animate:"visible","data-slot":"package-grid",className:ms,children:x.map((k,I)=>s.jsx(Ge.div,{variants:l?void 0:Yt,custom:I<ye.max?I:0,className:"h-full",children:s.jsx(bn,{pkg:k,installed:N.has(k.name),devLinked:$.has(k.name),onClick:()=>T(k.name),onInstallClick:()=>v(k)})},k.name))})]})}function Xe(e,n){return e instanceof Error?`Couldn’t uninstall ${n}: ${e.message}`:`Couldn’t uninstall ${n}. Try again.`}function re(e){const n=K(e.name);return e.where?`${n} from ${e.where}`:n}function Ze(e){const n=(e==null?void 0:e.warnings)??[];return n.length>0?{description:n.join(" ")}:{}}function Ks(){const e=Tt(),n=ae(),{mutate:t,mutateAsync:r}=e,a=p.useCallback(()=>{n.invalidateQueries({queryKey:[...lt]})},[n]),l=p.useCallback(({where:o,...d})=>{const u=S.loading(`Uninstalling ${re({...d,where:o})}…`);t(d,{onSuccess:c=>{a(),S.success(`Uninstalled ${re({...d,where:o})}`,{id:u,...Ze(c)})},onError:c=>{S.error(Xe(c,re({...d,where:o})),{id:u})}})},[t,a]),i=p.useCallback(async({where:o,...d})=>{const u=S.loading(`Uninstalling ${re({...d,where:o})}…`);try{const c=await r(d);return a(),S.success(`Uninstalled ${re({...d,where:o})}`,{id:u,...Ze(c)}),c}catch(c){throw S.error(Xe(c,re({...d,where:o})),{id:u}),c}},[r,a]);return{...e,mutate:l,mutateAsync:i}}function Vs(){const[e,n]=p.useState(null),[t,r]=p.useState(null),a=Ke(),l=c=>{var h;return{name:c.name,...it(c),parked:((h=c.devLink)==null?void 0:h.parked)===!0}},i=p.useCallback(c=>{r(null),n(l(c))},[]),o=p.useCallback((c,h)=>{r({pkg:h,installation:c}),n({...l(c),then:"install"})},[]),d=p.useCallback(()=>n(null),[]),u=p.useCallback(c=>{if(c.then!=="install"||!t)return;const{pkg:h,installation:f}=t;r(null),a(h,f.agentPath?{agentPath:f.agentPath,agentName:f.agentName??f.agentPath}:void 0)},[t,a]);return{target:e,askUnlink:i,askInstallPublished:o,close:d,onUnlinked:u}}function Zt(e){const{data:n}=$s(),t=ot(n==null?void 0:n.links,e),r=wn(ct(e,t)),a=Cn(l=>l.latest[r]);return e.devLink?dt(e.devLink,a,t):null}function ea({status:e}){switch(e.kind){case"reloaded":return s.jsx(sa,{at:e.at});case"watching":return s.jsx("p",{className:"text-muted-foreground text-xs",children:"Watching for edits."});case"reload-failed":return s.jsxs("div",{className:"text-status-warning-fg space-y-1 text-xs",children:[s.jsxs("p",{className:"flex items-start gap-1",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"[overflow-wrap:anywhere]",children:e.headline})]}),s.jsx(pt,{label:"Details",openLabel:"Hide details",className:"ml-4",children:e.details.map((n,t)=>s.jsx("p",{className:"font-mono text-xs [overflow-wrap:anywhere]",children:n},`${t}-${n}`))})]});case"folder-missing":return s.jsx(Oe,{children:"Folder missing. Restore it or unlink."});case"link-missing":return s.jsx(Oe,{children:"Its link is gone. Unlink to finish."});case"link-replaced":return s.jsx(Oe,{children:"Something else is in its place. Unlink to finish."})}}function sa({at:e}){const n=Pn(1e3);return s.jsx("time",{dateTime:e,title:new Date(e).toLocaleString(),className:"text-muted-foreground text-xs",children:ut(e,n)})}function Oe({children:e}){return s.jsxs("p",{className:"text-status-warning-fg flex items-start gap-1 text-xs",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{children:e})]})}function qs({installation:e}){const n=Zt(e);return!e.devLink||!n?null:s.jsxs("div",{className:"mt-1.5 space-y-1","data-testid":"dev-link-details",children:[s.jsx(yn,{path:e.devLink.path}),s.jsx("div",{role:"status","aria-live":"polite","data-testid":"dev-link-status",children:s.jsx(ea,{status:n})})]})}function Hs({installation:e,published:n,label:t,onUnlink:r,onInstallPublished:a,disabled:l}){return e.devLink?e.devLink.parked?s.jsxs(C,{size:"sm",variant:"outline",onClick:r,disabled:l,"aria-label":`Use the installed copy of ${t}`,children:[s.jsx(Nn,{className:"mr-1 size-3","aria-hidden":!0}),"Use installed copy"]}):s.jsxs(s.Fragment,{children:[n&&s.jsxs(C,{size:"sm",variant:"outline",onClick:()=>a(n),disabled:l,"aria-label":`Install the published version of ${t}`,children:[s.jsx(kt,{className:"mr-1 size-3","aria-hidden":!0}),"Install published version"]}),s.jsxs(C,{size:"sm",variant:"ghost",onClick:r,disabled:l,"aria-label":`Unlink ${t}`,children:[s.jsx(wt,{className:"mr-1 size-3","aria-hidden":!0}),"Unlink"]})]}):null}function Bs(e){return e.includes("\\")&&!e.includes("/")?"\\":"/"}function es(e){return e.split(/[\\/]/)}function na(e){const n=e[0];if(n===void 0)return"";const t=Bs(n);let r=es(n).slice(0,-1);for(const a of e.slice(1)){const l=es(a).slice(0,-1);let i=0;for(;i<r.length&&i<l.length&&r[i]===l[i];)i+=1;if(r=r.slice(0,i),r.length===0)break}return r.length===0?"":r.length===1&&r[0]===""?t:r.join(t)}function ta(e,n){if(n==="")return e;const t=Bs(e),r=n.endsWith(t)?n:n+t;return e.startsWith(r)?e.slice(r.length):e}function ss(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/(^|\/)\.(?=\/|$)/g,"$1").replace(/\/+/g,"/").replace(/(.)\/$/,"$1")}function aa(e,n){if(n==="")return!1;const t=ss(n);if(t==="/"||t==="")return!0;const r=ss(e);return r===t||r.startsWith(`${t}/`)}const ra={delete:"removed",modify:"changed",create:"new"},la=["delete","modify","create"];function ns(e,n){const t=[];for(const r of la){const a=e.filter(l=>l.action===r).map(l=>ta(l.path,n)).sort((l,i)=>l.localeCompare(i));for(const l of a)t.push({text:l,tag:ra[r],...r==="delete"?{severity:"warning"}:{}})}return t}function ia(e,n){if(e.length===0)return[];const t=na(e.map(d=>d.path)),r={create:e.filter(d=>d.action==="create").length,modify:e.filter(d=>d.action==="modify").length,delete:e.filter(d=>d.action==="delete").length},a=e.length===1?"file":"files",l=t===""?"":` under ${t}`,i=[{icon:"file",label:`${e.length} ${a}${l}: ${r.create} new, ${r.modify} changed, ${r.delete} removed`,details:ns(e,t),detailsLabel:`Show ${e.length} ${a}`}];if(!n)return i;const o=e.filter(d=>!aa(d.path,n));return o.length>0&&i.push({icon:"alert-triangle",label:`${o.length} ${o.length===1?"file lands":"files land"} outside ${n}.`,severity:"warning",details:ns(o,""),detailsLabel:`Show ${o.length} ${o.length===1?"file":"files"}`}),i}function oa(e,n){const t=ia(e.fileChanges,n);if(e.npmDependencies.length>0){const r=e.npmDependencies.length;t.push({icon:"globe",label:`Download ${r} npm ${r===1?"library":"libraries"} and their dependencies`,description:e.npmDependencies.map(a=>`${a.name}@${a.range}${a.optional?" (optional)":""}`).join(", ")})}for(const r of e.extensions)t.push({icon:"puzzle",label:`Register UI extension: ${r.id}`,description:r.slots.length>0?`Slots: ${r.slots.join(", ")}`:void 0});for(const r of e.skippedLinks)t.push({icon:"alert-triangle",label:"Part of this package won’t be installed",description:r.message,severity:"warning"});return t}function Ws(e,n=Sn){const t=e.hooks.map(a=>({icon:"terminal",label:Y(a.command),description:a.source?`Runs ${Je(a.event,a.matcher)}, while ${Y(a.source)} is in use`:`Runs ${Je(a.event,a.matcher)}`,mono:!0}));for(const a of e.skillCommands){const l=$n(a.source);t.push({icon:"terminal",label:Y(a.command),description:`Runs when the ${l} "${Y(a.skill)}" is used (${Y(a.source)})`+(a.usesArguments?". Uses what you type after it":""),mono:!0})}for(const a of e.unreadableHooks)t.push({icon:"alert-triangle",label:"Sets up a command DorkOS couldn’t read",description:a.event?`${a.path} declares "${a.event}" in a form DorkOS can’t read`:`DorkOS can’t read ${a.path}`,severity:"warning"});const r=(a,l,i=!0)=>({icon:i?"terminal":"globe",label:a,description:`${l}. ${n}`,mono:!0});for(const a of e.mcpServers)t.push(a.command!==void 0?r(ve(a.command,a.args),`MCP server "${a.name}"`):r(Y(JSON.stringify(a.url??"")),`Remote MCP server "${a.name}"`,!1));for(const a of e.lspServers)t.push(r(ve(a.command,a.args),`Language server "${a.name}"`));for(const a of e.monitors)t.push(r(ve(a.command),`Background monitor "${a.name}"${a.when?`, ${a.when}`:""}`));for(const a of e.executables)t.push(r(ve(a),"Added to the agent’s commands (bin/)"));for(const a of e.skillTools)t.push({icon:"key",label:a.tools.map(l=>Y(JSON.stringify(l))).join(", "),description:`Skill "${Y(a.skill)}" may use these without asking you`,mono:!0});for(const a of e.unreadableDeclarations)t.push({icon:"alert-triangle",label:"Sets up a program DorkOS couldn’t read",description:a.entry?`${a.path} declares "${a.entry}" in a form DorkOS can’t read`:`DorkOS can’t read ${a.path}`,severity:"warning"});return t}function Qs(e){return e.schedules.map(n=>({icon:"clock",label:n.name,description:st(n),severity:et(n.permissionMode)&&n.startsEnabled?"warning":"info"}))}function ca(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function da(e){const n={create:e.fileChanges.filter(u=>u.action==="create").length,modify:e.fileChanges.filter(u=>u.action==="modify").length,delete:e.fileChanges.filter(u=>u.action==="delete").length},r=[{verb:"Adds",count:n.create},{verb:"Changes",count:n.modify},{verb:"Removes",count:n.delete}].filter(u=>u.count>0).map((u,c)=>{const h=c===0?u.verb:u.verb.toLowerCase(),f=c===0?` ${u.count===1?"file":"files"}`:"";return`${h} ${u.count}${f}`}),a=r.length===0?"Changes no files":ca(r),l=e.hooks.length+e.skillCommands.length+e.unreadableHooks.length,i=l===0?"Declares no commands":`Declares ${l} ${l===1?"command":"commands"}`,o=e.mcpServers.length+e.lspServers.length+e.monitors.length+e.executables.length,d=o===0?"":` Includes ${o} ${o===1?"program":"programs"}.`;return`${a}. ${i}.${d}`}function ua(e,n={}){return{effects:oa(e,n.installBase),commands:Ws(e),schedules:Qs(e),secrets:e.secrets.map(t=>({icon:"key",label:t.key+(t.required?"":" (optional)"),description:t.description,severity:t.required?"warning":"info"})),hosts:e.externalHosts.map(t=>({icon:"globe",label:t})),dependencies:e.requires.map(t=>({icon:t.satisfied?"check":"alert-triangle",label:`${t.type}:${t.name}${t.version?`@${t.version}`:""}`,severity:t.satisfied?"info":"warning"})),conflicts:e.conflicts.map(t=>({icon:"alert-triangle",label:t.description,description:t.conflictingPackage?`Conflicts with: ${t.conflictingPackage}`:void 0,severity:t.level==="error"?"error":"warning"}))}}const ma={global:"Starts in every chat.",project:"Declared, but not started for a project install."};function Be(e,n){const t={hooks:e.hooks.map(a=>({event:a.event,...a.matcher!==null&&{matcher:a.matcher},command:a.command,...a.source!==null&&{source:a.source}})),unreadableHooks:[],mcpServers:e.mcpServers.map(a=>({name:a.name,transport:a.transport,...a.command!==null&&{command:a.command,args:a.args},...a.url!==null&&{url:a.url}})),lspServers:e.lspServers.map(({name:a,command:l,args:i})=>({name:a,command:l,args:i})),monitors:e.monitors.map(({name:a,command:l,when:i})=>({name:a,command:l,...i!==null&&{when:i}})),executables:e.executables,skillTools:e.skillTools,skillCommands:e.skillCommands,unreadableDeclarations:[]},r=e.schedules.map(a=>({name:a.name,cron:a.cron,permissionMode:a.permissionMode,startsEnabled:a.startsEnabled}));return[...Ws(t,ma[n]),...Qs({schedules:r})]}const ha={hooks:[],schedules:[],mcpServers:[],lspServers:[],monitors:[],executables:[],skillTools:[],skillCommands:[]},pa=["hooks","skillCommands","mcpServers","lspServers","monitors","executables","skillTools","schedules"];function we(e,n){if(!(e==="hooks"||e==="skillCommands"||e==="executables"))return e==="skillTools"?n.source:n.name}function fa(e,n,t){const r=[],a=(l,i)=>Be({...ha,[l]:[i]},t)[0];for(const l of pa)for(const i of e[l]){const o=a(l,i);if(!o)continue;const d=xa(l,i,n),u=d==="changed"?n[l].find(h=>we(l,h)===we(l,i)):void 0,c=u===void 0?void 0:a(l,u);r.push({row:o,change:d,...c&&{previous:c}})}return r}function xa(e,n,t){if(!t)return"unknown";const r=t[e],a=JSON.stringify(n);if(r.some(i=>JSON.stringify(i)===a))return"unchanged";const l=we(e,n);return l!==void 0&&r.some(i=>we(e,i)===l)?"changed":"new"}const ga={file:Is,puzzle:qe,clock:Rn,terminal:In,key:bt,globe:Ve,check:hs,"alert-triangle":me},Ce={info:"text-muted-foreground",warning:"text-status-warning-fg",error:"text-destructive"};function ka({items:e,label:n}){return s.jsxs("details",{className:"group/details mt-1.5",children:[s.jsxs("summary",{className:oe("text-muted-foreground hover:text-foreground focus-ring inline-flex cursor-pointer","list-none items-center gap-1 rounded-sm text-xs select-none","[&::-webkit-details-marker]:hidden"),children:[s.jsx(Se,{className:"size-3 shrink-0 transition-transform duration-200 group-open/details:rotate-90"}),n]}),s.jsx("ul",{className:"bg-muted/40 mt-1.5 max-h-64 space-y-0.5 overflow-y-auto rounded-md p-2",children:e.map((t,r)=>s.jsxs("li",{className:"text-2xs flex items-baseline gap-2 font-mono",children:[t.tag&&s.jsx("span",{className:oe("w-14 shrink-0",t.severity?Ce[t.severity]:Ce.info),children:t.tag}),s.jsx("span",{className:"text-foreground min-w-0 break-all","data-testid":"file-change-path",children:t.text})]},r))})]})}function Gs(e){const n=e.split(new RegExp(`(?<=\\/)|(?=["'])`));return n.map((t,r)=>s.jsxs(p.Fragment,{children:[t,r<n.length-1&&s.jsx("wbr",{})]},r))}function ge({item:e}){const n=ga[e.icon]??Is,t=e.severity?Ce[e.severity]:Ce.info;return s.jsxs("li",{className:oe("flex items-start gap-2 text-sm",t),children:[s.jsx(n,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[e.mono?s.jsx("code",{className:"bg-muted text-foreground block rounded px-1.5 py-1 font-mono text-xs [overflow-wrap:anywhere] whitespace-pre-wrap",children:Gs(e.label)}):s.jsx("span",{className:"break-words",children:e.label}),e.description&&s.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs break-words",children:e.description}),e.details&&e.details.length>0&&s.jsx(ka,{items:e.details,label:e.detailsLabel??"Show details"})]})]})}function Z({title:e,items:n,tone:t,defaultOpen:r=!1}){const[a,l]=p.useState(r);return n.length===0?null:s.jsx(ps,{open:a,onOpenChange:l,trigger:s.jsx("span",{className:oe("text-xs font-semibold tracking-wider uppercase",t==="warning"?"text-status-warning-fg":"text-muted-foreground"),children:e}),badge:s.jsx(se,{variant:"secondary",className:"text-xs",children:n.length}),children:s.jsx("ul",{className:"space-y-1.5",children:n.map((i,o)=>s.jsx(ge,{item:i},o))})})}function ja(e){return e.isolation!==void 0}function va({extensions:e}){const[n,t]=p.useState(!0),r=e.filter(ja);return r.length===0?null:s.jsx(ps,{open:n,onOpenChange:t,trigger:s.jsx("span",{className:"text-muted-foreground text-xs font-semibold tracking-wider uppercase",children:"What its extensions can reach"}),badge:s.jsx(se,{variant:"secondary",className:"text-xs",children:r.length}),children:s.jsx("ul",{className:"space-y-3","data-testid":"preview-extension-reach",children:r.map(a=>s.jsxs("li",{className:"flex min-w-0 items-start gap-2 text-sm",children:[s.jsx(qe,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsx("p",{className:"text-foreground font-mono text-xs break-all",children:s.jsx("bdi",{children:a.id})}),s.jsx(Tn,{permissions:{runtime:a.isolation.runtime,net:a.isolation.net,run:a.isolation.run.map(l=>({name:l})),agents:a.isolation.agents,...a.hasServer!==void 0?{hasServer:a.hasServer}:{}},"data-testid":`preview-extension-reach-${a.id}`})]})]},a.id))})})}function Js({preview:e,installBase:n}){const t=ua(e,{installBase:n}),r=Object.values(t).some(a=>a.length>0);return s.jsxs("div",{className:"space-y-6",children:[r&&s.jsx("p",{className:"text-sm",children:da(e)}),s.jsx(Z,{title:"What this package will do",items:t.effects}),s.jsx(va,{extensions:e.extensions}),s.jsx(Z,{title:"Commands this package declares",items:t.commands,defaultOpen:!0}),s.jsx(Z,{title:"Jobs it will schedule",items:t.schedules,defaultOpen:!0}),s.jsx(Z,{title:"Secrets required",items:t.secrets}),s.jsx(Z,{title:"External hosts",items:t.hosts}),s.jsx(Z,{title:"Dependencies",items:t.dependencies}),s.jsx(Z,{title:"Conflicts",items:t.conflicts,tone:"warning",defaultOpen:!0})]})}function ba(e){if(typeof e=="string")return e;if(e&&typeof e=="object"&&"name"in e)return String(e.name)}function Ys(e){return e.scope===void 0||e.scope==="global"}function _e(e){var n;return Ys(e)?"All agents (global)":e.agentName??((n=e.agentPath)==null?void 0:n.split("/").filter(Boolean).pop())??"This agent"}function ya(e){if(!e)return null;const n=[];return e.commands>0&&n.push(`${e.commands} command${e.commands===1?"":"s"}`),e.skills>0&&n.push(`${e.skills} skill${e.skills===1?"":"s"}`),e.hooks&&n.push("hooks"),n.length>0?n.join(" · "):null}const Na=3e3;function wa(){return s.jsxs("div",{className:"space-y-4",children:[s.jsx(W,{className:"h-4 w-3/4"}),s.jsx(W,{className:"h-4 w-1/2"}),s.jsx(W,{className:"h-20 w-full rounded-lg"}),s.jsx(W,{className:"h-4 w-2/3"})]})}function Fe({icon:e,children:n}){return s.jsxs("div",{className:"bg-muted/50 flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs",children:[s.jsx(e,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:n})]})}function Ca({installation:e,isRemoving:n,isConfirmingUninstall:t,disabled:r,onReinstall:a,onUninstallClick:l,published:i,onUnlink:o,onInstallPublished:d}){const u=Ys(e),c=_e(e),h=u?Ve:ks,f=e.installedAt?new Date(e.installedAt).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):null;return e.devLink?s.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx(h,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:c}),s.jsx(js,{})]}),s.jsx(qs,{installation:e})]})]}),s.jsx("div",{className:"flex flex-wrap items-center justify-end gap-1",children:s.jsx(Hs,{installation:e,published:i,label:c,onUnlink:o,onInstallPublished:d,disabled:r})})]}):s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border p-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx(h,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:c}),e.scope==="override"&&s.jsx("span",{className:"text-3xs shrink-0 rounded-full bg-amber-100 px-1.5 py-0.5 font-medium text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:"Overrides global"})]}),s.jsxs("div",{className:"text-muted-foreground text-xs",children:["v",e.version,f&&` · ${f}`]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsxs(C,{size:"sm",variant:"ghost",disabled:r,onClick:a,"aria-label":`Reinstall for ${c}`,children:[s.jsx(He,{className:"mr-1 size-3","aria-hidden":!0}),"Reinstall"]}),s.jsxs(C,{size:"sm",variant:t?"destructive":"ghost",disabled:r,onClick:l,"aria-label":t?`Uninstall ${c} now`:`Uninstall for ${c}`,className:t?"":"text-destructive hover:text-destructive",children:[s.jsx(vs,{className:"mr-1 size-3","aria-hidden":!0}),n?"Removing…":t?"Uninstall now":"Uninstall"]})]})]})}function Pa({installations:e,uninstallPendingFor:n,anyMutationPending:t,onReinstall:r,onUninstall:a,published:l,onUnlink:i,onInstallPublished:o}){var T,v;const[d,u]=p.useState(null);function c(x){d===x.installPath?(u(null),a(x)):(u(x.installPath),setTimeout(()=>{u(N=>N===x.installPath?null:N)},Na))}const h=e.some(x=>x.type==="shape"),f=ya((T=e.find(x=>x.provides))==null?void 0:T.provides)??(h?"a workspace layout, agents, and schedules":null),w=(v=e.find(x=>x.installedFrom))==null?void 0:v.installedFrom;return s.jsxs("section",{className:"space-y-3",children:[s.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 text-sm font-medium",children:[s.jsx(hs,{className:"size-4 shrink-0","aria-hidden":!0}),e.every(x=>x.devLink)?"Dev link":e.length===1?"Installed":`Installed in ${e.length} locations`]}),s.jsx("div",{className:"space-y-2",role:"list","aria-label":"Installations",children:e.map(x=>s.jsx("div",{role:"listitem",children:s.jsx(Ca,{installation:x,isRemoving:n===x.installPath,isConfirmingUninstall:d===x.installPath,disabled:t,onReinstall:()=>r(x),onUninstallClick:()=>c(x),published:l,onUnlink:()=>i(x),onInstallPublished:N=>o(x,N)})},x.installPath))}),s.jsxs("dl",{className:"text-muted-foreground space-y-1.5 text-xs",children:[w&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(gs,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:["from ",w]})]}),f&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(qe,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:["Provides ",f]})]})]})]})}function Sa(){var b;const{selectedPackageName:e,closeDetail:n}=ke(),t=Ke(),{data:r}=Pe(),a=e?(r??[]).find(y=>y.name===e)??null:null;p.useEffect(()=>{e&&r&&!r.some(y=>y.name===e)&&n()},[e,r,n]);const l=a!==null,i=(a==null?void 0:a.name)??null,{data:o,isLoading:d}=Ct(i,{enabled:l}),{data:u,isLoading:c}=je(),h=a!==null?(u??[]).filter(y=>y.name===a.name):[],f=h.length>0,{data:w}=Pt(i,{enabled:f}),{data:T,isLoading:v,error:x}=Cs(i,{enabled:l&&!f&&!c}),{data:N}=fs(),$=Ks(),k=Vs(),A=d||v||l&&c,D=(T==null?void 0:T.preview)??(o==null?void 0:o.preview),E=ba((o==null?void 0:o.manifest.author)??(a==null?void 0:a.author)),M=o==null?void 0:o.manifest.version,H=o==null?void 0:o.manifest.license,U=a==null?void 0:a.homepage,R=a==null?void 0:a.marketplace;function O(y){a&&t(a,y.agentPath?{agentPath:y.agentPath,agentName:_e(y)}:void 0)}function F(y){a&&$.mutate({name:a.name,options:y.agentPath?{projectPath:y.agentPath}:void 0,where:y.agentPath?_e(y):void 0})}const _=$.isPending&&$.variables?((b=h.find(y=>{var V,j;return(y.agentPath??void 0)===((j=(V=$.variables)==null?void 0:V.options)==null?void 0:j.projectPath)}))==null?void 0:b.installPath)??null:null;return s.jsxs(Dn,{open:a!==null,onOpenChange:y=>!y&&n(),children:[s.jsx(En,{side:"right",className:"flex w-full flex-col overflow-hidden sm:max-w-xl",children:a&&s.jsxs(s.Fragment,{children:[s.jsxs(Ln,{className:"shrink-0 space-y-4 border-b pb-6",children:[s.jsxs("div",{className:"flex items-start gap-4 pr-8",children:[s.jsx("div",{className:"bg-muted flex size-14 shrink-0 items-center justify-center rounded-xl text-3xl",children:a.icon??"📦"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx(An,{className:"text-lg",children:be(a)}),s.jsx(xs,{type:a.type??"plugin",adapterType:a.adapterType,className:"shrink-0"})]}),a.description&&s.jsx(Un,{className:"mt-1.5 line-clamp-3 text-sm",children:a.description})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[M&&s.jsxs(se,{size:"xs",variant:"outline",className:"font-mono",children:["v",M]}),E&&s.jsx(Fe,{icon:On,children:E}),R&&s.jsx(Fe,{icon:Ve,children:R}),H&&s.jsx(Fe,{icon:Nt,children:H})]}),U&&s.jsxs(Fn,{href:U,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5 text-xs transition-colors",children:[s.jsx(Mn,{className:"size-3","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:U})]})]}),s.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto px-4 py-6",children:[A?s.jsx(wa,{}):f?s.jsx(Pa,{installations:w??h,uninstallPendingFor:_,anyMutationPending:$.isPending,onReinstall:O,onUninstall:F,published:a,onUnlink:k.askUnlink,onInstallPublished:k.askInstallPublished}):x?s.jsx(Ps,{error:x}):D?s.jsxs("section",{children:[s.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"What this can do"}),s.jsx(Js,{preview:D,installBase:N==null?void 0:N.dorkHome})]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"No special permissions required."}),!A&&(o==null?void 0:o.readme)&&s.jsxs("section",{children:[s.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"About"}),s.jsx(rt,{content:o.readme,className:"text-sm",errorFallback:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This README couldn’t be displayed."})})]})]}),s.jsxs(zn,{className:"flex-row gap-2 border-t pt-4",children:[s.jsx(C,{variant:"ghost",onClick:n,className:"flex-1",children:"Close"}),f?s.jsx(C,{variant:"outline",disabled:$.isPending,onClick:()=>t(a),className:"flex-1",children:"Install…"}):s.jsx(C,{onClick:()=>t(a),className:"flex-1",children:"Install"})]})]})}),s.jsx(Ss,{target:k.target,onClose:k.close,onUnlinked:k.onUnlinked})]})}function ts(e,n){return e instanceof Error?`Couldn’t install ${n}: ${e.message}`:`Couldn’t install ${n}. Try again.`}function as(e,n,t){var l;const r=e.warnings.length>0?e.warnings.join(" "):void 0;return e.type==="shape"?{id:n,description:r,action:{label:"Apply…",onClick:()=>bs.getState().openShapeSwitcherToShape(e.packageName)}}:Kn(e.type,(l=e.manifest)==null?void 0:l.adapterType)?{id:n,description:r,action:{label:"Open Connections",onClick:()=>t()}}:{id:n,description:r}}function $a(){const e=Rt(),n=_n(),{mutate:t,mutateAsync:r}=e,a=p.useCallback(i=>{const o=K(i.name),d=S.loading(`Installing ${o}…`);t(i,{onSuccess:u=>{S.success(`Installed ${o}`,as(u,d,n))},onError:u=>{S.error(ts(u,o),{id:d})}})},[t,n]),l=p.useCallback(async i=>{const o=K(i.name),d=S.loading(`Installing ${o}…`);try{const u=await r(i);return S.success(`Installed ${o}`,as(u,d,n)),u}catch(u){throw S.error(ts(u,o),{id:d}),u}},[r,n]);return{...e,mutate:a,mutateAsync:l}}function Ia(e,n){return n==="global"?e===void 0||e==="global":e==="agent-local"||e==="override"}function Ra(e){return e.isPending?e.isReinstall?"Reinstalling…":"Installing…":e.hasBlockingConflicts?"Can’t install: conflicts found":e.isReinstall?"Reinstall":"Install"}function Ta(){var V;const e=Ue(j=>j.installConfirmPackage),n=Ue(j=>j.installContext),t=Ue(j=>j.closeInstallConfirm),r=$a(),{data:a}=ys(),l=(a==null?void 0:a.agents)??[],i=(e==null?void 0:e.type)==="shape",o=n?"agent-local":"global",d=n?(V=l.find(j=>j.projectPath===n.agentPath))==null?void 0:V.id:void 0,[u,c]=p.useState(null),h=u!==null&&u.forContext===n?u:null,f=(h==null?void 0:h.scope)??o,w=h===null?d:h.agentId,T=j=>c({forContext:n,scope:j.scope??f,agentId:"agentId"in j?j.agentId:w}),v=i?"global":f,x=l.find(j=>j.id===w),N=v==="agent-local"?x==null?void 0:x.projectPath:void 0,$=v==="agent-local"&&!w,{data:k,isLoading:I,error:A}=Cs((e==null?void 0:e.name)??null,{enabled:e!==null&&!$,...N?{projectPath:N}:{}}),D=$?null:(k==null?void 0:k.preview)??null,{data:E}=fs(),M=N?`${N}/.dork`:E==null?void 0:E.dorkHome,H=D!==null&&D.conflicts.some(j=>j.level==="error"),{data:U}=je(N),R=!$&&(U??[]).some(j=>j.name===(e==null?void 0:e.name)&&Ia(j.scope,v)),O=!$&&A!==null,F=r.isPending||I||O||H||e===null||$,_=Ra({isPending:r.isPending,isReinstall:R,hasBlockingConflicts:H});async function b(){if(e)try{const j={...N&&{projectPath:N},...(k==null?void 0:k.disclosed)&&{approvedDisclosure:k.disclosed,approvedContentHash:k.contentHash}};await r.mutateAsync({name:e.name,options:Object.keys(j).length>0?j:void 0}),t()}catch{}}function y(j){j||t()}return s.jsx($e,{open:e!==null,onOpenChange:y,children:s.jsx(Ie,{className:"max-h-[85vh] !min-h-0 sm:max-w-2xl",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs(Re,{className:"shrink-0",children:[s.jsxs(Te,{children:[R?"Reinstall":"Install"," ",be(e),"?"]}),s.jsx(De,{children:R?"This replaces the installed copy. Check what it does below.":"Check what this package does before you install it."})]}),s.jsx("div",{className:"shrink-0 space-y-2 px-4 sm:px-6",children:i?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Shapes apply to your whole app."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:"Install for"}),s.jsxs(Ns,{value:f,onValueChange:j=>{const Q=j;T(Q==="global"?{scope:Q,agentId:void 0}:{scope:Q})},className:"gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ne,{value:"global",id:"scope-global"}),s.jsx(ee,{htmlFor:"scope-global",className:"text-sm font-normal",children:"All agents (global)"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ne,{value:"agent-local",id:"scope-agent"}),s.jsx(ee,{htmlFor:"scope-agent",className:"text-sm font-normal",children:"Specific agent"})]})]}),f==="agent-local"&&s.jsx("div",{className:"pl-6",children:s.jsx(Rs,{agents:l,value:w,onValueChange:j=>T({agentId:j})})})]})}),s.jsxs(Ee,{className:"mt-4",children:[$&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"Pick an agent to preview this install."}),I&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading preview…"}),O&&s.jsx(Ps,{error:A}),D&&s.jsx(Js,{preview:D,installBase:M})]}),s.jsxs(Le,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:t,disabled:r.isPending,children:"Cancel"}),s.jsx(C,{onClick:b,disabled:F,children:_})]})]})})})}function Da(e){return new Map((e??[]).map(n=>[n.installPath,n]))}function rs(e){return e.startsWith("v")?e.slice(1):e}function Xs(e,n){const t=n.get(e.installPath);if(t)return t.installedVersionSource!=="package"||rs(t.installedVersion)===rs(e.version)?t:void 0}function Ea(e,n,t){const r=Xs(e,n);return t.applying.has(e.installPath)?{kind:"applying",check:r}:t.isChecking?{kind:"checking"}:r?{kind:r.status,check:r}:{kind:"unchecked"}}function La(e,n){const t={available:[],current:0,unknown:0};for(const r of e){if(r.devLink)continue;const a=Xs(r,n);(a==null?void 0:a.status)==="update-available"?t.available.push({installation:r,check:a}):(a==null?void 0:a.status)==="current"?t.current+=1:(a==null?void 0:a.status)==="unknown"&&(t.unknown+=1)}return t}const Aa=7;function X(e,n){return n==="commit"?e.slice(0,Aa):e.startsWith("v")?e:`v${e}`}function ce(e){var n;return e.scope!=="agent-local"&&e.scope!=="override"?null:e.agentName??((n=e.agentPath)==null?void 0:n.split("/").filter(Boolean).pop())??"agent"}function Ua(e){var n,t;return((t=(n=e.applied)==null?void 0:n.fileNotices)==null?void 0:t.some(r=>r.outcome==="kept-unproven"))??!1}function Zs({installation:e}){const n=K(e.name),t=ce(e);return t?`${n} on ${t}`:n}function Oa(e,n){if(n!=null&&n.applied){const t=Ms(n),r=X(t.installedVersion,t.installedVersionSource),a=n.applied.warnings??[];return{kind:"success",message:`Updated ${e} to ${r}`,...a.length>0&&{description:a.join(" ")}}}if(n!=null&&n.applyError)return{kind:"error",message:`Couldn’t update ${e}: ${n.applyError}`};if((n==null?void 0:n.status)==="current")return{kind:"success",message:`${e} is already up to date`};if((n==null?void 0:n.status)==="unknown"){const t=n.note?`: ${n.note}`:"";return{kind:"warning",message:`Couldn’t check ${e} for updates${t}`}}return{kind:"warning",message:`${e} wasn’t updated`}}function Fa(e){const n=e.length,t=e.filter(a=>a.applied).length,r=e.filter(a=>a.applyError).length;return t===n?{kind:"success",message:e.some(Ua)?`Updated ${n} packages. Some kept files need sorting; see their rows.`:`Updated ${n} packages`}:t>0?{kind:"warning",message:`Updated ${t} of ${n} packages. Each row shows why.`}:r>0?{kind:"error",message:`Couldn’t update ${r===n?`${n}`:`${r} of ${n}`} packages. Each row shows why.`}:e.every(a=>a.status==="current")?{kind:"success",message:`All ${n} packages are up to date`}:{kind:"warning",message:"Nothing was updated. Each row shows why."}}function Ma(e,n){const t=new Map(n.checks.map(r=>[r.installPath,r]));if(e.length===1){const r=e[0];return Oa(Zs(r),t.get(r.check.installPath))}return Fa(e.map(({check:r})=>t.get(r.installPath)??r))}function za(e,n){S[e.kind](e.message,{id:n,...e.description&&{description:e.description}})}const _a="batch_update_needs_approval",Ka="disclosure_changed";function Va(e,n){const t=e==null?void 0:e.code;return t===Ka?`${n.length===1?"This package":"One of these packages"} changed what it runs since you looked. Review it again.`:t===_a?n.length===1?`It needs your approval. Run \`dorkos marketplace update ${n[0].check.packageName} --apply\` in a terminal.`:"Each needs your approval. Run `dorkos marketplace update <name> --apply` in a terminal.":e instanceof Error?e.message:String(e)}function qa(){const{mutateAsync:e}=Et(),n=p.useRef(new Set);return{apply:p.useCallback(r=>{const a=r.filter(({check:c})=>!n.current.has(c.installPath)),[l,...i]=a.map(({check:c})=>({installPath:c.installPath,latestVersion:c.latestVersion,disclosed:c.disclosed??null,contentHash:c.contentHash??""}));if(l===void 0)return;const o=a.map(({check:c})=>c.installPath);for(const c of o)n.current.add(c);const d=a.length===1?Zs(a[0]):`${a.length} packages`,u=S.loading(`Updating ${d}…`);e({targets:[l,...i]}).then(c=>za(Ma(a,c),u)).catch(c=>S.error(`Couldn’t update ${d}`,{id:u,description:Va(c,a)})).finally(()=>{for(const c of o)n.current.delete(c)})},[e])}}function Ha(){const e=Dt(),{mutate:n}=e,t=p.useCallback(({where:r,...a})=>{const l=r?`${K(a.name)} on ${r}`:K(a.name),i=S.loading(`Checking the files of ${l}…`);n(a,{onSuccess:o=>{(o.outcome==="rebuilt"||o.outcome==="not-needed"?S.success:S.warning)(o.message,{id:i})},onError:o=>{S.error(`Couldn’t check the files of ${l}: ${o.message}`,{id:i})}})},[n]);return{...e,mutate:t}}function Ba(){const e=Ot(),{mutate:n}=e,t=p.useCallback(r=>{n(r,{onSuccess:a=>{S.success(a.message)},onError:a=>{S.error(a.message)}})},[n]);return{...e,mutate:t}}function en(){const e=ae(),{data:n}=je(),t=((n==null?void 0:n.length)??0)>0,r=It(void 0,{enabled:t}),{data:a,isFetching:l,error:i,refetch:o}=r,d=p.useRef(n);p.useEffect(()=>{const h=d.current;d.current=n,!(h===void 0||h===n)&&e.invalidateQueries({queryKey:P.updates(),refetchType:"none"})},[n,e]);const u=p.useMemo(()=>Da(i||a==null?void 0:a.checks),[a,i]),c=p.useMemo(()=>La(n??[],u),[n,u]);return{checks:u,summary:c,isChecking:l,error:i,recheck:()=>void o()}}function sn(e){const n=p.useRef(null),t=p.useRef(!1);p.useEffect(()=>{var l;if(e||!t.current)return;t.current=!1;const a=document.activeElement;(a===null||a===document.body)&&((l=n.current)==null||l.focus())},[e]);const r=p.useMemo(()=>({onFocus:()=>{t.current=!0},onBlur:a=>{a.relatedTarget!==null&&(t.current=!1)}}),[]);return{targetRef:n,controlProps:r}}function Wa(e){return e===1?"1 package is":`${e} packages are`}function Qa(e){return`${e} ${e===1?"package":"packages"}`}function Ga(e){const n=[];return e.current>0&&n.push(`${Wa(e.current)} up to date.`),e.unknown>0&&n.push(`${Qa(e.unknown)} couldn’t be checked.`),n}function Ja(e){const n=e.available.length;return n>0?{headline:`${n} ${n===1?"update":"updates"} available.`,allCurrent:!1}:e.current>0&&e.unknown===0?{headline:"All packages are up to date.",allCurrent:!0}:e.current===0&&e.unknown===0?{headline:"Not checked for updates yet.",allCurrent:!1}:{headline:"No updates found.",allCurrent:!1}}function Ya({summary:e,isChecking:n,error:t,isApplying:r,onUpdateAll:a,onRecheck:l}){const{headline:i,allCurrent:o}=Ja(e),d=o?[]:Ga(e),u=!n&&!t&&e.available.length>0,{targetRef:c,controlProps:h}=sn(u);return s.jsxs("div",{className:"bg-muted/40 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 rounded-xl px-4 py-3",children:[s.jsx("p",{ref:c,tabIndex:-1,role:"status","aria-live":"polite",className:"focus-visible:ring-ring min-w-0 rounded-sm text-sm outline-none focus-visible:ring-2",children:n?s.jsxs("span",{className:"text-muted-foreground flex items-center gap-2",children:[s.jsx(Me,{size:"xs"}),"Checking your packages for updates…"]}):t?s.jsxs("span",{children:["Couldn’t check for updates: ",t.message]}):s.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[o&&s.jsx(ws,{className:"text-status-success-fg size-4 shrink-0","aria-hidden":!0}),s.jsx("span",{className:e.available.length>0?"font-medium":void 0,children:i}),d.map(f=>s.jsx("span",{className:"text-muted-foreground",children:f},f))]})}),!n&&s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(C,{size:"sm",variant:"ghost",onClick:l,disabled:r,children:[s.jsx(He,{className:"mr-1 size-3","aria-hidden":!0}),t?"Try again":"Check again"]}),u&&s.jsx(C,{size:"sm","aria-disabled":r||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50",onClick:r?void 0:a,...h,children:"Update all…"})]})]})}const le="flex items-start gap-1.5 text-xs",ie="mt-0.5 size-3 shrink-0";function ls({text:e}){return s.jsx("p",{className:"text-muted-foreground pl-4.5 text-xs",children:e})}function Xa({state:e}){switch(e.kind){case"checking":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Me,{size:"xs",className:ie}),"Checking for updates…"]});case"applying":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Me,{size:"xs",className:ie}),e.check?`Updating to ${X(e.check.latestVersion,e.check.latestVersionSource)}…`:"Updating…"]});case"update-available":{const{check:n}=e,t=X(n.installedVersion,n.installedVersionSource),r=X(n.latestVersion,n.latestVersionSource);return s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("p",{className:`${le} text-status-info-fg font-medium`,children:[s.jsx(jt,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Update available: ",t," ",s.jsx("span",{"aria-hidden":!0,children:"→"}),s.jsx("span",{className:"sr-only",children:"to"})," ",r]})]}),n.note&&s.jsx(ls,{text:n.note}),n.applyError&&s.jsxs("p",{className:`${le} text-destructive`,children:[s.jsx(me,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Couldn’t update: ",n.applyError]})]})]})}case"current":return s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(ws,{className:ie,"aria-hidden":!0}),"Up to date"]}),e.check.note&&s.jsx(ls,{text:e.check.note})]});case"unknown":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Vn,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Couldn’t check for updates",e.check.note?`: ${e.check.note}`:""]})]});case"unchecked":return null}}const Za="Check files so updates keep your edits.";function er(e,n){return e===1?`the file you ${n}`:`the ${e} files you ${n}`}function nn(e){return[e.changed.length>0&&`Updating replaces ${er(e.changed.length,"edited")} and keeps your copies beside them.`,e.added.length>0&&(e.added.length===1?"The file you added stays.":`The ${e.added.length} files you added stay.`),e.missing.length>0&&(e.missing.length===1?"The file you removed comes back.":`The ${e.missing.length} files you removed come back.`)].filter(n=>typeof n=="string")}function sr(e){if(e.changed.length>0)return"Updating replaces your edits; copies are kept.";if(e.missing.length>0)return"Updating puts back files you removed.";if(e.added.length>0)return"Updating keeps the files you added."}function nr(e){const t=[[e.changed.length,"edited"],[e.added.length,"added"],[e.missing.length,"removed"]].filter(([i])=>i>0),r=t.reduce((i,[o])=>i+o,0),a=e.truncated?"+":"",l=`${r}${a} ${r===1?"file":"files"} changed since install`;return t.length>1?`${l} (${t.map(([i,o])=>`${i} ${o}`).join(", ")})`:l}function tn(e){return(e==null?void 0:e.status)==="unknown"&&(e.reason==="no-record"||e.reason==="inferred")}function tr(e){var r,a;const n=tn(e)?e.check:(e==null?void 0:e.status)==="clean"||(e==null?void 0:e.status)==="modified"?(r=e.unproven)==null?void 0:r.check:void 0;if(!n||n.source==="local")return!1;const t=(a=n.last)==null?void 0:a.outcome;return t!=="mismatch"&&t!=="no-source"}function ar(e){var n;return e.check.source==="local"||((n=e.check.last)==null?void 0:n.outcome)==="fetch-failed"}function ne({title:e,paths:n}){return n.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-3xs font-medium tracking-wide uppercase",children:e}),s.jsx("ul",{"aria-label":e,className:"mt-0.5 space-y-0.5",children:n.map(t=>s.jsx("li",{className:"font-mono text-xs [overflow-wrap:anywhere]",children:t},t))})]})}function rr({unproven:e,label:n,onKeepFiles:t}){const r=e.files.length,a=e.running,l=a.length>0,i=e.check.source==="local",o=e.files.filter(d=>!a.includes(d));return s.jsxs("details",{"data-testid":"installation-integrity-unproven","data-runs":l?"true":"false",className:"group/kept mt-1 text-xs",children:[s.jsxs("summary",{className:oe("focus-ring flex cursor-pointer list-none items-start gap-1 rounded-sm select-none [&::-webkit-details-marker]:hidden",l?"text-amber-700 hover:text-amber-800 dark:text-amber-400 dark:hover:text-amber-300":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Ts,{className:"mt-0.5 size-3 shrink-0 text-amber-600 dark:text-amber-400","aria-hidden":!0}),s.jsxs("span",{children:["Kept ",r," ",r===1?"file":"files"," an update couldn’t sort.",l&&` ${a.length} of ${r===1?"it":"them"} still ${a.length===1?"runs":"run"}.`]}),s.jsx(Se,{className:"mt-0.5 size-3 shrink-0 transition-transform duration-200 group-open/kept:rotate-90","aria-hidden":!0})]}),s.jsxs("div",{className:"text-muted-foreground mt-1.5 space-y-1.5 pl-4",children:[s.jsx("p",{children:"Unclear if these are yours or leftovers, so DorkOS kept them."}),s.jsx("p",{children:i?"Keep them as yours, or delete any you don’t need.":"Check files sets aside the leftovers and keeps yours."}),e.check.last&&s.jsx("p",{children:e.check.last.message}),s.jsx(ne,{title:"Still runs",paths:a}),s.jsx(ne,{title:"Kept",paths:o}),t&&ar(e)&&s.jsx(C,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",onClick:t,"aria-label":`Keep the files ${n??"this package"} kept as mine`,children:"Keep these as mine"})]})]})}function lr(e){const{integrity:n}=e,t=(n==null?void 0:n.status)==="clean"||(n==null?void 0:n.status)==="modified"?n.unproven:void 0;return t?s.jsxs(s.Fragment,{children:[s.jsx(is,{...e}),s.jsx(rr,{unproven:t,label:e.label,onKeepFiles:e.onKeepFiles})]}):s.jsx(is,{...e})}function is({integrity:e,updateAvailable:n,label:t,onCheckFiles:r,isCheckingFiles:a=!1}){var l,i;if((e==null?void 0:e.status)==="modified"){const o=n?nn(e):[],d=n?sr(e):void 0;return s.jsxs("details",{"data-testid":"installation-integrity",className:"group/files mt-1 text-xs",children:[s.jsxs("summary",{className:"text-muted-foreground hover:text-foreground focus-ring flex cursor-pointer list-none items-start gap-1 rounded-sm select-none [&::-webkit-details-marker]:hidden",children:[s.jsx(xt,{className:"text-status-warning-dot mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{className:"flex flex-col",children:[s.jsxs("span",{children:[nr(e),"."]}),d&&s.jsx("span",{"data-testid":"installation-integrity-update",children:d})]}),s.jsx(Se,{className:"mt-0.5 size-3 shrink-0 transition-transform duration-200 group-open/files:rotate-90","aria-hidden":!0})]}),s.jsxs("div",{className:"text-muted-foreground mt-1.5 space-y-1.5 pl-4",children:[o.map(u=>s.jsx("p",{children:u},u)),s.jsx(ne,{title:"Edited",paths:e.changed}),s.jsx(ne,{title:"Added",paths:e.added}),s.jsx(ne,{title:"Removed",paths:e.missing}),e.truncated&&s.jsx("p",{children:"Showing the first 50 of each."})]})]})}if(tn(e)){const o=((l=e.check)==null?void 0:l.source)==="local",d=(i=e.check)==null?void 0:i.last,u=o?"Installed from a folder by an older DorkOS. Reinstall so updates keep your edits.":d?d.message:`Installed by an older DorkOS. ${Za}`,c=!o&&(d==null?void 0:d.outcome)==="mismatch"&&r;return s.jsxs("p",{"data-testid":"installation-integrity",className:"text-muted-foreground mt-1 flex items-start gap-1 text-xs",children:[s.jsx(Ts,{className:"text-status-warning-dot mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:[u,c&&s.jsxs(s.Fragment,{children:[" ",s.jsx("button",{type:"button",onClick:r,disabled:a,"aria-label":`Check the files of ${t??"this package"} again`,className:"text-foreground focus-ring rounded-sm underline underline-offset-2 disabled:opacity-50",children:a?"Checking…":"Try again"})]})]})]})}return null}function os(e){if(e.length!==1)return`${e.length} packages`;const[{installation:n}]=e,t=ce(n),r=K(n.name);return t?`${r} on ${t}`:r}function an({check:e}){return e.disclosed?fa(e.disclosed,e.installedDisclosed,e.scope==="global"?"global":"project"):[]}function ir(e){const n=e.map(an),t=n.filter(i=>i.length>0).length,r=n.filter(i=>i.some(o=>o.change==="new"||o.change==="changed")).length,a=e.length===1?t===1?"The new version runs things on its own":"The new version runs nothing on its own":`${t} of ${e.length} run things on their own`;if(r===0)return a;const l=e.length===1?"it adds or changes something":`${r} ${r===1?"adds":"add"} or ${r===1?"changes":"change"} something`;return`${a} · ${l}`}function or({change:e}){return e!=="new"&&e!=="changed"?null:s.jsx(se,{variant:"outline",className:"text-3xs shrink-0 border-amber-500/60 text-amber-700 dark:text-amber-300",children:e==="new"?"New":"Changed"})}function cs({row:e,change:n,previous:t}){return s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("ul",{children:s.jsx(ge,{item:e})}),t&&s.jsxs("div",{className:"mt-1 pl-6 opacity-70",children:[s.jsx("p",{className:"text-muted-foreground text-3xs mb-0.5 font-medium tracking-wide uppercase",children:"Installed now"}),s.jsx("ul",{"aria-label":"What the installed version runs instead",children:s.jsx(ge,{item:{...t,description:void 0,details:void 0}})})]})]}),s.jsx(or,{change:n})]})}function cr(e){const n=an(e);if(n.length===0)return s.jsx("p",{className:"text-muted-foreground text-xs",children:"The new version runs nothing on its own."});const t=n.filter(a=>a.change!=="unchanged"),r=n.filter(a=>a.change==="unchanged");return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The new version runs ",n.length===1?"this":`these ${n.length}`," on its own:"]}),s.jsxs("div",{role:"list","aria-label":"What the new version runs",className:"space-y-2",children:[t.map((a,l)=>s.jsx("div",{role:"listitem",children:s.jsx(cs,{...a})},`lead-${l}`)),r.length>0&&s.jsxs("details",{className:"group/unchanged",role:"listitem",children:[s.jsxs("summary",{className:"text-muted-foreground hover:text-foreground focus-ring inline-flex cursor-pointer list-none items-center gap-1 rounded-sm text-xs select-none [&::-webkit-details-marker]:hidden",children:[s.jsx(Se,{className:"size-3 shrink-0 transition-transform duration-200 group-open/unchanged:rotate-90"}),r.length," unchanged"]}),s.jsx("div",{className:"mt-2 space-y-2",children:r.map((a,l)=>s.jsx(cs,{...a},`same-${l}`))})]})]})]})}function dr({integrity:e,...n}){const{installation:t,check:r}=n,a=ce(t),l=X(r.installedVersion,r.installedVersionSource),i=X(r.latestVersion,r.latestVersionSource);return s.jsxs("li",{className:"bg-muted/40 space-y-2 rounded-lg px-3 py-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:K(t.name)}),s.jsx("div",{className:"text-muted-foreground text-xs",children:a??"All agents"}),a&&t.agentPath&&s.jsx("div",{className:"text-muted-foreground text-2xs font-mono [overflow-wrap:anywhere]",children:Gs(t.agentPath)})]}),s.jsxs("div",{className:"shrink-0 font-mono text-xs",children:[l," ",s.jsx("span",{"aria-hidden":!0,children:"→"}),s.jsx("span",{className:"sr-only",children:"to"})," ",i]})]}),(e==null?void 0:e.status)==="modified"&&nn(e).map(o=>s.jsx("p",{className:"text-muted-foreground text-xs",children:o},o)),s.jsx(cr,{...n})]})}function ur({stale:e,onCancel:n,onConfirm:t,integrityByPath:r}){return s.jsx($e,{open:e!==null,onOpenChange:a=>!a&&n(),children:s.jsx(Ie,{className:"max-h-[85vh] !min-h-0 sm:max-w-xl",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs(Re,{className:"shrink-0 text-left",children:[s.jsxs(Te,{className:"text-left",children:["Update ",os(e),"?"]}),s.jsx(De,{className:"text-left",children:e.length===1?"The newest version replaces this one in place. Check what it runs first.":"Each newest version replaces the one installed. Check what each runs first."}),s.jsx("p",{className:"text-foreground text-left text-xs font-medium","data-testid":"update-disclosure-summary",children:ir(e)})]}),s.jsx(Ee,{children:s.jsx("ul",{"aria-label":"Packages to update",className:"space-y-2",children:e.map(a=>s.jsx(dr,{...a,integrity:r==null?void 0:r.get(a.installation.installPath)},a.check.installPath))})}),s.jsxs(Le,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:n,children:"Cancel"}),s.jsxs(C,{onClick:()=>t(e),children:["Update ",os(e)]})]})]})})})}function mr(e){return e!==null&&e.heldBack!==void 0&&(e.scope===void 0||e.scope==="global")}function hr({installation:e,unproven:n,onCancel:t,onConfirm:r}){var T;const a=mr(e),l=Ut(a),i=a?(T=l.data)==null?void 0:T.find(v=>v.name===(e==null?void 0:e.name)):void 0,o=i!=null&&i.effects&&i.bindsTo?{effects:i.effects,bindsTo:i.bindsTo}:void 0,d=a&&l.isPending,u=e!==null&&n!==void 0,c=e?K(e.name):"",h=(n==null?void 0:n.running)??[],f=(n==null?void 0:n.files.filter(v=>!h.includes(v)))??[],w=o?Be(o.effects,"global"):[];return s.jsx($e,{open:u,onOpenChange:v=>!v&&t(),children:s.jsx(Ie,{className:"max-h-[85vh] !min-h-0 sm:max-w-lg",children:u&&e&&n&&s.jsxs(s.Fragment,{children:[s.jsxs(Re,{className:"shrink-0 text-left",children:[s.jsxs(Te,{className:"text-left",children:["Keep these ",c," files as yours?"]}),s.jsx(De,{className:"text-left",children:"An update couldn’t tell if these are yours or leftovers."})]}),s.jsxs(Ee,{className:"space-y-3 text-xs",children:[s.jsxs("div",{className:"text-muted-foreground space-y-1",children:[s.jsx("p",{children:n.check.source==="local"?"No earlier version to compare with.":"DorkOS couldn’t download the old version to compare."}),s.jsx("p",{children:"Keeping makes them yours. Updates leave them alone."}),s.jsx("p",{children:"Nothing is moved or deleted."}),h.length>0&&s.jsx("p",{children:"They now run as your own files."})]}),s.jsx(ne,{title:"Still runs",paths:h}),s.jsx(ne,{title:"Kept",paths:f}),a&&s.jsx("div",{"data-testid":"keep-files-activation",className:"space-y-1.5",children:d?s.jsxs("p",{className:"text-muted-foreground",children:["Reading what ",c," runs…"]}):o?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-foreground font-medium",children:[c," is held back from chats."]}),s.jsx("p",{className:"text-foreground",children:"Keeping also lets it run in every chat, as it is now:"}),s.jsx("ul",{"aria-label":`What ${c} runs`,className:"space-y-1.5",children:w.map((v,x)=>s.jsx(ge,{item:v},x))})]}):s.jsxs("p",{className:"text-muted-foreground",children:[c," stays held back until you review it."]})})]}),s.jsxs(Le,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:t,children:"Cancel"}),s.jsx(C,{disabled:d,onClick:()=>r({installRoot:e.installPath,keepKey:n.keepKey,...e.agentPath&&{projectPath:e.agentPath},...o&&{review:o}}),children:o?"Keep them and let it run":"Keep them as mine"})]})]})})})}const pr="dev_link_changed",fe={card:null,refusal:null,checking:!1};function ds(e){const n=e;return{message:(n==null?void 0:n.message)||"Couldn’t check this folder. Try again.",code:n==null?void 0:n.code}}function fr({open:e,onOpenChange:n}){var z;const[t,r]=p.useState(""),[a,l]=p.useState("global"),[i,o]=p.useState(void 0),[d,u]=p.useState(!1),[c,h]=p.useState(fe),[f,w]=p.useState(!1),[T,v]=p.useState(null),[x,N]=p.useState(null),[$,k]=p.useState(!1),I=p.useRef(0),A=mt(),D=ht(),{data:E}=ys({enabled:e}),M=(E==null?void 0:E.agents)??[],H=a==="agent-local"?(z=M.find(g=>g.id===i))==null?void 0:z.projectPath:void 0,U=a==="agent-local"&&H===void 0;function R(){I.current+=1,n(!1)}async function O(g){const q=(g.path??t).trim(),G="projectPath"in g?g.projectPath:H,J=g.replaceInstalled??!1;u(J),N(null),v(null),g.keepChangedNotice||w(!1);const he=++I.current,rn=!("projectPath"in g)&&U;if(q===""||rn){h(fe);return}h(pe=>({card:g.keepCard?pe.card:null,refusal:null,checking:!0}));try{const pe=await A.mutateAsync({path:q,...G?{scope:"project",projectPath:G}:{scope:"global"},...J&&{replaceInstalled:!0}});if(he!==I.current)return;h({card:{preview:pe,replaceInstalled:J,projectPath:G},refusal:null,checking:!1})}catch(pe){if(he!==I.current)return;h({card:null,refusal:ds(pe).message,checking:!1})}}function F(g){c.card&&O({path:c.card.preview.path,projectPath:c.card.projectPath,replaceInstalled:g,keepCard:!0})}async function _(){if(!c.card||c.checking)return;N(null);const{preview:g,replaceInstalled:q,projectPath:G}=c.card;try{const J=await D.mutateAsync({path:g.path,...G?{scope:"project",projectPath:G}:{scope:"global"},...q&&{replaceInstalled:!0},via:"app",expectedChange:g.change});if(J.status==="approval_required"){v(J.approval);return}S.success(`${K(g.name)} runs from your folder.`),R()}catch(J){const he=ds(J);if(he.code===pr){w(!0),await O({path:g.path,projectPath:G,replaceInstalled:q,keepChangedNotice:!0});return}N(he.message)}}const b=c.card,y=(b==null?void 0:b.preview.replaces)??null,V=b?K(b.preview.name):"",j=b!=null&&b.preview.effects?Be(b.preview.effects,b.projectPath?"project":"global"):[],Q=(b==null?void 0:b.preview.extensions)??[],m=y===null||d&&(b==null?void 0:b.replaceInstalled)===!0,L=b===null||c.checking||!m||D.isPending||T!==null;return s.jsxs($e,{open:e,onOpenChange:g=>g?n(!0):R(),children:[s.jsxs(Ie,{className:"max-h-[85vh] !min-h-0 sm:max-w-lg",children:[s.jsxs(Re,{className:"shrink-0 text-left",children:[s.jsx(Te,{className:"text-left",children:b?`Run ${V} from this folder?`:"Link a folder"}),s.jsx(De,{className:"text-left",children:"Run a plugin or skill pack from your own folder."})]}),s.jsxs(Ee,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{htmlFor:"dev-link-path",children:"Folder"}),s.jsx(gt,{id:"dev-link-path",value:t,placeholder:"/Users/you/code/my-plugin",onChange:g=>{r(g),c!==fe&&(I.current+=1,h(fe),u(!1))},onBlur:()=>void O({}),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),O({}))},onBrowse:()=>k(!0),browseTestId:"dev-link-browse","aria-describedby":c.refusal?"dev-link-refusal":void 0,"aria-invalid":c.refusal?!0:void 0,autoComplete:"off",spellCheck:!1}),c.refusal&&s.jsx("p",{id:"dev-link-refusal",role:"alert",className:"text-status-warning-fg text-xs [overflow-wrap:anywhere]",children:c.refusal}),s.jsx("p",{className:"text-muted-foreground text-xs empty:hidden","aria-live":"polite",children:c.checking?"Checking the folder…":""})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:"Run for"}),s.jsxs(Ns,{value:a,onValueChange:g=>{const q=g;l(q),q==="global"?(o(void 0),O({projectPath:void 0})):(I.current+=1,h(fe),u(!1))},className:"gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ne,{value:"global",id:"dev-link-scope-global"}),s.jsx(ee,{htmlFor:"dev-link-scope-global",className:"text-sm font-normal",children:"All agents (global)"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ne,{value:"agent-local",id:"dev-link-scope-agent"}),s.jsx(ee,{htmlFor:"dev-link-scope-agent",className:"text-sm font-normal",children:"Specific agent"})]})]}),a==="agent-local"&&s.jsx("div",{className:"pl-6",children:s.jsx(Rs,{agents:M,value:i,onValueChange:g=>{var q;o(g),O({projectPath:(q=M.find(G=>G.id===g))==null?void 0:q.projectPath})}})}),U&&t.trim()!==""&&s.jsx("p",{className:"text-muted-foreground text-xs",children:"Pick an agent to check this folder."})]}),f&&s.jsx(ze,{tone:"info",role:"alert",children:"The folder changed. Check it again."}),b&&s.jsxs("section",{"aria-label":"What linking does",className:"space-y-3 text-sm",children:[s.jsx("code",{className:"bg-muted block rounded px-2 py-1.5 font-mono text-xs [overflow-wrap:anywhere]",children:b.preview.path}),s.jsx("p",{children:"Edits here run in DorkOS right away, without asking."}),y&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{children:["Your installed copy (v",y.version,") is set aside, not deleted."]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(qn,{id:"dev-link-replace",checked:d,onCheckedChange:g=>{c.checking||F(g===!0)},"aria-disabled":c.checking||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50"}),s.jsx(ee,{htmlFor:"dev-link-replace",className:"text-sm leading-snug font-normal",children:"Use my folder instead of the installed copy"})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"font-medium",children:"It runs:"}),j.length===0&&Q.length===0?s.jsx("p",{className:"text-muted-foreground",children:"Nothing on its own."}):s.jsxs("ul",{"aria-label":`What ${V} runs`,className:"space-y-1.5",children:[Q.map(g=>s.jsxs("li",{className:"text-sm [overflow-wrap:anywhere]",children:["Extension ",g]},g)),j.map((g,q)=>s.jsx(ge,{item:g},q))]})]})]}),T&&s.jsx(ze,{tone:"info",role:"status",children:"Approve it where DorkOS asks. This dialog can close."}),x&&s.jsx("p",{role:"alert",className:"text-status-warning-fg text-xs [overflow-wrap:anywhere]",children:x})]}),s.jsxs(Le,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:R,disabled:D.isPending,children:"Cancel"}),s.jsx(C,{onClick:()=>void _(),disabled:L,children:D.isPending?"Linking…":"Link folder"})]})]}),$&&s.jsx(Hn,{open:!0,onOpenChange:k,initialPath:t.trim()||null,onSelect:g=>{r(g),k(!1),O({path:g})}})]})}function xr({heldBack:e,label:n,onReviewClick:t,isRaisingReview:r}){return s.jsxs("div",{className:"text-status-warning-fg mt-1.5 flex flex-col items-start gap-1.5 text-xs sm:flex-row sm:gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Bn,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:e.note})]}),e.reviewable&&s.jsx(C,{size:"sm",variant:"outline",className:"ml-5 h-6 shrink-0 px-2 text-xs sm:ml-0",onClick:t,disabled:r,"aria-label":`Review ${n}`,children:r?"Asking…":"Review"})]})}function gr({state:e,label:n,onClick:t,focusProps:r}){if(e.kind!=="update-available"&&e.kind!=="applying")return null;const a=e.kind==="applying",{check:l}=e,i=l&&X(l.installedVersion,l.installedVersionSource),o=l&&X(l.latestVersion,l.latestVersionSource);return s.jsxs(C,{size:"sm",variant:"outline","aria-disabled":a||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50",onClick:a?void 0:t,"aria-label":a?`Updating ${n}`:`Update ${n} from ${i} to ${o}`,...r,children:[s.jsx(He,{className:`mr-1 size-3 ${a?"animate-spin motion-reduce:animate-none":""}`,"aria-hidden":!0}),a?"Updating…":`Update to ${o}`]})}function kr(e){return(e==null?void 0:e.status)==="clean"||(e==null?void 0:e.status)==="modified"?e.unproven:void 0}function jr({installation:e,isActiveShape:n,isConfirmingUninstall:t,isUninstalling:r,updateState:a,integrity:l,isCheckingFiles:i,onCheckFilesClick:o,onKeepFilesClick:d,onApplyClick:u,onUpdateClick:c,onUninstallClick:h,onReviewClick:f,isRaisingReview:w,published:T,onUnlinkClick:v,onInstallPublishedClick:x}){const{name:N,version:$,type:k,scope:I,installedFrom:A,installedAt:D,adapterType:E}=e,M=e.dependencyWarnings??[],H=k==="shape",U=e.devLink!==void 0,R=K(N),O=D?new Date(D).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):null,F=ce(e),_=F?`${R} on ${F}`:R,{targetRef:b,controlProps:y}=sn(a.kind==="update-available"||a.kind==="applying");return s.jsxs("div",{className:"bg-card flex flex-col gap-3 rounded-xl border p-4 @2xl:flex-row @2xl:items-center @2xl:justify-between @2xl:gap-4 @2xl:p-6",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold",children:R}),s.jsx(xs,{type:k,adapterType:E}),U&&s.jsx(js,{}),e.heldBack&&s.jsx(se,{variant:"outline",className:"border-amber-500/60 text-amber-700 dark:text-amber-300",children:"Held back"}),n&&s.jsx(se,{variant:"secondary",children:"Active"}),s.jsxs(se,{variant:"outline",className:"font-mono",children:["v",$]}),I==="agent-local"&&s.jsx("span",{className:"text-3xs rounded-full bg-blue-100 px-1.5 py-0.5 font-medium text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:"Local"}),I==="override"&&s.jsx("span",{className:"text-3xs rounded-full bg-amber-100 px-1.5 py-0.5 font-medium text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:"Overrides global"})]}),s.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs",children:[F&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ks,{className:"size-3","aria-hidden":!0}),F]}),A&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(gs,{className:"size-3","aria-hidden":!0}),A]}),O&&s.jsxs("span",{children:["Installed ",O]})]}),U?s.jsx(qs,{installation:e}):s.jsx("div",{ref:b,tabIndex:-1,"data-testid":"installation-update-status",className:"focus-visible:ring-ring mt-1.5 rounded-sm outline-none focus-visible:ring-2",children:s.jsx(Xa,{state:a})}),e.heldBack&&s.jsx(xr,{heldBack:e.heldBack,label:_,onReviewClick:f,isRaisingReview:w}),!U&&s.jsx(lr,{integrity:l,updateAvailable:a.kind==="update-available"||a.kind==="applying",label:_,onCheckFiles:o,isCheckingFiles:i,onKeepFiles:d}),M.length>0&&s.jsx("div",{className:"mt-1 space-y-0.5",children:M.map(V=>s.jsxs("p",{className:"text-status-warning-fg flex items-start gap-1 text-xs",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{children:V})]},V))})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[H&&!n&&s.jsxs(C,{size:"sm",variant:"outline",onClick:u,"aria-label":`Apply ${R}`,children:[s.jsx(Jn,{className:"mr-1 size-3","aria-hidden":!0}),"Apply…"]}),U&&s.jsx(Hs,{installation:e,published:T,label:_,onUnlink:v,onInstallPublished:x}),!U&&tr(l)&&s.jsxs(C,{size:"sm",variant:"outline",onClick:o,disabled:i,"aria-label":i?`Checking the files of ${_}`:`Check the files of ${_}`,children:[s.jsx(vt,{className:"mr-1 size-3","aria-hidden":!0}),i?"Checking…":"Check files"]}),!U&&s.jsx(gr,{state:a,label:_,onClick:c,focusProps:y}),!U&&s.jsxs(C,{size:"sm",variant:t?"destructive":"ghost",onClick:h,disabled:r,"aria-label":t?`Uninstall ${R}${F?` from ${F}`:""} now`:`Uninstall ${R}${F?` from ${F}`:""}`,className:t?"":"text-destructive hover:text-destructive",children:[s.jsx(vs,{className:"mr-1 size-3","aria-hidden":!0}),r?"Removing…":t?"Uninstall now":"Uninstall"]})]})]})}const vr=3e3;function br(){var Q;const{data:e,isLoading:n,error:t,refetch:r}=je(),{data:a}=Wn(),l=(Q=a==null?void 0:a.find(m=>m.active))==null?void 0:Q.name,i=bs(m=>m.openShapeSwitcherToShape),o=Ks(),d=en(),u=Lt(),{apply:c}=qa(),h=At(),{data:f}=St(),w=Ha(),T=Ba(),[v,x]=p.useState(null),[N,$]=p.useState(null),[k,I]=p.useState(null),[A,D]=p.useState(!1),E=Vs(),{data:M}=$s(),H=(e??[]).some(m=>m.devLink&&!m.devLink.parked),{data:U}=Pe(void 0,{enabled:H}),R=m=>s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(C,{size:"sm",variant:"outline",onClick:()=>D(!0),children:[s.jsx(Gn,{className:"mr-1 size-3","aria-hidden":!0}),"Link a folder"]})}),(M==null?void 0:M.registryUnreadable)&&s.jsx(ze,{tone:"error",children:"Dev links can’t be read right now."}),m,A&&s.jsx(fr,{open:!0,onOpenChange:D}),s.jsx(Ss,{target:E.target,onClose:E.close,onUnlinked:E.onUnlinked})]});if(n)return R(s.jsx(zs,{count:3}));if(t)return R(s.jsx(_s,{error:t,onRetry:()=>void r()}));if(!e||e.length===0)return R(s.jsx(xe,{title:"No packages installed",description:"Browse the marketplace to find one."}));function O(m){N===m.installPath?(o.mutate({name:m.name,options:{purge:!1,...m.agentPath&&{projectPath:m.agentPath}},where:ce(m)??void 0}),$(null)):($(m.installPath),setTimeout(()=>{$(L=>L===m.installPath?null:L)},vr))}function F(m){h.mutate(m.name,{onSuccess:()=>S.info(`Review ${K(m.name)} on the approval card`,{description:"It stays held back until you allow it."}),onError:L=>S.error(`Couldn’t ask about ${K(m.name)}`,{description:L.message})})}function _(m){I(null),c(m)}function b(m){w.mutate({name:m.name,options:{installRoot:m.installPath,...m.agentPath&&{projectPath:m.agentPath}},where:ce(m)??void 0})}function y(m){var L,z,g;return w.isPending&&((L=w.variables)==null?void 0:L.name)===m.name&&(((g=(z=w.variables)==null?void 0:z.options)==null?void 0:g.installRoot)??m.installPath)===m.installPath}function V(m){var z;const L=o.variables;return o.isPending&&(L==null?void 0:L.name)===m.name&&(((z=L==null?void 0:L.options)==null?void 0:z.projectPath)??void 0)===(m.agentPath??void 0)}const j={isChecking:d.isChecking,applying:u};return R(s.jsxs(s.Fragment,{children:[s.jsx(Ya,{summary:d.summary,isChecking:d.isChecking,error:d.error,isApplying:u.size>0,onUpdateAll:()=>I(d.summary.available),onRecheck:d.recheck}),s.jsx("div",{className:"@container space-y-3",role:"list","aria-label":"Installed packages",children:e.map(m=>{const L=Ea(m,d.checks,j);return s.jsx("div",{role:"listitem",children:s.jsx(jr,{installation:m,isActiveShape:m.type==="shape"&&m.name===l,isConfirmingUninstall:N===m.installPath,isUninstalling:V(m),updateState:L,integrity:f==null?void 0:f.get(m.installPath),isCheckingFiles:y(m),onCheckFilesClick:()=>b(m),onKeepFilesClick:()=>x(m),onApplyClick:()=>i(m.name),onUpdateClick:()=>{if(L.kind!=="update-available")return;const z={installation:m,check:L.check};Qn(L.check.disclosed)?I([z]):c([z])},onUninstallClick:()=>O(m),onReviewClick:()=>F(m),isRaisingReview:h.isPending&&h.variables===m.name,published:U==null?void 0:U.find(z=>z.name===m.name),onUnlinkClick:()=>E.askUnlink(m),onInstallPublishedClick:z=>E.askInstallPublished(m,z)})},m.installPath)})}),s.jsx(ur,{stale:k,integrityByPath:f,onCancel:()=>I(null),onConfirm:_}),s.jsx(hr,{installation:v,unproven:v?kr(f==null?void 0:f.get(v.installPath)):void 0,onCancel:()=>x(null),onConfirm:m=>{v&&T.mutate({name:v.name,options:m}),x(null)}})]}))}function Ur(){const{view:e,setView:n}=ke(),t=en().summary.available.length;return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx(Yn,{children:"Marketplace"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:e==="installed"?"Everything you’ve installed.":"Packages for your agents and for DorkOS."})]}),s.jsx(nt,{value:e,onValueChange:r=>n(r),children:s.jsxs(tt,{"aria-label":"Marketplace view",children:[s.jsx(Ye,{value:"browse",children:"Browse"}),s.jsxs(Ye,{value:"installed",children:["Installed",t>0&&s.jsxs(s.Fragment,{children:[s.jsx(Xn,{count:t,tone:"neutral",className:"ml-1.5"}),s.jsxs("span",{className:"sr-only",children:[", ",t," ",t===1?"update":"updates"," available"]})]})]})]})})]}),e==="installed"?s.jsx("section",{"aria-label":"Installed packages",children:s.jsx(br,{})}):s.jsxs(s.Fragment,{children:[s.jsx(_t,{}),s.jsx(Zn,{}),s.jsx("section",{"aria-label":"All packages",children:s.jsx(Xt,{})})]}),s.jsx(Sa,{}),s.jsx(Ta,{})]})}export{br as I,Ur as M};
@@ -1 +1 @@
1
- import{a1 as N,a2 as T,a8 as g,a3 as S,a4 as $,r as b,j as e,e1 as L,B as x,f as R,e as P,fg as I,eR as B,fh as H,dD as v,fi as V,fj as W,fk as G,fl as J,fm as U,en as D,I as F,fn as X}from"./index-OQuvRZTD.js";import{u as Y}from"./use-pending-read-D0y6i7G9.js";function Z(){const s=N();return T({queryKey:g.sources(),queryFn:()=>s.listMarketplaceSources(),staleTime:6e4})}function _(){const s=N(),t=S();return $({mutationFn:n=>s.addMarketplaceSource(n),onSuccess:()=>{t.invalidateQueries({queryKey:g.sources()}),t.invalidateQueries({queryKey:g.packages()})}})}function ee(){const s=N(),t=S();return $({mutationFn:n=>s.removeMarketplaceSource(n),onSuccess:()=>{t.invalidateQueries({queryKey:g.sources()}),t.invalidateQueries({queryKey:g.packages()})}})}function se(){const s=N(),t=S();return $({mutationFn:n=>s.refreshMarketplaceSource(n),meta:{suppressErrorToast:!0},onSettled:()=>{t.invalidateQueries({queryKey:g.sources()}),t.invalidateQueries({queryKey:g.packages()})}})}function M(s){return s===1?"1 package is ready to install.":`${s} packages are ready to install.`}function k(s){return`${s.replace(/\.+$/,"")}.`}function C(s){return new Date(s).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function q(s){return s.startsWith("file://")}function z(s){return q(s)?"Couldn’t read that folder":"Couldn’t reach it"}function ae(s){const t=s.lastFetch;return(t==null?void 0:t.state)==="failed"?{kind:"failed",message:`Its packages didn’t load: ${k(t.reason)}`}:(t==null?void 0:t.state)==="stale"?{kind:"stale",message:`${z(s.source)}: ${k(t.reason)} Still showing the last copy, from ${C(t.copyFetchedAt)}.`}:null}function te(s,t,n){return s?(t==null?void 0:t.kind)==="failed"?"Enabled, but its packages didn’t load":(t==null?void 0:t.kind)==="stale"?"Enabled, showing an older copy":n?"Enabled":"Enabled, not fetched yet":"Disabled"}function ne({name:s,source:t,enabled:n,addedAt:d,listing:u,fetched:i,onRefresh:h,isRefreshing:r,onRemove:p,isRemoving:f}){const c=C(d),j=n?u?"fill-current text-status-warning-dot":i?"fill-current text-status-success":"fill-none text-muted-foreground":"fill-current text-muted-foreground";return e.jsxs("div",{"data-slot":"source-card",className:"bg-card flex items-start justify-between gap-4 rounded-xl border p-5",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx(I,{className:`mt-0.5 size-3 shrink-0 ${j}`,"aria-label":te(n,u,i)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold",children:s}),e.jsx("p",{className:"text-muted-foreground truncate text-xs",children:t}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["Added ",c]}),u&&e.jsxs("p",{className:"text-status-warning-fg mt-2 text-xs",children:[u.message," ",e.jsx(x,{variant:"link",size:"sm",onClick:h,"aria-busy":r,"aria-label":`Try again for ${s}`,className:"text-status-warning-fg h-auto p-0 text-xs underline",children:"Try again"})]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs(x,{variant:"ghost",size:"sm",onClick:h,"aria-busy":r,"aria-label":`Refresh ${s}`,children:[e.jsx(B,{className:`size-3.5 ${r?"animate-spin":""}`}),e.jsx("span",{className:"ml-1.5 hidden sm:inline",children:"Refresh"})]}),e.jsxs(x,{variant:"ghost",size:"sm",onClick:p,disabled:f,className:"text-destructive hover:text-destructive","aria-label":`Remove ${s}`,children:[e.jsx(H,{className:"size-3.5"}),e.jsx("span",{className:"ml-1.5 hidden sm:inline",children:"Remove"})]})]})]})}function re({open:s,onOpenChange:t,isPending:n,error:d,onSubmit:u}){const[i,h]=b.useState(""),[r,p]=b.useState(""),f=()=>{u(i.trim(),r.trim())},c=m=>{m||(h(""),p("")),t(m)},j=r.trim().length>0&&i.trim().length>0;return e.jsx(V,{open:s,onOpenChange:c,children:e.jsxs(W,{className:"sm:max-w-md",children:[e.jsxs(G,{children:[e.jsx(J,{children:"Add a marketplace source"}),e.jsx(U,{children:"Paste a git repository link and give it a name."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{htmlFor:"source-url",children:"Repository link"}),e.jsx(F,{id:"source-url",value:r,onChange:m=>p(m.target.value),placeholder:"https://github.com/org/marketplace",autoComplete:"off"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{htmlFor:"source-name",children:"Name"}),e.jsx(F,{id:"source-name",value:i,onChange:m=>h(m.target.value),placeholder:"e.g. my-registry",autoComplete:"off"})]}),d&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:d})]}),e.jsxs(X,{children:[e.jsx(x,{variant:"ghost",onClick:()=>c(!1),disabled:n,children:"Cancel"}),e.jsx(x,{onClick:f,disabled:!j||n,children:n?"Adding…":"Add source"})]})]})})}function oe(){var w;const{data:s,isLoading:t}=Z(),n=Y(t),d=_(),u=ee(),i=se(),[h,r]=b.useState(!1),[p,f]=b.useState({id:0,text:""}),c=a=>f(o=>({id:o.id+1,text:a})),j=(a,o)=>{d.mutate({name:a,source:o,enabled:!0},{onSuccess:l=>{if(r(!1),l.listing.fetched){const y=M(l.listing.packageCount);c(`${l.name}: ${y}`),v.success(`Added ${l.name}. ${y}`)}else c(`${l.name}: Added, but its packages didn’t load: ${k(l.listing.reason)}`),v.warning(`Added ${l.name}, but its packages didn’t load.`)}})},m=a=>i.isPending&&i.variables===a,E=a=>{m(a)||i.mutate(a,{onSuccess:o=>{var y;if(o.stale){const A=((y=s==null?void 0:s.find(O=>O.name===a))==null?void 0:y.source)??"";c(`${a}: ${z(A)}: ${k(o.reason??"no reason given")} Still showing the last copy, from ${C(o.fetchedAt)}.`),v.warning(`${q(A)?"Couldn’t read":"Couldn’t reach"} ${a}. Still showing the last copy.`);return}const l=M(o.marketplace.plugins.length);c(`${a}: ${l}`),v.success(`Refreshed ${a}. ${l}`)},onError:o=>{c(`${a}: Its packages didn’t load: ${k(o.message)}`),v.warning(`Couldn’t refresh ${a}.`)}})},K=a=>{a||d.reset(),r(a)},Q=!n&&(!s||s.length===0);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[e.jsxs("div",{children:[e.jsx(L,{children:"Marketplace sources"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Git registries that publish marketplace packages."})]}),e.jsxs(x,{onClick:()=>r(!0),size:"sm",children:[e.jsx(R,{className:"mr-1.5 size-4"}),"Add marketplace source"]})]}),n&&e.jsx("div",{className:"space-y-3",children:[1,2].map(a=>e.jsx(P,{className:"h-20 rounded-xl border"},a))}),Q&&e.jsxs("div",{className:"rounded-xl border border-dashed p-10 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"No marketplaces added yet"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Add a source to browse its packages."}),e.jsxs(x,{className:"mt-4",size:"sm",onClick:()=>r(!0),children:[e.jsx(R,{className:"mr-1.5 size-4"}),"Add marketplace source"]})]}),s&&s.length>0&&e.jsx("div",{className:"space-y-3",children:s.map(a=>e.jsx(ne,{name:a.name,source:a.source,enabled:a.enabled,addedAt:a.addedAt,listing:ae(a),fetched:a.lastFetch===void 0||a.lastFetch.state!=="never",onRefresh:()=>E(a.name),isRefreshing:m(a.name),onRemove:()=>u.mutate(a.name),isRemoving:u.isPending},a.name))}),e.jsx("div",{"data-slot":"listing-announcer",role:"status","aria-live":"polite",className:"sr-only",children:e.jsx("span",{children:p.text},p.id)}),e.jsx(re,{open:h,onOpenChange:K,isPending:d.isPending,error:((w=d.error)==null?void 0:w.message)??null,onSubmit:j})]})}export{oe as M};
1
+ import{a5 as N,a6 as P,ac as f,a7 as S,a8 as $,r as b,j as e,d$ as T,B as x,f as R,e as L,fe as I,eP as B,ff as H,dB as v,fg as V,fh as W,fi as G,fj as J,fk as U,el as D,I as F,fl as X}from"./index-YUtEyz7O.js";import{u as Y}from"./use-pending-read-C1oA2H00.js";function Z(){const s=N();return P({queryKey:f.sources(),queryFn:()=>s.listMarketplaceSources(),staleTime:6e4})}function _(){const s=N(),t=S();return $({mutationFn:n=>s.addMarketplaceSource(n),onSuccess:()=>{t.invalidateQueries({queryKey:f.sources()}),t.invalidateQueries({queryKey:f.packages()})}})}function ee(){const s=N(),t=S();return $({mutationFn:n=>s.removeMarketplaceSource(n),onSuccess:()=>{t.invalidateQueries({queryKey:f.sources()}),t.invalidateQueries({queryKey:f.packages()})}})}function se(){const s=N(),t=S();return $({mutationFn:n=>s.refreshMarketplaceSource(n),meta:{suppressErrorToast:!0},onSettled:()=>{t.invalidateQueries({queryKey:f.sources()}),t.invalidateQueries({queryKey:f.packages()})}})}function M(s){return s===1?"1 package is ready to install.":`${s} packages are ready to install.`}function k(s){return`${s.replace(/\.+$/,"")}.`}function C(s){return new Date(s).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function q(s){return s.startsWith("file://")}function z(s){return q(s)?"Couldn’t read that folder":"Couldn’t reach it"}function ae(s){const t=s.lastFetch;return(t==null?void 0:t.state)==="failed"?{kind:"failed",message:`Its packages didn’t load: ${k(t.reason)}`}:(t==null?void 0:t.state)==="stale"?{kind:"stale",message:`${z(s.source)}: ${k(t.reason)} Still showing the last copy, from ${C(t.copyFetchedAt)}.`}:null}function te(s,t,n){return s?(t==null?void 0:t.kind)==="failed"?"Enabled, but its packages didn’t load":(t==null?void 0:t.kind)==="stale"?"Enabled, showing an older copy":n?"Enabled":"Enabled, not fetched yet":"Disabled"}function ne({name:s,source:t,enabled:n,addedAt:d,listing:u,fetched:i,onRefresh:h,isRefreshing:r,onRemove:p,isRemoving:g}){const c=C(d),j=n?u?"fill-current text-status-warning-dot":i?"fill-current text-status-success":"fill-none text-muted-foreground":"fill-current text-muted-foreground";return e.jsxs("div",{"data-slot":"source-card",className:"bg-card flex items-start justify-between gap-4 rounded-xl border p-5",children:[e.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.jsx(I,{className:`mt-0.5 size-3 shrink-0 ${j}`,"aria-label":te(n,u,i)}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-semibold",children:s}),e.jsx("p",{className:"text-muted-foreground truncate text-xs",children:t}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["Added ",c]}),u&&e.jsxs("p",{className:"text-status-warning-fg mt-2 text-xs",children:[u.message," ",e.jsx(x,{variant:"link",size:"sm",onClick:h,"aria-busy":r,"aria-label":`Try again for ${s}`,className:"text-status-warning-fg h-auto p-0 text-xs underline",children:"Try again"})]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsxs(x,{variant:"ghost",size:"sm",onClick:h,"aria-busy":r,"aria-label":`Refresh ${s}`,children:[e.jsx(B,{className:`size-3.5 ${r?"animate-spin":""}`}),e.jsx("span",{className:"ml-1.5 hidden sm:inline",children:"Refresh"})]}),e.jsxs(x,{variant:"ghost",size:"sm",onClick:p,disabled:g,className:"text-destructive hover:text-destructive","aria-label":`Remove ${s}`,children:[e.jsx(H,{className:"size-3.5"}),e.jsx("span",{className:"ml-1.5 hidden sm:inline",children:"Remove"})]})]})]})}function re({open:s,onOpenChange:t,isPending:n,error:d,onSubmit:u}){const[i,h]=b.useState(""),[r,p]=b.useState(""),g=()=>{u(i.trim(),r.trim())},c=m=>{m||(h(""),p("")),t(m)},j=r.trim().length>0&&i.trim().length>0;return e.jsx(V,{open:s,onOpenChange:c,children:e.jsxs(W,{className:"sm:max-w-md",children:[e.jsxs(G,{children:[e.jsx(J,{children:"Add a marketplace source"}),e.jsx(U,{children:"Paste a git repository link and give it a name."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{htmlFor:"source-url",children:"Repository link"}),e.jsx(F,{id:"source-url",value:r,onChange:m=>p(m.target.value),placeholder:"https://github.com/org/marketplace",autoComplete:"off"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(D,{htmlFor:"source-name",children:"Name"}),e.jsx(F,{id:"source-name",value:i,onChange:m=>h(m.target.value),placeholder:"e.g. my-registry",autoComplete:"off"})]}),d&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:d})]}),e.jsxs(X,{children:[e.jsx(x,{variant:"ghost",onClick:()=>c(!1),disabled:n,children:"Cancel"}),e.jsx(x,{onClick:g,disabled:!j||n,children:n?"Adding…":"Add source"})]})]})})}function oe(){var w;const{data:s,isLoading:t}=Z(),n=Y(t),d=_(),u=ee(),i=se(),[h,r]=b.useState(!1),[p,g]=b.useState({id:0,text:""}),c=a=>g(o=>({id:o.id+1,text:a})),j=(a,o)=>{d.mutate({name:a,source:o,enabled:!0},{onSuccess:l=>{if(r(!1),l.listing.fetched){const y=M(l.listing.packageCount);c(`${l.name}: ${y}`),v.success(`Added ${l.name}. ${y}`)}else c(`${l.name}: Added, but its packages didn’t load: ${k(l.listing.reason)}`),v.warning(`Added ${l.name}, but its packages didn’t load.`)}})},m=a=>i.isPending&&i.variables===a,E=a=>{m(a)||i.mutate(a,{onSuccess:o=>{var y;if(o.stale){const A=((y=s==null?void 0:s.find(O=>O.name===a))==null?void 0:y.source)??"";c(`${a}: ${z(A)}: ${k(o.reason??"no reason given")} Still showing the last copy, from ${C(o.fetchedAt)}.`),v.warning(`${q(A)?"Couldn’t read":"Couldn’t reach"} ${a}. Still showing the last copy.`);return}const l=M(o.marketplace.plugins.length);c(`${a}: ${l}`),v.success(`Refreshed ${a}. ${l}`)},onError:o=>{c(`${a}: Its packages didn’t load: ${k(o.message)}`),v.warning(`Couldn’t refresh ${a}.`)}})},K=a=>{a||d.reset(),r(a)},Q=!n&&(!s||s.length===0);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[e.jsxs("div",{children:[e.jsx(T,{children:"Marketplace sources"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Git registries that publish marketplace packages."})]}),e.jsxs(x,{onClick:()=>r(!0),size:"sm",children:[e.jsx(R,{className:"mr-1.5 size-4"}),"Add marketplace source"]})]}),n&&e.jsx("div",{className:"space-y-3",children:[1,2].map(a=>e.jsx(L,{className:"h-20 rounded-xl border"},a))}),Q&&e.jsxs("div",{className:"rounded-xl border border-dashed p-10 text-center",children:[e.jsx("p",{className:"text-sm font-medium",children:"No marketplaces added yet"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Add a source to browse its packages."}),e.jsxs(x,{className:"mt-4",size:"sm",onClick:()=>r(!0),children:[e.jsx(R,{className:"mr-1.5 size-4"}),"Add marketplace source"]})]}),s&&s.length>0&&e.jsx("div",{className:"space-y-3",children:s.map(a=>e.jsx(ne,{name:a.name,source:a.source,enabled:a.enabled,addedAt:a.addedAt,listing:ae(a),fetched:a.lastFetch===void 0||a.lastFetch.state!=="never",onRefresh:()=>E(a.name),isRefreshing:m(a.name),onRemove:()=>u.mutate(a.name),isRemoving:u.isPending},a.name))}),e.jsx("div",{"data-slot":"listing-announcer",role:"status","aria-live":"polite",className:"sr-only",children:e.jsx("span",{children:p.text},p.id)}),e.jsx(re,{open:h,onOpenChange:K,isPending:d.isPending,error:((w=d.error)==null?void 0:w.message)??null,onSubmit:j})]})}export{oe as M};
@@ -1,6 +1,6 @@
1
- import{O as S,a1 as j,a2 as T,r as h,j as u,G as w,fz as P,fA as C}from"./index-OQuvRZTD.js";import{M as $}from"./more-details-CRLU2HN4.js";/**
1
+ import{O as S,a5 as j,a6 as T,r as h,j as u,G as w,fx as P,fy as C}from"./index-YUtEyz7O.js";import{M as $}from"./more-details-DF2dJXMV.js";/**
2
2
  * @license lucide-react v1.48.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const v={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};v.node;const q=S(v);function N(e){const t=j(),{sessionId:i,serverName:s,uri:o,enabled:c=!0}=e;return T({queryKey:["mcp-app-resource",i,s,o],queryFn:()=>t.fetchMcpAppResource(i,{serverName:s,uri:o}),enabled:c&&!!(i&&s&&o),staleTime:300*1e3,retry:!1})}const k=-32601,E=-32e3,I=["inline","fullscreen","pip"];function U(e){const{iframe:t,expectedOrigin:i,hostContext:s,handlers:o}=e,c=n=>{var r;(r=t.contentWindow)==null||r.postMessage(n,"*")},a=(n,r)=>{n!=null&&c({jsonrpc:"2.0",id:n,result:r})},d=(n,r,l)=>{n!=null&&c({jsonrpc:"2.0",id:n,error:{code:r,message:l}})},g=async n=>{switch(n.method){case"ui/initialize":{a(n.id,{availableDisplayModes:[...I],hostContext:s});return}case"resources/read":{const r=B(n.params);if(!r)return d(n.id,k,"resources/read requires a uri");try{const l=await o.readResource(r);a(n.id,{contents:[{uri:r,...l}]})}catch(l){d(n.id,E,l instanceof Error?l.message:"read failed")}return}case"ui/open-link":{const r=R(n.params);r&&o.openLink(r),a(n.id,{});return}case"ui/request-display-mode":{const r=W(n.params);r&&o.requestDisplayMode(r),a(n.id,{granted:r==="fullscreen"||r==="inline"||r==="pip"});return}case"tools/call":{d(n.id,E,"App tool calls are not permitted in this host (v1)");return}default:{d(n.id,k,`Unknown method: ${n.method}`);return}}},p=n=>{if(n.source!==t.contentWindow||n.origin!==i)return;const r=z(n.data);r&&g(r)};return window.addEventListener("message",p),()=>window.removeEventListener("message",p)}function z(e){if(typeof e!="object"||e===null)return null;const t=e;return t.jsonrpc!=="2.0"||typeof t.method!="string"?null:{jsonrpc:"2.0",method:t.method,id:t.id,params:t.params}}function B(e){const t=e==null?void 0:e.uri;return typeof t=="string"?t:void 0}function R(e){const t=e==null?void 0:e.url;return typeof t=="string"?t:void 0}function W(e){const t=e==null?void 0:e.mode;return t==="inline"||t==="fullscreen"||t==="pip"?t:void 0}const G="allow-scripts",H="null",X="default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'",K={camera:"camera",microphone:"microphone",geolocation:"geolocation","clipboard-write":"clipboard-write"};function Q(e){if(e.length!==0)return e.map(t=>`${K[t]} 'self'`).join("; ")}function V(e,t){const i=t&&t.trim().length>0?t:X,s=`<meta http-equiv="Content-Security-Policy" content="${Y(i)}">`;return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,o=>`${o}${s}`):/<html[^>]*>/i.test(e)?e.replace(/<html[^>]*>/i,o=>`${o}<head>${s}</head>`):`<!doctype html><html><head>${s}</head><body>${e}</body></html>`}function Y(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function J(){return document.documentElement.classList.contains("dark")?"dark":"light"}function ee({sessionId:e,serverName:t,uri:i,title:s,onRequestFullscreen:o,onRequestPip:c,className:a}){const d=j(),g=h.useRef(null),[p,n]=h.useState(null),{data:r,isLoading:l,isError:y,error:b}=N({sessionId:e,serverName:t,uri:i}),x=r!=null&&r.text?V(r.text,r.csp):void 0,M=Q((r==null?void 0:r.permissions)??[]),A=h.useCallback(async f=>{const m=await d.fetchMcpAppResource(e,{serverName:t,uri:f});return{mimeType:m.mimeType,text:m.text,blob:m.blob}},[d,e,t]),D=h.useCallback(f=>{f==="fullscreen"?o==null||o():f==="pip"&&(c==null||c())},[o,c]),[L,O]=h.useState(void 0);return h.useEffect(()=>{const f=g.current;if(!f||!x)return;const m=U({iframe:f,expectedOrigin:H,hostContext:{hostName:"DorkOS",theme:J()},handlers:{readResource:A,openLink:_=>n(_),requestDisplayMode:D}});return O(x),m},[x,A,D]),l?u.jsx("div",{className:w("text-muted-foreground p-4 text-sm",a),children:"Loading app…"}):y||!x?u.jsxs("div",{className:w("text-muted-foreground p-4 text-sm",a),children:[u.jsx("p",{children:y?`Couldn’t load the app from ${t}.`:"This app has nothing to show."}),y&&b instanceof Error&&b.message&&u.jsx($,{label:"Details",openLabel:"Hide details",className:"mt-1",children:u.jsx("p",{className:"font-mono text-xs break-words",children:b.message})})]}):u.jsxs("div",{className:w("relative h-full w-full",a),children:[u.jsx("iframe",{ref:g,title:s??`App from ${t}`,sandbox:G,...M?{allow:M}:{},srcDoc:L,className:"bg-background h-full w-full border-0"}),u.jsx(P,{url:p??"",isOpen:p!==null,onClose:()=>n(null),onConfirm:()=>{p&&C(p),n(null)}})]})}export{q as A,ee as M};
6
+ */const v={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};v.node;const q=S(v);function N(e){const t=j(),{sessionId:i,serverName:s,uri:o,enabled:c=!0}=e;return T({queryKey:["mcp-app-resource",i,s,o],queryFn:()=>t.fetchMcpAppResource(i,{serverName:s,uri:o}),enabled:c&&!!(i&&s&&o),staleTime:300*1e3,retry:!1})}const k=-32601,E=-32e3,I=["inline","fullscreen","pip"];function U(e){const{iframe:t,expectedOrigin:i,hostContext:s,handlers:o}=e,c=n=>{var r;(r=t.contentWindow)==null||r.postMessage(n,"*")},a=(n,r)=>{n!=null&&c({jsonrpc:"2.0",id:n,result:r})},d=(n,r,l)=>{n!=null&&c({jsonrpc:"2.0",id:n,error:{code:r,message:l}})},g=async n=>{switch(n.method){case"ui/initialize":{a(n.id,{availableDisplayModes:[...I],hostContext:s});return}case"resources/read":{const r=R(n.params);if(!r)return d(n.id,k,"resources/read requires a uri");try{const l=await o.readResource(r);a(n.id,{contents:[{uri:r,...l}]})}catch(l){d(n.id,E,l instanceof Error?l.message:"read failed")}return}case"ui/open-link":{const r=W(n.params);r&&o.openLink(r),a(n.id,{});return}case"ui/request-display-mode":{const r=z(n.params);r&&o.requestDisplayMode(r),a(n.id,{granted:r==="fullscreen"||r==="inline"||r==="pip"});return}case"tools/call":{d(n.id,E,"App tool calls are not permitted in this host (v1)");return}default:{d(n.id,k,`Unknown method: ${n.method}`);return}}},p=n=>{if(n.source!==t.contentWindow||n.origin!==i)return;const r=B(n.data);r&&g(r)};return window.addEventListener("message",p),()=>window.removeEventListener("message",p)}function B(e){if(typeof e!="object"||e===null)return null;const t=e;return t.jsonrpc!=="2.0"||typeof t.method!="string"?null:{jsonrpc:"2.0",method:t.method,id:t.id,params:t.params}}function R(e){const t=e==null?void 0:e.uri;return typeof t=="string"?t:void 0}function W(e){const t=e==null?void 0:e.url;return typeof t=="string"?t:void 0}function z(e){const t=e==null?void 0:e.mode;return t==="inline"||t==="fullscreen"||t==="pip"?t:void 0}const G="allow-scripts",H="null",X="default-src 'none'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'",K={camera:"camera",microphone:"microphone",geolocation:"geolocation","clipboard-write":"clipboard-write"};function Q(e){if(e.length!==0)return e.map(t=>`${K[t]} 'self'`).join("; ")}function V(e,t){const i=t&&t.trim().length>0?t:X,s=`<meta http-equiv="Content-Security-Policy" content="${Y(i)}">`;return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,o=>`${o}${s}`):/<html[^>]*>/i.test(e)?e.replace(/<html[^>]*>/i,o=>`${o}<head>${s}</head>`):`<!doctype html><html><head>${s}</head><body>${e}</body></html>`}function Y(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}function J(){return document.documentElement.classList.contains("dark")?"dark":"light"}function ee({sessionId:e,serverName:t,uri:i,title:s,onRequestFullscreen:o,onRequestPip:c,className:a}){const d=j(),g=h.useRef(null),[p,n]=h.useState(null),{data:r,isLoading:l,isError:y,error:b}=N({sessionId:e,serverName:t,uri:i}),x=r!=null&&r.text?V(r.text,r.csp):void 0,M=Q((r==null?void 0:r.permissions)??[]),A=h.useCallback(async f=>{const m=await d.fetchMcpAppResource(e,{serverName:t,uri:f});return{mimeType:m.mimeType,text:m.text,blob:m.blob}},[d,e,t]),D=h.useCallback(f=>{f==="fullscreen"?o==null||o():f==="pip"&&(c==null||c())},[o,c]),[L,O]=h.useState(void 0);return h.useEffect(()=>{const f=g.current;if(!f||!x)return;const m=U({iframe:f,expectedOrigin:H,hostContext:{hostName:"DorkOS",theme:J()},handlers:{readResource:A,openLink:_=>n(_),requestDisplayMode:D}});return O(x),m},[x,A,D]),l?u.jsx("div",{className:w("text-muted-foreground p-4 text-sm",a),children:"Loading app…"}):y||!x?u.jsxs("div",{className:w("text-muted-foreground p-4 text-sm",a),children:[u.jsx("p",{children:y?`Couldn’t load the app from ${t}.`:"This app has nothing to show."}),y&&b instanceof Error&&b.message&&u.jsx($,{label:"Details",openLabel:"Hide details",className:"mt-1",children:u.jsx("p",{className:"font-mono text-xs break-words",children:b.message})})]}):u.jsxs("div",{className:w("relative h-full w-full",a),children:[u.jsx("iframe",{ref:g,title:s??`App from ${t}`,sandbox:G,...M?{allow:M}:{},srcDoc:L,className:"bg-background h-full w-full border-0"}),u.jsx(P,{url:p??"",isOpen:p!==null,onClose:()=>n(null),onConfirm:()=>{p&&C(p),n(null)}})]})}export{q as A,ee as M};
@@ -1 +1 @@
1
- import{a1 as q,a3 as B,r as a,em as K,a4 as T,a2 as Q,j as s,en as U,I as W,eo as Y,B as b,x as z,G as S,ep as H,eq as V,er as X,bc as J}from"./index-OQuvRZTD.js";const P={SIGNIN_NO_APP_REGISTRATION:"This server doesn’t let DorkOS register itself. Add your own app credentials to try again.",SIGNIN_NO_SIGNIN_SUPPORT:"This server doesn’t offer sign-in the way DorkOS expects.",SIGNIN_UNREACHABLE:"Couldn’t reach the server to start the sign-in."};function Z(e){return e!==void 0&&e in P}function k(e){const{message:t,code:i,detail:o}=e;return Z(i)?{message:P[i],detail:o??t??null,canUseOwnCredentials:i==="SIGNIN_NO_APP_REGISTRATION"}:{message:t??"Sign-in didn’t finish. Try again.",detail:o??null,canUseOwnCredentials:!1}}function ee(e){if(typeof e!="object"||e===null)return{};const{code:t,body:i}=e,o=typeof i=="object"&&i!==null?i.detail:void 0;return{...typeof t=="string"?{code:t}:{},...typeof o=="string"?{detail:o}:{}}}const _=2e3,F=5,se="Couldn’t check the sign-in. Retrying.",te="Couldn’t check if the sign-in finished. Try again in a moment.",j={phase:"idle",disclosure:null,authorizeUrl:null,startFailure:null,credentialsError:null,flowId:null,watching:!1};function ne(e){const t=e==null?void 0:e.toolCount;return typeof t!="number"||!Number.isFinite(t)||t<0?null:t}function re(e,t){return(e==null?void 0:e.status)==="failed"?e.error??"Sign-in didn’t finish. Try again.":t>=F?te:null}function ie(e){return{...j,phase:"failed",startFailure:k({message:e.message,...ee(e)})}}function ae(e){return e===null?null:k({message:e})}function O(e){return e.flowId===null?!1:e.phase==="waiting"||e.phase==="disclosure"&&e.watching}function le(e,t,i){return O(e)?(t==null?void 0:t.status)==="connected"?"connected":(t==null?void 0:t.status)==="failed"?"failed":e.phase!=="waiting"?e.phase:i>=F?"failed":"waiting":e.phase}function he(e,t){const i=q(),o=B(),[u,r]=a.useState(j),h=a.useRef(0),[x,C]=a.useState(0),g=a.useRef(null),d=a.useCallback(n=>{g.current=n,h.current=0,C(0)},[]),p=a.useCallback((n,c)=>{c===g.current&&(h.current=n==="ok"?0:h.current+1,C(h.current))},[]),f=a.useCallback(()=>{o.invalidateQueries({queryKey:K.mcpServers(e)}),o.invalidateQueries({queryKey:["mcp-config"]})},[o,e]),l=T({mutationFn:()=>i.startMcpSignin(e,t),meta:{suppressErrorToast:!0}}),v=a.useCallback(()=>{d(null),r({...j,phase:"starting"}),l.mutate(void 0,{onSuccess:n=>{if(!n.alreadyConnected&&!n.authorizeUrl){r({...j,phase:"failed",startFailure:k({message:"Couldn’t make a sign-in link for this server."})});return}d(n.flowId),r({phase:n.alreadyConnected?"connected":"disclosure",disclosure:n.disclosure,authorizeUrl:n.authorizeUrl??null,startFailure:null,credentialsError:null,flowId:n.flowId,watching:!1})},onError:n=>r(ie(n))})},[l,d]),I=T({mutationFn:n=>i.setMcpClientCredentials(e,t,n),meta:{suppressErrorToast:!0}}),A=a.useCallback(n=>{r(c=>c.credentialsError===null?c:{...c,credentialsError:null}),I.mutate(n,{onSuccess:()=>{f(),v()},onError:c=>r(N=>({...N,credentialsError:c.message}))})},[I,f,v]),M=a.useCallback(n=>{g.current!==n.flowId&&(f(),d(n.flowId),r({phase:"disclosure",disclosure:n.disclosure,authorizeUrl:n.authorizeUrl,startFailure:null,credentialsError:null,flowId:n.flowId,watching:!0}))},[d]),D=a.useCallback(()=>{r(n=>n.phase==="disclosure"?{...n,phase:"waiting"}:n)},[]),G=a.useCallback(()=>{d(null),r(j)},[d]),E=Q({queryKey:["mcp-signin",e,t,u.flowId??""],queryFn:async()=>{const n=u.flowId??"";try{const c=await i.pollMcpSignin(n);return p("ok",n),c}catch(c){throw p("failed",n),c}},enabled:O(u),refetchInterval:n=>{var R;const c=(R=n.state.data)==null?void 0:R.status;if(c==="connected"||c==="failed")return!1;const N=h.current;return N===0?_:N>=F?!1:_*(N+1)},retry:!1,refetchOnWindowFocus:n=>{var c;return((c=n.state.data)==null?void 0:c.status)==="failed"},refetchOnReconnect:!1,gcTime:0,staleTime:0,meta:{suppressErrorToast:!0}}),w=x,y=le(u,E.data,w);a.useEffect(()=>{y==="connected"&&f()},[y,f]);const m=O(u)?ae(re(E.data,w)):u.startFailure,$=y==="waiting"&&w>0?se:null;return{state:{step:y,disclosure:u.disclosure,authorizeUrl:u.authorizeUrl,error:(m==null?void 0:m.message)??null,errorDetail:(m==null?void 0:m.detail)??null,canUseOwnCredentials:(m==null?void 0:m.canUseOwnCredentials)??!1,savingCredentials:I.isPending,credentialsError:u.credentialsError,retryNotice:$,toolCount:y==="connected"?ne(E.data):null},start:v,adopt:M,authOpened:D,useOwnCredentials:A,reset:G}}function ce({onSave:e,onCancel:t,saving:i=!1,error:o=null,className:u}){const r=a.useId(),h=a.useRef(null),[x,C]=a.useState(""),[g,d]=a.useState(""),p=x.trim(),f=g.trim();return a.useEffect(()=>{var l;(l=h.current)==null||l.focus()},[]),s.jsxs("form",{className:S("space-y-2",u),onSubmit:l=>{l.preventDefault(),!(!p||i)&&e({clientId:p,...f?{clientSecret:f}:{}})},children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(U,{htmlFor:`${r}-client-id`,className:"text-xs",children:"Client ID"}),s.jsx(W,{id:`${r}-client-id`,ref:h,value:x,onChange:l=>C(l.target.value),autoComplete:"off",spellCheck:!1,disabled:i,className:"h-8 text-xs"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs(U,{htmlFor:`${r}-client-secret`,className:"text-xs",children:["Client secret ",s.jsx("span",{className:"text-muted-foreground font-normal",children:"(if you got one)"})]}),s.jsx(Y,{id:`${r}-client-secret`,value:g,onChange:l=>d(l.target.value),autoComplete:"off",disabled:i,className:"h-8 text-xs"})]}),s.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"From the service’s developer settings. Kept encrypted here; agents never see it."}),o&&s.jsx("p",{role:"alert",className:"text-destructive text-xs leading-relaxed",children:o}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(b,{type:"submit",size:"sm",disabled:!p||i,className:"gap-1.5 focus-visible:ring-2",children:[i&&s.jsx(z,{size:"xs"}),"Save and sign in"]}),s.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:i,className:"focus-visible:ring-2",children:"Cancel"})]})]})}function L({children:e}){return s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[s.jsx(z,{size:"xs"}),e]})}function oe(e){return e===null?"Signed in. Its tools are available on the next turn.":`Connected · ${e} tool${e===1?"":"s"}.`}function ue(e){return`DorkOS keeps the key from ${e} here, never your agent. Removing the server deletes it.`}function de(e){const{state:t}=e;return t.step==="starting"?s.jsx(L,{children:"Starting sign-in…"}):t.step==="waiting"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(L,{children:"Waiting for you to sign in… Close the tab when done."}),t.retryNotice&&s.jsx("p",{className:"text-muted-foreground text-xs",children:t.retryNotice})]}):t.step==="connected"?s.jsxs("p",{className:"text-status-success-fg flex items-center gap-2 text-xs",children:[s.jsx(J,{className:"size-3.5","aria-hidden":!0}),oe(t.toolCount)]}):null}function pe({flow:e,serverName:t,className:i,failedActions:o,connectedActions:u}){const{state:r}=e,h=a.useRef(null),x=r.step==="disclosure",C=a.useRef(null),[g,d]=a.useState(!1),p=g&&r.canUseOwnCredentials;a.useEffect(()=>{var l;x&&((l=h.current)==null||l.focus())},[x]);const f=a.useRef(!1);return a.useEffect(()=>{var l;!f.current||p||(f.current=!1,(l=C.current)==null||l.focus())},[p]),s.jsxs(s.Fragment,{children:[s.jsx("div",{role:"status",className:S("[&:not(:empty)]:mt-1",i),children:de(e)}),x&&s.jsxs("div",{className:S("mt-1 space-y-2",i),children:[s.jsxs("div",{ref:h,tabIndex:-1,className:"border-status-success-border bg-status-success-bg text-status-success-fg flex items-start gap-2 rounded-md border px-3 py-2 focus-visible:ring-2",children:[s.jsx(H,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("p",{className:"text-xs font-semibold",children:"Your sign-in stays on this computer."}),s.jsx("p",{className:"text-xs leading-relaxed",children:r.disclosure??ue(t)})]})]}),r.authorizeUrl&&s.jsx(b,{asChild:!0,size:"sm",className:"gap-1.5 focus-visible:ring-2",children:s.jsxs(V,{href:r.authorizeUrl,onOpened:()=>e.authOpened(),"aria-label":`Open the sign-in page for ${t}`,children:["Open the sign-in page",s.jsx(X,{className:"size-3.5","aria-hidden":!0})]})})]}),r.step==="failed"&&s.jsxs("div",{className:S("mt-1 space-y-2",i),children:[s.jsx("p",{role:"alert",className:"text-destructive text-xs leading-relaxed",children:r.error??"Sign-in didn’t finish. Try again."}),r.errorDetail&&s.jsxs("details",{className:"text-muted-foreground text-xs",children:[s.jsx("summary",{className:"cursor-pointer focus-visible:ring-2",children:"Details"}),s.jsx("code",{className:"text-2xs mt-1 block font-mono break-all",children:r.errorDetail})]}),p?s.jsx(ce,{onSave:l=>e.useOwnCredentials(l),onCancel:()=>{d(!1),f.current=!0},saving:r.savingCredentials,error:r.credentialsError}):s.jsxs("div",{className:"flex flex-wrap gap-2",children:[o,r.canUseOwnCredentials&&s.jsx(b,{ref:C,variant:"secondary",size:"sm",onClick:()=>d(!0),className:"focus-visible:ring-2",children:"Use your own app credentials"})]})]}),r.step==="connected"&&u&&s.jsx("div",{className:S("mt-1",i),children:u})]})}export{pe as M,he as u};
1
+ import{a5 as q,a7 as B,r as a,ek as K,a8 as T,a6 as Q,j as s,el as U,I as W,em as Y,B as b,x as z,G as S,en as H,eo as V,ep as X,bf as J}from"./index-YUtEyz7O.js";const P={SIGNIN_NO_APP_REGISTRATION:"This server doesn’t let DorkOS register itself. Add your own app credentials to try again.",SIGNIN_NO_SIGNIN_SUPPORT:"This server doesn’t offer sign-in the way DorkOS expects.",SIGNIN_UNREACHABLE:"Couldn’t reach the server to start the sign-in."};function Z(e){return e!==void 0&&e in P}function k(e){const{message:t,code:i,detail:o}=e;return Z(i)?{message:P[i],detail:o??t??null,canUseOwnCredentials:i==="SIGNIN_NO_APP_REGISTRATION"}:{message:t??"Sign-in didn’t finish. Try again.",detail:o??null,canUseOwnCredentials:!1}}function ee(e){if(typeof e!="object"||e===null)return{};const{code:t,body:i}=e,o=typeof i=="object"&&i!==null?i.detail:void 0;return{...typeof t=="string"?{code:t}:{},...typeof o=="string"?{detail:o}:{}}}const _=2e3,F=5,se="Couldn’t check the sign-in. Retrying.",te="Couldn’t check if the sign-in finished. Try again in a moment.",j={phase:"idle",disclosure:null,authorizeUrl:null,startFailure:null,credentialsError:null,flowId:null,watching:!1};function ne(e){const t=e==null?void 0:e.toolCount;return typeof t!="number"||!Number.isFinite(t)||t<0?null:t}function re(e,t){return(e==null?void 0:e.status)==="failed"?e.error??"Sign-in didn’t finish. Try again.":t>=F?te:null}function ie(e){return{...j,phase:"failed",startFailure:k({message:e.message,...ee(e)})}}function ae(e){return e===null?null:k({message:e})}function O(e){return e.flowId===null?!1:e.phase==="waiting"||e.phase==="disclosure"&&e.watching}function le(e,t,i){return O(e)?(t==null?void 0:t.status)==="connected"?"connected":(t==null?void 0:t.status)==="failed"?"failed":e.phase!=="waiting"?e.phase:i>=F?"failed":"waiting":e.phase}function he(e,t){const i=q(),o=B(),[u,r]=a.useState(j),h=a.useRef(0),[x,C]=a.useState(0),g=a.useRef(null),d=a.useCallback(n=>{g.current=n,h.current=0,C(0)},[]),p=a.useCallback((n,c)=>{c===g.current&&(h.current=n==="ok"?0:h.current+1,C(h.current))},[]),f=a.useCallback(()=>{o.invalidateQueries({queryKey:K.mcpServers(e)}),o.invalidateQueries({queryKey:["mcp-config"]})},[o,e]),l=T({mutationFn:()=>i.startMcpSignin(e,t),meta:{suppressErrorToast:!0}}),v=a.useCallback(()=>{d(null),r({...j,phase:"starting"}),l.mutate(void 0,{onSuccess:n=>{if(!n.alreadyConnected&&!n.authorizeUrl){r({...j,phase:"failed",startFailure:k({message:"Couldn’t make a sign-in link for this server."})});return}d(n.flowId),r({phase:n.alreadyConnected?"connected":"disclosure",disclosure:n.disclosure,authorizeUrl:n.authorizeUrl??null,startFailure:null,credentialsError:null,flowId:n.flowId,watching:!1})},onError:n=>r(ie(n))})},[l,d]),I=T({mutationFn:n=>i.setMcpClientCredentials(e,t,n),meta:{suppressErrorToast:!0}}),A=a.useCallback(n=>{r(c=>c.credentialsError===null?c:{...c,credentialsError:null}),I.mutate(n,{onSuccess:()=>{f(),v()},onError:c=>r(N=>({...N,credentialsError:c.message}))})},[I,f,v]),M=a.useCallback(n=>{g.current!==n.flowId&&(f(),d(n.flowId),r({phase:"disclosure",disclosure:n.disclosure,authorizeUrl:n.authorizeUrl,startFailure:null,credentialsError:null,flowId:n.flowId,watching:!0}))},[d]),D=a.useCallback(()=>{r(n=>n.phase==="disclosure"?{...n,phase:"waiting"}:n)},[]),G=a.useCallback(()=>{d(null),r(j)},[d]),E=Q({queryKey:["mcp-signin",e,t,u.flowId??""],queryFn:async()=>{const n=u.flowId??"";try{const c=await i.pollMcpSignin(n);return p("ok",n),c}catch(c){throw p("failed",n),c}},enabled:O(u),refetchInterval:n=>{var R;const c=(R=n.state.data)==null?void 0:R.status;if(c==="connected"||c==="failed")return!1;const N=h.current;return N===0?_:N>=F?!1:_*(N+1)},retry:!1,refetchOnWindowFocus:n=>{var c;return((c=n.state.data)==null?void 0:c.status)==="failed"},refetchOnReconnect:!1,gcTime:0,staleTime:0,meta:{suppressErrorToast:!0}}),w=x,y=le(u,E.data,w);a.useEffect(()=>{y==="connected"&&f()},[y,f]);const m=O(u)?ae(re(E.data,w)):u.startFailure,$=y==="waiting"&&w>0?se:null;return{state:{step:y,disclosure:u.disclosure,authorizeUrl:u.authorizeUrl,error:(m==null?void 0:m.message)??null,errorDetail:(m==null?void 0:m.detail)??null,canUseOwnCredentials:(m==null?void 0:m.canUseOwnCredentials)??!1,savingCredentials:I.isPending,credentialsError:u.credentialsError,retryNotice:$,toolCount:y==="connected"?ne(E.data):null},start:v,adopt:M,authOpened:D,useOwnCredentials:A,reset:G}}function ce({onSave:e,onCancel:t,saving:i=!1,error:o=null,className:u}){const r=a.useId(),h=a.useRef(null),[x,C]=a.useState(""),[g,d]=a.useState(""),p=x.trim(),f=g.trim();return a.useEffect(()=>{var l;(l=h.current)==null||l.focus()},[]),s.jsxs("form",{className:S("space-y-2",u),onSubmit:l=>{l.preventDefault(),!(!p||i)&&e({clientId:p,...f?{clientSecret:f}:{}})},children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx(U,{htmlFor:`${r}-client-id`,className:"text-xs",children:"Client ID"}),s.jsx(W,{id:`${r}-client-id`,ref:h,value:x,onChange:l=>C(l.target.value),autoComplete:"off",spellCheck:!1,disabled:i,className:"h-8 text-xs"})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsxs(U,{htmlFor:`${r}-client-secret`,className:"text-xs",children:["Client secret ",s.jsx("span",{className:"text-muted-foreground font-normal",children:"(if you got one)"})]}),s.jsx(Y,{id:`${r}-client-secret`,value:g,onChange:l=>d(l.target.value),autoComplete:"off",disabled:i,className:"h-8 text-xs"})]}),s.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"From the service’s developer settings. Kept encrypted here; agents never see it."}),o&&s.jsx("p",{role:"alert",className:"text-destructive text-xs leading-relaxed",children:o}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(b,{type:"submit",size:"sm",disabled:!p||i,className:"gap-1.5 focus-visible:ring-2",children:[i&&s.jsx(z,{size:"xs"}),"Save and sign in"]}),s.jsx(b,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:i,className:"focus-visible:ring-2",children:"Cancel"})]})]})}function L({children:e}){return s.jsxs("p",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[s.jsx(z,{size:"xs"}),e]})}function oe(e){return e===null?"Signed in. Its tools are available on the next turn.":`Connected · ${e} tool${e===1?"":"s"}.`}function ue(e){return`DorkOS keeps the key from ${e} here, never your agent. Removing the server deletes it.`}function de(e){const{state:t}=e;return t.step==="starting"?s.jsx(L,{children:"Starting sign-in…"}):t.step==="waiting"?s.jsxs("div",{className:"space-y-1",children:[s.jsx(L,{children:"Waiting for you to sign in… Close the tab when done."}),t.retryNotice&&s.jsx("p",{className:"text-muted-foreground text-xs",children:t.retryNotice})]}):t.step==="connected"?s.jsxs("p",{className:"text-status-success-fg flex items-center gap-2 text-xs",children:[s.jsx(J,{className:"size-3.5","aria-hidden":!0}),oe(t.toolCount)]}):null}function pe({flow:e,serverName:t,className:i,failedActions:o,connectedActions:u}){const{state:r}=e,h=a.useRef(null),x=r.step==="disclosure",C=a.useRef(null),[g,d]=a.useState(!1),p=g&&r.canUseOwnCredentials;a.useEffect(()=>{var l;x&&((l=h.current)==null||l.focus())},[x]);const f=a.useRef(!1);return a.useEffect(()=>{var l;!f.current||p||(f.current=!1,(l=C.current)==null||l.focus())},[p]),s.jsxs(s.Fragment,{children:[s.jsx("div",{role:"status",className:S("[&:not(:empty)]:mt-1",i),children:de(e)}),x&&s.jsxs("div",{className:S("mt-1 space-y-2",i),children:[s.jsxs("div",{ref:h,tabIndex:-1,className:"border-status-success-border bg-status-success-bg text-status-success-fg flex items-start gap-2 rounded-md border px-3 py-2 focus-visible:ring-2",children:[s.jsx(H,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("p",{className:"text-xs font-semibold",children:"Your sign-in stays on this computer."}),s.jsx("p",{className:"text-xs leading-relaxed",children:r.disclosure??ue(t)})]})]}),r.authorizeUrl&&s.jsx(b,{asChild:!0,size:"sm",className:"gap-1.5 focus-visible:ring-2",children:s.jsxs(V,{href:r.authorizeUrl,onOpened:()=>e.authOpened(),"aria-label":`Open the sign-in page for ${t}`,children:["Open the sign-in page",s.jsx(X,{className:"size-3.5","aria-hidden":!0})]})})]}),r.step==="failed"&&s.jsxs("div",{className:S("mt-1 space-y-2",i),children:[s.jsx("p",{role:"alert",className:"text-destructive text-xs leading-relaxed",children:r.error??"Sign-in didn’t finish. Try again."}),r.errorDetail&&s.jsxs("details",{className:"text-muted-foreground text-xs",children:[s.jsx("summary",{className:"cursor-pointer focus-visible:ring-2",children:"Details"}),s.jsx("code",{className:"text-2xs mt-1 block font-mono break-all",children:r.errorDetail})]}),p?s.jsx(ce,{onSave:l=>e.useOwnCredentials(l),onCancel:()=>{d(!1),f.current=!0},saving:r.savingCredentials,error:r.credentialsError}):s.jsxs("div",{className:"flex flex-wrap gap-2",children:[o,r.canUseOwnCredentials&&s.jsx(b,{ref:C,variant:"secondary",size:"sm",onClick:()=>d(!0),className:"focus-visible:ring-2",children:"Use your own app credentials"})]})]}),r.step==="connected"&&u&&s.jsx("div",{className:S("mt-1",i),children:u})]})}export{pe as M,he as u};
@@ -1,4 +1,4 @@
1
- var i_=Object.defineProperty;var s_=(r,e,t)=>e in r?i_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var jt=(r,e,t)=>s_(r,typeof e!="symbol"?e+"":e,t);import{r as Xc,j as Kc}from"./index-OQuvRZTD.js";/**
1
+ var i_=Object.defineProperty;var s_=(r,e,t)=>e in r?i_(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var jt=(r,e,t)=>s_(r,typeof e!="symbol"?e+"":e,t);import{r as Xc,j as Kc}from"./index-YUtEyz7O.js";/**
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
@@ -0,0 +1 @@
1
+ import{j as o}from"./index-YUtEyz7O.js";import{P as m}from"./ProfileFields-DD6X85w2.js";import"./profile-errors-vJU1kT3U.js";import"./use-mounted-ref-1T3JbkY1.js";function a({member:r}){return o.jsx(m,{member:r})}export{a as NamePage};
@@ -1 +1 @@
1
- import{a1 as b,a3 as R,a4 as j,aN as x,dD as P,eB as C,r as d,j as e,d0 as E,d1 as M,d3 as k,d4 as T,d5 as K,eC as L,en as B,I,aA as N,B as D,bx as F,by as O,eD as Q,f as _,bz as q,bB as z,eE as H}from"./index-OQuvRZTD.js";function w(t){return Promise.all([t.invalidateQueries({queryKey:x.lists()}),t.invalidateQueries({queryKey:x.details()}),t.invalidateQueries({queryKey:x.threads()})]).then(()=>{})}function A(t){return(t==null?void 0:t.code)==="SLUG_TAKEN"}function Y({isInlineErrorVisible:t}){const n=b(),r=R();return j({mutationFn:({title:a,agentPaths:l})=>n.createRoom({kind:"channel",title:a,members:[],agentPaths:l}),onSuccess:()=>w(r),meta:{suppressErrorToast:!0},onError:a=>{A(a)&&t()||P.error("Couldn’t create that channel.",{description:a.message})}})}function W(){const t=b(),n=R();return j({mutationFn:({agentPaths:r,title:a})=>t.createRoom({kind:"dm",title:a,members:[],agentPaths:r}),onSettled:()=>w(n),meta:{errorLabel:"Couldn’t start that DM"}})}const y=200;function X({open:t,onOpenChange:n,onCreated:r}){const a=C(),[l,m]=d.useState(""),h=d.useRef(null),c=d.useRef(null),u=d.useRef(!0);d.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const o=Y({isInlineErrorVisible:()=>u.current}),g=A(o.error)?o.error.message:null,f=l.trim(),p=f.length>0&&f.length<=y,v=s=>{!p||o.isPending||o.mutate({title:f,agentPaths:s.map(i=>i.agentPath)},{onSuccess:i=>{n(!1),r(i)}})},S=s=>{var i;s.key==="Enter"&&(s.preventDefault(),p&&((i=c.current)==null||i.focus()))};return e.jsx(E,{open:t,onOpenChange:n,children:e.jsxs(M,{className:"sm:max-w-md",onOpenAutoFocus:s=>{var i;s.preventDefault(),(i=h.current)==null||i.focus()},children:[e.jsxs(k,{children:[e.jsx(T,{children:"New channel"}),e.jsx(K,{children:"Name it, then pick who’s in it."})]}),e.jsxs(L,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{htmlFor:"channel-name",children:"Channel name"}),e.jsx(I,{ref:h,id:"channel-name",value:l,maxLength:y,placeholder:"Backend",autoComplete:"off",onChange:s=>{m(s.target.value),o.error&&o.reset()},onKeyDown:S,"aria-invalid":g?!0:void 0,"aria-describedby":g?"channel-name-error":void 0}),g&&e.jsx("p",{id:"channel-name-error",role:"alert",className:"text-destructive text-xs",children:g})]}),e.jsxs("section",{"aria-label":"Agents in this channel",className:"space-y-2 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Who’s in it"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Agents read everything here and reply when @mentioned."}),e.jsx(N,{roster:a,onSubmit:v,submitLabel:s=>s.length===0?"Create channel":s.length===1?"Create channel with 1 agent":`Create channel with ${s.length} agents`,emptyRosterMessage:"You don’t have any agents yet. You can add them to the channel later.",allChosenMessage:"That’s every agent you have.",isSubmitting:o.isPending,submitDisabled:!p,inputRef:c})]}),e.jsx("div",{className:"flex justify-center border-t pt-3",children:e.jsx(D,{type:"button",variant:"ghost",size:"sm",disabled:!p||o.isPending,onClick:()=>v([]),children:"Create it without agents"})})]})]})})}const G="One agent opens a chat. Two or more start a group message.";function V(t){return t.length===1}function $(t){const n=t[0];return n!==void 0&&V(t)?`Open chat with ${n.displayName}`:"Start group message"}function J({onStart:t,open:n,onOpenChange:r,hideTrigger:a=!1}){const l=C(),m=d.useRef(null),h=()=>{r(!1),H.getState().open()};return e.jsxs(F,{open:n,onOpenChange:r,modal:!0,fullHeight:!0,children:[e.jsx(O,{asChild:!0,children:e.jsx(Q,{...a?{"aria-hidden":!0,tabIndex:-1,className:"sr-only"}:{"aria-label":"New message"},children:e.jsx(_,{})})}),e.jsxs(q,{side:"right",align:"start",className:"flex w-64 flex-col p-2","aria-label":"New message",onOpenAutoFocus:c=>{var u;c.preventDefault(),(u=m.current)==null||u.focus()},children:[e.jsx(z,{children:"New message"}),e.jsx(N,{inputRef:m,roster:l,onSubmit:c=>{r(!1),t(c)},submitLabel:$,emptyRosterMessage:"You don’t have any agents yet.",emptyRosterAction:e.jsx(D,{type:"button",size:"sm",variant:"outline",onClick:h,children:"Create agent"}),allChosenMessage:"Everyone is already here."}),e.jsx("p",{className:"text-muted-foreground mt-2 shrink-0 px-2 text-xs",children:G})]})]})}export{X as C,J as N,G as O,V as a,$ as o,W as u};
1
+ import{a5 as b,a7 as R,a8 as C,aQ as x,dB as P,ez as j,r as d,j as e,cY as E,cZ as M,c$ as k,d0 as T,d1 as K,eA as L,el as B,I,aD as N,B as D,by as F,bz as O,eB as Q,f as z,bA as Y,bC as _,eC as q}from"./index-YUtEyz7O.js";function w(t){return Promise.all([t.invalidateQueries({queryKey:x.lists()}),t.invalidateQueries({queryKey:x.details()}),t.invalidateQueries({queryKey:x.threads()})]).then(()=>{})}function A(t){return(t==null?void 0:t.code)==="SLUG_TAKEN"}function H({isInlineErrorVisible:t}){const n=b(),r=R();return C({mutationFn:({title:a,agentPaths:l})=>n.createRoom({kind:"channel",title:a,members:[],agentPaths:l}),onSuccess:()=>w(r),meta:{suppressErrorToast:!0},onError:a=>{A(a)&&t()||P.error("Couldn’t create that channel.",{description:a.message})}})}function W(){const t=b(),n=R();return C({mutationFn:({agentPaths:r,title:a})=>t.createRoom({kind:"dm",title:a,members:[],agentPaths:r}),onSettled:()=>w(n),meta:{errorLabel:"Couldn’t start that DM"}})}const y=200;function X({open:t,onOpenChange:n,onCreated:r}){const a=j(),[l,m]=d.useState(""),h=d.useRef(null),c=d.useRef(null),u=d.useRef(!0);d.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const o=H({isInlineErrorVisible:()=>u.current}),g=A(o.error)?o.error.message:null,f=l.trim(),p=f.length>0&&f.length<=y,v=s=>{!p||o.isPending||o.mutate({title:f,agentPaths:s.map(i=>i.agentPath)},{onSuccess:i=>{n(!1),r(i)}})},S=s=>{var i;s.key==="Enter"&&(s.preventDefault(),p&&((i=c.current)==null||i.focus()))};return e.jsx(E,{open:t,onOpenChange:n,children:e.jsxs(M,{className:"sm:max-w-md",onOpenAutoFocus:s=>{var i;s.preventDefault(),(i=h.current)==null||i.focus()},children:[e.jsxs(k,{children:[e.jsx(T,{children:"New channel"}),e.jsx(K,{children:"Name it, then pick who’s in it."})]}),e.jsxs(L,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(B,{htmlFor:"channel-name",children:"Channel name"}),e.jsx(I,{ref:h,id:"channel-name",value:l,maxLength:y,placeholder:"Backend",autoComplete:"off",onChange:s=>{m(s.target.value),o.error&&o.reset()},onKeyDown:S,"aria-invalid":g?!0:void 0,"aria-describedby":g?"channel-name-error":void 0}),g&&e.jsx("p",{id:"channel-name-error",role:"alert",className:"text-destructive text-xs",children:g})]}),e.jsxs("section",{"aria-label":"Agents in this channel",className:"space-y-2 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Who’s in it"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Agents read everything here and reply when @mentioned."}),e.jsx(N,{roster:a,onSubmit:v,submitLabel:s=>s.length===0?"Create channel":s.length===1?"Create channel with 1 agent":`Create channel with ${s.length} agents`,emptyRosterMessage:"You don’t have any agents yet. You can add them to the channel later.",allChosenMessage:"That’s every agent you have.",isSubmitting:o.isPending,submitDisabled:!p,inputRef:c})]}),e.jsx("div",{className:"flex justify-center border-t pt-3",children:e.jsx(D,{type:"button",variant:"ghost",size:"sm",disabled:!p||o.isPending,onClick:()=>v([]),children:"Create it without agents"})})]})]})})}const $="One agent opens a chat. Two or more start a group message.";function G(t){return t.length===1}function V(t){const n=t[0];return n!==void 0&&G(t)?`Open chat with ${n.displayName}`:"Start group message"}function Z({onStart:t,open:n,onOpenChange:r,hideTrigger:a=!1}){const l=j(),m=d.useRef(null),h=()=>{r(!1),q.getState().open()};return e.jsxs(F,{open:n,onOpenChange:r,modal:!0,fullHeight:!0,children:[e.jsx(O,{asChild:!0,children:e.jsx(Q,{...a?{"aria-hidden":!0,tabIndex:-1,className:"sr-only"}:{"aria-label":"New message"},children:e.jsx(z,{})})}),e.jsxs(Y,{side:"right",align:"start",className:"flex w-64 flex-col p-2","aria-label":"New message",onOpenAutoFocus:c=>{var u;c.preventDefault(),(u=m.current)==null||u.focus()},children:[e.jsx(_,{children:"New message"}),e.jsx(N,{inputRef:m,roster:l,onSubmit:c=>{r(!1),t(c)},submitLabel:V,emptyRosterMessage:"You don’t have any agents yet.",emptyRosterAction:e.jsx(D,{type:"button",size:"sm",variant:"outline",onClick:h,children:"Create agent"}),allChosenMessage:"Everyone is already here."}),e.jsx("p",{className:"text-muted-foreground mt-2 shrink-0 px-2 text-xs",children:$})]})]})}export{X as C,Z as N,$ as O,G as a,V as o,W as u};
@@ -1 +1 @@
1
- import{j as t,w as s}from"./index-OQuvRZTD.js";function o({member:e}){var n;const i=((n=e.agent)==null?void 0:n.manifestId)??null;return i===null?t.jsx("div",{className:"min-h-0 flex-1 px-4 py-3","data-slot":"profile-notifications",children:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Notifications are set per agent."})}):t.jsx("div",{className:"min-h-0 flex-1 px-2 py-2","data-slot":"profile-notifications",children:t.jsx(s,{lens:{agentId:i},emptyLabel:`${e.displayName} has not told you anything yet.`})})}export{o as NotificationsPage};
1
+ import{j as t,w as s}from"./index-YUtEyz7O.js";function o({member:e}){var n;const i=((n=e.agent)==null?void 0:n.manifestId)??null;return i===null?t.jsx("div",{className:"min-h-0 flex-1 px-4 py-3","data-slot":"profile-notifications",children:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Notifications are set per agent."})}):t.jsx("div",{className:"min-h-0 flex-1 px-2 py-2","data-slot":"profile-notifications",children:t.jsx(s,{lens:{agentId:i},emptyLabel:`${e.displayName} has not told you anything yet.`})})}export{o as NotificationsPage};
@@ -1,5 +1,5 @@
1
- import{eS as A,r as f,eT as k,eU as K,a1 as p,a2 as _,a3 as m,a4 as S,eV as M,j as d,eW as v,cZ as R,G as j}from"./index-OQuvRZTD.js";import{u as w}from"./use-mesh-topology-BTYAy6zc.js";const O={activeWithinMs:3600*1e3,inactiveAfterMs:10080*60*1e3};function P(e){if(e.liveKinds.includes("pendingApproval")||e.liveKinds.includes("error")||e.hasBrokenExecutionConfig===!0)return"needs-attention";if(e.liveKinds.includes("streaming"))return"active";if(e.lastActivityAt===null)return"fresh";if(e.now-e.lastActivityAt<=O.activeWithinMs)return"active";const s=Math.max(e.lastActivityAt,e.lastInteractionAt??e.lastActivityAt);return e.now-s>O.inactiveAfterMs?"inactive":"idle"}function x(e,t,s){var a;const n=new Map;for(const[i,o]of Object.entries(e)){if(!s.has(o))continue;const r=K((a=t[i])==null?void 0:a.lifecycle);if(!r)continue;const c=n.get(o);c?c.push(r):n.set(o,[r])}return n}const q=Object.freeze({});function B(e,t=[],s=q){const n=e.join(`
1
+ import{eQ as A,r as f,eR as k,eS as K,a5 as p,a6 as R,a7 as m,a8 as S,eT as M,j as d,eU as v,cV as _,G as j}from"./index-YUtEyz7O.js";import{u as w}from"./use-mesh-topology-BzSFyR_s.js";const O={activeWithinMs:3600*1e3,inactiveAfterMs:10080*60*1e3};function P(e){if(e.liveKinds.includes("pendingApproval")||e.liveKinds.includes("error")||e.hasBrokenExecutionConfig===!0)return"needs-attention";if(e.liveKinds.includes("streaming"))return"active";if(e.lastActivityAt===null)return"fresh";if(e.now-e.lastActivityAt<=O.activeWithinMs)return"active";const s=Math.max(e.lastActivityAt,e.lastInteractionAt??e.lastActivityAt);return e.now-s>O.inactiveAfterMs?"inactive":"idle"}function x(e,t,s){var a;const n=new Map;for(const[i,o]of Object.entries(e)){if(!s.has(o))continue;const r=K((a=t[i])==null?void 0:a.lifecycle);if(!r)continue;const c=n.get(o);c?c.push(r):n.set(o,[r])}return n}const q=Object.freeze({});function B(e,t=[],s=q){const n=e.join(`
2
2
  `),a=t.join(`
3
3
  `),i=A(f.useCallback(u=>u.statusCwds,[])),o=A(f.useCallback(u=>u.statuses,[])),{data:r}=k(),c=r==null?void 0:r.agentActivity;return f.useMemo(()=>{const u=n.length===0?[]:n.split(`
4
4
  `),N=new Set(a.length===0?[]:a.split(`
5
- `)),b=x(i,o,new Set(u)),T=Date.now(),y={};for(const l of u){const g=c==null?void 0:c[l];y[l]=P({liveKinds:b.get(l)??[],lastActivityAt:g?new Date(g).getTime():null,lastInteractionAt:s[l]??null,now:T,hasBrokenExecutionConfig:N.has(l)})}return y},[n,a,i,o,c,s])}function W(e){const t=p();return _({queryKey:["mesh","agent-health",e],queryFn:()=>t.getMeshAgentHealth(e),enabled:e!==null})}const h=["mesh","topology"];function G(){const e=p(),t=m();return S({mutationFn:s=>e.updateMeshAccessRule(s),onSuccess:()=>{t.invalidateQueries({queryKey:h})}})}function E(){const e=p(),t=m();return S({mutationFn:s=>e.updateMeshAccessRule({sourceNamespace:M,targetNamespace:M,action:s?"allow":"deny"}),onMutate:async s=>{await t.cancelQueries({queryKey:h});const n=t.getQueriesData({queryKey:h});return t.setQueriesData({queryKey:h},a=>a&&{...a,openMesh:s}),{previous:n}},onError:(s,n,a)=>{for(const[i,o]of(a==null?void 0:a.previous)??[])t.setQueryData(i,o)},onSettled:()=>{t.invalidateQueries({queryKey:h})}})}const C="Let all my agents talk to each other",L="On: any agent can message any other. Off: same project, plus pairs below.",D="New agents reach only their own project. Change it later in Team → Access.";function H({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(v,{label:C,description:L,checked:e,onCheckedChange:t,disabled:s,className:n})}function Q({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(v,{label:C,description:D,checked:e,onCheckedChange:t,disabled:s,className:j("bg-muted/40 rounded-xl px-4 py-3",n)})}function U(){const{data:e}=w(),{mutate:t,isPending:s}=E();return d.jsx(H,{checked:(e==null?void 0:e.openMesh)??!1,onCheckedChange:t,disabled:s})}function Y({className:e}){const{data:t}=w(),{data:s}=R(),{mutate:n,isPending:a}=E(),i=((s==null?void 0:s.agents)??[]).filter(o=>!o.isSystem).length;return(t==null?void 0:t.openMesh)!==!1||i===0?null:d.jsx(Q,{checked:!1,onCheckedChange:n,disabled:a,className:e})}export{U as O,G as a,W as b,Y as c,B as u};
5
+ `)),b=x(i,o,new Set(u)),T=Date.now(),y={};for(const l of u){const g=c==null?void 0:c[l];y[l]=P({liveKinds:b.get(l)??[],lastActivityAt:g?new Date(g).getTime():null,lastInteractionAt:s[l]??null,now:T,hasBrokenExecutionConfig:N.has(l)})}return y},[n,a,i,o,c,s])}function G(e){const t=p();return R({queryKey:["mesh","agent-health",e],queryFn:()=>t.getMeshAgentHealth(e),enabled:e!==null})}const h=["mesh","topology"];function U(){const e=p(),t=m();return S({mutationFn:s=>e.updateMeshAccessRule(s),onSuccess:()=>{t.invalidateQueries({queryKey:h})}})}function E(){const e=p(),t=m();return S({mutationFn:s=>e.updateMeshAccessRule({sourceNamespace:M,targetNamespace:M,action:s?"allow":"deny"}),onMutate:async s=>{await t.cancelQueries({queryKey:h});const n=t.getQueriesData({queryKey:h});return t.setQueriesData({queryKey:h},a=>a&&{...a,openMesh:s}),{previous:n}},onError:(s,n,a)=>{for(const[i,o]of(a==null?void 0:a.previous)??[])t.setQueryData(i,o)},onSettled:()=>{t.invalidateQueries({queryKey:h})}})}const C="Let all my agents talk to each other",L="On: any agent can message any other. Off: same project, plus pairs below.",Q="New agents reach only their own project. Change it later in Team → Access.";function D({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(v,{label:C,description:L,checked:e,onCheckedChange:t,disabled:s,className:n})}function H({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(v,{label:C,description:Q,checked:e,onCheckedChange:t,disabled:s,className:j("bg-muted/40 rounded-xl px-4 py-3",n)})}function W(){const{data:e}=w(),{mutate:t,isPending:s}=E();return d.jsx(D,{checked:(e==null?void 0:e.openMesh)??!1,onCheckedChange:t,disabled:s})}function Y({className:e}){const{data:t}=w(),{data:s}=_(),{mutate:n,isPending:a}=E(),i=((s==null?void 0:s.agents)??[]).filter(o=>!o.isSystem).length;return(t==null?void 0:t.openMesh)!==!1||i===0?null:d.jsx(H,{checked:!1,onCheckedChange:n,disabled:a,className:e})}export{W as O,U as a,G as b,Y as c,B as u};
@@ -0,0 +1 @@
1
+ import{bk as j,ft as F,fu as H,aZ as x,r as g,cb as P,cf as B,cn as w,fv as G,a5 as D,a6 as K,c0 as M,bX as Y,fw as q,z,bl as W,j as i,el as N,I as R,B as A}from"./index-YUtEyz7O.js";import{d as Q,c as U,n as V,h as X}from"./profile-errors-vJU1kT3U.js";import{u as Z}from"./use-mounted-ref-1T3JbkY1.js";import{u as L,F as k}from"./ProfileFields-DD6X85w2.js";function J(e){return{name:e.displayName.trim()===""||e.displayName===j,handle:!e.handle}}function de(e){const r=J(e);return r.name||r.handle}function $(e,r){var t,s,d;const a=(d=(s=(t=e.person)==null?void 0:t.email)==null?void 0:s.split("@")[0])==null?void 0:d.trim();if(!a)return"";const o=new Set([...F,...r.filter(l=>l.id!==e.id&&l.handle).map(l=>l.handle.toLowerCase())]);return H(a,o)??""}function ue(){const e=x(a=>a.setRightPanelOpen),r=x(a=>a.setActiveRightPanelTab);g.useEffect(()=>{const a=o=>{if((o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key==="A"){o.preventDefault();const{rightPanelOpen:t,activeRightPanelTab:s}=x.getState();t&&s===P?e(!1):(r(P),e(!0))}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r])}const ee="agent-hub",te={sessions:"sessions",tasks:"tasks",tools:"tools",channels:"rooms",config:null,toolkit:null,identity:null,overview:null,profile:null,personality:null};function ae(e){return(typeof e=="string"?te[e]:null)??void 0}const I=new Set(["identity","personality","channels","tools"]);function ne(){var n;const e=w(),r=D(),a=K({queryKey:["profile-location",e.profileRef],queryFn:()=>r.getSessionLocation(e.profileRef),enabled:!!e.profileRef}),o=M(m=>m.openProfileDockedFromLink),t=x(m=>m.requestRightPanel),s=x(m=>m.setExplicitAgentPath),d=Y(),l=e.panel===P,c=e.agentPath??((n=a.data)==null?void 0:n.cwd)??null,u=q(e.profilePage)??void 0,h=g.useRef(null);g.useEffect(()=>{!l&&c&&h.current!==c&&(h.current=c,s(c))},[l,c,s]);const f=g.useRef(new Map);g.useEffect(()=>{if(!l){f.current.clear();return}if(e.profileRef&&!c)return;const m=c??d;if(m){const p=f.current.get(m);if(p!==void 0&&(u===void 0||p.has(u)))return;f.current.set(m,(p??new Set).add(u??"")),o(m,u);return}t(P,null)},[l,e.profileRef,c,d,u,o,t])}function se(){const e=w(),r=G(),a=D(),o=e.panel===ee,t=e.dialog==="agent"||!!e.agent&&I.has(e.agent),s=o||t,d=o?e.hubTab:e.agent;g.useEffect(()=>{if(!s&&!e.agentPath||!r)return;let l=!1;return(async()=>{const u=e.profileRef??(e.agentPath?(await a.createSessionLocation(e.agentPath)).id:void 0);if(l)return;const h=ae(d);r({search:f=>{const n={...f};return e.dialog==="agent"&&delete n.dialog,typeof n.agent=="string"&&I.has(n.agent)&&delete n.agent,u&&(n.profileRef=u,delete n.agentPath),s&&(delete n.hubTab,n.panel=P,h?n.profilePage=h:delete n.profilePage),n},replace:!0})})().catch(()=>{}),()=>{l=!0}},[s,e.dialog,e.agentPath,e.profileRef,d,r,a])}function fe(){se(),ne(),B()}function re(){var S,b;const r=((S=z().data)==null?void 0:S.members)??[],a=r.find(v=>v.isSelf),o=Z(),t=Q({isShownInline:()=>o.current}),s=U({isShownInline:()=>o.current}),[d,l]=g.useState(!1),c=!a||a.displayName===j?"":a.displayName,u=(a==null?void 0:a.handle)??"",[h,f]=L(c),[n,m]=L(a?u||$(a,r):""),p=h.trim(),y=n.trim(),E=a?W(a):null,T=p.length>0&&(p!==c||E!==null),C=t.isError&&t.variables===p?V(t.error):null,O=s.isError&&((b=s.variables)==null?void 0:b.handle)===y?X(s.error,y):null,_=async()=>{if(!a)return!1;l(!0);let v=!0;return T&&(v=await t.mutateAsync(p).then(()=>v,()=>!1)),y&&y!==u&&(v=await s.mutateAsync({authorId:a.id,handle:y}).then(()=>v,()=>!1)),l(!1),v};return{ready:a!==void 0,name:h,setName:f,handle:n,setHandle:m,canSave:a!==void 0&&!d&&(p.length>0||y.length>0),saving:d,nameError:C,nameSuggestion:E!==null&&p===c?E:null,handleError:O,save:_}}function he({onSaved:e,confirmLabel:r="Save",onSkip:a,skipLabel:o="Skip"}){const t=re(),s=g.useId(),d=g.useId(),l=g.useId(),c=f=>{f.preventDefault(),t.canSave&&t.save().then(n=>{n&&e()})},u=t.nameError!==null||t.handleError!==null;let h=r;return t.saving?h="Saving…":u&&(h="Try again"),i.jsxs("form",{onSubmit:c,className:"flex flex-col gap-3","data-testid":"operator-identity-form",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:s,className:"text-xs",children:"Your name"}),i.jsx(R,{id:s,value:t.name,maxLength:80,autoComplete:"name",placeholder:"What you go by",disabled:!t.ready,onChange:f=>t.setName(f.target.value),className:"h-8 text-sm"}),t.nameSuggestion&&!t.nameError&&i.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.nameSuggestion,". Save it to make it yours."]}),t.nameError&&i.jsx(k,{tone:"error",children:t.nameError})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:d,className:"text-xs",children:"Handle"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-sm",children:"@"}),i.jsx(R,{id:d,value:t.handle,maxLength:64,autoComplete:"username",autoCapitalize:"none",spellCheck:!1,placeholder:"yourname","aria-describedby":l,disabled:!t.ready,onChange:f=>t.setHandle(f.target.value),className:"h-8 pl-6 text-sm"})]}),i.jsx("p",{id:l,className:"text-muted-foreground text-xs",children:"What others type after @ to reach you."}),t.handleError&&i.jsx(k,{tone:"error",children:t.handleError})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx(A,{type:"submit",size:"sm",disabled:!t.canSave,"data-testid":"confirm-identity",children:h}),a&&i.jsx(A,{type:"button",size:"sm",variant:"ghost",onClick:a,disabled:t.saving,"data-testid":"skip-identity",children:o})]})]})}export{he as O,ne as a,fe as b,ue as c,de as i,se as u};