@paperclipai/ui 2026.1106.0 → 2026.1107.0-canary.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 (412) hide show
  1. package/dist/assets/ActiveAgentsPanel-gVCE_F5O.js +1 -0
  2. package/dist/assets/{AdapterManager-B3EgG6bg.js → AdapterManager-BnF3U0Kj.js} +1 -1
  3. package/dist/assets/AdvancedToolsRoute-B_nuC_6D.js +39 -0
  4. package/dist/assets/AgentActionButtons-CI2UPNeY.js +1 -0
  5. package/dist/assets/AgentAdvancedTab-C2CYDHrn.js +131 -0
  6. package/dist/assets/AgentBulkRoster-C6o4kckc.js +2 -0
  7. package/dist/assets/AgentBulkSettingsSheet-C7ZQicK8.js +1 -0
  8. package/dist/assets/AgentChat-CPBBc_F0.js +1 -0
  9. package/dist/assets/AgentDetailPage-BQIqISD2.js +39 -0
  10. package/dist/assets/AgentIdentityChip-C6CMC1_m.js +1 -0
  11. package/dist/assets/Agents-ChJmaN-Z.js +2 -0
  12. package/dist/assets/Agents.production-C7Xx6goa.js +2 -0
  13. package/dist/assets/AnimatedDialogContent-B3c1OS-h.js +1 -0
  14. package/dist/assets/AppDetail-CIB59Acy.js +1 -0
  15. package/dist/assets/AppNotConnected-BiVpP8o5.js +1 -0
  16. package/dist/assets/ApprovalDetail-dlkF2hzF.js +1 -0
  17. package/dist/assets/Approvals-DH0S08ZM.js +1 -0
  18. package/dist/assets/AppsConnect-BIs1NWU4.js +1 -0
  19. package/dist/assets/{AppsReview-Dat_iZz7.js → AppsReview-C2orAhc5.js} +1 -1
  20. package/dist/assets/ArtifactEmptyGraphic-8dp7D7X4.js +1 -0
  21. package/dist/assets/Artifacts-5AIiF_La.js +1 -0
  22. package/dist/assets/AssistantConnection-CSH3SCLu.js +1 -0
  23. package/dist/assets/AuditHub-BsLr4FFu.js +1 -0
  24. package/dist/assets/AuditRuns-BAlqj2c_.js +1 -0
  25. package/dist/assets/Auth-BgCdblgf.js +3 -0
  26. package/dist/assets/{BoardChat-C7mrrKOE.js → BoardChat-BJx2WzZd.js} +4 -4
  27. package/dist/assets/BoardClaim-wRHOcaMP.js +1 -0
  28. package/dist/assets/{BootstrapSetupUxLab-C_qzfxrI.js → BootstrapSetupUxLab-7wmcPijO.js} +1 -1
  29. package/dist/assets/Browse-DmEq7AKG.js +1 -0
  30. package/dist/assets/BudgetPolicyCard-CpxL27q-.js +1 -0
  31. package/dist/assets/CaseDetail-B4U4-pLB.js +1 -0
  32. package/dist/assets/CaseStatus-P-Fj9Jt_.js +1 -0
  33. package/dist/assets/Cases-BbGzELLM.js +1 -0
  34. package/dist/assets/ChatEndpointDetail-PiuTP46M.js +5 -0
  35. package/dist/assets/ChatEndpointSetup-icLZraK6.js +1 -0
  36. package/dist/assets/ChatIdentityConfirm-B7266LBY.js +1 -0
  37. package/dist/assets/CliAuth-3AsC_iFp.js +1 -0
  38. package/dist/assets/Companies-BzF6DacB.js +1 -0
  39. package/dist/assets/CompanyAccess-CL2N_V63.js +1 -0
  40. package/dist/assets/CompanyActivity-BYto4Yf8.js +1 -0
  41. package/dist/assets/CompanyActivity.production-DZqctEbl.js +1 -0
  42. package/dist/assets/CompanyConnections-Ng7ObTN6.js +1 -0
  43. package/dist/assets/{CompanyEnvironments-BbSbF-xo.js → CompanyEnvironments-DfPnYzLf.js} +17 -17
  44. package/dist/assets/CompanyExport-ArvIwuFz.js +4 -0
  45. package/dist/assets/CompanyImport-BBmRrVHc.js +1 -0
  46. package/dist/assets/CompanySettings-CL2hO2v9.js +1 -0
  47. package/dist/assets/CompanySettingsPluginPage-BBzr0ul1.js +1 -0
  48. package/dist/assets/CompanySkills-DyZ4i38P.js +10 -0
  49. package/dist/assets/CompanySkills.production-CwujMBI8.js +10 -0
  50. package/dist/assets/ConfigureBuiltInAgentModal-DKgbU8gW.js +1 -0
  51. package/dist/assets/CopyableGatewayUrl-MTDXnH12.js +1 -0
  52. package/dist/assets/Costs-CH9jqY-g.js +1 -0
  53. package/dist/assets/{CrossIssueCollaborationUxLab-D1DK8pCU.js → CrossIssueCollaborationUxLab-CAt6kXQv.js} +1 -1
  54. package/dist/assets/Dashboard-DYBT-YnW.js +2 -0
  55. package/dist/assets/{DashboardLive-Bhet7tfL.js → DashboardLive-Ck2PWFSe.js} +1 -1
  56. package/dist/assets/DecisionDateChips-D9FYIWef.js +1 -0
  57. package/dist/assets/DecisionQueuePage-DJWtDcgS.js +1 -0
  58. package/dist/assets/DesignGuide-Lh8bRIQs.js +25 -0
  59. package/dist/assets/{DesignSandboxTaskThread-Btl5Yf0V.js → DesignSandboxTaskThread-dwxJJhSQ.js} +8 -8
  60. package/dist/assets/EmailConnectionAccess-Cc-1TXsE.js +1 -0
  61. package/dist/assets/EmailEndpointSetup-DmLjvAOL.js +1 -0
  62. package/dist/assets/EnforcementBanner-R9W0S4Mi.js +1 -0
  63. package/dist/assets/EntityRow-CKx0wtkE.js +1 -0
  64. package/dist/assets/ExecutionWorkspaceDetail-C8rFP0MN.js +19 -0
  65. package/dist/assets/ExternalAgentInviteDialog-Cb3S5rZv.js +50 -0
  66. package/dist/assets/{FilterBar-CMdDMfwb.js → FilterBar-Cn6EUh-Z.js} +1 -1
  67. package/dist/assets/FolderControls-CjsFX2rE.js +1 -0
  68. package/dist/assets/GatewayDetail-Dboc1xPL.js +2 -0
  69. package/dist/assets/GatewaysList-cgzJwEaH.js +1 -0
  70. package/dist/assets/GitHubConnectionRecovery-DM6Fshns.js +1 -0
  71. package/dist/assets/GoalDetail-CxUS2Prv.js +1 -0
  72. package/dist/assets/GoalTree-phAwXttT.js +1 -0
  73. package/dist/assets/Goals-D1cFLtak.js +1 -0
  74. package/dist/assets/InstanceAccess-Dnh1dAbe.js +1 -0
  75. package/dist/assets/InstanceExperimentalSettings-Chm-v-ot.js +1 -0
  76. package/dist/assets/InviteLanding-c3Rk88W0.js +1 -0
  77. package/dist/assets/{IssueChatLongThreadPerf-CoYlH2b9.js → IssueChatLongThreadPerf-Dx2wn_GN.js} +2 -2
  78. package/dist/assets/JoinRequestQueue-CrMG8ct1.js +1 -0
  79. package/dist/assets/Layout.production-C8APCiyl.js +1 -0
  80. package/dist/assets/ManagedAiConnectionDetails-84bg7nGa.js +1 -0
  81. package/dist/assets/McpConnect-C6JhWP79.js +1 -0
  82. package/dist/assets/MembershipAction-Ar4XxJqV.js +1 -0
  83. package/dist/assets/{MetricCard-B2Di_1o5.js → MetricCard-CZtd5x_G.js} +1 -1
  84. package/dist/assets/{MissingPluginTabPlaceholder-CmS8e8CW.js → MissingPluginTabPlaceholder-Cz_TGpV7.js} +1 -1
  85. package/dist/assets/NewAgent-Biwqvfur.js +1 -0
  86. package/dist/assets/NewAgentDialog-DkXgnZk9.js +1 -0
  87. package/dist/assets/NewGoalDialog-VbswDJiB.js +1 -0
  88. package/dist/assets/NewProjectDialog-RSiSPRDo.js +1 -0
  89. package/dist/assets/OnboardingPrimitives-BKn3-tS_.js +1 -0
  90. package/dist/assets/OnboardingWizard-JohyZeeh.js +2 -0
  91. package/dist/assets/OrgChart.production-DHYI76u7.js +1 -0
  92. package/dist/assets/PaperclipCloudOAuthHandoff-B-UlRRyT.js +1 -0
  93. package/dist/assets/PluginManager-DYAQLbq6.js +1 -0
  94. package/dist/assets/{PluginPage-CEkGIIhc.js → PluginPage-C5ZWMP87.js} +1 -1
  95. package/dist/assets/PluginSettings-CqD4p0XB.js +1 -0
  96. package/dist/assets/ProfileDetailRoute-D5S_HiSs.js +1 -0
  97. package/dist/assets/ProfileSettings-3FYSxQRK.js +1 -0
  98. package/dist/assets/ProfileWizardRoute-dCZ0jv_p.js +1 -0
  99. package/dist/assets/ProjectDetail-C7ZyN7uN.js +1 -0
  100. package/dist/assets/ProjectRepositoryInput-GzzthskH.js +1 -0
  101. package/dist/assets/ProjectWorkspaceDetail-oU4XIges.js +29 -0
  102. package/dist/assets/{ProjectWorkspacesContent-CMJ4tM_P.js → ProjectWorkspacesContent-DRHBujaJ.js} +1 -1
  103. package/dist/assets/Projects-CvkJGiMB.js +1 -0
  104. package/dist/assets/QuotaBar-BPDeixSu.js +1 -0
  105. package/dist/assets/RepositoryEditor-DjWP4WNd.js +1 -0
  106. package/dist/assets/{ResponsibleUserDenialUxLab-7VWE4E9Y.js → ResponsibleUserDenialUxLab-XY1kbf2R.js} +1 -1
  107. package/dist/assets/ReviewQueueCard-rZQxvKHy.js +1 -0
  108. package/dist/assets/{RoutineActivityRow-CUbd7CmM.js → RoutineActivityRow-CodLzwX9.js} +1 -1
  109. package/dist/assets/RoutineDetail-DTh73GV0.js +2 -0
  110. package/dist/assets/RoutineDetail.production-DFyfU4lo.js +1 -0
  111. package/dist/assets/RoutineRunVariablesDialog-covlKcBI.js +1 -0
  112. package/dist/assets/Routines-B-27ZQwW.js +1 -0
  113. package/dist/assets/Routines.production-PR6a0rpK.js +1 -0
  114. package/dist/assets/Search-CjLwxAT4.js +1 -0
  115. package/dist/assets/Secrets-CIzopuCf.js +4 -0
  116. package/dist/assets/{SkillBinaryFile-RahChYgn.js → SkillBinaryFile-DbYfdvlr.js} +1 -1
  117. package/dist/assets/{SkillCardIcon-CAT5DkGJ.js → SkillCardIcon-Byqliezr.js} +2 -2
  118. package/dist/assets/SkillFolderTree-DsN6vTpC.js +1 -0
  119. package/dist/assets/SkillSourceTree-BNXzJhPU.js +2 -0
  120. package/dist/assets/SkillSources-CMthMNTk.js +2 -0
  121. package/dist/assets/SkillStudio-DjKgb6ak.js +9 -0
  122. package/dist/assets/{SkillsNavigationTabs-BceSLkAb.js → SkillsNavigationTabs-Dvl7gIo7.js} +1 -1
  123. package/dist/assets/SpekoPhoneCallback-BBG0U0NN.js +1 -0
  124. package/dist/assets/{SpekoProviderSetup-DedUgkRp.js → SpekoProviderSetup-CP0YAGmS.js} +1 -1
  125. package/dist/assets/StatusCards-gg5U5PGC.js +1 -0
  126. package/dist/assets/SummarySlotCard-Dn-F8zVz.js +1 -0
  127. package/dist/assets/{TaskChatLab-jfgxyfJj.js → TaskChatLab-ChVx85bQ.js} +3 -3
  128. package/dist/assets/TaskSummaryList-C2-gnj0k.js +1 -0
  129. package/dist/assets/{Timeline-40V1FjUc.js → Timeline-D56aV3sU.js} +1 -1
  130. package/dist/assets/ToolsAdminGate-DiGsT0eE.js +1 -0
  131. package/dist/assets/TrustPresetSection-3bITFdMw.js +1 -0
  132. package/dist/assets/UserProfile-BoagkEoY.js +1 -0
  133. package/dist/assets/WebhookUrlWarning-DDfyoOUx.js +1 -0
  134. package/dist/assets/WhatNeedsMe-B1LkTm0_.js +1 -0
  135. package/dist/assets/Workspaces-CvSWs2Xj.js +1 -0
  136. package/dist/assets/{abnfDiagram-YUKMZFIV-CYclmgiA.js → abnfDiagram-YUKMZFIV-BYhs5Gd2.js} +1 -1
  137. package/dist/assets/{architecture-WOLXFQ4H-B4Z_FC3N.js → architecture-WOLXFQ4H-DATTB-op.js} +1 -1
  138. package/dist/assets/{architectureDiagram-47P4ROYG-DUerk92s.js → architectureDiagram-47P4ROYG-fDbYfznu.js} +1 -1
  139. package/dist/assets/{arrow-down-left-D6a2vS_-.js → arrow-down-left-osOCWPao.js} +1 -1
  140. package/dist/assets/{blockDiagram-E7TT5TSB-B56guZEC.js → blockDiagram-E7TT5TSB-oH3uBA7S.js} +1 -1
  141. package/dist/assets/{c4Diagram-CRA5TL53-DoGuQxSF.js → c4Diagram-CRA5TL53-Csm2rAK3.js} +1 -1
  142. package/dist/assets/channel-DwsAOUBe.js +1 -0
  143. package/dist/assets/chat-channels-DCOcXYAX.js +1 -0
  144. package/dist/assets/{chunk-2BW5OAIV-DWxssTQk.js → chunk-2BW5OAIV-CtHx5mwq.js} +1 -1
  145. package/dist/assets/{chunk-3YJQHVM4-C1vRqH0i.js → chunk-3YJQHVM4-Di3MHiYw.js} +1 -1
  146. package/dist/assets/{chunk-4EA7E6EY-Bolo8EVC.js → chunk-4EA7E6EY-Bv7ZM07e.js} +1 -1
  147. package/dist/assets/{chunk-7TKQ45FW-DWQSZJR0.js → chunk-7TKQ45FW-BDW9PcH-.js} +1 -1
  148. package/dist/assets/{chunk-AW2ZBBNX-CZSGhLhm.js → chunk-AW2ZBBNX-CPVL2nS4.js} +1 -1
  149. package/dist/assets/{chunk-DBDB3WZW-CfT4zBi0.js → chunk-DBDB3WZW-B9xX2hSp.js} +1 -1
  150. package/dist/assets/{chunk-E2ZNV5FY-D_-pgRuE.js → chunk-E2ZNV5FY-BWCAokaz.js} +1 -1
  151. package/dist/assets/{chunk-EU5HNXII-CLh5fnaN.js → chunk-EU5HNXII-QG67LIsR.js} +1 -1
  152. package/dist/assets/{chunk-FVRAUYC3-B06x5Tr-.js → chunk-FVRAUYC3-BtSXSJZb.js} +1 -1
  153. package/dist/assets/{chunk-HJ2JQQFS-Brh3i00t.js → chunk-HJ2JQQFS-CwLiQeX7.js} +1 -1
  154. package/dist/assets/{chunk-HTAEGDNF-BdorfNJc.js → chunk-HTAEGDNF-5S_kJZnU.js} +1 -1
  155. package/dist/assets/{chunk-KQW6MTUR-Cp_f1_kA.js → chunk-KQW6MTUR-BCjRx0O3.js} +1 -1
  156. package/dist/assets/{chunk-NTY3LDVX-DurHEGWa.js → chunk-NTY3LDVX-C6QbeD7p.js} +1 -1
  157. package/dist/assets/{chunk-VPRB5NB3-BP53-9_8.js → chunk-VPRB5NB3-CAw0dSrH.js} +1 -1
  158. package/dist/assets/{chunk-XC4XBNZT--cEnsNQI.js → chunk-XC4XBNZT-DF7widVC.js} +1 -1
  159. package/dist/assets/{circle-slash-D1nrjwDE.js → circle-slash-DyxSDEAE.js} +1 -1
  160. package/dist/assets/{classDiagram-v2-K4WV4PDN-BavpveTv.js → classDiagram-v2-K4WV4PDN-Bo1714tP.js} +1 -1
  161. package/dist/assets/{coins-Dz0bu2Nn.js → coins-BUQ6RIBy.js} +1 -1
  162. package/dist/assets/collections-DWBx3_z7.js +3 -0
  163. package/dist/assets/{connection-owner-HvpwDVJd.js → connection-owner-Di_Bbiw9.js} +1 -1
  164. package/dist/assets/{cynefin-EF2NZ3EQ-CNK_GaAK.js → cynefin-EF2NZ3EQ-BqaPaRCW.js} +1 -1
  165. package/dist/assets/{cynefinDiagram-3GCD6N5R-DmfRo_0r.js → cynefinDiagram-3GCD6N5R-hia8pyiu.js} +1 -1
  166. package/dist/assets/{dagre-W4DXFKR2-BxWkfxMx.js → dagre-W4DXFKR2-CWO56RHK.js} +1 -1
  167. package/dist/assets/{diagram-2UJZ2QOL-C3O0glGw.js → diagram-2UJZ2QOL-zKUNjc94.js} +1 -1
  168. package/dist/assets/{diagram-OVF4WLC6-Krv_AvZL.js → diagram-OVF4WLC6-7zxuFKx0.js} +1 -1
  169. package/dist/assets/{diagram-PFPMY2P6-tnuTg8Lf.js → diagram-PFPMY2P6-CwiW3qSv.js} +1 -1
  170. package/dist/assets/{diagram-UMYRVEAY-BT-XN_Wr.js → diagram-UMYRVEAY-D2H8DyJt.js} +1 -1
  171. package/dist/assets/{diagram-YEKJPTXX-Dgy_uhZI.js → diagram-YEKJPTXX-BPkByE9Y.js} +1 -1
  172. package/dist/assets/{diagram-ZIFT7M5P-BrfJnwq-.js → diagram-ZIFT7M5P-CX7QN3Hu.js} +1 -1
  173. package/dist/assets/dist-B7IVUyXV.js +1 -0
  174. package/dist/assets/dist-BHEW6Rkf.js +1 -0
  175. package/dist/assets/{dist-BBnh18gy.js → dist-BJab39LS.js} +2 -2
  176. package/dist/assets/dist-BdfP6IP-.js +1 -0
  177. package/dist/assets/dist-Bdw4b5uP.js +1 -0
  178. package/dist/assets/dist-BpgA-Cjh.js +1 -0
  179. package/dist/assets/dist-BzLd4iJJ.js +1 -0
  180. package/dist/assets/dist-C5SAtXYc.js +1 -0
  181. package/dist/assets/dist-CB5ruho9.js +1 -0
  182. package/dist/assets/dist-CUlATLX5.js +3 -0
  183. package/dist/assets/dist-CXwfhdd-.js +1 -0
  184. package/dist/assets/dist-DIbehe55.js +1 -0
  185. package/dist/assets/dist-DN0R2cDp.js +1 -0
  186. package/dist/assets/dist-DZCRy5aU.js +1 -0
  187. package/dist/assets/dist-DjDrRX2t.js +1 -0
  188. package/dist/assets/dist-DslBcjnn.js +1 -0
  189. package/dist/assets/dist-Dv9Pi76W.js +1 -0
  190. package/dist/assets/{dist-BnnWgd9O.js → dist-DxvFJI59.js} +4 -4
  191. package/dist/assets/dist-Dy-WLWHB.js +1 -0
  192. package/dist/assets/dist-LKBn9Y8A.js +1 -0
  193. package/dist/assets/dist-Tt0J7307.js +13 -0
  194. package/dist/assets/dist-Ym4IZeUC.js +1 -0
  195. package/dist/assets/dist-qHdkuMpg.js +7 -0
  196. package/dist/assets/{ebnfDiagram-VR2GEFS7-BuB73kMx.js → ebnfDiagram-VR2GEFS7-Bs9B4Q5k.js} +1 -1
  197. package/dist/assets/{elk-IJKZMXRS-BaOxRrOl.js → elk-IJKZMXRS-C1D6dAIF.js} +1 -1
  198. package/dist/assets/{erDiagram-O2IAPWRE-D2mlRh4i.js → erDiagram-O2IAPWRE-VuYRuMtg.js} +1 -1
  199. package/dist/assets/{eventmodeling-K75KTNOO-DkIlY_7A.js → eventmodeling-K75KTNOO-BtnWJEXi.js} +1 -1
  200. package/dist/assets/flowDiagram-OXPTDLAJ-C5mqlFQK.js +1 -0
  201. package/dist/assets/{ganttDiagram-R7TSEDQI-BGg29r2I.js → ganttDiagram-R7TSEDQI-B6BLrgFw.js} +1 -1
  202. package/dist/assets/{gitGraph-VSP46ZUC-DUHxXRsf.js → gitGraph-VSP46ZUC-BWR6NJYe.js} +1 -1
  203. package/dist/assets/{gitGraphDiagram-XJZIOB7I-BdzHNz4F.js → gitGraphDiagram-XJZIOB7I-7v25veEQ.js} +1 -1
  204. package/dist/assets/{goals-ZDYcfNWr.js → goals-BzHji0Z7.js} +1 -1
  205. package/dist/assets/index-B9u2GAJi.js +428 -0
  206. package/dist/assets/index-sQhl42sF.css +1 -0
  207. package/dist/assets/{info-OHQRW6UA-WtiWrGun.js → info-OHQRW6UA-BVgUSDnk.js} +1 -1
  208. package/dist/assets/{infoDiagram-5W2HQ5XZ-r39BqejK.js → infoDiagram-5W2HQ5XZ-DMYn-qSY.js} +1 -1
  209. package/dist/assets/{ishikawaDiagram-K3B6WC7H-CTl2PRYl.js → ishikawaDiagram-K3B6WC7H-DpwuadoC.js} +1 -1
  210. package/dist/assets/issue-detail-BCc22gsn.js +339 -0
  211. package/dist/assets/{journeyDiagram-COXZFDF6-CG0WY3T1.js → journeyDiagram-COXZFDF6-GNAsiOcI.js} +1 -1
  212. package/dist/assets/{kanban-definition-P3RFRI5V-yq61VhIu.js → kanban-definition-P3RFRI5V-CoDc1259.js} +1 -1
  213. package/dist/assets/{line-BoKtFXx8.js → line-SKEUWbtd.js} +1 -1
  214. package/dist/assets/{link-Cez8zEYK.js → link-PWetRs2y.js} +1 -1
  215. package/dist/assets/{list-filter-D8kqKAyN.js → list-filter-DZsHzWnk.js} +1 -1
  216. package/dist/assets/{log-in-CEfzyuId.js → log-in-I2bK9Uj8.js} +1 -1
  217. package/dist/assets/{mermaid-parser.core-CdFiKkGO.js → mermaid-parser.core-BrNhvL6b.js} +4 -4
  218. package/dist/assets/{mermaid.core-8LsXC41U.js → mermaid.core-BiGKgc7u.js} +4 -4
  219. package/dist/assets/{mindmap-definition-LZFPQGKD-DLn4QsWt.js → mindmap-definition-LZFPQGKD-DJT7Saj9.js} +1 -1
  220. package/dist/assets/onboarding-state-C5_mIw3o.js +1 -0
  221. package/dist/assets/operate-sections-Dpa-v0YW.js +1 -0
  222. package/dist/assets/{packet-JDAUHWVQ-dCXYK_nZ.js → packet-JDAUHWVQ-CMw7TLMC.js} +1 -1
  223. package/dist/assets/{pegDiagram-BGZESJAR-VYziGVII.js → pegDiagram-BGZESJAR-YfJ1FDN-.js} +1 -1
  224. package/dist/assets/{pen-line-3GyjxtOO.js → pen-line-0jU3kETw.js} +1 -1
  225. package/dist/assets/{pie-XZMESJXO-BOVg3xsq.js → pie-XZMESJXO-B4KXv-NH.js} +1 -1
  226. package/dist/assets/{pieDiagram-CAPJLFHJ-CexeN4X-.js → pieDiagram-CAPJLFHJ-D32zAt1B.js} +1 -1
  227. package/dist/assets/{power-CzxBm3W-.js → power-DA-JLMjT.js} +1 -1
  228. package/dist/assets/{profile-summary-Cr_yTzWk.js → profile-summary-CFDjDVWs.js} +1 -1
  229. package/dist/assets/{quadrantDiagram-GDMTTRAM-CNwZvvlL.js → quadrantDiagram-GDMTTRAM-BByO56Jb.js} +1 -1
  230. package/dist/assets/{radar-ABXABTNO-DHpRAJDf.js → radar-ABXABTNO-B111IsR6.js} +1 -1
  231. package/dist/assets/{railroad-I3PHUGI6-H33kO77C.js → railroad-I3PHUGI6-Cagl_EHR.js} +1 -1
  232. package/dist/assets/{railroad-abnf-LNEFI6M7-Cz93oqwa.js → railroad-abnf-LNEFI6M7-BoCN8ZxM.js} +1 -1
  233. package/dist/assets/{railroad-ebnf-DWYD2UWJ-DYMCczqm.js → railroad-ebnf-DWYD2UWJ-D5iXOEH9.js} +1 -1
  234. package/dist/assets/{railroad-peg-JR7BVNR7-BHkQAfMM.js → railroad-peg-JR7BVNR7-Cx2f_FvS.js} +1 -1
  235. package/dist/assets/{railroadDiagram-SM67HX2B-CUsiDC5L.js → railroadDiagram-SM67HX2B-DCm8YHtX.js} +1 -1
  236. package/dist/assets/{requirementDiagram-X7JNWC4A-DoL3LZsP.js → requirementDiagram-X7JNWC4A-Dv9vpo0Y.js} +1 -1
  237. package/dist/assets/{sankeyDiagram-UM26HJRW-xtXRZJCJ.js → sankeyDiagram-UM26HJRW-CYWdEfDJ.js} +1 -1
  238. package/dist/assets/search-1koe_hb6.js +1 -0
  239. package/dist/assets/{sequenceDiagram-ZO4K6R2Y-DQD7gBwU.js → sequenceDiagram-ZO4K6R2Y-DfQ8p7Zk.js} +1 -1
  240. package/dist/assets/shared-SvNLjO9T.js +1 -0
  241. package/dist/assets/{smoke-lab-matrix-B4XGX4h_.js → smoke-lab-matrix-Vxz--ttE.js} +1 -1
  242. package/dist/assets/{stateDiagram-v2-TBUQTH76-B_tVd4q3.js → stateDiagram-v2-TBUQTH76-CoEqtcHP.js} +1 -1
  243. package/dist/assets/{swimlanes-N4OXWK64-wuHFsxna.js → swimlanes-N4OXWK64-CEuQIHLZ.js} +1 -1
  244. package/dist/assets/swimlanesDiagram-K3J5GTZL-CFLM7ZUX.js +8 -0
  245. package/dist/assets/{timeline-definition-YOQAKGHF-DZMsq2s3.js → timeline-definition-YOQAKGHF-CidmenM8.js} +1 -1
  246. package/dist/assets/{treeView-D4JQ5SDB-CgPEU5y2.js → treeView-D4JQ5SDB-B0h4OWsY.js} +1 -1
  247. package/dist/assets/{treemap-SAJKECNS-DbJImAGH.js → treemap-SAJKECNS-DvQPr13C.js} +1 -1
  248. package/dist/assets/useAuthorizationWindow-BwTdVu1A.js +1 -0
  249. package/dist/assets/useDateRange-CyLQEuZX.js +1 -0
  250. package/dist/assets/useFastResponsesEnabled-CWTCTbVi.js +1 -0
  251. package/dist/assets/{useProfilesData-jFplHa_C.js → useProfilesData-dUMO8SxN.js} +1 -1
  252. package/dist/assets/useSummaryDraftStream-YPqUmAbf.js +3 -0
  253. package/dist/assets/{usecaseDiagram-VIAY4XPW-DMHY-m8h.js → usecaseDiagram-VIAY4XPW-CGWEyQ1_.js} +1 -1
  254. package/dist/assets/{vennDiagram-BLWOH2XV-CrYDT3rT.js → vennDiagram-BLWOH2XV-C4YxNwJf.js} +1 -1
  255. package/dist/assets/{wardley-7MLQ67FV-7iCKHFyO.js → wardley-7MLQ67FV-B2akqJTU.js} +1 -1
  256. package/dist/assets/{wardleyDiagram-YMQ3BMBF-D8tAygzp.js → wardleyDiagram-YMQ3BMBF-Dz5-RVCV.js} +1 -1
  257. package/dist/assets/{xychartDiagram-TAQBALBS-pYZ-BjGH.js → xychartDiagram-TAQBALBS-BuaLhg_J.js} +1 -1
  258. package/dist/brands/apps/1password-dark.svg +1 -0
  259. package/dist/brands/apps/1password.svg +1 -0
  260. package/dist/brands/apps/manifest.json +8 -1
  261. package/dist/index.html +39 -3
  262. package/dist/site.webmanifest +1 -1
  263. package/dist/sw.js +1 -1
  264. package/package.json +1 -1
  265. package/dist/assets/ActiveAgentsPanel-CZDoAvB_.js +0 -1
  266. package/dist/assets/AdvancedToolsRoute-DA3JP_iD.js +0 -39
  267. package/dist/assets/AgentActionButtons-Aj2aiMOA.js +0 -1
  268. package/dist/assets/AgentBulkRoster-C3fOjy9w.js +0 -2
  269. package/dist/assets/AgentBulkSettingsSheet-CsKLRWit.js +0 -1
  270. package/dist/assets/AgentChat-Cioq_pP8.js +0 -1
  271. package/dist/assets/AgentDetailPage-AkHN49l2.js +0 -38
  272. package/dist/assets/Agents-DMuTmFd4.js +0 -2
  273. package/dist/assets/Agents.production-C-Xezxa2.js +0 -2
  274. package/dist/assets/AnimatedDialogContent-B_zQ4Fcu.js +0 -1
  275. package/dist/assets/AppDetail-DHP2AJu8.js +0 -1
  276. package/dist/assets/AppNotConnected-CeKtvzuy.js +0 -1
  277. package/dist/assets/ApprovalDetail-CTQvytbM.js +0 -1
  278. package/dist/assets/Approvals-DHXcE2MM.js +0 -1
  279. package/dist/assets/AppsConnect-B-Lu06aW.js +0 -1
  280. package/dist/assets/Artifacts-BG8ZYQCh.js +0 -1
  281. package/dist/assets/AssistantConnection-CDPJJHU3.js +0 -1
  282. package/dist/assets/AuditHub-CBy0yoXy.js +0 -1
  283. package/dist/assets/Auth-15r82gGr.js +0 -3
  284. package/dist/assets/BoardClaim-Cryt2aiW.js +0 -1
  285. package/dist/assets/Browse-DF5vJeqz.js +0 -1
  286. package/dist/assets/BudgetPolicyCard-Dw8oz5tD.js +0 -1
  287. package/dist/assets/CaseDetail-Ceo9-wom.js +0 -1
  288. package/dist/assets/CaseStatus-DTxFtBNB.js +0 -1
  289. package/dist/assets/Cases-DvHJpHol.js +0 -1
  290. package/dist/assets/ChatEndpointDetail-BrWW8Vbt.js +0 -5
  291. package/dist/assets/ChatEndpointSetup-CmkH8BuO.js +0 -1
  292. package/dist/assets/ChatIdentityConfirm-DdKzeU9r.js +0 -1
  293. package/dist/assets/CliAuth-Cc-p1cBz.js +0 -1
  294. package/dist/assets/Companies-9YePYZ_p.js +0 -1
  295. package/dist/assets/CompanyAccess-DIsf7zZ9.js +0 -1
  296. package/dist/assets/CompanyActivity-D-Up0TMT.js +0 -1
  297. package/dist/assets/CompanyActivity.production-D4VAjdoE.js +0 -1
  298. package/dist/assets/CompanyConnections-CveLAvOY.js +0 -1
  299. package/dist/assets/CompanyExport-lRSjWCML.js +0 -4
  300. package/dist/assets/CompanyImport-D6l5JEtD.js +0 -1
  301. package/dist/assets/CompanySettings-C5gthnMw.js +0 -1
  302. package/dist/assets/CompanySettingsPluginPage-mqlQ2OVj.js +0 -1
  303. package/dist/assets/CompanySkills-KnPXHa1W.js +0 -10
  304. package/dist/assets/CompanySkills.production-FGnsT2pb.js +0 -10
  305. package/dist/assets/ConfigureBuiltInAgentModal-CO8iacRQ.js +0 -1
  306. package/dist/assets/CopyableGatewayUrl-Dd_TVBy5.js +0 -1
  307. package/dist/assets/Costs-BqG1sYA9.js +0 -1
  308. package/dist/assets/Dashboard-DeSTKzxd.js +0 -2
  309. package/dist/assets/DecisionDateChips-UMFDXlJ4.js +0 -1
  310. package/dist/assets/DecisionQueuePage-Dn9XGUSj.js +0 -1
  311. package/dist/assets/DesignGuide-dm4YS6Pb.js +0 -23
  312. package/dist/assets/EmailConnectionAccess-CKzBOA05.js +0 -1
  313. package/dist/assets/EmailEndpointSetup-D9awwu8p.js +0 -1
  314. package/dist/assets/EnforcementBanner-N5mrUB6j.js +0 -1
  315. package/dist/assets/EntityRow-DEnCWYkr.js +0 -1
  316. package/dist/assets/ExecutionWorkspaceDetail-C7QEBcSb.js +0 -19
  317. package/dist/assets/ExternalAgentInviteDialog-XRXdcfb_.js +0 -50
  318. package/dist/assets/FolderControls-5r2pZ_Eh.js +0 -1
  319. package/dist/assets/GatewayDetail-BaMcOu4l.js +0 -2
  320. package/dist/assets/GatewaysList-DYYOdBB8.js +0 -1
  321. package/dist/assets/GitHubConnectionRecovery-D_08y2eQ.js +0 -1
  322. package/dist/assets/GoalDetail-DK__oG0Y.js +0 -1
  323. package/dist/assets/GoalTree-fFVQTnHA.js +0 -1
  324. package/dist/assets/Goals-DKJXLljF.js +0 -1
  325. package/dist/assets/Inbox-DLYtWEDR.js +0 -3
  326. package/dist/assets/InstanceAccess-CqUI_g1f.js +0 -1
  327. package/dist/assets/InstanceExperimentalSettings-8U0XhPGL.js +0 -1
  328. package/dist/assets/InviteLanding-B0jCQurU.js +0 -1
  329. package/dist/assets/Issues-C5M7MpyF.js +0 -1
  330. package/dist/assets/JoinRequestQueue-CnlxqQki.js +0 -1
  331. package/dist/assets/Layout.production-tqYmoE_4.js +0 -1
  332. package/dist/assets/ManagedAiConnectionDetails-V1S36TJJ.js +0 -1
  333. package/dist/assets/McpConnect-BrEM-X38.js +0 -1
  334. package/dist/assets/MembershipAction-CGZc6fYa.js +0 -1
  335. package/dist/assets/NewAgent-HT_RU6hK.js +0 -1
  336. package/dist/assets/NewAgentDialog-7rlSe__2.js +0 -1
  337. package/dist/assets/NewGoalDialog-CATH3Umz.js +0 -1
  338. package/dist/assets/NewIssueDialog-Dc5GFmI4.js +0 -1
  339. package/dist/assets/NewProjectDialog-DW_nHIzL.js +0 -1
  340. package/dist/assets/OnboardingPrimitives-CjI1jTZD.js +0 -1
  341. package/dist/assets/OnboardingWizard-BbI9NeiV.js +0 -2
  342. package/dist/assets/OrgChart.production-HIUVrxwA.js +0 -1
  343. package/dist/assets/PaperclipCloudOAuthHandoff-186Touhi.js +0 -1
  344. package/dist/assets/PluginManager-CWCEWAMB.js +0 -1
  345. package/dist/assets/PluginSettings-JiF-AYjF.js +0 -1
  346. package/dist/assets/ProfileDetailRoute-B7eFFgG7.js +0 -1
  347. package/dist/assets/ProfileSettings-CL7-Ztoa.js +0 -1
  348. package/dist/assets/ProfileWizardRoute-MOX4Tq9-.js +0 -1
  349. package/dist/assets/ProjectDetail-dv5M5HmU.js +0 -1
  350. package/dist/assets/ProjectRepositoryInput-BvwsB4Jw.js +0 -1
  351. package/dist/assets/ProjectWorkspaceDetail-B4jwkVhi.js +0 -29
  352. package/dist/assets/Projects-d4dSe4uD.js +0 -1
  353. package/dist/assets/QuotaBar-1hMacK24.js +0 -1
  354. package/dist/assets/RepositoryEditor-CvUXkJtp.js +0 -1
  355. package/dist/assets/ReviewQueueCard-Cv3QewkR.js +0 -1
  356. package/dist/assets/RoutineDetail-C1sKydAN.js +0 -2
  357. package/dist/assets/RoutineDetail.production-D_qAhS8n.js +0 -1
  358. package/dist/assets/RoutineRunVariablesDialog-C_n3NNy3.js +0 -1
  359. package/dist/assets/Routines-CNpKyvp1.js +0 -1
  360. package/dist/assets/Routines.production-gQepjloq.js +0 -1
  361. package/dist/assets/Search-D6cYxLiH.js +0 -1
  362. package/dist/assets/Secrets-Jy6BDriu.js +0 -4
  363. package/dist/assets/SetMyUserSecretDialog-DM-44eeI.js +0 -1
  364. package/dist/assets/SkillFolderTree-CLWkQsqp.js +0 -1
  365. package/dist/assets/SkillSourceTree-BK9D324X.js +0 -2
  366. package/dist/assets/SkillSources-DYrya1ez.js +0 -2
  367. package/dist/assets/SkillStudio-cXOm1UXK.js +0 -9
  368. package/dist/assets/SpekoPhoneCallback-Be4N-mpO.js +0 -1
  369. package/dist/assets/StatusCards-D4LrRUGh.js +0 -1
  370. package/dist/assets/SummarySlotCard-B6DLP53Z.js +0 -1
  371. package/dist/assets/TaskSummaryList-Ce-Ce4l1.js +0 -1
  372. package/dist/assets/ToolbarSearch-BCmszDUo.js +0 -1
  373. package/dist/assets/ToolsAdminGate-C1ThW4Ri.js +0 -1
  374. package/dist/assets/TrustPresetSection-CwWyR09K.js +0 -1
  375. package/dist/assets/UserProfile-VVjsB5L_.js +0 -1
  376. package/dist/assets/WebhookUrlWarning-C_CzfZPI.js +0 -1
  377. package/dist/assets/WhatNeedsMe-BCL0UzZY.js +0 -1
  378. package/dist/assets/Workspaces-DZ2Cb6Ym.js +0 -1
  379. package/dist/assets/channel-CxIdGqvD.js +0 -1
  380. package/dist/assets/dist-B4ZViFQS.js +0 -1
  381. package/dist/assets/dist-B6FzCvrB.js +0 -1
  382. package/dist/assets/dist-BGto4PtK.js +0 -1
  383. package/dist/assets/dist-BRFOm9VP.js +0 -1
  384. package/dist/assets/dist-BoDP2kDb.js +0 -1
  385. package/dist/assets/dist-Bz8Vawcv.js +0 -1
  386. package/dist/assets/dist-C7q7bF2o.js +0 -1
  387. package/dist/assets/dist-CZZNWrQS.js +0 -13
  388. package/dist/assets/dist-Ch3xVYQG.js +0 -1
  389. package/dist/assets/dist-Cm_FABRO.js +0 -1
  390. package/dist/assets/dist-CorWWLoR.js +0 -1
  391. package/dist/assets/dist-CvtiZmPf.js +0 -1
  392. package/dist/assets/dist-CwaBioRT.js +0 -1
  393. package/dist/assets/dist-DxoX8puf.js +0 -1
  394. package/dist/assets/dist-DyCZWdng.js +0 -1
  395. package/dist/assets/dist-DzxBoDVi.js +0 -1
  396. package/dist/assets/dist-K9HZAPhz.js +0 -7
  397. package/dist/assets/dist-TPN4RlAe.js +0 -1
  398. package/dist/assets/dist-cYHVdswf.js +0 -1
  399. package/dist/assets/dist-fOlk1-ct.js +0 -1
  400. package/dist/assets/dist-w6brp1Jx.js +0 -3
  401. package/dist/assets/flowDiagram-OXPTDLAJ-ChfmRNyY.js +0 -1
  402. package/dist/assets/index-DH1ydvyl.js +0 -219
  403. package/dist/assets/index-Dbyu_v18.css +0 -1
  404. package/dist/assets/issue-detail-CIbQo9zW.css +0 -1
  405. package/dist/assets/issue-detail-D93stO87.js +0 -533
  406. package/dist/assets/operate-sections-DC2h-wgX.js +0 -1
  407. package/dist/assets/search-Ab9ldm4a.js +0 -1
  408. package/dist/assets/shared-C3q-ODD0.js +0 -1
  409. package/dist/assets/swimlanesDiagram-K3J5GTZL-DslV5cE_.js +0 -8
  410. package/dist/assets/useFastResponsesEnabled-CoUYTYI4.js +0 -1
  411. package/dist/assets/useSummaryDraftStream-9dlD7n7f.js +0 -3
  412. package/dist/assets/webhook-Ci1okhTh.js +0 -1
@@ -0,0 +1 @@
1
+ var k=Object.defineProperty;var d=(r,t)=>k(r,"name",{value:t,configurable:!0});import{a as w}from"./rolldown-runtime-DhZMWcEn.js";import{G as q,X as B}from"./issue-detail-BCc22gsn.js";import{Eo as U,Ey as j,FC as F,Hv as Q,Qp as K,RC as H,R_ as Y,Rp as R,Th as $,To as V,Um as z,Wv as G,gu as W,sy as y,yr as X}from"./index-B9u2GAJi.js";var o=w(H(),1),s=w(F(),1),J=[],Z=[],ee=[],se=[],te=d(async()=>{},"handleEmbeddedAdd");function ae(r){return r.status==="queued"||r.status==="running"}d(ae,"isRunActive");var ie=(0,o.memo)(d(function({run:t,transcript:e,hasOutput:i,companyId:m}){const n=ae(t),u=(0,o.useMemo)(()=>n?[t]:ee,[n,t]),x=(0,o.useMemo)(()=>n?se:[{runId:t.id,status:t.status,agentId:t.agentId,agentName:t.agentName,createdAt:t.createdAt,startedAt:t.startedAt,finishedAt:t.finishedAt}],[n,t]),g=(0,o.useMemo)(()=>new Map([[t.id,e]]),[t.id,e]);return(0,s.jsx)(q,{comments:J,linkedRuns:x,timelineEvents:Z,liveRuns:u,companyId:m,onAdd:te,showComposer:!1,showJumpToLatest:!1,variant:"embedded",emptyMessage:n?"Waiting for run output...":"No run output captured.",enableLiveTranscriptPolling:!1,transcriptsByRunId:g,hasOutputForRun:d(f=>f===t.id&&i,"hasOutputForRun"),includeSucceededRunsWithoutOutput:!0})},"RunChatSurface")),re=4,ne=4,de=15e3,oe=64e3,le=40,C=[],ue=[],ce={running:"Running",queued:"Queued",succeeded:"Succeeded",failed:"Failed",timed_out:"Timed out",cancelled:"Cancelled",interrupted:"Interrupted"};function xe({companyId:r,title:t="Agents",minRunCount:e=re,fetchLimit:i,cardLimit:m=ne,gridClassName:n,cardClassName:u,emptyMessage:x="No recent agent runs.",queryScope:g="dashboard",showMoreLink:f=!0,showTranscripts:h=!1,dedupeLinkedTasks:l=!1}){const v=i,b=[...$.liveRuns(r),g,{minRunCount:e,fetchLimit:v,dedupeLinkedTasks:l}],M=U({companyId:r,resourceKey:`live-runs:${g}:${e}:${v??"default"}:${l}`,queryKey:b,enabled:!!r,leaderOnly:!0}),{data:E,dataUpdatedAt:L}=Q({queryKey:b,queryFn:d(()=>W.liveRunsForCompany(r,{minCount:e,limit:v,distinctTasks:l}),"queryFn"),enabled:M.enabled});V(M,E,L);const p=E??[],_=(0,o.useMemo)(()=>{if(!l)return p;const a=new Set;return p.filter(c=>c.issueId?a.has(c.issueId)?!1:(a.add(c.issueId),!0):!0)},[l,p]),N=(0,o.useMemo)(()=>_.slice(0,m),[m,_]),I=Math.max(0,_.length-N.length),T=(0,o.useMemo)(()=>[...new Set(N.map(a=>a.issueId).filter(a=>!!a))],[N]),S=G({queries:T.map(a=>({queryKey:$.issues.detail(a),queryFn:d(()=>z.get(a),"queryFn"),staleTime:3e4}))}),P=(0,o.useMemo)(()=>{const a=new Map;for(const c of S){const A=c.data;A&&a.set(A.id,A)}return a},[S]),{transcriptByRun:D,hasOutputForRun:O}=B({runs:h?N:ue,companyId:r,maxChunksPerRun:le,logPollIntervalMs:de,logReadLimitBytes:oe,enabled:h});return(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"mb-3 text-sm font-semibold uppercase tracking-wide text-muted-foreground",children:t}),p.length===0?(0,s.jsx)("div",{className:"rounded-xl border border-border p-4",children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:x})}):(0,s.jsx)("div",{className:y("grid grid-cols-1 items-start gap-2 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4",n),children:N.map(a=>(0,s.jsx)(me,{companyId:r,run:a,issue:a.issueId?P.get(a.issueId):void 0,transcript:D.get(a.id)??C,hasOutput:O(a.id),showTranscript:h,issueLoadFailed:S.some((c,A)=>T[A]===a.issueId&&c.isError),className:u},a.id))}),f&&p.length>0&&(0,s.jsx)("div",{className:"mt-3 flex justify-end text-xs text-muted-foreground",children:(0,s.jsx)(R,{to:"/dashboard/live",className:"hover:text-foreground hover:underline",children:I>0?`${I} more active/recent run${I===1?"":"s"}`:"View all runs"})})]})}d(xe,"ActiveAgentsPanel");var me=(0,o.memo)(d(function({companyId:t,run:e,issue:i,transcript:m=C,hasOutput:n=!1,showTranscript:u=!1,issueLoadFailed:x=!1,className:g}){const f=ce[e.status]??e.status.replace(/[_-]/g," "),h=`/agents/${e.agentId}/runs/${e.id}`,l=e.finishedAt?`Finished ${j(e.finishedAt)}`:e.startedAt?`Started ${j(e.startedAt)}`:`Queued ${j(e.createdAt)}`,v=i?.status==="in_review"&&i.externalConversationState==="waiting"?"idle":i?.status??"backlog",b=i?.title??(x?"Task unavailable":"Loading task…");return(0,s.jsxs)("div",{className:y("dashboard-agent-card flex min-w-0 flex-col overflow-hidden rounded-xl border",u&&"h-(--sz-320px)",e.status==="running"?"border-(--dashboard-run-border) bg-(--dashboard-run-background) shadow-(--shadow-extract-1)":"border-border bg-background/70",g),"data-run-status":e.status,children:[(0,s.jsxs)("div",{className:y("flex shrink-0 flex-col gap-3 p-3",u&&"border-b border-border/60"),children:[(0,s.jsx)(R,{to:h,title:`${e.agentName} — ${f} · ${l}`,"aria-label":`${e.agentName} — ${f}. View run`,className:"flex min-w-0 items-center gap-2 rounded-md text-foreground hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,s.jsx)(X,{agent:{id:e.agentId,name:e.agentName,appearance:e.agentAppearance},size:"sm",className:"gap-2 font-medium"})}),e.issueId?(0,s.jsx)(R,{to:`/issues/${i?.identifier??e.issueId}`,className:"min-w-0 rounded-lg border border-border/60 bg-background/60 px-2.5 py-2 text-sm text-foreground transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",title:i?`${i.title} · ${i.identifier}`:b,children:(0,s.jsxs)("span",{className:"flex min-w-0 items-baseline gap-2",children:[(0,s.jsxs)("span",{className:"flex min-w-0 flex-1 items-baseline gap-1.5",children:[(0,s.jsx)(K,{status:v,size:"md",className:"self-center",title:i?`Task ${v.replace(/_/g," ")}`:void 0}),(0,s.jsx)("span",{className:"truncate",children:b})]}),(0,s.jsx)("span",{className:"shrink-0 font-mono text-(length:--text-micro) text-muted-foreground",children:i?.identifier??e.issueId.slice(0,8)})]})}):(0,s.jsxs)(R,{to:h,className:"flex items-center gap-1.5 rounded-lg border border-border/60 bg-background/60 px-2.5 py-2 text-sm text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,s.jsx)(Y,{className:"size-4 shrink-0","aria-hidden":!0}),(0,s.jsx)("span",{className:"truncate",children:e.invocationSource==="timer"?"Scheduled heartbeat":"No linked task"})]}),(0,s.jsx)("time",{dateTime:e.finishedAt??e.startedAt??e.createdAt,className:"text-right font-sans text-xs text-muted-foreground/70",children:l})]}),u&&(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:(0,s.jsx)(ie,{run:e,transcript:m,hasOutput:n,companyId:t})})]})},"AgentRunCard"));export{me as n,xe as t};
@@ -1 +1 @@
1
- var oe=Object.defineProperty;var t=(a,l)=>oe(a,"name",{value:l,configurable:!0});import{a as se}from"./rolldown-runtime-DhZMWcEn.js";import{Ks as de,Pr as X,Yo as h,Yr as ce,oo as q,qo as te,si as Z}from"./issue-detail-D93stO87.js";import{t as me}from"./power-CzxBm3W-.js";import{$m as ae,Gr as ue,Hp as xe,Kp as L,Mp as ne,Oc as y,Qm as b,Ur as M,Vf as pe,Wc as he,Wf as ge,Yd as ve,bf as fe,ch as je,dc as z,gc as K,gs as V,hc as W,lh as o,mc as H,my as be,nf as ee,pc as Q,qf as le,tu as ye,vc as U,vh as N,yc as Ne,yy as ke}from"./index-DH1ydvyl.js";var g=se(ke(),1),e=se(be(),1);function _({adapter:a,canRemove:l,onToggle:x,onRemove:i,onReload:d,onReinstall:r,isToggling:v,isReloading:p,isReinstalling:c,overriddenBy:f,toggleTitleEnabled:B,toggleTitleDisabled:k,disabledBadgeLabel:m}){return(0,e.jsx)("li",{children:(0,e.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("span",{className:N("font-medium",a.disabled&&"text-muted-foreground line-through"),children:a.label&&a.label!==a.type?a.label:te(a.type)}),(0,e.jsx)(y,{variant:"outline",children:a.source==="external"?"External":"Built-in"}),a.source==="external"&&(a.isLocalPath?(0,e.jsx)("span",{title:"Installed from local path",children:(0,e.jsx)(ne,{className:"h-4 w-4 text-amber-500"})}):(0,e.jsx)("span",{title:"Installed from npm",children:(0,e.jsx)(le,{className:"h-4 w-4 text-red-500"})})),a.version&&(0,e.jsxs)(y,{variant:"secondary",className:"font-mono text-(length:--text-nano)",children:["v",a.version]}),a.overriddenBuiltin&&(0,e.jsx)(y,{variant:"secondary",className:"text-blue-600 border-blue-400",children:"Overrides built-in"}),f&&(0,e.jsxs)(y,{variant:"secondary",className:"text-blue-600 border-blue-400",children:["Overridden by ",f]}),a.disabled&&(0,e.jsx)(y,{variant:"secondary",className:"text-amber-600 border-amber-400",children:m??"Hidden from menus"})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:[a.type,a.packageName&&a.packageName!==a.type&&(0,e.jsxs)(e.Fragment,{children:[" · ",a.packageName]})," · ",a.modelsCount," models"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[r&&(0,e.jsx)(o,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:"Reinstall adapter (pull latest from npm)",disabled:c,onClick:t(()=>r(a.type),"onClick"),children:(0,e.jsx)(xe,{className:N("h-4 w-4",c&&"animate-bounce")})}),d&&(0,e.jsx)(o,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:"Reload adapter (hot-swap)",disabled:p,onClick:t(()=>d(a.type),"onClick"),children:(0,e.jsx)(pe,{className:N("h-4 w-4",p&&"animate-spin")})}),(0,e.jsx)(o,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:a.disabled?B??"Show in agent menus":k??"Hide from agent menus",disabled:v,onClick:t(()=>x(a.type,!a.disabled),"onClick"),children:(0,e.jsx)(me,{className:N("h-4 w-4",a.disabled?"text-muted-foreground":"text-green-600")})}),l&&(0,e.jsx)(o,{variant:"outline",size:"icon-sm",className:"h-8 w-8 text-destructive hover:text-destructive",title:"Remove adapter",onClick:t(()=>i(a.type),"onClick"),children:(0,e.jsx)(de,{className:"h-4 w-4"})})]})]})})}t(_,"AdapterRow");function we(a){return fetch(`https://registry.npmjs.org/${encodeURIComponent(a)}/latest`,{signal:AbortSignal.timeout(5e3)}).then(l=>l.json()).then(l=>typeof l?.version=="string"?l.version:null).catch(()=>null)}t(we,"fetchNpmLatestVersion");function Pe({adapter:a,open:l,isReinstalling:x,onConfirm:i,onCancel:d}){const{data:r,isLoading:v}=ae({queryKey:["npm-latest-version",a?.packageName],queryFn:t(()=>a?.packageName?we(a.packageName):null,"queryFn"),enabled:l&&!!a?.packageName,staleTime:6e4}),p=a?.version&&r&&a.version===r;return(0,e.jsx)(z,{open:l,onOpenChange:t(c=>{c||d()},"onOpenChange"),children:(0,e.jsxs)(Q,{children:[(0,e.jsxs)(K,{children:[(0,e.jsx)(U,{children:"Reinstall Adapter"}),(0,e.jsxs)(H,{children:["This will pull the latest version of"," ",(0,e.jsx)("strong",{children:a?.packageName})," from npm and hot-swap the running adapter module. Existing agents will use the new version on their next run."]})]}),(0,e.jsxs)("div",{className:"rounded-md border bg-muted/50 px-4 py-3 text-sm space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Package"}),(0,e.jsx)("span",{className:"font-mono",children:a?.packageName})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Current"}),(0,e.jsx)("span",{className:"font-mono",children:a?.version?`v${a.version}`:"unknown"})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Latest on npm"}),(0,e.jsx)("span",{className:"font-mono",children:v?"checking...":r?`v${r}`:"unavailable"})]}),p&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground pt-1",children:"Already on the latest version."})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(o,{variant:"outline",onClick:d,disabled:x,children:"Cancel"}),(0,e.jsx)(o,{disabled:x,onClick:i,children:x?"Reinstalling...":"Reinstall"})]})]})})}t(Pe,"ReinstallDialog");function De(){const{selectedCompany:a}=ve(),{setBreadcrumbs:l}=ye(),x=je(),{pushToast:i}=he(),[d,r]=(0,g.useState)(""),[v,p]=(0,g.useState)(""),[c,f]=(0,g.useState)(!1),[B,k]=(0,g.useState)(!1),[m,C]=(0,g.useState)(null),[A,F]=(0,g.useState)(null);(0,g.useEffect)(()=>{l([{label:a?.name??"Organization",href:"/dashboard"},{label:"Settings",href:"/company/settings"},{label:"Adapters"}])},[a?.name,l]);const{data:T,isLoading:ie}=ae({queryKey:ee.adapters.all,queryFn:t(()=>h.list(),"queryFn")}),j=t(()=>{x.invalidateQueries({queryKey:ee.adapters.all})},"invalidate"),R=b({mutationFn:t(s=>h.install(s),"mutationFn"),onSuccess:t(s=>{j(),k(!1),r(""),p(""),f(!1),i({title:"Adapter installed",body:`Type "${s.type}" registered successfully.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:t(s=>{i({title:"Install failed",body:s.message,tone:"error"})},"onError")}),S=b({mutationFn:t(s=>h.remove(s),"mutationFn"),onSuccess:t(()=>{j(),i({title:"Adapter removed",tone:"success"})},"onSuccess"),onError:t(s=>{i({title:"Removal failed",body:s.message,tone:"error"})},"onError")}),w=b({mutationFn:t(({type:s,disabled:n})=>h.setDisabled(s,n),"mutationFn"),onSuccess:t(()=>{j()},"onSuccess"),onError:t(s=>{i({title:"Toggle failed",body:s.message,tone:"error"})},"onError")}),I=b({mutationFn:t(({type:s,paused:n})=>h.setOverridePaused(s,n),"mutationFn"),onSuccess:t(()=>{j()},"onSuccess"),onError:t(s=>{i({title:"Override toggle failed",body:s.message,tone:"error"})},"onError")}),E=b({mutationFn:t(s=>h.reload(s),"mutationFn"),onSuccess:t(s=>{j(),X(s.type),Z(s.type),i({title:"Adapter reloaded",body:`Type "${s.type}" reloaded.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:t(s=>{i({title:"Reload failed",body:s.message,tone:"error"})},"onError")}),D=b({mutationFn:t(s=>h.reinstall(s),"mutationFn"),onSuccess:t(s=>{j(),X(s.type),Z(s.type),i({title:"Adapter reinstalled",body:`Type "${s.type}" updated from npm.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:t(s=>{i({title:"Reinstall failed",body:s.message,tone:"error"})},"onError")}),O=(T??[]).filter(s=>s.source==="builtin"),Y=(T??[]).filter(s=>s.source==="external"),G=(T??[]).filter(s=>s.source==="external"&&s.overriddenBuiltin).filter(s=>!O.some(n=>n.type===s.type)).map(s=>({type:s.type,label:te(s.type),overriddenBy:[s.packageName,s.version?`v${s.version}`:void 0].filter(Boolean).join(" "),overridePaused:!!s.overridePaused,menuDisabled:!!s.disabled}));if(ie)return(0,e.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading adapters..."});const J=R.isPending||S.isPending||w.isPending||I.isPending||E.isPending||D.isPending;return(0,e.jsxs)("div",{className:"max-w-6xl space-y-6",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(L,{className:"h-6 w-6 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-xl font-semibold",children:"Adapters"}),(0,e.jsx)(y,{variant:"outline",className:"text-amber-600 border-amber-400",children:"Alpha"})]}),(0,e.jsxs)(z,{open:B,onOpenChange:k,children:[(0,e.jsx)(Ne,{asChild:!0,children:(0,e.jsxs)(o,{size:"sm",className:"gap-2",children:[(0,e.jsx)(ge,{className:"h-4 w-4"}),"Install Adapter"]})}),(0,e.jsxs)(Q,{children:[(0,e.jsxs)(K,{children:[(0,e.jsx)(U,{children:"Install External Adapter"}),(0,e.jsxs)(H,{children:["Add an adapter from npm or a local path. The adapter package must export ",(0,e.jsx)("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"createServerAdapter()"}),"."]})]}),(0,e.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("button",{type:"button",className:N("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors",c?"border-border text-muted-foreground hover:text-foreground hover:bg-accent/50":"border-foreground bg-accent text-foreground"),onClick:t(()=>f(!1),"onClick"),children:[(0,e.jsx)(le,{className:"h-3.5 w-3.5"}),"npm package"]}),(0,e.jsxs)("button",{type:"button",className:N("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors",c?"border-foreground bg-accent text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-accent/50"),onClick:t(()=>f(!0),"onClick"),children:[(0,e.jsx)(ne,{className:"h-3.5 w-3.5"}),"Local path"]})]}),c?(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)(q,{htmlFor:"adapterLocalPath",children:"Path to adapter package"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(V,{id:"adapterLocalPath",className:"flex-1 font-mono text-xs",placeholder:"/mnt/e/Projects/my-adapter or E:\\Projects\\my-adapter",value:d,onChange:t(s=>r(s.target.value),"onChange")}),(0,e.jsx)(ce,{})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Accepts Linux, WSL, and Windows paths. Windows paths are auto-converted."})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)(q,{htmlFor:"adapterPackageName",children:"Package Name"}),(0,e.jsx)(V,{id:"adapterPackageName",placeholder:"my-paperclip-adapter",value:d,onChange:t(s=>r(s.target.value),"onChange")})]}),(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)(q,{htmlFor:"adapterVersion",children:"Version (optional)"}),(0,e.jsx)(V,{id:"adapterVersion",placeholder:"latest",value:v,onChange:t(s=>p(s.target.value),"onChange")})]})]})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(o,{variant:"outline",onClick:t(()=>k(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(o,{onClick:t(()=>R.mutate({packageName:d,version:v||void 0,isLocalPath:c}),"onClick"),disabled:!d||R.isPending,children:R.isPending?"Installing...":"Install"})]})]})]})]}),(0,e.jsx)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)(fe,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-700"}),(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:"External adapters are alpha."}),(0,e.jsx)("p",{className:"text-muted-foreground",children:"The adapter plugin system is under active development. APIs and storage format may change. Use the power icon to hide adapters from agent menus without removing them."})]})]})}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(L,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:"External Adapters"})]}),Y.length===0?(0,e.jsx)(M,{className:"bg-muted/30",children:(0,e.jsxs)(ue,{className:"flex flex-col items-center justify-center py-10",children:[(0,e.jsx)(L,{className:"h-10 w-10 text-muted-foreground mb-4"}),(0,e.jsx)("p",{className:"text-sm font-medium",children:"No external adapters installed"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Install an adapter package to extend model support."})]})}):(0,e.jsx)(M,{className:"block py-0",children:(0,e.jsx)("ul",{className:"divide-y",children:Y.map(s=>{const n=s.overriddenBuiltin,P=n&&!!s.overridePaused,re=n?{...s,disabled:P??!1}:s;return(0,e.jsx)(_,{adapter:re,canRemove:!0,onToggle:n?(u,$)=>I.mutate({type:u,paused:$}):(u,$)=>w.mutate({type:u,disabled:$}),onRemove:t(u=>C(u),"onRemove"),onReload:t(u=>E.mutate(u),"onReload"),onReinstall:s.isLocalPath?void 0:u=>F(s),isToggling:n?I.isPending:w.isPending,isReloading:E.isPending,isReinstalling:D.isPending,toggleTitleDisabled:n?"Pause external override":void 0,toggleTitleEnabled:n?"Resume external override":void 0,disabledBadgeLabel:n?"Override paused":void 0},s.type)})})})]}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(L,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Built-in Adapters"})]}),O.length===0&&G.length===0?(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:"No built-in adapters found."}):(0,e.jsx)(M,{className:"block py-0",children:(0,e.jsxs)("ul",{className:"divide-y",children:[O.map(s=>(0,e.jsx)(_,{adapter:s,canRemove:!1,onToggle:t((n,P)=>w.mutate({type:n,disabled:P}),"onToggle"),onRemove:t(()=>{},"onRemove"),isToggling:J},s.type)),G.map(s=>(0,e.jsx)(_,{adapter:{type:s.type,label:s.label,source:"builtin",modelsCount:0,loaded:!0,disabled:s.menuDisabled,capabilities:{supportsInstructionsBundle:!1,supportsSkills:!1,supportsLocalAgentJwt:!1,requiresMaterializedRuntimeSkills:!1,supportsAcp:!1}},canRemove:!1,onToggle:t((n,P)=>w.mutate({type:n,disabled:P}),"onToggle"),onRemove:t(()=>{},"onRemove"),isToggling:J,overriddenBy:s.overridePaused?void 0:s.overriddenBy},s.type))]})})]}),(0,e.jsx)(z,{open:m!==null,onOpenChange:t(s=>{s||C(null)},"onOpenChange"),children:(0,e.jsxs)(Q,{children:[(0,e.jsxs)(K,{children:[(0,e.jsx)(U,{children:"Remove Adapter"}),(0,e.jsxs)(H,{children:["Are you sure you want to remove the ",(0,e.jsx)("strong",{children:m})," adapter? It will be unregistered and removed from the adapter store.",m&&T?.find(s=>s.type===m)?.packageName&&(0,e.jsx)(e.Fragment,{children:" npm packages will be cleaned up from disk."})," ","This action cannot be undone."]})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(o,{variant:"outline",onClick:t(()=>C(null),"onClick"),children:"Cancel"}),(0,e.jsx)(o,{variant:"destructive",disabled:S.isPending,onClick:t(()=>{m&&S.mutate(m,{onSettled:t(()=>C(null),"onSettled")})},"onClick"),children:S.isPending?"Removing...":"Remove"})]})]})}),(0,e.jsx)(Pe,{adapter:A,open:A!==null,isReinstalling:D.isPending,onConfirm:t(()=>{A&&D.mutate(A.type,{onSettled:t(()=>F(null),"onSettled")})},"onConfirm"),onCancel:t(()=>F(null),"onCancel")})]})}t(De,"AdapterManager");export{De as AdapterManager};
1
+ var oe=Object.defineProperty;var t=(a,l)=>oe(a,"name",{value:l,configurable:!0});import{a as se}from"./rolldown-runtime-DhZMWcEn.js";import{Fr as X,Ja as p,_o as de,ka as $,lo as te,lr as Y,wr as ce}from"./issue-detail-BCc22gsn.js";import{t as me}from"./power-DA-JLMjT.js";import{$u as M,Eg as ae,FC as ue,Fd as xe,Hv as ne,Kh as he,M_ as D,O_ as pe,Qf as ge,Qv as o,RC as ve,Th as ee,Vv as b,Zv as je,__ as le,_h as fe,ad as z,bd as y,bg as be,cd as K,dd as ye,gg as Ne,od as Q,rd as H,rr as ke,sd as U,sy as N,tr as q,ud as W}from"./index-B9u2GAJi.js";var g=se(ve(),1),e=se(ue(),1);function V({adapter:a,canRemove:l,onToggle:x,onRemove:r,onReload:d,onReinstall:i,isToggling:v,isReloading:h,isReinstalling:c,overriddenBy:j,toggleTitleEnabled:L,toggleTitleDisabled:k,disabledBadgeLabel:m}){return(0,e.jsx)("li",{children:(0,e.jsxs)("div",{className:"flex items-center gap-4 px-4 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("span",{className:N("font-medium",a.disabled&&"text-muted-foreground line-through"),children:a.label&&a.label!==a.type?a.label:te(a.type)}),(0,e.jsx)(y,{variant:"outline",children:a.source==="external"?"External":"Built-in"}),a.source==="external"&&(a.isLocalPath?(0,e.jsx)("span",{title:"Installed from local path",children:(0,e.jsx)(le,{className:"h-4 w-4 text-amber-500"})}):(0,e.jsx)("span",{title:"Installed from npm",children:(0,e.jsx)(ae,{className:"h-4 w-4 text-red-500"})})),a.version&&(0,e.jsxs)(y,{variant:"secondary",className:"font-mono text-(length:--text-nano)",children:["v",a.version]}),a.overriddenBuiltin&&(0,e.jsx)(y,{variant:"secondary",className:"text-blue-600 border-blue-400",children:"Overrides built-in"}),j&&(0,e.jsxs)(y,{variant:"secondary",className:"text-blue-600 border-blue-400",children:["Overridden by ",j]}),a.disabled&&(0,e.jsx)(y,{variant:"secondary",className:"text-amber-600 border-amber-400",children:m??"Hidden from menus"})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:[a.type,a.packageName&&a.packageName!==a.type&&(0,e.jsxs)(e.Fragment,{children:[" · ",a.packageName]})," · ",a.modelsCount," models"]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[i&&(0,e.jsx)(o,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:"Reinstall adapter (pull latest from npm)",disabled:c,onClick:t(()=>i(a.type),"onClick"),children:(0,e.jsx)(pe,{className:N("h-4 w-4",c&&"animate-bounce")})}),d&&(0,e.jsx)(o,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:"Reload adapter (hot-swap)",disabled:h,onClick:t(()=>d(a.type),"onClick"),children:(0,e.jsx)(Ne,{className:N("h-4 w-4",h&&"animate-spin")})}),(0,e.jsx)(o,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:a.disabled?L??"Show in agent menus":k??"Hide from agent menus",disabled:v,onClick:t(()=>x(a.type,!a.disabled),"onClick"),children:(0,e.jsx)(me,{className:N("h-4 w-4",a.disabled?"text-muted-foreground":"text-green-600")})}),l&&(0,e.jsx)(o,{variant:"outline",size:"icon-sm",className:"h-8 w-8 text-destructive hover:text-destructive",title:"Remove adapter",onClick:t(()=>r(a.type),"onClick"),children:(0,e.jsx)(de,{className:"h-4 w-4"})})]})]})})}t(V,"AdapterRow");function we(a){return fetch(`https://registry.npmjs.org/${encodeURIComponent(a)}/latest`,{signal:AbortSignal.timeout(5e3)}).then(l=>l.json()).then(l=>typeof l?.version=="string"?l.version:null).catch(()=>null)}t(we,"fetchNpmLatestVersion");function Pe({adapter:a,open:l,isReinstalling:x,onConfirm:r,onCancel:d}){const{data:i,isLoading:v}=ne({queryKey:["npm-latest-version",a?.packageName],queryFn:t(()=>a?.packageName?we(a.packageName):null,"queryFn"),enabled:l&&!!a?.packageName,staleTime:6e4}),h=a?.version&&i&&a.version===i;return(0,e.jsx)(H,{open:l,onOpenChange:t(c=>{c||d()},"onOpenChange"),children:(0,e.jsxs)(z,{children:[(0,e.jsxs)(K,{children:[(0,e.jsx)(W,{children:"Reinstall Adapter"}),(0,e.jsxs)(Q,{children:["This will pull the latest version of"," ",(0,e.jsx)("strong",{children:a?.packageName})," from npm and hot-swap the running adapter module. Existing agents will use the new version on their next run."]})]}),(0,e.jsxs)("div",{className:"rounded-md border bg-muted/50 px-4 py-3 text-sm space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Package"}),(0,e.jsx)("span",{className:"font-mono",children:a?.packageName})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Current"}),(0,e.jsx)("span",{className:"font-mono",children:a?.version?`v${a.version}`:"unknown"})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:"Latest on npm"}),(0,e.jsx)("span",{className:"font-mono",children:v?"checking...":i?`v${i}`:"unavailable"})]}),h&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground pt-1",children:"Already on the latest version."})]}),(0,e.jsxs)(U,{children:[(0,e.jsx)(o,{variant:"outline",onClick:d,disabled:x,children:"Cancel"}),(0,e.jsx)(o,{disabled:x,onClick:r,children:x?"Reinstalling...":"Reinstall"})]})]})})}t(Pe,"ReinstallDialog");function Fe(){const{selectedCompany:a}=fe(),{setBreadcrumbs:l}=ge(),x=je(),{pushToast:r}=xe(),[d,i]=(0,g.useState)(""),[v,h]=(0,g.useState)(""),[c,j]=(0,g.useState)(!1),[L,k]=(0,g.useState)(!1),[m,C]=(0,g.useState)(null),[A,B]=(0,g.useState)(null);(0,g.useEffect)(()=>{l([{label:a?.name??"Organization",href:"/dashboard"},{label:"Settings",href:"/company/settings"},{label:"Adapters"}])},[a?.name,l]);const{data:T,isLoading:re}=ne({queryKey:ee.adapters.all,queryFn:t(()=>p.list(),"queryFn")}),f=t(()=>{x.invalidateQueries({queryKey:ee.adapters.all})},"invalidate"),R=b({mutationFn:t(s=>p.install(s),"mutationFn"),onSuccess:t(s=>{f(),k(!1),i(""),h(""),j(!1),r({title:"Adapter installed",body:`Type "${s.type}" registered successfully.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:t(s=>{r({title:"Install failed",body:s.message,tone:"error"})},"onError")}),S=b({mutationFn:t(s=>p.remove(s),"mutationFn"),onSuccess:t(()=>{f(),r({title:"Adapter removed",tone:"success"})},"onSuccess"),onError:t(s=>{r({title:"Removal failed",body:s.message,tone:"error"})},"onError")}),w=b({mutationFn:t(({type:s,disabled:n})=>p.setDisabled(s,n),"mutationFn"),onSuccess:t(()=>{f()},"onSuccess"),onError:t(s=>{r({title:"Toggle failed",body:s.message,tone:"error"})},"onError")}),I=b({mutationFn:t(({type:s,paused:n})=>p.setOverridePaused(s,n),"mutationFn"),onSuccess:t(()=>{f()},"onSuccess"),onError:t(s=>{r({title:"Override toggle failed",body:s.message,tone:"error"})},"onError")}),E=b({mutationFn:t(s=>p.reload(s),"mutationFn"),onSuccess:t(s=>{f(),Y(s.type),X(s.type),r({title:"Adapter reloaded",body:`Type "${s.type}" reloaded.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:t(s=>{r({title:"Reload failed",body:s.message,tone:"error"})},"onError")}),F=b({mutationFn:t(s=>p.reinstall(s),"mutationFn"),onSuccess:t(s=>{f(),Y(s.type),X(s.type),r({title:"Adapter reinstalled",body:`Type "${s.type}" updated from npm.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:t(s=>{r({title:"Reinstall failed",body:s.message,tone:"error"})},"onError")}),O=(T??[]).filter(s=>s.source==="builtin"),J=(T??[]).filter(s=>s.source==="external"),Z=(T??[]).filter(s=>s.source==="external"&&s.overriddenBuiltin).filter(s=>!O.some(n=>n.type===s.type)).map(s=>({type:s.type,label:te(s.type),overriddenBy:[s.packageName,s.version?`v${s.version}`:void 0].filter(Boolean).join(" "),overridePaused:!!s.overridePaused,menuDisabled:!!s.disabled}));if(re)return(0,e.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:"Loading adapters..."});const G=R.isPending||S.isPending||w.isPending||I.isPending||E.isPending||F.isPending;return(0,e.jsxs)("div",{className:"max-w-6xl space-y-6",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(D,{className:"h-6 w-6 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-xl font-semibold",children:"Adapters"}),(0,e.jsx)(y,{variant:"outline",className:"text-amber-600 border-amber-400",children:"Alpha"})]}),(0,e.jsxs)(H,{open:L,onOpenChange:k,children:[(0,e.jsx)(ye,{asChild:!0,children:(0,e.jsxs)(o,{size:"sm",className:"gap-2",children:[(0,e.jsx)(be,{className:"h-4 w-4"}),"Install Adapter"]})}),(0,e.jsxs)(z,{children:[(0,e.jsxs)(K,{children:[(0,e.jsx)(W,{children:"Install External Adapter"}),(0,e.jsxs)(Q,{children:["Add an adapter from npm or a local path. The adapter package must export ",(0,e.jsx)("code",{className:"text-xs bg-muted px-1 py-0.5 rounded",children:"createServerAdapter()"}),"."]})]}),(0,e.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsxs)("button",{type:"button",className:N("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors",c?"border-border text-muted-foreground hover:text-foreground hover:bg-accent/50":"border-foreground bg-accent text-foreground"),onClick:t(()=>j(!1),"onClick"),children:[(0,e.jsx)(ae,{className:"h-3.5 w-3.5"}),"npm package"]}),(0,e.jsxs)("button",{type:"button",className:N("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors",c?"border-foreground bg-accent text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-accent/50"),onClick:t(()=>j(!0),"onClick"),children:[(0,e.jsx)(le,{className:"h-3.5 w-3.5"}),"Local path"]})]}),c?(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)($,{htmlFor:"adapterLocalPath",children:"Path to adapter package"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(M,{id:"adapterLocalPath",className:"flex-1 font-mono text-xs",placeholder:"/mnt/e/Projects/my-adapter or E:\\Projects\\my-adapter",value:d,onChange:t(s=>i(s.target.value),"onChange")}),(0,e.jsx)(ce,{})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Accepts Linux, WSL, and Windows paths. Windows paths are auto-converted."})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)($,{htmlFor:"adapterPackageName",children:"Package Name"}),(0,e.jsx)(M,{id:"adapterPackageName",placeholder:"my-paperclip-adapter",value:d,onChange:t(s=>i(s.target.value),"onChange")})]}),(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)($,{htmlFor:"adapterVersion",children:"Version (optional)"}),(0,e.jsx)(M,{id:"adapterVersion",placeholder:"latest",value:v,onChange:t(s=>h(s.target.value),"onChange")})]})]})]}),(0,e.jsxs)(U,{children:[(0,e.jsx)(o,{variant:"outline",onClick:t(()=>k(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(o,{onClick:t(()=>R.mutate({packageName:d,version:v||void 0,isLocalPath:c}),"onClick"),disabled:!d||R.isPending,children:R.isPending?"Installing...":"Install"})]})]})]})]}),(0,e.jsx)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)(he,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-700"}),(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:"External adapters are alpha."}),(0,e.jsx)("p",{className:"text-muted-foreground",children:"The adapter plugin system is under active development. APIs and storage format may change. Use the power icon to hide adapters from agent menus without removing them."})]})]})}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(D,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:"External Adapters"})]}),J.length===0?(0,e.jsx)(q,{className:"bg-muted/30",children:(0,e.jsxs)(ke,{className:"flex flex-col items-center justify-center py-10",children:[(0,e.jsx)(D,{className:"h-10 w-10 text-muted-foreground mb-4"}),(0,e.jsx)("p",{className:"text-sm font-medium",children:"No external adapters installed"}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Install an adapter package to extend model support."})]})}):(0,e.jsx)(q,{className:"block py-0",children:(0,e.jsx)("ul",{className:"divide-y",children:J.map(s=>{const n=s.overriddenBuiltin,P=n&&!!s.overridePaused,ie=n?{...s,disabled:P??!1}:s;return(0,e.jsx)(V,{adapter:ie,canRemove:!0,onToggle:n?(u,_)=>I.mutate({type:u,paused:_}):(u,_)=>w.mutate({type:u,disabled:_}),onRemove:t(u=>C(u),"onRemove"),onReload:t(u=>E.mutate(u),"onReload"),onReinstall:s.isLocalPath?void 0:u=>B(s),isToggling:n?I.isPending:w.isPending,isReloading:E.isPending,isReinstalling:F.isPending,toggleTitleDisabled:n?"Pause external override":void 0,toggleTitleEnabled:n?"Resume external override":void 0,disabledBadgeLabel:n?"Override paused":void 0},s.type)})})})]}),(0,e.jsxs)("section",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(D,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Built-in Adapters"})]}),O.length===0&&Z.length===0?(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:"No built-in adapters found."}):(0,e.jsx)(q,{className:"block py-0",children:(0,e.jsxs)("ul",{className:"divide-y",children:[O.map(s=>(0,e.jsx)(V,{adapter:s,canRemove:!1,onToggle:t((n,P)=>w.mutate({type:n,disabled:P}),"onToggle"),onRemove:t(()=>{},"onRemove"),isToggling:G},s.type)),Z.map(s=>(0,e.jsx)(V,{adapter:{type:s.type,label:s.label,source:"builtin",modelsCount:0,loaded:!0,disabled:s.menuDisabled,capabilities:{supportsInstructionsBundle:!1,supportsSkills:!1,supportsLocalAgentJwt:!1,requiresMaterializedRuntimeSkills:!1,supportsAcp:!1}},canRemove:!1,onToggle:t((n,P)=>w.mutate({type:n,disabled:P}),"onToggle"),onRemove:t(()=>{},"onRemove"),isToggling:G,overriddenBy:s.overridePaused?void 0:s.overriddenBy},s.type))]})})]}),(0,e.jsx)(H,{open:m!==null,onOpenChange:t(s=>{s||C(null)},"onOpenChange"),children:(0,e.jsxs)(z,{children:[(0,e.jsxs)(K,{children:[(0,e.jsx)(W,{children:"Remove Adapter"}),(0,e.jsxs)(Q,{children:["Are you sure you want to remove the ",(0,e.jsx)("strong",{children:m})," adapter? It will be unregistered and removed from the adapter store.",m&&T?.find(s=>s.type===m)?.packageName&&(0,e.jsx)(e.Fragment,{children:" npm packages will be cleaned up from disk."})," ","This action cannot be undone."]})]}),(0,e.jsxs)(U,{children:[(0,e.jsx)(o,{variant:"outline",onClick:t(()=>C(null),"onClick"),children:"Cancel"}),(0,e.jsx)(o,{variant:"destructive",disabled:S.isPending,onClick:t(()=>{m&&S.mutate(m,{onSettled:t(()=>C(null),"onSettled")})},"onClick"),children:S.isPending?"Removing...":"Remove"})]})]})}),(0,e.jsx)(Pe,{adapter:A,open:A!==null,isReinstalling:F.isPending,onConfirm:t(()=>{A&&F.mutate(A.type,{onSettled:t(()=>B(null),"onSettled")})},"onConfirm"),onCancel:t(()=>B(null),"onCancel")})]})}t(Fe,"AdapterManager");export{Fe as AdapterManager};
@@ -0,0 +1,39 @@
1
+ var Je=Object.defineProperty;var s=(t,r)=>Je(t,"name",{value:r,configurable:!0});import{a as qe}from"./rolldown-runtime-DhZMWcEn.js";import{Cn as Ye,Na as Ze,Po as Xe,Ra as et,Xr as tt,bn as st,br as nt,ka as rt,ti as at,vn as ot,wn as it,xn as lt,yo as dt}from"./issue-detail-BCc22gsn.js";import{a as ct,c as J,i as ut,n as mt,o as xt,r as Ae,s as ht,t as Te}from"./smoke-lab-matrix-Vxz--ttE.js";import{y as Pe}from"./collections-DWBx3_z7.js";import{t as pt}from"./circle-slash-DyxSDEAE.js";import{t as ft}from"./link-PWetRs2y.js";import{t as gt}from"./power-DA-JLMjT.js";import{$f as X,$u as Ee,Bd as bt,Bp as oe,D as jt,D_ as vt,Dv as yt,FC as Nt,Hd as wt,Hg as Ne,Hp as $e,Hv as Q,Ih as de,Ku as kt,Lh as Ct,Lv as B,Mg as Be,N_ as fe,Pd as we,Qd as St,Qf as At,Qu as Ke,Qv as y,RC as Tt,Rp as ie,Th as M,U_ as Pt,Ud as se,Vv as L,Wn as Et,X_ as Lt,Zf as It,Zg as ye,Zv as ke,_h as He,_i as Mt,ad as Ft,ag as Ue,bd as re,bg as Ge,bi as ge,cd as Rt,dd as Dt,gi as Ot,hi as F,jf as _t,nv as ce,od as zt,og as qt,pg as Qe,qd as $t,rd as Bt,rp as ue,sy as Z,tv as Kt,ud as Ht,uv as Ut,v_ as Le,xg as Gt,xi as Qt,xv as Vt,yi as Ie,zh as Wt}from"./index-B9u2GAJi.js";import{a as le,i as Ce,s as Ve}from"./shared-SvNLjO9T.js";import{t as Jt}from"./useAuthorizationWindow-BwTdVu1A.js";import{a as Yt,i as Zt,n as Xt,r as es,t as ts}from"./profile-summary-CFDjDVWs.js";import{r as ss,t as ns}from"./useProfilesData-dUMO8SxN.js";var Me=`I want to connect an MCP (Model Context Protocol) server to Paperclip, and I need a paste-ready config.
2
+
3
+ Target server: <name the server, or ask me if I have not said>
4
+
5
+ Please:
6
+
7
+ 1. Confirm which MCP server this is. If I have not named one, or you are unsure which product I mean, ask me for its name or a link to its documentation before answering. Then consult the current official documentation for that server (the vendor's own docs or the server's own repository), not your memory of it.
8
+
9
+ 2. Reply with one valid, paste-ready JSON object FIRST, before any prose. It must have a single top-level "mcpServers" key containing exactly one remote server entry, using:
10
+ - the exact HTTP(S) endpoint as "url", including any required query parameters
11
+ - the exact required header names, spelled the way the server expects them
12
+ Example of the shape (not the values):
13
+
14
+ {
15
+ "mcpServers": {
16
+ "example": {
17
+ "url": "https://mcp.example.com/mcp",
18
+ "headers": { "Authorization": "Bearer <YOUR_TOKEN>" }
19
+ }
20
+ }
21
+ }
22
+
23
+ 3. Use an obvious placeholder for every credential, like <YOUR_API_KEY>. Do not ask me to paste a real token into this conversation, do not repeat one back to me, and do not embed one in the JSON.
24
+
25
+ 4. After the JSON, add short setup notes covering:
26
+ - how I obtain each credential, step by step
27
+ - which scopes or permissions the credential needs
28
+ - which fields are optional and what they change
29
+ - whether this server requires browser sign-in (OAuth) instead of headers, in which case say so plainly
30
+ - the official documentation links you actually used
31
+
32
+ 5. Do not invent fields, header names, or URLs. If you are not certain about something, say which part you are unsure about instead of guessing. If this server only runs locally as a command (stdio) and has no remote HTTP endpoint, say that the paste-a-config path does not apply, and give me the verified local command separately.`,rs=["Copy this prompt and send it to an agent or assistant that can look up the server's documentation.","Paste only the JSON block it replies with back into the box on this page.","Paperclip reads the header names from that JSON and asks you for the values, then stores them as Paperclip secrets — so the config you paste should contain placeholders, not live credentials."],g=qe(Tt(),1),e=qe(Nt(),1);function as({companyId:t,agentOptions:r}){const[a,c]=(0,g.useState)(""),d=Q({queryKey:a?M.tools.effectiveProfilesForAgent(t,a):["tools",t,"profiles","effective","agent","__none__"],queryFn:s(()=>F.getEffectiveProfilesForAgent(t,a),"queryFn"),enabled:!!a}),u=ue(d);return(0,e.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(rt,{children:"Agent"}),(0,e.jsx)(Ze,{agents:r,value:a,onChange:c})]}),a?d.isLoading||u.kind==="reconnecting"?(0,e.jsx)(Ce,{label:"Checking access..."}):u.kind==="error"?(0,e.jsx)(X,{error:d.error,action:"check this agent's access",onRetry:u.retry,retrying:u.isFetching}):(0,e.jsxs)("div",{className:"min-h-0 space-y-5 overflow-y-auto pr-1",children:[(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Can use"}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(d.data?.allowedToolNames??[]).length," tools"]})]}),(d.data?.allowedToolNames??[]).length===0?(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"This agent cannot use any app tools right now."}):(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:(d.data?.allowedToolNames??[]).slice(0,80).map(m=>(0,e.jsx)(re,{variant:"outline",children:m},m))})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Access profiles"}),(d.data?.profiles??[]).length===0?(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"No active profile applies to this agent."}):(0,e.jsx)("div",{className:"divide-y divide-border rounded-lg border border-border",children:(d.data?.profiles??[]).map(m=>(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3 px-3 py-2.5",children:[(0,e.jsx)("span",{className:"min-w-0 truncate text-sm font-medium text-foreground",children:m.name}),m.summary.isCompanyDefault?(0,e.jsx)(re,{variant:"secondary",children:"Organization default"}):null]},m.id))})]})]}):(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border px-4 py-8 text-sm text-muted-foreground",children:"Pick an agent to see what it can use right now."})]})}s(as,"EffectiveAgentPanel");function Fe(t){return t?`/apps/advanced/profiles/new?template=${encodeURIComponent(t)}`:"/apps/advanced/profiles/new"}s(Fe,"newProfileHref");function os(t){return t==="active"?"default":t==="draft"?"secondary":"outline"}s(os,"statusVariant");function is({companyId:t,initialStatusFilter:r,initialResolverOpen:a}){const c=$e(),d=ke(),{pushToast:u}=we(),{profiles:m,agents:b}=ns(t),p=ue(m),[C,f]=(0,g.useState)(!!a),[w,K]=(0,g.useState)(r??"active"),[k,S]=(0,g.useState)(null);(0,g.useEffect)(()=>{new URLSearchParams(window.location.search).get("check")==="1"&&f(!0)},[]);const I=(0,g.useMemo)(()=>(b.data??[]).map(i=>({id:i.id,name:i.name})),[b.data]),R=s(()=>{d.invalidateQueries({queryKey:M.tools.profiles(t)}),d.invalidateQueries({queryKey:M.tools.testAgentAccesses()})},"invalidate"),A=s(i=>String(i?.message??i),"errorBody"),G=L({mutationFn:s(i=>F.duplicateProfile(i.id,{name:`${i.name} (copy)`}),"mutationFn"),onSuccess:s(()=>{u({title:"Profile duplicated",body:"The copy is not assigned to anyone yet.",tone:"success"}),R()},"onSuccess"),onError:s(i=>u({title:"Could not duplicate",body:A(i),tone:"error"}),"onError")}),T=L({mutationFn:s(i=>F.updateProfile(i.id,{status:"archived"}),"mutationFn"),onSuccess:s(()=>{u({title:"Profile archived",tone:"success"}),R()},"onSuccess"),onError:s(i=>u({title:"Could not archive",body:A(i),tone:"error"}),"onError")}),z=L({mutationFn:s(i=>F.updateProfile(i.id,{status:"active"}),"mutationFn"),onSuccess:s(()=>{u({title:"Profile restored",tone:"success"}),R()},"onSuccess"),onError:s(i=>u({title:"Could not restore",body:A(i),tone:"error"}),"onError")}),D=L({mutationFn:s(i=>F.deleteProfile(i.id),"mutationFn"),onSuccess:s(()=>{u({title:"Profile deleted",tone:"success"}),R()},"onSuccess"),onError:s(i=>u({title:"Could not delete",body:A(i),tone:"error"}),"onError")}),N=(0,e.jsx)(Ve,{title:"Access profiles",description:"Decide which tools your agents can use. Build a profile once, then assign it to the agents that need it.",actions:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(y,{variant:"outline",onClick:s(()=>f(!0),"onClick"),children:[(0,e.jsx)(Ue,{className:"mr-1.5 h-4 w-4"}),"Check an agent's access"]}),(0,e.jsxs)(y,{onClick:s(()=>c(Fe()),"onClick"),children:[(0,e.jsx)(Ge,{className:"mr-1.5 h-4 w-4"}),"New profile"]})]})}),q=(0,e.jsx)(ot,{open:C,onOpenChange:f,children:(0,e.jsxs)(st,{className:"w-full gap-0 p-0 sm:max-w-xl",children:[(0,e.jsxs)(Ye,{className:"border-b border-border",children:[(0,e.jsx)(it,{children:"Check an agent's access"}),(0,e.jsx)(lt,{children:"See exactly which tools an agent can use right now, and which profile allows each one."})]}),(0,e.jsx)("div",{className:"flex min-h-0 flex-1 flex-col p-4",children:(0,e.jsx)(as,{companyId:t,agentOptions:I})})]})});if(m.isLoading||p.kind==="reconnecting")return(0,e.jsxs)("div",{className:"space-y-5",children:[N,(0,e.jsx)(Ce,{label:"Loading profiles…"})]});if(p.kind==="error")return(0,e.jsxs)("div",{className:"space-y-5",children:[N,(0,e.jsx)(X,{error:m.error,action:"load profiles",onRetry:p.retry,retrying:p.isFetching})]});const o=(m.data?.profiles??[]).filter(i=>w==="archived"?i.status==="archived":i.status!=="archived");return(0,e.jsxs)("div",{className:"space-y-5",children:[N,(0,e.jsx)("div",{className:"inline-flex rounded-md border border-border p-0.5",children:["active","archived"].map(i=>(0,e.jsx)("button",{type:"button",onClick:s(()=>K(i),"onClick"),className:Z("rounded px-3 py-1 text-sm font-medium",w===i?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:i==="active"?"Active":"Archived"},i))}),o.length===0?w==="archived"?(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:"No archived profiles."}):(0,e.jsx)(ds,{onPick:s(i=>c(Fe(i)),"onPick")}):(0,e.jsx)("div",{className:"overflow-hidden rounded-lg border border-border",children:(0,e.jsxs)("table",{className:"w-full table-fixed text-sm",children:[(0,e.jsxs)("colgroup",{children:[(0,e.jsx)("col",{className:"w-(--sz-30pct)"}),(0,e.jsx)("col",{className:"w-(--sz-18pct)"}),(0,e.jsx)("col",{className:"w-(--sz-24pct)"}),(0,e.jsx)("col",{className:"w-(--sz-12pct)"}),(0,e.jsx)("col",{className:"w-(--sz-12pct)"}),(0,e.jsx)("col",{className:"w-10"})]}),(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"border-b border-border bg-muted/40 text-left text-xs font-medium text-muted-foreground",children:[(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:"Profile"}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:"Allows"}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:"Assigned to"}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:"Status"}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:"Updated"}),(0,e.jsx)("th",{className:"w-10 px-3 py-2"})]})}),(0,e.jsx)("tbody",{children:o.map(i=>{const O=es(i.summary),$=Zt(i),H=s(()=>c($?`/apps/advanced/profiles/${i.id}/edit`:`/apps/advanced/profiles/${i.id}`),"open");return(0,e.jsxs)("tr",{className:"group h-10 border-b border-border last:border-0 hover:bg-accent/40",children:[(0,e.jsx)("td",{className:"min-w-0 px-3 py-1.5",children:(0,e.jsx)("button",{type:"button",onClick:H,title:i.name,className:"block w-full truncate text-left font-medium text-foreground hover:underline",children:i.name})}),(0,e.jsx)("td",{className:"px-3 py-1.5 text-muted-foreground",children:(0,e.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,e.jsx)("span",{children:Xt(i.summary)}),(i.newToolsPendingCount??0)>0?(0,e.jsxs)(re,{variant:"outline",className:"border-amber-500/50 bg-amber-500/10 text-amber-800 dark:text-amber-200",children:[i.newToolsPendingCount," new"]}):null]})}),(0,e.jsx)("td",{className:"px-3 py-1.5",children:O.unassigned?(0,e.jsxs)("span",{className:"text-muted-foreground",children:[O.text,(0,e.jsx)("span",{className:"ml-1 text-xs text-muted-foreground/70",children:"— does not change access"})]}):(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-foreground",children:[i.summary.isCompanyDefault?null:(0,e.jsx)(Wt,{className:"h-3.5 w-3.5 text-muted-foreground"}),O.text]})}),(0,e.jsx)("td",{className:"px-3 py-1.5",children:(0,e.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,e.jsx)(re,{variant:os(i.status),children:ts[i.status]}),$?(0,e.jsx)("button",{type:"button",onClick:H,className:"text-xs font-medium text-primary hover:underline",children:"Resume"}):null]})}),(0,e.jsx)("td",{className:"px-3 py-1.5",children:(0,e.jsx)(le,{value:i.updatedAt})}),(0,e.jsx)("td",{className:"px-3 py-1.5 text-right",children:(0,e.jsx)(ls,{onEdit:H,onDuplicate:s(()=>G.mutate(i),"onDuplicate"),onArchive:s(()=>T.mutate(i),"onArchive"),onRestore:i.status==="archived"?()=>S({kind:"restore",profile:i}):void 0,onDelete:s(()=>S({kind:"delete",profile:i}),"onDelete")})})]},i.id)})})]})}),q,(0,e.jsx)(Yt,{kind:k?.kind??null,profile:k?.profile??null,pending:z.isPending||D.isPending,onClose:s(()=>S(null),"onClose"),onArchive:s(()=>{k&&T.mutate(k.profile,{onSuccess:s(()=>S(null),"onSuccess")})},"onArchive"),onRestore:s(()=>{k&&z.mutate(k.profile,{onSuccess:s(()=>S(null),"onSuccess")})},"onRestore"),onDelete:s(()=>{k&&D.mutate(k.profile,{onSuccess:s(()=>S(null),"onSuccess")})},"onDelete")})]})}s(is,"ProfilesIndex");function ls({onEdit:t,onDuplicate:r,onArchive:a,onRestore:c,onDelete:d}){return(0,e.jsxs)(bt,{children:[(0,e.jsx)(St,{asChild:!0,children:(0,e.jsx)("button",{type:"button","aria-label":"Profile actions",className:"inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-accent group-hover:opacity-100 data-[state=open]:opacity-100",children:(0,e.jsx)(vt,{className:"h-4 w-4"})})}),(0,e.jsxs)(wt,{align:"end",children:[(0,e.jsx)(se,{onSelect:t,children:"Edit"}),(0,e.jsx)(se,{onSelect:r,children:"Duplicate"}),c?(0,e.jsxs)(se,{onSelect:c,children:[(0,e.jsx)(Xe,{className:"mr-1.5 h-4 w-4"}),"Restore"]}):(0,e.jsx)(se,{onSelect:a,children:"Archive"}),(0,e.jsx)($t,{}),(0,e.jsx)(se,{onSelect:d,className:"text-destructive focus:text-destructive",children:"Delete"})]})]})}s(ls,"RowMenu");function ds({onPick:t}){return(0,e.jsxs)("div",{className:"rounded-lg border border-dashed border-border p-6",children:[(0,e.jsxs)("div",{className:"mb-4 max-w-2xl",children:[(0,e.jsx)("h3",{className:"text-base font-semibold text-foreground",children:"Create your first access profile"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Pick a starting point. You can fine-tune exactly which tools it allows in the next step."})]}),(0,e.jsx)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:ss.map(r=>(0,e.jsxs)("button",{type:"button",onClick:s(()=>t(r.key),"onClick"),className:Z("flex flex-col items-start gap-1 rounded-md border border-border bg-card px-4 py-3 text-left transition-colors","hover:border-primary hover:bg-primary/5"),children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:r.title}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:r.description})]},r.key))})]})}s(ds,"EmptyTemplatePicker");var ne=s(()=>({name:"",clientLabel:"",ownerNote:"",expiresAt:cs(new Date(Date.now()+7776e6)),allowedActions:["tools/list","tools/call"]}),"defaultTokenDraft");function cs(t){return t.toISOString().slice(0,10)}s(cs,"toDateInputValue");function U(t){return t?t.length>12?`${t.slice(0,8)}...`:t:null}s(U,"shortId");function Re(t,r,a=`${r}s`){return`${t} ${t===1?r:a}`}s(Re,"pluralize");function us(t){if(!t)return null;const r=t instanceof Date?t:new Date(t);return Number.isNaN(r.getTime())?null:r}s(us,"dateValue");function ms(t){return t.tokens.reduce((r,a)=>{const c=us(a.lastUsedAt);return c&&(!r||c.getTime()>r.getTime())?c:r},null)}s(ms,"latestTokenActivity");function xs(t,r){return t.agentId?r.get(t.agentId)??`Agent ${U(t.agentId)}`:t.createdByAgentId?r.get(t.createdByAgentId)??`Agent ${U(t.createdByAgentId)}`:t.createdByUserId?`Board user ${U(t.createdByUserId)}`:"Board"}s(xs,"formatOwner");function hs(t,r,a){return t.contextScopeType!=="none"&&t.contextScopeId?t.contextScopeType==="project"?`Project ${r.get(t.contextScopeId)??U(t.contextScopeId)}`:t.contextScopeType==="agent"?`Agent ${a.get(t.contextScopeId)??U(t.contextScopeId)}`:`${t.contextScopeType} ${U(t.contextScopeId)}`:t.projectId?`Project ${r.get(t.projectId)??U(t.projectId)}`:t.issueId?`Issue ${U(t.issueId)}`:t.agentId?`Agent ${a.get(t.agentId)??U(t.agentId)}`:"Company"}s(hs,"formatScope");function De(t){if(!t)return"Profile unavailable";const r=t.summary.allowedToolCount;return t.summary.accessMode==="all_except"?`${Re(Math.max(t.summary.totalToolCount-t.summary.excludedToolCount,0),"tool")} allowed`:r===0?"No tools allowed":`${Re(r,"tool")} allowed`}s(De,"formatAllowedTools");function Oe(t){return JSON.stringify(t,null,2)}s(Oe,"formatSnippetConfig");function ps(t){return t?`${t}T23:59:59.000Z`:null}s(ps,"buildTokenExpiresAt");function fs({companyId:t}){const r=ke(),{pushToast:a}=we(),[c,d]=(0,g.useState)(!1),[u,m]=(0,g.useState)({name:"",description:"",profileId:""}),[b,p]=(0,g.useState)({}),[C,f]=(0,g.useState)(null),[w,K]=(0,g.useState)({}),[k,S]=(0,g.useState)(null),I=Q({queryKey:M.tools.gateways(t),queryFn:s(()=>F.listGateways(t),"queryFn")}),R=Q({queryKey:M.tools.profiles(t),queryFn:s(()=>F.listProfiles(t),"queryFn")}),A=Q({queryKey:M.agents.list(t),queryFn:s(()=>It.list(t),"queryFn")}),G=Q({queryKey:M.projects.list(t,{includeArchived:!0}),queryFn:s(()=>kt.list(t,{includeArchived:!0}),"queryFn")}),T=ue(I),z=(0,g.useMemo)(()=>typeof window>"u"?"":window.location.origin,[]),D=R.data?.profiles??[],N=D.filter(n=>n.status!=="archived"),q=(0,g.useMemo)(()=>new Map(D.map(n=>[n.id,n])),[D]),o=(0,g.useMemo)(()=>new Map((A.data??[]).map(n=>[n.id,n.name])),[A.data]),i=(0,g.useMemo)(()=>new Map((G.data??[]).map(n=>[n.id,n.name])),[G.data]),O=s(()=>r.invalidateQueries({queryKey:M.tools.gateways(t)}),"invalidateGateways"),$=L({mutationFn:s(()=>F.createGateway(t,{name:u.name.trim(),description:u.description.trim()||null,profileId:u.profileId,defaultProfileMode:"gateway_only",contextScopeType:"company"}),"mutationFn"),onSuccess:s(async n=>{m({name:"",description:"",profileId:N[0]?.id??""}),d(!1),a({title:"Gateway created",body:n.name,tone:"success"}),await O()},"onSuccess"),onError:s(n=>{a({title:"Gateway was not created",body:B(n).body,tone:"error"})},"onError")}),H=L({mutationFn:s(async n=>{const x=b[n]??ne();return F.createGatewayToken(t,n,{name:x.name.trim(),clientLabel:x.clientLabel.trim(),ownerNote:x.ownerNote.trim(),allowedActions:x.allowedActions,expiresAt:ps(x.expiresAt)})},"mutationFn"),onSuccess:s(async n=>{K(x=>({...x,[n.gatewayId]:n})),f(null),p(x=>({...x,[n.gatewayId]:ne()})),a({title:"Token issued",body:`${n.name} was created. Copy it now; it will not be shown again.`,tone:"success"}),await O()},"onSuccess"),onError:s(n=>{a({title:"Token was not issued",body:B(n).body,tone:"error"})},"onError")}),V=L({mutationFn:s(n=>F.revokeGatewayToken(t,n),"mutationFn"),onSuccess:s(async n=>{S(null),a({title:"Token revoked",body:n.name,tone:"success"}),await O()},"onSuccess"),onError:s(n=>{a({title:"Token was not revoked",body:B(n).body,tone:"error"})},"onError")});async function W(n,x){try{await Et(n),a({title:"Copied to clipboard",body:x,tone:"success"})}catch(_){a({title:"Copy failed",body:B(_).body,tone:"error"})}}s(W,"copyText");function Y(n){K(x=>{const _={...x};return delete _[n],_}),p(x=>({...x,[n]:x[n]??ne()})),f(n)}s(Y,"startIssuing");function xe(n){if(n.preventDefault(),!u.profileId){a({title:"Pick a profile",body:"A gateway needs an access profile before it can be created.",tone:"warn"});return}$.mutate()}s(xe,"submitCreateGateway");function ee(n,x){if(n.preventDefault(),(b[x]??ne()).allowedActions.length===0){a({title:"Pick token actions",body:"Gateway tokens need at least one allowed MCP action.",tone:"warn"});return}H.mutate(x)}if(s(ee,"submitCreateToken"),I.isLoading||T.kind==="reconnecting")return(0,e.jsx)(Ce,{label:"Loading gateways..."});if(T.kind==="error")return(0,e.jsx)(X,{error:I.error,action:"load gateways",onRetry:T.retry,retrying:T.isFetching});const l=I.data?.gateways??[],j=R.isLoading,v=j||N.length===0||$.isPending;return(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsx)(Ve,{title:"Named MCP gateways",description:"Stable endpoints for external clients that use the same profiles, rules, and audit trail as agent tool access."}),(0,e.jsxs)(y,{type:"button",size:"sm",onClick:s(()=>{m(n=>({...n,profileId:n.profileId||N[0]?.id||""})),d(n=>!n)},"onClick"),disabled:j,children:[(0,e.jsx)(Ge,{className:"mr-1.5 h-3.5 w-3.5"}),"Create gateway"]})]}),c?(0,e.jsxs)("form",{className:"space-y-3 rounded-md border border-border p-4",onSubmit:xe,children:[(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-(--gtc-60)",children:[(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Gateway name"}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.name,onChange:s(n=>m(x=>({...x,name:n.target.value})),"onChange"),placeholder:"Engineering laptops",required:!0})]}),(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Access profile"}),(0,e.jsxs)("select",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.profileId,onChange:s(n=>m(x=>({...x,profileId:n.target.value})),"onChange"),required:!0,disabled:N.length===0,children:[(0,e.jsx)("option",{value:"",disabled:!0,children:j?"Loading profiles...":"Choose a profile"}),N.map(n=>(0,e.jsxs)("option",{value:n.id,children:[n.name," - ",De(n)]},n.id))]})]})]}),(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),(0,e.jsx)("textarea",{className:"min-h-20 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.description,onChange:s(n=>m(x=>({...x,description:n.target.value})),"onChange"),placeholder:"Who this endpoint is for and when it should be rotated."})]}),N.length===0&&!j?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Create an access profile before adding a gateway."}):null,(0,e.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,e.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:s(()=>d(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(y,{type:"submit",size:"sm",disabled:v||!u.name.trim()||!u.profileId,children:$.isPending?"Creating...":"Create gateway"})]})]}):null,l.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-border p-5 text-sm text-muted-foreground",children:"No named gateways yet. Create one here, then issue a token for the client that will connect to it."}):(0,e.jsx)("div",{className:"divide-y divide-border rounded-md border border-border",children:l.map(n=>{const x=`${z}${n.endpointPath}`,_=n.clientSnippets??[],te=q.get(n.profileId),Se=ms(n),P=b[n.id]??ne(),ae=w[n.id];return(0,e.jsxs)("section",{className:"space-y-4 p-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(ft,{className:"h-4 w-4 text-muted-foreground"}),(0,e.jsx)("h3",{className:"truncate text-sm font-semibold text-foreground",children:n.name}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:n.status})]}),n.description?(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:n.description}):null]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>{W(x,"Gateway endpoint")},"onClick"),children:[(0,e.jsx)(fe,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy endpoint"]}),(0,e.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>Y(n.id),"onClick"),children:[(0,e.jsx)(ye,{className:"mr-1.5 h-3.5 w-3.5"}),"Issue token"]})]})]}),(0,e.jsx)("div",{className:"break-all rounded bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:x}),(0,e.jsxs)("dl",{className:"grid gap-x-4 gap-y-2 text-sm sm:grid-cols-2 lg:grid-cols-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:"Owner"}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:xs(n,o)})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:"Scope"}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:hs(n,i,o)})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:"Allowed tools"}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:te?`${De(te)} via ${te.name}`:`Profile ${U(n.profileId)}`})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:"Last activity"}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:Se?(0,e.jsx)(le,{value:Se}):"Never used"})]})]}),C===n.id?(0,e.jsxs)("form",{className:"space-y-3 rounded-md border border-border p-3",onSubmit:s(h=>ee(h,n.id),"onSubmit"),children:[(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Token name"}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:P.name,onChange:s(h=>p(E=>({...E,[n.id]:{...P,name:h.target.value}})),"onChange"),placeholder:"Dotta's MacBook",required:!0})]}),(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Client label"}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:P.clientLabel,onChange:s(h=>p(E=>({...E,[n.id]:{...P,clientLabel:h.target.value}})),"onChange"),placeholder:"Cursor on work laptop",required:!0})]})]}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-[1fr_auto]",children:[(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Owner note"}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:P.ownerNote,onChange:s(h=>p(E=>({...E,[n.id]:{...P,ownerNote:h.target.value}})),"onChange"),placeholder:"Who owns this token and why it exists",required:!0})]}),(0,e.jsxs)("label",{className:"space-y-1.5 text-sm",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Expires"}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",type:"date",value:P.expiresAt,onChange:s(h=>p(E=>({...E,[n.id]:{...P,expiresAt:h.target.value}})),"onChange"),required:!0})]})]}),(0,e.jsx)("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:["tools/list","tools/call"].map(h=>(0,e.jsxs)("label",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,e.jsx)("input",{type:"checkbox",checked:P.allowedActions.includes(h),onChange:s(E=>{const he=E.target.checked?Array.from(new Set([...P.allowedActions,h])):P.allowedActions.filter(pe=>pe!==h);p(pe=>({...pe,[n.id]:{...P,allowedActions:he}}))},"onChange")}),h]},h))}),(0,e.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,e.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:s(()=>f(null),"onClick"),children:"Cancel"}),(0,e.jsx)(y,{type:"submit",size:"sm",disabled:H.isPending||!P.name.trim()||!P.clientLabel.trim()||!P.ownerNote.trim()||!P.expiresAt,children:H.isPending?"Issuing...":"Issue token"})]})]}):null,ae?(0,e.jsxs)("div",{className:"space-y-2 rounded-md border border-border bg-muted/40 p-3 text-sm",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"font-medium text-foreground",children:["New token for ",ae.name]}),(0,e.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>{W(ae.token,"Gateway bearer token")},"onClick"),children:[(0,e.jsx)(fe,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy token"]})]}),(0,e.jsx)("div",{className:"break-all rounded bg-background px-3 py-2 font-mono text-xs text-muted-foreground",children:ae.token})]}):null,(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[(0,e.jsx)(ye,{className:"h-3.5 w-3.5"}),"Tokens"]}),(0,e.jsx)("div",{className:"space-y-1 text-sm",children:n.tokens.length===0?(0,e.jsx)("p",{className:"text-muted-foreground",children:"No tokens issued."}):n.tokens.map(h=>{const E=!!h.revokedAt,he=k===h.id;return(0,e.jsxs)("div",{className:"space-y-1 py-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"truncate text-foreground",children:h.name}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[h.clientLabel||h.tokenPrefix," · ",h.allowedActions.join(", ")]})]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:h.revokedAt?(0,e.jsxs)(e.Fragment,{children:["revoked ",(0,e.jsx)(le,{value:h.revokedAt})]}):h.expiresAt?(0,e.jsxs)(e.Fragment,{children:["expires ",(0,e.jsx)(le,{value:h.expiresAt})]}):"no expiry"}),E?null:(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:s(()=>S(h.id),"onClick"),"aria-label":`Revoke ${h.name}`,children:[(0,e.jsx)(Qe,{className:"mr-1 h-3.5 w-3.5"}),"Revoke"]})]})]}),he?(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{children:"Revoke this token now?"}),(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:s(()=>S(null),"onClick"),children:[(0,e.jsx)(de,{className:"mr-1 h-3.5 w-3.5"}),"Cancel"]}),(0,e.jsxs)(y,{type:"button",variant:"destructive",size:"sm",className:"h-7 px-2",onClick:s(()=>V.mutate(h.id),"onClick"),disabled:V.isPending,children:[(0,e.jsx)(ce,{className:"mr-1 h-3.5 w-3.5"}),"Confirm"]})]}):null]},h.id)})})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Client snippets"}),(0,e.jsx)("div",{className:"space-y-1 text-sm",children:_.length===0?(0,e.jsx)("p",{className:"text-muted-foreground",children:"No snippets available."}):_.map(h=>(0,e.jsxs)("details",{className:"rounded px-2 py-1 open:bg-muted/40",children:[(0,e.jsxs)("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 text-left",children:[(0,e.jsxs)("span",{className:"flex min-w-0 items-center gap-2 text-foreground",children:[(0,e.jsx)(Kt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate",children:h.label})]}),(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:s(E=>{E.preventDefault(),W(Oe(h.config),`${h.label} snippet`)},"onClick"),children:[(0,e.jsx)(fe,{className:"mr-1 h-3.5 w-3.5"}),"Copy"]})]}),(0,e.jsx)("pre",{className:"mt-2 max-h-56 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-3 text-xs text-muted-foreground",children:Oe(h.config)}),h.notes.length>0?(0,e.jsx)("div",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:h.notes.map(E=>(0,e.jsx)("div",{children:E},E))}):null]},h.client))})]})]})]},n.id)})})]})}s(fs,"GatewaysTab");function gs(){return(0,e.jsxs)(Bt,{children:[(0,e.jsx)(Dt,{asChild:!0,children:(0,e.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Get help creating an MCP config",children:(0,e.jsx)(Pt,{className:"h-4 w-4"})})}),(0,e.jsxs)(Ft,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(Rt,{children:[(0,e.jsx)(Ht,{children:"Ask an agent for an MCP config"}),(0,e.jsx)(zt,{children:"Don't know the URL or headers a tool needs? Hand this request to an agent and paste back what it gives you."})]}),(0,e.jsx)("ol",{className:"list-decimal space-y-1.5 pl-5 text-sm text-muted-foreground",children:rs.map(t=>(0,e.jsx)("li",{children:t},t))}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("label",{htmlFor:"mcp-config-help-prompt",className:"text-sm font-medium text-foreground",children:"Prompt to send"}),(0,e.jsx)(Ke,{id:"mcp-config-help-prompt",readOnly:!0,value:Me,rows:12,spellCheck:!1,onFocus:s(t=>t.currentTarget.select(),"onFocus"),className:"min-h-(--sz-220px) font-mono text-(length:--text-compact) leading-relaxed"})]}),(0,e.jsx)("div",{children:(0,e.jsx)(nt,{prompt:Me,label:"Get a config with an agent",title:"MCP configuration",description:"Paste this into your agent to create an MCP config, then paste its JSON reply back into Paperclip."})})]})]})}s(gs,"McpConfigHelpDialog");var bs=`{
33
+ "mcpServers": {
34
+ "github": {
35
+ "command": "npx -y @modelcontextprotocol/server-github",
36
+ "env": { "GITHUB_TOKEN": "ghp_..." }
37
+ }
38
+ }
39
+ }`;function js(t){const r=t.replace(/[_-]+/g," ").trim().toLowerCase();return r?r.charAt(0).toUpperCase()+r.slice(1):"Key"}s(js,"humanizeKey");function vs(t){const r=t.credentialFields.length||t.credentialRefs.length,a=t.transport==="local_stdio"?"Runs in your workspace":"Connects over the web";return r===0?`${a} · no keys needed`:`${a} · needs ${r} ${r===1?"key":"keys"}`}s(vs,"draftSummary");function be(t){if(t.transport!=="mcp_remote")return null;const r=t.config?.url;if(typeof r!="string")return null;try{const a=new URL(r.trim());return a.protocol!=="http:"&&a.protocol!=="https:"?null:a.toString()}catch{return null}}s(be,"draftConnectUrl");function me(t,r){return`${t.name}::${r}`}s(me,"credentialValueKey");function ys(t,r){const a={};for(const c of t.credentialFields){const d=r[me(t,c.configPath)]?.trim();d&&(a[c.configPath]=d)}return a}s(ys,"credentialValuesForDraft");function Ns(t,r){return t.credentialFields.filter(a=>a.required).filter(a=>!r[me(t,a.configPath)]?.trim()).map(a=>a.configPath)}s(Ns,"missingCredentialFields");function We(t){const r=t.suggestedDefaults?.askFirstRiskLevels;return Array.isArray(r)?r.filter(a=>typeof a=="string"):[]}s(We,"askFirstLevelsFrom");function ws({companyId:t}){const r=$e(),[a,c]=(0,g.useState)(""),[d,u]=(0,g.useState)(null),[m,b]=(0,g.useState)({}),[p,C]=(0,g.useState)({}),[f,w]=(0,g.useState)(null),[K,k]=(0,g.useState)({}),[S,I]=(0,g.useState)(null),[R,A]=(0,g.useState)("entry"),[G,T]=(0,g.useState)(null),[z,D]=(0,g.useState)(null),N=Jt(),q=L({mutationFn:s(l=>F.importMcpJson(t,{mcpJson:l}),"mutationFn"),onSuccess:s(l=>{u(l),b(Object.fromEntries(l.drafts.map(j=>[j.name,j.name]))),w(null),I(null)},"onSuccess")}),o=s(async(l,j)=>{try{const v=await N.open({authorizationUrl:l,handoff:j});D(v.host),A("redirecting")}catch(v){A("error"),T(B(v).body)}},"openAuthorizationPage"),{windowRef:i,cancel:O}=N,$=f?.connectionId;(0,g.useEffect)(()=>{if(R!=="redirecting"||!$)return;let l=!1,j=!1;const v=s(async()=>{if(l||j)return;const x=et(i.current,$);if(x!=="waiting"){if(x!=="connected"){O(),A("error"),T(x==="closed"?"The sign-in window closed. Try again to finish connecting.":x==="denied"?"Sign-in was cancelled. Try again when you’re ready.":"Sign-in failed. Try again to finish connecting.");return}j=!0;try{const _=await F.getConnection($);!l&&_.status==="active"&&(l=!0,O(),r(`/apps/${$}/permissions`))}catch{}finally{j=!1}}},"check"),n=window.setInterval(()=>{v()},1e3);return window.addEventListener("focus",v),()=>{l=!0,window.clearInterval(n),window.removeEventListener("focus",v)}},[R,$,i,O,r]);const H=L({mutationFn:s(l=>F.startOAuth(l),"mutationFn"),onSuccess:s(l=>{o(l.authorizationUrl,l.handoff)},"onSuccess"),onError:s(l=>{N.cancel(),A("error"),T(B(l).body)},"onError")}),V=L({mutationFn:s(l=>{const j=be(l);if(!j)throw new Error("Only remote HTTP drafts can be checked and activated from pasted config.");return F.connectApp(t,{link:j,name:m[l.name]?.trim()||l.name,credentialValues:ys(l,p)})},"mutationFn"),onSuccess:s(l=>{if(w(l),l.auth?.kind==="oauth"){if(I(null),D(null),T(null),l.auth.manualClientRequired){N.cancel(),A("error"),T("This server requires OAuth client details from its provider settings. Continue in setup to add them.");return}const v=l.auth.startUrl?.trim();v?o(v,l.auth.handoff):(A("starting"),H.mutate(l.connectionId));return}N.cancel();const j={};for(const v of l.actions.readOnly)j[v.catalogEntryId]=!0;for(const v of l.actions.canMakeChanges)j[v.catalogEntryId]=!0;k(j),I(null)},"onSuccess"),onError:s(()=>N.cancel(),"onError")}),W=L({mutationFn:s(()=>{const l=f?We(f):[],j=Object.entries(K).filter(([,n])=>n).map(([n])=>n),v=(f?.actions.canMakeChanges??[]).filter(n=>K[n.catalogEntryId]&&l.includes(n.riskLevel)).map(n=>n.catalogEntryId);return F.finishApp(t,f.connectionId,{enabledCatalogEntryIds:j,askFirstCatalogEntryIds:v,access:"all_agents"})},"mutationFn"),onSuccess:s(()=>I(f?.application.name??"Imported app"),"onSuccess")}),Y=d?.drafts??[],xe=a.trim().length>0&&!q.isPending,ee=(0,g.useMemo)(()=>{const l=a.trim();if(!l)return null;try{return JSON.parse(l),null}catch{return"That doesn't look like valid JSON yet — paste the whole snippet, including the outer braces."}},[a]);if(f?.auth?.kind==="oauth"){const l=typeof f.connection.config?.url=="string"?f.connection.config.url:typeof f.connection.transportConfig?.url=="string"?f.connection.transportConfig.url:"";return(0,e.jsxs)(e.Fragment,{children:[N.fallback,(0,e.jsx)(tt,{identity:{name:f.application.name,unverifiedHost:at(l)},phase:R,error:G,authorizationHost:z,onRetry:s(()=>{N.reserve(),T(null),D(null),A("starting"),H.mutate(f.connectionId)},"onRetry"),onBack:s(()=>r(`/apps/${f.connectionId}/permissions`),"onBack"),onCancel:s(()=>r("/apps"),"onCancel")})]})}return(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"flex max-w-2xl items-start gap-1.5",children:[(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"Paste the MCP config snippet from the tool's README and we'll turn it into a friendly setup."}),(0,e.jsx)(gs,{})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Just a URL?"," ",(0,e.jsx)(Vt,{to:"/apps",className:"text-primary hover:underline",children:"Browse planned app connections"})," ","instead."]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Ke,{value:a,onChange:s(l=>{c(l.target.value),d&&u(null),w(null),I(null)},"onChange"),spellCheck:!1,rows:10,placeholder:bs,className:"min-h-(--sz-220px) bg-slate-900 font-mono text-(length:--text-compact) leading-relaxed text-slate-100 placeholder:text-slate-500 focus-visible:ring-slate-400"}),ee?(0,e.jsx)("p",{className:"text-xs text-amber-600",children:ee}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Paste an MCP config — the snippet a README tells you to copy."})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,e.jsx)(y,{onClick:s(()=>q.mutate(a),"onClick"),disabled:!xe||!!ee,children:q.isPending?"Checking…":"Check config"}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"We'll read it and show what we found before anything is saved."})]}),q.error?(0,e.jsx)(X,{error:q.error,action:"check the config"}):null,d?Y.length===0?(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border p-6 text-sm text-muted-foreground",children:"We couldn't find an app in that config. Double-check you pasted the whole snippet."}):(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[(0,e.jsx)(Lt,{className:"h-4 w-4 text-emerald-600"}),"We found ",Y.length," ",Y.length===1?"app":"apps"," in that config"]}),Y.map((l,j)=>{const v=be(l),n=Ns(l,p);return(0,e.jsx)(ks,{draft:l,connectionName:m[l.name]??l.name,onConnectionNameChange:s(x=>b(_=>({..._,[l.name]:x})),"onConnectionNameChange"),credentialValues:p,onCredentialChange:s((x,_)=>C(te=>({...te,[me(l,x)]:_})),"onCredentialChange"),checking:V.isPending&&V.variables?.name===l.name,canCheck:!!v&&n.length===0,onCheck:v?()=>{N.reserve(),V.mutate(l)}:void 0},`${l.name}-${j}`)}),Y.some(l=>be(l))?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Checking a remote app creates a draft connection, stores any header replacements as Paperclip secrets, and runs health/catalog discovery before activation."}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"We humanized the field names from the config. These run-in-your-workspace tools stay as drafts until an admin maps them to an approved template."})]}):null,V.error?(0,e.jsx)(X,{error:V.error,action:"check the app"}):null,f?(0,e.jsx)(Cs,{result:f,enabled:K,onToggle:s((l,j)=>k(v=>({...v,[l]:j})),"onToggle"),onBulk:s((l,j)=>k(v=>{const n={...v};for(const x of l)n[x]=j;return n}),"onBulk"),finishing:W.isPending,activatedName:S,onFinish:s(()=>W.mutate(),"onFinish")}):null,W.error?(0,e.jsx)(X,{error:W.error,action:"finish setup"}):null]})}s(ws,"PasteConfigTab");function ks({draft:t,connectionName:r,onConnectionNameChange:a,credentialValues:c,onCredentialChange:d,checking:u,canCheck:m,onCheck:b}){return(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"font-semibold text-foreground",children:t.name}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:vs(t)})]}),b?(0,e.jsxs)(y,{size:"sm",className:"shrink-0",onClick:b,disabled:u||!m,children:[u?(0,e.jsx)(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,"Check actions"]}):null]}),b?(0,e.jsxs)("label",{className:"mt-4 block max-w-sm space-y-1 text-xs font-medium text-foreground",children:["Connection name",(0,e.jsx)(Ee,{value:r,onChange:s(p=>a(p.target.value),"onChange"),placeholder:t.name,className:"h-8 text-xs"})]}):null,t.credentialFields.length>0?(0,e.jsx)("div",{className:"mt-4 space-y-3",children:t.credentialFields.map(p=>(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-medium text-foreground",children:[(0,e.jsx)(ye,{className:"h-3.5 w-3.5 text-muted-foreground"}),js(p.label||p.key)]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("code",{className:"rounded border border-border bg-muted/40 px-2 py-1 font-mono text-(length:--text-micro) text-muted-foreground",children:p.key}),(0,e.jsx)(Ee,{type:"password",value:c[me(t,p.configPath)]??"",onChange:s(C=>d(p.configPath,C.target.value),"onChange"),placeholder:"Paste replacement value",className:"h-8 max-w-sm text-xs"})]})]},`${p.configPath}-${p.key}`))}):t.credentialRefs.length>0?(0,e.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:"Keys from this config stay draft-only until an admin maps them to an approved template."}):(0,e.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:"No keys needed for this one."}),t.warnings.length>0?(0,e.jsx)("ul",{className:"mt-4 space-y-1 border-t border-border pt-3",children:t.warnings.map((p,C)=>(0,e.jsx)("li",{className:"text-xs text-amber-600",children:p},C))}):null]})}s(ks,"DraftCard");function Cs({result:t,enabled:r,onToggle:a,onBulk:c,finishing:d,activatedName:u,onFinish:m}){const b=We(t),p=Object.values(r).filter(Boolean).length,C=t.actions.readOnly.length+t.actions.canMakeChanges.length;return(0,e.jsxs)("div",{className:"space-y-4 border-t border-border pt-5",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[(0,e.jsx)(Ue,{className:"h-4 w-4 text-emerald-600"}),"Review actions for ",t.application.name]}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Health and catalog checks passed. Every discovered action starts allowed; you can narrow access after activation."})]}),(0,e.jsxs)(y,{size:"sm",onClick:m,disabled:d||p===0||!!u,children:[d?(0,e.jsx)(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,"Activate ",p," of ",C]})]}),(0,e.jsx)(_e,{title:"Read-only",actions:t.actions.readOnly,enabled:r,onToggle:a,onBulk:s(f=>c(t.actions.readOnly.map(w=>w.catalogEntryId),f),"onBulk"),askFirstLevels:b}),(0,e.jsx)(_e,{title:"Can make changes",actions:t.actions.canMakeChanges,enabled:r,onToggle:a,onBulk:s(f=>c(t.actions.canMakeChanges.map(w=>w.catalogEntryId),f),"onBulk"),askFirstLevels:b}),u?(0,e.jsxs)("p",{className:"text-xs font-medium text-emerald-700",children:[u," is active for all agents."]}):null]})}s(Cs,"CatalogReview");function _e({title:t,actions:r,enabled:a,onToggle:c,onBulk:d,askFirstLevels:u}){return r.length===0?null:(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(y,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:s(()=>d(!0),"onClick"),children:"Turn all on"}),(0,e.jsx)(y,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:s(()=>d(!1),"onClick"),children:"Turn all off"})]})]}),(0,e.jsx)("div",{className:"divide-y divide-border rounded-lg border border-border",children:r.map(m=>{const b=a[m.catalogEntryId]??!1;return(0,e.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate text-sm font-medium text-foreground",children:m.title||m.toolName}),(0,e.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:u.includes(m.riskLevel)?"Ask first when enabled":m.riskLevel})]}),(0,e.jsx)(jt,{checked:b,onCheckedChange:s(p=>c(m.catalogEntryId,p),"onCheckedChange")})]},m.catalogEntryId)})})]})}s(_e,"ActionGroup");var Ss="smoke@paperclip.test",As="smoke-password";function je(t){if(!t)return"—";const r=new Date(t);return Number.isNaN(r.getTime())?"—":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(r)}s(je,"formatTime");function ve(t){return t==="running"?"success":t==="error"?"error":"muted"}s(ve,"serviceTone");function Ts({status:t}){return t==="pass"?(0,e.jsx)(ce,{className:"mx-auto h-4 w-4 text-emerald-600 dark:text-emerald-400","aria-label":"pass"}):t==="fail"?(0,e.jsx)(de,{className:"mx-auto h-4 w-4 text-destructive","aria-label":"fail"}):t==="skipped"?(0,e.jsx)(Be,{className:"mx-auto h-4 w-4 text-amber-500","aria-label":"skipped"}):(0,e.jsx)("span",{className:"mx-auto block h-1.5 w-1.5 rounded-full bg-muted-foreground/30","aria-label":"not run"})}s(Ts,"CellGlyph");var Ps={green:"bg-emerald-500",amber:"bg-amber-500",red:"bg-destructive",unknown:"bg-muted-foreground/40"};function Es({companyId:t}){const{enabled:r,loaded:a}=Ot(),c=ke(),{pushToast:d}=we(),[u,m]=(0,g.useState)(null),b=Q({queryKey:M.smokeLab.services(t),queryFn:s(()=>J.listServices(t),"queryFn"),enabled:r&&a,refetchInterval:r?1e4:!1}),p=Q({queryKey:M.smokeLab.runs(t),queryFn:s(()=>J.listRuns(t),"queryFn"),enabled:r&&a,refetchInterval:r?1e4:!1}).data?.runs??[],C=u??p[0]?.id??null,f=Q({queryKey:M.smokeLab.run(t,C??"__none__"),queryFn:s(()=>J.getRun(t,C),"queryFn"),enabled:r&&a&&!!C,refetchInterval:r&&C?1e4:!1}),w=(0,g.useMemo)(()=>f.data?.steps??[],[f.data]),K=(0,g.useMemo)(()=>ut(w),[w]),k=f.data?.run;function S(){c.invalidateQueries({queryKey:M.smokeLab.services(t)}),c.invalidateQueries({queryKey:M.smokeLab.runs(t)}),C&&c.invalidateQueries({queryKey:M.smokeLab.run(t,C)})}s(S,"refresh");const I=L({mutationFn:s(()=>J.startServices(t),"mutationFn"),onSuccess:s(()=>{d({title:"Smoke services started",tone:"success"}),S()},"onSuccess"),onError:s(o=>d({title:"Couldn't start services",body:B(o).body,tone:"error"}),"onError")}),R=L({mutationFn:s(()=>J.stopServices(t),"mutationFn"),onSuccess:s(()=>{d({title:"Smoke services stopped",tone:"info"}),S()},"onSuccess"),onError:s(o=>d({title:"Couldn't stop services",body:B(o).body,tone:"error"}),"onError")}),A=L({mutationFn:s(()=>J.installFixtures(t),"mutationFn"),onSuccess:s(o=>{d({title:o.created?"Fixture apps installed":"Fixture apps already present",tone:"success"}),S()},"onSuccess"),onError:s(o=>d({title:"Couldn't install fixtures",body:B(o).body,tone:"error"}),"onError")}),G=L({mutationFn:s(()=>J.reset(t),"mutationFn"),onSuccess:s(()=>{d({title:"Smoke Lab reset",tone:"info"}),m(null),S()},"onSuccess"),onError:s(o=>d({title:"Couldn't reset",body:B(o).body,tone:"error"}),"onError")}),T=L({mutationFn:s(()=>J.createRun(t,{trigger:"manual",summary:{}}),"mutationFn"),onSuccess:s(o=>{d({title:"Smoke run started",body:"The browser runner records each step as it completes.",tone:"success"}),m(o.run.id),S()},"onSuccess"),onError:s(o=>d({title:"Couldn't start a run",body:B(o).body,tone:"error"}),"onError")}),z=I.isPending||R.isPending||A.isPending||G.isPending||T.isPending;if(a&&!r)return(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-card p-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-foreground",children:[(0,e.jsx)(Le,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:"Smoke Lab is turned off"})]}),(0,e.jsxs)("p",{className:"mt-1.5 max-w-xl text-sm text-muted-foreground",children:["The Smoke Lab is an experimental developer surface for exercising the integration paths against deterministic local fixtures. Turn on ",(0,e.jsx)("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"Smoke Lab"})," ","under Settings → Experimental to enable it."]})]});if(!a)return(0,e.jsx)("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading Smoke Lab…"});const D=b.data?.services??[],N=ht(k,w),q=xt(w);return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"smoke-lab-tab",children:[(0,e.jsxs)("header",{children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Le,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-xl font-bold text-foreground",children:"Smoke Lab"}),(0,e.jsx)(re,{variant:"outline",children:"Experimental"}),(0,e.jsxs)("a",{href:"https://github.com/paperclipai/paperclip/blob/master/doc/connections/SMOKE-LAB-TUTORIAL.md",target:"_blank",rel:"noreferrer",className:"ml-auto inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline",children:[(0,e.jsx)(Ut,{className:"h-4 w-4"})," Hands-on tutorial"]})]}),(0,e.jsxs)("p",{className:"mt-1.5 max-w-3xl text-sm text-muted-foreground",children:["Exercise every integration path (P1–P7) end-to-end against deterministic local fixtures — a fake OAuth provider and loopback MCP servers. Nothing here touches a real vendor or a real credential. Start the services, install the fixture apps, then drive the governed lifecycle from a browser smoke run. New here? Follow the"," ",(0,e.jsx)("a",{href:"https://github.com/paperclipai/paperclip/blob/master/doc/connections/SMOKE-LAB-TUTORIAL.md",target:"_blank",rel:"noreferrer",className:"font-medium text-primary hover:underline",children:"hands-on tutorial"}),"."]})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(dt,{className:"h-4 w-4 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Fixture services"})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxs)(y,{size:"sm",onClick:s(()=>I.mutate(),"onClick"),disabled:z,children:[(0,e.jsx)(gt,{className:"h-4 w-4"})," Start services"]}),(0,e.jsx)(y,{size:"sm",variant:"outline",onClick:s(()=>R.mutate(),"onClick"),disabled:z,children:"Stop"}),(0,e.jsx)(y,{size:"sm",variant:"outline",onClick:s(()=>A.mutate(),"onClick"),disabled:z,children:"Install fixture apps"}),(0,e.jsxs)(y,{size:"sm",variant:"ghost",onClick:s(()=>G.mutate(),"onClick"),disabled:z,children:[(0,e.jsx)(Qe,{className:"h-4 w-4"})," Reset"]})]})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[D.map(o=>(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"text-sm font-semibold text-foreground",children:o.label}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:o.detail??o.id})]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium",children:[(0,e.jsx)("span",{className:Z("h-2 w-2 rounded-full",o.status==="running"?"bg-emerald-500":o.status==="error"?"bg-destructive":"bg-muted-foreground/40")}),(0,e.jsx)("span",{className:Z(ve(o.status)==="success"&&"text-emerald-600 dark:text-emerald-400",ve(o.status)==="error"&&"text-destructive",ve(o.status)==="muted"&&"text-muted-foreground"),children:o.status})]})]}),(0,e.jsx)("dl",{className:"mt-3 space-y-1 text-xs",children:(0,e.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,e.jsx)("dt",{className:"w-16 shrink-0 text-muted-foreground",children:"URL"}),(0,e.jsx)("dd",{className:"min-w-0 break-all font-mono text-foreground",children:o.url??(0,e.jsx)("span",{className:"text-muted-foreground",children:"not running"})})]})})]},o.id)),D.length===0&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:"No services reported. Start the fixture services above."})]}),(0,e.jsxs)("div",{className:"rounded-lg border border-dashed border-border bg-muted/30 p-3",children:[(0,e.jsx)("p",{className:"text-xs font-semibold text-foreground",children:"Fake OAuth demo credentials"}),(0,e.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Type these into the fake provider's real consent page during a P1 (OAuth) smoke. Fixed fixture values — safe to show."}),(0,e.jsxs)("div",{className:"mt-2 flex flex-wrap gap-x-6 gap-y-1 font-mono text-xs text-foreground",children:[(0,e.jsxs)("span",{children:["email: ",Ss]}),(0,e.jsxs)("span",{children:["password: ",As]})]})]})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Integration matrix"}),(0,e.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(ce,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400"})," pass"]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(de,{className:"h-3.5 w-3.5 text-destructive"})," fail"]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(Be,{className:"h-3.5 w-3.5 text-amber-500"})," skipped"]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-muted-foreground/30"})," not run"]})]})]}),(0,e.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border",children:(0,e.jsxs)("table",{className:"w-full border-collapse text-xs",children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{className:"border-b border-border bg-muted/40",children:[(0,e.jsx)("th",{className:"sticky left-0 z-10 bg-muted/40 px-3 py-2 text-left font-semibold text-foreground",children:"Path"}),Te.map(o=>(0,e.jsx)("th",{className:"px-2 py-2 text-center font-medium text-muted-foreground",children:o.label},o.key))]})}),(0,e.jsx)("tbody",{children:mt.map(o=>(0,e.jsxs)("tr",{className:"border-b border-border last:border-0",children:[(0,e.jsxs)("th",{scope:"row",className:"sticky left-0 z-10 bg-card px-3 py-2 text-left",children:[(0,e.jsx)("span",{className:"font-mono font-semibold text-foreground",children:o}),(0,e.jsx)("span",{className:"ml-2 text-foreground",children:Ae[o].title}),(0,e.jsx)("span",{className:"block text-(length:--text-micro) font-normal text-muted-foreground",children:Ae[o].detail})]}),Te.map(i=>{const O=K.get(ct(o,i.key));return(0,e.jsx)("td",{className:"px-2 py-2 text-center",children:(0,e.jsx)(Ts,{status:O?.status??"not-run"})},i.key)})]},o))})]})}),w.length===0&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No steps recorded for the selected run yet. Run a browser smoke to populate the matrix."})]}),(0,e.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:"Runs"}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:Z("h-2 w-2 rounded-full",Ps[N])}),N==="unknown"?"no runs yet":N,q.length>0&&` · failing: ${q.join(", ")}`]})]}),(0,e.jsxs)(y,{size:"sm",onClick:s(()=>T.mutate(),"onClick"),disabled:z,children:[T.isPending?(0,e.jsx)(Ne,{className:"h-4 w-4 animate-spin"}):(0,e.jsx)(Gt,{className:"h-4 w-4"}),"Run browser smoke now"]})]}),(0,e.jsxs)("div",{className:"grid gap-4 lg:grid-cols-(--gtc-64)",children:[(0,e.jsxs)("div",{className:"rounded-lg border border-border",children:[p.length===0&&(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:"No runs recorded yet."}),(0,e.jsx)("ul",{className:"divide-y divide-border",children:p.map(o=>{const i=o.id===C;return(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",onClick:s(()=>m(o.id),"onClick"),className:Z("flex w-full items-center justify-between gap-2 px-3 py-2.5 text-left transition-colors hover:bg-accent/50",i&&"bg-accent"),children:[(0,e.jsxs)("span",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"block text-xs font-medium text-foreground",children:je(o.startedAt)}),(0,e.jsx)("span",{className:"block text-(length:--text-micro) text-muted-foreground",children:o.trigger})]}),(0,e.jsx)(Pe,{status:o.status})]})},o.id)})})]}),(0,e.jsxs)("div",{className:"min-w-0 rounded-lg border border-border",children:[!k&&(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:"Select a run to see its steps."}),k&&(0,e.jsxs)("div",{className:"flex flex-col",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-2.5",children:[(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Started ",je(k.startedAt)," · finished ",je(k.finishedAt)]}),(0,e.jsx)(Pe,{status:k.status})]}),w.length===0?(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:"No steps recorded for this run."}):(0,e.jsx)("ul",{className:"divide-y divide-border",children:w.map(o=>(0,e.jsxs)("li",{className:"flex items-start gap-3 px-4 py-2.5",children:[(0,e.jsx)("span",{className:"mt-0.5",children:o.status==="pass"?(0,e.jsx)(ce,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}):o.status==="fail"?(0,e.jsx)(de,{className:"h-4 w-4 text-destructive"}):(0,e.jsx)(pt,{className:"h-4 w-4 text-amber-500"})}),(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsxs)("p",{className:"text-xs font-medium text-foreground",children:[(0,e.jsx)("span",{className:"font-mono",children:o.path})," · ",o.scenarioStep]}),o.detail&&(0,e.jsx)("p",{className:"mt-0.5 break-words text-(length:--text-micro) text-muted-foreground",children:o.detail}),o.screenshotArtifactRef&&typeof o.screenshotArtifactRef.url=="string"&&(0,e.jsx)("a",{href:o.screenshotArtifactRef.url,target:"_blank",rel:"noreferrer",className:"mt-1 inline-block text-(length:--text-micro) font-medium text-primary hover:underline",children:"View screenshot"})]}),typeof o.durationMs=="number"&&(0,e.jsxs)("span",{className:"shrink-0 text-(length:--text-micro) tabular-nums text-muted-foreground",children:[o.durationMs,"ms"]})]},o.id))})]})]})]})]})]})}s(Es,"SmokeLabTab");function ze(t,r){switch(t){case"profiles":return(0,e.jsx)(is,{companyId:r});case"gateways":return(0,e.jsx)(fs,{companyId:r});case"smoke-lab":return(0,e.jsx)(Es,{companyId:r});default:return(0,e.jsx)(ws,{companyId:r})}}s(ze,"renderTab");function Ls(){const{selectedCompany:t,selectedCompanyId:r}=He(),{setBreadcrumbs:a}=At(),c=yt(),d=Ie.find(b=>b.key===c.tab)?.key??"paste-config",u=Qt(d),m=Ie.find(b=>b.key===d)?.label;return(0,g.useEffect)(()=>(a([{label:t?.name??"Company",href:"/dashboard"},{label:"Apps",href:"/apps"},...u?[{label:"Advanced setup"}]:[{label:"Advanced setup",href:ge("paste-config")},{label:m??"Developer tools"}]]),()=>a([])),[a,t?.name,u,m]),r?c.tab==="run-your-own"?(0,e.jsx)(oe,{to:"/apps",replace:!0}):c.tab==="applications"||c.tab==="connections"||c.tab==="overview"||c.tab==="examples"||c.tab==="audit"?(0,e.jsx)(oe,{to:"/apps",replace:!0}):c.tab==="runtime"?(0,e.jsx)(oe,{to:"/apps",replace:!0}):c.tab==="policies"?(0,e.jsx)(oe,{to:"/apps/advanced/profiles",replace:!0}):u?(0,e.jsxs)("div",{className:"mx-auto flex w-full max-w-4xl flex-col gap-5 p-4 sm:p-6",children:[(0,e.jsxs)("header",{children:[(0,e.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,e.jsx)("h1",{className:"text-xl font-bold text-foreground",children:"Advanced setup"}),(0,e.jsx)("span",{className:"inline-flex items-center rounded-full bg-foreground px-2.5 py-0.5 text-(length:--text-micro) font-bold text-background",children:"Advanced"})]}),(0,e.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground",children:["For tools that aren't in the gallery. You'll need details from the tool's documentation. Most people never need this — if the app you want is in the gallery,"," ",(0,e.jsx)(ie,{to:"/apps",className:"font-medium text-primary hover:underline",children:"connect it there instead"}),"."]})]}),(0,e.jsx)("nav",{className:"flex items-center gap-6 border-b border-border",children:Mt.map(b=>(0,e.jsx)(ie,{to:ge(b.key),className:Z("-mb-px border-b-2 pb-2 text-sm transition-colors",b.key===d?"border-foreground font-bold text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:b.label},b.key))}),(0,e.jsx)("div",{className:"min-h-(--sz-300px)",children:ze(d,r)}),(0,e.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)(Ct,{className:"h-3.5 w-3.5"}),"Looking for the developer surface?"," ",(0,e.jsx)(ie,{to:ge("profiles"),className:"font-medium text-primary hover:underline",children:"Open developer tools"})]})]}):(0,e.jsx)("div",{className:"max-w-5xl",children:ze(d,r)}):(0,e.jsx)("div",{className:"p-6 text-sm text-muted-foreground",children:"Select an organization to open advanced setup."})}s(Ls,"ToolsAccess");function Us(){const{selectedCompanyId:t}=He(),r=Q({queryKey:M.access.currentBoardAccess,queryFn:s(()=>_t.getCurrentBoardAccess(),"queryFn")}),a=ue(r);if(r.isLoading||a.kind==="reconnecting")return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-muted-foreground",children:"Loading…"});if(a.kind==="error"&&a.errorKind!=="forbidden")return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10",children:(0,e.jsx)(X,{error:r.error,action:"check your access",onRetry:a.retry,retrying:a.isFetching})});const c=r.data,d=c?.memberships?.find(u=>u.companyId===t&&u.status==="active");return c?.source==="local_implicit"||c?.isInstanceAdmin||d?.membershipRole==="owner"||d?.membershipRole==="admin"||d?.membershipRole==="operator"||d?.membershipRole==="member"?(0,e.jsx)(Ls,{}):(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10",children:(0,e.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border bg-card p-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-foreground",children:[(0,e.jsx)(qt,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"Advanced setup requires editing access"})]}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:["This area lets company editors wire up tools that aren't in the gallery. Ask a company editor if you need a new app connected, or head back to"," ",(0,e.jsx)(ie,{to:"/apps",className:"font-medium text-primary hover:underline",children:"your apps"}),"."]})]})})}s(Us,"AdvancedToolsRoute");export{Us as AdvancedToolsRoute};
@@ -0,0 +1 @@
1
+ var Ge=Object.defineProperty;var i=(e,l)=>Ge(e,"name",{value:l,configurable:!0});import{a as Re}from"./rolldown-runtime-DhZMWcEn.js";import{_o as ue,uo as pe}from"./issue-detail-BCc22gsn.js";import{_ as Je}from"./collections-DWBx3_z7.js";import{Bf as Ze,D_ as me,FC as ze,Fd as Le,Fv as Ve,Hg as xe,Hp as We,N_ as Q,Pg as Xe,Qv as m,RC as Ye,Sm as fe,Sp as he,Th as x,Vv as z,Wn as ye,X_ as Te,Zf as p,Zv as es,_m as je,_p as be,bg as L,bp as ve,gp as Ce,hp as ge,iv as Ne,pg as we,sy as R,ty as ke,vp as Se,wg as Fe,xg as T,xp as _e,ym as Pe,yp as Ae}from"./index-B9u2GAJi.js";var f=Re(Ye(),1),ss=["instructionsBundleMode","instructionsRootPath","instructionsEntryFile","instructionsFilePath","agentsMdPath","promptTemplate","bootstrapPromptTemplate"];function V(e){return e?JSON.parse(JSON.stringify(e)):{}}i(V,"cloneRecord");function De(e){return`${e.trim()||"Agent"} Copy`}i(De,"duplicateAgentName");function ts(e,l){const r=V(e.adapterConfig);for(const h of ss)delete r[h];const a={name:De(e.name),role:e.role,adapterType:e.adapterType,adapterConfig:r,runtimeConfig:V(e.runtimeConfig),defaultEnvironmentId:e.defaultEnvironmentId??null,budgetMonthlyCents:e.budgetMonthlyCents??0,permissions:{canCreateAgents:!!e.permissions?.canCreateAgents,canCreateSkills:e.permissions?.canCreateSkills!==!1}};return e.title&&(a.title=e.title),e.icon&&(a.icon=e.icon),e.reportsTo&&(a.reportsTo=e.reportsTo),e.capabilities&&(a.capabilities=e.capabilities),e.metadata&&(a.metadata=V(e.metadata)),l&&Object.keys(l.files).length>0&&(a.instructionsBundle=l),a}i(ts,"buildDuplicateAgentPayload");var s=Re(ze(),1);function is({onClick:e,disabled:l,label:r="Run now",size:a="sm"}){return(0,s.jsxs)(m,{variant:"outline",size:a,onClick:e,disabled:l,children:[(0,s.jsx)(T,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:r})]})}i(is,"RunButton");function as({isPaused:e,onPause:l,onResume:r,disabled:a,size:h="sm"}){return e?(0,s.jsxs)(m,{variant:"outline",size:h,onClick:r,disabled:a,children:[(0,s.jsx)(T,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Resume"})]}):(0,s.jsxs)(m,{variant:"outline",size:h,onClick:l,disabled:a,children:[(0,s.jsx)(Fe,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Pause"})]})}i(as,"PauseResumeButton");function ns({onClick:e,disabled:l,size:r="sm"}){return(0,s.jsxs)(m,{variant:"outline",size:r,onClick:e,disabled:l,className:"border-destructive/60 text-destructive hover:bg-destructive/10 hover:text-destructive dark:border-destructive/50","aria-label":"Clear error and return agent to idle",children:[(0,s.jsx)(Te,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Clear error"})]})}i(ns,"ClearErrorButton");function rs(e,l){return l.deprecated||l.virtual?null:l.path}i(rs,"duplicateInstructionFilePath");async function ls(e,l){const r=await p.instructionsBundle(e,l),a={};for(const F of r.files){const S=rs(r,F);S&&(a[S]=(await p.instructionsFile(e,F.path,l)).content)}const h=Object.prototype.hasOwnProperty.call(a,r.entryFile)?r.entryFile:Object.keys(a)[0]??"AGENTS.md";return Object.keys(a).length>0?{entryFile:h,files:a}:null}i(ls,"loadDuplicateInstructionsBundle");function ms({agent:e,companyId:l,size:r="sm",assignLabel:a="Assign Task",showAssignIcon:h=!0,showChat:F=!1,runLabel:S="Run now",showStatus:Oe=!0,showRun:W=!0,actionsDisabled:qe=!1,workActionsDisabled:N=!1,workActionsDisabledReason:D,navigateToRunOnInvoke:$=!0,hasPendingNavigationChanges:X=!1,onBeforeNavigate:O,onActionError:b,onTerminateSuccess:B,pauseConfirm:y,hideTerminate:Y=!1,workActionsInMenu:Ee=!1,menuItems:Ie=[],children:ee,className:se}){const _=We(),u=es(),{openNewIssue:M}=Ze(),{pushToast:w}=Le(),[te,v]=(0,f.useState)(!1),[ie,q]=(0,f.useState)(!1),H=(0,f.useRef)(X),U=(0,f.useRef)(O),j=(0,f.useRef)(!1),ae=(0,f.useRef)(!1);H.current=X,U.current=O;function C(t){return t.current=H.current,U.current?.()!==!1}i(C,"confirmNavigationStart");function G(t){return!H.current||t.current||U.current?.()!==!1}i(G,"confirmLateNavigationChanges");const c=l??e.companyId,E=ke(e),J=e.lifecycleState?e.lifecycleState==="paused":e.status==="paused",Ke=e.status==="error",P=e.pauseReason==="setup"&&e.status!=="terminated"&&!["terminating","cleaning_up","terminated","rejected"].includes(e.lifecycleState??""),ne=(0,f.useCallback)(t=>{b?b(t):w({title:"Action failed",body:t,tone:"error"})},[b,w]),Qe=(0,f.useCallback)(()=>{u.invalidateQueries({queryKey:x.agents.detail(e.id)}),u.invalidateQueries({queryKey:x.agents.detail(E)}),u.invalidateQueries({queryKey:x.agents.runtimeState(e.id)}),u.invalidateQueries({queryKey:x.agents.taskSessions(e.id)}),c&&(u.invalidateQueries({queryKey:x.agents.list(c)}),u.invalidateQueries({queryKey:x.liveRuns(c)}),u.invalidateQueries({queryKey:x.heartbeats(c,e.id)}))},[e.id,E,u,c]),d=z({mutationFn:i(async t=>{switch(t){case"invoke":return p.invoke(e.id,c??void 0);case"pause":return p.pause(e.id,c??void 0);case"resume":return p.resume(e.id,c??void 0);case"clear_error":return p.clearError(e.id,c??void 0);case"approve":return p.approve(e.id,c??void 0);case"terminate":return p.terminate(e.id,c??void 0)}},"mutationFn"),onSuccess:i((t,n)=>{if(b?.(null),Qe(),n==="terminate"){const o=t.lifecycleState;if(o==="terminating"||o==="cleaning_up"||!G(j))return;B?.(t)}if(n==="invoke"&&$&&t&&typeof t=="object"&&"id"in t){if(!G(j))return;_(`/agents/${E}/runs/${t.id}`)}},"onSuccess"),onError:i(t=>{ne(t instanceof Error?t.message:"Action failed")},"onError")}),g=z({mutationFn:i(async()=>{if(!c)throw new Error("Agent is not ready to duplicate");const t=await ls(e.id,c),n=ts(e,t);try{return await p.create(c,n)}catch(o){if(o instanceof Ve&&o.status===409&&o.message.includes("requires board approval"))return(await p.hire(c,n)).agent;throw o}},"mutationFn"),onSuccess:i(async t=>{b?.(null),c&&await u.invalidateQueries({queryKey:x.agents.list(c)}),w({title:"Agent duplicated",body:t.name,tone:"success"}),G(ae)&&_(`/agents/${ke(t)}/dashboard`)},"onSuccess"),onError:i(t=>{const n=t instanceof Error?t.message:"Failed to duplicate agent";b?.(n),w({title:"Could not duplicate agent",body:n,tone:"error"})},"onError")}),re=(0,f.useCallback)(()=>{if(g.isPending)return;const t=De(e.name),n=window.confirm(`Duplicate ${e.name} as ${t}?`);v(!1),!(!n||!C(ae))&&g.mutate()},[e.name,g]),le=z({mutationFn:i(()=>p.resetSession(e.id,null,c??void 0),"mutationFn"),onSuccess:i(()=>{b?.(null),u.invalidateQueries({queryKey:x.agents.runtimeState(e.id)}),u.invalidateQueries({queryKey:x.agents.taskSessions(e.id)})},"onSuccess"),onError:i(t=>{ne(t instanceof Error?t.message:"Failed to reset session")},"onError")}),ce=e.status==="pending_approval",k=qe||d.isPending,A=k||ce||N||e.status==="terminated",Z=k||ce||J&&N||!!(e.lifecycleState&&["pausing","terminating","cleaning_up","terminated","rejected"].includes(e.lifecycleState)),oe=k,I=e.runtimeConfig,de=(I&&typeof I.debug=="object"&&I.debug!==null?I.debug:null)?.providerTrace==="raw",$e=i(()=>{C(j)&&_(`/agents/new?${new URLSearchParams({name:e.name,adapterType:e.adapterType,setupAgentId:e.id,runnerProvider:String(e.adapterConfig.provider==="acpx"?e.adapterConfig.acpxAgent:e.adapterConfig.provider??"codex"),...e.adapterType==="paperclip_runner"?{runner:"paperclip"}:["codex_local","claude_local","opencode_local","pi_local"].includes(e.adapterType)?{runner:"legacy"}:{},...pe(e)})}`)},"finishSetup"),Be=y?(0,s.jsx)(ge,{open:ie,onOpenChange:q,children:(0,s.jsxs)(Se,{children:[(0,s.jsxs)(_e,{children:[(0,s.jsx)(he,{children:y.title}),(0,s.jsx)(Ae,{asChild:!0,children:(0,s.jsx)("div",{children:y.description})})]}),(0,s.jsxs)(ve,{children:[(0,s.jsx)(be,{children:"Cancel"}),(0,s.jsx)(Ce,{onClick:i(()=>d.mutate("pause"),"onClick"),children:"Pause anyway"})]})]})}):null;if(Ee){const t="flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm transition-colors hover:bg-accent disabled:pointer-events-none disabled:opacity-50",n="size-4 shrink-0 text-muted-foreground",o=i(K=>()=>{v(!1),K()},"select");return(0,s.jsxs)("div",{className:se??"flex shrink-0 items-center gap-2",children:[de?(0,s.jsxs)("span",{className:"hidden items-center gap-1 rounded-md border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary lg:inline-flex",title:"Exact provider traffic will be captured for future runs and retained for up to 24 hours.",children:[(0,s.jsx)(Ne,{className:"h-3.5 w-3.5"}),"Raw tracing on"]}):null,ee,(0,s.jsxs)(je,{open:te,onOpenChange:v,children:[(0,s.jsx)(fe,{asChild:!0,children:(0,s.jsx)(m,{variant:"ghost",size:"icon","aria-label":`Open actions for ${e.name}`,children:(0,s.jsx)(me,{className:"size-4"})})}),(0,s.jsxs)(Pe,{className:"w-52 p-1",align:"end",children:[P?(0,s.jsxs)("button",{type:"button",className:t,disabled:A,title:N?D:void 0,onClick:o(()=>M({assigneeAgentId:e.id})),children:[(0,s.jsx)(L,{className:n}),a]}):W?(0,s.jsxs)("button",{type:"button",className:t,disabled:A,title:N?D:void 0,onClick:o(()=>{$&&!C(j)||d.mutate("invoke")}),children:[(0,s.jsx)(T,{className:n}),S]}):null,P?null:Ke?(0,s.jsxs)("button",{type:"button",className:R(t,"text-destructive"),disabled:oe,"aria-label":"Clear error and return agent to idle",onClick:o(()=>d.mutate("clear_error")),children:[(0,s.jsx)(Te,{className:R(n,"text-destructive")}),"Clear error"]}):J?(0,s.jsxs)("button",{type:"button",className:t,disabled:Z,onClick:o(()=>d.mutate("resume")),children:[(0,s.jsx)(T,{className:n}),"Resume"]}):(0,s.jsxs)("button",{type:"button",className:t,disabled:Z,onClick:o(()=>y?q(!0):d.mutate("pause")),children:[(0,s.jsx)(Fe,{className:n}),"Pause"]}),(0,s.jsx)("div",{role:"separator",className:"-mx-1 my-1 h-px bg-border"}),Ie.map(({label:K,icon:Me,onSelect:He,disabled:Ue})=>(0,s.jsxs)("button",{type:"button",className:t,disabled:Ue,onClick:o(He),children:[(0,s.jsx)(Me,{className:n}),K]},K)),(0,s.jsxs)("button",{type:"button",className:t,disabled:g.isPending,onClick:re,children:[g.isPending?(0,s.jsx)(xe,{className:R(n,"animate-spin")}):(0,s.jsx)(Q,{className:n}),"Duplicate agent"]}),(0,s.jsxs)("button",{type:"button",className:t,onClick:o(()=>{ye(e.id).catch(()=>{w({title:"Copy failed",body:"Clipboard access is unavailable.",tone:"error"})})}),children:[(0,s.jsx)(Q,{className:n}),"Copy agent ID"]}),(0,s.jsxs)("button",{type:"button",className:t,onClick:o(()=>le.mutate()),children:[(0,s.jsx)(we,{className:n}),"Reset sessions"]}),Y?null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{role:"separator",className:"-mx-1 my-1 h-px bg-border"}),(0,s.jsxs)("button",{type:"button",className:R(t,"text-destructive"),onClick:o(()=>{B&&!C(j)||d.mutate("terminate")}),children:[(0,s.jsx)(ue,{className:R(n,"text-destructive")}),"Terminate"]})]})]})]}),F&&(0,s.jsx)(m,{variant:"outline",size:"icon","aria-label":`Chat with ${e.name}`,title:"Chat with this agent",disabled:k,onClick:i(()=>{(!O||O())&&_(`/chats/${E}`)},"onClick"),children:(0,s.jsx)(Xe,{className:"size-4"})}),P?(0,s.jsxs)(m,{size:r,disabled:k,onClick:$e,children:[(0,s.jsx)(T,{className:"size-4"}),"Finish setup"]}):(0,s.jsxs)(m,{size:r,onClick:i(()=>M({assigneeAgentId:e.id}),"onClick"),disabled:A,title:N?D:void 0,children:[h&&(0,s.jsx)(L,{className:"size-4"}),a]}),Be]})}return(0,s.jsxs)("div",{className:se??"flex items-center gap-1 sm:gap-2 shrink-0",children:[de?(0,s.jsxs)("span",{className:"hidden items-center gap-1 rounded-md border border-primary/30 bg-primary/10 px-2 py-1 text-xs font-medium text-primary lg:inline-flex",title:"Exact provider traffic will be captured for future runs and retained for up to 24 hours.",children:[(0,s.jsx)(Ne,{className:"h-3.5 w-3.5"}),"Raw tracing on"]}):null,(0,s.jsxs)(m,{variant:"outline",size:r,onClick:i(()=>M({assigneeAgentId:e.id}),"onClick"),disabled:A,title:N?D:void 0,children:[(0,s.jsx)(L,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:a})]}),P?(0,s.jsx)(m,{variant:"outline",size:r,disabled:k,onClick:i(()=>{C(j)&&_(`/agents/new?${new URLSearchParams({name:e.name,adapterType:e.adapterType,setupAgentId:e.id,runnerProvider:String(e.adapterConfig.provider==="acpx"?e.adapterConfig.acpxAgent:e.adapterConfig.provider??"codex"),...e.adapterType==="paperclip_runner"?{runner:"paperclip"}:["codex_local","claude_local","opencode_local","pi_local"].includes(e.adapterType)?{runner:"legacy"}:{},...pe(e)})}`)},"onClick"),children:"Finish setup"}):W&&(0,s.jsx)(is,{onClick:i(()=>{$&&!C(j)||d.mutate("invoke")},"onClick"),disabled:A,label:S,size:r}),!P&&(e.status==="error"?(0,s.jsx)(ns,{onClick:i(()=>d.mutate("clear_error"),"onClick"),disabled:oe,size:r}):(0,s.jsx)(as,{isPaused:J,onPause:i(()=>y?q(!0):d.mutate("pause"),"onPause"),onResume:i(()=>d.mutate("resume"),"onResume"),disabled:Z,size:r})),y&&(0,s.jsx)(ge,{open:ie,onOpenChange:q,children:(0,s.jsxs)(Se,{children:[(0,s.jsxs)(_e,{children:[(0,s.jsx)(he,{children:y.title}),(0,s.jsx)(Ae,{asChild:!0,children:(0,s.jsx)("div",{children:y.description})})]}),(0,s.jsxs)(ve,{children:[(0,s.jsx)(be,{children:"Cancel"}),(0,s.jsx)(Ce,{onClick:i(()=>d.mutate("pause"),"onClick"),children:"Pause anyway"})]})]})}),Oe&&(0,s.jsx)("span",{className:"hidden sm:inline",children:(0,s.jsx)(Je,{status:e.status})}),ee,(0,s.jsxs)(je,{open:te,onOpenChange:v,children:[(0,s.jsx)(fe,{asChild:!0,children:(0,s.jsx)(m,{variant:"ghost",size:"icon-xs","aria-label":`Open actions for ${e.name}`,children:(0,s.jsx)(me,{className:"h-4 w-4"})})}),(0,s.jsxs)(Pe,{className:"w-44 p-1",align:"end",children:[(0,s.jsxs)("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50",disabled:g.isPending,onClick:re,children:[g.isPending?(0,s.jsx)(xe,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(Q,{className:"h-3 w-3"}),"Duplicate Agent"]}),(0,s.jsxs)("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50",onClick:i(()=>{ye(e.id).catch(()=>{w({title:"Copy failed",body:"Clipboard access is unavailable.",tone:"error"})}),v(!1)},"onClick"),children:[(0,s.jsx)(Q,{className:"h-3 w-3"}),"Copy Agent ID"]}),(0,s.jsxs)("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50",onClick:i(()=>{le.mutate(),v(!1)},"onClick"),children:[(0,s.jsx)(we,{className:"h-3 w-3"}),"Reset Sessions"]}),!Y&&(0,s.jsxs)("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50 text-destructive",onClick:i(()=>{v(!1),!(B&&!C(j))&&d.mutate("terminate")},"onClick"),children:[(0,s.jsx)(ue,{className:"h-3 w-3"}),"Terminate"]})]})]})]})}i(ms,"AgentActionButtons");export{is as n,ms as t};