dorkos 0.126.3 → 0.127.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +7771 -7141
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-ycWTfXI8.js → AboutPage-BnnwvwU1.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-DBecAo4-.js → ActivityErrorState-DW-plne9.js} +1 -1
- package/dist/client/assets/{ActivityPage-CGuIeDGm.js → ActivityPage-BMrtNC9t.js} +1 -1
- package/dist/client/assets/{ActivityRow-BRiUvjHA.js → ActivityRow-BnBDxJqK.js} +1 -1
- package/dist/client/assets/{AdapterIcon-z6z9LKwd.js → AdapterIcon-J2UUIfEX.js} +1 -1
- package/dist/client/assets/AdapterSetupWizard-MDV6zwYC.js +2 -0
- package/dist/client/assets/{AgentOptionRow-BLuSwpNh.js → AgentOptionRow-Dj2MlE6E.js} +1 -1
- package/dist/client/assets/{AgentPicker-DazquIgR.js → AgentPicker-D6MsFN_H.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-BoRmxLKy.js → AgentRequestCard-BTyuNOhU.js} +1 -1
- package/dist/client/assets/{AppearancePage-BMiVpe48.js → AppearancePage-DJfJUAkw.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-BHIrnfPf.js → ApplyToOverridesDialog-Akw0_458.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-CjN8lCWI.js → AttentionSignalRow-Cx9-sStN.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BMBnO0fv.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CRlmlore.js} +3 -3
- package/dist/client/assets/BindingDialog-ZAX-h6D4.js +1 -0
- package/dist/client/assets/{BlintzCanvas-Dd3bC9vw.js → BlintzCanvas-fEMJgpNx.js} +3 -3
- package/dist/client/assets/{CanvasCsvContent-B2S75f6B.js → CanvasCsvContent-CUoIFG7g.js} +3 -3
- package/dist/client/assets/{CanvasFileContent-CVSfg4MO.js → CanvasFileContent-Cg2jcXse.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-CNmJsBTS.js → CanvasModel3dContent-BL-UiHAj.js} +2 -2
- package/dist/client/assets/ChannelComposer-BHxXoQwT.js +44 -0
- package/dist/client/assets/{ChatAppsOff-D7anOG3n.js → ChatAppsOff-CSSu_yVC.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-CfOmRCky.js → CodeMirrorDiff-dfcDpguR.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-Cyz227_1.js → CodeMirrorEditor-C1YQ35ki.js} +1 -1
- package/dist/client/assets/{CommitmentList-DKo1Fb1A.js → CommitmentList-B6RG_hWB.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-DIcEZ2ka.js → CommitmentsPage-CDFvo1lt.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-Ck7rJ-SP.js → ComputerResourceView-vJ8UfRNm.js} +1 -1
- package/dist/client/assets/{ComputerViewer-Dw_VpNjD.js → ComputerViewer-BTqPuZyh.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-CETLVH7o.js → ConnectionAccessLists-DPnmOuiA.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-ZVWDffcl.js → ConnectionsPage-CSHnGkha.js} +2 -2
- package/dist/client/assets/{ConventionPage-DkJ91wrN.js → ConventionPage-C6WsAvm4.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-FbJo1Qc0.js → ExtensionPageRoute-CGjw2Cwy.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DCLR3iKw.js → FloatingTanStackRouterDevtools-CqogiFob-CKlmwuIc.js} +1 -1
- package/dist/client/assets/{ForwardConsentHost-Buy5XlH7.js → ForwardConsentHost-D8rVtTRp.js} +1 -1
- package/dist/client/assets/HandlePage-BciCIffv.js +1 -0
- package/dist/client/assets/{HeartbeatPage-GXBEcZoJ.js → HeartbeatPage-DQImR4dY.js} +1 -1
- package/dist/client/assets/{KeyEntry-g2VQ33KW.js → KeyEntry-BerpQFQT.js} +1 -1
- package/dist/client/assets/{LexicalField-CLd77PuB.js → LexicalField-CkcKNJGL.js} +1 -1
- package/dist/client/assets/{ManagesPage-qCwzJ4Cx.js → ManagesPage-CV4xieFk.js} +1 -1
- package/dist/client/assets/{Marketplace-DdkdIVPQ.js → Marketplace-Cp0e4Nv8.js} +4 -4
- package/dist/client/assets/{MarketplaceSourcesView-D44G21ff.js → MarketplaceSourcesView-ZBNnVSuv.js} +1 -1
- package/dist/client/assets/{McpAppFrame-DVNWJHrn.js → McpAppFrame-BtKAUDBg.js} +2 -2
- package/dist/client/assets/{McpSigninBody-BO0OkvOw.js → McpSigninBody-DjGrp_sO.js} +1 -1
- package/dist/client/assets/{Model3dViewer-Cvcyx2yv.js → Model3dViewer-BSX1QGsE.js} +1 -1
- package/dist/client/assets/NamePage-tBV32PJI.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-C_hXtliM.js → NewDirectMessageMenu-DTQ7vFsa.js} +1 -1
- package/dist/client/assets/{NotificationsPage-DP4HAVMA.js → NotificationsPage-q7BDVKOz.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-0Mkl8abo.js → OpenMeshSwitch-aAMKDAyc.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-BRftJqRq.js → OperatorIdentityForm-CCAvadEZ.js} +1 -1
- package/dist/client/assets/{PermissionHistory-Czl5PWN3.js → PermissionHistory-_8m4ohGq.js} +1 -1
- package/dist/client/assets/{PermissionsPage-DAsbrl6Q.js → PermissionsPage-DHl8sCfQ.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-liTJ0Lns.js → PersonalityPopover-DOql0nWB.js} +1 -1
- package/dist/client/assets/PhotoPage-DtX2GEvQ.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-DcD1EY2c.js → PreviewRefusedNotice-BfvSYL-w.js} +1 -1
- package/dist/client/assets/{ProfileFields-Bi_AfHOE.js → ProfileFields-CX2mdPAV.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-BIbOulLu.js → ProfilePanelContainer-Cj_57NEG.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-BadkFi4V.js → ProfileRolePicker-D7F0PDw9.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-C653MlaU.js → PromptSuggestionChips-BopMvYe7.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-dIbt6aes.js → ReportsToPopover-CG_hjT_U.js} +1 -1
- package/dist/client/assets/{RoomSurface-CssMcozl.js → RoomSurface-Mt3dk4_6.js} +1 -1
- package/dist/client/assets/{RoomsPage-CxwTRRNu.js → RoomsPage-ByHhS_HA.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-lp8n4lgI.js → RunsOnPopover-DS8_Au0B.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-hhvWVRMu.js +1 -0
- package/dist/client/assets/{RuntimeSetupDialog-E6f7Rd2W.js → RuntimeSetupDialog-NKy3mLEH.js} +1 -1
- package/dist/client/assets/SeenDevices-65oxnxk6.js +19 -0
- package/dist/client/assets/{SessionsPage-BNZTufty.js → SessionsPage-WbWf0huR.js} +1 -1
- package/dist/client/assets/SettingsDialog-e33ltTb6.js +12 -0
- package/dist/client/assets/{SkillsPage-DiqUOZup.js → SkillsPage-Cj3XrV8s.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-5gb-f-Uo.js → TaskDialogWrapper-DJAGQuab.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-g-CavcMv.js → TasksEmptyState-DNI1C274.js} +2 -2
- package/dist/client/assets/{TasksPage-BexV_pxB.js → TasksPage-Dc1j_X1K.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-BFYqGL-G.js → TeamComputerEntry-DWenh1bP.js} +1 -1
- package/dist/client/assets/{ToolsPage-Dxt6qOdF.js → ToolsPage-CXKq_axq.js} +2 -2
- package/dist/client/assets/{TopologyGraph-Cx_6gdbV.js → TopologyGraph-DgTGLoaA.js} +3 -3
- package/dist/client/assets/TourHost-C4KKDX9k.js +1 -0
- package/dist/client/assets/{UnlinkDialog-fgubvOUd.js → UnlinkDialog-GfsbP91q.js} +1 -1
- package/dist/client/assets/{UnreadDivider-BoLcTO_Z.js → UnreadDivider-C52_nmrB.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-CgRMeAEO.js → WidgetErrorCard-BZkAK-Ke.js} +3 -3
- package/dist/client/assets/{WithheldExtensionsNotice-CFHBDyIh.js → WithheldExtensionsNotice-Dt51QZLT.js} +1 -1
- package/dist/client/assets/{WorkView-5jzcnod5.js → WorkView-YozVoXhb.js} +15 -15
- package/dist/client/assets/{_shell-DFfXd1ys.js → _shell-BScdINMH.js} +2 -2
- package/dist/client/assets/{_shell._home-D2GJeGbi.js → _shell._home-CUusDXBM.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-DRXBBtAq.js → _shell._home.activity-DPjJ1_vZ.js} +1 -1
- package/dist/client/assets/_shell._home.index-CTBWy5Au.js +3 -0
- package/dist/client/assets/{_shell._home.tasks-Cr4gak8T.js → _shell._home.tasks-DWFh5Qbq.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-DbWciI1g.js → _shell._home.workspaces-DWjB1sCd.js} +1 -1
- package/dist/client/assets/{_shell.channels-C31Txlqh.js → _shell.channels-C6v3yOzH.js} +1 -1
- package/dist/client/assets/_shell.connections-jXaP35mN.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-CQc7aVrV.js → _shell.feedback-requests-CyV-aboj.js} +1 -1
- package/dist/client/assets/_shell.marketplace-Cp2Udmlv.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-Dg0YgG-u.js +1 -0
- package/dist/client/assets/_shell.session-DyKnijqi.js +1 -0
- package/dist/client/assets/{_shell.team-BlLU5BMC.js → _shell.team-BPevCu33.js} +4 -4
- package/dist/client/assets/{_shell.threads-YmF9dQnZ.js → _shell.threads-gzYSpt7x.js} +1 -1
- package/dist/client/assets/_shell.x._extensionId-BA0u_ZTU.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-BA0u_ZTU.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-DLiXaMmC.js → abnfDiagram-WEYOIA3C-iUnN9Com.js} +1 -1
- package/dist/client/assets/{access-copy-xWnaUps1.js → access-copy-CP0B1ZT9.js} +1 -1
- package/dist/client/assets/{arc-AndXXvZc.js → arc-BVSQ4HBO.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-CM4tGveM.js → architectureDiagram-ZHVYKT53-_zlUU8PS.js} +1 -1
- package/dist/client/assets/{banner-BH1gXPTc.js → banner-DTCBttcQ.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-DenkdFXV.js → blockDiagram-RJAE7QA3-COqNq2ny.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DMAlFuoX.js → c4Diagram-XDPPPE54-Caa3QxQ_.js} +1 -1
- package/dist/client/assets/{card-TbpEl6EH.js → card-D9DO5nt4.js} +1 -1
- package/dist/client/assets/channel-CenDG0-I.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-u0q5vCEc.js → chunk-2E7WHVMD-BqirxZIN.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-DBTggfjR.js → chunk-2Q5K7J3B-CYGt3XQf.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-zu55wq-c.js → chunk-4EMNKR2T-Bx234GPP.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-XLIA3Qss.js → chunk-55XCU76K-CAA7du3_.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-DmGjbtZg.js → chunk-5VM5RSS4-Dxl-FvVz.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-ikMrk6md.js → chunk-JWPE2WC7-CjcTenhr.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-cfwin8SC.js → chunk-VQ5W62QI-COdK9J2i.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-Cn3e0QEQ.js → chunk-XXDRQBXY-DeXzMeSy.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-7RkBP94K.js → chunk-ZCHMQSOR-C7r0u2k6.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-CqVol7t8.js → classDiagram-v2-4MYWR3UA-BSI2Eza3.js} +1 -1
- package/dist/client/assets/{command-2pl_Cn7b.js → command-C7Cl56dV.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-m0tmlDnx.js → cose-bilkent-JH36ORCC-CLzQXbOG.js} +1 -1
- package/dist/client/assets/{cpu-CdCfSlSR.js → cpu-CLfYM0zq.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-Cf7ajLou.js → cynefin-EF2NZ3EQ-e_0nKhb5.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-Dl8GJr0l.js → cynefinDiagram-WF24UDRP-Cflfw_GE.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-2yAF6nW_.js → dagre-NK4GIZVX-D66Simjb.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-DaBb9JFm.js → diagram-CBK3MWTC-CJEeUCUY.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-BMeCfhD1.js → diagram-I5XIIV2D-BPSiDLoN.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-ClVKCieB.js → diagram-ODIL2UCW-DJptgW_s.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-DFIKk-tB.js → diagram-PFBEJUXE-BECklqVg.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-DzC_xtYu.js → diagram-RJA3I4VV-B-veBl7Z.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-BroMVHm2.js → diagram-TYUNFSNR-U8kleemE.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-GMsyIh86.js → ebnfDiagram-V4P3TTPT-DlwBfJCe.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-DIpw6SW5.js → elk-QONTBCTQ-DnFzEb3y.js} +1 -1
- package/dist/client/assets/{empty-state-B7ufhAFk.js → empty-state-2mQX7azC.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-CsezeWpx.js → erDiagram-KYQIGQAA-CYTM37Ws.js} +1 -1
- package/dist/client/assets/{execution-config-DRqIsff0.js → execution-config-COqY7hHn.js} +1 -1
- package/dist/client/assets/{file-DHPgnMgj.js → file-CKSjJRX5.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DtjBa2XX.js → file-exclamation-point-ad7FedZ9.js} +1 -1
- package/dist/client/assets/{file-text-wmrSy3Io.js → file-text-DXPPkxAL.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-Bv9D10ve.js → find-latest-widget-fence-BsDq4SYp.js} +3 -3
- package/dist/client/assets/{flowDiagram-IUGLLWBU-BGwNqglr.js → flowDiagram-IUGLLWBU-DD259OPj.js} +1 -1
- package/dist/client/assets/{form-CA_eiUg-.js → form-C9cPRNOV.js} +1 -1
- package/dist/client/assets/{format-cron-YPhIy57w.js → format-cron-DIw9_M6c.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-4IlzTCzA.js → ganttDiagram-R7GPNTJY-BmoAVY6N.js} +1 -1
- package/dist/client/assets/{git-branch-BLIYLcM4.js → git-branch-DlUQMA-U.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-HeaC8vlP.js → gitGraphDiagram-PDYL7XHY-Db8GGxGr.js} +1 -1
- package/dist/client/assets/{graph-Ch9lnHSS.js → graph-BqwkokGk.js} +1 -1
- package/dist/client/assets/{heart-D4fTvM5q.js → heart-CRoafWCm.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-KPma22SA.js → highlighted-body-KPVGNVTW-D-QIuqsv.js} +1 -1
- package/dist/client/assets/{image-lightbox-DI18fB2Q.js → image-lightbox-BZBT_ptW.js} +1 -1
- package/dist/client/assets/{image-off-DRgXXpgv.js → image-off-Bc6AP3w0.js} +1 -1
- package/dist/client/assets/{index-3UGWygRZ.js → index-78G8l1M7.js} +1 -1
- package/dist/client/assets/{index-C-X6jaVm.js → index-AxYQRAoO.js} +1 -1
- package/dist/client/assets/index-B48IJBNm.js +1058 -0
- package/dist/client/assets/{index-DuvW22xi.js → index-BHNwprrd.js} +1 -1
- package/dist/client/assets/{index-CucieFDK.js → index-B_i3pTpf.js} +1 -1
- package/dist/client/assets/{index-mRMaqxu5.js → index-Be3_cvW0.js} +1 -1
- package/dist/client/assets/{index-EDXuyCOT.js → index-BeCzlnZ3.js} +1 -1
- package/dist/client/assets/{index--2mMmier.js → index-Bw1l5I4w.js} +1 -1
- package/dist/client/assets/{index-DHZS9Lod.js → index-BwOvHDL2.js} +1 -1
- package/dist/client/assets/{index-Dbujw1c2.js → index-ByyXrDny.js} +1 -1
- package/dist/client/assets/{index-Ix2nCAz0.js → index-CFV7Ggyj.js} +1 -1
- package/dist/client/assets/index-CMWttCLt.js +1 -0
- package/dist/client/assets/{index-ClbMjgcZ.js → index-CNsZn6QE.js} +1 -1
- package/dist/client/assets/{index-2J89pJxF.js → index-CTFwtIJP.js} +1 -1
- package/dist/client/assets/{index-qEI7Rsr1.js → index-CWfreKgt.js} +1 -1
- package/dist/client/assets/{index-DTRAR0KK.js → index-CWx_JEio.js} +1 -1
- package/dist/client/assets/{index-CTTaeOCw.js → index-CZ4wx2F3.js} +1 -1
- package/dist/client/assets/{index-B_56Srtt.js → index-Clr1ssap.js} +1 -1
- package/dist/client/assets/{index-D9w0FBQG.js → index-CoFRHepD.js} +1 -1
- package/dist/client/assets/{index-zvAbU6ah.js → index-CptdhVbC.js} +1 -1
- package/dist/client/assets/{index-Dy9bWvna.js → index-Cpy9wOYc.js} +1 -1
- package/dist/client/assets/{index-COoO8dzi.js → index-Cs9yQ5zH.js} +1 -1
- package/dist/client/assets/{index-QSo53dH-.js → index-Cx2slDvh.js} +1 -1
- package/dist/client/assets/{index-rPJ8b_DO.js → index-DDGc0Nfu.js} +1 -1
- package/dist/client/assets/{index-B-4XmK5Q.js → index-DMlo5rLX.js} +1 -1
- package/dist/client/assets/index-DSt16Y0s.js +1 -0
- package/dist/client/assets/{index-D0cIffaH.js → index-DV5hFlfw.js} +1 -1
- package/dist/client/assets/index-DfWZORsm.js +1 -0
- package/dist/client/assets/{index-CujX3mpY.css → index-Dry_agqN.css} +1 -1
- package/dist/client/assets/{index-uG06zgQo.js → index-Dtb34mrg.js} +1 -1
- package/dist/client/assets/{index-DpvGUFpV.js → index-DwyVu2Mh.js} +1 -1
- package/dist/client/assets/{index-BY0SKYuc.js → index-Hf3kLtiJ.js} +1 -1
- package/dist/client/assets/{index-BmlBYrxT.js → index-a8LKmWxN.js} +1 -1
- package/dist/client/assets/{index-C3IsCAxA.js → index-bSzhhjtG.js} +1 -1
- package/dist/client/assets/{index-BtRM2yox.js → index-eF6QtmU6.js} +1 -1
- package/dist/client/assets/{index-BAd8jUzo.js → index-jIAsl-Y5.js} +2 -2
- package/dist/client/assets/{index-DbV3-jog.js → index-mrbr3BaJ.js} +1 -1
- package/dist/client/assets/{index-CRCfkwyN.js → index-okP_lDUw.js} +1 -1
- package/dist/client/assets/{index-JoxvTUfo.js → index-sCJ7YWzB.js} +3 -3
- package/dist/client/assets/index-sZ8Dddnp.js +1 -0
- package/dist/client/assets/{index-uy36h8lC.js → index-x0XGESNQ.js} +1 -1
- package/dist/client/assets/{index-bzM-k5lI.js → index-y1yAU07O.js} +1 -1
- package/dist/client/assets/{index-DSIdPh8G.js → index-zIfhHvVv.js} +1 -1
- package/dist/client/assets/{index-jk2K24il.js → index-zSj20f3H.js} +1 -1
- package/dist/client/assets/{index.esm-CxXuMuQv.js → index.esm-uC5dql6Q.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-g9EeD2xH.js → infoDiagram-MVDRKAX5-y6U3OQ5m.js} +1 -1
- package/dist/client/assets/{inline-code-14c1Gacs.js → inline-code-BCFlKPIb.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-Zv5DrRnv.js → ishikawaDiagram-HPEHV2GE-D32SA0vX.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-COiWWTez.js → journeyDiagram-BOSHW7O7-D1X0dI8X.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-DnQa8qXB.js → kanban-definition-FNSA4HC5-gU9KcKa4.js} +1 -1
- package/dist/client/assets/{layers-D_NEJsnH.js → layers-A4MxcGWV.js} +1 -1
- package/dist/client/assets/{lightbulb-EadQi_Lr.js → lightbulb-Dh2dYHMS.js} +1 -1
- package/dist/client/assets/{link-2-DugR2HHU.js → link-2-qEUih2FP.js} +1 -1
- package/dist/client/assets/{list-runtime-types-iJaKcim4.js → list-runtime-types-B1J9AtqH.js} +1 -1
- package/dist/client/assets/{markdown-content-BFHUHPgi.js → markdown-content-BA0KEJH_.js} +1 -1
- package/dist/client/assets/mention-pill-0aHe3D1A.js +1 -0
- package/dist/client/assets/{mermaid.core-C6ckWvkG.js → mermaid.core-Birdr1kF.js} +4 -4
- package/dist/client/assets/{message-square-off-BH8wbm2a.js → message-square-off-DvVenheW.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-DV4PNLc-.js → mindmap-definition-6OY57UG3-CLlh3nSF.js} +1 -1
- package/dist/client/assets/{more-details-DhdX4DGU.js → more-details-Bo2AAXHj.js} +1 -1
- package/dist/client/assets/{owner-notice-FMj3k7-f.js → owner-notice-DReCUEf1.js} +1 -1
- package/dist/client/assets/{package-0mI7-RiJ.js → package-CxZe6vve.js} +1 -1
- package/dist/client/assets/{page-container-DRyYoDkA.js → page-container-Bx1sr900.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-OBc3uYxQ.js → pane-resize-handle-ojhYGmDs.js} +1 -1
- package/dist/client/assets/{paperclip-BsTJpkyE.js → paperclip-D3-8ygf1.js} +1 -1
- package/dist/client/assets/{path-input-CFm1b1pk.js → path-input-D_o1_pAa.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-Cboo0f6B.js → pegDiagram-ECIUJNBX-BeMd_oXJ.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-CiihSor1.js → pieDiagram-GNMPY74T-CXUXnp_A.js} +1 -1
- package/dist/client/assets/{plug-BdnJAo1j.js → plug-Du5LK0oZ.js} +1 -1
- package/dist/client/assets/primer-trigger-BxofQe1n.js +3 -0
- package/dist/client/assets/{profile-errors-B08zStmk.js → profile-errors-C0BgTjzk.js} +1 -1
- package/dist/client/assets/{progress-CpiQE0rv.js → progress-AKcr8opu.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-dF0oKeMn.js → quadrantDiagram-D57K4MC3-FTkKRlZm.js} +1 -1
- package/dist/client/assets/{query-error-state-B0RUeb10.js → query-error-state-CRmZMMkL.js} +1 -1
- package/dist/client/assets/{radio-CAGXbJK_.js → radio-DQHR6Su5.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-ClkFJVq1.js → railroadDiagram-Y72NRBL7-D5TdGrPg.js} +1 -1
- package/dist/client/assets/{registry-Cog_2xvt.js → registry-BxY1lah6.js} +4 -4
- package/dist/client/assets/registry-CWK5lzYs.js +1 -0
- package/dist/client/assets/relay-trace-schemas---fuhTF2.js +6 -0
- package/dist/client/assets/{repeat-Dag80z5v.js → repeat-zL9y24zY.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-Cey6FmFd.js → requirementDiagram-EQYSW5RA-Dxiv9lE0.js} +1 -1
- package/dist/client/assets/{room-files-source-BKUFMU_b.js → room-files-source-B0WR4gIC.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-egrvXlKX.js → rotate-ccw-clock-BUhy2_cF.js} +1 -1
- package/dist/client/assets/{rotate-cw-Po-L3HFe.js → rotate-cw-CCrNd4eJ.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-BsIuHjbJ.js → sankeyDiagram-SY24JHO5-C3jjstXq.js} +1 -1
- package/dist/client/assets/{scroll-area-C7vKp2H4.js → scroll-area-D6gNpFjK.js} +1 -1
- package/dist/client/assets/search-x-CUZ1LRYe.js +6 -0
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BJZXJxwu.js → sequenceDiagram-BLEHNHQU-CIDmjz0x.js} +1 -1
- package/dist/client/assets/{shield-x-hHpT8rAA.js → shield-x-Ch7sY2XD.js} +1 -1
- package/dist/client/assets/{signed-in-BhArfIJC.js → signed-in-BQ44fFH5.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-DYCQyn7S.js → sizeCapture-INFHLROL-Dkp-75Wy.js} +1 -1
- package/dist/client/assets/{soul-file-Doekkv7n.js → soul-file-CTFcpRMh.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-C6bUDAO7.js → stateDiagram-v2-A6IESKWZ-L_51UnwV.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-DGyTrJBT.js → swimlanes-B3ENRKFQ-D-etAQQd.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-zjIBWGY4.js +8 -0
- package/dist/client/assets/{table-9KRGRv_s.js → table-D6BUawIb.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-CHAJwSq6.js → timeline-definition-JXYKGLGB-DNxnC3VG.js} +1 -1
- package/dist/client/assets/{trust-posture-BQE9NSf_.js → trust-posture-5IWBJmA5.js} +1 -1
- package/dist/client/assets/{unplug-CklGWwz7.js → unplug-BVIT6OSL.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-9mykZSlO.js → unverified-catalog-notice-BA7_V-80.js} +1 -1
- package/dist/client/assets/{use-bindings-CPbqKyo6.js → use-bindings-DdWRXvtd.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-C7v03Xx_.js → use-composer-prefs-DC5w4eWw.js} +1 -1
- package/dist/client/assets/{use-connector-management-COqWo76Y.js → use-connector-management-DDlpD6tk.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-BuYR3PaO.js → use-deep-link-scroll-Cvv0VcXx.js} +1 -1
- package/dist/client/assets/{use-delete-binding-Dfz8BlLn.js → use-delete-binding-D585ISkL.js} +1 -1
- package/dist/client/assets/{use-dev-links-Cu2JmM-_.js → use-dev-links-BwS5hgur.js} +1 -1
- package/dist/client/assets/{use-direct-message-panel-DobIp_O4.js → use-direct-message-panel--unflmj8.js} +1 -1
- package/dist/client/assets/use-external-adapter-catalog-DUyh1bH1.js +1 -0
- package/dist/client/assets/use-full-activity-feed-DsNOIkL8.js +1 -0
- package/dist/client/assets/use-is-below-desktop-C-4kc5lS.js +1 -0
- package/dist/client/assets/{use-local-browser-DPdkgs06.js → use-local-browser-DGIut7R4.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-Ci7r-pAi.js → use-mesh-topology-DNXD7seM.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-CWXhSyZ8.js → use-mounted-ref-7xoMthh4.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-GJ2coibL.js → use-notification-prefs-CzibxpTZ.js} +1 -1
- package/dist/client/assets/use-pending-read-BTR5-HXf.js +1 -0
- package/dist/client/assets/{use-personality-commit-Da2BJ_58.js → use-personality-commit-isaMS7W5.js} +1 -1
- package/dist/client/assets/{use-promo-activation-D4PAd7pd.js → use-promo-activation-DesLEeyi.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-BCBu0s3k.js → use-promo-dismissals-DQi8tey8.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-CHLSUL-h.js → use-pulse-freshness-DPplpvcq.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BSijPV3c.js → use-room-follow-claim-C4UikQzz.js} +1 -1
- package/dist/client/assets/{use-room-sessions-CNqHgLVa.js → use-room-sessions-C6wsszcG.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-EsqX22Ik.js → use-roving-tab-list-DEh387tR.js} +1 -1
- package/dist/client/assets/{use-session-canvas-DAGOz8a6.js → use-session-canvas-B2CM1KZu.js} +8 -8
- package/dist/client/assets/{use-status-budget-CHln-8aP.js → use-status-budget-CltxSIUD.js} +3 -3
- package/dist/client/assets/{use-transform-BmyqpcvO.js → use-transform-CNLqlc2h.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-9Clj_rwl.js → use-unclaimed-chats-DJyl7A1E.js} +1 -1
- package/dist/client/assets/use-update-config-B2rsDnxk.js +1 -0
- package/dist/client/assets/{useMutationState-B61VoWtY.js → useMutationState-BX-ggHVY.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-BUqj8rIH.js → usecaseDiagram-WPOLBNNX-2l6yZUUH.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-B09oli-Z.js → vennDiagram-Q3Y3IDCW-DIOfjNDq.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-BE7gzLdw.js → wardleyDiagram-IVAIDKWA-B5Hx1we8.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-CbGKfmuW.js → xychartDiagram-4URNHDU4-sy90CqIK.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +30051 -25401
- package/dist/server/index.js.map +2 -2
- package/package.json +9 -9
- package/dist/client/assets/AdapterSetupWizard-Cp56Zx24.js +0 -2
- package/dist/client/assets/BindingDialog-Bw55sMTh.js +0 -1
- package/dist/client/assets/ChannelComposer-7KpffyFv.js +0 -44
- package/dist/client/assets/HandlePage-CByGC3B8.js +0 -1
- package/dist/client/assets/NamePage-5VUtswMH.js +0 -1
- package/dist/client/assets/PhotoPage-DDcbiGjb.js +0 -1
- package/dist/client/assets/RuntimeConnectFlow-BAqkzthF.js +0 -1
- package/dist/client/assets/SeenDevices-xdR3YQNr.js +0 -19
- package/dist/client/assets/SettingsDialog-d7SQTDNy.js +0 -12
- package/dist/client/assets/TourHost-DvAjpsug.js +0 -1
- package/dist/client/assets/_shell._home.index-CA_GnaUK.js +0 -3
- package/dist/client/assets/_shell.connections-gfevZyC-.js +0 -1
- package/dist/client/assets/_shell.marketplace-BepG1fJe.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-BBQESbqU.js +0 -1
- package/dist/client/assets/_shell.session-DzeI9YIK.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-ByRocZjS.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-ByRocZjS.js +0 -1
- package/dist/client/assets/channel-5-dQamNX.js +0 -1
- package/dist/client/assets/index-B9X2-pzp.js +0 -1
- package/dist/client/assets/index-BMYGo6Ki.js +0 -1
- package/dist/client/assets/index-ButY6gKr.js +0 -1
- package/dist/client/assets/index-CgpRBcA4.js +0 -1
- package/dist/client/assets/index-p3WivF1M.js +0 -1053
- package/dist/client/assets/mention-pill-DXBno6EY.js +0 -1
- package/dist/client/assets/primer-trigger-BV4xZfFz.js +0 -3
- package/dist/client/assets/registry-DLWJMbtY.js +0 -1
- package/dist/client/assets/relay-trace-schemas-CNDSmhcJ.js +0 -6
- package/dist/client/assets/search-x-C_BEqIuX.js +0 -6
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-DrZ99xGr.js +0 -8
- package/dist/client/assets/use-adapter-catalog-CDxy08u_.js +0 -1
- package/dist/client/assets/use-external-adapter-catalog-OLn4l20Q.js +0 -1
- package/dist/client/assets/use-full-activity-feed-DNrhQueu.js +0 -1
- package/dist/client/assets/use-is-below-desktop-7gY1n-47.js +0 -1
- package/dist/client/assets/use-pending-read-DcVJ8fZb.js +0 -1
- package/dist/client/assets/use-relay-config-C6rPlEud.js +0 -1
- package/dist/client/assets/use-update-config-T78vOnRy.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as ie,a4 as de,a3 as Oe,iZ as _e,i_ as ne,i$ as me,j0 as Le,j1 as Fe,j2 as De,aP as ze,r as s,j as t,G as ee,B as we,x as He,e as Q,gy as Ie,hh as qe,gx as ke,j3 as $e,j4 as We,n as Be,gB as U,a7 as Ke,fy as Ge,j5 as Ue,j6 as Xe,j7 as Ye,cu as Qe,j8 as Ve,j9 as Ze,ja as Je,jb as et,cq as tt,jc as nt,gw as Y,jd as st,l as rt,s as he,je as ot,jf as at,e7 as it,X as dt,e4 as lt,ar as ut,jg as ct,jh as pe,ji as ft,ad as mt,jj as ht,gv as pt,gu as gt,jk as xt,aF as ge,by as yt}from"./index-p3WivF1M.js";import{P as Rt,u as vt}from"./pane-resize-handle-OBc3uYxQ.js";import{D as bt,U as jt,u as wt}from"./UnreadDivider-BoLcTO_Z.js";import{u as It}from"./use-room-follow-claim-BSijPV3c.js";import{a as le,e as ue,g as kt,f as Ae,h as At,i as Ne,c as G,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-7KpffyFv.js";import{u as Mt,f as Tt,a as Pt,F as Et,C as X,d as Ot,M as _t}from"./registry-Cog_2xvt.js";import{u as Lt}from"./use-connector-management-COqWo76Y.js";import{A as Ft}from"./AgentRequestCard-BoRmxLKy.js";import{u as Dt}from"./use-room-sessions-CNqHgLVa.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),R=ne(p=>{var f;return e===null?null:((f=p.paging[e])==null?void 0:f.cursor)??null}),i=de({mutationFn:async p=>{var j;const f=(j=ne.getState().paging[p])==null?void 0:j.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:w}=i,y=s.useRef(!1),x=s.useCallback(async()=>{if(!(e===null||y.current)){y.current=!0;try{await d(e).catch(()=>{})}finally{y.current=!1}}},[e,d]);return{canLoadOlder:u,isLoadingOlder:w,cursor:R,loadOlder:x}}function $t({id:e,summary:o,open:r,onOpen:u}){const{capabilities:R}=Mt(),{count:i,lastAt:d,unread:w}=o,y=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 R.threads?t.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":w>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",w>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",y.length>0&&t.jsxs(t.Fragment,{children:[" · last ",t.jsx("time",{dateTime:d,title:Pt(d),children:y})]}),w>0&&` · ${w} new`]}):null}function Wt({loading:e,onLoad:o}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(we,{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 Gt({roomId:e,roomName:o,viewerAuthorId:r,entries:u,members:R,formerAuthors:i,lastReadSeq:d,reactionFrequents:w,streamStalled:y,isLoading:x,error:p,onAddAgents:f,openThreadId:v,onOpenThread:I,resumeRow:k,landOnRow:A,onTopRow:j,canLoadOlder:S=!1,isLoadingOlder:l=!1,onLoadOlder:c,ref:C}){const N=s.useMemo(()=>le(R,i),[R,i]),P=Ie(R,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=$e(H,d),m=We(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]),$=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:G(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(Wt,{loading:l,onLoad:c});if(b.kind==="day-divider")return t.jsx(bt,{label:b.label});if(b.kind==="unread-divider")return t.jsx(jt,{});if(b.kind==="thread-reply"){if(m.onOpenThread===void 0)return null;const h=m.onOpenThread;return t.jsx($t,{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:G(a,N,E.faces),authorRef:N.get(a),authors:N,viewerAuthorId:r,authorNames:T,reactionFrequents:w,streamStalled:y,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,w,y,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 W=R.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:W?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(we,{type:"button",size:"sm",variant:W?"ghost":"default",onClick:f,className:"mt-1",children:W?"Add more agents":"Add agents"})]});return t.jsx(Se,{known:E,children:t.jsx(X.Timeline,{ref:C,conversationId:e,label:`Messages in ${o}`,rows:$,renderRow:K,onOpenThread:I,domIdOf:O,...k===void 0?{}:{resumeRow:k},...A===void 0?{}:{landOnRow:A},...j===void 0?{}:{onTopRow:j},pending:L,viewerAuthorId:r,loading:x?t.jsx(Pe,{roomName:o}):void 0,empty:B,feedTestId:"room-timeline"})})}function Ut(e){const{roomId:o,entrySeq:r,entries:u,historyLoaded:R}=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 j=ce(k)??null,S=j!==null&&A.rowId!==k.id;return{roomRowId:A.rowId,threadRootId:S?j:null,entryId:k.id}},[u,r]),w=s.useRef(null),y=(d==null?void 0:d.threadRootId)??null;s.useEffect(()=>{i===null||y===null||w.current!==i&&(w.current=i,U.getState().openThread(o,y))},[i,o,y]);const x=s.useRef(null);s.useEffect(()=>{i===null||!R||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,R,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 Xt(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 Yt=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 w;(w=e.current)==null||w.call(e);let u=0;const R=Date.now()+Yt;let i=!1;const d=()=>{if(i)return;const y=document.activeElement;if(y===null||y===document.body||!y.isConnected){const p=Qt(r);if(p!==null){p.focus();return}}Date.now()>=R||(u=requestAnimationFrame(d))};u=requestAnimationFrame(d),e.current=()=>{i=!0,cancelAnimationFrame(u)}},[])}}function Zt({roomId:e,route:o,urlThreadId:r,openThreadId:u,entries:R,historyLoaded:i}){const d=Ge(),w=s.useRef(null);s.useEffect(()=>{if(e!==null){if(w.current!==e&&(w.current=e,r!==void 0)){U.getState().openThread(e,r);return}if(i&&u!==void 0){const y=R.find(p=>p.id===u),x=y===void 0?void 0:St(y);if(x!==void 0&&x!==u){const p=U.getState().open[e];U.getState().openThread(e,x,(p==null?void 0:p.focusComposer)??!1);return}}u!==r&&(d==null||d({to:o,search:y=>({...y,thread:u}),replace:!0}))}},[e,o,u,r,R,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}=Ue(),r=Xe(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(Ye,{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:R,unavailable:i=!1,onRetry:d,onScrollToRow:w}){const y=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:j}=zt(),[S,l]=s.useState(rn),c=s.useCallback(a=>{l(h=>new Set(h).add(a)),j({roomId:e.id,authorId:a},{onSettled:()=>l(h=>{const g=new Set(h);return g.delete(a),g})})},[j,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:Y(h)},othersWaiting:a.othersWaiting,severalInTheWay:a.severalInTheWay}}),[p,L,E.data]),$=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:R,presence:q,held:z,silentFinish:K,turn:null}),[F,D,q,z,K,R]),W=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:G(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:W.get(g.authorId)??null}}),h=z.map(g=>({authorId:g.authorId,author:G(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,W]),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:G(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(X.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=>{y(he({session:a}))},className:"border-l-0"}):void 0,peek:t.jsx(X.LivePeek,{rows:m,onScrollToRow:w,onOpenSession:a=>{y(he({session:a}))},onOpenRoom:a=>{y({...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:$,onStopAll:()=>A.mutate({roomId:e.id}),stopping:A.isPending,onStopAgent:c,stoppingAgents:S})})}const ye=3e3;function on(e,o,r,u=Date.now){const R=s.useRef(null),i=s.useRef(new Map),d=s.useRef(new Map),w=R.current,y=i.current,x=d.current,p=u();for(const f of e){if(x.has(f.id))continue;if(w===null){x.set(f.id,"at-rest");continue}const v=y.get(f.authorId);x.set(f.id,v!==void 0&&p-v<ye?"handed-off":"dropped")}return s.useEffect(()=>{if(!r)return;R.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>ye&&i.current.delete(v);for(const v of d.current.keys())R.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:R,streamStalled:i,streamUnavailable:d,onRetryStream:w,historyLoaded:y,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),j=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,y),q=s.useRef(null),z=s.useCallback(n=>{var m;(m=q.current)==null||m.scrollToRow(n)},[]),$=s.useRef(null);s.useEffect(()=>{var n;r||(n=$.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":y?"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:G(V(l,I),I,j.faces),at:l.createdAt});for(const m of c)n.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:G(V(m,I),I,j.faces),at:m.createdAt});return n},[l,P,c,I,j.faces,x,y]),W=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:R,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(Re,{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,R,i,A,E]),B=s.useCallback(n=>n.kind==="message"?J(n.id):void 0,[]);return t.jsx(Se,{known:j,children:t.jsx(X.Root,{surface:"room",capabilities:fe,target:k.target,anchor:"rail",children:t.jsxs("section",{ref:$,"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 ${Y(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:Y(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:Y(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:G(V(l,I),I,j.faces),authorRef:I.get(l.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:R,streamStalled:i,isMember:A,grouping:{position:"only"}}),t.jsx(Re,{count:T})]}),t.jsx(X.Timeline,{ref:q,conversationId:`thread-${o}`,label:`Thread in ${Y(e)}`,busy:!y&&!x,rows:O,renderRow:W,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?w:void 0,onScrollToRow:z}),t.jsx(Te,{room:e,threadRootId:o,attachments:k.attachments,focusOnMount:r},o)]})})})}function Re({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:(R,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 yn(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 Rn(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 jn="react-resizable-panels:room-thread-split";function wn(){try{localStorage.removeItem(jn)}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 w=new ResizeObserver(d);return w.observe(i),()=>{w.disconnect(),o(null),u(null)}},[]),element:e,width:r,sizing:yn(r??0)}}const kn=`${te}-room`,be=`${te}-thread`,je=`${te}-handle`,An=4;function Nn({room:e,thread:o,storageKey:r=ft.ROOM_THREAD_WIDTH}){const{ref:u,element:R,width:i,sizing:d}=In(),[w,y]=s.useState(()=>vn(r)),[x,p]=s.useState(null),f=s.useRef(null),v=Rn(w,i,d),I=i===null||(d.maxPct-d.minPct)/100*i<An,k=o!==!1;s.useEffect(wn,[]);const A=s.useRef(!1);s.useLayoutEffect(()=>{var c;A.current&&((c=f.current)==null||c.resize(v))},[v,k]);const j=s.useRef(null),S=()=>{var P;const c=(P=f.current)==null?void 0:P.getSize(),C=j.current;if(j.current=null,c===void 0||i===null||i<=0||C===c)return;const N=Math.round(c/100*i);y(N),bn(r,N)},l=x??v;return s.useLayoutEffect(()=>{const c=R==null?void 0:R.querySelector(`[data-panel-resize-handle-id="${je}"]`);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(Rt,{id:je,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:I,onDragging:c=>{var C;c&&(j.current=((C=f.current)==null?void 0:C.getSize())??null)},onKeyDownCapture:c=>{var C,N;I||(j.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:R,aboveComposer:i,offerJumpBackIn:d,onComposerFocusChange:w}){const y=mt(),x=vt(),p=ht(e),f=p==null?void 0:p.rootEntryId,v=Vt(),I=s.useCallback(()=>{var m;const n=(m=U.getState().open[e])==null?void 0:m.rootEntryId;U.getState().closeThread(e),n!==void 0&&v.arm(n)},[e,v]),k=s.useCallback(n=>{U.getState().openThread(e,n)},[e]),A=pt(e),j=gt(e),S=wt(e,j.isSuccess);It(e);const l=A.data,c=s.useMemo(()=>j.data??[],[j.data]),C=Me({room:l});Zt({roomId:e,route:u,urlThreadId:o,openThreadId:f,entries:c,historyLoaded:j.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=Xt(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]),$=Ut({roomId:e,entrySeq:r,entries:c,historyLoaded:j.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:j.isSuccess,historyFailed:j.isError,...$.threadRow===void 0?{}:{landOnRow:$.threadRow},pushed:y,onClose:I},p.rootEntryId),W=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[R,t.jsx(Gt,{ref:E,roomId:l.id,roomName:Y(l),viewerAuthorId:l.viewerAuthorId,entries:c,members:l.members,formerAuthors:l.formerAuthors,lastReadSeq:P,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,isLoading:j.isLoading,error:j.error,onAddAgents:()=>ge("add",l.id),openThreadId:f,onOpenThread:k,resumeRow:L,...$.roomRow===void 0?{}:{landOnRow:$.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:w},l.id)]}),B={surface:"room",capabilities:fe,target:C.target,anchor:"rail"};return y?t.jsx(X.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:W}),t.jsx(yt,{initial:!1,children:O!==!1&&t.jsx(fn,{onClose:I,children:O},`thread-${f}`)})]})})}):t.jsx(X.Root,{...B,children:t.jsx(Nn,{room:W,thread:O})})}export{Fn as R,$t as T,Pe as a};
|
|
1
|
+
import{a1 as ie,a4 as de,a3 as Oe,j0 as _e,j1 as ne,j2 as me,j3 as Le,j4 as De,j5 as Fe,aN as ze,r as s,j as t,G as ee,B as we,x as He,e as Q,gy as Ie,hh as qe,gx as ke,j6 as $e,j7 as We,n as Be,gB as U,dD as Ke,fx as Ge,j8 as Ue,j9 as Xe,ja as Ye,cs as Qe,jb as Ve,jc as Ze,jd as Je,je as et,co as tt,jf as nt,gw as Y,jg as st,l as rt,s as he,jh as ot,ji as at,e6 as it,X as dt,e3 as lt,ap as ut,jj as ct,jk as pe,jl as ft,ab as mt,jm as ht,gv as pt,gu as gt,jn as xt,aD as ge,bw as Rt}from"./index-B48IJBNm.js";import{P as yt,u as vt}from"./pane-resize-handle-ojhYGmDs.js";import{D as bt,U as jt,u as wt}from"./UnreadDivider-C52_nmrB.js";import{u as It}from"./use-room-follow-claim-C4UikQzz.js";import{a as le,e as ue,g as kt,f as Ae,h as At,i as Ne,c as G,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-BHxXoQwT.js";import{u as Mt,f as Tt,a as Et,F as Pt,C as X,d as Ot,M as _t}from"./registry-BxY1lah6.js";import{u as Lt}from"./use-connector-management-DDlpD6tk.js";import{A as Dt}from"./AgentRequestCard-BTyuNOhU.js";import{u as Ft}from"./use-room-sessions-C6wsszcG.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 j;const f=(j=ne.getState().paging[p])==null?void 0:j.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,De(v)??f,Fe(v,me)||A.length===((k==null?void 0:k.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:d,isPending:w}=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:w,cursor:y,loadOlder:x}}function $t({id:e,summary:o,open:r,onOpen:u}){const{capabilities:y}=Mt(),{count:i,lastAt:d,unread:w}=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":w>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",w>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:Et(d),children:R})]}),w>0&&` · ${w} new`]}):null}function Wt({loading:e,onLoad:o}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(we,{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 Ee({roomName:e}){return t.jsx(Pt,{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 Gt({roomId:e,roomName:o,viewerAuthorId:r,entries:u,members:y,formerAuthors:i,lastReadSeq:d,reactionFrequents:w,streamStalled:R,isLoading:x,error:p,onAddAgents:f,openThreadId:v,onOpenThread:I,resumeRow:k,landOnRow:A,onTopRow:j,canLoadOlder:S=!1,isLoadingOlder:l=!1,onLoadOlder:c,ref:C}){const N=s.useMemo(()=>le(y,i),[y,i]),E=Ie(y,r),P=ue(),T=s.useMemo(()=>new Map([...N].map(([n,m])=>[n,m.displayName])),[N]),M=qe(),L=ke(e,null),{topLevel:H,repliesByRoot:D,orphaned:F}=s.useMemo(()=>kt(u),[u]),q=s.useMemo(()=>new Map(u.map(n=>[n.id,n])),[u]),z=s.useMemo(()=>{const n=$e(H,d),m=We(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=D.get(h.id);g&&b.push({kind:"thread-reply",id:At(h.id),rootId:h.id,replies:g,totalReplies:h.threadReplyCount})}return b},[H,D,q,d,M,S,x]),$=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:G(V(n.entry,N),N,P.faces),at:n.entry.createdAt}),[z,N,P.faces]),K=s.useCallback((n,m)=>{const b=z[m.index];if(b.kind==="load-older")return c===void 0?null:t.jsx(Wt,{loading:l,onLoad:c});if(b.kind==="day-divider")return t.jsx(bt,{label:b.label});if(b.kind==="unread-divider")return t.jsx(jt,{});if(b.kind==="thread-reply"){if(m.onOpenThread===void 0)return null;const h=m.onOpenThread;return t.jsx($t,{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:G(a,N,P.faces),authorRef:N.get(a),authors:N,viewerAuthorId:r,authorNames:T,reactionFrequents:w,streamStalled:R,isMember:E,grouping:b.grouping,orphanedReply:F.has(b.entry.id),answers:b.answers,feedPosition:{index:b.position,total:-1},rowId:ae(b.entry.id)})},[z,e,N,P.faces,r,T,w,R,E,F,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 W=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:W?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(we,{type:"button",size:"sm",variant:W?"ghost":"default",onClick:f,className:"mt-1",children:W?"Add more agents":"Add agents"})]});return t.jsx(Se,{known:P,children:t.jsx(X.Timeline,{ref:C,conversationId:e,label:`Messages in ${o}`,rows:$,renderRow:K,onOpenThread:I,domIdOf:O,...k===void 0?{}:{resumeRow:k},...A===void 0?{}:{landOnRow:A},...j===void 0?{}:{onTopRow:j},pending:L,viewerAuthorId:r,loading:x?t.jsx(Ee,{roomName:o}):void 0,empty:B,feedTestId:"room-timeline"})})}function Ut(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 j=ce(k)??null,S=j!==null&&A.rowId!==k.id;return{roomRowId:A.rowId,threadRootId:S?j:null,entryId:k.id}},[u,r]),w=s.useRef(null),R=(d==null?void 0:d.threadRootId)??null;s.useEffect(()=>{i===null||R===null||w.current!==i&&(w.current=i,U.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 Xt(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 Yt=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 w;(w=e.current)==null||w.call(e);let u=0;const y=Date.now()+Yt;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=Ge(),w=s.useRef(null);s.useEffect(()=>{if(e!==null){if(w.current!==e&&(w.current=e,r!==void 0)){U.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=U.getState().open[e];U.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}=Ue(),r=Xe(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(Ye,{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(Dt,{request:u},u.requestId))})}const sn="An agent",xe=64,se=3,rn=new Set;function Pe({room:e,entries:o,scope:r,laneScope:u,stalled:y,unavailable:i=!1,onRetry:d,onScrollToRow:w}){const R=Qe(),x=Ve(e.id,r),p=Ze(e.id,r),f=Je(e.id,r),[v,I]=s.useState(!1),k=Ft(e.id,{enabled:v}),A=et(),{mutate:j}=zt(),[S,l]=s.useState(rn),c=s.useCallback(a=>{l(h=>new Set(h).add(a)),j({roomId:e.id,authorId:a},{onSettled:()=>l(h=>{const g=new Set(h);return g.delete(a),g})})},[j,e.id]),C=Ht(),[N,E]=s.useState(()=>new Map),P=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(),D=s.useMemo(()=>H.filter(a=>a.roomId===e.id),[H,e.id]),F=s.useMemo(()=>{var h;const a={};for(const g of D){if(g.roomAuthorId===void 0)continue;const _=(h=M.get(g.roomAuthorId))==null?void 0:h.displayName;_!==void 0&&(a[g.sessionId]=_)}return a},[D,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=P.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:Y(h)},othersWaiting:a.othersWaiting,severalInTheWay:a.severalInTheWay}}),[p,L,P.data]),$=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:D,agentNames:F,stalled:y,presence:q,held:z,silentFinish:K,turn:null}),[D,F,q,z,K,y]),W=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:G(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:W.get(g.authorId)??null}}),h=z.map(g=>({authorId:g.authorId,author:G(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,W]),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:G(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(X.LiveLane,{state:O,scope:u,onRetry:d,unavailable:i,faces:b,onPeekOpenChange:I,askCard:O.kind==="ask"?t.jsx(ot,{ask:O.ask,...F[O.ask.sessionId]?{agentName:F[O.ask.sessionId]}:{},onOpenSession:a=>{R(he({session:a}))},className:"border-l-0"}):void 0,peek:t.jsx(X.LivePeek,{rows:m,onScrollToRow:w,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&&E(g=>new Map(g).set(a,h.entryId)),C.mutate({roomId:e.id,authorId:a})},promoted:$,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),w=y.current,R=i.current,x=d.current,p=u();for(const f of e){if(x.has(f.id))continue;if(w===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:w,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),j=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,E=!f,P=l===void 0||N?-1:(E?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),D=ke(e.id,o),F=on(c,H,R),q=s.useRef(null),z=s.useCallback(n=>{var m;(m=q.current)==null||m.scrollToRow(n)},[]),$=s.useRef(null);s.useEffect(()=>{var n;r||(n=$.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 E&&n.push({kind:"message",id:l.id,payload:l,grouping:{position:"only"},author:G(V(l,I),I,j.faces),at:l.createdAt});for(const m of c)n.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:G(V(m,I),I,j.faces),at:m.createdAt});return n},[l,E,c,I,j.faces,x,R]),W=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||!E?0:1)+a+1,total:P}});if(b)return t.jsxs(t.Fragment,{children:[h,t.jsx(ye,{count:T})]});const g=F.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,E,c,T,F,e.id,e.viewerAuthorId,I,S,y,i,A,P]),B=s.useCallback(n=>n.kind==="message"?J(n.id):void 0,[]);return t.jsx(Se,{known:j,children:t.jsx(X.Root,{surface:"room",capabilities:fe,target:k.target,anchor:"rail",children:t.jsxs("section",{ref:$,"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 ${Y(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:Y(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:Y(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:G(V(l,I),I,j.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(X.Timeline,{ref:q,conversationId:`thread-${o}`,label:`Thread in ${Y(e)}`,busy:!R&&!x,rows:O,renderRow:W,domIdOf:B,...p===void 0?{}:{landOnRow:p},pending:D,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),t.jsx(Pe,{room:e,entries:u,scope:L,laneScope:"thread",stalled:f&&i===!0,unavailable:d,onRetry:f?w: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 jn="react-resizable-panels:room-thread-split";function wn(){try{localStorage.removeItem(jn)}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 w=new ResizeObserver(d);return w.observe(i),()=>{w.disconnect(),o(null),u(null)}},[]),element:e,width:r,sizing:Rn(r??0)}}const kn=`${te}-room`,be=`${te}-thread`,je=`${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(),[w,R]=s.useState(()=>vn(r)),[x,p]=s.useState(null),f=s.useRef(null),v=yn(w,i,d),I=i===null||(d.maxPct-d.minPct)/100*i<An,k=o!==!1;s.useEffect(wn,[]);const A=s.useRef(!1);s.useLayoutEffect(()=>{var c;A.current&&((c=f.current)==null||c.resize(v))},[v,k]);const j=s.useRef(null),S=()=>{var E;const c=(E=f.current)==null?void 0:E.getSize(),C=j.current;if(j.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="${je}"]`);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:je,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:I,onDragging:c=>{var C;c&&(j.current=((C=f.current)==null?void 0:C.getSize())??null)},onKeyDownCapture:c=>{var C,N;I||(j.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 Dn({roomId:e,threadId:o,entrySeq:r,threadRoute:u,aboveTimeline:y,aboveComposer:i,offerJumpBackIn:d,onComposerFocusChange:w}){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=U.getState().open[e])==null?void 0:m.rootEntryId;U.getState().closeThread(e),n!==void 0&&v.arm(n)},[e,v]),k=s.useCallback(n=>{U.getState().openThread(e,n)},[e]),A=pt(e),j=gt(e),S=wt(e,j.isSuccess);It(e);const l=A.data,c=s.useMemo(()=>j.data??[],[j.data]),C=Me({room:l});Zt({roomId:e,route:u,urlThreadId:o,openThreadId:f,entries:c,historyLoaded:j.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]),E=Xt(e,N);xt(l,c);const P=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=P.current)==null||m.scrollToRow(n)},[]),D=qt(e),{loadOlder:F,cursor:q}=D,z=s.useCallback(()=>{const n=Ct(c,q);F().then(()=>{n!==null&&requestAnimationFrame(()=>{var m;return(m=P.current)==null?void 0:m.scrollToRow(n.domId)})})},[c,q,F]),$=Ut({roomId:e,entrySeq:r,entries:c,historyLoaded:j.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(Ee,{})});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:j.isSuccess,historyFailed:j.isError,...$.threadRow===void 0?{}:{landOnRow:$.threadRow},pushed:R,onClose:I},p.rootEntryId),W=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[y,t.jsx(Gt,{ref:P,roomId:l.id,roomName:Y(l),viewerAuthorId:l.viewerAuthorId,entries:c,members:l.members,formerAuthors:l.formerAuthors,lastReadSeq:E,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,isLoading:j.isLoading,error:j.error,onAddAgents:()=>ge("add",l.id),openThreadId:f,onOpenThread:k,resumeRow:L,...$.roomRow===void 0?{}:{landOnRow:$.roomRow},onTopRow:M,canLoadOlder:D.canLoadOlder,isLoadingOlder:D.isLoadingOlder,onLoadOlder:z}),i,t.jsx(tn,{roomId:l.id}),t.jsx(nn,{roomId:l.id}),t.jsx(Pe,{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:w},l.id)]}),B={surface:"room",capabilities:fe,target:C.target,anchor:"rail"};return R?t.jsx(X.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:W}),t.jsx(Rt,{initial:!1,children:O!==!1&&t.jsx(fn,{onClose:I,children:O},`thread-${f}`)})]})})}):t.jsx(X.Root,{...B,children:t.jsx(Nn,{room:W,thread:O})})}export{Dn as R,$t as T,Ee 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-B48IJBNm.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,e8 as de,bz as ue,bA as fe,bB as me,bD as xe,e9 as Ae,a1 as Te,a3 as ke,a4 as De,ad as pe,aN as Le,ea as he,eb as Oe,ec as Ie,ed as Pe,a8 as j,ee as _e,ef as H,eg as Ue,am as be,B as $e,U as Re,b as He,e as Me,eh as Be,ei as ze,ej as Ke,ek as qe,el as Qe,em as Ve}from"./index-p3WivF1M.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-DRqIsff0.js";import{U as Xe}from"./unverified-catalog-notice-9mykZSlO.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",Ae.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=Te(),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,T;return((T=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:T.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,A=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=A?(m??[]).find(t=>t.value===A):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:Q,creditsEntry:je,resolvedAccount:V}=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:Q(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&&V?Q(V):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(T=>t.includes(T.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)??A??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:A,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(Qe,{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(Ve,{"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 L,j as e,a0 as ye,bw as Ee,ap as we,G as N,e7 as de,bx as ue,by as fe,bz as me,bB as xe,e8 as ke,a1 as Te,a3 as Ae,a4 as Le,ab as pe,aL as Oe,e9 as he,ea as De,eb as Ie,ec as Pe,a6 as j,ed as _e,ee as H,ef as Ue,ak as be,B as $e,U as Re,b as He,e as Me,eg as Be,eh as ze,ei as Ke,ej as qe,ek as Qe,el as Ve}from"./index-B48IJBNm.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as Fe,d as Ge,k as We,e as A}from"./execution-config-COqY7hHn.js";import{U as Xe}from"./unverified-catalog-notice-BA7_V-80.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]=L.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",ke.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=Te(),d=Ae();return Le({...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:O}){const w=pe(),[S,h]=L.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:O??(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}=Oe(),{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}=De(),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,T;return((T=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:T.runsOn)==="credits"}}),{data:m,isError:O}=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,k=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=k?(m??[]).find(t=>t.value===k):void 0,D=(n==null?void 0:n.supportsEffort)??((ae=Ye(i,o))==null?void 0:ae.supportsEffort),B=D===void 0&&u,z=D!==!1,K=p?p.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:Q,creditsEntry:je,resolvedAccount:V}=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:Q(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&&V?Q(V):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=L.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:D,runtimeLabel:t=>H(t).label}),E=t=>{var b;return((b=Ne.breakages.find(T=>t.includes(T.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=L.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)??k??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:k,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&&O&&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?A(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:A(X),options:Ue.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:A(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?A(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(Qe,{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(Ve,{"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{aL as Ee,a1 as b,a3 as T,r as u,a4 as I,jQ as q,jR as M,ec as Be,jS as Ge,a2 as Q,j as e,jT as We,ij as we,eq as Ye,er as V,Q as Re,T as Ie,V as Le,B as O,hU as Ve,G as H,eP as He,ea as Je,jU as Xe,jV as Ze,e3 as Ae,ap as te,x as de,bw as es,J as ue,ee as me,en as C,eo as ne,aG as ss,jW as ts,I as U,jX as ns,jY as Ke,jZ as rs,_ as De,fA as as,eg as is,eh as os,ei as ls,ej as cs,ek as be,e6 as ds,C as us,j_ as ms,j$ as xs,k0 as hs,U as fs}from"./index-B48IJBNm.js";import{I as gs}from"./inline-code-BCFlKPIb.js";import{u as ps}from"./useMutationState-BX-ggHVY.js";import{O as ys,a as Y}from"./runtime-connect-Dn0T5YWv.js";function js(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function Ct(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Ot(s){var d,m;const t=b(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:()=>(a(null),t.provisionRuntime(s,x=>a(x))),onSuccess:x=>{x.ok&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((d=r.data)==null?void 0:d.ok)===!1,o=r.isError?r.error.message:((m=r.data)==null?void 0:m.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Te(s){return["runtime-key-status",s]}function vs(s,t=!0){const n=b();return Q({queryKey:Te(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function ks(s){const t=b(),n=I({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 Ns(s){var o,c,d;const t=b(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:async m=>{a("checking");const x=await t.checkRuntimeCredential(s,m);return x.ok?(a("saving"),await t.storeRuntimeCredential(s,m),{saved:!0,message:null}):{saved:!1,message:x.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:m=>{m.saved&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Te(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:m=>{m.trim().length!==0&&r.mutate(m)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((d=r.data)==null?void 0:d.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function bs(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function Ss(s,t){var E,K,L,S,v;const n=b(),i=T(),{sessionId:a,accountRoot:r,accountId:l,onCompleted:o}=t??{},c=Be(),d=l??(r?((E=c.accounts.find(N=>N.path===r))==null?void 0:E.id)??(c.ownResolvedAccount===r?"default":void 0):a?void 0:"default"),m=u.useMemo(()=>["runtime-login",s,a??"",d??r??""],[s,a,d,r]),x=I({mutationKey:m,mutationFn:()=>{if(s==="claude-code"&&r&&!d&&!a)throw new Error("Choose this account in Runtimes.");return n.delegateRuntimeLogin(s,s==="claude-code"?{sessionId:a,accountId:d}:a?{sessionId:a}:void 0)},onSuccess:N=>{i.invalidateQueries({queryKey:["claude-signin-policy"]}),N.ok&&(i.invalidateQueries({queryKey:Ge.all}),i.invalidateQueries({queryKey:[...q]}),i.invalidateQueries({queryKey:[...M]}))}}),p=ps({filters:{mutationKey:m,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),y=p.some(N=>N.state.status==="pending"),f=p[p.length-1],h=y||f==null?void 0:f.state,k=y||f==null?void 0:f.id,w=!y&&((h==null?void 0:h.status)==="error"||((K=h==null?void 0:h.data)==null?void 0:K.ok)===!1),F=(h==null?void 0:h.status)==="error"?((L=h.error)==null?void 0:L.message)??null:((S=h==null?void 0:h.data)==null?void 0:S.error)??null,R=((v=h==null?void 0:h.data)==null?void 0:v.ok)===!0,P=u.useRef(o);return P.current=o,u.useEffect(()=>{var _;if(!R||k===void 0)return;const N=bs(i);N.has(k)||(N.add(k),(_=P.current)==null||_.call(P))},[R,k,i]),{login:()=>{y||x.mutate()},isPending:y,isSuccess:R,isError:w,errorMessage:w?F??"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 Cs(s){return Ce[s]??Ce["claude-code"]}function Os({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(We,{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(Ye,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(V,{className:"size-3"})]})]})}function Pt({command:s,runtimeLabel:t}){const[n,i]=u.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(gs,{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(O,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ve,{className:"size-3"}),"Retry"]})]})}function Ps({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 Es(s){const t=He(),{data:n}=Je();return s?Xe(Ze(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",ws={title:xe,body:`Frontier models are unlocked. ${he}`},Rs={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Me(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function Is(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(es,{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 z({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 B({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(O,{size:"sm",onClick:t,children:"Try again"})]})}function Ls({type:s,onConnected:t,asOtherWay:n=!1}){const i=Cs(s),a=Ss(s),[r,l]=u.useState(!1),o=u.useRef(!1);return u.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Me(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(z,{message:"Signed in"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(O,{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(As,{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(O,{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 As({type:s,copy:t,onConnected:n}){var f,h;const[i,a]=u.useState(""),r=Ns(s),l=vs(s),o=ks(s),c=u.useRef(!1),d=u.useRef(null);if(u.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Me(me(s).label)))},[r.isSuccess,n,s]),u.useEffect(()=>{var k;r.isError&&((k=d.current)==null||k.focus())},[r.isError]),r.isSuccess)return e.jsx(z,{});const m=(f=l.data)!=null&&f.key.saved?l.data.key:null,x=i.trim().length>0,p=r.isPending||o.isPending,y=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:k=>{k.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(C,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:d,value:i,disabled:p,onChange:k=>{a(k.target.value),y()},placeholder:m?`Saved key ends in ${m.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(V,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"ghost",disabled:!x&&m===null||p,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:!x||p,children:"Save key"})]})]}),p?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((h=o.result)==null?void 0:h.ok)===!0?e.jsx(z,{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 Ks(s){const t=b(),n=Q({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(Ds,{saved:n.data,...s},JSON.stringify(n.data))}function Ds({saved:s,onConnected:t,onSave:n}){var D,X,W,Z,j,$,fe,ge,pe,ye,je,ve;const i=b(),a=T(),r=u.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=u.useState(n&&l==="dorkos-credits"?"api-key":l),[d,m]=u.useState(((X=s.inference)==null?void 0:X.protocol)??"openai-chat-completions"),[x,p]=u.useState(((W=s.inference)==null?void 0:W.endpoint)??""),[y,f]=u.useState(((Z=s.inference)==null?void 0:Z.provider)??""),[h,k]=u.useState(((j=s.inference)==null?void 0:j.model)??""),[w,F]=u.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[R,P]=u.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[E,K]=u.useState(""),[L,S]=u.useState(null),v=Q({queryKey:["doe-credits-models",d],queryFn:()=>i.getDoeCreditsModels(d),enabled:o==="dorkos-credits"}),N=o==="dorkos-credits"?(ge=v.data)==null?void 0:ge.models.find(g=>g.id===h):void 0,_=s.hasKey&&((pe=s.inference)==null?void 0:pe.endpoint)===x&&s.inference.source==="api-key",J=I({mutationFn:async g=>{if(n)return n(g,E.trim()||null);o==="api-key"&&E.trim()?await i.storeDoeCredential(g,E.trim()):await i.setDoeInference(g),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{K("");for(const g of[["doe-inference"],q,M,ss.all,ts.status()])a.invalidateQueries({queryKey:g});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:g=>S(n&&g instanceof Error&&g.message?g.message:"Couldn’t save model settings. Try again.")});function re(g){var ke,Ne;if(g.preventDefault(),S(null),E.trim().startsWith("sk-ant-oat")){S("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!E.trim()&&!_){S("Enter an API key.");return}if(o==="dorkos-credits"&&(!N||!((ke=v.data)!=null&&ke.endpoint))){S("Link DorkOS credits and choose an available model.");return}const ae=ns.safeParse({source:o,protocol:d,provider:o==="dorkos-credits"?"dorkos":y,endpoint:o==="dorkos-credits"?(Ne=v.data)==null?void 0:Ne.endpoint:x,model:h,contextWindow:(N==null?void 0:N.contextWindow)??Number(w),maxOutputTokens:(N==null?void 0:N.maxOutputTokens)??Number(R)});if(!ae.success){S("Check the model, endpoint, and token limits.");return}J.mutate(ae.data)}const G="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(C,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:G,value:o,onChange:g=>{c(g.target.value),k("")},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(C,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:G,value:d,onChange:g=>{m(g.target.value),o==="dorkos-credits"&&k("")},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(C,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:G,value:h,onChange:g=>k(g.target.value),disabled:v.isPending||!((ye=v.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=v.data)==null?void 0:je.models.map(g=>e.jsx("option",{value:g.id,children:g.displayName},g.id))]}),!((ve=v.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(C,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(U,{id:`${r}-service`,value:y,onChange:g=>f(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(U,{id:`${r}-endpoint`,type:"url",value:x,onChange:g=>p(g.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(C,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(U,{id:`${r}-model`,value:h,onChange:g=>k(g.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(C,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(U,{id:`${r}-context`,type:"number",min:1,value:w,onChange:g=>F(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(U,{id:`${r}-output`,type:"number",min:1,value:R,onChange:g=>P(g.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:E,onChange:g=>K(g.target.value),autoComplete:"off"}),_&&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(O,{type:"submit",disabled:J.isPending,children:J.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ts={openai:"OpenAI",anthropic:"Anthropic"};function Ms(s){return Ts[s]??s}function qs(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 Fs(s){const t=b();return Q({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function $s(){const s=b(),t=T(),n=I({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...q]}),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 Q({queryKey:$e,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function Us(){var i;const s=b(),t=I({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 zs(){var l,o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async({providerId:d,key:m,baseURL:x})=>{const p=(x==null?void 0:x.trim())||null;i("checking");const y=await s.checkProviderCredential(d,m.trim().length>0?m:null,p);return y.ok?(i("saving"),await s.storeProviderCredential(d,m,p),{saved:!0,message:null}):{saved:!1,message:y.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[...$e]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:d=>{d.providerId.trim().length!==0&&a.mutate(d)},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 Qs(s){const t=b();return Q({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Bs(){var o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async d=>{i(null);const m=await s.pullOllamaModel(d,x=>i(x));return m.ok&&await s.updateConfig({runtimes:{opencode:{provider:qe}}}),m},onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:[...q]}),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:d=>a.mutate(d),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Gs(){var o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:()=>(i(null),s.provisionOllama(d=>i(d))),onSuccess:d=>{d.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 Ws="https://ollama.com/download",Ys="curl -fsSL https://ollama.com/install.sh | sh";function Vs({installMethod:s}){const t=Gs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Hs,{}),n?e.jsx(Js,{provision:t}):e.jsx(Xs,{}),e.jsx(Zs,{})]})}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 Js({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(B,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(O,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Xs(){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(Os,{command:Ys,copyLabel:"Copy the Ollama install command"})]})}function Zs(){return e.jsxs("a",{href:Ws,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(V,{className:"size-3"})]})}const et="https://ollama.com/library",st={"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"}},tt={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function nt({active:s,onConnected:t,onConnectDirectly:n}){var R,P,E,K,L,S;const i=Fs(s),a=$s(),r=Bs(),l=((R=i.data)==null?void 0:R.running)??!1,o=Qs(l),[c,d]=u.useState(null),[m,x]=u.useState(null);u.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),u.useEffect(()=>{var v;(v=r.result)!=null&&v.ok&&(t==null||t(Pe))},[(P=r.result)==null?void 0:P.ok,t]);const p=v=>{d(v),a.connect(v)},y=v=>{x(v),r.pull(v)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Vs,{installMethod:(E=i.data)==null?void 0:E.installMethod});if(a.isSuccess)return t?null:e.jsx(z,{message:"Connected to Ollama"});if((K=r.result)!=null&&K.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(rs,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const f=i.data,h=(f==null?void 0:f.installed)??[],k=((L=f==null?void 0:f.installed)==null?void 0:L.length)??(f==null?void 0:f.models.length)??0,w=((S=o.data)==null?void 0:S.models.some(v=>v.model.id===m))??!1,F=m!==null&&!w?m:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(rt,{count:k}),h.length>0&&e.jsx(at,{installed:h,connect:a,connectingId:c,onUse:p}),e.jsx(it,{catalogQuery:o,pull:r,pullingId:m,onGet:y}),e.jsx(ot,{pull:r,activePull:F,onSubmit:y}),e.jsx(lt,{}),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 rt({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=st[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:tt[s]})}function at({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(O,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(B,{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 it({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 d=n===l.id,m=()=>i(l.id);return d&&(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(B,{message:t.errorMessage??"Couldn’t download the model.",onRetry:m})]},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(O,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:m,children:"Get"})]},l.id)})})]})}function ot({pull:s,activePull:t,onSubmit:n}){const[i,a]=u.useState(""),r=i.trim(),l=ys.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(C,{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(U,{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(O,{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(B,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function lt(){return e.jsxs("a",{href:et,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(V,{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 ct(){var r,l,o;const s=b(),t=T(),n=I({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...q]}),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 dt(){var p,y;const s=b(),t=T(),[n,i]=u.useState(null),[a,r]=u.useState(null),l=I({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:f,state:h})=>{if(!as(f)){r("Couldn’t open the OpenRouter sign-in page.");return}i(h)},onError:f=>r(f.message??"Couldn’t start OpenRouter sign-in.")}),o=Q({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="pending"?1500:!1},refetchOnWindowFocus:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="error"}}),c=(p=o.data)==null?void 0:p.status;u.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const d=l.isPending||n!==null&&c==="pending",m=!!a||c==="error",x=m?a??((y=o.data)==null?void 0:y.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:d,isSuccess:c==="connected",isError:m,errorMessage:x}}const ut="https://openrouter.ai/keys";function mt({onConnected:s}){const[t,n]=u.useState(""),i=ct(),a=dt(),r=i.isSuccess||a.isSuccess;return u.useEffect(()=>{r&&(s==null||s(ws))},[r,s]),r?e.jsx(z,{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(B,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(O,{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(C,{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:ut,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(V,{className:"size-3"})]}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function ee(s){return Y.find(t=>t.id===s)}function xt(s){var t;return((t=ee(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=Y.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??Y[0].defaultBaseURL}function Qe(s){return Y.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 ht({onConnected:s}){const t=_s();return t.isError&&!t.data?e.jsx(B,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ft,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ft({setup:s,onConnected:t}){var Z;const n=Qe(s)?s:null,[i,a]=u.useState(()=>ie(s)),[r,l]=u.useState(""),[o,c]=u.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=ee(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[d,m]=u.useState(()=>{var $;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=ee(j))==null?void 0:$.defaultBaseURL)}),x=zs(),p=Us(),y=ee(i),f=xt(i),h=n!=null&&n.key.saved&&n.providerId===f?n.key.last4:null,k=o.trim(),w=i===se,F=!w||k.length>0,R=ce(f),P=k||R,E=P===R?"":P,K=n===null?null:n.baseURL??ce(n.providerId),L=f!==((n==null?void 0:n.providerId)??null)||P!==K,S=r.trim().length>0,N=(S||h!==null&&!L)&&F,_=S&&F,J=!S&&h!==null&&L,re=P.startsWith("http://"),G={providerId:f,key:r,baseURL:E},D=x.isPending||p.isPending,X=u.useRef(null),W=()=>{p.reset(),x.reset()};return u.useEffect(()=>{x.isSuccess&&(t==null||t(Rs))},[x.isSuccess,t]),u.useEffect(()=>{var j;x.isError&&((j=X.current)==null||j.focus())},[x.isError]),x.isSuccess?e.jsx(z,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),p.reset(),x.connect(G)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(is,{value:i,disabled:D,onValueChange:j=>{var $;a(j),c((($=ee(j))==null?void 0:$.defaultBaseURL)??""),W()},children:[e.jsx(os,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(ls,{})}),e.jsxs(cs,{children:[Y.map(j=>e.jsx(be,{value:j.id,children:j.label},j.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(w||d)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!w&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(U,{id:"direct-provider-base-url",value:o,disabled:D,onChange:j=>{c(j.target.value),W()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!w&&!d&&e.jsx("button",{type:"button",onClick:()=>m(!0),disabled:D,"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(C,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:X,value:r,disabled:D,onChange:j=>{l(j.target.value),W()},placeholder:h===null?(y==null?void 0:y.keyPlaceholder)??Y[0].keyPlaceholder:`Saved key ends in ${h}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),x.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x.errorMessage}),J&&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:[y===void 0?e.jsx("span",{}):e.jsxs("a",{href:y.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(V,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"outline",disabled:!N||D,"data-testid":"direct-provider-test",onClick:()=>{x.reset(),p.reset(),p.check(G)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",disabled:!_||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:x.phase==="saving"?"Saving…":"Checking your key…"}):((Z=p.result)==null?void 0:Z.ok)===!0?e.jsx(z,{message:p.checkedSavedKey?"Your saved key works":"Key works"}):p.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:p.result.message}):null]})}function gt({currentProvider:s,onConnected:t}){const[n,i]=u.useState("choose"),a=pt();if(n==="choose")return e.jsx(yt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(mt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(nt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(ht,{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 yt({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: ",qs(n)]}),Object.values(s).map(i=>e.jsx(jt,{source:i,onChoose:t},i.step))]})}function jt({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(us,{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(ds,{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 vt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=js(),r=Es(s),l=ms(),o=xs(),c=hs([s]);if(s==="doe")return a?e.jsx(Ks,{onConnected:i}):e.jsx(Oe,{});const d=r==="lead"&&l!==null,m=a?t.kind==="provider-picker"?e.jsx(gt,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Ls,{type:s,onConnected:i,asOtherWay:d}):null:e.jsx(Oe,{});if(m===null)return null;const x=me(s).label,p=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 ",x," runs on your DorkOS credits.",c.map(f=>` ${f}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:m})]});const y=f=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:f,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Is(x))}});return d?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[y(!0),e.jsx(le,{children:m}),e.jsx(Ps,{ollama:p,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[m,e.jsx(le,{children:y(!1)})]}):m}function le({collapsed:s=!1,children:t}){const[n,i]=u.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(fs,{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 Et=s=>e.jsx(vt,{...s});export{Pt as C,Os as D,Ps as K,Oe as R,Ss as a,js as b,Ct as c,qs as d,Es as e,Ks as f,Cs as g,Et as r,Ot as u};
|
package/dist/client/assets/{RuntimeSetupDialog-E6f7Rd2W.js → RuntimeSetupDialog-NKy3mLEH.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,bq as Y,eH as U,eI as G,j as e,eJ as J,eK as Q,bp as W,bn as C,bm as M,eL as V,bo as X,eM as Z,eN as q,eO as ee,bv as te,eP as ne,aJ as se,a9 as re,eQ as ae,ea as oe,eR as z,d2 as ie,d3 as ce,d5 as le,d6 as de,d7 as ue,eD as fe,ef as k,J as D,B as S,e4 as A,eS as me,G as E,Q as xe,T as pe,U as ve,V as he,bX as ge,ar as I,x as Ce,by as be}from"./index-p3WivF1M.js";import{I as je}from"./inline-code-14c1Gacs.js";import{l as Re}from"./list-runtime-types-iJaKcim4.js";import{D as O,u as Ne,C as Pe}from"./RuntimeConnectFlow-BAqkzthF.js";var Se=Object.defineProperty,b=(t,n)=>Se(t,"name",{value:n,configurable:!0}),T,_="HoverCard",[F,Ze]=Y(_,[U]),L=U(),[we,H]=F(_),He=b(t=>{const{__scopeHoverCard:n,children:r,open:o,defaultOpen:s,onOpenChange:c,openDelay:a=700,closeDelay:f=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,m]=G({prop:o,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>m(!0),a)},[a,m]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>m(!1),f))},[f,m]),h=l.useCallback(()=>m(!1),[m]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(we,{scope:n,open:u,onOpenChange:m,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(J,{...x,children:r})})},"HoverCard"),Te="HoverCardTrigger",ye=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,...s}=n,c=H(Te,o),a=L(o);return e.jsx(Q,{asChild:!0,...a,children:e.jsx(W.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,w(c.onOpen)),onPointerLeave:C(n.onPointerLeave,w(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,f=>f.preventDefault())})})},"HoverCardTrigger")),B="HoverCardPortal",[ke,De]=F(B,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:o,container:s}=t,c=H(B,n);return e.jsx(ke,{scope:n,forceMount:r,children:e.jsx(M,{present:r||c.open,children:e.jsx(V,{asChild:!0,container:s,children:o})})})},"HoverCardPortal"),y="HoverCardContent",Oe=l.forwardRef(b(function(n,r){const o=De(y,n.__scopeHoverCard),{forceMount:s=o.forceMount,...c}=n,a=H(y,n.__scopeHoverCard);return e.jsx(M,{present:s||a.open,children:e.jsx(_e,{"data-state":a.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,w(a.onOpen)),onPointerLeave:C(n.onPointerLeave,w(a.onClose)),ref:r})})},"HoverCardContent")),_e=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:a,onInteractOutside:f,...x}=n,i=H(y,o),p=L(o),v=l.useRef(null),g=X(r,v),[u,m]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return T=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=T,d.style.webkitUserSelect=T}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{m(!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&&K(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(Z,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(a,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(q,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&m(!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 w(t){return n=>n.pointerType==="touch"?void 0:t()}b(w,"excludeTouch");function K(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(o=>o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(K,"getTabbableNodes");var Le=He,$e=ye,Ie=Ee,Ue=Oe;function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card",...t})}function et({...t}){return e.jsx($e,{"data-slot":"hover-card-trigger",...t})}function tt({className:t,align:n="center",sideOffset:r=4,...o}){const s=ee();return e.jsx(Ie,{"data-slot":"hover-card-portal",container:s,children:e.jsx(Ue,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:te("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),...o})})}function Me(t,n,r){return r?ne(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:se.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${re(t)}`}}:null:null}function ze(t,n,r){return t?[t]:n||Re(r)}function Ae({runtime:t,types:n,requirements:r,registeredTypes:o=[],onRecheck:s,isRechecking:c=!1,renderConnect:a}){const f=A(),x=ze(t,n,o);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Fe,{type:i,requirements:r,registered:o.includes(i),renderConnect:a},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(me,{className:E("size-3.5",c&&!f&&"animate-spin")}),"Check again"]})]})]})}function Fe({type:t,requirements:n,registered:r,renderConnect:o}){var N,P,$;const s=k(t),c=s.icon,a=n==null?void 0:n.runtimes[t],f=z(n,t,r),x=f.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?Me(t,a==null?void 0:a.provider,!!o):null,m=a==null?void 0:a.dependencies.find(R=>R.status!=="satisfied"&&R.installHint),d=(m==null?void 0:m.installHint)??((N=s.setup)==null?void 0:N.installCommand),j=(m==null?void 0:m.infoUrl)??((P=s.setup)==null?void 0:P.infoUrl),h=!!a||!!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(D,{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:[o==null?void 0:o({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})]}),f.state==="unknown"&&e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:($=a==null?void 0:a.dependencies.find(R=>R.status==="unknown"))==null?void 0:$.description}),!x&&f.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Be,{type:t,connect:f.connect,renderConnect:o,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(xe,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(pe,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ve,{className:E("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(he,{className:"mt-3 space-y-3",children:a?a.dependencies.map(R=>e.jsx(Ge,{dep:R},R.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(je,{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 Be({type:t,connect:n,renderConnect:r,installCommand:o,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Ke,{type:t,label:n.label,installCommand:o,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 Ke({type:t,label:n,installCommand:r,installInfoUrl:o}){const s=k(t),{provision:c,isPending:a,isError:f,errorMessage:x,progress:i,result:p}=Ne(t);return a||p!=null&&p.ok?e.jsx(Ye,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):f?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:o,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(Pe,{command:r,runtimeLabel:s.label})]})}function Ye({message:t}){const n=A();return e.jsxs(I.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(Ce,{size:"xs",className:E("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(be,{mode:"wait",children:e.jsx(I.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 Ge({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(D,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(ge,{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 nt({runtime:t,open:n,onOpenChange:r,renderConnect:o,onRuntimeReady:s,showConnectSuccess:c=!1}){const a=ae(),{data:f}=oe(),x=t?k(t):null,i=z(a.data,t??"",f?t!==void 0&&t in f.capabilities:!0),p=a.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,m]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&m(null),d.current=n},[n]);const j=o&&(c?h=>o({...h,onConnected:N=>{var P;(P=h.onConnected)==null||P.call(h,N),m(N)}}):o);return e.jsx(ie,{open:n,onOpenChange:r,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(de,{children:x?x.label:"Your runtimes"}),e.jsx(ue,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(fe,{children:u?e.jsx(Je,{success:u,onDone:()=>r(!1)}):e.jsx(Ae,{runtime:t,requirements:a.data,registeredTypes:f?Object.keys(f.capabilities):void 0,onRecheck:()=>void a.refetch(),isRechecking:a.isFetching,renderConnect:j})})]})})}function Je({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(D,{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{qe as H,nt as R,et as a,tt as b,Ae as c};
|
|
1
|
+
import{r as l,bo as G,eG as U,eH as Y,j as e,eI as Q,eJ as V,bn as W,bl as C,bk as M,eK as J,bm as X,eL as Z,eM as q,eN as ee,bt as te,eO as ne,aH as se,a7 as re,eP as ae,e9 as oe,eQ as z,d0 as ie,d1 as ce,d3 as le,d4 as de,d5 as ue,eC as fe,ee as y,J as D,B as S,e3 as A,eR as me,G as E,Q as xe,T as pe,U as ve,V as he,bV as ge,ap as I,x as Ce,bw as be}from"./index-B48IJBNm.js";import{I as je}from"./inline-code-BCFlKPIb.js";import{l as Re}from"./list-runtime-types-B1J9AtqH.js";import{D as O,u as Ne,C as Pe}from"./RuntimeConnectFlow-hhvWVRMu.js";var Se=Object.defineProperty,b=(t,n)=>Se(t,"name",{value:n,configurable:!0}),T,_="HoverCard",[F,Ze]=G(_,[U]),L=U(),[we,H]=F(_),He=b(t=>{const{__scopeHoverCard:n,children:r,open:o,defaultOpen:s,onOpenChange:c,openDelay:a=700,closeDelay:f=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,m]=Y({prop:o,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>m(!0),a)},[a,m]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>m(!1),f))},[f,m]),h=l.useCallback(()=>m(!1),[m]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(we,{scope:n,open:u,onOpenChange:m,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(Q,{...x,children:r})})},"HoverCard"),Te="HoverCardTrigger",ke=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,...s}=n,c=H(Te,o),a=L(o);return e.jsx(V,{asChild:!0,...a,children:e.jsx(W.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,w(c.onOpen)),onPointerLeave:C(n.onPointerLeave,w(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,f=>f.preventDefault())})})},"HoverCardTrigger")),B="HoverCardPortal",[ye,De]=F(B,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:o,container:s}=t,c=H(B,n);return e.jsx(ye,{scope:n,forceMount:r,children:e.jsx(M,{present:r||c.open,children:e.jsx(J,{asChild:!0,container:s,children:o})})})},"HoverCardPortal"),k="HoverCardContent",Oe=l.forwardRef(b(function(n,r){const o=De(k,n.__scopeHoverCard),{forceMount:s=o.forceMount,...c}=n,a=H(k,n.__scopeHoverCard);return e.jsx(M,{present:s||a.open,children:e.jsx(_e,{"data-state":a.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,w(a.onOpen)),onPointerLeave:C(n.onPointerLeave,w(a.onClose)),ref:r})})},"HoverCardContent")),_e=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:a,onInteractOutside:f,...x}=n,i=H(k,o),p=L(o),v=l.useRef(null),g=X(r,v),[u,m]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return T=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=T,d.style.webkitUserSelect=T}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{m(!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&&K(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(Z,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(a,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(q,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&m(!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 w(t){return n=>n.pointerType==="touch"?void 0:t()}b(w,"excludeTouch");function K(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(o=>o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(K,"getTabbableNodes");var Le=He,$e=ke,Ie=Ee,Ue=Oe;function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card",...t})}function et({...t}){return e.jsx($e,{"data-slot":"hover-card-trigger",...t})}function tt({className:t,align:n="center",sideOffset:r=4,...o}){const s=ee();return e.jsx(Ie,{"data-slot":"hover-card-portal",container:s,children:e.jsx(Ue,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:te("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),...o})})}function Me(t,n,r){return r?ne(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:se.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${re(t)}`}}:null:null}function ze(t,n,r){return t?[t]:n||Re(r)}function Ae({runtime:t,types:n,requirements:r,registeredTypes:o=[],onRecheck:s,isRechecking:c=!1,renderConnect:a}){const f=A(),x=ze(t,n,o);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Fe,{type:i,requirements:r,registered:o.includes(i),renderConnect:a},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(me,{className:E("size-3.5",c&&!f&&"animate-spin")}),"Check again"]})]})]})}function Fe({type:t,requirements:n,registered:r,renderConnect:o}){var N,P,$;const s=y(t),c=s.icon,a=n==null?void 0:n.runtimes[t],f=z(n,t,r),x=f.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?Me(t,a==null?void 0:a.provider,!!o):null,m=a==null?void 0:a.dependencies.find(R=>R.status!=="satisfied"&&R.installHint),d=(m==null?void 0:m.installHint)??((N=s.setup)==null?void 0:N.installCommand),j=(m==null?void 0:m.infoUrl)??((P=s.setup)==null?void 0:P.infoUrl),h=!!a||!!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(D,{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:[o==null?void 0:o({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})]}),f.state==="unknown"&&e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:($=a==null?void 0:a.dependencies.find(R=>R.status==="unknown"))==null?void 0:$.description}),!x&&f.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Be,{type:t,connect:f.connect,renderConnect:o,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(xe,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(pe,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ve,{className:E("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(he,{className:"mt-3 space-y-3",children:a?a.dependencies.map(R=>e.jsx(Ye,{dep:R},R.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(je,{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 Be({type:t,connect:n,renderConnect:r,installCommand:o,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Ke,{type:t,label:n.label,installCommand:o,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 Ke({type:t,label:n,installCommand:r,installInfoUrl:o}){const s=y(t),{provision:c,isPending:a,isError:f,errorMessage:x,progress:i,result:p}=Ne(t);return a||p!=null&&p.ok?e.jsx(Ge,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):f?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:o,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(Pe,{command:r,runtimeLabel:s.label})]})}function Ge({message:t}){const n=A();return e.jsxs(I.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(Ce,{size:"xs",className:E("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(be,{mode:"wait",children:e.jsx(I.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(D,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(ge,{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 nt({runtime:t,open:n,onOpenChange:r,renderConnect:o,onRuntimeReady:s,showConnectSuccess:c=!1}){const a=ae(),{data:f}=oe(),x=t?y(t):null,i=z(a.data,t??"",f?t!==void 0&&t in f.capabilities:!0),p=a.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,m]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&m(null),d.current=n},[n]);const j=o&&(c?h=>o({...h,onConnected:N=>{var P;(P=h.onConnected)==null||P.call(h,N),m(N)}}):o);return e.jsx(ie,{open:n,onOpenChange:r,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(de,{children:x?x.label:"Your runtimes"}),e.jsx(ue,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(fe,{children:u?e.jsx(Qe,{success:u,onDone:()=>r(!1)}):e.jsx(Ae,{runtime:t,requirements:a.data,registeredTypes:f?Object.keys(f.capabilities):void 0,onRecheck:()=>void a.refetch(),isRechecking:a.isFetching,renderConnect:j})})]})})}function Qe({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(D,{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{qe as H,nt as R,et as a,tt as b,Ae as c};
|