dorkos 0.128.0 → 0.130.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 (375) hide show
  1. package/dist/bin/cli.js +766 -517
  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-B2CzVj5W.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-Dw231W2w.js → ActivityErrorState-Dl-P-e0R.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-DVfeyA9u.js → ActivityPage-CW7tqLHb.js} +1 -1
  7. package/dist/client/assets/ActivityRow-Vy4aXWk-.js +1 -0
  8. package/dist/client/assets/{AdapterIcon-NqCDzgCI.js → AdapterIcon-aabKVZmM.js} +1 -1
  9. package/dist/client/assets/AdapterSetupWizard-C5Hs0xkG.js +2 -0
  10. package/dist/client/assets/{AgentOptionRow-BRJfZo2y.js → AgentOptionRow-CqIMxq9S.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-B7upjYRk.js → AgentPicker-C6mbTDJJ.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-DXJnLk6q.js → AgentRequestCard-C8GV5Sxn.js} +4 -4
  13. package/dist/client/assets/AppearancePage-C0JKrHsO.js +1 -0
  14. package/dist/client/assets/{ApplyToOverridesDialog-C_QQhNIf.js → ApplyToOverridesDialog-DWEi0MNt.js} +1 -1
  15. package/dist/client/assets/AttentionSignalRow-Cpu0lKYg.js +1 -0
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-G7vrCqeA.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-_zVrHu5s.js} +3 -3
  17. package/dist/client/assets/BindingDialog-4UeaJfUu.js +1 -0
  18. package/dist/client/assets/BlintzCanvas-DCXIQZM_.js +1231 -0
  19. package/dist/client/assets/{CanvasCsvContent-CtLpZnTs.js → CanvasCsvContent-D-0TuvVs.js} +4 -4
  20. package/dist/client/assets/CanvasFileContent-DqSx7lz9.js +2 -0
  21. package/dist/client/assets/CanvasModel3dContent-zTx660yQ.js +2 -0
  22. package/dist/client/assets/ChannelComposer-D4TYVkvO.js +45 -0
  23. package/dist/client/assets/{ChatAppsOff-CCZUzDIH.js → ChatAppsOff-BzfyQc55.js} +2 -2
  24. package/dist/client/assets/{CodeMirrorDiff-BCpYdhgZ.js → CodeMirrorDiff-BLWBYGLp.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-BeCubxHV.js → CodeMirrorEditor-D0q3ETxK.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-BZtfTnwg.js → CommitmentList-BoMiLsRe.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-DmurDgxV.js → CommitmentsPage-_7mNJVUZ.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-Bik6GLKp.js → ComputerResourceView-Bo2LaCJf.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-CksBDqdu.js → ComputerViewer-a4VSdAw_.js} +1 -1
  30. package/dist/client/assets/ConnectionAccessLists-Dvv0YO31.js +1 -0
  31. package/dist/client/assets/{ConnectionsPage-Cgg36gDY.js → ConnectionsPage-oO8pNgbc.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-CNhpF6Z1.js → ConventionPage-CFJjwhBd.js} +2 -2
  33. package/dist/client/assets/{ExtensionPageRoute-C2zue_Pw.js → ExtensionPageRoute-BqZN9q7M.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-3v1TfY1P.js → FloatingTanStackRouterDevtools-CqogiFob-CnSp2ZEM.js} +1 -1
  35. package/dist/client/assets/{ForwardConsentHost-Mbo0D-zk.js → ForwardConsentHost-4LhRvCdu.js} +1 -1
  36. package/dist/client/assets/HandlePage-BjoYPqme.js +1 -0
  37. package/dist/client/assets/HeartbeatPage-rJzICayy.js +1 -0
  38. package/dist/client/assets/{KeyEntry-C43vkwpA.js → KeyEntry-BTTuXleL.js} +1 -1
  39. package/dist/client/assets/{LexicalField-iAHcvRmI.js → LexicalField-Dk_SDrjk.js} +1 -1
  40. package/dist/client/assets/{ManagesPage-BUIJvLmv.js → ManagesPage-Cvu3CQDn.js} +1 -1
  41. package/dist/client/assets/Marketplace-DPjPPlZz.js +36 -0
  42. package/dist/client/assets/{MarketplaceSourcesView-BZODwhxu.js → MarketplaceSourcesView-ChCys0on.js} +1 -1
  43. package/dist/client/assets/{McpAppFrame-D15nxVaI.js → McpAppFrame-DNamtzOp.js} +2 -2
  44. package/dist/client/assets/{McpSigninBody-DmBxqgxN.js → McpSigninBody-DLw3ZdZE.js} +1 -1
  45. package/dist/client/assets/{Model3dViewer-RGXeJd6a.js → Model3dViewer-IwCBCPZ2.js} +1 -1
  46. package/dist/client/assets/NamePage-FY_D0eA2.js +1 -0
  47. package/dist/client/assets/NewDirectMessageMenu-BB0gvClR.js +1 -0
  48. package/dist/client/assets/{NotificationsPage-NRfyiinS.js → NotificationsPage-aCF0AtqL.js} +1 -1
  49. package/dist/client/assets/{OpenMeshSwitch-CgQ6uefo.js → OpenMeshSwitch-DjCWF2Vy.js} +2 -2
  50. package/dist/client/assets/OperatorIdentityForm-Bcveds6f.js +1 -0
  51. package/dist/client/assets/{PermissionHistory-DPEPq8D9.js → PermissionHistory-CYsxFYmV.js} +1 -1
  52. package/dist/client/assets/{PermissionsPage--k-xutbJ.js → PermissionsPage-sxHkY92V.js} +1 -1
  53. package/dist/client/assets/{PersonalityPopover-DMMptmPS.js → PersonalityPopover-BZ20JTnJ.js} +1 -1
  54. package/dist/client/assets/PhotoPage-KBzkb0sT.js +1 -0
  55. package/dist/client/assets/PreviewRefusedNotice-BFQPYcUG.js +1 -0
  56. package/dist/client/assets/{ProfileFields-DbPJ7fvN.js → ProfileFields-sp17IFo8.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-CzwhrIlw.js → ProfilePanelContainer-mA44jh5A.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-CZEXvlJm.js → ProfileRolePicker-Chh4_ZMB.js} +1 -1
  59. package/dist/client/assets/PromptSuggestionChips-CEi_-fHF.js +1 -0
  60. package/dist/client/assets/{ReportsToPopover-YOwGLJy5.js → ReportsToPopover-D1uknwnk.js} +1 -1
  61. package/dist/client/assets/RoomSurface-Clf1yLrr.js +1 -0
  62. package/dist/client/assets/{RoomsPage-CoXjZMWL.js → RoomsPage-BtCNzvhQ.js} +1 -1
  63. package/dist/client/assets/RunsOnPopover-LCvBpe9J.js +1 -0
  64. package/dist/client/assets/RuntimeConnectFlow-C5UDeHUC.js +1 -0
  65. package/dist/client/assets/RuntimeSetupDialog-Bqh67Vqb.js +1 -0
  66. package/dist/client/assets/{SeenDevices-Bh2yh-PW.js → SeenDevices-DvCfdeDo.js} +3 -3
  67. package/dist/client/assets/{SessionsPage-CFvkbT9X.js → SessionsPage-DLByE-re.js} +1 -1
  68. package/dist/client/assets/SettingsDialog-Co-Oxtyw.js +12 -0
  69. package/dist/client/assets/SkillsPage-Cc79IstM.js +1 -0
  70. package/dist/client/assets/TaskDialogWrapper-DuYV7Zch.js +1 -0
  71. package/dist/client/assets/TasksEmptyState-CfmPtBra.js +3 -0
  72. package/dist/client/assets/{TasksPage-D0Zi6Mve.js → TasksPage-DGk0zUhO.js} +1 -1
  73. package/dist/client/assets/{TeamComputerEntry-CY9eLVad.js → TeamComputerEntry-CLHbeX5i.js} +1 -1
  74. package/dist/client/assets/{ToolsPage-0_vx5P-F.js → ToolsPage-CSkDE7rZ.js} +2 -2
  75. package/dist/client/assets/{TopologyGraph-DUZLZZrB.js → TopologyGraph-pBC37k5P.js} +14 -14
  76. package/dist/client/assets/TourHost-CS9RsLj_.js +1 -0
  77. package/dist/client/assets/{UnlinkDialog-ptZy3IN4.js → UnlinkDialog-CelhOUZ0.js} +1 -1
  78. package/dist/client/assets/{UnreadDivider-Ckey1IWn.js → UnreadDivider-B_OMR0mQ.js} +1 -1
  79. package/dist/client/assets/WidgetErrorCard-CsMqCyCb.js +108 -0
  80. package/dist/client/assets/{WithheldExtensionsNotice-7Vu1Jctn.js → WithheldExtensionsNotice-GiKb0iQu.js} +1 -1
  81. package/dist/client/assets/WorkQueuePage-Cu721KyM.js +1 -0
  82. package/dist/client/assets/WorkView-CpWEaxMr.js +51 -0
  83. package/dist/client/assets/_shell-CmGG8Ysk.js +80 -0
  84. package/dist/client/assets/{_shell._home-BRIXhYLg.js → _shell._home-BnKkAeSp.js} +1 -1
  85. package/dist/client/assets/_shell._home.activity-DaaLJbvO.js +1 -0
  86. package/dist/client/assets/_shell._home.index-CNPasFxP.js +3 -0
  87. package/dist/client/assets/_shell._home.tasks-DXEOJ5Nq.js +1 -0
  88. package/dist/client/assets/_shell._home.workspaces-UeSvmquR.js +1 -0
  89. package/dist/client/assets/{_shell.channels-Bx6q9xVH.js → _shell.channels-NUbf5mcb.js} +4 -4
  90. package/dist/client/assets/_shell.connections-BEns4DKb.js +1 -0
  91. package/dist/client/assets/{_shell.feedback-requests-DFznTGbN.js → _shell.feedback-requests-NyjHNdnj.js} +2 -2
  92. package/dist/client/assets/_shell.marketplace-BEYqsDKe.js +1 -0
  93. package/dist/client/assets/_shell.marketplace_.sources-D6Ls30FY.js +1 -0
  94. package/dist/client/assets/_shell.session-CVc6i3eN.js +1 -0
  95. package/dist/client/assets/{_shell.team-DmA09abY.js → _shell.team-CXeOt4XD.js} +6 -6
  96. package/dist/client/assets/_shell.threads-BYdN1UtZ.js +1 -0
  97. package/dist/client/assets/_shell.x._extensionId-DtJYSfvG.js +1 -0
  98. package/dist/client/assets/_shell.x._extensionId_._-DtJYSfvG.js +1 -0
  99. package/dist/client/assets/{abnfDiagram-WEYOIA3C-DxgtVd9I.js → abnfDiagram-WEYOIA3C-BLCVDt6M.js} +1 -1
  100. package/dist/client/assets/{access-copy-Dqct36mi.js → access-copy-BSQ3QECN.js} +1 -1
  101. package/dist/client/assets/{arc-C-67Ef0p.js → arc-t4OhsI5R.js} +1 -1
  102. package/dist/client/assets/{architectureDiagram-ZHVYKT53-B7TjdT-_.js → architectureDiagram-ZHVYKT53-BcIfbGZR.js} +1 -1
  103. package/dist/client/assets/{banner-C9qTs6-C.js → banner-B6xfuDA7.js} +2 -2
  104. package/dist/client/assets/{blockDiagram-RJAE7QA3-DNqxJ3Ww.js → blockDiagram-RJAE7QA3-DTOlrcEZ.js} +1 -1
  105. package/dist/client/assets/{c4Diagram-XDPPPE54-D3jNLV0j.js → c4Diagram-XDPPPE54-CHGqwaxa.js} +1 -1
  106. package/dist/client/assets/channel-CSk6LhO2.js +1 -0
  107. package/dist/client/assets/{chunk-2E7WHVMD-C6OKx0ty.js → chunk-2E7WHVMD-Bh4L_7yX.js} +1 -1
  108. package/dist/client/assets/{chunk-2Q5K7J3B-Dr_6hHrZ.js → chunk-2Q5K7J3B-BmouLl8r.js} +1 -1
  109. package/dist/client/assets/{chunk-4EMNKR2T-CSrZVDEt.js → chunk-4EMNKR2T-BVhtiAdG.js} +1 -1
  110. package/dist/client/assets/{chunk-55XCU76K-CIazeRXO.js → chunk-55XCU76K-BdbLnE56.js} +1 -1
  111. package/dist/client/assets/{chunk-5VM5RSS4-C8IJ3zTR.js → chunk-5VM5RSS4-Qg9lQpPO.js} +1 -1
  112. package/dist/client/assets/{chunk-JWPE2WC7-D9DGXb79.js → chunk-JWPE2WC7-CfIrQaMW.js} +1 -1
  113. package/dist/client/assets/{chunk-VQ5W62QI-B0LNYdif.js → chunk-VQ5W62QI-BP9oQzc0.js} +1 -1
  114. package/dist/client/assets/{chunk-XXDRQBXY-C7IAIbvZ.js → chunk-XXDRQBXY-DKzIjnsB.js} +1 -1
  115. package/dist/client/assets/{chunk-ZCHMQSOR-C79hvjlu.js → chunk-ZCHMQSOR-DsvG6BGY.js} +2 -2
  116. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-0Di1C2ZB.js → classDiagram-v2-4MYWR3UA-BSiSmGgP.js} +1 -1
  117. package/dist/client/assets/{command-BVQb6I3_.js → command-B_FPXirc.js} +1 -1
  118. package/dist/client/assets/copy-button-Bp75zBSh.js +1 -0
  119. package/dist/client/assets/{cose-bilkent-JH36ORCC-rZumaV4b.js → cose-bilkent-JH36ORCC-CXgyrZix.js} +1 -1
  120. package/dist/client/assets/{cpu-DeRuDMl4.js → cpu-DpkNIYeK.js} +1 -1
  121. package/dist/client/assets/{cynefin-EF2NZ3EQ-CI9l9xhM.js → cynefin-EF2NZ3EQ-DkmPO3hK.js} +1 -1
  122. package/dist/client/assets/{cynefinDiagram-WF24UDRP-C8CdorJJ.js → cynefinDiagram-WF24UDRP-BDknJT17.js} +1 -1
  123. package/dist/client/assets/{dagre-NK4GIZVX-AHpsTq1O.js → dagre-NK4GIZVX-BR4J5E3b.js} +1 -1
  124. package/dist/client/assets/detail-row-C8zz6mAC.js +1 -0
  125. package/dist/client/assets/{diagram-CBK3MWTC-BpPLL30n.js → diagram-CBK3MWTC-CvLKqPry.js} +1 -1
  126. package/dist/client/assets/{diagram-I5XIIV2D-D6loMn3G.js → diagram-I5XIIV2D-CVtE60X9.js} +1 -1
  127. package/dist/client/assets/{diagram-ODIL2UCW-BaGNd5eN.js → diagram-ODIL2UCW-B--CpfLk.js} +1 -1
  128. package/dist/client/assets/{diagram-PFBEJUXE-BnDdKu_g.js → diagram-PFBEJUXE-08gch1t1.js} +1 -1
  129. package/dist/client/assets/{diagram-RJA3I4VV-UXagB0_c.js → diagram-RJA3I4VV-C2e-ubaD.js} +1 -1
  130. package/dist/client/assets/{diagram-TYUNFSNR-C-whBP-S.js → diagram-TYUNFSNR-DcpK4OXX.js} +1 -1
  131. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-BbG481iS.js → ebnfDiagram-V4P3TTPT-DM44BkBt.js} +1 -1
  132. package/dist/client/assets/{elk-QONTBCTQ-FtssIxOc.js → elk-QONTBCTQ-maYS1Zzm.js} +1 -1
  133. package/dist/client/assets/{empty-state-CACt-76q.js → empty-state-HtOTBAoq.js} +1 -1
  134. package/dist/client/assets/{erDiagram-KYQIGQAA-PpFgUf4C.js → erDiagram-KYQIGQAA-BR7z9r2M.js} +1 -1
  135. package/dist/client/assets/{execution-config-CGL73sRn.js → execution-config-DYYeJyJh.js} +1 -1
  136. package/dist/client/assets/{file-D80JE_L0.js → file-VtGYNr9E.js} +1 -1
  137. package/dist/client/assets/{file-exclamation-point-CcJ_e4_m.js → file-exclamation-point-eBlQssyW.js} +1 -1
  138. package/dist/client/assets/{file-text-Ds9edaTZ.js → file-text-DvNAxTGZ.js} +1 -1
  139. package/dist/client/assets/{find-latest-widget-fence-BtqFMP_f.js → find-latest-widget-fence-C2qXvASs.js} +5 -5
  140. package/dist/client/assets/{flowDiagram-IUGLLWBU-BIva66g9.js → flowDiagram-IUGLLWBU-DiuMtMbj.js} +1 -1
  141. package/dist/client/assets/form-CGIIzr1u.js +1 -0
  142. package/dist/client/assets/{format-cron-BpGrgPLu.js → format-cron-BzJ6ekoo.js} +1 -1
  143. package/dist/client/assets/format-tokens-DymkROvy.js +1 -0
  144. package/dist/client/assets/{ganttDiagram-R7GPNTJY-CZqips_4.js → ganttDiagram-R7GPNTJY-Cf_z8Ri1.js} +1 -1
  145. package/dist/client/assets/{git-branch-B8JNwQ6q.js → git-branch-BVzjBPW-.js} +1 -1
  146. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DoIc3lda.js → gitGraphDiagram-PDYL7XHY-RZXACCBr.js} +1 -1
  147. package/dist/client/assets/{graph-yizM0vwL.js → graph-DfAV_ObD.js} +1 -1
  148. package/dist/client/assets/{heart-BavUIV45.js → heart-BMOCYMFT.js} +1 -1
  149. package/dist/client/assets/{highlighted-body-KPVGNVTW-CGr3AgaU.js → highlighted-body-KPVGNVTW-DrrsaKBc.js} +1 -1
  150. package/dist/client/assets/image-lightbox-tAwBNBhm.js +1 -0
  151. package/dist/client/assets/{image-off-C1uTDs9-.js → image-off-BpagBHk1.js} +1 -1
  152. package/dist/client/assets/{index-CrTmY12y.js → index-0uCJUW_h.js} +2 -2
  153. package/dist/client/assets/index-0y0K3rYv.js +1 -0
  154. package/dist/client/assets/{index-CJXMgnYp.js → index-2GjydAcS.js} +1 -1
  155. package/dist/client/assets/index-6dsaPQ7-.js +1 -0
  156. package/dist/client/assets/{index-X282DRZf.js → index-7-yzdcAx.js} +3 -3
  157. package/dist/client/assets/{index-C8ZpJXTQ.js → index-A7HgzxSw.js} +1 -1
  158. package/dist/client/assets/{index-DW4KUPHp.js → index-BEqKTiCR.js} +1 -1
  159. package/dist/client/assets/{index-56EOd-zy.js → index-BIN0yv4s.js} +1 -1
  160. package/dist/client/assets/{index-FhWMRBQP.js → index-BL5Vmq62.js} +1 -1
  161. package/dist/client/assets/index-BOvFXsF_.js +1 -0
  162. package/dist/client/assets/index-BbcfxnHC.js +1 -0
  163. package/dist/client/assets/{index-DqkFtcGQ.js → index-BdKIijqB.js} +1 -1
  164. package/dist/client/assets/{index-BOEPL6hN.js → index-BfAymWoj.js} +1 -1
  165. package/dist/client/assets/{index-BKWJiERs.js → index-Bgts5its.js} +1 -1
  166. package/dist/client/assets/{index-n_pnc-CO.js → index-BiL3chP7.js} +1 -1
  167. package/dist/client/assets/{index-FI_y_dND.js → index-Bu3PEVA_.js} +1 -1
  168. package/dist/client/assets/{index-BOhSPP-6.js → index-C6DTV4h3.js} +1 -1
  169. package/dist/client/assets/{index-Cdod8zEY.js → index-CCH9c-nB.js} +1 -1
  170. package/dist/client/assets/{index-BkJlIXqM.js → index-CH4NJ8dD.js} +1 -1
  171. package/dist/client/assets/{index-CiGYtR9O.js → index-CKGJp3Cm.js} +1 -1
  172. package/dist/client/assets/{index-DEiSJbvu.js → index-CeqI4FFw.js} +1 -1
  173. package/dist/client/assets/{index-C4t0UTU-.js → index-Cj9-XXKl.js} +1 -1
  174. package/dist/client/assets/{index-ZR5f82z2.js → index-Cu8tnfM_.js} +1 -1
  175. package/dist/client/assets/{index-Dcd4NqFB.js → index-D4OWRMsG.js} +1 -1
  176. package/dist/client/assets/{index-Br6xDNvu.js → index-D8SP73Xw.js} +1 -1
  177. package/dist/client/assets/{index-CoNMlH37.js → index-DEJXVqcY.js} +1 -1
  178. package/dist/client/assets/{index-CoKNU2F9.js → index-DEMZynQt.js} +1 -1
  179. package/dist/client/assets/index-DGzMwE1Z.js +1 -0
  180. package/dist/client/assets/{index-1QfQImuJ.js → index-DIJdZqg2.js} +3 -3
  181. package/dist/client/assets/{index-YSHcMqHa.js → index-DIRqrOEK.js} +1 -1
  182. package/dist/client/assets/{index-CeDn1Ak1.js → index-DNbdGvs9.js} +1 -1
  183. package/dist/client/assets/{index-7XeZCCDI.js → index-DOBjxRe9.js} +1 -1
  184. package/dist/client/assets/{index-BJEt9R_G.js → index-DcBlHsnC.js} +1 -1
  185. package/dist/client/assets/index-DdsaTuqO.js +1 -0
  186. package/dist/client/assets/index-Dt4H9Tms.js +17 -0
  187. package/dist/client/assets/{index-DYEmUa5t.js → index-HXC63Ry8.js} +1 -1
  188. package/dist/client/assets/index-MHIn2TC9.js +1063 -0
  189. package/dist/client/assets/{index-tgbcsB6H.js → index-OjJ_8uMM.js} +1 -1
  190. package/dist/client/assets/index-P4Wos1Gi.css +1 -0
  191. package/dist/client/assets/{index-QSXJR98z.js → index-U5jTIqzv.js} +1 -1
  192. package/dist/client/assets/{index-CXBYgGja.js → index-ZzPr9GUI.js} +1 -1
  193. package/dist/client/assets/index-d9cqTUAj.js +1 -0
  194. package/dist/client/assets/{index-LwL5BpE4.js → index-fcfCRITA.js} +1 -1
  195. package/dist/client/assets/{index-SOKlO1zZ.js → index-onQlu3UR.js} +1 -1
  196. package/dist/client/assets/{index.esm-CAeUe7uQ.js → index.esm-DSKTDEoH.js} +1 -1
  197. package/dist/client/assets/{infoDiagram-MVDRKAX5-DweUdYSy.js → infoDiagram-MVDRKAX5-B8dulOBe.js} +1 -1
  198. package/dist/client/assets/{inline-code-SYHTKcle.js → inline-code-B3qpjdZ2.js} +1 -1
  199. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DKNQIv7P.js → ishikawaDiagram-HPEHV2GE-Cy8aIg0O.js} +1 -1
  200. package/dist/client/assets/{journeyDiagram-BOSHW7O7-DPD7F4VO.js → journeyDiagram-BOSHW7O7-BZAlejG3.js} +1 -1
  201. package/dist/client/assets/{kanban-definition-FNSA4HC5-B_uPSwxC.js → kanban-definition-FNSA4HC5-BxS1edpe.js} +1 -1
  202. package/dist/client/assets/{layers-F4mvrI2l.js → layers-ByCM7XO5.js} +1 -1
  203. package/dist/client/assets/{lightbulb-a6nNsrzy.js → lightbulb-KjW8YTXH.js} +1 -1
  204. package/dist/client/assets/{link-2-yI2Tlm7Q.js → link-2-CtFfuMO5.js} +1 -1
  205. package/dist/client/assets/{list-runtime-types-CsGil5te.js → list-runtime-types-DrzHejZo.js} +1 -1
  206. package/dist/client/assets/{markdown-content-Cjhsscbn.js → markdown-content-DgiSdNwz.js} +1 -1
  207. package/dist/client/assets/mention-pill-CHPHlu-U.js +1 -0
  208. package/dist/client/assets/{mermaid.core-9PwG-9fN.js → mermaid.core-ovqlC4PC.js} +4 -4
  209. package/dist/client/assets/{message-square-off-aV4NMCjd.js → message-square-off-CEOyy4Pq.js} +1 -1
  210. package/dist/client/assets/{mindmap-definition-6OY57UG3-BRbWmQkj.js → mindmap-definition-6OY57UG3-CsngqLzI.js} +1 -1
  211. package/dist/client/assets/{more-details-CRLU2HN4.js → more-details-BW9mauVT.js} +1 -1
  212. package/dist/client/assets/{owner-notice-CTJbhUak.js → owner-notice-BRUVafHC.js} +1 -1
  213. package/dist/client/assets/{package-sPggO7Dr.js → package-Bbs99yqi.js} +1 -1
  214. package/dist/client/assets/{page-container-CnfDuiDC.js → page-container-BVfGgaaJ.js} +1 -1
  215. package/dist/client/assets/{pane-resize-handle-63OC5vfI.js → pane-resize-handle-BL7Meu5R.js} +1 -1
  216. package/dist/client/assets/{paperclip-WhPo3_WD.js → paperclip-QOWXs8-5.js} +1 -1
  217. package/dist/client/assets/path-input-BDRHmgzW.js +1 -0
  218. package/dist/client/assets/{pegDiagram-ECIUJNBX-Ct9Li_PA.js → pegDiagram-ECIUJNBX-DPsWmWqw.js} +1 -1
  219. package/dist/client/assets/{pieDiagram-GNMPY74T-BAB5RA5v.js → pieDiagram-GNMPY74T-BdOIDv4F.js} +1 -1
  220. package/dist/client/assets/{plug-_q5iqunq.js → plug-BrsPyUhu.js} +1 -1
  221. package/dist/client/assets/primer-trigger-C97fRm1v.js +3 -0
  222. package/dist/client/assets/{profile-errors-COcBx7w5.js → profile-errors-nPLX60ha.js} +1 -1
  223. package/dist/client/assets/{progress-77FCPL2y.js → progress-C9TALtIa.js} +1 -1
  224. package/dist/client/assets/{quadrantDiagram-D57K4MC3-BqPJVmMS.js → quadrantDiagram-D57K4MC3-MzMEunU7.js} +1 -1
  225. package/dist/client/assets/{query-error-state-5236P3z0.js → query-error-state-BJjgx-WC.js} +1 -1
  226. package/dist/client/assets/{radio-C8xmfoqO.js → radio-Biql29-B.js} +1 -1
  227. package/dist/client/assets/{railroadDiagram-Y72NRBL7-B8U11nT6.js → railroadDiagram-Y72NRBL7-Dzx_PYVW.js} +1 -1
  228. package/dist/client/assets/registry-B0HgbN69.js +1 -0
  229. package/dist/client/assets/registry-fiUD5cv6.js +39 -0
  230. package/dist/client/assets/{relay-trace-schemas-B80E4EUn.js → relay-trace-schemas-BJ4MfChd.js} +2 -2
  231. package/dist/client/assets/{repeat-CHmB_vD7.js → repeat-CKufDGoQ.js} +1 -1
  232. package/dist/client/assets/{requirementDiagram-EQYSW5RA-CzJ1gzTh.js → requirementDiagram-EQYSW5RA-J0pg6FEt.js} +1 -1
  233. package/dist/client/assets/{room-files-source-B0gc97Ri.js → room-files-source-iaYdshKo.js} +2 -2
  234. package/dist/client/assets/{rotate-ccw-clock-CCU6SVnv.js → rotate-ccw-clock-CnARSw5V.js} +1 -1
  235. package/dist/client/assets/{rotate-cw-B8WQa8O-.js → rotate-cw-BAn_5-Gq.js} +1 -1
  236. package/dist/client/assets/{sankeyDiagram-SY24JHO5-D4vQwyve.js → sankeyDiagram-SY24JHO5-6V_uy-zQ.js} +1 -1
  237. package/dist/client/assets/scroll-area-XDq7yL_d.js +1 -0
  238. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BVnIsPQe.js → sequenceDiagram-BLEHNHQU-C4jZi3N4.js} +1 -1
  239. package/dist/client/assets/{shield-x-ijIbRppV.js → shield-x-CpiXuMbN.js} +1 -1
  240. package/dist/client/assets/signed-in-Rv3Sjk8n.js +1 -0
  241. package/dist/client/assets/{sizeCapture-INFHLROL-DGb1rAJL.js → sizeCapture-INFHLROL-B7nxFreb.js} +1 -1
  242. package/dist/client/assets/{soul-file-CXgYs25S.js → soul-file-BQz4TtHo.js} +1 -1
  243. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DeX3IKTm.js → stateDiagram-v2-A6IESKWZ-B5rvc4n2.js} +1 -1
  244. package/dist/client/assets/{swimlanes-B3ENRKFQ-DN5ljYhG.js → swimlanes-B3ENRKFQ-DnElusDo.js} +1 -1
  245. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-DLpKz5fF.js +8 -0
  246. package/dist/client/assets/{table-D9ww_3Ij.js → table-NGiWzPO4.js} +1 -1
  247. package/dist/client/assets/{timeline-definition-JXYKGLGB-DpRthC3r.js → timeline-definition-JXYKGLGB-DMgyn3XX.js} +1 -1
  248. package/dist/client/assets/{trust-posture-Dn2ciEE0.js → trust-posture-BArJ9H4j.js} +1 -1
  249. package/dist/client/assets/{unplug-BZ8zSvfB.js → unplug-MSjeZ0tJ.js} +1 -1
  250. package/dist/client/assets/{unverified-catalog-notice-CGy05tAO.js → unverified-catalog-notice-DA96H8Df.js} +1 -1
  251. package/dist/client/assets/{use-bindings-BLAWQRpe.js → use-bindings-BojBqRJS.js} +1 -1
  252. package/dist/client/assets/{use-composer-prefs-ICOpilWK.js → use-composer-prefs-BDl8aMme.js} +1 -1
  253. package/dist/client/assets/{use-connector-management-DEMGZy9N.js → use-connector-management-FONU6FK8.js} +1 -1
  254. package/dist/client/assets/{use-deep-link-scroll-DxGYrks3.js → use-deep-link-scroll-CtbBPBgi.js} +1 -1
  255. package/dist/client/assets/{use-delete-binding-Bnv3J5Fu.js → use-delete-binding-COhBv6X3.js} +1 -1
  256. package/dist/client/assets/{use-dev-links-BOcktLiE.js → use-dev-links-Dh0MCiGY.js} +1 -1
  257. package/dist/client/assets/{use-direct-message-panel-D38tSozW.js → use-direct-message-panel-CYnWunqk.js} +1 -1
  258. package/dist/client/assets/{use-external-adapter-catalog-9qiNBqpc.js → use-external-adapter-catalog-RTDOW8Yi.js} +1 -1
  259. package/dist/client/assets/use-filter-state-CSFTDx7z.js +6 -0
  260. package/dist/client/assets/use-full-activity-feed-DlY_ZbRZ.js +1 -0
  261. package/dist/client/assets/use-is-below-desktop-ClzGXlRb.js +1 -0
  262. package/dist/client/assets/{use-local-browser-B1huJhdg.js → use-local-browser-WwZd-FOP.js} +1 -1
  263. package/dist/client/assets/{use-mesh-topology-BTYAy6zc.js → use-mesh-topology-WnFkjq41.js} +1 -1
  264. package/dist/client/assets/{use-mounted-ref-CaPc6Prv.js → use-mounted-ref-Dz1h70pz.js} +1 -1
  265. package/dist/client/assets/{use-notification-prefs-u76DPoP0.js → use-notification-prefs-IrF5_cko.js} +1 -1
  266. package/dist/client/assets/use-pending-read-CnAnzOt_.js +1 -0
  267. package/dist/client/assets/use-personality-commit-C4hYkSPy.js +1 -0
  268. package/dist/client/assets/use-promo-activation-CPVANFBh.js +6 -0
  269. package/dist/client/assets/{use-promo-dismissals-CO7-qhEl.js → use-promo-dismissals-B9m0HT6L.js} +1 -1
  270. package/dist/client/assets/{use-pulse-freshness-D07Mv-Sa.js → use-pulse-freshness-DMySxN8D.js} +1 -1
  271. package/dist/client/assets/{use-room-follow-claim-DRQBuAIe.js → use-room-follow-claim-ByaYVY0o.js} +1 -1
  272. package/dist/client/assets/{use-room-sessions-Bzk7rM40.js → use-room-sessions-DPB29acU.js} +1 -1
  273. package/dist/client/assets/{use-roving-tab-list-CcznVldj.js → use-roving-tab-list-BO8kbs-w.js} +1 -1
  274. package/dist/client/assets/{use-session-canvas-CpgE7tFb.js → use-session-canvas-Cunag2K7.js} +9 -9
  275. package/dist/client/assets/use-status-budget-jt-9aQR0.js +21 -0
  276. package/dist/client/assets/{use-transform-ByJGn3hq.js → use-transform-ydtuYUNp.js} +1 -1
  277. package/dist/client/assets/{use-unclaimed-chats-C-z5fstJ.js → use-unclaimed-chats-ClBWJgNm.js} +1 -1
  278. package/dist/client/assets/use-update-config-ZHtOtve0.js +1 -0
  279. package/dist/client/assets/{useMutationState-BF1EFtIZ.js → useMutationState-B8ArIqeH.js} +1 -1
  280. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-efVKbRIX.js → usecaseDiagram-WPOLBNNX-C5JdAkG9.js} +1 -1
  281. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Bravmwce.js → vennDiagram-Q3Y3IDCW-CqLCy7LU.js} +1 -1
  282. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-fR77zByv.js → wardleyDiagram-IVAIDKWA-C9FlHLTd.js} +1 -1
  283. package/dist/client/assets/{xychartDiagram-4URNHDU4-BphORSLh.js → xychartDiagram-4URNHDU4-BIm-RUWd.js} +1 -1
  284. package/dist/client/index.html +2 -2
  285. package/dist/drizzle/20261031012841_dor3309_file_turn_on_offer.sql +2 -0
  286. package/dist/drizzle/20261101122330_schedule_declined_content_key.sql +1 -0
  287. package/dist/drizzle/20261101195529_work_queue.sql +38 -0
  288. package/dist/drizzle/20261101233656_dor3644_session_launched_by.sql +1 -0
  289. package/dist/drizzle/20261102041558_dor3070_marketplace_summary.sql +2 -0
  290. package/dist/drizzle/20261102051715_dor3440_clear_origin_holds.sql +10 -0
  291. package/dist/drizzle/20261102135442_agent_browser_profiles.sql +15 -0
  292. package/dist/drizzle/meta/20261031012841_snapshot.json +14116 -0
  293. package/dist/drizzle/meta/20261101122330_snapshot.json +14123 -0
  294. package/dist/drizzle/meta/20261101195529_snapshot.json +14363 -0
  295. package/dist/drizzle/meta/20261101233656_snapshot.json +14370 -0
  296. package/dist/drizzle/meta/20261102041558_snapshot.json +14384 -0
  297. package/dist/drizzle/meta/20261102051715_snapshot.json +14384 -0
  298. package/dist/drizzle/meta/20261102135442_snapshot.json +14483 -0
  299. package/dist/drizzle/meta/_journal.json +49 -0
  300. package/dist/server/extension-child.cjs +1147 -572
  301. package/dist/server/index.js +45678 -38894
  302. package/dist/server/index.js.map +2 -2
  303. package/package.json +5 -5
  304. package/dist/client/assets/ActivityRow-DIBH4v9c.js +0 -1
  305. package/dist/client/assets/AdapterSetupWizard-Dle_b9qc.js +0 -2
  306. package/dist/client/assets/AppearancePage-DXbhUt2e.js +0 -1
  307. package/dist/client/assets/AttentionSignalRow-5E7TkG98.js +0 -1
  308. package/dist/client/assets/BindingDialog-q--8SDJF.js +0 -1
  309. package/dist/client/assets/BlintzCanvas-DruVZcDU.js +0 -1231
  310. package/dist/client/assets/CanvasFileContent-BThy5fjD.js +0 -2
  311. package/dist/client/assets/CanvasModel3dContent-BbgR73jh.js +0 -2
  312. package/dist/client/assets/ChannelComposer-qhk0KtW7.js +0 -44
  313. package/dist/client/assets/ConnectionAccessLists-DRwO1v0V.js +0 -1
  314. package/dist/client/assets/HandlePage-B4qbFi40.js +0 -1
  315. package/dist/client/assets/HeartbeatPage-BnNbQLCW.js +0 -1
  316. package/dist/client/assets/Marketplace-DbdLWz0-.js +0 -36
  317. package/dist/client/assets/NamePage-fhxyWDDY.js +0 -1
  318. package/dist/client/assets/NewDirectMessageMenu-DBAdvv5p.js +0 -1
  319. package/dist/client/assets/OperatorIdentityForm-Bls5Vo_u.js +0 -1
  320. package/dist/client/assets/PhotoPage-CNHcXbz4.js +0 -1
  321. package/dist/client/assets/PreviewRefusedNotice-Ds4IO32o.js +0 -1
  322. package/dist/client/assets/PromptSuggestionChips-BXxC799Q.js +0 -1
  323. package/dist/client/assets/RoomSurface-DgH3a_Fv.js +0 -1
  324. package/dist/client/assets/RunsOnPopover-CEkkjrGg.js +0 -1
  325. package/dist/client/assets/RuntimeConnectFlow-DXWGgvCW.js +0 -1
  326. package/dist/client/assets/RuntimeSetupDialog-D6L1QhMF.js +0 -1
  327. package/dist/client/assets/SettingsDialog-BOOqWKcj.js +0 -12
  328. package/dist/client/assets/SkillsPage-ntCEhUIM.js +0 -1
  329. package/dist/client/assets/TaskDialogWrapper-vBWAWwTY.js +0 -1
  330. package/dist/client/assets/TasksEmptyState-C_3UkAbA.js +0 -3
  331. package/dist/client/assets/TourHost-B69XAKpE.js +0 -1
  332. package/dist/client/assets/WidgetErrorCard-BlqaIsPK.js +0 -108
  333. package/dist/client/assets/WorkView-BekLkR4O.js +0 -51
  334. package/dist/client/assets/_shell-Du0F-5fK.js +0 -80
  335. package/dist/client/assets/_shell._home.activity-5rihXoYF.js +0 -1
  336. package/dist/client/assets/_shell._home.index-BsLNqt4f.js +0 -3
  337. package/dist/client/assets/_shell._home.tasks-Cxs5tLWA.js +0 -1
  338. package/dist/client/assets/_shell._home.workspaces-CEHDdfbP.js +0 -1
  339. package/dist/client/assets/_shell.connections-Bm0WmgXH.js +0 -1
  340. package/dist/client/assets/_shell.marketplace-CsQ60Mlc.js +0 -1
  341. package/dist/client/assets/_shell.marketplace_.sources-DNyShS1x.js +0 -1
  342. package/dist/client/assets/_shell.session-BN42bV3w.js +0 -1
  343. package/dist/client/assets/_shell.threads-HH4EvufJ.js +0 -1
  344. package/dist/client/assets/_shell.x._extensionId-3ZlJV1iu.js +0 -1
  345. package/dist/client/assets/_shell.x._extensionId_._-3ZlJV1iu.js +0 -1
  346. package/dist/client/assets/card-DUmTNXJJ.js +0 -1
  347. package/dist/client/assets/channel-B7zgJbnU.js +0 -1
  348. package/dist/client/assets/form-D93N5lrK.js +0 -1
  349. package/dist/client/assets/image-lightbox-vgPEvSCc.js +0 -1
  350. package/dist/client/assets/index-B36osK_S.js +0 -17
  351. package/dist/client/assets/index-B446r3dL.js +0 -1
  352. package/dist/client/assets/index-BGo1YiUE.js +0 -1
  353. package/dist/client/assets/index-BO3yPJt-.js +0 -1
  354. package/dist/client/assets/index-DE6uOpn4.js +0 -1
  355. package/dist/client/assets/index-Dag1qeZI.js +0 -1
  356. package/dist/client/assets/index-Dm0Tav7v.js +0 -1
  357. package/dist/client/assets/index-Dry_agqN.css +0 -1
  358. package/dist/client/assets/index-OQuvRZTD.js +0 -1058
  359. package/dist/client/assets/index-eVrGefuq.js +0 -1
  360. package/dist/client/assets/mention-pill-BsOeTJ2f.js +0 -1
  361. package/dist/client/assets/path-input-C2KIXdON.js +0 -1
  362. package/dist/client/assets/primer-trigger-B2tjuHBx.js +0 -3
  363. package/dist/client/assets/registry-BzXBOE9h.js +0 -34
  364. package/dist/client/assets/registry-sfhDu9q2.js +0 -1
  365. package/dist/client/assets/scroll-area-FwZwM74Q.js +0 -1
  366. package/dist/client/assets/search-x-Q18Wm-C5.js +0 -6
  367. package/dist/client/assets/signed-in-DEOMBWVX.js +0 -1
  368. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-D8kHFWtL.js +0 -8
  369. package/dist/client/assets/use-full-activity-feed-CtQquOBW.js +0 -1
  370. package/dist/client/assets/use-is-below-desktop-CAGEAsCC.js +0 -1
  371. package/dist/client/assets/use-pending-read-D0y6i7G9.js +0 -1
  372. package/dist/client/assets/use-personality-commit-C3h8upDo.js +0 -1
  373. package/dist/client/assets/use-promo-activation-5HG08FlB.js +0 -11
  374. package/dist/client/assets/use-status-budget-Xn2sIeM1.js +0 -16
  375. package/dist/client/assets/use-update-config-L5NCTj3t.js +0 -1
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-BeCubxHV.js","assets/index-OQuvRZTD.js","assets/index-Dry_agqN.css","assets/index-BkJlIXqM.js","assets/index-1QfQImuJ.js","assets/BlintzCanvas-DruVZcDU.js","assets/index-QSXJR98z.js","assets/BlintzCanvas-DCXOV_yN.css"])))=>i.map(i=>d[i]);
2
- import{r as a,aW as z,h7 as ce,j as t,G as O,g0 as oe,g1 as le,B as D,g2 as ue,g3 as de,g4 as X,h8 as fe,dj as he,dk as pe,J as me,gh as ve,dl as xe,a3 as ge,h9 as be,aX as ee,a1 as ye,ha as je,a2 as Ce}from"./index-OQuvRZTD.js";import{u as ke,a as we,b as Re}from"./use-session-canvas-CpgE7tFb.js";import{R as Te}from"./rotate-cw-B8WQa8O-.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CAeUe7uQ.js";import"./WidgetErrorCard-BlqaIsPK.js";import"./index-CoKNU2F9.js";import"./card-DUmTNXJJ.js";import"./progress-77FCPL2y.js";import"./markdown-content-Cjhsscbn.js";import"./table-D9ww_3Ij.js";import"./package-sPggO7Dr.js";import"./heart-BavUIV45.js";import"./git-branch-B8JNwQ6q.js";import"./file-text-Ds9edaTZ.js";import"./file-D80JE_L0.js";import"./McpAppFrame-D15nxVaI.js";import"./more-details-CRLU2HN4.js";function B(e,r){return["canvas-file",e,r]}function Ne({documentId:e,sourcePath:r,binding:d,save:n,draftRef:o,revisionRef:s,finishAttemptRef:C,timerRef:y,finalSaveRef:b,invalidateConfirmedFile:p}){const x=a.useRef({binding:d,save:n,invalidateConfirmedFile:p}),_=a.useRef(null),f=a.useRef(null);return a.useLayoutEffect(()=>{x.current={binding:d,save:n,invalidateConfirmedFile:p}}),a.useLayoutEffect(()=>{const w=z.getState().openDocuments.find(m=>m.id===e);if(!w||typeof w.openedAt!="number")return;const R=ce(e,w.openedAt,r,{required:()=>!!x.current.binding,current:()=>{const m=f.current;return!!m&&m.revision===s.current&&m.attempt===C.current&&m.binding===x.current.binding&&m.save===x.current.save&&m.binding.current()},invalidateConfirmedFile:()=>x.current.invalidateConfirmedFile(),prepare:async()=>{var c;f.current=null;const{binding:m,save:T}=x.current;if(!(m!=null&&m.current()))return!1;y.current&&(clearTimeout(y.current),y.current=null);const F=o.current,g=s.current,l=++C.current,i=await T(F);return i.status!=="changed"&&i.status!=="no_op"||i.confirmed.content!==F||s.current!==g||C.current!==l||x.current.binding!==m||x.current.save!==T||!m.current()?!1:((c=b.current)==null||c.cancel(),b.current=null,f.current={revision:g,attempt:l,binding:m,save:T},!0)}});return _.current=R,()=>R.retire()},[e,r,o,s,C,y,b]),_}function M(e){return e.status==="refused"||e.status==="local_uncertain"?e.status:"unavailable"}function _e(e,r,d){var l;const n=a.useRef(e),o=a.useRef(null),s=a.useRef(null),[C,y]=a.useState({identity:e.identity,phase:"pending",busy:!1});a.useLayoutEffect(()=>{n.current=e},[e]);const b=a.useCallback((i,c)=>{o.current===i&&n.current.identity===i&&n.current.current()&&y(u=>({identity:i,...c,historical:c.historical??(u.identity===i?u.historical:void 0)}))},[]),p=a.useCallback(i=>{o.current!==i||n.current.identity!==i||y(c=>c.identity===i?{...c,phase:"unavailable",busy:!1}:{identity:i,phase:"unavailable",busy:!1})},[]),x=e.identity,_=e.supported;a.useLayoutEffect(()=>{const i=n.current;s.current=null,o.current=x;let c=!1;return _&&r==="ready"&&i.discover().then(u=>{c||(u.status==="observed"?b(x,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(x,{phase:M(u),busy:!1}):p(x))}),()=>{c=!0,s.current=null,o.current===x&&(o.current=null)}},[x,_,r,d,b,p]);const f=C.identity===e.identity?C:void 0,w=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return;s.current=null,y(j=>({identity:c,phase:"pending",busy:!0,historical:j.identity===c?j.historical:void 0}));const u=await i.discover(!0);u.status==="observed"?b(c,{phase:"ready",discovery:u.value,busy:!1}):u.status!=="idle"?b(c,{phase:M(u),busy:!1}):p(c)},[b,p]),R=a.useCallback(async i=>{const c=n.current,u=c.identity;if(o.current!==u||!c.current())return;s.current=null,y(h=>({identity:u,phase:"pending",busy:!0,discovery:h.identity===u?h.discovery:void 0,historical:h.identity===u?h.historical:void 0}));const j=await c.recover(i);j.status==="observed"?b(u,{phase:"ready",discovery:j.value.discovery,historical:j.value.result.entry,busy:!1}):j.status!=="idle"?b(u,{phase:M(j),busy:!1}):p(u)},[b,p]),m=a.useCallback(async()=>{const i=n.current,c=i.identity;if(o.current!==c||!i.current())return{status:"idle"};const u={};s.current=u,y(h=>h.identity===c?{...h,phase:"pending",busy:!0}:h);const j=await i.inspectCurrent();return s.current!==u?{status:"idle"}:(s.current=null,j.status==="idle"&&p(c),o.current===c&&n.current.identity===c&&i.current()&&j.status!=="idle"&&y(h=>h.identity===c?{...h,phase:j.status==="observed"?"ready":M(j),busy:!1}:h),j)},[p]),T=e.supported&&r==="ready",F=r==="pending"?"pending":(f==null?void 0:f.phase)??"pending",g=T&&(F!=="ready"||((l=f==null?void 0:f.discovery)==null?void 0:l.admission)==="blocked");return{supported:T,phase:F,editBlocked:g,busy:(f==null?void 0:f.busy)??F==="pending",discovery:f==null?void 0:f.discovery,historical:f==null?void 0:f.historical,refresh:w,recover:R,inspectCurrent:m}}const Fe={unavailable:"Couldn’t check previous saves, so editing is off.",refused:"This file can’t be edited from this canvas."};function Pe(e){var r,d,n;return e.supported?e.phase==="unavailable"||e.phase==="refused"||e.phase==="local_uncertain"?!0:((r=e.discovery)==null?void 0:r.admission)==="blocked"||((d=e.discovery)==null?void 0:d.entries.some(o=>o.state==="review"))===!0||((n=e.historical)==null?void 0:n.state)==="receipt":!1}function Z({recovery:e,editing:r,loadCurrent:d}){var o;if(e.phase==="unavailable"||e.phase==="refused")return t.jsxs(t.Fragment,{children:[t.jsx("p",{role:"alert",className:"col-start-1 row-start-1 py-1.5",children:Fe[e.phase]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",className:"col-span-2 col-start-1 row-start-2 mb-1.5 justify-self-start @md:col-span-1 @md:col-start-2 @md:row-start-1 @md:mb-0",disabled:e.busy||r,onClick:()=>void e.refresh(),children:"Check again"})]});if(e.phase==="local_uncertain")return t.jsx("p",{role:"alert",children:"Use Retry original save. Checking previous saves won’t confirm this save."});const n=e.discovery;return t.jsxs("div",{className:"space-y-1",children:[(n==null?void 0:n.admission)==="blocked"&&t.jsx("p",{role:"alert",children:"An unresolved original save blocks this file. This list may not include the blocking operation."}),(n==null?void 0:n.hasMore)&&t.jsx("p",{children:"Only the latest 25 matching saves are shown. Older evidence is omitted."}),n&&n.entries.length>0&&t.jsx(t.Fragment,{children:t.jsx("ul",{children:n.entries.map(s=>t.jsxs("li",{children:[t.jsxs("span",{children:[s.eventId,":"," ",s.state==="receipt"?"Historical save recorded":s.state==="review"?"Original save needs review":s.state==="no_op"?"Original save made no change":"Original save failed before replacement"]}),s.state==="review"&&(s.reason==="prepared_without_replacement"?t.jsx("p",{children:"This save needs manual review. These controls won’t write the file."}):t.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsx("p",{children:"The original saved replacement must be proven before its receipt can be settled."}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:e.busy||r,onClick:()=>void e.recover(s.eventId),children:"Recover original receipt"})]}))]},s.eventId))})}),(n==null?void 0:n.admission)==="blocked"&&n.entries.length===0&&t.jsx("p",{children:"No matching recent saves."}),((o=e.historical)==null?void 0:o.state)==="receipt"&&t.jsxs("div",{role:"status",className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[t.jsxs("div",{children:[t.jsx("p",{children:"Previous save confirmed. Your current draft may differ."}),t.jsx("p",{children:e.historical.currentFileMatch==="different"?"The current file differs from that historical save.":e.historical.currentFileMatch==="same_saved_replacement"?"The saved replacement matched when checked; current bytes still require a fresh load.":"The current file was not checked."})]}),t.jsx(D,{type:"button",size:"sm",variant:"outline",disabled:r||e.editBlocked||e.busy,onClick:d,children:"Load current file"})]})]})}function Se({recovery:e,editing:r,loadCurrent:d}){return!e.supported||r?null:t.jsxs(oe,{children:[t.jsx(le,{asChild:!0,children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground","aria-label":"More file actions",children:t.jsx(ue,{className:"size-4"})})}),t.jsxs(de,{align:"end",children:[t.jsx(X,{disabled:e.busy,onSelect:()=>void e.refresh(),children:"Check previous saves"}),t.jsx(X,{disabled:e.editBlocked||e.busy,onSelect:()=>d(),children:"Load current file"})]})]})}function De({recovery:e,editing:r,loadCurrent:d,toolbar:n}){const o=Pe(e),s=e.phase==="unavailable"||e.phase==="refused";return t.jsxs(t.Fragment,{children:[e.supported&&e.phase==="pending"&&t.jsx("p",{role:"status",className:"sr-only",children:"Checking previous saves…"}),t.jsx("div",{...o?{role:"region","aria-label":"Previous file saves"}:{},className:O("shrink-0",o?"bg-muted text-foreground mx-2 mt-2 rounded-md py-1 pr-1 pl-3 text-sm":"flex justify-end px-2 pt-1",o&&(s?"@container":"flow-root")),children:t.jsxs("div",{className:O(o&&s&&"grid grid-cols-[1fr_auto] items-center gap-x-2 @md:grid-cols-[1fr_auto_auto]"),children:[t.jsx("div",{className:O("flex items-center gap-1",o&&!s&&"float-right ml-2",o&&s&&"col-start-2 row-start-1 @md:col-start-3"),children:n}),o&&(s?t.jsx(Z,{recovery:e,editing:r,loadCurrent:d}):t.jsx("div",{className:"py-1.5",children:t.jsx(Z,{recovery:e,editing:r,loadCurrent:d})}))]})})]})}function Le({editing:e,off:r,observation:d,onClick:n}){return t.jsx(fe,{children:t.jsxs(he,{...r?{}:{open:!1},children:[t.jsx(pe,{asChild:!0,children:t.jsx("span",{className:"inline-flex",children:t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:n,"aria-label":e?"Finish editing":"Edit file",disabled:r,"data-document-save-observation":d,children:e?t.jsx(me,{className:"size-4"}):t.jsx(ve,{className:"size-4"})})})}),t.jsx(xe,{children:"Editing is off"})]})})}const Ee=a.lazy(()=>ee(()=>import("./CodeMirrorEditor-BeCubxHV.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),ze=a.lazy(()=>ee(()=>import("./BlintzCanvas-DruVZcDU.js").then(e=>e.B),__vite__mapDeps([5,1,2,6,4,7])).then(e=>({default:e.BlintzCanvas}))),Be=500;function Me(e,r){return r==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function Oe(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";case"uncertain":return"Save not confirmed";default:return null}}function te({content:e,documentId:r,cwd:d,loaded:n,theme:o,isEditing:s,onEditingChange:C,setDocumentEditing:y,observedBinding:b,fileSaveObservation:p="unavailable",recoveryBinding:x}){const _=e.readOnly!==!0,f=Me(e.sourcePath,e.language),w=ge(),[R,m]=a.useState(n),[T,F]=a.useState(),g=a.useRef(b);a.useLayoutEffect(()=>{g.current=b},[b]);const l=ke({documentId:r,sourcePath:e.sourcePath,cwd:d,loadedContent:n,documentSaveBinding:T,documentRecoveryBinding:x}),i=_e(l.recovery,p,x),c=we({cwd:d,sourcePath:f?e.sourcePath:null,content:R,saved:l.status==="saved"}),u=a.useRef(!1),j=a.useRef(s);a.useLayoutEffect(()=>(u.current=!0,j.current=s,()=>{u.current=!1}),[s]);const h=a.useRef(null),S=a.useRef(R),L=a.useRef(0),A=a.useRef(0),I=a.useRef(l.save),K=a.useRef(l.prepareFinalSave),U=a.useRef(l.waitForCloseDrain),E=a.useRef(null),V=a.useRef(C),Y=Ne({documentId:r,sourcePath:e.sourcePath,binding:T,save:l.save,draftRef:S,revisionRef:L,finishAttemptRef:A,timerRef:h,finalSaveRef:E,invalidateConfirmedFile:()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)}).catch(()=>{})}});a.useEffect(()=>{S.current=R,I.current=l.save,K.current=l.prepareFinalSave,U.current=l.waitForCloseDrain,V.current=C});const $=a.useCallback(v=>{var k;L.current+=1,S.current=v,m(v),(k=E.current)==null||k.cancel(),E.current=K.current(v),h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,I.current(S.current)},Be)},[]),se=()=>{var P;if(i.editBlocked||p==="pending"||p==="ready"&&!((P=g.current)!=null&&P.current()))return;const v=g.current,k=v&&Object.freeze({...v.incarnation});F(v!=null&&v.current()&&k?{incarnation:k,current:()=>{const N=g.current;return!!N&&be(k,N.incarnation)&&N.current()}}:void 0),L.current+=1,S.current=n,m(n),C(!0),y(r,!0)},ne=async()=>{h.current&&(clearTimeout(h.current),h.current=null);const v=S.current,k=L.current,P=++A.current,N=await I.current(v);if(N.status!=="changed"&&N.status!=="no_op"||L.current!==k||A.current!==P||N.confirmed.content!==v)return;const q=N.confirmed;q.content===S.current&&w.setQueryData(B(d,e.sourcePath),Q=>Q&&{...Q,content:q.content,hash:q.hash}),C(!1),y(r,!1)},re=()=>{w.invalidateQueries({queryKey:B(d,e.sourcePath)})};a.useEffect(()=>{var v;s||(h.current&&clearTimeout(h.current),h.current=null,(v=E.current)==null||v.cancel(),E.current=null)},[s]),a.useEffect(()=>{const v=Y.current;return()=>{var N;h.current&&(clearTimeout(h.current),h.current=null);const k=(N=E.current)==null?void 0:N.flush(),P=S.current;v==null||v.settleRetirement(Promise.resolve(k).then(()=>U.current(P))),E.current=null,y(r,!1),V.current(!1)}},[r,y,Y]);const G=async()=>{if(s||!u.current||i.editBlocked)return;const v=L.current,k=await i.inspectCurrent();k.status!=="observed"||!u.current||j.current||L.current!==v||!l.recovery.current()||w.setQueryData(B(d,e.sourcePath),P=>P&&{...P,...k.value})},ae=()=>{const v=l.adoptDisk();v!=null&&m(v)},ie=()=>{l.overwrite(S.current)},W=l.status==="saved"?l.confirmedContent!==R?"Unsaved changes":l.documentReceipt?"Save recorded":"Saved to file":Oe(l.status),J=s?R:n;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsx(De,{recovery:i,editing:s,loadCurrent:()=>void G(),toolbar:t.jsxs(t.Fragment,{children:[_&&W&&t.jsx("span",{className:O("mr-1 text-xs",l.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:W}),!s&&p==="pending"&&t.jsx("span",{role:"status",children:"Checking document…"}),!s&&t.jsx(D,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground",onClick:re,"aria-label":"Refresh from disk",children:t.jsx(Te,{className:"size-4"})}),_&&t.jsx(Le,{editing:s,off:!s&&(p==="pending"||i.editBlocked),observation:p,onClick:s?()=>void ne():se}),t.jsx(Se,{recovery:i,editing:s,loadCurrent:()=>void G()})]})}),l.status==="uncertain"&&t.jsxs("div",{role:"status",className:"mx-2 mt-2 flex items-center gap-2 text-sm",children:[t.jsx("span",{children:"Save not confirmed. Retry the original save before saving another draft."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",onClick:()=>void l.retryUnconfirmed(),children:"Retry original save"})]}),l.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(D,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:ae,children:"Reload"}),t.jsx(D,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:ie,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(a.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:f?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(ze,{value:J,editable:s,onChange:s?$:void 0,wikiLinks:c})}):t.jsx(Ee,{value:J,editable:s,filename:e.sourcePath,languageHint:e.language,theme:o,onChange:s?$:void 0})})})]})}function Ae(e){const{fileSaveBinding:r,fileSaveObservation:d}=Re(e.documentId);return t.jsx(te,{...e,observedBinding:r,recoveryBinding:r,fileSaveObservation:d})}function Ie(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function at({content:e,documentId:r}){const d=ye(),n=z(g=>g.selectedCwd),o=z(g=>g.setDocumentEditing),s=z(g=>{var l;return((l=g.openDocuments.find(i=>i.id===r))==null?void 0:l.editing)??!1}),C=je(),y=z(g=>g.canvasSessionId),b=z(g=>g.roomCanvasLiveRoomId),{data:p,error:x,isLoading:_}=Ce({queryKey:B(n,e.sourcePath),enabled:n!==null,queryFn:()=>d.readFileContent(n,e.sourcePath),staleTime:3e4,retry:!1}),[f,w]=a.useState(null),R=g=>{w(g&&p?{pinnedHash:p.hash}:null)};if(n===null)return t.jsx(H,{children:"Open a chat to view files."});if(_)return t.jsx(H,{children:"Loading file…"});if(x||!p)return t.jsx(H,{children:Ie(x)});const m=f!==null&&s,T=(m?f==null?void 0:f.pinnedHash:null)??p.hash,F=y&&!b?Ae:te;return t.jsx(F,{content:e,documentId:r,cwd:n,loaded:p.content,theme:C,isEditing:m,onEditingChange:R,setDocumentEditing:o},`${e.sourcePath}:${T}`)}function H({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{at as CanvasFileContent};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-RGXeJd6a.js","assets/index-OQuvRZTD.js","assets/index-Dry_agqN.css"])))=>i.map(i=>d[i]);
2
- import{a1 as m,aW as n,r as s,j as t,aX as p}from"./index-OQuvRZTD.js";import{r as u}from"./use-session-canvas-CpgE7tFb.js";import"./rotate-cw-B8WQa8O-.js";import"./query-keys-DeYqUDia.js";import"./index.esm-CAeUe7uQ.js";import"./WidgetErrorCard-BlqaIsPK.js";import"./index-CoKNU2F9.js";import"./card-DUmTNXJJ.js";import"./progress-77FCPL2y.js";import"./markdown-content-Cjhsscbn.js";import"./table-D9ww_3Ij.js";import"./package-sPggO7Dr.js";import"./heart-BavUIV45.js";import"./git-branch-B8JNwQ6q.js";import"./file-text-Ds9edaTZ.js";import"./file-D80JE_L0.js";import"./McpAppFrame-D15nxVaI.js";import"./more-details-CRLU2HN4.js";const d=s.lazy(()=>p(()=>import("./Model3dViewer-RGXeJd6a.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.Model3dViewer})));function f(e){var o;const r=(o=e.split(".").pop())==null?void 0:o.toLowerCase();return r==="glb"||r==="gltf"?"gltf":r==="stl"?"stl":r==="obj"?"obj":r==="3mf"?"3mf":r==="ply"?"ply":r==="fbx"?"fbx":r==="dae"?"dae":null}function A({content:e}){const r=m(),o=n(i=>i.selectedCwd),l=s.useMemo(()=>u(e.src,i=>r.mediaUrl(o??"",i)),[e.src,r,o]),a=s.useMemo(()=>f(e.src),[e.src]);return l.url===null||a===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(s.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(d,{url:l.url,format:a,label:e.title??"Canvas 3D model"})})})}export{A as CanvasModel3dContent,f as formatOf};
@@ -1,44 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B36osK_S.js","assets/index-OQuvRZTD.js","assets/index-Dry_agqN.css","assets/room-files-source-B0gc97Ri.js","assets/markdown-content-Cjhsscbn.js","assets/file-exclamation-point-CcJ_e4_m.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-n_pnc-CO.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-B8WQa8O-.js","assets/link-2-yI2Tlm7Q.js","assets/file-D80JE_L0.js","assets/git-branch-B8JNwQ6q.js","assets/more-details-CRLU2HN4.js"])))=>i.map(i=>d[i]);
2
- import{O as F,r as c,j as l,B as ue,h4 as kn,n2 as wn,g as In,k4 as Nn,G as te,a1 as fe,a3 as Fe,a4 as Le,aN as H,ch as Be,ci as Rn,cX as Cn,n3 as An,lB as Mn,n4 as Sn,h as jn,av as _n,co as Ue,gw as se,q as Z,dD as He,s as pe,l$ as On,n5 as En,mF as Tn,n6 as $n,eR as Dn,g8 as Pn,Y as Fn,e2 as Ln,n0 as Bn,n7 as Un,n8 as Hn,a0 as Kn,bv as qn,n9 as Wn,na as zn,ju as Vn,it as Gn,gB as Yn,kV as Ne,nb as Ke,bU as Jn,kU as X,kY as qe,nc as Xn,cg as ge,ag as Qn,bY as he,im as We,nd as Zn,cs as ze,ne as et,fe as nt,kl as Ve,nf as Ge,aX as tt,gy as Ye,kX as st,ng as Je,nh as ot,ni as at,nj as rt,nk as Re,eT as it,nl as ct,nm as lt,nn as dt,no as ut,np as mt,nq as ft,l as pt,hh as gt,ap as Xe,kM as ht,ah as xt,nr as yt,ns as bt,nt as vt,b6 as kt,c4 as wt,nu as It,nv as Nt,nw as Rt,nx as Ct,bw as Ce,f2 as At}from"./index-OQuvRZTD.js";import{g as Ae,m as Me,h as xe,f as Qe,M as Mt,a as St,E as jt,i as _t,j as Ot,c as P,k as Et,b as Tt,l as $t,u as Dt,C as Pt}from"./registry-BzXBOE9h.js";import"./WidgetErrorCard-BlqaIsPK.js";import{R as Ft,A as Ze}from"./repeat-CHmB_vD7.js";import{u as Lt}from"./use-room-sessions-Bzk7rM40.js";import{M as Bt}from"./markdown-content-Cjhsscbn.js";import{W as Ut,a as Ht}from"./find-latest-widget-fence-BtqFMP_f.js";import{f as Kt}from"./format-duration-BCr6uzby.js";import{H as qt,a as Wt,b as zt}from"./RuntimeSetupDialog-D6L1QhMF.js";import{M as Se}from"./mention-pill-BsOeTJ2f.js";import{R as Vt}from"./rotate-ccw-clock-CCU6SVnv.js";import{U as Gt}from"./unplug-BZ8zSvfB.js";import{M as je}from"./message-square-off-aV4NMCjd.js";import{i as Yt}from"./registry-sfhDu9q2.js";/**
3
- * @license lucide-react v1.48.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const en={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};en.node;const Jt=F(en);/**
8
- * @license lucide-react v1.48.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const nn={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};nn.node;const Xt=F(nn);/**
13
- * @license lucide-react v1.48.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const tn={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};tn.node;const Qt=F(tn);/**
18
- * @license lucide-react v1.48.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const sn={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};sn.node;const Zt=F(sn);/**
23
- * @license lucide-react v1.48.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const on={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};on.node;const es=F(on);/**
28
- * @license lucide-react v1.48.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const an={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};an.node;const ns=F(an);/**
33
- * @license lucide-react v1.48.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */const rn={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};rn.node;const _e=F(rn);/**
38
- * @license lucide-react v1.48.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */const cn={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};cn.node;const ts=F(cn),ss='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function os(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=c.useRef(null),r=c.useRef(!1);c.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let u=0,x=0;const v=()=>{var f;const m=(f=a.current)==null?void 0:f.querySelector(ss);if(m)return m.focus();++u<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[t]);const i=c.useCallback(u=>{var x;!u&&((x=a.current)!=null&&x.contains(document.activeElement))||s(u)},[s]),d=c.useCallback(u=>{!o||u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r.current=!0,s(!0))},[o,s]),p=c.useMemo(()=>({onEscapeKeyDown:()=>{var u;return(u=n.current)==null?void 0:u.focus()},onBlur:u=>{var v,m,f;const x=u.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(m=n.current)!=null&&m.contains(x))||(f=a.current)!=null&&f.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:i,onTriggerKeyDown:d,contentHandlers:p}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const i=s||n&&e.shiftKey?-1:1;a[(r+i+a.length)%a.length].focus()}function as({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function rs({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(kn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const is=300;function G({className:e,children:t}){return l.jsx("span",{className:te("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:i}){const{kind:d,displayName:p,handle:u,color:x,emoji:v,imageUrl:m,origin:f,agent:g}=e,w=x??"hsl(var(--muted-foreground))",h=typeof f=="object"&&f!==null,y=d==="agent"&&(g==null?void 0:g.working)!=null?g.working:null,[I,S]=c.useState(!1),M=c.useCallback(k=>{S(k),a==null||a(k)},[a]),C=c.useRef(!1),N=c.useRef(null),A=wn({onLongPress:()=>{C.current&&M(!0)}}),{contentRef:_,handleOpenChange:j,onTriggerKeyDown:b,contentHandlers:O}=os({open:I,setOpen:M,triggerRef:N,enabled:r&&o!==void 0});return l.jsxs(qt,{open:I,onOpenChange:j,openDelay:is,children:[l.jsx(Wt,{asChild:!0,ref:N,"data-gesture-priority":"",...A,onPointerDown:k=>{C.current=k.pointerType==="touch"||k.pointerType==="pen",A.onPointerDown(k)},...r?{onClick:()=>M(!0),onKeyDown:b}:{},children:t}),l.jsxs(zt,{ref:_,...O,...o?{role:"dialog","aria-label":p}:{},"data-slot":"identity-hover-card",align:"start",className:te("flex w-64 flex-col gap-0 overflow-hidden p-0",i),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(In,{"aria-hidden":!0,color:w,emoji:v,imageUrl:m,fallback:Nn(p),kind:d,origin:f,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:p}),u&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",u]})]})]}),n&&l.jsx(as,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((g==null?void 0:g.runtime)||(g==null?void 0:g.model))&&l.jsx(G,{children:[g.runtime,g.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Kt(y.forMs)]}),d==="human"&&l.jsx(G,{children:h?f.platform:"On this machine"}),d==="agent"&&(g==null?void 0:g.managedBy)&&l.jsxs(G,{children:["Managed by"," ",g.managedBy.handle?`@${g.managedBy.handle}`:g.managedBy.displayName]})]}),o?l.jsx(rs,{actions:o,onAct:()=>{var k;(k=N.current)==null||k.focus(),M(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=N.current)==null||k.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function cs(){const e=fe(),t=Fe();return Le({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var u;const r=t.getQueryData(H.entries(s)),i=(u=r==null?void 0:r.find(x=>x.id===n))==null?void 0:u.reactions,{reactions:d,on:p}=Ae(i,o,a);return t.setQueryData(H.entries(s),x=>Me(x,n,d)),{on:p}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,p;const r=t.getQueryData(H.entries(s)),i=((p=(d=r==null?void 0:r.find(u=>u.id===n))==null?void 0:d.reactions)==null?void 0:p.some(u=>u.emoji===o&&u.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:i})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},i)=>{i!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const p=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:u}=Ae(p,a,r,!i.on);return Me(d,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function q(e){return e.threadRootEntryId??e.parentEntryId}function ls(e){return q(e)??e.id}function ds(e,t){return Math.max(t??0,e)}function na(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:ds(e.length,s),lastAt:n.createdAt,unread:o}}function us(e){var M,C;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=Be(),r=Rn(),i=a&&o&&t!==void 0,d=Cn(i?t:null),p=An(d.member),u=Mn(),x=Sn(),v=jn(),m=_n(),{data:f}=Ue({enabled:i&&r}),g=m.status==="ready"?m.roomId:null,w=f==null?void 0:f.find(N=>N.id===g),h=w?se(w):null,y=(C=(M=d.member)==null?void 0:M.agent)==null?void 0:C.effectiveRuntimeId,I=c.useCallback(()=>{t!==void 0&&(Z.getState().recordOpened("agent",t),u({agentPath:t},y?{runtime:y}:{}))},[t,u,y]),S=c.useCallback(async()=>{if(t===void 0||!v)return;const N=await x(t);if(N===null){He(`${s} has no session in ${h??"this room"} yet`);return}v(pe({session:N}))},[t,v,x,s,h]);return c.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:p},actions:{onMessage:I,...n?{onViewProfile:n}:{},...r&&h?{session:{label:`Session in ${h}`,onOpen:()=>void S()}}:{}}},[a,t,d.role,p,I,n,r,h,S])}function ms({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=c.useState(!1),i=us({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=c.useCallback(p=>{p&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&i!==null,...i?{about:i.about,actions:i.actions}:{},children:o})}function fs(e){return l.jsx(Ht,{code:e.code,isIncomplete:e.isIncomplete})}const ps=[{language:Ut,component:fs}],gs={turn_failed:{Icon:Kn,tone:"text-status-warning"},agent_busy:{Icon:Hn},agent_gone:{Icon:ts,tone:"text-status-warning"},agent_left:{Icon:_e,tone:"text-status-warning"},room_archived:{Icon:Un},agent_reseated:{Icon:Bn},handle_changed:{Icon:Ze},files_set_up:{Icon:Ln},handoff_shared:{Icon:Fn},handoff_declined:{Icon:je},runtime_gone:{Icon:Zt,tone:"text-status-warning"},agent_paused:{Icon:Pn},agent_declined:{Icon:je},agent_unavailable:{Icon:Dn},awaiting_approval:{Icon:Jt,tone:"text-status-warning"},halted:{Icon:$n},budget_reached:{Icon:Tn},cascade_stopped:{Icon:En},addressing_changed:{Icon:Qt},bridge_blocked:{Icon:Gt,tone:"text-status-warning"},bridge_undelivered:{Icon:On,tone:"text-status-warning"},bridge_rate_limited:{Icon:ns},bridge_second_agent_refused:{Icon:_e},bridge_disconnected:{Icon:Xt},bridge_agent_swapped:{Icon:Ft},bridge_history_note:{Icon:Vt}},hs={Icon:qn},le=80;function xs(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function ys(e,t,s){const n=bs(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function bs(e,t){if(t!==void 0){const n=Wn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=zn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function vs({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&gs[e.body.notice])??hs;return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":xs(e.body.text)},...xe(t),className:te("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",r??"text-muted-foreground"),children:[l.jsx(a,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),l.jsx("span",{children:n?ys(e.body.text,n,o):e.body.text})]})}const ks=Yt.moment;function ws({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=Qe(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:l.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Mt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(ks,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:St(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function Is(e,t){const s=X.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
43
- `)?"":" ";s.set(e,`${n}${o}@${t} `)}function Ns({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const a=ls(t),r=t.body.text,i=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,d=s==null?void 0:s.displayName,{copy:p}=Vn({toastOnSettle:!0});return c.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:es,run:()=>{Yn.getState().openThread(e,a,!0),Ne.getState().requestFocus(Ke(e,a))}},copy:{id:"copy",label:"Copy text",icon:Gn,run:()=>void p(r)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:Jn,run:o}),i!==void 0&&(u.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:Ze,run:()=>{Is(e,i),Ne.getState().requestFocus(e)}}),jt.map(x=>u[x]).filter(x=>x!==void 0)},[e,a,r,i,d,o,p])}function Rs(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function ta(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function sa(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Cs(e,t,s){const n=t.get(e),o=qe({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function oa(e){const t=new Set;for(const a of e)q(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=q(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const i=n.get(r);i?i.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function As(e){return`thread-${e}`}function Ms(e){return`thread-row-${e}`}function aa(e){return`thread-panel-entry-${e}`}function Ss(e){return`room-entry-${e}`}function js(e,t){const s=e.find(i=>i.id===t);if(s===void 0)return null;const n=q(s)??null,o={rowId:t,domId:Ss(t)};if(n===null)return o;const a=e.find(i=>i.id===n);return a!==void 0&&(q(a)??null)===null?{rowId:As(n),domId:Ms(n)}:o}function ra(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:js(e,s.id)}const Oe=48;function ia(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Oe?`${a.slice(0,Oe).trimEnd()}…`:a}}function _s(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=Xn({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:Qn(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Os(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Es={info:new Map,faces:new Map},be=c.createContext(Es);function ca({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function la(){const e=he(),t=c.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=c.useMemo(()=>t.map(r=>r.projectPath),[t]),n=We(s),o=c.useMemo(()=>_s(t,n.data??{}),[t,n.data]),a=c.useMemo(()=>Os(o),[o]);return c.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const t=c.useContext(be);return e===void 0?void 0:t.info.get(e)}function Ts(){return c.useContext(be).faces}function $s({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:i}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(i)}}const Q=120,Ds="code block";function Ps(e){if(e.length<=Q&&!e.includes("```"))return null;const t=Fs(e);return t.length===0?null:t}function Fs(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Ds} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=Q)return t;const s=Ls(t,Q),n=s.lastIndexOf(" ");return`${(n>Q/2?s.slice(0,n):s).trimEnd()}…`}function Ls(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Bs({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=cs(),i=o===!0||!a,d=c.useMemo(()=>t.reactions??[],[t.reactions]),p=c.useMemo(()=>d.filter(v=>_t(v,s)).map(v=>v.emoji),[d,s]),u=c.useCallback(v=>r.mutate({roomId:e,entryId:t.id,emoji:v,viewerAuthorId:s}),[r,e,t.id,s]),x=c.useMemo(()=>({quick:n,mine:p,onToggle:u,disabled:i}),[n,p,u,i]);return{reactions:d,toggle:u,quickRow:x}}function Us({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function Hs(e,t){var x,v;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Zn.includes(n),a=Lt(e,{enabled:o}),r=ze(),i=Fe(),d=fe(),p=o?((v=(x=a.data)==null?void 0:x.bindings.find(m=>m.authorId===s))==null?void 0:v.sessionId)??null:null,u=c.useCallback(m=>{m.button!==0||m.metaKey||m.ctrlKey||m.shiftKey||m.altKey||(m.preventDefault(),!(p===null||s===void 0)&&et({queryClient:i,transport:d},e,s).then(f=>{f.kind!=="none"&&r(pe({session:f.kind==="bound"?f.sessionId:p}))}))},[s,r,i,e,p,d]);return c.useMemo(()=>p===null?null:{href:nt({session:p}),onOpen:u},[u,p])}const ne="mention",ve="author_id",Ks={[ne]:[ve]},qs=[ne];function Ws(e,t){if(!t||t.length===0)return e;const s=zs(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:i}=s[o],d=n.slice(0,a),p=n.slice(a,a+r),u=n.slice(a+r);n=`${d}<${ne} ${ve}="${i}">${p}</${ne}>${u}`}return n}function zs(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const Vs=/^[\s,&+/]*(?:and[\s,&+/]+)?$/i;function Gs(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=new Set;let o=!0;return s.map((a,r)=>{if(o&&r>0){const i=s[r-1];o=Vs.test(e.slice(i.offset+i.length,a.offset))}return o&&n.add(a.authorId),n.has(a.authorId)?a:{...a,cc:!0}})}function Ys(e){const t=new Set(e.filter(n=>!n.cc).map(n=>n.authorId)),s=[];for(const n of e)n.cc&&!t.has(n.authorId)&&!s.includes(n.authorId)&&s.push(n.authorId);return s}const Js=new Map,ln=c.createContext(Js);function Xs({authors:e,children:t}){return l.jsx(ln.Provider,{value:e,children:t})}function Qs(e){const t=c.useContext(ln);return e===void 0?void 0:t.get(e)}const Ee=new WeakMap;function Zs(e){const t=Ee.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return Ee.set(e,s),s}function eo(e){var n;const s=(n=he().data)==null?void 0:n.agents;return c.useMemo(()=>e===void 0||!s?void 0:Zs(s).get(e),[s,e])}function dn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=Be(),a=eo(o?t:void 0),r=ee(t);return c.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const i={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(p,u={})=>l.jsx(ms,{identity:i,agentPath:a,onViewProfile:n,openOnClick:u.openOnClick??!1,children:p});return{wrap:d,wrapAvatar:p=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:p}),{openOnClick:!0}),wrapName:p=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:te(p.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const no={kind:"human",displayName:""};function to(e){return typeof e=="string"?e.replace(/^@/,""):""}function so({authorId:e,children:t,cc:s}){const n=Qs(e),o=ee(n==null?void 0:n.agentRef),{open:a}=Ve(),r=n?qe({record:n,override:o==null?void 0:o.visual}):null,i=n?Ge(n,o==null?void 0:o.memberId):void 0,d=c.useMemo(()=>i===void 0?void 0:()=>a(i),[i,a]),p=r==null?void 0:r.color,u=r==null?void 0:r.emoji,x=r==null?void 0:r.imageUrl,v=c.useMemo(()=>n?{kind:n.kind,displayName:n.displayName,handle:n.handle??void 0,color:p,emoji:u,imageUrl:x,origin:n.origin,agent:o&&{runtime:o.runtime,...o.model&&{model:o.model}}}:null,[n,p,u,x,o]),m=dn({agentRef:n==null?void 0:n.agentRef,identity:v??no,onViewProfile:d});if(!n||!v)return l.jsx(Se,{kind:"human",label:to(t),resolved:!1});const g=m?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:d?{role:"button",tabIndex:0,"aria-label":`View ${n.displayName}’s profile`,onClick:d,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),d())}}:{},w=l.jsx(Se,{kind:n.kind,label:n.displayName,handle:n.handle??void 0,color:n.color,origin:n.origin,resolved:!0,interactive:d!==void 0,...g,cc:s});return m?m.wrap(w,{openOnClick:!0}):l.jsx(ye,{onViewProfile:d,identity:v,children:w})}function oo(e,t=new Set){return{mention:s=>{const n=s[ve],o=typeof n=="string"?n:void 0;return!o||!e.has(o)?l.jsx(l.Fragment,{children:s.children}):l.jsx(so,{authorId:o,cc:t.has(o),children:s.children})}}}function ao({entry:e,authors:t}){const s=c.useMemo(()=>Ws(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=c.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(i=>i.authorId))??[])},[e.mentionSpans]),o=c.useMemo(()=>new Set(Ys(e.mentionSpans??[])),[e.mentionSpans]),a=c.useMemo(()=>oo(n,o),[n,o]);return l.jsx(Xs,{authors:t,children:l.jsx(Bt,{content:s,className:"msg-prose",allowedTags:Ks,literalTagContent:qs,components:a,renderers:ps})})}function ro(e){return function(s){return l.jsx(ao,{entry:s,authors:e})}}const un="the top folder";function Te(e){return e.slice(e.lastIndexOf("/")+1)}function io(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function co(e){return e===""?un:`${e}/`}function de(e){return e.target!==void 0?e.target===""?un:e.target:co(io(e.paths[0]??""))}function lo(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${Te(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${Te(s)} from the chat to ${de(e)}`}}const uo=c.lazy(()=>tt(()=>import("./index-B36osK_S.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function da({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:i,streamStalled:d,isMember:p=!0,grouping:u,orphanedReply:x,answers:v,feedPosition:m,rowId:f}){const g=Qe(t.createdAt),w=c.useMemo(()=>{const L=Ps(t.body.text),ie=Ot(t.attachments??[]);if(ie===null)return L;const Ie=L??t.body.text.trim();return Ie.length>0?`${Ie} ${ie}`:ie},[t.body.text,t.attachments]),h=c.useId(),y=`${h}-author`,I=`${h}-content`,S=`${h}-summary`,M=c.useRef(null),C=c.useRef(null),N=c.useRef(null),{reactions:A,toggle:_,quickRow:j}=Bs({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:i,streamStalled:d,isMember:p}),b=ee(n==null?void 0:n.agentRef),{open:O}=Ve(),k=n===void 0?void 0:Ge(n,b==null?void 0:b.memberId),T=c.useCallback(()=>{k!==void 0&&O(k)},[O,k]),$=k===void 0?void 0:T,W=Ns({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:$}),z=(n==null?void 0:n.handle)??void 0,B=c.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:z,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,z,s.color,s.emoji,s.imageUrl]),D=dn({agentRef:n==null?void 0:n.agentRef,identity:B,onViewProfile:$}),R=Us({barRef:C,pillsRef:N,hasReactions:A.length>0}),U=c.useCallback(()=>{var L;return(L=M.current)==null?void 0:L.focus()},[]),oe=c.useMemo(()=>ro(o),[o]),xn=c.useCallback(L=>l.jsx(c.Suspense,{fallback:null,children:l.jsx(uo,{roomId:e,attachment:L})}),[e]),yn=Ts(),ae=t.body.subjectAuthorId??t.authorId,E=o.get(ae),V=ee(E==null?void 0:E.agentRef),bn=Hs(e,t),re=Rs(t);if(re.kind==="notice")return l.jsx(vs,{entry:t,feedPosition:m,rowId:f,sessionLink:bn,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(ws,{entry:t,moment:re.moment,subject:ae===t.authorId?s:Cs(ae,o,yn),subjectIdentity:{handle:(E==null?void 0:E.handle)??void 0,origin:E==null?void 0:E.origin,agent:V&&{runtime:V.runtime,...V.model&&{model:V.model}}},feedPosition:m,rowId:f});const vn=u.position==="first"||u.position==="only",we=t.authorId===a;return l.jsxs(P.Root,{ref:M,id:f,position:u.position,actions:W,reactions:j,"data-testid":"room-entry",tabIndex:0,...$s({showAuthorHeader:vn,headerId:y,displayName:s.displayName,time:g,summary:w,contentId:I,summaryId:S,feedPosition:m}),onKeyDown:R,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:D?void 0:$,isSelf:we,renderAvatar:D==null?void 0:D.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:y,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,isSelf:we,renderName:D==null?void 0:D.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),v!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${v.excerpt}”`}),t.body.via&&l.jsx(Et,{via:t.body.via}),l.jsx(P.Content,{id:I,className:"wrap-anywhere [&_pre]:overflow-x-auto [&_pre]:wrap-normal",children:t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:lo(t.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):oe(t,{rowId:t.id,isStreaming:!1})}),w!==null&&l.jsx("span",{id:S,className:"hidden",children:w}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:p?xn:void 0}),l.jsx(P.Reactions,{ref:N,reactions:A,viewerAuthorId:a,names:r,frequents:i,onToggle:_,disabled:d===!0||!p,onExit:U}),l.jsx(P.Actions,{actions:W,reactions:j,barRef:C,onExit:U})]})]})}const ua={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function mo(e){const t=fe(),[s,n]=c.useState([]),o=c.useRef(new Map),a=c.useCallback(m=>{const f=m.map(g=>({id:crypto.randomUUID(),file:g,status:"pending",progress:0}));n(g=>[...g,...f])},[]),r=c.useCallback(m=>{o.current.delete(m),n(f=>f.filter(g=>g.id!==m))},[]),i=c.useCallback(m=>{if(!m){o.current.clear(),n([]);return}const f=new Set(m);for(const g of f)o.current.delete(g);n(g=>g.filter(w=>!f.has(w.id)))},[]),d=c.useCallback(m=>{o.current.delete(m),n(f=>f.map(g=>g.id===m&&g.status==="error"?{...g,status:"pending",progress:0,error:void 0}:g))},[]),p=c.useRef(null),u=Le({meta:{suppressErrorToast:!0},mutationFn:async m=>{n(h=>h.map(y=>m.some(I=>I.id===y.id)?{...y,status:"uploading"}:y));const f=h=>{n(y=>y.map(I=>I.status==="uploading"?{...I,progress:h.percentage}:I))},g=new AbortController;p.current=g;const w=m.map(h=>h.file);return t.uploadRoomAttachments(e,w,f,g.signal)},onSettled:()=>{p.current=null},onSuccess:(m,f)=>{f.forEach((g,w)=>{const h=m[w];h&&o.current.set(g.id,h.id)}),n(g=>g.map(w=>f.findIndex(y=>y.id===w.id)===-1?w:{...w,status:"uploaded",progress:100}))},onError:m=>{n(f=>f.map(g=>g.status==="uploading"?{...g,status:"error",error:m.message}:g))}}),x=c.useCallback(()=>{var m;(m=p.current)==null||m.abort()},[]),v=c.useCallback(async()=>{const m=s.filter(g=>g.status==="error");if(m.length>0)throw new Error(m.length===1?`${m[0].file.name} didn’t upload. Try again or remove it.`:`${m.length} files didn’t upload. Try again or remove them.`);const f=s.filter(g=>g.status==="pending");return f.length>0&&await u.mutateAsync(f),s.map(g=>o.current.get(g.id)).filter(g=>g!==void 0)},[s,u]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:i,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(m=>m.status==="error"),isUploading:u.isPending}}function ma(e){const{room:t,threadRootId:s}=e,n=Tt(),o=$t(),a=mo((t==null?void 0:t.id)??""),r=t!==void 0&&Ye(t.members,t.viewerAuthorId),i=c.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});c.useEffect(()=>{i.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=c.useCallback(y=>i.current.attachments.addFiles(y),[]),p=c.useCallback(y=>i.current.attachments.removeFile(y),[]),u=c.useCallback(y=>i.current.attachments.retryFile(y),[]),x=c.useCallback(()=>i.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:m,isUploading:f}=a,g=c.useMemo(()=>({staged:v,add:d,remove:p,retry:u,cancel:x,hasFailed:m,isUploading:f,holdsSendWhileUploading:!1}),[v,m,f,d,p,u,x]),w=c.useCallback(async y=>{const{attachments:I,post:S,reply:M,room:C,threadRootId:N}=i.current;if(C===void 0)throw new Error("That room isn’t loaded yet.");if(C.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",C.id);const A=st(),_=I.pendingFiles.map(k=>k.file.name),j=I.pendingFiles.map(k=>k.id),b=await I.uploadAndGetIds();I.clearFiles(j);const O=y.parentEntryId??N;if(O!==void 0){M.mutate({roomId:C.id,rootEntryId:O,text:y.text,clientId:A,attachmentIds:b,attachmentNames:_});return}S.mutate({roomId:C.id,text:y.text,clientId:A,attachmentIds:b,attachmentNames:_})},[]);return{target:c.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Je},send:w,attachments:g}),[t,s,r,g,w]),attachments:a}}const mn=8;function fn(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function fo(e){if(rt(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:fn(e.topic)}function $e(e){return{kind:"session",id:e.id,name:at(e.title),summary:fn(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function po(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:fo(e),lastActivityAt:e.lastActivityAt,room:e}}function Y(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function go(e){return e.kind==="session"?Re("session",e.id):Re("room",e.id)}function De(e,t){const s=[Y(t[go(e)]),...e.kind==="session"?[Y(e.session.lastTouchedByYouAt),Y(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):Y(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function ho(e){return(t,s)=>De(s,e)-De(t,e)||s.id.localeCompare(t.id)}function xo(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function yo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function bo({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=mn}){const{yours:a,spinOffs:r,automated:i}=ot(e),d=ho(n),p=[...a.map($e),...t.filter(u=>yo(u,s)).map(po)].sort(d);return{items:xo(p).slice(0,o),automated:[...r,...i].map($e).sort(d).slice(0,o)}}const vo=3,ko=lt;function wo({limit:e=mn,mutedRoomIds:t,enabled:s=!0}={}){var p,u;const n=it(Math.max(e*vo,ko),{enabled:s}),o=Ue({enabled:s}),a=ct(),r=(p=n.data)==null?void 0:p.sessions,i=o.data;return{...c.useMemo(()=>bo({sessions:r??[],rooms:i??[],mutedRoomIds:t,interactions:a,limit:e}),[r,i,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((u=n.data)==null?void 0:u.warnings)??[]}}const Io=6,pn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const No='[role="combobox"]';function K(e){return e instanceof Element&&e.matches(No)}function Ro({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=ze(),o=dt(),[a,r]=c.useState(!1),[i,d]=c.useState({stamp:"",index:0}),[p,u]=c.useState(!1),[x,v]=c.useState(!1);e.length>0&&!x&&v(!0);const m=c.useRef(!1);c.useEffect(()=>{m.current=!0},[]);const{data:f}=he({enabled:s}),g=c.useMemo(()=>((f==null?void 0:f.agents)??[]).map(R=>R.projectPath),[f]),{data:w}=We(g,{enabled:s}),h=c.useMemo(()=>w??{},[w]),y=c.useMemo(()=>ut(g,h),[g,h]),I=c.useMemo(()=>new Map(g.map(R=>[ge(R),R])),[g]),S=c.useCallback(R=>mt({room:R,agentsByPath:h,pathByAgentRef:I}),[h,I]),M=c.useMemo(()=>ft(o.muted),[o.muted]),{items:C}=wo({mutedRoomIds:M,enabled:s}),N=c.useMemo(()=>C.slice(0,Io),[C]),A=s&&a&&!p&&!x&&!t&&e.length===0&&N.length>0,_=`${A}:${N.length}`,j=i.stamp===_?i.index:0,b=c.useCallback(R=>{m.current&&K(R.target)&&(u(!1),v(!1),r(!0))},[]),O=c.useCallback(R=>{K(R.target)&&r(!0)},[]),k=c.useCallback(R=>{K(R.target)&&r(!1)},[]),T=c.useCallback(R=>{N.length!==0&&d(U=>{const oe=U.stamp===_?U.index:0;return{stamp:_,index:(oe+R+N.length)%N.length}})},[N.length,_]),$=c.useCallback(()=>T(1),[T]),W=c.useCallback(()=>T(-1),[T]),z=c.useCallback(()=>{u(!0)},[]),B=c.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Z.getState().recordOpened("agent",R.session.cwd),n(pe({dir:R.session.cwd??void 0,session:R.session.id}));return}Z.getState().recordOpened("room",R.room.id),n({...pt.channels(),search:{id:R.room.id}})},[n]),D=c.useCallback(()=>{const R=N[j];!A||!R||B(R)},[A,N,j,B]);return{isOpen:A,hasRows:N.length>0,rows:N,agents:h,displayNames:y,visualOf:S,selectedIndex:j,activeDescendantId:A&&N[j]!==void 0?ke(j):void 0,listboxId:A?pn:void 0,handleFocus:b,handleBlur:k,handlePointerDown:O,moveDown:$,moveUp:W,selectHighlighted:D,selectRow:B,dismiss:z}}function gn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:i,onSelect:d}){const p=c.useMemo(()=>Number.isNaN(Date.parse(o))?null:kt(o),[o,i]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),p!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:p})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function Co({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const i=ht(t,e.session.cwd??s);return l.jsx(gn,{mark:l.jsx(xt,{color:i.color,emoji:i.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function Ao({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(gn,{mark:l.jsx(bt,{room:e.room,participants:e.room.participants,visuals:vt(t)}),label:l.jsx(yt,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function Mo({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=gt(6e4);return c.useEffect(()=>{var i,d;(d=(i=document.getElementById(ke(t)))==null?void 0:i.scrollIntoView)==null||d.call(i,{block:"nearest"})},[t]),l.jsx(Xe.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:i=>i.preventDefault(),children:l.jsx("div",{id:pn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((i,d)=>{var p;return i.kind==="session"?l.jsx(Co,{item:i,agent:i.session.cwd&&s[i.session.cwd]||null,displayName:i.session.cwd&&n[i.session.cwd]||((p=i.session.cwd)==null?void 0:p.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(i)},`session-${i.id}`):l.jsx(Ao,{item:i,visual:o(i.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(i)},`room-${i.id}`)})})})}const Pe={people:"People",agents:"Agents"},So=["people","agents"];function jo(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function _o(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Oo(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Oo(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function J(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Eo(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,i=a.startsWith(" ")?"":" ";return{value:o+r+i+a,cursorPos:o.length+r.length+1}}const To=/(^|\s)@([A-Za-z0-9_.-]*)$/,hn="mention-palette-listbox";function me(e){return`mention-item-${e}`}function $o({members:e,viewerAuthorId:t,text:s,sectionOrder:n=So}){var O;const[o,a]=c.useState(!1),[r,i]=c.useState(""),[d,p]=c.useState(-1),u=wt(s),x=c.useRef(!1),v=c.useMemo(()=>jo(e,t),[e,t]),m=c.useMemo(()=>o?_o(v,r,n):[],[v,r,o,n]),[f,g]=c.useState(null),w=f!==null&&f.query===r&&f.open===o?f.index:J(m,0,1),h=m[w],y=m.length===0||h!==void 0&&!h.disabled?w:J(m,0,1),I=c.useCallback((k,T)=>{const $=k.slice(0,T).match(To);if(!$){a(!1);return}a(!0),i($[2]),p(($.index??0)+$[1].length)},[]),S=c.useCallback(k=>{u.write(k),x.current=!1},[u]),M=c.useCallback(k=>{x.current||I(u.read(),k)},[I,u]),C=c.useCallback(()=>{g({query:r,open:o,index:J(m,y+1,1)})},[m,y,r,o]),N=c.useCallback(()=>{g({query:r,open:o,index:J(m,y-1,-1)})},[m,y,r,o]),A=c.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Eo(u.read(),d,r,k.handle)),[d,r,u]),_=c.useCallback(()=>{const k=m[y];return k?A(k):(a(!1),null)},[m,y,A]),j=c.useCallback(()=>{x.current=!0,a(!1)},[]),b=m.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:b,rows:m,selectedIndex:y,activeDescendantId:o&&((O=m[y])==null?void 0:O.disabled)===!1?me(y):void 0,listboxId:o?hn:void 0,noteTextChange:S,handleCursorChange:M,moveDown:C,moveUp:N,selectHighlighted:_,selectRow:A,dismiss:j}}function Do({rows:e,selectedIndex:t,onSelect:s}){const n=c.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const i=o[o.length-1];i&&i.section===a.section?i.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return c.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Xe.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:hn,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":Pe[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:Pe[o]}),a.map(({row:i,index:d})=>{const p=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":p,"aria-disabled":i.disabled,"data-selected":p,"data-disabled":i.disabled,onClick:()=>{i.disabled||s(i)},className:i.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:i.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:i.label}),i.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",i.handle]}),i.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:i.disabledReason})]},i.authorId)})]},o))})})}const Po=/@([A-Za-z0-9][A-Za-z0-9_.-]*)/g,Fo=/[.\-_]+$/;function Lo(e,t){const s=new Map;for(const{author:o}of t)o.handle&&s.set(o.handle.toLowerCase(),o.handle);const n=[];for(const o of e.matchAll(Po)){if(o.index===void 0)continue;const a=o[1].toLowerCase(),r=a.replace(Fo,""),i=s.get(a)??s.get(r);if(!i)continue;const d=(s.has(a)?a.length:r.length)+1;n.push({offset:o.index,length:d,authorId:i,handle:i})}return n}function Bo(e,t){const s=Gs(e,Lo(e,t)),n=[],o=[];for(const r of s){const i=r.cc?o:n;i.includes(r.handle)||i.push(r.handle)}if(o.length===0||n.length===0)return null;const a=r=>r.map(i=>`@${i}`).join(", ");return`Asks ${a(n)} · cc ${a(o)}`}function fa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:Ke(e.id,t),i=It(r),{target:d}=Dt(),p=Nt(),u=Rt(r),x=c.useRef(null),v=Ye(e.members,e.viewerAuthorId),m=c.useRef(!1),f=$o({members:e.members,viewerAuthorId:e.viewerAuthorId,text:i}),g=c.useMemo(()=>e.kind==="channel"?Bo(i,e.members):null,[e.kind,e.members,i]),w=n===!0,h=Ro({value:i,yieldToPalette:f.isOpen,enabled:w}),y=c.useRef(u);c.useEffect(()=>{var b;u!==y.current&&(y.current=u,(b=x.current)==null||b.focus())},[u]),c.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const I=c.useCallback(b=>X.getState().set(r,b),[r]),[S,M]=c.useState(null);c.useLayoutEffect(()=>{var b;S!==null&&((b=x.current)==null||b.focusAt(S.pos))},[S]);const C=c.useCallback(b=>{b&&(I(b.value),M({pos:b.cursorPos}))},[I]),N=c.useCallback(b=>C(f.selectRow(b)),[f,C]),A=c.useCallback(()=>C(f.selectHighlighted()),[f,C]),_=()=>{if(d===null||!d.canSend||m.current)return;f.dismiss();const b=X.getState().take(r).trim();if(b==="")return;const O=a.pendingFiles.length>0;O&&(m.current=!0),d.send({text:b}).catch(()=>{const k=X.getState(),T=k.drafts[r]??"";k.set(r,T===""?b:`${b}
44
- ${T}`)}).finally(()=>{O&&(m.current=!1)})};if(!v)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Je}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:p.isPending,onClick:()=>p.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>He.success(`You joined ${se(e)}`)}),children:Ct})]});const j=l.jsx(Pt.Composer,{inputRef:x,value:i,onChange:b=>{I(b),f.noteTextChange(b)},onSubmit:_,footer:g?l.jsx("p",{"data-slot":"cc-line",className:"text-muted-foreground px-3 pb-2 text-xs",children:g}):void 0,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:f.isOpen&&f.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Ce,{children:f.isOpen&&l.jsx(Do,{rows:f.rows,selectedIndex:f.selectedIndex,onSelect:N})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Ce,{children:h.isOpen&&l.jsx(Mo,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:f.handleCursorChange,isStreaming:!1,isPaletteOpen:f.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:f.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:f.moveUp,onArrowDown:h.isOpen?h.moveDown:f.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:A,onEscape:h.isOpen?h.dismiss:f.dismiss,tabPicks:!h.isOpen,onClear:()=>{I(""),f.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:f.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:f.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!w&&o===void 0?j:l.jsx("section",{className:"flex flex-col","data-testid":At.homeComposer,onFocus:b=>{h.handleFocus(b),K(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),K(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:j})}export{ca as A,fa as C,ye as I,ua as R,ta as a,da as b,Cs as c,sa as d,la as e,ia as f,oa as g,As as h,ds as i,na as j,Ms as k,Ss as l,js as m,aa as n,ra as o,K as p,ls as r,q as t,ma as u};
@@ -1 +0,0 @@
1
- import{j as s,e as x,B as o,Y as m,Z as u,_ as h,$ as g}from"./index-OQuvRZTD.js";import{u as p,s as l,a as j,b as f}from"./access-copy-Dqct36mi.js";import{Q as N}from"./query-error-state-5236P3z0.js";const v={agent:"From the agent",this_chat:"Only in this chat"};function k({agentId:n,onManage:e}){var i;const a=p(n);if(a.isPending)return s.jsx(x,{className:"h-24 w-full rounded-lg"});if(a.isError)return s.jsx(N,{title:"Couldn’t load account access",description:"Nothing changed. Try again.",onRetry:()=>void a.refetch(),isRetrying:a.isFetching});const c=((i=a.data)==null?void 0:i.connections)??[];return s.jsxs("section",{"aria-labelledby":"agent-account-access",className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("h3",{id:"agent-account-access",className:"text-sm font-semibold",children:"Account access"}),s.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs",children:"Accounts this agent can use."})]}),e&&s.jsxs(o,{variant:"ghost",size:"sm",onClick:e,children:["Manage",s.jsx(m,{className:"size-3.5","aria-hidden":!0})]})]}),c.length===0?s.jsxs("div",{className:"bg-muted/40 rounded-lg p-4 text-sm",children:[s.jsx("p",{className:"font-medium",children:"No account access"}),s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Give access from the Connections page."})]}):s.jsx("ul",{className:"space-y-1.5",children:c.map(t=>{const r=t.readiness.state==="ready";return s.jsxs("li",{"data-testid":`agent-connection-${t.connectionId}`,className:"bg-muted/40 flex min-h-11 items-center gap-3 rounded-lg px-3 py-2",children:[s.jsx(u,{iconKey:t.toolkit,displayName:l(t.toolkit),className:"size-7"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"truncate text-sm font-medium",children:[l(t.toolkit)," (",t.label,")"]}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.operationRevisionIds.length," approved"," ",t.operationRevisionIds.length===1?"action":"actions",t.everyAgent&&" · given to every agent"]})]}),s.jsx(h,{size:"xs",variant:r?"secondary":"outline",title:r?void 0:t.readiness.copy.owner,children:r?"Available":"Unavailable"})]},t.connectionId)})})]})}const y="This only affects this chat. Turning an app back on never adds access.",C="Couldn’t change access for this chat. Try again.";function b(n){return(n==null?void 0:n.code)==="session_access_other_agent"?n.message:C}function _({sessionId:n,onManage:e,emptyAction:a,footer:c}){var r;const i=j(n);if(i.isPending)return s.jsx(x,{className:"h-16 w-full rounded-lg"});if(i.isError)return s.jsxs("section",{"data-testid":"session-connectors",className:"space-y-2",children:[s.jsx("p",{role:"alert",className:"text-destructive px-1 text-xs",children:"Couldn’t load account access."}),s.jsx(o,{variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Try again"})]});const t=((r=i.data)==null?void 0:r.connections)??[];return s.jsxs("section",{"data-testid":"session-connectors","aria-labelledby":"session-account-access",className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 pb-1",children:[s.jsx("h3",{id:"session-account-access",className:"text-muted-foreground text-xs font-medium tracking-wide uppercase",children:"Connections"}),e&&s.jsxs(o,{variant:"ghost",size:"xs",onClick:e,children:["Manage agent access",s.jsx(m,{className:"size-3","aria-hidden":!0})]})]}),t.length===0?s.jsxs("div",{className:"bg-muted/40 space-y-2 rounded-md px-2.5 py-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium",children:"No account access"}),s.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Ask this agent to request the access it needs."})]}),a]}):s.jsxs(s.Fragment,{children:[t.some(d=>d.thisChat)&&s.jsx("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:y}),t.map(d=>s.jsx(S,{sessionId:n,connection:d},d.connectionId))]}),t.length>0&&c]})}function S({sessionId:n,connection:e}){const a=f(n),c=e.readiness.state==="ready",i=`${l(e.toolkit)} (${e.label})`;return s.jsxs("div",{"data-testid":`session-connection-${e.connectionId}`,"data-reason":e.readiness.reason,className:"bg-muted/40 rounded-md px-2.5 py-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[s.jsx("span",{className:"text-sm font-medium",children:i}),s.jsx(h,{size:"xs",variant:c?"secondary":"outline",children:c?v[e.source]:"Not available"})]}),s.jsx("p",{className:c?"text-muted-foreground mt-1 text-xs":"text-status-warning-fg mt-1 text-xs",children:c?`${e.operationRevisionIds.length} ${e.operationRevisionIds.length===1?"action":"actions"} available in this chat.`:e.readiness.copy.owner})]}),e.thisChat&&s.jsx(g,{"aria-label":`${i} in this chat`,"data-testid":`session-connection-switch-${e.connectionId}`,checked:e.thisChat==="on",disabled:a.isPending,onCheckedChange:t=>a.mutate({connectionId:e.connectionId,on:t}),className:"mt-0.5 shrink-0"})]}),a.isError&&e.thisChat&&s.jsx("p",{role:"alert",className:"text-destructive mt-1 text-xs",children:b(a.error)})]})}export{k as A,_ as S};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-OQuvRZTD.js";import{a as t}from"./ProfileFields-DbPJ7fvN.js";import"./profile-errors-COcBx7w5.js";import"./use-mounted-ref-CaPc6Prv.js";function n({member:r}){return o.jsx(t,{member:r})}export{n as HandlePage};
@@ -1 +0,0 @@
1
- import{a1 as T,a3 as w,a4 as B,hb as v,hc as $,h as O,j as s,hd as A,b6 as E,he as W,_ as P,B as x,s as R,a7 as D,hf as M,hg as H,d as L,r as h,hh as F,e as S,hi as I,hj as q,b as U,hk as _}from"./index-OQuvRZTD.js";import{M as C}from"./more-details-CRLU2HN4.js";import{HeartbeatFileEditor as z}from"./ConventionPage-CNhpF6Z1.js";import"./relay-trace-schemas-B80E4EUn.js";import"./form-D93N5lrK.js";import"./untrusted-text-BDygHCRk.js";import"./soul-file-CXgYs25S.js";function Q(){const e=T(),t=w();return B({mutationFn:n=>e.chooseTriageCredits(n),onSettled:()=>t.invalidateQueries({queryKey:v.all})})}function K(e,t){if(e.cadence==="off")return"Sends no reports.";const n=e.cadence==="weekly"?"each week":"each workday",a=e.items===0?"Nothing to report yet.":`${e.items} ${e.items===1?"item":"items"} so far.`;return`Reports to ${t} ${n}. ${a}`}function G(e,t){const n=$(e,t);return a=>{var r;return((r=e.find(l=>{var o;return((o=l.agent)==null?void 0:o.manifestId)===a}))==null?void 0:r.displayName)??n(a)}}function J(e){return Number.isNaN(e.getTime())?null:e.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}function V({beat:e,onOpenChat:t}){const n=A[e.outcome],a=J(new Date(e.startedAt));return s.jsxs("li",{"data-slot":"heartbeat-beat","data-outcome":e.outcome,className:"flex flex-col gap-1 rounded-md px-2 py-2",children:[s.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-2 gap-y-1 text-xs",children:[s.jsx("time",{dateTime:e.startedAt,title:a??void 0,children:E(e.startedAt)}),s.jsx("span",{children:W[e.kind]}),s.jsx(P,{variant:"outline",size:"xs",tone:n.tone,className:"ml-auto",children:n.label})]}),e.summary&&s.jsx("p",{className:"text-sm break-words",children:e.summary}),t&&s.jsx(x,{size:"xs",variant:"ghost",className:"-ml-2 self-start","aria-label":a?`Open chat from the check at ${a}`:"Open chat from this check",onClick:t,children:"Open chat"})]})}function X({beats:e,canOpenChat:t}){const n=O();return e.length===0?s.jsx("p",{className:"text-muted-foreground px-2 text-sm",children:"No checks yet."}):s.jsx("ul",{className:"flex flex-col","aria-label":"Last checks",children:e.map(a=>{const r=a.sessionId,l=t&&r&&n?()=>void n(R({session:r})):void 0;return s.jsx(V,{beat:a,...l?{onOpenChat:l}:{}},a.id)})})}function Y(e){return e.runsOn==="credits"?`Checks run on DorkOS credits. ${e.today} today.`:`Checks run on ${D(e.runtime)}.`}function Z(e){if(e.today===0)return null;const t=`${e.tokens.toLocaleString("en-US")} tokens`;return e.runsOn==="credits"?`${t} today.`:`${`${e.today} ${e.today===1?"check":"checks"}`} on credits earlier today, ${t}.`}function ee(){const e=Q();return s.jsxs("div",{className:"bg-muted/40 space-y-2 rounded-md border px-3 py-3","data-slot":"heartbeat-credits-offer",children:[s.jsx("p",{className:"text-sm font-medium",children:"Run cheap checks on DorkOS credits?"}),s.jsx("p",{className:"text-muted-foreground text-xs",children:"Quick checks skip most full runs. Nothing is spent until you say yes."}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(x,{size:"sm",disabled:e.isPending,onClick:()=>e.mutate(!0),children:"Use credits"}),s.jsx(x,{size:"sm",variant:"ghost",disabled:e.isPending,onClick:()=>e.mutate(!1),children:"Not now"})]}),e.isError&&s.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Couldn’t save your answer. Try again."})]})}function se({checks:e}){const t=Z(e);return s.jsxs("section",{className:"space-y-2","data-slot":"heartbeat-checks",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Checks"}),s.jsx("p",{className:"text-sm",children:Y(e)}),t&&s.jsx("p",{className:"text-muted-foreground text-xs",children:t}),e.offer&&s.jsx(ee,{})]})}function te({held:e,nameOf:t,now:n}){return e.length===0?null:s.jsxs("section",{className:"space-y-2","data-slot":"heartbeat-held",children:[s.jsxs("h3",{className:"text-sm font-semibold",children:["Held until working hours: ",e.length,"."]}),s.jsx("ul",{className:"flex flex-col","aria-label":"Held messages",children:e.map(a=>{const r=M(a.deliverAfter,new Date(n));return s.jsxs("li",{className:"flex flex-col gap-0.5 rounded-md px-2 py-2",children:[a.text&&s.jsx("p",{className:"line-clamp-3 text-sm break-words whitespace-pre-line",children:a.text}),s.jsx("p",{className:"text-muted-foreground text-xs",children:[`To ${t(a.to)}`,r].filter(Boolean).join(" · ")})]},a.id)})})]})}function f(e){return e.value===null?null:`${Math.round(e.value*100)}%`}function p(e){return`${e.part} of ${e.whole}`}function ne(e){return`Target ${e.charAt(0).toLowerCase()}${e.slice(1)}`}function ae(e){return e.value!==null?e.value.toFixed(1):e.messages>0?`${e.messages} sent, none useful`:null}function re(e){return e.windowDays===1?"No checks in the last day.":`No checks in the last ${e.windowDays} days.`}function oe(e){return e.windowDays===1?"Last day.":`Last ${e.windowDays} days.`}function N(e,t,n){return`${e} ${e===1?t:n}`}function le(e){const{pauses:t,wakeOff:n,mutes:a}=e.mutesAndPauses,r=[t>0?N(t,"pause","pauses"):null,n>0?N(n,"switch-off","switch-offs"):null,a>0?N(a,"mute","mutes"):null].filter(l=>l!==null);return r.length===0?null:r.join(", ")}function ie(e){const t=e.supporting,n=o=>Math.round(o).toLocaleString("en-US"),a=f(t.quietBeats),r=f(t.commitmentsOnTime);return[a?`Quiet checks: ${a}, ${p(t.quietBeats)}.`:null,r?`Promises kept on time: ${r}, ${p(t.commitmentsOnTime)}.`:"No promises came due.",t.noEndBeat>0?`Ended without a summary: ${t.noEndBeat}.`:null,t.triage.checks>0?`Cheap checks: ${t.triage.checks}, ${n(t.triage.tokens)} tokens.`:null,t.turns.count>0?t.turns.tokensPerTurn===null?`Full runs: ${t.turns.count}.`:`Full runs: ${t.turns.count}, about ${n(t.turns.tokensPerTurn)} tokens each.`:null,t.bypass>0?`Posted outside a check’s summary: ${t.bypass}.`:null,t.held>0?`Held for people’s hours: ${t.held}.`:null].filter(o=>o!==null)}function u({label:e,value:t,detail:n,target:a,source:r}){return s.jsxs("div",{"data-slot":"heartbeat-measure",className:"grid grid-cols-[1fr_auto] items-baseline gap-x-2 gap-y-0.5 py-1.5",children:[s.jsx("dt",{className:"text-sm",children:e}),s.jsx("dd",{className:"text-sm font-medium tabular-nums",children:t}),(n||a)&&s.jsxs("dd",{className:"text-muted-foreground col-span-2 flex flex-wrap gap-x-2 text-xs",children:[n&&s.jsx("span",{className:"tabular-nums",children:n}),a&&s.jsx("span",{children:ne(a)})]}),s.jsx("dd",{className:"text-muted-foreground col-span-2 text-xs",children:r})]})}function k({measures:e}){const{mutesAndPauses:t}=e;return s.jsx(u,{label:"Mutes and pauses",value:String(t.total),detail:le(e),target:t.target,source:t.source})}function ce({measures:e}){const t="Nothing to count yet";if(e.supporting.beats===0)return s.jsxs("section",{className:"space-y-1","data-slot":"heartbeat-measures","data-state":"empty",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Measures"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:re(e)}),s.jsx("dl",{children:s.jsx(k,{measures:e})})]});const{keptRate:n,usefulRaiseRate:a,interruptions:r}=e,l=ie(e);return s.jsxs("section",{className:"space-y-2","data-slot":"heartbeat-measures","data-state":"measured",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Measures"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[oe(e)," Targets are starting points, not grades."]})]}),s.jsxs("dl",{className:"divide-y",children:[s.jsx(u,{label:"Work that stuck",value:f(n)??t,detail:n.whole>0?p(n):null,target:n.target,source:n.source}),s.jsx(u,{label:"Useful messages",value:f(a)??t,detail:a.whole>0?p(a):null,target:a.target,source:a.source}),s.jsx(u,{label:"Interruptions per useful outcome",value:ae(r)??t,detail:r.value===null?null:`${r.messages} sent, ${r.usefulOutcomes} useful`,target:r.target,source:r.source}),s.jsx(u,{label:"Surprises",value:"Not measured yet",source:e.surprises.source}),s.jsx(k,{measures:e})]}),l.length>0&&s.jsx(C,{label:"Supporting measures",openLabel:"Fewer measures",children:s.jsx("ul",{className:"space-y-1 text-xs","aria-label":"Supporting measures",children:l.map(o=>s.jsx("li",{children:o},o))})})]})}function ue({status:e,now:t,readerName:n}){const a=e.enabled&&e.wake==="timed"?I(e.nextBeatAt,new Date(t)):null,r=e.enabled&&e.skippedReason===null;return s.jsxs("section",{className:"space-y-1","data-slot":"heartbeat-wake",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"How it wakes"}),s.jsx("p",{className:"text-sm",children:q(e)}),a&&s.jsx("p",{className:"text-muted-foreground text-xs",children:a}),r&&s.jsx("p",{className:"text-muted-foreground text-xs","data-slot":"heartbeat-next-report",children:K(e.report,n(e.report.to))})]})}function de({error:e}){return s.jsxs("div",{role:"alert",className:"space-y-1","data-slot":"heartbeat-file-problem",children:[s.jsx("p",{className:"text-destructive text-sm",children:"These settings don’t read. The last good ones still apply."}),s.jsx("p",{className:"text-sm",children:_(e)}),s.jsx(C,{children:s.jsx("p",{className:"font-mono break-words",children:e})})]})}function me(e){var i;const{member:t,roster:n,onPush:a,status:r}=e,l=w(),{agent:o,isPending:g}=U(t),[j,c]=h.useState(!1),d=((i=t.agent)==null?void 0:i.manifestId)??"";if(g)return s.jsx(S,{className:"h-40 w-full"});const m=!!o&&((o==null?void 0:o.heartbeatContent)??null)===null;return m&&!j?s.jsxs("section",{className:"space-y-2","data-slot":"heartbeat-file-empty",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"No HEARTBEAT.md yet"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"It wakes only when something happens."}),s.jsx(x,{size:"sm",variant:"outline",onClick:()=>c(!0),children:"Write one"})]}):s.jsxs("section",{className:"space-y-2",children:[r.fileError&&s.jsx(de,{error:r.fileError}),s.jsx(z,{member:t,roster:n,onPush:a,...m?{onCancel:()=>c(!1)}:{},onSaved:()=>void l.invalidateQueries({queryKey:v.agent(d)})})]})}function ye(e){var y,b;const{member:t,roster:n}=e,a=((y=t.agent)==null?void 0:y.manifestId)??null,r=H(a,{live:!0}),l=L(t,n),o=l==="managed"||l==="system",g=h.useMemo(()=>$(n,t),[n,t]),j=h.useMemo(()=>G(n,t),[n,t]),c=F(3e4),[d,m]=h.useState(!1);if(o&&((b=r.data)!=null&&b.enabled)&&!d&&m(!0),!a)return null;if(r.isPending)return s.jsx(S,{className:"h-24 w-full"});if(!r.data)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this heartbeat."});const i=r.data;return s.jsxs("div",{className:"space-y-6","data-slot":"profile-heartbeat",children:[s.jsx(ue,{status:i,now:c,readerName:j}),i.enabled&&s.jsx(se,{checks:i.checks}),o&&d&&s.jsx(me,{...e,status:i}),s.jsx(te,{held:i.held,nameOf:g,now:c}),s.jsx(ce,{measures:i.measures}),s.jsxs("section",{className:"space-y-2","data-slot":"heartbeat-beats",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"Last checks"}),s.jsx(X,{beats:i.lastBeats,now:c,canOpenChat:i.enabled})]})]})}export{ye as HeartbeatPage};
@@ -1,36 +0,0 @@
1
- import{O as te,a1 as B,a2 as de,a8 as P,a3 as ae,a4 as ue,r as p,u as ke,nz as Ce,j as s,eg as ln,eh as on,ei as cn,ej as dn,ek as un,fB as mn,en as ee,dU as hn,I as pn,nA as We,nB as be,nC as Ge,nD as us,nE as ms,e as W,l$ as fn,a0 as me,nF as xn,B as C,e3 as gn,nG as Ke,nH as kn,nI as jn,ap as Qe,P as vn,G as oe,dD as S,dM as K,fV as bn,hU as yn,nJ as Nn,dL as wn,hh as Cn,nK as Pn,nL as Je,nM as Y,nN as Sn,nO as ve,J as hs,ig as Ve,jT as $n,b7 as In,f$ as qe,gX as ps,_ as se,hC as Rn,C as Pe,aL as fs,i1 as Tn,i2 as Dn,i3 as En,i4 as Ln,nP as xs,i5 as An,bU as Un,eq as On,er as Fn,kJ as Mn,ao as gs,aT as ks,hz as js,eR as He,fh as vs,gd as zn,aW as bs,nQ as _n,a as Ae,bY as ys,d0 as Se,d1 as $e,d3 as Ie,d4 as Re,d5 as Te,lo as Ns,lp as ye,eC as De,dN as Ee,x as Fe,bc as ws,au as Kn,gs as Me,gQ as Vn,nR as qn,ix as Hn,nS as Bn,nT as Wn,jI as Gn,nU as Qn,e1 as Jn,nV as Yn}from"./index-OQuvRZTD.js";import{r as Xn,d as Zn,u as Cs,P as Ps,T as et,a as st,b as Ye}from"./PreviewRefusedNotice-Ds4IO32o.js";import{C as nt}from"./card-DUmTNXJJ.js";import{E as tt}from"./empty-state-CACt-76q.js";import{M as at}from"./markdown-content-Cjhsscbn.js";import{U as rt}from"./use-unclaimed-chats-C-z5fstJ.js";import{d as lt,f as it,a as ot,b as ct,c as dt,U as Ss,u as ut,e as mt}from"./UnlinkDialog-ptZy3IN4.js";import{M as ht}from"./more-details-CRLU2HN4.js";import{a as $s}from"./use-dev-links-BOcktLiE.js";import{F as Is}from"./file-D80JE_L0.js";import{A as Rs}from"./AgentPicker-B7upjYRk.js";import{u as pt}from"./useMutationState-BF1EFtIZ.js";import{F as ft}from"./file-exclamation-point-CcJ_e4_m.js";import{R as Ts}from"./rotate-ccw-clock-CCU6SVnv.js";import{P as xt}from"./path-input-C2KIXdON.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 gt=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 kt=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 jt=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 vt=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 bt=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 yt=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 Nt=te(Fs);function wt(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 Ct(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 Pt(){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 St=10*6e4;function $t(e,n={}){const t=B();return de({queryKey:P.updates(e),queryFn:()=>t.checkMarketplaceUpdates(e),enabled:n.enabled??!0,staleTime:St,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function It(){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 Rt(){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 Tt(){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 Dt(){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 Et(){const e=pt({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 Lt(){const e=B();return ue({mutationFn:n=>e.reviewHeldBackPackage(n),meta:{suppressErrorToast:!0}})}function At(e){const n=B();return de({queryKey:P.heldBack(),queryFn:()=>n.listHeldBackPackages(),enabled:e})}function Ut(){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 Ot(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 Ft=300,Mt=[{value:"featured",label:"Featured"},{value:"name",label:"A–Z"},{value:"popular",label:"Popular"},{value:"recent",label:"Recent"}];function zt(){const{sort:e,setSort:n}=ke(),{data:t}=Ce(),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(_t,{})}),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:Mt.map(i=>s.jsx(un,{value:i.value,disabled:l(i.value),className:"text-xs",children:i.label},i.value))})]})]})}function _t(){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),Ft);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 Kt(e,n){if(n==="all")return!0;const t=e.type??"plugin";return n===We?t==="adapter"&&e.adapterType===We:t===n}function Vt(e,n){const t=n.search.trim().toLowerCase();return e.filter(r=>!(!Kt(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&&!Ot(r,t)))}function Le(e,n){return be(e).localeCompare(be(n))}function qt(e,n){const t=e.marketplace===Ge?1:0,r=n.marketplace===Ge?1:0;if(t!==r)return r-t;const a=e.featured?1:0,l=n.featured?1:0;return a!==l?l-a:Le(e,n)}function Ht(e,n){const t=e.installCount??0,r=n.installCount??0;return t!==r?r-t:Le(e,n)}function Bt(e,n){const t=e.updatedAt??"",r=n.updatedAt??"";return t!==r?r.localeCompare(t):Le(e,n)}function Wt(e,n){const t=[...e];switch(n){case"featured":return t.sort(qt);case"name":return t.sort(Le);case"popular":return t.sort(Ht);case"recent":return t.sort(Bt)}}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(nt,{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(tt,{className:"rounded-xl border border-dashed",icon:bt,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?fn: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(xn,{text:e.message})}),s.jsx(C,{variant:"outline",onClick:n,children:"Try again"})]})}const ze=20,Qt=.03,Jt={hidden:{},visible:{transition:{staggerChildren:Qt}}},Yt={hidden:e=>({opacity:e<ze?0:1,y:e<ze?12:0}),visible:{opacity:1,y:0,transition:{duration:.25,ease:"easeOut"}}};function Xt(){const{data:e,isLoading:n,error:t,refetch:r}=Ce(),{data:a}=je(),l=gn(),{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?Wt(Vt(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?kn(A):void 0,E=A?D?jn[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(Qe.div,{variants:l?void 0:Jt,initial:"hidden",animate:"visible","data-slot":"package-grid",className:ms,children:x.map((k,I)=>s.jsx(Qe.div,{variants:l?void 0:Yt,custom:I<ze?I:0,className:"h-full",children:s.jsx(vn,{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=Rt(),n=ae(),{mutate:t,mutateAsync:r}=e,a=p.useCallback(()=>{n.invalidateQueries({queryKey:[...rt]})},[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,...lt(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=it(n==null?void 0:n.links,e),r=Nn(ot(e,t)),a=wn(l=>l.latest[r]);return e.devLink?ct(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(ht,{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(Ue,{children:"Folder missing. Restore it or unlink."});case"link-missing":return s.jsx(Ue,{children:"Its link is gone. Unlink to finish."});case"link-replaced":return s.jsx(Ue,{children:"Something else is in its place. Unlink to finish."})}}function sa({at:e}){const n=Cn(1e3);return s.jsx("time",{dateTime:e,title:new Date(e).toLocaleString(),className:"text-muted-foreground text-xs",children:dt(e,n)})}function Ue({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(bn,{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(yn,{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(gt,{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(Nt,{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=Pn){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=Sn(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 Gs(e){return e.schedules.map(n=>({icon:"clock",label:n.name,description:Zn(n),severity:Xn(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:Gs(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]),...Gs({schedules:r})]}const ha={hooks:[],schedules:[],mcpServers:[],lspServers:[],monitors:[],executables:[],skillTools:[],skillCommands:[]},pa=["hooks","skillCommands","mcpServers","lspServers","monitors","executables","skillTools","schedules"];function Ne(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=>Ne(l,h)===Ne(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=Ne(e,n);return l!==void 0&&r.some(i=>Ne(e,i)===l)?"changed":"new"}const ga={file:Is,puzzle:qe,clock:In,terminal:$n,key:vt,globe:Ve,check:hs,"alert-triangle":me},we={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(Pe,{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?we[t.severity]:we.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 Qs(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?we[e.severity]:we.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:Qs(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(Rn,{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 Oe({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}=Ce(),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}=wt(i,{enabled:l}),{data:u,isLoading:c}=je(),h=a!==null?(u??[]).filter(y=>y.name===a.name):[],f=h.length>0,{data:w}=Ct(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(Tn,{open:a!==null,onOpenChange:y=>!y&&n(),children:[s.jsx(Dn,{side:"right",className:"flex w-full flex-col overflow-hidden sm:max-w-xl",children:a&&s.jsxs(s.Fragment,{children:[s.jsxs(En,{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(Ln,{className:"text-lg",children:be(a)}),s.jsx(xs,{type:a.type??"plugin",adapterType:a.adapterType,className:"shrink-0"})]}),a.description&&s.jsx(An,{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(Oe,{icon:Un,children:E}),R&&s.jsx(Oe,{icon:Ve,children:R}),H&&s.jsx(Oe,{icon:yt,children:H})]}),U&&s.jsxs(On,{href:U,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5 text-xs transition-colors",children:[s.jsx(Fn,{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(at,{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(Mn,{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)}}:_n(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=It(),n=zn(),{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=Ae(j=>j.installConfirmPackage),n=Ae(j=>j.installContext),t=Ae(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(Se,{open:e!==null,onOpenChange:y,children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-2xl",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0",children:[s.jsxs(Re,{children:[R?"Reinstall":"Install"," ",be(e),"?"]}),s.jsx(Te,{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 G=j;T(G==="global"?{scope:G,agentId:void 0}:{scope:G})},className:"gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{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(ye,{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(De,{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(Ee,{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}=Dt(),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=Tt(),{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=Ut(),{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=$t(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 Ga(e){return`${e} ${e===1?"package":"packages"}`}function Qa(e){const n=[];return e.current>0&&n.push(`${Wa(e.current)} up to date.`),e.unknown>0&&n.push(`${Ga(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?[]:Qa(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(Fe,{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(Fe,{size:"xs",className:ie}),"Checking for updates…"]});case"applying":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Fe,{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(kt,{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(Kn,{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(Pe,{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(ft,{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(Pe,{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(Pe,{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:Qs(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(Se,{open:e!==null,onOpenChange:a=>!a&&n(),children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-xl",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsxs(Re,{className:"text-left",children:["Update ",os(e),"?"]}),s.jsx(Te,{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(De,{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(Ee,{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=At(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(Se,{open:u,onOpenChange:v=>!v&&t(),children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-lg",children:u&&e&&n&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsxs(Re,{className:"text-left",children:["Keep these ",c," files as yours?"]}),s.jsx(Te,{className:"text-left",children:"An update couldn’t tell if these are yours or leftovers."})]}),s.jsxs(De,{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(Ee,{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=ut(),D=mt(),{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(),Q="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,...Q?{scope:"project",projectPath:Q}:{scope:"global"},...J&&{replaceInstalled:!0}});if(he!==I.current)return;h({card:{preview:pe,replaceInstalled:J,projectPath:Q},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:Q}=c.card;try{const J=await D.mutateAsync({path:g.path,...Q?{scope:"project",projectPath:Q}:{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:Q,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"):[],G=(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(Se,{open:e,onOpenChange:g=>g?n(!0):R(),children:[s.jsxs($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-lg",children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsx(Re,{className:"text-left",children:b?`Run ${V} from this folder?`:"Link a folder"}),s.jsx(Te,{className:"text-left",children:"Run a plugin or skill pack from your own folder."})]}),s.jsxs(De,{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(xt,{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(ye,{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(ye,{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(Q=>Q.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(Me,{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(Vn,{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&&G.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:[G.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(Me,{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(Ee,{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(qn,{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(Hn,{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(Qn,{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(jt,{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 G;const{data:e,isLoading:n,error:t,refetch:r}=je(),{data:a}=Bn(),l=(G=a==null?void 0:a.find(m=>m.active))==null?void 0:G.name,i=bs(m=>m.openShapeSwitcherToShape),o=Ks(),d=en(),u=Et(),{apply:c}=qa(),h=Lt(),{data:f}=Pt(),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}=Ce(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(Me,{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};Wn(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 Or(){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(Jn,{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(et,{value:e,onValueChange:r=>n(r),children:s.jsxs(st,{"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("span",{"aria-hidden":!0,className:"bg-status-info-bg text-status-info-fg text-2xs ml-1.5 rounded-full px-1.5 font-medium tabular-nums",children:t}),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(zt,{}),s.jsx(Yn,{}),s.jsx("section",{"aria-label":"All packages",children:s.jsx(Xt,{})})]}),s.jsx(Sa,{}),s.jsx(Ta,{})]})}export{br as I,Or as M};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-OQuvRZTD.js";import{P as m}from"./ProfileFields-DbPJ7fvN.js";import"./profile-errors-COcBx7w5.js";import"./use-mounted-ref-CaPc6Prv.js";function a({member:r}){return o.jsx(m,{member:r})}export{a as NamePage};
@@ -1 +0,0 @@
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 +0,0 @@
1
- import{bh as j,fv as F,fw as H,aW as x,r as g,ca as P,ce as B,cm as w,fx as G,a1 as D,a2 as K,b$ as M,bW as W,fy as Y,z as q,bi as z,j as i,en as N,I as R,B as A}from"./index-OQuvRZTD.js";import{d as Q,c as U,n as V,h as $}from"./profile-errors-COcBx7w5.js";import{u as J}from"./use-mounted-ref-CaPc6Prv.js";import{u as L,F as k}from"./ProfileFields-DbPJ7fvN.js";function X(e){return{name:e.displayName.trim()===""||e.displayName===j,handle:!e.handle}}function de(e){const r=X(e);return r.name||r.handle}function Z(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=W(),l=e.panel===P,c=e.agentPath??((n=a.data)==null?void 0:n.cwd)??null,u=Y(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=q().data)==null?void 0:S.members)??[],a=r.find(y=>y.isSelf),o=J(),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||Z(a,r):""),p=h.trim(),v=n.trim(),E=a?z(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)===v?$(s.error,v):null,_=async()=>{if(!a)return!1;l(!0);let y=!0;return T&&(y=await t.mutateAsync(p).then(()=>y,()=>!1)),v&&v!==u&&(y=await s.mutateAsync({authorId:a.id,handle:v}).then(()=>y,()=>!1)),l(!1),y};return{ready:a!==void 0,name:h,setName:f,handle:n,setHandle:m,canSave:a!==void 0&&!d&&(p.length>0||v.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};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-OQuvRZTD.js";import{b as t}from"./ProfileFields-DbPJ7fvN.js";import"./profile-errors-COcBx7w5.js";import"./use-mounted-ref-CaPc6Prv.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};