dorkos 0.128.0 → 0.129.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) hide show
  1. package/dist/bin/cli.js +84 -16
  2. package/dist/browser/native/package-manifest.json +1 -1
  3. package/dist/browser/source-manifest.json +1 -1
  4. package/dist/client/assets/{AboutPage-CmQERFxo.js → AboutPage-CML_SdU1.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-Dw231W2w.js → ActivityErrorState-TuQRJopr.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-DVfeyA9u.js → ActivityPage-CmSxeVSK.js} +1 -1
  7. package/dist/client/assets/ActivityRow-DJhDehIR.js +1 -0
  8. package/dist/client/assets/{AdapterIcon-NqCDzgCI.js → AdapterIcon-CeRDpZGz.js} +1 -1
  9. package/dist/client/assets/AdapterSetupWizard-B6KkTuJo.js +2 -0
  10. package/dist/client/assets/{AgentOptionRow-BRJfZo2y.js → AgentOptionRow-388OJkPc.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-B7upjYRk.js → AgentPicker-C51wqToQ.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-DXJnLk6q.js → AgentRequestCard-Bz31ewIs.js} +4 -4
  13. package/dist/client/assets/AppearancePage-DSVeowGb.js +1 -0
  14. package/dist/client/assets/{ApplyToOverridesDialog-C_QQhNIf.js → ApplyToOverridesDialog-DRtcLrVY.js} +1 -1
  15. package/dist/client/assets/AttentionSignalRow-CqKZyoxB.js +1 -0
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-G7vrCqeA.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-DA1jhqFy.js} +3 -3
  17. package/dist/client/assets/BindingDialog-D25PAed0.js +1 -0
  18. package/dist/client/assets/{BlintzCanvas-DruVZcDU.js → BlintzCanvas-BgIQdpTx.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-CtLpZnTs.js → CanvasCsvContent-ZWHWmb88.js} +4 -4
  20. package/dist/client/assets/CanvasFileContent-DR5pUgca.js +2 -0
  21. package/dist/client/assets/CanvasModel3dContent-OP1ZOMui.js +2 -0
  22. package/dist/client/assets/ChannelComposer-BJ0nNzQb.js +45 -0
  23. package/dist/client/assets/{ChatAppsOff-CCZUzDIH.js → ChatAppsOff-ByitL4Xt.js} +2 -2
  24. package/dist/client/assets/{CodeMirrorDiff-BCpYdhgZ.js → CodeMirrorDiff-JsV_vWBa.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-BeCubxHV.js → CodeMirrorEditor-BfCJG9hQ.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-BZtfTnwg.js → CommitmentList-yFV3_m00.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-DmurDgxV.js → CommitmentsPage-DeERVg-2.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-Bik6GLKp.js → ComputerResourceView-CYMMSE8Y.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-CksBDqdu.js → ComputerViewer-H7kJSIj7.js} +1 -1
  30. package/dist/client/assets/ConnectionAccessLists-SRkf7-Y6.js +1 -0
  31. package/dist/client/assets/{ConnectionsPage-Cgg36gDY.js → ConnectionsPage-D6e3hd4L.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-CNhpF6Z1.js → ConventionPage-CpvRMcSG.js} +2 -2
  33. package/dist/client/assets/{ExtensionPageRoute-C2zue_Pw.js → ExtensionPageRoute-CiFv6we8.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-3v1TfY1P.js → FloatingTanStackRouterDevtools-CqogiFob-D-8CeYC7.js} +1 -1
  35. package/dist/client/assets/{ForwardConsentHost-Mbo0D-zk.js → ForwardConsentHost-ml3b_fsX.js} +1 -1
  36. package/dist/client/assets/HandlePage-Bq5qdCfY.js +1 -0
  37. package/dist/client/assets/HeartbeatPage-C0zSvWH4.js +1 -0
  38. package/dist/client/assets/{KeyEntry-C43vkwpA.js → KeyEntry-Dq6eKAbX.js} +1 -1
  39. package/dist/client/assets/{LexicalField-iAHcvRmI.js → LexicalField-CYOqOLpV.js} +1 -1
  40. package/dist/client/assets/{ManagesPage-BUIJvLmv.js → ManagesPage-DZTMD3Al.js} +1 -1
  41. package/dist/client/assets/Marketplace-buSfuVrY.js +36 -0
  42. package/dist/client/assets/{MarketplaceSourcesView-BZODwhxu.js → MarketplaceSourcesView-BxwvBWgh.js} +1 -1
  43. package/dist/client/assets/{McpAppFrame-D15nxVaI.js → McpAppFrame-CWiRFp8o.js} +2 -2
  44. package/dist/client/assets/{McpSigninBody-DmBxqgxN.js → McpSigninBody-BpYSAV1h.js} +1 -1
  45. package/dist/client/assets/{Model3dViewer-RGXeJd6a.js → Model3dViewer-B2KTvx6d.js} +1 -1
  46. package/dist/client/assets/NamePage-_yT2RQvT.js +1 -0
  47. package/dist/client/assets/{NewDirectMessageMenu-DBAdvv5p.js → NewDirectMessageMenu-CMp4ppiH.js} +1 -1
  48. package/dist/client/assets/{NotificationsPage-NRfyiinS.js → NotificationsPage-CWXIghVM.js} +1 -1
  49. package/dist/client/assets/{OpenMeshSwitch-CgQ6uefo.js → OpenMeshSwitch-C9hiAEHP.js} +2 -2
  50. package/dist/client/assets/OperatorIdentityForm-CjmMoP6n.js +1 -0
  51. package/dist/client/assets/{PermissionHistory-DPEPq8D9.js → PermissionHistory-D_Imuq02.js} +1 -1
  52. package/dist/client/assets/{PermissionsPage--k-xutbJ.js → PermissionsPage-QMLV8PfB.js} +1 -1
  53. package/dist/client/assets/{PersonalityPopover-DMMptmPS.js → PersonalityPopover-BL9DLK0Q.js} +1 -1
  54. package/dist/client/assets/PhotoPage-Djh4IZBF.js +1 -0
  55. package/dist/client/assets/PreviewRefusedNotice-Dt2hV0aJ.js +1 -0
  56. package/dist/client/assets/{ProfileFields-DbPJ7fvN.js → ProfileFields-DD6X85w2.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-CzwhrIlw.js → ProfilePanelContainer-DuFEpNJ3.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-CZEXvlJm.js → ProfileRolePicker-CT9eJ1J0.js} +1 -1
  59. package/dist/client/assets/PromptSuggestionChips-C8V611-5.js +1 -0
  60. package/dist/client/assets/{ReportsToPopover-YOwGLJy5.js → ReportsToPopover-Bs55bP7b.js} +1 -1
  61. package/dist/client/assets/RoomSurface-DXZ36tmU.js +1 -0
  62. package/dist/client/assets/{RoomsPage-CoXjZMWL.js → RoomsPage-CDiSwt-I.js} +1 -1
  63. package/dist/client/assets/RunsOnPopover-CFBDa9DO.js +1 -0
  64. package/dist/client/assets/RuntimeConnectFlow-DsawxJN7.js +1 -0
  65. package/dist/client/assets/RuntimeSetupDialog-bdf844gx.js +1 -0
  66. package/dist/client/assets/{SeenDevices-Bh2yh-PW.js → SeenDevices-Cix5nnGQ.js} +2 -2
  67. package/dist/client/assets/{SessionsPage-CFvkbT9X.js → SessionsPage-CCu8rM-J.js} +1 -1
  68. package/dist/client/assets/SettingsDialog-D7sVluoe.js +12 -0
  69. package/dist/client/assets/SkillsPage-SSq7ofgp.js +1 -0
  70. package/dist/client/assets/TaskDialogWrapper-CBIuIbmj.js +1 -0
  71. package/dist/client/assets/TasksEmptyState-C0K_NOA3.js +3 -0
  72. package/dist/client/assets/{TasksPage-D0Zi6Mve.js → TasksPage-BpSn7GmR.js} +1 -1
  73. package/dist/client/assets/{TeamComputerEntry-CY9eLVad.js → TeamComputerEntry-BAi9omUC.js} +1 -1
  74. package/dist/client/assets/{ToolsPage-0_vx5P-F.js → ToolsPage-nkGWy6MR.js} +2 -2
  75. package/dist/client/assets/{TopologyGraph-DUZLZZrB.js → TopologyGraph-D6SSv0kC.js} +14 -14
  76. package/dist/client/assets/TourHost-CrZciWIf.js +1 -0
  77. package/dist/client/assets/{UnlinkDialog-ptZy3IN4.js → UnlinkDialog-B9zw8r6F.js} +1 -1
  78. package/dist/client/assets/{UnreadDivider-Ckey1IWn.js → UnreadDivider-BnJ06LmP.js} +1 -1
  79. package/dist/client/assets/WidgetErrorCard-CQKYI7oK.js +108 -0
  80. package/dist/client/assets/{WithheldExtensionsNotice-7Vu1Jctn.js → WithheldExtensionsNotice-VMM5NjL5.js} +1 -1
  81. package/dist/client/assets/WorkView-D5d8DDxS.js +51 -0
  82. package/dist/client/assets/_shell-CTKp94uQ.js +80 -0
  83. package/dist/client/assets/{_shell._home-BRIXhYLg.js → _shell._home-CcfELPIk.js} +1 -1
  84. package/dist/client/assets/_shell._home.activity-CGKsuLq8.js +1 -0
  85. package/dist/client/assets/_shell._home.index-DrJRgJCb.js +3 -0
  86. package/dist/client/assets/_shell._home.tasks-B_lv_-fX.js +1 -0
  87. package/dist/client/assets/_shell._home.workspaces-CjBJymCW.js +1 -0
  88. package/dist/client/assets/{_shell.channels-Bx6q9xVH.js → _shell.channels-CzQFR6pU.js} +4 -4
  89. package/dist/client/assets/_shell.connections-B5hafeep.js +1 -0
  90. package/dist/client/assets/{_shell.feedback-requests-DFznTGbN.js → _shell.feedback-requests-DtD2bH-4.js} +2 -2
  91. package/dist/client/assets/_shell.marketplace-DUpaCb0r.js +1 -0
  92. package/dist/client/assets/_shell.marketplace_.sources-C3pA7zZW.js +1 -0
  93. package/dist/client/assets/_shell.session-DH_9f3AK.js +1 -0
  94. package/dist/client/assets/{_shell.team-DmA09abY.js → _shell.team-BrGo-IxK.js} +6 -6
  95. package/dist/client/assets/_shell.threads-Ceq_tmNk.js +1 -0
  96. package/dist/client/assets/_shell.x._extensionId-DaXLhYNr.js +1 -0
  97. package/dist/client/assets/_shell.x._extensionId_._-DaXLhYNr.js +1 -0
  98. package/dist/client/assets/{abnfDiagram-WEYOIA3C-DxgtVd9I.js → abnfDiagram-WEYOIA3C-BN5bqwbu.js} +1 -1
  99. package/dist/client/assets/{access-copy-Dqct36mi.js → access-copy-BAhTOOsG.js} +1 -1
  100. package/dist/client/assets/{arc-C-67Ef0p.js → arc-BfTE_VoF.js} +1 -1
  101. package/dist/client/assets/{architectureDiagram-ZHVYKT53-B7TjdT-_.js → architectureDiagram-ZHVYKT53-Dc6keeDz.js} +1 -1
  102. package/dist/client/assets/{banner-C9qTs6-C.js → banner-DOgGDCJ5.js} +2 -2
  103. package/dist/client/assets/{blockDiagram-RJAE7QA3-DNqxJ3Ww.js → blockDiagram-RJAE7QA3-B4c6U-ob.js} +1 -1
  104. package/dist/client/assets/{c4Diagram-XDPPPE54-D3jNLV0j.js → c4Diagram-XDPPPE54-CCtD8QC8.js} +1 -1
  105. package/dist/client/assets/channel-CF9_Q7CV.js +1 -0
  106. package/dist/client/assets/{chunk-2E7WHVMD-C6OKx0ty.js → chunk-2E7WHVMD-DcDNqIJG.js} +1 -1
  107. package/dist/client/assets/{chunk-2Q5K7J3B-Dr_6hHrZ.js → chunk-2Q5K7J3B-DOVVK0B8.js} +1 -1
  108. package/dist/client/assets/{chunk-4EMNKR2T-CSrZVDEt.js → chunk-4EMNKR2T-Cg-Do982.js} +1 -1
  109. package/dist/client/assets/{chunk-55XCU76K-CIazeRXO.js → chunk-55XCU76K-CDmULSeY.js} +1 -1
  110. package/dist/client/assets/{chunk-5VM5RSS4-C8IJ3zTR.js → chunk-5VM5RSS4-Bi0yIWW1.js} +1 -1
  111. package/dist/client/assets/{chunk-JWPE2WC7-D9DGXb79.js → chunk-JWPE2WC7-ZHaJh6CV.js} +1 -1
  112. package/dist/client/assets/{chunk-VQ5W62QI-B0LNYdif.js → chunk-VQ5W62QI-DZi6GyW_.js} +1 -1
  113. package/dist/client/assets/{chunk-XXDRQBXY-C7IAIbvZ.js → chunk-XXDRQBXY-D18oZOrd.js} +1 -1
  114. package/dist/client/assets/{chunk-ZCHMQSOR-C79hvjlu.js → chunk-ZCHMQSOR-BkZ0l0fE.js} +2 -2
  115. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-0Di1C2ZB.js → classDiagram-v2-4MYWR3UA-BfmK1buF.js} +1 -1
  116. package/dist/client/assets/{command-BVQb6I3_.js → command-CZqA020F.js} +1 -1
  117. package/dist/client/assets/copy-button-ByA00JGh.js +1 -0
  118. package/dist/client/assets/{cose-bilkent-JH36ORCC-rZumaV4b.js → cose-bilkent-JH36ORCC-B1NTVSbk.js} +1 -1
  119. package/dist/client/assets/{cpu-DeRuDMl4.js → cpu-DNvpMmNN.js} +1 -1
  120. package/dist/client/assets/{cynefin-EF2NZ3EQ-CI9l9xhM.js → cynefin-EF2NZ3EQ-CB_HMIZ8.js} +1 -1
  121. package/dist/client/assets/{cynefinDiagram-WF24UDRP-C8CdorJJ.js → cynefinDiagram-WF24UDRP-MmIWYdc2.js} +1 -1
  122. package/dist/client/assets/{dagre-NK4GIZVX-AHpsTq1O.js → dagre-NK4GIZVX-BQay0k4e.js} +1 -1
  123. package/dist/client/assets/detail-row-290qyusq.js +1 -0
  124. package/dist/client/assets/{diagram-CBK3MWTC-BpPLL30n.js → diagram-CBK3MWTC-C1lRH4cb.js} +1 -1
  125. package/dist/client/assets/{diagram-I5XIIV2D-D6loMn3G.js → diagram-I5XIIV2D-CnANa27A.js} +1 -1
  126. package/dist/client/assets/{diagram-ODIL2UCW-BaGNd5eN.js → diagram-ODIL2UCW-Cwt7hxes.js} +1 -1
  127. package/dist/client/assets/{diagram-PFBEJUXE-BnDdKu_g.js → diagram-PFBEJUXE-DZtAER77.js} +1 -1
  128. package/dist/client/assets/{diagram-RJA3I4VV-UXagB0_c.js → diagram-RJA3I4VV-CbVXbiGs.js} +1 -1
  129. package/dist/client/assets/{diagram-TYUNFSNR-C-whBP-S.js → diagram-TYUNFSNR-D-AcGdsL.js} +1 -1
  130. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-BbG481iS.js → ebnfDiagram-V4P3TTPT-DLkrFSAy.js} +1 -1
  131. package/dist/client/assets/{elk-QONTBCTQ-FtssIxOc.js → elk-QONTBCTQ-DQM6Glxa.js} +1 -1
  132. package/dist/client/assets/{empty-state-CACt-76q.js → empty-state-BnuM8oop.js} +1 -1
  133. package/dist/client/assets/{erDiagram-KYQIGQAA-PpFgUf4C.js → erDiagram-KYQIGQAA-C1qgB1Mn.js} +1 -1
  134. package/dist/client/assets/{execution-config-CGL73sRn.js → execution-config-BjLHHc9x.js} +1 -1
  135. package/dist/client/assets/{file-D80JE_L0.js → file-D7_QdH_S.js} +1 -1
  136. package/dist/client/assets/{file-exclamation-point-CcJ_e4_m.js → file-exclamation-point-Cdt8YqyQ.js} +1 -1
  137. package/dist/client/assets/{file-text-Ds9edaTZ.js → file-text-CB9l6Ur-.js} +1 -1
  138. package/dist/client/assets/{find-latest-widget-fence-BtqFMP_f.js → find-latest-widget-fence-SQB9WgjN.js} +5 -5
  139. package/dist/client/assets/{flowDiagram-IUGLLWBU-BIva66g9.js → flowDiagram-IUGLLWBU-DH-ePeFu.js} +1 -1
  140. package/dist/client/assets/form--HjBAzX8.js +1 -0
  141. package/dist/client/assets/{format-cron-BpGrgPLu.js → format-cron-svkfKW5b.js} +1 -1
  142. package/dist/client/assets/format-tokens-DymkROvy.js +1 -0
  143. package/dist/client/assets/{ganttDiagram-R7GPNTJY-CZqips_4.js → ganttDiagram-R7GPNTJY-fjb_iAW1.js} +1 -1
  144. package/dist/client/assets/{git-branch-B8JNwQ6q.js → git-branch-CPOwiT8a.js} +1 -1
  145. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DoIc3lda.js → gitGraphDiagram-PDYL7XHY-CcCqH5T3.js} +1 -1
  146. package/dist/client/assets/{graph-yizM0vwL.js → graph-DS3J2jnN.js} +1 -1
  147. package/dist/client/assets/{heart-BavUIV45.js → heart-C6uRnXx3.js} +1 -1
  148. package/dist/client/assets/{highlighted-body-KPVGNVTW-CGr3AgaU.js → highlighted-body-KPVGNVTW-CNygKq0i.js} +1 -1
  149. package/dist/client/assets/image-lightbox-BQV3i0WJ.js +1 -0
  150. package/dist/client/assets/{image-off-C1uTDs9-.js → image-off-B88WBkcV.js} +1 -1
  151. package/dist/client/assets/{index-SOKlO1zZ.js → index-3CJSEcZE.js} +1 -1
  152. package/dist/client/assets/index-3JL8A9YZ.css +1 -0
  153. package/dist/client/assets/{index-BJEt9R_G.js → index-57qzL_5b.js} +1 -1
  154. package/dist/client/assets/index-5RD9flqf.js +1 -0
  155. package/dist/client/assets/{index-FhWMRBQP.js → index-B6pmysqs.js} +1 -1
  156. package/dist/client/assets/{index-DEiSJbvu.js → index-BIZNH5u1.js} +1 -1
  157. package/dist/client/assets/{index-BOhSPP-6.js → index-BKdXHSbr.js} +1 -1
  158. package/dist/client/assets/{index-B36osK_S.js → index-BN3zOTbR.js} +3 -3
  159. package/dist/client/assets/{index-DYEmUa5t.js → index-BNq_mnok.js} +1 -1
  160. package/dist/client/assets/index-BPp-rj-W.js +1 -0
  161. package/dist/client/assets/{index-DW4KUPHp.js → index-BTqJGL1_.js} +1 -1
  162. package/dist/client/assets/{index-CJXMgnYp.js → index-B_YZ5cyn.js} +1 -1
  163. package/dist/client/assets/{index-Dcd4NqFB.js → index-B_rc9Pb1.js} +1 -1
  164. package/dist/client/assets/{index-56EOd-zy.js → index-B_v2l2ND.js} +1 -1
  165. package/dist/client/assets/{index-QSXJR98z.js → index-Bktc0aFV.js} +1 -1
  166. package/dist/client/assets/index-BtTqA4_d.js +1 -0
  167. package/dist/client/assets/{index-CiGYtR9O.js → index-BxsALYNM.js} +1 -1
  168. package/dist/client/assets/index-C4Uak2ha.js +1 -0
  169. package/dist/client/assets/{index-FI_y_dND.js → index-C7I0BjyX.js} +1 -1
  170. package/dist/client/assets/{index-CoNMlH37.js → index-CEicS7Zi.js} +1 -1
  171. package/dist/client/assets/{index-1QfQImuJ.js → index-CLTrC-a-.js} +3 -3
  172. package/dist/client/assets/{index-CXBYgGja.js → index-CLVvKY2v.js} +1 -1
  173. package/dist/client/assets/{index-BKWJiERs.js → index-COXdXByr.js} +1 -1
  174. package/dist/client/assets/{index-CoKNU2F9.js → index-CTJA-mZu.js} +1 -1
  175. package/dist/client/assets/{index-BOEPL6hN.js → index-CZmU-67J.js} +1 -1
  176. package/dist/client/assets/{index-LwL5BpE4.js → index-Cbbw2ByB.js} +1 -1
  177. package/dist/client/assets/{index-C4t0UTU-.js → index-Cbk19RQp.js} +1 -1
  178. package/dist/client/assets/{index-DqkFtcGQ.js → index-D0QV18E0.js} +1 -1
  179. package/dist/client/assets/{index-7XeZCCDI.js → index-D5fV4hrl.js} +1 -1
  180. package/dist/client/assets/{index-CeDn1Ak1.js → index-DBAPfYwE.js} +1 -1
  181. package/dist/client/assets/{index-Cdod8zEY.js → index-DK8zHloW.js} +1 -1
  182. package/dist/client/assets/index-DO8NbOqk.js +1 -0
  183. package/dist/client/assets/{index-C8ZpJXTQ.js → index-DXZ-w0Z9.js} +1 -1
  184. package/dist/client/assets/{index-n_pnc-CO.js → index-DYQjub9g.js} +1 -1
  185. package/dist/client/assets/index-Daoy3TZ8.js +1 -0
  186. package/dist/client/assets/{index-tgbcsB6H.js → index-DdBvjuc4.js} +1 -1
  187. package/dist/client/assets/{index-X282DRZf.js → index-DhqeMM58.js} +2 -2
  188. package/dist/client/assets/{index-YSHcMqHa.js → index-Ds9wPt9M.js} +1 -1
  189. package/dist/client/assets/{index-Br6xDNvu.js → index-RQhQx8gq.js} +1 -1
  190. package/dist/client/assets/{index-CrTmY12y.js → index-UJpgX--l.js} +2 -2
  191. package/dist/client/assets/index-YUtEyz7O.js +1053 -0
  192. package/dist/client/assets/{index-BkJlIXqM.js → index-oc-yQ5Q4.js} +1 -1
  193. package/dist/client/assets/index-tRdq7FGO.js +1 -0
  194. package/dist/client/assets/{index-ZR5f82z2.js → index-um-0KSur.js} +1 -1
  195. package/dist/client/assets/{index.esm-CAeUe7uQ.js → index.esm-B10OaB6F.js} +1 -1
  196. package/dist/client/assets/{infoDiagram-MVDRKAX5-DweUdYSy.js → infoDiagram-MVDRKAX5-CGtvYWtj.js} +1 -1
  197. package/dist/client/assets/{inline-code-SYHTKcle.js → inline-code-BL-6EKVP.js} +1 -1
  198. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DKNQIv7P.js → ishikawaDiagram-HPEHV2GE-ICsVVT2t.js} +1 -1
  199. package/dist/client/assets/{journeyDiagram-BOSHW7O7-DPD7F4VO.js → journeyDiagram-BOSHW7O7-DEmSX2Hn.js} +1 -1
  200. package/dist/client/assets/{kanban-definition-FNSA4HC5-B_uPSwxC.js → kanban-definition-FNSA4HC5-SAV5PQOr.js} +1 -1
  201. package/dist/client/assets/{layers-F4mvrI2l.js → layers-Bfdpn7ZM.js} +1 -1
  202. package/dist/client/assets/{lightbulb-a6nNsrzy.js → lightbulb-CSPTiZoi.js} +1 -1
  203. package/dist/client/assets/{link-2-yI2Tlm7Q.js → link-2-ZzmN9B9k.js} +1 -1
  204. package/dist/client/assets/{list-runtime-types-CsGil5te.js → list-runtime-types-7qV7HQ7K.js} +1 -1
  205. package/dist/client/assets/{markdown-content-Cjhsscbn.js → markdown-content-CiDXslQf.js} +1 -1
  206. package/dist/client/assets/mention-pill-CuSUdpn7.js +1 -0
  207. package/dist/client/assets/{mermaid.core-9PwG-9fN.js → mermaid.core-C-qvGQ5g.js} +4 -4
  208. package/dist/client/assets/{message-square-off-aV4NMCjd.js → message-square-off-BehEHG9c.js} +1 -1
  209. package/dist/client/assets/{mindmap-definition-6OY57UG3-BRbWmQkj.js → mindmap-definition-6OY57UG3-DzU2APoo.js} +1 -1
  210. package/dist/client/assets/{more-details-CRLU2HN4.js → more-details-DF2dJXMV.js} +1 -1
  211. package/dist/client/assets/{owner-notice-CTJbhUak.js → owner-notice-DoH-_Veh.js} +1 -1
  212. package/dist/client/assets/{package-sPggO7Dr.js → package-Fm_v1gMn.js} +1 -1
  213. package/dist/client/assets/{page-container-CnfDuiDC.js → page-container-Bcz5wJVR.js} +1 -1
  214. package/dist/client/assets/{pane-resize-handle-63OC5vfI.js → pane-resize-handle-_EuIpxzc.js} +1 -1
  215. package/dist/client/assets/{paperclip-WhPo3_WD.js → paperclip-AGN67YEM.js} +1 -1
  216. package/dist/client/assets/path-input-jrT0Ap4j.js +1 -0
  217. package/dist/client/assets/{pegDiagram-ECIUJNBX-Ct9Li_PA.js → pegDiagram-ECIUJNBX-CAyGJ7fm.js} +1 -1
  218. package/dist/client/assets/{pieDiagram-GNMPY74T-BAB5RA5v.js → pieDiagram-GNMPY74T-tmLJe1p-.js} +1 -1
  219. package/dist/client/assets/{plug-_q5iqunq.js → plug-C-4o4Kb8.js} +1 -1
  220. package/dist/client/assets/primer-trigger-CmE4Ib-X.js +3 -0
  221. package/dist/client/assets/{profile-errors-COcBx7w5.js → profile-errors-vJU1kT3U.js} +1 -1
  222. package/dist/client/assets/{progress-77FCPL2y.js → progress-BTu_QWg8.js} +1 -1
  223. package/dist/client/assets/{quadrantDiagram-D57K4MC3-BqPJVmMS.js → quadrantDiagram-D57K4MC3-CUr2zJoz.js} +1 -1
  224. package/dist/client/assets/{query-error-state-5236P3z0.js → query-error-state-BCX32dab.js} +1 -1
  225. package/dist/client/assets/{radio-C8xmfoqO.js → radio-DBitPjM1.js} +1 -1
  226. package/dist/client/assets/{railroadDiagram-Y72NRBL7-B8U11nT6.js → railroadDiagram-Y72NRBL7-Bk9OMEWz.js} +1 -1
  227. package/dist/client/assets/registry-DVPRVi8T.js +34 -0
  228. package/dist/client/assets/registry-DiFfRDdW.js +1 -0
  229. package/dist/client/assets/{relay-trace-schemas-B80E4EUn.js → relay-trace-schemas-C-1Js81V.js} +2 -2
  230. package/dist/client/assets/{repeat-CHmB_vD7.js → repeat-B1wCYWXI.js} +1 -1
  231. package/dist/client/assets/{requirementDiagram-EQYSW5RA-CzJ1gzTh.js → requirementDiagram-EQYSW5RA-B2pkljrw.js} +1 -1
  232. package/dist/client/assets/{room-files-source-B0gc97Ri.js → room-files-source-BDkq0-fd.js} +2 -2
  233. package/dist/client/assets/{rotate-ccw-clock-CCU6SVnv.js → rotate-ccw-clock-Ds8cHkxD.js} +1 -1
  234. package/dist/client/assets/{rotate-cw-B8WQa8O-.js → rotate-cw-hUzouNTK.js} +1 -1
  235. package/dist/client/assets/{sankeyDiagram-SY24JHO5-D4vQwyve.js → sankeyDiagram-SY24JHO5-DEW9eIPS.js} +1 -1
  236. package/dist/client/assets/scroll-area-RSd8NjrE.js +1 -0
  237. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BVnIsPQe.js → sequenceDiagram-BLEHNHQU-CoiCdD1D.js} +1 -1
  238. package/dist/client/assets/{shield-x-ijIbRppV.js → shield-x-KL4ZbHfz.js} +1 -1
  239. package/dist/client/assets/signed-in-Dzxe2378.js +1 -0
  240. package/dist/client/assets/{sizeCapture-INFHLROL-DGb1rAJL.js → sizeCapture-INFHLROL-BWGf0Ghs.js} +1 -1
  241. package/dist/client/assets/{soul-file-CXgYs25S.js → soul-file-BQXbWArv.js} +1 -1
  242. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DeX3IKTm.js → stateDiagram-v2-A6IESKWZ-aeqwGZMB.js} +1 -1
  243. package/dist/client/assets/{swimlanes-B3ENRKFQ-DN5ljYhG.js → swimlanes-B3ENRKFQ-BkWhAAlV.js} +1 -1
  244. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CS2DMvLi.js +8 -0
  245. package/dist/client/assets/{table-D9ww_3Ij.js → table-CfLst6CF.js} +1 -1
  246. package/dist/client/assets/{timeline-definition-JXYKGLGB-DpRthC3r.js → timeline-definition-JXYKGLGB-C1BUxIfq.js} +1 -1
  247. package/dist/client/assets/{trust-posture-Dn2ciEE0.js → trust-posture-CfEIPM4Z.js} +1 -1
  248. package/dist/client/assets/{unplug-BZ8zSvfB.js → unplug-B3eDst8L.js} +1 -1
  249. package/dist/client/assets/{unverified-catalog-notice-CGy05tAO.js → unverified-catalog-notice-BqIWxQuN.js} +1 -1
  250. package/dist/client/assets/{use-bindings-BLAWQRpe.js → use-bindings-DhOKnybh.js} +1 -1
  251. package/dist/client/assets/{use-composer-prefs-ICOpilWK.js → use-composer-prefs-_rlNL0D8.js} +1 -1
  252. package/dist/client/assets/{use-connector-management-DEMGZy9N.js → use-connector-management-CHLdhBhC.js} +1 -1
  253. package/dist/client/assets/{use-deep-link-scroll-DxGYrks3.js → use-deep-link-scroll-BVkszEn2.js} +1 -1
  254. package/dist/client/assets/{use-delete-binding-Bnv3J5Fu.js → use-delete-binding-BET7vH2R.js} +1 -1
  255. package/dist/client/assets/{use-dev-links-BOcktLiE.js → use-dev-links-BjLPuSUC.js} +1 -1
  256. package/dist/client/assets/{use-direct-message-panel-D38tSozW.js → use-direct-message-panel-ClXVf94w.js} +1 -1
  257. package/dist/client/assets/{use-external-adapter-catalog-9qiNBqpc.js → use-external-adapter-catalog-D1INoacX.js} +1 -1
  258. package/dist/client/assets/use-filter-state-BRlb3qG3.js +6 -0
  259. package/dist/client/assets/use-full-activity-feed-GWBg-_1B.js +1 -0
  260. package/dist/client/assets/use-is-below-desktop-BjWA-tqP.js +1 -0
  261. package/dist/client/assets/{use-local-browser-B1huJhdg.js → use-local-browser-C-V2n_wd.js} +1 -1
  262. package/dist/client/assets/{use-mesh-topology-BTYAy6zc.js → use-mesh-topology-BzSFyR_s.js} +1 -1
  263. package/dist/client/assets/{use-mounted-ref-CaPc6Prv.js → use-mounted-ref-1T3JbkY1.js} +1 -1
  264. package/dist/client/assets/{use-notification-prefs-u76DPoP0.js → use-notification-prefs-qcYeVmLQ.js} +1 -1
  265. package/dist/client/assets/use-pending-read-C1oA2H00.js +1 -0
  266. package/dist/client/assets/use-personality-commit-CJb-rqmM.js +1 -0
  267. package/dist/client/assets/{use-promo-activation-5HG08FlB.js → use-promo-activation-CAJItujg.js} +3 -3
  268. package/dist/client/assets/{use-promo-dismissals-CO7-qhEl.js → use-promo-dismissals-C6bPU5Rm.js} +1 -1
  269. package/dist/client/assets/{use-pulse-freshness-D07Mv-Sa.js → use-pulse-freshness-Y11Ibit1.js} +1 -1
  270. package/dist/client/assets/{use-room-follow-claim-DRQBuAIe.js → use-room-follow-claim-Di-yvoJD.js} +1 -1
  271. package/dist/client/assets/{use-room-sessions-Bzk7rM40.js → use-room-sessions-CPDRbQAW.js} +1 -1
  272. package/dist/client/assets/{use-roving-tab-list-CcznVldj.js → use-roving-tab-list-DK0OzOUz.js} +1 -1
  273. package/dist/client/assets/{use-session-canvas-CpgE7tFb.js → use-session-canvas-DA2i9Mdm.js} +6 -6
  274. package/dist/client/assets/use-status-budget-jMg_w0rF.js +21 -0
  275. package/dist/client/assets/{use-transform-ByJGn3hq.js → use-transform-BX3r518L.js} +1 -1
  276. package/dist/client/assets/{use-unclaimed-chats-C-z5fstJ.js → use-unclaimed-chats-B0nk8b84.js} +1 -1
  277. package/dist/client/assets/use-update-config-Ce7sHmp2.js +1 -0
  278. package/dist/client/assets/{useMutationState-BF1EFtIZ.js → useMutationState-Rlga1GBT.js} +1 -1
  279. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-efVKbRIX.js → usecaseDiagram-WPOLBNNX-mjIwRNL1.js} +1 -1
  280. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-Bravmwce.js → vennDiagram-Q3Y3IDCW-BcDIpVa6.js} +1 -1
  281. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-fR77zByv.js → wardleyDiagram-IVAIDKWA-NFX31kox.js} +1 -1
  282. package/dist/client/assets/{xychartDiagram-4URNHDU4-BphORSLh.js → xychartDiagram-4URNHDU4-DZZY7dL1.js} +1 -1
  283. package/dist/client/index.html +2 -2
  284. package/dist/drizzle/20261031012841_dor3309_file_turn_on_offer.sql +2 -0
  285. package/dist/drizzle/20261101122330_schedule_declined_content_key.sql +1 -0
  286. package/dist/drizzle/meta/20261031012841_snapshot.json +14116 -0
  287. package/dist/drizzle/meta/20261101122330_snapshot.json +14123 -0
  288. package/dist/drizzle/meta/_journal.json +14 -0
  289. package/dist/server/index.js +6424 -4548
  290. package/dist/server/index.js.map +2 -2
  291. package/package.json +5 -5
  292. package/dist/client/assets/ActivityRow-DIBH4v9c.js +0 -1
  293. package/dist/client/assets/AdapterSetupWizard-Dle_b9qc.js +0 -2
  294. package/dist/client/assets/AppearancePage-DXbhUt2e.js +0 -1
  295. package/dist/client/assets/AttentionSignalRow-5E7TkG98.js +0 -1
  296. package/dist/client/assets/BindingDialog-q--8SDJF.js +0 -1
  297. package/dist/client/assets/CanvasFileContent-BThy5fjD.js +0 -2
  298. package/dist/client/assets/CanvasModel3dContent-BbgR73jh.js +0 -2
  299. package/dist/client/assets/ChannelComposer-qhk0KtW7.js +0 -44
  300. package/dist/client/assets/ConnectionAccessLists-DRwO1v0V.js +0 -1
  301. package/dist/client/assets/HandlePage-B4qbFi40.js +0 -1
  302. package/dist/client/assets/HeartbeatPage-BnNbQLCW.js +0 -1
  303. package/dist/client/assets/Marketplace-DbdLWz0-.js +0 -36
  304. package/dist/client/assets/NamePage-fhxyWDDY.js +0 -1
  305. package/dist/client/assets/OperatorIdentityForm-Bls5Vo_u.js +0 -1
  306. package/dist/client/assets/PhotoPage-CNHcXbz4.js +0 -1
  307. package/dist/client/assets/PreviewRefusedNotice-Ds4IO32o.js +0 -1
  308. package/dist/client/assets/PromptSuggestionChips-BXxC799Q.js +0 -1
  309. package/dist/client/assets/RoomSurface-DgH3a_Fv.js +0 -1
  310. package/dist/client/assets/RunsOnPopover-CEkkjrGg.js +0 -1
  311. package/dist/client/assets/RuntimeConnectFlow-DXWGgvCW.js +0 -1
  312. package/dist/client/assets/RuntimeSetupDialog-D6L1QhMF.js +0 -1
  313. package/dist/client/assets/SettingsDialog-BOOqWKcj.js +0 -12
  314. package/dist/client/assets/SkillsPage-ntCEhUIM.js +0 -1
  315. package/dist/client/assets/TaskDialogWrapper-vBWAWwTY.js +0 -1
  316. package/dist/client/assets/TasksEmptyState-C_3UkAbA.js +0 -3
  317. package/dist/client/assets/TourHost-B69XAKpE.js +0 -1
  318. package/dist/client/assets/WidgetErrorCard-BlqaIsPK.js +0 -108
  319. package/dist/client/assets/WorkView-BekLkR4O.js +0 -51
  320. package/dist/client/assets/_shell-Du0F-5fK.js +0 -80
  321. package/dist/client/assets/_shell._home.activity-5rihXoYF.js +0 -1
  322. package/dist/client/assets/_shell._home.index-BsLNqt4f.js +0 -3
  323. package/dist/client/assets/_shell._home.tasks-Cxs5tLWA.js +0 -1
  324. package/dist/client/assets/_shell._home.workspaces-CEHDdfbP.js +0 -1
  325. package/dist/client/assets/_shell.connections-Bm0WmgXH.js +0 -1
  326. package/dist/client/assets/_shell.marketplace-CsQ60Mlc.js +0 -1
  327. package/dist/client/assets/_shell.marketplace_.sources-DNyShS1x.js +0 -1
  328. package/dist/client/assets/_shell.session-BN42bV3w.js +0 -1
  329. package/dist/client/assets/_shell.threads-HH4EvufJ.js +0 -1
  330. package/dist/client/assets/_shell.x._extensionId-3ZlJV1iu.js +0 -1
  331. package/dist/client/assets/_shell.x._extensionId_._-3ZlJV1iu.js +0 -1
  332. package/dist/client/assets/card-DUmTNXJJ.js +0 -1
  333. package/dist/client/assets/channel-B7zgJbnU.js +0 -1
  334. package/dist/client/assets/form-D93N5lrK.js +0 -1
  335. package/dist/client/assets/image-lightbox-vgPEvSCc.js +0 -1
  336. package/dist/client/assets/index-B446r3dL.js +0 -1
  337. package/dist/client/assets/index-BGo1YiUE.js +0 -1
  338. package/dist/client/assets/index-BO3yPJt-.js +0 -1
  339. package/dist/client/assets/index-DE6uOpn4.js +0 -1
  340. package/dist/client/assets/index-Dag1qeZI.js +0 -1
  341. package/dist/client/assets/index-Dm0Tav7v.js +0 -1
  342. package/dist/client/assets/index-Dry_agqN.css +0 -1
  343. package/dist/client/assets/index-OQuvRZTD.js +0 -1058
  344. package/dist/client/assets/index-eVrGefuq.js +0 -1
  345. package/dist/client/assets/mention-pill-BsOeTJ2f.js +0 -1
  346. package/dist/client/assets/path-input-C2KIXdON.js +0 -1
  347. package/dist/client/assets/primer-trigger-B2tjuHBx.js +0 -3
  348. package/dist/client/assets/registry-BzXBOE9h.js +0 -34
  349. package/dist/client/assets/registry-sfhDu9q2.js +0 -1
  350. package/dist/client/assets/scroll-area-FwZwM74Q.js +0 -1
  351. package/dist/client/assets/search-x-Q18Wm-C5.js +0 -6
  352. package/dist/client/assets/signed-in-DEOMBWVX.js +0 -1
  353. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-D8kHFWtL.js +0 -8
  354. package/dist/client/assets/use-full-activity-feed-CtQquOBW.js +0 -1
  355. package/dist/client/assets/use-is-below-desktop-CAGEAsCC.js +0 -1
  356. package/dist/client/assets/use-pending-read-D0y6i7G9.js +0 -1
  357. package/dist/client/assets/use-personality-commit-C3h8upDo.js +0 -1
  358. package/dist/client/assets/use-status-budget-Xn2sIeM1.js +0 -16
  359. package/dist/client/assets/use-update-config-L5NCTj3t.js +0 -1
@@ -1 +1 @@
1
- import{j as s,hp as A,hq as P,G as k,go as J,a1 as E,a2 as q,gM as R,r as N,a3 as Z,a4 as ee,aG as se,b8 as te,B as x,hU as v,bx as U,by as W,C as L,bz as M,bB as B,U as ne,gO as g,hV as w,gU as D,gV as _,e as C,b6 as ae,hW as ie,hX as le,hY as re}from"./index-OQuvRZTD.js";import{u as y,c as oe,a as p,l as H,S as f,P as b,s as z,d as T,r as j,f as $,b as K,e as S,g as de,A as ce}from"./ApplyToOverridesDialog-C_QQhNIf.js";const I=[{value:"blocked",label:"Blocked"},{value:"ask",label:"Ask"},{value:"allowed",label:"Allowed"}];function Q({value:e,onChange:t,floor:n=!1,disabled:a=!1,className:l,"aria-label":o}){const d=n?I.filter(i=>i.value!=="allowed"):I;return s.jsx(A,{"aria-label":o,value:e??"",onValueChange:i=>t(i),disabled:a,className:k("w-full md:w-auto",l),children:d.map(i=>s.jsx(P,{value:i.value,className:k(J,"md:min-h-0 md:min-w-16"),children:i.label},i.value))})}function ue(e){const t=E();return q({queryKey:R.agent(e??""),queryFn:()=>t.getAgentPermissions(e),enabled:!!e})}function me(e){const{data:t}=y();return N.useMemo(()=>{const n=new Map;for(const a of(t==null?void 0:t.exceptions)??[]){if(a.area!==e)continue;const l=n.get(a.agentId);(!l||l.action&&!a.action)&&n.set(a.agentId,a)}return[...n.values()]},[t,e])}function he(e){const t=E();return q({queryKey:R.history(e),queryFn:()=>t.getPermissionHistory(e?{agentId:e,limit:50}:{limit:50})})}function xe(e){var n;const t=e;return(t==null?void 0:t.code)!=="UNDO_CONFLICT"?null:((n=t.body)==null?void 0:n.conflicts)??[]}function fe(){const e=E(),t=Z();return ee({mutationFn:({eventId:n,force:a})=>e.undoPermissionChange(n,a?{force:!0}:{}),meta:{suppressErrorToast:!0},onSettled:()=>{t.invalidateQueries({queryKey:R.all}),t.invalidateQueries({queryKey:["mesh","agents"]}),t.invalidateQueries({queryKey:se.all})}})}function F(e){const{data:t}=y();return t?oe(t,e):void 0}function V({areaId:e,label:t,description:n,floor:a,value:l,sourceText:o,why:d,changed:i=!1,onChange:m,onReset:r,disabled:u=!1,footer:c,details:h}){return s.jsxs("div",{className:"@container","data-testid":`permission-row-${e}`,children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[i?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:t}),a?s.jsx(te,{className:"text-muted-foreground size-3.5","aria-label":"Never Allowed"}):null]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:n}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:o}),d?s.jsxs(s.Fragment,{children:[o?" · ":null,d]}):null]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(Q,{value:l,onChange:m,floor:a,disabled:u,"aria-label":t}),i&&r?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:r,disabled:u,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null,c]})]}),h]})}function ge({area:e,exception:t}){const n=p({kind:"agent",agentId:t.agentId}),a=()=>n.mutate({kind:"patch",...t.action?{actions:{[t.action]:null}}:{areas:{[e]:null}},surface:"settings"}),l=H(t.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[t.agentName,": ",f[t.state],t.action?" (one action)":""]}),l?s.jsx("span",{className:"text-muted-foreground block text-xs",children:l}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",onClick:a,disabled:n.isPending,"aria-label":`Reset ${t.agentName} to the default`,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function pe({area:e,areaLabel:t,agents:n}){if(n.length===0)return null;const a=n.length===1?"1 agent differs":`${n.length} agents differ`;return s.jsxs(U,{children:[s.jsx(W,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start md:self-end",children:[a,s.jsx(L,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(M,{className:"w-80 space-y-2",children:[s.jsxs(B,{className:"text-sm font-medium",children:["Set differently for ",t]}),s.jsx("ul",{className:"space-y-1",children:n.map(l=>s.jsx(ge,{area:e,exception:l},l.agentId))})]})]})}function G(e,t){return e.resolved.source===(t.kind==="agent"?"agent-action":"default-action")}function X({action:e,preset:t,agentName:n}){const a=f[e.resolved.state];return s.jsx(b,{question:`Why is ${e.title} set to ${a}${n?` for ${n}`:""}?`,sentence:z({...e.resolved,preset:t,fromExtension:e.source!==void 0}),...e.lastChange?{lastChange:e.lastChange}:{}})}function je({action:e,area:t,scope:n,preset:a,agentName:l,disabled:o,reset:d,onSave:i}){const m=G(e,n),r=F({kind:"action",action:e.id,area:t.id}),u=m?"Set on its own":e.alwaysAsks?e.source?"Always asks: an extension tool that can delete things":"Always asks, so you see the change first":e.resolved.destructiveAsk?"Always asks unless you set it here":`Follows ${t.label}`,c=n.kind==="default"&&r!==void 0?T(r):null;return s.jsxs("li",{className:"flex flex-col gap-2 py-2 @md:flex-row @md:items-center @md:justify-between","data-testid":`permission-action-${e.id}`,children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm",children:e.title}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.source?s.jsxs("span",{children:["From ",e.source.name," · "]}):null,s.jsx("span",{children:u}),c?s.jsxs("span",{children:[" · ",c]}):null," ·"," ",s.jsx(X,{action:e,preset:a,...l?{agentName:l}:{}})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[m?d:null,s.jsx(Q,{value:e.resolved.state,floor:t.floor||e.alwaysAsks===!0,disabled:o,"aria-label":e.title,onChange:h=>{h!==e.resolved.state&&i(h)}})]})]})}function Y({scope:e,area:t,surface:n,preset:a,agentName:l}){const o=p(e),[d,i]=N.useState(!1);if(t.actions.length===0)return null;const m=t.actions.filter(c=>G(c,e)),r=(c,h)=>o.mutate({kind:"patch",actions:{[c.id]:h},surface:n},{onError:j}),u=c=>s.jsxs(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:o.isPending,"aria-label":`Put ${c.title} back to ${t.label}`,onClick:()=>r(c,null),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]});return s.jsxs("div",{className:"flex flex-col items-start gap-1 pb-3","data-testid":`permission-actions-${t.id}`,children:[!d&&m.length>0?s.jsx("ul",{className:"w-full space-y-1","data-testid":`permission-action-exceptions-${t.id}`,children:m.map(c=>s.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[s.jsxs("span",{className:"text-muted-foreground min-w-0",children:[s.jsxs("span",{children:["Except ",c.title,": ",f[c.resolved.state]]})," ","·"," ",s.jsx(X,{action:c,preset:a,...l?{agentName:l}:{}})]}),u(c)]},c.id))}):null,s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground -ml-2 h-7 px-2 text-xs","aria-expanded":d,onClick:()=>i(c=>!c),children:[s.jsx(ne,{className:k("size-3.5 transition-transform",d&&"rotate-180"),"aria-hidden":!0}),d?"Hide individual actions":"Show individual actions"]}),d?s.jsx("ul",{className:"divide-border w-full divide-y","aria-label":`${t.label} actions`,children:t.actions.map(c=>s.jsx(je,{action:c,area:t,scope:e,preset:a,...l?{agentName:l}:{},disabled:o.isPending,reset:u(c),onSave:h=>r(c,h)},c.id))}):null]})}function Ne({agentId:e,agentName:t,files:n}){const a=p({kind:"agent",agentId:e}),l=n.source==="agent",o=n.inherited.stop,d=n.stop,i=r=>a.mutate({kind:"patch",filesAndCommands:r,surface:"agent-page"},{onError:j}),m=o?`${l?`Everyone else: ${g(o)}`:`Same as everyone (${g(o)})`}${n.inherited.source==="runtime"?` · ${$("runtime")}`:""}`:$(n.inherited.source);return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[l?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"})]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands in this agent’s chats"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:m})," ·"," ",s.jsx(b,{question:`Why is Files & commands ${d?`set to ${g(d)}`:"not set"} for ${t}?`,sentence:K(d,n.source),...n.lastChange?{lastChange:n.lastChange}:{}})]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:d??"",disabled:a.isPending,onValueChange:r=>{r&&r!==d&&i(r)},children:w.map(r=>s.jsxs(P,{value:r.id,"aria-label":r.label,children:[s.jsx(D,{descriptor:r,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:r.label})]},r.id))}),l?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:()=>i(null),disabled:a.isPending,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null]})]}),s.jsx(_,{descriptor:w.find(r=>r.stop===d),className:"pb-3"})]})}function Re({files:e,preset:t,onChange:n,disabled:a=!1,runtimeLabel:l=o=>o}){const o=F({kind:"files"}),d=e.stop===null?$("runtime-own"):e.stop===e.presetStop?`From ${S[t??"trusted"]}`:"Changed from your preset";return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:[d,o!==void 0?T(o):""].filter(Boolean).join(" · ")})," ","·"," ",s.jsx(b,{question:`Why is Files & commands ${e.stop?`set to ${g(e.stop)}`:"not set"}?`,sentence:K(e.stop,e.stop===null?"runtime-own":"default"),...e.lastChange?{lastChange:e.lastChange}:{}})]}),e.runtimes.map(i=>s.jsxs("p",{className:"text-muted-foreground text-xs",children:[l(i.runtime)," starts at ",g(i.stop)," (Settings → Runtimes)"]},i.runtime))]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:e.stop??"",disabled:a,onValueChange:i=>{i&&i!==e.stop&&n(i)},children:w.map(i=>s.jsxs(P,{value:i.id,"aria-label":i.label,children:[s.jsx(D,{descriptor:i,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:i.label})]},i.id))}),s.jsx(be,{agents:e.exceptions})]})]}),s.jsx(_,{descriptor:w.find(i=>i.stop===e.stop),className:"pb-3"})]})}function ve({agent:e}){const t=p({kind:"agent",agentId:e.agentId}),n=H(e.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[e.agentName,": ",g(e.stop)]}),n?s.jsx("span",{className:"text-muted-foreground block text-xs",children:n}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",disabled:t.isPending,"aria-label":`Reset ${e.agentName} to the default`,onClick:()=>t.mutate({kind:"patch",filesAndCommands:null,surface:"settings"},{onError:j}),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function be({agents:e}){return e.length===0?null:s.jsxs(U,{children:[s.jsx(W,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start @lg:self-end",children:[e.length===1?"1 agent differs":`${e.length} agents differ`,s.jsx(L,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(M,{className:"w-80 space-y-2",children:[s.jsx(B,{className:"text-sm font-medium",children:"Set differently for Files & commands"}),s.jsx("ul",{className:"space-y-1",children:e.map(t=>s.jsx(ve,{agent:t},t.agentId))})]})]})}function O(e){return e.filter(t=>t.kind==="state")}function we({area:e,overview:t}){const n=p({kind:"default"}),a=me(e.id),l=F({kind:"area",area:e.id})??0,[o,d]=N.useState(null),i=(r,u)=>{n.mutate({kind:"patch",areas:{[e.id]:r},...u&&u.length>0?{applyToAgents:u}:{},surface:"settings"},{onError:j,onSettled:()=>d(null)})},m=r=>{r!==e.resolved.state&&(a.length>0?d(r):i(r))};return s.jsxs(s.Fragment,{children:[s.jsx(V,{areaId:e.id,label:e.label,description:e.description,floor:e.floor,value:e.resolved.state,sourceText:[de(e.resolved.source,t.preset),T(l)].filter(Boolean).join(" · "),why:s.jsx(b,{question:`Why is ${e.label} set to ${f[e.resolved.state]}?`,sentence:z({...e.resolved,preset:t.preset}),...e.lastChange?{lastChange:e.lastChange}:{}}),onChange:m,disabled:n.isPending,footer:s.jsx(pe,{area:e.id,areaLabel:e.label,agents:a}),details:s.jsx(Y,{scope:{kind:"default"},area:e,surface:"settings",preset:t.preset})}),s.jsx(ce,{open:o!==null,onCancel:()=>d(null),subject:e.label,next:o??"ask",agents:a.map(r=>({agentId:r.agentId,agentName:r.agentName,detail:`${f[r.state]}${r.action?" (one action)":""}`})),affectedCount:l,onKeep:()=>o&&i(o),onUpdate:r=>o&&i(o,r),pending:n.isPending})]})}function ye({agentId:e,agentName:t,area:n}){var r;const a=((r=y().data)==null?void 0:r.preset)??null,l=p({kind:"agent",agentId:e}),o=n.resolved.source==="agent-area"||n.resolved.source==="agent-action",d=o?`Everyone else: ${f[n.inherited.state]}`:`Same as everyone (${f[n.inherited.state]})`,i=n.changedOutsideAt?`Changed outside DorkOS · ${d}`:d,m=u=>l.mutate({kind:"patch",areas:{[n.id]:u},surface:"agent-page"},{onError:j});return s.jsx(V,{areaId:n.id,label:n.label,description:n.description,floor:n.floor,value:n.resolved.state,sourceText:i,why:s.jsx(b,{question:`Why is ${n.label} set to ${f[n.resolved.state]} for ${t}?`,sentence:z({...n.resolved,preset:a}),...n.lastChange?{lastChange:n.lastChange}:{}}),changed:o,onChange:u=>{u!==n.resolved.state&&m(u)},onReset:()=>m(null),disabled:l.isPending,details:s.jsx(Y,{scope:{kind:"agent",agentId:e},area:n,surface:"agent-page",preset:a,agentName:t})})}function ze({scope:e}){const t=y(),n=ue(e.kind==="agent"?e.agentId:void 0);return e.kind==="default"?t.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the permissions."}):t.data?s.jsx("div",{className:"divide-border divide-y","data-testid":"permission-list-default",children:O(t.data.areas).map(a=>s.jsx(we,{area:a,overview:t.data},a.id))}):s.jsx(C,{className:"h-20 w-full"}):n.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s permissions."}):n.data?s.jsxs("div",{className:"divide-border divide-y","data-testid":"permission-list-agent",children:[s.jsx(Ne,{agentId:e.agentId,agentName:n.data.agentName,files:n.data.filesAndCommands}),O(n.data.areas).map(a=>s.jsx(ye,{agentId:e.agentId,agentName:n.data.agentName,area:a},a.id))]}):s.jsx(C,{className:"h-20 w-full"})}function ke(e,t){if(t.key.kind==="chat")return ie(e);if(t.key.kind==="account")return le(e);if(e===null)return t.target.kind==="agent"?"the default":"the preset";switch(t.key.kind){case"files":return Ce(e)?g(e):e;case"preset":return e in S?S[e]:e;default:return e in f?f[e]:e}}function Ce(e){return re.includes(e)}function $e(e){if(e.length===1){const{change:t}=e[0];return`This has changed since. Set it back to ${ke(t.before,t)} anyway?`}return"Some of this has changed since. Set it all back anyway?"}function Se(e){if(e.suggestionRestored)return null;if(e.changes.length===0&&e.skipped.length===0)return"Nothing to undo. It was already back.";if(e.skipped.length===0)return null;const t=e.changes.length,n=`Undid ${t} ${t===1?"change":"changes"}.`,a=e.skipped.filter(i=>i.reason==="changed-since").length,l=e.skipped.filter(i=>i.reason==="floor").length,o=e.skipped.filter(i=>i.reason==="gone").length,d=[];if(a>0&&d.push(`${a} had changed since and ${a===1?"was":"were"} left alone.`),l>0&&d.push(`${l} can’t be set to Allowed and ${l===1?"was":"were"} left alone.`),o>0&&d.push(`${o} ${o===1?"was about an agent":"were about agents"} no longer here.`),d.length>1){const i=e.skipped.length;return`${n} ${i} ${i===1?"was":"were"} left alone.`}return[n,...d].join(" ")}function Ae({item:e}){const t=fe(),[n,a]=N.useState(null),[l,o]=N.useState(null),d=e.undone,i=e.undoable&&!d,m=ae(e.occurredAt),r=u=>t.mutate({eventId:e.id,...u?{force:!0}:{}},{onSuccess:c=>{a(null),o(Se(c))},onError:c=>{const h=xe(c);h?a(h):j(c)}});return s.jsxs("li",{className:"space-y-1","data-testid":"permission-history-row",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[s.jsx("p",{className:"text-sm",children:e.summary}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.actorLabel," · ",m]}),e.actorDetail?s.jsx("p",{className:"text-muted-foreground text-xs",children:e.actorDetail}):null]}),d?s.jsx("span",{className:"text-muted-foreground shrink-0 pt-0.5 text-xs",children:"Undone"}):i&&n===null?s.jsx(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:t.isPending,"aria-label":`Undo: ${e.summary}, ${m}`,onClick:()=>r(!1),children:"Undo"}):null]}),n!==null?s.jsxs("div",{role:"group","aria-label":"Undo conflict",className:"bg-muted/50 flex flex-col gap-2 rounded-md p-2 @md:flex-row @md:items-center @md:justify-between",children:[s.jsx("p",{className:"text-sm",children:$e(n)}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(x,{variant:"outline",size:"sm",disabled:t.isPending,onClick:()=>a(null),children:"Cancel"}),s.jsx(x,{size:"sm",disabled:t.isPending,onClick:()=>r(!0),children:"Set it back"})]})]}):null,l?s.jsx("p",{className:"text-muted-foreground text-xs",role:"status",children:l}):null]})}function Te({agentId:e}){const{data:t,isPending:n,isError:a}=he(e);if(a)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the history."});if(n)return s.jsx(C,{className:"h-12 w-full"});const l=(t==null?void 0:t.items)??[];return l.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No permission changes yet."}):s.jsx("ul",{className:"@container space-y-3","aria-label":"Permission history",children:l.map(o=>s.jsx(Ae,{item:o},o.id))})}export{Re as D,ze as P,Te as a};
1
+ import{j as s,hp as A,hq as P,G as k,gn as Y,a5 as E,a6 as q,gM as R,r as N,a7 as Z,a8 as ee,aJ as se,bb as te,B as x,hU as v,by as U,bz as W,C as L,bA as M,bC as D,U as ne,gO as g,hV as w,gU as _,gV as B,e as C,b9 as ae,hW as ie,hX as le,hY as re}from"./index-YUtEyz7O.js";import{u as y,c as oe,a as p,l as H,S as f,P as b,s as z,d as T,r as j,f as $,b as K,e as S,g as de,A as ce}from"./ApplyToOverridesDialog-DRtcLrVY.js";const I=[{value:"blocked",label:"Blocked"},{value:"ask",label:"Ask"},{value:"allowed",label:"Allowed"}];function Q({value:e,onChange:t,floor:n=!1,disabled:a=!1,className:l,"aria-label":o}){const d=n?I.filter(i=>i.value!=="allowed"):I;return s.jsx(A,{"aria-label":o,value:e??"",onValueChange:i=>t(i),disabled:a,className:k("w-full md:w-auto",l),children:d.map(i=>s.jsx(P,{value:i.value,className:k(Y,"md:min-h-0 md:min-w-16"),children:i.label},i.value))})}function ue(e){const t=E();return q({queryKey:R.agent(e??""),queryFn:()=>t.getAgentPermissions(e),enabled:!!e})}function me(e){const{data:t}=y();return N.useMemo(()=>{const n=new Map;for(const a of(t==null?void 0:t.exceptions)??[]){if(a.area!==e)continue;const l=n.get(a.agentId);(!l||l.action&&!a.action)&&n.set(a.agentId,a)}return[...n.values()]},[t,e])}function he(e){const t=E();return q({queryKey:R.history(e),queryFn:()=>t.getPermissionHistory(e?{agentId:e,limit:50}:{limit:50})})}function xe(e){var n;const t=e;return(t==null?void 0:t.code)!=="UNDO_CONFLICT"?null:((n=t.body)==null?void 0:n.conflicts)??[]}function fe(){const e=E(),t=Z();return ee({mutationFn:({eventId:n,force:a})=>e.undoPermissionChange(n,a?{force:!0}:{}),meta:{suppressErrorToast:!0},onSettled:()=>{t.invalidateQueries({queryKey:R.all}),t.invalidateQueries({queryKey:["mesh","agents"]}),t.invalidateQueries({queryKey:se.all})}})}function F(e){const{data:t}=y();return t?oe(t,e):void 0}function V({areaId:e,label:t,description:n,floor:a,value:l,sourceText:o,why:d,changed:i=!1,onChange:m,onReset:r,disabled:u=!1,footer:c,details:h}){return s.jsxs("div",{className:"@container","data-testid":`permission-row-${e}`,children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[i?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:t}),a?s.jsx(te,{className:"text-muted-foreground size-3.5","aria-label":"Never Allowed"}):null]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:n}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:o}),d?s.jsxs(s.Fragment,{children:[o?" · ":null,d]}):null]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(Q,{value:l,onChange:m,floor:a,disabled:u,"aria-label":t}),i&&r?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:r,disabled:u,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null,c]})]}),h]})}function ge({area:e,exception:t}){const n=p({kind:"agent",agentId:t.agentId}),a=()=>n.mutate({kind:"patch",...t.action?{actions:{[t.action]:null}}:{areas:{[e]:null}},surface:"settings"}),l=H(t.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[t.agentName,": ",f[t.state],t.action?" (one action)":""]}),l?s.jsx("span",{className:"text-muted-foreground block text-xs",children:l}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",onClick:a,disabled:n.isPending,"aria-label":`Reset ${t.agentName} to the default`,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function pe({area:e,areaLabel:t,agents:n}){if(n.length===0)return null;const a=n.length===1?"1 agent differs":`${n.length} agents differ`;return s.jsxs(U,{children:[s.jsx(W,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start md:self-end",children:[a,s.jsx(L,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(M,{className:"w-80 space-y-2",children:[s.jsxs(D,{className:"text-sm font-medium",children:["Set differently for ",t]}),s.jsx("ul",{className:"space-y-1",children:n.map(l=>s.jsx(ge,{area:e,exception:l},l.agentId))})]})]})}function G(e,t){return e.resolved.source===(t.kind==="agent"?"agent-action":"default-action")}function J({action:e,preset:t,agentName:n}){const a=f[e.resolved.state];return s.jsx(b,{question:`Why is ${e.title} set to ${a}${n?` for ${n}`:""}?`,sentence:z({...e.resolved,preset:t,fromExtension:e.source!==void 0}),...e.lastChange?{lastChange:e.lastChange}:{}})}function je({action:e,area:t,scope:n,preset:a,agentName:l,disabled:o,reset:d,onSave:i}){const m=G(e,n),r=F({kind:"action",action:e.id,area:t.id}),u=m?"Set on its own":e.alwaysAsks?e.source?"Always asks: an extension tool that can delete things":"Always asks, so you see the change first":e.resolved.destructiveAsk?"Always asks unless you set it here":`Follows ${t.label}`,c=n.kind==="default"&&r!==void 0?T(r):null;return s.jsxs("li",{className:"flex flex-col gap-2 py-2 @md:flex-row @md:items-center @md:justify-between","data-testid":`permission-action-${e.id}`,children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm",children:e.title}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.source?s.jsxs("span",{children:["From ",e.source.name," · "]}):null,s.jsx("span",{children:u}),c?s.jsxs("span",{children:[" · ",c]}):null," ·"," ",s.jsx(J,{action:e,preset:a,...l?{agentName:l}:{}})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[m?d:null,s.jsx(Q,{value:e.resolved.state,floor:t.floor||e.alwaysAsks===!0,disabled:o,"aria-label":e.title,onChange:h=>{h!==e.resolved.state&&i(h)}})]})]})}function X({scope:e,area:t,surface:n,preset:a,agentName:l}){const o=p(e),[d,i]=N.useState(!1);if(t.actions.length===0)return null;const m=t.actions.filter(c=>G(c,e)),r=(c,h)=>o.mutate({kind:"patch",actions:{[c.id]:h},surface:n},{onError:j}),u=c=>s.jsxs(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:o.isPending,"aria-label":`Put ${c.title} back to ${t.label}`,onClick:()=>r(c,null),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]});return s.jsxs("div",{className:"flex flex-col items-start gap-1 pb-3","data-testid":`permission-actions-${t.id}`,children:[!d&&m.length>0?s.jsx("ul",{className:"w-full space-y-1","data-testid":`permission-action-exceptions-${t.id}`,children:m.map(c=>s.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[s.jsxs("span",{className:"text-muted-foreground min-w-0",children:[s.jsxs("span",{children:["Except ",c.title,": ",f[c.resolved.state]]})," ","·"," ",s.jsx(J,{action:c,preset:a,...l?{agentName:l}:{}})]}),u(c)]},c.id))}):null,s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground -ml-2 h-7 px-2 text-xs","aria-expanded":d,onClick:()=>i(c=>!c),children:[s.jsx(ne,{className:k("size-3.5 transition-transform",d&&"rotate-180"),"aria-hidden":!0}),d?"Hide individual actions":"Show individual actions"]}),d?s.jsx("ul",{className:"divide-border w-full divide-y","aria-label":`${t.label} actions`,children:t.actions.map(c=>s.jsx(je,{action:c,area:t,scope:e,preset:a,...l?{agentName:l}:{},disabled:o.isPending,reset:u(c),onSave:h=>r(c,h)},c.id))}):null]})}function Ne({agentId:e,agentName:t,files:n}){const a=p({kind:"agent",agentId:e}),l=n.source==="agent",o=n.inherited.stop,d=n.stop,i=r=>a.mutate({kind:"patch",filesAndCommands:r,surface:"agent-page"},{onError:j}),m=o?`${l?`Everyone else: ${g(o)}`:`Same as everyone (${g(o)})`}${n.inherited.source==="runtime"?` · ${$("runtime")}`:""}`:$(n.inherited.source);return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[l?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"})]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands in this agent’s chats"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:m})," ·"," ",s.jsx(b,{question:`Why is Files & commands ${d?`set to ${g(d)}`:"not set"} for ${t}?`,sentence:K(d,n.source),...n.lastChange?{lastChange:n.lastChange}:{}})]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:d??"",disabled:a.isPending,onValueChange:r=>{r&&r!==d&&i(r)},children:w.map(r=>s.jsxs(P,{value:r.id,"aria-label":r.label,children:[s.jsx(_,{descriptor:r,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:r.label})]},r.id))}),l?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:()=>i(null),disabled:a.isPending,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null]})]}),s.jsx(B,{descriptor:w.find(r=>r.stop===d),className:"pb-3"})]})}function Re({files:e,preset:t,onChange:n,disabled:a=!1,runtimeLabel:l=o=>o}){const o=F({kind:"files"}),d=e.stop===null?$("runtime-own"):e.stop===e.presetStop?`From ${S[t??"trusted"]}`:"Changed from your preset";return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:[d,o!==void 0?T(o):""].filter(Boolean).join(" · ")})," ","·"," ",s.jsx(b,{question:`Why is Files & commands ${e.stop?`set to ${g(e.stop)}`:"not set"}?`,sentence:K(e.stop,e.stop===null?"runtime-own":"default"),...e.lastChange?{lastChange:e.lastChange}:{}})]}),e.runtimes.map(i=>s.jsxs("p",{className:"text-muted-foreground text-xs",children:[l(i.runtime)," starts at ",g(i.stop)," (Settings → Runtimes)"]},i.runtime))]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:e.stop??"",disabled:a,onValueChange:i=>{i&&i!==e.stop&&n(i)},children:w.map(i=>s.jsxs(P,{value:i.id,"aria-label":i.label,children:[s.jsx(_,{descriptor:i,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:i.label})]},i.id))}),s.jsx(be,{agents:e.exceptions})]})]}),s.jsx(B,{descriptor:w.find(i=>i.stop===e.stop),className:"pb-3"})]})}function ve({agent:e}){const t=p({kind:"agent",agentId:e.agentId}),n=H(e.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[e.agentName,": ",g(e.stop)]}),n?s.jsx("span",{className:"text-muted-foreground block text-xs",children:n}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",disabled:t.isPending,"aria-label":`Reset ${e.agentName} to the default`,onClick:()=>t.mutate({kind:"patch",filesAndCommands:null,surface:"settings"},{onError:j}),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function be({agents:e}){return e.length===0?null:s.jsxs(U,{children:[s.jsx(W,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start @lg:self-end",children:[e.length===1?"1 agent differs":`${e.length} agents differ`,s.jsx(L,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(M,{className:"w-80 space-y-2",children:[s.jsx(D,{className:"text-sm font-medium",children:"Set differently for Files & commands"}),s.jsx("ul",{className:"space-y-1",children:e.map(t=>s.jsx(ve,{agent:t},t.agentId))})]})]})}function O(e){return e.filter(t=>t.kind==="state")}function we({area:e,overview:t}){const n=p({kind:"default"}),a=me(e.id),l=F({kind:"area",area:e.id})??0,[o,d]=N.useState(null),i=(r,u)=>{n.mutate({kind:"patch",areas:{[e.id]:r},...u&&u.length>0?{applyToAgents:u}:{},surface:"settings"},{onError:j,onSettled:()=>d(null)})},m=r=>{r!==e.resolved.state&&(a.length>0?d(r):i(r))};return s.jsxs(s.Fragment,{children:[s.jsx(V,{areaId:e.id,label:e.label,description:e.description,floor:e.floor,value:e.resolved.state,sourceText:[de(e.resolved.source,t.preset),T(l)].filter(Boolean).join(" · "),why:s.jsx(b,{question:`Why is ${e.label} set to ${f[e.resolved.state]}?`,sentence:z({...e.resolved,preset:t.preset}),...e.lastChange?{lastChange:e.lastChange}:{}}),onChange:m,disabled:n.isPending,footer:s.jsx(pe,{area:e.id,areaLabel:e.label,agents:a}),details:s.jsx(X,{scope:{kind:"default"},area:e,surface:"settings",preset:t.preset})}),s.jsx(ce,{open:o!==null,onCancel:()=>d(null),subject:e.label,next:o??"ask",agents:a.map(r=>({agentId:r.agentId,agentName:r.agentName,detail:`${f[r.state]}${r.action?" (one action)":""}`})),affectedCount:l,onKeep:()=>o&&i(o),onUpdate:r=>o&&i(o,r),pending:n.isPending})]})}function ye({agentId:e,agentName:t,area:n}){var r;const a=((r=y().data)==null?void 0:r.preset)??null,l=p({kind:"agent",agentId:e}),o=n.resolved.source==="agent-area"||n.resolved.source==="agent-action",d=o?`Everyone else: ${f[n.inherited.state]}`:`Same as everyone (${f[n.inherited.state]})`,i=n.changedOutsideAt?`Changed outside DorkOS · ${d}`:d,m=u=>l.mutate({kind:"patch",areas:{[n.id]:u},surface:"agent-page"},{onError:j});return s.jsx(V,{areaId:n.id,label:n.label,description:n.description,floor:n.floor,value:n.resolved.state,sourceText:i,why:s.jsx(b,{question:`Why is ${n.label} set to ${f[n.resolved.state]} for ${t}?`,sentence:z({...n.resolved,preset:a}),...n.lastChange?{lastChange:n.lastChange}:{}}),changed:o,onChange:u=>{u!==n.resolved.state&&m(u)},onReset:()=>m(null),disabled:l.isPending,details:s.jsx(X,{scope:{kind:"agent",agentId:e},area:n,surface:"agent-page",preset:a,agentName:t})})}function ze({scope:e}){const t=y(),n=ue(e.kind==="agent"?e.agentId:void 0);return e.kind==="default"?t.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the permissions."}):t.data?s.jsx("div",{className:"divide-border divide-y","data-testid":"permission-list-default",children:O(t.data.areas).map(a=>s.jsx(we,{area:a,overview:t.data},a.id))}):s.jsx(C,{className:"h-20 w-full"}):n.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s permissions."}):n.data?s.jsxs("div",{className:"divide-border divide-y","data-testid":"permission-list-agent",children:[s.jsx(Ne,{agentId:e.agentId,agentName:n.data.agentName,files:n.data.filesAndCommands}),O(n.data.areas).map(a=>s.jsx(ye,{agentId:e.agentId,agentName:n.data.agentName,area:a},a.id))]}):s.jsx(C,{className:"h-20 w-full"})}function ke(e,t){if(t.key.kind==="chat")return ie(e);if(t.key.kind==="account")return le(e);if(e===null)return t.target.kind==="agent"?"the default":"the preset";switch(t.key.kind){case"files":return Ce(e)?g(e):e;case"preset":return e in S?S[e]:e;default:return e in f?f[e]:e}}function Ce(e){return re.includes(e)}function $e(e){if(e.length===1){const{change:t}=e[0];return`This has changed since. Set it back to ${ke(t.before,t)} anyway?`}return"Some of this has changed since. Set it all back anyway?"}function Se(e){if(e.suggestionRestored)return null;if(e.changes.length===0&&e.skipped.length===0)return"Nothing to undo. It was already back.";if(e.skipped.length===0)return null;const t=e.changes.length,n=`Undid ${t} ${t===1?"change":"changes"}.`,a=e.skipped.filter(i=>i.reason==="changed-since").length,l=e.skipped.filter(i=>i.reason==="floor").length,o=e.skipped.filter(i=>i.reason==="gone").length,d=[];if(a>0&&d.push(`${a} had changed since and ${a===1?"was":"were"} left alone.`),l>0&&d.push(`${l} can’t be set to Allowed and ${l===1?"was":"were"} left alone.`),o>0&&d.push(`${o} ${o===1?"was about an agent":"were about agents"} no longer here.`),d.length>1){const i=e.skipped.length;return`${n} ${i} ${i===1?"was":"were"} left alone.`}return[n,...d].join(" ")}function Ae({item:e}){const t=fe(),[n,a]=N.useState(null),[l,o]=N.useState(null),d=e.undone,i=e.undoable&&!d,m=ae(e.occurredAt),r=u=>t.mutate({eventId:e.id,...u?{force:!0}:{}},{onSuccess:c=>{a(null),o(Se(c))},onError:c=>{const h=xe(c);h?a(h):j(c)}});return s.jsxs("li",{className:"space-y-1","data-testid":"permission-history-row",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[s.jsx("p",{className:"text-sm",children:e.summary}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.actorLabel," · ",m]}),e.actorDetail?s.jsx("p",{className:"text-muted-foreground text-xs",children:e.actorDetail}):null]}),d?s.jsx("span",{className:"text-muted-foreground shrink-0 pt-0.5 text-xs",children:"Undone"}):i&&n===null?s.jsx(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:t.isPending,"aria-label":`Undo: ${e.summary}, ${m}`,onClick:()=>r(!1),children:"Undo"}):null]}),n!==null?s.jsxs("div",{role:"group","aria-label":"Undo conflict",className:"bg-muted/50 flex flex-col gap-2 rounded-md p-2 @md:flex-row @md:items-center @md:justify-between",children:[s.jsx("p",{className:"text-sm",children:$e(n)}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(x,{variant:"outline",size:"sm",disabled:t.isPending,onClick:()=>a(null),children:"Cancel"}),s.jsx(x,{size:"sm",disabled:t.isPending,onClick:()=>r(!0),children:"Set it back"})]})]}):null,l?s.jsx("p",{className:"text-muted-foreground text-xs",role:"status",children:l}):null]})}function Te({agentId:e}){const{data:t,isPending:n,isError:a}=he(e);if(a)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the history."});if(n)return s.jsx(C,{className:"h-12 w-full"});const l=(t==null?void 0:t.items)??[];return l.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No permission changes yet."}):s.jsx("ul",{className:"@container space-y-3","aria-label":"Permission history",children:l.map(o=>s.jsx(Ae,{item:o},o.id))})}export{Re as D,ze as P,Te as a};
@@ -1 +1 @@
1
- import{y as i,j as s}from"./index-OQuvRZTD.js";import{P as a,a as m}from"./PermissionHistory-DPEPq8D9.js";import{R as n}from"./ApplyToOverridesDialog-C_QQhNIf.js";function l({member:t}){var o;const e=i((o=t.agent)==null?void 0:o.runtime),r=(e==null?void 0:e.supportsMcp)??!0;return s.jsxs("div",{className:"space-y-6",children:[r?null:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent can’t use DorkOS tools, so these don’t apply."}),s.jsx(a,{scope:{kind:"agent",agentId:t.id}}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:[n[0]," ",n[1]]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"History"}),s.jsx(m,{agentId:t.id})]})]})}export{l as PermissionsPage};
1
+ import{y as i,j as s}from"./index-YUtEyz7O.js";import{P as a,a as m}from"./PermissionHistory-D_Imuq02.js";import{R as n}from"./ApplyToOverridesDialog-DRtcLrVY.js";function l({member:t}){var o;const e=i((o=t.agent)==null?void 0:o.runtime),r=(e==null?void 0:e.supportsMcp)??!0;return s.jsxs("div",{className:"space-y-6",children:[r?null:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent can’t use DorkOS tools, so these don’t apply."}),s.jsx(a,{scope:{kind:"agent",agentId:t.id}}),s.jsxs("p",{className:"text-muted-foreground text-sm",children:[n[0]," ",n[1]]}),s.jsxs("section",{className:"space-y-2",children:[s.jsx("h3",{className:"text-sm font-semibold",children:"History"}),s.jsx(m,{agentId:t.id})]})]})}export{l as PermissionsPage};
@@ -1 +1 @@
1
- import{b as n,j as t,e as i}from"./index-OQuvRZTD.js";import{u as m,P as p}from"./use-personality-commit-C3h8upDo.js";import"./dorkbot-templates-8Yu9POWJ.js";import"./sound-D3r8dGFH.js";import"./soul-file-CXgYs25S.js";function P({member:r}){const{agent:e,isPending:o,update:a}=n(r),s=m(e,a);return o?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(p,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{P as PersonalityPopover};
1
+ import{b as n,j as t,e as i}from"./index-YUtEyz7O.js";import{u as m,P as p}from"./use-personality-commit-CJb-rqmM.js";import"./dorkbot-templates-8Yu9POWJ.js";import"./sound-D3r8dGFH.js";import"./soul-file-BQXbWArv.js";function P({member:r}){const{agent:e,isPending:o,update:a}=n(r),s=m(e,a);return o?t.jsx(i,{className:"h-40 w-full"}):e?t.jsx(p,{traits:s.traits,onTraitsChange:s.onTraitsChange,compact:!0,className:"p-1"}):t.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s personality."})}export{P as PersonalityPopover};
@@ -0,0 +1 @@
1
+ import{j as r}from"./index-YUtEyz7O.js";import{b as t}from"./ProfileFields-DD6X85w2.js";import"./profile-errors-vJU1kT3U.js";import"./use-mounted-ref-1T3JbkY1.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};
@@ -0,0 +1 @@
1
+ import{r as b,j as s,bn as _,bq as p,br as S,fm as k,bu as E,eF as I,dM as N,fn as R,fo as A,bo as T,bw as h,fp as M,fq as $,fr as D,fs as F,a5 as O,a6 as V,ac as G}from"./index-YUtEyz7O.js";import{S as L}from"./shield-x-KL4ZbHfz.js";var q=Object.defineProperty,v=(e,t)=>q(e,"name",{value:t,configurable:!0}),x="Tabs",[K,oe]=S(x,[k]),C=k(),[U,y]=K(x),H=b.forwardRef(v(function(t,a){const{__scopeTabs:r,value:n,onValueChange:o,defaultValue:u,orientation:i="horizontal",dir:l,activationMode:g="automatic",...m}=t,d=E(l),[c,f]=I({prop:n,onChange:o,defaultProp:u??"",caller:x});return s.jsx(U,{scope:r,baseId:N(),value:c,onValueChange:f,orientation:i,dir:d,activationMode:g,children:s.jsx(p.div,{dir:d,"data-orientation":i,...m,ref:a})})},"Tabs")),z="TabsList",B=b.forwardRef(v(function(t,a){const{__scopeTabs:r,loop:n=!0,...o}=t,u=y(z,r),i=C(r);return s.jsx(R,{asChild:!0,...i,orientation:u.orientation,dir:u.dir,loop:n,children:s.jsx(p.div,{role:"tablist","aria-orientation":u.orientation,...o,ref:a})})},"TabsList")),Q="TabsTrigger",W=b.forwardRef(v(function(t,a){const{__scopeTabs:r,value:n,disabled:o=!1,...u}=t,i=y(Q,r),l=C(r),g=w(i.baseId,n),m=j(i.baseId,n),d=n===i.value;return s.jsx(A,{asChild:!0,...l,focusable:!o,active:d,children:s.jsx(p.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":m,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:g,...u,ref:a,onMouseDown:T(t.onMouseDown,c=>{!o&&c.button===0&&c.ctrlKey===!1?i.onValueChange(n):c.preventDefault()}),onKeyDown:T(t.onKeyDown,c=>{o||c.target!==c.currentTarget||[" ","Enter"].includes(c.key)&&i.onValueChange(n)}),onFocus:T(t.onFocus,()=>{const c=i.activationMode!=="manual";!d&&!o&&c&&i.onValueChange(n)})})})},"TabsTrigger")),X="TabsContent",J=b.forwardRef(v(function(t,a){const{__scopeTabs:r,value:n,forceMount:o,children:u,...i}=t,l=y(X,r),g=w(l.baseId,n),m=j(l.baseId,n),d=n===l.value,c=b.useRef(d);return b.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),s.jsx(_,{present:o||d,children:({present:f})=>s.jsx(p.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":g,hidden:!f,id:m,tabIndex:0,...i,ref:a,style:{...t.style,animationDuration:c.current?"0s":void 0},children:f&&u})})},"TabsContent"));function w(e,t){return`${e}-trigger-${t}`}v(w,"makeTriggerId");function j(e,t){return`${e}-content-${t}`}v(j,"makeContentId");var Y=H,Z=B,ee=W,te=J;function ie({...e}){return s.jsx(Y,{"data-slot":"tabs",...e})}function ce({className:e,responsive:t=!0,...a}){return s.jsx(Z,{"data-slot":"tabs-list",className:h("bg-dui-muted text-dui-muted-foreground inline-flex items-center justify-center rounded-lg p-1",t?M:"h-9",e),...a})}function de({className:e,...t}){return s.jsx(ee,{"data-slot":"tabs-trigger",className:h("focus-ring inline-flex items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-[color,background-color,box-shadow,opacity] motion-reduce:transition-none! md:py-1","disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-dui-background data-[state=active]:text-dui-foreground data-[state=active]:shadow",e),...t})}function ue({className:e,...t}){return s.jsx(te,{"data-slot":"tabs-content",className:h("focus-ring mt-2","data-[state=active]:animate-in data-[state=active]:fade-in-0 data-[state=active]:duration-150 motion-reduce:animate-none!",e),...t})}const ae={default:!1,plan:!1,acceptEdits:!1,dontAsk:!0,bypassPermissions:!0,auto:!0};function le(e){return ae[e]??!1}function ne(e){try{return F.toString(e)}catch{return`On the schedule ${e}`}}function fe(e){const t=e.cron?ne(e.cron):"Runs only when you ask",a=$(e.startsEnabled);return`${t}, ${a}. This job ${D(e.permissionMode)}.`}function be(e,t){const a=O(),{enabled:r=!0,...n}=t??{},o=Object.keys(n).length>0;return V({queryKey:G.permissionPreview(e??"",o?n:void 0),queryFn:()=>a.previewMarketplacePackage(e,o?n:void 0),enabled:r&&e!==null,staleTime:3e4,networkMode:"always"})}function P(e){const t=e==null?void 0:e.body,a=Array.isArray(t==null?void 0:t.errors)?t.errors.filter(r=>typeof r=="string"):[];return a.length>0?{reasons:a,checked:!0}:{reasons:e instanceof Error&&e.message?[e.message]:[],checked:!1}}function ve(e){return P(e).checked}function ge({error:e}){const{reasons:t,checked:a}=P(e);return s.jsxs("div",{role:"alert",className:"border-destructive/40 bg-destructive/5 space-y-2 rounded-md border p-3 text-sm",children:[s.jsxs("p",{className:"text-destructive flex items-center gap-2 font-medium",children:[s.jsx(L,{className:"size-4 shrink-0","aria-hidden":!0}),"DorkOS won’t install this package"]}),s.jsx("p",{className:"text-muted-foreground text-xs",children:a?"What it found:":"It couldn’t check what this package does."}),t.length>0&&s.jsx("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-xs [overflow-wrap:anywhere]",children:t.map(r=>s.jsx("li",{children:r},r))})]})}export{ge as P,ie as T,ce as a,de as b,ue as c,fe as d,ve as i,le as r,be as u};
@@ -1 +1 @@
1
- import{r as p,t as E,j as e,be as m,bf as g,bg as x,g as y,B as u,I as f,bh as j,bi as b}from"./index-OQuvRZTD.js";import{u as k,a as C,b as v,c as A,h as I,d as F,n as D}from"./profile-errors-COcBx7w5.js";import{u as N}from"./use-mounted-ref-CaPc6Prv.js";function P(a){const[n,t]=p.useState(a),[r,i]=p.useState(a);return r!==a&&(i(a),t(a)),[n,t]}const M="image/png,image/jpeg,image/webp";function l({tone:a,children:n}){return e.jsx("p",{role:a==="error"?"alert":"status",className:a==="error"?"text-destructive text-xs":"text-muted-foreground text-xs",children:n})}function H({member:a}){const n=E(a),t=p.useRef(null),r=k(),i=C();function c(s){const o=s==null?void 0:s[0];o&&(r.mutate({file:o}),t.current&&(t.current.value=""))}return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Photo",description:"PNG, JPEG or WebP, up to 2 MB.",orientation:"vertical",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{size:"lg",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:t,type:"file",accept:M,className:"hidden","data-testid":"profile-photo-input",onChange:s=>c(s.target.files)}),e.jsx(u,{size:"sm",variant:"outline",disabled:r.isPending,onClick:()=>{var s;return(s=t.current)==null?void 0:s.click()},children:a.imageUrl?"Change photo":"Upload a photo"}),a.imageUrl&&e.jsx(u,{size:"sm",variant:"ghost",disabled:i.isPending,onClick:()=>i.mutate(),children:"Remove"})]})]})}),r.isError&&e.jsx(l,{tone:"error",children:v(r.error)}),i.isError&&e.jsx(l,{tone:"error",children:v(i.error)})]})})}function L({member:a}){const n=N(),t=F({isShownInline:()=>n.current}),r=a.displayName===j?"":a.displayName,[i,c]=P(r),s=b(a),o=i.trim().length>0&&i.trim()!==r,d=i.trim().length>0&&(o||s!==null);return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Display name",description:s?`${s}. Save it to make it yours.`:"What DorkOS calls you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{value:i,maxLength:80,"aria-label":"Display name",placeholder:j,onChange:h=>c(h.target.value)}),e.jsx(u,{size:"sm",disabled:!d||t.isPending,onClick:()=>t.mutate(i.trim()),children:"Save"})]})}),t.isError&&e.jsx(l,{tone:"error",children:D(t.error)}),t.isSuccess&&i.trim()===t.variables&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function z({member:a}){var d,h;const n=N(),t=A({isShownInline:()=>n.current}),[r,i]=P(a.handle??""),c=r.trim()!==(a.handle??""),s=a.kind==="agent",o=s?(d=a.agent)==null?void 0:d.authorId:a.id;return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Handle",description:s?"What others type after @ to reach this agent.":"What others type after @ to reach you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{value:r,maxLength:64,placeholder:s?"agentname":"yourname","aria-label":"Handle",disabled:!o,onChange:S=>i(S.target.value)}),e.jsx(u,{size:"sm",disabled:!o||!c||t.isPending,onClick:()=>o&&t.mutate({authorId:o,handle:r.trim()}),children:"Save"})]})}),!o&&e.jsx(l,{tone:"ok",children:"It gets a handle when it first joins a room."}),t.isError&&e.jsx(l,{tone:"error",children:I(t.error,r.trim())}),t.isSuccess&&r.trim()===((h=t.variables)==null?void 0:h.handle)&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function T({member:a}){var n,t;return e.jsx(m,{children:e.jsx(g,{children:e.jsx(x,{label:"Email",description:(n=a.person)!=null&&n.email?"Your sign-in email. It stays fixed.":"No login on this machine. Turn one on in Settings › Login & security.",orientation:"vertical",children:e.jsx(f,{readOnly:!0,"aria-label":"Email",value:((t=a.person)==null?void 0:t.email)??"",placeholder:"No email on this machine",className:"text-muted-foreground"})})})})}export{l as F,L as P,z as a,H as b,T as c,P as u};
1
+ import{r as p,t as E,j as e,bh as m,bi as g,bj as x,g as y,B as u,I as f,bk as j,bl as b}from"./index-YUtEyz7O.js";import{u as k,a as C,b as v,c as A,h as I,d as F,n as D}from"./profile-errors-vJU1kT3U.js";import{u as N}from"./use-mounted-ref-1T3JbkY1.js";function P(a){const[n,t]=p.useState(a),[r,i]=p.useState(a);return r!==a&&(i(a),t(a)),[n,t]}const M="image/png,image/jpeg,image/webp";function l({tone:a,children:n}){return e.jsx("p",{role:a==="error"?"alert":"status",className:a==="error"?"text-destructive text-xs":"text-muted-foreground text-xs",children:n})}function H({member:a}){const n=E(a),t=p.useRef(null),r=k(),i=C();function c(s){const o=s==null?void 0:s[0];o&&(r.mutate({file:o}),t.current&&(t.current.value=""))}return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Photo",description:"PNG, JPEG or WebP, up to 2 MB.",orientation:"vertical",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{size:"lg",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:t,type:"file",accept:M,className:"hidden","data-testid":"profile-photo-input",onChange:s=>c(s.target.files)}),e.jsx(u,{size:"sm",variant:"outline",disabled:r.isPending,onClick:()=>{var s;return(s=t.current)==null?void 0:s.click()},children:a.imageUrl?"Change photo":"Upload a photo"}),a.imageUrl&&e.jsx(u,{size:"sm",variant:"ghost",disabled:i.isPending,onClick:()=>i.mutate(),children:"Remove"})]})]})}),r.isError&&e.jsx(l,{tone:"error",children:v(r.error)}),i.isError&&e.jsx(l,{tone:"error",children:v(i.error)})]})})}function L({member:a}){const n=N(),t=F({isShownInline:()=>n.current}),r=a.displayName===j?"":a.displayName,[i,c]=P(r),s=b(a),o=i.trim().length>0&&i.trim()!==r,d=i.trim().length>0&&(o||s!==null);return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Display name",description:s?`${s}. Save it to make it yours.`:"What DorkOS calls you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{value:i,maxLength:80,"aria-label":"Display name",placeholder:j,onChange:h=>c(h.target.value)}),e.jsx(u,{size:"sm",disabled:!d||t.isPending,onClick:()=>t.mutate(i.trim()),children:"Save"})]})}),t.isError&&e.jsx(l,{tone:"error",children:D(t.error)}),t.isSuccess&&i.trim()===t.variables&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function z({member:a}){var d,h;const n=N(),t=A({isShownInline:()=>n.current}),[r,i]=P(a.handle??""),c=r.trim()!==(a.handle??""),s=a.kind==="agent",o=s?(d=a.agent)==null?void 0:d.authorId:a.id;return e.jsx(m,{children:e.jsxs(g,{className:"space-y-3",children:[e.jsx(x,{label:"Handle",description:s?"What others type after @ to reach this agent.":"What others type after @ to reach you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(f,{value:r,maxLength:64,placeholder:s?"agentname":"yourname","aria-label":"Handle",disabled:!o,onChange:S=>i(S.target.value)}),e.jsx(u,{size:"sm",disabled:!o||!c||t.isPending,onClick:()=>o&&t.mutate({authorId:o,handle:r.trim()}),children:"Save"})]})}),!o&&e.jsx(l,{tone:"ok",children:"It gets a handle when it first joins a room."}),t.isError&&e.jsx(l,{tone:"error",children:I(t.error,r.trim())}),t.isSuccess&&r.trim()===((h=t.variables)==null?void 0:h.handle)&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function T({member:a}){var n,t;return e.jsx(m,{children:e.jsx(g,{children:e.jsx(x,{label:"Email",description:(n=a.person)!=null&&n.email?"Your sign-in email. It stays fixed.":"No login on this machine. Turn one on in Settings › Login & security.",orientation:"vertical",children:e.jsx(f,{readOnly:!0,"aria-label":"Email",value:((t=a.person)==null?void 0:t.email)??"",placeholder:"No email on this machine",className:"text-muted-foreground"})})})})}export{l as F,L as P,z as a,H as b,T as c,P as u};
@@ -1 +1 @@
1
- import{r as f,j as t,be as D,bf as R,bg as E,eg as H,eh as M,ei as _,ej as Z,ek as A,G as V,I as v,B as P,z as B}from"./index-OQuvRZTD.js";import{F as j,b as K,P as Y,a as $,c as G}from"./ProfileFields-DbPJ7fvN.js";import{u as I,P as q,b as J}from"./ProfileRolePicker-CZEXvlJm.js";function k(e,s){if(e.length!==s.length)return!1;const n=new Set(s);return e.every(r=>n.has(r))}function Q(){const{roles:e,isLoading:s,saveRoles:n}=I(),[r,i]=f.useState(e),[l,o]=f.useState(e),[d,u]=f.useState("idle"),[x,m]=f.useState(null);!s&&!k(l,e)&&(o(e),i(e));const h=()=>{u("saving"),n(r).then(()=>{u("idle"),m(r)}).catch(()=>u("error"))};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-3",children:[t.jsx(E,{label:"What kind of work you do",description:"Only DorkBot and your agents read this. It stays on this machine.",orientation:"vertical",children:t.jsx(q,{selected:r,onChange:i,onConfirm:h,confirmLabel:d==="saving"?"Saving…":"Save",busy:d==="saving"||s})}),d==="error"&&t.jsx(j,{tone:"error",children:"Couldn’t save that. Try again."}),d!=="error"&&x&&k(r,x)&&t.jsx(j,{tone:"ok",children:"Saved."})]})})}const X=Object.freeze({days:[1,2,3,4,5],start:"09:00",end:"17:00"});function ee(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}const U=new Map;function te(e){let s=U.get(e);return s||(s=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"short"}),U.set(e,s)),s}const ne={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};function w(e,s){const n={};for(const r of te(s).formatToParts(new Date(e)))n[r.type]=r.value;return{year:Number(n.year),month:Number(n.month),day:Number(n.day),hour:Number(n.hour),minute:Number(n.minute),second:Number(n.second),weekday:ne[n.weekday??""]??0}}function z(e,s){const n=w(e,s);return Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-Math.floor(e/1e3)*1e3}function se(e){const[s,n]=e.split(":").map(Number);return(s??0)*60+(n??0)}function ae(e,s,n,r,i){const l=se(r),o=Date.UTC(e,s-1,n,Math.floor(l/60),l%60),d=o-z(o-864e5,i),u=o-z(o+864e5,i),x=h=>{const y=w(h,i);return y.year===e&&y.month===s&&y.day===n&&y.hour*60+y.minute===l},m=[d,u].filter(x);return m.length>0?Math.min(...m):Math.max(d,u)}function re(e,s,n){const[r,i,l]=e.split("-").map(Number);return new Date(ae(r??1970,i??1,l??1,s,n))}function oe(e,s){const n=w(e.getTime(),s);return`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}const ie=[{day:1,short:"M",name:"Monday"},{day:2,short:"T",name:"Tuesday"},{day:3,short:"W",name:"Wednesday"},{day:4,short:"T",name:"Thursday"},{day:5,short:"F",name:"Friday"},{day:6,short:"S",name:"Saturday"},{day:0,short:"S",name:"Sunday"}];function le(e){const s=typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[];return s.includes(e)?s:[e,...s]}function de(e,s,n){const r=e??J()??ee(),i=s??X;return{timezone:r,days:[...i.days],start:i.start,end:i.end,awayUntil:n!=null&&n.until?oe(new Date(n.until),r):""}}function b(e,s){return e.timezone===s.timezone&&e.start===s.start&&e.end===s.end&&e.awayUntil===s.awayUntil&&[...e.days].sort().join()===[...s.days].sort().join()}function ue(e){return e.days.length===0?"Pick at least one working day.":!e.start||!e.end?"Set a start and an end time.":e.end<=e.start?"The day has to end after it starts.":null}function ce(e,s,n){return e.awayUntil===s.awayUntil?n:e.awayUntil?{...n,until:re(e.awayUntil,"00:00",e.timezone).toISOString()}:null}function me(){const{timezone:e,workingHours:s,away:n,isLoading:r,saveHours:i}=I(),l=de(e,s,n),[o,d]=f.useState(l),[u,x]=f.useState(l),[m,h]=f.useState("idle"),[y,C]=f.useState(null),[F,O]=f.useState(null);!r&&!b(u,l)&&(x(l),d(l));const p=ue(o),g=a=>d(c=>({...c,...a})),W=a=>g({days:o.days.includes(a)?o.days.filter(c=>c!==a):[...o.days,a]}),L=()=>{if(p)return;h("saving");const a=o;i({timezone:a.timezone,workingHours:{days:[...a.days].sort((c,S)=>c-S),start:a.start,end:a.end},away:ce(a,u,n)}).then(()=>{h("idle"),C(null),O(a)}).catch(c=>{h("error"),C(c instanceof Error?c.message:null)})};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-4",children:[t.jsx(E,{label:"Your hours",description:"Your time zone and working hours.",orientation:"vertical",children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-timezone",className:"text-muted-foreground text-xs",children:"Time zone"}),t.jsxs(H,{value:o.timezone,onValueChange:a=>g({timezone:a}),children:[t.jsx(M,{id:"profile-timezone",className:"h-8 text-sm",responsive:!1,children:t.jsx(_,{})}),t.jsx(Z,{children:le(o.timezone).map(a=>t.jsx(A,{value:a,responsive:!1,children:a.replace(/_/g," ")},a))})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{id:"profile-days-label",className:"text-muted-foreground text-xs",children:"Working days"}),t.jsx("div",{role:"group","aria-labelledby":"profile-days-label",className:"flex gap-1",children:ie.map(({day:a,short:c,name:S})=>{const T=o.days.includes(a);return t.jsx("button",{type:"button","aria-label":S,"aria-pressed":T,onClick:()=>W(a),className:V("size-8 rounded-md border text-xs font-medium",T?"bg-primary text-primary-foreground border-transparent":"text-muted-foreground hover:bg-accent"),children:c},a)})})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-start",className:"text-muted-foreground text-xs",children:"Start"}),t.jsx(v,{id:"profile-hours-start",type:"time",value:o.start,onChange:a=>g({start:a.target.value})})]}),t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-end",className:"text-muted-foreground text-xs",children:"End"}),t.jsx(v,{id:"profile-hours-end",type:"time",value:o.end,onChange:a=>g({end:a.target.value})})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-away-until",className:"text-muted-foreground text-xs",children:"Away until"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(v,{id:"profile-away-until",type:"date",value:o.awayUntil,onChange:a=>g({awayUntil:a.target.value})}),o.awayUntil&&t.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>g({awayUntil:""}),children:"Clear"})]})]})]})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(P,{type:"button",size:"sm",onClick:L,disabled:r||m==="saving"||p!==null||b(o,u),children:m==="saving"?"Saving…":"Save"}),p&&t.jsx(j,{tone:"error",children:p}),!p&&m==="error"&&t.jsx(j,{tone:"error",children:y??"Couldn’t save that. Try again."}),!p&&m!=="error"&&F&&b(o,F)&&t.jsx(j,{tone:"ok",children:"Saved."})]})]})})}function fe({member:e}){return t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-muted-foreground text-sm",children:"How you appear on your team page, in rooms and beside your messages."}),t.jsx(K,{member:e}),t.jsx(Y,{member:e}),t.jsx($,{member:e}),t.jsx(G,{member:e}),t.jsx(Q,{}),t.jsx(me,{})]})}function N({children:e}){return t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:e})}function pe(){var n;const e=B(),s=(n=e.data)==null?void 0:n.members.find(r=>r.isSelf);return e.isPending?t.jsx(N,{children:"Loading your profile…"}):e.isError?t.jsx(N,{children:"Couldn’t load your profile. Reopen this tab to try again."}):s?t.jsx(fe,{member:s}):t.jsx(N,{children:"Couldn’t find your profile. Reopen this tab to try again."})}export{fe as P,pe as a};
1
+ import{r as f,j as t,bh as D,bi as R,bj as E,ee as H,ef as M,eg as _,eh as Z,ei as A,G as V,I as v,B as P,z as B}from"./index-YUtEyz7O.js";import{F as j,b as K,P as Y,a as $,c as G}from"./ProfileFields-DD6X85w2.js";import{u as I,P as q,b as J}from"./ProfileRolePicker-CT9eJ1J0.js";function U(e,s){if(e.length!==s.length)return!1;const n=new Set(s);return e.every(r=>n.has(r))}function Q(){const{roles:e,isLoading:s,saveRoles:n}=I(),[r,i]=f.useState(e),[l,o]=f.useState(e),[d,u]=f.useState("idle"),[x,m]=f.useState(null);!s&&!U(l,e)&&(o(e),i(e));const h=()=>{u("saving"),n(r).then(()=>{u("idle"),m(r)}).catch(()=>u("error"))};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-3",children:[t.jsx(E,{label:"What kind of work you do",description:"Only DorkBot and your agents read this. It stays on this machine.",orientation:"vertical",children:t.jsx(q,{selected:r,onChange:i,onConfirm:h,confirmLabel:d==="saving"?"Saving…":"Save",busy:d==="saving"||s})}),d==="error"&&t.jsx(j,{tone:"error",children:"Couldn’t save that. Try again."}),d!=="error"&&x&&U(r,x)&&t.jsx(j,{tone:"ok",children:"Saved."})]})})}const X=Object.freeze({days:[1,2,3,4,5],start:"09:00",end:"17:00"});function ee(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}const k=new Map;function te(e){let s=k.get(e);return s||(s=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",weekday:"short"}),k.set(e,s)),s}const ne={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6};function w(e,s){const n={};for(const r of te(s).formatToParts(new Date(e)))n[r.type]=r.value;return{year:Number(n.year),month:Number(n.month),day:Number(n.day),hour:Number(n.hour),minute:Number(n.minute),second:Number(n.second),weekday:ne[n.weekday??""]??0}}function z(e,s){const n=w(e,s);return Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)-Math.floor(e/1e3)*1e3}function se(e){const[s,n]=e.split(":").map(Number);return(s??0)*60+(n??0)}function ae(e,s,n,r,i){const l=se(r),o=Date.UTC(e,s-1,n,Math.floor(l/60),l%60),d=o-z(o-864e5,i),u=o-z(o+864e5,i),x=h=>{const y=w(h,i);return y.year===e&&y.month===s&&y.day===n&&y.hour*60+y.minute===l},m=[d,u].filter(x);return m.length>0?Math.min(...m):Math.max(d,u)}function re(e,s,n){const[r,i,l]=e.split("-").map(Number);return new Date(ae(r??1970,i??1,l??1,s,n))}function oe(e,s){const n=w(e.getTime(),s);return`${n.year}-${String(n.month).padStart(2,"0")}-${String(n.day).padStart(2,"0")}`}const ie=[{day:1,short:"M",name:"Monday"},{day:2,short:"T",name:"Tuesday"},{day:3,short:"W",name:"Wednesday"},{day:4,short:"T",name:"Thursday"},{day:5,short:"F",name:"Friday"},{day:6,short:"S",name:"Saturday"},{day:0,short:"S",name:"Sunday"}];function le(e){const s=typeof Intl.supportedValuesOf=="function"?Intl.supportedValuesOf("timeZone"):[];return s.includes(e)?s:[e,...s]}function de(e,s,n){const r=e??J()??ee(),i=s??X;return{timezone:r,days:[...i.days],start:i.start,end:i.end,awayUntil:n!=null&&n.until?oe(new Date(n.until),r):""}}function b(e,s){return e.timezone===s.timezone&&e.start===s.start&&e.end===s.end&&e.awayUntil===s.awayUntil&&[...e.days].sort().join()===[...s.days].sort().join()}function ue(e){return e.days.length===0?"Pick at least one working day.":!e.start||!e.end?"Set a start and an end time.":e.end<=e.start?"The day has to end after it starts.":null}function ce(e,s,n){return e.awayUntil===s.awayUntil?n:e.awayUntil?{...n,until:re(e.awayUntil,"00:00",e.timezone).toISOString()}:null}function me(){const{timezone:e,workingHours:s,away:n,isLoading:r,saveHours:i}=I(),l=de(e,s,n),[o,d]=f.useState(l),[u,x]=f.useState(l),[m,h]=f.useState("idle"),[y,C]=f.useState(null),[F,O]=f.useState(null);!r&&!b(u,l)&&(x(l),d(l));const p=ue(o),g=a=>d(c=>({...c,...a})),W=a=>g({days:o.days.includes(a)?o.days.filter(c=>c!==a):[...o.days,a]}),L=()=>{if(p)return;h("saving");const a=o;i({timezone:a.timezone,workingHours:{days:[...a.days].sort((c,S)=>c-S),start:a.start,end:a.end},away:ce(a,u,n)}).then(()=>{h("idle"),C(null),O(a)}).catch(c=>{h("error"),C(c instanceof Error?c.message:null)})};return t.jsx(D,{children:t.jsxs(R,{className:"space-y-4",children:[t.jsx(E,{label:"Your hours",description:"Your time zone and working hours.",orientation:"vertical",children:t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-timezone",className:"text-muted-foreground text-xs",children:"Time zone"}),t.jsxs(H,{value:o.timezone,onValueChange:a=>g({timezone:a}),children:[t.jsx(M,{id:"profile-timezone",className:"h-8 text-sm",responsive:!1,children:t.jsx(_,{})}),t.jsx(Z,{children:le(o.timezone).map(a=>t.jsx(A,{value:a,responsive:!1,children:a.replace(/_/g," ")},a))})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("div",{id:"profile-days-label",className:"text-muted-foreground text-xs",children:"Working days"}),t.jsx("div",{role:"group","aria-labelledby":"profile-days-label",className:"flex gap-1",children:ie.map(({day:a,short:c,name:S})=>{const T=o.days.includes(a);return t.jsx("button",{type:"button","aria-label":S,"aria-pressed":T,onClick:()=>W(a),className:V("size-8 rounded-md border text-xs font-medium",T?"bg-primary text-primary-foreground border-transparent":"text-muted-foreground hover:bg-accent"),children:c},a)})})]}),t.jsxs("div",{className:"flex gap-3",children:[t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-start",className:"text-muted-foreground text-xs",children:"Start"}),t.jsx(v,{id:"profile-hours-start",type:"time",value:o.start,onChange:a=>g({start:a.target.value})})]}),t.jsxs("div",{className:"flex-1 space-y-1",children:[t.jsx("label",{htmlFor:"profile-hours-end",className:"text-muted-foreground text-xs",children:"End"}),t.jsx(v,{id:"profile-hours-end",type:"time",value:o.end,onChange:a=>g({end:a.target.value})})]})]}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("label",{htmlFor:"profile-away-until",className:"text-muted-foreground text-xs",children:"Away until"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(v,{id:"profile-away-until",type:"date",value:o.awayUntil,onChange:a=>g({awayUntil:a.target.value})}),o.awayUntil&&t.jsx(P,{type:"button",variant:"ghost",size:"sm",onClick:()=>g({awayUntil:""}),children:"Clear"})]})]})]})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(P,{type:"button",size:"sm",onClick:L,disabled:r||m==="saving"||p!==null||b(o,u),children:m==="saving"?"Saving…":"Save"}),p&&t.jsx(j,{tone:"error",children:p}),!p&&m==="error"&&t.jsx(j,{tone:"error",children:y??"Couldn’t save that. Try again."}),!p&&m!=="error"&&F&&b(o,F)&&t.jsx(j,{tone:"ok",children:"Saved."})]})]})})}function fe({member:e}){return t.jsxs("div",{className:"space-y-4",children:[t.jsx("p",{className:"text-muted-foreground text-sm",children:"How you appear on your team page, in rooms and beside your messages."}),t.jsx(K,{member:e}),t.jsx(Y,{member:e}),t.jsx($,{member:e}),t.jsx(G,{member:e}),t.jsx(Q,{}),t.jsx(me,{})]})}function N({children:e}){return t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:e})}function pe(){var n;const e=B(),s=(n=e.data)==null?void 0:n.members.find(r=>r.isSelf);return e.isPending?t.jsx(N,{children:"Loading your profile…"}):e.isError?t.jsx(N,{children:"Couldn’t load your profile. Reopen this tab to try again."}):s?t.jsx(fe,{member:s}):t.jsx(N,{children:"Couldn’t find your profile. Reopen this tab to try again."})}export{fe as P,pe as a};
@@ -1 +1 @@
1
- import{a1 as O,a3 as E,a2 as S,aG as h,a4 as j,aF as D,eF as T,r as b,j as l,G as z,I as q,B as k}from"./index-OQuvRZTD.js";function B(){var a,d,c,m,g,p;const r=O(),s=E(),{data:e,isLoading:o}=S({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:T}),i=j({mutationKey:D,mutationFn:u=>r.updateConfig({profile:u}),onSuccess:()=>{s.invalidateQueries({queryKey:h.all})}});return{roles:((a=e==null?void 0:e.profile)==null?void 0:a.roles)??[],rolePromptDismissedAt:((d=e==null?void 0:e.profile)==null?void 0:d.rolePromptDismissedAt)??null,identityPromptDismissedAt:((c=e==null?void 0:e.profile)==null?void 0:c.identityPromptDismissedAt)??null,timezone:((m=e==null?void 0:e.profile)==null?void 0:m.timezone)??null,workingHours:((g=e==null?void 0:e.profile)==null?void 0:g.workingHours)??null,away:((p=e==null?void 0:e.profile)==null?void 0:p.away)??null,isLoading:o,saveHours:u=>i.mutateAsync(u).then(()=>{}),saveRoles:u=>i.mutateAsync({roles:u}).then(()=>{}),dismissRolePrompt:()=>i.mutateAsync({rolePromptDismissedAt:new Date().toISOString()}).then(()=>{}),dismissIdentityPrompt:()=>i.mutateAsync({identityPromptDismissedAt:new Date().toISOString()}).then(()=>{})}}let x=!1;function F(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function Q(){const r=O(),s=E(),{data:e,isSuccess:o}=S({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:T}),i=e==null?void 0:e.profile;b.useEffect(()=>{if(x||!o||!i)return;if(i.timezone!=null){x=!0;return}const a=F();a&&(x=!0,r.updateConfig({profile:{timezone:a}}).then(()=>s.invalidateQueries({queryKey:h.all})).catch(()=>{}))},[o,i,r,s])}const w=[{id:"software-development",label:"Building software"},{id:"hiring",label:"Hiring people"},{id:"marketing",label:"Marketing"},{id:"writing",label:"Writing"},{id:"research",label:"Research"},{id:"business-ops",label:"Running a business"},{id:"design",label:"Design"},{id:"sales",label:"Sales"}],K=6,M={developer:"software-development",engineer:"software-development",programmer:"software-development",coder:"software-development","software engineer":"software-development",recruiter:"hiring",recruiting:"hiring",talent:"hiring",marketer:"marketing",growth:"marketing",writer:"writing",author:"writing",researcher:"research",scientist:"research",founder:"business-ops",entrepreneur:"business-ops",operations:"business-ops",ops:"business-ops",designer:"design",seller:"sales",salesperson:"sales"};function G(r){var i;const s=r.trim().toLowerCase();if(s.length===0)return;const e=w.find(a=>a.id===s);if(e)return e.id;const o=M[s];return o||((i=w.find(a=>a.label.toLowerCase()===s))==null?void 0:i.id)}const A=10,N=60;function v(r,s){const e=s.trim().toLowerCase();return r.some(o=>o.trim().toLowerCase()===e)}function W({selected:r,onChange:s,onConfirm:e,confirmLabel:o,onSkip:i,skipLabel:a,busy:d=!1,error:c=null}){const[m,g]=b.useState(!1),[p,u]=b.useState(""),C=b.useRef(null),y=w.slice(0,K),I=r.filter(t=>!y.some(n=>n.id===t)),f=r.length>=A,P=t=>{v(r,t)?s(r.filter(n=>n!==t)):f||s([...r,t])},L=()=>{const t=p.trim().slice(0,N);if(!t)return;const n=G(t),R=n&&y.some(_=>_.id===n)?n:t;!v(r,R)&&r.length<A&&s([...r,R]),u("")};return l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"What kind of work you do",children:[y.map(t=>{const n=v(r,t.id);return l.jsx("button",{type:"button","aria-pressed":n,disabled:f&&!n,onClick:()=>P(t.id),className:z("focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",n?"border-primary bg-primary text-primary-foreground":"border-input bg-background text-foreground hover:bg-accent"),children:t.label},t.id)}),I.map(t=>l.jsx("button",{type:"button","aria-pressed":!0,onClick:()=>s(r.filter(n=>n!==t)),className:"border-primary bg-primary text-primary-foreground focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:t},t)),!m&&l.jsx("button",{type:"button",disabled:f,onClick:()=>{g(!0),setTimeout(()=>{var t;return(t=C.current)==null?void 0:t.focus()},0)},className:"border-input text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring rounded-md border border-dashed px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",children:"Something else"})]}),f&&l.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"profile-role-cap-hint",children:"Ten at most. Remove a role to add another."}),m&&!f&&l.jsx(q,{ref:C,value:p,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),L())},maxLength:N,placeholder:"Type your work and press Enter","aria-label":"Something else: describe your work",className:"h-8 text-xs"}),c&&l.jsx("p",{className:"text-destructive text-sm",role:"alert","data-testid":"profile-save-error",children:c}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(k,{size:"sm",onClick:e,disabled:d||r.length===0,"data-testid":"confirm-profile",children:o}),i&&l.jsx(k,{size:"sm",variant:"ghost",onClick:i,disabled:d,"data-testid":"skip-profile",children:a})]})]})}export{W as P,Q as a,F as b,B as u};
1
+ import{a5 as O,a7 as E,a6 as I,aJ as h,a8 as _,aI as j,eD as S,r as b,j as l,G as z,I as q,B as k}from"./index-YUtEyz7O.js";function B(){var a,d,c,m,g,p;const r=O(),s=E(),{data:e,isLoading:o}=I({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:S}),i=_({mutationKey:j,mutationFn:u=>r.updateConfig({profile:u}),onSuccess:()=>{s.invalidateQueries({queryKey:h.all})}});return{roles:((a=e==null?void 0:e.profile)==null?void 0:a.roles)??[],rolePromptDismissedAt:((d=e==null?void 0:e.profile)==null?void 0:d.rolePromptDismissedAt)??null,identityPromptDismissedAt:((c=e==null?void 0:e.profile)==null?void 0:c.identityPromptDismissedAt)??null,timezone:((m=e==null?void 0:e.profile)==null?void 0:m.timezone)??null,workingHours:((g=e==null?void 0:e.profile)==null?void 0:g.workingHours)??null,away:((p=e==null?void 0:e.profile)==null?void 0:p.away)??null,isLoading:o,saveHours:u=>i.mutateAsync(u).then(()=>{}),saveRoles:u=>i.mutateAsync({roles:u}).then(()=>{}),dismissRolePrompt:()=>i.mutateAsync({rolePromptDismissedAt:new Date().toISOString()}).then(()=>{}),dismissIdentityPrompt:()=>i.mutateAsync({identityPromptDismissedAt:new Date().toISOString()}).then(()=>{})}}let x=!1;function K(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{return null}}function Q(){const r=O(),s=E(),{data:e,isSuccess:o}=I({queryKey:h.current(),queryFn:()=>r.getConfig(),staleTime:S}),i=e==null?void 0:e.profile;b.useEffect(()=>{if(x||!o||!i)return;if(i.timezone!=null){x=!0;return}const a=K();a&&(x=!0,r.updateConfig({profile:{timezone:a}}).then(()=>s.invalidateQueries({queryKey:h.all})).catch(()=>{}))},[o,i,r,s])}const w=[{id:"software-development",label:"Building software"},{id:"hiring",label:"Hiring people"},{id:"marketing",label:"Marketing"},{id:"writing",label:"Writing"},{id:"research",label:"Research"},{id:"business-ops",label:"Running a business"},{id:"design",label:"Design"},{id:"sales",label:"Sales"}],M=6,F={developer:"software-development",engineer:"software-development",programmer:"software-development",coder:"software-development","software engineer":"software-development",recruiter:"hiring",recruiting:"hiring",talent:"hiring",marketer:"marketing",growth:"marketing",writer:"writing",author:"writing",researcher:"research",scientist:"research",founder:"business-ops",entrepreneur:"business-ops",operations:"business-ops",ops:"business-ops",designer:"design",seller:"sales",salesperson:"sales"};function H(r){var i;const s=r.trim().toLowerCase();if(s.length===0)return;const e=w.find(a=>a.id===s);if(e)return e.id;const o=F[s];return o||((i=w.find(a=>a.label.toLowerCase()===s))==null?void 0:i.id)}const A=10,N=60;function v(r,s){const e=s.trim().toLowerCase();return r.some(o=>o.trim().toLowerCase()===e)}function W({selected:r,onChange:s,onConfirm:e,confirmLabel:o,onSkip:i,skipLabel:a,busy:d=!1,error:c=null}){const[m,g]=b.useState(!1),[p,u]=b.useState(""),C=b.useRef(null),y=w.slice(0,M),T=r.filter(t=>!y.some(n=>n.id===t)),f=r.length>=A,P=t=>{v(r,t)?s(r.filter(n=>n!==t)):f||s([...r,t])},D=()=>{const t=p.trim().slice(0,N);if(!t)return;const n=H(t),R=n&&y.some(L=>L.id===n)?n:t;!v(r,R)&&r.length<A&&s([...r,R]),u("")};return l.jsxs("div",{className:"flex flex-col gap-3",children:[l.jsxs("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"What kind of work you do",children:[y.map(t=>{const n=v(r,t.id);return l.jsx("button",{type:"button","aria-pressed":n,disabled:f&&!n,onClick:()=>P(t.id),className:z("focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",n?"border-primary bg-primary text-primary-foreground":"border-input bg-background text-foreground hover:bg-accent"),children:t.label},t.id)}),T.map(t=>l.jsx("button",{type:"button","aria-pressed":!0,onClick:()=>s(r.filter(n=>n!==t)),className:"border-primary bg-primary text-primary-foreground focus-visible:ring-ring rounded-md border px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none",children:t},t)),!m&&l.jsx("button",{type:"button",disabled:f,onClick:()=>{g(!0),setTimeout(()=>{var t;return(t=C.current)==null?void 0:t.focus()},0)},className:"border-input text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:ring-ring rounded-md border border-dashed px-2.5 py-1 text-xs transition-colors duration-150 focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",children:"Something else"})]}),f&&l.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"profile-role-cap-hint",children:"Ten at most. Remove a role to add another."}),m&&!f&&l.jsx(q,{ref:C,value:p,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),D())},maxLength:N,placeholder:"Type your work and press Enter","aria-label":"Something else: describe your work",className:"h-8 text-xs"}),c&&l.jsx("p",{className:"text-destructive text-sm",role:"alert","data-testid":"profile-save-error",children:c}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[l.jsx(k,{size:"sm",onClick:e,disabled:d||r.length===0,"data-testid":"confirm-profile",children:o}),i&&l.jsx(k,{size:"sm",variant:"ghost",onClick:i,disabled:d,"data-testid":"skip-profile",children:a})]})]})}export{W as P,Q as a,K as b,B as u};
@@ -0,0 +1 @@
1
+ import{j as e,_ as c,aR as l,G as i}from"./index-YUtEyz7O.js";const p=4,m={compact:"max-w-[200px] gap-1.5 px-2.5 py-1 text-xs",comfortable:"min-h-9 max-w-[280px] gap-2 px-3 py-1.5 text-sm"};function u({suggestions:o,onChipClick:s,ariaLabel:r="Suggested follow-ups",size:a="compact"}){const n=o.slice(0,p);return e.jsx(c.div,{"data-slot":"prompt-suggestion-chips",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},role:"group","aria-label":r,className:"mt-1.5 flex flex-wrap items-center gap-2",children:n.map(t=>e.jsxs("button",{type:"button","aria-label":t,title:t,onClick:()=>s(t),className:i("bg-secondary text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring inline-flex items-center truncate rounded-md transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-offset-2",m[a]),children:[e.jsx(l,{className:i("shrink-0",a==="compact"?"size-3":"size-3.5")}),e.jsx("span",{className:"truncate",children:t})]},t))})}export{u as P};
@@ -1 +1 @@
1
- import{r as g,b as D,z as P,j as e,e as O,D as _,F as U,G as C,t as z,g as F,J as K,K as M}from"./index-OQuvRZTD.js";import{u as Y}from"./use-mounted-ref-CaPc6Prv.js";const A="REPORTS_TO_CYCLE",q="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function B({option:a,selected:d,focusable:i,isDefault:p,disabled:x,onPick:c}){const n=z(a.member);return e.jsxs("button",{type:"button",role:"radio","aria-checked":d,tabIndex:i?0:-1,disabled:x,onClick:c,className:C(M,"flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1 text-left text-sm","hover:bg-accent disabled:opacity-60"),children:[e.jsx(F,{size:"xs",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin,badge:null}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[a.label,p&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"text-muted-foreground",children:"(default)"})]})]}),d&&e.jsx(K,{"aria-hidden":!0,className:"size-3.5 shrink-0"})]})}function J({member:a}){var y,R;const d=Y(),i=g.useRef(null),p=g.useId(),x=g.useId(),{agent:c,isPending:n,isSaving:h,error:u,update:b}=D(a,{errorLabel:"Couldn’t change who this agent reports to",isShownInline:t=>d.current===!0&&t.code===A}),j=P();if(n||j.isPending)return e.jsx(O,{className:"h-24 w-full"});if(!c)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const I=((y=j.data)==null?void 0:y.members)??[],l=_(c,I,a),m=U(c.id,I,a),E=m.some(t=>t.accountId===l.accountId)?l.accountId:((R=m[0])==null?void 0:R.accountId)??null,L=t=>{var v;const s=Array.from(((v=i.current)==null?void 0:v.querySelectorAll('[role="radio"]'))??[]),r=s.indexOf(document.activeElement),o={ArrowDown:r+1,ArrowRight:r+1,ArrowUp:r-1,ArrowLeft:r-1,Home:0,End:s.length-1}[t.key];if(o===void 0||s.length===0)return;t.preventDefault();const f=s[(o+s.length)%s.length];s.forEach(N=>N.tabIndex=N===f?0:-1),f==null||f.focus()},S=m.filter(t=>t.kind==="person"),T=m.filter(t=>t.kind==="agent"),k=(u==null?void 0:u.code)===A?u.message:null,w=(t,s,r)=>r.length>0&&e.jsxs("div",{role:"group","aria-labelledby":s,className:"space-y-0.5",children:[e.jsx("div",{id:s,className:C(q,"px-1.5"),children:t}),r.map(o=>e.jsx(B,{option:o,selected:l.accountId===o.accountId,focusable:E===o.accountId,isDefault:l.isDefault&&l.accountId===o.accountId,disabled:h,onPick:()=>{o.accountId!==c.reportsTo&&b({reportsTo:o.accountId})}},o.accountId))]});return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-reports-to",children:[e.jsxs("div",{ref:i,role:"radiogroup","aria-label":"Reports to",onKeyDown:L,className:"max-h-72 space-y-2 overflow-y-auto",children:[w("People",p,S),w("Agents",x,T)]}),k&&e.jsx("p",{role:"alert",className:"text-status-error px-1.5 text-xs",children:k}),!l.isDefault&&e.jsx("button",{type:"button",disabled:h,onClick:()=>b({reportsTo:null}),className:"text-muted-foreground hover:text-foreground px-1.5 text-xs underline-offset-2 hover:underline",children:"Use the default"})]})}export{J as ReportsToPopover};
1
+ import{r as g,b as D,z as P,j as e,e as O,D as _,F as U,G as C,t as z,g as F,J as K,K as M}from"./index-YUtEyz7O.js";import{u as Y}from"./use-mounted-ref-1T3JbkY1.js";const A="REPORTS_TO_CYCLE",q="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function B({option:a,selected:d,focusable:i,isDefault:p,disabled:x,onPick:c}){const n=z(a.member);return e.jsxs("button",{type:"button",role:"radio","aria-checked":d,tabIndex:i?0:-1,disabled:x,onClick:c,className:C(M,"flex w-full min-w-0 items-center gap-2 rounded-md px-1.5 py-1 text-left text-sm","hover:bg-accent disabled:opacity-60"),children:[e.jsx(F,{size:"xs",kind:n.kind,color:n.color,emoji:n.emoji,imageUrl:n.imageUrl,fallback:n.fallback,origin:n.origin,badge:null}),e.jsxs("span",{className:"min-w-0 flex-1 truncate",children:[a.label,p&&e.jsxs(e.Fragment,{children:[" ",e.jsx("span",{className:"text-muted-foreground",children:"(default)"})]})]}),d&&e.jsx(K,{"aria-hidden":!0,className:"size-3.5 shrink-0"})]})}function J({member:a}){var y,R;const d=Y(),i=g.useRef(null),p=g.useId(),x=g.useId(),{agent:c,isPending:n,isSaving:h,error:u,update:b}=D(a,{errorLabel:"Couldn’t change who this agent reports to",isShownInline:t=>d.current===!0&&t.code===A}),j=P();if(n||j.isPending)return e.jsx(O,{className:"h-24 w-full"});if(!c)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const I=((y=j.data)==null?void 0:y.members)??[],l=_(c,I,a),m=U(c.id,I,a),E=m.some(t=>t.accountId===l.accountId)?l.accountId:((R=m[0])==null?void 0:R.accountId)??null,L=t=>{var v;const s=Array.from(((v=i.current)==null?void 0:v.querySelectorAll('[role="radio"]'))??[]),r=s.indexOf(document.activeElement),o={ArrowDown:r+1,ArrowRight:r+1,ArrowUp:r-1,ArrowLeft:r-1,Home:0,End:s.length-1}[t.key];if(o===void 0||s.length===0)return;t.preventDefault();const f=s[(o+s.length)%s.length];s.forEach(N=>N.tabIndex=N===f?0:-1),f==null||f.focus()},S=m.filter(t=>t.kind==="person"),T=m.filter(t=>t.kind==="agent"),k=(u==null?void 0:u.code)===A?u.message:null,w=(t,s,r)=>r.length>0&&e.jsxs("div",{role:"group","aria-labelledby":s,className:"space-y-0.5",children:[e.jsx("div",{id:s,className:C(q,"px-1.5"),children:t}),r.map(o=>e.jsx(B,{option:o,selected:l.accountId===o.accountId,focusable:E===o.accountId,isDefault:l.isDefault&&l.accountId===o.accountId,disabled:h,onPick:()=>{o.accountId!==c.reportsTo&&b({reportsTo:o.accountId})}},o.accountId))]});return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-reports-to",children:[e.jsxs("div",{ref:i,role:"radiogroup","aria-label":"Reports to",onKeyDown:L,className:"max-h-72 space-y-2 overflow-y-auto",children:[w("People",p,S),w("Agents",x,T)]}),k&&e.jsx("p",{role:"alert",className:"text-status-error px-1.5 text-xs",children:k}),!l.isDefault&&e.jsx("button",{type:"button",disabled:h,onClick:()=>b({reportsTo:null}),className:"text-muted-foreground hover:text-foreground px-1.5 text-xs underline-offset-2 hover:underline",children:"Use the default"})]})}export{J as ReportsToPopover};
@@ -0,0 +1 @@
1
+ import{a5 as ie,a8 as de,a7 as Oe,i$ as _e,j0 as ne,j1 as me,j2 as Le,j3 as Fe,j4 as De,aQ as ze,r as n,j as t,G as ee,B as we,x as He,e as Q,gx as ke,hh as qe,gw as Ie,j5 as $e,j6 as We,n as Be,gA as U,dB as Ke,fv as Ge,j7 as Ue,j8 as Xe,j9 as Ye,ct as Qe,ja as Ve,jb as Ze,jc as Je,jd as et,cp as tt,je as nt,gv as Y,jf as st,l as rt,s as he,jg as ot,jh as at,e4 as it,X as dt,e1 as lt,_ as ut,ji as ct,jj as pe,jk as ft,af as mt,jl as ht,gu as pt,gt,jm as xt,aG as ge,Z as Rt}from"./index-YUtEyz7O.js";import{P as vt,u as yt}from"./pane-resize-handle-_EuIpxzc.js";import{D as bt,U as jt,u as wt}from"./UnreadDivider-BnJ06LmP.js";import{u as kt}from"./use-room-follow-claim-Di-yvoJD.js";import{a as le,e as ue,g as It,f as Ae,h as At,i as Ne,c as G,d as V,j as Nt,k as re,b as oe,l as ae,A as Se,m as Ce,t as ce,r as St,n as J,R as fe,u as Me,C as Te,o as Ct}from"./ChannelComposer-BJ0nNzQb.js";import{u as Mt,f as Tt,a as Et,F as Pt,C as X,d as Ot,M as _t}from"./registry-DVPRVi8T.js";import{u as Lt}from"./use-connector-management-CHLdhBhC.js";import{A as Ft}from"./AgentRequestCard-Bz31ewIs.js";import{u as Dt}from"./use-room-sessions-CPDRbQAW.js";function zt(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.haltRoomAgent(o,r),meta:{errorLabel:"Couldn’t stop this agent"}})}function Ht(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.promoteHold(o,r),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function qt(e){const o=ie(),r=Oe(),u=_e(e),v=ne(g=>{var p;return e===null?null:((p=g.paging[e])==null?void 0:p.cursor)??null}),i=de({mutationFn:async g=>{var b;const p=(b=ne.getState().paging[g])==null?void 0:b.cursor;if(p==null)return;const y=await o.listRoomEntries(g,{before:p,limit:me}),w=ze.entries(g),k=r.getQueryData(w),I=Le(k,y);r.setQueryData(w,I),ne.getState().notePage(g,Fe(y)??p,De(y,me)||I.length===((k==null?void 0:k.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:l,isPending:j}=i,R=n.useRef(!1),x=n.useCallback(async()=>{if(!(e===null||R.current)){R.current=!0;try{await l(e).catch(()=>{})}finally{R.current=!1}}},[e,l]);return{canLoadOlder:u,isLoadingOlder:j,cursor:v,loadOlder:x}}function $t({id:e,summary:o,open:r,onOpen:u}){const{capabilities:v}=Mt(),{count:i,lastAt:l,unread:j}=o,R=Tt(l),[x,g]=n.useState({count:i,bumped:!1});x.count!==i&&g({count:i,bumped:!0});const p=x.count===i&&x.bumped;return v.threads?t.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":j>0?"":void 0,"aria-expanded":r,onClick:u,className:ee("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","mb-1 w-fit rounded text-left text-xs transition-colors","px-2 py-2 md:px-1 md:py-0.5",j>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[t.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),t.jsx("span",{className:ee(p&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:i},i),i===1?" reply":" replies",R.length>0&&t.jsxs(t.Fragment,{children:[" · last ",t.jsx("time",{dateTime:l,title:Et(l),children:R})]}),j>0&&` · ${j} new`]}):null}function Wt({loading:e,onLoad:o}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(we,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&t.jsx(He,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}const Bt="room-load-older",Kt=4;function Ee({roomName:e}){return t.jsx(Pt,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:Kt},(o,r)=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(Q,{className:"size-7 shrink-0 rounded-full"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${r}`))})}function Gt({roomId:e,roomName:o,viewerAuthorId:r,entries:u,members:v,formerAuthors:i,lastReadSeq:l,reactionFrequents:j,streamStalled:R,isLoading:x,error:g,onAddAgents:p,openThreadId:y,onOpenThread:w,resumeRow:k,landOnRow:I,onTopRow:b,canLoadOlder:N=!1,isLoadingOlder:d=!1,onLoadOlder:f,ref:C,roomKind:O}){const A=n.useMemo(()=>le(v,i),[v,i]),z=ke(v,r),S=ue(),M=n.useMemo(()=>new Map([...A].map(([a,T])=>[a,T.displayName])),[A]),_=qe(),B=Ie(e,null),{topLevel:P,repliesByRoot:D,orphaned:q}=n.useMemo(()=>It(u),[u]),H=n.useMemo(()=>new Map(u.map(a=>[a.id,a])),[u]),L=n.useMemo(()=>{const a=$e(P,l),T=We(P.map(c=>({id:c.id,authorId:c.body.moment?`moment:${c.id}`:c.authorId,timestamp:c.createdAt})),{now:_,lastSeenId:a.lastSeenId,unreadFromStart:a.fromStart}),s=[];N&&!x&&s.push({kind:"load-older",id:Bt});for(const c of T){if(c.kind==="day-divider"){s.push({kind:"day-divider",id:c.key,label:c.label});continue}if(c.kind==="unread-divider"){s.push({kind:"unread-divider",id:c.key});continue}const h=P[c.index];s.push({kind:"message",id:h.id,entry:h,grouping:c.grouping,position:c.index+1,answers:Ae(h,P[c.index-1],H.get.bind(H))});const E=D.get(h.id);E&&s.push({kind:"thread-reply",id:At(h.id),rootId:h.id,replies:E,totalReplies:h.threadReplyCount})}return s},[P,D,H,l,_,N,x]),K=n.useMemo(()=>L.map(a=>a.kind==="load-older"?{kind:"notice",id:a.id,at:"",body:null}:a.kind==="day-divider"?{kind:"day-divider",id:a.id,label:a.label}:a.kind==="unread-divider"?{kind:"unread-divider",id:a.id}:a.kind==="thread-reply"?{kind:"thread-reply",id:a.id,rootId:a.rootId,replyCount:Ne(a.replies.length,a.totalReplies),lastAt:a.replies[a.replies.length-1].createdAt}:{kind:"message",id:a.id,payload:a.entry,grouping:a.grouping,author:G(V(a.entry,A),A,S.faces),at:a.entry.createdAt}),[L,A,S.faces]),F=n.useCallback((a,T)=>{const s=L[T.index];if(s.kind==="load-older")return f===void 0?null:t.jsx(Wt,{loading:d,onLoad:f});if(s.kind==="day-divider")return t.jsx(bt,{label:s.label});if(s.kind==="unread-divider")return t.jsx(jt,{});if(s.kind==="thread-reply"){if(T.onOpenThread===void 0)return null;const h=T.onOpenThread;return t.jsx($t,{id:re(s.rootId),summary:Nt(s.replies,l,s.totalReplies),open:y===s.rootId,onOpen:()=>h(s.rootId)})}const c=V(s.entry,A);return t.jsx(oe,{roomId:e,entry:s.entry,author:G(c,A,S.faces),authorRef:A.get(c),authors:A,viewerAuthorId:r,authorNames:M,reactionFrequents:j,streamStalled:R,isMember:z,grouping:s.grouping,orphanedReply:q.has(s.entry.id),answers:s.answers,feedPosition:{index:s.position,total:-1},rowId:ae(s.entry.id),roomKind:O})},[L,e,O,A,S.faces,r,M,j,R,z,q,l,y,d,f]),W=n.useCallback(a=>{if(a.kind==="message")return ae(a.id);if(a.kind==="thread-reply")return re(a.rootId)},[]);if(g)return t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),t.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const $=v.some(a=>a.author.kind==="agent"),m=t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx(Be,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),t.jsx("p",{className:"max-w-sm",children:$?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(we,{type:"button",size:"sm",variant:$?"ghost":"default",onClick:p,className:"mt-1",children:$?"Add more agents":"Add agents"})]});return t.jsx(Se,{known:S,children:t.jsx(X.Timeline,{ref:C,conversationId:e,label:`Messages in ${o}`,rows:K,renderRow:F,onOpenThread:w,domIdOf:W,...k===void 0?{}:{resumeRow:k},...I===void 0?{}:{landOnRow:I},...b===void 0?{}:{onTopRow:b},pending:B,viewerAuthorId:r,loading:x?t.jsx(Ee,{roomName:o}):void 0,empty:m,feedTestId:"room-timeline"})})}function Ut(e){const{roomId:o,entrySeq:r,entries:u,historyLoaded:v}=e,i=r===void 0?null:`${o}:${r}`,l=n.useMemo(()=>{if(r===void 0)return null;const k=u.find(d=>d.seq===r);if(k===void 0)return null;const I=Ce(u,k.id);if(I===null)return null;const b=ce(k)??null,N=b!==null&&I.rowId!==k.id;return{roomRowId:I.rowId,threadRootId:N?b:null,entryId:k.id}},[u,r]),j=n.useRef(null),R=(l==null?void 0:l.threadRootId)??null;n.useEffect(()=>{i===null||R===null||j.current!==i&&(j.current=i,U.getState().openThread(o,R))},[i,o,R]);const x=n.useRef(null);n.useEffect(()=>{i===null||!v||l===null&&x.current!==i&&(x.current=i,Ke.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[i,v,l]);const g=n.useRef(null),p=n.useCallback(()=>{if(!(i===null||g.current===i))return g.current=i,l==null?void 0:l.roomRowId},[i,l]),y=n.useRef(null),w=n.useCallback(()=>{if(!(i===null||y.current===i))return y.current=i,(l==null?void 0:l.threadRootId)===null||l==null?void 0:l.entryId},[i,l]);return{roomRow:r===void 0?void 0:p,threadRow:r===void 0?void 0:w}}function Xt(e,o){const[r,u]=n.useState({roomId:null,seq:null});return r.roomId===e?r.seq:e===null?(u({roomId:null,seq:null}),null):o===null?null:(u({roomId:e,seq:o}),o)}const Yt=600;function Qt(e){return document.getElementById(re(e))??document.getElementById(ae(e))}function Vt(){const e=n.useRef(null);return n.useEffect(()=>()=>{var r;return(r=e.current)==null?void 0:r.call(e)},[]),{arm:n.useCallback(r=>{var j;(j=e.current)==null||j.call(e);let u=0;const v=Date.now()+Yt;let i=!1;const l=()=>{if(i)return;const R=document.activeElement;if(R===null||R===document.body||!R.isConnected){const g=Qt(r);if(g!==null){g.focus();return}}Date.now()>=v||(u=requestAnimationFrame(l))};u=requestAnimationFrame(l),e.current=()=>{i=!0,cancelAnimationFrame(u)}},[])}}function Zt({roomId:e,route:o,urlThreadId:r,openThreadId:u,entries:v,historyLoaded:i}){const l=Ge(),j=n.useRef(null);n.useEffect(()=>{if(e!==null){if(j.current!==e&&(j.current=e,r!==void 0)){U.getState().openThread(e,r);return}if(i&&u!==void 0){const R=v.find(g=>g.id===u),x=R===void 0?void 0:St(R);if(x!==void 0&&x!==u){const g=U.getState().open[e];U.getState().openThread(e,x,(g==null?void 0:g.focusComposer)??!1);return}}u!==r&&(l==null||l({to:o,search:R=>({...R,thread:u}),replace:!0}))}},[e,o,u,r,v,i,l])}function Jt(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(o=>o.author.kind==="agent")}function en({room:e,hasEntries:o,onAddAgents:r}){return!o||!Jt(e)?null:t.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",t.jsx("button",{type:"button",onClick:r,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function tn({roomId:e}){const{approvals:o}=Ue(),r=Xe(o).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:t.jsx(Ye,{approvals:r})})}function nn({roomId:e}){const{data:o}=Lt("pending"),r=(o??[]).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:r.map(u=>t.jsx(Ft,{request:u},u.requestId))})}const sn="An agent",xe=64,se=3,rn=new Set;function Pe({room:e,entries:o,scope:r,laneScope:u,stalled:v,unavailable:i=!1,onRetry:l,onScrollToRow:j}){const R=Qe(),x=Ve(e.id,r),g=Ze(e.id,r),p=Je(e.id,r),[y,w]=n.useState(!1),k=Dt(e.id,{enabled:y}),I=et(),{mutate:b}=zt(),[N,d]=n.useState(rn),f=n.useCallback(s=>{d(c=>new Set(c).add(s)),b({roomId:e.id,authorId:s},{onSettled:()=>d(c=>{const h=new Set(c);return h.delete(s),h})})},[b,e.id]),C=Ht(),[O,A]=n.useState(()=>new Map),z=tt(),S=ue(),M=n.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),_=n.useCallback(s=>{var c;return((c=M.get(s))==null?void 0:c.displayName)??sn},[M]),{interactions:B}=nt(),P=n.useMemo(()=>B.filter(s=>s.roomId===e.id),[B,e.id]),D=n.useMemo(()=>{var c;const s={};for(const h of P){if(h.roomAuthorId===void 0)continue;const E=(c=M.get(h.roomAuthorId))==null?void 0:c.displayName;E!==void 0&&(s[h.sessionId]=E)}return s},[P,M]),q=n.useMemo(()=>x.map(s=>({authorId:s.authorId,name:_(s.authorId),state:s.state,since:s.since,activity:s.activity??null})),[x,_]),H=n.useMemo(()=>g.map(s=>{var h;const c=(h=z.data)==null?void 0:h.find(E=>E.id===s.behindRoomId);return{authorId:s.authorId,name:_(s.authorId),since:s.since,behind:{roomId:s.behindRoomId,title:c===void 0?null:Y(c)},othersWaiting:s.othersWaiting,severalInTheWay:s.severalInTheWay}}),[g,_,z.data]),L=n.useMemo(()=>{const s=new Set;for(const c of g)O.get(c.authorId)===c.entryId&&s.add(c.authorId);return s},[g,O]),K=n.useMemo(()=>p===null?null:{authorId:p.authorId,name:_(p.authorId)},[p,_]),F=n.useMemo(()=>Ot({capabilities:fe,asks:P,agentNames:D,stalled:v,presence:q,held:H,silentFinish:K,turn:null}),[P,D,q,H,K,v]),W=n.useMemo(()=>{var c;const s=new Map;for(const h of((c=k.data)==null?void 0:c.bindings)??[])s.set(h.authorId,h.sessionId);return s},[k.data]),$=n.useCallback(s=>{const c=o.find(E=>E.id===s);if(c===void 0)return null;const h=c.body.text.replace(/\s+/gu," ").trim();return h.length===0?null:h.length>xe?`${h.slice(0,xe).trimEnd()}…`:h},[o]),m=n.useCallback(s=>{var c;return u==="thread"?J(s):((c=Ce(o,s))==null?void 0:c.domId)??null},[o,u]),a=n.useMemo(()=>{const s=x.map(h=>{const E=$(h.entryId),Z=m(h.entryId);return{authorId:h.authorId,author:G(h.authorId,M,S.faces),state:h.state,since:h.since,doing:st(h.activity),replyingTo:E===null||Z===null?null:{entryId:h.entryId,excerpt:E,rowId:Z},sessionId:W.get(h.authorId)??null}}),c=H.map(h=>({authorId:h.authorId,author:G(h.authorId,M,S.faces),state:"held",since:h.since,doing:null,replyingTo:null,sessionId:null,behind:h.behind,othersWaiting:h.othersWaiting}));return[...s,...c]},[x,H,M,S.faces,$,m,W]),T=n.useMemo(()=>{if(x.length===0)return null;const s=x.slice(0,se);return t.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[s.map(c=>t.jsx(_t,{author:G(c.authorId,M,S.faces),className:"ring-background size-4 ring-2"},c.authorId)),x.length>se&&t.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${x.length-se}`})]})},[x,M,S.faces]);return t.jsx(X.LiveLane,{state:F,scope:u,onRetry:l,unavailable:i,faces:T,onPeekOpenChange:w,askCard:F.kind==="ask"?t.jsx(ot,{ask:F.ask,...D[F.ask.sessionId]?{agentName:D[F.ask.sessionId]}:{},onOpenSession:s=>{R(he({session:s}))},className:"border-l-0"}):void 0,peek:t.jsx(X.LivePeek,{rows:a,onScrollToRow:j,onOpenSession:s=>{R(he({session:s}))},onOpenRoom:s=>{R({...rt.channels(),search:{id:s}})},onAnswerFirst:s=>{const c=g.find(h=>h.authorId===s);c!==void 0&&A(h=>new Map(h).set(s,c.entryId)),C.mutate({roomId:e.id,authorId:s})},promoted:L,onStopAll:()=>I.mutate({roomId:e.id}),stopping:I.isPending,onStopAgent:f,stoppingAgents:N})})}const Re=3e3;function on(e,o,r,u=Date.now){const v=n.useRef(null),i=n.useRef(new Map),l=n.useRef(new Map),j=v.current,R=i.current,x=l.current,g=u();for(const p of e){if(x.has(p.id))continue;if(j===null){x.set(p.id,"at-rest");continue}const y=R.get(p.authorId);x.set(p.id,y!==void 0&&g-y<Re?"handed-off":"dropped")}return n.useEffect(()=>{if(!r)return;v.current=new Set(e.map(y=>y.id));const p=u();for(const y of o)i.current.set(y,p);for(const[y,w]of i.current)p-w>Re&&i.current.delete(y);for(const y of l.current.keys())v.current.has(y)||l.current.delete(y)}),x}function an({kind:e}){return e==="thread-error"?t.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),t.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?t.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-sm"})]}):t.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function dn({room:e,rootEntryId:o,focusComposer:r,entries:u,reactionFrequents:v,streamStalled:i,streamUnavailable:l,onRetryStream:j,historyLoaded:R,historyFailed:x=!1,landOnRow:g,pushed:p,onClose:y}){const w=n.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),k=Me({room:e,threadRootId:o}),I=ke(e.members,e.viewerAuthorId),b=ue(),N=n.useMemo(()=>new Map([...w].map(([m,a])=>[m,a.displayName])),[w]),{root:d,replies:f}=n.useMemo(()=>{let m;const a=[];for(const T of u)T.id===o?m=T:ce(T)===o&&a.push(T);return{root:m,replies:a}},[u,o]),C=d==null?void 0:d.threadReplyCount,O=C!==void 0&&C>f.length,A=!p,z=d===void 0||O?-1:(A?1:0)+f.length,S=Ne(f.length,C),M=n.useMemo(()=>new Set(f.map(m=>m.id)),[f]),_=n.useMemo(()=>({replyIds:M,inside:!0}),[M]),B=at(e.id,_),P=Ie(e.id,o),D=on(f,B,R),q=n.useRef(null),H=n.useCallback(m=>{var a;(a=q.current)==null||a.scrollToRow(m)},[]),L=n.useRef(null);n.useEffect(()=>{var m;r||(m=L.current)==null||m.focus()},[o,r]);const K=m=>{m.key!=="Escape"||m.defaultPrevented||(m.stopPropagation(),y())},F=n.useMemo(()=>{const m=[];if(d===void 0){const a=x?"thread-error":R?"thread-orphan":"thread-waiting";m.push({kind:"notice",id:a,at:"",body:null})}else A&&m.push({kind:"message",id:d.id,payload:d,grouping:{position:"only"},author:G(V(d,w),w,b.faces),at:d.createdAt});for(const a of f)m.push({kind:"message",id:a.id,payload:a,grouping:{position:"only"},author:G(V(a,w),w,b.faces),at:a.createdAt});return m},[d,A,f,w,b.faces,x,R]),W=n.useCallback(m=>{if(m.kind==="notice")return t.jsx(an,{kind:m.id});if(m.kind!=="message")return null;const a=m.payload,T=d!==void 0&&a.id===d.id,s=f.findIndex(E=>E.id===a.id),c=t.jsx(oe,{roomId:e.id,entry:a,rowId:J(a.id),roomKind:e.kind,author:m.author,authorRef:w.get(a.authorId),authors:w,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:v,streamStalled:i,isMember:I,grouping:{position:"only"},answers:Ae(a,s<=0?d:f[s-1],E=>(d==null?void 0:d.id)===E?d:f.find(Z=>Z.id===E)),feedPosition:{index:T?1:(d===void 0||!A?0:1)+s+1,total:z}});if(T)return t.jsxs(t.Fragment,{children:[c,t.jsx(ve,{count:S})]});const h=D.get(a.id)??"at-rest";return t.jsx("div",{className:ee(h==="dropped"&&"motion-safe:animate-thread-reply-in",h==="handed-off"&&"motion-safe:animate-reply-settle"),children:c})},[d,A,f,S,D,e.id,e.kind,e.viewerAuthorId,w,N,v,i,I,z]),$=n.useCallback(m=>m.kind==="message"?J(m.id):void 0,[]);return t.jsx(Se,{known:b,children:t.jsx(X.Root,{surface:"room",capabilities:fe,target:k.target,anchor:"rail",children:t.jsxs("section",{ref:L,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:K,className:ee("bg-card flex min-h-0 flex-col outline-none",p?"h-full w-full":"w-full border-l"),children:[p?t.jsxs("header",{className:"flex items-center gap-2 border-b px-1 py-1",children:[t.jsxs("button",{type:"button",onClick:y,"aria-label":`Back to ${Y(e)}`,"data-testid":"room-thread-back",className:"focus-ring text-muted-foreground hover:text-foreground flex h-11 min-w-0 items-center gap-1 rounded px-2 text-sm",children:[t.jsx(it,{"aria-hidden":!0,className:"size-4 shrink-0"}),t.jsx("span",{className:"truncate",children:Y(e)})]}),t.jsx("p",{className:"ml-auto shrink-0 pr-3 text-sm font-medium",children:"Thread"})]}):t.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[t.jsx("button",{type:"button",onClick:y,"aria-label":"Close thread",className:"focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1",children:t.jsx(dt,{"aria-hidden":!0,className:"size-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium",children:"Thread"}),t.jsx("p",{className:"text-muted-foreground truncate text-xs",children:Y(e)})]})]}),p&&d!==void 0&&t.jsxs("div",{"data-testid":"room-thread-pinned-root",className:"max-h-[40%] shrink-0 overflow-y-auto border-b pt-2",children:[t.jsx(oe,{roomId:e.id,entry:d,rowId:J(d.id),roomKind:e.kind,author:G(V(d,w),w,b.faces),authorRef:w.get(d.authorId),authors:w,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:v,streamStalled:i,isMember:I,grouping:{position:"only"}}),t.jsx(ve,{count:S})]}),t.jsx(X.Timeline,{ref:q,conversationId:`thread-${o}`,label:`Thread in ${Y(e)}`,busy:!R&&!x,rows:F,renderRow:W,domIdOf:$,...g===void 0?{}:{landOnRow:g},pending:P,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),t.jsx(Pe,{room:e,entries:u,scope:_,laneScope:"thread",stalled:p&&i===!0,unavailable:l,onRetry:p?j:void 0,onScrollToRow:H}),t.jsx(Te,{room:e,threadRootId:o,attachments:k.attachments,focusOnMount:r},o)]})})})}function ve({count:e}){return e===0?null:t.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[t.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:e===1?"1 reply":`${e} replies`}),t.jsx("span",{className:"bg-border h-px flex-1"})]})}const ln=96,un=500;function cn(e){return e.offset.x>ln||e.velocity.x>un}function fn({children:e,onClose:o}){const r=lt()===!0,u=r?{x:0}:{x:"100%"};return t.jsx(ut.div,{"data-testid":"room-thread-sheet",className:"bg-card absolute inset-0 z-10 flex flex-col shadow-xl",initial:u,animate:{x:0},exit:u,transition:r?{duration:0}:{duration:.22,ease:[.32,.72,0,1]},drag:"x",dragDirectionLock:!0,dragConstraints:{left:0,right:0},dragElastic:{left:0,right:.9},dragMomentum:!1,onDragEnd:(v,i)=>{cn(i)&&o()},children:e})}const te="room-thread-split",mn=320,hn=360,pn=40,gn=50,xn=25;function ye(e,o){return o<=0?xn:Math.min(Math.round(e/o*1e3)/10,gn)}function Rn(e){const o=ye(mn,e),r=Math.round((100-ye(hn,e))*10)/10;return{minPct:o,maxPct:r,defaultPct:Math.min(Math.max(pn,o),r)}}function vn(e,o,r){if(e===null||o===null||o<=0)return r.defaultPct;const u=e/o*100;return Math.round(Math.min(Math.max(u,r.minPct),r.maxPct)*10)/10}function yn(e){try{const o=localStorage.getItem(e),r=o===null?NaN:Number(o);return Number.isFinite(r)&&r>0?r:null}catch{return null}}function bn(e,o){try{localStorage.setItem(e,String(Math.round(o)))}catch{}}const jn="react-resizable-panels:room-thread-split";function wn(){try{localStorage.removeItem(jn)}catch{}}function kn(){const[e,o]=n.useState(null),[r,u]=n.useState(null);return{ref:n.useCallback(i=>{if(i===null)return;o(i);const l=()=>u(i.offsetWidth);l();const j=new ResizeObserver(l);return j.observe(i),()=>{j.disconnect(),o(null),u(null)}},[]),element:e,width:r,sizing:Rn(r??0)}}const In=`${te}-room`,be=`${te}-thread`,je=`${te}-handle`,An=4;function Nn({room:e,thread:o,storageKey:r=ft.ROOM_THREAD_WIDTH}){const{ref:u,element:v,width:i,sizing:l}=kn(),[j,R]=n.useState(()=>yn(r)),[x,g]=n.useState(null),p=n.useRef(null),y=vn(j,i,l),w=i===null||(l.maxPct-l.minPct)/100*i<An,k=o!==!1;n.useEffect(wn,[]);const I=n.useRef(!1);n.useLayoutEffect(()=>{var f;I.current&&((f=p.current)==null||f.resize(y))},[y,k]);const b=n.useRef(null),N=()=>{var A;const f=(A=p.current)==null?void 0:A.getSize(),C=b.current;if(b.current=null,f===void 0||i===null||i<=0||C===f)return;const O=Math.round(f/100*i);R(O),bn(r,O)},d=x??y;return n.useLayoutEffect(()=>{const f=v==null?void 0:v.querySelector(`[data-panel-resize-handle-id="${je}"]`);f&&(f.setAttribute("aria-controls",be),f.setAttribute("aria-valuenow",String(Math.round(d))),f.setAttribute("aria-valuemin",String(Math.round(l.minPct))),f.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),t.jsx("div",{ref:u,className:"h-full overflow-hidden",children:t.jsxs(ct,{direction:"horizontal",id:te,onLayout:f=>{I.current=f.length>1,g(I.current?f[1]:null)},children:[t.jsx(pe,{id:In,order:1,className:"flex",children:e}),k&&t.jsxs(t.Fragment,{children:[t.jsx(vt,{id:je,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:w,onDragging:f=>{var C;f&&(b.current=((C=p.current)==null?void 0:C.getSize())??null)},onKeyDownCapture:f=>{var C,O;w||(b.current=((C=p.current)==null?void 0:C.getSize())??null,!(f.key!=="Home"&&f.key!=="End")&&(f.preventDefault(),(O=p.current)==null||O.resize(f.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),t.jsx(pe,{ref:p,id:be,order:2,defaultSize:y,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:o})]})]})})}function Fn({roomId:e,threadId:o,entrySeq:r,threadRoute:u,aboveTimeline:v,aboveComposer:i,offerJumpBackIn:l,onComposerFocusChange:j}){const R=mt(),x=yt(),g=ht(e),p=g==null?void 0:g.rootEntryId,y=Vt(),w=n.useCallback(()=>{var a;const m=(a=U.getState().open[e])==null?void 0:a.rootEntryId;U.getState().closeThread(e),m!==void 0&&y.arm(m)},[e,y]),k=n.useCallback(m=>{U.getState().openThread(e,m)},[e]),I=pt(e),b=gt(e),N=wt(e,b.isSuccess);kt(e);const d=I.data,f=n.useMemo(()=>b.data??[],[b.data]),C=Me({room:d});Zt({roomId:e,route:u,urlThreadId:o,openThreadId:p,entries:f,historyLoaded:b.isSuccess});const O=n.useMemo(()=>{var m;return((m=d==null?void 0:d.members.find(a=>a.author.id===d.viewerAuthorId))==null?void 0:m.lastReadSeq)??null},[d]),A=Xt(e,O);xt(d,f);const z=n.useRef(null),S=n.useRef(void 0),M=n.useCallback(m=>{S.current=m},[]),_=n.useCallback(()=>S.current,[]);n.useLayoutEffect(()=>{S.current=void 0},[e]);const B=n.useCallback(m=>{var a;(a=z.current)==null||a.scrollToRow(m)},[]),P=qt(e),{loadOlder:D,cursor:q}=P,H=n.useCallback(()=>{const m=Ct(f,q);D().then(()=>{m!==null&&requestAnimationFrame(()=>{var a;return(a=z.current)==null?void 0:a.scrollToRow(m.domId)})})},[f,q,D]),L=Ut({roomId:e,entrySeq:r,entries:f,historyLoaded:b.isSuccess}),K=n.useMemo(()=>p===void 0?void 0:{replyIds:new Set(f.filter(a=>ce(a)===p).map(a=>a.id)),inside:!1},[f,p]);if(I.isLoading)return t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(Ee,{})});if(I.isError||!d)return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),t.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const F=g!==void 0&&t.jsx(dn,{room:d,rootEntryId:g.rootEntryId,focusComposer:g.focusComposer,entries:f,reactionFrequents:d.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:b.isSuccess,historyFailed:b.isError,...L.threadRow===void 0?{}:{landOnRow:L.threadRow},pushed:R,onClose:w},g.rootEntryId),W=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[v,t.jsx(Gt,{ref:z,roomId:d.id,roomKind:d.kind,roomName:Y(d),viewerAuthorId:d.viewerAuthorId,entries:f,members:d.members,formerAuthors:d.formerAuthors,lastReadSeq:A,reactionFrequents:d.reactionFrequents,streamStalled:N.stalled,isLoading:b.isLoading,error:b.error,onAddAgents:()=>ge("add",d.id),openThreadId:p,onOpenThread:k,resumeRow:_,...L.roomRow===void 0?{}:{landOnRow:L.roomRow},onTopRow:M,canLoadOlder:P.canLoadOlder,isLoadingOlder:P.isLoadingOlder,onLoadOlder:H}),i,t.jsx(tn,{roomId:d.id}),t.jsx(nn,{roomId:d.id}),t.jsx(Pe,{room:d,entries:f,scope:K,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:B}),t.jsx(en,{room:d,hasEntries:f.length>0,onAddAgents:()=>ge("add",d.id)}),t.jsx(Te,{room:d,attachments:C.attachments,offerJumpBackIn:l,onFocusChange:j},d.id)]}),$={surface:"room",capabilities:fe,target:C.target,anchor:"rail"};return R?t.jsx(X.Root,{...$,children:t.jsx("div",{style:{paddingBottom:x},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",inert:F!==!1,"data-testid":"room-under-thread",children:W}),t.jsx(Rt,{initial:!1,children:F!==!1&&t.jsx(fn,{onClose:w,children:F},`thread-${p}`)})]})})}):t.jsx(X.Root,{...$,children:t.jsx(Nn,{room:W,thread:F})})}export{Fn as R,$t as T,Ee as a};
@@ -1 +1 @@
1
- import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-OQuvRZTD.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
1
+ import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-YUtEyz7O.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
@@ -0,0 +1 @@
1
+ import{r as D,e1 as Ee,j as e,Z as ye,_ as we,a2 as Ae,G as C,by as ue,bz as fe,e5 as ke,e6 as ie,a4 as Le,bA as me,bC as xe,a5 as De,a7 as Te,a8 as Oe,af as pe,aO as $e,e7 as he,e8 as Ie,e9 as Pe,ea as _e,aa as N,eb as Ue,ec as R,ed as Me,ao as be,B as Re,U as Be,b as He,e as ze,ee as Ke,ef as qe,eg as Qe,eh as Ve,ei as Fe,ej as Ge}from"./index-YUtEyz7O.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as L}from"./execution-config-BjLHHc9x.js";import{U as Ze}from"./unverified-catalog-notice-BqIWxQuN.js";import{s as Je}from"./settings-for-runtime-BoOa-ZFG.js";const et={duration:.12,ease:"easeOut"};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=D.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,v=Ee(),p=e.jsx(ye,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:v?{duration:0}:et,className:"block truncate",children:o},o)});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx(ke,{size:"sm",icon:r?Le:void 0,iconClassName:r?ie.warning:void 0,"aria-label":`Set here${r?`: ${r}`:""}`,title:r?`${o}: ${r}`:o,className:s,"data-testid":d,children:p})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:C("px-2 pt-1 text-xs",ie.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):e.jsx(Ae,{size:"xs",tone:r?"warning":"neutral",title:r?`${o}: ${r}`:o,"aria-label":r?`${o}: ${r}`:void 0,className:C("max-w-56",s),"data-testid":d,children:p})}const tt=["agents"];function st(a){const l=De(),i=Te();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:tt})}})}const je="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function U({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:v=!0,className:p,describedBy:m,inheritText:T}){const w=pe(),[S,h]=D.useState(!1);return e.jsxs("div",{className:C("space-y-1",p),children:[v&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:C("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Be,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:C("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:T??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function at({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,oe,le,re,de;const r=pe(),{data:s}=$e(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:v}=Ie(),p=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,k;return((k=(b=v==null?void 0:v.defaults)==null?void 0:b[t])==null?void 0:k.runsOn)==="credits"}}),{data:m,isError:T}=Pe({runtime:o,...p?{account:N}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=p&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,A=a.model??h??(E==null?void 0:E.value)??null,B=o==="doe"&&c&&!w&&!h,x=A?(m??[]).find(t=>t.value===A):void 0,O=(n==null?void 0:n.supportsEffort)??((ae=Je(d,o))==null?void 0:ae.supportsEffort),H=O===void 0&&u,z=O!==!1,K=x?x.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:Q,creditsEntry:ge,resolvedAccount:V}=_e(),F=ge??(a.account===N&&((oe=s==null?void 0:s.claudeCode)!=null&&oe.credits)?{path:s.claudeCode.credits.path}:null),j=q&&[...q.flatMap(t=>t.id===null?[]:[{id:t.id,label:Q(t.path),path:t.path}]),...F?[{id:N,label:Ue,path:F.path}]:[]],g=a.account??null,G=g!==null,W=o==="claude-code"&&g===N&&((le=s==null?void 0:s.claudeCode)==null?void 0:le.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),$=s!=null&&s.claudeCode&&V?Q(V):null,I=st({errorLabel:"Couldn’t change this agent’s account"}),P=D.useCallback(t=>{I.mutate({id:a.id,updates:{account:t}})},[a.id,I]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:j,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:O,runtimeLabel:t=>R(t).label}),y=t=>{var b;return((b=Ne.breakages.find(k=>t.includes(k.kind)))==null?void 0:b.message)??null},_=!H&&z&&K!==!1,X=a.effort??(n==null?void 0:n.effort)??null,Y=R(o).label,Ce=o==="claude-code"&&j!==void 0&&(j.length>1||G),Se=y(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=D.useId();return e.jsxs("div",{className:C("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(U,{label:"Model",valueLabel:B?ce:(x==null?void 0:x.displayName)??A??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:A,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:y(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:B?ce:c&&!h?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Ze,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),p&&T&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:"Effort"}),(!r||!_)&&(S||_)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?L(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),H?e.jsx(M,{testId:"agent-effort-pending",text:`Checking what ${Y} supports`,warning:null}):z?_?e.jsx(U,{label:"Effort",valueLabel:L(X),options:Me.filter(t=>!(x!=null&&x.supportedEffortLevels)||x.supportedEffortLevels.includes(t)).map(t=>({value:t,label:L(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?L(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(M,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(M,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${Y}`,warning:y(["effort-unsupported-runtime"])})]}),Ce&&e.jsx(U,{label:"Account",valueLabel:W?$??"Default":g!==null?((de=j==null?void 0:j.find(t=>t.id===g))==null?void 0:de.label)??g:$??"Default",options:(j??[]).map(t=>({value:t.id,label:t.label,hint:t.id===N?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:G,serverDefault:$,warning:Se,onSelect:t=>P(t),onInherit:()=>P(null),testId:"agent-account-row",className:"col-span-full"}),W&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx(Re,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:I.isPending,onClick:()=>P(N),children:"Allow"})]})]})}function M({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const nt="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function ct({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(ze,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:nt,children:"Runs on"}),e.jsxs(Ke,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(qe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Qe,{})}),e.jsx(Ve,{children:f.map(o=>e.jsx(Fe,{value:o,responsive:!1,children:R(o).label},o))})]})]}),e.jsx(at,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ge,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{ct as RunsOnPopover};
@@ -0,0 +1 @@
1
+ import{aO as Ee,a5 as S,a7 as T,r as u,a8 as I,jO as q,jP as M,ea as Be,jQ as Ge,a6 as Q,j as e,jR as We,eo as Ye,ep as V,Q as we,T as Re,V as Ie,B as O,hU as Ve,G as H,eN as He,e8 as Je,jS as Ze,jT as Xe,e1 as Le,_ as te,x as de,Z as es,J as ue,ec as me,el as C,em as ne,aJ as ss,jU as ts,I as U,jV as ns,jW as Ae,jX as rs,a2 as Ke,fy as as,ee as is,ef as os,eg as ls,eh as cs,ei as Se,e4 as ds,C as us,jY as ms,jZ as xs,j_ as hs,U as fs}from"./index-YUtEyz7O.js";import{C as De}from"./copy-button-ByA00JGh.js";import{I as gs}from"./inline-code-BL-6EKVP.js";import{u as ps}from"./useMutationState-Rlga1GBT.js";import{O as ys,a as Y}from"./runtime-connect-Dn0T5YWv.js";function js(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function Ot(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Pt(s){var d,m;const t=S(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:()=>(a(null),t.provisionRuntime(s,x=>a(x))),onSuccess:x=>{x.ok&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((d=r.data)==null?void 0:d.ok)===!1,o=r.isError?r.error.message:((m=r.data)==null?void 0:m.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Te(s){return["runtime-key-status",s]}function vs(s,t=!0){const n=S();return Q({queryKey:Te(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function ks(s){const t=S(),n=I({mutationFn:a=>t.checkRuntimeCredential(s,a.trim().length>0?a:null),meta:{suppressErrorToast:!0}}),i=n.data??(n.isError?{ok:!1,reason:"unexpected",message:n.error.message||"Couldn’t check the key."}:null);return{check:a=>n.mutate(a),isPending:n.isPending,result:i,checkedSavedKey:i!==null&&(n.variables??"").trim().length===0,reset:n.reset}}function Ns(s){var o,c,d;const t=S(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:async m=>{a("checking");const x=await t.checkRuntimeCredential(s,m);return x.ok?(a("saving"),await t.storeRuntimeCredential(s,m),{saved:!0,message:null}):{saved:!1,message:x.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:m=>{m.saved&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Te(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:m=>{m.trim().length!==0&&r.mutate(m)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((d=r.data)==null?void 0:d.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const be=new WeakMap;function Ss(s){const t=be.get(s);if(t)return t;const n=new Set;return be.set(s,n),n}function bs(s,t){var E,K,L,b,v;const n=S(),i=T(),{sessionId:a,accountRoot:r,accountId:l,onCompleted:o}=t??{},c=Be(),d=l??(r?((E=c.accounts.find(N=>N.path===r))==null?void 0:E.id)??(c.ownResolvedAccount===r?"default":void 0):a?void 0:"default"),m=u.useMemo(()=>["runtime-login",s,a??"",d??r??""],[s,a,d,r]),x=I({mutationKey:m,mutationFn:()=>{if(s==="claude-code"&&r&&!d&&!a)throw new Error("Choose this account in Runtimes.");return n.delegateRuntimeLogin(s,s==="claude-code"?{sessionId:a,accountId:d}:a?{sessionId:a}:void 0)},onSuccess:N=>{i.invalidateQueries({queryKey:["claude-signin-policy"]}),N.ok&&(i.invalidateQueries({queryKey:Ge.all}),i.invalidateQueries({queryKey:[...q]}),i.invalidateQueries({queryKey:[...M]}))}}),p=ps({filters:{mutationKey:m,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),y=p.some(N=>N.state.status==="pending"),f=p[p.length-1],h=y||f==null?void 0:f.state,k=y||f==null?void 0:f.id,w=!y&&((h==null?void 0:h.status)==="error"||((K=h==null?void 0:h.data)==null?void 0:K.ok)===!1),F=(h==null?void 0:h.status)==="error"?((L=h.error)==null?void 0:L.message)??null:((b=h==null?void 0:h.data)==null?void 0:b.error)??null,R=((v=h==null?void 0:h.data)==null?void 0:v.ok)===!0,P=u.useRef(o);return P.current=o,u.useEffect(()=>{var $;if(!R||k===void 0)return;const N=Ss(i);N.has(k)||(N.add(k),($=P.current)==null||$.call(P))},[R,k,i]),{login:()=>{y||x.mutate()},isPending:y,isSuccess:R,isError:w,errorMessage:w?F??"Couldn’t sign in. Try again.":null}}const Ce={"claude-code":{signInLabel:"Sign in",otherWayLabel:"Sign in with Claude",signInHint:"Use your Claude subscription or Anthropic account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"Anthropic API key",keyPlaceholder:"sk-ant-…",getKeyUrl:"https://console.anthropic.com/settings/keys"},codex:{signInLabel:"Sign in with ChatGPT",otherWayLabel:"Sign in with ChatGPT",signInHint:"Use your ChatGPT account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"OpenAI API key",keyPlaceholder:"sk-…",getKeyUrl:"https://platform.openai.com/api-keys"}};function Cs(s){return Ce[s]??Ce["claude-code"]}function Os({command:s,infoUrl:t,copyLabel:n}){return!s&&!t?null:e.jsxs("div",{className:"space-y-2",children:[s&&e.jsxs("div",{className:"bg-muted flex items-center justify-between gap-2 rounded-lg px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(We,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(De,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(Ye,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(V,{className:"size-3"})]})]})}function Et({command:s,runtimeLabel:t}){const[n,i]=u.useState(!1);return e.jsxs(we,{open:n,onOpenChange:i,className:"mt-2",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["DorkOS installs ",t," for you."," ",e.jsx(Re,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Ie,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(gs,{children:s}),e.jsx(De,{value:s,label:`Copy command: ${s}`,className:"shrink-0"})]})]})}function Oe({onRetry:s}){return e.jsxs("div",{"data-testid":"remote-signin-notice",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Signing in needs the computer DorkOS runs on."}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s?"Sign in to DorkOS there, then press Retry.":"Sign in to DorkOS there."}),e.jsx("p",{className:"text-muted-foreground/80 mt-2 text-xs",children:"Already on that computer? Open DorkOS at localhost instead."}),s&&e.jsxs(O,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ve,{className:"size-3"}),"Retry"]})]})}function Ps({ollama:s=!1,remote:t=!1,className:n}){return e.jsxs("p",{className:H("text-muted-foreground text-xs",n),"data-testid":"keep-it-local-note",children:[t?"Prefer everything on the computer DorkOS runs on? Use your own sign-in there":"Prefer to keep everything on this computer? Use your own sign-in",s?", or Ollama":"","."]})}function Es(s){const t=He(),{data:n}=Je();return s?Ze(Xe(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",ws={title:xe,body:`Frontier models are unlocked. ${he}`},Rs={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Me(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function Is(s){return{title:`${s} is ready`,body:`New work on ${s} runs on your DorkOS credits. Change it any time in Settings › Runtimes.`}}function A({message:s}){const t=Le();return e.jsxs(te.div,{role:"status",className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:t?!1:{opacity:0},animate:{opacity:1},"data-testid":"connect-progress",children:[e.jsx(de,{size:"xs",className:H("text-muted-foreground shrink-0",t&&"animate-none")}),e.jsx(es,{mode:"wait",children:e.jsx(te.span,{className:"truncate text-xs",initial:t?!1:{opacity:0},animate:{opacity:1},exit:t?void 0:{opacity:0},transition:{duration:.2},children:s},s)})]})}function z({message:s="Connected"}){return e.jsxs("div",{role:"status",className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"connect-connected",children:[e.jsx(ue,{className:"size-3.5"}),s]})}function B({message:s,onRetry:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:s}),e.jsx(O,{size:"sm",onClick:t,children:"Try again"})]})}function Ls({type:s,onConnected:t,asOtherWay:n=!1}){const i=Cs(s),a=bs(s),[r,l]=u.useState(!1),o=u.useRef(!1);return u.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Me(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(z,{message:"Signed in"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(O,{size:"sm",variant:n?"outline":"default",className:"w-full",onClick:a.login,children:n?i.otherWayLabel:i.signInLabel}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i.signInHint})]})}),r?e.jsxs("div",{className:"space-y-3","data-testid":`login-connect-key-${s}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),e.jsx(As,{type:s,copy:i,onConnected:t}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Back to sign in"})]}):n?e.jsx(O,{size:"sm",variant:"outline",className:"w-full",onClick:()=>l(!0),"data-testid":`login-connect-use-key-${s}`,children:"Paste a key"}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors","data-testid":`login-connect-use-key-${s}`,children:"Use an API key instead"})]})}function As({type:s,copy:t,onConnected:n}){var f,h;const[i,a]=u.useState(""),r=Ns(s),l=vs(s),o=ks(s),c=u.useRef(!1),d=u.useRef(null);if(u.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Me(me(s).label)))},[r.isSuccess,n,s]),u.useEffect(()=>{var k;r.isError&&((k=d.current)==null||k.focus())},[r.isError]),r.isSuccess)return e.jsx(z,{});const m=(f=l.data)!=null&&f.key.saved?l.data.key:null,x=i.trim().length>0,p=r.isPending||o.isPending,y=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:k=>{k.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(C,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:d,value:i,disabled:p,onChange:k=>{a(k.target.value),y()},placeholder:m?`Saved key ends in ${m.last4}. Paste to replace.`:t.keyPlaceholder,autoComplete:"off",spellCheck:!1}),r.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:r.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.getKeyUrl?e.jsxs("a",{href:t.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(V,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"ghost",disabled:!x&&m===null||p,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:!x||p,children:"Save key"})]})]}),p?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((h=o.result)==null?void 0:h.ok)===!0?e.jsx(z,{message:o.checkedSavedKey?"Your saved key works":"Key works"}):o.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o.result.message}):null]})}function Ks(s){const t=S(),n=Q({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference()});return n.isPending?e.jsx(de,{"aria-label":"Loading model settings"}):n.isError?e.jsx("p",{role:"alert",children:"Couldn’t load model settings. Try again."}):e.jsx(Ds,{saved:n.data,...s},JSON.stringify(n.data))}function Ds({saved:s,onConnected:t,onSave:n}){var D,Z,W,X,j,_,fe,ge,pe,ye,je,ve;const i=S(),a=T(),r=u.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=u.useState(n&&l==="dorkos-credits"?"api-key":l),[d,m]=u.useState(((Z=s.inference)==null?void 0:Z.protocol)??"openai-chat-completions"),[x,p]=u.useState(((W=s.inference)==null?void 0:W.endpoint)??""),[y,f]=u.useState(((X=s.inference)==null?void 0:X.provider)??""),[h,k]=u.useState(((j=s.inference)==null?void 0:j.model)??""),[w,F]=u.useState(String(((_=s.inference)==null?void 0:_.contextWindow)??8192)),[R,P]=u.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[E,K]=u.useState(""),[L,b]=u.useState(null),v=Q({queryKey:["doe-credits-models",d],queryFn:()=>i.getDoeCreditsModels(d),enabled:o==="dorkos-credits"}),N=o==="dorkos-credits"?(ge=v.data)==null?void 0:ge.models.find(g=>g.id===h):void 0,$=s.hasKey&&((pe=s.inference)==null?void 0:pe.endpoint)===x&&s.inference.source==="api-key",J=I({mutationFn:async g=>{if(n)return n(g,E.trim()||null);o==="api-key"&&E.trim()?await i.storeDoeCredential(g,E.trim()):await i.setDoeInference(g),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{K("");for(const g of[["doe-inference"],q,M,ss.all,ts.status()])a.invalidateQueries({queryKey:g});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:g=>b(n&&g instanceof Error&&g.message?g.message:"Couldn’t save model settings. Try again.")});function re(g){var ke,Ne;if(g.preventDefault(),b(null),E.trim().startsWith("sk-ant-oat")){b("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!E.trim()&&!$){b("Enter an API key.");return}if(o==="dorkos-credits"&&(!N||!((ke=v.data)!=null&&ke.endpoint))){b("Link DorkOS credits and choose an available model.");return}const ae=ns.safeParse({source:o,protocol:d,provider:o==="dorkos-credits"?"dorkos":y,endpoint:o==="dorkos-credits"?(Ne=v.data)==null?void 0:Ne.endpoint:x,model:h,contextWindow:(N==null?void 0:N.contextWindow)??Number(w),maxOutputTokens:(N==null?void 0:N.maxOutputTokens)??Number(R)});if(!ae.success){b("Check the model, endpoint, and token limits.");return}J.mutate(ae.data)}const G="bg-background border-input focus-visible:ring-ring h-11 w-full rounded-md md:h-9 border px-3 text-sm focus-visible:ring-2";return e.jsxs("form",{onSubmit:re,className:"space-y-3","aria-label":"DorkOS model settings",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:G,value:o,onChange:g=>{c(g.target.value),k("")},children:[e.jsx("option",{value:"api-key",children:"My API key"}),e.jsx("option",{value:"local",children:"Local model"}),!n&&e.jsx("option",{value:"dorkos-credits",children:"DorkOS credits"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:G,value:d,onChange:g=>{m(g.target.value),o==="dorkos-credits"&&k("")},children:[e.jsx("option",{value:"openai-chat-completions",children:"OpenAI Chat Completions"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"})]})]}),o==="dorkos-credits"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:G,value:h,onChange:g=>k(g.target.value),disabled:v.isPending||!((ye=v.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=v.data)==null?void 0:je.models.map(g=>e.jsx("option",{value:g.id,children:g.displayName},g.id))]}),!((ve=v.data)!=null&&ve.endpoint)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link DorkOS credits in Settings to choose a model."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(U,{id:`${r}-service`,value:y,onChange:g=>f(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(U,{id:`${r}-endpoint`,type:"url",value:x,onChange:g=>p(g.target.value),required:!0}),o==="local"&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Use a loopback address. No API key is needed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(U,{id:`${r}-model`,value:h,onChange:g=>k(g.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(U,{id:`${r}-context`,type:"number",min:1,value:w,onChange:g=>F(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(U,{id:`${r}-output`,type:"number",min:1,value:R,onChange:g=>P(g.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:E,onChange:g=>K(g.target.value),autoComplete:"off"}),$&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"API key saved. Leave blank to keep it."})]})]}),L&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:L}),e.jsx(O,{type:"submit",disabled:J.isPending,children:J.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ts={openai:"OpenAI",anthropic:"Anthropic"};function Ms(s){return Ts[s]??s}function qs(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ms(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function Fs(s){const t=S();return Q({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function _s(){const s=S(),t=T(),n=I({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]})}});return{connect:i=>n.mutate(i),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,errorMessage:n.isError?n.error.message??"Couldn’t connect to Ollama.":null}}const _e=["runtime-connect","opencode","direct"];function $s(){const s=S();return Q({queryKey:_e,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function Us(){var i;const s=S(),t=I({mutationFn:({providerId:a,key:r,baseURL:l})=>s.checkProviderCredential(a,r.trim().length>0?r:null,(l==null?void 0:l.trim())||null),meta:{suppressErrorToast:!0}}),n=t.data??(t.isError?{ok:!1,reason:"unexpected",message:t.error.message||"Couldn’t check the key."}:null);return{check:a=>t.mutate(a),isPending:t.isPending,result:n,checkedSavedKey:n!==null&&(((i=t.variables)==null?void 0:i.key)??"").trim().length===0,reset:t.reset}}function zs(){var l,o,c;const s=S(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async({providerId:d,key:m,baseURL:x})=>{const p=(x==null?void 0:x.trim())||null;i("checking");const y=await s.checkProviderCredential(d,m.trim().length>0?m:null,p);return y.ok?(i("saving"),await s.storeProviderCredential(d,m,p),{saved:!0,message:null}):{saved:!1,message:y.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[..._e]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:d=>{d.providerId.trim().length!==0&&a.mutate(d)},isPending:a.isPending,phase:n,isSuccess:((o=a.data)==null?void 0:o.saved)===!0,isError:a.isError||r,errorMessage:r?((c=a.data)==null?void 0:c.message)??null:a.isError?a.error.message??"Couldn’t save your key.":null,reset:a.reset}}function Qs(s){const t=S();return Q({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Bs(){var o,c;const s=S(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async d=>{i(null);const m=await s.pullOllamaModel(d,x=>i(x));return m.ok&&await s.updateConfig({runtimes:{opencode:{provider:qe}}}),m},onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{pull:d=>a.mutate(d),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Gs(){var o,c;const s=S(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:()=>(i(null),s.provisionOllama(d=>i(d))),onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{provision:()=>a.mutate(),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t install Ollama.":null,progress:n,result:a.data}}const Ws="https://ollama.com/download",Ys="curl -fsSL https://ollama.com/install.sh | sh";function Vs({installMethod:s}){const t=Gs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Hs,{}),n?e.jsx(Js,{provision:t}):e.jsx(Zs,{}),e.jsx(Xs,{})]})}function Hs(){const s=Ae();return e.jsxs("div",{className:"space-y-1.5","data-testid":"ollama-explainer",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Run AI models on ",s]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Ollama is a free app that runs AI models on ",s,"."]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Nothing you type leaves ",s,"."]})]})}function Js({provision:s}){var t,n,i;return s.isPending?e.jsx(A,{message:((t=s.progress)==null?void 0:t.message)??"Installing Ollama…"}):(n=s.result)!=null&&n.ok?(i=s.result.status)!=null&&i.running?e.jsx(A,{message:"Ollama is ready…"}):e.jsx("p",{className:"text-xs","data-testid":"ollama-installed-not-running",children:"Ollama isn’t running. Open the Ollama app to start it."}):s.isError?e.jsx(B,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(O,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Zs(){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-manual-install",children:[e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Installing Ollama needs administrator access. Run this in a terminal:"}),e.jsx(Os,{command:Ys,copyLabel:"Copy the Ollama install command"})]})}function Xs(){return e.jsxs("a",{href:Ws,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Or download Ollama from ollama.com ",e.jsx(V,{className:"size-3"})]})}const et="https://ollama.com/library",st={"runs-well":{label:"Runs well on your machine",tone:"text-status-success-fg"},"may-be-slow":{label:"May be slow on your machine",tone:"text-status-warning-fg"},"too-large":{label:"Too large for your machine",tone:"text-destructive"}},tt={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function nt({active:s,onConnected:t,onConnectDirectly:n}){var R,P,E,K,L,b;const i=Fs(s),a=_s(),r=Bs(),l=((R=i.data)==null?void 0:R.running)??!1,o=Qs(l),[c,d]=u.useState(null),[m,x]=u.useState(null);u.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),u.useEffect(()=>{var v;(v=r.result)!=null&&v.ok&&(t==null||t(Pe))},[(P=r.result)==null?void 0:P.ok,t]);const p=v=>{d(v),a.connect(v)},y=v=>{x(v),r.pull(v)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Vs,{installMethod:(E=i.data)==null?void 0:E.installMethod});if(a.isSuccess)return t?null:e.jsx(z,{message:"Connected to Ollama"});if((K=r.result)!=null&&K.ok)return t?null:e.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"guided-pull-connected",children:[e.jsx(ue,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Connected:"}),e.jsx(rs,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const f=i.data,h=(f==null?void 0:f.installed)??[],k=((L=f==null?void 0:f.installed)==null?void 0:L.length)??(f==null?void 0:f.models.length)??0,w=((b=o.data)==null?void 0:b.models.some(v=>v.model.id===m))??!1,F=m!==null&&!w?m:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(rt,{count:k}),h.length>0&&e.jsx(at,{installed:h,connect:a,connectingId:c,onUse:p}),e.jsx(it,{catalogQuery:o,pull:r,pullingId:m,onGet:y}),e.jsx(ot,{pull:r,activePull:F,onSubmit:y}),e.jsx(lt,{}),n&&e.jsxs("button",{type:"button",onClick:n,"data-testid":"local-connect-directly",className:"focus-ring text-muted-foreground hover:text-foreground block rounded-md text-left text-xs transition-colors",children:["Using LM Studio or another server? ",e.jsx("span",{className:"underline",children:"Connect it directly"})]})]})}function rt({count:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-xs","data-testid":"ollama-status-line",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-emerald-500","aria-hidden":!0}),e.jsxs("span",{children:["Ollama is running · ",s," ",s===1?"model":"models"," installed"]})]})}function $e({verdict:s,explanation:t}){const n=st[s];return e.jsxs("div",{"data-testid":"ollama-verdict","data-verdict":s,children:[e.jsx("p",{className:H("text-xs font-medium",n.tone),children:n.label}),e.jsx("p",{className:"text-muted-foreground/80 text-2xs leading-snug",children:t})]})}function Ue({tier:s}){return e.jsx(Ke,{size:"xs",variant:"outline",className:"font-normal",children:tt[s]})}function at({installed:s,connect:t,connectingId:n,onUse:i}){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-installed",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Installed"}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>{const r=n===a.id&&t.isPending,l=n===a.id&&t.isError,o=()=>i(a.id);let c=e.jsx(O,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(B,{message:t.errorMessage??"Couldn’t connect to Ollama.",onRetry:o})),e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"ollama-installed-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:a.id}),a.assessment.model.tier&&e.jsx(Ue,{tier:a.assessment.model.tier})]}),e.jsx($e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function it({catalogQuery:s,pull:t,pullingId:n,onGet:i}){var r;if(s.isPending)return e.jsx(A,{message:"Checking which models fit your machine…"});const a=((r=s.data)==null?void 0:r.models)??[];return s.isError||a.length===0?null:e.jsxs("div",{className:"space-y-2","data-testid":"ollama-shelf",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add a model"}),e.jsx("ul",{className:"space-y-1.5",children:a.map(({model:l,verdict:o,explanation:c})=>{const d=n===l.id,m=()=>i(l.id);return d&&(t.isPending||t.isError)?e.jsxs("li",{className:"border-border rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:l.label}),t.isPending?e.jsx(ze,{progress:t.progress}):e.jsx(B,{message:t.errorMessage??"Couldn’t download the model.",onRetry:m})]},l.id):e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:l.label}),l.tier&&e.jsx(Ue,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx($e,{verdict:o,explanation:c})]}),e.jsx(O,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:m,children:"Get"})]},l.id)})})]})}function ot({pull:s,activePull:t,onSubmit:n}){const[i,a]=u.useState(""),r=i.trim(),l=ys.test(r);if(t&&s.isPending)return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Downloading ",t,"…"]}),e.jsx(ze,{progress:s.progress})]});const o=c=>{c.preventDefault(),l&&n(r)};return e.jsxs("form",{onSubmit:o,className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"ollama-pull-tag",className:"text-xs font-normal",children:"Download any model by name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{id:"ollama-pull-tag","data-testid":"ollama-pull-by-name",value:i,onChange:c=>a(c.target.value),placeholder:"qwen2.5-coder:32b","aria-invalid":r.length>0&&!l}),e.jsx(O,{type:"submit",size:"sm",disabled:!l||s.isPending,children:"Download"})]}),r.length>0&&!l&&e.jsxs("p",{className:"text-muted-foreground text-2xs",children:["Use a tag like ",e.jsx("code",{className:"text-2xs",children:"qwen2.5-coder:32b"}),"."]}),t&&s.isError&&e.jsx(B,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function lt(){return e.jsxs("a",{href:et,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Browse the library ",e.jsx(V,{className:"size-3"})]})}function ze({progress:s}){const t=Le(),n=s==null?void 0:s.percent,i=(s==null?void 0:s.status)??"Starting download…";return e.jsxs("div",{className:"space-y-2","data-testid":"guided-pull-progress",children:[e.jsx("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:n===void 0?e.jsx(te.div,{className:"bg-primary/70 h-full w-1/3 rounded-full",animate:t?{}:{x:["-100%","300%"]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"}}):e.jsx(te.div,{className:"bg-primary h-full rounded-full",initial:!1,animate:{width:`${Math.min(100,Math.max(0,n))}%`},transition:t?{duration:0}:{duration:.3,ease:"easeOut"},"data-testid":"guided-pull-bar"})}),e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.jsx(de,{size:"xs",className:H("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function ct(){var r,l,o;const s=S(),t=T(),n=I({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))}}),i=n.isError||((r=n.data)==null?void 0:r.ok)===!1,a=n.isError?n.error.message:((l=n.data)==null?void 0:l.error)??null;return{store:c=>{c.trim().length!==0&&n.mutate(c)},isPending:n.isPending,isSuccess:((o=n.data)==null?void 0:o.ok)===!0,isError:i,errorMessage:i?a??"Couldn’t save the OpenRouter key.":null}}function dt(){var p,y;const s=S(),t=T(),[n,i]=u.useState(null),[a,r]=u.useState(null),l=I({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:f,state:h})=>{if(!as(f)){r("Couldn’t open the OpenRouter sign-in page.");return}i(h)},onError:f=>r(f.message??"Couldn’t start OpenRouter sign-in.")}),o=Q({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="pending"?1500:!1},refetchOnWindowFocus:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="error"}}),c=(p=o.data)==null?void 0:p.status;u.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const d=l.isPending||n!==null&&c==="pending",m=!!a||c==="error",x=m?a??((y=o.data)==null?void 0:y.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:d,isSuccess:c==="connected",isError:m,errorMessage:x}}const ut="https://openrouter.ai/keys";function mt({onConnected:s}){const[t,n]=u.useState(""),i=ct(),a=dt(),r=i.isSuccess||a.isSuccess;return u.useEffect(()=>{r&&(s==null||s(ws))},[r,s]),r?e.jsx(z,{message:"Connected to OpenRouter"}):e.jsxs("div",{className:"space-y-4","data-testid":"openrouter-gateway",children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:"Sign in to OpenRouter in the new tab…"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(O,{size:"sm",className:"w-full",onClick:a.begin,children:"Connect OpenRouter"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Makes a limited key for you."})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),i.isPending?e.jsx(A,{message:"Checking your OpenRouter key…"}):e.jsxs("form",{className:"space-y-2",onSubmit:l=>{l.preventDefault(),i.store(t)},children:[e.jsx(C,{htmlFor:"openrouter-key",className:"text-xs",children:"OpenRouter key"}),e.jsx(ne,{id:"openrouter-key",value:t,onChange:l=>n(l.target.value),placeholder:"sk-or-…",autoComplete:"off",spellCheck:!1}),i.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:i.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("a",{href:ut,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an OpenRouter key ",e.jsx(V,{className:"size-3"})]}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function ee(s){return Y.find(t=>t.id===s)}function xt(s){var t;return((t=ee(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=Y.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??Y[0].defaultBaseURL}function Qe(s){return Y.some(t=>t.id===s.providerId)}function ie(s){return Qe(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function ht({onConnected:s}){const t=$s();return t.isError&&!t.data?e.jsx(B,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ft,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ft({setup:s,onConnected:t}){var X;const n=Qe(s)?s:null,[i,a]=u.useState(()=>ie(s)),[r,l]=u.useState(""),[o,c]=u.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=ee(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[d,m]=u.useState(()=>{var _;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==((_=ee(j))==null?void 0:_.defaultBaseURL)}),x=zs(),p=Us(),y=ee(i),f=xt(i),h=n!=null&&n.key.saved&&n.providerId===f?n.key.last4:null,k=o.trim(),w=i===se,F=!w||k.length>0,R=ce(f),P=k||R,E=P===R?"":P,K=n===null?null:n.baseURL??ce(n.providerId),L=f!==((n==null?void 0:n.providerId)??null)||P!==K,b=r.trim().length>0,N=(b||h!==null&&!L)&&F,$=b&&F,J=!b&&h!==null&&L,re=P.startsWith("http://"),G={providerId:f,key:r,baseURL:E},D=x.isPending||p.isPending,Z=u.useRef(null),W=()=>{p.reset(),x.reset()};return u.useEffect(()=>{x.isSuccess&&(t==null||t(Rs))},[x.isSuccess,t]),u.useEffect(()=>{var j;x.isError&&((j=Z.current)==null||j.focus())},[x.isError]),x.isSuccess?e.jsx(z,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),p.reset(),x.connect(G)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(is,{value:i,disabled:D,onValueChange:j=>{var _;a(j),c(((_=ee(j))==null?void 0:_.defaultBaseURL)??""),W()},children:[e.jsx(os,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(ls,{})}),e.jsxs(cs,{children:[Y.map(j=>e.jsx(Se,{value:j.id,children:j.label},j.id)),e.jsx(Se,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(w||d)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!w&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(U,{id:"direct-provider-base-url",value:o,disabled:D,onChange:j=>{c(j.target.value),W()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!w&&!d&&e.jsx("button",{type:"button",onClick:()=>m(!0),disabled:D,"data-testid":"direct-provider-advanced",className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Advanced"}),re&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-insecure",children:"This address isn’t encrypted. Your key travels in the open."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:Z,value:r,disabled:D,onChange:j=>{l(j.target.value),W()},placeholder:h===null?(y==null?void 0:y.keyPlaceholder)??Y[0].keyPlaceholder:`Saved key ends in ${h}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),x.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x.errorMessage}),J&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-repaste",children:"Paste your key again to change the address."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y===void 0?e.jsx("span",{}):e.jsxs("a",{href:y.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(V,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"outline",disabled:!N||D,"data-testid":"direct-provider-test",onClick:()=>{x.reset(),p.reset(),p.check(G)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",disabled:!$||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:x.phase==="saving"?"Saving…":"Checking your key…"}):((X=p.result)==null?void 0:X.ok)===!0?e.jsx(z,{message:p.checkedSavedKey?"Your saved key works":"Key works"}):p.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:p.result.message}):null]})}function gt({currentProvider:s,onConnected:t}){const[n,i]=u.useState("choose"),a=pt();if(n==="choose")return e.jsx(yt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(mt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(nt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(ht,{onConnected:t})})}function pt(){return{cloud:{step:"cloud",title:"Best models, zero setup",description:"Claude, GPT, Gemini and 300+ more, in the cloud.",sub:"One OpenRouter account covers them all. Pay for what you use.",tradeOff:"Your prompts and code are sent to the model’s provider.",recommended:!0},local:{step:"local",title:"Private and free, on your computer",description:`Models run on ${Ae()}. Nothing you type ever leaves it.`,sub:"Runs Quick helpers and Solid coders. Frontier models stay cloud-only.",tradeOff:"Smaller models: good for edits and quick help."},direct:{step:"direct",title:"Use your own API key",stepTitle:"Your own API key",description:"Anthropic, OpenAI, or any OpenAI-compatible server, like LM Studio.",sub:"",quiet:!0}}}function yt({sources:s,onChoose:t,currentProvider:n}){return e.jsxs("div",{className:"space-y-2","data-testid":"opencode-power-sources",children:[n&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"opencode-current-source",children:["Currently: ",qs(n)]}),Object.values(s).map(i=>e.jsx(jt,{source:i,onChoose:t},i.step))]})}function jt({source:s,onChoose:t}){return e.jsxs("button",{type:"button",onClick:()=>t(s.step),"data-testid":`power-source-${s.step}`,className:H("card-interactive focus-ring group flex w-full items-start gap-3 rounded-lg border p-3 text-left",s.recommended?"border-primary/40 bg-card shadow-soft":"border-border bg-card shadow-soft",s.quiet&&"shadow-none"),children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.title}),s.recommended&&e.jsx(Ke,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(us,{className:"text-muted-foreground/60 mt-0.5 size-4 shrink-0"})]})}function oe({source:s,onBack:t,children:n}){const i=!!(s.sub||s.tradeOff);return e.jsxs("div",{className:"space-y-3","data-testid":"opencode-connect-step",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:t,className:"focus-ring text-muted-foreground hover:text-foreground -ml-1 inline-flex items-center gap-1 rounded-md px-1 py-0.5 text-xs transition-colors","data-testid":"connect-step-back",children:[e.jsx(ds,{className:"size-3.5"}),"Back"]}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{className:"text-sm font-medium",children:s.stepTitle??s.title})]}),i&&e.jsxs("div",{className:"space-y-1","data-testid":"connect-step-details",children:[s.sub&&e.jsx("p",{className:"text-muted-foreground/80 text-xs",children:s.sub}),s.tradeOff&&e.jsxs("p",{className:"text-muted-foreground/70 text-2xs leading-snug",children:[e.jsx("span",{className:"font-medium",children:"Trade-off:"})," ",s.tradeOff]})]}),n]})}function vt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=js(),r=Es(s),l=ms(),o=xs(),c=hs([s]);if(s==="doe")return a?e.jsx(Ks,{onConnected:i}):e.jsx(Oe,{});const d=r==="lead"&&l!==null,m=a?t.kind==="provider-picker"?e.jsx(gt,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Ls,{type:s,onConnected:i,asOtherWay:d}):null:e.jsx(Oe,{});if(m===null)return null;const x=me(s).label,p=t.kind==="provider-picker";if(r==="on-credits")return e.jsxs("div",{className:"space-y-3","data-testid":`credits-ready-${s}`,children:[e.jsxs("div",{role:"status",children:[e.jsxs("p",{className:"text-status-success-fg flex items-center gap-1.5 text-sm font-medium",children:[e.jsx(ue,{className:"size-3.5","aria-hidden":!0}),"You’re ready"]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["New work on ",x," runs on your DorkOS credits.",c.map(f=>` ${f}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:m})]});const y=f=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:f,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Is(x))}});return d?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[y(!0),e.jsx(le,{children:m}),e.jsx(Ps,{ollama:p,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[m,e.jsx(le,{children:y(!1)})]}):m}function le({collapsed:s=!1,children:t}){const[n,i]=u.useState(!s);return s?e.jsxs(we,{open:n,onOpenChange:i,children:[e.jsxs(Re,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(fs,{className:H("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Ie,{className:"mt-3",children:t})]}):e.jsxs("section",{className:"space-y-2","aria-label":"Other ways",children:[e.jsx("p",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:"Other ways"}),t]})}const wt=s=>e.jsx(vt,{...s});export{Et as C,Os as D,Ps as K,Oe as R,bs as a,js as b,Ot as c,qs as d,Es as e,Ks as f,Cs as g,wt as r,Pt as u};
@@ -0,0 +1 @@
1
+ import{r as l,br as Y,eE as U,eF as G,j as e,eG as W,eH as J,bq as Q,bo as C,bn as z,eI as V,bp as Z,eJ as X,eK as q,eL as ee,bw as te,eM as ne,aK as se,ab as re,eN as ae,e7 as oe,eO as A,cY as ie,cZ as ce,c$ as le,d0 as de,d1 as ue,eA as fe,ec as y,J as E,B as S,e1 as M,eP as me,G as D,Q as xe,T as pe,U as ve,V as he,bW as ge,_ as I,x as Ce,Z as be}from"./index-YUtEyz7O.js";import{I as je}from"./inline-code-BL-6EKVP.js";import{l as Ne}from"./list-runtime-types-7qV7HQ7K.js";import{D as O,u as Re,C as Pe}from"./RuntimeConnectFlow-DsawxJN7.js";var Se=Object.defineProperty,b=(t,n)=>Se(t,"name",{value:n,configurable:!0}),T,_="HoverCard",[F,Xe]=Y(_,[U]),L=U(),[we,H]=F(_),He=b(t=>{const{__scopeHoverCard:n,children:r,open:o,defaultOpen:s,onOpenChange:c,openDelay:a=700,closeDelay:f=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,m]=G({prop:o,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>m(!0),a)},[a,m]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>m(!1),f))},[f,m]),h=l.useCallback(()=>m(!1),[m]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(we,{scope:n,open:u,onOpenChange:m,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(W,{...x,children:r})})},"HoverCard"),Te="HoverCardTrigger",ke=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,...s}=n,c=H(Te,o),a=L(o);return e.jsx(J,{asChild:!0,...a,children:e.jsx(Q.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,w(c.onOpen)),onPointerLeave:C(n.onPointerLeave,w(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,f=>f.preventDefault())})})},"HoverCardTrigger")),B="HoverCardPortal",[ye,Ee]=F(B,{forceMount:void 0}),De=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:o,container:s}=t,c=H(B,n);return e.jsx(ye,{scope:n,forceMount:r,children:e.jsx(z,{present:r||c.open,children:e.jsx(V,{asChild:!0,container:s,children:o})})})},"HoverCardPortal"),k="HoverCardContent",Oe=l.forwardRef(b(function(n,r){const o=Ee(k,n.__scopeHoverCard),{forceMount:s=o.forceMount,...c}=n,a=H(k,n.__scopeHoverCard);return e.jsx(z,{present:s||a.open,children:e.jsx(_e,{"data-state":a.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,w(a.onOpen)),onPointerLeave:C(n.onPointerLeave,w(a.onClose)),ref:r})})},"HoverCardContent")),_e=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:a,onInteractOutside:f,...x}=n,i=H(k,o),p=L(o),v=l.useRef(null),g=Z(r,v),[u,m]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return T=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=T,d.style.webkitUserSelect=T}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{m(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&K(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(X,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(a,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(q,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&m(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function w(t){return n=>n.pointerType==="touch"?void 0:t()}b(w,"excludeTouch");function K(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(o=>o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(K,"getTabbableNodes");var Le=He,$e=ke,Ie=De,Ue=Oe;function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card",...t})}function et({...t}){return e.jsx($e,{"data-slot":"hover-card-trigger",...t})}function tt({className:t,align:n="center",sideOffset:r=4,...o}){const s=ee();return e.jsx(Ie,{"data-slot":"hover-card-portal",container:s,children:e.jsx(Ue,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:te("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dui-dark:border dui-dark:border-dui-border z-(--z-overlay) w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md p-4 shadow-lg outline-hidden motion-reduce:animate-none!",t),...o})})}function ze(t,n,r){return r?ne(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:se.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${re(t)}`}}:null:null}function Ae(t,n,r){return t?[t]:n||Ne(r)}function Me({runtime:t,types:n,requirements:r,registeredTypes:o=[],onRecheck:s,isRechecking:c=!1,renderConnect:a}){const f=M(),x=Ae(t,n,o);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Fe,{type:i,requirements:r,registered:o.includes(i),renderConnect:a},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(me,{className:D("size-3.5",c&&!f&&"animate-spin")}),"Check again"]})]})]})}function Fe({type:t,requirements:n,registered:r,renderConnect:o}){var R,P,$;const s=y(t),c=s.icon,a=n==null?void 0:n.runtimes[t],f=A(n,t,r),x=f.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?ze(t,a==null?void 0:a.provider,!!o):null,m=a==null?void 0:a.dependencies.find(N=>N.status!=="satisfied"&&N.installHint),d=(m==null?void 0:m.installHint)??((R=s.setup)==null?void 0:R.installCommand),j=(m==null?void 0:m.infoUrl)??((P=s.setup)==null?void 0:P.infoUrl),h=!!a||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(E,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[o==null?void 0:o({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),f.state==="unknown"&&e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:($=a==null?void 0:a.dependencies.find(N=>N.status==="unknown"))==null?void 0:$.description}),!x&&f.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Be,{type:t,connect:f.connect,renderConnect:o,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(xe,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(pe,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ve,{className:D("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(he,{className:"mt-3 space-y-3",children:a?a.dependencies.map(N=>e.jsx(Ge,{dep:N},N.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(je,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Be({type:t,connect:n,renderConnect:r,installCommand:o,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Ke,{type:t,label:n.label,installCommand:o,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Ke({type:t,label:n,installCommand:r,installInfoUrl:o}){const s=y(t),{provision:c,isPending:a,isError:f,errorMessage:x,progress:i,result:p}=Re(t);return a||p!=null&&p.ok?e.jsx(Ye,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):f?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:o,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(Pe,{command:r,runtimeLabel:s.label})]})}function Ye({message:t}){const n=M();return e.jsxs(I.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(Ce,{size:"xs",className:D("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(be,{mode:"wait",children:e.jsx(I.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ge({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(E,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(ge,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function nt({runtime:t,open:n,onOpenChange:r,renderConnect:o,onRuntimeReady:s,showConnectSuccess:c=!1}){const a=ae(),{data:f}=oe(),x=t?y(t):null,i=A(a.data,t??"",f?t!==void 0&&t in f.capabilities:!0),p=a.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,m]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&m(null),d.current=n},[n]);const j=o&&(c?h=>o({...h,onConnected:R=>{var P;(P=h.onConnected)==null||P.call(h,R),m(R)}}):o);return e.jsx(ie,{open:n,onOpenChange:r,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(de,{children:x?x.label:"Your runtimes"}),e.jsx(ue,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(fe,{children:u?e.jsx(We,{success:u,onDone:()=>r(!1)}):e.jsx(Me,{runtime:t,requirements:a.data,registeredTypes:f?Object.keys(f.capabilities):void 0,onRecheck:()=>void a.refetch(),isRechecking:a.isFetching,renderConnect:j})})]})})}function We({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(E,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{qe as H,nt as R,et as a,tt as b,Me as c};