dorkos 0.125.3 → 0.126.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 +87749 -87287
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-DSSx1Gzx.js → AboutPage-2c9n8B32.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-C-mLOmJm.js → ActivityErrorState-muwC_jif.js} +1 -1
- package/dist/client/assets/{ActivityPage-DsOjjulF.js → ActivityPage-2aUz3zv0.js} +1 -1
- package/dist/client/assets/{ActivityRow-ylgCMe7Y.js → ActivityRow-nQBqDCak.js} +1 -1
- package/dist/client/assets/{AdapterIcon-DT5OdFbe.js → AdapterIcon-ChpyilnO.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-C6jxF55P.js → AdapterSetupWizard-DRKQp5Gh.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-CtdBmX9G.js → AgentOptionRow-CeVPhvTq.js} +1 -1
- package/dist/client/assets/{AgentPicker--wr93sVO.js → AgentPicker-D8YX1P_q.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-DVoE2cnk.js → AgentRequestCard-refCLvuV.js} +3 -3
- package/dist/client/assets/{AppearancePage-DR_g6BJO.js → AppearancePage-BDTIp3j0.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-BqaoB6AS.js → ApplyToOverridesDialog-C-XL9N4W.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-CM0TrrbJ.js → AttentionSignalRow-Dn4rP542.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-DJ54CELa.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-B0sy0nRk.js} +1 -1
- package/dist/client/assets/{BindingDialog-JAPULq7H.js → BindingDialog-DMYB-vWm.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-B3-FjszN.js → BlintzCanvas-D9ZLEDXc.js} +28 -28
- package/dist/client/assets/{CanvasCsvContent-Cmqry1BS.js → CanvasCsvContent-DMqGpNWm.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-BMkxUF1r.js → CanvasFileContent-Bxhc86lv.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-DBhuNbFD.js → CanvasModel3dContent-D783Ql7m.js} +2 -2
- package/dist/client/assets/ChannelComposer-BNlD-d2W.js +44 -0
- package/dist/client/assets/{ChatAppsOff-CY5_0lQH.js → ChatAppsOff-eRAfqzJR.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-_EI44zW6.js → CodeMirrorDiff-CqEUAG6G.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-x1lTuDQH.js → CodeMirrorEditor-BM1ANude.js} +1 -1
- package/dist/client/assets/{CommitmentList-D-CvccnF.js → CommitmentList-C3QvbbGF.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-CLw1FRLv.js → CommitmentsPage-bmqKNd-Z.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-QJnXivV4.js → ComputerResourceView-78falOZG.js} +1 -1
- package/dist/client/assets/{ComputerViewer-DbTGz3OL.js → ComputerViewer-DZ2RiDbn.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-CB5UY0f0.js → ConnectionAccessLists-CXsNyR4U.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-SpEJxCeF.js → ConnectionsPage-bpkRfRRK.js} +2 -2
- package/dist/client/assets/{ConventionPage-C2NIZjG3.js → ConventionPage-rYtICYjS.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-Drr5uceG.js → ExtensionPageRoute-DXTqUrR4.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-kKteNmsx.js → FloatingTanStackRouterDevtools-CqogiFob-CCNB3_Gb.js} +1 -1
- package/dist/client/assets/ForwardConsentHost-BfVnJ6oD.js +1 -0
- package/dist/client/assets/HandlePage-BH_G4sMV.js +1 -0
- package/dist/client/assets/{HeartbeatPage-BLGTx_57.js → HeartbeatPage-DdAfcR81.js} +1 -1
- package/dist/client/assets/{KeyEntry-DgN8iewR.js → KeyEntry-CR7GBqXf.js} +1 -1
- package/dist/client/assets/{LexicalField-Bfj72GvX.js → LexicalField-RAoub3wq.js} +2 -2
- package/dist/client/assets/{ManagesPage-C3G1-Mep.js → ManagesPage-CEhYj9ov.js} +1 -1
- package/dist/client/assets/{Marketplace-Dg0bIo7_.js → Marketplace-DtxHDbF4.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-KPw8YYXi.js → MarketplaceSourcesView-CSFvFtV_.js} +1 -1
- package/dist/client/assets/{McpAppFrame-DjJ4EM39.js → McpAppFrame-1mPdRK9p.js} +2 -2
- package/dist/client/assets/{McpSigninBody-V6RSsDqe.js → McpSigninBody--HfjMnE1.js} +1 -1
- package/dist/client/assets/{Model3dViewer-woNPO5OC.js → Model3dViewer-BT2SY67i.js} +1 -1
- package/dist/client/assets/NamePage-CaJsVRhh.js +1 -0
- package/dist/client/assets/NewDirectMessageMenu-QUtJTzKI.js +1 -0
- package/dist/client/assets/{NotificationsPage-kUtiVsFS.js → NotificationsPage-D3fleW0i.js} +1 -1
- package/dist/client/assets/OpenMeshSwitch-8WEn0WrA.js +5 -0
- package/dist/client/assets/{OperatorIdentityForm-B29T-N9x.js → OperatorIdentityForm-BRKAQS0D.js} +1 -1
- package/dist/client/assets/{PermissionHistory-CV8cFJr3.js → PermissionHistory-5stLHBu8.js} +1 -1
- package/dist/client/assets/{PermissionsPage-_PKlbWde.js → PermissionsPage-C2pB1TCJ.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BOXTCA6E.js → PersonalityPopover-DIbsJ6HP.js} +1 -1
- package/dist/client/assets/PhotoPage-33Xh8sq1.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-CdHja8fU.js → PreviewRefusedNotice-CjT7jQ45.js} +1 -1
- package/dist/client/assets/{ProfileFields-C48alR3i.js → ProfileFields-gZNaFBow.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-BpJVbdUL.js → ProfilePanelContainer-DYf7L8xJ.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-DtuSZNaw.js → ProfileRolePicker-DclYXFSP.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-DT-JdGeO.js → PromptSuggestionChips-k9HolS90.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-BP2nxz2E.js → ReportsToPopover-Bh5KrFbJ.js} +1 -1
- package/dist/client/assets/RoomSurface-32U7Wl6Z.js +1 -0
- package/dist/client/assets/{RoomsPage-gDIy73MQ.js → RoomsPage-sdMZgHla.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-DhXG88Uj.js → RunsOnPopover-B5_Jz7ir.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-C_6ozpAK.js +1 -0
- package/dist/client/assets/RuntimeSetupDialog-BDvzruM4.js +1 -0
- package/dist/client/assets/SeenDevices-CZ--8ljN.js +19 -0
- package/dist/client/assets/{SessionsPage-C6nmCWVM.js → SessionsPage-BKyrJh1O.js} +1 -1
- package/dist/client/assets/SettingsDialog-E5hPag3F.js +12 -0
- package/dist/client/assets/{SkillsPage-DSIKEsHr.js → SkillsPage-BeL6zfgw.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-Cst7UxoY.js → TaskDialogWrapper-B-IP5hYv.js} +1 -1
- package/dist/client/assets/TasksEmptyState-BcftWVbk.js +3 -0
- package/dist/client/assets/TasksPage-CmroTI1v.js +1 -0
- package/dist/client/assets/{TeamComputerEntry-uj1GcPP_.js → TeamComputerEntry-DbfoZrZz.js} +1 -1
- package/dist/client/assets/{ToolsPage-Qm6x37SO.js → ToolsPage-h-PS45fZ.js} +1 -1
- package/dist/client/assets/{TopologyGraph-2C3Ij6tO.js → TopologyGraph-Bk_0y0Yy.js} +15 -15
- package/dist/client/assets/{TourHost-BsV8lcXT.js → TourHost-D4La-1-E.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-ClNn0nv6.js → UnlinkDialog-CWd4fhT4.js} +1 -1
- package/dist/client/assets/UnreadDivider-Bvg9QLn9.js +1 -0
- package/dist/client/assets/{WidgetErrorCard-oq5MKUX_.js → WidgetErrorCard-DictdlWO.js} +2 -2
- package/dist/client/assets/WorkView-DxThzZ0w.js +51 -0
- package/dist/client/assets/{_shell-D4V8GQqV.js → _shell-CX_gaQPE.js} +22 -22
- package/dist/client/assets/{_shell._home-DoaHLKk8.js → _shell._home-CBNsPEH4.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BP1byb8g.js → _shell._home.activity-DpSGWVSW.js} +1 -1
- package/dist/client/assets/_shell._home.index-BWH93iWg.js +3 -0
- package/dist/client/assets/_shell._home.tasks-Ive4UW8c.js +1 -0
- package/dist/client/assets/{_shell._home.workspaces-BcOiklL5.js → _shell._home.workspaces-3R3VtH7x.js} +1 -1
- package/dist/client/assets/{_shell.channels-DxSDnd-3.js → _shell.channels-DRslcaiA.js} +4 -4
- package/dist/client/assets/{_shell.connections-YKOm7ap5.js → _shell.connections-BPQxNUPD.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-DC2Jw1EF.js → _shell.feedback-requests-DkXEk3qm.js} +2 -2
- package/dist/client/assets/_shell.marketplace-D8deZF5L.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-BHG9MqWR.js +1 -0
- package/dist/client/assets/_shell.session-CkdA2hgF.js +1 -0
- package/dist/client/assets/{_shell.team-C9QJNwaK.js → _shell.team-CZu-l34d.js} +3 -3
- package/dist/client/assets/_shell.threads-Cz-EZQXr.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-Cry6E5KK.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-Cry6E5KK.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-sjxf16g2.js → abnfDiagram-WEYOIA3C-4hI8_uRi.js} +1 -1
- package/dist/client/assets/{access-copy-_81ChCG3.js → access-copy-BegDAoeR.js} +1 -1
- package/dist/client/assets/{arc-B-c5OGeX.js → arc-DgydwPM5.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-CExq4B1X.js → architectureDiagram-ZHVYKT53-4kexDkbn.js} +1 -1
- package/dist/client/assets/{banner-BhzLIs7u.js → banner-CYV5jQI0.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-C1D5MR7Z.js → blockDiagram-RJAE7QA3-BUP4L5_m.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DMtF_wcg.js → c4Diagram-XDPPPE54-B4HK3S3o.js} +1 -1
- package/dist/client/assets/{card-Dsy8PPN6.js → card-6VNSI3kT.js} +1 -1
- package/dist/client/assets/channel-Bf4e4rlX.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-DCmxZwyD.js → chunk-2E7WHVMD-Bhw5hCVI.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-BXvjhtJ3.js → chunk-2Q5K7J3B-CeUgfCvO.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-CR6qWjas.js → chunk-4EMNKR2T-DqSZunXx.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-Bny7RY06.js → chunk-55XCU76K-Bigp9-bU.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-B9aD4Uib.js → chunk-5VM5RSS4-DF1L8DrH.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-D28Xa5gr.js → chunk-JWPE2WC7-lcFap_43.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-CLgnUSgl.js → chunk-VQ5W62QI-Bgmsy9NF.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-vMTRVR5A.js → chunk-XXDRQBXY-DFFzLm_u.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-Ck0VFEtd.js → chunk-ZCHMQSOR-B4aJwBdo.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-Dh4gPh4M.js → classDiagram-v2-4MYWR3UA-BdUAMGnS.js} +1 -1
- package/dist/client/assets/{command-CxjTPW0z.js → command-Dz2pZLle.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-BA-tF0x7.js → cose-bilkent-JH36ORCC-BdJxQmWe.js} +1 -1
- package/dist/client/assets/{cpu-SRODWAA1.js → cpu-CjKJ8pVl.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-B_kxrTf4.js → cynefin-EF2NZ3EQ-BvnDWKe0.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-Be0brpVq.js → cynefinDiagram-WF24UDRP-DKL8UyvS.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-zI9I0fUC.js → dagre-NK4GIZVX-CCuJpxlY.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-jN0pUEKR.js → diagram-CBK3MWTC-C1jeuv8r.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-BjRZmmQf.js → diagram-I5XIIV2D-CSnTyOU0.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-BtnkiX3a.js → diagram-ODIL2UCW-9w6q1YKi.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-Bteh9wpL.js → diagram-PFBEJUXE-BMFBmD0P.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-hRmqKbOC.js → diagram-RJA3I4VV-D9Utl6qX.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-NKdthGes.js → diagram-TYUNFSNR-u_ogc51l.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-CpkD13ID.js → ebnfDiagram-V4P3TTPT-Bg_smbFH.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-Dw4bdkn4.js → elk-QONTBCTQ-CtuwbIK2.js} +1 -1
- package/dist/client/assets/{empty-state-Xw8KQdod.js → empty-state-CbFKhqwB.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-fiThyiH_.js → erDiagram-KYQIGQAA-MlvYHdZ7.js} +1 -1
- package/dist/client/assets/{execution-config-ryHuiBdx.js → execution-config-BjNjQoBp.js} +1 -1
- package/dist/client/assets/{file-CbZILJJL.js → file-JokR8lB2.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-rCHuN_aY.js → file-exclamation-point-sl45DZYe.js} +1 -1
- package/dist/client/assets/{file-text-DGtefNvG.js → file-text-C4PxLfBm.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-DJDfJAaN.js → find-latest-widget-fence-Bc1LICCy.js} +5 -5
- package/dist/client/assets/{flowDiagram-IUGLLWBU-ORyRd0wW.js → flowDiagram-IUGLLWBU-BlrKbUnh.js} +1 -1
- package/dist/client/assets/{form-USBlP2n_.js → form-1NlezfMg.js} +1 -1
- package/dist/client/assets/{format-cron-u8efK62G.js → format-cron-C57sE3sK.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-BC-M9_Wi.js → ganttDiagram-R7GPNTJY-BhCCQ-d7.js} +3 -3
- package/dist/client/assets/{git-branch-jQqbJAvp.js → git-branch-BXEb1Sqq.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-NIdjLN38.js → gitGraphDiagram-PDYL7XHY-Chl1aqHg.js} +1 -1
- package/dist/client/assets/{graph-CBIOKOiw.js → graph-DIIpUxLd.js} +1 -1
- package/dist/client/assets/{heart-CSbB9K4Q.js → heart-CUs7jdhV.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-OC8sqXXy.js → highlighted-body-KPVGNVTW-DlDHGjld.js} +1 -1
- package/dist/client/assets/image-lightbox-BczXKBTZ.js +1 -0
- package/dist/client/assets/image-off-Ch98GGBJ.js +6 -0
- package/dist/client/assets/{index-CiAb-mD4.js → index-0MDZSAdr.js} +1 -1
- package/dist/client/assets/{index-C5gtuueN.js → index-37h1E-65.js} +1 -1
- package/dist/client/assets/{index-CeJVF9AD.js → index-8FrM4Unx.js} +1 -1
- package/dist/client/assets/{index-CRPh-508.js → index-B0p2_o3r.js} +1 -1
- package/dist/client/assets/{index-BU_bmsP2.js → index-B0q1o1JU.js} +1 -1
- package/dist/client/assets/{index-Yr72qWri.js → index-BAnl5kwm.js} +1 -1
- package/dist/client/assets/{index-w4wyJU8q.js → index-BC41bN42.js} +1 -1
- package/dist/client/assets/{index-DfYJ-zxk.js → index-BNJa5z6K.js} +7 -7
- package/dist/client/assets/{index-DJyLZL6w.js → index-BQlnEL5t.js} +1 -1
- package/dist/client/assets/{index-DkcRrH0O.js → index-BRyEtRBO.js} +1 -1
- package/dist/client/assets/index-BThp0Av1.js +1 -0
- package/dist/client/assets/{index-LFeqJL-v.js → index-BVjrgWDa.js} +1 -1
- package/dist/client/assets/{index-D9Ej8fsx.js → index-BiyMpL0z.js} +1 -1
- package/dist/client/assets/{index-DeDh_2c1.js → index-BwHCH3tE.js} +1 -1
- package/dist/client/assets/index-ByIDaFWv.js +1 -0
- package/dist/client/assets/{index-RXFhiamo.js → index-BzqkXlms.js} +1 -1
- package/dist/client/assets/index-CFJcOzPD.js +1 -0
- package/dist/client/assets/{index-B5eM1_q1.js → index-CQTeDD0B.js} +1 -1
- package/dist/client/assets/{index-BOaou3k5.js → index-CSOhBvPV.js} +1 -1
- package/dist/client/assets/{index-Dk33a8Wz.js → index-CYhf-E_N.js} +1 -1
- package/dist/client/assets/{index-CWhDGAYM.js → index-CaVP52c1.js} +1 -1
- package/dist/client/assets/{index-CRTzTiNF.js → index-Cn1ZEy3S.js} +1 -1
- package/dist/client/assets/{index-C9UgTEuh.js → index-CnNGTb8f.js} +1 -1
- package/dist/client/assets/{index-BGGnQdij.js → index-Cnjpi7ar.js} +3 -3
- package/dist/client/assets/{index-BYxDsLTQ.js → index-CoHeCySh.js} +1 -1
- package/dist/client/assets/index-CujX3mpY.css +1 -0
- package/dist/client/assets/{index-C49AWTah.js → index-Cw0QRsnv.js} +1 -1
- package/dist/client/assets/{index-CuT_aCM-.js → index-Czar7aPT.js} +2 -2
- package/dist/client/assets/{index-Bz9CgPjs.js → index-D1Be28yK.js} +1 -1
- package/dist/client/assets/{index-j5szQcqb.js → index-D6NjBiAq.js} +1 -1
- package/dist/client/assets/{index-fAHI5hei.js → index-DMfV6rUz.js} +1 -1
- package/dist/client/assets/index-D_9H4FdK.js +1 -0
- package/dist/client/assets/{index-B9utW3HE.js → index-DaZdDh7o.js} +1 -1
- package/dist/client/assets/{index-CDslENFz.js → index-DlZ77Qfj.js} +1 -1
- package/dist/client/assets/index-Dv6HjbCS.js +1 -0
- package/dist/client/assets/index-DwrBsA10.js +1053 -0
- package/dist/client/assets/{index-CCohVfmo.js → index-DzLIbXMR.js} +1 -1
- package/dist/client/assets/{index-n6f9pLtt.js → index-Ev7FZl9a.js} +1 -1
- package/dist/client/assets/{index-DJlq_kd_.js → index-HnW-eS5i.js} +1 -1
- package/dist/client/assets/{index-DnyoNFRt.js → index-hyqRnlFg.js} +1 -1
- package/dist/client/assets/{index-jJbbnV9q.js → index-pQstFziR.js} +3 -3
- package/dist/client/assets/{index-BN02EVKP.js → index-rKEUwjq8.js} +1 -1
- package/dist/client/assets/{index-BAaqQW-m.js → index-slBSiB-H.js} +1 -1
- package/dist/client/assets/{index-DgnJZ7RZ.js → index-vU7itvE8.js} +1 -1
- package/dist/client/assets/{index.esm-Dyd3JXuK.js → index.esm-DM8Bqi3n.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-CPcm-36U.js → infoDiagram-MVDRKAX5-C0p1eP9j.js} +1 -1
- package/dist/client/assets/{inline-code-BjkmgK0M.js → inline-code-CNmpgW3O.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-B8eVNEDQ.js → ishikawaDiagram-HPEHV2GE-COdxgYUT.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-CGkIGaMV.js → journeyDiagram-BOSHW7O7-C84Ny9n9.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-BTDbT6UJ.js → kanban-definition-FNSA4HC5-ECSXhFX0.js} +1 -1
- package/dist/client/assets/{layers-DyShcAgn.js → layers-JgRwJGyf.js} +1 -1
- package/dist/client/assets/{lightbulb-QljDqLq7.js → lightbulb-BhQB8sFP.js} +1 -1
- package/dist/client/assets/{link-2-7SoeCkEs.js → link-2-B4byjdgg.js} +1 -1
- package/dist/client/assets/{list-runtime-types-DvfLx6v2.js → list-runtime-types-M5_gxIg1.js} +1 -1
- package/dist/client/assets/{markdown-content-D7t62wwm.js → markdown-content-C3qWcii6.js} +1 -1
- package/dist/client/assets/{mention-pill-DNQ2ICCW.js → mention-pill-DUbgdKmA.js} +1 -1
- package/dist/client/assets/{mermaid.core-NAyHAvFm.js → mermaid.core-BQiwaVjZ.js} +4 -4
- package/dist/client/assets/{message-square-off-D6K1M95g.js → message-square-off-AjtFFe_u.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-26dEepZx.js → mindmap-definition-6OY57UG3-BfA6EqgP.js} +1 -1
- package/dist/client/assets/{more-details-BJ_2FYn8.js → more-details-itSF4Fah.js} +1 -1
- package/dist/client/assets/{owner-notice-CIfb2Yr7.js → owner-notice-B6JRjE_c.js} +1 -1
- package/dist/client/assets/{package-CeRLwc1u.js → package-5YQSitlR.js} +1 -1
- package/dist/client/assets/{page-container-D2J6eon9.js → page-container-DBPUOYYM.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-CXxva43c.js → pane-resize-handle-Kwb3zKa6.js} +1 -1
- package/dist/client/assets/{paperclip-DFuuQSWM.js → paperclip-IRKZTEQw.js} +1 -1
- package/dist/client/assets/{path-input-DhGxbEsh.js → path-input-BHkA4fFw.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-BJu6g9eg.js → pegDiagram-ECIUJNBX-CqIy9WDe.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-CMf8TQF7.js → pieDiagram-GNMPY74T-C5yI3cvV.js} +1 -1
- package/dist/client/assets/{plug-Bqwk5g66.js → plug-CupdBXaG.js} +1 -1
- package/dist/client/assets/{primer-trigger-NAz78FSN.js → primer-trigger-Ci_XRRfX.js} +2 -2
- package/dist/client/assets/{profile-errors--0_JG2R0.js → profile-errors-aEsWNifs.js} +1 -1
- package/dist/client/assets/{progress-cQRXQehb.js → progress-Bpmb837n.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-Bb92PcA9.js → quadrantDiagram-D57K4MC3-DyCDNvk7.js} +1 -1
- package/dist/client/assets/{query-error-state-C2QLFCgp.js → query-error-state-s6AJaHa3.js} +1 -1
- package/dist/client/assets/{radio-CBD2fSSB.js → radio-Ci6Ghks8.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-YN2siyto.js → railroadDiagram-Y72NRBL7-B3u1B937.js} +1 -1
- package/dist/client/assets/registry-DatwH4jj.js +1 -0
- package/dist/client/assets/registry-NGfn1R2_.js +34 -0
- package/dist/client/assets/{relay-trace-schemas-yWn__06J.js → relay-trace-schemas-hOFIzdY-.js} +2 -2
- package/dist/client/assets/{repeat-CtIEyxm4.js → repeat-B1S2ceC2.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-DJBQviv-.js → requirementDiagram-EQYSW5RA-CdG-unip.js} +1 -1
- package/dist/client/assets/{room-files-source-nnbGMKus.js → room-files-source-J7gnN1gx.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-C2jXtg-P.js → rotate-ccw-clock-7Q2akPFi.js} +1 -1
- package/dist/client/assets/{rotate-cw-34X3Kx8Z.js → rotate-cw-DK3Rzmlh.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-DH2qnwVI.js → sankeyDiagram-SY24JHO5-D3Z4Qk2b.js} +1 -1
- package/dist/client/assets/{scroll-area-DYTbXWMY.js → scroll-area-6Gelypei.js} +1 -1
- package/dist/client/assets/{search-x-DeFOvp_5.js → search-x-Be8VetKs.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-CkHcuOw2.js → sequenceDiagram-BLEHNHQU-RXPgeLr6.js} +1 -1
- package/dist/client/assets/{shield-x-bloGLifl.js → shield-x-D8lJ0Op0.js} +1 -1
- package/dist/client/assets/signed-in-NOeTLLso.js +1 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-BXK-Cxjs.js → sizeCapture-INFHLROL-q7qki1pK.js} +1 -1
- package/dist/client/assets/{soul-file-DFPctfHR.js → soul-file-DTEcjDxP.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-DP_cqXJO.js → stateDiagram-v2-A6IESKWZ-DFs6IVbj.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-BZxkK7Fr.js → swimlanes-B3ENRKFQ-D1A-3JE-.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-hZFkkqUb.js +8 -0
- package/dist/client/assets/{table-B8zvHC0J.js → table-CuBPM_bg.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-BPZ64ADa.js → timeline-definition-JXYKGLGB-CLHy0rAb.js} +1 -1
- package/dist/client/assets/{trust-posture-C9r0jGhc.js → trust-posture-BXXe8F8n.js} +1 -1
- package/dist/client/assets/{unplug-DYZEcvkR.js → unplug-Cuej6sM6.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-DAhwNpy_.js → unverified-catalog-notice-BbK4SCJp.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-DrDMqxhZ.js → use-adapter-catalog-Cy7ENVZN.js} +1 -1
- package/dist/client/assets/{use-bindings-Ci7hpEO4.js → use-bindings-Tj0BcF4m.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-FpUdi_wE.js → use-composer-prefs-BrQVpwRi.js} +1 -1
- package/dist/client/assets/{use-connector-management-CinfkPZI.js → use-connector-management-CLZQXgln.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-DZnA4iYZ.js → use-deep-link-scroll-BeqtUhj2.js} +1 -1
- package/dist/client/assets/{use-delete-binding-DDtaCc3v.js → use-delete-binding-d7ii9iFQ.js} +1 -1
- package/dist/client/assets/{use-dev-links-CtHwhTBj.js → use-dev-links-MYOV3h2q.js} +1 -1
- package/dist/client/assets/{use-direct-message-panel-Da9rkfA3.js → use-direct-message-panel-C_lXDYnB.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-CikM-LiV.js → use-external-adapter-catalog-kMFSEJGV.js} +1 -1
- package/dist/client/assets/use-full-activity-feed-MFSkvnza.js +1 -0
- package/dist/client/assets/use-is-below-desktop-CJJ4zMQO.js +1 -0
- package/dist/client/assets/{use-local-browser-ABoWOGv1.js → use-local-browser-1oVtlmXD.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-C5njB0KY.js → use-mesh-topology-BJs6M6kh.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-Bp9Wp7zY.js → use-mounted-ref-DitdlmSI.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-DXww4pVV.js → use-notification-prefs-CXbRTRLF.js} +1 -1
- package/dist/client/assets/use-pending-read-CvX1lOb8.js +1 -0
- package/dist/client/assets/{use-personality-commit-DYQ3KVxd.js → use-personality-commit-DQrWyVGT.js} +1 -1
- package/dist/client/assets/{use-promo-activation-nURLgFxH.js → use-promo-activation-CgdBHk2f.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-BQkeHMCS.js → use-promo-dismissals-DprcDmfs.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-B8VeNnHj.js → use-pulse-freshness-BtMzHCs3.js} +1 -1
- package/dist/client/assets/{use-relay-config-D0BknsXK.js → use-relay-config-CGBlgXC2.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BruRRf3z.js → use-room-follow-claim-Db5U7kWT.js} +1 -1
- package/dist/client/assets/{use-room-sessions-DGcrmZvE.js → use-room-sessions-K6mdH-Tb.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-YQ4MgIBO.js → use-roving-tab-list-B2zxa_F_.js} +1 -1
- package/dist/client/assets/{use-session-canvas-BaGypLR6.js → use-session-canvas-D4G5fO_a.js} +7 -7
- package/dist/client/assets/{use-status-budget-Q1ltHI80.js → use-status-budget-UccdTZ7o.js} +4 -4
- package/dist/client/assets/use-transform-BBj2pwbo.js +1 -0
- package/dist/client/assets/{use-unclaimed-chats-Bext8Aim.js → use-unclaimed-chats-BidDnyt8.js} +1 -1
- package/dist/client/assets/use-update-config-D8g4P42J.js +1 -0
- package/dist/client/assets/{useMutationState-C3WVn0hu.js → useMutationState-RYxTf1aD.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Dg4P8nSr.js → usecaseDiagram-WPOLBNNX-Bjmcc2gK.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-B8Txoqsz.js → vennDiagram-Q3Y3IDCW-Cd6C9CxW.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-lgQBspKc.js → wardleyDiagram-IVAIDKWA-CzWWmwUL.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-Ct9-Lgo9.js → xychartDiagram-4URNHDU4-DSUn9rhA.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261025175042_dor3123_needs_attention.sql +7 -0
- package/dist/drizzle/meta/20261025175042_snapshot.json +14093 -0
- package/dist/drizzle/meta/_journal.json +7 -0
- package/dist/server/extension-child.cjs +188 -107
- package/dist/server/index.js +11572 -8338
- package/dist/server/index.js.map +2 -2
- package/package.json +7 -7
- package/dist/client/assets/ChannelComposer-WR3_Vvta.js +0 -44
- package/dist/client/assets/HandlePage-A1OCw0nr.js +0 -1
- package/dist/client/assets/NamePage-Du9m4rGe.js +0 -1
- package/dist/client/assets/NewDirectMessageMenu-CmCOFmXQ.js +0 -1
- package/dist/client/assets/OpenMeshSwitch-r6HJBjR6.js +0 -5
- package/dist/client/assets/PhotoPage-Dx-3Lhm5.js +0 -1
- package/dist/client/assets/RoomSurface-C_mTmn8g.js +0 -1
- package/dist/client/assets/RuntimeConnectFlow-BsZsQZS9.js +0 -1
- package/dist/client/assets/RuntimeSetupDialog-BSb5iK2A.js +0 -1
- package/dist/client/assets/SeenDevices-dzzlSeB2.js +0 -19
- package/dist/client/assets/SettingsDialog-5aEZ-DG6.js +0 -12
- package/dist/client/assets/TasksEmptyState-DityFi7P.js +0 -3
- package/dist/client/assets/TasksPage-BZx_Ku0k.js +0 -1
- package/dist/client/assets/UnreadDivider-CGKnJcx7.js +0 -1
- package/dist/client/assets/WorkView-wVnGvWAz.js +0 -63
- package/dist/client/assets/_shell._home.index-BB5pgiqt.js +0 -3
- package/dist/client/assets/_shell._home.tasks-B3w6mqyb.js +0 -1
- package/dist/client/assets/_shell.marketplace-BUh4boaf.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-CnOFcGv1.js +0 -1
- package/dist/client/assets/_shell.session-BUP7x_Ra.js +0 -1
- package/dist/client/assets/_shell.threads-gs_o48eZ.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-B-X7HuaQ.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-B-X7HuaQ.js +0 -1
- package/dist/client/assets/channel-C6IoQ0kc.js +0 -1
- package/dist/client/assets/image-lightbox-DgWS2xlv.js +0 -1
- package/dist/client/assets/image-off-DziiNcIl.js +0 -6
- package/dist/client/assets/index-B-KhOLHd.js +0 -1
- package/dist/client/assets/index-BpsATTKn.js +0 -1
- package/dist/client/assets/index-CP7hD01s.js +0 -1
- package/dist/client/assets/index-CUKvspHB.js +0 -1
- package/dist/client/assets/index-DSYz85aL.js +0 -1053
- package/dist/client/assets/index-DYF1ER90.js +0 -23
- package/dist/client/assets/index-DtlBeLQB.css +0 -1
- package/dist/client/assets/index-YtJ82pkp.js +0 -1
- package/dist/client/assets/registry-CsiY3fnM.js +0 -1
- package/dist/client/assets/signed-in-DD2qV0PJ.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-DXRZtHKX.js +0 -8
- package/dist/client/assets/use-full-activity-feed-B6TQc-xB.js +0 -1
- package/dist/client/assets/use-is-below-desktop-DJQVU5CF.js +0 -1
- package/dist/client/assets/use-panel-tab-placements-DLQeHI7w.js +0 -1
- package/dist/client/assets/use-pending-read-CgR0BnSW.js +0 -1
- package/dist/client/assets/use-update-config-BJEw2LjV.js +0 -1
- /package/dist/client/assets/{WorkView-DIs3GY4I.css → registry-DIs3GY4I.css} +0 -0
package/dist/server/index.js.map
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/server/index.js.map
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 64714849 bytes
|
|
4
|
+
sha256: bf065b62484d809967584a30dcecf929b126e7be643ba6b22c0cad7bf5ce899b
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dorkos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.126.0",
|
|
4
4
|
"description": "You, multiplied. Build and run your business with an agent team. Your agents join your team chat, take on real work, and build the tools your company runs on.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Dorian Collier",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@asteasolutions/zod-to-openapi": "9.1.0",
|
|
55
55
|
"@composio/core": "0.21.0",
|
|
56
56
|
"@inquirer/prompts": "^8.7.2",
|
|
57
|
-
"@modelcontextprotocol/sdk": "1.
|
|
57
|
+
"@modelcontextprotocol/sdk": "1.32.0",
|
|
58
58
|
"@ngrok/ngrok": "^1.7.0",
|
|
59
59
|
"@openai/codex": "0.163.0",
|
|
60
60
|
"@openai/codex-sdk": "~0.163.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"qrcode-terminal": "^0.12.0",
|
|
70
70
|
"uuid": "^13.0.2",
|
|
71
71
|
"ws": "^8.22.0",
|
|
72
|
-
"zod": "^4.6.
|
|
72
|
+
"zod": "^4.6.6"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@better-auth/api-key": "1.7.6",
|
|
@@ -83,14 +83,14 @@
|
|
|
83
83
|
"typescript": "^5.9.3",
|
|
84
84
|
"vitest": "^4.1.11",
|
|
85
85
|
"@dorkos/browser": "0.0.0",
|
|
86
|
+
"@dorkos/db": "0.0.0",
|
|
86
87
|
"@dorkos/eslint-config": "0.0.0",
|
|
87
|
-
"@dorkos/harness": "0.0.0",
|
|
88
88
|
"@dorkos/marketplace": "0.0.0",
|
|
89
|
-
"@dorkos/typescript-config": "0.0.0",
|
|
90
89
|
"@dorkos/server": "0.0.0",
|
|
91
|
-
"@dorkos/
|
|
90
|
+
"@dorkos/client": "0.0.0",
|
|
91
|
+
"@dorkos/typescript-config": "0.0.0",
|
|
92
92
|
"@dorkos/shared": "0.0.0",
|
|
93
|
-
"@dorkos/
|
|
93
|
+
"@dorkos/harness": "0.0.0"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build": "tsx scripts/build.ts",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BGGnQdij.js","assets/index-DSYz85aL.js","assets/index-DtlBeLQB.css","assets/room-files-source-nnbGMKus.js","assets/markdown-content-D7t62wwm.js","assets/file-exclamation-point-rCHuN_aY.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-CDslENFz.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-34X3Kx8Z.js","assets/link-2-7SoeCkEs.js","assets/file-CbZILJJL.js","assets/git-branch-jQqbJAvp.js","assets/more-details-BJ_2FYn8.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{W as F,r as i,j as l,B as ue,hv as bn,mI as vn,g as kn,jT as wn,G as te,a1 as fe,a3 as De,a4 as Pe,aP as H,c8 as Fe,c9 as Nn,cO as In,mJ as Rn,lo as Cn,mK as An,h as Mn,aA as jn,cf as Le,gk as se,q as Z,a7 as Be,s as pe,lO as Sn,mL as On,ms as _n,mM as En,dX as Tn,fW as $n,ec as Dn,mG as Pn,mN as Fn,mO as Ln,a0 as Bn,bx as Un,mP as Hn,mQ as Kn,ji as Wn,ib as qn,h0 as zn,k_ as Ne,mR as Ue,bL as Vn,kZ as X,l1 as He,mS as Gn,c7 as ge,ai as Jn,bP as he,i6 as Ke,mT as Yn,cj as We,mU as Xn,eU as Qn,k8 as qe,mV as ze,aZ as Zn,gZ as Ve,l0 as et,mW as Ge,mX as nt,mY as tt,mZ as st,m_ as Ie,eN as ot,m$ as at,n0 as rt,n1 as it,n2 as ct,n3 as lt,n4 as dt,l as ut,hI as mt,ar as Je,kR as ft,aj as pt,n5 as gt,n6 as ht,n7 as xt,b8 as yt,bX as bt,n8 as vt,n9 as kt,na as wt,nb as Nt,by as Re,ea as It}from"./index-DSYz85aL.js";import{g as Ce,m as Ae,h as xe,f as Ye,M as Rt,a as Ct,E as At,i as Mt,j as jt,c as P,b as St,k as Ot,u as _t,C as Et}from"./index-DYF1ER90.js";import{R as Tt,A as Xe}from"./repeat-CtIEyxm4.js";import{u as $t}from"./use-room-sessions-DGcrmZvE.js";import"./WidgetErrorCard-oq5MKUX_.js";import{M as Dt}from"./markdown-content-D7t62wwm.js";import{W as Pt,a as Ft}from"./find-latest-widget-fence-DJDfJAaN.js";import{f as Lt}from"./format-duration-BCr6uzby.js";import{H as Bt,a as Ut,b as Ht}from"./RuntimeSetupDialog-BSb5iK2A.js";import{M as Me}from"./mention-pill-DNQ2ICCW.js";import{R as Kt}from"./rotate-ccw-clock-C2jXtg-P.js";import{U as Wt}from"./unplug-DYZEcvkR.js";import{M as qt}from"./message-square-off-D6K1M95g.js";import{i as zt}from"./registry-CsiY3fnM.js";/**
|
|
3
|
-
* @license lucide-react v1.48.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const Qe={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};Qe.node;const Vt=F(Qe);/**
|
|
8
|
-
* @license lucide-react v1.48.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/const Ze={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};Ze.node;const Gt=F(Ze);/**
|
|
13
|
-
* @license lucide-react v1.48.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const en={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};en.node;const Jt=F(en);/**
|
|
18
|
-
* @license lucide-react v1.48.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const nn={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};nn.node;const Yt=F(nn);/**
|
|
23
|
-
* @license lucide-react v1.48.0 - ISC
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const tn={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};tn.node;const Xt=F(tn);/**
|
|
28
|
-
* @license lucide-react v1.48.0 - ISC
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the ISC license.
|
|
31
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const sn={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};sn.node;const Qt=F(sn);/**
|
|
33
|
-
* @license lucide-react v1.48.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const on={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};on.node;const je=F(on);/**
|
|
38
|
-
* @license lucide-react v1.48.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const an={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};an.node;const Zt=F(an),es='[data-slot="identity-hover-card-actions"] button:not(:disabled)';function ns(e){const{open:t,setOpen:s,triggerRef:n,enabled:o}=e,a=i.useRef(null),r=i.useRef(!1);i.useEffect(()=>{if(!t||!r.current)return;r.current=!1;let u=0,x=0;const v=()=>{var m;const f=(m=a.current)==null?void 0:m.querySelector(es);if(f)return f.focus();++u<10&&(x=requestAnimationFrame(v))};return v(),()=>cancelAnimationFrame(x)},[t]);const c=i.useCallback(u=>{var x;!u&&((x=a.current)!=null&&x.contains(document.activeElement))||s(u)},[s]),d=i.useCallback(u=>{!o||u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r.current=!0,s(!0))},[o,s]),g=i.useMemo(()=>({onEscapeKeyDown:()=>{var u;return(u=n.current)==null?void 0:u.focus()},onBlur:u=>{var v,f,m;const x=u.relatedTarget;x&&((v=a.current)!=null&&v.contains(x)||(f=n.current)!=null&&f.contains(x))||(m=a.current)!=null&&m.contains(document.activeElement)||s(!1)}}),[s,n]);return{contentRef:a,handleOpenChange:c,onTriggerKeyDown:d,contentHandlers:g}}function ce(e){const t=e.key==="ArrowRight"||e.key==="ArrowDown",s=e.key==="ArrowLeft"||e.key==="ArrowUp",n=e.key==="Tab";if(!t&&!s&&!n)return;const o=e.currentTarget.closest('[data-slot="identity-hover-card-actions"]');if(!o)return;const a=Array.from(o.querySelectorAll("button:not(:disabled)")),r=a.indexOf(document.activeElement);if(r===-1||a.length===0)return;e.preventDefault();const c=s||n&&e.shiftKey?-1:1;a[(r+c+a.length)%a.length].focus()}function ts({kind:e,about:t}){const n=[e==="agent"?"Agent":e==="human"?"Person":null,t.role].filter(Boolean).join(" · ");return!n&&!t.status?null:l.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5 px-3 pb-3","data-slot":"identity-hover-card-about",children:[n&&l.jsx("p",{className:"text-muted-foreground truncate text-xs",title:n,children:n}),t.status&&l.jsx("p",{className:"text-foreground/80 truncate text-xs","data-slot":"identity-hover-card-status",children:t.status})]})}function ss({actions:e,onAct:t}){const s=n=>()=>{t(),n()};return l.jsxs("div",{className:"border-border mt-auto flex flex-col gap-2 border-t p-3","data-slot":"identity-hover-card-actions",role:"group","aria-label":"Actions",children:[l.jsxs("div",{className:"flex gap-2",children:[e.onMessage&&l.jsx(ue,{size:"xs",className:"flex-1",onClick:s(e.onMessage),onKeyDown:ce,children:"Message"}),e.onViewProfile&&l.jsx(ue,{size:"xs",variant:"outline",className:"flex-1",onClick:s(e.onViewProfile),onKeyDown:ce,children:"Profile"})]}),e.session&&l.jsxs("button",{type:"button","data-slot":"identity-hover-card-session",onClick:s(e.session.onOpen),onKeyDown:ce,className:"text-muted-foreground hover:text-foreground focus-visible:ring-ring flex min-w-0 items-center gap-1.5 rounded-sm text-left text-xs transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[l.jsx(bn,{className:"size-3.5 shrink-0","aria-hidden":!0}),l.jsx("span",{className:"truncate",children:e.session.label})]})]})}const os=300;function G({className:e,children:t}){return l.jsx("span",{className:te("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function ye({identity:e,children:t,onViewProfile:s,about:n,actions:o,onOpenChange:a,openOnClick:r=!1,className:c}){const{kind:d,displayName:g,handle:u,color:x,emoji:v,imageUrl:f,origin:m,agent:p}=e,h=x??"hsl(var(--muted-foreground))",w=typeof m=="object"&&m!==null,y=d==="agent"&&(p==null?void 0:p.working)!=null?p.working:null,[I,S]=i.useState(!1),C=i.useCallback(k=>{S(k),a==null||a(k)},[a]),A=i.useRef(!1),N=i.useRef(null),M=vn({onLongPress:()=>{A.current&&C(!0)}}),{contentRef:j,handleOpenChange:b,onTriggerKeyDown:O,contentHandlers:_}=ns({open:I,setOpen:C,triggerRef:N,enabled:r&&o!==void 0});return l.jsxs(Bt,{open:I,onOpenChange:b,openDelay:os,children:[l.jsx(Ut,{asChild:!0,ref:N,"data-gesture-priority":"",...M,onPointerDown:k=>{A.current=k.pointerType==="touch"||k.pointerType==="pen",M.onPointerDown(k)},...r?{onClick:()=>C(!0),onKeyDown:O}:{},children:t}),l.jsxs(Ht,{ref:j,..._,...o?{role:"dialog","aria-label":g}:{},"data-slot":"identity-hover-card",align:"start",className:te("flex w-64 flex-col gap-0 overflow-hidden p-0",c),children:[l.jsxs("div",{className:"flex items-center gap-3 p-3",children:[l.jsx(kn,{"aria-hidden":!0,color:h,emoji:v,imageUrl:f,fallback:wn(g),kind:d,origin:m,status:y?"working":"idle",size:"md"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:g}),u&&l.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",u]})]})]}),n&&l.jsx(ts,{kind:d,about:n}),l.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[d==="agent"&&((p==null?void 0:p.runtime)||(p==null?void 0:p.model))&&l.jsx(G,{children:[p.runtime,p.model].filter(Boolean).join(" · ")}),y&&l.jsxs(G,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Lt(y.forMs)]}),d==="human"&&l.jsx(G,{children:w?m.platform:"On this machine"}),d==="agent"&&(p==null?void 0:p.managedBy)&&l.jsxs(G,{children:["Managed by"," ",p.managedBy.handle?`@${p.managedBy.handle}`:p.managedBy.displayName]})]}),o?l.jsx(ss,{actions:o,onAct:()=>{var k;(k=N.current)==null||k.focus(),C(!1)}}):s?l.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var k;(k=N.current)==null||k.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):l.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[l.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),l.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function as(){const e=fe(),t=De();return Pe({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var u;const r=t.getQueryData(H.entries(s)),c=(u=r==null?void 0:r.find(x=>x.id===n))==null?void 0:u.reactions,{reactions:d,on:g}=Ce(c,o,a);return t.setQueryData(H.entries(s),x=>Ae(x,n,d)),{on:g}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:a})=>{var d,g;const r=t.getQueryData(H.entries(s)),c=((g=(d=r==null?void 0:r.find(u=>u.id===n))==null?void 0:d.reactions)==null?void 0:g.some(u=>u.emoji===o&&u.authorIds.includes(a)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:a,viewerAuthorId:r},c)=>{c!==void 0&&t.setQueryData(H.entries(n),d=>{var x;const g=(x=d==null?void 0:d.find(v=>v.id===o))==null?void 0:x.reactions,{reactions:u}=Ce(g,a,r,!c.on);return Ae(d,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(H.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function W(e){return e.threadRootEntryId??e.parentEntryId}function rs(e){return W(e)??e.id}function is(e,t){return Math.max(t??0,e)}function qo(e,t,s){let n=e[0],o=0;for(const a of e)a.seq>n.seq&&(n=a),t!==null&&a.seq>t&&(o+=1);return{count:is(e.length,s),lastAt:n.createdAt,unread:o}}function cs(e){var C,A;const{agentPath:t,displayName:s,onViewProfile:n,engaged:o}=e,a=Fe(),r=Nn(),c=a&&o&&t!==void 0,d=In(c?t:null),g=Rn(d.member),u=Cn(),x=An(),v=Mn(),f=jn(),{data:m}=Le({enabled:c&&r}),p=f.status==="ready"?f.roomId:null,h=m==null?void 0:m.find(N=>N.id===p),w=h?se(h):null,y=(A=(C=d.member)==null?void 0:C.agent)==null?void 0:A.effectiveRuntimeId,I=i.useCallback(()=>{t!==void 0&&(Z.getState().recordOpened("agent",t),u({agentPath:t},y?{runtime:y}:{}))},[t,u,y]),S=i.useCallback(async()=>{if(t===void 0||!v)return;const N=await x(t);if(N===null){Be(`${s} has no session in ${w??"this room"} yet`);return}v(pe({session:N}))},[t,v,x,s,w]);return i.useMemo(()=>!a||t===void 0?null:{about:{role:d.role,status:g},actions:{onMessage:I,...n?{onViewProfile:n}:{},...r&&w?{session:{label:`Session in ${w}`,onOpen:()=>void S()}}:{}}},[a,t,d.role,g,I,n,r,w,S])}function ls({identity:e,agentPath:t,onViewProfile:s,openOnClick:n=!1,children:o}){const[a,r]=i.useState(!1),c=cs({agentPath:t,displayName:e.displayName,onViewProfile:s,engaged:a}),d=i.useCallback(g=>{g&&r(!0)},[]);return l.jsx(ye,{identity:e,onViewProfile:s,onOpenChange:d,openOnClick:n&&c!==null,...c?{about:c.about,actions:c.actions}:{},children:o})}function ds(e){return l.jsx(Ft,{code:e.code,isIncomplete:e.isIncomplete})}const us=[{language:Pt,component:ds}],ms={turn_failed:{Icon:Bn,tone:"text-status-warning"},agent_busy:{Icon:Ln},agent_gone:{Icon:Zt,tone:"text-status-warning"},agent_left:{Icon:je,tone:"text-status-warning"},room_archived:{Icon:Fn},agent_reseated:{Icon:Pn},handle_changed:{Icon:Xe},files_set_up:{Icon:Dn},runtime_gone:{Icon:Yt,tone:"text-status-warning"},agent_paused:{Icon:$n},agent_declined:{Icon:qt},agent_unavailable:{Icon:Tn},awaiting_approval:{Icon:Vt,tone:"text-status-warning"},halted:{Icon:En},budget_reached:{Icon:_n},cascade_stopped:{Icon:On},addressing_changed:{Icon:Jt},bridge_blocked:{Icon:Wt,tone:"text-status-warning"},bridge_undelivered:{Icon:Sn,tone:"text-status-warning"},bridge_rate_limited:{Icon:Qt},bridge_second_agent_refused:{Icon:je},bridge_disconnected:{Icon:Gt},bridge_agent_swapped:{Icon:Tt},bridge_history_note:{Icon:Kt}},fs={Icon:Un},le=80;function ps(e){const t=e.trim();if(t.length<=le)return t;const s=t.slice(0,le),n=s.lastIndexOf(" ");return`${(n>le/2?s.slice(0,n):s).trimEnd()}…`}function gs(e,t,s){const n=hs(e,s),o=a=>l.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:a});return n===null?l.jsxs(l.Fragment,{children:[e," ",o("Open chat")]}):l.jsxs(l.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function hs(e,t){if(t!==void 0){const n=Hn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=Kn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function xs({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:a,tone:r}=(e.body.notice&&ms[e.body.notice])??fs;return l.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":ps(e.body.text)},...xe(t),className:te("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",r??"text-muted-foreground"),children:[l.jsx(a,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),l.jsx("span",{children:n?gs(e.body.text,n,o):e.body.text})]})}const ys=zt.moment;function bs({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:a}){const r=Ye(e.createdAt);return l.jsx("div",{id:a,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...xe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:l.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[l.jsx(ye,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:l.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[l.jsx(Rt,{author:s}),l.jsx("span",{className:"sr-only",children:s.displayName})]})}),l.jsx(ys,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),l.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),r.length>0&&l.jsx("time",{dateTime:e.createdAt,title:Ct(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:r})]})})}function vs(e,t){const s=X.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
|
|
43
|
-
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function ks({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const a=rs(t),r=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,d=s==null?void 0:s.displayName,{copy:g}=Wn({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Xt,run:()=>{zn.getState().openThread(e,a,!0),Ne.getState().requestFocus(Ue(e,a))}},copy:{id:"copy",label:"Copy text",icon:qn,run:()=>void g(r)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:Vn,run:o}),c!==void 0&&(u.mention={id:"mention",label:d===void 0?"Mention author":`Mention ${d}`,icon:Xe,run:()=>{vs(e,c),Ne.getState().requestFocus(e)}}),At.map(x=>u[x]).filter(x=>x!==void 0)},[e,a,r,c,d,o,g])}function ws(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function zo(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function Vo(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Ns(e,t,s){const n=t.get(e),o=He({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Go(e){const t=new Set;for(const a of e)W(a)===null&&t.add(a.id);const s=[],n=new Map,o=new Set;for(const a of e){const r=W(a);if(r===null){s.push(a);continue}if(!t.has(r)){s.push(a),o.add(a.id);continue}const c=n.get(r);c?c.push(a):n.set(r,[a])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Is(e){return`thread-${e}`}function Rs(e){return`thread-row-${e}`}function Jo(e){return`thread-panel-entry-${e}`}function Cs(e){return`room-entry-${e}`}function As(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=W(s)??null,o={rowId:t,domId:Cs(t)};if(n===null)return o;const a=e.find(c=>c.id===n);return a!==void 0&&(W(a)??null)===null?{rowId:Is(n),domId:Rs(n)}:o}function Yo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:As(e,s.id)}const Se=48;function Xo(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const a=o.body.text.replace(/\s+/gu," ").trim();return a.length===0?null:{entryId:n,excerpt:a.length>Se?`${a.slice(0,Se).trimEnd()}…`:a}}function Ms(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const a=Gn({runtime:o.runtime,model:o.model});s.set(ge(n.projectPath),{memberId:n.id,visual:Jn(o),runtime:a.label,...a.modelLabel!==null&&{model:a.modelLabel}})}return s}function js(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Ss={info:new Map,faces:new Map},be=i.createContext(Ss);function Qo({known:e,children:t}){return l.jsx(be.Provider,{value:e,children:t})}function Zo(){const e=he(),t=i.useMemo(()=>{var r;return((r=e.data)==null?void 0:r.agents)??[]},[e.data]),s=i.useMemo(()=>t.map(r=>r.projectPath),[t]),n=Ke(s),o=i.useMemo(()=>Ms(t,n.data??{}),[t,n.data]),a=i.useMemo(()=>js(o),[o]);return i.useMemo(()=>({info:o,faces:a}),[o,a])}function ee(e){const t=i.useContext(be);return e===void 0?void 0:t.info.get(e)}function Os(){return i.useContext(be).faces}function _s({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:a,summaryId:r,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?a:r,...xe(c)}}const Q=120,Es="code block";function Ts(e){if(e.length<=Q&&!e.includes("```"))return null;const t=$s(e);return t.length===0?null:t}function $s(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Es} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=Q)return t;const s=Ds(t,Q),n=s.lastIndexOf(" ");return`${(n>Q/2?s.slice(0,n):s).trimEnd()}…`}function Ds(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:a}of n.segment(e)){if(o.length+a.length>t)break;o+=a}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Ps({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:a=!0}){const r=as(),c=o===!0||!a,d=i.useMemo(()=>t.reactions??[],[t.reactions]),g=i.useMemo(()=>d.filter(v=>Mt(v,s)).map(v=>v.emoji),[d,s]),u=i.useCallback(v=>r.mutate({roomId:e,entryId:t.id,emoji:v,viewerAuthorId:s}),[r,e,t.id,s]),x=i.useMemo(()=>({quick:n,mine:g,onToggle:u,disabled:c}),[n,g,u,c]);return{reactions:d,toggle:u,quickRow:x}}function Fs({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var a,r;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(a=t.current)==null||a.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(r=e.current)==null||r.focusFirst())}}function Ls(e,t){var x,v;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Yn.includes(n),a=$t(e,{enabled:o}),r=We(),c=De(),d=fe(),g=o?((v=(x=a.data)==null?void 0:x.bindings.find(f=>f.authorId===s))==null?void 0:v.sessionId)??null:null,u=i.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(g===null||s===void 0)&&Xn({queryClient:c,transport:d},e,s).then(m=>{m.kind!=="none"&&r(pe({session:m.kind==="bound"?m.sessionId:g}))}))},[s,r,c,e,g,d]);return i.useMemo(()=>g===null?null:{href:Qn({session:g}),onOpen:u},[u,g])}const ne="mention",ve="author_id",Bs={[ne]:[ve]},Us=[ne];function Hs(e,t){if(!t||t.length===0)return e;const s=Ks(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:a,length:r,authorId:c}=s[o],d=n.slice(0,a),g=n.slice(a,a+r),u=n.slice(a+r);n=`${d}<${ne} ${ve}="${c}">${g}</${ne}>${u}`}return n}function Ks(e,t){const s=[...t].sort((a,r)=>a.offset-r.offset),n=[];let o=0;for(const a of s)a.offset<o||a.offset+a.length>e.length||(n.push(a),o=a.offset+a.length);return n}const Ws=new Map,rn=i.createContext(Ws);function qs({authors:e,children:t}){return l.jsx(rn.Provider,{value:e,children:t})}function zs(e){const t=i.useContext(rn);return e===void 0?void 0:t.get(e)}const Oe=new WeakMap;function Vs(e){const t=Oe.get(e);if(t)return t;const s=new Map(e.map(n=>[ge(n.projectPath),n.projectPath]));return Oe.set(e,s),s}function Gs(e){var n;const s=(n=he().data)==null?void 0:n.agents;return i.useMemo(()=>e===void 0||!s?void 0:Vs(s).get(e),[s,e])}function cn(e){const{agentRef:t,identity:s,onViewProfile:n}=e,o=Fe(),a=Gs(o?t:void 0),r=ee(t);return i.useMemo(()=>{if(!o||s.kind!=="agent"||a===void 0)return null;const c={...s,agent:r&&{runtime:r.runtime,...r.model&&{model:r.model}}},d=(g,u={})=>l.jsx(ls,{identity:c,agentPath:a,onViewProfile:n,openOnClick:u.openOnClick??!1,children:g});return{wrap:d,wrapAvatar:g=>d(l.jsx("button",{type:"button",tabIndex:-1,"aria-label":s.displayName,"aria-haspopup":"dialog",className:"focus-ring inline-flex cursor-pointer rounded-sm","data-slot":"room-agent-card-face",children:g}),{openOnClick:!0}),wrapName:g=>d(l.jsx("button",{type:"button","aria-haspopup":"dialog",className:te(g.props.className,"focus-ring cursor-pointer rounded-sm text-left underline-offset-4 hover:underline"),"data-slot":"room-agent-card-name",children:s.displayName}),{openOnClick:!0})}},[o,s,a,r,n])}const Js={kind:"human",displayName:""};function Ys(e){return typeof e=="string"?e.replace(/^@/,""):""}function Xs({authorId:e,children:t}){const s=zs(e),n=ee(s==null?void 0:s.agentRef),{open:o}=qe(),a=s?He({record:s,override:n==null?void 0:n.visual}):null,r=s?ze(s,n==null?void 0:n.memberId):void 0,c=i.useMemo(()=>r===void 0?void 0:()=>o(r),[r,o]),d=a==null?void 0:a.color,g=a==null?void 0:a.emoji,u=a==null?void 0:a.imageUrl,x=i.useMemo(()=>s?{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:d,emoji:g,imageUrl:u,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}}:null,[s,d,g,u,n]),v=cn({agentRef:s==null?void 0:s.agentRef,identity:x??Js,onViewProfile:c});if(!s||!x)return l.jsx(Me,{kind:"human",label:Ys(t),resolved:!1});const m=v?{role:"button",tabIndex:0,"aria-haspopup":"dialog"}:c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:h=>{h.key!=="Enter"&&h.key!==" "||(h.preventDefault(),c())}}:{},p=l.jsx(Me,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...m});return v?v.wrap(p,{openOnClick:!0}):l.jsx(ye,{onViewProfile:c,identity:x,children:p})}function Qs(e){return{mention:t=>{const s=t[ve],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?l.jsx(l.Fragment,{children:t.children}):l.jsx(Xs,{authorId:n,children:t.children})}}}function Zs({entry:e,authors:t}){const s=i.useMemo(()=>Hs(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=i.useMemo(()=>{var a;return new Set(((a=e.mentionSpans)==null?void 0:a.map(r=>r.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Qs(n),[n]);return l.jsx(qs,{authors:t,children:l.jsx(Dt,{content:s,className:"msg-prose",allowedTags:Bs,literalTagContent:Us,components:o,renderers:us})})}function eo(e){return function(s){return l.jsx(Zs,{entry:s,authors:e})}}const ln="the top folder";function _e(e){return e.slice(e.lastIndexOf("/")+1)}function no(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function to(e){return e===""?ln:`${e}/`}function de(e){return e.target!==void 0?e.target===""?ln:e.target:to(no(e.paths[0]??""))}function so(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${_e(s)} to ${de(e)}`:`${t} uploaded ${e.pathCount} files to ${de(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${_e(s)} from the chat to ${de(e)}`}}const oo=i.lazy(()=>Zn(()=>import("./index-BGGnQdij.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function ea({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:a,authorNames:r,reactionFrequents:c,streamStalled:d,isMember:g=!0,grouping:u,orphanedReply:x,answers:v,feedPosition:f,rowId:m}){const p=Ye(t.createdAt),h=i.useMemo(()=>{const L=Ts(t.body.text),ie=jt(t.attachments??[]);if(ie===null)return L;const we=L??t.body.text.trim();return we.length>0?`${we} ${ie}`:ie},[t.body.text,t.attachments]),w=i.useId(),y=`${w}-author`,I=`${w}-content`,S=`${w}-summary`,C=i.useRef(null),A=i.useRef(null),N=i.useRef(null),{reactions:M,toggle:j,quickRow:b}=Ps({roomId:e,entry:t,viewerAuthorId:a,reactionFrequents:c,streamStalled:d,isMember:g}),O=ee(n==null?void 0:n.agentRef),{open:_}=qe(),k=n===void 0?void 0:ze(n,O==null?void 0:O.memberId),D=i.useCallback(()=>{k!==void 0&&_(k)},[_,k]),T=k===void 0?void 0:D,q=ks({roomId:e,entry:t,author:n,viewerAuthorId:a,onViewProfile:T}),z=(n==null?void 0:n.handle)??void 0,B=i.useMemo(()=>({kind:s.kind,displayName:s.displayName,handle:z,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl}),[s.kind,s.displayName,z,s.color,s.emoji,s.imageUrl]),$=cn({agentRef:n==null?void 0:n.agentRef,identity:B,onViewProfile:T}),R=Fs({barRef:A,pillsRef:N,hasReactions:M.length>0}),U=i.useCallback(()=>{var L;return(L=C.current)==null?void 0:L.focus()},[]),oe=i.useMemo(()=>eo(o),[o]),gn=i.useCallback(L=>l.jsx(i.Suspense,{fallback:null,children:l.jsx(oo,{roomId:e,attachment:L})}),[e]),hn=Os(),ae=t.body.subjectAuthorId??t.authorId,E=o.get(ae),V=ee(E==null?void 0:E.agentRef),xn=Ls(e,t),re=ws(t);if(re.kind==="notice")return l.jsx(xs,{entry:t,feedPosition:f,rowId:m,sessionLink:xn,subjectName:E==null?void 0:E.displayName});if(re.kind==="moment")return l.jsx(bs,{entry:t,moment:re.moment,subject:ae===t.authorId?s:Ns(ae,o,hn),subjectIdentity:{handle:(E==null?void 0:E.handle)??void 0,origin:E==null?void 0:E.origin,agent:V&&{runtime:V.runtime,...V.model&&{model:V.model}}},feedPosition:f,rowId:m});const yn=u.position==="first"||u.position==="only";return l.jsxs(P.Root,{ref:C,id:m,position:u.position,actions:q,reactions:b,"data-testid":"room-entry",tabIndex:0,..._s({showAuthorHeader:yn,headerId:y,displayName:s.displayName,time:p,summary:h,contentId:I,summaryId:S,feedPosition:f}),onKeyDown:R,children:[l.jsx(P.Gutter,{author:s,at:t.createdAt,onViewProfile:$?void 0:T,isSelf:t.authorId===a,renderAvatar:$==null?void 0:$.wrapAvatar}),l.jsxs(P.Body,{children:[l.jsx(P.Author,{id:y,author:s,at:t.createdAt,origin:n==null?void 0:n.origin,renderName:$==null?void 0:$.wrapName}),x===!0&&l.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),v!=null&&l.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${v.excerpt}”`}),l.jsx(P.Content,{id:I,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:t.body.fileChange?l.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:so(t.body.fileChange,(E==null?void 0:E.displayName)??"Somebody")}):oe(t,{rowId:t.id,isStreaming:!1})}),h!==null&&l.jsx("span",{id:S,className:"hidden",children:h}),l.jsx(P.Attachments,{items:t.attachments??[],renderAction:g?gn:void 0}),l.jsx(P.Reactions,{ref:N,reactions:M,viewerAuthorId:a,names:r,frequents:c,onToggle:j,disabled:d===!0||!g,onExit:U}),l.jsx(P.Actions,{actions:q,reactions:b,barRef:A,onExit:U})]})]})}const na={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function ao(e){const t=fe(),[s,n]=i.useState([]),o=i.useRef(new Map),a=i.useCallback(f=>{const m=f.map(p=>({id:crypto.randomUUID(),file:p,status:"pending",progress:0}));n(p=>[...p,...m])},[]),r=i.useCallback(f=>{o.current.delete(f),n(m=>m.filter(p=>p.id!==f))},[]),c=i.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const m=new Set(f);for(const p of m)o.current.delete(p);n(p=>p.filter(h=>!m.has(h.id)))},[]),d=i.useCallback(f=>{o.current.delete(f),n(m=>m.map(p=>p.id===f&&p.status==="error"?{...p,status:"pending",progress:0,error:void 0}:p))},[]),g=i.useRef(null),u=Pe({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(w=>w.map(y=>f.some(I=>I.id===y.id)?{...y,status:"uploading"}:y));const m=w=>{n(y=>y.map(I=>I.status==="uploading"?{...I,progress:w.percentage}:I))},p=new AbortController;g.current=p;const h=f.map(w=>w.file);return t.uploadRoomAttachments(e,h,m,p.signal)},onSettled:()=>{g.current=null},onSuccess:(f,m)=>{m.forEach((p,h)=>{const w=f[h];w&&o.current.set(p.id,w.id)}),n(p=>p.map(h=>m.findIndex(y=>y.id===h.id)===-1?h:{...h,status:"uploaded",progress:100}))},onError:f=>{n(m=>m.map(p=>p.status==="uploading"?{...p,status:"error",error:f.message}:p))}}),x=i.useCallback(()=>{var f;(f=g.current)==null||f.abort()},[]),v=i.useCallback(async()=>{const f=s.filter(p=>p.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const m=s.filter(p=>p.status==="pending");return m.length>0&&await u.mutateAsync(m),s.map(p=>o.current.get(p.id)).filter(p=>p!==void 0)},[s,u]);return{pendingFiles:s,addFiles:a,removeFile:r,retryFile:d,clearFiles:c,cancelUpload:x,uploadAndGetIds:v,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function ta(e){const{room:t,threadRootId:s}=e,n=St(),o=Ot(),a=ao((t==null?void 0:t.id)??""),r=t!==void 0&&Ve(t.members,t.viewerAuthorId),c=i.useRef({attachments:a,post:n,reply:o,room:t,threadRootId:s});i.useEffect(()=>{c.current={attachments:a,post:n,reply:o,room:t,threadRootId:s}});const d=i.useCallback(y=>c.current.attachments.addFiles(y),[]),g=i.useCallback(y=>c.current.attachments.removeFile(y),[]),u=i.useCallback(y=>c.current.attachments.retryFile(y),[]),x=i.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:v,hasFailedUpload:f,isUploading:m}=a,p=i.useMemo(()=>({staged:v,add:d,remove:g,retry:u,cancel:x,hasFailed:f,isUploading:m,holdsSendWhileUploading:!1}),[v,f,m,d,g,u,x]),h=i.useCallback(async y=>{const{attachments:I,post:S,reply:C,room:A,threadRootId:N}=c.current;if(A===void 0)throw new Error("That room isn’t loaded yet.");if(A.archived)throw new Error("This room is archived.");Z.getState().recordOpened("room",A.id);const M=et(),j=I.pendingFiles.map(k=>k.file.name),b=I.pendingFiles.map(k=>k.id),O=await I.uploadAndGetIds();I.clearFiles(b);const _=y.parentEntryId??N;if(_!==void 0){C.mutate({roomId:A.id,rootEntryId:_,text:y.text,clientId:M,attachmentIds:O,attachmentNames:j});return}S.mutate({roomId:A.id,text:y.text,clientId:M,attachmentIds:O,attachmentNames:j})},[]);return{target:i.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&r,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:r?{}:{canSendReason:Ge},send:h,attachments:p}),[t,s,r,p,h]),attachments:a}}const dn=8;function un(e){if(e==null)return null;const t=e.replace(/\s+/g," ").trim();return t.length===0?null:t}function ro(e){if(st(e)){const s=e.unreadCount??0;return s===1?"1 new message":`${s} new messages`}const t=e.working??0;return t>0?t===1?"1 agent working":`${t} agents working`:un(e.topic)}function Ee(e){return{kind:"session",id:e.id,name:tt(e.title),summary:un(e.lastMessagePreview),lastActivityAt:e.updatedAt,session:e}}function io(e){return{kind:e.kind==="dm"?"dm":"channel",id:e.id,name:se(e),summary:ro(e),lastActivityAt:e.lastActivityAt,room:e}}function J(e){if(e===void 0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:t}function co(e){return e.kind==="session"?Ie("session",e.id):Ie("room",e.id)}function Te(e,t){const s=[J(t[co(e)]),...e.kind==="session"?[J(e.session.lastTouchedByYouAt),J(e.session.userLastMessageAt)]:[]].filter(n=>n!==null);return s.length>0?Math.max(...s):J(e.lastActivityAt)??Number.NEGATIVE_INFINITY}function lo(e){return(t,s)=>Te(s,e)-Te(t,e)||s.id.localeCompare(t.id)}function uo(e){const t=new Set;return e.filter(s=>{const n=`${s.kind}:${s.id}`;return t.has(n)?!1:(t.add(n),!0)})}function mo(e,t){return!(t.has(e.id)||e.unreadCount===null||e.lastActivityAt===e.createdAt)}function fo({sessions:e,rooms:t,mutedRoomIds:s=new Set,interactions:n={},limit:o=dn}){const{yours:a,spinOffs:r,automated:c}=nt(e),d=lo(n),g=[...a.map(Ee),...t.filter(u=>mo(u,s)).map(io)].sort(d);return{items:uo(g).slice(0,o),automated:[...r,...c].map(Ee).sort(d).slice(0,o)}}const po=3,go=rt;function ho({limit:e=dn,mutedRoomIds:t,enabled:s=!0}={}){var g,u;const n=ot(Math.max(e*po,go),{enabled:s}),o=Le({enabled:s}),a=at(),r=(g=n.data)==null?void 0:g.sessions,c=o.data;return{...i.useMemo(()=>fo({sessions:r??[],rooms:c??[],mutedRoomIds:t,interactions:a,limit:e}),[r,c,t,a,e]),isLoading:s&&(n.isLoading||o.isLoading),warnings:((u=n.data)==null?void 0:u.warnings)??[]}}const xo=6,mn="jump-back-in-listbox";function ke(e){return`jump-back-in-item-${e}`}const yo='[role="combobox"]';function K(e){return e instanceof Element&&e.matches(yo)}function bo({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=We(),o=it(),[a,r]=i.useState(!1),[c,d]=i.useState({stamp:"",index:0}),[g,u]=i.useState(!1),[x,v]=i.useState(!1);e.length>0&&!x&&v(!0);const f=i.useRef(!1);i.useEffect(()=>{f.current=!0},[]);const{data:m}=he({enabled:s}),p=i.useMemo(()=>((m==null?void 0:m.agents)??[]).map(R=>R.projectPath),[m]),{data:h}=Ke(p,{enabled:s}),w=i.useMemo(()=>h??{},[h]),y=i.useMemo(()=>ct(p,w),[p,w]),I=i.useMemo(()=>new Map(p.map(R=>[ge(R),R])),[p]),S=i.useCallback(R=>lt({room:R,agentsByPath:w,pathByAgentRef:I}),[w,I]),C=i.useMemo(()=>dt(o.muted),[o.muted]),{items:A}=ho({mutedRoomIds:C,enabled:s}),N=i.useMemo(()=>A.slice(0,xo),[A]),M=s&&a&&!g&&!x&&!t&&e.length===0&&N.length>0,j=`${M}:${N.length}`,b=c.stamp===j?c.index:0,O=i.useCallback(R=>{f.current&&K(R.target)&&(u(!1),v(!1),r(!0))},[]),_=i.useCallback(R=>{K(R.target)&&r(!0)},[]),k=i.useCallback(R=>{K(R.target)&&r(!1)},[]),D=i.useCallback(R=>{N.length!==0&&d(U=>{const oe=U.stamp===j?U.index:0;return{stamp:j,index:(oe+R+N.length)%N.length}})},[N.length,j]),T=i.useCallback(()=>D(1),[D]),q=i.useCallback(()=>D(-1),[D]),z=i.useCallback(()=>{u(!0)},[]),B=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Z.getState().recordOpened("agent",R.session.cwd),n(pe({dir:R.session.cwd??void 0,session:R.session.id}));return}Z.getState().recordOpened("room",R.room.id),n({...ut.channels(),search:{id:R.room.id}})},[n]),$=i.useCallback(()=>{const R=N[b];!M||!R||B(R)},[M,N,b,B]);return{isOpen:M,hasRows:N.length>0,rows:N,agents:w,displayNames:y,visualOf:S,selectedIndex:b,activeDescendantId:M&&N[b]!==void 0?ke(b):void 0,listboxId:M?mn:void 0,handleFocus:O,handleBlur:k,handlePointerDown:_,moveDown:T,moveUp:q,selectHighlighted:$,selectRow:B,dismiss:z}}function fn({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:a,isSelected:r,now:c,onSelect:d}){const g=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:yt(o),[o,c]);return l.jsxs("div",{id:ke(a),role:"option","aria-selected":r,"data-selected":r,title:s,onClick:d,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),l.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),g!==null&&l.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:g})]}),n!==null&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function vo({item:e,agent:t,displayName:s,index:n,isSelected:o,now:a,onSelect:r}){const c=ft(t,e.session.cwd??s);return l.jsx(fn,{mark:l.jsx(pt,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:a,onSelect:r})}function ko({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:a}){return l.jsx(fn,{mark:l.jsx(ht,{room:e.room,participants:e.room.participants,visuals:xt(t)}),label:l.jsx(gt,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:a})}function wo({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:a}){const r=mt(6e4);return i.useEffect(()=>{var c,d;(d=(c=document.getElementById(ke(t)))==null?void 0:c.scrollIntoView)==null||d.call(c,{block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:l.jsx("div",{id:mn,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,d)=>{var g;return c.kind==="session"?l.jsx(vo,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((g=c.session.cwd)==null?void 0:g.split("/").pop())||"Agent",index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`session-${c.id}`):l.jsx(ko,{item:c,visual:o(c.room),index:d,isSelected:d===t,now:r,onSelect:()=>a(c)},`room-${c.id}`)})})})}const $e={people:"People",agents:"Agents"},No=["people","agents"];function Io(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Ro(e,t,s){const n=t.trim().toLowerCase(),o=e.map((a,r)=>({row:a,position:r,tier:Co(a,n)})).filter(a=>a.tier!==null).sort((a,r)=>a.tier-r.tier||a.position-r.position);return s.flatMap(a=>o.filter(r=>r.row.section===a).map(({row:r})=>r))}function Co(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(a=>a!==void 0);let n=null;for(const a of s){const r=a===t?0:a.startsWith(t)?1:a.includes(t)?2:null;r!==null&&(n===null||r<n)&&(n=r)}return n}function Y(e,t,s){var a;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let r=0;r<n;r++){if(!((a=e[o])!=null&&a.disabled))return o;o=(o+s+n)%n}return 0}function Ao(e,t,s,n){const o=e.slice(0,t),a=e.slice(t+1+s.length),r=`@${n}`,c=a.startsWith(" ")?"":" ";return{value:o+r+c+a,cursorPos:o.length+r.length+1}}const Mo=/(^|\s)@([A-Za-z0-9_.-]*)$/,pn="mention-palette-listbox";function me(e){return`mention-item-${e}`}function jo({members:e,viewerAuthorId:t,text:s,sectionOrder:n=No}){var _;const[o,a]=i.useState(!1),[r,c]=i.useState(""),[d,g]=i.useState(-1),u=bt(s),x=i.useRef(!1),v=i.useMemo(()=>Io(e,t),[e,t]),f=i.useMemo(()=>o?Ro(v,r,n):[],[v,r,o,n]),[m,p]=i.useState(null),h=m!==null&&m.query===r&&m.open===o?m.index:Y(f,0,1),w=f[h],y=f.length===0||w!==void 0&&!w.disabled?h:Y(f,0,1),I=i.useCallback((k,D)=>{const T=k.slice(0,D).match(Mo);if(!T){a(!1);return}a(!0),c(T[2]),g((T.index??0)+T[1].length)},[]),S=i.useCallback(k=>{u.write(k),x.current=!1},[u]),C=i.useCallback(k=>{x.current||I(u.read(),k)},[I,u]),A=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y+1,1)})},[f,y,r,o]),N=i.useCallback(()=>{p({query:r,open:o,index:Y(f,y-1,-1)})},[f,y,r,o]),M=i.useCallback(k=>k.disabled||k.handle===void 0?null:(x.current=!0,a(!1),Ao(u.read(),d,r,k.handle)),[d,r,u]),j=i.useCallback(()=>{const k=f[y];return k?M(k):(a(!1),null)},[f,y,M]),b=i.useCallback(()=>{x.current=!0,a(!1)},[]),O=f.some(k=>!k.disabled);return{isOpen:o,hasSelectableRows:O,rows:f,selectedIndex:y,activeDescendantId:o&&((_=f[y])==null?void 0:_.disabled)===!1?me(y):void 0,listboxId:o?pn:void 0,noteTextChange:S,handleCursorChange:C,moveDown:A,moveUp:N,selectHighlighted:j,selectRow:M,dismiss:b}}function So({rows:e,selectedIndex:t,onSelect:s}){const n=i.useMemo(()=>{const o=[];return e.forEach((a,r)=>{const c=o[o.length-1];c&&c.section===a.section?c.items.push({row:a,index:r}):o.push({section:a.section,items:[{row:a,index:r}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(me(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),l.jsx(Je.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:l.jsx("div",{id:pn,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?l.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:a},r)=>l.jsxs("div",{role:"group","aria-label":$e[o],children:[r>0&&l.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),l.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:$e[o]}),a.map(({row:c,index:d})=>{const g=d===t;return l.jsxs("div",{id:me(d),role:"option","aria-selected":g,"aria-disabled":c.disabled,"data-selected":g,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[l.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),l.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&l.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&l.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function sa({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:a}){const r=t===void 0?e.id:Ue(e.id,t),c=vt(r),{target:d}=_t(),g=kt(),u=wt(r),x=i.useRef(null),v=Ve(e.members,e.viewerAuthorId),f=i.useRef(!1),m=jo({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),p=n===!0,h=bo({value:c,yieldToPalette:m.isOpen,enabled:p}),w=i.useRef(u);i.useEffect(()=>{var b;u!==w.current&&(w.current=u,(b=x.current)==null||b.focus())},[u]),i.useEffect(()=>{var b;s===!0&&((b=x.current)==null||b.focusUnlessTouch())},[]);const y=i.useCallback(b=>X.getState().set(r,b),[r]),[I,S]=i.useState(null);i.useLayoutEffect(()=>{var b;I!==null&&((b=x.current)==null||b.focusAt(I.pos))},[I]);const C=i.useCallback(b=>{b&&(y(b.value),S({pos:b.cursorPos}))},[y]),A=i.useCallback(b=>C(m.selectRow(b)),[m,C]),N=i.useCallback(()=>C(m.selectHighlighted()),[m,C]),M=()=>{if(d===null||!d.canSend||f.current)return;m.dismiss();const b=X.getState().take(r).trim();if(b==="")return;const O=a.pendingFiles.length>0;O&&(f.current=!0),d.send({text:b}).catch(()=>{const _=X.getState(),k=_.drafts[r]??"";_.set(r,k===""?b:`${b}
|
|
44
|
-
${k}`)}).finally(()=>{O&&(f.current=!1)})};if(!v)return l.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[l.jsx("p",{className:"text-muted-foreground text-sm",children:Ge}),l.jsx(ue,{type:"button",size:"sm",variant:"outline",disabled:g.isPending,onClick:()=>g.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>Be.success(`You joined ${se(e)}`)}),children:Nt})]});const j=l.jsx(Et.Composer,{inputRef:x,value:c,onChange:b=>{y(b),m.noteTextChange(b)},onSubmit:M,head:l.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:m.isOpen&&m.rows.length===0?"No one by that name.":""}),mentionPicker:l.jsx(Re,{children:m.isOpen&&l.jsx(So,{rows:m.rows,selectedIndex:m.selectedIndex,onSelect:A})}),overlays:l.jsx(l.Fragment,{children:l.jsx(Re,{children:h.isOpen&&l.jsx(wo,{rows:h.rows,selectedIndex:h.selectedIndex,agents:h.agents,displayNames:h.displayNames,visualOf:h.visualOf,onSelect:h.selectRow})})}),input:{onCursorChange:m.handleCursorChange,isStreaming:!1,isPaletteOpen:m.isOpen||h.isOpen,paletteHasResults:h.isOpen?h.hasRows:m.hasSelectableRows,onArrowUp:h.isOpen?h.moveUp:m.moveUp,onArrowDown:h.isOpen?h.moveDown:m.moveDown,onCommandSelect:h.isOpen?h.selectHighlighted:N,onEscape:h.isOpen?h.dismiss:m.dismiss,tabPicks:!h.isOpen,onClear:()=>{y(""),m.dismiss()},activeDescendantId:h.isOpen?h.activeDescendantId:m.activeDescendantId,paletteListboxId:h.isOpen?h.listboxId:m.listboxId,contextKey:r,...a.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!p&&o===void 0?j:l.jsx("section",{className:"flex flex-col","data-testid":It.homeComposer,onFocus:b=>{h.handleFocus(b),K(b.target)&&(o==null||o(!0))},onBlur:b=>{h.handleBlur(b),K(b.target)&&(o==null||o(!1))},onPointerDown:h.handlePointerDown,children:j})}export{Qo as A,sa as C,ye as I,na as R,zo as a,ea as b,Ns as c,Vo as d,Zo as e,Xo as f,Go as g,Is as h,is as i,qo as j,Rs as k,Cs as l,As as m,Jo as n,Yo as o,K as p,rs as r,W as t,ta as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-DSYz85aL.js";import{a as t}from"./ProfileFields-C48alR3i.js";import"./profile-errors--0_JG2R0.js";import"./use-mounted-ref-Bp9Wp7zY.js";function n({member:r}){return o.jsx(t,{member:r})}export{n as HandlePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-DSYz85aL.js";import{P as m}from"./ProfileFields-C48alR3i.js";import"./profile-errors--0_JG2R0.js";import"./use-mounted-ref-Bp9Wp7zY.js";function a({member:r}){return o.jsx(m,{member:r})}export{a as NamePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as b,a3 as R,a4 as j,aP as x,a7 as P,eI as C,r as d,j as e,cT as E,cU as M,cW as k,cX as T,cY as K,dU as I,eu as L,I as F,aF as N,B as D,bz as B,bA as O,eJ as Q,f as Y,bB as _,bD as q,eK as z}from"./index-DSYz85aL.js";function w(t){return Promise.all([t.invalidateQueries({queryKey:x.lists()}),t.invalidateQueries({queryKey:x.details()}),t.invalidateQueries({queryKey:x.threads()})]).then(()=>{})}function A(t){return(t==null?void 0:t.code)==="SLUG_TAKEN"}function H({isInlineErrorVisible:t}){const n=b(),r=R();return j({mutationFn:({title:a,agentPaths:l})=>n.createRoom({kind:"channel",title:a,members:[],agentPaths:l}),onSuccess:()=>w(r),meta:{suppressErrorToast:!0},onError:a=>{A(a)&&t()||P.error("Couldn’t create that channel.",{description:a.message})}})}function X(){const t=b(),n=R();return j({mutationFn:({agentPaths:r,title:a})=>t.createRoom({kind:"dm",title:a,members:[],agentPaths:r}),onSettled:()=>w(n),meta:{errorLabel:"Couldn’t start that DM"}})}const y=200;function $({open:t,onOpenChange:n,onCreated:r}){const a=C(),[l,m]=d.useState(""),h=d.useRef(null),c=d.useRef(null),u=d.useRef(!0);d.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]);const o=H({isInlineErrorVisible:()=>u.current}),g=A(o.error)?o.error.message:null,f=l.trim(),p=f.length>0&&f.length<=y,v=s=>{!p||o.isPending||o.mutate({title:f,agentPaths:s.map(i=>i.agentPath)},{onSuccess:i=>{n(!1),r(i)}})},S=s=>{var i;s.key==="Enter"&&(s.preventDefault(),p&&((i=c.current)==null||i.focus()))};return e.jsx(E,{open:t,onOpenChange:n,children:e.jsxs(M,{className:"sm:max-w-md",onOpenAutoFocus:s=>{var i;s.preventDefault(),(i=h.current)==null||i.focus()},children:[e.jsxs(k,{children:[e.jsx(T,{children:"New channel"}),e.jsx(K,{children:"Name it, then pick who’s in it."})]}),e.jsxs(I,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{htmlFor:"channel-name",children:"Channel name"}),e.jsx(F,{ref:h,id:"channel-name",value:l,maxLength:y,placeholder:"Backend",autoComplete:"off",onChange:s=>{m(s.target.value),o.error&&o.reset()},onKeyDown:S,"aria-invalid":g?!0:void 0,"aria-describedby":g?"channel-name-error":void 0}),g&&e.jsx("p",{id:"channel-name-error",role:"alert",className:"text-destructive text-xs",children:g})]}),e.jsxs("section",{"aria-label":"Agents in this channel",className:"space-y-2 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Who’s in it"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Agents read everything here and reply when @mentioned."}),e.jsx(N,{roster:a,onSubmit:v,submitLabel:s=>s.length===0?"Create channel":s.length===1?"Create channel with 1 agent":`Create channel with ${s.length} agents`,emptyRosterMessage:"You don’t have any agents yet. You can add them to the channel later.",allChosenMessage:"That’s every agent you have.",isSubmitting:o.isPending,submitDisabled:!p,inputRef:c})]}),e.jsx("div",{className:"flex justify-center border-t pt-3",children:e.jsx(D,{type:"button",variant:"ghost",size:"sm",disabled:!p||o.isPending,onClick:()=>v([]),children:"Create it without agents"})})]})]})})}const U="One agent opens a chat. Two or more start a group message.";function G(t){return t.length===1}function V(t){const n=t[0];return n!==void 0&&G(t)?`Open chat with ${n.displayName}`:"Start group message"}function J({onStart:t,open:n,onOpenChange:r,hideTrigger:a=!1}){const l=C(),m=d.useRef(null),h=()=>{r(!1),z.getState().open()};return e.jsxs(B,{open:n,onOpenChange:r,modal:!0,fullHeight:!0,children:[e.jsx(O,{asChild:!0,children:e.jsx(Q,{...a?{"aria-hidden":!0,tabIndex:-1,className:"sr-only"}:{"aria-label":"New message"},children:e.jsx(Y,{})})}),e.jsxs(_,{side:"right",align:"start",className:"flex w-64 flex-col p-2","aria-label":"New message",onOpenAutoFocus:c=>{var u;c.preventDefault(),(u=m.current)==null||u.focus()},children:[e.jsx(q,{children:"New message"}),e.jsx(N,{inputRef:m,roster:l,onSubmit:c=>{r(!1),t(c)},submitLabel:V,emptyRosterMessage:"You don’t have any agents yet.",emptyRosterAction:e.jsx(D,{type:"button",size:"sm",variant:"outline",onClick:h,children:"Create agent"}),allChosenMessage:"Everyone is already here."}),e.jsx("p",{className:"text-muted-foreground mt-2 shrink-0 px-2 text-xs",children:U})]})]})}export{$ as C,J as N,U as O,G as a,V as o,X as u};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{eM as A,r as f,eN as K,eO as T,a1 as p,a2 as _,a3 as m,a4 as v,eP as M,j as d,eQ as S,cQ as R,G as j}from"./index-DSYz85aL.js";import{u as w}from"./use-mesh-topology-C5njB0KY.js";const O={activeWithinMs:3600*1e3,inactiveAfterMs:10080*60*1e3};function P(e){if(e.liveKinds.includes("pendingApproval")||e.liveKinds.includes("error")||e.hasBrokenExecutionConfig===!0)return"needs-attention";if(e.liveKinds.includes("streaming"))return"active";if(e.lastActivityAt===null)return"fresh";if(e.now-e.lastActivityAt<=O.activeWithinMs)return"active";const s=Math.max(e.lastActivityAt,e.lastInteractionAt??e.lastActivityAt);return e.now-s>O.inactiveAfterMs?"inactive":"idle"}function x(e,t,s){var a;const n=new Map;for(const[i,o]of Object.entries(e)){if(!s.has(o))continue;const r=T((a=t[i])==null?void 0:a.lifecycle);if(!r)continue;const c=n.get(o);c?c.push(r):n.set(o,[r])}return n}const Q=Object.freeze({});function B(e,t=[],s=Q){const n=e.join(`
|
|
2
|
-
`),a=t.join(`
|
|
3
|
-
`),i=A(f.useCallback(u=>u.statusCwds,[])),o=A(f.useCallback(u=>u.statuses,[])),{data:r}=K(),c=r==null?void 0:r.agentActivity;return f.useMemo(()=>{const u=n.length===0?[]:n.split(`
|
|
4
|
-
`),N=new Set(a.length===0?[]:a.split(`
|
|
5
|
-
`)),b=x(i,o,new Set(u)),k=Date.now(),y={};for(const l of u){const g=c==null?void 0:c[l];y[l]=P({liveKinds:b.get(l)??[],lastActivityAt:g?new Date(g).getTime():null,lastInteractionAt:s[l]??null,now:k,hasBrokenExecutionConfig:N.has(l)})}return y},[n,a,i,o,c,s])}function G(e){const t=p();return _({queryKey:["mesh","agent-health",e],queryFn:()=>t.getMeshAgentHealth(e),enabled:e!==null})}const h=["mesh","topology"];function W(){const e=p(),t=m();return v({mutationFn:s=>e.updateMeshAccessRule(s),onSuccess:()=>{t.invalidateQueries({queryKey:h})}})}function E(){const e=p(),t=m();return v({mutationFn:s=>e.updateMeshAccessRule({sourceNamespace:M,targetNamespace:M,action:s?"allow":"deny"}),onMutate:async s=>{await t.cancelQueries({queryKey:h});const n=t.getQueriesData({queryKey:h});return t.setQueriesData({queryKey:h},a=>a&&{...a,openMesh:s}),{previous:n}},onError:(s,n,a)=>{for(const[i,o]of(a==null?void 0:a.previous)??[])t.setQueryData(i,o)},onSettled:()=>{t.invalidateQueries({queryKey:h})}})}const C="Let all my agents talk to each other",q="On: any agent can message any other. Off: same project, plus pairs below.",L="New agents reach only their own project. Change it later in Team → Access.";function D({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(S,{label:C,description:q,checked:e,onCheckedChange:t,disabled:s,className:n})}function H({checked:e,onCheckedChange:t,disabled:s,className:n}){return d.jsx(S,{label:C,description:L,checked:e,onCheckedChange:t,disabled:s,className:j("bg-muted/40 rounded-xl px-4 py-3",n)})}function Y(){const{data:e}=w(),{mutate:t,isPending:s}=E();return d.jsx(D,{checked:(e==null?void 0:e.openMesh)??!1,onCheckedChange:t,disabled:s})}function z({className:e}){const{data:t}=w(),{data:s}=R(),{mutate:n,isPending:a}=E(),i=((s==null?void 0:s.agents)??[]).filter(o=>!o.isSystem).length;return(t==null?void 0:t.openMesh)!==!1||i===0?null:d.jsx(H,{checked:!1,onCheckedChange:n,disabled:a,className:e})}export{Y as O,W as a,G as b,z as c,B as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-DSYz85aL.js";import{b as t}from"./ProfileFields-C48alR3i.js";import"./profile-errors--0_JG2R0.js";import"./use-mounted-ref-Bp9Wp7zY.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as ie,a4 as de,a3 as Oe,iQ as _e,iR as ne,iS as me,iT as Le,iU as Fe,iV as De,aP as ze,r as s,j as t,G as ee,B as je,x as He,e as Q,gZ as Ie,hI as qe,gY as ke,iW as We,iX as $e,n as Be,h0 as X,a7 as Ke,fb as Ue,iY as Xe,iZ as Ye,i_ as Ge,cj as Qe,i$ as Ve,j0 as Ze,j1 as Je,j2 as et,cf as tt,j3 as nt,gk as G,j4 as st,l as rt,s as he,j5 as ot,j6 as at,ef as it,X as dt,dW as lt,ar as ut,j7 as ct,j8 as pe,j9 as ft,ad as mt,ja as ht,gX as pt,gW as gt,jb as xt,aI as ge,by as Rt}from"./index-DSYz85aL.js";import{P as yt,u as vt}from"./pane-resize-handle-CXxva43c.js";import{D as bt,U as wt,u as jt}from"./UnreadDivider-CGKnJcx7.js";import{u as It}from"./use-room-follow-claim-BruRRf3z.js";import{a as le,e as ue,g as kt,f as Ae,h as At,i as Ne,c as U,d as V,j as Nt,k as re,b as oe,l as ae,A as Se,m as Ce,t as ce,r as St,n as J,R as fe,u as Me,C as Te,o as Ct}from"./ChannelComposer-WR3_Vvta.js";import{u as Mt,f as Tt,a as Pt,F as Et,C as Y,d as Ot,M as _t}from"./index-DYF1ER90.js";import{u as Lt}from"./use-connector-management-CinfkPZI.js";import{A as Ft}from"./AgentRequestCard-DVoE2cnk.js";import{u as Dt}from"./use-room-sessions-DGcrmZvE.js";function zt(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.haltRoomAgent(o,r),meta:{errorLabel:"Couldn’t stop this agent"}})}function Ht(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.promoteHold(o,r),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function qt(e){const o=ie(),r=Oe(),u=_e(e),y=ne(p=>{var f;return e===null?null:((f=p.paging[e])==null?void 0:f.cursor)??null}),i=de({mutationFn:async p=>{var w;const f=(w=ne.getState().paging[p])==null?void 0:w.cursor;if(f==null)return;const v=await o.listRoomEntries(p,{before:f,limit:me}),I=ze.entries(p),k=r.getQueryData(I),A=Le(k,v);r.setQueryData(I,A),ne.getState().notePage(p,Fe(v)??f,De(v,me)||A.length===((k==null?void 0:k.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:d,isPending:j}=i,R=s.useRef(!1),x=s.useCallback(async()=>{if(!(e===null||R.current)){R.current=!0;try{await d(e).catch(()=>{})}finally{R.current=!1}}},[e,d]);return{canLoadOlder:u,isLoadingOlder:j,cursor:y,loadOlder:x}}function Wt({id:e,summary:o,open:r,onOpen:u}){const{capabilities:y}=Mt(),{count:i,lastAt:d,unread:j}=o,R=Tt(d),[x,p]=s.useState({count:i,bumped:!1});x.count!==i&&p({count:i,bumped:!0});const f=x.count===i&&x.bumped;return y.threads?t.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":j>0?"":void 0,"aria-expanded":r,onClick:u,className:ee("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","mb-1 w-fit rounded text-left text-xs transition-colors","px-2 py-2 md:px-1 md:py-0.5",j>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[t.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),t.jsx("span",{className:ee(f&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:i},i),i===1?" reply":" replies",R.length>0&&t.jsxs(t.Fragment,{children:[" · last ",t.jsx("time",{dateTime:d,title:Pt(d),children:R})]}),j>0&&` · ${j} new`]}):null}function $t({loading:e,onLoad:o}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(je,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&t.jsx(He,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}const Bt="room-load-older",Kt=4;function Pe({roomName:e}){return t.jsx(Et,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:Kt},(o,r)=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(Q,{className:"size-7 shrink-0 rounded-full"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${r}`))})}function Ut({roomId:e,roomName:o,viewerAuthorId:r,entries:u,members:y,formerAuthors:i,lastReadSeq:d,reactionFrequents:j,streamStalled:R,isLoading:x,error:p,onAddAgents:f,openThreadId:v,onOpenThread:I,resumeRow:k,landOnRow:A,onTopRow:w,canLoadOlder:S=!1,isLoadingOlder:l=!1,onLoadOlder:c,ref:C}){const N=s.useMemo(()=>le(y,i),[y,i]),P=Ie(y,r),E=ue(),T=s.useMemo(()=>new Map([...N].map(([n,m])=>[n,m.displayName])),[N]),M=qe(),L=ke(e,null),{topLevel:H,repliesByRoot:F,orphaned:D}=s.useMemo(()=>kt(u),[u]),q=s.useMemo(()=>new Map(u.map(n=>[n.id,n])),[u]),z=s.useMemo(()=>{const n=We(H,d),m=$e(H.map(a=>({id:a.id,authorId:a.body.moment?`moment:${a.id}`:a.authorId,timestamp:a.createdAt})),{now:M,lastSeenId:n.lastSeenId,unreadFromStart:n.fromStart}),b=[];S&&!x&&b.push({kind:"load-older",id:Bt});for(const a of m){if(a.kind==="day-divider"){b.push({kind:"day-divider",id:a.key,label:a.label});continue}if(a.kind==="unread-divider"){b.push({kind:"unread-divider",id:a.key});continue}const h=H[a.index];b.push({kind:"message",id:h.id,entry:h,grouping:a.grouping,position:a.index+1,answers:Ae(h,H[a.index-1],q.get.bind(q))});const g=F.get(h.id);g&&b.push({kind:"thread-reply",id:At(h.id),rootId:h.id,replies:g,totalReplies:h.threadReplyCount})}return b},[H,F,q,d,M,S,x]),W=s.useMemo(()=>z.map(n=>n.kind==="load-older"?{kind:"notice",id:n.id,at:"",body:null}:n.kind==="day-divider"?{kind:"day-divider",id:n.id,label:n.label}:n.kind==="unread-divider"?{kind:"unread-divider",id:n.id}:n.kind==="thread-reply"?{kind:"thread-reply",id:n.id,rootId:n.rootId,replyCount:Ne(n.replies.length,n.totalReplies),lastAt:n.replies[n.replies.length-1].createdAt}:{kind:"message",id:n.id,payload:n.entry,grouping:n.grouping,author:U(V(n.entry,N),N,E.faces),at:n.entry.createdAt}),[z,N,E.faces]),K=s.useCallback((n,m)=>{const b=z[m.index];if(b.kind==="load-older")return c===void 0?null:t.jsx($t,{loading:l,onLoad:c});if(b.kind==="day-divider")return t.jsx(bt,{label:b.label});if(b.kind==="unread-divider")return t.jsx(wt,{});if(b.kind==="thread-reply"){if(m.onOpenThread===void 0)return null;const h=m.onOpenThread;return t.jsx(Wt,{id:re(b.rootId),summary:Nt(b.replies,d,b.totalReplies),open:v===b.rootId,onOpen:()=>h(b.rootId)})}const a=V(b.entry,N);return t.jsx(oe,{roomId:e,entry:b.entry,author:U(a,N,E.faces),authorRef:N.get(a),authors:N,viewerAuthorId:r,authorNames:T,reactionFrequents:j,streamStalled:R,isMember:P,grouping:b.grouping,orphanedReply:D.has(b.entry.id),answers:b.answers,feedPosition:{index:b.position,total:-1},rowId:ae(b.entry.id)})},[z,e,N,E.faces,r,T,j,R,P,D,d,v,l,c]),O=s.useCallback(n=>{if(n.kind==="message")return ae(n.id);if(n.kind==="thread-reply")return re(n.rootId)},[]);if(p)return t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),t.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const $=y.some(n=>n.author.kind==="agent"),B=t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx(Be,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),t.jsx("p",{className:"max-w-sm",children:$?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(je,{type:"button",size:"sm",variant:$?"ghost":"default",onClick:f,className:"mt-1",children:$?"Add more agents":"Add agents"})]});return t.jsx(Se,{known:E,children:t.jsx(Y.Timeline,{ref:C,conversationId:e,label:`Messages in ${o}`,rows:W,renderRow:K,onOpenThread:I,domIdOf:O,...k===void 0?{}:{resumeRow:k},...A===void 0?{}:{landOnRow:A},...w===void 0?{}:{onTopRow:w},pending:L,viewerAuthorId:r,loading:x?t.jsx(Pe,{roomName:o}):void 0,empty:B,feedTestId:"room-timeline"})})}function Xt(e){const{roomId:o,entrySeq:r,entries:u,historyLoaded:y}=e,i=r===void 0?null:`${o}:${r}`,d=s.useMemo(()=>{if(r===void 0)return null;const k=u.find(l=>l.seq===r);if(k===void 0)return null;const A=Ce(u,k.id);if(A===null)return null;const w=ce(k)??null,S=w!==null&&A.rowId!==k.id;return{roomRowId:A.rowId,threadRootId:S?w:null,entryId:k.id}},[u,r]),j=s.useRef(null),R=(d==null?void 0:d.threadRootId)??null;s.useEffect(()=>{i===null||R===null||j.current!==i&&(j.current=i,X.getState().openThread(o,R))},[i,o,R]);const x=s.useRef(null);s.useEffect(()=>{i===null||!y||d===null&&x.current!==i&&(x.current=i,Ke.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[i,y,d]);const p=s.useRef(null),f=s.useCallback(()=>{if(!(i===null||p.current===i))return p.current=i,d==null?void 0:d.roomRowId},[i,d]),v=s.useRef(null),I=s.useCallback(()=>{if(!(i===null||v.current===i))return v.current=i,(d==null?void 0:d.threadRootId)===null||d==null?void 0:d.entryId},[i,d]);return{roomRow:r===void 0?void 0:f,threadRow:r===void 0?void 0:I}}function Yt(e,o){const[r,u]=s.useState({roomId:null,seq:null});return r.roomId===e?r.seq:e===null?(u({roomId:null,seq:null}),null):o===null?null:(u({roomId:e,seq:o}),o)}const Gt=600;function Qt(e){return document.getElementById(re(e))??document.getElementById(ae(e))}function Vt(){const e=s.useRef(null);return s.useEffect(()=>()=>{var r;return(r=e.current)==null?void 0:r.call(e)},[]),{arm:s.useCallback(r=>{var j;(j=e.current)==null||j.call(e);let u=0;const y=Date.now()+Gt;let i=!1;const d=()=>{if(i)return;const R=document.activeElement;if(R===null||R===document.body||!R.isConnected){const p=Qt(r);if(p!==null){p.focus();return}}Date.now()>=y||(u=requestAnimationFrame(d))};u=requestAnimationFrame(d),e.current=()=>{i=!0,cancelAnimationFrame(u)}},[])}}function Zt({roomId:e,route:o,urlThreadId:r,openThreadId:u,entries:y,historyLoaded:i}){const d=Ue(),j=s.useRef(null);s.useEffect(()=>{if(e!==null){if(j.current!==e&&(j.current=e,r!==void 0)){X.getState().openThread(e,r);return}if(i&&u!==void 0){const R=y.find(p=>p.id===u),x=R===void 0?void 0:St(R);if(x!==void 0&&x!==u){const p=X.getState().open[e];X.getState().openThread(e,x,(p==null?void 0:p.focusComposer)??!1);return}}u!==r&&(d==null||d({to:o,search:R=>({...R,thread:u}),replace:!0}))}},[e,o,u,r,y,i,d])}function Jt(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(o=>o.author.kind==="agent")}function en({room:e,hasEntries:o,onAddAgents:r}){return!o||!Jt(e)?null:t.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",t.jsx("button",{type:"button",onClick:r,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function tn({roomId:e}){const{approvals:o}=Xe(),r=Ye(o).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:t.jsx(Ge,{approvals:r})})}function nn({roomId:e}){const{data:o}=Lt("pending"),r=(o??[]).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:r.map(u=>t.jsx(Ft,{request:u},u.requestId))})}const sn="An agent",xe=64,se=3,rn=new Set;function Ee({room:e,entries:o,scope:r,laneScope:u,stalled:y,unavailable:i=!1,onRetry:d,onScrollToRow:j}){const R=Qe(),x=Ve(e.id,r),p=Ze(e.id,r),f=Je(e.id,r),[v,I]=s.useState(!1),k=Dt(e.id,{enabled:v}),A=et(),{mutate:w}=zt(),[S,l]=s.useState(rn),c=s.useCallback(a=>{l(h=>new Set(h).add(a)),w({roomId:e.id,authorId:a},{onSettled:()=>l(h=>{const g=new Set(h);return g.delete(a),g})})},[w,e.id]),C=Ht(),[N,P]=s.useState(()=>new Map),E=tt(),T=ue(),M=s.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),L=s.useCallback(a=>{var h;return((h=M.get(a))==null?void 0:h.displayName)??sn},[M]),{interactions:H}=nt(),F=s.useMemo(()=>H.filter(a=>a.roomId===e.id),[H,e.id]),D=s.useMemo(()=>{var h;const a={};for(const g of F){if(g.roomAuthorId===void 0)continue;const _=(h=M.get(g.roomAuthorId))==null?void 0:h.displayName;_!==void 0&&(a[g.sessionId]=_)}return a},[F,M]),q=s.useMemo(()=>x.map(a=>({authorId:a.authorId,name:L(a.authorId),state:a.state,since:a.since,activity:a.activity??null})),[x,L]),z=s.useMemo(()=>p.map(a=>{var g;const h=(g=E.data)==null?void 0:g.find(_=>_.id===a.behindRoomId);return{authorId:a.authorId,name:L(a.authorId),since:a.since,behind:{roomId:a.behindRoomId,title:h===void 0?null:G(h)},othersWaiting:a.othersWaiting,severalInTheWay:a.severalInTheWay}}),[p,L,E.data]),W=s.useMemo(()=>{const a=new Set;for(const h of p)N.get(h.authorId)===h.entryId&&a.add(h.authorId);return a},[p,N]),K=s.useMemo(()=>f===null?null:{authorId:f.authorId,name:L(f.authorId)},[f,L]),O=s.useMemo(()=>Ot({capabilities:fe,asks:F,agentNames:D,stalled:y,presence:q,held:z,silentFinish:K,turn:null}),[F,D,q,z,K,y]),$=s.useMemo(()=>{var h;const a=new Map;for(const g of((h=k.data)==null?void 0:h.bindings)??[])a.set(g.authorId,g.sessionId);return a},[k.data]),B=s.useCallback(a=>{const h=o.find(_=>_.id===a);if(h===void 0)return null;const g=h.body.text.replace(/\s+/gu," ").trim();return g.length===0?null:g.length>xe?`${g.slice(0,xe).trimEnd()}…`:g},[o]),n=s.useCallback(a=>{var h;return u==="thread"?J(a):((h=Ce(o,a))==null?void 0:h.domId)??null},[o,u]),m=s.useMemo(()=>{const a=x.map(g=>{const _=B(g.entryId),Z=n(g.entryId);return{authorId:g.authorId,author:U(g.authorId,M,T.faces),state:g.state,since:g.since,doing:st(g.activity),replyingTo:_===null||Z===null?null:{entryId:g.entryId,excerpt:_,rowId:Z},sessionId:$.get(g.authorId)??null}}),h=z.map(g=>({authorId:g.authorId,author:U(g.authorId,M,T.faces),state:"held",since:g.since,doing:null,replyingTo:null,sessionId:null,behind:g.behind,othersWaiting:g.othersWaiting}));return[...a,...h]},[x,z,M,T.faces,B,n,$]),b=s.useMemo(()=>{if(x.length===0)return null;const a=x.slice(0,se);return t.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[a.map(h=>t.jsx(_t,{author:U(h.authorId,M,T.faces),className:"ring-background size-4 ring-2"},h.authorId)),x.length>se&&t.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${x.length-se}`})]})},[x,M,T.faces]);return t.jsx(Y.LiveLane,{state:O,scope:u,onRetry:d,unavailable:i,faces:b,onPeekOpenChange:I,askCard:O.kind==="ask"?t.jsx(ot,{ask:O.ask,...D[O.ask.sessionId]?{agentName:D[O.ask.sessionId]}:{},onOpenSession:a=>{R(he({session:a}))},className:"border-l-0"}):void 0,peek:t.jsx(Y.LivePeek,{rows:m,onScrollToRow:j,onOpenSession:a=>{R(he({session:a}))},onOpenRoom:a=>{R({...rt.channels(),search:{id:a}})},onAnswerFirst:a=>{const h=p.find(g=>g.authorId===a);h!==void 0&&P(g=>new Map(g).set(a,h.entryId)),C.mutate({roomId:e.id,authorId:a})},promoted:W,onStopAll:()=>A.mutate({roomId:e.id}),stopping:A.isPending,onStopAgent:c,stoppingAgents:S})})}const Re=3e3;function on(e,o,r,u=Date.now){const y=s.useRef(null),i=s.useRef(new Map),d=s.useRef(new Map),j=y.current,R=i.current,x=d.current,p=u();for(const f of e){if(x.has(f.id))continue;if(j===null){x.set(f.id,"at-rest");continue}const v=R.get(f.authorId);x.set(f.id,v!==void 0&&p-v<Re?"handed-off":"dropped")}return s.useEffect(()=>{if(!r)return;y.current=new Set(e.map(v=>v.id));const f=u();for(const v of o)i.current.set(v,f);for(const[v,I]of i.current)f-I>Re&&i.current.delete(v);for(const v of d.current.keys())y.current.has(v)||d.current.delete(v)}),x}function an({kind:e}){return e==="thread-error"?t.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),t.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?t.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-sm"})]}):t.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function dn({room:e,rootEntryId:o,focusComposer:r,entries:u,reactionFrequents:y,streamStalled:i,streamUnavailable:d,onRetryStream:j,historyLoaded:R,historyFailed:x=!1,landOnRow:p,pushed:f,onClose:v}){const I=s.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),k=Me({room:e,threadRootId:o}),A=Ie(e.members,e.viewerAuthorId),w=ue(),S=s.useMemo(()=>new Map([...I].map(([n,m])=>[n,m.displayName])),[I]),{root:l,replies:c}=s.useMemo(()=>{let n;const m=[];for(const b of u)b.id===o?n=b:ce(b)===o&&m.push(b);return{root:n,replies:m}},[u,o]),C=l==null?void 0:l.threadReplyCount,N=C!==void 0&&C>c.length,P=!f,E=l===void 0||N?-1:(P?1:0)+c.length,T=Ne(c.length,C),M=s.useMemo(()=>new Set(c.map(n=>n.id)),[c]),L=s.useMemo(()=>({replyIds:M,inside:!0}),[M]),H=at(e.id,L),F=ke(e.id,o),D=on(c,H,R),q=s.useRef(null),z=s.useCallback(n=>{var m;(m=q.current)==null||m.scrollToRow(n)},[]),W=s.useRef(null);s.useEffect(()=>{var n;r||(n=W.current)==null||n.focus()},[o,r]);const K=n=>{n.key!=="Escape"||n.defaultPrevented||(n.stopPropagation(),v())},O=s.useMemo(()=>{const n=[];if(l===void 0){const m=x?"thread-error":R?"thread-orphan":"thread-waiting";n.push({kind:"notice",id:m,at:"",body:null})}else P&&n.push({kind:"message",id:l.id,payload:l,grouping:{position:"only"},author:U(V(l,I),I,w.faces),at:l.createdAt});for(const m of c)n.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:U(V(m,I),I,w.faces),at:m.createdAt});return n},[l,P,c,I,w.faces,x,R]),$=s.useCallback(n=>{if(n.kind==="notice")return t.jsx(an,{kind:n.id});if(n.kind!=="message")return null;const m=n.payload,b=l!==void 0&&m.id===l.id,a=c.findIndex(_=>_.id===m.id),h=t.jsx(oe,{roomId:e.id,entry:m,rowId:J(m.id),author:n.author,authorRef:I.get(m.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:y,streamStalled:i,isMember:A,grouping:{position:"only"},answers:Ae(m,a<=0?l:c[a-1],_=>(l==null?void 0:l.id)===_?l:c.find(Z=>Z.id===_)),feedPosition:{index:b?1:(l===void 0||!P?0:1)+a+1,total:E}});if(b)return t.jsxs(t.Fragment,{children:[h,t.jsx(ye,{count:T})]});const g=D.get(m.id)??"at-rest";return t.jsx("div",{className:ee(g==="dropped"&&"motion-safe:animate-thread-reply-in",g==="handed-off"&&"motion-safe:animate-reply-settle"),children:h})},[l,P,c,T,D,e.id,e.viewerAuthorId,I,S,y,i,A,E]),B=s.useCallback(n=>n.kind==="message"?J(n.id):void 0,[]);return t.jsx(Se,{known:w,children:t.jsx(Y.Root,{surface:"room",capabilities:fe,target:k.target,anchor:"rail",children:t.jsxs("section",{ref:W,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:K,className:ee("bg-card flex min-h-0 flex-col outline-none",f?"h-full w-full":"w-full border-l"),children:[f?t.jsxs("header",{className:"flex items-center gap-2 border-b px-1 py-1",children:[t.jsxs("button",{type:"button",onClick:v,"aria-label":`Back to ${G(e)}`,"data-testid":"room-thread-back",className:"focus-ring text-muted-foreground hover:text-foreground flex h-11 min-w-0 items-center gap-1 rounded px-2 text-sm",children:[t.jsx(it,{"aria-hidden":!0,className:"size-4 shrink-0"}),t.jsx("span",{className:"truncate",children:G(e)})]}),t.jsx("p",{className:"ml-auto shrink-0 pr-3 text-sm font-medium",children:"Thread"})]}):t.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[t.jsx("button",{type:"button",onClick:v,"aria-label":"Close thread",className:"focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1",children:t.jsx(dt,{"aria-hidden":!0,className:"size-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium",children:"Thread"}),t.jsx("p",{className:"text-muted-foreground truncate text-xs",children:G(e)})]})]}),f&&l!==void 0&&t.jsxs("div",{"data-testid":"room-thread-pinned-root",className:"max-h-[40%] shrink-0 overflow-y-auto border-b pt-2",children:[t.jsx(oe,{roomId:e.id,entry:l,rowId:J(l.id),author:U(V(l,I),I,w.faces),authorRef:I.get(l.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:y,streamStalled:i,isMember:A,grouping:{position:"only"}}),t.jsx(ye,{count:T})]}),t.jsx(Y.Timeline,{ref:q,conversationId:`thread-${o}`,label:`Thread in ${G(e)}`,busy:!R&&!x,rows:O,renderRow:$,domIdOf:B,...p===void 0?{}:{landOnRow:p},pending:F,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),t.jsx(Ee,{room:e,entries:u,scope:L,laneScope:"thread",stalled:f&&i===!0,unavailable:d,onRetry:f?j:void 0,onScrollToRow:z}),t.jsx(Te,{room:e,threadRootId:o,attachments:k.attachments,focusOnMount:r},o)]})})})}function ye({count:e}){return e===0?null:t.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[t.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:e===1?"1 reply":`${e} replies`}),t.jsx("span",{className:"bg-border h-px flex-1"})]})}const ln=96,un=500;function cn(e){return e.offset.x>ln||e.velocity.x>un}function fn({children:e,onClose:o}){const r=lt()===!0,u=r?{x:0}:{x:"100%"};return t.jsx(ut.div,{"data-testid":"room-thread-sheet",className:"bg-card absolute inset-0 z-10 flex flex-col shadow-xl",initial:u,animate:{x:0},exit:u,transition:r?{duration:0}:{duration:.22,ease:[.32,.72,0,1]},drag:"x",dragDirectionLock:!0,dragConstraints:{left:0,right:0},dragElastic:{left:0,right:.9},dragMomentum:!1,onDragEnd:(y,i)=>{cn(i)&&o()},children:e})}const te="room-thread-split",mn=320,hn=360,pn=40,gn=50,xn=25;function ve(e,o){return o<=0?xn:Math.min(Math.round(e/o*1e3)/10,gn)}function Rn(e){const o=ve(mn,e),r=Math.round((100-ve(hn,e))*10)/10;return{minPct:o,maxPct:r,defaultPct:Math.min(Math.max(pn,o),r)}}function yn(e,o,r){if(e===null||o===null||o<=0)return r.defaultPct;const u=e/o*100;return Math.round(Math.min(Math.max(u,r.minPct),r.maxPct)*10)/10}function vn(e){try{const o=localStorage.getItem(e),r=o===null?NaN:Number(o);return Number.isFinite(r)&&r>0?r:null}catch{return null}}function bn(e,o){try{localStorage.setItem(e,String(Math.round(o)))}catch{}}const wn="react-resizable-panels:room-thread-split";function jn(){try{localStorage.removeItem(wn)}catch{}}function In(){const[e,o]=s.useState(null),[r,u]=s.useState(null);return{ref:s.useCallback(i=>{if(i===null)return;o(i);const d=()=>u(i.offsetWidth);d();const j=new ResizeObserver(d);return j.observe(i),()=>{j.disconnect(),o(null),u(null)}},[]),element:e,width:r,sizing:Rn(r??0)}}const kn=`${te}-room`,be=`${te}-thread`,we=`${te}-handle`,An=4;function Nn({room:e,thread:o,storageKey:r=ft.ROOM_THREAD_WIDTH}){const{ref:u,element:y,width:i,sizing:d}=In(),[j,R]=s.useState(()=>vn(r)),[x,p]=s.useState(null),f=s.useRef(null),v=yn(j,i,d),I=i===null||(d.maxPct-d.minPct)/100*i<An,k=o!==!1;s.useEffect(jn,[]);const A=s.useRef(!1);s.useLayoutEffect(()=>{var c;A.current&&((c=f.current)==null||c.resize(v))},[v,k]);const w=s.useRef(null),S=()=>{var P;const c=(P=f.current)==null?void 0:P.getSize(),C=w.current;if(w.current=null,c===void 0||i===null||i<=0||C===c)return;const N=Math.round(c/100*i);R(N),bn(r,N)},l=x??v;return s.useLayoutEffect(()=>{const c=y==null?void 0:y.querySelector(`[data-panel-resize-handle-id="${we}"]`);c&&(c.setAttribute("aria-controls",be),c.setAttribute("aria-valuenow",String(Math.round(l))),c.setAttribute("aria-valuemin",String(Math.round(d.minPct))),c.setAttribute("aria-valuemax",String(Math.round(d.maxPct))))}),t.jsx("div",{ref:u,className:"h-full overflow-hidden",children:t.jsxs(ct,{direction:"horizontal",id:te,onLayout:c=>{A.current=c.length>1,p(A.current?c[1]:null)},children:[t.jsx(pe,{id:kn,order:1,className:"flex",children:e}),k&&t.jsxs(t.Fragment,{children:[t.jsx(yt,{id:we,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:I,onDragging:c=>{var C;c&&(w.current=((C=f.current)==null?void 0:C.getSize())??null)},onKeyDownCapture:c=>{var C,N;I||(w.current=((C=f.current)==null?void 0:C.getSize())??null,!(c.key!=="Home"&&c.key!=="End")&&(c.preventDefault(),(N=f.current)==null||N.resize(c.key==="Home"?d.minPct:d.maxPct)))},onResizeEnd:S}),t.jsx(pe,{ref:f,id:be,order:2,defaultSize:v,minSize:d.minPct,maxSize:d.maxPct,className:"flex",children:o})]})]})})}function Fn({roomId:e,threadId:o,entrySeq:r,threadRoute:u,aboveTimeline:y,aboveComposer:i,offerJumpBackIn:d,onComposerFocusChange:j}){const R=mt(),x=vt(),p=ht(e),f=p==null?void 0:p.rootEntryId,v=Vt(),I=s.useCallback(()=>{var m;const n=(m=X.getState().open[e])==null?void 0:m.rootEntryId;X.getState().closeThread(e),n!==void 0&&v.arm(n)},[e,v]),k=s.useCallback(n=>{X.getState().openThread(e,n)},[e]),A=pt(e),w=gt(e),S=jt(e,w.isSuccess);It(e);const l=A.data,c=s.useMemo(()=>w.data??[],[w.data]),C=Me({room:l});Zt({roomId:e,route:u,urlThreadId:o,openThreadId:f,entries:c,historyLoaded:w.isSuccess});const N=s.useMemo(()=>{var n;return((n=l==null?void 0:l.members.find(m=>m.author.id===l.viewerAuthorId))==null?void 0:n.lastReadSeq)??null},[l]),P=Yt(e,N);xt(l,c);const E=s.useRef(null),T=s.useRef(void 0),M=s.useCallback(n=>{T.current=n},[]),L=s.useCallback(()=>T.current,[]);s.useLayoutEffect(()=>{T.current=void 0},[e]);const H=s.useCallback(n=>{var m;(m=E.current)==null||m.scrollToRow(n)},[]),F=qt(e),{loadOlder:D,cursor:q}=F,z=s.useCallback(()=>{const n=Ct(c,q);D().then(()=>{n!==null&&requestAnimationFrame(()=>{var m;return(m=E.current)==null?void 0:m.scrollToRow(n.domId)})})},[c,q,D]),W=Xt({roomId:e,entrySeq:r,entries:c,historyLoaded:w.isSuccess}),K=s.useMemo(()=>f===void 0?void 0:{replyIds:new Set(c.filter(m=>ce(m)===f).map(m=>m.id)),inside:!1},[c,f]);if(A.isLoading)return t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(Pe,{})});if(A.isError||!l)return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),t.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const O=p!==void 0&&t.jsx(dn,{room:l,rootEntryId:p.rootEntryId,focusComposer:p.focusComposer,entries:c,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,streamUnavailable:S.unavailable,onRetryStream:S.retry,historyLoaded:w.isSuccess,historyFailed:w.isError,...W.threadRow===void 0?{}:{landOnRow:W.threadRow},pushed:R,onClose:I},p.rootEntryId),$=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[y,t.jsx(Ut,{ref:E,roomId:l.id,roomName:G(l),viewerAuthorId:l.viewerAuthorId,entries:c,members:l.members,formerAuthors:l.formerAuthors,lastReadSeq:P,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,isLoading:w.isLoading,error:w.error,onAddAgents:()=>ge("add",l.id),openThreadId:f,onOpenThread:k,resumeRow:L,...W.roomRow===void 0?{}:{landOnRow:W.roomRow},onTopRow:M,canLoadOlder:F.canLoadOlder,isLoadingOlder:F.isLoadingOlder,onLoadOlder:z}),i,t.jsx(tn,{roomId:l.id}),t.jsx(nn,{roomId:l.id}),t.jsx(Ee,{room:l,entries:c,scope:K,laneScope:"room",stalled:S.stalled,unavailable:S.unavailable,onRetry:S.retry,onScrollToRow:H}),t.jsx(en,{room:l,hasEntries:c.length>0,onAddAgents:()=>ge("add",l.id)}),t.jsx(Te,{room:l,attachments:C.attachments,offerJumpBackIn:d,onFocusChange:j},l.id)]}),B={surface:"room",capabilities:fe,target:C.target,anchor:"rail"};return R?t.jsx(Y.Root,{...B,children:t.jsx("div",{style:{paddingBottom:x},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",inert:O!==!1,"data-testid":"room-under-thread",children:$}),t.jsx(Rt,{initial:!1,children:O!==!1&&t.jsx(fn,{onClose:I,children:O},`thread-${f}`)})]})})}):t.jsx(Y.Root,{...B,children:t.jsx(Nn,{room:$,thread:O})})}export{Fn as R,Wt as T,Pe as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{as as Ee,a1 as b,a3 as K,r as x,a4 as R,jE as F,jF as M,a2 as z,j as e,jG as Qe,i3 as we,ex as Ge,ey as Y,O as Re,Q as Ie,U as Le,B as C,hM as We,G as H,dR as Ye,ei as He,jH as Ve,jI as Je,dW as Ae,ar as te,x as de,by as Xe,J as ue,dV as me,eu as S,ev as ne,au as Ze,jJ as es,I as _,jK as ss,jL as De,jM as ts,_ as Ke,fe as ns,en as rs,eo as as,ep as is,eq as os,er as be,ef as ls,C as cs,jN as ds,jO as us,jP as ms,T as xs}from"./index-DSYz85aL.js";import{I as hs}from"./inline-code-BjkmgK0M.js";import{u as fs}from"./useMutationState-C3WVn0hu.js";import{O as ps,a as W}from"./runtime-connect-Dn0T5YWv.js";function gs(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function bt(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function St(s){var u,d;const t=b(),n=K(),[i,a]=x.useState(null),r=R({mutationFn:()=>(a(null),t.provisionRuntime(s,m=>a(m))),onSuccess:m=>{m.ok&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((u=r.data)==null?void 0:u.ok)===!1,o=r.isError?r.error.message:((d=r.data)==null?void 0:d.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Me(s){return["runtime-key-status",s]}function ys(s,t=!0){const n=b();return z({queryKey:Me(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function js(s){const t=b(),n=R({mutationFn:a=>t.checkRuntimeCredential(s,a.trim().length>0?a:null),meta:{suppressErrorToast:!0}}),i=n.data??(n.isError?{ok:!1,reason:"unexpected",message:n.error.message||"Couldn’t check the key."}:null);return{check:a=>n.mutate(a),isPending:n.isPending,result:i,checkedSavedKey:i!==null&&(n.variables??"").trim().length===0,reset:n.reset}}function vs(s){var o,c,u;const t=b(),n=K(),[i,a]=x.useState(null),r=R({mutationFn:async d=>{a("checking");const m=await t.checkRuntimeCredential(s,d);return m.ok?(a("saving"),await t.storeRuntimeCredential(s,d),{saved:!0,message:null}):{saved:!1,message:m.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Me(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:d=>{d.trim().length!==0&&r.mutate(d)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((u=r.data)==null?void 0:u.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function ks(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function Ns(s,t){var T,I,w,P;const n=b(),i=K(),{sessionId:a,accountRoot:r,onCompleted:l}=t??{},o=x.useMemo(()=>["runtime-login",s,a??"",r??""],[s,a,r]),c=R({mutationKey:o,mutationFn:()=>n.delegateRuntimeLogin(s,a===void 0&&r===void 0?void 0:{sessionId:a,accountRoot:r}),onSuccess:N=>{N.ok&&(i.invalidateQueries({queryKey:[...F]}),i.invalidateQueries({queryKey:[...M]}))}}),u=fs({filters:{mutationKey:o,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),d=u.some(N=>N.state.status==="pending"),m=u[u.length-1],h=d||m==null?void 0:m.state,g=d||m==null?void 0:m.id,p=!d&&((h==null?void 0:h.status)==="error"||((T=h==null?void 0:h.data)==null?void 0:T.ok)===!1),y=(h==null?void 0:h.status)==="error"?((I=h.error)==null?void 0:I.message)??null:((w=h==null?void 0:h.data)==null?void 0:w.error)??null,v=((P=h==null?void 0:h.data)==null?void 0:P.ok)===!0,O=x.useRef(l);return O.current=l,x.useEffect(()=>{var L;if(!v||g===void 0)return;const N=ks(i);N.has(g)||(N.add(g),(L=O.current)==null||L.call(O))},[v,g,i]),{login:()=>{d||c.mutate()},isPending:d,isSuccess:v,isError:p,errorMessage:p?y??"Couldn’t sign in. Try again.":null}}const Ce={"claude-code":{signInLabel:"Sign in",otherWayLabel:"Sign in with Claude",signInHint:"Use your Claude subscription or Anthropic account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"Anthropic API key",keyPlaceholder:"sk-ant-…",getKeyUrl:"https://console.anthropic.com/settings/keys"},codex:{signInLabel:"Sign in with ChatGPT",otherWayLabel:"Sign in with ChatGPT",signInHint:"Use your ChatGPT account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"OpenAI API key",keyPlaceholder:"sk-…",getKeyUrl:"https://platform.openai.com/api-keys"}};function bs(s){return Ce[s]??Ce["claude-code"]}function Ss({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(Qe,{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(Ge,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(Y,{className:"size-3"})]})]})}function Ct({command:s,runtimeLabel:t}){const[n,i]=x.useState(!1);return e.jsxs(Re,{open:n,onOpenChange:i,className:"mt-2",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["DorkOS installs ",t," for you."," ",e.jsx(Ie,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Le,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(hs,{children:s}),e.jsx(we,{value:s,label:`Copy command: ${s}`,className:"shrink-0"})]})]})}function Oe({onRetry:s}){return e.jsxs("div",{"data-testid":"remote-signin-notice",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Signing in needs the computer DorkOS runs on."}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s?"Sign in to DorkOS there, then press Retry.":"Sign in to DorkOS there."}),e.jsx("p",{className:"text-muted-foreground/80 mt-2 text-xs",children:"Already on that computer? Open DorkOS at localhost instead."}),s&&e.jsxs(C,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(We,{className:"size-3"}),"Retry"]})]})}function Cs({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 Os(s){const t=Ye(),{data:n}=He();return s?Ve(Je(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",Ps={title:xe,body:`Frontier models are unlocked. ${he}`},Es={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Te(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function ws(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(Xe,{mode:"wait",children:e.jsx(te.span,{className:"truncate text-xs",initial:t?!1:{opacity:0},animate:{opacity:1},exit:t?void 0:{opacity:0},transition:{duration:.2},children:s},s)})]})}function U({message:s="Connected"}){return e.jsxs("div",{role:"status",className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"connect-connected",children:[e.jsx(ue,{className:"size-3.5"}),s]})}function 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(C,{size:"sm",onClick:t,children:"Try again"})]})}function Rs({type:s,onConnected:t,asOtherWay:n=!1}){const i=bs(s),a=Ns(s),[r,l]=x.useState(!1),o=x.useRef(!1);return x.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Te(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(U,{message:"Signed in"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",variant:n?"outline":"default",className:"w-full",onClick:a.login,children:n?i.otherWayLabel:i.signInLabel}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i.signInHint})]})}),r?e.jsxs("div",{className:"space-y-3","data-testid":`login-connect-key-${s}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),e.jsx(Is,{type:s,copy:i,onConnected:t}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Back to sign in"})]}):n?e.jsx(C,{size:"sm",variant:"outline",className:"w-full",onClick:()=>l(!0),"data-testid":`login-connect-use-key-${s}`,children:"Paste a key"}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors","data-testid":`login-connect-use-key-${s}`,children:"Use an API key instead"})]})}function Is({type:s,copy:t,onConnected:n}){var p,y;const[i,a]=x.useState(""),r=vs(s),l=ys(s),o=js(s),c=x.useRef(!1),u=x.useRef(null);if(x.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Te(me(s).label)))},[r.isSuccess,n,s]),x.useEffect(()=>{var v;r.isError&&((v=u.current)==null||v.focus())},[r.isError]),r.isSuccess)return e.jsx(U,{});const d=(p=l.data)!=null&&p.key.saved?l.data.key:null,m=i.trim().length>0,h=r.isPending||o.isPending,g=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:v=>{v.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(S,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:u,value:i,disabled:h,onChange:v=>{a(v.target.value),g()},placeholder:d?`Saved key ends in ${d.last4}. Paste to replace.`:t.keyPlaceholder,autoComplete:"off",spellCheck:!1}),r.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:r.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.getKeyUrl?e.jsxs("a",{href:t.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"ghost",disabled:!m&&d===null||h,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:!m||h,children:"Save key"})]})]}),h?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((y=o.result)==null?void 0:y.ok)===!0?e.jsx(U,{message:o.checkedSavedKey?"Your saved key works":"Key works"}):o.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o.result.message}):null]})}function Ls(s){const t=b(),n=z({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference()});return n.isPending?e.jsx(de,{"aria-label":"Loading model settings"}):n.isError?e.jsx("p",{role:"alert",children:"Couldn’t load model settings. Try again."}):e.jsx(As,{saved:n.data,...s},JSON.stringify(n.data))}function As({saved:s,onConnected:t,onSave:n}){var D,J,G,X,j,$,fe,pe,ge,ye,je,ve;const i=b(),a=K(),r=x.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=x.useState(n&&l==="dorkos-credits"?"api-key":l),[u,d]=x.useState(((J=s.inference)==null?void 0:J.protocol)??"openai-chat-completions"),[m,h]=x.useState(((G=s.inference)==null?void 0:G.endpoint)??""),[g,p]=x.useState(((X=s.inference)==null?void 0:X.provider)??""),[y,v]=x.useState(((j=s.inference)==null?void 0:j.model)??""),[O,T]=x.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[I,w]=x.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[P,N]=x.useState(""),[L,E]=x.useState(null),k=z({queryKey:["doe-credits-models",u],queryFn:()=>i.getDoeCreditsModels(u),enabled:o==="dorkos-credits"}),q=o==="dorkos-credits"?(pe=k.data)==null?void 0:pe.models.find(f=>f.id===y):void 0,ee=s.hasKey&&((ge=s.inference)==null?void 0:ge.endpoint)===m&&s.inference.source==="api-key",V=R({mutationFn:async f=>{if(n)return n(f,P.trim()||null);o==="api-key"&&P.trim()?await i.storeDoeCredential(f,P.trim()):await i.setDoeInference(f),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{N("");for(const f of[["doe-inference"],F,M,Ze.all,es.status()])a.invalidateQueries({queryKey:f});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:f=>E(n&&f instanceof Error&&f.message?f.message:"Couldn’t save model settings. Try again.")});function re(f){var ke,Ne;if(f.preventDefault(),E(null),P.trim().startsWith("sk-ant-oat")){E("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!P.trim()&&!ee){E("Enter an API key.");return}if(o==="dorkos-credits"&&(!q||!((ke=k.data)!=null&&ke.endpoint))){E("Link DorkOS credits and choose an available model.");return}const ae=ss.safeParse({source:o,protocol:u,provider:o==="dorkos-credits"?"dorkos":g,endpoint:o==="dorkos-credits"?(Ne=k.data)==null?void 0:Ne.endpoint:m,model:y,contextWindow:(q==null?void 0:q.contextWindow)??Number(O),maxOutputTokens:(q==null?void 0:q.maxOutputTokens)??Number(I)});if(!ae.success){E("Check the model, endpoint, and token limits.");return}V.mutate(ae.data)}const Q="bg-background border-input focus-visible:ring-ring h-11 w-full rounded-md md:h-9 border px-3 text-sm focus-visible:ring-2";return e.jsxs("form",{onSubmit:re,className:"space-y-3","aria-label":"DorkOS model settings",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:Q,value:o,onChange:f=>{c(f.target.value),v("")},children:[e.jsx("option",{value:"api-key",children:"My API key"}),e.jsx("option",{value:"local",children:"Local model"}),!n&&e.jsx("option",{value:"dorkos-credits",children:"DorkOS credits"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:Q,value:u,onChange:f=>{d(f.target.value),o==="dorkos-credits"&&v("")},children:[e.jsx("option",{value:"openai-chat-completions",children:"OpenAI Chat Completions"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"})]})]}),o==="dorkos-credits"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:Q,value:y,onChange:f=>v(f.target.value),disabled:k.isPending||!((ye=k.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=k.data)==null?void 0:je.models.map(f=>e.jsx("option",{value:f.id,children:f.displayName},f.id))]}),!((ve=k.data)!=null&&ve.endpoint)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link DorkOS credits in Settings to choose a model."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(_,{id:`${r}-service`,value:g,onChange:f=>p(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(_,{id:`${r}-endpoint`,type:"url",value:m,onChange:f=>h(f.target.value),required:!0}),o==="local"&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Use a loopback address. No API key is needed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(_,{id:`${r}-model`,value:y,onChange:f=>v(f.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(_,{id:`${r}-context`,type:"number",min:1,value:O,onChange:f=>T(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(_,{id:`${r}-output`,type:"number",min:1,value:I,onChange:f=>w(f.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:P,onChange:f=>N(f.target.value),autoComplete:"off"}),ee&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"API key saved. Leave blank to keep it."})]})]}),L&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:L}),e.jsx(C,{type:"submit",disabled:V.isPending,children:V.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ds={openai:"OpenAI",anthropic:"Anthropic"};function Ks(s){return Ds[s]??s}function Ms(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ks(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function Ts(s){const t=b();return z({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function qs(){const s=b(),t=K(),n=R({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]})}});return{connect:i=>n.mutate(i),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,errorMessage:n.isError?n.error.message??"Couldn’t connect to Ollama.":null}}const $e=["runtime-connect","opencode","direct"];function Fs(){const s=b();return z({queryKey:$e,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function $s(){var i;const s=b(),t=R({mutationFn:({providerId:a,key:r,baseURL:l})=>s.checkProviderCredential(a,r.trim().length>0?r:null,(l==null?void 0:l.trim())||null),meta:{suppressErrorToast:!0}}),n=t.data??(t.isError?{ok:!1,reason:"unexpected",message:t.error.message||"Couldn’t check the key."}:null);return{check:a=>t.mutate(a),isPending:t.isPending,result:n,checkedSavedKey:n!==null&&(((i=t.variables)==null?void 0:i.key)??"").trim().length===0,reset:t.reset}}function _s(){var l,o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:async({providerId:u,key:d,baseURL:m})=>{const h=(m==null?void 0:m.trim())||null;i("checking");const g=await s.checkProviderCredential(u,d.trim().length>0?d:null,h);return g.ok?(i("saving"),await s.storeProviderCredential(u,d,h),{saved:!0,message:null}):{saved:!1,message:g.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:u=>{u.saved&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[...$e]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:u=>{u.providerId.trim().length!==0&&a.mutate(u)},isPending:a.isPending,phase:n,isSuccess:((o=a.data)==null?void 0:o.saved)===!0,isError:a.isError||r,errorMessage:r?((c=a.data)==null?void 0:c.message)??null:a.isError?a.error.message??"Couldn’t save your key.":null,reset:a.reset}}function Us(s){const t=b();return z({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function zs(){var o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:async u=>{i(null);const d=await s.pullOllamaModel(u,m=>i(m));return d.ok&&await s.updateConfig({runtimes:{opencode:{provider:qe}}}),d},onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{pull:u=>a.mutate(u),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Bs(){var o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:()=>(i(null),s.provisionOllama(u=>i(u))),onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{provision:()=>a.mutate(),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t install Ollama.":null,progress:n,result:a.data}}const Qs="https://ollama.com/download",Gs="curl -fsSL https://ollama.com/install.sh | sh";function Ws({installMethod:s}){const t=Bs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Ys,{}),n?e.jsx(Hs,{provision:t}):e.jsx(Vs,{}),e.jsx(Js,{})]})}function Ys(){const s=De();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 Hs({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(C,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Vs(){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(Ss,{command:Gs,copyLabel:"Copy the Ollama install command"})]})}function Js(){return e.jsxs("a",{href:Qs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Or download Ollama from ollama.com ",e.jsx(Y,{className:"size-3"})]})}const Xs="https://ollama.com/library",Zs={"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"}},et={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function st({active:s,onConnected:t,onConnectDirectly:n}){var I,w,P,N,L,E;const i=Ts(s),a=qs(),r=zs(),l=((I=i.data)==null?void 0:I.running)??!1,o=Us(l),[c,u]=x.useState(null),[d,m]=x.useState(null);x.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),x.useEffect(()=>{var k;(k=r.result)!=null&&k.ok&&(t==null||t(Pe))},[(w=r.result)==null?void 0:w.ok,t]);const h=k=>{u(k),a.connect(k)},g=k=>{m(k),r.pull(k)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Ws,{installMethod:(P=i.data)==null?void 0:P.installMethod});if(a.isSuccess)return t?null:e.jsx(U,{message:"Connected to Ollama"});if((N=r.result)!=null&&N.ok)return t?null:e.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"guided-pull-connected",children:[e.jsx(ue,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Connected:"}),e.jsx(ts,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const p=i.data,y=(p==null?void 0:p.installed)??[],v=((L=p==null?void 0:p.installed)==null?void 0:L.length)??(p==null?void 0:p.models.length)??0,O=((E=o.data)==null?void 0:E.models.some(k=>k.model.id===d))??!1,T=d!==null&&!O?d:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(tt,{count:v}),y.length>0&&e.jsx(nt,{installed:y,connect:a,connectingId:c,onUse:h}),e.jsx(rt,{catalogQuery:o,pull:r,pullingId:d,onGet:g}),e.jsx(at,{pull:r,activePull:T,onSubmit:g}),e.jsx(it,{}),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 tt({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=Zs[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(Ke,{size:"xs",variant:"outline",className:"font-normal",children:et[s]})}function nt({installed:s,connect:t,connectingId:n,onUse:i}){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-installed",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Installed"}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>{const r=n===a.id&&t.isPending,l=n===a.id&&t.isError,o=()=>i(a.id);let c=e.jsx(C,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(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 rt({catalogQuery:s,pull:t,pullingId:n,onGet:i}){var r;if(s.isPending)return e.jsx(A,{message:"Checking which models fit your machine…"});const a=((r=s.data)==null?void 0:r.models)??[];return s.isError||a.length===0?null:e.jsxs("div",{className:"space-y-2","data-testid":"ollama-shelf",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add a model"}),e.jsx("ul",{className:"space-y-1.5",children:a.map(({model:l,verdict:o,explanation:c})=>{const u=n===l.id,d=()=>i(l.id);return u&&(t.isPending||t.isError)?e.jsxs("li",{className:"border-border rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:l.label}),t.isPending?e.jsx(ze,{progress:t.progress}):e.jsx(B,{message:t.errorMessage??"Couldn’t download the model.",onRetry:d})]},l.id):e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:l.label}),l.tier&&e.jsx(Ue,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx(_e,{verdict:o,explanation:c})]}),e.jsx(C,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:d,children:"Get"})]},l.id)})})]})}function at({pull:s,activePull:t,onSubmit:n}){const[i,a]=x.useState(""),r=i.trim(),l=ps.test(r);if(t&&s.isPending)return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Downloading ",t,"…"]}),e.jsx(ze,{progress:s.progress})]});const o=c=>{c.preventDefault(),l&&n(r)};return e.jsxs("form",{onSubmit:o,className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"ollama-pull-tag",className:"text-xs font-normal",children:"Download any model by name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(_,{id:"ollama-pull-tag","data-testid":"ollama-pull-by-name",value:i,onChange:c=>a(c.target.value),placeholder:"qwen2.5-coder:32b","aria-invalid":r.length>0&&!l}),e.jsx(C,{type:"submit",size:"sm",disabled:!l||s.isPending,children:"Download"})]}),r.length>0&&!l&&e.jsxs("p",{className:"text-muted-foreground text-2xs",children:["Use a tag like ",e.jsx("code",{className:"text-2xs",children:"qwen2.5-coder:32b"}),"."]}),t&&s.isError&&e.jsx(B,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function it(){return e.jsxs("a",{href:Xs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Browse the library ",e.jsx(Y,{className:"size-3"})]})}function ze({progress:s}){const t=Ae(),n=s==null?void 0:s.percent,i=(s==null?void 0:s.status)??"Starting download…";return e.jsxs("div",{className:"space-y-2","data-testid":"guided-pull-progress",children:[e.jsx("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:n===void 0?e.jsx(te.div,{className:"bg-primary/70 h-full w-1/3 rounded-full",animate:t?{}:{x:["-100%","300%"]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"}}):e.jsx(te.div,{className:"bg-primary h-full rounded-full",initial:!1,animate:{width:`${Math.min(100,Math.max(0,n))}%`},transition:t?{duration:0}:{duration:.3,ease:"easeOut"},"data-testid":"guided-pull-bar"})}),e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.jsx(de,{size:"xs",className:H("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function ot(){var r,l,o;const s=b(),t=K(),n=R({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))}}),i=n.isError||((r=n.data)==null?void 0:r.ok)===!1,a=n.isError?n.error.message:((l=n.data)==null?void 0:l.error)??null;return{store:c=>{c.trim().length!==0&&n.mutate(c)},isPending:n.isPending,isSuccess:((o=n.data)==null?void 0:o.ok)===!0,isError:i,errorMessage:i?a??"Couldn’t save the OpenRouter key.":null}}function lt(){var h,g;const s=b(),t=K(),[n,i]=x.useState(null),[a,r]=x.useState(null),l=R({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:p,state:y})=>{if(!ns(p)){r("Couldn’t open the OpenRouter sign-in page.");return}i(y)},onError:p=>r(p.message??"Couldn’t start OpenRouter sign-in.")}),o=z({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="pending"?1500:!1},refetchOnWindowFocus:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="error"}}),c=(h=o.data)==null?void 0:h.status;x.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const u=l.isPending||n!==null&&c==="pending",d=!!a||c==="error",m=d?a??((g=o.data)==null?void 0:g.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:u,isSuccess:c==="connected",isError:d,errorMessage:m}}const ct="https://openrouter.ai/keys";function dt({onConnected:s}){const[t,n]=x.useState(""),i=ot(),a=lt(),r=i.isSuccess||a.isSuccess;return x.useEffect(()=>{r&&(s==null||s(Ps))},[r,s]),r?e.jsx(U,{message:"Connected to OpenRouter"}):e.jsxs("div",{className:"space-y-4","data-testid":"openrouter-gateway",children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:"Sign in to OpenRouter in the new tab…"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",className:"w-full",onClick:a.begin,children:"Connect OpenRouter"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Makes a limited key for you."})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),i.isPending?e.jsx(A,{message:"Checking your OpenRouter key…"}):e.jsxs("form",{className:"space-y-2",onSubmit:l=>{l.preventDefault(),i.store(t)},children:[e.jsx(S,{htmlFor:"openrouter-key",className:"text-xs",children:"OpenRouter key"}),e.jsx(ne,{id:"openrouter-key",value:t,onChange:l=>n(l.target.value),placeholder:"sk-or-…",autoComplete:"off",spellCheck:!1}),i.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:i.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("a",{href:ct,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an OpenRouter key ",e.jsx(Y,{className:"size-3"})]}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function Z(s){return W.find(t=>t.id===s)}function ut(s){var t;return((t=Z(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=W.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??W[0].defaultBaseURL}function Be(s){return W.some(t=>t.id===s.providerId)}function ie(s){return Be(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function mt({onConnected:s}){const t=Fs();return t.isError&&!t.data?e.jsx(B,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(xt,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function xt({setup:s,onConnected:t}){var X;const n=Be(s)?s:null,[i,a]=x.useState(()=>ie(s)),[r,l]=x.useState(""),[o,c]=x.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=Z(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[u,d]=x.useState(()=>{var $;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=Z(j))==null?void 0:$.defaultBaseURL)}),m=_s(),h=$s(),g=Z(i),p=ut(i),y=n!=null&&n.key.saved&&n.providerId===p?n.key.last4:null,v=o.trim(),O=i===se,T=!O||v.length>0,I=ce(p),w=v||I,P=w===I?"":w,N=n===null?null:n.baseURL??ce(n.providerId),L=p!==((n==null?void 0:n.providerId)??null)||w!==N,E=r.trim().length>0,q=(E||y!==null&&!L)&&T,ee=E&&T,V=!E&&y!==null&&L,re=w.startsWith("http://"),Q={providerId:p,key:r,baseURL:P},D=m.isPending||h.isPending,J=x.useRef(null),G=()=>{h.reset(),m.reset()};return x.useEffect(()=>{m.isSuccess&&(t==null||t(Es))},[m.isSuccess,t]),x.useEffect(()=>{var j;m.isError&&((j=J.current)==null||j.focus())},[m.isError]),m.isSuccess?e.jsx(U,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),h.reset(),m.connect(Q)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(rs,{value:i,disabled:D,onValueChange:j=>{var $;a(j),c((($=Z(j))==null?void 0:$.defaultBaseURL)??""),G()},children:[e.jsx(as,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(is,{})}),e.jsxs(os,{children:[W.map(j=>e.jsx(be,{value:j.id,children:j.label},j.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(O||u)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(S,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!O&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(_,{id:"direct-provider-base-url",value:o,disabled:D,onChange:j=>{c(j.target.value),G()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!O&&!u&&e.jsx("button",{type:"button",onClick:()=>d(!0),disabled: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(S,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:J,value:r,disabled:D,onChange:j=>{l(j.target.value),G()},placeholder:y===null?(g==null?void 0:g.keyPlaceholder)??W[0].keyPlaceholder:`Saved key ends in ${y}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),m.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:m.errorMessage}),V&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-repaste",children:"Paste your key again to change the address."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g===void 0?e.jsx("span",{}):e.jsxs("a",{href:g.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"outline",disabled:!q||D,"data-testid":"direct-provider-test",onClick:()=>{m.reset(),h.reset(),h.check(Q)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",disabled:!ee||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:m.phase==="saving"?"Saving…":"Checking your key…"}):((X=h.result)==null?void 0:X.ok)===!0?e.jsx(U,{message:h.checkedSavedKey?"Your saved key works":"Key works"}):h.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:h.result.message}):null]})}function ht({currentProvider:s,onConnected:t}){const[n,i]=x.useState("choose"),a=ft();if(n==="choose")return e.jsx(pt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(dt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(st,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(mt,{onConnected:t})})}function ft(){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 ${De()}. 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 pt({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: ",Ms(n)]}),Object.values(s).map(i=>e.jsx(gt,{source:i,onChoose:t},i.step))]})}function gt({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(Ke,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(cs,{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(ls,{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 yt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=gs(),r=Os(s),l=ds(),o=us(),c=ms([s]);if(s==="doe")return a?e.jsx(Ls,{onConnected:i}):e.jsx(Oe,{});const u=r==="lead"&&l!==null,d=a?t.kind==="provider-picker"?e.jsx(ht,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Rs,{type:s,onConnected:i,asOtherWay:u}):null:e.jsx(Oe,{});if(d===null)return null;const m=me(s).label,h=t.kind==="provider-picker";if(r==="on-credits")return e.jsxs("div",{className:"space-y-3","data-testid":`credits-ready-${s}`,children:[e.jsxs("div",{role:"status",children:[e.jsxs("p",{className:"text-status-success-fg flex items-center gap-1.5 text-sm font-medium",children:[e.jsx(ue,{className:"size-3.5","aria-hidden":!0}),"You’re ready"]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["New work on ",m," runs on your DorkOS credits.",c.map(p=>` ${p}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:d})]});const g=p=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:p,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(ws(m))}});return u?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[g(!0),e.jsx(le,{children:d}),e.jsx(Cs,{ollama:h,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[d,e.jsx(le,{children:g(!1)})]}):d}function le({collapsed:s=!1,children:t}){const[n,i]=x.useState(!s);return s?e.jsxs(Re,{open:n,onOpenChange:i,children:[e.jsxs(Ie,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(xs,{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 Ot=s=>e.jsx(yt,{...s});export{Ct as C,Ss as D,Cs as K,Oe as R,gs as a,bt as b,Os as c,Ms as d,Ns as e,Ls as f,bs as g,Ot as r,St as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,bq as K,dJ as $,dK as Y,j as e,dL as W,dM as G,bp as Q,bn as C,bm as I,dN as J,bo as V,dO as X,dP as Z,dQ as q,bv as ee,dR as te,dS as ne,dT as M,cT as se,cU as re,cW as ae,cX as oe,cY as ie,dU as ce,dV as D,J as E,B as S,dW as z,dX as le,G as k,O as de,Q as ue,T as fe,U as me,dY as xe,aK as pe,a9 as ve,bM as he,ar as U,x as ge,by as Ce}from"./index-DSYz85aL.js";import{I as be}from"./inline-code-BjkmgK0M.js";import{l as je}from"./list-runtime-types-DvfLx6v2.js";import{D as O,u as Re,C as Ne}from"./RuntimeConnectFlow-BsZsQZS9.js";var Pe=Object.defineProperty,b=(t,n)=>Pe(t,"name",{value:n,configurable:!0}),H,_="HoverCard",[A,Xe]=K(_,[$]),L=$(),[Se,w]=A(_),Te=b(t=>{const{__scopeHoverCard:n,children:r,open:a,defaultOpen:s,onOpenChange:c,openDelay:o=700,closeDelay:m=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,f]=Y({prop:a,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>f(!0),o)},[o,f]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>f(!1),m))},[m,f]),h=l.useCallback(()=>f(!1),[f]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(Se,{scope:n,open:u,onOpenChange:f,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(W,{...x,children:r})})},"HoverCard"),we="HoverCardTrigger",He=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,...s}=n,c=w(we,a),o=L(a);return e.jsx(G,{asChild:!0,...o,children:e.jsx(Q.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,T(c.onOpen)),onPointerLeave:C(n.onPointerLeave,T(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,m=>m.preventDefault())})})},"HoverCardTrigger")),F="HoverCardPortal",[ye,De]=A(F,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:a,container:s}=t,c=w(F,n);return e.jsx(ye,{scope:n,forceMount:r,children:e.jsx(I,{present:r||c.open,children:e.jsx(J,{asChild:!0,container:s,children:a})})})},"HoverCardPortal"),y="HoverCardContent",ke=l.forwardRef(b(function(n,r){const a=De(y,n.__scopeHoverCard),{forceMount:s=a.forceMount,...c}=n,o=w(y,n.__scopeHoverCard);return e.jsx(I,{present:s||o.open,children:e.jsx(Oe,{"data-state":o.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,T(o.onOpen)),onPointerLeave:C(n.onPointerLeave,T(o.onClose)),ref:r})})},"HoverCardContent")),Oe=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:o,onInteractOutside:m,...x}=n,i=w(y,a),p=L(a),v=l.useRef(null),g=V(r,v),[u,f]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return H=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=H,d.style.webkitUserSelect=H}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{f(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&B(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(X,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:m,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(o,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(Z,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&f(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function T(t){return n=>n.pointerType==="touch"?void 0:t()}b(T,"excludeTouch");function B(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(a=>a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(B,"getTabbableNodes");var _e=Te,Le=He,Ue=Ee,$e=ke;function Ze({...t}){return e.jsx(_e,{"data-slot":"hover-card",...t})}function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card-trigger",...t})}function et({className:t,align:n="center",sideOffset:r=4,...a}){const s=q();return e.jsx(Ue,{"data-slot":"hover-card-portal",container:s,children:e.jsx($e,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:ee("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-dui-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden motion-reduce:animate-none!",t),...a})})}function Ie(t,n,r){return t?[t]:n||je(r)}function Me({runtime:t,types:n,requirements:r,registeredTypes:a=[],onRecheck:s,isRechecking:c=!1,renderConnect:o}){const m=z(),x=Ie(t,n,a);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Ae,{type:i,requirements:r,registered:a.includes(i),renderConnect:o},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(le,{className:k("size-3.5",c&&!m&&"animate-spin")}),"Check again"]})]})]})}function ze(t,n,r){return r?xe(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:pe.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${ve(t)}`}}:null:null}function Ae({type:t,requirements:n,registered:r,renderConnect:a}){var R,N;const s=D(t),c=s.icon,o=n==null?void 0:n.runtimes[t],m=M(n,t,r),x=m.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?ze(t,o==null?void 0:o.provider,!!a):null,f=o==null?void 0:o.dependencies.find(P=>P.status!=="satisfied"&&P.installHint),d=(f==null?void 0:f.installHint)??((R=s.setup)==null?void 0:R.installCommand),j=(f==null?void 0:f.infoUrl)??((N=s.setup)==null?void 0:N.infoUrl),h=!!o||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(E,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[a==null?void 0:a({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),!x&&m.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Fe,{type:t,connect:m.connect,renderConnect:a,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(de,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(ue,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(fe,{className:k("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(me,{className:"mt-3 space-y-3",children:o?o.dependencies.map(P=>e.jsx(Ye,{dep:P},P.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(be,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Fe({type:t,connect:n,renderConnect:r,installCommand:a,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Be,{type:t,label:n.label,installCommand:a,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Be({type:t,label:n,installCommand:r,installInfoUrl:a}){const s=D(t),{provision:c,isPending:o,isError:m,errorMessage:x,progress:i,result:p}=Re(t);return o||p!=null&&p.ok?e.jsx(Ke,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):m?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:a,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(Ne,{command:r,runtimeLabel:s.label})]})}function Ke({message:t}){const n=z();return e.jsxs(U.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(ge,{size:"xs",className:k("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(Ce,{mode:"wait",children:e.jsx(U.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ye({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(E,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(he,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function tt({runtime:t,open:n,onOpenChange:r,renderConnect:a,onRuntimeReady:s,showConnectSuccess:c=!1}){const o=te(),{data:m}=ne(),x=t?D(t):null,i=M(o.data,t??"",m?t!==void 0&&t in m.capabilities:!0),p=o.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,f]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&f(null),d.current=n},[n]);const j=a&&(c?h=>a({...h,onConnected:R=>{var N;(N=h.onConnected)==null||N.call(h,R),f(R)}}):a);return e.jsx(se,{open:n,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(ae,{children:[e.jsx(oe,{children:x?x.label:"Your runtimes"}),e.jsx(ie,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(ce,{children:u?e.jsx(We,{success:u,onDone:()=>r(!1)}):e.jsx(Me,{runtime:t,requirements:o.data,registeredTypes:m?Object.keys(m.capabilities):void 0,onRecheck:()=>void o.refetch(),isRechecking:o.isFetching,renderConnect:j})})]})})}function We({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(E,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{Ze as H,tt as R,qe as a,et as b,Me as c};
|