dorkos 0.126.3 → 0.127.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 (320) hide show
  1. package/dist/bin/cli.js +7771 -7141
  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-ycWTfXI8.js → AboutPage-BnnwvwU1.js} +1 -1
  5. package/dist/client/assets/{ActivityErrorState-DBecAo4-.js → ActivityErrorState-DW-plne9.js} +1 -1
  6. package/dist/client/assets/{ActivityPage-CGuIeDGm.js → ActivityPage-BMrtNC9t.js} +1 -1
  7. package/dist/client/assets/{ActivityRow-BRiUvjHA.js → ActivityRow-BnBDxJqK.js} +1 -1
  8. package/dist/client/assets/{AdapterIcon-z6z9LKwd.js → AdapterIcon-J2UUIfEX.js} +1 -1
  9. package/dist/client/assets/AdapterSetupWizard-MDV6zwYC.js +2 -0
  10. package/dist/client/assets/{AgentOptionRow-BLuSwpNh.js → AgentOptionRow-Dj2MlE6E.js} +1 -1
  11. package/dist/client/assets/{AgentPicker-DazquIgR.js → AgentPicker-D6MsFN_H.js} +1 -1
  12. package/dist/client/assets/{AgentRequestCard-BoRmxLKy.js → AgentRequestCard-BTyuNOhU.js} +1 -1
  13. package/dist/client/assets/{AppearancePage-BMiVpe48.js → AppearancePage-DJfJUAkw.js} +1 -1
  14. package/dist/client/assets/{ApplyToOverridesDialog-BHIrnfPf.js → ApplyToOverridesDialog-Akw0_458.js} +1 -1
  15. package/dist/client/assets/{AttentionSignalRow-CjN8lCWI.js → AttentionSignalRow-Cx9-sStN.js} +1 -1
  16. package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BMBnO0fv.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CRlmlore.js} +3 -3
  17. package/dist/client/assets/BindingDialog-ZAX-h6D4.js +1 -0
  18. package/dist/client/assets/{BlintzCanvas-Dd3bC9vw.js → BlintzCanvas-fEMJgpNx.js} +3 -3
  19. package/dist/client/assets/{CanvasCsvContent-B2S75f6B.js → CanvasCsvContent-CUoIFG7g.js} +3 -3
  20. package/dist/client/assets/{CanvasFileContent-CVSfg4MO.js → CanvasFileContent-Cg2jcXse.js} +2 -2
  21. package/dist/client/assets/{CanvasModel3dContent-CNmJsBTS.js → CanvasModel3dContent-BL-UiHAj.js} +2 -2
  22. package/dist/client/assets/ChannelComposer-BHxXoQwT.js +44 -0
  23. package/dist/client/assets/{ChatAppsOff-D7anOG3n.js → ChatAppsOff-CSSu_yVC.js} +2 -2
  24. package/dist/client/assets/{CodeMirrorDiff-CfOmRCky.js → CodeMirrorDiff-dfcDpguR.js} +1 -1
  25. package/dist/client/assets/{CodeMirrorEditor-Cyz227_1.js → CodeMirrorEditor-C1YQ35ki.js} +1 -1
  26. package/dist/client/assets/{CommitmentList-DKo1Fb1A.js → CommitmentList-B6RG_hWB.js} +1 -1
  27. package/dist/client/assets/{CommitmentsPage-DIcEZ2ka.js → CommitmentsPage-CDFvo1lt.js} +1 -1
  28. package/dist/client/assets/{ComputerResourceView-Ck7rJ-SP.js → ComputerResourceView-vJ8UfRNm.js} +1 -1
  29. package/dist/client/assets/{ComputerViewer-Dw_VpNjD.js → ComputerViewer-BTqPuZyh.js} +1 -1
  30. package/dist/client/assets/{ConnectionAccessLists-CETLVH7o.js → ConnectionAccessLists-DPnmOuiA.js} +1 -1
  31. package/dist/client/assets/{ConnectionsPage-ZVWDffcl.js → ConnectionsPage-CSHnGkha.js} +2 -2
  32. package/dist/client/assets/{ConventionPage-DkJ91wrN.js → ConventionPage-C6WsAvm4.js} +1 -1
  33. package/dist/client/assets/{ExtensionPageRoute-FbJo1Qc0.js → ExtensionPageRoute-CGjw2Cwy.js} +2 -2
  34. package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DCLR3iKw.js → FloatingTanStackRouterDevtools-CqogiFob-CKlmwuIc.js} +1 -1
  35. package/dist/client/assets/{ForwardConsentHost-Buy5XlH7.js → ForwardConsentHost-D8rVtTRp.js} +1 -1
  36. package/dist/client/assets/HandlePage-BciCIffv.js +1 -0
  37. package/dist/client/assets/{HeartbeatPage-GXBEcZoJ.js → HeartbeatPage-DQImR4dY.js} +1 -1
  38. package/dist/client/assets/{KeyEntry-g2VQ33KW.js → KeyEntry-BerpQFQT.js} +1 -1
  39. package/dist/client/assets/{LexicalField-CLd77PuB.js → LexicalField-CkcKNJGL.js} +1 -1
  40. package/dist/client/assets/{ManagesPage-qCwzJ4Cx.js → ManagesPage-CV4xieFk.js} +1 -1
  41. package/dist/client/assets/{Marketplace-DdkdIVPQ.js → Marketplace-Cp0e4Nv8.js} +4 -4
  42. package/dist/client/assets/{MarketplaceSourcesView-D44G21ff.js → MarketplaceSourcesView-ZBNnVSuv.js} +1 -1
  43. package/dist/client/assets/{McpAppFrame-DVNWJHrn.js → McpAppFrame-BtKAUDBg.js} +2 -2
  44. package/dist/client/assets/{McpSigninBody-BO0OkvOw.js → McpSigninBody-DjGrp_sO.js} +1 -1
  45. package/dist/client/assets/{Model3dViewer-Cvcyx2yv.js → Model3dViewer-BSX1QGsE.js} +1 -1
  46. package/dist/client/assets/NamePage-tBV32PJI.js +1 -0
  47. package/dist/client/assets/{NewDirectMessageMenu-C_hXtliM.js → NewDirectMessageMenu-DTQ7vFsa.js} +1 -1
  48. package/dist/client/assets/{NotificationsPage-DP4HAVMA.js → NotificationsPage-q7BDVKOz.js} +1 -1
  49. package/dist/client/assets/{OpenMeshSwitch-0Mkl8abo.js → OpenMeshSwitch-aAMKDAyc.js} +2 -2
  50. package/dist/client/assets/{OperatorIdentityForm-BRftJqRq.js → OperatorIdentityForm-CCAvadEZ.js} +1 -1
  51. package/dist/client/assets/{PermissionHistory-Czl5PWN3.js → PermissionHistory-_8m4ohGq.js} +1 -1
  52. package/dist/client/assets/{PermissionsPage-DAsbrl6Q.js → PermissionsPage-DHl8sCfQ.js} +1 -1
  53. package/dist/client/assets/{PersonalityPopover-liTJ0Lns.js → PersonalityPopover-DOql0nWB.js} +1 -1
  54. package/dist/client/assets/PhotoPage-DtX2GEvQ.js +1 -0
  55. package/dist/client/assets/{PreviewRefusedNotice-DcD1EY2c.js → PreviewRefusedNotice-BfvSYL-w.js} +1 -1
  56. package/dist/client/assets/{ProfileFields-Bi_AfHOE.js → ProfileFields-CX2mdPAV.js} +1 -1
  57. package/dist/client/assets/{ProfilePanelContainer-BIbOulLu.js → ProfilePanelContainer-Cj_57NEG.js} +1 -1
  58. package/dist/client/assets/{ProfileRolePicker-BadkFi4V.js → ProfileRolePicker-D7F0PDw9.js} +1 -1
  59. package/dist/client/assets/{PromptSuggestionChips-C653MlaU.js → PromptSuggestionChips-BopMvYe7.js} +1 -1
  60. package/dist/client/assets/{ReportsToPopover-dIbt6aes.js → ReportsToPopover-CG_hjT_U.js} +1 -1
  61. package/dist/client/assets/{RoomSurface-CssMcozl.js → RoomSurface-Mt3dk4_6.js} +1 -1
  62. package/dist/client/assets/{RoomsPage-CxwTRRNu.js → RoomsPage-ByHhS_HA.js} +1 -1
  63. package/dist/client/assets/{RunsOnPopover-lp8n4lgI.js → RunsOnPopover-DS8_Au0B.js} +1 -1
  64. package/dist/client/assets/RuntimeConnectFlow-hhvWVRMu.js +1 -0
  65. package/dist/client/assets/{RuntimeSetupDialog-E6f7Rd2W.js → RuntimeSetupDialog-NKy3mLEH.js} +1 -1
  66. package/dist/client/assets/SeenDevices-65oxnxk6.js +19 -0
  67. package/dist/client/assets/{SessionsPage-BNZTufty.js → SessionsPage-WbWf0huR.js} +1 -1
  68. package/dist/client/assets/SettingsDialog-e33ltTb6.js +12 -0
  69. package/dist/client/assets/{SkillsPage-DiqUOZup.js → SkillsPage-Cj3XrV8s.js} +1 -1
  70. package/dist/client/assets/{TaskDialogWrapper-5gb-f-Uo.js → TaskDialogWrapper-DJAGQuab.js} +1 -1
  71. package/dist/client/assets/{TasksEmptyState-g-CavcMv.js → TasksEmptyState-DNI1C274.js} +2 -2
  72. package/dist/client/assets/{TasksPage-BexV_pxB.js → TasksPage-Dc1j_X1K.js} +1 -1
  73. package/dist/client/assets/{TeamComputerEntry-BFYqGL-G.js → TeamComputerEntry-DWenh1bP.js} +1 -1
  74. package/dist/client/assets/{ToolsPage-Dxt6qOdF.js → ToolsPage-CXKq_axq.js} +2 -2
  75. package/dist/client/assets/{TopologyGraph-Cx_6gdbV.js → TopologyGraph-DgTGLoaA.js} +3 -3
  76. package/dist/client/assets/TourHost-C4KKDX9k.js +1 -0
  77. package/dist/client/assets/{UnlinkDialog-fgubvOUd.js → UnlinkDialog-GfsbP91q.js} +1 -1
  78. package/dist/client/assets/{UnreadDivider-BoLcTO_Z.js → UnreadDivider-C52_nmrB.js} +1 -1
  79. package/dist/client/assets/{WidgetErrorCard-CgRMeAEO.js → WidgetErrorCard-BZkAK-Ke.js} +3 -3
  80. package/dist/client/assets/{WithheldExtensionsNotice-CFHBDyIh.js → WithheldExtensionsNotice-Dt51QZLT.js} +1 -1
  81. package/dist/client/assets/{WorkView-5jzcnod5.js → WorkView-YozVoXhb.js} +15 -15
  82. package/dist/client/assets/{_shell-DFfXd1ys.js → _shell-BScdINMH.js} +2 -2
  83. package/dist/client/assets/{_shell._home-D2GJeGbi.js → _shell._home-CUusDXBM.js} +1 -1
  84. package/dist/client/assets/{_shell._home.activity-DRXBBtAq.js → _shell._home.activity-DPjJ1_vZ.js} +1 -1
  85. package/dist/client/assets/_shell._home.index-CTBWy5Au.js +3 -0
  86. package/dist/client/assets/{_shell._home.tasks-Cr4gak8T.js → _shell._home.tasks-DWFh5Qbq.js} +1 -1
  87. package/dist/client/assets/{_shell._home.workspaces-DbWciI1g.js → _shell._home.workspaces-DWjB1sCd.js} +1 -1
  88. package/dist/client/assets/{_shell.channels-C31Txlqh.js → _shell.channels-C6v3yOzH.js} +1 -1
  89. package/dist/client/assets/_shell.connections-jXaP35mN.js +1 -0
  90. package/dist/client/assets/{_shell.feedback-requests-CQc7aVrV.js → _shell.feedback-requests-CyV-aboj.js} +1 -1
  91. package/dist/client/assets/_shell.marketplace-Cp2Udmlv.js +1 -0
  92. package/dist/client/assets/_shell.marketplace_.sources-Dg0YgG-u.js +1 -0
  93. package/dist/client/assets/_shell.session-DyKnijqi.js +1 -0
  94. package/dist/client/assets/{_shell.team-BlLU5BMC.js → _shell.team-BPevCu33.js} +4 -4
  95. package/dist/client/assets/{_shell.threads-YmF9dQnZ.js → _shell.threads-gzYSpt7x.js} +1 -1
  96. package/dist/client/assets/_shell.x._extensionId-BA0u_ZTU.js +1 -0
  97. package/dist/client/assets/_shell.x._extensionId_._-BA0u_ZTU.js +1 -0
  98. package/dist/client/assets/{abnfDiagram-WEYOIA3C-DLiXaMmC.js → abnfDiagram-WEYOIA3C-iUnN9Com.js} +1 -1
  99. package/dist/client/assets/{access-copy-xWnaUps1.js → access-copy-CP0B1ZT9.js} +1 -1
  100. package/dist/client/assets/{arc-AndXXvZc.js → arc-BVSQ4HBO.js} +1 -1
  101. package/dist/client/assets/{architectureDiagram-ZHVYKT53-CM4tGveM.js → architectureDiagram-ZHVYKT53-_zlUU8PS.js} +1 -1
  102. package/dist/client/assets/{banner-BH1gXPTc.js → banner-DTCBttcQ.js} +2 -2
  103. package/dist/client/assets/{blockDiagram-RJAE7QA3-DenkdFXV.js → blockDiagram-RJAE7QA3-COqNq2ny.js} +1 -1
  104. package/dist/client/assets/{c4Diagram-XDPPPE54-DMAlFuoX.js → c4Diagram-XDPPPE54-Caa3QxQ_.js} +1 -1
  105. package/dist/client/assets/{card-TbpEl6EH.js → card-D9DO5nt4.js} +1 -1
  106. package/dist/client/assets/channel-CenDG0-I.js +1 -0
  107. package/dist/client/assets/{chunk-2E7WHVMD-u0q5vCEc.js → chunk-2E7WHVMD-BqirxZIN.js} +1 -1
  108. package/dist/client/assets/{chunk-2Q5K7J3B-DBTggfjR.js → chunk-2Q5K7J3B-CYGt3XQf.js} +1 -1
  109. package/dist/client/assets/{chunk-4EMNKR2T-zu55wq-c.js → chunk-4EMNKR2T-Bx234GPP.js} +1 -1
  110. package/dist/client/assets/{chunk-55XCU76K-XLIA3Qss.js → chunk-55XCU76K-CAA7du3_.js} +1 -1
  111. package/dist/client/assets/{chunk-5VM5RSS4-DmGjbtZg.js → chunk-5VM5RSS4-Dxl-FvVz.js} +1 -1
  112. package/dist/client/assets/{chunk-JWPE2WC7-ikMrk6md.js → chunk-JWPE2WC7-CjcTenhr.js} +1 -1
  113. package/dist/client/assets/{chunk-VQ5W62QI-cfwin8SC.js → chunk-VQ5W62QI-COdK9J2i.js} +1 -1
  114. package/dist/client/assets/{chunk-XXDRQBXY-Cn3e0QEQ.js → chunk-XXDRQBXY-DeXzMeSy.js} +1 -1
  115. package/dist/client/assets/{chunk-ZCHMQSOR-7RkBP94K.js → chunk-ZCHMQSOR-C7r0u2k6.js} +2 -2
  116. package/dist/client/assets/{classDiagram-v2-4MYWR3UA-CqVol7t8.js → classDiagram-v2-4MYWR3UA-BSI2Eza3.js} +1 -1
  117. package/dist/client/assets/{command-2pl_Cn7b.js → command-C7Cl56dV.js} +1 -1
  118. package/dist/client/assets/{cose-bilkent-JH36ORCC-m0tmlDnx.js → cose-bilkent-JH36ORCC-CLzQXbOG.js} +1 -1
  119. package/dist/client/assets/{cpu-CdCfSlSR.js → cpu-CLfYM0zq.js} +1 -1
  120. package/dist/client/assets/{cynefin-EF2NZ3EQ-Cf7ajLou.js → cynefin-EF2NZ3EQ-e_0nKhb5.js} +1 -1
  121. package/dist/client/assets/{cynefinDiagram-WF24UDRP-Dl8GJr0l.js → cynefinDiagram-WF24UDRP-Cflfw_GE.js} +1 -1
  122. package/dist/client/assets/{dagre-NK4GIZVX-2yAF6nW_.js → dagre-NK4GIZVX-D66Simjb.js} +1 -1
  123. package/dist/client/assets/{diagram-CBK3MWTC-DaBb9JFm.js → diagram-CBK3MWTC-CJEeUCUY.js} +1 -1
  124. package/dist/client/assets/{diagram-I5XIIV2D-BMeCfhD1.js → diagram-I5XIIV2D-BPSiDLoN.js} +1 -1
  125. package/dist/client/assets/{diagram-ODIL2UCW-ClVKCieB.js → diagram-ODIL2UCW-DJptgW_s.js} +1 -1
  126. package/dist/client/assets/{diagram-PFBEJUXE-DFIKk-tB.js → diagram-PFBEJUXE-BECklqVg.js} +1 -1
  127. package/dist/client/assets/{diagram-RJA3I4VV-DzC_xtYu.js → diagram-RJA3I4VV-B-veBl7Z.js} +1 -1
  128. package/dist/client/assets/{diagram-TYUNFSNR-BroMVHm2.js → diagram-TYUNFSNR-U8kleemE.js} +1 -1
  129. package/dist/client/assets/{ebnfDiagram-V4P3TTPT-GMsyIh86.js → ebnfDiagram-V4P3TTPT-DlwBfJCe.js} +1 -1
  130. package/dist/client/assets/{elk-QONTBCTQ-DIpw6SW5.js → elk-QONTBCTQ-DnFzEb3y.js} +1 -1
  131. package/dist/client/assets/{empty-state-B7ufhAFk.js → empty-state-2mQX7azC.js} +1 -1
  132. package/dist/client/assets/{erDiagram-KYQIGQAA-CsezeWpx.js → erDiagram-KYQIGQAA-CYTM37Ws.js} +1 -1
  133. package/dist/client/assets/{execution-config-DRqIsff0.js → execution-config-COqY7hHn.js} +1 -1
  134. package/dist/client/assets/{file-DHPgnMgj.js → file-CKSjJRX5.js} +1 -1
  135. package/dist/client/assets/{file-exclamation-point-DtjBa2XX.js → file-exclamation-point-ad7FedZ9.js} +1 -1
  136. package/dist/client/assets/{file-text-wmrSy3Io.js → file-text-DXPPkxAL.js} +1 -1
  137. package/dist/client/assets/{find-latest-widget-fence-Bv9D10ve.js → find-latest-widget-fence-BsDq4SYp.js} +3 -3
  138. package/dist/client/assets/{flowDiagram-IUGLLWBU-BGwNqglr.js → flowDiagram-IUGLLWBU-DD259OPj.js} +1 -1
  139. package/dist/client/assets/{form-CA_eiUg-.js → form-C9cPRNOV.js} +1 -1
  140. package/dist/client/assets/{format-cron-YPhIy57w.js → format-cron-DIw9_M6c.js} +1 -1
  141. package/dist/client/assets/{ganttDiagram-R7GPNTJY-4IlzTCzA.js → ganttDiagram-R7GPNTJY-BmoAVY6N.js} +1 -1
  142. package/dist/client/assets/{git-branch-BLIYLcM4.js → git-branch-DlUQMA-U.js} +1 -1
  143. package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-HeaC8vlP.js → gitGraphDiagram-PDYL7XHY-Db8GGxGr.js} +1 -1
  144. package/dist/client/assets/{graph-Ch9lnHSS.js → graph-BqwkokGk.js} +1 -1
  145. package/dist/client/assets/{heart-D4fTvM5q.js → heart-CRoafWCm.js} +1 -1
  146. package/dist/client/assets/{highlighted-body-KPVGNVTW-KPma22SA.js → highlighted-body-KPVGNVTW-D-QIuqsv.js} +1 -1
  147. package/dist/client/assets/{image-lightbox-DI18fB2Q.js → image-lightbox-BZBT_ptW.js} +1 -1
  148. package/dist/client/assets/{image-off-DRgXXpgv.js → image-off-Bc6AP3w0.js} +1 -1
  149. package/dist/client/assets/{index-3UGWygRZ.js → index-78G8l1M7.js} +1 -1
  150. package/dist/client/assets/{index-C-X6jaVm.js → index-AxYQRAoO.js} +1 -1
  151. package/dist/client/assets/index-B48IJBNm.js +1058 -0
  152. package/dist/client/assets/{index-DuvW22xi.js → index-BHNwprrd.js} +1 -1
  153. package/dist/client/assets/{index-CucieFDK.js → index-B_i3pTpf.js} +1 -1
  154. package/dist/client/assets/{index-mRMaqxu5.js → index-Be3_cvW0.js} +1 -1
  155. package/dist/client/assets/{index-EDXuyCOT.js → index-BeCzlnZ3.js} +1 -1
  156. package/dist/client/assets/{index--2mMmier.js → index-Bw1l5I4w.js} +1 -1
  157. package/dist/client/assets/{index-DHZS9Lod.js → index-BwOvHDL2.js} +1 -1
  158. package/dist/client/assets/{index-Dbujw1c2.js → index-ByyXrDny.js} +1 -1
  159. package/dist/client/assets/{index-Ix2nCAz0.js → index-CFV7Ggyj.js} +1 -1
  160. package/dist/client/assets/index-CMWttCLt.js +1 -0
  161. package/dist/client/assets/{index-ClbMjgcZ.js → index-CNsZn6QE.js} +1 -1
  162. package/dist/client/assets/{index-2J89pJxF.js → index-CTFwtIJP.js} +1 -1
  163. package/dist/client/assets/{index-qEI7Rsr1.js → index-CWfreKgt.js} +1 -1
  164. package/dist/client/assets/{index-DTRAR0KK.js → index-CWx_JEio.js} +1 -1
  165. package/dist/client/assets/{index-CTTaeOCw.js → index-CZ4wx2F3.js} +1 -1
  166. package/dist/client/assets/{index-B_56Srtt.js → index-Clr1ssap.js} +1 -1
  167. package/dist/client/assets/{index-D9w0FBQG.js → index-CoFRHepD.js} +1 -1
  168. package/dist/client/assets/{index-zvAbU6ah.js → index-CptdhVbC.js} +1 -1
  169. package/dist/client/assets/{index-Dy9bWvna.js → index-Cpy9wOYc.js} +1 -1
  170. package/dist/client/assets/{index-COoO8dzi.js → index-Cs9yQ5zH.js} +1 -1
  171. package/dist/client/assets/{index-QSo53dH-.js → index-Cx2slDvh.js} +1 -1
  172. package/dist/client/assets/{index-rPJ8b_DO.js → index-DDGc0Nfu.js} +1 -1
  173. package/dist/client/assets/{index-B-4XmK5Q.js → index-DMlo5rLX.js} +1 -1
  174. package/dist/client/assets/index-DSt16Y0s.js +1 -0
  175. package/dist/client/assets/{index-D0cIffaH.js → index-DV5hFlfw.js} +1 -1
  176. package/dist/client/assets/index-DfWZORsm.js +1 -0
  177. package/dist/client/assets/{index-CujX3mpY.css → index-Dry_agqN.css} +1 -1
  178. package/dist/client/assets/{index-uG06zgQo.js → index-Dtb34mrg.js} +1 -1
  179. package/dist/client/assets/{index-DpvGUFpV.js → index-DwyVu2Mh.js} +1 -1
  180. package/dist/client/assets/{index-BY0SKYuc.js → index-Hf3kLtiJ.js} +1 -1
  181. package/dist/client/assets/{index-BmlBYrxT.js → index-a8LKmWxN.js} +1 -1
  182. package/dist/client/assets/{index-C3IsCAxA.js → index-bSzhhjtG.js} +1 -1
  183. package/dist/client/assets/{index-BtRM2yox.js → index-eF6QtmU6.js} +1 -1
  184. package/dist/client/assets/{index-BAd8jUzo.js → index-jIAsl-Y5.js} +2 -2
  185. package/dist/client/assets/{index-DbV3-jog.js → index-mrbr3BaJ.js} +1 -1
  186. package/dist/client/assets/{index-CRCfkwyN.js → index-okP_lDUw.js} +1 -1
  187. package/dist/client/assets/{index-JoxvTUfo.js → index-sCJ7YWzB.js} +3 -3
  188. package/dist/client/assets/index-sZ8Dddnp.js +1 -0
  189. package/dist/client/assets/{index-uy36h8lC.js → index-x0XGESNQ.js} +1 -1
  190. package/dist/client/assets/{index-bzM-k5lI.js → index-y1yAU07O.js} +1 -1
  191. package/dist/client/assets/{index-DSIdPh8G.js → index-zIfhHvVv.js} +1 -1
  192. package/dist/client/assets/{index-jk2K24il.js → index-zSj20f3H.js} +1 -1
  193. package/dist/client/assets/{index.esm-CxXuMuQv.js → index.esm-uC5dql6Q.js} +1 -1
  194. package/dist/client/assets/{infoDiagram-MVDRKAX5-g9EeD2xH.js → infoDiagram-MVDRKAX5-y6U3OQ5m.js} +1 -1
  195. package/dist/client/assets/{inline-code-14c1Gacs.js → inline-code-BCFlKPIb.js} +1 -1
  196. package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-Zv5DrRnv.js → ishikawaDiagram-HPEHV2GE-D32SA0vX.js} +1 -1
  197. package/dist/client/assets/{journeyDiagram-BOSHW7O7-COiWWTez.js → journeyDiagram-BOSHW7O7-D1X0dI8X.js} +1 -1
  198. package/dist/client/assets/{kanban-definition-FNSA4HC5-DnQa8qXB.js → kanban-definition-FNSA4HC5-gU9KcKa4.js} +1 -1
  199. package/dist/client/assets/{layers-D_NEJsnH.js → layers-A4MxcGWV.js} +1 -1
  200. package/dist/client/assets/{lightbulb-EadQi_Lr.js → lightbulb-Dh2dYHMS.js} +1 -1
  201. package/dist/client/assets/{link-2-DugR2HHU.js → link-2-qEUih2FP.js} +1 -1
  202. package/dist/client/assets/{list-runtime-types-iJaKcim4.js → list-runtime-types-B1J9AtqH.js} +1 -1
  203. package/dist/client/assets/{markdown-content-BFHUHPgi.js → markdown-content-BA0KEJH_.js} +1 -1
  204. package/dist/client/assets/mention-pill-0aHe3D1A.js +1 -0
  205. package/dist/client/assets/{mermaid.core-C6ckWvkG.js → mermaid.core-Birdr1kF.js} +4 -4
  206. package/dist/client/assets/{message-square-off-BH8wbm2a.js → message-square-off-DvVenheW.js} +1 -1
  207. package/dist/client/assets/{mindmap-definition-6OY57UG3-DV4PNLc-.js → mindmap-definition-6OY57UG3-CLlh3nSF.js} +1 -1
  208. package/dist/client/assets/{more-details-DhdX4DGU.js → more-details-Bo2AAXHj.js} +1 -1
  209. package/dist/client/assets/{owner-notice-FMj3k7-f.js → owner-notice-DReCUEf1.js} +1 -1
  210. package/dist/client/assets/{package-0mI7-RiJ.js → package-CxZe6vve.js} +1 -1
  211. package/dist/client/assets/{page-container-DRyYoDkA.js → page-container-Bx1sr900.js} +1 -1
  212. package/dist/client/assets/{pane-resize-handle-OBc3uYxQ.js → pane-resize-handle-ojhYGmDs.js} +1 -1
  213. package/dist/client/assets/{paperclip-BsTJpkyE.js → paperclip-D3-8ygf1.js} +1 -1
  214. package/dist/client/assets/{path-input-CFm1b1pk.js → path-input-D_o1_pAa.js} +1 -1
  215. package/dist/client/assets/{pegDiagram-ECIUJNBX-Cboo0f6B.js → pegDiagram-ECIUJNBX-BeMd_oXJ.js} +1 -1
  216. package/dist/client/assets/{pieDiagram-GNMPY74T-CiihSor1.js → pieDiagram-GNMPY74T-CXUXnp_A.js} +1 -1
  217. package/dist/client/assets/{plug-BdnJAo1j.js → plug-Du5LK0oZ.js} +1 -1
  218. package/dist/client/assets/primer-trigger-BxofQe1n.js +3 -0
  219. package/dist/client/assets/{profile-errors-B08zStmk.js → profile-errors-C0BgTjzk.js} +1 -1
  220. package/dist/client/assets/{progress-CpiQE0rv.js → progress-AKcr8opu.js} +1 -1
  221. package/dist/client/assets/{quadrantDiagram-D57K4MC3-dF0oKeMn.js → quadrantDiagram-D57K4MC3-FTkKRlZm.js} +1 -1
  222. package/dist/client/assets/{query-error-state-B0RUeb10.js → query-error-state-CRmZMMkL.js} +1 -1
  223. package/dist/client/assets/{radio-CAGXbJK_.js → radio-DQHR6Su5.js} +1 -1
  224. package/dist/client/assets/{railroadDiagram-Y72NRBL7-ClkFJVq1.js → railroadDiagram-Y72NRBL7-D5TdGrPg.js} +1 -1
  225. package/dist/client/assets/{registry-Cog_2xvt.js → registry-BxY1lah6.js} +4 -4
  226. package/dist/client/assets/registry-CWK5lzYs.js +1 -0
  227. package/dist/client/assets/relay-trace-schemas---fuhTF2.js +6 -0
  228. package/dist/client/assets/{repeat-Dag80z5v.js → repeat-zL9y24zY.js} +1 -1
  229. package/dist/client/assets/{requirementDiagram-EQYSW5RA-Cey6FmFd.js → requirementDiagram-EQYSW5RA-Dxiv9lE0.js} +1 -1
  230. package/dist/client/assets/{room-files-source-BKUFMU_b.js → room-files-source-B0WR4gIC.js} +1 -1
  231. package/dist/client/assets/{rotate-ccw-clock-egrvXlKX.js → rotate-ccw-clock-BUhy2_cF.js} +1 -1
  232. package/dist/client/assets/{rotate-cw-Po-L3HFe.js → rotate-cw-CCrNd4eJ.js} +1 -1
  233. package/dist/client/assets/{sankeyDiagram-SY24JHO5-BsIuHjbJ.js → sankeyDiagram-SY24JHO5-C3jjstXq.js} +1 -1
  234. package/dist/client/assets/{scroll-area-C7vKp2H4.js → scroll-area-D6gNpFjK.js} +1 -1
  235. package/dist/client/assets/search-x-CUZ1LRYe.js +6 -0
  236. package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BJZXJxwu.js → sequenceDiagram-BLEHNHQU-CIDmjz0x.js} +1 -1
  237. package/dist/client/assets/{shield-x-hHpT8rAA.js → shield-x-Ch7sY2XD.js} +1 -1
  238. package/dist/client/assets/{signed-in-BhArfIJC.js → signed-in-BQ44fFH5.js} +1 -1
  239. package/dist/client/assets/{sizeCapture-INFHLROL-DYCQyn7S.js → sizeCapture-INFHLROL-Dkp-75Wy.js} +1 -1
  240. package/dist/client/assets/{soul-file-Doekkv7n.js → soul-file-CTFcpRMh.js} +1 -1
  241. package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-C6bUDAO7.js → stateDiagram-v2-A6IESKWZ-L_51UnwV.js} +1 -1
  242. package/dist/client/assets/{swimlanes-B3ENRKFQ-DGyTrJBT.js → swimlanes-B3ENRKFQ-D-etAQQd.js} +1 -1
  243. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-zjIBWGY4.js +8 -0
  244. package/dist/client/assets/{table-9KRGRv_s.js → table-D6BUawIb.js} +1 -1
  245. package/dist/client/assets/{timeline-definition-JXYKGLGB-CHAJwSq6.js → timeline-definition-JXYKGLGB-DNxnC3VG.js} +1 -1
  246. package/dist/client/assets/{trust-posture-BQE9NSf_.js → trust-posture-5IWBJmA5.js} +1 -1
  247. package/dist/client/assets/{unplug-CklGWwz7.js → unplug-BVIT6OSL.js} +1 -1
  248. package/dist/client/assets/{unverified-catalog-notice-9mykZSlO.js → unverified-catalog-notice-BA7_V-80.js} +1 -1
  249. package/dist/client/assets/{use-bindings-CPbqKyo6.js → use-bindings-DdWRXvtd.js} +1 -1
  250. package/dist/client/assets/{use-composer-prefs-C7v03Xx_.js → use-composer-prefs-DC5w4eWw.js} +1 -1
  251. package/dist/client/assets/{use-connector-management-COqWo76Y.js → use-connector-management-DDlpD6tk.js} +1 -1
  252. package/dist/client/assets/{use-deep-link-scroll-BuYR3PaO.js → use-deep-link-scroll-Cvv0VcXx.js} +1 -1
  253. package/dist/client/assets/{use-delete-binding-Dfz8BlLn.js → use-delete-binding-D585ISkL.js} +1 -1
  254. package/dist/client/assets/{use-dev-links-Cu2JmM-_.js → use-dev-links-BwS5hgur.js} +1 -1
  255. package/dist/client/assets/{use-direct-message-panel-DobIp_O4.js → use-direct-message-panel--unflmj8.js} +1 -1
  256. package/dist/client/assets/use-external-adapter-catalog-DUyh1bH1.js +1 -0
  257. package/dist/client/assets/use-full-activity-feed-DsNOIkL8.js +1 -0
  258. package/dist/client/assets/use-is-below-desktop-C-4kc5lS.js +1 -0
  259. package/dist/client/assets/{use-local-browser-DPdkgs06.js → use-local-browser-DGIut7R4.js} +1 -1
  260. package/dist/client/assets/{use-mesh-topology-Ci7r-pAi.js → use-mesh-topology-DNXD7seM.js} +1 -1
  261. package/dist/client/assets/{use-mounted-ref-CWXhSyZ8.js → use-mounted-ref-7xoMthh4.js} +1 -1
  262. package/dist/client/assets/{use-notification-prefs-GJ2coibL.js → use-notification-prefs-CzibxpTZ.js} +1 -1
  263. package/dist/client/assets/use-pending-read-BTR5-HXf.js +1 -0
  264. package/dist/client/assets/{use-personality-commit-Da2BJ_58.js → use-personality-commit-isaMS7W5.js} +1 -1
  265. package/dist/client/assets/{use-promo-activation-D4PAd7pd.js → use-promo-activation-DesLEeyi.js} +3 -3
  266. package/dist/client/assets/{use-promo-dismissals-BCBu0s3k.js → use-promo-dismissals-DQi8tey8.js} +1 -1
  267. package/dist/client/assets/{use-pulse-freshness-CHLSUL-h.js → use-pulse-freshness-DPplpvcq.js} +1 -1
  268. package/dist/client/assets/{use-room-follow-claim-BSijPV3c.js → use-room-follow-claim-C4UikQzz.js} +1 -1
  269. package/dist/client/assets/{use-room-sessions-CNqHgLVa.js → use-room-sessions-C6wsszcG.js} +1 -1
  270. package/dist/client/assets/{use-roving-tab-list-EsqX22Ik.js → use-roving-tab-list-DEh387tR.js} +1 -1
  271. package/dist/client/assets/{use-session-canvas-DAGOz8a6.js → use-session-canvas-B2CM1KZu.js} +8 -8
  272. package/dist/client/assets/{use-status-budget-CHln-8aP.js → use-status-budget-CltxSIUD.js} +3 -3
  273. package/dist/client/assets/{use-transform-BmyqpcvO.js → use-transform-CNLqlc2h.js} +1 -1
  274. package/dist/client/assets/{use-unclaimed-chats-9Clj_rwl.js → use-unclaimed-chats-DJyl7A1E.js} +1 -1
  275. package/dist/client/assets/use-update-config-B2rsDnxk.js +1 -0
  276. package/dist/client/assets/{useMutationState-B61VoWtY.js → useMutationState-BX-ggHVY.js} +1 -1
  277. package/dist/client/assets/{usecaseDiagram-WPOLBNNX-BUqj8rIH.js → usecaseDiagram-WPOLBNNX-2l6yZUUH.js} +1 -1
  278. package/dist/client/assets/{vennDiagram-Q3Y3IDCW-B09oli-Z.js → vennDiagram-Q3Y3IDCW-DIOfjNDq.js} +1 -1
  279. package/dist/client/assets/{wardleyDiagram-IVAIDKWA-BE7gzLdw.js → wardleyDiagram-IVAIDKWA-B5Hx1we8.js} +1 -1
  280. package/dist/client/assets/{xychartDiagram-4URNHDU4-CbGKfmuW.js → xychartDiagram-4URNHDU4-sy90CqIK.js} +1 -1
  281. package/dist/client/index.html +2 -2
  282. package/dist/server/index.js +30051 -25401
  283. package/dist/server/index.js.map +2 -2
  284. package/package.json +9 -9
  285. package/dist/client/assets/AdapterSetupWizard-Cp56Zx24.js +0 -2
  286. package/dist/client/assets/BindingDialog-Bw55sMTh.js +0 -1
  287. package/dist/client/assets/ChannelComposer-7KpffyFv.js +0 -44
  288. package/dist/client/assets/HandlePage-CByGC3B8.js +0 -1
  289. package/dist/client/assets/NamePage-5VUtswMH.js +0 -1
  290. package/dist/client/assets/PhotoPage-DDcbiGjb.js +0 -1
  291. package/dist/client/assets/RuntimeConnectFlow-BAqkzthF.js +0 -1
  292. package/dist/client/assets/SeenDevices-xdR3YQNr.js +0 -19
  293. package/dist/client/assets/SettingsDialog-d7SQTDNy.js +0 -12
  294. package/dist/client/assets/TourHost-DvAjpsug.js +0 -1
  295. package/dist/client/assets/_shell._home.index-CA_GnaUK.js +0 -3
  296. package/dist/client/assets/_shell.connections-gfevZyC-.js +0 -1
  297. package/dist/client/assets/_shell.marketplace-BepG1fJe.js +0 -1
  298. package/dist/client/assets/_shell.marketplace_.sources-BBQESbqU.js +0 -1
  299. package/dist/client/assets/_shell.session-DzeI9YIK.js +0 -1
  300. package/dist/client/assets/_shell.x._extensionId-ByRocZjS.js +0 -1
  301. package/dist/client/assets/_shell.x._extensionId_._-ByRocZjS.js +0 -1
  302. package/dist/client/assets/channel-5-dQamNX.js +0 -1
  303. package/dist/client/assets/index-B9X2-pzp.js +0 -1
  304. package/dist/client/assets/index-BMYGo6Ki.js +0 -1
  305. package/dist/client/assets/index-ButY6gKr.js +0 -1
  306. package/dist/client/assets/index-CgpRBcA4.js +0 -1
  307. package/dist/client/assets/index-p3WivF1M.js +0 -1053
  308. package/dist/client/assets/mention-pill-DXBno6EY.js +0 -1
  309. package/dist/client/assets/primer-trigger-BV4xZfFz.js +0 -3
  310. package/dist/client/assets/registry-DLWJMbtY.js +0 -1
  311. package/dist/client/assets/relay-trace-schemas-CNDSmhcJ.js +0 -6
  312. package/dist/client/assets/search-x-C_BEqIuX.js +0 -6
  313. package/dist/client/assets/swimlanesDiagram-AYQRV4AK-DrZ99xGr.js +0 -8
  314. package/dist/client/assets/use-adapter-catalog-CDxy08u_.js +0 -1
  315. package/dist/client/assets/use-external-adapter-catalog-OLn4l20Q.js +0 -1
  316. package/dist/client/assets/use-full-activity-feed-DNrhQueu.js +0 -1
  317. package/dist/client/assets/use-is-below-desktop-7gY1n-47.js +0 -1
  318. package/dist/client/assets/use-pending-read-DcVJ8fZb.js +0 -1
  319. package/dist/client/assets/use-relay-config-C6rPlEud.js +0 -1
  320. package/dist/client/assets/use-update-config-T78vOnRy.js +0 -1
@@ -1,4 +1,4 @@
1
1
  [diffend] Oversized file quarantined before diffing.
2
2
  name: package/dist/server/index.js.map
3
- size: 65096717 bytes
4
- sha256: 4da1cca0fd3faec496b3f33dfbae22e37bafdda312d330cc2a89cb0dcde15ca0
3
+ size: 65612332 bytes
4
+ sha256: dabed0306bd63efe9f3e45e5421c9f5424dd9bdbc80ec1e852b32e50e8f358e0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dorkos",
3
- "version": "0.126.3",
3
+ "version": "0.127.0",
4
4
  "description": "You, multiplied. Build and run your business with an agent team. Your agents join your team chat, take on real work, and build the tools your company runs on.",
5
5
  "license": "MIT",
6
6
  "author": "Dorian Collier",
@@ -72,24 +72,24 @@
72
72
  "zod": "^4.6.6"
73
73
  },
74
74
  "devDependencies": {
75
- "@better-auth/api-key": "1.7.6",
76
- "@better-auth/core": "1.7.6",
75
+ "@better-auth/api-key": "1.7.7",
76
+ "@better-auth/core": "1.7.7",
77
77
  "@better-fetch/fetch": "1.3.2",
78
78
  "@types/better-sqlite3": "^7.6.13",
79
79
  "@types/qrcode-terminal": "^0.12.2",
80
- "better-auth": "1.7.6",
80
+ "better-auth": "1.7.7",
81
81
  "conf": "^15.1.0",
82
82
  "tsx": "^4.23.15",
83
83
  "typescript": "^5.9.3",
84
84
  "vitest": "^4.1.11",
85
- "@dorkos/db": "0.0.0",
86
85
  "@dorkos/browser": "0.0.0",
87
- "@dorkos/marketplace": "0.0.0",
88
- "@dorkos/harness": "0.0.0",
89
86
  "@dorkos/eslint-config": "0.0.0",
90
- "@dorkos/typescript-config": "0.0.0",
91
- "@dorkos/shared": "0.0.0",
87
+ "@dorkos/harness": "0.0.0",
92
88
  "@dorkos/server": "0.0.0",
89
+ "@dorkos/db": "0.0.0",
90
+ "@dorkos/marketplace": "0.0.0",
91
+ "@dorkos/shared": "0.0.0",
92
+ "@dorkos/typescript-config": "0.0.0",
93
93
  "@dorkos/client": "0.0.0"
94
94
  },
95
95
  "scripts": {
@@ -1,2 +0,0 @@
1
- import{a1 as be,a3 as Ne,a4 as ze,j as e,bg as qe,bh as Ee,r as m,dr as ie,hZ as Te,ds as oe,h0 as le,$ as $e,Q as ce,T as de,aw as ue,U as he,V as pe,by as Y,ar as J,h_ as me,h$ as Me,G as U,eh as X,ei as Z,ej as ee,ek as se,el as te,I as re,ep as xe,J as We,bx as Ve,B as k,i0 as Se,er as De,eo as ae,x as ke,be as Pe,bd as Re,a0 as Oe,ak as ge,i1 as Le,i2 as _e,i3 as Ge,i4 as Ue,i5 as Ie,c$ as Qe,a7 as G,fj as He,fk as Ke,fl as Ye,fm as Je,fn as Xe,fo as Ze,i6 as fe,i7 as H}from"./index-p3WivF1M.js";import{B as es}from"./use-bindings-CPbqKyo6.js";import{M as I}from"./markdown-content-BFHUHPgi.js";import{a as ss,b as ts,c as rs}from"./use-adapter-catalog-CDxy08u_.js";import{u as as}from"./form-CA_eiUg-.js";import{a as ns}from"./BindingDialog-Bw55sMTh.js";import"./relay-trace-schemas-CNDSmhcJ.js";function zs(s={}){const t=be(),a=Ne();return ze({mutationFn:({id:r,updates:l})=>t.updateBinding(r,l),onSuccess:()=>{a.invalidateQueries({queryKey:[...es]})},meta:s.suppressErrorToast?{suppressErrorToast:!0}:{errorLabel:s.errorLabel??"Couldn’t update that connection"}})}function is({field:s,value:t,onChange:a,error:r,allValues:l}){const[i,n]=m.useState("");if(s.showWhen&&l[s.showWhen.field]!==s.showWhen.equals)return null;const o=`config-field-${s.key}`,v=s.type==="select"&&s.displayAs==="radio-cards",h=t!=null?String(t):"",x=h==="***",y=()=>{if(x){n("");return}if(s.pattern&&h&&!new RegExp(s.pattern).test(h)){n(s.patternMessage??"Check the format");return}n("")},d=r??i;if(s.type==="boolean")return e.jsxs("div",{children:[e.jsxs(ie,{orientation:"horizontal",className:"items-center justify-between gap-4",children:[e.jsxs(Te,{className:"min-w-0",children:[e.jsxs(oe,{htmlFor:o,className:"text-sm font-medium",children:[s.label,s.required&&e.jsx("span",{"aria-hidden":"true",className:"text-destructive ml-0.5",children:"*"})]}),s.description&&e.jsx(le,{className:"text-xs",children:s.description})]}),e.jsx($e,{id:o,checked:!!t,onCheckedChange:N=>a(s.key,N)})]}),s.helpMarkdown&&e.jsxs(ce,{children:[e.jsxs(de,{className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ue,{className:"size-3"}),"Where do I find this?",e.jsx(he,{className:"size-3 transition-transform [[data-state=open]_&]:rotate-180"})]}),e.jsx(pe,{children:e.jsx("div",{className:"bg-muted/50 mt-2 rounded-md border p-3",children:e.jsx(I,{content:s.helpMarkdown,className:"text-xs"})})})]}),e.jsx(Y,{children:d&&e.jsx(J.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.15},className:"overflow-hidden",children:e.jsx(me,{className:"mt-1.5",children:d})})})]});const b=()=>{var N,C;switch(s.type){case"text":case"url":return e.jsx(re,{id:o,type:s.type==="url"?"url":"text",value:h,onChange:c=>a(s.key,c.target.value),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"password":return x?e.jsx(xe,{id:o,value:h,showPassword:!1,onChange:c=>{a(s.key,c.target.value.trim()),i&&n("")},onFocus:()=>a(s.key,""),onBlur:y,placeholder:"Saved · type to replace"}):e.jsx(xe,{id:o,value:h,visibleByDefault:s.visibleByDefault??!1,onChange:c=>{a(s.key,c.target.value.trim()),i&&n("")},onBlur:y,onPaste:()=>setTimeout(y,0),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"number":return e.jsx(re,{id:o,type:"number",value:h,onChange:c=>a(s.key,c.target.value?Number(c.target.value):void 0),placeholder:s.placeholder,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});case"select":return s.displayAs==="radio-cards"?e.jsx("div",{className:"grid grid-cols-2 gap-3",role:"radiogroup","aria-labelledby":`${o}-label`,"aria-required":s.required||void 0,children:(N=s.options)==null?void 0:N.map(c=>e.jsxs("button",{type:"button",role:"radio","aria-checked":h===c.value,onClick:()=>a(s.key,c.value),className:U("hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-ring flex flex-col items-start rounded-md border p-3 text-left transition outline-none focus-visible:ring-[3px]",h===c.value&&"border-primary ring-primary bg-accent/30 ring-1"),children:[e.jsx("span",{className:"text-sm font-medium",children:c.label}),c.description&&e.jsx("span",{className:"text-muted-foreground mt-1 text-xs",children:c.description})]},c.value))}):e.jsxs(X,{value:h,onValueChange:c=>a(s.key,c),children:[e.jsx(Z,{id:o,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0,children:e.jsx(ee,{placeholder:s.placeholder??"Select…"})}),e.jsx(se,{children:(C=s.options)==null?void 0:C.map(c=>e.jsx(te,{value:c.value,children:c.label},c.value))})]});case"textarea":return e.jsx(Me,{id:o,value:h,onChange:c=>a(s.key,c.target.value),placeholder:s.placeholder,rows:3,"aria-invalid":!!d||void 0,"aria-required":s.required||void 0});default:return null}};return e.jsxs(ie,{children:[e.jsxs(oe,{id:`${o}-label`,htmlFor:v?void 0:o,children:[s.label,s.required&&!x&&e.jsx("span",{"aria-hidden":"true",className:"text-destructive ml-0.5",children:"*"})]}),b(),s.description&&e.jsx(le,{className:"text-xs",children:s.description}),s.helpMarkdown&&e.jsxs(ce,{children:[e.jsxs(de,{className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ue,{className:"size-3"}),"Where do I find this?",e.jsx(he,{className:"size-3 transition-transform [[data-state=open]_&]:rotate-180"})]}),e.jsx(pe,{children:e.jsx("div",{className:"bg-muted/50 mt-2 rounded-md border p-3",children:e.jsx(I,{content:s.helpMarkdown,className:"text-xs"})})})]}),e.jsx(Y,{children:d&&e.jsx(J.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.15},className:"overflow-hidden",children:e.jsx(me,{children:d})})})]})}function os(s,t){return s.showWhen?t[s.showWhen.field]===s.showWhen.equals:!0}function ls({fields:s,allValues:t,renderField:a}){const r=new Map;for(const l of s){const i=l.section;r.has(i)||r.set(i,[]),r.get(i).push(l)}return e.jsx("div",{className:"space-y-6",children:Array.from(r.entries()).map(([l,i])=>{const n=i.filter(o=>os(o,t));return n.length===0?null:e.jsxs("div",{className:"space-y-3",children:[l&&e.jsx("h4",{className:"text-sm font-semibold",children:l}),e.jsx(qe,{children:e.jsx(Ee,{children:n.map(o=>a(o))})})]},l??"__default")})})}const je=["agent","configure","test","confirm"],cs={agent:"Agent",configure:"Set up",test:"Check",confirm:"Review"};function ds({current:s,showAgentStep:t}){const a=t?je:je.filter(l=>l!=="agent"),r=a.indexOf(s);return e.jsx("div",{className:"flex items-start justify-between px-1",role:"navigation","aria-label":"Setup steps",children:a.map((l,i)=>{const n=i<r,o=i===r,v=i>r;return e.jsxs(m.Fragment,{children:[i>0&&e.jsx("div",{className:U("mt-3 h-px flex-1",n||o?"bg-primary":"border-muted-foreground/40 border-t border-dashed")}),e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("div",{className:U("flex size-6 items-center justify-center rounded-full text-xs font-medium",n&&"bg-primary text-primary-foreground",o&&"bg-primary text-primary-foreground ring-primary/30 ring-2",v&&"border-muted-foreground text-muted-foreground border"),"aria-current":o?"step":void 0,children:n?e.jsx(We,{className:"size-3"}):i+1}),e.jsx("span",{className:U("text-3xs",o?"text-foreground font-medium":"text-muted-foreground"),children:cs[l]})]})]},l)})})}function us({manifest:s,label:t,onLabelChange:a,fields:r,form:l,currentSetupStep:i,hasSetupGuide:n,onOpenGuide:o}){const{Subscribe:v,AppField:h}=l;return e.jsxs("div",{className:"space-y-4",children:[s.setupInstructions&&e.jsxs("div",{className:"flex gap-2 rounded-md border border-blue-200 bg-blue-50 p-3 text-sm text-blue-800 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-200",children:[e.jsx(Ve,{className:"mt-0.5 size-4 shrink-0"}),e.jsx(I,{content:s.setupInstructions,className:"text-sm text-blue-800 dark:text-blue-200"})]}),(s.actionButton||n)&&e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[n&&e.jsxs(k,{type:"button",variant:"outline",size:"sm",onClick:o,children:[e.jsx(Se,{className:"mr-1.5 size-3.5"}),"Setup guide"]}),s.actionButton&&e.jsx(k,{asChild:!0,type:"button",variant:"outline",size:"sm",children:e.jsx(De,{href:s.actionButton.url,children:s.actionButton.label})})]}),i&&e.jsx("h4",{className:"text-sm font-medium",children:i.title}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"adapter-label",children:"Name (optional)"}),e.jsx(re,{id:"adapter-label",placeholder:s.displayName,value:t,onChange:x=>a(x.target.value)}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Helps you tell this connection apart."})]}),e.jsx(v,{selector:x=>x.values,children:x=>e.jsx(ls,{fields:r,allValues:x,renderField:y=>e.jsx(h,{name:y.key,children:d=>{var b;return e.jsx(is,{field:y,value:d.state.value,onChange:(N,C)=>d.handleChange(C),onBlur:d.handleBlur,error:d.state.meta.isTouched?(b=d.state.meta.errors[0])==null?void 0:b.toString():void 0,allValues:x})}},y.key)})})]})}function hs({isPending:s,isSuccess:t,isError:a,errorMessage:r,botUsername:l,onRetry:i}){return e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(ke,{size:"lg",className:"text-muted-foreground"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Trying to reach it…"})]}),t&&e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(Pe,{className:"text-status-success size-8"}),e.jsx("p",{className:"text-status-success-fg text-sm",children:"Reachable"}),l&&e.jsx("div",{className:"flex items-center gap-2 rounded-md border px-3 py-2 text-sm",children:e.jsxs("span",{className:"font-mono",children:["@",l]})})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Re,{className:"text-destructive size-8"}),e.jsx("p",{className:"text-destructive text-sm",children:"Not reachable"}),r&&e.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-red-200 bg-red-50 p-3 text-xs text-red-700 dark:border-red-800 dark:bg-red-950 dark:text-red-300",children:[e.jsx(Oe,{className:"mt-0.5 size-3 shrink-0"}),e.jsx("span",{children:r})]}),e.jsx(k,{variant:"outline",size:"sm",onClick:i,children:"Retry"})]})]})}function ps(s){return s.length>8?"•••• "+s.slice(-4):"•••"}function ms({manifest:s,adapterId:t,isEditMode:a,values:r,botUsername:l,agentName:i}){return e.jsxs("div",{className:"space-y-3",children:[!a&&i&&e.jsxs("p",{className:"bg-accent/30 rounded-md border px-3 py-2 text-sm",children:["Messages here go to ",e.jsx("span",{className:"font-medium",children:i}),"."]}),!a&&e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Connection ID"}),e.jsx("span",{className:"font-mono",children:t})]}),s.configFields.map(n=>{if(n.showWhen&&r[n.showWhen.field]!==n.showWhen.equals)return null;const o=String(r[n.key]??""),v=n.type==="password"?ps(o):o;return e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:n.label}),e.jsx("span",{className:"max-w-[200px] truncate font-mono",children:v})]},n.key)}),l&&s.type==="telegram"&&e.jsxs("a",{href:`https://t.me/${l}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex items-center gap-1.5 text-sm underline-offset-4 hover:underline",children:["Message @",l," in Telegram"]})]})}const ye=[{value:"per-chat",label:"One shared chat per group or channel",hint:"Everyone there shares one chat with the agent."},{value:"per-user",label:"One chat per person",hint:"Each person gets their own chat, even in a group."},{value:"stateless",label:"A fresh start every message",hint:"Nothing carries over from the message before."}];function xs({agentOptions:s,agentId:t,onAgentIdChange:a,strategy:r,onStrategyChange:l}){var n;const i=s.length===1?s[0]:void 0;return m.useEffect(()=>{i&&!t&&a(i.id)},[i,t,a]),s.length===0?e.jsx("p",{role:"alert",className:"text-muted-foreground rounded-md border border-dashed px-4 py-6 text-center text-sm",children:"No agents yet. Add one from the Team page first."}):e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Messages here go to this agent."}),i?e.jsxs("div",{className:"bg-accent/30 rounded-md border px-4 py-3 text-sm",children:[e.jsx("span",{className:"font-medium",children:ge(i)})," will answer."]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"wizard-agent",children:"Who should answer?"}),e.jsxs(X,{value:t,onValueChange:a,children:[e.jsx(Z,{id:"wizard-agent",className:"w-full",children:e.jsx(ee,{placeholder:"Pick an agent"})}),e.jsx(se,{children:s.map(o=>e.jsx(te,{value:o.id,children:ge(o)},o.id))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ae,{htmlFor:"wizard-memory",children:"How the agent remembers"}),e.jsxs(X,{value:r,onValueChange:o=>l(o),children:[e.jsx(Z,{id:"wizard-memory",className:"w-full",children:e.jsx(ee,{})}),e.jsx(se,{children:ye.map(o=>e.jsx(te,{value:o.value,children:o.label},o.value))})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:(n=ye.find(o=>o.value===r))==null?void 0:n.hint})]})]})}function gs({open:s,onOpenChange:t,title:a,content:r}){return e.jsx(Le,{open:s,onOpenChange:t,children:e.jsxs(_e,{side:"right",className:"w-[480px] overflow-y-auto sm:max-w-lg",children:[e.jsxs(Ge,{children:[e.jsxs(Ue,{className:"flex items-center gap-2",children:[e.jsx(Se,{className:"size-4"}),a," setup guide"]}),e.jsx(Ie,{children:"Step-by-step setup instructions."})]}),e.jsx("div",{className:"mt-4 px-4",children:e.jsx(I,{content:r})})]})})}function we(s){const t=s.setupSteps;if(!t||t.length===0)return[];const a=new Set(t.flatMap(r=>r.fields));return s.configFields.filter(r=>!a.has(r.key))}function fs(s,t){return typeof t=="string"||t===void 0||t===null?t:s.valueShape==="id-list"?Array.isArray(t)?t.join(`
2
- `):t:s.valueShape==="json-object"&&typeof t=="object"?JSON.stringify(t,null,2):t}function js(s,t){const a=s.setupSteps;if(!a||a.length===0)return s.configFields;const r=a[t];if(!r)return s.configFields;const l=s.configFields.filter(i=>r.fields.includes(i.key));return t!==a.length-1?l:[...l,...we(s)]}const ys="Advanced";function K(s){const t={};for(const[a,r]of Object.entries(s)){const l=a.split(".");let i=t;for(let n=0;n<l.length-1;n++){const o=l[n];(!(o in i)||typeof i[o]!="object"||i[o]===null)&&(i[o]={}),i=i[o]}i[l[l.length-1]]=r}return t}function ve(s,t){const a=t.split(".");let r=s;for(const l of a){if(r==null||typeof r!="object")return;r=r[l]}return r}function vs(s,t){const a={};for(const r of s.configFields){const l=t?ve(t,r.key):void 0;l!==void 0&&r.type!=="password"?a[r.key]=fs(r,l):r.type==="password"&&t&&ve(t,r.key)!==void 0?a[r.key]="***":r.default!==void 0?a[r.key]=r.default:a[r.key]=r.type==="boolean"?!1:""}return a}function bs(s,t=[]){const a=s.type;if(!t.includes(a))return a;let r=2;for(;t.includes(`${a}-${r}`);)r++;return`${a}-${r}`}function Ns({manifest:s,existingInstance:t,existingAdapterIds:a=[],onOpenChange:r}){const l=!!t,[i,n]=m.useState(t?"configure":"agent"),[o,v]=m.useState(!1),[h]=m.useState(()=>(t==null?void 0:t.id)??bs(s,a)),[x,y]=m.useState(()=>{var p;return((p=t==null?void 0:t.config)==null?void 0:p.label)??""}),[d,b]=m.useState(0),[N,C]=m.useState(""),[c,P]=m.useState(""),[$,R]=m.useState("per-chat"),E=ss(),z=ts(),S=rs(),M=ns(),{data:F}=Qe(),w=be(),q=Ne(),T=(F==null?void 0:F.agents)??[],B=s.setupSteps&&s.setupSteps.length>0,j=as({defaultValues:vs(s,t==null?void 0:t.config),validators:{onSubmit:({value:p})=>{const g={};for(const u of s.configFields)if(!(u.showWhen&&p[u.showWhen.field]!==u.showWhen.equals)&&u.required){const f=p[u.key];(f==null||f==="")&&(g[u.key]=`${u.label} is required`)}return Object.keys(g).length>0?{fields:g}:void 0}},onSubmit:async()=>{}}),W=m.useMemo(()=>{const p=new Set(we(s).map(g=>g.key));return js(s,d).map(g=>p.has(g.key)&&!g.section?{...g,section:ys}:g)},[s,d]),O=m.useCallback(()=>{const p=j.state.values;let g=!0;for(const u of W)if(!(u.showWhen&&p[u.showWhen.field]!==u.showWhen.equals)&&u.required){const f=p[u.key];(f==null||f==="")&&(j.setFieldMeta(u.key,A=>({...A,isTouched:!0,errors:[`${u.label} is required`],errorMap:{onSubmit:`${u.label} is required`}})),g=!1)}return g},[j,W]),L=m.useCallback(()=>{if(i==="agent"){if(!c)return;n("configure");return}if(i==="configure"){if(!O())return;if(B&&s.setupSteps&&d<s.setupSteps.length-1){b(u=>u+1);return}const g=j.state.values;n("test"),S.mutate({type:s.type,config:K(g)},{onSuccess:u=>{u.botUsername&&(C(u.botUsername),x||y(`@${u.botUsername}`))}})}else i==="test"&&n("confirm")},[i,c,B,s,d,O,j,S,x]),V=m.useCallback(()=>{i==="test"?(n("configure"),S.reset()):i==="confirm"?n("test"):i==="configure"&&(B&&d>0?b(p=>p-1):l||n("agent"))},[i,B,d,S,l]),D=m.useCallback(async p=>{try{return await w.removeRelayAdapter(p),!0}catch{return!1}finally{q.invalidateQueries({queryKey:["relay"]})}},[w,q]),Q=m.useCallback(()=>{const p=j.state.values,g=K(p),u=x?{...g,label:x}:g;if(l&&t){z.mutate({id:t.id,config:u},{onSuccess:()=>r(!1)});return}if(!c){n("agent");return}E.mutate({type:s.type,id:h,config:u},{onSuccess:()=>{M.mutate({adapterId:h,agentId:c,sessionStrategy:$,label:""},{onSuccess:()=>{var A;const f=((A=T.find(_=>_.id===c))==null?void 0:A.name)??c;G.success(`${s.displayName} is connected`,{description:`Messages here go to ${f}.`}),r(!1)},onError:f=>{n("agent"),D(h).then(A=>{A?G.error("Nothing was set up",{description:`${s.displayName} couldn’t be linked to an agent, so it wasn’t saved. ${f.message}`}):G.error("Couldn’t finish undoing",{description:`${s.displayName} was added with no agent to answer it. Remove it from Messaging. ${f.message}`})})}})},onError:f=>{var A,_,ne;(A=f.message)!=null&&A.includes("timed out")?G.error(`Couldn’t reach ${s.displayName}`,{description:"Check your token and network, then try again."}):((_=f.message)!=null&&_.includes("duplicate")||(ne=f.message)!=null&&ne.includes("exists"))&&(n("configure"),b(0))}})},[j,l,t,z,E,M,s,h,x,c,$,T,D,r]),Ce=m.useCallback(p=>{p||(n(l?"configure":"agent"),b(0),y(""),C(""),P(""),R("per-chat"),v(!1),j.reset(),S.reset()),r(p)},[r,j,S,l]),Ae=m.useCallback(()=>{S.mutate({type:s.type,config:K(j.state.values)})},[S,s.type,j]),Fe=E.isPending||z.isPending||M.isPending,Be=B&&s.setupSteps?s.setupSteps[d]:void 0;return{step:i,isEditMode:l,adapterId:h,label:x,setLabel:y,botUsername:N,guideOpen:o,setGuideOpen:v,form:j,visibleFields:W,bindAgentId:c,setBindAgentId:P,bindStrategy:$,setBindStrategy:R,agentOptions:T,isSaving:Fe,hasSetupSteps:B,setupStepIndex:d,currentSetupStep:Be,testConnection:S,handleContinue:L,handleBack:V,handleSave:Q,handleOpenChange:Ce,handleRetryTest:Ae}}function qs({open:s,onOpenChange:t,manifest:a,existingInstance:r,existingAdapterIds:l=[]}){var L;const i=Ns({manifest:a,existingInstance:r,existingAdapterIds:l,onOpenChange:t}),{step:n,isEditMode:o,adapterId:v,label:h,setLabel:x,botUsername:y,guideOpen:d,setGuideOpen:b,form:N,visibleFields:C,bindAgentId:c,setBindAgentId:P,bindStrategy:$,setBindStrategy:R,agentOptions:E,isSaving:z,hasSetupSteps:S,setupStepIndex:M,currentSetupStep:F,testConnection:w,handleContinue:q,handleBack:T,handleSave:B,handleOpenChange:j,handleRetryTest:W}=i,O={agent:"Pick who answers messages here.",configure:(F==null?void 0:F.description)??"Fill in the settings this needs.",test:"Checking the connection…",confirm:"Check it over, then save."}[n];return e.jsxs(m.Fragment,{children:[e.jsx(He,{open:s,onOpenChange:j,children:e.jsxs(Ke,{className:"flex max-h-[85vh] max-w-lg flex-col",children:[e.jsxs(Ye,{children:[e.jsx(Je,{children:o?`Edit ${a.displayName}`:`Add ${a.displayName}`}),e.jsx(Xe,{children:O})]}),e.jsxs("div",{className:"min-h-0 space-y-4 overflow-y-auto py-2",children:[e.jsx(ds,{current:n,showAgentStep:!o}),e.jsx(Y,{mode:"wait",children:e.jsxs(J.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[n==="agent"&&e.jsx(xs,{agentOptions:E,agentId:c,onAgentIdChange:P,strategy:$,onStrategyChange:R}),n==="configure"&&e.jsx(us,{manifest:a,label:h,onLabelChange:x,fields:C,form:N,currentSetupStep:F,hasSetupGuide:!!a.setupGuide,onOpenGuide:()=>b(!0)}),n==="test"&&e.jsx(hs,{isPending:w.isPending,isSuccess:w.isSuccess,isError:w.isError,errorMessage:(L=w.error)==null?void 0:L.message,botUsername:y,onRetry:W}),n==="confirm"&&e.jsx(N.Subscribe,{selector:V=>V.values,children:V=>{var D;return e.jsx(ms,{manifest:a,adapterId:v,isEditMode:o,values:V,botUsername:y,agentName:((D=E.find(Q=>Q.id===c))==null?void 0:D.name)||c})}})]},n)})]}),e.jsxs(Ze,{className:"flex items-center justify-between sm:justify-between",children:[e.jsxs("div",{children:[(n==="test"||n==="confirm")&&e.jsxs(k,{variant:"ghost",onClick:T,disabled:z,children:[e.jsx(fe,{className:"mr-1 size-4"}),"Back"]}),n==="configure"&&(S?M>0:!o)&&e.jsxs(k,{variant:"ghost",onClick:T,children:[e.jsx(fe,{className:"mr-1 size-4"}),"Back"]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),n==="agent"&&e.jsxs(k,{onClick:q,disabled:!c,children:["Continue",e.jsx(H,{className:"ml-1 size-4"})]}),n==="configure"&&e.jsxs(k,{onClick:q,children:["Continue",e.jsx(H,{className:"ml-1 size-4"})]}),n==="test"&&!w.isPending&&!w.isSuccess&&e.jsx(k,{variant:"ghost",onClick:q,children:"Skip"}),n==="test"&&w.isSuccess&&e.jsxs(k,{onClick:q,children:["Continue",e.jsx(H,{className:"ml-1 size-4"})]}),n==="confirm"&&e.jsxs(k,{onClick:B,disabled:z,children:[z&&e.jsx(ke,{className:"mr-2"}),o?"Save changes":"Connect"]})]})]})]})}),a.setupGuide&&e.jsx(gs,{open:d,onOpenChange:b,title:a.displayName,content:a.setupGuide})]})}export{qs as A,zs as u};
@@ -1 +0,0 @@
1
- import{gR as v,gS as fe,gO as be,gT as Ce,j as e,bJ as ee,bK as ne,bL as te,bM as se,gU as Ne,bN as ae,gV as ie,bO as re,bP as ce,bR as oe,a1 as de,a3 as Ie,a4 as Te,a2 as Ae,y as le,gW as Se,r as A,gX as he,eo as g,eh as S,ei as k,ej as R,ek as F,el as b,gY as ke,gZ as Re,$ as E,_ as pe,aN as Fe,g_ as Oe,g$ as we,c$ as Me,d2 as De,d3 as Ee,d5 as Be,d6 as $e,d7 as _e,ak as Le,I as Pe,h0 as J,B,dO as ze,h1 as qe,fi as He,h2 as Ye,x as Ge}from"./index-p3WivF1M.js";import{B as Ke}from"./use-bindings-CPbqKyo6.js";import{u as Ue}from"./form-CA_eiUg-.js";import{u as We}from"./use-adapter-catalog-CDxy08u_.js";import{I as Qe,t as Ve}from"./trust-posture-BQE9NSf_.js";function X(n){return`Turn on ${be(n.stop)}`}function Je(n){return!v(n)||fe(n)?null:"This stop never pauses to ask. It acts without checking with you."}function Xe({descriptor:n,consequence:i,onCancel:o,onConfirm:h}){const d=Ce(n??void 0),y=n?Je(n):null;return e.jsx(ee,{open:n!==null,onOpenChange:C=>!C&&o(),children:e.jsxs(ne,{children:[e.jsxs(te,{children:[e.jsxs(se,{className:"flex items-center gap-2",children:[e.jsx(Ne,{descriptor:n??void 0,className:`size-4 ${d}`}),n&&X(n)]}),e.jsxs(ae,{children:[n==null?void 0:n.promise,y&&" ",y&&e.jsx("span",{className:"text-foreground mt-2 block","data-testid":"consent-asks-note",children:y})]})]}),e.jsx("div",{className:"text-muted-foreground space-y-2 text-sm",children:i}),n&&e.jsx(ie,{mode:n.id,descriptor:n}),e.jsxs(re,{children:[e.jsx(ce,{children:"Cancel"}),e.jsx(oe,{onClick:h,children:n&&X(n)})]})]})})}function ln(n={}){const i=de(),o=Ie();return Te({mutationFn:h=>i.createBinding(h),onSuccess:()=>{o.invalidateQueries({queryKey:[...Ke]})},meta:n.suppressErrorToast?{suppressErrorToast:!0}:{errorLabel:n.errorLabel??"Couldn’t add that connection"}})}function Ze(n){const i=de();return Ae({queryKey:["relay","observed-chats",n],queryFn:()=>i.getObservedChats(n),enabled:!!n,staleTime:3e4})}const Z=[{value:"per-chat",label:"One shared chat per group or channel",description:"Everyone there shares one chat with the agent."},{value:"per-user",label:"One chat per person",description:"Each person gets their own chat, even in a group."},{value:"stateless",label:"A fresh start every message",description:"Nothing carries over from the message before."}],Y="claude-code";function ve({strategy:n,onStrategyChange:i,permissionMode:o,onPermissionModeChange:h,canInitiate:d,onCanInitiateChange:y,canReply:C,onCanReplyChange:O,canReceive:w,onCanReceiveChange:M,notifyOnTaskComplete:$,onNotifyOnTaskCompleteChange:_,notifyBootstrapHint:p,bridged:L,open:P,onOpenChange:z,hasChanges:q}){const u=Z.find(l=>l.value===n),j=le(Y),c=(j==null?void 0:j.permissionModes.values)??[],r=c.find(l=>l.id===o),D=(r==null?void 0:r.label)??Se(o),[f,I]=A.useState(null);function H(l){const N=c.find(T=>T.id===l);if(N&&v(N)){I(N);return}h(l)}return e.jsxs(e.Fragment,{children:[e.jsxs(he,{open:P,onOpenChange:z,trigger:"Advanced",badge:q?e.jsx(pe,{variant:"secondary",children:"Modified"}):void 0,children:[L?e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(g,{children:"How the agent remembers"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Kept in the channel this chat is linked to."})]}):e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(g,{htmlFor:"binding-session-strategy",children:"How the agent remembers"}),e.jsxs(S,{value:n,onValueChange:l=>i(l),children:[e.jsx(k,{id:"binding-session-strategy",className:"w-full",children:e.jsx(R,{})}),e.jsx(F,{children:Z.map(l=>e.jsx(b,{value:l.value,children:l.label},l.value))})]}),u&&e.jsx("p",{className:"text-muted-foreground text-xs",children:u.description})]}),e.jsxs("div",{className:"space-y-2 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Permissions"}),c.length===0?e.jsxs("p",{"data-testid":"trust-dial-unavailable",className:"text-muted-foreground px-1 text-xs leading-relaxed",children:["Set to “",D,"”. No other levels to choose yet. Saving keeps it."]}):e.jsxs(e.Fragment,{children:[e.jsx(ke,{mode:o,descriptors:c,onChangeMode:H,strandsWorkingMode:!0,strandedNote:e.jsxs(e.Fragment,{children:["Set to “",D,"”. Saving keeps it, or pick a stop."]})}),e.jsx(ie,{mode:o,...r?{descriptor:r}:{},className:"px-1"})]})]}),e.jsxs("div",{className:"space-y-2.5 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Message direction"}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsxs(g,{htmlFor:"perm-initiate",className:"flex cursor-pointer items-center gap-1.5 text-xs font-normal",children:[e.jsx(Re,{className:"text-muted-foreground size-3"}),"Agent can message first"]}),e.jsx(E,{id:"perm-initiate",checked:d,onCheckedChange:y,"aria-label":"Agent can message first"})]}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(g,{htmlFor:"perm-reply",className:"cursor-pointer text-xs font-normal",children:"Agent can reply to messages"}),e.jsx(E,{id:"perm-reply",checked:C,onCheckedChange:O,"aria-label":"Agent can reply to messages"})]}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(g,{htmlFor:"perm-receive",className:"cursor-pointer text-xs font-normal",children:"Agent receives new messages"}),e.jsx(E,{id:"perm-receive",checked:w,onCheckedChange:M,"aria-label":"Agent receives new messages"})]})]}),e.jsxs("div",{className:"space-y-2.5 px-4 py-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Notifications"}),e.jsxs("div",{className:"flex cursor-pointer items-center justify-between gap-3",children:[e.jsx(g,{htmlFor:"notify-task-complete",className:"cursor-pointer text-xs font-normal",children:"Message me when scheduled tasks finish"}),e.jsx(E,{id:"notify-task-complete",checked:$,onCheckedChange:_,"aria-label":"Message me when scheduled tasks finish"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"When off, you still hear about runs that didn’t finish."}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Needs “Agent can message first”."}),p&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Message your bot once to start. Bots can’t write first."})]})]}),e.jsx(Xe,{descriptor:f,consequence:e.jsxs(e.Fragment,{children:["Anyone who can message this connection can make the agent act, with no one asked."," ",e.jsxs(Qe,{label:"About asking in the chat",title:"At a stop that asks",children:[e.jsx("p",{children:"Where your connection can show buttons, the agent waits for Approve or Deny."}),e.jsx("p",{children:"Only people on the approver list can answer."}),e.jsx("p",{children:"An ask nobody answers is refused after 10 minutes, and the agent carries on."})]})]}),onCancel:()=>I(null),onConfirm:()=>{f&&h(f.id),I(null)}})]})}const m="__any__",en={"per-chat":"One shared chat per group or channel","per-user":"One chat for each person",stateless:"No memory between messages"},me=[{value:"dm",label:"Direct message"},{value:"group",label:"Group"},{value:"channel",label:"Broadcast channel"},{value:"thread",label:"Thread"}];function ge(n){var i;return((i=me.find(o=>o.value===n))==null?void 0:i.label)??n}function nn({sessionStrategy:n,chatDisplayName:i,channelType:o}){const h=en[n];return i?`${h} in ${i}`:o?`${h} · ${ge(o)}`:h}function hn(n){return{adapterId:n.adapterId,agentId:n.agentId,sessionStrategy:n.sessionStrategy,label:n.label,permissionMode:n.permissionMode,chatId:n.chatId,channelType:n.channelType,canInitiate:n.canInitiate,canReply:n.canReply,canReceive:n.canReceive,notifyOnTaskComplete:n.notifyOnTaskComplete}}function pn(n){return{sessionStrategy:n.sessionStrategy,label:n.label,permissionMode:n.permissionMode,chatId:n.chatId??null,channelType:n.channelType??null,canInitiate:n.canInitiate,canReply:n.canReply,canReceive:n.canReceive,notifyOnTaskComplete:n.notifyOnTaskComplete}}function tn(n){return!!(n!=null&&n.canInitiate||(n==null?void 0:n.canReply)===!1||(n==null?void 0:n.canReceive)===!1||(n==null?void 0:n.notifyOnTaskComplete)===!1||(n==null?void 0:n.permissionMode)!==void 0&&n.permissionMode!=="acceptEdits"||n!=null&&n.sessionStrategy&&n.sessionStrategy!=="per-chat")}function sn(n,i){return{adapterId:(n==null?void 0:n.adapterId)??"",agentId:(n==null?void 0:n.agentId)??"",strategy:(n==null?void 0:n.sessionStrategy)??"per-chat",label:(n==null?void 0:n.label)??"",chatId:(n==null?void 0:n.chatId)??m,channelType:(n==null?void 0:n.channelType)??m,permissionMode:(n==null?void 0:n.permissionMode)??(i==null?void 0:i.defaultPermissionMode)??"acceptEdits",canInitiate:(n==null?void 0:n.canInitiate)??(i==null?void 0:i.defaultCanInitiate)??!1,canReply:(n==null?void 0:n.canReply)??!0,canReceive:(n==null?void 0:n.canReceive)??!0,notifyOnTaskComplete:(n==null?void 0:n.notifyOnTaskComplete)??!0}}function mn({open:n,onOpenChange:i,onConfirm:o,mode:h,initialValues:d,adapterName:y,agentName:C,onDelete:O,bindingId:w,isPending:M,bridged:$,bridgeSlot:_}){const p=h==="edit",[L,P]=A.useState(()=>!!(d!=null&&d.chatId||d!=null&&d.channelType)),[z,q]=A.useState(()=>tn(d)),{data:u}=Fe(),j=le(Y),[c]=A.useState(()=>{var t;return sn(d,p?void 0:{defaultPermissionMode:Oe(we(u==null?void 0:u.executionDefaults,Y),(j==null?void 0:j.permissionModes.values)??[]),defaultCanInitiate:u!=null&&Ve((t=u.permissions)==null?void 0:t.preset)==="trusted"})}),r=Ue({defaultValues:c,onSubmit:async({value:t})=>{await o({adapterId:t.adapterId,agentId:t.agentId,sessionStrategy:t.strategy,label:t.label,permissionMode:t.permissionMode,chatId:t.chatId===m?void 0:t.chatId,channelType:t.channelType===m?void 0:t.channelType,canInitiate:t.canInitiate,canReply:t.canReply,canReceive:t.canReceive,notifyOnTaskComplete:t.notifyOnTaskComplete}),p||r.reset()}}),{data:D=[]}=We(),{data:f}=Me(),[I,H]=A.useState(()=>(d==null?void 0:d.adapterId)??""),{data:l=[]}=Ze(I||void 0),N=D.flatMap(t=>t.instances.filter(x=>x.enabled).map(x=>({id:x.id,label:x.label?`${x.label} (${t.manifest.displayName})`:`${x.id} (${t.manifest.displayName})`}))),T=(f==null?void 0:f.agents)??[];function xe(){r.setFieldValue("chatId",m),r.setFieldValue("channelType",m)}return e.jsx(De,{open:n,onOpenChange:i,children:e.jsxs(Ee,{className:"max-h-[85vh] max-w-md gap-0 p-0",children:[e.jsxs(Be,{className:"border-b px-4 py-3",children:[e.jsx($e,{children:p?"Edit connection":"Add connection"}),e.jsx(_e,{className:"sr-only",children:p?"Edit this connection’s settings":"Connect this agent to a chat"})]}),e.jsx(r.Subscribe,{selector:t=>({values:t.values,isSubmitting:t.isSubmitting}),children:({values:t,isSubmitting:x})=>{var V;const G=p||!!t.adapterId&&!!t.agentId,ue=!p||t.adapterId!==c.adapterId||t.agentId!==c.agentId||t.strategy!==c.strategy||t.label!==c.label||t.chatId!==c.chatId||t.channelType!==c.channelType||t.permissionMode!==c.permissionMode||t.canInitiate!==c.canInitiate||t.canReply!==c.canReply||t.canReceive!==c.canReceive||t.notifyOnTaskComplete!==c.notifyOnTaskComplete,K=p?C:(V=T.find(s=>s.id===t.agentId))==null?void 0:V.name,U=G&&K?`${nn({sessionStrategy:t.strategy,chatDisplayName:t.chatId!==m?`#${t.chatId}`:void 0,channelType:t.channelType!==m?t.channelType:void 0})}. Routed to ${K}.`:null,W=t.chatId!==m||t.channelType!==m,ye=t.strategy!=="per-chat"||t.permissionMode!=="acceptEdits"||t.canInitiate||!t.canReply||!t.canReceive||!t.notifyOnTaskComplete,je=!G||!ue||!!M||x,Q=!!M||x;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-5 overflow-y-auto px-4 py-5",children:[p?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Connection:"," ",e.jsx("span",{className:"text-foreground font-medium",children:y})," →"," ",e.jsx("span",{className:"text-foreground font-medium",children:C})]}),_]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{htmlFor:"binding-adapter",children:"Source"}),N.length===0?e.jsx("p",{className:"text-muted-foreground border-input rounded-md border px-3 py-2 text-sm opacity-50",children:"Nothing set up yet"}):e.jsx(r.AppField,{name:"adapterId",children:s=>e.jsxs(S,{value:s.state.value,onValueChange:a=>{s.handleChange(a),H(a)},children:[e.jsx(k,{id:"binding-adapter",className:"w-full",children:e.jsx(R,{placeholder:"Pick a source"})}),e.jsx(F,{children:N.map(a=>e.jsx(b,{value:a.id,children:a.label},a.id))})]})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{htmlFor:"binding-agent",children:"Agent"}),T.length===0?e.jsx("p",{className:"text-muted-foreground border-input rounded-md border px-3 py-2 text-sm opacity-50",children:"No agents yet"}):e.jsx(r.AppField,{name:"agentId",children:s=>e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(k,{id:"binding-agent",className:"w-full",children:e.jsx(R,{placeholder:"Select an agent"})}),e.jsx(F,{children:T.map(a=>e.jsx(b,{value:a.id,children:Le(a)},a.id))})]})})]})]}),e.jsx(r.AppField,{name:"label",children:s=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(g,{htmlFor:"binding-label",children:"Label (optional)"}),e.jsx(Pe,{id:"binding-label",placeholder:"e.g., Customer support bot",value:s.state.value,onBlur:s.handleBlur,onChange:a=>s.handleChange(a.target.value)}),e.jsx(J,{children:"A name to tell this connection apart"})]})}),e.jsxs(he,{open:L,onOpenChange:P,trigger:"Chat filter",badge:W?e.jsx(pe,{variant:"secondary",children:"Active"}):void 0,children:[e.jsx(r.AppField,{name:"chatId",children:s=>e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(g,{htmlFor:"binding-chat-id",children:"Chat ID"}),e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(k,{id:"binding-chat-id",className:"w-full",children:e.jsx(R,{placeholder:"Any chat"})}),e.jsxs(F,{children:[e.jsx(b,{value:m,children:"Any chat"}),l.map(a=>e.jsxs(b,{value:a.chatId,children:[e.jsx("span",{children:a.displayName??a.chatId}),(a.channelType||a.messageCount>0)&&e.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:[a.channelType?ge(a.channelType):null,`${a.messageCount} messages`].filter(Boolean).join(" · ")})]},a.chatId))]})]}),e.jsx(J,{children:"Only take messages from this chat"})]})}),e.jsx(r.AppField,{name:"channelType",children:s=>e.jsxs("div",{className:"space-y-1.5 px-4 py-3",children:[e.jsx(g,{htmlFor:"binding-channel-type",children:"Chat type"}),e.jsxs(S,{value:s.state.value,onValueChange:s.handleChange,children:[e.jsx(k,{id:"binding-channel-type",className:"w-full",children:e.jsx(R,{placeholder:"Any type"})}),e.jsxs(F,{children:[e.jsx(b,{value:m,children:"Any type"}),me.map(a=>e.jsx(b,{value:a.value,children:a.label},a.value))]})]})]})}),W&&e.jsx("div",{className:"px-4 py-3",children:e.jsx(B,{variant:"ghost",size:"sm",onClick:xe,children:"Clear filters"})})]}),e.jsx(ve,{strategy:t.strategy,onStrategyChange:s=>r.setFieldValue("strategy",s),permissionMode:t.permissionMode,onPermissionModeChange:s=>r.setFieldValue("permissionMode",s),canInitiate:t.canInitiate,onCanInitiateChange:s=>r.setFieldValue("canInitiate",s),canReply:t.canReply,onCanReplyChange:s=>r.setFieldValue("canReply",s),canReceive:t.canReceive,onCanReceiveChange:s=>r.setFieldValue("canReceive",s),notifyOnTaskComplete:t.notifyOnTaskComplete,onNotifyOnTaskCompleteChange:s=>r.setFieldValue("notifyOnTaskComplete",s),notifyBootstrapHint:l.length===0,bridged:$,open:z,onOpenChange:q,hasChanges:ye}),U&&e.jsx("p",{className:"text-muted-foreground bg-muted/50 rounded-md px-3 py-2 text-xs italic",children:U})]}),e.jsxs(ze,{className:"border-t px-4 py-3",children:[p&&O&&w&&e.jsxs(ee,{children:[e.jsx(qe,{asChild:!0,children:e.jsxs(B,{variant:"ghost",size:"sm",className:"mr-auto text-red-600 hover:bg-red-50 hover:text-red-700 dark:hover:bg-red-950",children:[e.jsx(He,{className:"mr-1.5 size-3.5"}),"Remove"]})}),e.jsxs(ne,{children:[e.jsxs(te,{children:[e.jsx(se,{children:"Remove this connection?"}),e.jsx(ae,{children:"This agent stops getting messages from it."})]}),e.jsxs(re,{children:[e.jsx(ce,{children:"Cancel"}),e.jsx(oe,{onClick:()=>O(w),className:Ye({variant:"destructive"}),children:"Remove connection"})]})]})]}),e.jsx(B,{variant:"ghost",size:"sm",onClick:()=>i(!1),children:"Cancel"}),e.jsxs(B,{size:"sm",onClick:()=>r.handleSubmit(),disabled:je,children:[Q&&e.jsx(Ge,{size:"xs",className:"mr-1.5"}),Q?"Saving…":p?"Save changes":"Add connection"]})]})]})}})]})})}export{mn as B,ln as a,nn as b,hn as c,ge as d,pn as t,Ze as u};
@@ -1,44 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C3IsCAxA.js","assets/index-p3WivF1M.js","assets/index-CujX3mpY.css","assets/room-files-source-BKUFMU_b.js","assets/markdown-content-BFHUHPgi.js","assets/file-exclamation-point-DtjBa2XX.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-Dbujw1c2.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-Po-L3HFe.js","assets/link-2-DugR2HHU.js","assets/file-DHPgnMgj.js","assets/git-branch-BLIYLcM4.js","assets/more-details-DhdX4DGU.js"])))=>i.map(i=>d[i]);
2
- import{O as F,r as i,j as l,B as ue,h4 as bn,mS as vn,g as kn,k1 as wn,G as te,a1 as fe,a3 as De,a4 as Pe,aP as H,cj as Fe,ck as Nn,cZ as In,mT as Rn,ly as Cn,mU as An,h as Mn,ax as jn,cq as Le,gw as se,q as Z,a7 as Be,s as pe,lY as Sn,mV as _n,mC as On,mW as En,eS as Tn,g9 as $n,e3 as Dn,mQ as Pn,mX as Fn,mY as Ln,a0 as Bn,bx as Un,mZ as Hn,m_ as Kn,jr as Wn,iq as qn,gB as Vn,kS as Ne,m$ as Ue,bW as zn,kR as Q,kV as He,n0 as Gn,ci as ge,ai as Jn,b_ as he,ij as Ke,n1 as Yn,cu as We,n2 as Qn,ff as Xn,ki as qe,n3 as Ve,aZ as Zn,gy as ze,kU as et,n4 as Ge,n5 as nt,n6 as tt,n7 as st,n8 as Ie,eU as ot,n9 as at,na as rt,nb as it,nc as ct,nd as lt,ne as dt,l as ut,hh as mt,ar as Je,kJ as ft,aj as pt,nf as gt,ng as ht,nh as xt,b8 as yt,c6 as bt,ni as vt,nj as kt,nk as wt,nl as Nt,by as Re,f3 as It}from"./index-p3WivF1M.js";import{g as Ce,m as Ae,h as xe,f as Ye,M as Rt,a as Ct,E as At,i as Mt,j as jt,c as P,k as St,b as _t,l as Ot,u as Et,C as Tt}from"./registry-Cog_2xvt.js";import"./WidgetErrorCard-CgRMeAEO.js";import{R as $t,A as Qe}from"./repeat-Dag80z5v.js";import{u as Dt}from"./use-room-sessions-CNqHgLVa.js";import{M as Pt}from"./markdown-content-BFHUHPgi.js";import{W as Ft,a as Lt}from"./find-latest-widget-fence-Bv9D10ve.js";import{f as Bt}from"./format-duration-BCr6uzby.js";import{H as Ut,a as Ht,b as Kt}from"./RuntimeSetupDialog-E6f7Rd2W.js";import{M as Me}from"./mention-pill-DXBno6EY.js";import{R as Wt}from"./rotate-ccw-clock-egrvXlKX.js";import{U as qt}from"./unplug-CklGWwz7.js";import{M as Vt}from"./message-square-off-BH8wbm2a.js";import{i as zt}from"./registry-DLWJMbtY.js";/**
3
- * @license lucide-react v1.48.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const Xe={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};Xe.node;const Gt=F(Xe);/**
8
- * @license lucide-react v1.48.0 - ISC
9
- *
10
- * This source code is licensed under the ISC license.
11
- * See the LICENSE file in the root directory of this source tree.
12
- */const Ze={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};Ze.node;const Jt=F(Ze);/**
13
- * @license lucide-react v1.48.0 - ISC
14
- *
15
- * This source code is licensed under the ISC license.
16
- * See the LICENSE file in the root directory of this source tree.
17
- */const en={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};en.node;const Yt=F(en);/**
18
- * @license lucide-react v1.48.0 - ISC
19
- *
20
- * This source code is licensed under the ISC license.
21
- * See the LICENSE file in the root directory of this source tree.
22
- */const nn={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};nn.node;const Qt=F(nn);/**
23
- * @license lucide-react v1.48.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */const tn={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};tn.node;const Xt=F(tn);/**
28
- * @license lucide-react v1.48.0 - ISC
29
- *
30
- * This source code is licensed under the ISC license.
31
- * See the LICENSE file in the root directory of this source tree.
32
- */const sn={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};sn.node;const Zt=F(sn);/**
33
- * @license lucide-react v1.48.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */const on={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};on.node;const je=F(on);/**
38
- * @license lucide-react v1.48.0 - ISC
39
- *
40
- * This source code is licensed under the ISC license.
41
- * See the LICENSE file in the root directory of this source tree.
42
- */const an={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};an.node;const es=F(an),ns='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function ts(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=i.useRef(null),r=i.useRef(!1);i.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let u=0,x=0;const v=()=>{var m;const f=(m=a.current)==null?void 0:m.querySelector(ns);if(f)return f.focus();++u<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[t]);const c=i.useCallback(u=>{var x;!u&&((x=a.current)!=null&&x.contains(document.activeElement))||s(u)},[s]),d=i.useCallback(u=>{!o||u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r.current=!0,s(!0))},[o,s]),g=i.useMemo(()=>({onEscapeKeyDown:()=>{var u;return(u=n.current)==null?void 0:u.focus()},onBlur:u=>{var v,f,m;const x=u.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(f=n.current)!=null&&f.contains(x))||(m=a.current)!=null&&m.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:c,onTriggerKeyDown:d,contentHandlers:g}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const c=s||n&&e.shiftKey?-1:1;a[(r+c+a.length)%a.length].focus()}function ss({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function os({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(bn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const as=300;function G({className:e,children:t}){return l.jsx("span",{className:te("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:c}){const{kind:d,displayName:g,handle:u,color:x,emoji:v,imageUrl:f,origin:m,agent:p}=e,h=x??"hsl(var(--muted-foreground))",w=typeof m=="object"&&m!==null,y=d==="agent"&&(p==null?void 0:p.working)!=null?p.working:null,[I,S]=i.useState(!1),C=i.useCallback(k=>{S(k),a==null||a(k)},[a]),A=i.useRef(!1),N=i.useRef(null),M=vn({onLongPress:()=>{A.current&&C(!0)}}),{contentRef:j,handleOpenChange:b,onTriggerKeyDown:_,contentHandlers:O}=ts({open:I,setOpen:C,triggerRef:N,enabled:r&&o!==void 0});return l.jsxs(Ut,{open:I,onOpenChange:b,openDelay:as,children:[l.jsx(Ht,{asChild:!0,ref:N,"data-gesture-priority":"",...M,onPointerDown:k=>{A.current=k.pointerType==="touch"||k.pointerType==="pen",M.onPointerDown(k)},...r?{onClick:()=>C(!0),onKeyDown:_}:{},children:t}),l.jsxs(Kt,{ref:j,...O,...o?{role:"dialog","aria-label":g}:{},"data-slot":"identity-hover-card",align:"start",className:te("flex w-64 flex-col gap-0 overflow-hidden p-0",c),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(kn,{"aria-hidden":!0,color:h,emoji:v,imageUrl:f,fallback:wn(g),kind:d,origin:m,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:g}),u&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",u]})]})]}),n&&l.jsx(ss,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((p==null?void 0:p.runtime)||(p==null?void 0:p.model))&&l.jsx(G,{children:[p.runtime,p.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Bt(y.forMs)]}),d==="human"&&l.jsx(G,{children:w?m.platform:"On this machine"}),d==="agent"&&(p==null?void 0:p.managedBy)&&l.jsxs(G,{children:["Managed by"," ",p.managedBy.handle?`@${p.managedBy.handle}`:p.managedBy.displayName]})]}),o?l.jsx(os,{actions:o,onAct:()=>{var k;(k=N.current)==null||k.focus(),C(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=N.current)==null||k.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function rs(){const e=fe(),t=De();return Pe({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var u;const r=t.getQueryData(H.entries(s)),c=(u=r==null?void 0:r.find(x=>x.id===n))==null?void 0:u.reactions,{reactions:d,on:g}=Ce(c,o,a);return t.setQueryData(H.entries(s),x=>Ae(x,n,d)),{on:g}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,g;const r=t.getQueryData(H.entries(s)),c=((g=(d=r==null?void 0:r.find(u=>u.id===n))==null?void 0:d.reactions)==null?void 0:g.some(u=>u.emoji===o&&u.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},c)=>{c!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const g=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:u}=Ce(g,a,r,!c.on);return Ae(d,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function W(e){return e.threadRootEntryId??e.parentEntryId}function is(e){return W(e)??e.id}function cs(e,t){return Math.max(t??0,e)}function Vo(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:cs(e.length,s),lastAt:n.createdAt,unread:o}}function ls(e){var C,A;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=Fe(),r=Nn(),c=a&&o&&t!==void 0,d=In(c?t:null),g=Rn(d.member),u=Cn(),x=An(),v=Mn(),f=jn(),{data:m}=Le({enabled:c&&r}),p=f.status==="ready"?f.roomId:null,h=m==null?void 0:m.find(N=>N.id===p),w=h?se(h):null,y=(A=(C=d.member)==null?void 0:C.agent)==null?void 0:A.effectiveRuntimeId,I=i.useCallback(()=>{t!==void 0&&(Z.getState().recordOpened("agent",t),u({agentPath:t},y?{runtime:y}:{}))},[t,u,y]),S=i.useCallback(async()=>{if(t===void 0||!v)return;const N=await x(t);if(N===null){Be(`${s} has no session in ${w??"this room"} yet`);return}v(pe({session:N}))},[t,v,x,s,w]);return i.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:g},actions:{onMessage:I,...n?{onViewProfile:n}:{},...r&&w?{session:{label:`Session in ${w}`,onOpen:()=>void S()}}:{}}},[a,t,d.role,g,I,n,r,w,S])}function ds({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=i.useState(!1),c=ls({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=i.useCallback(g=>{g&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&c!==null,...c?{about:c.about,actions:c.actions}:{},children:o})}function us(e){return l.jsx(Lt,{code:e.code,isIncomplete:e.isIncomplete})}const ms=[{language:Ft,component:us}],fs={turn_failed:{Icon:Bn,tone:"text-status-warning"},agent_busy:{Icon:Ln},agent_gone:{Icon:es,tone:"text-status-warning"},agent_left:{Icon:je,tone:"text-status-warning"},room_archived:{Icon:Fn},agent_reseated:{Icon:Pn},handle_changed:{Icon:Qe},files_set_up:{Icon:Dn},runtime_gone:{Icon:Qt,tone:"text-status-warning"},agent_paused:{Icon:$n},agent_declined:{Icon:Vt},agent_unavailable:{Icon:Tn},awaiting_approval:{Icon:Gt,tone:"text-status-warning"},halted:{Icon:En},budget_reached:{Icon:On},cascade_stopped:{Icon:_n},addressing_changed:{Icon:Yt},bridge_blocked:{Icon:qt,tone:"text-status-warning"},bridge_undelivered:{Icon:Sn,tone:"text-status-warning"},bridge_rate_limited:{Icon:Zt},bridge_second_agent_refused:{Icon:je},bridge_disconnected:{Icon:Jt},bridge_agent_swapped:{Icon:$t},bridge_history_note:{Icon:Wt}},ps={Icon:Un},le=80;function gs(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function hs(e,t,s){const n=xs(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function xs(e,t){if(t!==void 0){const n=Hn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Kn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function ys({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&fs[e.body.notice])??ps;return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":gs(e.body.text)},...xe(t),className:te("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",r??"text-muted-foreground"),children:[l.jsx(a,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),l.jsx("span",{children:n?hs(e.body.text,n,o):e.body.text})]})}const bs=zt.moment;function vs({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=Ye(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:l.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Rt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(bs,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Ct(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function ks(e,t){const s=Q.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
43
- `)?"":" ";s.set(e,`${n}${o}@${t} `)}function ws({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const a=is(t),r=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,d=s==null?void 0:s.displayName,{copy:g}=Wn({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Xt,run:()=>{Vn.getState().openThread(e,a,!0),Ne.getState().requestFocus(Ue(e,a))}},copy:{id:"copy",label:"Copy text",icon:qn,run:()=>void g(r)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:zn,run:o}),c!==void 0&&(u.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:Qe,run:()=>{ks(e,c),Ne.getState().requestFocus(e)}}),At.map(x=>u[x]).filter(x=>x!==void 0)},[e,a,r,c,d,o,g])}function Ns(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function zo(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function Go(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Is(e,t,s){const n=t.get(e),o=He({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Jo(e){const t=new Set;for(const a of e)W(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=W(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const c=n.get(r);c?c.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Rs(e){return`thread-${e}`}function Cs(e){return`thread-row-${e}`}function Yo(e){return`thread-panel-entry-${e}`}function As(e){return`room-entry-${e}`}function Ms(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=W(s)??null,o={rowId:t,domId:As(t)};if(n===null)return o;const a=e.find(c=>c.id===n);return a!==void 0&&(W(a)??null)===null?{rowId:Rs(n),domId:Cs(n)}:o}function Qo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Ms(e,s.id)}const Se=48;function Xo(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Se?`${a.slice(0,Se).trimEnd()}…`:a}}function js(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=Gn({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:Jn(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function Ss(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const _s={info:new Map,faces:new Map},be=i.createContext(_s);function Zo({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function ea(){const e=he(),t=i.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=i.useMemo(()=>t.map(r=>r.projectPath),[t]),n=Ke(s),o=i.useMemo(()=>js(t,n.data??{}),[t,n.data]),a=i.useMemo(()=>Ss(o),[o]);return i.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const t=i.useContext(be);return e===void 0?void 0:t.info.get(e)}function Os(){return i.useContext(be).faces}function Es({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(c)}}const X=120,Ts="code block";function $s(e){if(e.length<=X&&!e.includes("```"))return null;const t=Ds(e);return t.length===0?null:t}function Ds(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Ts} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=X)return t;const s=Ps(t,X),n=s.lastIndexOf(" ");return`${(n>X/2?s.slice(0,n):s).trimEnd()}…`}function Ps(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Fs({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=rs(),c=o===!0||!a,d=i.useMemo(()=>t.reactions??[],[t.reactions]),g=i.useMemo(()=>d.filter(v=>Mt(v,s)).map(v=>v.emoji),[d,s]),u=i.useCallback(v=>r.mutate({roomId:e,entryId:t.id,emoji:v,viewerAuthorId:s}),[r,e,t.id,s]),x=i.useMemo(()=>({quick:n,mine:g,onToggle:u,disabled:c}),[n,g,u,c]);return{reactions:d,toggle:u,quickRow:x}}function Ls({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function Bs(e,t){var x,v;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Yn.includes(n),a=Dt(e,{enabled:o}),r=We(),c=De(),d=fe(),g=o?((v=(x=a.data)==null?void 0:x.bindings.find(f=>f.authorId===s))==null?void 0:v.sessionId)??null:null,u=i.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(g===null||s===void 0)&&Qn({queryClient:c,transport:d},e,s).then(m=>{m.kind!=="none"&&r(pe({session:m.kind==="bound"?m.sessionId:g}))}))},[s,r,c,e,g,d]);return i.useMemo(()=>g===null?null:{href:Xn({session:g}),onOpen:u},[u,g])}const ne="mention",ve="author_id",Us={[ne]:[ve]},Hs=[ne];function Ks(e,t){if(!t||t.length===0)return e;const s=Ws(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:c}=s[o],d=n.slice(0,a),g=n.slice(a,a+r),u=n.slice(a+r);n=`${d}<${ne} ${ve}="${c}">${g}</${ne}>${u}`}return n}function Ws(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const qs=new Map,rn=i.createContext(qs);function Vs({authors:e,children:t}){return l.jsx(rn.Provider,{value:e,children:t})}function zs(e){const t=i.useContext(rn);return e===void 0?void 0:t.get(e)}const _e=new WeakMap;function Gs(e){const t=_e.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return _e.set(e,s),s}function Js(e){var n;const s=(n=he().data)==null?void 0:n.agents;return i.useMemo(()=>e===void 0||!s?void 0:Gs(s).get(e),[s,e])}function cn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=Fe(),a=Js(o?t:void 0),r=ee(t);return i.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const c={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(g,u={})=>l.jsx(ds,{identity:c,agentPath:a,onViewProfile:n,openOnClick:u.openOnClick??!1,children:g});return{wrap:d,wrapAvatar:g=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:g}),{openOnClick:!0}),wrapName:g=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:te(g.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const Ys={kind:"human",displayName:""};function Qs(e){return typeof e=="string"?e.replace(/^@/,""):""}function Xs({authorId:e,children:t}){const s=zs(e),n=ee(s==null?void 0:s.agentRef),{open:o}=qe(),a=s?He({record:s,override:n==null?void 0:n.visual}):null,r=s?Ve(s,n==null?void 0:n.memberId):void 0,c=i.useMemo(()=>r===void 0?void 0:()=>o(r),[r,o]),d=a==null?void 0:a.color,g=a==null?void 0:a.emoji,u=a==null?void 0:a.imageUrl,x=i.useMemo(()=>s?{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:d,emoji:g,imageUrl:u,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}}:null,[s,d,g,u,n]),v=cn({agentRef:s==null?void 0:s.agentRef,identity:x??Ys,onViewProfile:c});if(!s||!x)return l.jsx(Me,{kind:"human",label:Qs(t),resolved:!1});const m=v?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),c())}}:{},p=l.jsx(Me,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...m});return v?v.wrap(p,{openOnClick:!0}):l.jsx(ye,{onViewProfile:c,identity:x,children:p})}function Zs(e){return{mention:t=>{const s=t[ve],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?l.jsx(l.Fragment,{children:t.children}):l.jsx(Xs,{authorId:n,children:t.children})}}}function eo({entry:e,authors:t}){const s=i.useMemo(()=>Ks(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=i.useMemo(()=>{var a;return new Set(((a=e.mentionSpans)==null?void 0:a.map(r=>r.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Zs(n),[n]);return l.jsx(Vs,{authors:t,children:l.jsx(Pt,{content:s,className:"msg-prose",allowedTags:Us,literalTagContent:Hs,components:o,renderers:ms})})}function no(e){return function(s){return l.jsx(eo,{entry:s,authors:e})}}const ln="the top folder";function Oe(e){return e.slice(e.lastIndexOf("/")+1)}function to(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function so(e){return e===""?ln:`${e}/`}function de(e){return e.target!==void 0?e.target===""?ln:e.target:so(to(e.paths[0]??""))}function oo(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${Oe(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${Oe(s)} from the chat to ${de(e)}`}}const ao=i.lazy(()=>Zn(()=>import("./index-C3IsCAxA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function na({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:c,streamStalled:d,isMember:g=!0,grouping:u,orphanedReply:x,answers:v,feedPosition:f,rowId:m}){const p=Ye(t.createdAt),h=i.useMemo(()=>{const L=$s(t.body.text),ie=jt(t.attachments??[]);if(ie===null)return L;const we=L??t.body.text.trim();return we.length>0?`${we} ${ie}`:ie},[t.body.text,t.attachments]),w=i.useId(),y=`${w}-author`,I=`${w}-content`,S=`${w}-summary`,C=i.useRef(null),A=i.useRef(null),N=i.useRef(null),{reactions:M,toggle:j,quickRow:b}=Fs({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:c,streamStalled:d,isMember:g}),_=ee(n==null?void 0:n.agentRef),{open:O}=qe(),k=n===void 0?void 0:Ve(n,_==null?void 0:_.memberId),D=i.useCallback(()=>{k!==void 0&&O(k)},[O,k]),T=k===void 0?void 0:D,q=ws({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:T}),V=(n==null?void 0:n.handle)??void 0,B=i.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:V,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,V,s.color,s.emoji,s.imageUrl]),$=cn({agentRef:n==null?void 0:n.agentRef,identity:B,onViewProfile:T}),R=Ls({barRef:A,pillsRef:N,hasReactions:M.length>0}),U=i.useCallback(()=>{var L;return(L=C.current)==null?void 0:L.focus()},[]),oe=i.useMemo(()=>no(o),[o]),gn=i.useCallback(L=>l.jsx(i.Suspense,{fallback:null,children:l.jsx(ao,{roomId:e,attachment:L})}),[e]),hn=Os(),ae=t.body.subjectAuthorId??t.authorId,E=o.get(ae),z=ee(E==null?void 0:E.agentRef),xn=Bs(e,t),re=Ns(t);if(re.kind==="notice")return l.jsx(ys,{entry:t,feedPosition:f,rowId:m,sessionLink:xn,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(vs,{entry:t,moment:re.moment,subject:ae===t.authorId?s:Is(ae,o,hn),subjectIdentity:{handle:(E==null?void 0:E.handle)??void 0,origin:E==null?void 0:E.origin,agent:z&&{runtime:z.runtime,...z.model&&{model:z.model}}},feedPosition:f,rowId:m});const yn=u.position==="first"||u.position==="only";return l.jsxs(P.Root,{ref:C,id:m,position:u.position,actions:q,reactions:b,"data-testid":"room-entry",tabIndex:0,...Es({showAuthorHeader:yn,headerId:y,displayName:s.displayName,time:p,summary:h,contentId:I,summaryId:S,feedPosition:f}),onKeyDown:R,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:$?void 0:T,isSelf:t.authorId===a,renderAvatar:$==null?void 0:$.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:y,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,renderName:$==null?void 0:$.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),v!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${v.excerpt}”`}),t.body.via&&l.jsx(St,{via:t.body.via}),l.jsx(P.Content,{id:I,className:"wrap-anywhere [&_pre]:overflow-x-auto [&_pre]:wrap-normal",children:t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:oo(t.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):oe(t,{rowId:t.id,isStreaming:!1})}),h!==null&&l.jsx("span",{id:S,className:"hidden",children:h}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:g?gn:void 0}),l.jsx(P.Reactions,{ref:N,reactions:M,viewerAuthorId:a,names:r,frequents:c,onToggle:j,disabled:d===!0||!g,onExit:U}),l.jsx(P.Actions,{actions:q,reactions:b,barRef:A,onExit:U})]})]})}const ta={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function ro(e){const t=fe(),[s,n]=i.useState([]),o=i.useRef(new Map),a=i.useCallback(f=>{const m=f.map(p=>({id:crypto.randomUUID(),file:p,status:"pending",progress:0}));n(p=>[...p,...m])},[]),r=i.useCallback(f=>{o.current.delete(f),n(m=>m.filter(p=>p.id!==f))},[]),c=i.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const m=new Set(f);for(const p of m)o.current.delete(p);n(p=>p.filter(h=>!m.has(h.id)))},[]),d=i.useCallback(f=>{o.current.delete(f),n(m=>m.map(p=>p.id===f&&p.status==="error"?{...p,status:"pending",progress:0,error:void 0}:p))},[]),g=i.useRef(null),u=Pe({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(w=>w.map(y=>f.some(I=>I.id===y.id)?{...y,status:"uploading"}:y));const m=w=>{n(y=>y.map(I=>I.status==="uploading"?{...I,progress:w.percentage}:I))},p=new AbortController;g.current=p;const h=f.map(w=>w.file);return t.uploadRoomAttachments(e,h,m,p.signal)},onSettled:()=>{g.current=null},onSuccess:(f,m)=>{m.forEach((p,h)=>{const w=f[h];w&&o.current.set(p.id,w.id)}),n(p=>p.map(h=>m.findIndex(y=>y.id===h.id)===-1?h:{...h,status:"uploaded",progress:100}))},onError:f=>{n(m=>m.map(p=>p.status==="uploading"?{...p,status:"error",error:f.message}:p))}}),x=i.useCallback(()=>{var f;(f=g.current)==null||f.abort()},[]),v=i.useCallback(async()=>{const f=s.filter(p=>p.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const m=s.filter(p=>p.status==="pending");return m.length>0&&await u.mutateAsync(m),s.map(p=>o.current.get(p.id)).filter(p=>p!==void 0)},[s,u]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:c,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function sa(e){const{room:t,threadRootId:s}=e,n=_t(),o=Ot(),a=ro((t==null?void 0:t.id)??""),r=t!==void 0&&ze(t.members,t.viewerAuthorId),c=i.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});i.useEffect(()=>{c.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=i.useCallback(y=>c.current.attachments.addFiles(y),[]),g=i.useCallback(y=>c.current.attachments.removeFile(y),[]),u=i.useCallback(y=>c.current.attachments.retryFile(y),[]),x=i.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:f,isUploading:m}=a,p=i.useMemo(()=>({staged:v,add:d,remove:g,retry:u,cancel:x,hasFailed:f,isUploading:m,holdsSendWhileUploading:!1}),[v,f,m,d,g,u,x]),h=i.useCallback(async y=>{const{attachments:I,post:S,reply:C,room:A,threadRootId:N}=c.current;if(A===void 0)throw new Error("That room isn’t loaded yet.");if(A.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",A.id);const M=et(),j=I.pendingFiles.map(k=>k.file.name),b=I.pendingFiles.map(k=>k.id),_=await I.uploadAndGetIds();I.clearFiles(b);const O=y.parentEntryId??N;if(O!==void 0){C.mutate({roomId:A.id,rootEntryId:O,text:y.text,clientId:M,attachmentIds:_,attachmentNames:j});return}S.mutate({roomId:A.id,text:y.text,clientId:M,attachmentIds:_,attachmentNames:j})},[]);return{target:i.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ge},send:h,attachments:p}),[t,s,r,p,h]),attachments:a}}const dn=8;function un(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function io(e){if(st(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:un(e.topic)}function Ee(e){return{kind:"session",id:e.id,name:tt(e.title),summary:un(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function co(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:io(e),lastActivityAt:e.lastActivityAt,room:e}}function J(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function lo(e){return e.kind==="session"?Ie("session",e.id):Ie("room",e.id)}function Te(e,t){const s=[J(t[lo(e)]),...e.kind==="session"?[J(e.session.lastTouchedByYouAt),J(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):J(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function uo(e){return(t,s)=>Te(s,e)-Te(t,e)||s.id.localeCompare(t.id)}function mo(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function fo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function po({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=dn}){const{yours:a,spinOffs:r,automated:c}=nt(e),d=uo(n),g=[...a.map(Ee),...t.filter(u=>fo(u,s)).map(co)].sort(d);return{items:mo(g).slice(0,o),automated:[...r,...c].map(Ee).sort(d).slice(0,o)}}const go=3,ho=rt;function xo({limit:e=dn,mutedRoomIds:t,enabled:s=!0}={}){var g,u;const n=ot(Math.max(e*go,ho),{enabled:s}),o=Le({enabled:s}),a=at(),r=(g=n.data)==null?void 0:g.sessions,c=o.data;return{...i.useMemo(()=>po({sessions:r??[],rooms:c??[],mutedRoomIds:t,interactions:a,limit:e}),[r,c,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((u=n.data)==null?void 0:u.warnings)??[]}}const yo=6,mn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const bo='[role="combobox"]';function K(e){return e instanceof Element&&e.matches(bo)}function vo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=We(),o=it(),[a,r]=i.useState(!1),[c,d]=i.useState({stamp:"",index:0}),[g,u]=i.useState(!1),[x,v]=i.useState(!1);e.length>0&&!x&&v(!0);const f=i.useRef(!1);i.useEffect(()=>{f.current=!0},[]);const{data:m}=he({enabled:s}),p=i.useMemo(()=>((m==null?void 0:m.agents)??[]).map(R=>R.projectPath),[m]),{data:h}=Ke(p,{enabled:s}),w=i.useMemo(()=>h??{},[h]),y=i.useMemo(()=>ct(p,w),[p,w]),I=i.useMemo(()=>new Map(p.map(R=>[ge(R),R])),[p]),S=i.useCallback(R=>lt({room:R,agentsByPath:w,pathByAgentRef:I}),[w,I]),C=i.useMemo(()=>dt(o.muted),[o.muted]),{items:A}=xo({mutedRoomIds:C,enabled:s}),N=i.useMemo(()=>A.slice(0,yo),[A]),M=s&&a&&!g&&!x&&!t&&e.length===0&&N.length>0,j=`${M}:${N.length}`,b=c.stamp===j?c.index:0,_=i.useCallback(R=>{f.current&&K(R.target)&&(u(!1),v(!1),r(!0))},[]),O=i.useCallback(R=>{K(R.target)&&r(!0)},[]),k=i.useCallback(R=>{K(R.target)&&r(!1)},[]),D=i.useCallback(R=>{N.length!==0&&d(U=>{const oe=U.stamp===j?U.index:0;return{stamp:j,index:(oe+R+N.length)%N.length}})},[N.length,j]),T=i.useCallback(()=>D(1),[D]),q=i.useCallback(()=>D(-1),[D]),V=i.useCallback(()=>{u(!0)},[]),B=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Z.getState().recordOpened("agent",R.session.cwd),n(pe({dir:R.session.cwd??void 0,session:R.session.id}));return}Z.getState().recordOpened("room",R.room.id),n({...ut.channels(),search:{id:R.room.id}})},[n]),$=i.useCallback(()=>{const R=N[b];!M||!R||B(R)},[M,N,b,B]);return{isOpen:M,hasRows:N.length>0,rows:N,agents:w,displayNames:y,visualOf:S,selectedIndex:b,activeDescendantId:M&&N[b]!==void 0?ke(b):void 0,listboxId:M?mn:void 0,handleFocus:_,handleBlur:k,handlePointerDown:O,moveDown:T,moveUp:q,selectHighlighted:$,selectRow:B,dismiss:V}}function fn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:c,onSelect:d}){const g=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:yt(o),[o,c]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),g!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:g})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function ko({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const c=ft(t,e.session.cwd??s);return l.jsx(fn,{mark:l.jsx(pt,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function wo({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(fn,{mark:l.jsx(ht,{room:e.room,participants:e.room.participants,visuals:xt(t)}),label:l.jsx(gt,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function No({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=mt(6e4);return i.useEffect(()=>{var c,d;(d=(c=document.getElementById(ke(t)))==null?void 0:c.scrollIntoView)==null||d.call(c,{block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:l.jsx("div",{id:mn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,d)=>{var g;return c.kind==="session"?l.jsx(ko,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((g=c.session.cwd)==null?void 0:g.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`session-${c.id}`):l.jsx(wo,{item:c,visual:o(c.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`room-${c.id}`)})})})}const $e={people:"People",agents:"Agents"},Io=["people","agents"];function Ro(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Co(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Ao(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Ao(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function Y(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Mo(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,c=a.startsWith(" ")?"":" ";return{value:o+r+c+a,cursorPos:o.length+r.length+1}}const jo=/(^|\s)@([A-Za-z0-9_.-]*)$/,pn="mention-palette-listbox";function me(e){return`mention-item-${e}`}function So({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Io}){var O;const[o,a]=i.useState(!1),[r,c]=i.useState(""),[d,g]=i.useState(-1),u=bt(s),x=i.useRef(!1),v=i.useMemo(()=>Ro(e,t),[e,t]),f=i.useMemo(()=>o?Co(v,r,n):[],[v,r,o,n]),[m,p]=i.useState(null),h=m!==null&&m.query===r&&m.open===o?m.index:Y(f,0,1),w=f[h],y=f.length===0||w!==void 0&&!w.disabled?h:Y(f,0,1),I=i.useCallback((k,D)=>{const T=k.slice(0,D).match(jo);if(!T){a(!1);return}a(!0),c(T[2]),g((T.index??0)+T[1].length)},[]),S=i.useCallback(k=>{u.write(k),x.current=!1},[u]),C=i.useCallback(k=>{x.current||I(u.read(),k)},[I,u]),A=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y+1,1)})},[f,y,r,o]),N=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y-1,-1)})},[f,y,r,o]),M=i.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Mo(u.read(),d,r,k.handle)),[d,r,u]),j=i.useCallback(()=>{const k=f[y];return k?M(k):(a(!1),null)},[f,y,M]),b=i.useCallback(()=>{x.current=!0,a(!1)},[]),_=f.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:_,rows:f,selectedIndex:y,activeDescendantId:o&&((O=f[y])==null?void 0:O.disabled)===!1?me(y):void 0,listboxId:o?pn:void 0,noteTextChange:S,handleCursorChange:C,moveDown:A,moveUp:N,selectHighlighted:j,selectRow:M,dismiss:b}}function _o({rows:e,selectedIndex:t,onSelect:s}){const n=i.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const c=o[o.length-1];c&&c.section===a.section?c.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:pn,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:c,index:d})=>{const g=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":g,"aria-disabled":c.disabled,"data-selected":g,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function oa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:Ue(e.id,t),c=vt(r),{target:d}=Et(),g=kt(),u=wt(r),x=i.useRef(null),v=ze(e.members,e.viewerAuthorId),f=i.useRef(!1),m=So({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),p=n===!0,h=vo({value:c,yieldToPalette:m.isOpen,enabled:p}),w=i.useRef(u);i.useEffect(()=>{var b;u!==w.current&&(w.current=u,(b=x.current)==null||b.focus())},[u]),i.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const y=i.useCallback(b=>Q.getState().set(r,b),[r]),[I,S]=i.useState(null);i.useLayoutEffect(()=>{var b;I!==null&&((b=x.current)==null||b.focusAt(I.pos))},[I]);const C=i.useCallback(b=>{b&&(y(b.value),S({pos:b.cursorPos}))},[y]),A=i.useCallback(b=>C(m.selectRow(b)),[m,C]),N=i.useCallback(()=>C(m.selectHighlighted()),[m,C]),M=()=>{if(d===null||!d.canSend||f.current)return;m.dismiss();const b=Q.getState().take(r).trim();if(b==="")return;const _=a.pendingFiles.length>0;_&&(f.current=!0),d.send({text:b}).catch(()=>{const O=Q.getState(),k=O.drafts[r]??"";O.set(r,k===""?b:`${b}
44
- ${k}`)}).finally(()=>{_&&(f.current=!1)})};if(!v)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Ge}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:g.isPending,onClick:()=>g.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>Be.success(`You joined ${se(e)}`)}),children:Nt})]});const j=l.jsx(Tt.Composer,{inputRef:x,value:c,onChange:b=>{y(b),m.noteTextChange(b)},onSubmit:M,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:m.isOpen&&m.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Re,{children:m.isOpen&&l.jsx(_o,{rows:m.rows,selectedIndex:m.selectedIndex,onSelect:A})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Re,{children:h.isOpen&&l.jsx(No,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:m.handleCursorChange,isStreaming:!1,isPaletteOpen:m.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:m.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:m.moveUp,onArrowDown:h.isOpen?h.moveDown:m.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:N,onEscape:h.isOpen?h.dismiss:m.dismiss,tabPicks:!h.isOpen,onClear:()=>{y(""),m.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:m.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:m.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!p&&o===void 0?j:l.jsx("section",{className:"flex flex-col","data-testid":It.homeComposer,onFocus:b=>{h.handleFocus(b),K(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),K(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:j})}export{Zo as A,oa as C,ye as I,ta as R,zo as a,na as b,Is as c,Go as d,ea as e,Xo as f,Jo as g,Rs as h,cs as i,Vo as j,Cs as k,As as l,Ms as m,Yo as n,Qo as o,K as p,is as r,W as t,sa as u};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-p3WivF1M.js";import{a as t}from"./ProfileFields-Bi_AfHOE.js";import"./profile-errors-B08zStmk.js";import"./use-mounted-ref-CWXhSyZ8.js";function n({member:r}){return o.jsx(t,{member:r})}export{n as HandlePage};
@@ -1 +0,0 @@
1
- import{j as o}from"./index-p3WivF1M.js";import{P as m}from"./ProfileFields-Bi_AfHOE.js";import"./profile-errors-B08zStmk.js";import"./use-mounted-ref-CWXhSyZ8.js";function a({member:r}){return o.jsx(m,{member:r})}export{a as NamePage};
@@ -1 +0,0 @@
1
- import{j as r}from"./index-p3WivF1M.js";import{b as t}from"./ProfileFields-Bi_AfHOE.js";import"./profile-errors-B08zStmk.js";import"./use-mounted-ref-CWXhSyZ8.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};
@@ -1 +0,0 @@
1
- import{aN as Ee,a1 as b,a3 as D,r as x,a4 as R,jN as F,jO as T,jP as Be,a2 as z,j as e,jQ as Ge,ig as we,er as We,es as Y,Q as Re,T as Ie,V as Le,B as C,hU as Ye,G as V,eQ as Ve,eb as He,jR as Je,jS as Xe,e4 as Ae,ar as te,x as de,by as Ze,J as ue,ef as me,eo as S,ep as ne,aI as es,jT as ss,I as _,jU as ts,jV as Ke,jW as ns,_ as De,fB as rs,eh as as,ei as is,ej as os,ek as ls,el as be,e7 as cs,C as ds,jX as us,jY as ms,jZ as xs,U as hs}from"./index-p3WivF1M.js";import{I as fs}from"./inline-code-14c1Gacs.js";import{u as gs}from"./useMutationState-B61VoWtY.js";import{O as ps,a as W}from"./runtime-connect-Dn0T5YWv.js";function ys(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function St(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Ct(s){var u,d;const t=b(),n=D(),[i,a]=x.useState(null),r=R({mutationFn:()=>(a(null),t.provisionRuntime(s,m=>a(m))),onSuccess:m=>{m.ok&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...T]}))}}),l=r.isError||((u=r.data)==null?void 0:u.ok)===!1,o=r.isError?r.error.message:((d=r.data)==null?void 0:d.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 js(s,t=!0){const n=b();return z({queryKey:Te(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function vs(s){const t=b(),n=R({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 ks(s){var o,c,u;const t=b(),n=D(),[i,a]=x.useState(null),r=R({mutationFn:async d=>{a("checking");const m=await t.checkRuntimeCredential(s,d);return m.ok?(a("saving"),await t.storeRuntimeCredential(s,d),{saved:!0,message:null}):{saved:!1,message:m.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...T]}),n.invalidateQueries({queryKey:[...Te(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:d=>{d.trim().length!==0&&r.mutate(d)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((u=r.data)==null?void 0:u.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function Ns(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function bs(s,t){var M,I,w,P;const n=b(),i=D(),{sessionId:a,accountRoot:r,onCompleted:l}=t??{},o=x.useMemo(()=>["runtime-login",s,a??"",r??""],[s,a,r]),c=R({mutationKey:o,mutationFn:()=>n.delegateRuntimeLogin(s,a===void 0&&r===void 0?void 0:{sessionId:a,accountRoot:r}),onSuccess:N=>{N.ok&&(i.invalidateQueries({queryKey:Be.all}),i.invalidateQueries({queryKey:[...F]}),i.invalidateQueries({queryKey:[...T]}))}}),u=gs({filters:{mutationKey:o,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),d=u.some(N=>N.state.status==="pending"),m=u[u.length-1],h=d||m==null?void 0:m.state,p=d||m==null?void 0:m.id,g=!d&&((h==null?void 0:h.status)==="error"||((M=h==null?void 0:h.data)==null?void 0:M.ok)===!1),y=(h==null?void 0:h.status)==="error"?((I=h.error)==null?void 0:I.message)??null:((w=h==null?void 0:h.data)==null?void 0:w.error)??null,v=((P=h==null?void 0:h.data)==null?void 0:P.ok)===!0,O=x.useRef(l);return O.current=l,x.useEffect(()=>{var L;if(!v||p===void 0)return;const N=Ns(i);N.has(p)||(N.add(p),(L=O.current)==null||L.call(O))},[v,p,i]),{login:()=>{d||c.mutate()},isPending:d,isSuccess:v,isError:g,errorMessage:g?y??"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 Ss(s){return Ce[s]??Ce["claude-code"]}function Cs({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(Ge,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(we,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(We,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(Y,{className:"size-3"})]})]})}function Ot({command:s,runtimeLabel:t}){const[n,i]=x.useState(!1);return e.jsxs(Re,{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(Ie,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Le,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(fs,{children:s}),e.jsx(we,{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(C,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ye,{className:"size-3"}),"Retry"]})]})}function Os({ollama:s=!1,remote:t=!1,className:n}){return e.jsxs("p",{className:V("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 Ps(s){const t=Ve(),{data:n}=He();return s?Je(Xe(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",Es={title:xe,body:`Frontier models are unlocked. ${he}`},ws={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 Rs(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=Ae();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:V("text-muted-foreground shrink-0",t&&"animate-none")}),e.jsx(Ze,{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 U({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 Q({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(C,{size:"sm",onClick:t,children:"Try again"})]})}function Is({type:s,onConnected:t,asOtherWay:n=!1}){const i=Ss(s),a=bs(s),[r,l]=x.useState(!1),o=x.useRef(!1);return x.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(U,{message:"Signed in"}):a.isError?e.jsx(Q,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(C,{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(Ls,{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(C,{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 Ls({type:s,copy:t,onConnected:n}){var g,y;const[i,a]=x.useState(""),r=ks(s),l=js(s),o=vs(s),c=x.useRef(!1),u=x.useRef(null);if(x.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Me(me(s).label)))},[r.isSuccess,n,s]),x.useEffect(()=>{var v;r.isError&&((v=u.current)==null||v.focus())},[r.isError]),r.isSuccess)return e.jsx(U,{});const d=(g=l.data)!=null&&g.key.saved?l.data.key:null,m=i.trim().length>0,h=r.isPending||o.isPending,p=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:v=>{v.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(S,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:u,value:i,disabled:h,onChange:v=>{a(v.target.value),p()},placeholder:d?`Saved key ends in ${d.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(Y,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"ghost",disabled:!m&&d===null||h,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:!m||h,children:"Save key"})]})]}),h?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((y=o.result)==null?void 0:y.ok)===!0?e.jsx(U,{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 As(s){const t=b(),n=z({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(Ks,{saved:n.data,...s},JSON.stringify(n.data))}function Ks({saved:s,onConnected:t,onSave:n}){var K,J,G,X,j,$,fe,ge,pe,ye,je,ve;const i=b(),a=D(),r=x.useId(),l=((K=s.inference)==null?void 0:K.source)??"api-key",[o,c]=x.useState(n&&l==="dorkos-credits"?"api-key":l),[u,d]=x.useState(((J=s.inference)==null?void 0:J.protocol)??"openai-chat-completions"),[m,h]=x.useState(((G=s.inference)==null?void 0:G.endpoint)??""),[p,g]=x.useState(((X=s.inference)==null?void 0:X.provider)??""),[y,v]=x.useState(((j=s.inference)==null?void 0:j.model)??""),[O,M]=x.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[I,w]=x.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[P,N]=x.useState(""),[L,E]=x.useState(null),k=z({queryKey:["doe-credits-models",u],queryFn:()=>i.getDoeCreditsModels(u),enabled:o==="dorkos-credits"}),q=o==="dorkos-credits"?(ge=k.data)==null?void 0:ge.models.find(f=>f.id===y):void 0,ee=s.hasKey&&((pe=s.inference)==null?void 0:pe.endpoint)===m&&s.inference.source==="api-key",H=R({mutationFn:async f=>{if(n)return n(f,P.trim()||null);o==="api-key"&&P.trim()?await i.storeDoeCredential(f,P.trim()):await i.setDoeInference(f),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{N("");for(const f of[["doe-inference"],F,T,es.all,ss.status()])a.invalidateQueries({queryKey:f});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:f=>E(n&&f instanceof Error&&f.message?f.message:"Couldn’t save model settings. Try again.")});function re(f){var ke,Ne;if(f.preventDefault(),E(null),P.trim().startsWith("sk-ant-oat")){E("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!P.trim()&&!ee){E("Enter an API key.");return}if(o==="dorkos-credits"&&(!q||!((ke=k.data)!=null&&ke.endpoint))){E("Link DorkOS credits and choose an available model.");return}const ae=ts.safeParse({source:o,protocol:u,provider:o==="dorkos-credits"?"dorkos":p,endpoint:o==="dorkos-credits"?(Ne=k.data)==null?void 0:Ne.endpoint:m,model:y,contextWindow:(q==null?void 0:q.contextWindow)??Number(O),maxOutputTokens:(q==null?void 0:q.maxOutputTokens)??Number(I)});if(!ae.success){E("Check the model, endpoint, and token limits.");return}H.mutate(ae.data)}const B="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(S,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:B,value:o,onChange:f=>{c(f.target.value),v("")},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(S,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:B,value:u,onChange:f=>{d(f.target.value),o==="dorkos-credits"&&v("")},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(S,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:B,value:y,onChange:f=>v(f.target.value),disabled:k.isPending||!((ye=k.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=k.data)==null?void 0:je.models.map(f=>e.jsx("option",{value:f.id,children:f.displayName},f.id))]}),!((ve=k.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(S,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(_,{id:`${r}-service`,value:p,onChange:f=>g(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(_,{id:`${r}-endpoint`,type:"url",value:m,onChange:f=>h(f.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(S,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(_,{id:`${r}-model`,value:y,onChange:f=>v(f.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(S,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(_,{id:`${r}-context`,type:"number",min:1,value:O,onChange:f=>M(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(_,{id:`${r}-output`,type:"number",min:1,value:I,onChange:f=>w(f.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:P,onChange:f=>N(f.target.value),autoComplete:"off"}),ee&&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(C,{type:"submit",disabled:H.isPending,children:H.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ds={openai:"OpenAI",anthropic:"Anthropic"};function Ts(s){return Ds[s]??s}function Ms(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ts(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function qs(s){const t=b();return z({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function Fs(){const s=b(),t=D(),n=R({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]})}});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=b();return z({queryKey:$e,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function _s(){var i;const s=b(),t=R({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 Us(){var l,o,c;const s=b(),t=D(),[n,i]=x.useState(null),a=R({mutationFn:async({providerId:u,key:d,baseURL:m})=>{const h=(m==null?void 0:m.trim())||null;i("checking");const p=await s.checkProviderCredential(u,d.trim().length>0?d:null,h);return p.ok?(i("saving"),await s.storeProviderCredential(u,d,h),{saved:!0,message:null}):{saved:!1,message:p.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:u=>{u.saved&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}),t.invalidateQueries({queryKey:[...$e]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:u=>{u.providerId.trim().length!==0&&a.mutate(u)},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 zs(s){const t=b();return z({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Qs(){var o,c;const s=b(),t=D(),[n,i]=x.useState(null),a=R({mutationFn:async u=>{i(null);const d=await s.pullOllamaModel(u,m=>i(m));return d.ok&&await s.updateConfig({runtimes:{opencode:{provider:qe}}}),d},onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))}}),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:u=>a.mutate(u),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Bs(){var o,c;const s=b(),t=D(),[n,i]=x.useState(null),a=R({mutationFn:()=>(i(null),s.provisionOllama(u=>i(u))),onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...T]}))}}),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 Gs="https://ollama.com/download",Ws="curl -fsSL https://ollama.com/install.sh | sh";function Ys({installMethod:s}){const t=Bs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Vs,{}),n?e.jsx(Hs,{provision:t}):e.jsx(Js,{}),e.jsx(Xs,{})]})}function Vs(){const s=Ke();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 Hs({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(Q,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(C,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Js(){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(Cs,{command:Ws,copyLabel:"Copy the Ollama install command"})]})}function Xs(){return e.jsxs("a",{href:Gs,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(Y,{className:"size-3"})]})}const Zs="https://ollama.com/library",et={"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"}},st={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function tt({active:s,onConnected:t,onConnectDirectly:n}){var I,w,P,N,L,E;const i=qs(s),a=Fs(),r=Qs(),l=((I=i.data)==null?void 0:I.running)??!1,o=zs(l),[c,u]=x.useState(null),[d,m]=x.useState(null);x.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),x.useEffect(()=>{var k;(k=r.result)!=null&&k.ok&&(t==null||t(Pe))},[(w=r.result)==null?void 0:w.ok,t]);const h=k=>{u(k),a.connect(k)},p=k=>{m(k),r.pull(k)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Ys,{installMethod:(P=i.data)==null?void 0:P.installMethod});if(a.isSuccess)return t?null:e.jsx(U,{message:"Connected to Ollama"});if((N=r.result)!=null&&N.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(ns,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const g=i.data,y=(g==null?void 0:g.installed)??[],v=((L=g==null?void 0:g.installed)==null?void 0:L.length)??(g==null?void 0:g.models.length)??0,O=((E=o.data)==null?void 0:E.models.some(k=>k.model.id===d))??!1,M=d!==null&&!O?d:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(nt,{count:v}),y.length>0&&e.jsx(rt,{installed:y,connect:a,connectingId:c,onUse:h}),e.jsx(at,{catalogQuery:o,pull:r,pullingId:d,onGet:p}),e.jsx(it,{pull:r,activePull:M,onSubmit:p}),e.jsx(ot,{}),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 nt({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=et[s];return e.jsxs("div",{"data-testid":"ollama-verdict","data-verdict":s,children:[e.jsx("p",{className:V("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(De,{size:"xs",variant:"outline",className:"font-normal",children:st[s]})}function rt({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(C,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(Q,{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 at({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 u=n===l.id,d=()=>i(l.id);return u&&(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(Q,{message:t.errorMessage??"Couldn’t download the model.",onRetry:d})]},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(C,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:d,children:"Get"})]},l.id)})})]})}function it({pull:s,activePull:t,onSubmit:n}){const[i,a]=x.useState(""),r=i.trim(),l=ps.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(S,{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(_,{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(C,{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(Q,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function ot(){return e.jsxs("a",{href:Zs,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(Y,{className:"size-3"})]})}function ze({progress:s}){const t=Ae(),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:V("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function lt(){var r,l,o;const s=b(),t=D(),n=R({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))}}),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 ct(){var h,p;const s=b(),t=D(),[n,i]=x.useState(null),[a,r]=x.useState(null),l=R({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:g,state:y})=>{if(!rs(g)){r("Couldn’t open the OpenRouter sign-in page.");return}i(y)},onError:g=>r(g.message??"Couldn’t start OpenRouter sign-in.")}),o=z({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:g=>{var y;return((y=g.state.data)==null?void 0:y.status)==="pending"?1500:!1},refetchOnWindowFocus:g=>{var y;return((y=g.state.data)==null?void 0:y.status)==="error"}}),c=(h=o.data)==null?void 0:h.status;x.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))},[c,t]);const u=l.isPending||n!==null&&c==="pending",d=!!a||c==="error",m=d?a??((p=o.data)==null?void 0:p.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:u,isSuccess:c==="connected",isError:d,errorMessage:m}}const dt="https://openrouter.ai/keys";function ut({onConnected:s}){const[t,n]=x.useState(""),i=lt(),a=ct(),r=i.isSuccess||a.isSuccess;return x.useEffect(()=>{r&&(s==null||s(Es))},[r,s]),r?e.jsx(U,{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(Q,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(C,{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(S,{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:dt,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(Y,{className:"size-3"})]}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function Z(s){return W.find(t=>t.id===s)}function mt(s){var t;return((t=Z(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=W.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??W[0].defaultBaseURL}function Qe(s){return W.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 xt({onConnected:s}){const t=$s();return t.isError&&!t.data?e.jsx(Q,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ht,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ht({setup:s,onConnected:t}){var X;const n=Qe(s)?s:null,[i,a]=x.useState(()=>ie(s)),[r,l]=x.useState(""),[o,c]=x.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=Z(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[u,d]=x.useState(()=>{var $;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=Z(j))==null?void 0:$.defaultBaseURL)}),m=Us(),h=_s(),p=Z(i),g=mt(i),y=n!=null&&n.key.saved&&n.providerId===g?n.key.last4:null,v=o.trim(),O=i===se,M=!O||v.length>0,I=ce(g),w=v||I,P=w===I?"":w,N=n===null?null:n.baseURL??ce(n.providerId),L=g!==((n==null?void 0:n.providerId)??null)||w!==N,E=r.trim().length>0,q=(E||y!==null&&!L)&&M,ee=E&&M,H=!E&&y!==null&&L,re=w.startsWith("http://"),B={providerId:g,key:r,baseURL:P},K=m.isPending||h.isPending,J=x.useRef(null),G=()=>{h.reset(),m.reset()};return x.useEffect(()=>{m.isSuccess&&(t==null||t(ws))},[m.isSuccess,t]),x.useEffect(()=>{var j;m.isError&&((j=J.current)==null||j.focus())},[m.isError]),m.isSuccess?e.jsx(U,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),h.reset(),m.connect(B)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(as,{value:i,disabled:K,onValueChange:j=>{var $;a(j),c((($=Z(j))==null?void 0:$.defaultBaseURL)??""),G()},children:[e.jsx(is,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(os,{})}),e.jsxs(ls,{children:[W.map(j=>e.jsx(be,{value:j.id,children:j.label},j.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(O||u)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(S,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!O&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(_,{id:"direct-provider-base-url",value:o,disabled:K,onChange:j=>{c(j.target.value),G()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!O&&!u&&e.jsx("button",{type:"button",onClick:()=>d(!0),disabled:K,"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(S,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:J,value:r,disabled:K,onChange:j=>{l(j.target.value),G()},placeholder:y===null?(p==null?void 0:p.keyPlaceholder)??W[0].keyPlaceholder:`Saved key ends in ${y}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),m.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:m.errorMessage}),H&&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:[p===void 0?e.jsx("span",{}):e.jsxs("a",{href:p.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(Y,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"outline",disabled:!q||K,"data-testid":"direct-provider-test",onClick:()=>{m.reset(),h.reset(),h.check(B)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",disabled:!ee||K,children:"Save & connect"})]})]}),K?e.jsx(A,{message:m.phase==="saving"?"Saving…":"Checking your key…"}):((X=h.result)==null?void 0:X.ok)===!0?e.jsx(U,{message:h.checkedSavedKey?"Your saved key works":"Key works"}):h.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:h.result.message}):null]})}function ft({currentProvider:s,onConnected:t}){const[n,i]=x.useState("choose"),a=gt();if(n==="choose")return e.jsx(pt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(ut,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(tt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(xt,{onConnected:t})})}function gt(){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 ${Ke()}. 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 pt({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: ",Ms(n)]}),Object.values(s).map(i=>e.jsx(yt,{source:i,onChoose:t},i.step))]})}function yt({source:s,onChoose:t}){return e.jsxs("button",{type:"button",onClick:()=>t(s.step),"data-testid":`power-source-${s.step}`,className:V("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(De,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(ds,{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(cs,{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 jt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=ys(),r=Ps(s),l=us(),o=ms(),c=xs([s]);if(s==="doe")return a?e.jsx(As,{onConnected:i}):e.jsx(Oe,{});const u=r==="lead"&&l!==null,d=a?t.kind==="provider-picker"?e.jsx(ft,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Is,{type:s,onConnected:i,asOtherWay:u}):null:e.jsx(Oe,{});if(d===null)return null;const m=me(s).label,h=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 ",m," runs on your DorkOS credits.",c.map(g=>` ${g}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:d})]});const p=g=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:g,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Rs(m))}});return u?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[p(!0),e.jsx(le,{children:d}),e.jsx(Os,{ollama:h,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[d,e.jsx(le,{children:p(!1)})]}):d}function le({collapsed:s=!1,children:t}){const[n,i]=x.useState(!s);return s?e.jsxs(Re,{open:n,onOpenChange:i,children:[e.jsxs(Ie,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(hs,{className:V("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Le,{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 Pt=s=>e.jsx(jt,{...s});export{Ot as C,Cs as D,Os as K,Oe as R,bs as a,ys as b,St as c,Ms as d,Ps as e,As as f,Ss as g,Pt as r,Ct as u};