@penclipai/ui 2026.1026.0-beta.0 → 2026.1026.0-beta.1
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.
- package/dist/assets/{ActiveAgentsPanel-DBWu-RI8.js → ActiveAgentsPanel-CpKs6jF_.js} +1 -1
- package/dist/assets/{AdapterManager-BKE2W5bj.js → AdapterManager-Rebf4uwW.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-BLF4v3Cx.js → AdvancedToolsRoute-G8EN7tf8.js} +3 -3
- package/dist/assets/{AgentActionButtons-CVMEUelQ.js → AgentActionButtons-CwQUOyaw.js} +1 -1
- package/dist/assets/{AgentBulkRoster-C8xpxlbS.js → AgentBulkRoster-gNkCd137.js} +2 -2
- package/dist/assets/{AgentBulkSettingsSheet-D6WozUsP.js → AgentBulkSettingsSheet-CjifETrT.js} +1 -1
- package/dist/assets/{AgentChat-CosaootX.js → AgentChat-Dr-8hjkQ.js} +1 -1
- package/dist/assets/{AgentDetailPage-B-RGirOH.js → AgentDetailPage-BJXT78Xj.js} +17 -17
- package/dist/assets/{Agents-Dw6yD_01.js → Agents-fwQiQ0g1.js} +2 -2
- package/dist/assets/{Agents.production-Bkm2soG1.js → Agents.production-DZlSlI32.js} +2 -2
- package/dist/assets/{AnimatedDialogContent-CX0MJjw2.js → AnimatedDialogContent-Y2s4FIqS.js} +1 -1
- package/dist/assets/{AppDetail-BESPkwqN.js → AppDetail-Dliq3Y37.js} +1 -1
- package/dist/assets/{AppNotConnected-BUEGSGL4.js → AppNotConnected-6X0msJIH.js} +1 -1
- package/dist/assets/{ApprovalDetail-D7Ahk7EQ.js → ApprovalDetail-hLi0Lzq3.js} +1 -1
- package/dist/assets/{Approvals-CqQQqwvZ.js → Approvals-BFt7TeEE.js} +1 -1
- package/dist/assets/{AppsConnect-CWo5u3Il.js → AppsConnect-CtJcpfTa.js} +1 -1
- package/dist/assets/{AppsReview-_vTZEiaY.js → AppsReview-CNG1VHkb.js} +1 -1
- package/dist/assets/{Artifacts-iRv5hznB.js → Artifacts-wS0mNEBE.js} +1 -1
- package/dist/assets/{AssistantConnection-jiReSx-l.js → AssistantConnection-zkzJOsI_.js} +1 -1
- package/dist/assets/{AuditHub-62cAWrtP.js → AuditHub-DHjEg8Nv.js} +1 -1
- package/dist/assets/{Auth-CvPA3W-8.js → Auth-Cwg47ZoK.js} +1 -1
- package/dist/assets/{BoardChat-UTRxmIS9.js → BoardChat-ChdC9G15.js} +3 -3
- package/dist/assets/{BoardClaim-kl4n1PDv.js → BoardClaim-DGFqiHgJ.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-CwQYMTDd.js → BootstrapSetupUxLab-sRSnvGek.js} +1 -1
- package/dist/assets/{Browse-BtAiF9QL.js → Browse-D536Sakn.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-LH5s25F7.js → BudgetPolicyCard-Bd34NRw6.js} +1 -1
- package/dist/assets/{CaseDetail-D6kSJTop.js → CaseDetail-B-abdAx0.js} +1 -1
- package/dist/assets/{CaseStatus-CknXOZNk.js → CaseStatus-DOgGkwZC.js} +1 -1
- package/dist/assets/{Cases-BDEz1iuR.js → Cases-Devo6iUd.js} +1 -1
- package/dist/assets/{ChatEndpointDetail-CI50izo3.js → ChatEndpointDetail-aMULy7mB.js} +3 -3
- package/dist/assets/{ChatEndpointSetup-CG5lNZg2.js → ChatEndpointSetup-CIVb_j9K.js} +1 -1
- package/dist/assets/{ChatIdentityConfirm-DDe2q2c1.js → ChatIdentityConfirm-CMgjZkbz.js} +1 -1
- package/dist/assets/{CliAuth-C3tZzyfX.js → CliAuth-C_0OpeMx.js} +1 -1
- package/dist/assets/{Companies-0k0t8SKv.js → Companies-QEvz18C9.js} +1 -1
- package/dist/assets/{CompanyAccess-Dfi722bt.js → CompanyAccess-CTg_WIL8.js} +1 -1
- package/dist/assets/{CompanyActivity-C4Art_aR.js → CompanyActivity-Ahj8AVCp.js} +1 -1
- package/dist/assets/{CompanyActivity.production-D0-T6D9A.js → CompanyActivity.production-DvJ4xsPw.js} +1 -1
- package/dist/assets/{CompanyConnections-BuvZeoc9.js → CompanyConnections-Clb4J67L.js} +1 -1
- package/dist/assets/{CompanyEnvironments-D_eJiHzi.js → CompanyEnvironments-CYgHThzI.js} +2 -2
- package/dist/assets/{CompanyExport-DAlPU_76.js → CompanyExport-D9hrJYkz.js} +1 -1
- package/dist/assets/{CompanyImport-DMZaPVHI.js → CompanyImport-B9w6zmr_.js} +1 -1
- package/dist/assets/{CompanySettings-crLpO158.js → CompanySettings-DmEna-8z.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-D8vCxcJa.js → CompanySettingsPluginPage-QpTo9Yfz.js} +1 -1
- package/dist/assets/{CompanySkills-D9fVjtqP.js → CompanySkills-BlgntdNg.js} +2 -2
- package/dist/assets/{CompanySkills.production-CM1jfrYM.js → CompanySkills.production-O8JhCSVE.js} +2 -2
- package/dist/assets/ConfigureBuiltInAgentModal-xz3SPJwZ.js +1 -0
- package/dist/assets/{CopyableGatewayUrl-BvLShRdM.js → CopyableGatewayUrl-Cna2dTXW.js} +1 -1
- package/dist/assets/{Costs-BfjV7dU5.js → Costs-COwXNCpR.js} +1 -1
- package/dist/assets/{CrossIssueCollaborationUxLab-D7UY26de.js → CrossIssueCollaborationUxLab-CAF6mPZH.js} +1 -1
- package/dist/assets/{Dashboard-B5jOhqDG.js → Dashboard-Bl5HkTDi.js} +1 -1
- package/dist/assets/{DashboardLive-C7hIV1hl.js → DashboardLive-uNXwmq11.js} +1 -1
- package/dist/assets/{DecisionDateChips-Dz2wMBNe.js → DecisionDateChips-BjsFACEA.js} +1 -1
- package/dist/assets/{DecisionQueuePage-PgDIzxjS.js → DecisionQueuePage-IxbCNFWT.js} +1 -1
- package/dist/assets/{DesignGuide-CagYau3s.js → DesignGuide-CWZuodNp.js} +4 -4
- package/dist/assets/{DesignSandboxTaskThread-B5gnOG8i.js → DesignSandboxTaskThread-Cg9GWHow.js} +4 -4
- package/dist/assets/{EmailConnectionAccess-gy1Mpixg.js → EmailConnectionAccess-CTBuHeuW.js} +1 -1
- package/dist/assets/{EmailEndpointSetup-HN5Q9QNh.js → EmailEndpointSetup-BZFNHNkK.js} +1 -1
- package/dist/assets/{EnforcementBanner-CHtoXwRm.js → EnforcementBanner-DCVNuK7w.js} +1 -1
- package/dist/assets/{EntityRow-DQ9LQukR.js → EntityRow-CH6bfdEU.js} +1 -1
- package/dist/assets/{ExecutionWorkspaceDetail-CSBOdY-t.js → ExecutionWorkspaceDetail-BHIInc6p.js} +1 -1
- package/dist/assets/{ExternalAgentInviteDialog-DiudbswA.js → ExternalAgentInviteDialog-CaPFojwh.js} +3 -3
- package/dist/assets/{FilterBar-CUTGhox6.js → FilterBar-3czx7OLR.js} +1 -1
- package/dist/assets/{FolderControls-boTzW-4V.js → FolderControls-EgS5UBqE.js} +1 -1
- package/dist/assets/{GatewayDetail-JP87al8N.js → GatewayDetail-CHj9J8Vy.js} +2 -2
- package/dist/assets/{GatewaysList-CthhaStn.js → GatewaysList-CN6iHWn7.js} +1 -1
- package/dist/assets/{GitHubConnectionRecovery-B4FeiOYB.js → GitHubConnectionRecovery-DQpPf1Xv.js} +1 -1
- package/dist/assets/{GoalDetail-DBg-ZB2T.js → GoalDetail-CYmd_Aah.js} +1 -1
- package/dist/assets/{GoalTree-CVF_Q4lx.js → GoalTree-BMMqkWs8.js} +1 -1
- package/dist/assets/{Goals-UgwjstnK.js → Goals-D9K0o76O.js} +1 -1
- package/dist/assets/{Inbox-X4naEip4.js → Inbox-C81eYBfR.js} +3 -3
- package/dist/assets/{InstanceAccess-Bynjjucp.js → InstanceAccess-CwG9dPIK.js} +1 -1
- package/dist/assets/{InstanceExperimentalSettings-DYYgPtBx.js → InstanceExperimentalSettings-CZpbsgXE.js} +1 -1
- package/dist/assets/{InviteLanding-uBtqmadA.js → InviteLanding-CAngHYLc.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-C_JEq6Nq.js → IssueChatLongThreadPerf-DrvIJ4Va.js} +1 -1
- package/dist/assets/{Issues-2yUbB_hX.js → Issues-BJPW6M6A.js} +1 -1
- package/dist/assets/{JoinRequestQueue-D6otumTB.js → JoinRequestQueue-9r2jINyU.js} +1 -1
- package/dist/assets/{Layout.production-DVdIHzsi.js → Layout.production-D-JXpSSB.js} +1 -1
- package/dist/assets/{ManagedAiConnectionDetails-wLsBOfjv.js → ManagedAiConnectionDetails-CRv3HQJz.js} +1 -1
- package/dist/assets/{McpConnect-BnwNSYqL.js → McpConnect-D6Osi8f0.js} +1 -1
- package/dist/assets/{MembershipAction-BZNnB5hW.js → MembershipAction-t8mwiW7A.js} +1 -1
- package/dist/assets/{MetricCard-BFsAIEWz.js → MetricCard-C3ECiAXR.js} +1 -1
- package/dist/assets/{MissingPluginTabPlaceholder-BKkESw7X.js → MissingPluginTabPlaceholder-C4cmGwvr.js} +1 -1
- package/dist/assets/NewAgent-DOr_L51z.js +1 -0
- package/dist/assets/{NewAgentDialog-DwUwyL7b.js → NewAgentDialog-Ci6p9ri0.js} +1 -1
- package/dist/assets/{NewGoalDialog-BwrFlkUF.js → NewGoalDialog-BNSP-XCm.js} +1 -1
- package/dist/assets/{NewProjectDialog-sZfFDd6V.js → NewProjectDialog-giZHmGZf.js} +1 -1
- package/dist/assets/{OnboardingPrimitives-DyIVF8wp.js → OnboardingPrimitives-C5ySk1SK.js} +1 -1
- package/dist/assets/{OnboardingWizard-CRIXsIKv.js → OnboardingWizard-BGG6z-Zj.js} +1 -1
- package/dist/assets/{OrgChart.production-CpmdZwPD.js → OrgChart.production-C3jq3l8p.js} +1 -1
- package/dist/assets/{PaperclipCloudOAuthHandoff-DHs_1xa_.js → PaperclipCloudOAuthHandoff-C-gBUrDQ.js} +1 -1
- package/dist/assets/{PluginManager-D_nrp_qF.js → PluginManager-Csf-aUtY.js} +1 -1
- package/dist/assets/{PluginPage-DLF63JWC.js → PluginPage-ACa_sdYq.js} +1 -1
- package/dist/assets/{PluginSettings-DUTEeOZ-.js → PluginSettings-jzeVyadw.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-DO_jdq4e.js → ProfileDetailRoute-ggfH4TCX.js} +1 -1
- package/dist/assets/ProfileSettings-CR94nWG6.js +1 -0
- package/dist/assets/{ProfileWizardRoute-ClI4Ale_.js → ProfileWizardRoute-D4U45L-5.js} +1 -1
- package/dist/assets/{ProjectDetail-C0WM_bLq.js → ProjectDetail-B_4xAI-m.js} +1 -1
- package/dist/assets/{ProjectRepositoryInput-CeWBhric.js → ProjectRepositoryInput-CraO-rXr.js} +1 -1
- package/dist/assets/{ProjectWorkspaceDetail-DkxQzhIP.js → ProjectWorkspaceDetail-D_VqSYpd.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-DRhz9sKG.js → ProjectWorkspacesContent-Dei9m_cj.js} +1 -1
- package/dist/assets/{Projects-_VNW363e.js → Projects-D8M1KXpB.js} +1 -1
- package/dist/assets/{QuotaBar-CDtFLylg.js → QuotaBar-BozrBM0L.js} +1 -1
- package/dist/assets/{RepositoryEditor-Bhyafl1K.js → RepositoryEditor-qpOR4Ve1.js} +1 -1
- package/dist/assets/{ResponsibleUserDenialUxLab-C12Vip70.js → ResponsibleUserDenialUxLab-OM752SyJ.js} +1 -1
- package/dist/assets/{ReviewQueueCard-tXVmq3RN.js → ReviewQueueCard-Cskf5YxP.js} +1 -1
- package/dist/assets/{RoutineActivityRow-wPG_vbva.js → RoutineActivityRow-Db-JtQyN.js} +1 -1
- package/dist/assets/{RoutineDetail-eBcEHU_s.js → RoutineDetail-CwVahz9T.js} +2 -2
- package/dist/assets/{RoutineDetail.production-CVtg3U6W.js → RoutineDetail.production-Biudg-oO.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-D2bVhaIq.js → RoutineRunVariablesDialog-DhjPSrjL.js} +1 -1
- package/dist/assets/{Routines-CNu2ezwW.js → Routines-DwAJRWYe.js} +1 -1
- package/dist/assets/{Routines.production-DQy9Gj6i.js → Routines.production-CvMXlReN.js} +1 -1
- package/dist/assets/{Search-B_eBdN5U.js → Search-BdvOcke-.js} +1 -1
- package/dist/assets/{Secrets-DRS3_DCx.js → Secrets-BpzBYMdC.js} +3 -3
- package/dist/assets/{SkillBinaryFile-ChGEgfkJ.js → SkillBinaryFile-CBvoHpqT.js} +1 -1
- package/dist/assets/{SkillCardIcon-19HSgVD8.js → SkillCardIcon-DCYvX1_D.js} +1 -1
- package/dist/assets/{SkillFolderTree-C6vLg0Lz.js → SkillFolderTree-B99LalF2.js} +1 -1
- package/dist/assets/{SkillSourceTree-CI1jOUnC.js → SkillSourceTree-ChZeZPxc.js} +1 -1
- package/dist/assets/{SkillSources-DYY__cnD.js → SkillSources-BkELgPxM.js} +2 -2
- package/dist/assets/{SkillStudio-CsFwT37k.js → SkillStudio-CUJHpj75.js} +4 -4
- package/dist/assets/{SkillsNavigationTabs-CVoIxDvx.js → SkillsNavigationTabs-U2gvf7bn.js} +1 -1
- package/dist/assets/{SpekoPhoneCallback-DE2cU8J-.js → SpekoPhoneCallback-CeTo0gTF.js} +1 -1
- package/dist/assets/{SpekoProviderSetup-PczhQUZ0.js → SpekoProviderSetup-DIWpYgMQ.js} +1 -1
- package/dist/assets/{StatusCards-Cd01E6GM.js → StatusCards-Clf9Vhgg.js} +1 -1
- package/dist/assets/{SummarySlotCard-leFhRuZH.js → SummarySlotCard-DsdAp5TI.js} +1 -1
- package/dist/assets/{TaskChatLab-CrqvL_9M.js → TaskChatLab-D0BEuk_u.js} +2 -2
- package/dist/assets/{TaskSummaryList-DSlRE6ND.js → TaskSummaryList-ChSGZVKK.js} +1 -1
- package/dist/assets/{Timeline-Bs1FhI82.js → Timeline-XrKWOjKm.js} +1 -1
- package/dist/assets/{ToolbarSearch-DcAbJJiS.js → ToolbarSearch-CksaM2iQ.js} +1 -1
- package/dist/assets/{ToolsAdminGate-Db8Cqvio.js → ToolsAdminGate-CvfQ3tE1.js} +1 -1
- package/dist/assets/{TrustPresetSection-ZpR_Czo4.js → TrustPresetSection-CKYz3XWl.js} +1 -1
- package/dist/assets/{UserProfile-DWLjOVpK.js → UserProfile-BA-A1nFP.js} +1 -1
- package/dist/assets/{WebhookUrlWarning-ByyLGtZj.js → WebhookUrlWarning-DreWd4YT.js} +1 -1
- package/dist/assets/{WhatNeedsMe-DBveBacp.js → WhatNeedsMe-c7noYytn.js} +1 -1
- package/dist/assets/{Workspaces-CSgbwWzs.js → Workspaces-Dh52tmms.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-DFEhC-Zl.js → abnfDiagram-YUKMZFIV-CjtyrqHC.js} +1 -1
- package/dist/assets/{architecture-WOLXFQ4H-nzBPv-de.js → architecture-WOLXFQ4H-B8-QljiT.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-BUS7ySX5.js → architectureDiagram-47P4ROYG-B3Gx6aDx.js} +1 -1
- package/dist/assets/{arrow-down-left-DbIn-fZo.js → arrow-down-left-9sCussq8.js} +1 -1
- package/dist/assets/{audit-DWOvVXR_.js → audit-rDoi0Hak.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-DpDde9dr.js → blockDiagram-E7TT5TSB-CxlYsEYr.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-u19icQN5.js → c4Diagram-CRA5TL53-Cna-yEwv.js} +1 -1
- package/dist/assets/channel-qnGDYVN_.js +1 -0
- package/dist/assets/{chunk-2BW5OAIV-DMSSU5tk.js → chunk-2BW5OAIV-C_-XzNUk.js} +1 -1
- package/dist/assets/{chunk-3YJQHVM4-DNvTfBeQ.js → chunk-3YJQHVM4-DEZyixtI.js} +1 -1
- package/dist/assets/{chunk-4EA7E6EY-Boi1W4_c.js → chunk-4EA7E6EY-BQ3VfkKp.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-ClP7Nlre.js → chunk-7TKQ45FW-D8nNFdvX.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-C90itbpY.js → chunk-AW2ZBBNX-BCxRiv33.js} +1 -1
- package/dist/assets/{chunk-DBDB3WZW-C-bitsN4.js → chunk-DBDB3WZW-f6tcrZ5B.js} +1 -1
- package/dist/assets/{chunk-E2ZNV5FY-Begysp6v.js → chunk-E2ZNV5FY-CUZ-W9LM.js} +1 -1
- package/dist/assets/{chunk-EU5HNXII-CKD78Jtx.js → chunk-EU5HNXII-D8u43SfU.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-CACKDjsD.js → chunk-FVRAUYC3-Cz_39w3Y.js} +1 -1
- package/dist/assets/{chunk-HJ2JQQFS-vaL4nvs_.js → chunk-HJ2JQQFS-BT60QIvn.js} +1 -1
- package/dist/assets/{chunk-HTAEGDNF-Dx-uIhTP.js → chunk-HTAEGDNF-B2rva7Zh.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-CCxQedN5.js → chunk-KQW6MTUR-By4kjwX_.js} +1 -1
- package/dist/assets/{chunk-NTY3LDVX-BaffjwCL.js → chunk-NTY3LDVX-Roewi1k6.js} +1 -1
- package/dist/assets/{chunk-VPRB5NB3-D3HG6rqV.js → chunk-VPRB5NB3-C0fAVFSQ.js} +1 -1
- package/dist/assets/{chunk-XC4XBNZT-Dr_FsQCo.js → chunk-XC4XBNZT-C0sY2QbF.js} +1 -1
- package/dist/assets/{circle-slash-DLzWcLsN.js → circle-slash-pxQo3SIQ.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-DTF4MOE1.js → classDiagram-v2-K4WV4PDN-jslcosCS.js} +1 -1
- package/dist/assets/{coins-yQHSNqR8.js → coins-DcUZ4bzq.js} +1 -1
- package/dist/assets/{connection-owner-DPJ3nXu0.js → connection-owner-V_xLJyhn.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-DxmMAhGN.js → cynefin-EF2NZ3EQ-RuiKpTkq.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-DCGspp1G.js → cynefinDiagram-3GCD6N5R-V2b_WWKp.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-Bq2fZMWV.js → dagre-W4DXFKR2-D3uik2Xc.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-BJdEzDYf.js → diagram-2UJZ2QOL-Brmog55Z.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-CZQlYDRu.js → diagram-OVF4WLC6-D47gXGRf.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-D_ZFdXGI.js → diagram-PFPMY2P6-7cWoDGqI.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-D_CL3l3x.js → diagram-UMYRVEAY-qjZPxv46.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-umElIkAI.js → diagram-YEKJPTXX-BXHu29AA.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-EsPhU1Yo.js → diagram-ZIFT7M5P-BwUcdlQf.js} +1 -1
- package/dist/assets/{dist-CjjVlYy1.js → dist-5FTKzMna.js} +1 -1
- package/dist/assets/{dist-DC4dyefh.js → dist-B800wBv5.js} +1 -1
- package/dist/assets/{dist-CLefae-i.js → dist-BCDvxFZF.js} +1 -1
- package/dist/assets/{dist-Df3cTZ1T.js → dist-BPFsIzxu.js} +1 -1
- package/dist/assets/{dist-DmtahJ_d.js → dist-BRTWXMzY.js} +1 -1
- package/dist/assets/{dist-DPDK5_Of.js → dist-BSFG2yMQ.js} +1 -1
- package/dist/assets/{dist-mjKAXABN.js → dist-BYbbZIHN.js} +1 -1
- package/dist/assets/{dist-B9hxZjc8.js → dist-BgdzspJr.js} +1 -1
- package/dist/assets/{dist-CRN1XPDN.js → dist-BnB-lzJs.js} +1 -1
- package/dist/assets/{dist-Dqx9Mu9Y.js → dist-BodNROC6.js} +1 -1
- package/dist/assets/{dist-DJ1yZUt-.js → dist-C9wcVGw2.js} +1 -1
- package/dist/assets/{dist-BBDk7WdN.js → dist-Cc5BMNj7.js} +1 -1
- package/dist/assets/{dist-B8Tby_tn.js → dist-CjEadMLh.js} +1 -1
- package/dist/assets/{dist-BKgqK7kB.js → dist-CqXU6K1Q.js} +1 -1
- package/dist/assets/{dist-BWHA4LpW.js → dist-D-JH_z-y.js} +1 -1
- package/dist/assets/{dist-DYjtL9VC.js → dist-DB-TgSnJ.js} +1 -1
- package/dist/assets/{dist-BH9x55Vm.js → dist-DBtHL-NY.js} +1 -1
- package/dist/assets/{dist-GnUr5MM2.js → dist-DbonUMni.js} +1 -1
- package/dist/assets/{dist-DV93uhx_.js → dist-DwFoY4nw.js} +1 -1
- package/dist/assets/{dist-BPZgD8X7.js → dist-EFW9iqv-.js} +1 -1
- package/dist/assets/{dist-DMmIoM1s.js → dist-Hkh9Ece0.js} +1 -1
- package/dist/assets/{dist-DG2PQ4ch.js → dist-R-P0DPHG.js} +1 -1
- package/dist/assets/{dist-BIT0pzVR.js → dist-spvL5u1m.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-x5w0DxcM.js → ebnfDiagram-VR2GEFS7-Bo5aqDMh.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-Csg94weW.js → elk-IJKZMXRS-BpJHZ-Ua.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-8r6o5Icl.js → erDiagram-O2IAPWRE-7NA43ji6.js} +1 -1
- package/dist/assets/{eventmodeling-K75KTNOO-ClWVejY5.js → eventmodeling-K75KTNOO-Cyyr8lLx.js} +1 -1
- package/dist/assets/flowDiagram-OXPTDLAJ-Dh_2ugJ8.js +1 -0
- package/dist/assets/{ganttDiagram-R7TSEDQI-C4sRYce6.js → ganttDiagram-R7TSEDQI-TpOfIE6r.js} +1 -1
- package/dist/assets/{gitGraph-VSP46ZUC-DAY1GA_U.js → gitGraph-VSP46ZUC-D80hisRj.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-bFZKMEXz.js → gitGraphDiagram-XJZIOB7I-Tq9ba07P.js} +1 -1
- package/dist/assets/{goals-Dwvbf9Tb.js → goals-B6VIDL9f.js} +1 -1
- package/dist/assets/{index-B7Ixs7A0.js → index-B9_Uv8kr.js} +5 -5
- package/dist/assets/{info-OHQRW6UA-CZ7j8UF9.js → info-OHQRW6UA-DxetWE_O.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-u4Rc1F6y.js → infoDiagram-5W2HQ5XZ-_5P-InFG.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-CoqsdwWF.js → ishikawaDiagram-K3B6WC7H-BF8lnUV6.js} +1 -1
- package/dist/assets/{issue-detail-DhUrNgHw.js → issue-detail-DxleZn9K.js} +42 -42
- package/dist/assets/{journeyDiagram-COXZFDF6-BPoA4-_J.js → journeyDiagram-COXZFDF6-BqWV8dfi.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-SRoJmqjQ.js → kanban-definition-P3RFRI5V-CnfChncM.js} +1 -1
- package/dist/assets/{line-DfUbIwDP.js → line-Bek-0AXM.js} +1 -1
- package/dist/assets/{link-DPw7fF61.js → link-DijVPzPg.js} +1 -1
- package/dist/assets/{list-filter-BZvxH-lo.js → list-filter-D7jj6vYO.js} +1 -1
- package/dist/assets/{log-in-P9NhHMIr.js → log-in-BZTHHeeB.js} +1 -1
- package/dist/assets/{mermaid-parser.core-BMWx52RP.js → mermaid-parser.core-C0Ap09yU.js} +3 -3
- package/dist/assets/{mermaid.core-Clids-yQ.js → mermaid.core-C9yx0c3j.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-B3WpBtCg.js → mindmap-definition-LZFPQGKD-N4YipRVv.js} +1 -1
- package/dist/assets/{operate-sections-LmDGdd3E.js → operate-sections-D1EknLv8.js} +1 -1
- package/dist/assets/{packet-JDAUHWVQ-Bz-dhSg8.js → packet-JDAUHWVQ-DJvmjRjz.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-DmVM3V8T.js → pegDiagram-BGZESJAR-ypsZYpQk.js} +1 -1
- package/dist/assets/{pen-line-L4gGNhDv.js → pen-line-BY3dIE_E.js} +1 -1
- package/dist/assets/{pie-XZMESJXO-sxqD0K-h.js → pie-XZMESJXO-BnjVC42v.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-DOsi54i1.js → pieDiagram-CAPJLFHJ-BobGVrsB.js} +1 -1
- package/dist/assets/{power-DyuyvgaK.js → power-DY2kZpaP.js} +1 -1
- package/dist/assets/{profile-summary-Ctv0HM7f.js → profile-summary-D_TiZOEc.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-evGdiNXo.js → quadrantDiagram-GDMTTRAM-BnYpTHhb.js} +1 -1
- package/dist/assets/{radar-ABXABTNO-BUHLjvZE.js → radar-ABXABTNO-B_M55WG1.js} +1 -1
- package/dist/assets/{railroad-I3PHUGI6-Dl8yaztw.js → railroad-I3PHUGI6-DO-fquJN.js} +1 -1
- package/dist/assets/{railroad-abnf-LNEFI6M7-C6dul9-L.js → railroad-abnf-LNEFI6M7-Bi_Nau8E.js} +1 -1
- package/dist/assets/{railroad-ebnf-DWYD2UWJ-CG1wrhe1.js → railroad-ebnf-DWYD2UWJ-beAQdqfq.js} +1 -1
- package/dist/assets/{railroad-peg-JR7BVNR7-C0Zbw-Cg.js → railroad-peg-JR7BVNR7-FVk3K44c.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-BfnbANDz.js → railroadDiagram-SM67HX2B-BBgMvilC.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-DPY0C_6D.js → requirementDiagram-X7JNWC4A-j_S6tr7o.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-Bpd5i3K-.js → sankeyDiagram-UM26HJRW-DkcUgjnf.js} +1 -1
- package/dist/assets/{search-3C1xQdVJ.js → search-BSqclyPO.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-BcgaW3rf.js → sequenceDiagram-ZO4K6R2Y-DG-8wfLA.js} +1 -1
- package/dist/assets/{shared-4rFsAeZD.js → shared-CI7fMsr8.js} +1 -1
- package/dist/assets/{smoke-lab-matrix-samOLyLM.js → smoke-lab-matrix-Do3yT9YB.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-Dl1SZity.js → stateDiagram-v2-TBUQTH76-BHmZdVyW.js} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-DnHP6hl6.js → swimlanes-N4OXWK64-CIzivYhB.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-C3b2cJK5.js +8 -0
- package/dist/assets/{timeline-definition-YOQAKGHF-CuxtCx4l.js → timeline-definition-YOQAKGHF-BD_7ErKs.js} +1 -1
- package/dist/assets/{treeView-D4JQ5SDB-CsRO4rEJ.js → treeView-D4JQ5SDB-CiKA6Vk_.js} +1 -1
- package/dist/assets/{treemap-SAJKECNS-DFoZUUFB.js → treemap-SAJKECNS-DZyItgrk.js} +1 -1
- package/dist/assets/{useFastResponsesEnabled-DUmsBEo_.js → useFastResponsesEnabled-CVFqdZoJ.js} +1 -1
- package/dist/assets/{useProfilesData-CR7A3EHG.js → useProfilesData-2bU5tsHk.js} +1 -1
- package/dist/assets/useSummaryDraftStream-330naclI.js +3 -0
- package/dist/assets/{usecaseDiagram-VIAY4XPW-CoLEcFd4.js → usecaseDiagram-VIAY4XPW-BPvQJJoH.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-IQaKsUlu.js → vennDiagram-BLWOH2XV-DSf0l7em.js} +1 -1
- package/dist/assets/{wardley-7MLQ67FV-vXujoat7.js → wardley-7MLQ67FV-SRbPz076.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-BlZY4jIl.js → wardleyDiagram-YMQ3BMBF-FOf01AFj.js} +1 -1
- package/dist/assets/{webhook-DU_O7wr6.js → webhook-BuwLYvh1.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-CaHWqRHH.js → xychartDiagram-TAQBALBS-C-5dSFaR.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/ConfigureBuiltInAgentModal-DyK9oR-z.js +0 -1
- package/dist/assets/NewAgent-YGvo76So.js +0 -1
- package/dist/assets/ProfileSettings-QJ6XF9H6.js +0 -1
- package/dist/assets/channel-u_wLto4J.js +0 -1
- package/dist/assets/flowDiagram-OXPTDLAJ-Dk1z_eyM.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-BN9md4_8.js +0 -8
- package/dist/assets/useSummaryDraftStream-BoQnQsvX.js +0 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
var K=Object.defineProperty;var o=(n,t)=>K(n,"name",{value:t,configurable:!0});import{a as D}from"./rolldown-runtime-DhZMWcEn.js";import{U as F,et as H}from"./issue-detail-
|
|
1
|
+
var K=Object.defineProperty;var o=(n,t)=>K(n,"name",{value:t,configurable:!0});import{a as D}from"./rolldown-runtime-DhZMWcEn.js";import{U as F,et as H}from"./issue-detail-DxleZn9K.js";import{Bf as M,Hp as Y,S_ as Q,Tb as k,V_ as w,Vo as V,dv as r,ep as z,go as G,hm as U,ho as W,lr as J,ov as E,sx as X,ux as Z,w_ as ee,xg as se}from"./index-B9_Uv8kr.js";var l=D(Z(),1),s=D(X(),1),te=[],ae=[],re=[],ie=[],ne=o(async()=>{},"handleEmbeddedAdd");function de(n){return n.status==="queued"||n.status==="running"}o(de,"isRunActive");var oe=(0,l.memo)(o(function({run:t,transcript:e,hasOutput:i,companyId:g}){k();const d=de(t),c=(0,l.useMemo)(()=>d?[t]:re,[d,t]),b=(0,l.useMemo)(()=>d?ie:[{runId:t.id,status:t.status,agentId:t.agentId,agentName:t.agentName,createdAt:t.createdAt,startedAt:t.startedAt,finishedAt:t.finishedAt}],[d,t]),v=(0,l.useMemo)(()=>new Map([[t.id,e]]),[t.id,e]);return(0,s.jsx)(F,{comments:te,linkedRuns:b,timelineEvents:ae,liveRuns:c,companyId:g,onAdd:ne,showComposer:!1,showJumpToLatest:!1,variant:"embedded",emptyMessage:d?r("Waiting for run output..."):r("No run output captured."),enableLiveTranscriptPolling:!1,transcriptsByRunId:v,hasOutputForRun:o(f=>f===t.id&&i,"hasOutputForRun"),includeSucceededRunsWithoutOutput:!0})},"RunChatSurface")),le=4,ue=4,ce=15e3,me=64e3,he=40,O=[],ge=[],ve={running:"dashboardLive.runStatus.running",queued:"dashboardLive.runStatus.queued",succeeded:"dashboardLive.runStatus.succeeded",failed:"dashboardLive.runStatus.failed",timed_out:"dashboardLive.runStatus.timed_out",cancelled:"dashboardLive.runStatus.cancelled",interrupted:"dashboardLive.runStatus.interrupted"};function Ne({companyId:n,title:t,minRunCount:e=le,fetchLimit:i,cardLimit:g=ue,gridClassName:d,cardClassName:c,emptyMessage:b,queryScope:v="dashboard",showMoreLink:f=!0,showTranscripts:x=!1,dedupeLinkedTasks:u=!1}){k();const S=t??r("Agents"),p=b??r("No recent agent runs."),A=i,L=[...U.liveRuns(n),v,{minRunCount:e,fetchLimit:A,dedupeLinkedTasks:u}],y=G({companyId:n,resourceKey:`live-runs:${v}:${e}:${A??"default"}:${u}`,queryKey:L,enabled:!!n,leaderOnly:!0}),{data:N,dataUpdatedAt:I}=Q({queryKey:L,queryFn:o(()=>V.liveRunsForCompany(n,{minCount:e,limit:A,distinctTasks:u}),"queryFn"),enabled:y.enabled});W(y,N,I);const m=N??[],j=(0,l.useMemo)(()=>{if(!u)return m;const a=new Set;return m.filter(h=>h.issueId?a.has(h.issueId)?!1:(a.add(h.issueId),!0):!0)},[u,m]),_=(0,l.useMemo)(()=>j.slice(0,g),[g,j]),C=Math.max(0,j.length-_.length),P=(0,l.useMemo)(()=>[...new Set(_.map(a=>a.issueId).filter(a=>!!a))],[_]),T=ee({queries:P.map(a=>({queryKey:U.issues.detail(a),queryFn:o(()=>Y.get(a),"queryFn"),staleTime:3e4,retry:!1}))}),q=(0,l.useMemo)(()=>{const a=new Map;for(const h of T){const R=h.data;R&&a.set(R.id,R)}return a},[T]),{transcriptByRun:$,hasOutputForRun:B}=H({runs:x?_:ge,companyId:n,maxChunksPerRun:he,logPollIntervalMs:ce,logReadLimitBytes:me,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:S}),m.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:p})}):(0,s.jsx)("div",{className:w("grid grid-cols-1 items-start gap-2 sm:grid-cols-2 sm:gap-4 xl:grid-cols-4",d),children:_.map(a=>(0,s.jsx)(fe,{companyId:n,run:a,issue:a.issueId?q.get(a.issueId):void 0,transcript:$.get(a.id)??O,hasOutput:B(a.id),showTranscript:x,issueLoadFailed:T.some((h,R)=>P[R]===a.issueId&&h.isError),className:c},a.id))}),f&&m.length>0&&(0,s.jsx)("div",{className:"mt-3 flex justify-end text-xs text-muted-foreground",children:(0,s.jsx)(M,{to:"/dashboard/live",className:"hover:text-foreground hover:underline",children:C>0?r("dashboardLive.moreActiveRecentRuns",{count:C}):r("dashboardLive.viewAllRuns")})})]})}o(Ne,"ActiveAgentsPanel");var fe=(0,l.memo)(o(function({companyId:t,run:e,issue:i,transcript:g=O,hasOutput:d=!1,showTranscript:c=!1,issueLoadFailed:b=!1,className:v}){k();const f=ve[e.status],x=f?r(f):e.status.replace(/[_-]/g," "),u=`/agents/${e.agentId}/runs/${e.id}`,S=e.finishedAt?r("dashboardLive.finishedAt",{time:E(e.finishedAt)}):e.startedAt?r("dashboardLive.startedAt",{time:E(e.startedAt)}):r("dashboardLive.queuedAt",{time:E(e.createdAt)}),p=i?.status==="in_review"&&i.externalConversationState==="waiting"?"idle":i?.status??"backlog",A=p.replace(/_([a-z])/g,(I,m)=>m.toUpperCase()),L=p.replace(/[_-]/g," ").replace(/\b\w/g,I=>I.toUpperCase()),y=r(`status.${A}`,{defaultValue:L}),N=i?.title??(b?r("dashboardLive.taskUnavailable"):r("dashboardLive.loadingTask"));return(0,s.jsxs)("div",{className:w("dashboard-agent-card flex min-w-0 flex-col overflow-hidden rounded-xl border",c&&"h-(--sz-320px)",e.status==="running"?"border-(--dashboard-run-border) bg-(--dashboard-run-background) shadow-(--shadow-extract-1)":"border-border bg-background/70",v),"data-run-status":e.status,children:[(0,s.jsxs)("div",{className:w("flex shrink-0 flex-col gap-3 p-3",c&&"border-b border-border/60"),children:[(0,s.jsx)(M,{to:u,title:`${e.agentName} — ${x} · ${S}`,"aria-label":r("dashboardLive.runLinkAria",{agentName:e.agentName,status:x}),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)(J,{agent:{id:e.agentId,name:e.agentName,appearance:e.agentAppearance},size:"sm",className:"gap-2 font-medium"})}),e.issueId?(0,s.jsx)(M,{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}`:N,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)(z,{status:p,size:"md",className:"self-center",title:i?r("dashboardLive.taskStatus",{status:y}):void 0}),(0,s.jsx)("span",{className:"truncate",children:N})]}),(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)(M,{to:u,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)(se,{className:"size-4 shrink-0","aria-hidden":!0}),(0,s.jsx)("span",{className:"truncate",children:e.invocationSource==="timer"?r("dashboardLive.scheduledHeartbeat"):r("dashboardLive.noLinkedTask")})]}),(0,s.jsx)("time",{dateTime:e.finishedAt??e.startedAt??e.createdAt,className:"text-right font-sans text-xs text-muted-foreground/70",children:S})]}),c&&(0,s.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:(0,s.jsx)(oe,{run:e,transcript:g,hasOutput:d,companyId:t})})]})},"AgentRunCard"));export{fe as n,Ne as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var me=Object.defineProperty;var a=(n,r)=>me(n,"name",{value:r,configurable:!0});import{a as ne}from"./rolldown-runtime-DhZMWcEn.js";import{ao as g,ga as V,ir as te,kr as b,lo as ue,ro as le,yr as xe}from"./issue-detail-DhUrNgHw.js";import{t as pe}from"./power-DyuyvgaK.js";import{Au as Q,Bu as N,Cu as U,Du as W,Eu as G,Gn as z,M_ as d,Ou as J,Pm as he,S_ as ie,Tb as Y,Tu as X,V_ as k,cm as ge,dg as ve,dh as re,dv as t,eg as oe,hg as F,hm as ae,j_ as je,ju as fe,mf as be,nd as ye,oh as Ne,qn as ke,rh as we,sx as Pe,ux as Ce,x_ as y,yu as H}from"./index-B7Ixs7A0.js";var v=ne(Ce(),1),e=ne(Pe(),1);function K({adapter:n,canRemove:r,onToggle:c,onRemove:w,onReload:i,onReinstall:o,isToggling:u,isReloading:x,isReinstalling:p,overriddenBy:h,toggleTitleEnabled:P,toggleTitleDisabled:E,disabledBadgeLabel:C}){return Y(),(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:k("font-medium",n.disabled&&"text-muted-foreground line-through"),children:n.label&&n.label!==n.type?n.label:le(n.type)}),(0,e.jsx)(N,{variant:"outline",children:n.source==="external"?t("External"):t("Built-in")}),n.source==="external"&&(n.isLocalPath?(0,e.jsx)("span",{title:t("Installed from local path"),children:(0,e.jsx)(oe,{className:"h-4 w-4 text-amber-500"})}):(0,e.jsx)("span",{title:t("Installed from npm"),children:(0,e.jsx)(re,{className:"h-4 w-4 text-red-500"})})),n.version&&(0,e.jsxs)(N,{variant:"secondary",className:"font-mono text-(length:--text-nano)",children:["v",n.version]}),n.overriddenBuiltin&&(0,e.jsx)(N,{variant:"secondary",className:"text-blue-600 border-blue-400",children:t("Overrides built-in")}),h&&(0,e.jsxs)(N,{variant:"secondary",className:"text-blue-600 border-blue-400",children:[t("Overridden by")," ",h]}),n.disabled&&(0,e.jsx)(N,{variant:"secondary",className:"text-amber-600 border-amber-400",children:C??t("Hidden from menus")})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:[n.type,n.packageName&&n.packageName!==n.type&&(0,e.jsxs)(e.Fragment,{children:[" · ",n.packageName]})," · ",n.modelsCount," ",t("models")]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[o&&(0,e.jsx)(d,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:t("Reinstall adapter (pull latest from npm)"),disabled:p,onClick:a(()=>o(n.type),"onClick"),children:(0,e.jsx)(ve,{className:k("h-4 w-4",p&&"animate-bounce")})}),i&&(0,e.jsx)(d,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:t("Reload adapter (hot-swap)"),disabled:x,onClick:a(()=>i(n.type),"onClick"),children:(0,e.jsx)(we,{className:k("h-4 w-4",x&&"animate-spin")})}),(0,e.jsx)(d,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:n.disabled?P??t("Show in agent menus"):E??t("Hide from agent menus"),disabled:u,onClick:a(()=>c(n.type,!n.disabled),"onClick"),children:(0,e.jsx)(pe,{className:k("h-4 w-4",n.disabled?"text-muted-foreground":"text-green-600")})}),r&&(0,e.jsx)(d,{variant:"outline",size:"icon-sm",className:"h-8 w-8 text-destructive hover:text-destructive",title:t("Remove adapter"),onClick:a(()=>w(n.type),"onClick"),children:(0,e.jsx)(ue,{className:"h-4 w-4"})})]})]})})}a(K,"AdapterRow");function Ae(n){return fetch(`https://registry.npmjs.org/${encodeURIComponent(n)}/latest`,{signal:AbortSignal.timeout(5e3)}).then(r=>r.json()).then(r=>typeof r?.version=="string"?r.version:null).catch(()=>null)}a(Ae,"fetchNpmLatestVersion");function Te({adapter:n,open:r,isReinstalling:c,onConfirm:w,onCancel:i}){Y();const{data:o,isLoading:u}=ie({queryKey:["npm-latest-version",n?.packageName],queryFn:a(()=>n?.packageName?Ae(n.packageName):null,"queryFn"),enabled:r&&!!n?.packageName,staleTime:6e4}),x=n?.version&&o&&n.version===o;return(0,e.jsx)(U,{open:r,onOpenChange:a(p=>{p||i()},"onOpenChange"),children:(0,e.jsxs)(X,{children:[(0,e.jsxs)(J,{children:[(0,e.jsx)(Q,{children:t("Reinstall Adapter")}),(0,e.jsxs)(G,{children:[t("This will pull the latest version of")," ",(0,e.jsx)("strong",{children:n?.packageName})," ",t("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:t("Package")}),(0,e.jsx)("span",{className:"font-mono",children:n?.packageName})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:t("Current")}),(0,e.jsx)("span",{className:"font-mono",children:n?.version?`v${n.version}`:t("unknown")})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:t("Latest on npm")}),(0,e.jsx)("span",{className:"font-mono",children:u?t("checking..."):o?`v${o}`:t("unavailable")})]}),x&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground pt-1",children:t("Already on the latest version.")})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(d,{variant:"outline",onClick:i,disabled:c,children:t("common.cancel")}),(0,e.jsx)(d,{disabled:c,onClick:w,children:c?t("Reinstalling..."):t("Reinstall")})]})]})})}a(Te,"ReinstallDialog");function Le(){const{t:n}=Y(),{selectedCompany:r}=ge(),{setBreadcrumbs:c}=be(),w=je(),{pushToast:i}=ye(),[o,u]=(0,v.useState)(""),[x,p]=(0,v.useState)(""),[h,P]=(0,v.useState)(!1),[E,C]=(0,v.useState)(!1),[j,R]=(0,v.useState)(null),[S,O]=(0,v.useState)(null);(0,v.useEffect)(()=>{c([{label:r?.name??t("Organization"),href:"/dashboard"},{label:t("Settings"),href:"/company/settings"},{label:t("Adapters")}])},[r?.name,c]);const{data:D,isLoading:de}=ie({queryKey:ae.adapters.all,queryFn:a(()=>g.list(),"queryFn")}),f=a(()=>{w.invalidateQueries({queryKey:ae.adapters.all})},"invalidate"),B=y({mutationFn:a(s=>g.install(s),"mutationFn"),onSuccess:a(s=>{f(),b(s.type),C(!1),u(""),p(""),P(!1),i({title:t("Adapter installed"),body:`Type "${s.type}" registered successfully.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:a(s=>{i({title:t("Install failed"),body:s.message,tone:"error"})},"onError")}),I=y({mutationFn:a(s=>g.remove(s),"mutationFn"),onSuccess:a(s=>{f(),b(s.type),i({title:t("Adapter removed"),tone:"success"})},"onSuccess"),onError:a(s=>{i({title:t("Removal failed"),body:s.message,tone:"error"})},"onError")}),A=y({mutationFn:a(({type:s,disabled:l})=>g.setDisabled(s,l),"mutationFn"),onSuccess:a(s=>{f(),b(s.type)},"onSuccess"),onError:a(s=>{i({title:t("Toggle failed"),body:s.message,tone:"error"})},"onError")}),_=y({mutationFn:a(({type:s,paused:l})=>g.setOverridePaused(s,l),"mutationFn"),onSuccess:a(s=>{f(),b(s.type)},"onSuccess"),onError:a(s=>{i({title:t("Override toggle failed"),body:s.message,tone:"error"})},"onError")}),$=y({mutationFn:a(s=>g.reload(s),"mutationFn"),onSuccess:a(s=>{f(),te(s.type),b(s.type),i({title:t("Adapter reloaded"),body:`Type "${s.type}" reloaded.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:a(s=>{i({title:t("Reload failed"),body:s.message,tone:"error"})},"onError")}),L=y({mutationFn:a(s=>g.reinstall(s),"mutationFn"),onSuccess:a(s=>{f(),te(s.type),b(s.type),i({title:t("Adapter reinstalled"),body:`Type "${s.type}" updated from npm.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:a(s=>{i({title:t("Reinstall failed"),body:s.message,tone:"error"})},"onError")}),M=(D??[]).filter(s=>s.source==="builtin"),Z=(D??[]).filter(s=>s.source==="external"),ee=(D??[]).filter(s=>s.source==="external"&&s.overriddenBuiltin).filter(s=>!M.some(l=>l.type===s.type)).map(s=>({type:s.type,label:le(s.type),overriddenBy:[s.packageName,s.version?`v${s.version}`:void 0].filter(Boolean).join(" "),overridePaused:!!s.overridePaused,menuDisabled:!!s.disabled}));if(de)return(0,e.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:t("Loading adapters...")});const se=B.isPending||I.isPending||A.isPending||_.isPending||$.isPending||L.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)(F,{className:"h-6 w-6 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-xl font-semibold",children:t("Adapters")}),(0,e.jsx)(N,{variant:"outline",className:"text-amber-600 border-amber-400",children:"Alpha"})]}),(0,e.jsxs)(U,{open:E,onOpenChange:C,children:[(0,e.jsx)(fe,{asChild:!0,children:(0,e.jsxs)(d,{size:"sm",className:"gap-2",children:[(0,e.jsx)(Ne,{className:"h-4 w-4"}),t("Install Adapter")]})}),(0,e.jsxs)(X,{children:[(0,e.jsxs)(J,{children:[(0,e.jsx)(Q,{children:t("Install External Adapter")}),(0,e.jsxs)(G,{children:[t("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()"}),t(".")]})]}),(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:k("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors",h?"border-border text-muted-foreground hover:text-foreground hover:bg-accent/50":"border-foreground bg-accent text-foreground"),onClick:a(()=>P(!1),"onClick"),children:[(0,e.jsx)(re,{className:"h-3.5 w-3.5"}),t("npm package")]}),(0,e.jsxs)("button",{type:"button",className:k("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors",h?"border-foreground bg-accent text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-accent/50"),onClick:a(()=>P(!0),"onClick"),children:[(0,e.jsx)(oe,{className:"h-3.5 w-3.5"}),t("Local path")]})]}),h?(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)(V,{htmlFor:"adapterLocalPath",children:t("Path to adapter package")}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(H,{id:"adapterLocalPath",className:"flex-1 font-mono text-xs",placeholder:t("/mnt/e/Projects/my-adapter or E:\\Projects\\my-adapter"),value:o,onChange:a(s=>u(s.target.value),"onChange")}),(0,e.jsx)(xe,{})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("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)(V,{htmlFor:"adapterPackageName",children:t("Package Name")}),(0,e.jsx)(H,{id:"adapterPackageName",placeholder:"my-paperclip-adapter",value:o,onChange:a(s=>u(s.target.value),"onChange")})]}),(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)(V,{htmlFor:"adapterVersion",children:t("Version (optional)")}),(0,e.jsx)(H,{id:"adapterVersion",placeholder:t("routineHistory.env.latest"),value:x,onChange:a(s=>p(s.target.value),"onChange")})]})]})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(d,{variant:"outline",onClick:a(()=>C(!1),"onClick"),children:n("common.cancel")}),(0,e.jsx)(d,{onClick:a(()=>B.mutate({packageName:o,version:x||void 0,isLocalPath:h}),"onClick"),disabled:!o||B.isPending,children:B.isPending?t("Installing..."):t("Install")})]})]})]})]}),(0,e.jsx)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)(he,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-700"}),(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:t("External adapters are alpha.")}),(0,e.jsx)("p",{className:"text-muted-foreground",children:t("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)(F,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:t("External Adapters")})]}),Z.length===0?(0,e.jsx)(z,{className:"bg-muted/30",children:(0,e.jsxs)(ke,{className:"flex flex-col items-center justify-center py-10",children:[(0,e.jsx)(F,{className:"h-10 w-10 text-muted-foreground mb-4"}),(0,e.jsx)("p",{className:"text-sm font-medium",children:t("No external adapters installed")}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t("Install an adapter package to extend model support.")})]})}):(0,e.jsx)(z,{className:"block py-0",children:(0,e.jsx)("ul",{className:"divide-y",children:Z.map(s=>{const l=s.overriddenBuiltin,T=l&&!!s.overridePaused,ce=l?{...s,disabled:T??!1}:s;return(0,e.jsx)(K,{adapter:ce,canRemove:!0,onToggle:l?(m,q)=>_.mutate({type:m,paused:q}):(m,q)=>A.mutate({type:m,disabled:q}),onRemove:a(m=>R(m),"onRemove"),onReload:a(m=>$.mutate(m),"onReload"),onReinstall:s.isLocalPath?void 0:m=>O(s),isToggling:l?_.isPending:A.isPending,isReloading:$.isPending,isReinstalling:L.isPending,toggleTitleDisabled:l?"Pause external override":void 0,toggleTitleEnabled:l?"Resume external override":void 0,disabledBadgeLabel:l?"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)(F,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:t("Built-in Adapters")})]}),M.length===0&&ee.length===0?(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:t("No built-in adapters found.")}):(0,e.jsx)(z,{className:"block py-0",children:(0,e.jsxs)("ul",{className:"divide-y",children:[M.map(s=>(0,e.jsx)(K,{adapter:s,canRemove:!1,onToggle:a((l,T)=>A.mutate({type:l,disabled:T}),"onToggle"),onRemove:a(()=>{},"onRemove"),isToggling:se},s.type)),ee.map(s=>(0,e.jsx)(K,{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:a((l,T)=>A.mutate({type:l,disabled:T}),"onToggle"),onRemove:a(()=>{},"onRemove"),isToggling:se,overriddenBy:s.overridePaused?void 0:s.overriddenBy},s.type))]})})]}),(0,e.jsx)(U,{open:j!==null,onOpenChange:a(s=>{s||R(null)},"onOpenChange"),children:(0,e.jsxs)(X,{children:[(0,e.jsxs)(J,{children:[(0,e.jsx)(Q,{children:t("Remove Adapter")}),(0,e.jsxs)(G,{children:[t("Are you sure you want to remove the"),(0,e.jsx)("strong",{children:j})," ",t("adapter? It will be unregistered and removed from the adapter store."),j&&D?.find(s=>s.type===j)?.packageName&&(0,e.jsxs)(e.Fragment,{children:[" ",t("npm packages will be cleaned up from disk.")]})," ",t("This action cannot be undone.")]})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(d,{variant:"outline",onClick:a(()=>R(null),"onClick"),children:n("common.cancel")}),(0,e.jsx)(d,{variant:"destructive",disabled:I.isPending,onClick:a(()=>{j&&I.mutate(j,{onSettled:a(()=>R(null),"onSettled")})},"onClick"),children:I.isPending?t("Removing..."):t("Remove")})]})]})}),(0,e.jsx)(Te,{adapter:S,open:S!==null,isReinstalling:L.isPending,onConfirm:a(()=>{S&&L.mutate(S.type,{onSettled:a(()=>O(null),"onSettled")})},"onConfirm"),onCancel:a(()=>O(null),"onCancel")})]})}a(Le,"AdapterManager");export{Le as AdapterManager};
|
|
1
|
+
var me=Object.defineProperty;var a=(n,r)=>me(n,"name",{value:r,configurable:!0});import{a as ne}from"./rolldown-runtime-DhZMWcEn.js";import{Ar as b,_a as V,ar as te,br as ue,io as le,oo as g,uo as xe}from"./issue-detail-DxleZn9K.js";import{t as pe}from"./power-DY2kZpaP.js";import{Au as Q,Bu as N,Cu as U,Du as W,Eu as G,Gn as z,M_ as d,Ou as J,Pm as he,S_ as ie,Tb as Y,Tu as X,V_ as k,cm as ge,dg as ve,dh as re,dv as t,eg as oe,hg as F,hm as ae,j_ as je,ju as fe,mf as be,nd as ye,oh as Ne,qn as ke,rh as we,sx as Pe,ux as Ce,x_ as y,yu as H}from"./index-B9_Uv8kr.js";var v=ne(Ce(),1),e=ne(Pe(),1);function K({adapter:n,canRemove:r,onToggle:c,onRemove:w,onReload:i,onReinstall:o,isToggling:u,isReloading:x,isReinstalling:p,overriddenBy:h,toggleTitleEnabled:P,toggleTitleDisabled:E,disabledBadgeLabel:C}){return Y(),(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:k("font-medium",n.disabled&&"text-muted-foreground line-through"),children:n.label&&n.label!==n.type?n.label:le(n.type)}),(0,e.jsx)(N,{variant:"outline",children:n.source==="external"?t("External"):t("Built-in")}),n.source==="external"&&(n.isLocalPath?(0,e.jsx)("span",{title:t("Installed from local path"),children:(0,e.jsx)(oe,{className:"h-4 w-4 text-amber-500"})}):(0,e.jsx)("span",{title:t("Installed from npm"),children:(0,e.jsx)(re,{className:"h-4 w-4 text-red-500"})})),n.version&&(0,e.jsxs)(N,{variant:"secondary",className:"font-mono text-(length:--text-nano)",children:["v",n.version]}),n.overriddenBuiltin&&(0,e.jsx)(N,{variant:"secondary",className:"text-blue-600 border-blue-400",children:t("Overrides built-in")}),h&&(0,e.jsxs)(N,{variant:"secondary",className:"text-blue-600 border-blue-400",children:[t("Overridden by")," ",h]}),n.disabled&&(0,e.jsx)(N,{variant:"secondary",className:"text-amber-600 border-amber-400",children:C??t("Hidden from menus")})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5",children:[n.type,n.packageName&&n.packageName!==n.type&&(0,e.jsxs)(e.Fragment,{children:[" · ",n.packageName]})," · ",n.modelsCount," ",t("models")]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[o&&(0,e.jsx)(d,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:t("Reinstall adapter (pull latest from npm)"),disabled:p,onClick:a(()=>o(n.type),"onClick"),children:(0,e.jsx)(ve,{className:k("h-4 w-4",p&&"animate-bounce")})}),i&&(0,e.jsx)(d,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:t("Reload adapter (hot-swap)"),disabled:x,onClick:a(()=>i(n.type),"onClick"),children:(0,e.jsx)(we,{className:k("h-4 w-4",x&&"animate-spin")})}),(0,e.jsx)(d,{variant:"outline",size:"icon-sm",className:"h-8 w-8",title:n.disabled?P??t("Show in agent menus"):E??t("Hide from agent menus"),disabled:u,onClick:a(()=>c(n.type,!n.disabled),"onClick"),children:(0,e.jsx)(pe,{className:k("h-4 w-4",n.disabled?"text-muted-foreground":"text-green-600")})}),r&&(0,e.jsx)(d,{variant:"outline",size:"icon-sm",className:"h-8 w-8 text-destructive hover:text-destructive",title:t("Remove adapter"),onClick:a(()=>w(n.type),"onClick"),children:(0,e.jsx)(xe,{className:"h-4 w-4"})})]})]})})}a(K,"AdapterRow");function Ae(n){return fetch(`https://registry.npmjs.org/${encodeURIComponent(n)}/latest`,{signal:AbortSignal.timeout(5e3)}).then(r=>r.json()).then(r=>typeof r?.version=="string"?r.version:null).catch(()=>null)}a(Ae,"fetchNpmLatestVersion");function Te({adapter:n,open:r,isReinstalling:c,onConfirm:w,onCancel:i}){Y();const{data:o,isLoading:u}=ie({queryKey:["npm-latest-version",n?.packageName],queryFn:a(()=>n?.packageName?Ae(n.packageName):null,"queryFn"),enabled:r&&!!n?.packageName,staleTime:6e4}),x=n?.version&&o&&n.version===o;return(0,e.jsx)(U,{open:r,onOpenChange:a(p=>{p||i()},"onOpenChange"),children:(0,e.jsxs)(X,{children:[(0,e.jsxs)(J,{children:[(0,e.jsx)(Q,{children:t("Reinstall Adapter")}),(0,e.jsxs)(G,{children:[t("This will pull the latest version of")," ",(0,e.jsx)("strong",{children:n?.packageName})," ",t("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:t("Package")}),(0,e.jsx)("span",{className:"font-mono",children:n?.packageName})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:t("Current")}),(0,e.jsx)("span",{className:"font-mono",children:n?.version?`v${n.version}`:t("unknown")})]}),(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("span",{className:"text-muted-foreground",children:t("Latest on npm")}),(0,e.jsx)("span",{className:"font-mono",children:u?t("checking..."):o?`v${o}`:t("unavailable")})]}),x&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground pt-1",children:t("Already on the latest version.")})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(d,{variant:"outline",onClick:i,disabled:c,children:t("common.cancel")}),(0,e.jsx)(d,{disabled:c,onClick:w,children:c?t("Reinstalling..."):t("Reinstall")})]})]})})}a(Te,"ReinstallDialog");function Le(){const{t:n}=Y(),{selectedCompany:r}=ge(),{setBreadcrumbs:c}=be(),w=je(),{pushToast:i}=ye(),[o,u]=(0,v.useState)(""),[x,p]=(0,v.useState)(""),[h,P]=(0,v.useState)(!1),[E,C]=(0,v.useState)(!1),[j,R]=(0,v.useState)(null),[S,O]=(0,v.useState)(null);(0,v.useEffect)(()=>{c([{label:r?.name??t("Organization"),href:"/dashboard"},{label:t("Settings"),href:"/company/settings"},{label:t("Adapters")}])},[r?.name,c]);const{data:D,isLoading:de}=ie({queryKey:ae.adapters.all,queryFn:a(()=>g.list(),"queryFn")}),f=a(()=>{w.invalidateQueries({queryKey:ae.adapters.all})},"invalidate"),B=y({mutationFn:a(s=>g.install(s),"mutationFn"),onSuccess:a(s=>{f(),b(s.type),C(!1),u(""),p(""),P(!1),i({title:t("Adapter installed"),body:`Type "${s.type}" registered successfully.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:a(s=>{i({title:t("Install failed"),body:s.message,tone:"error"})},"onError")}),I=y({mutationFn:a(s=>g.remove(s),"mutationFn"),onSuccess:a(s=>{f(),b(s.type),i({title:t("Adapter removed"),tone:"success"})},"onSuccess"),onError:a(s=>{i({title:t("Removal failed"),body:s.message,tone:"error"})},"onError")}),A=y({mutationFn:a(({type:s,disabled:l})=>g.setDisabled(s,l),"mutationFn"),onSuccess:a(s=>{f(),b(s.type)},"onSuccess"),onError:a(s=>{i({title:t("Toggle failed"),body:s.message,tone:"error"})},"onError")}),_=y({mutationFn:a(({type:s,paused:l})=>g.setOverridePaused(s,l),"mutationFn"),onSuccess:a(s=>{f(),b(s.type)},"onSuccess"),onError:a(s=>{i({title:t("Override toggle failed"),body:s.message,tone:"error"})},"onError")}),$=y({mutationFn:a(s=>g.reload(s),"mutationFn"),onSuccess:a(s=>{f(),te(s.type),b(s.type),i({title:t("Adapter reloaded"),body:`Type "${s.type}" reloaded.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:a(s=>{i({title:t("Reload failed"),body:s.message,tone:"error"})},"onError")}),L=y({mutationFn:a(s=>g.reinstall(s),"mutationFn"),onSuccess:a(s=>{f(),te(s.type),b(s.type),i({title:t("Adapter reinstalled"),body:`Type "${s.type}" updated from npm.${s.version?` (v${s.version})`:""}`,tone:"success"})},"onSuccess"),onError:a(s=>{i({title:t("Reinstall failed"),body:s.message,tone:"error"})},"onError")}),M=(D??[]).filter(s=>s.source==="builtin"),Z=(D??[]).filter(s=>s.source==="external"),ee=(D??[]).filter(s=>s.source==="external"&&s.overriddenBuiltin).filter(s=>!M.some(l=>l.type===s.type)).map(s=>({type:s.type,label:le(s.type),overriddenBy:[s.packageName,s.version?`v${s.version}`:void 0].filter(Boolean).join(" "),overridePaused:!!s.overridePaused,menuDisabled:!!s.disabled}));if(de)return(0,e.jsx)("div",{className:"p-4 text-sm text-muted-foreground",children:t("Loading adapters...")});const se=B.isPending||I.isPending||A.isPending||_.isPending||$.isPending||L.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)(F,{className:"h-6 w-6 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-xl font-semibold",children:t("Adapters")}),(0,e.jsx)(N,{variant:"outline",className:"text-amber-600 border-amber-400",children:"Alpha"})]}),(0,e.jsxs)(U,{open:E,onOpenChange:C,children:[(0,e.jsx)(fe,{asChild:!0,children:(0,e.jsxs)(d,{size:"sm",className:"gap-2",children:[(0,e.jsx)(Ne,{className:"h-4 w-4"}),t("Install Adapter")]})}),(0,e.jsxs)(X,{children:[(0,e.jsxs)(J,{children:[(0,e.jsx)(Q,{children:t("Install External Adapter")}),(0,e.jsxs)(G,{children:[t("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()"}),t(".")]})]}),(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:k("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors",h?"border-border text-muted-foreground hover:text-foreground hover:bg-accent/50":"border-foreground bg-accent text-foreground"),onClick:a(()=>P(!1),"onClick"),children:[(0,e.jsx)(re,{className:"h-3.5 w-3.5"}),t("npm package")]}),(0,e.jsxs)("button",{type:"button",className:k("inline-flex items-center gap-1.5 rounded-md border px-3 py-1.5 text-xs transition-colors",h?"border-foreground bg-accent text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-accent/50"),onClick:a(()=>P(!0),"onClick"),children:[(0,e.jsx)(oe,{className:"h-3.5 w-3.5"}),t("Local path")]})]}),h?(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)(V,{htmlFor:"adapterLocalPath",children:t("Path to adapter package")}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(H,{id:"adapterLocalPath",className:"flex-1 font-mono text-xs",placeholder:t("/mnt/e/Projects/my-adapter or E:\\Projects\\my-adapter"),value:o,onChange:a(s=>u(s.target.value),"onChange")}),(0,e.jsx)(ue,{})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:t("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)(V,{htmlFor:"adapterPackageName",children:t("Package Name")}),(0,e.jsx)(H,{id:"adapterPackageName",placeholder:"my-paperclip-adapter",value:o,onChange:a(s=>u(s.target.value),"onChange")})]}),(0,e.jsxs)("div",{className:"grid gap-2",children:[(0,e.jsx)(V,{htmlFor:"adapterVersion",children:t("Version (optional)")}),(0,e.jsx)(H,{id:"adapterVersion",placeholder:t("routineHistory.env.latest"),value:x,onChange:a(s=>p(s.target.value),"onChange")})]})]})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(d,{variant:"outline",onClick:a(()=>C(!1),"onClick"),children:n("common.cancel")}),(0,e.jsx)(d,{onClick:a(()=>B.mutate({packageName:o,version:x||void 0,isLocalPath:h}),"onClick"),disabled:!o||B.isPending,children:B.isPending?t("Installing..."):t("Install")})]})]})]})]}),(0,e.jsx)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-4 py-3",children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)(he,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-700"}),(0,e.jsxs)("div",{className:"space-y-1 text-sm",children:[(0,e.jsx)("p",{className:"font-medium text-foreground",children:t("External adapters are alpha.")}),(0,e.jsx)("p",{className:"text-muted-foreground",children:t("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)(F,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:t("External Adapters")})]}),Z.length===0?(0,e.jsx)(z,{className:"bg-muted/30",children:(0,e.jsxs)(ke,{className:"flex flex-col items-center justify-center py-10",children:[(0,e.jsx)(F,{className:"h-10 w-10 text-muted-foreground mb-4"}),(0,e.jsx)("p",{className:"text-sm font-medium",children:t("No external adapters installed")}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t("Install an adapter package to extend model support.")})]})}):(0,e.jsx)(z,{className:"block py-0",children:(0,e.jsx)("ul",{className:"divide-y",children:Z.map(s=>{const l=s.overriddenBuiltin,T=l&&!!s.overridePaused,ce=l?{...s,disabled:T??!1}:s;return(0,e.jsx)(K,{adapter:ce,canRemove:!0,onToggle:l?(m,q)=>_.mutate({type:m,paused:q}):(m,q)=>A.mutate({type:m,disabled:q}),onRemove:a(m=>R(m),"onRemove"),onReload:a(m=>$.mutate(m),"onReload"),onReinstall:s.isLocalPath?void 0:m=>O(s),isToggling:l?_.isPending:A.isPending,isReloading:$.isPending,isReinstalling:L.isPending,toggleTitleDisabled:l?"Pause external override":void 0,toggleTitleEnabled:l?"Resume external override":void 0,disabledBadgeLabel:l?"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)(F,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:t("Built-in Adapters")})]}),M.length===0&&ee.length===0?(0,e.jsx)("div",{className:"text-sm text-muted-foreground",children:t("No built-in adapters found.")}):(0,e.jsx)(z,{className:"block py-0",children:(0,e.jsxs)("ul",{className:"divide-y",children:[M.map(s=>(0,e.jsx)(K,{adapter:s,canRemove:!1,onToggle:a((l,T)=>A.mutate({type:l,disabled:T}),"onToggle"),onRemove:a(()=>{},"onRemove"),isToggling:se},s.type)),ee.map(s=>(0,e.jsx)(K,{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:a((l,T)=>A.mutate({type:l,disabled:T}),"onToggle"),onRemove:a(()=>{},"onRemove"),isToggling:se,overriddenBy:s.overridePaused?void 0:s.overriddenBy},s.type))]})})]}),(0,e.jsx)(U,{open:j!==null,onOpenChange:a(s=>{s||R(null)},"onOpenChange"),children:(0,e.jsxs)(X,{children:[(0,e.jsxs)(J,{children:[(0,e.jsx)(Q,{children:t("Remove Adapter")}),(0,e.jsxs)(G,{children:[t("Are you sure you want to remove the"),(0,e.jsx)("strong",{children:j})," ",t("adapter? It will be unregistered and removed from the adapter store."),j&&D?.find(s=>s.type===j)?.packageName&&(0,e.jsxs)(e.Fragment,{children:[" ",t("npm packages will be cleaned up from disk.")]})," ",t("This action cannot be undone.")]})]}),(0,e.jsxs)(W,{children:[(0,e.jsx)(d,{variant:"outline",onClick:a(()=>R(null),"onClick"),children:n("common.cancel")}),(0,e.jsx)(d,{variant:"destructive",disabled:I.isPending,onClick:a(()=>{j&&I.mutate(j,{onSettled:a(()=>R(null),"onSettled")})},"onClick"),children:I.isPending?t("Removing..."):t("Remove")})]})]})}),(0,e.jsx)(Te,{adapter:S,open:S!==null,isReinstalling:L.isPending,onConfirm:a(()=>{S&&L.mutate(S.type,{onSettled:a(()=>O(null),"onSettled")})},"onConfirm"),onCancel:a(()=>O(null),"onCancel")})]})}a(Le,"AdapterManager");export{Le as AdapterManager};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var We=Object.defineProperty;var s=(t,o)=>We(t,"name",{value:o,configurable:!0});import{a as qe}from"./rolldown-runtime-DhZMWcEn.js";import{
|
|
1
|
+
var We=Object.defineProperty;var s=(t,o)=>We(t,"name",{value:o,configurable:!0});import{a as qe}from"./rolldown-runtime-DhZMWcEn.js";import{Oo as Ye,Sn as Ae,Ur as Xe,_a as Ze,_n as et,fn as tt,fo as st,gr as at,hn as nt,ii as ot,mn as rt,ni as lt,qr as it,vn as dt,xa as ct}from"./issue-detail-DxleZn9K.js";import{a as ut,c as Y,i as mt,n as xt,o as pt,r as re,s as ft,t as Te}from"./smoke-lab-matrix-Do3yT9YB.js";import{t as ht}from"./circle-slash-pxQo3SIQ.js";import{t as gt}from"./link-DijVPzPg.js";import{t as bt}from"./power-DY2kZpaP.js";import{Au as jt,Bf as ie,Bu as ne,C as yt,Cu as vt,Dh as Ne,Dm as Nt,Eg as wt,Eu as kt,Hf as le,Ih as ve,Jm as Ct,M_ as y,Ng as St,Nn as At,Ou as Tt,Rg as Pt,S_ as Q,Tb as q,Tm as Lt,Tu as Et,V_ as Z,Wd as Ft,Wf as ze,_h as Ke,ai as Pe,cm as $e,dv as a,eh as Be,fu as It,gg as he,hm as _,i_ as Dt,j_ as we,ju as Mt,ld as _t,md as Ot,mf as Rt,ni as Vt,oh as Ue,oi as ge,pf as qt,qd as zt,qg as Kt,qm as Ge,ri as $t,sd as Bt,sh as Ut,si as Gt,sx as Ht,td as ke,tg as Le,ti as R,u_ as Qt,ud as se,ug as Jt,ux as Wt,vu as He,wm as ce,x_ as I,yd as Yt,yu as Ee,zg as ue}from"./index-B9_Uv8kr.js";import{a as de,i as Ce,r as ee,s as Qe}from"./shared-CI7fMsr8.js";import{a as Xt,i as Zt,n as es,r as ts,t as ss}from"./profile-summary-D_TiZOEc.js";import{n as as,t as ns}from"./useProfilesData-2bU5tsHk.js";var Fe=`I want to connect an MCP (Model Context Protocol) server to Paperclip, and I need a paste-ready config.
|
|
2
2
|
|
|
3
3
|
Target server: <name the server, or ask me if I have not said>
|
|
4
4
|
|
|
@@ -29,11 +29,11 @@ Please:
|
|
|
29
29
|
- whether this server requires browser sign-in (OAuth) instead of headers, in which case say so plainly
|
|
30
30
|
- the official documentation links you actually used
|
|
31
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.`,os=["Copy this prompt and send it to an agent or assistant that can look up the server's documentation.","Paste only the JSON block it replies with back into the box on this page.","Paperclip reads the header names from that JSON and asks you for the values, then stores them as Paperclip secrets — so the config you paste should contain placeholders, not live credentials."],g=qe(Wt(),1),e=qe(Gt(),1);function rs({companyId:t,agentOptions:o}){q();const[l,i]=(0,g.useState)(""),u=Q({queryKey:l?_.tools.effectiveProfilesForAgent(t,l):["tools",t,"profiles","effective","agent","__none__"],queryFn:s(()=>O.getEffectiveProfilesForAgent(t,l),"queryFn"),enabled:!!l});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)(nt,{children:a("tools.common.agent")}),(0,e.jsx)(tt,{agents:o,value:l,onChange:i})]}),l?u.isLoading?(0,e.jsx)(Ce,{label:a("tools.profiles.effective.checking")}):u.error?(0,e.jsx)(ee,{error:u.error,onRetry:s(()=>u.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:a("tools.profiles.effective.canUse")}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(u.data?.allowedToolNames??[]).length," tools"]})]}),(u.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:a("tools.profiles.effective.noTools")}):(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:(u.data?.allowedToolNames??[]).slice(0,80).map(c=>(0,e.jsx)(ne,{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:a("tools.profiles.title")}),(u.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:a("tools.profiles.effective.noProfile")}):(0,e.jsx)("div",{className:"divide-y divide-border rounded-lg border border-border",children:(u.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)(ne,{variant:"secondary",children:a("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:a("tools.profiles.effective.pickAgent")})]})}s(rs,"EffectiveAgentPanel");var Ie={read_only:{titleKey:"tools.profiles.templates.readOnly.title",descriptionKey:"tools.profiles.templates.readOnly.description"},everyday:{titleKey:"tools.profiles.templates.everyday.title",descriptionKey:"tools.profiles.templates.everyday.description"},full_access:{titleKey:"tools.profiles.templates.fullAccess.title",descriptionKey:"tools.profiles.templates.fullAccess.description"},scratch:{titleKey:"tools.profiles.templates.scratch.title",descriptionKey:"tools.profiles.templates.scratch.description"},copy:{titleKey:"tools.profiles.templates.copy.title",descriptionKey:"tools.profiles.templates.copy.description"}};function De(t){return t?`/apps/advanced/profiles/new?template=${encodeURIComponent(t)}`:"/apps/advanced/profiles/new"}s(De,"newProfileHref");function ls(t){return t==="active"?"default":t==="draft"?"secondary":"outline"}s(ls,"statusVariant");function is({companyId:t,initialStatusFilter:o,initialResolverOpen:l}){const{t:i}=q(),u=Ke(),c=we(),{pushToast:p}=ke(),{profiles:f,agents:h}=ns(t),[D,x]=(0,g.useState)(!!l),[C,T]=(0,g.useState)(o??"active"),[P,N]=(0,g.useState)(null);(0,g.useEffect)(()=>{new URLSearchParams(window.location.search).get("check")==="1"&&x(!0)},[]);const k=(0,g.useMemo)(()=>(h.data??[]).map(n=>({id:n.id,name:n.name})),[h.data]),K=s(()=>{c.invalidateQueries({queryKey:_.tools.profiles(t)}),c.invalidateQueries({queryKey:_.tools.testAgentAccesses()})},"invalidate"),S=s(n=>String(n?.message??n),"errorBody"),G=I({mutationFn:s(n=>O.duplicateProfile(n.id,{name:i("tools.profiles.dialog.copyNameParenthetical",{defaultValue:"{{name}} (copy)",name:n.name})}),"mutationFn"),onSuccess:s(()=>{p({title:i("tools.profiles.toast.duplicated",{defaultValue:"Profile duplicated"}),body:i("tools.profiles.toast.copyUnassigned",{defaultValue:"The copy is not assigned to anyone yet."}),tone:"success"}),K()},"onSuccess"),onError:s(n=>p({title:i("tools.profiles.toast.duplicateFailed",{defaultValue:"Could not duplicate"}),body:S(n),tone:"error"}),"onError")}),V=I({mutationFn:s(n=>O.updateProfile(n.id,{status:"archived"}),"mutationFn"),onSuccess:s(()=>{p({title:i("tools.profiles.toast.archived",{defaultValue:"Profile archived"}),tone:"success"}),K()},"onSuccess"),onError:s(n=>p({title:i("tools.profiles.toast.archiveFailed",{defaultValue:"Could not archive"}),body:S(n),tone:"error"}),"onError")}),z=I({mutationFn:s(n=>O.updateProfile(n.id,{status:"active"}),"mutationFn"),onSuccess:s(()=>{p({title:i("tools.profiles.toast.restored",{defaultValue:"Profile restored"}),tone:"success"}),K()},"onSuccess"),onError:s(n=>p({title:i("tools.profiles.toast.restoreFailed",{defaultValue:"Could not restore"}),body:S(n),tone:"error"}),"onError")}),w=I({mutationFn:s(n=>O.deleteProfile(n.id),"mutationFn"),onSuccess:s(()=>{p({title:i("tools.profiles.toast.deleted",{defaultValue:"Profile deleted"}),tone:"success"}),K()},"onSuccess"),onError:s(n=>p({title:i("tools.profiles.toast.deleteFailed",{defaultValue:"Could not delete"}),body:S(n),tone:"error"}),"onError")}),R=(0,e.jsx)(Qe,{title:i("tools.profiles.title",{defaultValue:"Access profiles"}),description:i("tools.profiles.description",{defaultValue:"Decide which tools your agents can use. Build a profile once, then assign it to the agents that need it."}),actions:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(y,{variant:"outline",onClick:s(()=>x(!0),"onClick"),children:[(0,e.jsx)(Ue,{className:"mr-1.5 h-4 w-4"}),i("tools.profiles.checkAgentAccess",{defaultValue:"Check an agent's access"})]}),(0,e.jsxs)(y,{onClick:s(()=>u(De()),"onClick"),children:[(0,e.jsx)(He,{className:"mr-1.5 h-4 w-4"}),i("tools.profiles.newProfile",{defaultValue:"New profile"})]})]})}),$=(0,e.jsx)(st,{open:D,onOpenChange:x,children:(0,e.jsxs)(it,{className:"w-full gap-0 p-0 sm:max-w-xl",children:[(0,e.jsxs)(ot,{className:"border-b border-border",children:[(0,e.jsx)(et,{children:i("tools.profiles.checkAgentAccess",{defaultValue:"Check an agent's access"})}),(0,e.jsx)(lt,{children:i("tools.profiles.checkAgentAccessDescription",{defaultValue:"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)(rs,{companyId:t,agentOptions:k})})]})});if(f.isLoading)return(0,e.jsxs)("div",{className:"space-y-5",children:[R,(0,e.jsx)(Ce,{label:i("tools.profiles.loading",{defaultValue:"Loading profiles…"})})]});if(f.isError)return(0,e.jsxs)("div",{className:"space-y-5",children:[R,(0,e.jsx)(ee,{error:f.error,onRetry:s(()=>f.refetch(),"onRetry")})]});const B=(f.data?.profiles??[]).filter(n=>C==="archived"?n.status==="archived":n.status!=="archived");return(0,e.jsxs)("div",{className:"space-y-5",children:[R,(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(()=>T(n),"onClick"),className:Z("rounded px-3 py-1 text-sm font-medium",C===n?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:n==="active"?i("tools.profiles.status.active",{defaultValue:"Active"}):i("tools.profiles.status.archived",{defaultValue:"Archived"})},n))}),B.length===0?C==="archived"?(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:i("tools.profiles.emptyArchived",{defaultValue:"No archived profiles."})}):(0,e.jsx)(cs,{onPick:s(n=>u(De(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:i("tools.profiles.table.profile",{defaultValue:"Profile"})}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:i("tools.profiles.table.allows",{defaultValue:"Allows"})}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:i("tools.profiles.table.assignedTo",{defaultValue:"Assigned to"})}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:i("tools.common.status",{defaultValue:"Status"})}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:i("tools.common.updated",{defaultValue:"Updated"})}),(0,e.jsx)("th",{className:"w-10 px-3 py-2"})]})}),(0,e.jsx)("tbody",{children:B.map(n=>{const A=ts(n.summary),M=Zt(n),J=s(()=>u(M?`/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:J,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:es(n.summary)}),(n.newToolsPendingCount??0)>0?(0,e.jsx)(ne,{variant:"outline",className:"border-amber-500/50 bg-amber-500/10 text-amber-800 dark:text-amber-200",children:i("tools.profiles.table.newTools",{defaultValue:"{{count}} new",count:n.newToolsPendingCount})}):null]})}),(0,e.jsx)("td",{className:"px-3 py-1.5",children:A.unassigned?(0,e.jsxs)("span",{className:"text-muted-foreground",children:[A.text,(0,e.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground/70",children:["— ",i("tools.profiles.table.noAccessEffect",{defaultValue:"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)(Nt,{className:"h-3.5 w-3.5 text-muted-foreground"}),A.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)(ne,{variant:ls(n.status),children:i(`tools.profiles.status.${n.status}`,{defaultValue:ss[n.status]})}),M?(0,e.jsx)("button",{type:"button",onClick:J,className:"text-xs font-medium text-primary hover:underline",children:i("tools.common.resume",{defaultValue:"Resume"})}):null]})}),(0,e.jsx)("td",{className:"px-3 py-1.5",children:(0,e.jsx)(de,{value:n.updatedAt})}),(0,e.jsx)("td",{className:"px-3 py-1.5 text-right",children:(0,e.jsx)(ds,{onEdit:J,onDuplicate:s(()=>G.mutate(n),"onDuplicate"),onArchive:s(()=>V.mutate(n),"onArchive"),onRestore:n.status==="archived"?()=>N({kind:"restore",profile:n}):void 0,onDelete:s(()=>N({kind:"delete",profile:n}),"onDelete")})})]},n.id)})})]})}),$,(0,e.jsx)(Xt,{kind:P?.kind??null,profile:P?.profile??null,pending:z.isPending||w.isPending,onClose:s(()=>N(null),"onClose"),onArchive:s(()=>{P&&V.mutate(P.profile,{onSuccess:s(()=>N(null),"onSuccess")})},"onArchive"),onRestore:s(()=>{P&&z.mutate(P.profile,{onSuccess:s(()=>N(null),"onSuccess")})},"onRestore"),onDelete:s(()=>{P&&w.mutate(P.profile,{onSuccess:s(()=>N(null),"onSuccess")})},"onDelete")})]})}s(is,"ProfilesIndex");function ds({onEdit:t,onDuplicate:o,onArchive:l,onRestore:i,onDelete:u}){const{t:c}=q();return(0,e.jsxs)(Bt,{children:[(0,e.jsx)(Yt,{asChild:!0,children:(0,e.jsx)("button",{type:"button","aria-label":c("tools.profiles.rowActions",{defaultValue:"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)(Jt,{className:"h-4 w-4"})})}),(0,e.jsxs)(_t,{align:"end",children:[(0,e.jsx)(se,{onSelect:t,children:c("tools.common.edit",{defaultValue:"Edit"})}),(0,e.jsx)(se,{onSelect:o,children:c("tools.common.duplicate",{defaultValue:"Duplicate"})}),i?(0,e.jsxs)(se,{onSelect:i,children:[(0,e.jsx)(Ye,{className:"mr-1.5 h-4 w-4"}),c("tools.common.restore",{defaultValue:"Restore"})]}):(0,e.jsx)(se,{onSelect:l,children:c("tools.common.archive",{defaultValue:"Archive"})}),(0,e.jsx)(Rt,{}),(0,e.jsx)(se,{onSelect:u,className:"text-destructive focus:text-destructive",children:c("tools.common.delete",{defaultValue:"Delete"})})]})]})}s(ds,"RowMenu");function cs({onPick:t}){const{t:o}=q();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:o("tools.profiles.empty.title",{defaultValue:"Create your first access profile"})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:o("tools.profiles.empty.description",{defaultValue:"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:as.map(l=>(0,e.jsxs)("button",{type:"button",onClick:s(()=>t(l.key),"onClick"),className:Z("flex flex-col items-start gap-1 rounded-md border border-border bg-card px-4 py-3 text-left transition-colors","hover:border-primary hover:bg-primary/5"),children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:o(Ie[l.key].titleKey,{defaultValue:l.title})}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:o(Ie[l.key].descriptionKey,{defaultValue:l.description})})]},l.key))})]})}s(cs,"EmptyTemplatePicker");var ae=s(()=>({name:"",clientLabel:"",ownerNote:"",expiresAt:us(new Date(Date.now()+7776e6)),allowedActions:["tools/list","tools/call"]}),"defaultTokenDraft");function us(t){return t.toISOString().slice(0,10)}s(us,"toDateInputValue");function U(t){return t?t.length>12?`${t.slice(0,8)}...`:t:null}s(U,"shortId");function Me(t,o,l=`${o}s`){return`${t} ${t===1?o:l}`}s(Me,"pluralize");function ms(t){if(!t)return null;const o=t instanceof Date?t:new Date(t);return Number.isNaN(o.getTime())?null:o}s(ms,"dateValue");function xs(t){return t.tokens.reduce((o,l)=>{const i=ms(l.lastUsedAt);return i&&(!o||i.getTime()>o.getTime())?i:o},null)}s(xs,"latestTokenActivity");function ps(t,o){return t.agentId?o.get(t.agentId)??`Agent ${U(t.agentId)}`:t.createdByAgentId?o.get(t.createdByAgentId)??`Agent ${U(t.createdByAgentId)}`:t.createdByUserId?`Board user ${U(t.createdByUserId)}`:"Board"}s(ps,"formatOwner");function fs(t,o,l){return t.contextScopeType!=="none"&&t.contextScopeId?t.contextScopeType==="project"?`Project ${o.get(t.contextScopeId)??U(t.contextScopeId)}`:t.contextScopeType==="agent"?`Agent ${l.get(t.contextScopeId)??U(t.contextScopeId)}`:`${t.contextScopeType} ${U(t.contextScopeId)}`:t.projectId?`Project ${o.get(t.projectId)??U(t.projectId)}`:t.issueId?`Issue ${U(t.issueId)}`:t.agentId?`Agent ${l.get(t.agentId)??U(t.agentId)}`:"Company"}s(fs,"formatScope");function _e(t){if(!t)return"Profile unavailable";const o=t.summary.allowedToolCount;return t.summary.accessMode==="all_except"?`${Me(Math.max(t.summary.totalToolCount-t.summary.excludedToolCount,0),"tool")} allowed`:o===0?"No tools allowed":`${Me(o,"tool")} allowed`}s(_e,"formatAllowedTools");function Re(t){return JSON.stringify(t,null,2)}s(Re,"formatSnippetConfig");function hs(t){return t?`${t}T23:59:59.000Z`:null}s(hs,"buildTokenExpiresAt");function gs({companyId:t}){q();const o=we(),{pushToast:l}=ke(),[i,u]=(0,g.useState)(!1),[c,p]=(0,g.useState)({name:"",description:"",profileId:""}),[f,h]=(0,g.useState)({}),[D,x]=(0,g.useState)(null),[C,T]=(0,g.useState)({}),[P,N]=(0,g.useState)(null),k=Q({queryKey:_.tools.gateways(t),queryFn:s(()=>O.listGateways(t),"queryFn")}),K=Q({queryKey:_.tools.profiles(t),queryFn:s(()=>O.listProfiles(t),"queryFn")}),S=Q({queryKey:_.agents.list(t),queryFn:s(()=>qt.list(t),"queryFn")}),G=Q({queryKey:_.projects.list(t,{includeArchived:!0}),queryFn:s(()=>It.list(t,{includeArchived:!0}),"queryFn")}),V=(0,g.useMemo)(()=>typeof window>"u"?"":window.location.origin,[]),z=K.data?.profiles??[],w=z.filter(r=>r.status!=="archived"),R=(0,g.useMemo)(()=>new Map(z.map(r=>[r.id,r])),[z]),$=(0,g.useMemo)(()=>new Map((S.data??[]).map(r=>[r.id,r.name])),[S.data]),B=(0,g.useMemo)(()=>new Map((G.data??[]).map(r=>[r.id,r.name])),[G.data]),n=s(()=>o.invalidateQueries({queryKey:_.tools.gateways(t)}),"invalidateGateways"),A=I({mutationFn:s(()=>O.createGateway(t,{name:c.name.trim(),description:c.description.trim()||null,profileId:c.profileId,defaultProfileMode:"gateway_only",contextScopeType:"company"}),"mutationFn"),onSuccess:s(async r=>{p({name:"",description:"",profileId:w[0]?.id??""}),u(!1),l({title:a("apps.gateways.newGateway.toast.createdTitle"),body:r.name,tone:"success"}),await n()},"onSuccess"),onError:s(r=>{l({title:a("apps.gateways.newGateway.toast.createFailedTitle"),body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")}),M=I({mutationFn:s(async r=>{const b=f[r]??ae();return O.createGatewayToken(t,r,{name:b.name.trim(),clientLabel:b.clientLabel.trim(),ownerNote:b.ownerNote.trim(),allowedActions:b.allowedActions,expiresAt:hs(b.expiresAt)})},"mutationFn"),onSuccess:s(async r=>{T(b=>({...b,[r.gatewayId]:r})),x(null),h(b=>({...b,[r.gatewayId]:ae()})),l({title:a("tools.gateways.toast.tokenIssued"),body:`${r.name} was created. Copy it now; it will not be shown again.`,tone:"success"}),await n()},"onSuccess"),onError:s(r=>{l({title:a("tools.gateways.toast.tokenIssueFailed"),body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")}),J=I({mutationFn:s(r=>O.revokeGatewayToken(t,r),"mutationFn"),onSuccess:s(async r=>{N(null),l({title:a("apps.gateways.tokens.toast.revokedTitle"),body:r.name,tone:"success"}),await n()},"onSuccess"),onError:s(r=>{l({title:a("apps.gateways.tokens.toast.revokeFailedTitle"),body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")});async function X(r,b){try{await At(r),l({title:a("Copied to clipboard"),body:b,tone:"success"})}catch(W){l({title:a("Copy failed"),body:W instanceof Error?W.message:"Clipboard access is unavailable.",tone:"error"})}}s(X,"copyText");function d(r){T(b=>{const W={...b};return delete W[r],W}),h(b=>({...b,[r]:b[r]??ae()})),x(r)}s(d,"startIssuing");function v(r){if(r.preventDefault(),!c.profileId){l({title:a("tools.gateways.toast.pickProfile"),body:"A gateway needs an access profile before it can be created.",tone:"warn"});return}A.mutate()}s(v,"submitCreateGateway");function j(r,b){if(r.preventDefault(),(f[b]??ae()).allowedActions.length===0){l({title:a("tools.gateways.toast.pickTokenActions"),body:"Gateway tokens need at least one allowed MCP action.",tone:"warn"});return}M.mutate(b)}if(s(j,"submitCreateToken"),k.isLoading)return(0,e.jsx)(Ce,{label:a("tools.gateways.loading")});if(k.isError)return(0,e.jsx)(ee,{error:k.error});const L=k.data?.gateways??[],H=K.isLoading,te=H||w.length===0||A.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)(Qe,{title:a("tools.gateways.title"),description:a("tools.gateways.description")}),(0,e.jsxs)(y,{type:"button",size:"sm",onClick:s(()=>{p(r=>({...r,profileId:r.profileId||w[0]?.id||""})),u(r=>!r)},"onClick"),disabled:H,children:[(0,e.jsx)(He,{className:"mr-1.5 h-3.5 w-3.5"}),a("apps.gateways.newGateway.create")]})]}),i?(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:a("tools.gateways.form.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=>p(b=>({...b,name:r.target.value})),"onChange"),placeholder:a("tools.gateways.form.namePlaceholder"),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:a("tools.gateways.form.accessProfile")}),(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=>p(b=>({...b,profileId:r.target.value})),"onChange"),required:!0,disabled:w.length===0,children:[(0,e.jsx)("option",{value:"",disabled:!0,children:H?a("tools.gateways.form.loadingProfiles"):a("apps.gateways.newGateway.chooseProfile")}),w.map(r=>(0,e.jsxs)("option",{value:r.id,children:[r.name," - ",_e(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:a("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=>p(b=>({...b,description:r.target.value})),"onChange"),placeholder:a("apps.gateways.newGateway.descriptionPlaceholder")})]}),w.length===0&&!H?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.gateways.form.profileRequired")}):null,(0,e.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,e.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:s(()=>u(!1),"onClick"),children:a("Cancel")}),(0,e.jsx)(y,{type:"submit",size:"sm",disabled:te||!c.name.trim()||!c.profileId,children:A.isPending?a("Creating..."):a("apps.gateways.newGateway.create")})]})]}):null,L.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-border p-5 text-sm text-muted-foreground",children:a("tools.gateways.empty")}):(0,e.jsx)("div",{className:"divide-y divide-border rounded-md border border-border",children:L.map(r=>{const b=`${V}${r.endpointPath}`,W=r.clientSnippets??[],xe=R.get(r.profileId),Se=xs(r),E=f[r.id]??ae(),oe=C[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)(gt,{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)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>{X(b,"Gateway endpoint")},"onClick"),children:[(0,e.jsx)(he,{className:"mr-1.5 h-3.5 w-3.5"}),a("tools.gateways.copy.endpoint")]}),(0,e.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>d(r.id),"onClick"),children:[(0,e.jsx)(ve,{className:"mr-1.5 h-3.5 w-3.5"}),a("tools.gateways.token.issue")]})]})]}),(0,e.jsx)("div",{className:"break-all rounded bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:b}),(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:a("Owner")}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:ps(r,$)})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:a("Scope")}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:fs(r,B,$)})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:a("tools.gateways.allowedTools")}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:xe?`${_e(xe)} via ${xe.name}`:`Profile ${U(r.profileId)}`})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:a("tools.gateways.lastActivity")}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:Se?(0,e.jsx)(de,{value:Se}):a("tools.gateways.neverUsed")})]})]}),D===r.id?(0,e.jsxs)("form",{className:"space-y-3 rounded-md border border-border p-3",onSubmit:s(m=>j(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:a("tools.gateways.token.name")}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:E.name,onChange:s(m=>h(F=>({...F,[r.id]:{...E,name:m.target.value}})),"onChange"),placeholder:a("tools.gateways.token.namePlaceholder"),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:a("tools.gateways.token.clientLabel")}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:E.clientLabel,onChange:s(m=>h(F=>({...F,[r.id]:{...E,clientLabel:m.target.value}})),"onChange"),placeholder:a("tools.gateways.token.clientLabelPlaceholder"),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:a("tools.gateways.token.ownerNote")}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:E.ownerNote,onChange:s(m=>h(F=>({...F,[r.id]:{...E,ownerNote:m.target.value}})),"onChange"),placeholder:a("tools.gateways.token.ownerNotePlaceholder"),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:a("apps.gateways.tokens.expiresLabel")}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",type:"date",value:E.expiresAt,onChange:s(m=>h(F=>({...F,[r.id]:{...E,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:E.allowedActions.includes(m),onChange:s(F=>{const pe=F.target.checked?Array.from(new Set([...E.allowedActions,m])):E.allowedActions.filter(fe=>fe!==m);h(fe=>({...fe,[r.id]:{...E,allowedActions:pe}}))},"onChange")}),m]},m))}),(0,e.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,e.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:s(()=>x(null),"onClick"),children:a("Cancel")}),(0,e.jsx)(y,{type:"submit",size:"sm",disabled:M.isPending||!E.name.trim()||!E.clientLabel.trim()||!E.ownerNote.trim()||!E.expiresAt,children:M.isPending?a("tools.gateways.token.issuing"):a("tools.gateways.token.issue")})]})]}):null,oe?(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:[a("New token for")," ",oe.name]}),(0,e.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>{X(oe.token,"Gateway bearer token")},"onClick"),children:[(0,e.jsx)(he,{className:"mr-1.5 h-3.5 w-3.5"}),a("tools.gateways.copy.token")]})]}),(0,e.jsx)("div",{className:"break-all rounded bg-background px-3 py-2 font-mono text-xs text-muted-foreground",children:oe.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)(ve,{className:"h-3.5 w-3.5"}),a("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:a("tools.gateways.token.none")}):r.tokens.map(m=>{const F=!!m.revokedAt,pe=P===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:[a("tools.gateways.token.revoked")," ",(0,e.jsx)(de,{value:m.revokedAt})]}):m.expiresAt?(0,e.jsxs)(e.Fragment,{children:[a("tools.gateways.token.expires")," ",(0,e.jsx)(de,{value:m.expiresAt})]}):a("apps.gateways.tokens.noExpiry")}),F?null:(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:s(()=>N(m.id),"onClick"),"aria-label":`Revoke ${m.name}`,children:[(0,e.jsx)(Be,{className:"mr-1 h-3.5 w-3.5"}),a("Revoke")]})]})]}),pe?(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:a("tools.gateways.token.revokeConfirm")}),(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:s(()=>N(null),"onClick"),children:[(0,e.jsx)(ce,{className:"mr-1 h-3.5 w-3.5"}),a("Cancel")]}),(0,e.jsxs)(y,{type:"button",variant:"destructive",size:"sm",className:"h-7 px-2",onClick:s(()=>J.mutate(m.id),"onClick"),disabled:J.isPending,children:[(0,e.jsx)(ue,{className:"mr-1 h-3.5 w-3.5"}),a("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:a("tools.gateways.snippets.title")}),(0,e.jsx)("div",{className:"space-y-1 text-sm",children:W.length===0?(0,e.jsx)("p",{className:"text-muted-foreground",children:a("tools.gateways.snippets.empty")}):W.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)(Pt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate",children:m.label})]}),(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:s(F=>{F.preventDefault(),X(Re(m.config),`${m.label} snippet`)},"onClick"),children:[(0,e.jsx)(he,{className:"mr-1 h-3.5 w-3.5"}),a("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:Re(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(F=>(0,e.jsx)("div",{children:F},F))}):null]},m.client))})]})]})]},r.id)})})]})}s(gs,"GatewaysTab");function bs(){return q(),(0,e.jsxs)(vt,{children:[(0,e.jsx)(Mt,{asChild:!0,children:(0,e.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-foreground","aria-label":a("Get help creating an MCP config"),children:(0,e.jsx)(wt,{className:"h-4 w-4"})})}),(0,e.jsxs)(Et,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(Tt,{children:[(0,e.jsx)(jt,{children:a("Ask an agent for an MCP config")}),(0,e.jsx)(kt,{children:a("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:os.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:a("Prompt to send")}),(0,e.jsx)(Ge,{id:"mcp-config-help-prompt",readOnly:!0,value:Fe,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)(rt,{prompt:Fe,label:a("Get a config with an agent"),title:a("MCP configuration"),description:a("Paste this into your agent to create an MCP config, then paste its JSON reply back into Paperclip.")})})]})]})}s(bs,"McpConfigHelpDialog");var js=`{
|
|
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.`,os=["Copy this prompt and send it to an agent or assistant that can look up the server's documentation.","Paste only the JSON block it replies with back into the box on this page.","Paperclip reads the header names from that JSON and asks you for the values, then stores them as Paperclip secrets — so the config you paste should contain placeholders, not live credentials."],g=qe(Wt(),1),e=qe(Ht(),1);function rs({companyId:t,agentOptions:o}){q();const[l,i]=(0,g.useState)(""),u=Q({queryKey:l?_.tools.effectiveProfilesForAgent(t,l):["tools",t,"profiles","effective","agent","__none__"],queryFn:s(()=>R.getEffectiveProfilesForAgent(t,l),"queryFn"),enabled:!!l});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)(Ze,{children:a("tools.common.agent")}),(0,e.jsx)(ct,{agents:o,value:l,onChange:i})]}),l?u.isLoading?(0,e.jsx)(Ce,{label:a("tools.profiles.effective.checking")}):u.error?(0,e.jsx)(ee,{error:u.error,onRetry:s(()=>u.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:a("tools.profiles.effective.canUse")}),(0,e.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[(u.data?.allowedToolNames??[]).length," tools"]})]}),(u.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:a("tools.profiles.effective.noTools")}):(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:(u.data?.allowedToolNames??[]).slice(0,80).map(c=>(0,e.jsx)(ne,{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:a("tools.profiles.title")}),(u.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:a("tools.profiles.effective.noProfile")}):(0,e.jsx)("div",{className:"divide-y divide-border rounded-lg border border-border",children:(u.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)(ne,{variant:"secondary",children:a("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:a("tools.profiles.effective.pickAgent")})]})}s(rs,"EffectiveAgentPanel");var Ie={read_only:{titleKey:"tools.profiles.templates.readOnly.title",descriptionKey:"tools.profiles.templates.readOnly.description"},everyday:{titleKey:"tools.profiles.templates.everyday.title",descriptionKey:"tools.profiles.templates.everyday.description"},full_access:{titleKey:"tools.profiles.templates.fullAccess.title",descriptionKey:"tools.profiles.templates.fullAccess.description"},scratch:{titleKey:"tools.profiles.templates.scratch.title",descriptionKey:"tools.profiles.templates.scratch.description"},copy:{titleKey:"tools.profiles.templates.copy.title",descriptionKey:"tools.profiles.templates.copy.description"}};function De(t){return t?`/apps/advanced/profiles/new?template=${encodeURIComponent(t)}`:"/apps/advanced/profiles/new"}s(De,"newProfileHref");function ls(t){return t==="active"?"default":t==="draft"?"secondary":"outline"}s(ls,"statusVariant");function is({companyId:t,initialStatusFilter:o,initialResolverOpen:l}){const{t:i}=q(),u=ze(),c=we(),{pushToast:p}=ke(),{profiles:f,agents:h}=ns(t),[D,x]=(0,g.useState)(!!l),[C,T]=(0,g.useState)(o??"active"),[P,N]=(0,g.useState)(null);(0,g.useEffect)(()=>{new URLSearchParams(window.location.search).get("check")==="1"&&x(!0)},[]);const k=(0,g.useMemo)(()=>(h.data??[]).map(n=>({id:n.id,name:n.name})),[h.data]),z=s(()=>{c.invalidateQueries({queryKey:_.tools.profiles(t)}),c.invalidateQueries({queryKey:_.tools.testAgentAccesses()})},"invalidate"),S=s(n=>String(n?.message??n),"errorBody"),H=I({mutationFn:s(n=>R.duplicateProfile(n.id,{name:i("tools.profiles.dialog.copyNameParenthetical",{defaultValue:"{{name}} (copy)",name:n.name})}),"mutationFn"),onSuccess:s(()=>{p({title:i("tools.profiles.toast.duplicated",{defaultValue:"Profile duplicated"}),body:i("tools.profiles.toast.copyUnassigned",{defaultValue:"The copy is not assigned to anyone yet."}),tone:"success"}),z()},"onSuccess"),onError:s(n=>p({title:i("tools.profiles.toast.duplicateFailed",{defaultValue:"Could not duplicate"}),body:S(n),tone:"error"}),"onError")}),V=I({mutationFn:s(n=>R.updateProfile(n.id,{status:"archived"}),"mutationFn"),onSuccess:s(()=>{p({title:i("tools.profiles.toast.archived",{defaultValue:"Profile archived"}),tone:"success"}),z()},"onSuccess"),onError:s(n=>p({title:i("tools.profiles.toast.archiveFailed",{defaultValue:"Could not archive"}),body:S(n),tone:"error"}),"onError")}),K=I({mutationFn:s(n=>R.updateProfile(n.id,{status:"active"}),"mutationFn"),onSuccess:s(()=>{p({title:i("tools.profiles.toast.restored",{defaultValue:"Profile restored"}),tone:"success"}),z()},"onSuccess"),onError:s(n=>p({title:i("tools.profiles.toast.restoreFailed",{defaultValue:"Could not restore"}),body:S(n),tone:"error"}),"onError")}),w=I({mutationFn:s(n=>R.deleteProfile(n.id),"mutationFn"),onSuccess:s(()=>{p({title:i("tools.profiles.toast.deleted",{defaultValue:"Profile deleted"}),tone:"success"}),z()},"onSuccess"),onError:s(n=>p({title:i("tools.profiles.toast.deleteFailed",{defaultValue:"Could not delete"}),body:S(n),tone:"error"}),"onError")}),O=(0,e.jsx)(Qe,{title:i("tools.profiles.title",{defaultValue:"Access profiles"}),description:i("tools.profiles.description",{defaultValue:"Decide which tools your agents can use. Build a profile once, then assign it to the agents that need it."}),actions:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(y,{variant:"outline",onClick:s(()=>x(!0),"onClick"),children:[(0,e.jsx)(Ge,{className:"mr-1.5 h-4 w-4"}),i("tools.profiles.checkAgentAccess",{defaultValue:"Check an agent's access"})]}),(0,e.jsxs)(y,{onClick:s(()=>u(De()),"onClick"),children:[(0,e.jsx)(Ue,{className:"mr-1.5 h-4 w-4"}),i("tools.profiles.newProfile",{defaultValue:"New profile"})]})]})}),$=(0,e.jsx)(tt,{open:D,onOpenChange:x,children:(0,e.jsxs)(rt,{className:"w-full gap-0 p-0 sm:max-w-xl",children:[(0,e.jsxs)(et,{className:"border-b border-border",children:[(0,e.jsx)(dt,{children:i("tools.profiles.checkAgentAccess",{defaultValue:"Check an agent's access"})}),(0,e.jsx)(nt,{children:i("tools.profiles.checkAgentAccessDescription",{defaultValue:"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)(rs,{companyId:t,agentOptions:k})})]})});if(f.isLoading)return(0,e.jsxs)("div",{className:"space-y-5",children:[O,(0,e.jsx)(Ce,{label:i("tools.profiles.loading",{defaultValue:"Loading profiles…"})})]});if(f.isError)return(0,e.jsxs)("div",{className:"space-y-5",children:[O,(0,e.jsx)(ee,{error:f.error,onRetry:s(()=>f.refetch(),"onRetry")})]});const B=(f.data?.profiles??[]).filter(n=>C==="archived"?n.status==="archived":n.status!=="archived");return(0,e.jsxs)("div",{className:"space-y-5",children:[O,(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(()=>T(n),"onClick"),className:Z("rounded px-3 py-1 text-sm font-medium",C===n?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:n==="active"?i("tools.profiles.status.active",{defaultValue:"Active"}):i("tools.profiles.status.archived",{defaultValue:"Archived"})},n))}),B.length===0?C==="archived"?(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border px-4 py-5 text-sm text-muted-foreground",children:i("tools.profiles.emptyArchived",{defaultValue:"No archived profiles."})}):(0,e.jsx)(cs,{onPick:s(n=>u(De(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:i("tools.profiles.table.profile",{defaultValue:"Profile"})}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:i("tools.profiles.table.allows",{defaultValue:"Allows"})}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:i("tools.profiles.table.assignedTo",{defaultValue:"Assigned to"})}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:i("tools.common.status",{defaultValue:"Status"})}),(0,e.jsx)("th",{className:"px-3 py-2 font-medium",children:i("tools.common.updated",{defaultValue:"Updated"})}),(0,e.jsx)("th",{className:"w-10 px-3 py-2"})]})}),(0,e.jsx)("tbody",{children:B.map(n=>{const A=ts(n.summary),M=Zt(n),J=s(()=>u(M?`/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:J,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:es(n.summary)}),(n.newToolsPendingCount??0)>0?(0,e.jsx)(ne,{variant:"outline",className:"border-amber-500/50 bg-amber-500/10 text-amber-800 dark:text-amber-200",children:i("tools.profiles.table.newTools",{defaultValue:"{{count}} new",count:n.newToolsPendingCount})}):null]})}),(0,e.jsx)("td",{className:"px-3 py-1.5",children:A.unassigned?(0,e.jsxs)("span",{className:"text-muted-foreground",children:[A.text,(0,e.jsxs)("span",{className:"ml-1 text-xs text-muted-foreground/70",children:["— ",i("tools.profiles.table.noAccessEffect",{defaultValue:"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)(Nt,{className:"h-3.5 w-3.5 text-muted-foreground"}),A.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)(ne,{variant:ls(n.status),children:i(`tools.profiles.status.${n.status}`,{defaultValue:ss[n.status]})}),M?(0,e.jsx)("button",{type:"button",onClick:J,className:"text-xs font-medium text-primary hover:underline",children:i("tools.common.resume",{defaultValue:"Resume"})}):null]})}),(0,e.jsx)("td",{className:"px-3 py-1.5",children:(0,e.jsx)(de,{value:n.updatedAt})}),(0,e.jsx)("td",{className:"px-3 py-1.5 text-right",children:(0,e.jsx)(ds,{onEdit:J,onDuplicate:s(()=>H.mutate(n),"onDuplicate"),onArchive:s(()=>V.mutate(n),"onArchive"),onRestore:n.status==="archived"?()=>N({kind:"restore",profile:n}):void 0,onDelete:s(()=>N({kind:"delete",profile:n}),"onDelete")})})]},n.id)})})]})}),$,(0,e.jsx)(Xt,{kind:P?.kind??null,profile:P?.profile??null,pending:K.isPending||w.isPending,onClose:s(()=>N(null),"onClose"),onArchive:s(()=>{P&&V.mutate(P.profile,{onSuccess:s(()=>N(null),"onSuccess")})},"onArchive"),onRestore:s(()=>{P&&K.mutate(P.profile,{onSuccess:s(()=>N(null),"onSuccess")})},"onRestore"),onDelete:s(()=>{P&&w.mutate(P.profile,{onSuccess:s(()=>N(null),"onSuccess")})},"onDelete")})]})}s(is,"ProfilesIndex");function ds({onEdit:t,onDuplicate:o,onArchive:l,onRestore:i,onDelete:u}){const{t:c}=q();return(0,e.jsxs)(Bt,{children:[(0,e.jsx)(Yt,{asChild:!0,children:(0,e.jsx)("button",{type:"button","aria-label":c("tools.profiles.rowActions",{defaultValue:"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)(Jt,{className:"h-4 w-4"})})}),(0,e.jsxs)(_t,{align:"end",children:[(0,e.jsx)(se,{onSelect:t,children:c("tools.common.edit",{defaultValue:"Edit"})}),(0,e.jsx)(se,{onSelect:o,children:c("tools.common.duplicate",{defaultValue:"Duplicate"})}),i?(0,e.jsxs)(se,{onSelect:i,children:[(0,e.jsx)(Ye,{className:"mr-1.5 h-4 w-4"}),c("tools.common.restore",{defaultValue:"Restore"})]}):(0,e.jsx)(se,{onSelect:l,children:c("tools.common.archive",{defaultValue:"Archive"})}),(0,e.jsx)(Ot,{}),(0,e.jsx)(se,{onSelect:u,className:"text-destructive focus:text-destructive",children:c("tools.common.delete",{defaultValue:"Delete"})})]})]})}s(ds,"RowMenu");function cs({onPick:t}){const{t:o}=q();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:o("tools.profiles.empty.title",{defaultValue:"Create your first access profile"})}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:o("tools.profiles.empty.description",{defaultValue:"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:as.map(l=>(0,e.jsxs)("button",{type:"button",onClick:s(()=>t(l.key),"onClick"),className:Z("flex flex-col items-start gap-1 rounded-md border border-border bg-card px-4 py-3 text-left transition-colors","hover:border-primary hover:bg-primary/5"),children:[(0,e.jsx)("span",{className:"text-sm font-medium text-foreground",children:o(Ie[l.key].titleKey,{defaultValue:l.title})}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:o(Ie[l.key].descriptionKey,{defaultValue:l.description})})]},l.key))})]})}s(cs,"EmptyTemplatePicker");var ae=s(()=>({name:"",clientLabel:"",ownerNote:"",expiresAt:us(new Date(Date.now()+7776e6)),allowedActions:["tools/list","tools/call"]}),"defaultTokenDraft");function us(t){return t.toISOString().slice(0,10)}s(us,"toDateInputValue");function G(t){return t?t.length>12?`${t.slice(0,8)}...`:t:null}s(G,"shortId");function Me(t,o,l=`${o}s`){return`${t} ${t===1?o:l}`}s(Me,"pluralize");function ms(t){if(!t)return null;const o=t instanceof Date?t:new Date(t);return Number.isNaN(o.getTime())?null:o}s(ms,"dateValue");function xs(t){return t.tokens.reduce((o,l)=>{const i=ms(l.lastUsedAt);return i&&(!o||i.getTime()>o.getTime())?i:o},null)}s(xs,"latestTokenActivity");function ps(t,o){return t.agentId?o.get(t.agentId)??`Agent ${G(t.agentId)}`:t.createdByAgentId?o.get(t.createdByAgentId)??`Agent ${G(t.createdByAgentId)}`:t.createdByUserId?`Board user ${G(t.createdByUserId)}`:"Board"}s(ps,"formatOwner");function fs(t,o,l){return t.contextScopeType!=="none"&&t.contextScopeId?t.contextScopeType==="project"?`Project ${o.get(t.contextScopeId)??G(t.contextScopeId)}`:t.contextScopeType==="agent"?`Agent ${l.get(t.contextScopeId)??G(t.contextScopeId)}`:`${t.contextScopeType} ${G(t.contextScopeId)}`:t.projectId?`Project ${o.get(t.projectId)??G(t.projectId)}`:t.issueId?`Issue ${G(t.issueId)}`:t.agentId?`Agent ${l.get(t.agentId)??G(t.agentId)}`:"Company"}s(fs,"formatScope");function _e(t){if(!t)return"Profile unavailable";const o=t.summary.allowedToolCount;return t.summary.accessMode==="all_except"?`${Me(Math.max(t.summary.totalToolCount-t.summary.excludedToolCount,0),"tool")} allowed`:o===0?"No tools allowed":`${Me(o,"tool")} allowed`}s(_e,"formatAllowedTools");function Oe(t){return JSON.stringify(t,null,2)}s(Oe,"formatSnippetConfig");function hs(t){return t?`${t}T23:59:59.000Z`:null}s(hs,"buildTokenExpiresAt");function gs({companyId:t}){q();const o=we(),{pushToast:l}=ke(),[i,u]=(0,g.useState)(!1),[c,p]=(0,g.useState)({name:"",description:"",profileId:""}),[f,h]=(0,g.useState)({}),[D,x]=(0,g.useState)(null),[C,T]=(0,g.useState)({}),[P,N]=(0,g.useState)(null),k=Q({queryKey:_.tools.gateways(t),queryFn:s(()=>R.listGateways(t),"queryFn")}),z=Q({queryKey:_.tools.profiles(t),queryFn:s(()=>R.listProfiles(t),"queryFn")}),S=Q({queryKey:_.agents.list(t),queryFn:s(()=>qt.list(t),"queryFn")}),H=Q({queryKey:_.projects.list(t,{includeArchived:!0}),queryFn:s(()=>It.list(t,{includeArchived:!0}),"queryFn")}),V=(0,g.useMemo)(()=>typeof window>"u"?"":window.location.origin,[]),K=z.data?.profiles??[],w=K.filter(r=>r.status!=="archived"),O=(0,g.useMemo)(()=>new Map(K.map(r=>[r.id,r])),[K]),$=(0,g.useMemo)(()=>new Map((S.data??[]).map(r=>[r.id,r.name])),[S.data]),B=(0,g.useMemo)(()=>new Map((H.data??[]).map(r=>[r.id,r.name])),[H.data]),n=s(()=>o.invalidateQueries({queryKey:_.tools.gateways(t)}),"invalidateGateways"),A=I({mutationFn:s(()=>R.createGateway(t,{name:c.name.trim(),description:c.description.trim()||null,profileId:c.profileId,defaultProfileMode:"gateway_only",contextScopeType:"company"}),"mutationFn"),onSuccess:s(async r=>{p({name:"",description:"",profileId:w[0]?.id??""}),u(!1),l({title:a("apps.gateways.newGateway.toast.createdTitle"),body:r.name,tone:"success"}),await n()},"onSuccess"),onError:s(r=>{l({title:a("apps.gateways.newGateway.toast.createFailedTitle"),body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")}),M=I({mutationFn:s(async r=>{const b=f[r]??ae();return R.createGatewayToken(t,r,{name:b.name.trim(),clientLabel:b.clientLabel.trim(),ownerNote:b.ownerNote.trim(),allowedActions:b.allowedActions,expiresAt:hs(b.expiresAt)})},"mutationFn"),onSuccess:s(async r=>{T(b=>({...b,[r.gatewayId]:r})),x(null),h(b=>({...b,[r.gatewayId]:ae()})),l({title:a("tools.gateways.toast.tokenIssued"),body:`${r.name} was created. Copy it now; it will not be shown again.`,tone:"success"}),await n()},"onSuccess"),onError:s(r=>{l({title:a("tools.gateways.toast.tokenIssueFailed"),body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")}),J=I({mutationFn:s(r=>R.revokeGatewayToken(t,r),"mutationFn"),onSuccess:s(async r=>{N(null),l({title:a("apps.gateways.tokens.toast.revokedTitle"),body:r.name,tone:"success"}),await n()},"onSuccess"),onError:s(r=>{l({title:a("apps.gateways.tokens.toast.revokeFailedTitle"),body:r instanceof Error?r.message:String(r),tone:"error"})},"onError")});async function X(r,b){try{await At(r),l({title:a("Copied to clipboard"),body:b,tone:"success"})}catch(W){l({title:a("Copy failed"),body:W instanceof Error?W.message:"Clipboard access is unavailable.",tone:"error"})}}s(X,"copyText");function d(r){T(b=>{const W={...b};return delete W[r],W}),h(b=>({...b,[r]:b[r]??ae()})),x(r)}s(d,"startIssuing");function v(r){if(r.preventDefault(),!c.profileId){l({title:a("tools.gateways.toast.pickProfile"),body:"A gateway needs an access profile before it can be created.",tone:"warn"});return}A.mutate()}s(v,"submitCreateGateway");function j(r,b){if(r.preventDefault(),(f[b]??ae()).allowedActions.length===0){l({title:a("tools.gateways.toast.pickTokenActions"),body:"Gateway tokens need at least one allowed MCP action.",tone:"warn"});return}M.mutate(b)}if(s(j,"submitCreateToken"),k.isLoading)return(0,e.jsx)(Ce,{label:a("tools.gateways.loading")});if(k.isError)return(0,e.jsx)(ee,{error:k.error});const L=k.data?.gateways??[],U=z.isLoading,te=U||w.length===0||A.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)(Qe,{title:a("tools.gateways.title"),description:a("tools.gateways.description")}),(0,e.jsxs)(y,{type:"button",size:"sm",onClick:s(()=>{p(r=>({...r,profileId:r.profileId||w[0]?.id||""})),u(r=>!r)},"onClick"),disabled:U,children:[(0,e.jsx)(Ue,{className:"mr-1.5 h-3.5 w-3.5"}),a("apps.gateways.newGateway.create")]})]}),i?(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:a("tools.gateways.form.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=>p(b=>({...b,name:r.target.value})),"onChange"),placeholder:a("tools.gateways.form.namePlaceholder"),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:a("tools.gateways.form.accessProfile")}),(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=>p(b=>({...b,profileId:r.target.value})),"onChange"),required:!0,disabled:w.length===0,children:[(0,e.jsx)("option",{value:"",disabled:!0,children:U?a("tools.gateways.form.loadingProfiles"):a("apps.gateways.newGateway.chooseProfile")}),w.map(r=>(0,e.jsxs)("option",{value:r.id,children:[r.name," - ",_e(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:a("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=>p(b=>({...b,description:r.target.value})),"onChange"),placeholder:a("apps.gateways.newGateway.descriptionPlaceholder")})]}),w.length===0&&!U?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.gateways.form.profileRequired")}):null,(0,e.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,e.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:s(()=>u(!1),"onClick"),children:a("Cancel")}),(0,e.jsx)(y,{type:"submit",size:"sm",disabled:te||!c.name.trim()||!c.profileId,children:A.isPending?a("Creating..."):a("apps.gateways.newGateway.create")})]})]}):null,L.length===0?(0,e.jsx)("div",{className:"rounded-md border border-dashed border-border p-5 text-sm text-muted-foreground",children:a("tools.gateways.empty")}):(0,e.jsx)("div",{className:"divide-y divide-border rounded-md border border-border",children:L.map(r=>{const b=`${V}${r.endpointPath}`,W=r.clientSnippets??[],xe=O.get(r.profileId),Se=xs(r),E=f[r.id]??ae(),oe=C[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)(gt,{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)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>{X(b,"Gateway endpoint")},"onClick"),children:[(0,e.jsx)(he,{className:"mr-1.5 h-3.5 w-3.5"}),a("tools.gateways.copy.endpoint")]}),(0,e.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>d(r.id),"onClick"),children:[(0,e.jsx)(ve,{className:"mr-1.5 h-3.5 w-3.5"}),a("tools.gateways.token.issue")]})]})]}),(0,e.jsx)("div",{className:"break-all rounded bg-muted px-3 py-2 font-mono text-xs text-muted-foreground",children:b}),(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:a("Owner")}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:ps(r,$)})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:a("Scope")}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:fs(r,B,$)})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:a("tools.gateways.allowedTools")}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:xe?`${_e(xe)} via ${xe.name}`:`Profile ${G(r.profileId)}`})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("dt",{className:"text-xs font-medium text-muted-foreground",children:a("tools.gateways.lastActivity")}),(0,e.jsx)("dd",{className:"mt-0.5 text-foreground",children:Se?(0,e.jsx)(de,{value:Se}):a("tools.gateways.neverUsed")})]})]}),D===r.id?(0,e.jsxs)("form",{className:"space-y-3 rounded-md border border-border p-3",onSubmit:s(m=>j(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:a("tools.gateways.token.name")}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:E.name,onChange:s(m=>h(F=>({...F,[r.id]:{...E,name:m.target.value}})),"onChange"),placeholder:a("tools.gateways.token.namePlaceholder"),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:a("tools.gateways.token.clientLabel")}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:E.clientLabel,onChange:s(m=>h(F=>({...F,[r.id]:{...E,clientLabel:m.target.value}})),"onChange"),placeholder:a("tools.gateways.token.clientLabelPlaceholder"),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:a("tools.gateways.token.ownerNote")}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:E.ownerNote,onChange:s(m=>h(F=>({...F,[r.id]:{...E,ownerNote:m.target.value}})),"onChange"),placeholder:a("tools.gateways.token.ownerNotePlaceholder"),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:a("apps.gateways.tokens.expiresLabel")}),(0,e.jsx)("input",{className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",type:"date",value:E.expiresAt,onChange:s(m=>h(F=>({...F,[r.id]:{...E,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:E.allowedActions.includes(m),onChange:s(F=>{const pe=F.target.checked?Array.from(new Set([...E.allowedActions,m])):E.allowedActions.filter(fe=>fe!==m);h(fe=>({...fe,[r.id]:{...E,allowedActions:pe}}))},"onChange")}),m]},m))}),(0,e.jsxs)("div",{className:"flex flex-wrap justify-end gap-2",children:[(0,e.jsx)(y,{type:"button",variant:"ghost",size:"sm",onClick:s(()=>x(null),"onClick"),children:a("Cancel")}),(0,e.jsx)(y,{type:"submit",size:"sm",disabled:M.isPending||!E.name.trim()||!E.clientLabel.trim()||!E.ownerNote.trim()||!E.expiresAt,children:M.isPending?a("tools.gateways.token.issuing"):a("tools.gateways.token.issue")})]})]}):null,oe?(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:[a("New token for")," ",oe.name]}),(0,e.jsxs)(y,{type:"button",variant:"outline",size:"sm",onClick:s(()=>{X(oe.token,"Gateway bearer token")},"onClick"),children:[(0,e.jsx)(he,{className:"mr-1.5 h-3.5 w-3.5"}),a("tools.gateways.copy.token")]})]}),(0,e.jsx)("div",{className:"break-all rounded bg-background px-3 py-2 font-mono text-xs text-muted-foreground",children:oe.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)(ve,{className:"h-3.5 w-3.5"}),a("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:a("tools.gateways.token.none")}):r.tokens.map(m=>{const F=!!m.revokedAt,pe=P===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:[a("tools.gateways.token.revoked")," ",(0,e.jsx)(de,{value:m.revokedAt})]}):m.expiresAt?(0,e.jsxs)(e.Fragment,{children:[a("tools.gateways.token.expires")," ",(0,e.jsx)(de,{value:m.expiresAt})]}):a("apps.gateways.tokens.noExpiry")}),F?null:(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs text-destructive hover:text-destructive",onClick:s(()=>N(m.id),"onClick"),"aria-label":`Revoke ${m.name}`,children:[(0,e.jsx)(Be,{className:"mr-1 h-3.5 w-3.5"}),a("Revoke")]})]})]}),pe?(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:a("tools.gateways.token.revokeConfirm")}),(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:s(()=>N(null),"onClick"),children:[(0,e.jsx)(ce,{className:"mr-1 h-3.5 w-3.5"}),a("Cancel")]}),(0,e.jsxs)(y,{type:"button",variant:"destructive",size:"sm",className:"h-7 px-2",onClick:s(()=>J.mutate(m.id),"onClick"),disabled:J.isPending,children:[(0,e.jsx)(ue,{className:"mr-1 h-3.5 w-3.5"}),a("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:a("tools.gateways.snippets.title")}),(0,e.jsx)("div",{className:"space-y-1 text-sm",children:W.length===0?(0,e.jsx)("p",{className:"text-muted-foreground",children:a("tools.gateways.snippets.empty")}):W.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)(Pt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate",children:m.label})]}),(0,e.jsxs)(y,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2",onClick:s(F=>{F.preventDefault(),X(Oe(m.config),`${m.label} snippet`)},"onClick"),children:[(0,e.jsx)(he,{className:"mr-1 h-3.5 w-3.5"}),a("Copy")]})]}),(0,e.jsx)("pre",{className:"mt-2 max-h-56 overflow-auto whitespace-pre-wrap break-words rounded bg-background p-3 text-xs text-muted-foreground",children:Oe(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(F=>(0,e.jsx)("div",{children:F},F))}):null]},m.client))})]})]})]},r.id)})})]})}s(gs,"GatewaysTab");function bs(){return q(),(0,e.jsxs)(vt,{children:[(0,e.jsx)(Mt,{asChild:!0,children:(0,e.jsx)(y,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-foreground","aria-label":a("Get help creating an MCP config"),children:(0,e.jsx)(wt,{className:"h-4 w-4"})})}),(0,e.jsxs)(Et,{className:"max-h-(--sz-85vh) overflow-y-auto sm:max-w-2xl",children:[(0,e.jsxs)(Tt,{children:[(0,e.jsx)(jt,{children:a("Ask an agent for an MCP config")}),(0,e.jsx)(kt,{children:a("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:os.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:a("Prompt to send")}),(0,e.jsx)(He,{id:"mcp-config-help-prompt",readOnly:!0,value:Fe,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)(at,{prompt:Fe,label:a("Get a config with an agent"),title:a("MCP configuration"),description:a("Paste this into your agent to create an MCP config, then paste its JSON reply back into Paperclip.")})})]})]})}s(bs,"McpConfigHelpDialog");var js=`{
|
|
33
33
|
"mcpServers": {
|
|
34
34
|
"github": {
|
|
35
35
|
"command": "npx -y @modelcontextprotocol/server-github",
|
|
36
36
|
"env": { "GITHUB_TOKEN": "ghp_..." }
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
}`;function ys(t){const o=t.replace(/[_-]+/g," ").trim().toLowerCase();return o?o.charAt(0).toUpperCase()+o.slice(1):a("Key")}s(ys,"humanizeKey");function vs(t){const o=t.credentialFields.length||t.credentialRefs.length,l=t.transport==="local_stdio"?"Runs in your workspace":"Connects over the web";return o===0?`${l} · no keys needed`:`${l} · needs ${o} ${o===1?"key":"keys"}`}s(vs,"draftSummary");function be(t){if(t.transport!=="mcp_remote")return null;const o=t.config?.url;if(typeof o!="string")return null;try{const l=new URL(o.trim());return l.protocol!=="http:"&&l.protocol!=="https:"?null:l.toString()}catch{return null}}s(be,"draftConnectUrl");function me(t,o){return`${t.name}::${o}`}s(me,"credentialValueKey");function Ns(t,o){const l={};for(const i of t.credentialFields){const u=o[me(t,i.configPath)]?.trim();u&&(l[i.configPath]=u)}return l}s(Ns,"credentialValuesForDraft");function ws(t,o){return t.credentialFields.filter(l=>l.required).filter(l=>!o[me(t,l.configPath)]?.trim()).map(l=>l.configPath)}s(ws,"missingCredentialFields");function Je(t){const o=t.suggestedDefaults?.askFirstRiskLevels;return Array.isArray(o)?o.filter(l=>typeof l=="string"):[]}s(Je,"askFirstLevelsFrom");function ks({companyId:t}){q();const o=Ke(),[l,i]=(0,g.useState)(""),[u,c]=(0,g.useState)(null),[p,f]=(0,g.useState)({}),[h,D]=(0,g.useState)({}),[x,C]=(0,g.useState)(null),[T,P]=(0,g.useState)({}),[N,k]=(0,g.useState)(null),[K,S]=(0,g.useState)("entry"),[G,V]=(0,g.useState)(null),[z,w]=(0,g.useState)(null),R=I({mutationFn:s(d=>O.importMcpJson(t,{mcpJson:d}),"mutationFn"),onSuccess:s(d=>{c(d),f(Object.fromEntries(d.drafts.map(v=>[v.name,v.name]))),C(null),k(null)},"onSuccess")}),$=s(async(d,v)=>{try{const j=await ct({authorizationUrl:d,handoff:v});j.kind==="reauthentication"&&v&&dt(v.session),w(j.host),S(j.kind==="authorization"?"redirecting":"starting"),Ft(j.url)}catch(j){S("error"),V(j instanceof Error?j.message:"Paperclip couldn’t start secure sign-in. Try again.")}},"openAuthorizationPage"),B=I({mutationFn:s(d=>O.startOAuth(d),"mutationFn"),onSuccess:s(d=>{$(d.authorizationUrl,d.handoff)},"onSuccess"),onError:s(d=>{S("error"),V(d instanceof Error?d.message:"Paperclip couldn’t start secure sign-in. Try again.")},"onError")}),n=I({mutationFn:s(d=>{const v=be(d);if(!v)throw new Error("Only remote HTTP drafts can be checked and activated from pasted config.");return O.connectApp(t,{link:v,name:p[d.name]?.trim()||d.name,credentialValues:Ns(d,h)})},"mutationFn"),onSuccess:s(d=>{if(C(d),d.auth?.kind==="oauth"){if(k(null),w(null),V(null),d.auth.manualClientRequired){S("error"),V("This server requires OAuth client details from its provider settings. Continue in setup to add them.");return}const j=d.auth.startUrl?.trim();j?$(j,d.auth.handoff):(S("starting"),B.mutate(d.connectionId));return}const v={};for(const j of d.actions.readOnly)v[j.catalogEntryId]=!0;for(const j of d.actions.canMakeChanges)v[j.catalogEntryId]=!0;P(v),k(null)},"onSuccess")}),A=I({mutationFn:s(()=>{const d=x?Je(x):[],v=Object.entries(T).filter(([,L])=>L).map(([L])=>L),j=(x?.actions.canMakeChanges??[]).filter(L=>T[L.catalogEntryId]&&d.includes(L.riskLevel)).map(L=>L.catalogEntryId);return O.finishApp(t,x.connectionId,{enabledCatalogEntryIds:v,askFirstCatalogEntryIds:j,access:"all_agents"})},"mutationFn"),onSuccess:s(()=>k(x?.application.name??"Imported app"),"onSuccess")}),M=u?.drafts??[],J=l.trim().length>0&&!R.isPending,X=(0,g.useMemo)(()=>{const d=l.trim();if(!d)return null;try{return JSON.parse(d),null}catch{return a("That doesn't look like valid JSON yet — paste the whole snippet, including the outer braces.")}},[l]);if(x?.auth?.kind==="oauth"){const d=typeof x.connection.config?.url=="string"?x.connection.config.url:typeof x.connection.transportConfig?.url=="string"?x.connection.transportConfig.url:"";return(0,e.jsx)(Xe,{identity:{name:x.application.name,unverifiedHost:Ze(d)},phase:K,error:G,authorizationHost:z,onRetry:s(()=>{V(null),w(null),S("starting"),B.mutate(x.connectionId)},"onRetry"),onBack:s(()=>o(`/apps/${x.connectionId}/permissions`),"onBack"),onCancel:s(()=>o("/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:a("tools.pasteConfig.description")}),(0,e.jsx)(bs,{})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[a("tools.pasteConfig.justUrl")," ",(0,e.jsx)(Dt,{to:"/apps",className:"text-primary hover:underline",children:a("tools.pasteConfig.browseConnections")})," ",a("tools.pasteConfig.instead")]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(Ge,{value:l,onChange:s(d=>{i(d.target.value),u&&c(null),C(null),k(null)},"onChange"),spellCheck:!1,rows:10,placeholder:js,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"}),X?(0,e.jsx)("p",{className:"text-xs text-amber-600",children:X}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.pasteConfig.pasteHint")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,e.jsx)(y,{onClick:s(()=>R.mutate(l),"onClick"),disabled:!J||!!X,children:R.isPending?a("Checking…"):a("tools.pasteConfig.checkConfig")}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:a("tools.pasteConfig.checkHint")})]}),R.isError?(0,e.jsx)(ee,{error:R.error}):null,u?M.length===0?(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border p-6 text-sm text-muted-foreground",children:a("tools.pasteConfig.empty")}):(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)(St,{className:"h-4 w-4 text-emerald-600"}),a(M.length===1?"connectionUi.pasteConfig.foundApps_one":"connectionUi.pasteConfig.foundApps_other",{count:M.length,defaultValue:M.length===1?"We found {{count}} app in that config":"We found {{count}} apps in that config"})]}),M.map((d,v)=>{const j=be(d),L=ws(d,h);return(0,e.jsx)(Cs,{draft:d,connectionName:p[d.name]??d.name,onConnectionNameChange:s(H=>f(te=>({...te,[d.name]:H})),"onConnectionNameChange"),credentialValues:h,onCredentialChange:s((H,te)=>D(r=>({...r,[me(d,H)]:te})),"onCredentialChange"),checking:n.isPending&&n.variables?.name===d.name,canCheck:!!j&&L.length===0,onCheck:j?()=>n.mutate(d):void 0},`${d.name}-${v}`)}),M.some(d=>be(d))?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.pasteConfig.remoteCheckHint")}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.pasteConfig.localDraftHint")})]}):null,n.isError?(0,e.jsx)(ee,{error:n.error}):null,x?(0,e.jsx)(Ss,{result:x,enabled:T,onToggle:s((d,v)=>P(j=>({...j,[d]:v})),"onToggle"),onBulk:s((d,v)=>P(j=>{const L={...j};for(const H of d)L[H]=v;return L}),"onBulk"),finishing:A.isPending,activatedName:N,onFinish:s(()=>A.mutate(),"onFinish")}):null,A.isError?(0,e.jsx)(ee,{error:A.error}):null]})}s(ks,"PasteConfigTab");function Cs({draft:t,connectionName:o,onConnectionNameChange:l,credentialValues:i,onCredentialChange:u,checking:c,canCheck:p,onCheck:f}){return q(),(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"font-semibold text-foreground",children:t.name}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:vs(t)})]}),f?(0,e.jsxs)(y,{size:"sm",className:"shrink-0",onClick:f,disabled:c||!p,children:[c?(0,e.jsx)(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,a("tools.pasteConfig.checkActions")]}):null]}),f?(0,e.jsxs)("label",{className:"mt-4 block max-w-sm space-y-1 text-xs font-medium text-foreground",children:[a("tools.connections.add.connectionName"),(0,e.jsx)(Ee,{value:o,onChange:s(h=>l(h.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(h=>(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)(ve,{className:"h-3.5 w-3.5 text-muted-foreground"}),ys(h.label||h.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:h.key}),(0,e.jsx)(Ee,{type:"password",value:i[me(t,h.configPath)]??"",onChange:s(D=>u(h.configPath,D.target.value),"onChange"),placeholder:a("tools.pasteConfig.replacementPlaceholder"),className:"h-8 max-w-sm text-xs"})]})]},`${h.configPath}-${h.key}`))}):t.credentialRefs.length>0?(0,e.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:a("tools.pasteConfig.keysDraftOnly")}):(0,e.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:a("tools.pasteConfig.noKeys")}),t.warnings.length>0?(0,e.jsx)("ul",{className:"mt-4 space-y-1 border-t border-border pt-3",children:t.warnings.map((h,D)=>(0,e.jsx)("li",{className:"text-xs text-amber-600",children:h},D))}):null]})}s(Cs,"DraftCard");function Ss({result:t,enabled:o,onToggle:l,onBulk:i,finishing:u,activatedName:c,onFinish:p}){q();const f=Je(t),h=Object.values(o).filter(Boolean).length,D=t.actions.readOnly.length+t.actions.canMakeChanges.length;return(0,e.jsxs)("div",{className:"space-y-4 border-t border-border pt-5",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[(0,e.jsx)(Ue,{className:"h-4 w-4 text-emerald-600"}),a("Review actions for")," ",t.application.name]}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a("Health and catalog checks passed. Every discovered action starts allowed; you can narrow access after activation.")})]}),(0,e.jsxs)(y,{size:"sm",onClick:p,disabled:u||h===0||!!c,children:[u?(0,e.jsx)(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,a("Activate")," ",h," ",a("issueCommon.of")," ",D]})]}),(0,e.jsx)(Oe,{title:a("companySkills.readOnly"),actions:t.actions.readOnly,enabled:o,onToggle:l,onBulk:s(x=>i(t.actions.readOnly.map(C=>C.catalogEntryId),x),"onBulk"),askFirstLevels:f}),(0,e.jsx)(Oe,{title:a("Can make changes"),actions:t.actions.canMakeChanges,enabled:o,onToggle:l,onBulk:s(x=>i(t.actions.canMakeChanges.map(C=>C.catalogEntryId),x),"onBulk"),askFirstLevels:f}),c?(0,e.jsxs)("p",{className:"text-xs font-medium text-emerald-700",children:[c," ",a("is active for all agents.")]}):null]})}s(Ss,"CatalogReview");function Oe({title:t,actions:o,enabled:l,onToggle:i,onBulk:u,askFirstLevels:c}){return q(),o.length===0?null:(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(y,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:s(()=>u(!0),"onClick"),children:"Turn all on"}),(0,e.jsx)(y,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:s(()=>u(!1),"onClick"),children:a("apps.connect.actions.turnAllOff")})]})]}),(0,e.jsx)("div",{className:"divide-y divide-border rounded-lg border border-border",children:o.map(p=>{const f=l[p.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:p.title||p.toolName}),(0,e.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:c.includes(p.riskLevel)?a("tools.pasteConfig.askFirstWhenEnabled"):p.riskLevel})]}),(0,e.jsx)(yt,{checked:f,onCheckedChange:s(h=>i(p.catalogEntryId,h),"onCheckedChange")})]},p.catalogEntryId)})})]})}s(Oe,"ActionGroup");var As="smoke@paperclip.test",Ts="smoke-password";function je(t){if(!t)return"—";const o=new Date(t);return Number.isNaN(o.getTime())?"—":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(o)}s(je,"formatTime");function ye(t){return t==="running"?"success":t==="error"?"error":"muted"}s(ye,"serviceTone");function Ps({status:t}){const o=a("tools.smokeLab.status.pass"),l=a("tools.smokeLab.status.fail"),i=a("tools.smokeLab.status.skipped");return t==="pass"?(0,e.jsx)(ue,{className:"mx-auto h-4 w-4 text-emerald-600 dark:text-emerald-400","aria-label":o}):t==="fail"?(0,e.jsx)(ce,{className:"mx-auto h-4 w-4 text-destructive","aria-label":l}):t==="skipped"?(0,e.jsx)(ze,{className:"mx-auto h-4 w-4 text-amber-500","aria-label":i}):(0,e.jsx)("span",{className:"mx-auto block h-1.5 w-1.5 rounded-full bg-muted-foreground/30","aria-label":a("tools.smokeLab.status.notRun")})}s(Ps,"CellGlyph");var Ls={green:"bg-emerald-500",amber:"bg-amber-500",red:"bg-destructive",unknown:"bg-muted-foreground/40"};function Es({companyId:t}){const{t:o}=q(),{enabled:l,loaded:i}=Vt(),u=we(),{pushToast:c}=ke(),[p,f]=(0,g.useState)(null),h=Q({queryKey:_.smokeLab.services(t),queryFn:s(()=>Y.listServices(t),"queryFn"),enabled:l&&i,refetchInterval:l?1e4:!1}),D=Q({queryKey:_.smokeLab.runs(t),queryFn:s(()=>Y.listRuns(t),"queryFn"),enabled:l&&i,refetchInterval:l?1e4:!1}).data?.runs??[],x=p??D[0]?.id??null,C=Q({queryKey:_.smokeLab.run(t,x??"__none__"),queryFn:s(()=>Y.getRun(t,x),"queryFn"),enabled:l&&i&&!!x,refetchInterval:l&&x?1e4:!1}),T=(0,g.useMemo)(()=>C.data?.steps??[],[C.data]),P=(0,g.useMemo)(()=>mt(T),[T]),N=C.data?.run;function k(){u.invalidateQueries({queryKey:_.smokeLab.services(t)}),u.invalidateQueries({queryKey:_.smokeLab.runs(t)}),x&&u.invalidateQueries({queryKey:_.smokeLab.run(t,x)})}s(k,"refresh");const K=I({mutationFn:s(()=>Y.startServices(t),"mutationFn"),onSuccess:s(()=>{c({title:o("tools.smokeLab.toast.servicesStarted"),tone:"success"}),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.startServicesFailed"),body:n.message,tone:"error"}),"onError")}),S=I({mutationFn:s(()=>Y.stopServices(t),"mutationFn"),onSuccess:s(()=>{c({title:o("tools.smokeLab.toast.servicesStopped"),tone:"info"}),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.stopServicesFailed"),body:n.message,tone:"error"}),"onError")}),G=I({mutationFn:s(()=>Y.installFixtures(t),"mutationFn"),onSuccess:s(n=>{c({title:n.created?o("tools.smokeLab.toast.fixturesInstalled"):o("tools.smokeLab.toast.fixturesPresent"),tone:"success"}),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.installFixturesFailed"),body:n.message,tone:"error"}),"onError")}),V=I({mutationFn:s(()=>Y.reset(t),"mutationFn"),onSuccess:s(()=>{c({title:o("tools.smokeLab.toast.reset"),tone:"info"}),f(null),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.resetFailed"),body:n.message,tone:"error"}),"onError")}),z=I({mutationFn:s(()=>Y.createRun(t,{trigger:"manual",summary:{}}),"mutationFn"),onSuccess:s(n=>{c({title:o("tools.smokeLab.toast.runStarted"),body:o("tools.smokeLab.toast.runStartedBody"),tone:"success"}),f(n.run.id),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.startRunFailed"),body:n.message,tone:"error"}),"onError")}),w=K.isPending||S.isPending||G.isPending||V.isPending||z.isPending;if(i&&!l)return(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-card p-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-foreground",children:[(0,e.jsx)(Le,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:o("tools.smokeLab.disabled.title")})]}),(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:o("tools.smokeLab.title")})," ","under Settings → Experimental to enable it."]})]});if(!i)return(0,e.jsx)("div",{className:"p-6 text-sm text-muted-foreground",children:o("tools.smokeLab.loading")});const R=h.data?.services??[],$=ft(N,T),B=pt(T);return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"smoke-lab-tab",children:[(0,e.jsxs)("header",{children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Le,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-xl font-bold text-foreground",children:o("tools.smokeLab.title")}),(0,e.jsx)(ne,{variant:"outline",children:o("tools.common.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)(zt,{className:"h-4 w-4"})," ",a("tools.smokeLab.tutorial")]})]}),(0,e.jsxs)("p",{className:"mt-1.5 max-w-3xl text-sm text-muted-foreground",children:[a("tools.smokeLab.description")," ",(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:a("tools.smokeLab.tutorialLower")}),a(".")]})]}),(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)(at,{className:"h-4 w-4 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:o("tools.smokeLab.services.title")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxs)(y,{size:"sm",onClick:s(()=>K.mutate(),"onClick"),disabled:w,children:[(0,e.jsx)(bt,{className:"h-4 w-4"})," ",a("Start services")]}),(0,e.jsx)(y,{size:"sm",variant:"outline",onClick:s(()=>S.mutate(),"onClick"),disabled:w,children:a("Stop")}),(0,e.jsx)(y,{size:"sm",variant:"outline",onClick:s(()=>G.mutate(),"onClick"),disabled:w,children:a("tools.smokeLab.services.installFixtures")}),(0,e.jsxs)(y,{size:"sm",variant:"ghost",onClick:s(()=>V.mutate(),"onClick"),disabled:w,children:[(0,e.jsx)(Be,{className:"h-4 w-4"})," ",a("Reset")]})]})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[R.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:Z("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:Z(ye(n.status)==="success"&&"text-emerald-600 dark:text-emerald-400",ye(n.status)==="error"&&"text-destructive",ye(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:o("tools.smokeLab.services.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:o("tools.smokeLab.services.notRunning")})})]})})]},n.id)),R.length===0&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:o("tools.smokeLab.services.empty")})]}),(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:o("tools.smokeLab.credentials.title")}),(0,e.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a("tools.smokeLab.credentials.description")}),(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:[a("tools.smokeLab.credentials.email")," ",As]}),(0,e.jsxs)("span",{children:[a("tools.smokeLab.credentials.password")," ",Ts]})]})]})]}),(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:o("tools.smokeLab.matrix.title")}),(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)(ue,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400"})," ",a("tools.smokeLab.status.pass")]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(ce,{className:"h-3.5 w-3.5 text-destructive"})," ",a("tools.smokeLab.status.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"})," ",a("tools.smokeLab.status.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"})," ",a("tools.smokeLab.status.notRun")]})]})]}),(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:o("tools.smokeLab.matrix.path")}),Te.map(n=>(0,e.jsx)("th",{className:"px-2 py-2 text-center font-medium text-muted-foreground",children:o(n.labelKey,{defaultValue:n.labelDefault})},n.key))]})}),(0,e.jsx)("tbody",{children:xt.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:o(re[n].titleKey,{defaultValue:re[n].titleDefault})}),(0,e.jsx)("span",{className:"block text-(length:--text-micro) font-normal text-muted-foreground",children:o(re[n].detailKey,{defaultValue:re[n].detailDefault})})]}),Te.map(A=>{const M=P.get(ut(n,A.key));return(0,e.jsx)("td",{className:"px-2 py-2 text-center",children:(0,e.jsx)(Ps,{status:M?.status??"not-run"})},A.key)})]},n))})]})}),T.length===0&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.smokeLab.matrix.empty")})]}),(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:o("tools.smokeLab.runs.title")}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:Z("h-2 w-2 rounded-full",Ls[$])}),$==="unknown"?o("tools.smokeLab.runs.noneYet"):$,B.length>0&&` · failing: ${B.join(", ")}`]})]}),(0,e.jsxs)(y,{size:"sm",onClick:s(()=>z.mutate(),"onClick"),disabled:w,children:[z.isPending?(0,e.jsx)(Ne,{className:"h-4 w-4 animate-spin"}):(0,e.jsx)(Ht,{className:"h-4 w-4"}),a("tools.smokeLab.runs.start")]})]}),(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:[D.length===0&&(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:o("tools.smokeLab.runs.empty")}),(0,e.jsx)("ul",{className:"divide-y divide-border",children:D.map(n=>{const A=n.id===x;return(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",onClick:s(()=>f(n.id),"onClick"),className:Z("flex w-full items-center justify-between gap-2 px-3 py-2.5 text-left transition-colors hover:bg-accent/50",A&&"bg-accent"),children:[(0,e.jsxs)("span",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"block text-xs font-medium text-foreground",children:je(n.startedAt)}),(0,e.jsx)("span",{className:"block text-(length:--text-micro) text-muted-foreground",children:n.trigger})]}),(0,e.jsx)(Ae,{status:n.status})]})},n.id)})})]}),(0,e.jsxs)("div",{className:"min-w-0 rounded-lg border border-border",children:[!N&&(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:o("tools.smokeLab.runs.select")}),N&&(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:[a("Started")," ",je(N.startedAt)," · finished ",je(N.finishedAt)]}),(0,e.jsx)(Ae,{status:N.status})]}),T.length===0?(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:o("tools.smokeLab.runs.noSteps")}):(0,e.jsx)("ul",{className:"divide-y divide-border",children:T.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)(ue,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}):n.status==="fail"?(0,e.jsx)(ce,{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:a("tools.smokeLab.runs.viewScreenshot")})]}),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(Es,"SmokeLabTab");function Ve(t,o){switch(t){case"profiles":return(0,e.jsx)(is,{companyId:o});case"gateways":return(0,e.jsx)(gs,{companyId:o});case"smoke-lab":return(0,e.jsx)(Es,{companyId:o});default:return(0,e.jsx)(ks,{companyId:o})}}s(Ve,"renderTab");function Fs(){q();const{selectedCompany:t,selectedCompanyId:o}=$e(),{setBreadcrumbs:l}=Ot(),i=Qt(),u=Pe.find(f=>f.key===i.tab)?.key??"paste-config",c=Ut(u),p=Pe.find(f=>f.key===u)?.label;return(0,g.useEffect)(()=>(l([{label:t?.name??a("Company"),href:"/dashboard"},{label:a("tools.breadcrumbs.apps"),href:"/apps"},...c?[{label:a("tools.advanced.title")}]:[{label:a("tools.advanced.title"),href:ge("paste-config")},{label:p??a("tools.developer.title")}]]),()=>l([])),[l,t?.name,c,p]),o?i.tab==="run-your-own"?(0,e.jsx)(le,{to:"/apps",replace:!0}):i.tab==="applications"||i.tab==="connections"||i.tab==="overview"||i.tab==="examples"||i.tab==="audit"?(0,e.jsx)(le,{to:"/apps",replace:!0}):i.tab==="runtime"?(0,e.jsx)(le,{to:"/apps",replace:!0}):i.tab==="policies"?(0,e.jsx)(le,{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:a("tools.advanced.title")}),(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:a("tools.advanced.badge")})]}),(0,e.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground",children:[a("tools.advanced.description")," ",(0,e.jsx)(ie,{to:"/apps",className:"font-medium text-primary hover:underline",children:a("tools.advanced.connectInGallery")}),a(".")]})]}),(0,e.jsx)("nav",{className:"flex items-center gap-6 border-b border-border",children:$t.map(f=>(0,e.jsx)(ie,{to:ge(f.key),className:Z("-mb-px border-b-2 pb-2 text-sm transition-colors",f.key===u?"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:Ve(u,o)}),(0,e.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)(Lt,{className:"h-3.5 w-3.5"}),a("tools.advanced.lookingForDeveloperTools")," ",(0,e.jsx)(ie,{to:ge("profiles"),className:"font-medium text-primary hover:underline",children:a("tools.advanced.openDeveloperTools")})]})]}):(0,e.jsx)("div",{className:"max-w-5xl",children:Ve(u,o)}):(0,e.jsx)("div",{className:"p-6 text-sm text-muted-foreground",children:a("Select an organization to open advanced setup.")})}s(Fs,"ToolsAccess");function Bs(){q();const{selectedCompanyId:t}=$e(),o=Q({queryKey:_.access.currentBoardAccess,queryFn:s(()=>Kt.getCurrentBoardAccess(),"queryFn"),retry:!1});if(o.isLoading)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-muted-foreground",children:a("tools.advanced.loading")});const l=o.data,i=l?.memberships?.find(u=>u.companyId===t&&u.status==="active");return l?.source==="local_implicit"||l?.isInstanceAdmin||i?.membershipRole==="owner"||i?.membershipRole==="admin"||i?.membershipRole==="operator"||i?.membershipRole==="member"?(0,e.jsx)(Fs,{}):(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)(Ct,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:a("Advanced setup requires editing access")})]}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[a("This area lets company editors wire up tools that aren't in the gallery. Ask a company editor if you need a new app connected, or head back to")," ",(0,e.jsx)(ie,{to:"/apps",className:"font-medium text-primary hover:underline",children:a("tools.advanced.yourApps")}),a(".")]})]})})}s(Bs,"AdvancedToolsRoute");export{Bs as AdvancedToolsRoute};
|
|
39
|
+
}`;function ys(t){const o=t.replace(/[_-]+/g," ").trim().toLowerCase();return o?o.charAt(0).toUpperCase()+o.slice(1):a("Key")}s(ys,"humanizeKey");function vs(t){const o=t.credentialFields.length||t.credentialRefs.length,l=t.transport==="local_stdio"?"Runs in your workspace":"Connects over the web";return o===0?`${l} · no keys needed`:`${l} · needs ${o} ${o===1?"key":"keys"}`}s(vs,"draftSummary");function be(t){if(t.transport!=="mcp_remote")return null;const o=t.config?.url;if(typeof o!="string")return null;try{const l=new URL(o.trim());return l.protocol!=="http:"&&l.protocol!=="https:"?null:l.toString()}catch{return null}}s(be,"draftConnectUrl");function me(t,o){return`${t.name}::${o}`}s(me,"credentialValueKey");function Ns(t,o){const l={};for(const i of t.credentialFields){const u=o[me(t,i.configPath)]?.trim();u&&(l[i.configPath]=u)}return l}s(Ns,"credentialValuesForDraft");function ws(t,o){return t.credentialFields.filter(l=>l.required).filter(l=>!o[me(t,l.configPath)]?.trim()).map(l=>l.configPath)}s(ws,"missingCredentialFields");function Je(t){const o=t.suggestedDefaults?.askFirstRiskLevels;return Array.isArray(o)?o.filter(l=>typeof l=="string"):[]}s(Je,"askFirstLevelsFrom");function ks({companyId:t}){q();const o=ze(),[l,i]=(0,g.useState)(""),[u,c]=(0,g.useState)(null),[p,f]=(0,g.useState)({}),[h,D]=(0,g.useState)({}),[x,C]=(0,g.useState)(null),[T,P]=(0,g.useState)({}),[N,k]=(0,g.useState)(null),[z,S]=(0,g.useState)("entry"),[H,V]=(0,g.useState)(null),[K,w]=(0,g.useState)(null),O=I({mutationFn:s(d=>R.importMcpJson(t,{mcpJson:d}),"mutationFn"),onSuccess:s(d=>{c(d),f(Object.fromEntries(d.drafts.map(v=>[v.name,v.name]))),C(null),k(null)},"onSuccess")}),$=s(async(d,v)=>{try{const j=await lt({authorizationUrl:d,handoff:v});j.kind==="reauthentication"&&v&&ot(v.session),w(j.host),S(j.kind==="authorization"?"redirecting":"starting"),Ft(j.url)}catch(j){S("error"),V(j instanceof Error?j.message:"Paperclip couldn’t start secure sign-in. Try again.")}},"openAuthorizationPage"),B=I({mutationFn:s(d=>R.startOAuth(d),"mutationFn"),onSuccess:s(d=>{$(d.authorizationUrl,d.handoff)},"onSuccess"),onError:s(d=>{S("error"),V(d instanceof Error?d.message:"Paperclip couldn’t start secure sign-in. Try again.")},"onError")}),n=I({mutationFn:s(d=>{const v=be(d);if(!v)throw new Error("Only remote HTTP drafts can be checked and activated from pasted config.");return R.connectApp(t,{link:v,name:p[d.name]?.trim()||d.name,credentialValues:Ns(d,h)})},"mutationFn"),onSuccess:s(d=>{if(C(d),d.auth?.kind==="oauth"){if(k(null),w(null),V(null),d.auth.manualClientRequired){S("error"),V("This server requires OAuth client details from its provider settings. Continue in setup to add them.");return}const j=d.auth.startUrl?.trim();j?$(j,d.auth.handoff):(S("starting"),B.mutate(d.connectionId));return}const v={};for(const j of d.actions.readOnly)v[j.catalogEntryId]=!0;for(const j of d.actions.canMakeChanges)v[j.catalogEntryId]=!0;P(v),k(null)},"onSuccess")}),A=I({mutationFn:s(()=>{const d=x?Je(x):[],v=Object.entries(T).filter(([,L])=>L).map(([L])=>L),j=(x?.actions.canMakeChanges??[]).filter(L=>T[L.catalogEntryId]&&d.includes(L.riskLevel)).map(L=>L.catalogEntryId);return R.finishApp(t,x.connectionId,{enabledCatalogEntryIds:v,askFirstCatalogEntryIds:j,access:"all_agents"})},"mutationFn"),onSuccess:s(()=>k(x?.application.name??"Imported app"),"onSuccess")}),M=u?.drafts??[],J=l.trim().length>0&&!O.isPending,X=(0,g.useMemo)(()=>{const d=l.trim();if(!d)return null;try{return JSON.parse(d),null}catch{return a("That doesn't look like valid JSON yet — paste the whole snippet, including the outer braces.")}},[l]);if(x?.auth?.kind==="oauth"){const d=typeof x.connection.config?.url=="string"?x.connection.config.url:typeof x.connection.transportConfig?.url=="string"?x.connection.transportConfig.url:"";return(0,e.jsx)(Xe,{identity:{name:x.application.name,unverifiedHost:it(d)},phase:z,error:H,authorizationHost:K,onRetry:s(()=>{V(null),w(null),S("starting"),B.mutate(x.connectionId)},"onRetry"),onBack:s(()=>o(`/apps/${x.connectionId}/permissions`),"onBack"),onCancel:s(()=>o("/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:a("tools.pasteConfig.description")}),(0,e.jsx)(bs,{})]}),(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[a("tools.pasteConfig.justUrl")," ",(0,e.jsx)(Dt,{to:"/apps",className:"text-primary hover:underline",children:a("tools.pasteConfig.browseConnections")})," ",a("tools.pasteConfig.instead")]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)(He,{value:l,onChange:s(d=>{i(d.target.value),u&&c(null),C(null),k(null)},"onChange"),spellCheck:!1,rows:10,placeholder:js,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"}),X?(0,e.jsx)("p",{className:"text-xs text-amber-600",children:X}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.pasteConfig.pasteHint")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,e.jsx)(y,{onClick:s(()=>O.mutate(l),"onClick"),disabled:!J||!!X,children:O.isPending?a("Checking…"):a("tools.pasteConfig.checkConfig")}),(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:a("tools.pasteConfig.checkHint")})]}),O.isError?(0,e.jsx)(ee,{error:O.error}):null,u?M.length===0?(0,e.jsx)("div",{className:"rounded-lg border border-dashed border-border p-6 text-sm text-muted-foreground",children:a("tools.pasteConfig.empty")}):(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)(St,{className:"h-4 w-4 text-emerald-600"}),a(M.length===1?"connectionUi.pasteConfig.foundApps_one":"connectionUi.pasteConfig.foundApps_other",{count:M.length,defaultValue:M.length===1?"We found {{count}} app in that config":"We found {{count}} apps in that config"})]}),M.map((d,v)=>{const j=be(d),L=ws(d,h);return(0,e.jsx)(Cs,{draft:d,connectionName:p[d.name]??d.name,onConnectionNameChange:s(U=>f(te=>({...te,[d.name]:U})),"onConnectionNameChange"),credentialValues:h,onCredentialChange:s((U,te)=>D(r=>({...r,[me(d,U)]:te})),"onCredentialChange"),checking:n.isPending&&n.variables?.name===d.name,canCheck:!!j&&L.length===0,onCheck:j?()=>n.mutate(d):void 0},`${d.name}-${v}`)}),M.some(d=>be(d))?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.pasteConfig.remoteCheckHint")}):(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.pasteConfig.localDraftHint")})]}):null,n.isError?(0,e.jsx)(ee,{error:n.error}):null,x?(0,e.jsx)(Ss,{result:x,enabled:T,onToggle:s((d,v)=>P(j=>({...j,[d]:v})),"onToggle"),onBulk:s((d,v)=>P(j=>{const L={...j};for(const U of d)L[U]=v;return L}),"onBulk"),finishing:A.isPending,activatedName:N,onFinish:s(()=>A.mutate(),"onFinish")}):null,A.isError?(0,e.jsx)(ee,{error:A.error}):null]})}s(ks,"PasteConfigTab");function Cs({draft:t,connectionName:o,onConnectionNameChange:l,credentialValues:i,onCredentialChange:u,checking:c,canCheck:p,onCheck:f}){return q(),(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"font-semibold text-foreground",children:t.name}),(0,e.jsx)("div",{className:"text-xs text-muted-foreground",children:vs(t)})]}),f?(0,e.jsxs)(y,{size:"sm",className:"shrink-0",onClick:f,disabled:c||!p,children:[c?(0,e.jsx)(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,a("tools.pasteConfig.checkActions")]}):null]}),f?(0,e.jsxs)("label",{className:"mt-4 block max-w-sm space-y-1 text-xs font-medium text-foreground",children:[a("tools.connections.add.connectionName"),(0,e.jsx)(Ee,{value:o,onChange:s(h=>l(h.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(h=>(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)(ve,{className:"h-3.5 w-3.5 text-muted-foreground"}),ys(h.label||h.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:h.key}),(0,e.jsx)(Ee,{type:"password",value:i[me(t,h.configPath)]??"",onChange:s(D=>u(h.configPath,D.target.value),"onChange"),placeholder:a("tools.pasteConfig.replacementPlaceholder"),className:"h-8 max-w-sm text-xs"})]})]},`${h.configPath}-${h.key}`))}):t.credentialRefs.length>0?(0,e.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:a("tools.pasteConfig.keysDraftOnly")}):(0,e.jsx)("p",{className:"mt-3 text-xs text-muted-foreground",children:a("tools.pasteConfig.noKeys")}),t.warnings.length>0?(0,e.jsx)("ul",{className:"mt-4 space-y-1 border-t border-border pt-3",children:t.warnings.map((h,D)=>(0,e.jsx)("li",{className:"text-xs text-amber-600",children:h},D))}):null]})}s(Cs,"DraftCard");function Ss({result:t,enabled:o,onToggle:l,onBulk:i,finishing:u,activatedName:c,onFinish:p}){q();const f=Je(t),h=Object.values(o).filter(Boolean).length,D=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)(Ge,{className:"h-4 w-4 text-emerald-600"}),a("Review actions for")," ",t.application.name]}),(0,e.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:a("Health and catalog checks passed. Every discovered action starts allowed; you can narrow access after activation.")})]}),(0,e.jsxs)(y,{size:"sm",onClick:p,disabled:u||h===0||!!c,children:[u?(0,e.jsx)(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,a("Activate")," ",h," ",a("issueCommon.of")," ",D]})]}),(0,e.jsx)(Re,{title:a("companySkills.readOnly"),actions:t.actions.readOnly,enabled:o,onToggle:l,onBulk:s(x=>i(t.actions.readOnly.map(C=>C.catalogEntryId),x),"onBulk"),askFirstLevels:f}),(0,e.jsx)(Re,{title:a("Can make changes"),actions:t.actions.canMakeChanges,enabled:o,onToggle:l,onBulk:s(x=>i(t.actions.canMakeChanges.map(C=>C.catalogEntryId),x),"onBulk"),askFirstLevels:f}),c?(0,e.jsxs)("p",{className:"text-xs font-medium text-emerald-700",children:[c," ",a("is active for all agents.")]}):null]})}s(Ss,"CatalogReview");function Re({title:t,actions:o,enabled:l,onToggle:i,onBulk:u,askFirstLevels:c}){return q(),o.length===0?null:(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("div",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:t}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(y,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:s(()=>u(!0),"onClick"),children:"Turn all on"}),(0,e.jsx)(y,{type:"button",size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:s(()=>u(!1),"onClick"),children:a("apps.connect.actions.turnAllOff")})]})]}),(0,e.jsx)("div",{className:"divide-y divide-border rounded-lg border border-border",children:o.map(p=>{const f=l[p.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:p.title||p.toolName}),(0,e.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:c.includes(p.riskLevel)?a("tools.pasteConfig.askFirstWhenEnabled"):p.riskLevel})]}),(0,e.jsx)(yt,{checked:f,onCheckedChange:s(h=>i(p.catalogEntryId,h),"onCheckedChange")})]},p.catalogEntryId)})})]})}s(Re,"ActionGroup");var As="smoke@paperclip.test",Ts="smoke-password";function je(t){if(!t)return"—";const o=new Date(t);return Number.isNaN(o.getTime())?"—":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(o)}s(je,"formatTime");function ye(t){return t==="running"?"success":t==="error"?"error":"muted"}s(ye,"serviceTone");function Ps({status:t}){const o=a("tools.smokeLab.status.pass"),l=a("tools.smokeLab.status.fail"),i=a("tools.smokeLab.status.skipped");return t==="pass"?(0,e.jsx)(ue,{className:"mx-auto h-4 w-4 text-emerald-600 dark:text-emerald-400","aria-label":o}):t==="fail"?(0,e.jsx)(ce,{className:"mx-auto h-4 w-4 text-destructive","aria-label":l}):t==="skipped"?(0,e.jsx)(Ke,{className:"mx-auto h-4 w-4 text-amber-500","aria-label":i}):(0,e.jsx)("span",{className:"mx-auto block h-1.5 w-1.5 rounded-full bg-muted-foreground/30","aria-label":a("tools.smokeLab.status.notRun")})}s(Ps,"CellGlyph");var Ls={green:"bg-emerald-500",amber:"bg-amber-500",red:"bg-destructive",unknown:"bg-muted-foreground/40"};function Es({companyId:t}){const{t:o}=q(),{enabled:l,loaded:i}=Vt(),u=we(),{pushToast:c}=ke(),[p,f]=(0,g.useState)(null),h=Q({queryKey:_.smokeLab.services(t),queryFn:s(()=>Y.listServices(t),"queryFn"),enabled:l&&i,refetchInterval:l?1e4:!1}),D=Q({queryKey:_.smokeLab.runs(t),queryFn:s(()=>Y.listRuns(t),"queryFn"),enabled:l&&i,refetchInterval:l?1e4:!1}).data?.runs??[],x=p??D[0]?.id??null,C=Q({queryKey:_.smokeLab.run(t,x??"__none__"),queryFn:s(()=>Y.getRun(t,x),"queryFn"),enabled:l&&i&&!!x,refetchInterval:l&&x?1e4:!1}),T=(0,g.useMemo)(()=>C.data?.steps??[],[C.data]),P=(0,g.useMemo)(()=>mt(T),[T]),N=C.data?.run;function k(){u.invalidateQueries({queryKey:_.smokeLab.services(t)}),u.invalidateQueries({queryKey:_.smokeLab.runs(t)}),x&&u.invalidateQueries({queryKey:_.smokeLab.run(t,x)})}s(k,"refresh");const z=I({mutationFn:s(()=>Y.startServices(t),"mutationFn"),onSuccess:s(()=>{c({title:o("tools.smokeLab.toast.servicesStarted"),tone:"success"}),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.startServicesFailed"),body:n.message,tone:"error"}),"onError")}),S=I({mutationFn:s(()=>Y.stopServices(t),"mutationFn"),onSuccess:s(()=>{c({title:o("tools.smokeLab.toast.servicesStopped"),tone:"info"}),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.stopServicesFailed"),body:n.message,tone:"error"}),"onError")}),H=I({mutationFn:s(()=>Y.installFixtures(t),"mutationFn"),onSuccess:s(n=>{c({title:n.created?o("tools.smokeLab.toast.fixturesInstalled"):o("tools.smokeLab.toast.fixturesPresent"),tone:"success"}),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.installFixturesFailed"),body:n.message,tone:"error"}),"onError")}),V=I({mutationFn:s(()=>Y.reset(t),"mutationFn"),onSuccess:s(()=>{c({title:o("tools.smokeLab.toast.reset"),tone:"info"}),f(null),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.resetFailed"),body:n.message,tone:"error"}),"onError")}),K=I({mutationFn:s(()=>Y.createRun(t,{trigger:"manual",summary:{}}),"mutationFn"),onSuccess:s(n=>{c({title:o("tools.smokeLab.toast.runStarted"),body:o("tools.smokeLab.toast.runStartedBody"),tone:"success"}),f(n.run.id),k()},"onSuccess"),onError:s(n=>c({title:o("tools.smokeLab.toast.startRunFailed"),body:n.message,tone:"error"}),"onError")}),w=z.isPending||S.isPending||H.isPending||V.isPending||K.isPending;if(i&&!l)return(0,e.jsxs)("div",{className:"rounded-lg border border-border bg-card p-6",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-foreground",children:[(0,e.jsx)(Le,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-base font-semibold",children:o("tools.smokeLab.disabled.title")})]}),(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:o("tools.smokeLab.title")})," ","under Settings → Experimental to enable it."]})]});if(!i)return(0,e.jsx)("div",{className:"p-6 text-sm text-muted-foreground",children:o("tools.smokeLab.loading")});const O=h.data?.services??[],$=ft(N,T),B=pt(T);return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"smoke-lab-tab",children:[(0,e.jsxs)("header",{children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Le,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-xl font-bold text-foreground",children:o("tools.smokeLab.title")}),(0,e.jsx)(ne,{variant:"outline",children:o("tools.common.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)(Kt,{className:"h-4 w-4"})," ",a("tools.smokeLab.tutorial")]})]}),(0,e.jsxs)("p",{className:"mt-1.5 max-w-3xl text-sm text-muted-foreground",children:[a("tools.smokeLab.description")," ",(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:a("tools.smokeLab.tutorialLower")}),a(".")]})]}),(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)(st,{className:"h-4 w-4 text-muted-foreground"}),(0,e.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:o("tools.smokeLab.services.title")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxs)(y,{size:"sm",onClick:s(()=>z.mutate(),"onClick"),disabled:w,children:[(0,e.jsx)(bt,{className:"h-4 w-4"})," ",a("Start services")]}),(0,e.jsx)(y,{size:"sm",variant:"outline",onClick:s(()=>S.mutate(),"onClick"),disabled:w,children:a("Stop")}),(0,e.jsx)(y,{size:"sm",variant:"outline",onClick:s(()=>H.mutate(),"onClick"),disabled:w,children:a("tools.smokeLab.services.installFixtures")}),(0,e.jsxs)(y,{size:"sm",variant:"ghost",onClick:s(()=>V.mutate(),"onClick"),disabled:w,children:[(0,e.jsx)(Be,{className:"h-4 w-4"})," ",a("Reset")]})]})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[O.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:Z("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:Z(ye(n.status)==="success"&&"text-emerald-600 dark:text-emerald-400",ye(n.status)==="error"&&"text-destructive",ye(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:o("tools.smokeLab.services.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:o("tools.smokeLab.services.notRunning")})})]})})]},n.id)),O.length===0&&(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:o("tools.smokeLab.services.empty")})]}),(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:o("tools.smokeLab.credentials.title")}),(0,e.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a("tools.smokeLab.credentials.description")}),(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:[a("tools.smokeLab.credentials.email")," ",As]}),(0,e.jsxs)("span",{children:[a("tools.smokeLab.credentials.password")," ",Ts]})]})]})]}),(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:o("tools.smokeLab.matrix.title")}),(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)(ue,{className:"h-3.5 w-3.5 text-emerald-600 dark:text-emerald-400"})," ",a("tools.smokeLab.status.pass")]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(ce,{className:"h-3.5 w-3.5 text-destructive"})," ",a("tools.smokeLab.status.fail")]}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,e.jsx)(Ke,{className:"h-3.5 w-3.5 text-amber-500"})," ",a("tools.smokeLab.status.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"})," ",a("tools.smokeLab.status.notRun")]})]})]}),(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:o("tools.smokeLab.matrix.path")}),Te.map(n=>(0,e.jsx)("th",{className:"px-2 py-2 text-center font-medium text-muted-foreground",children:o(n.labelKey,{defaultValue:n.labelDefault})},n.key))]})}),(0,e.jsx)("tbody",{children:xt.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:o(re[n].titleKey,{defaultValue:re[n].titleDefault})}),(0,e.jsx)("span",{className:"block text-(length:--text-micro) font-normal text-muted-foreground",children:o(re[n].detailKey,{defaultValue:re[n].detailDefault})})]}),Te.map(A=>{const M=P.get(ut(n,A.key));return(0,e.jsx)("td",{className:"px-2 py-2 text-center",children:(0,e.jsx)(Ps,{status:M?.status??"not-run"})},A.key)})]},n))})]})}),T.length===0&&(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:a("tools.smokeLab.matrix.empty")})]}),(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:o("tools.smokeLab.runs.title")}),(0,e.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:Z("h-2 w-2 rounded-full",Ls[$])}),$==="unknown"?o("tools.smokeLab.runs.noneYet"):$,B.length>0&&` · failing: ${B.join(", ")}`]})]}),(0,e.jsxs)(y,{size:"sm",onClick:s(()=>K.mutate(),"onClick"),disabled:w,children:[K.isPending?(0,e.jsx)(Ne,{className:"h-4 w-4 animate-spin"}):(0,e.jsx)(Ut,{className:"h-4 w-4"}),a("tools.smokeLab.runs.start")]})]}),(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:[D.length===0&&(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:o("tools.smokeLab.runs.empty")}),(0,e.jsx)("ul",{className:"divide-y divide-border",children:D.map(n=>{const A=n.id===x;return(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",onClick:s(()=>f(n.id),"onClick"),className:Z("flex w-full items-center justify-between gap-2 px-3 py-2.5 text-left transition-colors hover:bg-accent/50",A&&"bg-accent"),children:[(0,e.jsxs)("span",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"block text-xs font-medium text-foreground",children:je(n.startedAt)}),(0,e.jsx)("span",{className:"block text-(length:--text-micro) text-muted-foreground",children:n.trigger})]}),(0,e.jsx)(Ae,{status:n.status})]})},n.id)})})]}),(0,e.jsxs)("div",{className:"min-w-0 rounded-lg border border-border",children:[!N&&(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:o("tools.smokeLab.runs.select")}),N&&(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:[a("Started")," ",je(N.startedAt)," · finished ",je(N.finishedAt)]}),(0,e.jsx)(Ae,{status:N.status})]}),T.length===0?(0,e.jsx)("p",{className:"p-4 text-sm text-muted-foreground",children:o("tools.smokeLab.runs.noSteps")}):(0,e.jsx)("ul",{className:"divide-y divide-border",children:T.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)(ue,{className:"h-4 w-4 text-emerald-600 dark:text-emerald-400"}):n.status==="fail"?(0,e.jsx)(ce,{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:a("tools.smokeLab.runs.viewScreenshot")})]}),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(Es,"SmokeLabTab");function Ve(t,o){switch(t){case"profiles":return(0,e.jsx)(is,{companyId:o});case"gateways":return(0,e.jsx)(gs,{companyId:o});case"smoke-lab":return(0,e.jsx)(Es,{companyId:o});default:return(0,e.jsx)(ks,{companyId:o})}}s(Ve,"renderTab");function Fs(){q();const{selectedCompany:t,selectedCompanyId:o}=$e(),{setBreadcrumbs:l}=Rt(),i=Qt(),u=Pe.find(f=>f.key===i.tab)?.key??"paste-config",c=Gt(u),p=Pe.find(f=>f.key===u)?.label;return(0,g.useEffect)(()=>(l([{label:t?.name??a("Company"),href:"/dashboard"},{label:a("tools.breadcrumbs.apps"),href:"/apps"},...c?[{label:a("tools.advanced.title")}]:[{label:a("tools.advanced.title"),href:ge("paste-config")},{label:p??a("tools.developer.title")}]]),()=>l([])),[l,t?.name,c,p]),o?i.tab==="run-your-own"?(0,e.jsx)(le,{to:"/apps",replace:!0}):i.tab==="applications"||i.tab==="connections"||i.tab==="overview"||i.tab==="examples"||i.tab==="audit"?(0,e.jsx)(le,{to:"/apps",replace:!0}):i.tab==="runtime"?(0,e.jsx)(le,{to:"/apps",replace:!0}):i.tab==="policies"?(0,e.jsx)(le,{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:a("tools.advanced.title")}),(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:a("tools.advanced.badge")})]}),(0,e.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground",children:[a("tools.advanced.description")," ",(0,e.jsx)(ie,{to:"/apps",className:"font-medium text-primary hover:underline",children:a("tools.advanced.connectInGallery")}),a(".")]})]}),(0,e.jsx)("nav",{className:"flex items-center gap-6 border-b border-border",children:$t.map(f=>(0,e.jsx)(ie,{to:ge(f.key),className:Z("-mb-px border-b-2 pb-2 text-sm transition-colors",f.key===u?"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:Ve(u,o)}),(0,e.jsxs)("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,e.jsx)(Lt,{className:"h-3.5 w-3.5"}),a("tools.advanced.lookingForDeveloperTools")," ",(0,e.jsx)(ie,{to:ge("profiles"),className:"font-medium text-primary hover:underline",children:a("tools.advanced.openDeveloperTools")})]})]}):(0,e.jsx)("div",{className:"max-w-5xl",children:Ve(u,o)}):(0,e.jsx)("div",{className:"p-6 text-sm text-muted-foreground",children:a("Select an organization to open advanced setup.")})}s(Fs,"ToolsAccess");function Bs(){q();const{selectedCompanyId:t}=$e(),o=Q({queryKey:_.access.currentBoardAccess,queryFn:s(()=>zt.getCurrentBoardAccess(),"queryFn"),retry:!1});if(o.isLoading)return(0,e.jsx)("div",{className:"mx-auto max-w-xl py-10 text-sm text-muted-foreground",children:a("tools.advanced.loading")});const l=o.data,i=l?.memberships?.find(u=>u.companyId===t&&u.status==="active");return l?.source==="local_implicit"||l?.isInstanceAdmin||i?.membershipRole==="owner"||i?.membershipRole==="admin"||i?.membershipRole==="operator"||i?.membershipRole==="member"?(0,e.jsx)(Fs,{}):(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)(Ct,{className:"h-5 w-5 text-muted-foreground"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:a("Advanced setup requires editing access")})]}),(0,e.jsxs)("p",{className:"text-sm text-muted-foreground",children:[a("This area lets company editors wire up tools that aren't in the gallery. Ask a company editor if you need a new app connected, or head back to")," ",(0,e.jsx)(ie,{to:"/apps",className:"font-medium text-primary hover:underline",children:a("tools.advanced.yourApps")}),a(".")]})]})})}s(Bs,"AdvancedToolsRoute");export{Bs as AdvancedToolsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var xe=Object.defineProperty;var n=(e,a)=>xe(e,"name",{value:a,configurable:!0});import{a as X}from"./rolldown-runtime-DhZMWcEn.js";import{lo as ye,yn as ve}from"./issue-detail-DhUrNgHw.js";import{Cf as be,Df as je,Dh as ge,Ef as Ce,F_ as W,M_ as v,Ng as we,Nn as Ne,Of as Ae,Sf as Se,Tb as R,Tf as ke,Vg as Re,Wf as Te,dv as o,eh as _e,gg as Y,hm as m,j_ as Pe,kf as De,lh as Ee,m_ as Fe,nd as Oe,oh as qe,pf as u,rf as Ke,sh as Z,sx as Be,ug as Ie,ux as Qe,wf as Me,wp as $e,x_ as q,xp as Le,yp as Ge}from"./index-B7Ixs7A0.js";var f=X(Qe(),1),Je=["instructionsBundleMode","instructionsRootPath","instructionsEntryFile","instructionsFilePath","agentsMdPath","promptTemplate","bootstrapPromptTemplate"];function K(e){return e?JSON.parse(JSON.stringify(e)):{}}n(K,"cloneRecord");function z(e){return`${e.trim()||"Agent"} Copy`}n(z,"duplicateAgentName");function Ue(e,a){const r=K(e.adapterConfig);for(const d of Je)delete r[d];const i={name:z(e.name),role:e.role,adapterType:e.adapterType,adapterConfig:r,runtimeConfig:K(e.runtimeConfig),defaultEnvironmentId:e.defaultEnvironmentId??null,budgetMonthlyCents:e.budgetMonthlyCents??0,permissions:{canCreateAgents:!!e.permissions?.canCreateAgents,canCreateSkills:e.permissions?.canCreateSkills!==!1}};return e.title&&(i.title=e.title),e.icon&&(i.icon=e.icon),e.reportsTo&&(i.reportsTo=e.reportsTo),e.capabilities&&(i.capabilities=e.capabilities),e.metadata&&(i.metadata=K(e.metadata)),a&&Object.keys(a.files).length>0&&(i.instructionsBundle=a),i}n(Ue,"buildDuplicateAgentPayload");var s=X(Be(),1);function Ve({onClick:e,disabled:a,label:r,size:i="sm"}){R();const d=r??o("Run now");return(0,s.jsxs)(v,{variant:"outline",size:i,onClick:e,disabled:a,children:[(0,s.jsx)(Z,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d})]})}n(Ve,"RunButton");function He({isPaused:e,onPause:a,onResume:r,disabled:i,size:d="sm"}){return R(),e?(0,s.jsxs)(v,{variant:"outline",size:d,onClick:r,disabled:i,children:[(0,s.jsx)(Z,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:o("Resume")})]}):(0,s.jsxs)(v,{variant:"outline",size:d,onClick:a,disabled:i,children:[(0,s.jsx)(Ee,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:o("Pause")})]})}n(He,"PauseResumeButton");function We({onClick:e,disabled:a,size:r="sm"}){return R(),(0,s.jsxs)(v,{variant:"outline",size:r,onClick:e,disabled:a,className:"border-destructive/60 text-destructive hover:bg-destructive/10 hover:text-destructive dark:border-destructive/50","aria-label":o("agentActions.clearErrorAria"),children:[(0,s.jsx)(we,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:o("agentActions.clearError")})]})}n(We,"ClearErrorButton");function Ye(e,a){return a.deprecated||a.virtual?null:a.path}n(Ye,"duplicateInstructionFilePath");async function Xe(e,a){const r=await u.instructionsBundle(e,a),i={};for(const C of r.files){const w=Ye(r,C);w&&(i[w]=(await u.instructionsFile(e,C.path,a)).content)}const d=Object.prototype.hasOwnProperty.call(i,r.entryFile)?r.entryFile:Object.keys(i)[0]??"AGENTS.md";return Object.keys(i).length>0?{entryFile:d,files:i}:null}n(Xe,"loadDuplicateInstructionsBundle");function ts({agent:e,companyId:a,size:r="sm",assignLabel:i="Assign Task",runLabel:d,showStatus:C=!0,showRun:w=!0,actionsDisabled:ee=!1,workActionsDisabled:T=!1,workActionsDisabledReason:se,navigateToRunOnInvoke:B=!0,hasPendingNavigationChanges:I=!1,onBeforeNavigate:Q,onActionError:h,onTerminateSuccess:M,pauseConfirm:N,hideTerminate:te=!1,children:ne,className:ae}){const{t:$}=R(),ie=d??o("Run now"),_=Te(),c=Pe(),{openNewIssue:re}=Ke(),{pushToast:b}=Oe(),[le,j]=(0,f.useState)(!1),[oe,L]=(0,f.useState)(!1),P=(0,f.useRef)(I),D=(0,f.useRef)(Q),A=(0,f.useRef)(!1),G=(0,f.useRef)(!1);P.current=I,D.current=Q;function E(t){return t.current=P.current,D.current?.()!==!1}n(E,"confirmNavigationStart");function F(t){return!P.current||t.current||D.current?.()!==!1}n(F,"confirmLateNavigationChanges");const l=a??e.companyId,O=W(e),J=e.lifecycleState?e.lifecycleState==="paused":e.status==="paused",ce=e.status==="error",U=(0,f.useCallback)(t=>{h?h(t):b({title:$("agentActions.error.actionFailed",{defaultValue:"Action failed"}),body:t,tone:"error"})},[h,b,$]),ue=(0,f.useCallback)(()=>{c.invalidateQueries({queryKey:m.agents.detail(e.id)}),c.invalidateQueries({queryKey:m.agents.detail(O)}),c.invalidateQueries({queryKey:m.agents.runtimeState(e.id)}),c.invalidateQueries({queryKey:m.agents.taskSessions(e.id)}),l&&(c.invalidateQueries({queryKey:m.agents.list(l)}),c.invalidateQueries({queryKey:m.liveRuns(l)}),c.invalidateQueries({queryKey:m.heartbeats(l,e.id)}))},[e.id,O,c,l]),x=q({mutationFn:n(async t=>{switch(t){case"invoke":return u.invoke(e.id,l??void 0);case"pause":return u.pause(e.id,l??void 0);case"resume":return u.resume(e.id,l??void 0);case"clear_error":return u.clearError(e.id,l??void 0);case"approve":return u.approve(e.id,l??void 0);case"terminate":return u.terminate(e.id,l??void 0)}},"mutationFn"),onSuccess:n((t,p)=>{if(h?.(null),ue(),p==="terminate"){const y=t.lifecycleState;if(y==="terminating"||y==="cleaning_up"||!F(A))return;M?.(t)}if(p==="invoke"&&B&&t&&typeof t=="object"&&"id"in t){if(!F(A))return;_(`/agents/${O}/runs/${t.id}`)}},"onSuccess"),onError:n(t=>{U(t instanceof Error?t.message:"Action failed")},"onError")}),g=q({mutationFn:n(async()=>{if(!l)throw new Error("Agent is not ready to duplicate");const t=await Xe(e.id,l),p=Ue(e,t);try{return await u.create(l,p)}catch(y){if(y instanceof Fe&&y.status===409&&y.message.includes("requires board approval"))return(await u.hire(l,p)).agent;throw y}},"mutationFn"),onSuccess:n(async t=>{h?.(null),l&&await c.invalidateQueries({queryKey:m.agents.list(l)}),b({title:o("Agent duplicated"),body:t.name,tone:"success"}),F(G)&&_(`/agents/${W(t)}/dashboard`)},"onSuccess"),onError:n(t=>{const p=t instanceof Error?t.message:"Failed to duplicate agent";h?.(p),b({title:o("Could not duplicate agent"),body:p,tone:"error"})},"onError")}),de=(0,f.useCallback)(()=>{if(g.isPending)return;const t=z(e.name),p=window.confirm(`Duplicate ${e.name} as ${t}?`);j(!1),!(!p||!E(G))&&g.mutate()},[e.name,g]),pe=q({mutationFn:n(()=>u.resetSession(e.id,null,l??void 0),"mutationFn"),onSuccess:n(()=>{h?.(null),c.invalidateQueries({queryKey:m.agents.runtimeState(e.id)}),c.invalidateQueries({queryKey:m.agents.taskSessions(e.id)})},"onSuccess"),onError:n(t=>{U(t instanceof Error?t.message:"Failed to reset session")},"onError")}),V=e.status==="pending_approval",S=ee||x.isPending,H=S||V||T||e.status==="terminated",me=S||V||J&&T||!!(e.lifecycleState&&["pausing","terminating","cleaning_up","terminated","rejected"].includes(e.lifecycleState)),fe=S,k=e.runtimeConfig,he=(k&&typeof k.debug=="object"&&k.debug!==null?k.debug:null)?.providerTrace==="raw";return(0,s.jsxs)("div",{className:ae??"flex items-center gap-1 sm:gap-2 shrink-0",children:[he?(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:o("Exact provider traffic will be captured for future runs and retained for up to 24 hours."),children:[(0,s.jsx)(Re,{className:"h-3.5 w-3.5"}),o("Raw tracing on")]}):null,(0,s.jsxs)(v,{variant:"outline",size:r,onClick:n(()=>re({assigneeAgentId:e.id}),"onClick"),disabled:H,title:T?se:void 0,children:[(0,s.jsx)(qe,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:i})]}),w&&(0,s.jsx)(Ve,{onClick:n(()=>{B&&!E(A)||x.mutate("invoke")},"onClick"),disabled:H,label:ie,size:r}),ce?(0,s.jsx)(We,{onClick:n(()=>x.mutate("clear_error"),"onClick"),disabled:fe,size:r}):e.pauseReason==="setup"&&e.lifecycleState==="paused"?(0,s.jsx)(v,{variant:"outline",size:r,disabled:S,onClick:n(()=>_(`/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)(He,{isPaused:J,onPause:n(()=>N?L(!0):x.mutate("pause"),"onPause"),onResume:n(()=>x.mutate("resume"),"onResume"),disabled:me,size:r}),N&&(0,s.jsx)(Se,{open:oe,onOpenChange:L,children:(0,s.jsxs)(ke,{children:[(0,s.jsxs)(Ae,{children:[(0,s.jsx)(De,{children:N.title}),(0,s.jsx)(Ce,{asChild:!0,children:(0,s.jsx)("div",{children:N.description})})]}),(0,s.jsxs)(je,{children:[(0,s.jsx)(Me,{children:o("Cancel")}),(0,s.jsx)(be,{onClick:n(()=>x.mutate("pause"),"onClick"),children:o("agentAction.pauseAnyway")})]})]})}),C&&(0,s.jsx)("span",{className:"hidden sm:inline",children:(0,s.jsx)(ve,{status:e.status})}),ne,(0,s.jsxs)(Ge,{open:le,onOpenChange:j,children:[(0,s.jsx)($e,{asChild:!0,children:(0,s.jsx)(v,{variant:"ghost",size:"icon-xs","aria-label":`Open actions for ${e.name}`,children:(0,s.jsx)(Ie,{className:"h-4 w-4"})})}),(0,s.jsxs)(Le,{className:"w-44 p-1",align:"end",children:[(0,s.jsxs)("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50",disabled:g.isPending,onClick:de,children:[g.isPending?(0,s.jsx)(ge,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(Y,{className:"h-3 w-3"}),o("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:n(()=>{Ne(e.id).catch(()=>{b({title:o("Copy failed"),body:"Clipboard access is unavailable.",tone:"error"})}),j(!1)},"onClick"),children:[(0,s.jsx)(Y,{className:"h-3 w-3"}),o("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:n(()=>{pe.mutate(),j(!1)},"onClick"),children:[(0,s.jsx)(_e,{className:"h-3 w-3"}),o("Reset Sessions")]}),!te&&(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:n(()=>{j(!1),!(M&&!E(A))&&x.mutate("terminate")},"onClick"),children:[(0,s.jsx)(ye,{className:"h-3 w-3"}),o("Terminate")]})]})]})]})}n(ts,"AgentActionButtons");export{Ve as n,ts as t};
|
|
1
|
+
var xe=Object.defineProperty;var n=(e,a)=>xe(e,"name",{value:a,configurable:!0});import{a as X}from"./rolldown-runtime-DhZMWcEn.js";import{bn as ye,uo as ve}from"./issue-detail-DxleZn9K.js";import{Cf as be,Df as je,Dh as ge,Ef as Ce,F_ as W,M_ as v,Ng as we,Nn as Ne,Of as Ae,Sf as Se,Tb as R,Tf as ke,Vg as Re,Wf as Te,dv as o,eh as _e,gg as Y,hm as m,j_ as Pe,kf as De,lh as Ee,m_ as Fe,nd as Oe,oh as qe,pf as u,rf as Ke,sh as Z,sx as Be,ug as Ie,ux as Qe,wf as Me,wp as $e,x_ as q,xp as Le,yp as Ge}from"./index-B9_Uv8kr.js";var f=X(Qe(),1),Je=["instructionsBundleMode","instructionsRootPath","instructionsEntryFile","instructionsFilePath","agentsMdPath","promptTemplate","bootstrapPromptTemplate"];function K(e){return e?JSON.parse(JSON.stringify(e)):{}}n(K,"cloneRecord");function z(e){return`${e.trim()||"Agent"} Copy`}n(z,"duplicateAgentName");function Ue(e,a){const r=K(e.adapterConfig);for(const d of Je)delete r[d];const i={name:z(e.name),role:e.role,adapterType:e.adapterType,adapterConfig:r,runtimeConfig:K(e.runtimeConfig),defaultEnvironmentId:e.defaultEnvironmentId??null,budgetMonthlyCents:e.budgetMonthlyCents??0,permissions:{canCreateAgents:!!e.permissions?.canCreateAgents,canCreateSkills:e.permissions?.canCreateSkills!==!1}};return e.title&&(i.title=e.title),e.icon&&(i.icon=e.icon),e.reportsTo&&(i.reportsTo=e.reportsTo),e.capabilities&&(i.capabilities=e.capabilities),e.metadata&&(i.metadata=K(e.metadata)),a&&Object.keys(a.files).length>0&&(i.instructionsBundle=a),i}n(Ue,"buildDuplicateAgentPayload");var s=X(Be(),1);function Ve({onClick:e,disabled:a,label:r,size:i="sm"}){R();const d=r??o("Run now");return(0,s.jsxs)(v,{variant:"outline",size:i,onClick:e,disabled:a,children:[(0,s.jsx)(Z,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d})]})}n(Ve,"RunButton");function He({isPaused:e,onPause:a,onResume:r,disabled:i,size:d="sm"}){return R(),e?(0,s.jsxs)(v,{variant:"outline",size:d,onClick:r,disabled:i,children:[(0,s.jsx)(Z,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:o("Resume")})]}):(0,s.jsxs)(v,{variant:"outline",size:d,onClick:a,disabled:i,children:[(0,s.jsx)(Ee,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:o("Pause")})]})}n(He,"PauseResumeButton");function We({onClick:e,disabled:a,size:r="sm"}){return R(),(0,s.jsxs)(v,{variant:"outline",size:r,onClick:e,disabled:a,className:"border-destructive/60 text-destructive hover:bg-destructive/10 hover:text-destructive dark:border-destructive/50","aria-label":o("agentActions.clearErrorAria"),children:[(0,s.jsx)(we,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:o("agentActions.clearError")})]})}n(We,"ClearErrorButton");function Ye(e,a){return a.deprecated||a.virtual?null:a.path}n(Ye,"duplicateInstructionFilePath");async function Xe(e,a){const r=await u.instructionsBundle(e,a),i={};for(const C of r.files){const w=Ye(r,C);w&&(i[w]=(await u.instructionsFile(e,C.path,a)).content)}const d=Object.prototype.hasOwnProperty.call(i,r.entryFile)?r.entryFile:Object.keys(i)[0]??"AGENTS.md";return Object.keys(i).length>0?{entryFile:d,files:i}:null}n(Xe,"loadDuplicateInstructionsBundle");function ts({agent:e,companyId:a,size:r="sm",assignLabel:i="Assign Task",runLabel:d,showStatus:C=!0,showRun:w=!0,actionsDisabled:ee=!1,workActionsDisabled:T=!1,workActionsDisabledReason:se,navigateToRunOnInvoke:B=!0,hasPendingNavigationChanges:I=!1,onBeforeNavigate:Q,onActionError:h,onTerminateSuccess:M,pauseConfirm:N,hideTerminate:te=!1,children:ne,className:ae}){const{t:$}=R(),ie=d??o("Run now"),_=Te(),c=Pe(),{openNewIssue:re}=Ke(),{pushToast:b}=Oe(),[le,j]=(0,f.useState)(!1),[oe,L]=(0,f.useState)(!1),P=(0,f.useRef)(I),D=(0,f.useRef)(Q),A=(0,f.useRef)(!1),G=(0,f.useRef)(!1);P.current=I,D.current=Q;function E(t){return t.current=P.current,D.current?.()!==!1}n(E,"confirmNavigationStart");function F(t){return!P.current||t.current||D.current?.()!==!1}n(F,"confirmLateNavigationChanges");const l=a??e.companyId,O=W(e),J=e.lifecycleState?e.lifecycleState==="paused":e.status==="paused",ce=e.status==="error",U=(0,f.useCallback)(t=>{h?h(t):b({title:$("agentActions.error.actionFailed",{defaultValue:"Action failed"}),body:t,tone:"error"})},[h,b,$]),ue=(0,f.useCallback)(()=>{c.invalidateQueries({queryKey:m.agents.detail(e.id)}),c.invalidateQueries({queryKey:m.agents.detail(O)}),c.invalidateQueries({queryKey:m.agents.runtimeState(e.id)}),c.invalidateQueries({queryKey:m.agents.taskSessions(e.id)}),l&&(c.invalidateQueries({queryKey:m.agents.list(l)}),c.invalidateQueries({queryKey:m.liveRuns(l)}),c.invalidateQueries({queryKey:m.heartbeats(l,e.id)}))},[e.id,O,c,l]),x=q({mutationFn:n(async t=>{switch(t){case"invoke":return u.invoke(e.id,l??void 0);case"pause":return u.pause(e.id,l??void 0);case"resume":return u.resume(e.id,l??void 0);case"clear_error":return u.clearError(e.id,l??void 0);case"approve":return u.approve(e.id,l??void 0);case"terminate":return u.terminate(e.id,l??void 0)}},"mutationFn"),onSuccess:n((t,p)=>{if(h?.(null),ue(),p==="terminate"){const y=t.lifecycleState;if(y==="terminating"||y==="cleaning_up"||!F(A))return;M?.(t)}if(p==="invoke"&&B&&t&&typeof t=="object"&&"id"in t){if(!F(A))return;_(`/agents/${O}/runs/${t.id}`)}},"onSuccess"),onError:n(t=>{U(t instanceof Error?t.message:"Action failed")},"onError")}),g=q({mutationFn:n(async()=>{if(!l)throw new Error("Agent is not ready to duplicate");const t=await Xe(e.id,l),p=Ue(e,t);try{return await u.create(l,p)}catch(y){if(y instanceof Fe&&y.status===409&&y.message.includes("requires board approval"))return(await u.hire(l,p)).agent;throw y}},"mutationFn"),onSuccess:n(async t=>{h?.(null),l&&await c.invalidateQueries({queryKey:m.agents.list(l)}),b({title:o("Agent duplicated"),body:t.name,tone:"success"}),F(G)&&_(`/agents/${W(t)}/dashboard`)},"onSuccess"),onError:n(t=>{const p=t instanceof Error?t.message:"Failed to duplicate agent";h?.(p),b({title:o("Could not duplicate agent"),body:p,tone:"error"})},"onError")}),de=(0,f.useCallback)(()=>{if(g.isPending)return;const t=z(e.name),p=window.confirm(`Duplicate ${e.name} as ${t}?`);j(!1),!(!p||!E(G))&&g.mutate()},[e.name,g]),pe=q({mutationFn:n(()=>u.resetSession(e.id,null,l??void 0),"mutationFn"),onSuccess:n(()=>{h?.(null),c.invalidateQueries({queryKey:m.agents.runtimeState(e.id)}),c.invalidateQueries({queryKey:m.agents.taskSessions(e.id)})},"onSuccess"),onError:n(t=>{U(t instanceof Error?t.message:"Failed to reset session")},"onError")}),V=e.status==="pending_approval",S=ee||x.isPending,H=S||V||T||e.status==="terminated",me=S||V||J&&T||!!(e.lifecycleState&&["pausing","terminating","cleaning_up","terminated","rejected"].includes(e.lifecycleState)),fe=S,k=e.runtimeConfig,he=(k&&typeof k.debug=="object"&&k.debug!==null?k.debug:null)?.providerTrace==="raw";return(0,s.jsxs)("div",{className:ae??"flex items-center gap-1 sm:gap-2 shrink-0",children:[he?(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:o("Exact provider traffic will be captured for future runs and retained for up to 24 hours."),children:[(0,s.jsx)(Re,{className:"h-3.5 w-3.5"}),o("Raw tracing on")]}):null,(0,s.jsxs)(v,{variant:"outline",size:r,onClick:n(()=>re({assigneeAgentId:e.id}),"onClick"),disabled:H,title:T?se:void 0,children:[(0,s.jsx)(qe,{className:"h-3.5 w-3.5 sm:mr-1"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:i})]}),w&&(0,s.jsx)(Ve,{onClick:n(()=>{B&&!E(A)||x.mutate("invoke")},"onClick"),disabled:H,label:ie,size:r}),ce?(0,s.jsx)(We,{onClick:n(()=>x.mutate("clear_error"),"onClick"),disabled:fe,size:r}):e.pauseReason==="setup"&&e.lifecycleState==="paused"?(0,s.jsx)(v,{variant:"outline",size:r,disabled:S,onClick:n(()=>_(`/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)(He,{isPaused:J,onPause:n(()=>N?L(!0):x.mutate("pause"),"onPause"),onResume:n(()=>x.mutate("resume"),"onResume"),disabled:me,size:r}),N&&(0,s.jsx)(Se,{open:oe,onOpenChange:L,children:(0,s.jsxs)(ke,{children:[(0,s.jsxs)(Ae,{children:[(0,s.jsx)(De,{children:N.title}),(0,s.jsx)(Ce,{asChild:!0,children:(0,s.jsx)("div",{children:N.description})})]}),(0,s.jsxs)(je,{children:[(0,s.jsx)(Me,{children:o("Cancel")}),(0,s.jsx)(be,{onClick:n(()=>x.mutate("pause"),"onClick"),children:o("agentAction.pauseAnyway")})]})]})}),C&&(0,s.jsx)("span",{className:"hidden sm:inline",children:(0,s.jsx)(ye,{status:e.status})}),ne,(0,s.jsxs)(Ge,{open:le,onOpenChange:j,children:[(0,s.jsx)($e,{asChild:!0,children:(0,s.jsx)(v,{variant:"ghost",size:"icon-xs","aria-label":`Open actions for ${e.name}`,children:(0,s.jsx)(Ie,{className:"h-4 w-4"})})}),(0,s.jsxs)(Le,{className:"w-44 p-1",align:"end",children:[(0,s.jsxs)("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-xs rounded hover:bg-accent/50",disabled:g.isPending,onClick:de,children:[g.isPending?(0,s.jsx)(ge,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(Y,{className:"h-3 w-3"}),o("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:n(()=>{Ne(e.id).catch(()=>{b({title:o("Copy failed"),body:"Clipboard access is unavailable.",tone:"error"})}),j(!1)},"onClick"),children:[(0,s.jsx)(Y,{className:"h-3 w-3"}),o("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:n(()=>{pe.mutate(),j(!1)},"onClick"),children:[(0,s.jsx)(_e,{className:"h-3 w-3"}),o("Reset Sessions")]}),!te&&(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:n(()=>{j(!1),!(M&&!E(A))&&x.mutate("terminate")},"onClick"),children:[(0,s.jsx)(ve,{className:"h-3 w-3"}),o("Terminate")]})]})]})]})}n(ts,"AgentActionButtons");export{Ve as n,ts as t};
|