dorkos 0.125.3 → 0.125.4
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/bin/cli.js +246 -215
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-DSSx1Gzx.js → AboutPage-CTG5VvGg.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-C-mLOmJm.js → ActivityErrorState-BSuvlEdx.js} +1 -1
- package/dist/client/assets/{ActivityPage-DsOjjulF.js → ActivityPage-BoiN89nn.js} +1 -1
- package/dist/client/assets/{ActivityRow-ylgCMe7Y.js → ActivityRow-Bj0V45d7.js} +1 -1
- package/dist/client/assets/{AdapterIcon-DT5OdFbe.js → AdapterIcon-LFpWySMg.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-C6jxF55P.js → AdapterSetupWizard-D9V6g6ha.js} +1 -1
- package/dist/client/assets/{AgentOptionRow-CtdBmX9G.js → AgentOptionRow-nGR6PdC6.js} +1 -1
- package/dist/client/assets/{AgentPicker--wr93sVO.js → AgentPicker-BhsmtQgu.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-DVoE2cnk.js → AgentRequestCard-DBVuClMO.js} +1 -1
- package/dist/client/assets/{AppearancePage-DR_g6BJO.js → AppearancePage-DoDVD6OA.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-BqaoB6AS.js → ApplyToOverridesDialog-56HrIRuZ.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-CM0TrrbJ.js → AttentionSignalRow-x8vRACw-.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-DJ54CELa.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-Bxeb6ihh.js} +1 -1
- package/dist/client/assets/{BindingDialog-JAPULq7H.js → BindingDialog-D6HqDfnK.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-B3-FjszN.js → BlintzCanvas-DFsdE-hF.js} +3 -3
- package/dist/client/assets/{CanvasCsvContent-Cmqry1BS.js → CanvasCsvContent-BsRV_kUK.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-BMkxUF1r.js → CanvasFileContent-BzGYGFSi.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-DBhuNbFD.js → CanvasModel3dContent-dA90prow.js} +2 -2
- package/dist/client/assets/{ChannelComposer-WR3_Vvta.js → ChannelComposer-MROo35vI.js} +3 -3
- package/dist/client/assets/{ChatAppsOff-CY5_0lQH.js → ChatAppsOff-4xIVwDUJ.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-_EI44zW6.js → CodeMirrorDiff-Cexj7RYA.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-x1lTuDQH.js → CodeMirrorEditor-D1-q0hSM.js} +1 -1
- package/dist/client/assets/{CommitmentList-D-CvccnF.js → CommitmentList-Bn7E15MO.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-CLw1FRLv.js → CommitmentsPage-Ch-y0wr0.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-QJnXivV4.js → ComputerResourceView-Bbqh7e8R.js} +1 -1
- package/dist/client/assets/{ComputerViewer-DbTGz3OL.js → ComputerViewer-XqZtg4O4.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-CB5UY0f0.js → ConnectionAccessLists-D324Hahi.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-SpEJxCeF.js → ConnectionsPage-5nIQrmtW.js} +1 -1
- package/dist/client/assets/{ConventionPage-C2NIZjG3.js → ConventionPage-PFy9ASYy.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-Drr5uceG.js → ExtensionPageRoute-ClLEO5sJ.js} +1 -1
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-kKteNmsx.js → FloatingTanStackRouterDevtools-CqogiFob-D007PSSL.js} +1 -1
- package/dist/client/assets/HandlePage-DW4b2avU.js +1 -0
- package/dist/client/assets/{HeartbeatPage-BLGTx_57.js → HeartbeatPage-IqTdsHR6.js} +1 -1
- package/dist/client/assets/{KeyEntry-DgN8iewR.js → KeyEntry-ZYnZcVmM.js} +1 -1
- package/dist/client/assets/{LexicalField-Bfj72GvX.js → LexicalField-PdcZjVov.js} +1 -1
- package/dist/client/assets/{ManagesPage-C3G1-Mep.js → ManagesPage-doVOC8Dk.js} +1 -1
- package/dist/client/assets/{Marketplace-Dg0bIo7_.js → Marketplace-B9X8IIWI.js} +1 -1
- package/dist/client/assets/{MarketplaceSourcesView-KPw8YYXi.js → MarketplaceSourcesView-BZCnUvqP.js} +1 -1
- package/dist/client/assets/{McpAppFrame-DjJ4EM39.js → McpAppFrame-BXdeDoQB.js} +1 -1
- package/dist/client/assets/{McpSigninBody-V6RSsDqe.js → McpSigninBody-CI-gwQuU.js} +1 -1
- package/dist/client/assets/{Model3dViewer-woNPO5OC.js → Model3dViewer-ws_p2e-Q.js} +1 -1
- package/dist/client/assets/NamePage-Cv95tb4E.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-CmCOFmXQ.js → NewDirectMessageMenu-PuW-lVGF.js} +1 -1
- package/dist/client/assets/{NotificationsPage-kUtiVsFS.js → NotificationsPage-D_qHMJYR.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-r6HJBjR6.js → OpenMeshSwitch-DiuAcyMj.js} +1 -1
- package/dist/client/assets/{OperatorIdentityForm-B29T-N9x.js → OperatorIdentityForm-DBbsUGPX.js} +1 -1
- package/dist/client/assets/{PermissionHistory-CV8cFJr3.js → PermissionHistory-DNBswqms.js} +1 -1
- package/dist/client/assets/{PermissionsPage-_PKlbWde.js → PermissionsPage-D6cAIUTe.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BOXTCA6E.js → PersonalityPopover-d_PR1nuF.js} +1 -1
- package/dist/client/assets/PhotoPage-D8f25EFY.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-CdHja8fU.js → PreviewRefusedNotice-p-KIYJVf.js} +1 -1
- package/dist/client/assets/{ProfileFields-C48alR3i.js → ProfileFields-D_e9XQav.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-BpJVbdUL.js → ProfilePanelContainer-DxSkglaS.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-DtuSZNaw.js → ProfileRolePicker-kNJMfzUF.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-DT-JdGeO.js → PromptSuggestionChips-Dpie7Ut6.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-BP2nxz2E.js → ReportsToPopover-kZWnpINs.js} +1 -1
- package/dist/client/assets/{RoomSurface-C_mTmn8g.js → RoomSurface-DyubmENi.js} +1 -1
- package/dist/client/assets/{RoomsPage-gDIy73MQ.js → RoomsPage-B88d-F2r.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-DhXG88Uj.js → RunsOnPopover-C51USCpv.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-DJMtgkZF.js +1 -0
- package/dist/client/assets/{RuntimeSetupDialog-BSb5iK2A.js → RuntimeSetupDialog-DQss2qqJ.js} +1 -1
- package/dist/client/assets/SeenDevices-DQnrqn19.js +19 -0
- package/dist/client/assets/{SessionsPage-C6nmCWVM.js → SessionsPage-BxT6HETG.js} +1 -1
- package/dist/client/assets/SettingsDialog-BriAKBHz.js +12 -0
- package/dist/client/assets/{SkillsPage-DSIKEsHr.js → SkillsPage-QfxMaHeF.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-Cst7UxoY.js → TaskDialogWrapper-D54Nqlkr.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-DityFi7P.js → TasksEmptyState-rCcan38Y.js} +1 -1
- package/dist/client/assets/{TasksPage-BZx_Ku0k.js → TasksPage-rIqxyB15.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-uj1GcPP_.js → TeamComputerEntry-BtSsE94x.js} +1 -1
- package/dist/client/assets/{ToolsPage-Qm6x37SO.js → ToolsPage-CfM2Cdtm.js} +1 -1
- package/dist/client/assets/{TopologyGraph-2C3Ij6tO.js → TopologyGraph-BMvLKLwd.js} +1 -1
- package/dist/client/assets/{TourHost-BsV8lcXT.js → TourHost-XxcgkZcj.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-ClNn0nv6.js → UnlinkDialog-D1tIChdU.js} +1 -1
- package/dist/client/assets/{UnreadDivider-CGKnJcx7.js → UnreadDivider-mAlJ1Ci7.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-oq5MKUX_.js → WidgetErrorCard-DQWpqcbG.js} +3 -3
- package/dist/client/assets/{WorkView-wVnGvWAz.js → WorkView-D1V2vzFd.js} +15 -15
- package/dist/client/assets/{_shell-D4V8GQqV.js → _shell-C5LhHVEU.js} +22 -22
- package/dist/client/assets/{_shell._home-DoaHLKk8.js → _shell._home-BhaXi3EI.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BP1byb8g.js → _shell._home.activity-Bd8jIlgC.js} +1 -1
- package/dist/client/assets/{_shell._home.index-BB5pgiqt.js → _shell._home.index-zoh1Ij4R.js} +2 -2
- package/dist/client/assets/{_shell._home.tasks-B3w6mqyb.js → _shell._home.tasks-CnfbD4z-.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-BcOiklL5.js → _shell._home.workspaces-Cew8PET2.js} +1 -1
- package/dist/client/assets/{_shell.channels-DxSDnd-3.js → _shell.channels-efUOy5uH.js} +1 -1
- package/dist/client/assets/{_shell.connections-YKOm7ap5.js → _shell.connections-DS8BI_M6.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-DC2Jw1EF.js → _shell.feedback-requests-C9nwY8FH.js} +1 -1
- package/dist/client/assets/_shell.marketplace-BxOR_qkR.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-BdVMq5Gt.js +1 -0
- package/dist/client/assets/_shell.session-DxIjWGPk.js +1 -0
- package/dist/client/assets/{_shell.team-C9QJNwaK.js → _shell.team-DejtvgcD.js} +3 -3
- package/dist/client/assets/{_shell.threads-gs_o48eZ.js → _shell.threads-BiIjml5t.js} +1 -1
- package/dist/client/assets/_shell.x._extensionId-VrXvDnpj.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-VrXvDnpj.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-sjxf16g2.js → abnfDiagram-WEYOIA3C-CAQusbaN.js} +1 -1
- package/dist/client/assets/{access-copy-_81ChCG3.js → access-copy-DzgVmhna.js} +1 -1
- package/dist/client/assets/{arc-B-c5OGeX.js → arc-Dx6GrexJ.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-CExq4B1X.js → architectureDiagram-ZHVYKT53-wFr3hleP.js} +1 -1
- package/dist/client/assets/{banner-BhzLIs7u.js → banner-C0yzCrO7.js} +1 -1
- package/dist/client/assets/{blockDiagram-RJAE7QA3-C1D5MR7Z.js → blockDiagram-RJAE7QA3-CnuvSqM0.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DMtF_wcg.js → c4Diagram-XDPPPE54-DzLijAHt.js} +1 -1
- package/dist/client/assets/{card-Dsy8PPN6.js → card-ZF4yWM1Y.js} +1 -1
- package/dist/client/assets/channel-BhigWC_Q.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-DCmxZwyD.js → chunk-2E7WHVMD-SN1xBBT1.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-BXvjhtJ3.js → chunk-2Q5K7J3B-DbW-InNL.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-CR6qWjas.js → chunk-4EMNKR2T-DxMZsEVE.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-Bny7RY06.js → chunk-55XCU76K-9dknyxgR.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-B9aD4Uib.js → chunk-5VM5RSS4-CeL_dp1K.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-D28Xa5gr.js → chunk-JWPE2WC7-H-uQEL4m.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-CLgnUSgl.js → chunk-VQ5W62QI-YZCtp46Q.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-vMTRVR5A.js → chunk-XXDRQBXY-CTsuviQ9.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-Ck0VFEtd.js → chunk-ZCHMQSOR-Dymmj4ca.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-Dh4gPh4M.js → classDiagram-v2-4MYWR3UA-AZrXuO6n.js} +1 -1
- package/dist/client/assets/{command-CxjTPW0z.js → command-D2uvj-5S.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-BA-tF0x7.js → cose-bilkent-JH36ORCC-DH6uyH8n.js} +1 -1
- package/dist/client/assets/{cpu-SRODWAA1.js → cpu-CxkuIIZ9.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-B_kxrTf4.js → cynefin-EF2NZ3EQ-CPF1WTGP.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-Be0brpVq.js → cynefinDiagram-WF24UDRP-BvgLB9D2.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-zI9I0fUC.js → dagre-NK4GIZVX-Dbgki4TG.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-jN0pUEKR.js → diagram-CBK3MWTC-C84DYVUU.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-BjRZmmQf.js → diagram-I5XIIV2D-DKFohwHa.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-BtnkiX3a.js → diagram-ODIL2UCW-C80JpCDz.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-Bteh9wpL.js → diagram-PFBEJUXE-I7bZPRJw.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-hRmqKbOC.js → diagram-RJA3I4VV-Gqdnf6A3.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-NKdthGes.js → diagram-TYUNFSNR-CCzmXB0d.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-CpkD13ID.js → ebnfDiagram-V4P3TTPT-DWKMGbp5.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-Dw4bdkn4.js → elk-QONTBCTQ-BH9-VsJv.js} +1 -1
- package/dist/client/assets/{empty-state-Xw8KQdod.js → empty-state-CQVHyP7G.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-fiThyiH_.js → erDiagram-KYQIGQAA-Dw7o0PKQ.js} +1 -1
- package/dist/client/assets/{execution-config-ryHuiBdx.js → execution-config-B0Ip8o1B.js} +1 -1
- package/dist/client/assets/{file-CbZILJJL.js → file-aWVIKIhu.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-rCHuN_aY.js → file-exclamation-point-VqrEIkK2.js} +1 -1
- package/dist/client/assets/{file-text-DGtefNvG.js → file-text-BcDT6eqO.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-DJDfJAaN.js → find-latest-widget-fence-BBx2mbzG.js} +1 -1
- package/dist/client/assets/{flowDiagram-IUGLLWBU-ORyRd0wW.js → flowDiagram-IUGLLWBU-DUap_2VM.js} +1 -1
- package/dist/client/assets/{form-USBlP2n_.js → form-Bq-P02ub.js} +1 -1
- package/dist/client/assets/{format-cron-u8efK62G.js → format-cron-CoTCXmQp.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-BC-M9_Wi.js → ganttDiagram-R7GPNTJY-GAxFxszj.js} +1 -1
- package/dist/client/assets/{git-branch-jQqbJAvp.js → git-branch-Cvc-Sr6q.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-NIdjLN38.js → gitGraphDiagram-PDYL7XHY-CNXDdCW9.js} +1 -1
- package/dist/client/assets/{graph-CBIOKOiw.js → graph-CtCYTWZj.js} +1 -1
- package/dist/client/assets/{heart-CSbB9K4Q.js → heart-yvX6jsem.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-OC8sqXXy.js → highlighted-body-KPVGNVTW-B6iFwydl.js} +1 -1
- package/dist/client/assets/{image-lightbox-DgWS2xlv.js → image-lightbox-COo7DKXH.js} +1 -1
- package/dist/client/assets/{image-off-DziiNcIl.js → image-off-BPRcQBvJ.js} +1 -1
- package/dist/client/assets/{index-CP7hD01s.js → index-7EayMDlv.js} +1 -1
- package/dist/client/assets/{index-CCohVfmo.js → index-B1UgkD5d.js} +1 -1
- package/dist/client/assets/{index-jJbbnV9q.js → index-B36G1Wt7.js} +3 -3
- package/dist/client/assets/{index-DJlq_kd_.js → index-B7M2ny5y.js} +1 -1
- package/dist/client/assets/{index-B5eM1_q1.js → index-B8YnzTmr.js} +1 -1
- package/dist/client/assets/{index-BU_bmsP2.js → index-BI7mYC3q.js} +1 -1
- package/dist/client/assets/{index-DgnJZ7RZ.js → index-BIoO-kFF.js} +1 -1
- package/dist/client/assets/{index-BAaqQW-m.js → index-BJKRrppi.js} +1 -1
- package/dist/client/assets/{index-CWhDGAYM.js → index-BSGg8ud2.js} +1 -1
- package/dist/client/assets/{index-DSYz85aL.js → index-BSNB2iOV.js} +9 -9
- package/dist/client/assets/{index-B9utW3HE.js → index-Bcv5Znqx.js} +1 -1
- package/dist/client/assets/{index-CiAb-mD4.js → index-BsmQ2VMC.js} +1 -1
- package/dist/client/assets/{index-DkcRrH0O.js → index-BzlepYwD.js} +1 -1
- package/dist/client/assets/{index-CRTzTiNF.js → index-CCo77KAN.js} +1 -1
- package/dist/client/assets/{index-CeJVF9AD.js → index-CIIAns2d.js} +1 -1
- package/dist/client/assets/{index-DYF1ER90.js → index-CNlIRtiQ.js} +3 -3
- package/dist/client/assets/{index-n6f9pLtt.js → index-COenrxg6.js} +1 -1
- package/dist/client/assets/{index-fAHI5hei.js → index-CXCoNv1T.js} +1 -1
- package/dist/client/assets/{index-DfYJ-zxk.js → index-CYPbNdgY.js} +1 -1
- package/dist/client/assets/{index-Bz9CgPjs.js → index-CYl4FhO7.js} +1 -1
- package/dist/client/assets/{index-DJyLZL6w.js → index-CZA2uFZQ.js} +1 -1
- package/dist/client/assets/{index-BGGnQdij.js → index-CaOL5rt9.js} +1 -1
- package/dist/client/assets/{index-YtJ82pkp.js → index-Cbu89CsC.js} +1 -1
- package/dist/client/assets/{index-BYxDsLTQ.js → index-Cdzlu1-P.js} +1 -1
- package/dist/client/assets/{index-CuT_aCM-.js → index-D1e3aPAe.js} +2 -2
- package/dist/client/assets/{index-CRPh-508.js → index-D9pvn-mm.js} +1 -1
- package/dist/client/assets/{index-C49AWTah.js → index-DRao3lV4.js} +1 -1
- package/dist/client/assets/{index-Dk33a8Wz.js → index-DefXQdQA.js} +1 -1
- package/dist/client/assets/{index-BOaou3k5.js → index-Dqq2lV9x.js} +1 -1
- package/dist/client/assets/{index-B-KhOLHd.js → index-Drg391kA.js} +1 -1
- package/dist/client/assets/{index-DnyoNFRt.js → index-DuEmhl4K.js} +1 -1
- package/dist/client/assets/{index-LFeqJL-v.js → index-FCztjyrm.js} +1 -1
- package/dist/client/assets/{index-DeDh_2c1.js → index-GEDh_fwN.js} +1 -1
- package/dist/client/assets/{index-C5gtuueN.js → index-KLtoKDvx.js} +1 -1
- package/dist/client/assets/{index-C9UgTEuh.js → index-N3JAoXse.js} +1 -1
- package/dist/client/assets/{index-RXFhiamo.js → index-NbnKjhyZ.js} +1 -1
- package/dist/client/assets/index-ZRwRzKll.js +1 -0
- package/dist/client/assets/index-bgXdb4vP.js +1 -0
- package/dist/client/assets/{index-w4wyJU8q.js → index-io81RE8o.js} +1 -1
- package/dist/client/assets/{index-Yr72qWri.js → index-p7yYM6Iz.js} +1 -1
- package/dist/client/assets/{index-CDslENFz.js → index-sTYFlBEJ.js} +1 -1
- package/dist/client/assets/{index-D9Ej8fsx.js → index-thNMHUmT.js} +1 -1
- package/dist/client/assets/{index-BN02EVKP.js → index-vWi6pOlY.js} +1 -1
- package/dist/client/assets/{index-j5szQcqb.js → index-xKvoBO92.js} +1 -1
- package/dist/client/assets/{index.esm-Dyd3JXuK.js → index.esm-BYS3OpKb.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-CPcm-36U.js → infoDiagram-MVDRKAX5-BB5v9AOj.js} +1 -1
- package/dist/client/assets/{inline-code-BjkmgK0M.js → inline-code-Df1J1tQV.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-B8eVNEDQ.js → ishikawaDiagram-HPEHV2GE-D8Zw0Wka.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-CGkIGaMV.js → journeyDiagram-BOSHW7O7-CIaVEmcq.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-BTDbT6UJ.js → kanban-definition-FNSA4HC5-D0jxBQB1.js} +1 -1
- package/dist/client/assets/{layers-DyShcAgn.js → layers-Byywl2sz.js} +1 -1
- package/dist/client/assets/{lightbulb-QljDqLq7.js → lightbulb-Cu6PlV7n.js} +1 -1
- package/dist/client/assets/{link-2-7SoeCkEs.js → link-2-D2LX2bAn.js} +1 -1
- package/dist/client/assets/{list-runtime-types-DvfLx6v2.js → list-runtime-types-C4Ik3n5A.js} +1 -1
- package/dist/client/assets/{markdown-content-D7t62wwm.js → markdown-content-BbH7L0YO.js} +1 -1
- package/dist/client/assets/{mention-pill-DNQ2ICCW.js → mention-pill-DxRP9Bkp.js} +1 -1
- package/dist/client/assets/{mermaid.core-NAyHAvFm.js → mermaid.core-D9Vc69mt.js} +4 -4
- package/dist/client/assets/{message-square-off-D6K1M95g.js → message-square-off-BP01X_ck.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-26dEepZx.js → mindmap-definition-6OY57UG3-DNd2V0AH.js} +1 -1
- package/dist/client/assets/{more-details-BJ_2FYn8.js → more-details-7psgoF8x.js} +1 -1
- package/dist/client/assets/{owner-notice-CIfb2Yr7.js → owner-notice-83ejBJ3g.js} +1 -1
- package/dist/client/assets/{package-CeRLwc1u.js → package-DSJyi_sq.js} +1 -1
- package/dist/client/assets/{page-container-D2J6eon9.js → page-container-D7q7ISl1.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-CXxva43c.js → pane-resize-handle-BnQ8IKj6.js} +1 -1
- package/dist/client/assets/{paperclip-DFuuQSWM.js → paperclip-CeOJ8Nwp.js} +1 -1
- package/dist/client/assets/{path-input-DhGxbEsh.js → path-input-BToXn1c2.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-BJu6g9eg.js → pegDiagram-ECIUJNBX-sCkH1RIT.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-CMf8TQF7.js → pieDiagram-GNMPY74T-B4V9xf2z.js} +1 -1
- package/dist/client/assets/{plug-Bqwk5g66.js → plug-CMcqk2p3.js} +1 -1
- package/dist/client/assets/{primer-trigger-NAz78FSN.js → primer-trigger-DtyY4fpx.js} +1 -1
- package/dist/client/assets/{profile-errors--0_JG2R0.js → profile-errors-DSKechEz.js} +1 -1
- package/dist/client/assets/{progress-cQRXQehb.js → progress-8CDPI0xL.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-Bb92PcA9.js → quadrantDiagram-D57K4MC3-DkcmqAD-.js} +1 -1
- package/dist/client/assets/{query-error-state-C2QLFCgp.js → query-error-state-jrioxcrf.js} +1 -1
- package/dist/client/assets/{radio-CBD2fSSB.js → radio-D3k0l1vj.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-YN2siyto.js → railroadDiagram-Y72NRBL7-T9Qbdks1.js} +1 -1
- package/dist/client/assets/registry-B0s0gwF4.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-yWn__06J.js → relay-trace-schemas-epyobQGg.js} +1 -1
- package/dist/client/assets/{repeat-CtIEyxm4.js → repeat-Cbe4MVvF.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-DJBQviv-.js → requirementDiagram-EQYSW5RA-BKrsOvZR.js} +1 -1
- package/dist/client/assets/{room-files-source-nnbGMKus.js → room-files-source-wUgOb12j.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-C2jXtg-P.js → rotate-ccw-clock-CI-xhvb_.js} +1 -1
- package/dist/client/assets/{rotate-cw-34X3Kx8Z.js → rotate-cw-BGDIfrKN.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-DH2qnwVI.js → sankeyDiagram-SY24JHO5-SVj2Csf7.js} +1 -1
- package/dist/client/assets/{scroll-area-DYTbXWMY.js → scroll-area-D3x48cAw.js} +1 -1
- package/dist/client/assets/{search-x-DeFOvp_5.js → search-x-Dz-ryi0D.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-CkHcuOw2.js → sequenceDiagram-BLEHNHQU-CSliXD3t.js} +1 -1
- package/dist/client/assets/{shield-x-bloGLifl.js → shield-x-FVhBth4G.js} +1 -1
- package/dist/client/assets/{signed-in-DD2qV0PJ.js → signed-in-BQcV7AMx.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-BXK-Cxjs.js → sizeCapture-INFHLROL-4lP-N234.js} +1 -1
- package/dist/client/assets/{soul-file-DFPctfHR.js → soul-file-CS-EETV8.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DP_cqXJO.js → stateDiagram-v2-A6IESKWZ-Cij5yf9S.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-BZxkK7Fr.js → swimlanes-B3ENRKFQ-iSf_hOim.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C8oY0fep.js +8 -0
- package/dist/client/assets/{table-B8zvHC0J.js → table-Cg_1lfh0.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-BPZ64ADa.js → timeline-definition-JXYKGLGB-DVZj2yY_.js} +1 -1
- package/dist/client/assets/{trust-posture-C9r0jGhc.js → trust-posture-CkEXRlxW.js} +1 -1
- package/dist/client/assets/{unplug-DYZEcvkR.js → unplug-CASvw-Yn.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-DAhwNpy_.js → unverified-catalog-notice-CMDo7sp5.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-DrDMqxhZ.js → use-adapter-catalog-BVeUe0tR.js} +1 -1
- package/dist/client/assets/{use-bindings-Ci7hpEO4.js → use-bindings-Clux6PJ0.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-FpUdi_wE.js → use-composer-prefs-D0poHQqk.js} +1 -1
- package/dist/client/assets/{use-connector-management-CinfkPZI.js → use-connector-management-CQQGCFaL.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-DZnA4iYZ.js → use-deep-link-scroll-BdGMaupf.js} +1 -1
- package/dist/client/assets/{use-delete-binding-DDtaCc3v.js → use-delete-binding-CSpocSwM.js} +1 -1
- package/dist/client/assets/{use-dev-links-CtHwhTBj.js → use-dev-links-c6K0en5G.js} +1 -1
- package/dist/client/assets/{use-direct-message-panel-Da9rkfA3.js → use-direct-message-panel-sq9_ehHu.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-CikM-LiV.js → use-external-adapter-catalog-C3T1MGxz.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-B6TQc-xB.js → use-full-activity-feed-Bmmagy2q.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-CGj5vT8N.js +1 -0
- package/dist/client/assets/{use-local-browser-ABoWOGv1.js → use-local-browser-Di54G1yg.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-C5njB0KY.js → use-mesh-topology-C_bdAJfy.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-Bp9Wp7zY.js → use-mounted-ref-C_ChQ0xs.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-DXww4pVV.js → use-notification-prefs-BjGauolP.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-DLQeHI7w.js → use-panel-tab-placements-Bn-CIS6M.js} +1 -1
- package/dist/client/assets/use-pending-read-CIp204qI.js +1 -0
- package/dist/client/assets/{use-personality-commit-DYQ3KVxd.js → use-personality-commit-WeCQulwl.js} +1 -1
- package/dist/client/assets/{use-promo-activation-nURLgFxH.js → use-promo-activation-C9I5YwBo.js} +1 -1
- package/dist/client/assets/{use-promo-dismissals-BQkeHMCS.js → use-promo-dismissals-BhTNS7LX.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-B8VeNnHj.js → use-pulse-freshness-DDo5a3nh.js} +1 -1
- package/dist/client/assets/{use-relay-config-D0BknsXK.js → use-relay-config-Bfjxr2lE.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BruRRf3z.js → use-room-follow-claim-D_HTjK2r.js} +1 -1
- package/dist/client/assets/{use-room-sessions-DGcrmZvE.js → use-room-sessions-UwyzNxeo.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-YQ4MgIBO.js → use-roving-tab-list-CXAJxnx0.js} +1 -1
- package/dist/client/assets/{use-session-canvas-BaGypLR6.js → use-session-canvas-CTDXU27z.js} +3 -3
- package/dist/client/assets/{use-status-budget-Q1ltHI80.js → use-status-budget-CFS9gmSZ.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-Bext8Aim.js → use-unclaimed-chats-BlUFVbnm.js} +1 -1
- package/dist/client/assets/use-update-config-BwjEWlgj.js +1 -0
- package/dist/client/assets/{useMutationState-C3WVn0hu.js → useMutationState-CUuSnqrc.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Dg4P8nSr.js → usecaseDiagram-WPOLBNNX-BTdq_YOC.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-B8Txoqsz.js → vennDiagram-Q3Y3IDCW-BLQwiECh.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-lgQBspKc.js → wardleyDiagram-IVAIDKWA-Cp8QrBQm.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-Ct9-Lgo9.js → xychartDiagram-4URNHDU4-CrrAKTa0.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +2384 -2338
- package/dist/server/index.js.map +2 -2
- package/package.json +5 -5
- package/dist/client/assets/HandlePage-A1OCw0nr.js +0 -1
- package/dist/client/assets/NamePage-Du9m4rGe.js +0 -1
- package/dist/client/assets/PhotoPage-Dx-3Lhm5.js +0 -1
- package/dist/client/assets/RuntimeConnectFlow-BsZsQZS9.js +0 -1
- package/dist/client/assets/SeenDevices-dzzlSeB2.js +0 -19
- package/dist/client/assets/SettingsDialog-5aEZ-DG6.js +0 -12
- package/dist/client/assets/_shell.marketplace-BUh4boaf.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-CnOFcGv1.js +0 -1
- package/dist/client/assets/_shell.session-BUP7x_Ra.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-B-X7HuaQ.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-B-X7HuaQ.js +0 -1
- package/dist/client/assets/channel-C6IoQ0kc.js +0 -1
- package/dist/client/assets/index-BpsATTKn.js +0 -1
- package/dist/client/assets/index-CUKvspHB.js +0 -1
- package/dist/client/assets/registry-CsiY3fnM.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-DXRZtHKX.js +0 -8
- package/dist/client/assets/use-is-below-desktop-DJQVU5CF.js +0 -1
- package/dist/client/assets/use-pending-read-CgR0BnSW.js +0 -1
- package/dist/client/assets/use-update-config-BJEw2LjV.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as ie,a4 as de,a3 as Oe,iQ as _e,iR as ne,iS as me,iT as Le,iU as Fe,iV as De,aP as ze,r as s,j as t,G as ee,B as je,x as He,e as Q,gZ as Ie,hI as qe,gY as ke,iW as We,iX as $e,n as Be,h0 as X,a7 as Ke,fb as Ue,iY as Xe,iZ as Ye,i_ as Ge,cj as Qe,i$ as Ve,j0 as Ze,j1 as Je,j2 as et,cf as tt,j3 as nt,gk as G,j4 as st,l as rt,s as he,j5 as ot,j6 as at,ef as it,X as dt,dW as lt,ar as ut,j7 as ct,j8 as pe,j9 as ft,ad as mt,ja as ht,gX as pt,gW as gt,jb as xt,aI as ge,by as Rt}from"./index-DSYz85aL.js";import{P as yt,u as vt}from"./pane-resize-handle-CXxva43c.js";import{D as bt,U as wt,u as jt}from"./UnreadDivider-CGKnJcx7.js";import{u as It}from"./use-room-follow-claim-BruRRf3z.js";import{a as le,e as ue,g as kt,f as Ae,h as At,i as Ne,c as U,d as V,j as Nt,k as re,b as oe,l as ae,A as Se,m as Ce,t as ce,r as St,n as J,R as fe,u as Me,C as Te,o as Ct}from"./ChannelComposer-WR3_Vvta.js";import{u as Mt,f as Tt,a as Pt,F as Et,C as Y,d as Ot,M as _t}from"./index-DYF1ER90.js";import{u as Lt}from"./use-connector-management-CinfkPZI.js";import{A as Ft}from"./AgentRequestCard-DVoE2cnk.js";import{u as Dt}from"./use-room-sessions-DGcrmZvE.js";function zt(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.haltRoomAgent(o,r),meta:{errorLabel:"Couldn’t stop this agent"}})}function Ht(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.promoteHold(o,r),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function qt(e){const o=ie(),r=Oe(),u=_e(e),y=ne(p=>{var f;return e===null?null:((f=p.paging[e])==null?void 0:f.cursor)??null}),i=de({mutationFn:async p=>{var w;const f=(w=ne.getState().paging[p])==null?void 0:w.cursor;if(f==null)return;const v=await o.listRoomEntries(p,{before:f,limit:me}),I=ze.entries(p),k=r.getQueryData(I),A=Le(k,v);r.setQueryData(I,A),ne.getState().notePage(p,Fe(v)??f,De(v,me)||A.length===((k==null?void 0:k.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:d,isPending:j}=i,R=s.useRef(!1),x=s.useCallback(async()=>{if(!(e===null||R.current)){R.current=!0;try{await d(e).catch(()=>{})}finally{R.current=!1}}},[e,d]);return{canLoadOlder:u,isLoadingOlder:j,cursor:y,loadOlder:x}}function Wt({id:e,summary:o,open:r,onOpen:u}){const{capabilities:y}=Mt(),{count:i,lastAt:d,unread:j}=o,R=Tt(d),[x,p]=s.useState({count:i,bumped:!1});x.count!==i&&p({count:i,bumped:!0});const f=x.count===i&&x.bumped;return y.threads?t.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":j>0?"":void 0,"aria-expanded":r,onClick:u,className:ee("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","mb-1 w-fit rounded text-left text-xs transition-colors","px-2 py-2 md:px-1 md:py-0.5",j>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[t.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),t.jsx("span",{className:ee(f&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:i},i),i===1?" reply":" replies",R.length>0&&t.jsxs(t.Fragment,{children:[" · last ",t.jsx("time",{dateTime:d,title:Pt(d),children:R})]}),j>0&&` · ${j} new`]}):null}function $t({loading:e,onLoad:o}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(je,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&t.jsx(He,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}const Bt="room-load-older",Kt=4;function Pe({roomName:e}){return t.jsx(Et,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:Kt},(o,r)=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(Q,{className:"size-7 shrink-0 rounded-full"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${r}`))})}function Ut({roomId:e,roomName:o,viewerAuthorId:r,entries:u,members:y,formerAuthors:i,lastReadSeq:d,reactionFrequents:j,streamStalled:R,isLoading:x,error:p,onAddAgents:f,openThreadId:v,onOpenThread:I,resumeRow:k,landOnRow:A,onTopRow:w,canLoadOlder:S=!1,isLoadingOlder:l=!1,onLoadOlder:c,ref:C}){const N=s.useMemo(()=>le(y,i),[y,i]),P=Ie(y,r),E=ue(),T=s.useMemo(()=>new Map([...N].map(([n,m])=>[n,m.displayName])),[N]),M=qe(),L=ke(e,null),{topLevel:H,repliesByRoot:F,orphaned:D}=s.useMemo(()=>kt(u),[u]),q=s.useMemo(()=>new Map(u.map(n=>[n.id,n])),[u]),z=s.useMemo(()=>{const n=We(H,d),m=$e(H.map(a=>({id:a.id,authorId:a.body.moment?`moment:${a.id}`:a.authorId,timestamp:a.createdAt})),{now:M,lastSeenId:n.lastSeenId,unreadFromStart:n.fromStart}),b=[];S&&!x&&b.push({kind:"load-older",id:Bt});for(const a of m){if(a.kind==="day-divider"){b.push({kind:"day-divider",id:a.key,label:a.label});continue}if(a.kind==="unread-divider"){b.push({kind:"unread-divider",id:a.key});continue}const h=H[a.index];b.push({kind:"message",id:h.id,entry:h,grouping:a.grouping,position:a.index+1,answers:Ae(h,H[a.index-1],q.get.bind(q))});const g=F.get(h.id);g&&b.push({kind:"thread-reply",id:At(h.id),rootId:h.id,replies:g,totalReplies:h.threadReplyCount})}return b},[H,F,q,d,M,S,x]),W=s.useMemo(()=>z.map(n=>n.kind==="load-older"?{kind:"notice",id:n.id,at:"",body:null}:n.kind==="day-divider"?{kind:"day-divider",id:n.id,label:n.label}:n.kind==="unread-divider"?{kind:"unread-divider",id:n.id}:n.kind==="thread-reply"?{kind:"thread-reply",id:n.id,rootId:n.rootId,replyCount:Ne(n.replies.length,n.totalReplies),lastAt:n.replies[n.replies.length-1].createdAt}:{kind:"message",id:n.id,payload:n.entry,grouping:n.grouping,author:U(V(n.entry,N),N,E.faces),at:n.entry.createdAt}),[z,N,E.faces]),K=s.useCallback((n,m)=>{const b=z[m.index];if(b.kind==="load-older")return c===void 0?null:t.jsx($t,{loading:l,onLoad:c});if(b.kind==="day-divider")return t.jsx(bt,{label:b.label});if(b.kind==="unread-divider")return t.jsx(wt,{});if(b.kind==="thread-reply"){if(m.onOpenThread===void 0)return null;const h=m.onOpenThread;return t.jsx(Wt,{id:re(b.rootId),summary:Nt(b.replies,d,b.totalReplies),open:v===b.rootId,onOpen:()=>h(b.rootId)})}const a=V(b.entry,N);return t.jsx(oe,{roomId:e,entry:b.entry,author:U(a,N,E.faces),authorRef:N.get(a),authors:N,viewerAuthorId:r,authorNames:T,reactionFrequents:j,streamStalled:R,isMember:P,grouping:b.grouping,orphanedReply:D.has(b.entry.id),answers:b.answers,feedPosition:{index:b.position,total:-1},rowId:ae(b.entry.id)})},[z,e,N,E.faces,r,T,j,R,P,D,d,v,l,c]),O=s.useCallback(n=>{if(n.kind==="message")return ae(n.id);if(n.kind==="thread-reply")return re(n.rootId)},[]);if(p)return t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),t.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const $=y.some(n=>n.author.kind==="agent"),B=t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx(Be,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),t.jsx("p",{className:"max-w-sm",children:$?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(je,{type:"button",size:"sm",variant:$?"ghost":"default",onClick:f,className:"mt-1",children:$?"Add more agents":"Add agents"})]});return t.jsx(Se,{known:E,children:t.jsx(Y.Timeline,{ref:C,conversationId:e,label:`Messages in ${o}`,rows:W,renderRow:K,onOpenThread:I,domIdOf:O,...k===void 0?{}:{resumeRow:k},...A===void 0?{}:{landOnRow:A},...w===void 0?{}:{onTopRow:w},pending:L,viewerAuthorId:r,loading:x?t.jsx(Pe,{roomName:o}):void 0,empty:B,feedTestId:"room-timeline"})})}function Xt(e){const{roomId:o,entrySeq:r,entries:u,historyLoaded:y}=e,i=r===void 0?null:`${o}:${r}`,d=s.useMemo(()=>{if(r===void 0)return null;const k=u.find(l=>l.seq===r);if(k===void 0)return null;const A=Ce(u,k.id);if(A===null)return null;const w=ce(k)??null,S=w!==null&&A.rowId!==k.id;return{roomRowId:A.rowId,threadRootId:S?w:null,entryId:k.id}},[u,r]),j=s.useRef(null),R=(d==null?void 0:d.threadRootId)??null;s.useEffect(()=>{i===null||R===null||j.current!==i&&(j.current=i,X.getState().openThread(o,R))},[i,o,R]);const x=s.useRef(null);s.useEffect(()=>{i===null||!y||d===null&&x.current!==i&&(x.current=i,Ke.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[i,y,d]);const p=s.useRef(null),f=s.useCallback(()=>{if(!(i===null||p.current===i))return p.current=i,d==null?void 0:d.roomRowId},[i,d]),v=s.useRef(null),I=s.useCallback(()=>{if(!(i===null||v.current===i))return v.current=i,(d==null?void 0:d.threadRootId)===null||d==null?void 0:d.entryId},[i,d]);return{roomRow:r===void 0?void 0:f,threadRow:r===void 0?void 0:I}}function Yt(e,o){const[r,u]=s.useState({roomId:null,seq:null});return r.roomId===e?r.seq:e===null?(u({roomId:null,seq:null}),null):o===null?null:(u({roomId:e,seq:o}),o)}const Gt=600;function Qt(e){return document.getElementById(re(e))??document.getElementById(ae(e))}function Vt(){const e=s.useRef(null);return s.useEffect(()=>()=>{var r;return(r=e.current)==null?void 0:r.call(e)},[]),{arm:s.useCallback(r=>{var j;(j=e.current)==null||j.call(e);let u=0;const y=Date.now()+Gt;let i=!1;const d=()=>{if(i)return;const R=document.activeElement;if(R===null||R===document.body||!R.isConnected){const p=Qt(r);if(p!==null){p.focus();return}}Date.now()>=y||(u=requestAnimationFrame(d))};u=requestAnimationFrame(d),e.current=()=>{i=!0,cancelAnimationFrame(u)}},[])}}function Zt({roomId:e,route:o,urlThreadId:r,openThreadId:u,entries:y,historyLoaded:i}){const d=Ue(),j=s.useRef(null);s.useEffect(()=>{if(e!==null){if(j.current!==e&&(j.current=e,r!==void 0)){X.getState().openThread(e,r);return}if(i&&u!==void 0){const R=y.find(p=>p.id===u),x=R===void 0?void 0:St(R);if(x!==void 0&&x!==u){const p=X.getState().open[e];X.getState().openThread(e,x,(p==null?void 0:p.focusComposer)??!1);return}}u!==r&&(d==null||d({to:o,search:R=>({...R,thread:u}),replace:!0}))}},[e,o,u,r,y,i,d])}function Jt(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(o=>o.author.kind==="agent")}function en({room:e,hasEntries:o,onAddAgents:r}){return!o||!Jt(e)?null:t.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",t.jsx("button",{type:"button",onClick:r,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function tn({roomId:e}){const{approvals:o}=Xe(),r=Ye(o).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:t.jsx(Ge,{approvals:r})})}function nn({roomId:e}){const{data:o}=Lt("pending"),r=(o??[]).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:r.map(u=>t.jsx(Ft,{request:u},u.requestId))})}const sn="An agent",xe=64,se=3,rn=new Set;function Ee({room:e,entries:o,scope:r,laneScope:u,stalled:y,unavailable:i=!1,onRetry:d,onScrollToRow:j}){const R=Qe(),x=Ve(e.id,r),p=Ze(e.id,r),f=Je(e.id,r),[v,I]=s.useState(!1),k=Dt(e.id,{enabled:v}),A=et(),{mutate:w}=zt(),[S,l]=s.useState(rn),c=s.useCallback(a=>{l(h=>new Set(h).add(a)),w({roomId:e.id,authorId:a},{onSettled:()=>l(h=>{const g=new Set(h);return g.delete(a),g})})},[w,e.id]),C=Ht(),[N,P]=s.useState(()=>new Map),E=tt(),T=ue(),M=s.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),L=s.useCallback(a=>{var h;return((h=M.get(a))==null?void 0:h.displayName)??sn},[M]),{interactions:H}=nt(),F=s.useMemo(()=>H.filter(a=>a.roomId===e.id),[H,e.id]),D=s.useMemo(()=>{var h;const a={};for(const g of F){if(g.roomAuthorId===void 0)continue;const _=(h=M.get(g.roomAuthorId))==null?void 0:h.displayName;_!==void 0&&(a[g.sessionId]=_)}return a},[F,M]),q=s.useMemo(()=>x.map(a=>({authorId:a.authorId,name:L(a.authorId),state:a.state,since:a.since,activity:a.activity??null})),[x,L]),z=s.useMemo(()=>p.map(a=>{var g;const h=(g=E.data)==null?void 0:g.find(_=>_.id===a.behindRoomId);return{authorId:a.authorId,name:L(a.authorId),since:a.since,behind:{roomId:a.behindRoomId,title:h===void 0?null:G(h)},othersWaiting:a.othersWaiting,severalInTheWay:a.severalInTheWay}}),[p,L,E.data]),W=s.useMemo(()=>{const a=new Set;for(const h of p)N.get(h.authorId)===h.entryId&&a.add(h.authorId);return a},[p,N]),K=s.useMemo(()=>f===null?null:{authorId:f.authorId,name:L(f.authorId)},[f,L]),O=s.useMemo(()=>Ot({capabilities:fe,asks:F,agentNames:D,stalled:y,presence:q,held:z,silentFinish:K,turn:null}),[F,D,q,z,K,y]),$=s.useMemo(()=>{var h;const a=new Map;for(const g of((h=k.data)==null?void 0:h.bindings)??[])a.set(g.authorId,g.sessionId);return a},[k.data]),B=s.useCallback(a=>{const h=o.find(_=>_.id===a);if(h===void 0)return null;const g=h.body.text.replace(/\s+/gu," ").trim();return g.length===0?null:g.length>xe?`${g.slice(0,xe).trimEnd()}…`:g},[o]),n=s.useCallback(a=>{var h;return u==="thread"?J(a):((h=Ce(o,a))==null?void 0:h.domId)??null},[o,u]),m=s.useMemo(()=>{const a=x.map(g=>{const _=B(g.entryId),Z=n(g.entryId);return{authorId:g.authorId,author:U(g.authorId,M,T.faces),state:g.state,since:g.since,doing:st(g.activity),replyingTo:_===null||Z===null?null:{entryId:g.entryId,excerpt:_,rowId:Z},sessionId:$.get(g.authorId)??null}}),h=z.map(g=>({authorId:g.authorId,author:U(g.authorId,M,T.faces),state:"held",since:g.since,doing:null,replyingTo:null,sessionId:null,behind:g.behind,othersWaiting:g.othersWaiting}));return[...a,...h]},[x,z,M,T.faces,B,n,$]),b=s.useMemo(()=>{if(x.length===0)return null;const a=x.slice(0,se);return t.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[a.map(h=>t.jsx(_t,{author:U(h.authorId,M,T.faces),className:"ring-background size-4 ring-2"},h.authorId)),x.length>se&&t.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${x.length-se}`})]})},[x,M,T.faces]);return t.jsx(Y.LiveLane,{state:O,scope:u,onRetry:d,unavailable:i,faces:b,onPeekOpenChange:I,askCard:O.kind==="ask"?t.jsx(ot,{ask:O.ask,...D[O.ask.sessionId]?{agentName:D[O.ask.sessionId]}:{},onOpenSession:a=>{R(he({session:a}))},className:"border-l-0"}):void 0,peek:t.jsx(Y.LivePeek,{rows:m,onScrollToRow:j,onOpenSession:a=>{R(he({session:a}))},onOpenRoom:a=>{R({...rt.channels(),search:{id:a}})},onAnswerFirst:a=>{const h=p.find(g=>g.authorId===a);h!==void 0&&P(g=>new Map(g).set(a,h.entryId)),C.mutate({roomId:e.id,authorId:a})},promoted:W,onStopAll:()=>A.mutate({roomId:e.id}),stopping:A.isPending,onStopAgent:c,stoppingAgents:S})})}const Re=3e3;function on(e,o,r,u=Date.now){const y=s.useRef(null),i=s.useRef(new Map),d=s.useRef(new Map),j=y.current,R=i.current,x=d.current,p=u();for(const f of e){if(x.has(f.id))continue;if(j===null){x.set(f.id,"at-rest");continue}const v=R.get(f.authorId);x.set(f.id,v!==void 0&&p-v<Re?"handed-off":"dropped")}return s.useEffect(()=>{if(!r)return;y.current=new Set(e.map(v=>v.id));const f=u();for(const v of o)i.current.set(v,f);for(const[v,I]of i.current)f-I>Re&&i.current.delete(v);for(const v of d.current.keys())y.current.has(v)||d.current.delete(v)}),x}function an({kind:e}){return e==="thread-error"?t.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),t.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?t.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-sm"})]}):t.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function dn({room:e,rootEntryId:o,focusComposer:r,entries:u,reactionFrequents:y,streamStalled:i,streamUnavailable:d,onRetryStream:j,historyLoaded:R,historyFailed:x=!1,landOnRow:p,pushed:f,onClose:v}){const I=s.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),k=Me({room:e,threadRootId:o}),A=Ie(e.members,e.viewerAuthorId),w=ue(),S=s.useMemo(()=>new Map([...I].map(([n,m])=>[n,m.displayName])),[I]),{root:l,replies:c}=s.useMemo(()=>{let n;const m=[];for(const b of u)b.id===o?n=b:ce(b)===o&&m.push(b);return{root:n,replies:m}},[u,o]),C=l==null?void 0:l.threadReplyCount,N=C!==void 0&&C>c.length,P=!f,E=l===void 0||N?-1:(P?1:0)+c.length,T=Ne(c.length,C),M=s.useMemo(()=>new Set(c.map(n=>n.id)),[c]),L=s.useMemo(()=>({replyIds:M,inside:!0}),[M]),H=at(e.id,L),F=ke(e.id,o),D=on(c,H,R),q=s.useRef(null),z=s.useCallback(n=>{var m;(m=q.current)==null||m.scrollToRow(n)},[]),W=s.useRef(null);s.useEffect(()=>{var n;r||(n=W.current)==null||n.focus()},[o,r]);const K=n=>{n.key!=="Escape"||n.defaultPrevented||(n.stopPropagation(),v())},O=s.useMemo(()=>{const n=[];if(l===void 0){const m=x?"thread-error":R?"thread-orphan":"thread-waiting";n.push({kind:"notice",id:m,at:"",body:null})}else P&&n.push({kind:"message",id:l.id,payload:l,grouping:{position:"only"},author:U(V(l,I),I,w.faces),at:l.createdAt});for(const m of c)n.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:U(V(m,I),I,w.faces),at:m.createdAt});return n},[l,P,c,I,w.faces,x,R]),$=s.useCallback(n=>{if(n.kind==="notice")return t.jsx(an,{kind:n.id});if(n.kind!=="message")return null;const m=n.payload,b=l!==void 0&&m.id===l.id,a=c.findIndex(_=>_.id===m.id),h=t.jsx(oe,{roomId:e.id,entry:m,rowId:J(m.id),author:n.author,authorRef:I.get(m.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:y,streamStalled:i,isMember:A,grouping:{position:"only"},answers:Ae(m,a<=0?l:c[a-1],_=>(l==null?void 0:l.id)===_?l:c.find(Z=>Z.id===_)),feedPosition:{index:b?1:(l===void 0||!P?0:1)+a+1,total:E}});if(b)return t.jsxs(t.Fragment,{children:[h,t.jsx(ye,{count:T})]});const g=D.get(m.id)??"at-rest";return t.jsx("div",{className:ee(g==="dropped"&&"motion-safe:animate-thread-reply-in",g==="handed-off"&&"motion-safe:animate-reply-settle"),children:h})},[l,P,c,T,D,e.id,e.viewerAuthorId,I,S,y,i,A,E]),B=s.useCallback(n=>n.kind==="message"?J(n.id):void 0,[]);return t.jsx(Se,{known:w,children:t.jsx(Y.Root,{surface:"room",capabilities:fe,target:k.target,anchor:"rail",children:t.jsxs("section",{ref:W,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:K,className:ee("bg-card flex min-h-0 flex-col outline-none",f?"h-full w-full":"w-full border-l"),children:[f?t.jsxs("header",{className:"flex items-center gap-2 border-b px-1 py-1",children:[t.jsxs("button",{type:"button",onClick:v,"aria-label":`Back to ${G(e)}`,"data-testid":"room-thread-back",className:"focus-ring text-muted-foreground hover:text-foreground flex h-11 min-w-0 items-center gap-1 rounded px-2 text-sm",children:[t.jsx(it,{"aria-hidden":!0,className:"size-4 shrink-0"}),t.jsx("span",{className:"truncate",children:G(e)})]}),t.jsx("p",{className:"ml-auto shrink-0 pr-3 text-sm font-medium",children:"Thread"})]}):t.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[t.jsx("button",{type:"button",onClick:v,"aria-label":"Close thread",className:"focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1",children:t.jsx(dt,{"aria-hidden":!0,className:"size-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium",children:"Thread"}),t.jsx("p",{className:"text-muted-foreground truncate text-xs",children:G(e)})]})]}),f&&l!==void 0&&t.jsxs("div",{"data-testid":"room-thread-pinned-root",className:"max-h-[40%] shrink-0 overflow-y-auto border-b pt-2",children:[t.jsx(oe,{roomId:e.id,entry:l,rowId:J(l.id),author:U(V(l,I),I,w.faces),authorRef:I.get(l.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:y,streamStalled:i,isMember:A,grouping:{position:"only"}}),t.jsx(ye,{count:T})]}),t.jsx(Y.Timeline,{ref:q,conversationId:`thread-${o}`,label:`Thread in ${G(e)}`,busy:!R&&!x,rows:O,renderRow:$,domIdOf:B,...p===void 0?{}:{landOnRow:p},pending:F,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),t.jsx(Ee,{room:e,entries:u,scope:L,laneScope:"thread",stalled:f&&i===!0,unavailable:d,onRetry:f?j:void 0,onScrollToRow:z}),t.jsx(Te,{room:e,threadRootId:o,attachments:k.attachments,focusOnMount:r},o)]})})})}function ye({count:e}){return e===0?null:t.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[t.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:e===1?"1 reply":`${e} replies`}),t.jsx("span",{className:"bg-border h-px flex-1"})]})}const ln=96,un=500;function cn(e){return e.offset.x>ln||e.velocity.x>un}function fn({children:e,onClose:o}){const r=lt()===!0,u=r?{x:0}:{x:"100%"};return t.jsx(ut.div,{"data-testid":"room-thread-sheet",className:"bg-card absolute inset-0 z-10 flex flex-col shadow-xl",initial:u,animate:{x:0},exit:u,transition:r?{duration:0}:{duration:.22,ease:[.32,.72,0,1]},drag:"x",dragDirectionLock:!0,dragConstraints:{left:0,right:0},dragElastic:{left:0,right:.9},dragMomentum:!1,onDragEnd:(y,i)=>{cn(i)&&o()},children:e})}const te="room-thread-split",mn=320,hn=360,pn=40,gn=50,xn=25;function ve(e,o){return o<=0?xn:Math.min(Math.round(e/o*1e3)/10,gn)}function Rn(e){const o=ve(mn,e),r=Math.round((100-ve(hn,e))*10)/10;return{minPct:o,maxPct:r,defaultPct:Math.min(Math.max(pn,o),r)}}function yn(e,o,r){if(e===null||o===null||o<=0)return r.defaultPct;const u=e/o*100;return Math.round(Math.min(Math.max(u,r.minPct),r.maxPct)*10)/10}function vn(e){try{const o=localStorage.getItem(e),r=o===null?NaN:Number(o);return Number.isFinite(r)&&r>0?r:null}catch{return null}}function bn(e,o){try{localStorage.setItem(e,String(Math.round(o)))}catch{}}const wn="react-resizable-panels:room-thread-split";function jn(){try{localStorage.removeItem(wn)}catch{}}function In(){const[e,o]=s.useState(null),[r,u]=s.useState(null);return{ref:s.useCallback(i=>{if(i===null)return;o(i);const d=()=>u(i.offsetWidth);d();const j=new ResizeObserver(d);return j.observe(i),()=>{j.disconnect(),o(null),u(null)}},[]),element:e,width:r,sizing:Rn(r??0)}}const kn=`${te}-room`,be=`${te}-thread`,we=`${te}-handle`,An=4;function Nn({room:e,thread:o,storageKey:r=ft.ROOM_THREAD_WIDTH}){const{ref:u,element:y,width:i,sizing:d}=In(),[j,R]=s.useState(()=>vn(r)),[x,p]=s.useState(null),f=s.useRef(null),v=yn(j,i,d),I=i===null||(d.maxPct-d.minPct)/100*i<An,k=o!==!1;s.useEffect(jn,[]);const A=s.useRef(!1);s.useLayoutEffect(()=>{var c;A.current&&((c=f.current)==null||c.resize(v))},[v,k]);const w=s.useRef(null),S=()=>{var P;const c=(P=f.current)==null?void 0:P.getSize(),C=w.current;if(w.current=null,c===void 0||i===null||i<=0||C===c)return;const N=Math.round(c/100*i);R(N),bn(r,N)},l=x??v;return s.useLayoutEffect(()=>{const c=y==null?void 0:y.querySelector(`[data-panel-resize-handle-id="${we}"]`);c&&(c.setAttribute("aria-controls",be),c.setAttribute("aria-valuenow",String(Math.round(l))),c.setAttribute("aria-valuemin",String(Math.round(d.minPct))),c.setAttribute("aria-valuemax",String(Math.round(d.maxPct))))}),t.jsx("div",{ref:u,className:"h-full overflow-hidden",children:t.jsxs(ct,{direction:"horizontal",id:te,onLayout:c=>{A.current=c.length>1,p(A.current?c[1]:null)},children:[t.jsx(pe,{id:kn,order:1,className:"flex",children:e}),k&&t.jsxs(t.Fragment,{children:[t.jsx(yt,{id:we,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:I,onDragging:c=>{var C;c&&(w.current=((C=f.current)==null?void 0:C.getSize())??null)},onKeyDownCapture:c=>{var C,N;I||(w.current=((C=f.current)==null?void 0:C.getSize())??null,!(c.key!=="Home"&&c.key!=="End")&&(c.preventDefault(),(N=f.current)==null||N.resize(c.key==="Home"?d.minPct:d.maxPct)))},onResizeEnd:S}),t.jsx(pe,{ref:f,id:be,order:2,defaultSize:v,minSize:d.minPct,maxSize:d.maxPct,className:"flex",children:o})]})]})})}function Fn({roomId:e,threadId:o,entrySeq:r,threadRoute:u,aboveTimeline:y,aboveComposer:i,offerJumpBackIn:d,onComposerFocusChange:j}){const R=mt(),x=vt(),p=ht(e),f=p==null?void 0:p.rootEntryId,v=Vt(),I=s.useCallback(()=>{var m;const n=(m=X.getState().open[e])==null?void 0:m.rootEntryId;X.getState().closeThread(e),n!==void 0&&v.arm(n)},[e,v]),k=s.useCallback(n=>{X.getState().openThread(e,n)},[e]),A=pt(e),w=gt(e),S=jt(e,w.isSuccess);It(e);const l=A.data,c=s.useMemo(()=>w.data??[],[w.data]),C=Me({room:l});Zt({roomId:e,route:u,urlThreadId:o,openThreadId:f,entries:c,historyLoaded:w.isSuccess});const N=s.useMemo(()=>{var n;return((n=l==null?void 0:l.members.find(m=>m.author.id===l.viewerAuthorId))==null?void 0:n.lastReadSeq)??null},[l]),P=Yt(e,N);xt(l,c);const E=s.useRef(null),T=s.useRef(void 0),M=s.useCallback(n=>{T.current=n},[]),L=s.useCallback(()=>T.current,[]);s.useLayoutEffect(()=>{T.current=void 0},[e]);const H=s.useCallback(n=>{var m;(m=E.current)==null||m.scrollToRow(n)},[]),F=qt(e),{loadOlder:D,cursor:q}=F,z=s.useCallback(()=>{const n=Ct(c,q);D().then(()=>{n!==null&&requestAnimationFrame(()=>{var m;return(m=E.current)==null?void 0:m.scrollToRow(n.domId)})})},[c,q,D]),W=Xt({roomId:e,entrySeq:r,entries:c,historyLoaded:w.isSuccess}),K=s.useMemo(()=>f===void 0?void 0:{replyIds:new Set(c.filter(m=>ce(m)===f).map(m=>m.id)),inside:!1},[c,f]);if(A.isLoading)return t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(Pe,{})});if(A.isError||!l)return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),t.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const O=p!==void 0&&t.jsx(dn,{room:l,rootEntryId:p.rootEntryId,focusComposer:p.focusComposer,entries:c,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,streamUnavailable:S.unavailable,onRetryStream:S.retry,historyLoaded:w.isSuccess,historyFailed:w.isError,...W.threadRow===void 0?{}:{landOnRow:W.threadRow},pushed:R,onClose:I},p.rootEntryId),$=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[y,t.jsx(Ut,{ref:E,roomId:l.id,roomName:G(l),viewerAuthorId:l.viewerAuthorId,entries:c,members:l.members,formerAuthors:l.formerAuthors,lastReadSeq:P,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,isLoading:w.isLoading,error:w.error,onAddAgents:()=>ge("add",l.id),openThreadId:f,onOpenThread:k,resumeRow:L,...W.roomRow===void 0?{}:{landOnRow:W.roomRow},onTopRow:M,canLoadOlder:F.canLoadOlder,isLoadingOlder:F.isLoadingOlder,onLoadOlder:z}),i,t.jsx(tn,{roomId:l.id}),t.jsx(nn,{roomId:l.id}),t.jsx(Ee,{room:l,entries:c,scope:K,laneScope:"room",stalled:S.stalled,unavailable:S.unavailable,onRetry:S.retry,onScrollToRow:H}),t.jsx(en,{room:l,hasEntries:c.length>0,onAddAgents:()=>ge("add",l.id)}),t.jsx(Te,{room:l,attachments:C.attachments,offerJumpBackIn:d,onFocusChange:j},l.id)]}),B={surface:"room",capabilities:fe,target:C.target,anchor:"rail"};return R?t.jsx(Y.Root,{...B,children:t.jsx("div",{style:{paddingBottom:x},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",inert:O!==!1,"data-testid":"room-under-thread",children:$}),t.jsx(Rt,{initial:!1,children:O!==!1&&t.jsx(fn,{onClose:I,children:O},`thread-${f}`)})]})})}):t.jsx(Y.Root,{...B,children:t.jsx(Nn,{room:$,thread:O})})}export{Fn as R,Wt as T,Pe as a};
|
|
1
|
+
import{a1 as ie,a4 as de,a3 as Oe,iQ as _e,iR as ne,iS as me,iT as Le,iU as Fe,iV as De,aP as ze,r as s,j as t,G as ee,B as je,x as He,e as Q,gZ as Ie,hI as qe,gY as ke,iW as We,iX as $e,n as Be,h0 as X,a7 as Ke,fb as Ue,iY as Xe,iZ as Ye,i_ as Ge,cj as Qe,i$ as Ve,j0 as Ze,j1 as Je,j2 as et,cf as tt,j3 as nt,gk as G,j4 as st,l as rt,s as he,j5 as ot,j6 as at,ef as it,X as dt,dW as lt,ar as ut,j7 as ct,j8 as pe,j9 as ft,ad as mt,ja as ht,gX as pt,gW as gt,jb as xt,aI as ge,by as Rt}from"./index-BSNB2iOV.js";import{P as yt,u as vt}from"./pane-resize-handle-BnQ8IKj6.js";import{D as bt,U as wt,u as jt}from"./UnreadDivider-mAlJ1Ci7.js";import{u as It}from"./use-room-follow-claim-D_HTjK2r.js";import{a as le,e as ue,g as kt,f as Ae,h as At,i as Ne,c as U,d as V,j as Nt,k as re,b as oe,l as ae,A as Se,m as Ce,t as ce,r as St,n as J,R as fe,u as Me,C as Te,o as Ct}from"./ChannelComposer-MROo35vI.js";import{u as Mt,f as Tt,a as Pt,F as Et,C as Y,d as Ot,M as _t}from"./index-CNlIRtiQ.js";import{u as Lt}from"./use-connector-management-CQQGCFaL.js";import{A as Ft}from"./AgentRequestCard-DBVuClMO.js";import{u as Dt}from"./use-room-sessions-UwyzNxeo.js";function zt(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.haltRoomAgent(o,r),meta:{errorLabel:"Couldn’t stop this agent"}})}function Ht(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.promoteHold(o,r),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function qt(e){const o=ie(),r=Oe(),u=_e(e),y=ne(p=>{var f;return e===null?null:((f=p.paging[e])==null?void 0:f.cursor)??null}),i=de({mutationFn:async p=>{var w;const f=(w=ne.getState().paging[p])==null?void 0:w.cursor;if(f==null)return;const v=await o.listRoomEntries(p,{before:f,limit:me}),I=ze.entries(p),k=r.getQueryData(I),A=Le(k,v);r.setQueryData(I,A),ne.getState().notePage(p,Fe(v)??f,De(v,me)||A.length===((k==null?void 0:k.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:d,isPending:j}=i,R=s.useRef(!1),x=s.useCallback(async()=>{if(!(e===null||R.current)){R.current=!0;try{await d(e).catch(()=>{})}finally{R.current=!1}}},[e,d]);return{canLoadOlder:u,isLoadingOlder:j,cursor:y,loadOlder:x}}function Wt({id:e,summary:o,open:r,onOpen:u}){const{capabilities:y}=Mt(),{count:i,lastAt:d,unread:j}=o,R=Tt(d),[x,p]=s.useState({count:i,bumped:!1});x.count!==i&&p({count:i,bumped:!0});const f=x.count===i&&x.bumped;return y.threads?t.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":j>0?"":void 0,"aria-expanded":r,onClick:u,className:ee("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","mb-1 w-fit rounded text-left text-xs transition-colors","px-2 py-2 md:px-1 md:py-0.5",j>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[t.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),t.jsx("span",{className:ee(f&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:i},i),i===1?" reply":" replies",R.length>0&&t.jsxs(t.Fragment,{children:[" · last ",t.jsx("time",{dateTime:d,title:Pt(d),children:R})]}),j>0&&` · ${j} new`]}):null}function $t({loading:e,onLoad:o}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(je,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&t.jsx(He,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}const Bt="room-load-older",Kt=4;function Pe({roomName:e}){return t.jsx(Et,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:Kt},(o,r)=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(Q,{className:"size-7 shrink-0 rounded-full"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${r}`))})}function Ut({roomId:e,roomName:o,viewerAuthorId:r,entries:u,members:y,formerAuthors:i,lastReadSeq:d,reactionFrequents:j,streamStalled:R,isLoading:x,error:p,onAddAgents:f,openThreadId:v,onOpenThread:I,resumeRow:k,landOnRow:A,onTopRow:w,canLoadOlder:S=!1,isLoadingOlder:l=!1,onLoadOlder:c,ref:C}){const N=s.useMemo(()=>le(y,i),[y,i]),P=Ie(y,r),E=ue(),T=s.useMemo(()=>new Map([...N].map(([n,m])=>[n,m.displayName])),[N]),M=qe(),L=ke(e,null),{topLevel:H,repliesByRoot:F,orphaned:D}=s.useMemo(()=>kt(u),[u]),q=s.useMemo(()=>new Map(u.map(n=>[n.id,n])),[u]),z=s.useMemo(()=>{const n=We(H,d),m=$e(H.map(a=>({id:a.id,authorId:a.body.moment?`moment:${a.id}`:a.authorId,timestamp:a.createdAt})),{now:M,lastSeenId:n.lastSeenId,unreadFromStart:n.fromStart}),b=[];S&&!x&&b.push({kind:"load-older",id:Bt});for(const a of m){if(a.kind==="day-divider"){b.push({kind:"day-divider",id:a.key,label:a.label});continue}if(a.kind==="unread-divider"){b.push({kind:"unread-divider",id:a.key});continue}const h=H[a.index];b.push({kind:"message",id:h.id,entry:h,grouping:a.grouping,position:a.index+1,answers:Ae(h,H[a.index-1],q.get.bind(q))});const g=F.get(h.id);g&&b.push({kind:"thread-reply",id:At(h.id),rootId:h.id,replies:g,totalReplies:h.threadReplyCount})}return b},[H,F,q,d,M,S,x]),W=s.useMemo(()=>z.map(n=>n.kind==="load-older"?{kind:"notice",id:n.id,at:"",body:null}:n.kind==="day-divider"?{kind:"day-divider",id:n.id,label:n.label}:n.kind==="unread-divider"?{kind:"unread-divider",id:n.id}:n.kind==="thread-reply"?{kind:"thread-reply",id:n.id,rootId:n.rootId,replyCount:Ne(n.replies.length,n.totalReplies),lastAt:n.replies[n.replies.length-1].createdAt}:{kind:"message",id:n.id,payload:n.entry,grouping:n.grouping,author:U(V(n.entry,N),N,E.faces),at:n.entry.createdAt}),[z,N,E.faces]),K=s.useCallback((n,m)=>{const b=z[m.index];if(b.kind==="load-older")return c===void 0?null:t.jsx($t,{loading:l,onLoad:c});if(b.kind==="day-divider")return t.jsx(bt,{label:b.label});if(b.kind==="unread-divider")return t.jsx(wt,{});if(b.kind==="thread-reply"){if(m.onOpenThread===void 0)return null;const h=m.onOpenThread;return t.jsx(Wt,{id:re(b.rootId),summary:Nt(b.replies,d,b.totalReplies),open:v===b.rootId,onOpen:()=>h(b.rootId)})}const a=V(b.entry,N);return t.jsx(oe,{roomId:e,entry:b.entry,author:U(a,N,E.faces),authorRef:N.get(a),authors:N,viewerAuthorId:r,authorNames:T,reactionFrequents:j,streamStalled:R,isMember:P,grouping:b.grouping,orphanedReply:D.has(b.entry.id),answers:b.answers,feedPosition:{index:b.position,total:-1},rowId:ae(b.entry.id)})},[z,e,N,E.faces,r,T,j,R,P,D,d,v,l,c]),O=s.useCallback(n=>{if(n.kind==="message")return ae(n.id);if(n.kind==="thread-reply")return re(n.rootId)},[]);if(p)return t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),t.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const $=y.some(n=>n.author.kind==="agent"),B=t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx(Be,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),t.jsx("p",{className:"max-w-sm",children:$?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(je,{type:"button",size:"sm",variant:$?"ghost":"default",onClick:f,className:"mt-1",children:$?"Add more agents":"Add agents"})]});return t.jsx(Se,{known:E,children:t.jsx(Y.Timeline,{ref:C,conversationId:e,label:`Messages in ${o}`,rows:W,renderRow:K,onOpenThread:I,domIdOf:O,...k===void 0?{}:{resumeRow:k},...A===void 0?{}:{landOnRow:A},...w===void 0?{}:{onTopRow:w},pending:L,viewerAuthorId:r,loading:x?t.jsx(Pe,{roomName:o}):void 0,empty:B,feedTestId:"room-timeline"})})}function Xt(e){const{roomId:o,entrySeq:r,entries:u,historyLoaded:y}=e,i=r===void 0?null:`${o}:${r}`,d=s.useMemo(()=>{if(r===void 0)return null;const k=u.find(l=>l.seq===r);if(k===void 0)return null;const A=Ce(u,k.id);if(A===null)return null;const w=ce(k)??null,S=w!==null&&A.rowId!==k.id;return{roomRowId:A.rowId,threadRootId:S?w:null,entryId:k.id}},[u,r]),j=s.useRef(null),R=(d==null?void 0:d.threadRootId)??null;s.useEffect(()=>{i===null||R===null||j.current!==i&&(j.current=i,X.getState().openThread(o,R))},[i,o,R]);const x=s.useRef(null);s.useEffect(()=>{i===null||!y||d===null&&x.current!==i&&(x.current=i,Ke.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[i,y,d]);const p=s.useRef(null),f=s.useCallback(()=>{if(!(i===null||p.current===i))return p.current=i,d==null?void 0:d.roomRowId},[i,d]),v=s.useRef(null),I=s.useCallback(()=>{if(!(i===null||v.current===i))return v.current=i,(d==null?void 0:d.threadRootId)===null||d==null?void 0:d.entryId},[i,d]);return{roomRow:r===void 0?void 0:f,threadRow:r===void 0?void 0:I}}function Yt(e,o){const[r,u]=s.useState({roomId:null,seq:null});return r.roomId===e?r.seq:e===null?(u({roomId:null,seq:null}),null):o===null?null:(u({roomId:e,seq:o}),o)}const Gt=600;function Qt(e){return document.getElementById(re(e))??document.getElementById(ae(e))}function Vt(){const e=s.useRef(null);return s.useEffect(()=>()=>{var r;return(r=e.current)==null?void 0:r.call(e)},[]),{arm:s.useCallback(r=>{var j;(j=e.current)==null||j.call(e);let u=0;const y=Date.now()+Gt;let i=!1;const d=()=>{if(i)return;const R=document.activeElement;if(R===null||R===document.body||!R.isConnected){const p=Qt(r);if(p!==null){p.focus();return}}Date.now()>=y||(u=requestAnimationFrame(d))};u=requestAnimationFrame(d),e.current=()=>{i=!0,cancelAnimationFrame(u)}},[])}}function Zt({roomId:e,route:o,urlThreadId:r,openThreadId:u,entries:y,historyLoaded:i}){const d=Ue(),j=s.useRef(null);s.useEffect(()=>{if(e!==null){if(j.current!==e&&(j.current=e,r!==void 0)){X.getState().openThread(e,r);return}if(i&&u!==void 0){const R=y.find(p=>p.id===u),x=R===void 0?void 0:St(R);if(x!==void 0&&x!==u){const p=X.getState().open[e];X.getState().openThread(e,x,(p==null?void 0:p.focusComposer)??!1);return}}u!==r&&(d==null||d({to:o,search:R=>({...R,thread:u}),replace:!0}))}},[e,o,u,r,y,i,d])}function Jt(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(o=>o.author.kind==="agent")}function en({room:e,hasEntries:o,onAddAgents:r}){return!o||!Jt(e)?null:t.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",t.jsx("button",{type:"button",onClick:r,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function tn({roomId:e}){const{approvals:o}=Xe(),r=Ye(o).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:t.jsx(Ge,{approvals:r})})}function nn({roomId:e}){const{data:o}=Lt("pending"),r=(o??[]).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:r.map(u=>t.jsx(Ft,{request:u},u.requestId))})}const sn="An agent",xe=64,se=3,rn=new Set;function Ee({room:e,entries:o,scope:r,laneScope:u,stalled:y,unavailable:i=!1,onRetry:d,onScrollToRow:j}){const R=Qe(),x=Ve(e.id,r),p=Ze(e.id,r),f=Je(e.id,r),[v,I]=s.useState(!1),k=Dt(e.id,{enabled:v}),A=et(),{mutate:w}=zt(),[S,l]=s.useState(rn),c=s.useCallback(a=>{l(h=>new Set(h).add(a)),w({roomId:e.id,authorId:a},{onSettled:()=>l(h=>{const g=new Set(h);return g.delete(a),g})})},[w,e.id]),C=Ht(),[N,P]=s.useState(()=>new Map),E=tt(),T=ue(),M=s.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),L=s.useCallback(a=>{var h;return((h=M.get(a))==null?void 0:h.displayName)??sn},[M]),{interactions:H}=nt(),F=s.useMemo(()=>H.filter(a=>a.roomId===e.id),[H,e.id]),D=s.useMemo(()=>{var h;const a={};for(const g of F){if(g.roomAuthorId===void 0)continue;const _=(h=M.get(g.roomAuthorId))==null?void 0:h.displayName;_!==void 0&&(a[g.sessionId]=_)}return a},[F,M]),q=s.useMemo(()=>x.map(a=>({authorId:a.authorId,name:L(a.authorId),state:a.state,since:a.since,activity:a.activity??null})),[x,L]),z=s.useMemo(()=>p.map(a=>{var g;const h=(g=E.data)==null?void 0:g.find(_=>_.id===a.behindRoomId);return{authorId:a.authorId,name:L(a.authorId),since:a.since,behind:{roomId:a.behindRoomId,title:h===void 0?null:G(h)},othersWaiting:a.othersWaiting,severalInTheWay:a.severalInTheWay}}),[p,L,E.data]),W=s.useMemo(()=>{const a=new Set;for(const h of p)N.get(h.authorId)===h.entryId&&a.add(h.authorId);return a},[p,N]),K=s.useMemo(()=>f===null?null:{authorId:f.authorId,name:L(f.authorId)},[f,L]),O=s.useMemo(()=>Ot({capabilities:fe,asks:F,agentNames:D,stalled:y,presence:q,held:z,silentFinish:K,turn:null}),[F,D,q,z,K,y]),$=s.useMemo(()=>{var h;const a=new Map;for(const g of((h=k.data)==null?void 0:h.bindings)??[])a.set(g.authorId,g.sessionId);return a},[k.data]),B=s.useCallback(a=>{const h=o.find(_=>_.id===a);if(h===void 0)return null;const g=h.body.text.replace(/\s+/gu," ").trim();return g.length===0?null:g.length>xe?`${g.slice(0,xe).trimEnd()}…`:g},[o]),n=s.useCallback(a=>{var h;return u==="thread"?J(a):((h=Ce(o,a))==null?void 0:h.domId)??null},[o,u]),m=s.useMemo(()=>{const a=x.map(g=>{const _=B(g.entryId),Z=n(g.entryId);return{authorId:g.authorId,author:U(g.authorId,M,T.faces),state:g.state,since:g.since,doing:st(g.activity),replyingTo:_===null||Z===null?null:{entryId:g.entryId,excerpt:_,rowId:Z},sessionId:$.get(g.authorId)??null}}),h=z.map(g=>({authorId:g.authorId,author:U(g.authorId,M,T.faces),state:"held",since:g.since,doing:null,replyingTo:null,sessionId:null,behind:g.behind,othersWaiting:g.othersWaiting}));return[...a,...h]},[x,z,M,T.faces,B,n,$]),b=s.useMemo(()=>{if(x.length===0)return null;const a=x.slice(0,se);return t.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[a.map(h=>t.jsx(_t,{author:U(h.authorId,M,T.faces),className:"ring-background size-4 ring-2"},h.authorId)),x.length>se&&t.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${x.length-se}`})]})},[x,M,T.faces]);return t.jsx(Y.LiveLane,{state:O,scope:u,onRetry:d,unavailable:i,faces:b,onPeekOpenChange:I,askCard:O.kind==="ask"?t.jsx(ot,{ask:O.ask,...D[O.ask.sessionId]?{agentName:D[O.ask.sessionId]}:{},onOpenSession:a=>{R(he({session:a}))},className:"border-l-0"}):void 0,peek:t.jsx(Y.LivePeek,{rows:m,onScrollToRow:j,onOpenSession:a=>{R(he({session:a}))},onOpenRoom:a=>{R({...rt.channels(),search:{id:a}})},onAnswerFirst:a=>{const h=p.find(g=>g.authorId===a);h!==void 0&&P(g=>new Map(g).set(a,h.entryId)),C.mutate({roomId:e.id,authorId:a})},promoted:W,onStopAll:()=>A.mutate({roomId:e.id}),stopping:A.isPending,onStopAgent:c,stoppingAgents:S})})}const Re=3e3;function on(e,o,r,u=Date.now){const y=s.useRef(null),i=s.useRef(new Map),d=s.useRef(new Map),j=y.current,R=i.current,x=d.current,p=u();for(const f of e){if(x.has(f.id))continue;if(j===null){x.set(f.id,"at-rest");continue}const v=R.get(f.authorId);x.set(f.id,v!==void 0&&p-v<Re?"handed-off":"dropped")}return s.useEffect(()=>{if(!r)return;y.current=new Set(e.map(v=>v.id));const f=u();for(const v of o)i.current.set(v,f);for(const[v,I]of i.current)f-I>Re&&i.current.delete(v);for(const v of d.current.keys())y.current.has(v)||d.current.delete(v)}),x}function an({kind:e}){return e==="thread-error"?t.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),t.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?t.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-sm"})]}):t.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function dn({room:e,rootEntryId:o,focusComposer:r,entries:u,reactionFrequents:y,streamStalled:i,streamUnavailable:d,onRetryStream:j,historyLoaded:R,historyFailed:x=!1,landOnRow:p,pushed:f,onClose:v}){const I=s.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),k=Me({room:e,threadRootId:o}),A=Ie(e.members,e.viewerAuthorId),w=ue(),S=s.useMemo(()=>new Map([...I].map(([n,m])=>[n,m.displayName])),[I]),{root:l,replies:c}=s.useMemo(()=>{let n;const m=[];for(const b of u)b.id===o?n=b:ce(b)===o&&m.push(b);return{root:n,replies:m}},[u,o]),C=l==null?void 0:l.threadReplyCount,N=C!==void 0&&C>c.length,P=!f,E=l===void 0||N?-1:(P?1:0)+c.length,T=Ne(c.length,C),M=s.useMemo(()=>new Set(c.map(n=>n.id)),[c]),L=s.useMemo(()=>({replyIds:M,inside:!0}),[M]),H=at(e.id,L),F=ke(e.id,o),D=on(c,H,R),q=s.useRef(null),z=s.useCallback(n=>{var m;(m=q.current)==null||m.scrollToRow(n)},[]),W=s.useRef(null);s.useEffect(()=>{var n;r||(n=W.current)==null||n.focus()},[o,r]);const K=n=>{n.key!=="Escape"||n.defaultPrevented||(n.stopPropagation(),v())},O=s.useMemo(()=>{const n=[];if(l===void 0){const m=x?"thread-error":R?"thread-orphan":"thread-waiting";n.push({kind:"notice",id:m,at:"",body:null})}else P&&n.push({kind:"message",id:l.id,payload:l,grouping:{position:"only"},author:U(V(l,I),I,w.faces),at:l.createdAt});for(const m of c)n.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:U(V(m,I),I,w.faces),at:m.createdAt});return n},[l,P,c,I,w.faces,x,R]),$=s.useCallback(n=>{if(n.kind==="notice")return t.jsx(an,{kind:n.id});if(n.kind!=="message")return null;const m=n.payload,b=l!==void 0&&m.id===l.id,a=c.findIndex(_=>_.id===m.id),h=t.jsx(oe,{roomId:e.id,entry:m,rowId:J(m.id),author:n.author,authorRef:I.get(m.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:y,streamStalled:i,isMember:A,grouping:{position:"only"},answers:Ae(m,a<=0?l:c[a-1],_=>(l==null?void 0:l.id)===_?l:c.find(Z=>Z.id===_)),feedPosition:{index:b?1:(l===void 0||!P?0:1)+a+1,total:E}});if(b)return t.jsxs(t.Fragment,{children:[h,t.jsx(ye,{count:T})]});const g=D.get(m.id)??"at-rest";return t.jsx("div",{className:ee(g==="dropped"&&"motion-safe:animate-thread-reply-in",g==="handed-off"&&"motion-safe:animate-reply-settle"),children:h})},[l,P,c,T,D,e.id,e.viewerAuthorId,I,S,y,i,A,E]),B=s.useCallback(n=>n.kind==="message"?J(n.id):void 0,[]);return t.jsx(Se,{known:w,children:t.jsx(Y.Root,{surface:"room",capabilities:fe,target:k.target,anchor:"rail",children:t.jsxs("section",{ref:W,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:K,className:ee("bg-card flex min-h-0 flex-col outline-none",f?"h-full w-full":"w-full border-l"),children:[f?t.jsxs("header",{className:"flex items-center gap-2 border-b px-1 py-1",children:[t.jsxs("button",{type:"button",onClick:v,"aria-label":`Back to ${G(e)}`,"data-testid":"room-thread-back",className:"focus-ring text-muted-foreground hover:text-foreground flex h-11 min-w-0 items-center gap-1 rounded px-2 text-sm",children:[t.jsx(it,{"aria-hidden":!0,className:"size-4 shrink-0"}),t.jsx("span",{className:"truncate",children:G(e)})]}),t.jsx("p",{className:"ml-auto shrink-0 pr-3 text-sm font-medium",children:"Thread"})]}):t.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[t.jsx("button",{type:"button",onClick:v,"aria-label":"Close thread",className:"focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1",children:t.jsx(dt,{"aria-hidden":!0,className:"size-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium",children:"Thread"}),t.jsx("p",{className:"text-muted-foreground truncate text-xs",children:G(e)})]})]}),f&&l!==void 0&&t.jsxs("div",{"data-testid":"room-thread-pinned-root",className:"max-h-[40%] shrink-0 overflow-y-auto border-b pt-2",children:[t.jsx(oe,{roomId:e.id,entry:l,rowId:J(l.id),author:U(V(l,I),I,w.faces),authorRef:I.get(l.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:y,streamStalled:i,isMember:A,grouping:{position:"only"}}),t.jsx(ye,{count:T})]}),t.jsx(Y.Timeline,{ref:q,conversationId:`thread-${o}`,label:`Thread in ${G(e)}`,busy:!R&&!x,rows:O,renderRow:$,domIdOf:B,...p===void 0?{}:{landOnRow:p},pending:F,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),t.jsx(Ee,{room:e,entries:u,scope:L,laneScope:"thread",stalled:f&&i===!0,unavailable:d,onRetry:f?j:void 0,onScrollToRow:z}),t.jsx(Te,{room:e,threadRootId:o,attachments:k.attachments,focusOnMount:r},o)]})})})}function ye({count:e}){return e===0?null:t.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[t.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:e===1?"1 reply":`${e} replies`}),t.jsx("span",{className:"bg-border h-px flex-1"})]})}const ln=96,un=500;function cn(e){return e.offset.x>ln||e.velocity.x>un}function fn({children:e,onClose:o}){const r=lt()===!0,u=r?{x:0}:{x:"100%"};return t.jsx(ut.div,{"data-testid":"room-thread-sheet",className:"bg-card absolute inset-0 z-10 flex flex-col shadow-xl",initial:u,animate:{x:0},exit:u,transition:r?{duration:0}:{duration:.22,ease:[.32,.72,0,1]},drag:"x",dragDirectionLock:!0,dragConstraints:{left:0,right:0},dragElastic:{left:0,right:.9},dragMomentum:!1,onDragEnd:(y,i)=>{cn(i)&&o()},children:e})}const te="room-thread-split",mn=320,hn=360,pn=40,gn=50,xn=25;function ve(e,o){return o<=0?xn:Math.min(Math.round(e/o*1e3)/10,gn)}function Rn(e){const o=ve(mn,e),r=Math.round((100-ve(hn,e))*10)/10;return{minPct:o,maxPct:r,defaultPct:Math.min(Math.max(pn,o),r)}}function yn(e,o,r){if(e===null||o===null||o<=0)return r.defaultPct;const u=e/o*100;return Math.round(Math.min(Math.max(u,r.minPct),r.maxPct)*10)/10}function vn(e){try{const o=localStorage.getItem(e),r=o===null?NaN:Number(o);return Number.isFinite(r)&&r>0?r:null}catch{return null}}function bn(e,o){try{localStorage.setItem(e,String(Math.round(o)))}catch{}}const wn="react-resizable-panels:room-thread-split";function jn(){try{localStorage.removeItem(wn)}catch{}}function In(){const[e,o]=s.useState(null),[r,u]=s.useState(null);return{ref:s.useCallback(i=>{if(i===null)return;o(i);const d=()=>u(i.offsetWidth);d();const j=new ResizeObserver(d);return j.observe(i),()=>{j.disconnect(),o(null),u(null)}},[]),element:e,width:r,sizing:Rn(r??0)}}const kn=`${te}-room`,be=`${te}-thread`,we=`${te}-handle`,An=4;function Nn({room:e,thread:o,storageKey:r=ft.ROOM_THREAD_WIDTH}){const{ref:u,element:y,width:i,sizing:d}=In(),[j,R]=s.useState(()=>vn(r)),[x,p]=s.useState(null),f=s.useRef(null),v=yn(j,i,d),I=i===null||(d.maxPct-d.minPct)/100*i<An,k=o!==!1;s.useEffect(jn,[]);const A=s.useRef(!1);s.useLayoutEffect(()=>{var c;A.current&&((c=f.current)==null||c.resize(v))},[v,k]);const w=s.useRef(null),S=()=>{var P;const c=(P=f.current)==null?void 0:P.getSize(),C=w.current;if(w.current=null,c===void 0||i===null||i<=0||C===c)return;const N=Math.round(c/100*i);R(N),bn(r,N)},l=x??v;return s.useLayoutEffect(()=>{const c=y==null?void 0:y.querySelector(`[data-panel-resize-handle-id="${we}"]`);c&&(c.setAttribute("aria-controls",be),c.setAttribute("aria-valuenow",String(Math.round(l))),c.setAttribute("aria-valuemin",String(Math.round(d.minPct))),c.setAttribute("aria-valuemax",String(Math.round(d.maxPct))))}),t.jsx("div",{ref:u,className:"h-full overflow-hidden",children:t.jsxs(ct,{direction:"horizontal",id:te,onLayout:c=>{A.current=c.length>1,p(A.current?c[1]:null)},children:[t.jsx(pe,{id:kn,order:1,className:"flex",children:e}),k&&t.jsxs(t.Fragment,{children:[t.jsx(yt,{id:we,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:I,onDragging:c=>{var C;c&&(w.current=((C=f.current)==null?void 0:C.getSize())??null)},onKeyDownCapture:c=>{var C,N;I||(w.current=((C=f.current)==null?void 0:C.getSize())??null,!(c.key!=="Home"&&c.key!=="End")&&(c.preventDefault(),(N=f.current)==null||N.resize(c.key==="Home"?d.minPct:d.maxPct)))},onResizeEnd:S}),t.jsx(pe,{ref:f,id:be,order:2,defaultSize:v,minSize:d.minPct,maxSize:d.maxPct,className:"flex",children:o})]})]})})}function Fn({roomId:e,threadId:o,entrySeq:r,threadRoute:u,aboveTimeline:y,aboveComposer:i,offerJumpBackIn:d,onComposerFocusChange:j}){const R=mt(),x=vt(),p=ht(e),f=p==null?void 0:p.rootEntryId,v=Vt(),I=s.useCallback(()=>{var m;const n=(m=X.getState().open[e])==null?void 0:m.rootEntryId;X.getState().closeThread(e),n!==void 0&&v.arm(n)},[e,v]),k=s.useCallback(n=>{X.getState().openThread(e,n)},[e]),A=pt(e),w=gt(e),S=jt(e,w.isSuccess);It(e);const l=A.data,c=s.useMemo(()=>w.data??[],[w.data]),C=Me({room:l});Zt({roomId:e,route:u,urlThreadId:o,openThreadId:f,entries:c,historyLoaded:w.isSuccess});const N=s.useMemo(()=>{var n;return((n=l==null?void 0:l.members.find(m=>m.author.id===l.viewerAuthorId))==null?void 0:n.lastReadSeq)??null},[l]),P=Yt(e,N);xt(l,c);const E=s.useRef(null),T=s.useRef(void 0),M=s.useCallback(n=>{T.current=n},[]),L=s.useCallback(()=>T.current,[]);s.useLayoutEffect(()=>{T.current=void 0},[e]);const H=s.useCallback(n=>{var m;(m=E.current)==null||m.scrollToRow(n)},[]),F=qt(e),{loadOlder:D,cursor:q}=F,z=s.useCallback(()=>{const n=Ct(c,q);D().then(()=>{n!==null&&requestAnimationFrame(()=>{var m;return(m=E.current)==null?void 0:m.scrollToRow(n.domId)})})},[c,q,D]),W=Xt({roomId:e,entrySeq:r,entries:c,historyLoaded:w.isSuccess}),K=s.useMemo(()=>f===void 0?void 0:{replyIds:new Set(c.filter(m=>ce(m)===f).map(m=>m.id)),inside:!1},[c,f]);if(A.isLoading)return t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(Pe,{})});if(A.isError||!l)return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),t.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const O=p!==void 0&&t.jsx(dn,{room:l,rootEntryId:p.rootEntryId,focusComposer:p.focusComposer,entries:c,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,streamUnavailable:S.unavailable,onRetryStream:S.retry,historyLoaded:w.isSuccess,historyFailed:w.isError,...W.threadRow===void 0?{}:{landOnRow:W.threadRow},pushed:R,onClose:I},p.rootEntryId),$=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[y,t.jsx(Ut,{ref:E,roomId:l.id,roomName:G(l),viewerAuthorId:l.viewerAuthorId,entries:c,members:l.members,formerAuthors:l.formerAuthors,lastReadSeq:P,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,isLoading:w.isLoading,error:w.error,onAddAgents:()=>ge("add",l.id),openThreadId:f,onOpenThread:k,resumeRow:L,...W.roomRow===void 0?{}:{landOnRow:W.roomRow},onTopRow:M,canLoadOlder:F.canLoadOlder,isLoadingOlder:F.isLoadingOlder,onLoadOlder:z}),i,t.jsx(tn,{roomId:l.id}),t.jsx(nn,{roomId:l.id}),t.jsx(Ee,{room:l,entries:c,scope:K,laneScope:"room",stalled:S.stalled,unavailable:S.unavailable,onRetry:S.retry,onScrollToRow:H}),t.jsx(en,{room:l,hasEntries:c.length>0,onAddAgents:()=>ge("add",l.id)}),t.jsx(Te,{room:l,attachments:C.attachments,offerJumpBackIn:d,onFocusChange:j},l.id)]}),B={surface:"room",capabilities:fe,target:C.target,anchor:"rail"};return R?t.jsx(Y.Root,{...B,children:t.jsx("div",{style:{paddingBottom:x},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",inert:O!==!1,"data-testid":"room-under-thread",children:$}),t.jsx(Rt,{initial:!1,children:O!==!1&&t.jsx(fn,{onClose:I,children:O},`thread-${f}`)})]})})}):t.jsx(Y.Root,{...B,children:t.jsx(Nn,{room:$,thread:O})})}export{Fn as R,Wt as T,Pe as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-
|
|
1
|
+
import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-BSNB2iOV.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as D,j as e,a0 as ye,by as Ee,ar as we,G as N,eg as de,bz as ue,bA as fe,bB as me,bD as xe,eh as Te,a1 as Ae,a3 as ke,a4 as De,ad as pe,as as Le,dS as he,ei as Oe,ej as Ie,ek as Pe,a8 as j,el as _e,dV as H,em as Ue,am as be,B as $e,T as Re,b as He,e as Me,en as Be,eo as ze,ep as Ke,eq as qe,er as Ve,es as Qe}from"./index-DSYz85aL.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as Fe,d as Ge,k as We,e as k}from"./execution-config-ryHuiBdx.js";import{U as Xe}from"./unverified-catalog-notice-DAhwNpy_.js";import{s as Ye}from"./settings-for-runtime-BoOa-ZFG.js";const Je={duration:.12,ease:"easeOut"},Ze={type:"spring",stiffness:320,damping:28};function ge({isSetHere:a,serverDefault:l,onUseServerDefault:d,warning:r,className:s,"data-testid":i}){const[u,f]=D.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!d,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?de.warning:de.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":i,children:[r&&e.jsx(ye,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Ee,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Ze},exit:{opacity:0},transition:Je,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",Te.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{d(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":i?`${i}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Ae(),d=ke();return De({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{d.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{d.invalidateQueries({queryKey:et})}})}const ve="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:d,selected:r,isSetHere:s,serverDefault:i,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:L}){const w=pe(),[S,h]=D.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:a}),!w&&e.jsx(ge,{isSetHere:s,serverDefault:i,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Re,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:d.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:L??(i?`Use server default: ${i}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:d}){var ee,te,se,ae,ne,le,oe,re,ie;const r=pe(),{data:s}=Le(),{data:i,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=Oe(),C=Fe(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=i==null?void 0:i.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,A;return((A=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:L}=Ie({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),y=c?(m??[]).find(t=>t.isDefault):void 0,T=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=T?(m??[]).find(t=>t.value===T):void 0,O=(n==null?void 0:n.supportsEffort)??((ae=Ye(i,o))==null?void 0:ae.supportsEffort),B=O===void 0&&u,z=O!==!1,K=p?p.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:V,creditsEntry:je,resolvedAccount:Q}=Pe(),F=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),g=q&&[...q.flatMap(t=>t.id===null?[]:[{id:t.id,label:V(t.path),path:t.path}]),...F?[{id:j,label:_e,path:F.path}]:[]],v=a.account??null,G=v!==null,W=o==="claude-code"&&v===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&Q?V(Q):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=D.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Ge({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:We(m),knownAccounts:g,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:O,runtimeLabel:t=>H(t).label}),E=t=>{var b;return((b=Ne.breakages.find(A=>t.includes(A.kind)))==null?void 0:b.message)??null},U=!B&&z&&K!==!1,X=a.effort??(n==null?void 0:n.effort)??null,Y=H(o).label,Ce=o==="claude-code"&&g!==void 0&&(g.length>1||G),Se=E(["account-unregistered"]),J=(m??[]).some(t=>t.unverified),Z=D.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",d),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??T??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:T,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:E(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:J?Z:void 0,inheritText:M?ce:c&&!h?y?`Use the suggested model: ${y.displayName}`:"Use the default model":void 0}),J&&e.jsx(Xe,{id:Z}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&L&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ge,{isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:E(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${Y} supports`,warning:null}):z?U?e.jsx($,{label:"Effort",valueLabel:k(X),options:Ue.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:k(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:E(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${Y}`,warning:E(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:W?I??"Default":v!==null?((ie=g==null?void 0:g.find(t=>t.id===v))==null?void 0:ie.label)??v:I??"Default",options:(g??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:v,isSetHere:G,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),W&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx($e,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:d}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":d,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function dt({member:a}){const{agent:l,projectPath:d,isPending:r,update:s}=He(a),{data:i}=he();if(r)return e.jsx(Me,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=i?Object.keys(i.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(Be,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(ze,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Ke,{})}),e.jsx(qe,{children:f.map(o=>e.jsx(Ve,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),d&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Qe,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(d)})]})]})}export{dt as RunsOnPopover};
|
|
1
|
+
import{r as D,j as e,a0 as ye,by as Ee,ar as we,G as N,eg as de,bz as ue,bA as fe,bB as me,bD as xe,eh as Te,a1 as Ae,a3 as ke,a4 as De,ad as pe,as as Le,dS as he,ei as Oe,ej as Ie,ek as Pe,a8 as j,el as _e,dV as H,em as Ue,am as be,B as $e,T as Re,b as He,e as Me,en as Be,eo as ze,ep as Ke,eq as qe,er as Ve,es as Qe}from"./index-BSNB2iOV.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as Fe,d as Ge,k as We,e as k}from"./execution-config-B0Ip8o1B.js";import{U as Xe}from"./unverified-catalog-notice-CMDo7sp5.js";import{s as Ye}from"./settings-for-runtime-BoOa-ZFG.js";const Je={duration:.12,ease:"easeOut"},Ze={type:"spring",stiffness:320,damping:28};function ge({isSetHere:a,serverDefault:l,onUseServerDefault:d,warning:r,className:s,"data-testid":i}){const[u,f]=D.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!d,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?de.warning:de.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":i,children:[r&&e.jsx(ye,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Ee,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Ze},exit:{opacity:0},transition:Je,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",Te.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{d(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":i?`${i}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Ae(),d=ke();return De({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{d.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{d.invalidateQueries({queryKey:et})}})}const ve="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:d,selected:r,isSetHere:s,serverDefault:i,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:L}){const w=pe(),[S,h]=D.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:a}),!w&&e.jsx(ge,{isSetHere:s,serverDefault:i,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Re,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:d.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:L??(i?`Use server default: ${i}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:d}){var ee,te,se,ae,ne,le,oe,re,ie;const r=pe(),{data:s}=Le(),{data:i,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=Oe(),C=Fe(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=i==null?void 0:i.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,A;return((A=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:L}=Ie({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),y=c?(m??[]).find(t=>t.isDefault):void 0,T=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=T?(m??[]).find(t=>t.value===T):void 0,O=(n==null?void 0:n.supportsEffort)??((ae=Ye(i,o))==null?void 0:ae.supportsEffort),B=O===void 0&&u,z=O!==!1,K=p?p.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:V,creditsEntry:je,resolvedAccount:Q}=Pe(),F=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),g=q&&[...q.flatMap(t=>t.id===null?[]:[{id:t.id,label:V(t.path),path:t.path}]),...F?[{id:j,label:_e,path:F.path}]:[]],v=a.account??null,G=v!==null,W=o==="claude-code"&&v===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&Q?V(Q):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=D.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Ge({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:We(m),knownAccounts:g,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:O,runtimeLabel:t=>H(t).label}),E=t=>{var b;return((b=Ne.breakages.find(A=>t.includes(A.kind)))==null?void 0:b.message)??null},U=!B&&z&&K!==!1,X=a.effort??(n==null?void 0:n.effort)??null,Y=H(o).label,Ce=o==="claude-code"&&g!==void 0&&(g.length>1||G),Se=E(["account-unregistered"]),J=(m??[]).some(t=>t.unverified),Z=D.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",d),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??T??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:T,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:E(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:J?Z:void 0,inheritText:M?ce:c&&!h?y?`Use the suggested model: ${y.displayName}`:"Use the default model":void 0}),J&&e.jsx(Xe,{id:Z}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&L&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ge,{isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:E(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${Y} supports`,warning:null}):z?U?e.jsx($,{label:"Effort",valueLabel:k(X),options:Ue.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:k(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:E(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${Y}`,warning:E(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:W?I??"Default":v!==null?((ie=g==null?void 0:g.find(t=>t.id===v))==null?void 0:ie.label)??v:I??"Default",options:(g??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:v,isSetHere:G,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),W&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx($e,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:d}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":d,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function dt({member:a}){const{agent:l,projectPath:d,isPending:r,update:s}=He(a),{data:i}=he();if(r)return e.jsx(Me,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=i?Object.keys(i.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(Be,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(ze,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Ke,{})}),e.jsx(qe,{children:f.map(o=>e.jsx(Ve,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),d&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Qe,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(d)})]})]})}export{dt as RunsOnPopover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{as as Ee,a1 as b,a3 as D,r as x,a4 as R,jE as F,jF as M,jG as Be,a2 as z,j as e,jH as Ge,i3 as we,ex as We,ey as Y,O as Re,Q as Ie,U as Le,B as C,hM as Ye,G as H,dR as He,ei as Ve,jI as Je,jJ as Xe,dW as Ae,ar as te,x as de,by as Ze,J as ue,dV as me,eu as S,ev as ne,au as es,jK as ss,I as _,jL as ts,jM as Ke,jN as ns,_ as De,fe as rs,en as as,eo as is,ep as os,eq as ls,er as be,ef as cs,C as ds,jO as us,jP as ms,jQ as xs,T as hs}from"./index-BSNB2iOV.js";import{I as fs}from"./inline-code-Df1J1tQV.js";import{u as ps}from"./useMutationState-CUuSnqrc.js";import{O as gs,a as W}from"./runtime-connect-Dn0T5YWv.js";function ys(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function St(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Ct(s){var u,d;const t=b(),n=D(),[i,a]=x.useState(null),r=R({mutationFn:()=>(a(null),t.provisionRuntime(s,m=>a(m))),onSuccess:m=>{m.ok&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((u=r.data)==null?void 0:u.ok)===!1,o=r.isError?r.error.message:((d=r.data)==null?void 0:d.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Me(s){return["runtime-key-status",s]}function js(s,t=!0){const n=b();return z({queryKey:Me(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function vs(s){const t=b(),n=R({mutationFn:a=>t.checkRuntimeCredential(s,a.trim().length>0?a:null),meta:{suppressErrorToast:!0}}),i=n.data??(n.isError?{ok:!1,reason:"unexpected",message:n.error.message||"Couldn’t check the key."}:null);return{check:a=>n.mutate(a),isPending:n.isPending,result:i,checkedSavedKey:i!==null&&(n.variables??"").trim().length===0,reset:n.reset}}function ks(s){var o,c,u;const t=b(),n=D(),[i,a]=x.useState(null),r=R({mutationFn:async d=>{a("checking");const m=await t.checkRuntimeCredential(s,d);return m.ok?(a("saving"),await t.storeRuntimeCredential(s,d),{saved:!0,message:null}):{saved:!1,message:m.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Me(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:d=>{d.trim().length!==0&&r.mutate(d)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((u=r.data)==null?void 0:u.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function Ns(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function bs(s,t){var T,I,w,P;const n=b(),i=D(),{sessionId:a,accountRoot:r,onCompleted:l}=t??{},o=x.useMemo(()=>["runtime-login",s,a??"",r??""],[s,a,r]),c=R({mutationKey:o,mutationFn:()=>n.delegateRuntimeLogin(s,a===void 0&&r===void 0?void 0:{sessionId:a,accountRoot:r}),onSuccess:N=>{N.ok&&(i.invalidateQueries({queryKey:Be.all}),i.invalidateQueries({queryKey:[...F]}),i.invalidateQueries({queryKey:[...M]}))}}),u=ps({filters:{mutationKey:o,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),d=u.some(N=>N.state.status==="pending"),m=u[u.length-1],h=d||m==null?void 0:m.state,g=d||m==null?void 0:m.id,p=!d&&((h==null?void 0:h.status)==="error"||((T=h==null?void 0:h.data)==null?void 0:T.ok)===!1),y=(h==null?void 0:h.status)==="error"?((I=h.error)==null?void 0:I.message)??null:((w=h==null?void 0:h.data)==null?void 0:w.error)??null,v=((P=h==null?void 0:h.data)==null?void 0:P.ok)===!0,O=x.useRef(l);return O.current=l,x.useEffect(()=>{var L;if(!v||g===void 0)return;const N=Ns(i);N.has(g)||(N.add(g),(L=O.current)==null||L.call(O))},[v,g,i]),{login:()=>{d||c.mutate()},isPending:d,isSuccess:v,isError:p,errorMessage:p?y??"Couldn’t sign in. Try again.":null}}const Ce={"claude-code":{signInLabel:"Sign in",otherWayLabel:"Sign in with Claude",signInHint:"Use your Claude subscription or Anthropic account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"Anthropic API key",keyPlaceholder:"sk-ant-…",getKeyUrl:"https://console.anthropic.com/settings/keys"},codex:{signInLabel:"Sign in with ChatGPT",otherWayLabel:"Sign in with ChatGPT",signInHint:"Use your ChatGPT account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"OpenAI API key",keyPlaceholder:"sk-…",getKeyUrl:"https://platform.openai.com/api-keys"}};function Ss(s){return Ce[s]??Ce["claude-code"]}function Cs({command:s,infoUrl:t,copyLabel:n}){return!s&&!t?null:e.jsxs("div",{className:"space-y-2",children:[s&&e.jsxs("div",{className:"bg-muted flex items-center justify-between gap-2 rounded-lg px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(Ge,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(we,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(We,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(Y,{className:"size-3"})]})]})}function Ot({command:s,runtimeLabel:t}){const[n,i]=x.useState(!1);return e.jsxs(Re,{open:n,onOpenChange:i,className:"mt-2",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["DorkOS installs ",t," for you."," ",e.jsx(Ie,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Le,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(fs,{children:s}),e.jsx(we,{value:s,label:`Copy command: ${s}`,className:"shrink-0"})]})]})}function Oe({onRetry:s}){return e.jsxs("div",{"data-testid":"remote-signin-notice",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Signing in needs the computer DorkOS runs on."}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s?"Sign in to DorkOS there, then press Retry.":"Sign in to DorkOS there."}),e.jsx("p",{className:"text-muted-foreground/80 mt-2 text-xs",children:"Already on that computer? Open DorkOS at localhost instead."}),s&&e.jsxs(C,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ye,{className:"size-3"}),"Retry"]})]})}function Os({ollama:s=!1,remote:t=!1,className:n}){return e.jsxs("p",{className:H("text-muted-foreground text-xs",n),"data-testid":"keep-it-local-note",children:[t?"Prefer everything on the computer DorkOS runs on? Use your own sign-in there":"Prefer to keep everything on this computer? Use your own sign-in",s?", or Ollama":"","."]})}function Ps(s){const t=He(),{data:n}=Ve();return s?Je(Xe(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",Es={title:xe,body:`Frontier models are unlocked. ${he}`},ws={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Te(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function Rs(s){return{title:`${s} is ready`,body:`New work on ${s} runs on your DorkOS credits. Change it any time in Settings › Runtimes.`}}function A({message:s}){const t=Ae();return e.jsxs(te.div,{role:"status",className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:t?!1:{opacity:0},animate:{opacity:1},"data-testid":"connect-progress",children:[e.jsx(de,{size:"xs",className:H("text-muted-foreground shrink-0",t&&"animate-none")}),e.jsx(Ze,{mode:"wait",children:e.jsx(te.span,{className:"truncate text-xs",initial:t?!1:{opacity:0},animate:{opacity:1},exit:t?void 0:{opacity:0},transition:{duration:.2},children:s},s)})]})}function U({message:s="Connected"}){return e.jsxs("div",{role:"status",className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"connect-connected",children:[e.jsx(ue,{className:"size-3.5"}),s]})}function Q({message:s,onRetry:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:s}),e.jsx(C,{size:"sm",onClick:t,children:"Try again"})]})}function Is({type:s,onConnected:t,asOtherWay:n=!1}){const i=Ss(s),a=bs(s),[r,l]=x.useState(!1),o=x.useRef(!1);return x.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Te(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(U,{message:"Signed in"}):a.isError?e.jsx(Q,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",variant:n?"outline":"default",className:"w-full",onClick:a.login,children:n?i.otherWayLabel:i.signInLabel}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i.signInHint})]})}),r?e.jsxs("div",{className:"space-y-3","data-testid":`login-connect-key-${s}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),e.jsx(Ls,{type:s,copy:i,onConnected:t}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Back to sign in"})]}):n?e.jsx(C,{size:"sm",variant:"outline",className:"w-full",onClick:()=>l(!0),"data-testid":`login-connect-use-key-${s}`,children:"Paste a key"}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors","data-testid":`login-connect-use-key-${s}`,children:"Use an API key instead"})]})}function Ls({type:s,copy:t,onConnected:n}){var p,y;const[i,a]=x.useState(""),r=ks(s),l=js(s),o=vs(s),c=x.useRef(!1),u=x.useRef(null);if(x.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Te(me(s).label)))},[r.isSuccess,n,s]),x.useEffect(()=>{var v;r.isError&&((v=u.current)==null||v.focus())},[r.isError]),r.isSuccess)return e.jsx(U,{});const d=(p=l.data)!=null&&p.key.saved?l.data.key:null,m=i.trim().length>0,h=r.isPending||o.isPending,g=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:v=>{v.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(S,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:u,value:i,disabled:h,onChange:v=>{a(v.target.value),g()},placeholder:d?`Saved key ends in ${d.last4}. Paste to replace.`:t.keyPlaceholder,autoComplete:"off",spellCheck:!1}),r.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:r.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.getKeyUrl?e.jsxs("a",{href:t.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"ghost",disabled:!m&&d===null||h,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:!m||h,children:"Save key"})]})]}),h?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((y=o.result)==null?void 0:y.ok)===!0?e.jsx(U,{message:o.checkedSavedKey?"Your saved key works":"Key works"}):o.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o.result.message}):null]})}function As(s){const t=b(),n=z({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference()});return n.isPending?e.jsx(de,{"aria-label":"Loading model settings"}):n.isError?e.jsx("p",{role:"alert",children:"Couldn’t load model settings. Try again."}):e.jsx(Ks,{saved:n.data,...s},JSON.stringify(n.data))}function Ks({saved:s,onConnected:t,onSave:n}){var K,J,G,X,j,$,fe,pe,ge,ye,je,ve;const i=b(),a=D(),r=x.useId(),l=((K=s.inference)==null?void 0:K.source)??"api-key",[o,c]=x.useState(n&&l==="dorkos-credits"?"api-key":l),[u,d]=x.useState(((J=s.inference)==null?void 0:J.protocol)??"openai-chat-completions"),[m,h]=x.useState(((G=s.inference)==null?void 0:G.endpoint)??""),[g,p]=x.useState(((X=s.inference)==null?void 0:X.provider)??""),[y,v]=x.useState(((j=s.inference)==null?void 0:j.model)??""),[O,T]=x.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[I,w]=x.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[P,N]=x.useState(""),[L,E]=x.useState(null),k=z({queryKey:["doe-credits-models",u],queryFn:()=>i.getDoeCreditsModels(u),enabled:o==="dorkos-credits"}),q=o==="dorkos-credits"?(pe=k.data)==null?void 0:pe.models.find(f=>f.id===y):void 0,ee=s.hasKey&&((ge=s.inference)==null?void 0:ge.endpoint)===m&&s.inference.source==="api-key",V=R({mutationFn:async f=>{if(n)return n(f,P.trim()||null);o==="api-key"&&P.trim()?await i.storeDoeCredential(f,P.trim()):await i.setDoeInference(f),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{N("");for(const f of[["doe-inference"],F,M,es.all,ss.status()])a.invalidateQueries({queryKey:f});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:f=>E(n&&f instanceof Error&&f.message?f.message:"Couldn’t save model settings. Try again.")});function re(f){var ke,Ne;if(f.preventDefault(),E(null),P.trim().startsWith("sk-ant-oat")){E("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!P.trim()&&!ee){E("Enter an API key.");return}if(o==="dorkos-credits"&&(!q||!((ke=k.data)!=null&&ke.endpoint))){E("Link DorkOS credits and choose an available model.");return}const ae=ts.safeParse({source:o,protocol:u,provider:o==="dorkos-credits"?"dorkos":g,endpoint:o==="dorkos-credits"?(Ne=k.data)==null?void 0:Ne.endpoint:m,model:y,contextWindow:(q==null?void 0:q.contextWindow)??Number(O),maxOutputTokens:(q==null?void 0:q.maxOutputTokens)??Number(I)});if(!ae.success){E("Check the model, endpoint, and token limits.");return}V.mutate(ae.data)}const B="bg-background border-input focus-visible:ring-ring h-11 w-full rounded-md md:h-9 border px-3 text-sm focus-visible:ring-2";return e.jsxs("form",{onSubmit:re,className:"space-y-3","aria-label":"DorkOS model settings",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:B,value:o,onChange:f=>{c(f.target.value),v("")},children:[e.jsx("option",{value:"api-key",children:"My API key"}),e.jsx("option",{value:"local",children:"Local model"}),!n&&e.jsx("option",{value:"dorkos-credits",children:"DorkOS credits"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:B,value:u,onChange:f=>{d(f.target.value),o==="dorkos-credits"&&v("")},children:[e.jsx("option",{value:"openai-chat-completions",children:"OpenAI Chat Completions"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"})]})]}),o==="dorkos-credits"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:B,value:y,onChange:f=>v(f.target.value),disabled:k.isPending||!((ye=k.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=k.data)==null?void 0:je.models.map(f=>e.jsx("option",{value:f.id,children:f.displayName},f.id))]}),!((ve=k.data)!=null&&ve.endpoint)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link DorkOS credits in Settings to choose a model."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(_,{id:`${r}-service`,value:g,onChange:f=>p(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(_,{id:`${r}-endpoint`,type:"url",value:m,onChange:f=>h(f.target.value),required:!0}),o==="local"&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Use a loopback address. No API key is needed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(_,{id:`${r}-model`,value:y,onChange:f=>v(f.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(_,{id:`${r}-context`,type:"number",min:1,value:O,onChange:f=>T(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(_,{id:`${r}-output`,type:"number",min:1,value:I,onChange:f=>w(f.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:P,onChange:f=>N(f.target.value),autoComplete:"off"}),ee&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"API key saved. Leave blank to keep it."})]})]}),L&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:L}),e.jsx(C,{type:"submit",disabled:V.isPending,children:V.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ds={openai:"OpenAI",anthropic:"Anthropic"};function Ms(s){return Ds[s]??s}function Ts(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ms(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function qs(s){const t=b();return z({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function Fs(){const s=b(),t=D(),n=R({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]})}});return{connect:i=>n.mutate(i),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,errorMessage:n.isError?n.error.message??"Couldn’t connect to Ollama.":null}}const $e=["runtime-connect","opencode","direct"];function $s(){const s=b();return z({queryKey:$e,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function _s(){var i;const s=b(),t=R({mutationFn:({providerId:a,key:r,baseURL:l})=>s.checkProviderCredential(a,r.trim().length>0?r:null,(l==null?void 0:l.trim())||null),meta:{suppressErrorToast:!0}}),n=t.data??(t.isError?{ok:!1,reason:"unexpected",message:t.error.message||"Couldn’t check the key."}:null);return{check:a=>t.mutate(a),isPending:t.isPending,result:n,checkedSavedKey:n!==null&&(((i=t.variables)==null?void 0:i.key)??"").trim().length===0,reset:t.reset}}function Us(){var l,o,c;const s=b(),t=D(),[n,i]=x.useState(null),a=R({mutationFn:async({providerId:u,key:d,baseURL:m})=>{const h=(m==null?void 0:m.trim())||null;i("checking");const g=await s.checkProviderCredential(u,d.trim().length>0?d:null,h);return g.ok?(i("saving"),await s.storeProviderCredential(u,d,h),{saved:!0,message:null}):{saved:!1,message:g.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:u=>{u.saved&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[...$e]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:u=>{u.providerId.trim().length!==0&&a.mutate(u)},isPending:a.isPending,phase:n,isSuccess:((o=a.data)==null?void 0:o.saved)===!0,isError:a.isError||r,errorMessage:r?((c=a.data)==null?void 0:c.message)??null:a.isError?a.error.message??"Couldn’t save your key.":null,reset:a.reset}}function zs(s){const t=b();return z({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Qs(){var o,c;const s=b(),t=D(),[n,i]=x.useState(null),a=R({mutationFn:async u=>{i(null);const d=await s.pullOllamaModel(u,m=>i(m));return d.ok&&await s.updateConfig({runtimes:{opencode:{provider:qe}}}),d},onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{pull:u=>a.mutate(u),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Bs(){var o,c;const s=b(),t=D(),[n,i]=x.useState(null),a=R({mutationFn:()=>(i(null),s.provisionOllama(u=>i(u))),onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{provision:()=>a.mutate(),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t install Ollama.":null,progress:n,result:a.data}}const Gs="https://ollama.com/download",Ws="curl -fsSL https://ollama.com/install.sh | sh";function Ys({installMethod:s}){const t=Bs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Hs,{}),n?e.jsx(Vs,{provision:t}):e.jsx(Js,{}),e.jsx(Xs,{})]})}function Hs(){const s=Ke();return e.jsxs("div",{className:"space-y-1.5","data-testid":"ollama-explainer",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Run AI models on ",s]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Ollama is a free app that runs AI models on ",s,"."]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Nothing you type leaves ",s,"."]})]})}function Vs({provision:s}){var t,n,i;return s.isPending?e.jsx(A,{message:((t=s.progress)==null?void 0:t.message)??"Installing Ollama…"}):(n=s.result)!=null&&n.ok?(i=s.result.status)!=null&&i.running?e.jsx(A,{message:"Ollama is ready…"}):e.jsx("p",{className:"text-xs","data-testid":"ollama-installed-not-running",children:"Ollama isn’t running. Open the Ollama app to start it."}):s.isError?e.jsx(Q,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(C,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Js(){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-manual-install",children:[e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Installing Ollama needs administrator access. Run this in a terminal:"}),e.jsx(Cs,{command:Ws,copyLabel:"Copy the Ollama install command"})]})}function Xs(){return e.jsxs("a",{href:Gs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Or download Ollama from ollama.com ",e.jsx(Y,{className:"size-3"})]})}const Zs="https://ollama.com/library",et={"runs-well":{label:"Runs well on your machine",tone:"text-status-success-fg"},"may-be-slow":{label:"May be slow on your machine",tone:"text-status-warning-fg"},"too-large":{label:"Too large for your machine",tone:"text-destructive"}},st={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function tt({active:s,onConnected:t,onConnectDirectly:n}){var I,w,P,N,L,E;const i=qs(s),a=Fs(),r=Qs(),l=((I=i.data)==null?void 0:I.running)??!1,o=zs(l),[c,u]=x.useState(null),[d,m]=x.useState(null);x.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),x.useEffect(()=>{var k;(k=r.result)!=null&&k.ok&&(t==null||t(Pe))},[(w=r.result)==null?void 0:w.ok,t]);const h=k=>{u(k),a.connect(k)},g=k=>{m(k),r.pull(k)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Ys,{installMethod:(P=i.data)==null?void 0:P.installMethod});if(a.isSuccess)return t?null:e.jsx(U,{message:"Connected to Ollama"});if((N=r.result)!=null&&N.ok)return t?null:e.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"guided-pull-connected",children:[e.jsx(ue,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Connected:"}),e.jsx(ns,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const p=i.data,y=(p==null?void 0:p.installed)??[],v=((L=p==null?void 0:p.installed)==null?void 0:L.length)??(p==null?void 0:p.models.length)??0,O=((E=o.data)==null?void 0:E.models.some(k=>k.model.id===d))??!1,T=d!==null&&!O?d:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(nt,{count:v}),y.length>0&&e.jsx(rt,{installed:y,connect:a,connectingId:c,onUse:h}),e.jsx(at,{catalogQuery:o,pull:r,pullingId:d,onGet:g}),e.jsx(it,{pull:r,activePull:T,onSubmit:g}),e.jsx(ot,{}),n&&e.jsxs("button",{type:"button",onClick:n,"data-testid":"local-connect-directly",className:"focus-ring text-muted-foreground hover:text-foreground block rounded-md text-left text-xs transition-colors",children:["Using LM Studio or another server? ",e.jsx("span",{className:"underline",children:"Connect it directly"})]})]})}function nt({count:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-xs","data-testid":"ollama-status-line",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-emerald-500","aria-hidden":!0}),e.jsxs("span",{children:["Ollama is running · ",s," ",s===1?"model":"models"," installed"]})]})}function _e({verdict:s,explanation:t}){const n=et[s];return e.jsxs("div",{"data-testid":"ollama-verdict","data-verdict":s,children:[e.jsx("p",{className:H("text-xs font-medium",n.tone),children:n.label}),e.jsx("p",{className:"text-muted-foreground/80 text-2xs leading-snug",children:t})]})}function Ue({tier:s}){return e.jsx(De,{size:"xs",variant:"outline",className:"font-normal",children:st[s]})}function rt({installed:s,connect:t,connectingId:n,onUse:i}){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-installed",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Installed"}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>{const r=n===a.id&&t.isPending,l=n===a.id&&t.isError,o=()=>i(a.id);let c=e.jsx(C,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(Q,{message:t.errorMessage??"Couldn’t connect to Ollama.",onRetry:o})),e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"ollama-installed-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:a.id}),a.assessment.model.tier&&e.jsx(Ue,{tier:a.assessment.model.tier})]}),e.jsx(_e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function at({catalogQuery:s,pull:t,pullingId:n,onGet:i}){var r;if(s.isPending)return e.jsx(A,{message:"Checking which models fit your machine…"});const a=((r=s.data)==null?void 0:r.models)??[];return s.isError||a.length===0?null:e.jsxs("div",{className:"space-y-2","data-testid":"ollama-shelf",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add a model"}),e.jsx("ul",{className:"space-y-1.5",children:a.map(({model:l,verdict:o,explanation:c})=>{const u=n===l.id,d=()=>i(l.id);return u&&(t.isPending||t.isError)?e.jsxs("li",{className:"border-border rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:l.label}),t.isPending?e.jsx(ze,{progress:t.progress}):e.jsx(Q,{message:t.errorMessage??"Couldn’t download the model.",onRetry:d})]},l.id):e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:l.label}),l.tier&&e.jsx(Ue,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx(_e,{verdict:o,explanation:c})]}),e.jsx(C,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:d,children:"Get"})]},l.id)})})]})}function it({pull:s,activePull:t,onSubmit:n}){const[i,a]=x.useState(""),r=i.trim(),l=gs.test(r);if(t&&s.isPending)return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Downloading ",t,"…"]}),e.jsx(ze,{progress:s.progress})]});const o=c=>{c.preventDefault(),l&&n(r)};return e.jsxs("form",{onSubmit:o,className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"ollama-pull-tag",className:"text-xs font-normal",children:"Download any model by name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{id:"ollama-pull-tag","data-testid":"ollama-pull-by-name",value:i,onChange:c=>a(c.target.value),placeholder:"qwen2.5-coder:32b","aria-invalid":r.length>0&&!l}),e.jsx(C,{type:"submit",size:"sm",disabled:!l||s.isPending,children:"Download"})]}),r.length>0&&!l&&e.jsxs("p",{className:"text-muted-foreground text-2xs",children:["Use a tag like ",e.jsx("code",{className:"text-2xs",children:"qwen2.5-coder:32b"}),"."]}),t&&s.isError&&e.jsx(Q,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function ot(){return e.jsxs("a",{href:Zs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Browse the library ",e.jsx(Y,{className:"size-3"})]})}function ze({progress:s}){const t=Ae(),n=s==null?void 0:s.percent,i=(s==null?void 0:s.status)??"Starting download…";return e.jsxs("div",{className:"space-y-2","data-testid":"guided-pull-progress",children:[e.jsx("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:n===void 0?e.jsx(te.div,{className:"bg-primary/70 h-full w-1/3 rounded-full",animate:t?{}:{x:["-100%","300%"]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"}}):e.jsx(te.div,{className:"bg-primary h-full rounded-full",initial:!1,animate:{width:`${Math.min(100,Math.max(0,n))}%`},transition:t?{duration:0}:{duration:.3,ease:"easeOut"},"data-testid":"guided-pull-bar"})}),e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.jsx(de,{size:"xs",className:H("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function lt(){var r,l,o;const s=b(),t=D(),n=R({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))}}),i=n.isError||((r=n.data)==null?void 0:r.ok)===!1,a=n.isError?n.error.message:((l=n.data)==null?void 0:l.error)??null;return{store:c=>{c.trim().length!==0&&n.mutate(c)},isPending:n.isPending,isSuccess:((o=n.data)==null?void 0:o.ok)===!0,isError:i,errorMessage:i?a??"Couldn’t save the OpenRouter key.":null}}function ct(){var h,g;const s=b(),t=D(),[n,i]=x.useState(null),[a,r]=x.useState(null),l=R({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:p,state:y})=>{if(!rs(p)){r("Couldn’t open the OpenRouter sign-in page.");return}i(y)},onError:p=>r(p.message??"Couldn’t start OpenRouter sign-in.")}),o=z({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="pending"?1500:!1},refetchOnWindowFocus:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="error"}}),c=(h=o.data)==null?void 0:h.status;x.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const u=l.isPending||n!==null&&c==="pending",d=!!a||c==="error",m=d?a??((g=o.data)==null?void 0:g.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:u,isSuccess:c==="connected",isError:d,errorMessage:m}}const dt="https://openrouter.ai/keys";function ut({onConnected:s}){const[t,n]=x.useState(""),i=lt(),a=ct(),r=i.isSuccess||a.isSuccess;return x.useEffect(()=>{r&&(s==null||s(Es))},[r,s]),r?e.jsx(U,{message:"Connected to OpenRouter"}):e.jsxs("div",{className:"space-y-4","data-testid":"openrouter-gateway",children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:"Sign in to OpenRouter in the new tab…"}):a.isError?e.jsx(Q,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",className:"w-full",onClick:a.begin,children:"Connect OpenRouter"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Makes a limited key for you."})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),i.isPending?e.jsx(A,{message:"Checking your OpenRouter key…"}):e.jsxs("form",{className:"space-y-2",onSubmit:l=>{l.preventDefault(),i.store(t)},children:[e.jsx(S,{htmlFor:"openrouter-key",className:"text-xs",children:"OpenRouter key"}),e.jsx(ne,{id:"openrouter-key",value:t,onChange:l=>n(l.target.value),placeholder:"sk-or-…",autoComplete:"off",spellCheck:!1}),i.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:i.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("a",{href:dt,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an OpenRouter key ",e.jsx(Y,{className:"size-3"})]}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function Z(s){return W.find(t=>t.id===s)}function mt(s){var t;return((t=Z(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=W.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??W[0].defaultBaseURL}function Qe(s){return W.some(t=>t.id===s.providerId)}function ie(s){return Qe(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function xt({onConnected:s}){const t=$s();return t.isError&&!t.data?e.jsx(Q,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ht,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ht({setup:s,onConnected:t}){var X;const n=Qe(s)?s:null,[i,a]=x.useState(()=>ie(s)),[r,l]=x.useState(""),[o,c]=x.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=Z(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[u,d]=x.useState(()=>{var $;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=Z(j))==null?void 0:$.defaultBaseURL)}),m=Us(),h=_s(),g=Z(i),p=mt(i),y=n!=null&&n.key.saved&&n.providerId===p?n.key.last4:null,v=o.trim(),O=i===se,T=!O||v.length>0,I=ce(p),w=v||I,P=w===I?"":w,N=n===null?null:n.baseURL??ce(n.providerId),L=p!==((n==null?void 0:n.providerId)??null)||w!==N,E=r.trim().length>0,q=(E||y!==null&&!L)&&T,ee=E&&T,V=!E&&y!==null&&L,re=w.startsWith("http://"),B={providerId:p,key:r,baseURL:P},K=m.isPending||h.isPending,J=x.useRef(null),G=()=>{h.reset(),m.reset()};return x.useEffect(()=>{m.isSuccess&&(t==null||t(ws))},[m.isSuccess,t]),x.useEffect(()=>{var j;m.isError&&((j=J.current)==null||j.focus())},[m.isError]),m.isSuccess?e.jsx(U,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),h.reset(),m.connect(B)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(as,{value:i,disabled:K,onValueChange:j=>{var $;a(j),c((($=Z(j))==null?void 0:$.defaultBaseURL)??""),G()},children:[e.jsx(is,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(os,{})}),e.jsxs(ls,{children:[W.map(j=>e.jsx(be,{value:j.id,children:j.label},j.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(O||u)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(S,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!O&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(_,{id:"direct-provider-base-url",value:o,disabled:K,onChange:j=>{c(j.target.value),G()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!O&&!u&&e.jsx("button",{type:"button",onClick:()=>d(!0),disabled:K,"data-testid":"direct-provider-advanced",className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Advanced"}),re&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-insecure",children:"This address isn’t encrypted. Your key travels in the open."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:J,value:r,disabled:K,onChange:j=>{l(j.target.value),G()},placeholder:y===null?(g==null?void 0:g.keyPlaceholder)??W[0].keyPlaceholder:`Saved key ends in ${y}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),m.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:m.errorMessage}),V&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-repaste",children:"Paste your key again to change the address."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g===void 0?e.jsx("span",{}):e.jsxs("a",{href:g.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"outline",disabled:!q||K,"data-testid":"direct-provider-test",onClick:()=>{m.reset(),h.reset(),h.check(B)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",disabled:!ee||K,children:"Save & connect"})]})]}),K?e.jsx(A,{message:m.phase==="saving"?"Saving…":"Checking your key…"}):((X=h.result)==null?void 0:X.ok)===!0?e.jsx(U,{message:h.checkedSavedKey?"Your saved key works":"Key works"}):h.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:h.result.message}):null]})}function ft({currentProvider:s,onConnected:t}){const[n,i]=x.useState("choose"),a=pt();if(n==="choose")return e.jsx(gt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(ut,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(tt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(xt,{onConnected:t})})}function pt(){return{cloud:{step:"cloud",title:"Best models, zero setup",description:"Claude, GPT, Gemini and 300+ more, in the cloud.",sub:"One OpenRouter account covers them all. Pay for what you use.",tradeOff:"Your prompts and code are sent to the model’s provider.",recommended:!0},local:{step:"local",title:"Private and free, on your computer",description:`Models run on ${Ke()}. Nothing you type ever leaves it.`,sub:"Runs Quick helpers and Solid coders. Frontier models stay cloud-only.",tradeOff:"Smaller models: good for edits and quick help."},direct:{step:"direct",title:"Use your own API key",stepTitle:"Your own API key",description:"Anthropic, OpenAI, or any OpenAI-compatible server, like LM Studio.",sub:"",quiet:!0}}}function gt({sources:s,onChoose:t,currentProvider:n}){return e.jsxs("div",{className:"space-y-2","data-testid":"opencode-power-sources",children:[n&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"opencode-current-source",children:["Currently: ",Ts(n)]}),Object.values(s).map(i=>e.jsx(yt,{source:i,onChoose:t},i.step))]})}function yt({source:s,onChoose:t}){return e.jsxs("button",{type:"button",onClick:()=>t(s.step),"data-testid":`power-source-${s.step}`,className:H("card-interactive focus-ring group flex w-full items-start gap-3 rounded-lg border p-3 text-left",s.recommended?"border-primary/40 bg-card shadow-soft":"border-border bg-card shadow-soft",s.quiet&&"shadow-none"),children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.title}),s.recommended&&e.jsx(De,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(ds,{className:"text-muted-foreground/60 mt-0.5 size-4 shrink-0"})]})}function oe({source:s,onBack:t,children:n}){const i=!!(s.sub||s.tradeOff);return e.jsxs("div",{className:"space-y-3","data-testid":"opencode-connect-step",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:t,className:"focus-ring text-muted-foreground hover:text-foreground -ml-1 inline-flex items-center gap-1 rounded-md px-1 py-0.5 text-xs transition-colors","data-testid":"connect-step-back",children:[e.jsx(cs,{className:"size-3.5"}),"Back"]}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{className:"text-sm font-medium",children:s.stepTitle??s.title})]}),i&&e.jsxs("div",{className:"space-y-1","data-testid":"connect-step-details",children:[s.sub&&e.jsx("p",{className:"text-muted-foreground/80 text-xs",children:s.sub}),s.tradeOff&&e.jsxs("p",{className:"text-muted-foreground/70 text-2xs leading-snug",children:[e.jsx("span",{className:"font-medium",children:"Trade-off:"})," ",s.tradeOff]})]}),n]})}function jt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=ys(),r=Ps(s),l=us(),o=ms(),c=xs([s]);if(s==="doe")return a?e.jsx(As,{onConnected:i}):e.jsx(Oe,{});const u=r==="lead"&&l!==null,d=a?t.kind==="provider-picker"?e.jsx(ft,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Is,{type:s,onConnected:i,asOtherWay:u}):null:e.jsx(Oe,{});if(d===null)return null;const m=me(s).label,h=t.kind==="provider-picker";if(r==="on-credits")return e.jsxs("div",{className:"space-y-3","data-testid":`credits-ready-${s}`,children:[e.jsxs("div",{role:"status",children:[e.jsxs("p",{className:"text-status-success-fg flex items-center gap-1.5 text-sm font-medium",children:[e.jsx(ue,{className:"size-3.5","aria-hidden":!0}),"You’re ready"]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["New work on ",m," runs on your DorkOS credits.",c.map(p=>` ${p}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:d})]});const g=p=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:p,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Rs(m))}});return u?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[g(!0),e.jsx(le,{children:d}),e.jsx(Os,{ollama:h,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[d,e.jsx(le,{children:g(!1)})]}):d}function le({collapsed:s=!1,children:t}){const[n,i]=x.useState(!s);return s?e.jsxs(Re,{open:n,onOpenChange:i,children:[e.jsxs(Ie,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(hs,{className:H("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Le,{className:"mt-3",children:t})]}):e.jsxs("section",{className:"space-y-2","aria-label":"Other ways",children:[e.jsx("p",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:"Other ways"}),t]})}const Pt=s=>e.jsx(jt,{...s});export{Ot as C,Cs as D,Os as K,Oe as R,bs as a,ys as b,St as c,Ts as d,Ps as e,As as f,Ss as g,Pt as r,Ct as u};
|
package/dist/client/assets/{RuntimeSetupDialog-BSb5iK2A.js → RuntimeSetupDialog-DQss2qqJ.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,bq as K,dJ as $,dK as Y,j as e,dL as W,dM as G,bp as Q,bn as C,bm as I,dN as J,bo as V,dO as X,dP as Z,dQ as q,bv as ee,dR as te,dS as ne,dT as M,cT as se,cU as re,cW as ae,cX as oe,cY as ie,dU as ce,dV as D,J as E,B as S,dW as z,dX as le,G as k,O as de,Q as ue,T as fe,U as me,dY as xe,aK as pe,a9 as ve,bM as he,ar as U,x as ge,by as Ce}from"./index-DSYz85aL.js";import{I as be}from"./inline-code-BjkmgK0M.js";import{l as je}from"./list-runtime-types-DvfLx6v2.js";import{D as O,u as Re,C as Ne}from"./RuntimeConnectFlow-BsZsQZS9.js";var Pe=Object.defineProperty,b=(t,n)=>Pe(t,"name",{value:n,configurable:!0}),H,_="HoverCard",[A,Xe]=K(_,[$]),L=$(),[Se,w]=A(_),Te=b(t=>{const{__scopeHoverCard:n,children:r,open:a,defaultOpen:s,onOpenChange:c,openDelay:o=700,closeDelay:m=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,f]=Y({prop:a,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>f(!0),o)},[o,f]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>f(!1),m))},[m,f]),h=l.useCallback(()=>f(!1),[f]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(Se,{scope:n,open:u,onOpenChange:f,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(W,{...x,children:r})})},"HoverCard"),we="HoverCardTrigger",He=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,...s}=n,c=w(we,a),o=L(a);return e.jsx(G,{asChild:!0,...o,children:e.jsx(Q.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,T(c.onOpen)),onPointerLeave:C(n.onPointerLeave,T(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,m=>m.preventDefault())})})},"HoverCardTrigger")),F="HoverCardPortal",[ye,De]=A(F,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:a,container:s}=t,c=w(F,n);return e.jsx(ye,{scope:n,forceMount:r,children:e.jsx(I,{present:r||c.open,children:e.jsx(J,{asChild:!0,container:s,children:a})})})},"HoverCardPortal"),y="HoverCardContent",ke=l.forwardRef(b(function(n,r){const a=De(y,n.__scopeHoverCard),{forceMount:s=a.forceMount,...c}=n,o=w(y,n.__scopeHoverCard);return e.jsx(I,{present:s||o.open,children:e.jsx(Oe,{"data-state":o.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,T(o.onOpen)),onPointerLeave:C(n.onPointerLeave,T(o.onClose)),ref:r})})},"HoverCardContent")),Oe=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:o,onInteractOutside:m,...x}=n,i=w(y,a),p=L(a),v=l.useRef(null),g=V(r,v),[u,f]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return H=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=H,d.style.webkitUserSelect=H}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{f(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&B(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(X,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:m,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(o,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(Z,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&f(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function T(t){return n=>n.pointerType==="touch"?void 0:t()}b(T,"excludeTouch");function B(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(a=>a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(B,"getTabbableNodes");var _e=Te,Le=He,Ue=Ee,$e=ke;function Ze({...t}){return e.jsx(_e,{"data-slot":"hover-card",...t})}function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card-trigger",...t})}function et({className:t,align:n="center",sideOffset:r=4,...a}){const s=q();return e.jsx(Ue,{"data-slot":"hover-card-portal",container:s,children:e.jsx($e,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:ee("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-dui-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden motion-reduce:animate-none!",t),...a})})}function Ie(t,n,r){return t?[t]:n||je(r)}function Me({runtime:t,types:n,requirements:r,registeredTypes:a=[],onRecheck:s,isRechecking:c=!1,renderConnect:o}){const m=z(),x=Ie(t,n,a);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Ae,{type:i,requirements:r,registered:a.includes(i),renderConnect:o},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(le,{className:k("size-3.5",c&&!m&&"animate-spin")}),"Check again"]})]})]})}function ze(t,n,r){return r?xe(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:pe.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${ve(t)}`}}:null:null}function Ae({type:t,requirements:n,registered:r,renderConnect:a}){var R,N;const s=D(t),c=s.icon,o=n==null?void 0:n.runtimes[t],m=M(n,t,r),x=m.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?ze(t,o==null?void 0:o.provider,!!a):null,f=o==null?void 0:o.dependencies.find(P=>P.status!=="satisfied"&&P.installHint),d=(f==null?void 0:f.installHint)??((R=s.setup)==null?void 0:R.installCommand),j=(f==null?void 0:f.infoUrl)??((N=s.setup)==null?void 0:N.infoUrl),h=!!o||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(E,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[a==null?void 0:a({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),!x&&m.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Fe,{type:t,connect:m.connect,renderConnect:a,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(de,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(ue,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(fe,{className:k("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(me,{className:"mt-3 space-y-3",children:o?o.dependencies.map(P=>e.jsx(Ye,{dep:P},P.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(be,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Fe({type:t,connect:n,renderConnect:r,installCommand:a,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Be,{type:t,label:n.label,installCommand:a,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Be({type:t,label:n,installCommand:r,installInfoUrl:a}){const s=D(t),{provision:c,isPending:o,isError:m,errorMessage:x,progress:i,result:p}=Re(t);return o||p!=null&&p.ok?e.jsx(Ke,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):m?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:a,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(Ne,{command:r,runtimeLabel:s.label})]})}function Ke({message:t}){const n=z();return e.jsxs(U.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(ge,{size:"xs",className:k("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(Ce,{mode:"wait",children:e.jsx(U.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ye({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(E,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(he,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function tt({runtime:t,open:n,onOpenChange:r,renderConnect:a,onRuntimeReady:s,showConnectSuccess:c=!1}){const o=te(),{data:m}=ne(),x=t?D(t):null,i=M(o.data,t??"",m?t!==void 0&&t in m.capabilities:!0),p=o.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,f]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&f(null),d.current=n},[n]);const j=a&&(c?h=>a({...h,onConnected:R=>{var N;(N=h.onConnected)==null||N.call(h,R),f(R)}}):a);return e.jsx(se,{open:n,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(ae,{children:[e.jsx(oe,{children:x?x.label:"Your runtimes"}),e.jsx(ie,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(ce,{children:u?e.jsx(We,{success:u,onDone:()=>r(!1)}):e.jsx(Me,{runtime:t,requirements:o.data,registeredTypes:m?Object.keys(m.capabilities):void 0,onRecheck:()=>void o.refetch(),isRechecking:o.isFetching,renderConnect:j})})]})})}function We({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(E,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{Ze as H,tt as R,qe as a,et as b,Me as c};
|
|
1
|
+
import{r as l,bq as K,dJ as $,dK as Y,j as e,dL as W,dM as G,bp as Q,bn as C,bm as I,dN as J,bo as V,dO as X,dP as Z,dQ as q,bv as ee,dR as te,dS as ne,dT as M,cT as se,cU as re,cW as ae,cX as oe,cY as ie,dU as ce,dV as D,J as E,B as S,dW as z,dX as le,G as k,O as de,Q as ue,T as fe,U as me,dY as xe,aK as pe,a9 as ve,bM as he,ar as U,x as ge,by as Ce}from"./index-BSNB2iOV.js";import{I as be}from"./inline-code-Df1J1tQV.js";import{l as je}from"./list-runtime-types-C4Ik3n5A.js";import{D as O,u as Re,C as Ne}from"./RuntimeConnectFlow-DJMtgkZF.js";var Pe=Object.defineProperty,b=(t,n)=>Pe(t,"name",{value:n,configurable:!0}),H,_="HoverCard",[A,Xe]=K(_,[$]),L=$(),[Se,w]=A(_),Te=b(t=>{const{__scopeHoverCard:n,children:r,open:a,defaultOpen:s,onOpenChange:c,openDelay:o=700,closeDelay:m=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,f]=Y({prop:a,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>f(!0),o)},[o,f]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>f(!1),m))},[m,f]),h=l.useCallback(()=>f(!1),[f]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(Se,{scope:n,open:u,onOpenChange:f,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(W,{...x,children:r})})},"HoverCard"),we="HoverCardTrigger",He=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,...s}=n,c=w(we,a),o=L(a);return e.jsx(G,{asChild:!0,...o,children:e.jsx(Q.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,T(c.onOpen)),onPointerLeave:C(n.onPointerLeave,T(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,m=>m.preventDefault())})})},"HoverCardTrigger")),F="HoverCardPortal",[ye,De]=A(F,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:a,container:s}=t,c=w(F,n);return e.jsx(ye,{scope:n,forceMount:r,children:e.jsx(I,{present:r||c.open,children:e.jsx(J,{asChild:!0,container:s,children:a})})})},"HoverCardPortal"),y="HoverCardContent",ke=l.forwardRef(b(function(n,r){const a=De(y,n.__scopeHoverCard),{forceMount:s=a.forceMount,...c}=n,o=w(y,n.__scopeHoverCard);return e.jsx(I,{present:s||o.open,children:e.jsx(Oe,{"data-state":o.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,T(o.onOpen)),onPointerLeave:C(n.onPointerLeave,T(o.onClose)),ref:r})})},"HoverCardContent")),Oe=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:o,onInteractOutside:m,...x}=n,i=w(y,a),p=L(a),v=l.useRef(null),g=V(r,v),[u,f]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return H=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=H,d.style.webkitUserSelect=H}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{f(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&B(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(X,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:m,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(o,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(Z,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&f(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function T(t){return n=>n.pointerType==="touch"?void 0:t()}b(T,"excludeTouch");function B(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(a=>a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(B,"getTabbableNodes");var _e=Te,Le=He,Ue=Ee,$e=ke;function Ze({...t}){return e.jsx(_e,{"data-slot":"hover-card",...t})}function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card-trigger",...t})}function et({className:t,align:n="center",sideOffset:r=4,...a}){const s=q();return e.jsx(Ue,{"data-slot":"hover-card-portal",container:s,children:e.jsx($e,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:ee("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-dui-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden motion-reduce:animate-none!",t),...a})})}function Ie(t,n,r){return t?[t]:n||je(r)}function Me({runtime:t,types:n,requirements:r,registeredTypes:a=[],onRecheck:s,isRechecking:c=!1,renderConnect:o}){const m=z(),x=Ie(t,n,a);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Ae,{type:i,requirements:r,registered:a.includes(i),renderConnect:o},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(le,{className:k("size-3.5",c&&!m&&"animate-spin")}),"Check again"]})]})]})}function ze(t,n,r){return r?xe(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:pe.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${ve(t)}`}}:null:null}function Ae({type:t,requirements:n,registered:r,renderConnect:a}){var R,N;const s=D(t),c=s.icon,o=n==null?void 0:n.runtimes[t],m=M(n,t,r),x=m.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?ze(t,o==null?void 0:o.provider,!!a):null,f=o==null?void 0:o.dependencies.find(P=>P.status!=="satisfied"&&P.installHint),d=(f==null?void 0:f.installHint)??((R=s.setup)==null?void 0:R.installCommand),j=(f==null?void 0:f.infoUrl)??((N=s.setup)==null?void 0:N.infoUrl),h=!!o||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(E,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[a==null?void 0:a({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),!x&&m.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Fe,{type:t,connect:m.connect,renderConnect:a,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(de,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(ue,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(fe,{className:k("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(me,{className:"mt-3 space-y-3",children:o?o.dependencies.map(P=>e.jsx(Ye,{dep:P},P.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(be,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Fe({type:t,connect:n,renderConnect:r,installCommand:a,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Be,{type:t,label:n.label,installCommand:a,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Be({type:t,label:n,installCommand:r,installInfoUrl:a}){const s=D(t),{provision:c,isPending:o,isError:m,errorMessage:x,progress:i,result:p}=Re(t);return o||p!=null&&p.ok?e.jsx(Ke,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):m?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:a,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(Ne,{command:r,runtimeLabel:s.label})]})}function Ke({message:t}){const n=z();return e.jsxs(U.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(ge,{size:"xs",className:k("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(Ce,{mode:"wait",children:e.jsx(U.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ye({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(E,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(he,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function tt({runtime:t,open:n,onOpenChange:r,renderConnect:a,onRuntimeReady:s,showConnectSuccess:c=!1}){const o=te(),{data:m}=ne(),x=t?D(t):null,i=M(o.data,t??"",m?t!==void 0&&t in m.capabilities:!0),p=o.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,f]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&f(null),d.current=n},[n]);const j=a&&(c?h=>a({...h,onConnected:R=>{var N;(N=h.onConnected)==null||N.call(h,R),f(R)}}):a);return e.jsx(se,{open:n,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(ae,{children:[e.jsx(oe,{children:x?x.label:"Your runtimes"}),e.jsx(ie,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(ce,{children:u?e.jsx(We,{success:u,onDone:()=>r(!1)}):e.jsx(Me,{runtime:t,requirements:o.data,registeredTypes:m?Object.keys(m.capabilities):void 0,onRecheck:()=>void o.refetch(),isRechecking:o.isFetching,renderConnect:j})})]})})}function We({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(E,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{Ze as H,tt as R,qe as a,et as b,Me as c};
|