@paperclipai/ui 2026.1023.0 → 2026.1024.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 (415) hide show
  1. package/dist/assets/ActiveAgentsPanel-d0JTux8w.js +1 -0
  2. package/dist/assets/AdapterManager-CSuXXys7.js +1 -0
  3. package/dist/assets/AdvancedToolsRoute-h-wb6CIa.js +39 -0
  4. package/dist/assets/AgentActionButtons-8eMdlERI.js +1 -0
  5. package/dist/assets/AgentBulkRoster-CHK5ekxM.js +2 -0
  6. package/dist/assets/AgentBulkSettingsSheet-D1vM7GWb.js +1 -0
  7. package/dist/assets/AgentChat-D1NgZ3s-.js +1 -0
  8. package/dist/assets/AgentDetailPage-CqcQJFZD.js +38 -0
  9. package/dist/assets/Agents-CTfu7pjO.js +2 -0
  10. package/dist/assets/Agents.production-Cmv6zQOv.js +2 -0
  11. package/dist/assets/AnimatedDialogContent-CgWmpz2A.js +1 -0
  12. package/dist/assets/AppDetail-DrfkoQx3.js +1 -0
  13. package/dist/assets/AppNotConnected-DVMOqzPG.js +1 -0
  14. package/dist/assets/ApprovalDetail-CuzSfs-q.js +1 -0
  15. package/dist/assets/Approvals-YCalUU9-.js +1 -0
  16. package/dist/assets/AppsConnect-BC4bc0dt.js +1 -0
  17. package/dist/assets/AppsReview-DG2Q4BDD.js +1 -0
  18. package/dist/assets/Artifacts-CRW5eMQ5.js +1 -0
  19. package/dist/assets/AssistantConnection-CtGVmNKR.js +1 -0
  20. package/dist/assets/AuditHub-MJtlEO-l.js +1 -0
  21. package/dist/assets/Auth-f_gNmeNZ.js +3 -0
  22. package/dist/assets/BoardChat-CXTkZm_1.js +18 -0
  23. package/dist/assets/BoardClaim-C7HK7gDf.js +1 -0
  24. package/dist/assets/BootstrapSetupUxLab-CAehulsl.js +1 -0
  25. package/dist/assets/Browse-COs_fVfK.js +1 -0
  26. package/dist/assets/BudgetPolicyCard-DOv3-V31.js +1 -0
  27. package/dist/assets/CaseDetail-BBiLM8bS.js +1 -0
  28. package/dist/assets/CaseStatus-DMQ1VSv4.js +1 -0
  29. package/dist/assets/Cases-CYFRL-6b.js +1 -0
  30. package/dist/assets/ChatEndpointDetail-BtTZe3Jt.js +5 -0
  31. package/dist/assets/ChatEndpointSetup-B_zjDrS-.js +1 -0
  32. package/dist/assets/ChatIdentityConfirm-DeTY5gDa.js +1 -0
  33. package/dist/assets/CliAuth-B0I3KcuE.js +1 -0
  34. package/dist/assets/Companies-CfMr7wMK.js +1 -0
  35. package/dist/assets/CompanyAccess-DncgZI61.js +1 -0
  36. package/dist/assets/CompanyActivity-BQ-C1IYg.js +1 -0
  37. package/dist/assets/CompanyActivity.production-CQ3zP7ti.js +1 -0
  38. package/dist/assets/CompanyConnections-DEAxHjIx.js +1 -0
  39. package/dist/assets/CompanyEnvironments-BrP-ENHg.css +1 -0
  40. package/dist/assets/CompanyEnvironments-QGZu3b0_.js +35 -0
  41. package/dist/assets/CompanyExport-EngGGpAD.js +4 -0
  42. package/dist/assets/CompanyImport-lxwCzXzm.js +1 -0
  43. package/dist/assets/CompanySettings-Dtpekahp.js +1 -0
  44. package/dist/assets/CompanySettingsPluginPage-BUqjnHzX.js +1 -0
  45. package/dist/assets/CompanySkills-Bhj-2JhE.js +10 -0
  46. package/dist/assets/{CompanySkills.production-D61y2stR.js → CompanySkills.production-BAzc44MG.js} +2 -2
  47. package/dist/assets/ConfigureBuiltInAgentModal-ujd1uyib.js +1 -0
  48. package/dist/assets/CopyableGatewayUrl-tN3Pxa-G.js +1 -0
  49. package/dist/assets/Costs-0BQGz2Wi.js +1 -0
  50. package/dist/assets/CrossIssueCollaborationUxLab-CayfP_FK.js +1 -0
  51. package/dist/assets/Dashboard-C0rNoNBG.js +2 -0
  52. package/dist/assets/DashboardLive-UevZJlrL.js +1 -0
  53. package/dist/assets/DecisionDateChips-nAtt68DE.js +1 -0
  54. package/dist/assets/DecisionQueuePage-DN197VdF.js +1 -0
  55. package/dist/assets/DesignGuide-MBb0FRYq.js +23 -0
  56. package/dist/assets/DesignSandboxTaskThread-BBWkrTTm.js +28 -0
  57. package/dist/assets/EmailConnectionAccess-BoTRBcqw.js +1 -0
  58. package/dist/assets/EmailEndpointSetup-B9GKZzH-.js +1 -0
  59. package/dist/assets/EnforcementBanner-CJ16kaCY.js +1 -0
  60. package/dist/assets/EntityRow-Bb-CQP0L.js +1 -0
  61. package/dist/assets/ExecutionWorkspaceDetail-BRfQts4U.js +19 -0
  62. package/dist/assets/ExternalAgentInviteDialog-EGDk_QZc.js +50 -0
  63. package/dist/assets/FilterBar-D6LDDM8B.js +1 -0
  64. package/dist/assets/FolderControls-DN8I0umg.js +1 -0
  65. package/dist/assets/GatewayDetail-CPdaCM0E.js +2 -0
  66. package/dist/assets/GatewaysList-B-1dlfr1.js +1 -0
  67. package/dist/assets/GitHubConnectionRecovery-DJ1HQrMN.js +1 -0
  68. package/dist/assets/GoalDetail-B1pa5CaA.js +1 -0
  69. package/dist/assets/GoalTree-CREfHBfH.js +1 -0
  70. package/dist/assets/Goals-Dx1GIyyw.js +1 -0
  71. package/dist/assets/Inbox-R6RswJAg.js +3 -0
  72. package/dist/assets/InstanceAccess-DdSVmfkE.js +1 -0
  73. package/dist/assets/InstanceExperimentalSettings-ipjZMntc.js +1 -0
  74. package/dist/assets/InviteLanding-DHdK18iC.js +1 -0
  75. package/dist/assets/IssueChatLongThreadPerf-CHgcSBtM.js +2 -0
  76. package/dist/assets/Issues-DGKWilgJ.js +1 -0
  77. package/dist/assets/JoinRequestQueue-C8_3mpDH.js +1 -0
  78. package/dist/assets/Layout.production-Dnvl9PKE.js +1 -0
  79. package/dist/assets/ManagedAiConnectionDetails-CZ1qlxJ-.js +1 -0
  80. package/dist/assets/McpConnect-SM4Orynw.js +1 -0
  81. package/dist/assets/MembershipAction-CVgpzHYJ.js +1 -0
  82. package/dist/assets/MetricCard-Cz895hIY.js +1 -0
  83. package/dist/assets/MissingPluginTabPlaceholder-B6gpoLRt.js +1 -0
  84. package/dist/assets/NewAgent-BskVxS2M.js +1 -0
  85. package/dist/assets/NewAgentDialog-D_CP2epa.js +1 -0
  86. package/dist/assets/NewGoalDialog-1UhHPXx4.js +1 -0
  87. package/dist/assets/NewIssueDialog-DKXygC3f.js +1 -0
  88. package/dist/assets/NewProjectDialog-0euRC7Lo.js +1 -0
  89. package/dist/assets/OnboardingPrimitives-B31Bs77k.js +1 -0
  90. package/dist/assets/OnboardingWizard-RAGqZllb.js +2 -0
  91. package/dist/assets/OrgChart.production-CP5JpUqE.js +1 -0
  92. package/dist/assets/PaperclipCloudOAuthHandoff-CC6_zebd.js +1 -0
  93. package/dist/assets/PluginManager-DGaolDu0.js +1 -0
  94. package/dist/assets/PluginPage-Dg5Dhmbl.js +1 -0
  95. package/dist/assets/PluginSettings-2Md68AKc.js +1 -0
  96. package/dist/assets/ProfileDetailRoute-Bg6XzZeg.js +1 -0
  97. package/dist/assets/ProfileSettings-DE4PNyBw.js +1 -0
  98. package/dist/assets/ProfileWizardRoute-CnKjXCys.js +1 -0
  99. package/dist/assets/ProjectDetail-h_GGmo3O.js +1 -0
  100. package/dist/assets/ProjectRepositoryInput-DfxlVbMy.js +1 -0
  101. package/dist/assets/ProjectWorkspaceDetail-Ccfnu3ZM.js +29 -0
  102. package/dist/assets/ProjectWorkspacesContent-BETrNgzD.js +1 -0
  103. package/dist/assets/Projects-DYvC_-Mx.js +1 -0
  104. package/dist/assets/QuotaBar-DHUOFXB1.js +1 -0
  105. package/dist/assets/RepositoryEditor-L3JkfvNc.js +1 -0
  106. package/dist/assets/ResponsibleUserDenialUxLab-CsvYFYO5.js +1 -0
  107. package/dist/assets/ReviewQueueCard-CavT0469.js +1 -0
  108. package/dist/assets/RoutineActivityRow-DqYmwCuX.js +1 -0
  109. package/dist/assets/RoutineDetail-DzK75Frb.js +2 -0
  110. package/dist/assets/RoutineDetail.production-EhA1Kt7B.js +1 -0
  111. package/dist/assets/RoutineRunVariablesDialog-D_tdwPB8.js +1 -0
  112. package/dist/assets/Routines-CqYNTSoo.js +1 -0
  113. package/dist/assets/Routines.production-Bcm6YOW-.js +1 -0
  114. package/dist/assets/Search-CFID3QKY.js +1 -0
  115. package/dist/assets/Secrets-4dQGWrYl.js +4 -0
  116. package/dist/assets/SetMyUserSecretDialog-DAjmKtel.js +1 -0
  117. package/dist/assets/SkillBinaryFile-DFUcJJ2j.js +1 -0
  118. package/dist/assets/SkillCardIcon-MgYB_jH1.js +2 -0
  119. package/dist/assets/SkillFolderTree-DTZn1-Bo.js +1 -0
  120. package/dist/assets/SkillSourceTree-N449b_ev.js +2 -0
  121. package/dist/assets/SkillSources-BgKyvOEJ.js +2 -0
  122. package/dist/assets/SkillStudio-B0FM4USW.js +9 -0
  123. package/dist/assets/SkillsNavigationTabs-CbJjf5j8.js +1 -0
  124. package/dist/assets/SpekoPhoneCallback-6D8rDs5y.js +1 -0
  125. package/dist/assets/SpekoProviderSetup-DgoSdPJm.js +1 -0
  126. package/dist/assets/StatusCards-DiLr1Ubn.js +1 -0
  127. package/dist/assets/SummarySlotCard-BlW2oY0_.js +1 -0
  128. package/dist/assets/TaskChatLab-dbTvzgF3.js +11 -0
  129. package/dist/assets/TaskSummaryList-B_Yd4uPg.js +1 -0
  130. package/dist/assets/Timeline-Cn_ktCT_.js +1 -0
  131. package/dist/assets/ToolbarSearch-CuKaWFmz.js +1 -0
  132. package/dist/assets/ToolsAdminGate-DkN7j0ew.js +1 -0
  133. package/dist/assets/TrustPresetSection-DL-S6P1O.js +1 -0
  134. package/dist/assets/UserProfile-CFoVENq4.js +1 -0
  135. package/dist/assets/WebhookUrlWarning-BkRLRouP.js +1 -0
  136. package/dist/assets/WhatNeedsMe-C7cyPr5c.js +1 -0
  137. package/dist/assets/Workspaces-BMkWRCIg.js +1 -0
  138. package/dist/assets/{abnfDiagram-VCTEODGH-CElI5h6o.js → abnfDiagram-YUKMZFIV-Clq04j7E.js} +1 -1
  139. package/dist/assets/{arc-BQ55EiX2.js → arc-Dnq9Aszq.js} +1 -1
  140. package/dist/assets/architecture-WOLXFQ4H-DTi4VXCE.js +1 -0
  141. package/dist/assets/{architectureDiagram-5GKGNRK7-DUBpjYei.js → architectureDiagram-47P4ROYG-CaqbNO2z.js} +3 -3
  142. package/dist/assets/arrow-down-left-Co6LiPFV.js +1 -0
  143. package/dist/assets/blockDiagram-E7TT5TSB-DqQPVDAz.js +140 -0
  144. package/dist/assets/c4Diagram-CRA5TL53-qDN7WkoW.js +38 -0
  145. package/dist/assets/channel-BMz7mere.js +1 -0
  146. package/dist/assets/chunk-2BW5OAIV-DpVLmYom.js +10 -0
  147. package/dist/assets/{chunk-75Z2AOVW-CTyOxDW3.js → chunk-3YJQHVM4-BlOLETjD.js} +2 -2
  148. package/dist/assets/chunk-4EA7E6EY-BctWW9a3.js +1 -0
  149. package/dist/assets/{chunk-F27PBJKO-BI6MjXNA.js → chunk-7TKQ45FW-Cecyw-8m.js} +1 -1
  150. package/dist/assets/{chunk-SVP7TREG-BNLl-Ok9.js → chunk-AW2ZBBNX-Bz_0XqKK.js} +2 -2
  151. package/dist/assets/{chunk-GVQU2GXP-D5bNpR4K.js → chunk-DBDB3WZW-DSX18RHL.js} +1 -1
  152. package/dist/assets/chunk-DUW6YSOI-slPglwIh.js +1 -0
  153. package/dist/assets/chunk-E2ZNV5FY-icYW7hK7.js +70 -0
  154. package/dist/assets/chunk-EU5HNXII-DQ6Qqyb6.js +213 -0
  155. package/dist/assets/chunk-FVRAUYC3-wdWa_rfZ.js +2 -0
  156. package/dist/assets/{chunk-PWAF6VOD-DHqPPKbd.js → chunk-HJ2JQQFS-C8uTWXBP.js} +1 -1
  157. package/dist/assets/chunk-HTAEGDNF-SsTPocoS.js +1 -0
  158. package/dist/assets/chunk-J5ZVWO5B-ClU583ja.js +1 -0
  159. package/dist/assets/{chunk-POPQ4Y6H-B0MtQqlF.js → chunk-KQW6MTUR-CGkylpf0.js} +1 -1
  160. package/dist/assets/chunk-NGNAAXSQ-e5XI1hSt.js +128 -0
  161. package/dist/assets/chunk-NTY3LDVX-CapHAS2z.js +1 -0
  162. package/dist/assets/chunk-VPRB5NB3-CNNFEklI.js +129 -0
  163. package/dist/assets/chunk-XC4XBNZT-D4sRIJVX.js +62 -0
  164. package/dist/assets/{chunk-XXDRQBXY-BhrH-9FX.js → chunk-XXDRQBXY-BdWplhUD.js} +1 -1
  165. package/dist/assets/circle-slash-DZZ4iQaC.js +1 -0
  166. package/dist/assets/classDiagram-v2-K4WV4PDN-DwwDEL5Z.js +217 -0
  167. package/dist/assets/coins-BJQvTMO0.js +1 -0
  168. package/dist/assets/company-skill-routes-D5LJ1l8M.js +1 -0
  169. package/dist/assets/connection-owner-CR_PBLnH.js +1 -0
  170. package/dist/assets/{cose-bilkent-JH36ORCC-ShY6JvWh.js → cose-bilkent-JH36ORCC-DFyVDb92.js} +1 -1
  171. package/dist/assets/cynefin-EF2NZ3EQ-C3WHGKON.js +1 -0
  172. package/dist/assets/{cynefinDiagram-5FMLGOSQ-CGZNoppH.js → cynefinDiagram-3GCD6N5R-BM22hMrU.js} +1 -1
  173. package/dist/assets/{cytoscape.esm-B68Piqei.js → cytoscape.esm-C2vp4vBx.js} +1 -1
  174. package/dist/assets/dagre-W4DXFKR2-BwKZ5KfT.js +4 -0
  175. package/dist/assets/definition-DxwMBXnu.js +1 -0
  176. package/dist/assets/diagram-2UJZ2QOL-Ct-fgo81.js +200 -0
  177. package/dist/assets/{diagram-VX7I27RA-C6F4NzHd.js → diagram-OVF4WLC6-DYsnA97K.js} +1 -1
  178. package/dist/assets/{diagram-S7CK7UJ4-BMOu70sn.js → diagram-PFPMY2P6-CO1KZwXK.js} +4 -4
  179. package/dist/assets/diagram-UMYRVEAY-BR8L6bl-.js +24 -0
  180. package/dist/assets/diagram-YEKJPTXX-B0cGdeR-.js +41 -0
  181. package/dist/assets/diagram-ZIFT7M5P-BqOl3nY1.js +3 -0
  182. package/dist/assets/dist-BFdKiSX8.js +1 -0
  183. package/dist/assets/dist-BNftRM_W.js +1 -0
  184. package/dist/assets/dist-BOGb7-gh.js +1 -0
  185. package/dist/assets/dist-BWt6r06W.js +1 -0
  186. package/dist/assets/{dist-BEo-uoE2.js → dist-BY5Z9Zdt.js} +2 -2
  187. package/dist/assets/dist-BYriS7qv.js +1 -0
  188. package/dist/assets/dist-BbkBf8tb.js +1 -0
  189. package/dist/assets/dist-BhTaLr9E.js +1 -0
  190. package/dist/assets/dist-BkfXCzaM.js +1 -0
  191. package/dist/assets/dist-BpG1wQ9x.js +7 -0
  192. package/dist/assets/{dist-CN5Rg9XU.js → dist-CCuVGlEH.js} +4 -4
  193. package/dist/assets/dist-CDBydW4j.js +1 -0
  194. package/dist/assets/dist-CQ7_HrHi.js +1 -0
  195. package/dist/assets/dist-CS6FGvin.js +1 -0
  196. package/dist/assets/{dist-Cj4C2HPs.js → dist-CTlCK4Pe.js} +1 -1
  197. package/dist/assets/dist-Cd7wdKYE.js +39 -0
  198. package/dist/assets/dist-CuaPMWWC.js +1 -0
  199. package/dist/assets/dist-Cvmtp8NW.js +1 -0
  200. package/dist/assets/dist-DgxeVLkb.js +1 -0
  201. package/dist/assets/dist-Dl5HmkxE.js +1 -0
  202. package/dist/assets/dist-Dsbwc3eB.js +1 -0
  203. package/dist/assets/dist-EArvifTQ.js +1 -0
  204. package/dist/assets/dist-V6YMmsuf.js +1 -0
  205. package/dist/assets/dist-ZrkTJZ6B.js +3 -0
  206. package/dist/assets/dist-y0r6zY_J.js +13 -0
  207. package/dist/assets/{ebnfDiagram-PWID7BFC-DFhVsGcz.js → ebnfDiagram-VR2GEFS7-C45viB8J.js} +1 -1
  208. package/dist/assets/elk-IJKZMXRS-NSUUrrwA.js +25 -0
  209. package/dist/assets/erDiagram-O2IAPWRE-B6cQt0YW.js +99 -0
  210. package/dist/assets/eventmodeling-K75KTNOO-fdgG94d5.js +1 -0
  211. package/dist/assets/flowDiagram-OXPTDLAJ-okhElccR.js +1 -0
  212. package/dist/assets/ganttDiagram-R7TSEDQI-CwblK5c9.js +292 -0
  213. package/dist/assets/gitGraph-VSP46ZUC-DoZZWiOb.js +1 -0
  214. package/dist/assets/{gitGraphDiagram-WWUBYQGX-BejeRC3-.js → gitGraphDiagram-XJZIOB7I-DbxubPhb.js} +3 -3
  215. package/dist/assets/goals-CBb650uE.js +1 -0
  216. package/dist/assets/index-Dbyu_v18.css +1 -0
  217. package/dist/assets/index-Hy6BKS-o.js +219 -0
  218. package/dist/assets/info-OHQRW6UA-CFnVGOVH.js +1 -0
  219. package/dist/assets/infoDiagram-5W2HQ5XZ-B_Dk4QAT.js +2 -0
  220. package/dist/assets/invite-memory-BKdqfr5K.js +1 -0
  221. package/dist/assets/{ishikawaDiagram-5VMMS53U-DDvnGaeJ.js → ishikawaDiagram-K3B6WC7H-D_kbgis4.js} +3 -3
  222. package/dist/assets/issue-detail-CIbQo9zW.css +1 -0
  223. package/dist/assets/issue-detail-ls2AWc8k.js +533 -0
  224. package/dist/assets/{journeyDiagram-3NMN7TZE-rmjbLNr7.js → journeyDiagram-COXZFDF6-CBxtMw7O.js} +3 -3
  225. package/dist/assets/{kanban-definition-UXKFOSKX-hvO2tDhG.js → kanban-definition-P3RFRI5V-Dm5Gjjcv.js} +6 -6
  226. package/dist/assets/{line-Dk_ouzM8.js → line-DP5iwpBG.js} +1 -1
  227. package/dist/assets/{linear-s0r5e4qh.js → linear-BRQgexd0.js} +1 -1
  228. package/dist/assets/link-Cl8h2Hgq.js +1 -0
  229. package/dist/assets/list-filter-Bl0YNvbM.js +1 -0
  230. package/dist/assets/log-in-lFroibUJ.js +1 -0
  231. package/dist/assets/mermaid-parser.core-DBdChcln.js +7 -0
  232. package/dist/assets/mermaid.core-CORLHrOD.js +42 -0
  233. package/dist/assets/{mindmap-definition-YA3MSWOX-Dislw6JU.js → mindmap-definition-LZFPQGKD-Bg-c1rxY.js} +4 -4
  234. package/dist/assets/operate-sections-DS15A-iD.js +1 -0
  235. package/dist/assets/packet-JDAUHWVQ-Djs-09VJ.js +1 -0
  236. package/dist/assets/palette-tokens-CL5ZDrEd.js +1 -0
  237. package/dist/assets/{pegDiagram-XKGWAZYB-CizC38c5.js → pegDiagram-BGZESJAR-BzpENKxN.js} +1 -1
  238. package/dist/assets/pen-line-o1bbI0uD.js +1 -0
  239. package/dist/assets/pie-XZMESJXO-dSZgqSZR.js +1 -0
  240. package/dist/assets/{pieDiagram-E7YTZNPT-DvHDuZK1.js → pieDiagram-CAPJLFHJ-Dx5ZndAB.js} +2 -2
  241. package/dist/assets/portable-files-CloN_vbk.js +1 -0
  242. package/dist/assets/power-D4ktXLaq.js +1 -0
  243. package/dist/assets/{prod-COP_vZWu.js → prod-C6Q7tISe.js} +1 -1
  244. package/dist/assets/profile-summary-B9s7MgXG.js +1 -0
  245. package/dist/assets/{quadrantDiagram-AXDQQJYC-DTAvsUNT.js → quadrantDiagram-GDMTTRAM-C8Z96kQ3.js} +2 -2
  246. package/dist/assets/radar-ABXABTNO-BXEHZB8C.js +1 -0
  247. package/dist/assets/railroad-I3PHUGI6-Du0o_nVZ.js +1 -0
  248. package/dist/assets/railroad-abnf-LNEFI6M7-CQ8PfHzV.js +1 -0
  249. package/dist/assets/railroad-ebnf-DWYD2UWJ-Bqxug34R.js +1 -0
  250. package/dist/assets/railroad-peg-JR7BVNR7-DnukkWsr.js +1 -0
  251. package/dist/assets/{railroadDiagram-O6MQD6OU-DGlhxzAn.js → railroadDiagram-SM67HX2B-EhLqPQa8.js} +1 -1
  252. package/dist/assets/requirementDiagram-X7JNWC4A-BUFADT18.js +84 -0
  253. package/dist/assets/rolldown-runtime-DhZMWcEn.js +1 -0
  254. package/dist/assets/routine-variables-CzIFRXlW.js +1 -0
  255. package/dist/assets/{sankeyDiagram-P5KCCOFB-Be3A08ra.js → sankeyDiagram-UM26HJRW-CogyeoRk.js} +5 -5
  256. package/dist/assets/search-FJa8bXgL.js +1 -0
  257. package/dist/assets/sequenceDiagram-ZO4K6R2Y-B0Z3w-Lb.js +169 -0
  258. package/dist/assets/shared-gz0b27q4.js +1 -0
  259. package/dist/assets/skill-source-connect-return-eFTeuj7y.js +1 -0
  260. package/dist/assets/smoke-lab-matrix-DxkB20fL.js +1 -0
  261. package/dist/assets/{src-Bssc388C.js → src-DYjgETqR.js} +1 -1
  262. package/dist/assets/stateDiagram-v2-TBUQTH76-BTI-Jzyl.js +291 -0
  263. package/dist/assets/swimlanes-N4OXWK64-CR60wDcN.js +1 -0
  264. package/dist/assets/swimlanesDiagram-K3J5GTZL-BVr5vRFC.js +8 -0
  265. package/dist/assets/timeline-definition-YOQAKGHF-DdRZ6XW3.js +120 -0
  266. package/dist/assets/treeView-D4JQ5SDB-CDVZTVh8.js +1 -0
  267. package/dist/assets/treemap-SAJKECNS-BwmxyExU.js +1 -0
  268. package/dist/assets/useFastResponsesEnabled-Bo7kpHJp.js +1 -0
  269. package/dist/assets/useProfilesData-e2DVfkNL.js +1 -0
  270. package/dist/assets/useSummaryDraftStream-BIJ_yacz.js +3 -0
  271. package/dist/assets/usecaseDiagram-VIAY4XPW-CPVEWA49.js +362 -0
  272. package/dist/assets/{vennDiagram-4TSXK5OY-BZm-uDwq.js → vennDiagram-BLWOH2XV-N2suUu75.js} +6 -6
  273. package/dist/assets/wardley-7MLQ67FV--a8x6AQ1.js +1 -0
  274. package/dist/assets/{wardleyDiagram-VM6X3IG4-Y317P_uV.js → wardleyDiagram-YMQ3BMBF-CqUo9YVB.js} +3 -3
  275. package/dist/assets/webhook-CLStULRC.js +1 -0
  276. package/dist/assets/xychartDiagram-TAQBALBS-B2UnMscV.js +7 -0
  277. package/dist/brands/apps/1password-dark.svg +1 -0
  278. package/dist/brands/apps/1password.svg +1 -0
  279. package/dist/brands/apps/braintrust-dark.png +0 -0
  280. package/dist/brands/apps/braintrust.png +0 -0
  281. package/dist/brands/apps/daytona-dark.svg +1 -0
  282. package/dist/brands/apps/daytona.svg +1 -0
  283. package/dist/brands/apps/ditto.png +0 -0
  284. package/dist/brands/apps/manifest.json +57 -1
  285. package/dist/brands/apps/paperclip-notebook-dark.svg +1 -0
  286. package/dist/brands/apps/paperclip-notebook.svg +1 -0
  287. package/dist/brands/apps/speko.svg +16 -0
  288. package/dist/brands/apps/unikraft.svg +1 -0
  289. package/dist/fonts/NOTICE.md +13 -0
  290. package/dist/fonts/PaperMono-OFL.txt +93 -0
  291. package/dist/fonts/PaperMono-Variable.woff2 +0 -0
  292. package/dist/index.html +4 -43
  293. package/dist/storybook/grok-comparison.csv +4 -0
  294. package/dist/sw.js +56 -3
  295. package/package.json +1 -1
  296. package/dist/assets/AgentAvatar-B-1xry2J.js +0 -1
  297. package/dist/assets/Agents.production-pyhOBV2x.js +0 -2
  298. package/dist/assets/BreadcrumbContext-BqrxjvgW.js +0 -15
  299. package/dist/assets/CompanyActivity.production-HWlY6969.js +0 -1
  300. package/dist/assets/CompanyExport-WskzQtT_.js +0 -4
  301. package/dist/assets/EmptyState-BTZhuDsf.js +0 -1
  302. package/dist/assets/MarkdownBody-cZQWay7b.js +0 -16
  303. package/dist/assets/MarkdownEditor-DAPNmxy1.js +0 -85
  304. package/dist/assets/OrgChart.production-9-_IJFEl.js +0 -1
  305. package/dist/assets/PageSkeleton-CxgVifID.js +0 -1
  306. package/dist/assets/RoutineDetail.production-DBvVMjsd.js +0 -1
  307. package/dist/assets/RoutineRunVariablesDialog-DZOo1veJ.js +0 -5
  308. package/dist/assets/Routines.production-DE1oZ_mY.js +0 -1
  309. package/dist/assets/StatusIcon-BXQHVKUH.js +0 -1
  310. package/dist/assets/ToastContext-T9Pp8-AG.js +0 -1
  311. package/dist/assets/agent-avatar-url-DQnt6boq.js +0 -134
  312. package/dist/assets/alert-dialog-DMuNPqKM.js +0 -1
  313. package/dist/assets/architecture-7GRP2DOG-B-bRgmfI.js +0 -1
  314. package/dist/assets/arrow-right-B0x0jRuv.js +0 -1
  315. package/dist/assets/badge-CZnzMLuG.js +0 -1
  316. package/dist/assets/blockDiagram-I7D4REHJ-CD5_3VhC.js +0 -129
  317. package/dist/assets/bot-CEdLboxo.js +0 -1
  318. package/dist/assets/c4Diagram-7LVT6UL2-CSASNZeo.js +0 -38
  319. package/dist/assets/card-s-lN8fb-.js +0 -1
  320. package/dist/assets/channel-CtmRoUn0.js +0 -1
  321. package/dist/assets/check-BIqJVMcw.js +0 -1
  322. package/dist/assets/checkbox-Br1J3cXc.js +0 -1
  323. package/dist/assets/chunk-4HAMMTFA-Duh1dbZg.js +0 -62
  324. package/dist/assets/chunk-DU6HZSFF-mLZ_DAj9.js +0 -127
  325. package/dist/assets/chunk-FOHPRMQF-7Ogwfo6e.js +0 -153
  326. package/dist/assets/chunk-GMAD6QVW-Vk29EsOn.js +0 -70
  327. package/dist/assets/chunk-IMKFNOWR-DlfITCc_.js +0 -231
  328. package/dist/assets/chunk-L3NEJ4N5-GADujcju.js +0 -1
  329. package/dist/assets/chunk-OSK3NFVY-BfvIkdmA.js +0 -10
  330. package/dist/assets/chunk-P2QGCYS3-DD1uZyrA.js +0 -1
  331. package/dist/assets/chunk-SHT3W25Y-CorllSkN.js +0 -168
  332. package/dist/assets/chunk-TICWLB2K-BWKPkn9E.js +0 -206
  333. package/dist/assets/classDiagram-ZZMXUADV-DDCCAOna.js +0 -1
  334. package/dist/assets/classDiagram-v2-VYDZK3BY-DDCCAOna.js +0 -1
  335. package/dist/assets/clipboard-D40Q5q6s.js +0 -1
  336. package/dist/assets/company-members-Gm1tBjqe.js +0 -1
  337. package/dist/assets/cynefin-OW5HDTMX-SmJ8tLYh.js +0 -1
  338. package/dist/assets/dagre-Bnei_7lW.js +0 -1
  339. package/dist/assets/dagre-GXQ25YYZ-D0kXJo1b.js +0 -4
  340. package/dist/assets/definition-k8fwqa3H.js +0 -1
  341. package/dist/assets/diagram-UQ7AKVKN-dAmEsEgr.js +0 -41
  342. package/dist/assets/diagram-VSXAHHWV-zD92DhH2.js +0 -3
  343. package/dist/assets/diagram-Z3DM3KII-BxGljaP6.js +0 -24
  344. package/dist/assets/dist-B6TpBrd3.js +0 -1
  345. package/dist/assets/dist-BAtkULn4.js +0 -1
  346. package/dist/assets/dist-BGju9tdR.js +0 -1
  347. package/dist/assets/dist-BPuuaNc6.js +0 -1
  348. package/dist/assets/dist-BX4PSqp4.js +0 -1
  349. package/dist/assets/dist-BY93_d3Z.js +0 -1
  350. package/dist/assets/dist-Bc6S4vv3.js +0 -3
  351. package/dist/assets/dist-BhxPxuMy.js +0 -13
  352. package/dist/assets/dist-Bp5Y-deP.js +0 -1
  353. package/dist/assets/dist-CD47N__7.js +0 -1
  354. package/dist/assets/dist-CcBZFMdg.js +0 -1
  355. package/dist/assets/dist-CdFTLNcc.js +0 -1
  356. package/dist/assets/dist-Cv1Aw0YM.js +0 -1
  357. package/dist/assets/dist-D1LcUizL.js +0 -1
  358. package/dist/assets/dist-D4qkWMdz.js +0 -1
  359. package/dist/assets/dist-D61jI6QA.js +0 -1
  360. package/dist/assets/dist-DTj_cM7l.js +0 -1
  361. package/dist/assets/dist-DTwCbVsv.js +0 -7
  362. package/dist/assets/dist-DY5RRJBY.js +0 -1
  363. package/dist/assets/dist-DrXWoUSy.js +0 -1
  364. package/dist/assets/dist-DwveVgxz.js +0 -1
  365. package/dist/assets/dist-Uvf9OORN.js +0 -1
  366. package/dist/assets/dist-Wi1mdRva.js +0 -1
  367. package/dist/assets/dist-ds5P5TFe.js +0 -13
  368. package/dist/assets/dist-yKrp-Qew.js +0 -1
  369. package/dist/assets/environments-hvvTB-X_.js +0 -1
  370. package/dist/assets/erDiagram-RLTQ6QDP-CExzemcW.js +0 -99
  371. package/dist/assets/eventmodeling-NTZA5JFV-CCSRuDgA.js +0 -1
  372. package/dist/assets/external-link-CRPTOPQP.js +0 -1
  373. package/dist/assets/file-text-7IiZXGg8.js +0 -1
  374. package/dist/assets/flowDiagram-HODETNUW-DEjrdPyS.js +0 -1
  375. package/dist/assets/ganttDiagram-EL5Y4UJY-DStsnXzo.js +0 -292
  376. package/dist/assets/gitGraph-4MIJSDKK-SUTvd_QT.js +0 -1
  377. package/dist/assets/health-DEc4HToe.js +0 -1
  378. package/dist/assets/heartbeats-BLf3lyvz.js +0 -1
  379. package/dist/assets/index-CUVXSWy6.css +0 -1
  380. package/dist/assets/index-YJY9oyby.js +0 -684
  381. package/dist/assets/info-A6RAGUB7-DP8pqSDg.js +0 -1
  382. package/dist/assets/infoDiagram-27XIBGKW-Cch-IRh-.js +0 -2
  383. package/dist/assets/input-QhvcBvZC.js +0 -1
  384. package/dist/assets/label-D1BwZwuY.js +0 -5
  385. package/dist/assets/mention-chips-BccP-YPW.js +0 -17
  386. package/dist/assets/mermaid-parser.core-CHJSk6z0.js +0 -7
  387. package/dist/assets/mermaid.core-Be3XJK9z.js +0 -42
  388. package/dist/assets/packet-AYTQ26CC-DHxu-C4z.js +0 -1
  389. package/dist/assets/pie-WAS4IAKB-CP_gIBKD.js +0 -1
  390. package/dist/assets/preload-helper-CceJXRIF.js +0 -1
  391. package/dist/assets/radar-RG4KPBEZ-DbvKbV6l.js +0 -1
  392. package/dist/assets/railroad-74A4TZTK-BPHjMWIu.js +0 -1
  393. package/dist/assets/railroad-abnf-HS5TGJTU-DKY8xCGL.js +0 -1
  394. package/dist/assets/railroad-ebnf-LZEXJU2U-DK75GN4x.js +0 -1
  395. package/dist/assets/railroad-peg-WCYAUIDC-0bHp9JB9.js +0 -1
  396. package/dist/assets/requirementDiagram-BXWQKSXE-BzY8WPIy.js +0 -84
  397. package/dist/assets/rolldown-runtime-ZpX3ckPj.js +0 -1
  398. package/dist/assets/rotate-ccw-DWQojh1C.js +0 -1
  399. package/dist/assets/select-Dx8riB8Y.js +0 -1
  400. package/dist/assets/sequenceDiagram-WJ2MYXX4-BJuFaGQ8.js +0 -162
  401. package/dist/assets/sheet-B29m3gPT.js +0 -1
  402. package/dist/assets/skeleton-D7QvWIPX.js +0 -1
  403. package/dist/assets/stateDiagram-D77RDMKH-BWwUdBob.js +0 -1
  404. package/dist/assets/stateDiagram-v2-MP3YSRHH-P6gPsRNv.js +0 -1
  405. package/dist/assets/swimlanes-42K2YHIH-CMos3UkM.js +0 -1
  406. package/dist/assets/swimlanesDiagram-VR7AAH4N-BjRksHrL.js +0 -8
  407. package/dist/assets/tabs-AE3sXkCp.js +0 -1
  408. package/dist/assets/timeline-definition-24CTP7MA-5RQLEOvu.js +0 -120
  409. package/dist/assets/treeView-Q6P3EWNA-CzxfDhvq.js +0 -1
  410. package/dist/assets/treemap-WGGIJYW6-DNWYF4zd.js +0 -1
  411. package/dist/assets/use-adapter-capabilities-Dkd784iv.js +0 -1
  412. package/dist/assets/use-copy-action-B9lu9oLC.js +0 -1
  413. package/dist/assets/useHiddenSettings-DQ4f3mug.js +0 -1
  414. package/dist/assets/wardley-WFR3VGLG-C18JBEVS.js +0 -1
  415. package/dist/assets/xychartDiagram-S5SC5T6Z-DIOiLKNy.js +0 -7
@@ -0,0 +1 @@
1
+ var O=Object.defineProperty;var d=(r,t)=>O(r,"name",{value:t,configurable:!0});import{a as w}from"./rolldown-runtime-DhZMWcEn.js";import{U,tt as q}from"./issue-detail-ls2AWc8k.js";import{$m as B,Du as R,Lh as y,Ms as F,Ns as Q,Qp as K,Vu as Y,ic as H,kd as V,my as z,nf as $,si as G,th as W,vh as j,yy as J}from"./index-Hy6BKS-o.js";var o=w(J(),1),s=w(z(),1),X=[],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)(U,{comments:X,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,L=[],ue=[],ce={running:"Running",queued:"Queued",succeeded:"Succeeded",failed:"Failed",timed_out:"Timed out",cancelled:"Cancelled",interrupted:"Interrupted"};function ve({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:v=!1,dedupeLinkedTasks:l=!1}){const h=i,b=[...$.liveRuns(r),g,{minRunCount:e,fetchLimit:h,dedupeLinkedTasks:l}],M=Q({companyId:r,resourceKey:`live-runs:${g}:${e}:${h??"default"}:${l}`,queryKey:b,enabled:!!r,leaderOnly:!0}),{data:E,dataUpdatedAt:C}=B({queryKey:b,queryFn:d(()=>H.liveRunsForCompany(r,{minCount:e,limit:h,distinctTasks:l}),"queryFn"),enabled:M.enabled});F(M,E,C);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=W({queries:T.map(a=>({queryKey:$.issues.detail(a),queryFn:d(()=>V.get(a),"queryFn"),staleTime:3e4,retry:!1}))}),D=(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:P,hasOutputForRun:k}=q({runs:v?N:ue,companyId:r,maxChunksPerRun:le,logPollIntervalMs:de,logReadLimitBytes:oe,enableRealtimeUpdates:!1});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:j("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?D.get(a.issueId):void 0,transcript:P.get(a.id)??L,hasOutput:k(a.id),showTranscript:v,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(ve,"ActiveAgentsPanel");var me=(0,o.memo)(d(function({companyId:t,run:e,issue:i,transcript:m=L,hasOutput:n=!1,showTranscript:u=!1,issueLoadFailed:x=!1,className:g}){const f=ce[e.status]??e.status.replace(/[_-]/g," "),v=`/agents/${e.agentId}/runs/${e.id}`,l=e.finishedAt?`Finished ${y(e.finishedAt)}`:e.startedAt?`Started ${y(e.startedAt)}`:`Queued ${y(e.createdAt)}`,h=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:j("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:j("flex shrink-0 flex-col gap-3 p-3",u&&"border-b border-border/60"),children:[(0,s.jsx)(R,{to:v,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)(G,{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)(Y,{status:h,size:"md",className:"self-center",title:i?`Task ${h.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:v,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)(K,{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,ve as t};
@@ -0,0 +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{Jo as te,Pr as X,Xo as h,Yr as de,oo as q,qs as ce,si as Z}from"./issue-detail-ls2AWc8k.js";import{t as me}from"./power-D4ktXLaq.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-Hy6BKS-o.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)(ce,{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"),J=(T??[]).filter(s=>s.source==="external"),Y=(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 G=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)(de,{})]}),(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"})]}),J.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:J.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&&Y.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:G},s.type)),Y.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:G,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};
@@ -0,0 +1,39 @@
1
+ var Qe=Object.defineProperty;var s=(t,a)=>Qe(t,"name",{value:a,configurable:!0});import{a as Oe}from"./rolldown-runtime-DhZMWcEn.js";import{Bi as Je,Gr as Ve,Jn as ke,Ri as We,Xs as Ye,Zs as Ze,_n as Xe,fn as et,hn as tt,ki as st,mn as nt,mo as _e,oo as rt,uo as at,vn as ot,wi as it,yc as lt}from"./issue-detail-ls2AWc8k.js";import{a as dt,c as J,i as ct,n as mt,o as ut,r as Ce,s as xt,t as Se}from"./smoke-lab-matrix-DxkB20fL.js";import{t as ht}from"./circle-slash-DZZ4iQaC.js";import{t as pt}from"./link-Cl8h2Hgq.js";import{t as ft}from"./power-D4ktXLaq.js";import{$m as H,Ar as gt,Bm as bt,Cm as jt,Du as ae,Gf as vt,Mf as qe,Np as Ae,Oc as te,Pl as Nt,Pm as yt,Qc as X,Qf as ze,Qm as L,Rf as $e,Uc as je,Vp as wt,Wf as Be,Yc as kt,Yd as Ke,Zc as Ct,_p as be,ca as F,ch as ve,cp as Ne,dc as St,df as ie,dt as At,eu as Pt,fa as Pe,ff as Tt,gc as Et,gs as Te,hm as le,jl as Lt,ju as Ge,ks as Mt,ku as re,la as It,lh as j,lm as Dt,ma as Rt,mc as Ft,mf as Ot,mm as _t,my as qt,nf as M,nl as zt,nm as $t,pa as xe,pc as Bt,qp as he,sl as Kt,tu as Gt,ua as Ut,vc as Ht,vh as W,yc as Qt,yy as Jt}from"./index-Hy6BKS-o.js";import{a as oe,i as ye,r as Y,s as Ue}from"./shared-gz0b27q4.js";import{a as Vt,i as Wt,n as Yt,r as Zt,t as Xt}from"./profile-summary-B9s7MgXG.js";import{r as es,t as ts}from"./useProfilesData-e2DVfkNL.js";var Ee=`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.`,ss=["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."],p=Oe(Jt(),1),e=Oe(qt(),1);function ns({companyId:t,agentOptions:a}){const[o,d]=(0,p.useState)(""),l=H({queryKey:o?M.tools.effectiveProfilesForAgent(t,o):["tools",t,"profiles","effective","agent","__none__"],queryFn:s(()=>F.getEffectiveProfilesForAgent(t,o),"queryFn"),enabled:!!o});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)(at,{agents:a,value:o,onChange:d})]}),o?l.isLoading?(0,e.jsx)(ye,{label:"Checking access..."}):l.error?(0,e.jsx)(Y,{error:l.error,onRetry:s(()=>l.refetch(),"onRetry")}):(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:[(l.data?.allowedToolNames??[]).length," tools"]})]}),(l.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:(l.data?.allowedToolNames??[]).slice(0,80).map(c=>(0,e.jsx)(te,{variant:"outline",children:c},c))})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:"Access profiles"}),(l.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:(l.data?.profiles??[]).map(c=>(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:c.name}),c.summary.isCompanyDefault?(0,e.jsx)(te,{variant:"secondary",children:"Organization default"}):null]},c.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(ns,"EffectiveAgentPanel");function Le(t){return t?`/apps/advanced/profiles/new?template=${encodeURIComponent(t)}`:"/apps/advanced/profiles/new"}s(Le,"newProfileHref");function rs(t){return t==="active"?"default":t==="draft"?"secondary":"outline"}s(rs,"statusVariant");function as({companyId:t,initialStatusFilter:a,initialResolverOpen:o}){const d=Ge(),l=ve(),{pushToast:c}=je(),{profiles:x,agents:f}=ts(t),[u,N]=(0,p.useState)(!!o),[h,y]=(0,p.useState)(a??"active"),[S,w]=(0,p.useState)(null);(0,p.useEffect)(()=>{new URLSearchParams(window.location.search).get("check")==="1"&&N(!0)},[]);const O=(0,p.useMemo)(()=>(f.data??[]).map(n=>({id:n.id,name:n.name})),[f.data]),k=s(()=>{l.invalidateQueries({queryKey:M.tools.profiles(t)}),l.invalidateQueries({queryKey:M.tools.testAgentAccesses()})},"invalidate"),$=s(n=>String(n?.message??n),"errorBody"),I=L({mutationFn:s(n=>F.duplicateProfile(n.id,{name:`${n.name} (copy)`}),"mutationFn"),onSuccess:s(()=>{c({title:"Profile duplicated",body:"The copy is not assigned to anyone yet.",tone:"success"}),k()},"onSuccess"),onError:s(n=>c({title:"Could not duplicate",body:$(n),tone:"error"}),"onError")}),K=L({mutationFn:s(n=>F.updateProfile(n.id,{status:"archived"}),"mutationFn"),onSuccess:s(()=>{c({title:"Profile archived",tone:"success"}),k()},"onSuccess"),onError:s(n=>c({title:"Could not archive",body:$(n),tone:"error"}),"onError")}),D=L({mutationFn:s(n=>F.updateProfile(n.id,{status:"active"}),"mutationFn"),onSuccess:s(()=>{c({title:"Profile restored",tone:"success"}),k()},"onSuccess"),onError:s(n=>c({title:"Could not restore",body:$(n),tone:"error"}),"onError")}),R=L({mutationFn:s(n=>F.deleteProfile(n.id),"mutationFn"),onSuccess:s(()=>{c({title:"Profile deleted",tone:"success"}),k()},"onSuccess"),onError:s(n=>c({title:"Could not delete",body:$(n),tone:"error"}),"onError")}),A=(0,e.jsx)(Ue,{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)(j,{variant:"outline",onClick:s(()=>N(!0),"onClick"),children:[(0,e.jsx)(qe,{className:"mr-1.5 h-4 w-4"}),"Check an agent's access"]}),(0,e.jsxs)(j,{onClick:s(()=>d(Le()),"onClick"),children:[(0,e.jsx)(Be,{className:"mr-1.5 h-4 w-4"}),"New profile"]})]})}),_=(0,e.jsx)(et,{open:u,onOpenChange:N,children:(0,e.jsxs)(nt,{className:"w-full gap-0 p-0 sm:max-w-xl",children:[(0,e.jsxs)(Xe,{className:"border-b border-border",children:[(0,e.jsx)(ot,{children:"Check an agent's access"}),(0,e.jsx)(tt,{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)(ns,{companyId:t,agentOptions:O})})]})});if(x.isLoading)return(0,e.jsxs)("div",{className:"space-y-5",children:[A,(0,e.jsx)(ye,{label:"Loading profiles…"})]});if(x.isError)return(0,e.jsxs)("div",{className:"space-y-5",children:[A,(0,e.jsx)(Y,{error:x.error,onRetry:s(()=>x.refetch(),"onRetry")})]});const B=(x.data?.profiles??[]).filter(n=>h==="archived"?n.status==="archived":n.status!=="archived");return(0,e.jsxs)("div",{className:"space-y-5",children:[A,(0,e.jsx)("div",{className:"inline-flex rounded-md border border-border p-0.5",children:["active","archived"].map(n=>(0,e.jsx)("button",{type:"button",onClick:s(()=>y(n),"onClick"),className:W("rounded px-3 py-1 text-sm font-medium",h===n?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:n==="active"?"Active":"Archived"},n))}),B.length===0?h==="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)(is,{onPick:s(n=>d(Le(n)),"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:B.map(n=>{const C=Zt(n.summary),q=Wt(n),z=s(()=>d(q?`/apps/advanced/profiles/${n.id}/edit`:`/apps/advanced/profiles/${n.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:z,title:n.name,className:"block w-full truncate text-left font-medium text-foreground hover:underline",children:n.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:Yt(n.summary)}),(n.newToolsPendingCount??0)>0?(0,e.jsxs)(te,{variant:"outline",className:"border-amber-500/50 bg-amber-500/10 text-amber-800 dark:text-amber-200",children:[n.newToolsPendingCount," new"]}):null]})}),(0,e.jsx)("td",{className:"px-3 py-1.5",children:C.unassigned?(0,e.jsxs)("span",{className:"text-muted-foreground",children:[C.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:[n.summary.isCompanyDefault?null:(0,e.jsx)(Ot,{className:"h-3.5 w-3.5 text-muted-foreground"}),C.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)(te,{variant:rs(n.status),children:Xt[n.status]}),q?(0,e.jsx)("button",{type:"button",onClick:z,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)(oe,{value:n.updatedAt})}),(0,e.jsx)("td",{className:"px-3 py-1.5 text-right",children:(0,e.jsx)(os,{onEdit:z,onDuplicate:s(()=>I.mutate(n),"onDuplicate"),onArchive:s(()=>K.mutate(n),"onArchive"),onRestore:n.status==="archived"?()=>w({kind:"restore",profile:n}):void 0,onDelete:s(()=>w({kind:"delete",profile:n}),"onDelete")})})]},n.id)})})]})}),_,(0,e.jsx)(Vt,{kind:S?.kind??null,profile:S?.profile??null,pending:D.isPending||R.isPending,onClose:s(()=>w(null),"onClose"),onArchive:s(()=>{S&&K.mutate(S.profile,{onSuccess:s(()=>w(null),"onSuccess")})},"onArchive"),onRestore:s(()=>{S&&D.mutate(S.profile,{onSuccess:s(()=>w(null),"onSuccess")})},"onRestore"),onDelete:s(()=>{S&&R.mutate(S.profile,{onSuccess:s(()=>w(null),"onSuccess")})},"onDelete")})]})}s(as,"ProfilesIndex");function os({onEdit:t,onDuplicate:a,onArchive:o,onRestore:d,onDelete:l}){return(0,e.jsxs)(kt,{children:[(0,e.jsx)(Kt,{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)(wt,{className:"h-4 w-4"})})}),(0,e.jsxs)(Ct,{align:"end",children:[(0,e.jsx)(X,{onSelect:t,children:"Edit"}),(0,e.jsx)(X,{onSelect:a,children:"Duplicate"}),d?(0,e.jsxs)(X,{onSelect:d,children:[(0,e.jsx)(lt,{className:"mr-1.5 h-4 w-4"}),"Restore"]}):(0,e.jsx)(X,{onSelect:o,children:"Archive"}),(0,e.jsx)(zt,{}),(0,e.jsx)(X,{onSelect:l,className:"text-destructive focus:text-destructive",children:"Delete"})]})]})}s(os,"RowMenu");function is({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:es.map(a=>(0,e.jsxs)("button",{type:"button",onClick:s(()=>t(a.key),"onClick"),className:W("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:a.title}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:a.description})]},a.key))})]})}s(is,"EmptyTemplatePicker");var ee=s(()=>({name:"",clientLabel:"",ownerNote:"",expiresAt:ls(new Date(Date.now()+7776e6)),allowedActions:["tools/list","tools/call"]}),"defaultTokenDraft");function ls(t){return t.toISOString().slice(0,10)}s(ls,"toDateInputValue");function U(t){return t?t.length>12?`${t.slice(0,8)}...`:t:null}s(U,"shortId");function Me(t,a,o=`${a}s`){return`${t} ${t===1?a:o}`}s(Me,"pluralize");function ds(t){if(!t)return null;const a=t instanceof Date?t:new Date(t);return Number.isNaN(a.getTime())?null:a}s(ds,"dateValue");function cs(t){return t.tokens.reduce((a,o)=>{const d=ds(o.lastUsedAt);return d&&(!a||d.getTime()>a.getTime())?d:a},null)}s(cs,"latestTokenActivity");function ms(t,a){return t.agentId?a.get(t.agentId)??`Agent ${U(t.agentId)}`:t.createdByAgentId?a.get(t.createdByAgentId)??`Agent ${U(t.createdByAgentId)}`:t.createdByUserId?`Board user ${U(t.createdByUserId)}`:"Board"}s(ms,"formatOwner");function us(t,a,o){return t.contextScopeType!=="none"&&t.contextScopeId?t.contextScopeType==="project"?`Project ${a.get(t.contextScopeId)??U(t.contextScopeId)}`:t.contextScopeType==="agent"?`Agent ${o.get(t.contextScopeId)??U(t.contextScopeId)}`:`${t.contextScopeType} ${U(t.contextScopeId)}`:t.projectId?`Project ${a.get(t.projectId)??U(t.projectId)}`:t.issueId?`Issue ${U(t.issueId)}`:t.agentId?`Agent ${o.get(t.agentId)??U(t.agentId)}`:"Company"}s(us,"formatScope");function Ie(t){if(!t)return"Profile unavailable";const a=t.summary.allowedToolCount;return t.summary.accessMode==="all_except"?`${Me(Math.max(t.summary.totalToolCount-t.summary.excludedToolCount,0),"tool")} allowed`:a===0?"No tools allowed":`${Me(a,"tool")} allowed`}s(Ie,"formatAllowedTools");function De(t){return JSON.stringify(t,null,2)}s(De,"formatSnippetConfig");function xs(t){return t?`${t}T23:59:59.000Z`:null}s(xs,"buildTokenExpiresAt");function hs({companyId:t}){const a=ve(),{pushToast:o}=je(),[d,l]=(0,p.useState)(!1),[c,x]=(0,p.useState)({name:"",description:"",profileId:""}),[f,u]=(0,p.useState)({}),[N,h]=(0,p.useState)(null),[y,S]=(0,p.useState)({}),[w,O]=(0,p.useState)(null),k=H({queryKey:M.tools.gateways(t),queryFn:s(()=>F.listGateways(t),"queryFn")}),$=H({queryKey:M.tools.profiles(t),queryFn:s(()=>F.listProfiles(t),"queryFn")}),I=H({queryKey:M.agents.list(t),queryFn:s(()=>Pt.list(t),"queryFn")}),K=H({queryKey:M.projects.list(t,{includeArchived:!0}),queryFn:s(()=>Mt.list(t,{includeArchived:!0}),"queryFn")}),D=(0,p.useMemo)(()=>typeof window>"u"?"":window.location.origin,[]),R=$.data?.profiles??[],A=R.filter(r=>r.status!=="archived"),_=(0,p.useMemo)(()=>new Map(R.map(r=>[r.id,r])),[R]),B=(0,p.useMemo)(()=>new Map((I.data??[]).map(r=>[r.id,r.name])),[I.data]),n=(0,p.useMemo)(()=>new Map((K.data??[]).map(r=>[r.id,r.name])),[K.data]),C=s(()=>a.invalidateQueries({queryKey:M.tools.gateways(t)}),"invalidateGateways"),q=L({mutationFn:s(()=>F.createGateway(t,{name:c.name.trim(),description:c.description.trim()||null,profileId:c.profileId,defaultProfileMode:"gateway_only",contextScopeType:"company"}),"mutationFn"),onSuccess:s(async r=>{x({name:"",description:"",profileId:A[0]?.id??""}),l(!1),o({title:"Gateway created",body:r.name,tone:"success"}),await C()},"onSuccess"),onError:s(r=>{o({title:"Gateway was not created",body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")}),z=L({mutationFn:s(async r=>{const g=f[r]??ee();return F.createGatewayToken(t,r,{name:g.name.trim(),clientLabel:g.clientLabel.trim(),ownerNote:g.ownerNote.trim(),allowedActions:g.allowedActions,expiresAt:xs(g.expiresAt)})},"mutationFn"),onSuccess:s(async r=>{S(g=>({...g,[r.gatewayId]:r})),h(null),u(g=>({...g,[r.gatewayId]:ee()})),o({title:"Token issued",body:`${r.name} was created. Copy it now; it will not be shown again.`,tone:"success"}),await C()},"onSuccess"),onError:s(r=>{o({title:"Token was not issued",body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")}),se=L({mutationFn:s(r=>F.revokeGatewayToken(t,r),"mutationFn"),onSuccess:s(async r=>{O(null),o({title:"Token revoked",body:r.name,tone:"success"}),await C()},"onSuccess"),onError:s(r=>{o({title:"Token was not revoked",body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")});async function V(r,g){try{await gt(r),o({title:"Copied to clipboard",body:g,tone:"success"})}catch(Q){o({title:"Copy failed",body:Q instanceof Error?Q.message:"Clipboard access is unavailable.",tone:"error"})}}s(V,"copyText");function i(r){S(g=>{const Q={...g};return delete Q[r],Q}),u(g=>({...g,[r]:g[r]??ee()})),h(r)}s(i,"startIssuing");function v(r){if(r.preventDefault(),!c.profileId){o({title:"Pick a profile",body:"A gateway needs an access profile before it can be created.",tone:"warn"});return}q.mutate()}s(v,"submitCreateGateway");function b(r,g){if(r.preventDefault(),(f[g]??ee()).allowedActions.length===0){o({title:"Pick token actions",body:"Gateway tokens need at least one allowed MCP action.",tone:"warn"});return}z.mutate(g)}if(s(b,"submitCreateToken"),k.isLoading)return(0,e.jsx)(ye,{label:"Loading gateways..."});if(k.isError)return(0,e.jsx)(Y,{error:k.error});const P=k.data?.gateways??[],G=$.isLoading,Z=G||A.length===0||q.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)(Ue,{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)(j,{type:"button",size:"sm",onClick:s(()=>{x(r=>({...r,profileId:r.profileId||A[0]?.id||""})),l(r=>!r)},"onClick"),disabled:G,children:[(0,e.jsx)(Be,{className:"mr-1.5 h-3.5 w-3.5"}),"Create gateway"]})]}),d?(0,e.jsxs)("form",{className:"space-y-3 rounded-md border border-border p-4",onSubmit:v,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:c.name,onChange:s(r=>x(g=>({...g,name:r.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:c.profileId,onChange:s(r=>x(g=>({...g,profileId:r.target.value})),"onChange"),required:!0,disabled:A.length===0,children:[(0,e.jsx)("option",{value:"",disabled:!0,children:G?"Loading profiles...":"Choose a profile"}),A.map(r=>(0,e.jsxs)("option",{value:r.id,children:[r.name," - ",Ie(r)]},r.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:c.description,onChange:s(r=>x(g=>({...g,description:r.target.value})),"onChange"),placeholder:"Who this endpoint is for and when it should be rotated."})]}),A.length===0&&!G?(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)(j,{type:"button",variant:"ghost",size:"sm",onClick:s(()=>l(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(j,{type:"submit",size:"sm",disabled:Z||!c.name.trim()||!c.profileId,children:q.isPending?"Creating...":"Create gateway"})]})]}):null,P.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:P.map(r=>{const g=`${D}${r.endpointPath}`,Q=r.clientSnippets??[],ce=_.get(r.profileId),we=cs(r),T=f[r.id]??ee(),ne=y[r.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)(pt,{className:"h-4 w-4 text-muted-foreground"}),(0,e.jsx)("h3",{className:"truncate text-sm font-semibold text-foreground",children:r.name}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:r.status})]}),r.description?(0,e.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:r.description}):null]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsxs)(j,{type:"button",variant:"outline",size:"sm",onClick:s(()=>{V(g,"Gateway endpoint")},"onClick"),children:[(0,e.jsx)(he,{className:"mr-1.5 h-3.5 w-3.5"}),"Copy endpoint"]}),(0,e.jsxs)(j,{type:"button",variant:"outline",size:"sm",onClick:s(()=>i(r.id),"onClick"),children:[(0,e.jsx)(be,{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:g}),(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:ms(r,B)})]}),(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:us(r,n,B)})]}),(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:ce?`${Ie(ce)} via ${ce.name}`:`Profile ${U(r.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:we?(0,e.jsx)(oe,{value:we}):"Never used"})]})]}),N===r.id?(0,e.jsxs)("form",{className:"space-y-3 rounded-md border border-border p-3",onSubmit:s(m=>b(m,r.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:T.name,onChange:s(m=>u(E=>({...E,[r.id]:{...T,name:m.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:T.clientLabel,onChange:s(m=>u(E=>({...E,[r.id]:{...T,clientLabel:m.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:T.ownerNote,onChange:s(m=>u(E=>({...E,[r.id]:{...T,ownerNote:m.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:T.expiresAt,onChange:s(m=>u(E=>({...E,[r.id]:{...T,expiresAt:m.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(m=>(0,e.jsxs)("label",{className:"flex items-center gap-2 text-muted-foreground",children:[(0,e.jsx)("input",{type:"checkbox",checked:T.allowedActions.includes(m),onChange:s(E=>{const me=E.target.checked?Array.from(new Set([...T.allowedActions,m])):T.allowedActions.filter(ue=>ue!==m);u(ue=>({...ue,[r.id]:{...T,allowedActions:me}}))},"onChange")}),m]},m))}),(0,e.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,e.jsx)(j,{type:"button",variant:"ghost",size:"sm",onClick:s(()=>h(null),"onClick"),children:"Cancel"}),(0,e.jsx)(j,{type:"submit",size:"sm",disabled:z.isPending||!T.name.trim()||!T.clientLabel.trim()||!T.ownerNote.trim()||!T.expiresAt,children:z.isPending?"Issuing...":"Issue token"})]})]}):null,ne?(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 ",ne.name]}),(0,e.jsxs)(j,{type:"button",variant:"outline",size:"sm",onClick:s(()=>{V(ne.token,"Gateway bearer token")},"onClick"),children:[(0,e.jsx)(he,{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:ne.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)(be,{className:"h-3.5 w-3.5"}),"Tokens"]}),(0,e.jsx)("div",{className:"space-y-1 text-sm",children:r.tokens.length===0?(0,e.jsx)("p",{className:"text-muted-foreground",children:"No tokens issued."}):r.tokens.map(m=>{const E=!!m.revokedAt,me=w===m.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:m.name}),(0,e.jsxs)("div",{className:"text-xs text-muted-foreground",children:[m.clientLabel||m.tokenPrefix," · ",m.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:m.revokedAt?(0,e.jsxs)(e.Fragment,{children:["revoked ",(0,e.jsx)(oe,{value:m.revokedAt})]}):m.expiresAt?(0,e.jsxs)(e.Fragment,{children:["expires ",(0,e.jsx)(oe,{value:m.expiresAt})]}):"no expiry"}),E?null:(0,e.jsxs)(j,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:s(()=>O(m.id),"onClick"),"aria-label":`Revoke ${m.name}`,children:[(0,e.jsx)($e,{className:"mr-1 h-3.5 w-3.5"}),"Revoke"]})]})]}),me?(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)(j,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:s(()=>O(null),"onClick"),children:[(0,e.jsx)(ie,{className:"mr-1 h-3.5 w-3.5"}),"Cancel"]}),(0,e.jsxs)(j,{type:"button",variant:"destructive",size:"sm",className:"h-7 px-2",onClick:s(()=>se.mutate(m.id),"onClick"),disabled:se.isPending,children:[(0,e.jsx)(le,{className:"mr-1 h-3.5 w-3.5"}),"Confirm"]})]}):null]},m.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:Q.length===0?(0,e.jsx)("p",{className:"text-muted-foreground",children:"No snippets available."}):Q.map(m=>(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)(_t,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate",children:m.label})]}),(0,e.jsxs)(j,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:s(E=>{E.preventDefault(),V(De(m.config),`${m.label} snippet`)},"onClick"),children:[(0,e.jsx)(he,{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:De(m.config)}),m.notes.length>0?(0,e.jsx)("div",{className:"mt-2 space-y-1 text-xs text-muted-foreground",children:m.notes.map(E=>(0,e.jsx)("div",{children:E},E))}):null]},m.client))})]})]})]},r.id)})})]})}s(hs,"GatewaysTab");function ps(){return(0,e.jsxs)(St,{children:[(0,e.jsx)(Qt,{asChild:!0,children:(0,e.jsx)(j,{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)($t,{className:"h-4 w-4"})})}),(0,e.jsxs)(Bt,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(Et,{children:[(0,e.jsx)(Ht,{children:"Ask an agent for an MCP config"}),(0,e.jsx)(Ft,{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:ss.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)(_e,{id:"mcp-config-help-prompt",readOnly:!0,value:Ee,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)(Ve,{prompt:Ee,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(ps,"McpConfigHelpDialog");var fs=`{
33
+ "mcpServers": {
34
+ "github": {
35
+ "command": "npx -y @modelcontextprotocol/server-github",
36
+ "env": { "GITHUB_TOKEN": "ghp_..." }
37
+ }
38
+ }
39
+ }`;function gs(t){const a=t.replace(/[_-]+/g," ").trim().toLowerCase();return a?a.charAt(0).toUpperCase()+a.slice(1):"Key"}s(gs,"humanizeKey");function bs(t){const a=t.credentialFields.length||t.credentialRefs.length,o=t.transport==="local_stdio"?"Runs in your workspace":"Connects over the web";return a===0?`${o} · no keys needed`:`${o} · needs ${a} ${a===1?"key":"keys"}`}s(bs,"draftSummary");function pe(t){if(t.transport!=="mcp_remote")return null;const a=t.config?.url;if(typeof a!="string")return null;try{const o=new URL(a.trim());return o.protocol!=="http:"&&o.protocol!=="https:"?null:o.toString()}catch{return null}}s(pe,"draftConnectUrl");function de(t,a){return`${t.name}::${a}`}s(de,"credentialValueKey");function js(t,a){const o={};for(const d of t.credentialFields){const l=a[de(t,d.configPath)]?.trim();l&&(o[d.configPath]=l)}return o}s(js,"credentialValuesForDraft");function vs(t,a){return t.credentialFields.filter(o=>o.required).filter(o=>!a[de(t,o.configPath)]?.trim()).map(o=>o.configPath)}s(vs,"missingCredentialFields");function He(t){const a=t.suggestedDefaults?.askFirstRiskLevels;return Array.isArray(a)?a.filter(o=>typeof o=="string"):[]}s(He,"askFirstLevelsFrom");function Ns({companyId:t}){const a=Ge(),[o,d]=(0,p.useState)(""),[l,c]=(0,p.useState)(null),[x,f]=(0,p.useState)({}),[u,N]=(0,p.useState)({}),[h,y]=(0,p.useState)(null),[S,w]=(0,p.useState)({}),[O,k]=(0,p.useState)(null),[$,I]=(0,p.useState)("entry"),[K,D]=(0,p.useState)(null),[R,A]=(0,p.useState)(null),_=L({mutationFn:s(i=>F.importMcpJson(t,{mcpJson:i}),"mutationFn"),onSuccess:s(i=>{c(i),f(Object.fromEntries(i.drafts.map(v=>[v.name,v.name]))),y(null),k(null)},"onSuccess")}),B=s(async(i,v)=>{try{const b=await We({authorizationUrl:i,handoff:v});b.kind==="reauthentication"&&v&&Je(v.session),A(b.host),I(b.kind==="authorization"?"redirecting":"starting"),Lt(b.url)}catch(b){I("error"),D(b instanceof Error?b.message:"Paperclip couldn’t start secure sign-in. Try again.")}},"openAuthorizationPage"),n=L({mutationFn:s(i=>F.startOAuth(i),"mutationFn"),onSuccess:s(i=>{B(i.authorizationUrl,i.handoff)},"onSuccess"),onError:s(i=>{I("error"),D(i instanceof Error?i.message:"Paperclip couldn’t start secure sign-in. Try again.")},"onError")}),C=L({mutationFn:s(i=>{const v=pe(i);if(!v)throw new Error("Only remote HTTP drafts can be checked and activated from pasted config.");return F.connectApp(t,{link:v,name:x[i.name]?.trim()||i.name,credentialValues:js(i,u)})},"mutationFn"),onSuccess:s(i=>{if(y(i),i.auth?.kind==="oauth"){if(k(null),A(null),D(null),i.auth.manualClientRequired){I("error"),D("This server requires OAuth client details from its provider settings. Continue in setup to add them.");return}const b=i.auth.startUrl?.trim();b?B(b,i.auth.handoff):(I("starting"),n.mutate(i.connectionId));return}const v={};for(const b of i.actions.readOnly)v[b.catalogEntryId]=!0;for(const b of i.actions.canMakeChanges)v[b.catalogEntryId]=!0;w(v),k(null)},"onSuccess")}),q=L({mutationFn:s(()=>{const i=h?He(h):[],v=Object.entries(S).filter(([,P])=>P).map(([P])=>P),b=(h?.actions.canMakeChanges??[]).filter(P=>S[P.catalogEntryId]&&i.includes(P.riskLevel)).map(P=>P.catalogEntryId);return F.finishApp(t,h.connectionId,{enabledCatalogEntryIds:v,askFirstCatalogEntryIds:b,access:"all_agents"})},"mutationFn"),onSuccess:s(()=>k(h?.application.name??"Imported app"),"onSuccess")}),z=l?.drafts??[],se=o.trim().length>0&&!_.isPending,V=(0,p.useMemo)(()=>{const i=o.trim();if(!i)return null;try{return JSON.parse(i),null}catch{return"That doesn't look like valid JSON yet — paste the whole snippet, including the outer braces."}},[o]);if(h?.auth?.kind==="oauth"){const i=typeof h.connection.config?.url=="string"?h.connection.config.url:typeof h.connection.transportConfig?.url=="string"?h.connection.transportConfig.url:"";return(0,e.jsx)(it,{identity:{name:h.application.name,unverifiedHost:st(i)},phase:$,error:K,authorizationHost:R,onRetry:s(()=>{D(null),A(null),I("starting"),n.mutate(h.connectionId)},"onRetry"),onBack:s(()=>a(`/apps/${h.connectionId}/permissions`),"onBack"),onCancel:s(()=>a("/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)(ps,{})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Just a URL?"," ",(0,e.jsx)(yt,{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)(_e,{value:o,onChange:s(i=>{d(i.target.value),l&&c(null),y(null),k(null)},"onChange"),spellCheck:!1,rows:10,placeholder:fs,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"}),V?(0,e.jsx)("p",{className:"text-xs text-amber-600",children:V}):(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)(j,{onClick:s(()=>_.mutate(o),"onClick"),disabled:!se||!!V,children:_.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."})]}),_.isError?(0,e.jsx)(Y,{error:_.error}):null,l?z.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)(Dt,{className:"h-4 w-4 text-emerald-600"}),"We found ",z.length," ",z.length===1?"app":"apps"," in that config"]}),z.map((i,v)=>{const b=pe(i),P=vs(i,u);return(0,e.jsx)(ys,{draft:i,connectionName:x[i.name]??i.name,onConnectionNameChange:s(G=>f(Z=>({...Z,[i.name]:G})),"onConnectionNameChange"),credentialValues:u,onCredentialChange:s((G,Z)=>N(r=>({...r,[de(i,G)]:Z})),"onCredentialChange"),checking:C.isPending&&C.variables?.name===i.name,canCheck:!!b&&P.length===0,onCheck:b?()=>C.mutate(i):void 0},`${i.name}-${v}`)}),z.some(i=>pe(i))?(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,C.isError?(0,e.jsx)(Y,{error:C.error}):null,h?(0,e.jsx)(ws,{result:h,enabled:S,onToggle:s((i,v)=>w(b=>({...b,[i]:v})),"onToggle"),onBulk:s((i,v)=>w(b=>{const P={...b};for(const G of i)P[G]=v;return P}),"onBulk"),finishing:q.isPending,activatedName:O,onFinish:s(()=>q.mutate(),"onFinish")}):null,q.isError?(0,e.jsx)(Y,{error:q.error}):null]})}s(Ns,"PasteConfigTab");function ys({draft:t,connectionName:a,onConnectionNameChange:o,credentialValues:d,onCredentialChange:l,checking:c,canCheck:x,onCheck:f}){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:bs(t)})]}),f?(0,e.jsxs)(j,{size:"sm",className:"shrink-0",onClick:f,disabled:c||!x,children:[c?(0,e.jsx)(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,"Check actions"]}):null]}),f?(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)(Te,{value:a,onChange:s(u=>o(u.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(u=>(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)(be,{className:"h-3.5 w-3.5 text-muted-foreground"}),gs(u.label||u.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:u.key}),(0,e.jsx)(Te,{type:"password",value:d[de(t,u.configPath)]??"",onChange:s(N=>l(u.configPath,N.target.value),"onChange"),placeholder:"Paste replacement value",className:"h-8 max-w-sm text-xs"})]})]},`${u.configPath}-${u.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((u,N)=>(0,e.jsx)("li",{className:"text-xs text-amber-600",children:u},N))}):null]})}s(ys,"DraftCard");function ws({result:t,enabled:a,onToggle:o,onBulk:d,finishing:l,activatedName:c,onFinish:x}){const f=He(t),u=Object.values(a).filter(Boolean).length,N=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)(qe,{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)(j,{size:"sm",onClick:x,disabled:l||u===0||!!c,children:[l?(0,e.jsx)(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,"Activate ",u," of ",N]})]}),(0,e.jsx)(Re,{title:"Read-only",actions:t.actions.readOnly,enabled:a,onToggle:o,onBulk:s(h=>d(t.actions.readOnly.map(y=>y.catalogEntryId),h),"onBulk"),askFirstLevels:f}),(0,e.jsx)(Re,{title:"Can make changes",actions:t.actions.canMakeChanges,enabled:a,onToggle:o,onBulk:s(h=>d(t.actions.canMakeChanges.map(y=>y.catalogEntryId),h),"onBulk"),askFirstLevels:f}),c?(0,e.jsxs)("p",{className:"text-xs font-medium text-emerald-700",children:[c," is active for all agents."]}):null]})}s(ws,"CatalogReview");function Re({title:t,actions:a,enabled:o,onToggle:d,onBulk:l,askFirstLevels:c}){return a.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)(j,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:s(()=>l(!0),"onClick"),children:"Turn all on"}),(0,e.jsx)(j,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:s(()=>l(!1),"onClick"),children:"Turn all off"})]})]}),(0,e.jsx)("div",{className:"divide-y divide-border rounded-lg border border-border",children:a.map(x=>{const f=o[x.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:x.title||x.toolName}),(0,e.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:c.includes(x.riskLevel)?"Ask first when enabled":x.riskLevel})]}),(0,e.jsx)(At,{checked:f,onCheckedChange:s(u=>d(x.catalogEntryId,u),"onCheckedChange")})]},x.catalogEntryId)})})]})}s(Re,"ActionGroup");var ks="smoke@paperclip.test",Cs="smoke-password";function fe(t){if(!t)return"—";const a=new Date(t);return Number.isNaN(a.getTime())?"—":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(a)}s(fe,"formatTime");function ge(t){return t==="running"?"success":t==="error"?"error":"muted"}s(ge,"serviceTone");function Ss({status:t}){return t==="pass"?(0,e.jsx)(le,{className:"mx-auto h-4 w-4 text-emerald-600 dark:text-emerald-400","aria-label":"pass"}):t==="fail"?(0,e.jsx)(ie,{className:"mx-auto h-4 w-4 text-destructive","aria-label":"fail"}):t==="skipped"?(0,e.jsx)(ze,{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(Ss,"CellGlyph");var As={green:"bg-emerald-500",amber:"bg-amber-500",red:"bg-destructive",unknown:"bg-muted-foreground/40"};function Ps({companyId:t}){const{enabled:a,loaded:o}=It(),d=ve(),{pushToast:l}=je(),[c,x]=(0,p.useState)(null),f=H({queryKey:M.smokeLab.services(t),queryFn:s(()=>J.listServices(t),"queryFn"),enabled:a&&o,refetchInterval:a?1e4:!1}),u=H({queryKey:M.smokeLab.runs(t),queryFn:s(()=>J.listRuns(t),"queryFn"),enabled:a&&o,refetchInterval:a?1e4:!1}).data?.runs??[],N=c??u[0]?.id??null,h=H({queryKey:M.smokeLab.run(t,N??"__none__"),queryFn:s(()=>J.getRun(t,N),"queryFn"),enabled:a&&o&&!!N,refetchInterval:a&&N?1e4:!1}),y=(0,p.useMemo)(()=>h.data?.steps??[],[h.data]),S=(0,p.useMemo)(()=>ct(y),[y]),w=h.data?.run;function O(){d.invalidateQueries({queryKey:M.smokeLab.services(t)}),d.invalidateQueries({queryKey:M.smokeLab.runs(t)}),N&&d.invalidateQueries({queryKey:M.smokeLab.run(t,N)})}s(O,"refresh");const k=L({mutationFn:s(()=>J.startServices(t),"mutationFn"),onSuccess:s(()=>{l({title:"Smoke services started",tone:"success"}),O()},"onSuccess"),onError:s(n=>l({title:"Couldn't start services",body:n.message,tone:"error"}),"onError")}),$=L({mutationFn:s(()=>J.stopServices(t),"mutationFn"),onSuccess:s(()=>{l({title:"Smoke services stopped",tone:"info"}),O()},"onSuccess"),onError:s(n=>l({title:"Couldn't stop services",body:n.message,tone:"error"}),"onError")}),I=L({mutationFn:s(()=>J.installFixtures(t),"mutationFn"),onSuccess:s(n=>{l({title:n.created?"Fixture apps installed":"Fixture apps already present",tone:"success"}),O()},"onSuccess"),onError:s(n=>l({title:"Couldn't install fixtures",body:n.message,tone:"error"}),"onError")}),K=L({mutationFn:s(()=>J.reset(t),"mutationFn"),onSuccess:s(()=>{l({title:"Smoke Lab reset",tone:"info"}),x(null),O()},"onSuccess"),onError:s(n=>l({title:"Couldn't reset",body:n.message,tone:"error"}),"onError")}),D=L({mutationFn:s(()=>J.createRun(t,{trigger:"manual",summary:{}}),"mutationFn"),onSuccess:s(n=>{l({title:"Smoke run started",body:"The browser runner records each step as it completes.",tone:"success"}),x(n.run.id),O()},"onSuccess"),onError:s(n=>l({title:"Couldn't start a run",body:n.message,tone:"error"}),"onError")}),R=k.isPending||$.isPending||I.isPending||K.isPending||D.isPending;if(o&&!a)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)(Ae,{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(!o)return(0,e.jsx)("div",{className:"p-6 text-sm text-muted-foreground",children:"Loading Smoke Lab…"});const A=f.data?.services??[],_=xt(w,y),B=ut(y);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)(Ae,{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)(te,{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)(jt,{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)(Ze,{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)(j,{size:"sm",onClick:s(()=>k.mutate(),"onClick"),disabled:R,children:[(0,e.jsx)(ft,{className:"h-4 w-4"})," Start services"]}),(0,e.jsx)(j,{size:"sm",variant:"outline",onClick:s(()=>$.mutate(),"onClick"),disabled:R,children:"Stop"}),(0,e.jsx)(j,{size:"sm",variant:"outline",onClick:s(()=>I.mutate(),"onClick"),disabled:R,children:"Install fixture apps"}),(0,e.jsxs)(j,{size:"sm",variant:"ghost",onClick:s(()=>K.mutate(),"onClick"),disabled:R,children:[(0,e.jsx)($e,{className:"h-4 w-4"})," Reset"]})]})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[A.map(n=>(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:n.label}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:n.detail??n.id})]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium",children:[(0,e.jsx)("span",{className:W("h-2 w-2 rounded-full",n.status==="running"?"bg-emerald-500":n.status==="error"?"bg-destructive":"bg-muted-foreground/40")}),(0,e.jsx)("span",{className:W(ge(n.status)==="success"&&"text-emerald-600 dark:text-emerald-400",ge(n.status)==="error"&&"text-destructive",ge(n.status)==="muted"&&"text-muted-foreground"),children:n.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:n.url??(0,e.jsx)("span",{className:"text-muted-foreground",children:"not running"})})]})})]},n.id)),A.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: ",ks]}),(0,e.jsxs)("span",{children:["password: ",Cs]})]})]})]}),(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)(le,{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)(ie,{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)(ze,{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"}),Se.map(n=>(0,e.jsx)("th",{className:"px-2 py-2 text-center font-medium text-muted-foreground",children:n.label},n.key))]})}),(0,e.jsx)("tbody",{children:mt.map(n=>(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:n}),(0,e.jsx)("span",{className:"ml-2 text-foreground",children:Ce[n].title}),(0,e.jsx)("span",{className:"block text-(length:--text-micro) font-normal text-muted-foreground",children:Ce[n].detail})]}),Se.map(C=>{const q=S.get(dt(n,C.key));return(0,e.jsx)("td",{className:"px-2 py-2 text-center",children:(0,e.jsx)(Ss,{status:q?.status??"not-run"})},C.key)})]},n))})]})}),y.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:W("h-2 w-2 rounded-full",As[_])}),_==="unknown"?"no runs yet":_,B.length>0&&` · failing: ${B.join(", ")}`]})]}),(0,e.jsxs)(j,{size:"sm",onClick:s(()=>D.mutate(),"onClick"),disabled:R,children:[D.isPending?(0,e.jsx)(Ne,{className:"h-4 w-4 animate-spin"}):(0,e.jsx)(vt,{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:[u.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:u.map(n=>{const C=n.id===N;return(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",onClick:s(()=>x(n.id),"onClick"),className:W("flex w-full items-center justify-between gap-2 px-3 py-2.5 text-left transition-colors hover:bg-accent/50",C&&"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:fe(n.startedAt)}),(0,e.jsx)("span",{className:"block text-(length:--text-micro) text-muted-foreground",children:n.trigger})]}),(0,e.jsx)(ke,{status:n.status})]})},n.id)})})]}),(0,e.jsxs)("div",{className:"min-w-0 rounded-lg border border-border",children:[!w&&(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:"Select a run to see its steps."}),w&&(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 ",fe(w.startedAt)," · finished ",fe(w.finishedAt)]}),(0,e.jsx)(ke,{status:w.status})]}),y.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:y.map(n=>(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:n.status==="pass"?(0,e.jsx)(le,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}):n.status==="fail"?(0,e.jsx)(ie,{className:"h-4 w-4 text-destructive"}):(0,e.jsx)(ht,{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:n.path})," · ",n.scenarioStep]}),n.detail&&(0,e.jsx)("p",{className:"mt-0.5 break-words text-(length:--text-micro) text-muted-foreground",children:n.detail}),n.screenshotArtifactRef&&typeof n.screenshotArtifactRef.url=="string"&&(0,e.jsx)("a",{href:n.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 n.durationMs=="number"&&(0,e.jsxs)("span",{className:"shrink-0 text-(length:--text-micro) tabular-nums text-muted-foreground",children:[n.durationMs,"ms"]})]},n.id))})]})]})]})]})]})}s(Ps,"SmokeLabTab");function Fe(t,a){switch(t){case"profiles":return(0,e.jsx)(as,{companyId:a});case"gateways":return(0,e.jsx)(hs,{companyId:a});case"smoke-lab":return(0,e.jsx)(Ps,{companyId:a});default:return(0,e.jsx)(Ns,{companyId:a})}}s(Fe,"renderTab");function Ts(){const{selectedCompany:t,selectedCompanyId:a}=Ke(),{setBreadcrumbs:o}=Gt(),d=bt(),l=Pe.find(f=>f.key===d.tab)?.key??"paste-config",c=Rt(l),x=Pe.find(f=>f.key===l)?.label;return(0,p.useEffect)(()=>(o([{label:t?.name??"Company",href:"/dashboard"},{label:"Apps",href:"/apps"},...c?[{label:"Advanced setup"}]:[{label:"Advanced setup",href:xe("paste-config")},{label:x??"Developer tools"}]]),()=>o([])),[o,t?.name,c,x]),a?d.tab==="run-your-own"?(0,e.jsx)(re,{to:"/apps",replace:!0}):d.tab==="applications"||d.tab==="connections"||d.tab==="overview"||d.tab==="examples"||d.tab==="audit"?(0,e.jsx)(re,{to:"/apps",replace:!0}):d.tab==="runtime"?(0,e.jsx)(re,{to:"/apps",replace:!0}):d.tab==="policies"?(0,e.jsx)(re,{to:"/apps/advanced/profiles",replace:!0}):c?(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)(ae,{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:Ut.map(f=>(0,e.jsx)(ae,{to:xe(f.key),className:W("-mb-px border-b-2 pb-2 text-sm transition-colors",f.key===l?"border-foreground font-bold text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:f.label},f.key))}),(0,e.jsx)("div",{className:"min-h-(--sz-300px)",children:Fe(l,a)}),(0,e.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)(Tt,{className:"h-3.5 w-3.5"}),"Looking for the developer surface?"," ",(0,e.jsx)(ae,{to:xe("profiles"),className:"font-medium text-primary hover:underline",children:"Open developer tools"})]})]}):(0,e.jsx)("div",{className:"max-w-5xl",children:Fe(l,a)}):(0,e.jsx)("div",{className:"p-6 text-sm text-muted-foreground",children:"Select an organization to open advanced setup."})}s(Ts,"ToolsAccess");function $s(){const{selectedCompanyId:t}=Ke(),a=H({queryKey:M.access.currentBoardAccess,queryFn:s(()=>Nt.getCurrentBoardAccess(),"queryFn"),retry:!1});if(a.isLoading)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-muted-foreground",children:"Loading…"});const o=a.data,d=o?.memberships?.find(l=>l.companyId===t&&l.status==="active");return o?.source==="local_implicit"||o?.isInstanceAdmin||d?.membershipRole==="owner"||d?.membershipRole==="admin"||d?.membershipRole==="operator"||d?.membershipRole==="member"?(0,e.jsx)(Ts,{}):(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)(Ye,{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)(ae,{to:"/apps",className:"font-medium text-primary hover:underline",children:"your apps"}),"."]})]})})}s($s,"AdvancedToolsRoute");export{$s as AdvancedToolsRoute};
@@ -0,0 +1 @@
1
+ var pe=Object.defineProperty;var i=(e,n)=>pe(e,"name",{value:n,configurable:!0});import{a as H}from"./rolldown-runtime-DhZMWcEn.js";import{Kn as me,qs as fe,tc as he}from"./issue-detail-ls2AWc8k.js";import{Ar as ye,Gf as V,Gm as xe,Qm as E,Rf as ve,Vp as je,Wc as be,Wf as Ce,Wl as ge,_m as we,cd as Ne,ch as Ae,cp as Se,dd as ke,du as Re,eu as c,fh as J,fu as Pe,gu as Te,hu as _e,ju as De,lh as x,lm as qe,lu as Ee,mu as Fe,my as Oe,nf as d,od as Ke,pu as Qe,qp as U,uu as Be,yy as Ie}from"./index-Hy6BKS-o.js";var p=H(Ie(),1),$e=["instructionsBundleMode","instructionsRootPath","instructionsEntryFile","instructionsFilePath","agentsMdPath","promptTemplate","bootstrapPromptTemplate"];function F(e){return e?JSON.parse(JSON.stringify(e)):{}}i(F,"cloneRecord");function Y(e){return`${e.trim()||"Agent"} Copy`}i(Y,"duplicateAgentName");function Me(e,n){const r=F(e.adapterConfig);for(const m of $e)delete r[m];const a={name:Y(e.name),role:e.role,adapterType:e.adapterType,adapterConfig:r,runtimeConfig:F(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=F(e.metadata)),n&&Object.keys(n.files).length>0&&(a.instructionsBundle=n),a}i(Me,"buildDuplicateAgentPayload");var s=H(Oe(),1);function Ge({onClick:e,disabled:n,label:r="Run now",size:a="sm"}){return(0,s.jsxs)(x,{variant:"outline",size:a,onClick:e,disabled:n,children:[(0,s.jsx)(V,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:r})]})}i(Ge,"RunButton");function Le({isPaused:e,onPause:n,onResume:r,disabled:a,size:m="sm"}){return e?(0,s.jsxs)(x,{variant:"outline",size:m,onClick:r,disabled:a,children:[(0,s.jsx)(V,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Resume"})]}):(0,s.jsxs)(x,{variant:"outline",size:m,onClick:n,disabled:a,children:[(0,s.jsx)(he,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Pause"})]})}i(Le,"PauseResumeButton");function We({onClick:e,disabled:n,size:r="sm"}){return(0,s.jsxs)(x,{variant:"outline",size:r,onClick:e,disabled:n,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)(qe,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"Clear error"})]})}i(We,"ClearErrorButton");function Je(e,n){return n.deprecated||n.virtual?null:n.path}i(Je,"duplicateInstructionFilePath");async function Ue(e,n){const r=await c.instructionsBundle(e,n),a={};for(const C of r.files){const g=Je(r,C);g&&(a[g]=(await c.instructionsFile(e,C.path,n)).content)}const m=Object.prototype.hasOwnProperty.call(a,r.entryFile)?r.entryFile:Object.keys(a)[0]??"AGENTS.md";return Object.keys(a).length>0?{entryFile:m,files:a}:null}i(Ue,"loadDuplicateInstructionsBundle");function Ze({agent:e,companyId:n,size:r="sm",assignLabel:a="Assign Task",runLabel:m="Run now",showStatus:C=!0,showRun:g=!0,actionsDisabled:X=!1,workActionsDisabled:k=!1,workActionsDisabledReason:Z,navigateToRunOnInvoke:O=!0,hasPendingNavigationChanges:K=!1,onBeforeNavigate:Q,onActionError:f,onTerminateSuccess:B,pauseConfirm:w,hideTerminate:z=!1,children:ee,className:se}){const R=De(),o=Ae(),{openNewIssue:te}=ge(),{pushToast:v}=be(),[ie,j]=(0,p.useState)(!1),[ne,I]=(0,p.useState)(!1),P=(0,p.useRef)(K),T=(0,p.useRef)(Q),N=(0,p.useRef)(!1),$=(0,p.useRef)(!1);P.current=K,T.current=Q;function _(t){return t.current=P.current,T.current?.()!==!1}i(_,"confirmNavigationStart");function D(t){return!P.current||t.current||T.current?.()!==!1}i(D,"confirmLateNavigationChanges");const l=n??e.companyId,q=J(e),M=e.lifecycleState?e.lifecycleState==="paused":e.status==="paused",ae=e.status==="error",G=(0,p.useCallback)(t=>{f?f(t):v({title:"Action failed",body:t,tone:"error"})},[f,v]),re=(0,p.useCallback)(()=>{o.invalidateQueries({queryKey:d.agents.detail(e.id)}),o.invalidateQueries({queryKey:d.agents.detail(q)}),o.invalidateQueries({queryKey:d.agents.runtimeState(e.id)}),o.invalidateQueries({queryKey:d.agents.taskSessions(e.id)}),l&&(o.invalidateQueries({queryKey:d.agents.list(l)}),o.invalidateQueries({queryKey:d.liveRuns(l)}),o.invalidateQueries({queryKey:d.heartbeats(l,e.id)}))},[e.id,q,o,l]),h=E({mutationFn:i(async t=>{switch(t){case"invoke":return c.invoke(e.id,l??void 0);case"pause":return c.pause(e.id,l??void 0);case"resume":return c.resume(e.id,l??void 0);case"clear_error":return c.clearError(e.id,l??void 0);case"approve":return c.approve(e.id,l??void 0);case"terminate":return c.terminate(e.id,l??void 0)}},"mutationFn"),onSuccess:i((t,u)=>{if(f?.(null),re(),u==="terminate"){const y=t.lifecycleState;if(y==="terminating"||y==="cleaning_up"||!D(N))return;B?.(t)}if(u==="invoke"&&O&&t&&typeof t=="object"&&"id"in t){if(!D(N))return;R(`/agents/${q}/runs/${t.id}`)}},"onSuccess"),onError:i(t=>{G(t instanceof Error?t.message:"Action failed")},"onError")}),b=E({mutationFn:i(async()=>{if(!l)throw new Error("Agent is not ready to duplicate");const t=await Ue(e.id,l),u=Me(e,t);try{return await c.create(l,u)}catch(y){if(y instanceof xe&&y.status===409&&y.message.includes("requires board approval"))return(await c.hire(l,u)).agent;throw y}},"mutationFn"),onSuccess:i(async t=>{f?.(null),l&&await o.invalidateQueries({queryKey:d.agents.list(l)}),v({title:"Agent duplicated",body:t.name,tone:"success"}),D($)&&R(`/agents/${J(t)}/dashboard`)},"onSuccess"),onError:i(t=>{const u=t instanceof Error?t.message:"Failed to duplicate agent";f?.(u),v({title:"Could not duplicate agent",body:u,tone:"error"})},"onError")}),le=(0,p.useCallback)(()=>{if(b.isPending)return;const t=Y(e.name),u=window.confirm(`Duplicate ${e.name} as ${t}?`);j(!1),!(!u||!_($))&&b.mutate()},[e.name,b]),oe=E({mutationFn:i(()=>c.resetSession(e.id,null,l??void 0),"mutationFn"),onSuccess:i(()=>{f?.(null),o.invalidateQueries({queryKey:d.agents.runtimeState(e.id)}),o.invalidateQueries({queryKey:d.agents.taskSessions(e.id)})},"onSuccess"),onError:i(t=>{G(t instanceof Error?t.message:"Failed to reset session")},"onError")}),L=e.status==="pending_approval",A=X||h.isPending,W=A||L||k||e.status==="terminated",ce=A||L||M&&k||!!(e.lifecycleState&&["pausing","terminating","cleaning_up","terminated","rejected"].includes(e.lifecycleState)),ue=A,S=e.runtimeConfig,de=(S&&typeof S.debug=="object"&&S.debug!==null?S.debug:null)?.providerTrace==="raw";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)(we,{className:"h-3.5 w-3.5"}),"Raw tracing on"]}):null,(0,s.jsxs)(x,{variant:"outline",size:r,onClick:i(()=>te({assigneeAgentId:e.id}),"onClick"),disabled:W,title:k?Z:void 0,children:[(0,s.jsx)(Ce,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:a})]}),g&&(0,s.jsx)(Ge,{onClick:i(()=>{O&&!_(N)||h.mutate("invoke")},"onClick"),disabled:W,label:m,size:r}),ae?(0,s.jsx)(We,{onClick:i(()=>h.mutate("clear_error"),"onClick"),disabled:ue,size:r}):e.pauseReason==="setup"&&e.lifecycleState==="paused"?(0,s.jsx)(x,{variant:"outline",size:r,disabled:A,onClick:i(()=>R(`/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"}:{}})}`),"onClick"),children:"Finish setup"}):(0,s.jsx)(Le,{isPaused:M,onPause:i(()=>w?I(!0):h.mutate("pause"),"onPause"),onResume:i(()=>h.mutate("resume"),"onResume"),disabled:ce,size:r}),w&&(0,s.jsx)(Ee,{open:ne,onOpenChange:I,children:(0,s.jsxs)(Pe,{children:[(0,s.jsxs)(_e,{children:[(0,s.jsx)(Te,{children:w.title}),(0,s.jsx)(Qe,{asChild:!0,children:(0,s.jsx)("div",{children:w.description})})]}),(0,s.jsxs)(Fe,{children:[(0,s.jsx)(Re,{children:"Cancel"}),(0,s.jsx)(Be,{onClick:i(()=>h.mutate("pause"),"onClick"),children:"Pause anyway"})]})]})}),C&&(0,s.jsx)("span",{className:"hidden sm:inline",children:(0,s.jsx)(me,{status:e.status})}),ee,(0,s.jsxs)(Ke,{open:ie,onOpenChange:j,children:[(0,s.jsx)(ke,{asChild:!0,children:(0,s.jsx)(x,{variant:"ghost",size:"icon-xs","aria-label":`Open actions for ${e.name}`,children:(0,s.jsx)(je,{className:"h-4 w-4"})})}),(0,s.jsxs)(Ne,{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:b.isPending,onClick:le,children:[b.isPending?(0,s.jsx)(Se,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(U,{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(()=>{v({title:"Copy failed",body:"Clipboard access is unavailable.",tone:"error"})}),j(!1)},"onClick"),children:[(0,s.jsx)(U,{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(()=>{oe.mutate(),j(!1)},"onClick"),children:[(0,s.jsx)(ve,{className:"h-3 w-3"}),"Reset Sessions"]}),!z&&(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(()=>{j(!1),!(B&&!_(N))&&h.mutate("terminate")},"onClick"),children:[(0,s.jsx)(fe,{className:"h-3 w-3"}),"Terminate"]})]})]})]})}i(Ze,"AgentActionButtons");export{Ge as n,Ze as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentBulkSettingsSheet-D1vM7GWb.js","assets/rolldown-runtime-DhZMWcEn.js","assets/issue-detail-ls2AWc8k.js","assets/index-Hy6BKS-o.js","assets/index-Dbyu_v18.css","assets/issue-detail-CIbQo9zW.css"])))=>i.map(i=>d[i]);
2
+ var q=Object.defineProperty;var n=(s,l)=>q(s,"name",{value:l,configurable:!0});import{a as E}from"./rolldown-runtime-DhZMWcEn.js";import{Eo as I,Jo as x,wc as L}from"./issue-detail-ls2AWc8k.js";import{$m as M,Ap as O,Hm as U,Kf as J,cd as K,dd as Q,df as V,hm as A,lh as j,my as X,nn as z,od as G,tg as W,vh as B,yy as Y}from"./index-Hy6BKS-o.js";var p=E(Y(),1),m=n(s=>L(s.adapterType,s.adapterConfig),"bulkAgentHarness"),Z=n(s=>typeof s.adapterConfig.model=="string"&&s.adapterConfig.model.trim()||null,"agentDefaultModel"),P=n(s=>W.safeParse(s.runtimeConfig.aiConnection).data,"agentConnection"),re=n((s,l)=>{const a=n(d=>JSON.stringify(d&&Object.fromEntries(Object.entries(d).sort(([r],[c])=>r.localeCompare(c)))),"canonical");return a(s)===a(l)},"sameBinding");function b(s){if(["terminated","pending_approval"].includes(s.status))return"This agent is not available for bulk edits";if(P(s)?.mode==="router")return"Edit connection pool members on the agent's configuration page";if(!["codex_local","claude_local","gemini_local","grok_local","opencode_local","hermes_local","pi_local","copilot_runtime","cursor_local"].includes(m(s)))return"Connection and model are managed externally"}n(b,"bulkAgentDisabledReason");function ie(s,l){return l.connections.find(a=>s?.mode==="responsible_user"?a.provider===s.provider&&a.isDefault&&a.ownership==="personal"&&a.ownerUserId===l.currentUserId:a.id===s?.connectionId&&a.grantId===s?.grantId)}n(ie,"resolveBulkConnection");function ee(s,l){return s?s.mode==="router"?"Connection pool":s.mode==="responsible_user"?"Responsible user's default":l?.connections.find(a=>a.id===s.connectionId&&a.grantId===s.grantId)?.name??"Assigned connection":"Local credentials"}n(ee,"bulkConnectionName");async function oe(s,l,a=4){const d=new Array(s.length);let r=0;return await Promise.all(Array.from({length:Math.min(a,s.length)},async()=>{for(;r<s.length;){const c=r++;try{d[c]={status:"fulfilled",value:await l(s[c])}}catch(o){d[c]={status:"rejected",reason:o}}}})),d}n(oe,"mapBulkAgents");var e=E(X(),1),te=(0,p.lazy)(()=>U(()=>import("./AgentBulkSettingsSheet-D1vM7GWb.js").then(s=>({default:s.AgentBulkSettingsSheet})),__vite__mapDeps([0,1,2,3,4,5])));function ce({companyId:s,agents:l,visibleAgents:a,renderAgent:d}){const[r,c]=(0,p.useState)([]),[o,C]=(0,p.useState)("all"),[g,_]=(0,p.useState)(null),[w,$]=(0,p.useState)(""),v=M({queryKey:["ai-connections",s],queryFn:n(()=>I.list(s),"queryFn"),retry:!1}),h=a.filter(t=>o==="all"||m(t)===o),f=h.filter(t=>!b(t)),u=l.filter(t=>r.includes(t.id)&&!b(t)),F=[...new Set(l.map(m))].sort((t,i)=>x(t).localeCompare(x(i))),N=[...new Set(u.map(m))],k=f.length>0&&f.every(t=>r.includes(t.id)),H=f.some(t=>r.includes(t.id)),S=u.filter(t=>!h.includes(t)).length,R=n(()=>c(k?r.filter(t=>!f.some(i=>i.id===t)):[...new Set([...r,...f.map(t=>t.id)])]),"toggleAll");return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,e.jsxs)(G,{children:[(0,e.jsx)(Q,{asChild:!0,children:(0,e.jsxs)(j,{variant:"ghost",size:"icon","aria-label":"Filter agents",title:o==="all"?"Filter":`Filter: ${x(o)}`,className:B("relative h-8 w-8 shrink-0",o!=="all"&&"text-blue-600 dark:text-blue-400"),children:[(0,e.jsx)(O,{className:"h-3.5 w-3.5","aria-hidden":!0}),o!=="all"&&(0,e.jsx)("span",{"aria-hidden":!0,className:"absolute -right-1 -top-1 flex h-3.5 w-3.5 items-center justify-center rounded-full bg-blue-600 text-(length:--text-nano) font-bold text-white",children:"1"})]})}),(0,e.jsxs)(K,{"aria-label":"Agent filters",align:"start",className:"w-64 space-y-3 p-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-sm font-medium",children:"Filters"}),o!=="all"&&(0,e.jsx)("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:n(()=>C("all"),"onClick"),children:"Clear"})]}),(0,e.jsxs)("div",{role:"group","aria-label":"Harness",className:"space-y-1",children:[(0,e.jsx)("div",{className:"px-2 text-xs font-medium text-muted-foreground",children:"Harness"}),["all",...F].map(t=>(0,e.jsxs)("button",{type:"button","aria-pressed":o===t,onClick:n(()=>C(t),"onClick"),className:B("flex w-full items-center justify-between rounded-sm px-2 py-1 text-left text-sm",o===t?"bg-accent/50 text-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[t==="all"?"All harnesses":x(t),o===t&&(0,e.jsx)(A,{className:"size-3.5","aria-hidden":!0})]},t))]})]})]}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[h.length," ",h.length===1?"agent":"agents"]})]}),u.length>0&&(0,e.jsxs)("div",{role:"region","aria-label":"Bulk actions",className:"sticky top-0 z-10 flex flex-wrap items-center gap-3 rounded-md border bg-muted p-3",children:[(0,e.jsxs)("span",{className:"text-sm font-medium",children:[u.length," selected"]}),S>0&&(0,e.jsxs)("span",{className:"text-xs text-muted-foreground",children:[S," hidden by filters"]}),N.length>1&&(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:"Choose a harness to edit"}),(0,e.jsxs)("div",{className:"flex flex-1 flex-wrap items-center justify-end gap-2",children:[N.map(t=>(0,e.jsxs)(j,{size:"sm",variant:"outline",onClick:n(()=>_(u.filter(i=>m(i)===t)),"onClick"),children:[(0,e.jsx)(J,{className:"size-3.5","aria-hidden":!0}),N.length===1?"Edit connection & model":`Edit ${u.filter(i=>m(i)===t).length} ${x(t)}`]},t)),(0,e.jsx)(j,{size:"icon-sm",variant:"ghost","aria-label":"Clear selection",onClick:n(()=>c([]),"onClick"),children:(0,e.jsx)(V,{className:"size-4"})})]})]}),w&&(0,e.jsxs)("p",{role:"status",className:"flex items-center gap-2 text-sm",children:[(0,e.jsx)(A,{className:"size-4","aria-hidden":!0}),w]}),v.error&&(0,e.jsxs)("p",{className:"text-xs text-destructive",children:["Connection names couldn’t be loaded. ",(0,e.jsx)(j,{variant:"link",size:"sm",onClick:n(()=>{v.refetch()},"onClick"),children:"Retry"})]}),(0,e.jsx)("div",{className:"overflow-x-auto",children:(0,e.jsxs)("table",{"aria-label":"Agent roster",className:"w-full text-left text-sm",children:[(0,e.jsx)("thead",{className:"text-xs text-muted-foreground [&_th]:px-3 [&_th]:py-3 [&_th]:font-normal",children:(0,e.jsxs)("tr",{children:[(0,e.jsx)("th",{className:"w-10",children:(0,e.jsx)(z,{"aria-label":"Select all visible editable agents",checked:k?!0:H?"indeterminate":!1,disabled:!f.length,onCheckedChange:R})}),(0,e.jsx)("th",{children:"Agent"}),(0,e.jsx)("th",{children:"Harness"}),(0,e.jsx)("th",{children:"Connection"}),(0,e.jsx)("th",{children:"Default model"})]})}),(0,e.jsx)("tbody",{children:h.map(t=>(0,e.jsxs)("tr",{"data-state":r.includes(t.id)?"selected":void 0,className:"border-t border-border data-[state=selected]:bg-accent/30 [&_td]:px-3",children:[(0,e.jsx)("td",{title:b(t),children:(0,e.jsx)(z,{"aria-label":`Select ${t.name}`,checked:u.some(i=>i.id===t.id),disabled:!!b(t),onCheckedChange:n(i=>c(i?[...new Set([...r,t.id])]:r.filter(y=>y!==t.id)),"onCheckedChange")})}),(0,e.jsx)("td",{className:"min-w-64 p-0",children:d(t)}),(0,e.jsx)("td",{className:"whitespace-nowrap text-xs",children:x(m(t))}),(0,e.jsx)("td",{className:"text-xs",children:["http","process"].includes(t.adapterType)?"Managed externally":ee(P(t),v.data)}),(0,e.jsx)("td",{className:"font-mono text-xs",children:Z(t)??"Harness default"})]},t.id))})]})}),!h.length&&(0,e.jsx)("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No agents match these filters."}),g&&(0,e.jsx)(p.Suspense,{fallback:(0,e.jsx)("p",{role:"status",className:"text-sm text-muted-foreground",children:"Loading editor…"}),children:(0,e.jsx)(te,{companyId:s,agents:g,totalSelected:u.length,onClose:n((t,i)=>{_(null),t.length&&(c(y=>y.filter(D=>!(i?g.map(T=>T.id):t).includes(D))),$(`Updated ${t.length} ${x(m(g[0]))} ${t.length===1?"agent":"agents"}.`))},"onClose")})})]})}n(ce,"AgentBulkRoster");export{ee as a,re as c,m as i,P as n,oe as o,Z as r,ie as s,ce as t};
@@ -0,0 +1 @@
1
+ var ve=Object.defineProperty;var o=(p,r)=>ve(p,"name",{value:r,configurable:!0});import{a as oe}from"./rolldown-runtime-DhZMWcEn.js";import{Eo as je,Jo as be,Qn as ye,_n as Ce,bi as Ne,fn as we,gn as Se,hn as ke,mn as Ae,vn as Me,xo as _e,yi as Ee}from"./issue-detail-ls2AWc8k.js";import{$m as $e,Om as te,ch as Re,cp as qe,eu as K,lh as E,my as Oe,nf as z,nn as ne,vu as Be,wg as De,yg as Fe,yy as Ke}from"./index-Hy6BKS-o.js";import{a as H,c as P,i as ae,n as N,o as re,r as w,s as ze}from"./AgentBulkRoster-CHK5ekxM.js";var f=oe(Ke(),1),s=oe(Oe(),1);function Ie({companyId:p,agents:r,totalSelected:Q,onClose:U}){const $=Re(),h=ae(r[0]),ie=be(h),[d,le]=(0,f.useState)(!1),[u,T]=(0,f.useState)(!1),[m,ce]=(0,f.useState)(),[R,I]=(0,f.useState)(""),[x,de]=(0,f.useState)(""),[ue,me]=(0,f.useState)(!1),[C,L]=(0,f.useState)(!1),S=(0,f.useRef)(!1),[q,pe]=(0,f.useState)([]),[i,he]=(0,f.useState)(null),v=i?i.map(e=>e.agent):r,y=$e({queryKey:["bulk-agent-models",p,v.map(e=>e.id),d?m:null],retry:!1,queryFn:o(async()=>{const e=new Map;return(await re(v,async t=>{const a=await je.list(p,t.id),l=N(t),n=d&&m?m:l?.mode!=="router"?l:void 0,c=ze(n,a)?.routing,g=c?.kind==="openrouter"||!c&&n?.provider==="openrouter",fe=!!(c?.models.length||g||h==="copilot_runtime");let A;if(c?.models.length)A=c.models.map(k=>({id:De(c,h,k.id),label:k.label??k.id}));else{const k=h==="copilot_runtime",X=g?"opencode_local":k?"paperclip_runner":h,Z=g?{provider:"openrouter"}:k?{provider:"acpx",acpxAgent:"copilot",agentId:t.id,aiConnection:n,environmentId:t.defaultEnvironmentId}:{environmentId:t.defaultEnvironmentId},ee=JSON.stringify([X,Z]);let _=e.get(ee);_||(_=K.adapterModels(p,X,Z),e.set(ee,_)),A=await _,g&&!["opencode_local","pi_local"].includes(h)&&(A=A.map(se=>({...se,id:se.id.replace(/^openrouter\//,"")})))}return{agent:t,accounts:a,binding:n,models:A,restricted:fe}})).map((t,a)=>t.status==="fulfilled"?t.value:{agent:v[a],error:t.reason instanceof Error?t.reason.message:"Couldn’t load connections or models"})},"queryFn")}),j=y.data?.filter(e=>!("error"in e))??[],O=y.data?.filter(e=>"error"in e)??[],ge=[...new Map(j.flatMap(e=>e.models).map(e=>[e.id,e])).values()].filter(e=>j.every(t=>!t.restricted||t.models.some(a=>a.id===e.id))),J=j.length===v.length&&j.every(e=>!e.restricted),b=v.filter(e=>d&&m&&!P(m,N(e))||u&&x&&x!==w(e)),M=!d&&!u||d&&!m||u&&!x,B=v.flatMap(e=>{const t=j.find(n=>n.agent.id===e.id);if(!t||M)return[];const a=u?x:w(e);let l=null;return t.binding&&(l=_e(t.binding,{companyId:p,provider:t.binding.provider},t.accounts.connections,t.accounts.currentUserId,e.id),!l&&!Fe(t.binding,h,a)&&(l="Choose a model compatible with this connection.")),!l&&t.restricted&&!t.models.some(n=>n.id===a)&&(l=`${a??"Harness default"} isn’t available on this connection. Choose a different connection or change the default model.`),l?[{agent:e,message:l}]:[]}),G=!C&&!M&&!R&&!y.isFetching&&!y.error&&!O.length&&j.length===v.length&&!B.length&&b.length>0,Y=b.length||r.length,V=Q-r.length,D=[...new Set(r.map(e=>H(N(e),j.find(t=>t.agent.id===e.id)?.accounts)))],F=[...new Set(r.map(e=>w(e)??"Harness default"))],W=o(()=>{S.current||U(q)},"close");async function xe(){if(!G||S.current)return;S.current=!0,L(!0);const e=await re(b,async n=>{const c={harness:h,...d&&m?{aiConnection:m}:{},...u?{model:x}:{},expected:{model:w(n),aiConnection:N(n)??null}};if(i){const g=await K.get(n.id,p);if(ae(g)===h&&(!d||P(m,N(g)))&&(!u||w(g)===x))return g}return K.updateRuntimeSettings(n.id,c,p)}),t=[],a=[];e.forEach((n,c)=>{n.status==="fulfilled"?a.push(n.value):t.push({agent:b[c],message:n.reason instanceof Error?n.reason.message:"Couldn’t save this agent. Try again."})});const l=[...q,...a.map(n=>n.id)];pe(l),$.setQueryData(z.agents.list(p),n=>n?.map(c=>a.find(g=>g.id===c.id)??c)),await Promise.all(a.map(n=>$.invalidateQueries({queryKey:z.agents.detail(n.id)}))),$.invalidateQueries({queryKey:z.agents.list(p)}),S.current=!1,L(!1),t.length?he(t):U(l,!0)}return o(xe,"save"),(0,s.jsx)(we,{open:!0,onOpenChange:o(e=>{e||W()},"onOpenChange"),children:(0,s.jsxs)(Ae,{className:"w-full sm:max-w-lg",showCloseButton:!C,onEscapeKeyDown:o(e=>{S.current&&e.preventDefault()},"onEscapeKeyDown"),onInteractOutside:o(e=>{S.current&&e.preventDefault()},"onInteractOutside"),children:[(0,s.jsxs)(Ce,{className:"px-6 pt-6 pb-0",children:[(0,s.jsxs)(Me,{children:["Update ",r.length," ",ie," ",r.length===1?"agent":"agents"]}),(0,s.jsx)(ke,{children:Q>r.length?`${V} other selected ${V===1?"agent":"agents"} won’t change.`:"Change their connection, default model, or both."})]}),(0,s.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto px-6 py-2",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-2","aria-label":"Agents to update",children:r.map(e=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs",children:[(0,s.jsx)(Be,{agent:e,size:20}),e.name]},e.id))}),i&&(0,s.jsxs)("div",{role:"alert",className:"space-y-2 rounded-md border border-destructive/30 p-3 text-sm",children:[(0,s.jsxs)("p",{className:"font-medium",children:[q.length," updated · ",i.length," couldn’t be saved"]}),i.map(e=>(0,s.jsxs)("p",{className:"text-muted-foreground",children:[e.agent.name,": ",e.message]},e.agent.id)),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Retry updates only the remaining agents. Close and reopen to review changed settings."})]}),(0,s.jsxs)("fieldset",{disabled:C||i!==null,className:"flex flex-col gap-6 disabled:opacity-60",children:[(0,s.jsxs)("section",{className:"space-y-3",children:[(0,s.jsxs)("label",{className:"flex cursor-pointer items-start gap-3",children:[(0,s.jsx)(ne,{checked:d,disabled:!Ne(h),onCheckedChange:o(e=>le(e===!0),"onCheckedChange"),"aria-label":"Change connection",className:"mt-0.5"}),(0,s.jsxs)("span",{className:"space-y-1",children:[(0,s.jsx)("span",{className:"block text-sm font-medium",children:"Change connection"}),(0,s.jsxs)("span",{className:"block text-xs text-muted-foreground",children:[D.length===1?D[0]:`${D.length} different connections`,!d&&" · Keep current"]})]})]}),d&&(0,s.jsx)("div",{className:"pl-7",children:(0,s.jsx)(Ee,{companyId:p,agentId:r[0].id,agentName:`${r.length} agents`,adapterType:h,model:u?x:void 0,value:m,readOnly:C||i!==null,onChange:o(e=>{if(e.mode==="router"){I("Configure connection pools on each agent’s configuration page.");return}I(""),ce(e)},"onChange")})})]}),(0,s.jsxs)("section",{className:"space-y-3",children:[(0,s.jsxs)("label",{className:"flex cursor-pointer items-start gap-3",children:[(0,s.jsx)(ne,{checked:u,onCheckedChange:o(e=>T(e===!0),"onCheckedChange"),"aria-label":"Change default model",className:"mt-0.5"}),(0,s.jsxs)("span",{className:"space-y-1",children:[(0,s.jsx)("span",{className:"block text-sm font-medium",children:"Change default model"}),(0,s.jsxs)("span",{className:"block text-xs text-muted-foreground",children:[F.length===1?F[0]:`${F.length} different models`,!u&&" · Keep current"]})]})]}),u&&(0,s.jsxs)("div",{className:"pl-7",children:[(0,s.jsx)(ye,{models:ge,value:x,onChange:de,open:ue,onOpenChange:me,allowDefault:!1,required:!0,groupByProvider:!1,preserveOrder:!0,creatable:J}),(0,s.jsx)("p",{className:"pt-2 text-xs text-muted-foreground",children:J?"Choose a suggested model or enter a model ID supported by your harness.":`Available on every selected agent’s ${d?"new connection":"current connection"}.`})]})]})]}),y.isFetching&&(0,s.jsx)("p",{role:"status",className:"text-xs text-muted-foreground",children:"Checking connections and models…"}),(y.error||O.length>0)&&(0,s.jsxs)("div",{role:"alert",className:"space-y-2 text-sm text-destructive",children:[(0,s.jsx)("p",{children:y.error?.message}),O.map(e=>(0,s.jsxs)("p",{children:[e.agent.name,": ","error"in e?e.error:""]},e.agent.id)),(0,s.jsx)(E,{variant:"outline",size:"sm",onClick:o(()=>{y.refetch()},"onClick"),children:"Retry loading options"})]}),R&&(0,s.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:R}),B.length>0&&(0,s.jsxs)("div",{role:"alert",className:"space-y-2 rounded-md border border-destructive/30 p-3 text-sm",children:[B.map(e=>(0,s.jsxs)("p",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[e.agent.name,": "]}),e.message]},e.agent.id)),!u&&!i&&(0,s.jsx)(E,{size:"sm",variant:"outline",onClick:o(()=>T(!0),"onClick"),children:"Change default model"})]}),!M&&b.length>0&&(0,s.jsxs)("section",{className:"space-y-3","aria-label":"Changes to apply",children:[(0,s.jsx)("h3",{className:"text-xs font-medium text-muted-foreground",children:"CHANGES TO APPLY"}),(0,s.jsx)("div",{className:"divide-y divide-border",children:b.map(e=>(0,s.jsxs)("div",{className:"space-y-1.5 py-3 text-xs",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:e.name}),d&&!P(m,N(e))&&(0,s.jsxs)("p",{className:"flex flex-wrap items-center gap-1.5 text-muted-foreground",children:[(0,s.jsx)("span",{children:H(N(e),j.find(t=>t.agent.id===e.id)?.accounts)}),(0,s.jsx)(te,{className:"size-3","aria-label":"to"}),(0,s.jsx)("span",{className:"text-foreground",children:H(m,j.find(t=>t.agent.id===e.id)?.accounts)})]}),u&&x!==w(e)&&(0,s.jsxs)("p",{className:"flex flex-wrap items-center gap-1.5 font-mono text-muted-foreground",children:[(0,s.jsx)("span",{children:w(e)??"Harness default"}),(0,s.jsx)(te,{className:"size-3","aria-label":"to"}),(0,s.jsx)("span",{className:"text-foreground",children:x})]})]},e.id))}),v.length>b.length&&(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[v.length-b.length," already have these settings."]})]}),!M&&!b.length&&(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"All selected agents already have these settings."}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Applies to future runs. Running work keeps its current settings. Task-specific model overrides stay in place. A model change may start a fresh session; existing sessions may retain their connection until reset."})]}),(0,s.jsxs)(Se,{className:"flex-row items-center justify-between border-t px-6 py-4",children:[(0,s.jsx)(E,{variant:"ghost",onClick:W,disabled:C,children:i?"Close":"Cancel"}),(0,s.jsxs)(E,{onClick:o(()=>{xe()},"onClick"),disabled:!G,children:[C&&(0,s.jsx)(qe,{className:"size-4 animate-spin","aria-hidden":!0}),C?"Updating…":i?`Retry ${i.length} ${i.length===1?"agent":"agents"}`:`Update ${Y} ${Y===1?"agent":"agents"}`]})]})]})})}o(Ie,"AgentBulkSettingsSheet");export{Ie as AgentBulkSettingsSheet};
@@ -0,0 +1 @@
1
+ var E=Object.defineProperty;var u=(a,t)=>E(a,"name",{value:t,configurable:!0});import{a as v}from"./rolldown-runtime-DhZMWcEn.js";import{n as S}from"./issue-detail-ls2AWc8k.js";import{$l as A,$m as f,Ag as _,Bm as I,Xl as K,Yd as F,Yl as k,af as N,ch as Q,eu as C,fh as w,my as P,nf as o,yy as R}from"./index-Hy6BKS-o.js";var h=v(R(),1),d=v(P(),1);function B(){const{agentRef:a=""}=I(),{selectedCompanyId:t}=F(),{enabled:c,loaded:b}=K(),m=Q(),l=f({queryKey:o.agents.list(t),queryFn:u(()=>C.list(t),"queryFn"),enabled:!!t}),r=f({queryKey:o.auth.session,queryFn:u(()=>N.getSession(),"queryFn")}),n=r.data?.user?.id??r.data?.session?.userId??null,p=l.data?.find(y=>y.id===a||w(y)===a),g=f({queryKey:o.agents.detail(a),queryFn:u(()=>C.get(a,t),"queryFn"),enabled:c&&!!t&&l.isSuccess&&!p&&_(a)}),e=p??(g.data?.companyId===t?g.data:void 0),q=o.agentChats.detail(t,n,e?.id),s=f({queryKey:q,queryFn:u(()=>A.get(t,e.id),"queryFn"),enabled:c&&!!e&&r.isFetched}),x=(0,h.useRef)(null);(0,h.useEffect)(()=>{x.current=null},[t,n,e?.id]),(0,h.useEffect)(()=>{c&&e&&r.isSuccess&&s.isSuccess&&k(e.companyId,n,e.id,s.data?.id??null)},[c,e?.id,e?.companyId,n,r.isSuccess,s.isSuccess,s.data?.id]);const j=(0,h.useCallback)(async()=>{if(!e||!t)throw new Error("Agent not found");if(s.data)return s.data;const y=x.current??=A.ensure(t,e.id);try{const i=await y;return m.setQueryData(o.issues.detail(i.id),i),m.setQueryData(q,i),m.invalidateQueries({queryKey:o.agentChats.list(t,n)}),i}catch(i){throw x.current=null,i}},[e,t,s.data,m,n]);return!b||l.isPending||r.isPending||g.isFetching&&!e?(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading conversation…"}):!c&&!s.data?(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Agent Chat is disabled. Enable it in Experimental settings. Existing history remains available through task links."}):l.error||s.error||!p&&g.error?(0,d.jsx)("p",{className:"text-sm text-destructive",children:(l.error??s.error??g.error)?.message}):e?s.isPending?(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading conversation…"}):(0,d.jsx)(S,{conversation:{agent:e,issue:s.data??null,ensureIssue:j}},`${e.id}:${n}`):(0,d.jsx)("p",{className:"text-sm text-destructive",children:"Agent not found."})}u(B,"AgentChat");export{B as AgentChat};