dorkos 0.120.0 → 0.121.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 +118 -22
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-Y8O56Cz5.js → AboutPage-CtI8gbER.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-DlROxqde.js → ActivityErrorState-CHTXfBS7.js} +1 -1
- package/dist/client/assets/{ActivityPage-BdV90CV2.js → ActivityPage-B8p4yYJL.js} +1 -1
- package/dist/client/assets/{ActivityRow-B5yiD_uD.js → ActivityRow-CSuSz-92.js} +1 -1
- package/dist/client/assets/{AdapterIcon-Dyq92Eup.js → AdapterIcon-Qnxn0cE5.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-D9tqz7Hl.js → AdapterSetupWizard-BG8H-Lld.js} +1 -1
- package/dist/client/assets/{AgentOptionRow-BeRqDo7c.js → AgentOptionRow-BWFQFynn.js} +1 -1
- package/dist/client/assets/{AgentPicker-BRyYVJZu.js → AgentPicker-CL93SET3.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-xX6fAKgO.js → AgentRequestCard-CamX7Tvr.js} +4 -4
- package/dist/client/assets/{AppearancePage-DKF9BqRt.js → AppearancePage-rN70_7ih.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-CPvtr_-f.js → ApplyToOverridesDialog-DeWaXbgm.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-vBfioH1A.js → AttentionSignalRow-CKcSWExi.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-B50zNtwB.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BwYaLf2P.js} +1 -1
- package/dist/client/assets/{BindingDialog-CSNjws3F.js → BindingDialog-DqPDLYbF.js} +1 -1
- package/dist/client/assets/BlintzCanvas-DoAZs5bz.js +1231 -0
- package/dist/client/assets/{BlintzCanvas-GgiCXV7C.css → BlintzCanvas-xZ3u3nk7.css} +1 -1
- package/dist/client/assets/{CanvasCsvContent-0Mb7uOuA.js → CanvasCsvContent-ViqRJuhW.js} +1 -1
- package/dist/client/assets/CanvasFileContent-ClcHZ_l-.js +2 -0
- package/dist/client/assets/{CanvasModel3dContent-UokbHY9i.js → CanvasModel3dContent-Cm3msNdQ.js} +2 -2
- package/dist/client/assets/{ChatAppsOff-CLRB0YU5.js → ChatAppsOff-D0PbHYqF.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-B4uFJD6g.js → CodeMirrorDiff-DFNSXeuV.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-rYOrBAZc.js → CodeMirrorEditor-AgkgsSqN.js} +1 -1
- package/dist/client/assets/{CommitmentList-i-IZ4gbr.js → CommitmentList-0V6QivXH.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-ChO1JkrE.js → CommitmentsPage-i3XoHwBj.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-pLuD2ie6.js → ComputerResourceView-RPoBc-km.js} +1 -1
- package/dist/client/assets/{ComputerViewer-D7tPmpY5.js → ComputerViewer-2ugaCd0H.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-D6VH1vX3.js → ConnectionAccessLists-DaPP4U96.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-7x5olD9q.js → ConnectionsPage-BVqYvfk5.js} +2 -2
- package/dist/client/assets/{ConventionPage-BTYLWw6p.js → ConventionPage-BoqncrFd.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-A9AdBBbw.js → ExtensionPageRoute-BrOEeNX3.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-ayv0yz1C.js → FloatingTanStackRouterDevtools-CqogiFob-DLwix3K7.js} +1 -1
- package/dist/client/assets/HandlePage-B_5GLHsp.js +1 -0
- package/dist/client/assets/{HeartbeatPage-Dh6W9Qg5.js → HeartbeatPage-DgXhbaBJ.js} +1 -1
- package/dist/client/assets/{KeyEntry-owhPGtw3.js → KeyEntry-CRr32Ae5.js} +1 -1
- package/dist/client/assets/{LexicalField-B1NFMLD6.js → LexicalField-DeAoA6yr.js} +1 -1
- package/dist/client/assets/{ManagesPage-BAnBmBdo.js → ManagesPage-ZBWYLTZx.js} +1 -1
- package/dist/client/assets/{Marketplace-67maxdwz.js → Marketplace-iL5p8Omt.js} +4 -4
- package/dist/client/assets/{MarketplaceSourcesView-CzPBNJJj.js → MarketplaceSourcesView-CsNLVOdP.js} +1 -1
- package/dist/client/assets/{McpAppFrame-CuObpQTg.js → McpAppFrame-B1WPswgk.js} +1 -1
- package/dist/client/assets/{McpSigninBody-B-ayj6bQ.js → McpSigninBody-CJ28yu0o.js} +1 -1
- package/dist/client/assets/{Model3dViewer-DRVqxazk.js → Model3dViewer-BIZWdK8g.js} +1 -1
- package/dist/client/assets/NamePage-0nr288eM.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-B3DxayR2.js → NewDirectMessageMenu-DRx9e9kM.js} +1 -1
- package/dist/client/assets/{NotificationsPage-BavEo7VZ.js → NotificationsPage-cfqgSuVy.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BwkX2Toa.js → OpenMeshSwitch-BIIuKDku.js} +1 -1
- package/dist/client/assets/{OperatorIdentityForm-CtWgz2yi.js → OperatorIdentityForm-BKUSGrs6.js} +1 -1
- package/dist/client/assets/{PermissionHistory-DvM0F2bS.js → PermissionHistory-Ctdqhib6.js} +1 -1
- package/dist/client/assets/{PermissionsPage-D1DJHezV.js → PermissionsPage-CYA_zdrV.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BV-9wfIl.js → PersonalityPopover-BR4Cpr2C.js} +1 -1
- package/dist/client/assets/PhotoPage-C3Ir3wlA.js +1 -0
- package/dist/client/assets/{PresetPicker-BOQKgYAK.js → PresetPicker-zGvDOqTf.js} +2 -2
- package/dist/client/assets/{PreviewRefusedNotice-BdhUln2h.js → PreviewRefusedNotice-D1Tl265t.js} +1 -1
- package/dist/client/assets/{ProfileFields-DFRnRR38.js → ProfileFields-T3vVbHRC.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-CkxX9Dps.js → ProfilePanelContainer-CParzTPA.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-BSYi_luB.js → ProfileRolePicker-BU4eiMKn.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-r08GqBH1.js → PromptSuggestionChips-CGNQc2Tf.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-BcsM5Eia.js → ReportsToPopover-Dj5U_Ppi.js} +1 -1
- package/dist/client/assets/{RoomSurface-DaRCf4og.js → RoomSurface-BIyjtxKD.js} +7 -7
- package/dist/client/assets/{RoomsPage-CQqsdVvB.js → RoomsPage-Cvs3h6f0.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-DFb4xEhP.js → RunsOnPopover-BUlYwRW4.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow-pKFJlNSJ.js → RuntimeConnectFlow-ChrvjC84.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-DvBJbrmj.js → RuntimeSetupDialog-BK9yo7YF.js} +1 -1
- package/dist/client/assets/{SessionsPage-CGgnEPh7.js → SessionsPage-CWUwU3US.js} +1 -1
- package/dist/client/assets/{SettingsDialog-D0cmzjrH.js → SettingsDialog-BApzy0J8.js} +3 -3
- package/dist/client/assets/{SkillsPage-DDoPlsn2.js → SkillsPage-z3XnApNX.js} +1 -1
- package/dist/client/assets/{TaskDialogWrapper-DoIVzbKU.js → TaskDialogWrapper-BEWUpAlk.js} +1 -1
- package/dist/client/assets/{TasksEmptyState-B68O6dnT.js → TasksEmptyState-CLwpLnIO.js} +2 -2
- package/dist/client/assets/{TasksPage-BsBDphim.js → TasksPage-CyHjr9OZ.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CoQ4EsDm.js → TeamComputerEntry-BHHIofx3.js} +1 -1
- package/dist/client/assets/{ToolsPage-Cl1aOpev.js → ToolsPage-CckCco8x.js} +1 -1
- package/dist/client/assets/TopologyGraph-Dox7aWP3.js +30 -0
- package/dist/client/assets/{TourHost-4O6TJzc-.js → TourHost-CTBewD-a.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-DIMY60Fi.js → UnlinkDialog-CFRgExId.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-CzWw_SPD.js → WidgetErrorCard-Dx5oPMlF.js} +23 -23
- package/dist/client/assets/_commonjs-dynamic-modules-TDtrdbi3.js +1 -0
- package/dist/client/assets/{_shell-BRH2Y-U-.js → _shell-BHUZq_8C.js} +1 -1
- package/dist/client/assets/{_shell._home-DG3Vw7S5.js → _shell._home-DnBkgWs4.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-COI96oAO.js → _shell._home.activity-CVCC-EEI.js} +1 -1
- package/dist/client/assets/{_shell._home.index-CTwsTjcQ.js → _shell._home.index-Ck6jxwIx.js} +1 -1
- package/dist/client/assets/{_shell._home.tasks-DOVoPYaf.js → _shell._home.tasks-B7QQAZnA.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-ApZhnjwy.js → _shell._home.workspaces-DlrRd9tv.js} +1 -1
- package/dist/client/assets/{_shell.channels-CRkJHU5R.js → _shell.channels-CiWehoyl.js} +4 -4
- package/dist/client/assets/{_shell.connections-bhAK3jnE.js → _shell.connections-CGP5hZHq.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-k43R8-rW.js → _shell.feedback-requests-BxxNvw6j.js} +1 -1
- package/dist/client/assets/_shell.marketplace-BoAmyvPt.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-BpqWjkGL.js +1 -0
- package/dist/client/assets/{_shell.session-D871zZl3.js → _shell.session-KyPj3OxK.js} +17 -17
- package/dist/client/assets/{_shell.team-DHCM1QoO.js → _shell.team-CsXH3NkS.js} +4 -4
- package/dist/client/assets/_shell.x._extensionId-CfiAgtoq.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-CfiAgtoq.js +1 -0
- package/dist/client/assets/abnfDiagram-WEYOIA3C-CMdkyiQ3.js +1 -0
- package/dist/client/assets/{access-copy-BVzi1REx.js → access-copy-CW-z1oMH.js} +1 -1
- package/dist/client/assets/arc-Bw7tftQk.js +1 -0
- package/dist/client/assets/architectureDiagram-ZHVYKT53-BhpXALtX.js +36 -0
- package/dist/client/assets/{banner-3xXXsU5J.js → banner-EomQNDOH.js} +1 -1
- package/dist/client/assets/blockDiagram-RJAE7QA3-Bxk_BuZv.js +140 -0
- package/dist/client/assets/c4Diagram-XDPPPE54-CYN0FwR8.js +38 -0
- package/dist/client/assets/{card-Bt6IU-Bh.js → card-ww4ebz8h.js} +1 -1
- package/dist/client/assets/channel-DZpRF3QJ.js +1 -0
- package/dist/client/assets/chunk-2E7WHVMD-IPDvYcPa.js +88 -0
- package/dist/client/assets/chunk-2Q5K7J3B-DZ5bU5Ax.js +1 -0
- package/dist/client/assets/chunk-4EMNKR2T-DrsWxa6Y.js +1 -0
- package/dist/client/assets/chunk-55XCU76K-CiBbKG0b.js +1 -0
- package/dist/client/assets/chunk-5VM5RSS4-B3K3MUav.js +15 -0
- package/dist/client/assets/chunk-JWPE2WC7-CjV5RcIh.js +1 -0
- package/dist/client/assets/chunk-VQ5W62QI-CWoRr0H2.js +1 -0
- package/dist/client/assets/chunk-XXDRQBXY-E0nvzXiG.js +1 -0
- package/dist/client/assets/chunk-ZCHMQSOR-DFop6Lvt.js +2 -0
- package/dist/client/assets/classDiagram-v2-4MYWR3UA-B7JJfc9z.js +217 -0
- package/dist/client/assets/{command-CWokzKS1.js → command-D4fLpJxA.js} +1 -1
- package/dist/client/assets/cose-bilkent-JH36ORCC-BjNppl29.js +1 -0
- package/dist/client/assets/{cpu-BzByzE9V.js → cpu-DCe0Yyml.js} +1 -1
- package/dist/client/assets/cynefin-EF2NZ3EQ-PmRntJwW.js +141 -0
- package/dist/client/assets/cynefinDiagram-WF24UDRP-Ctdbp_Vg.js +62 -0
- package/dist/client/assets/cytoscape.esm-BLAcgzS2.js +331 -0
- package/dist/client/assets/dagre-NK4GIZVX-5tvLY2ZW.js +4 -0
- package/dist/client/assets/defaultLocale-DX6XiGOO.js +1 -0
- package/dist/client/assets/diagram-CBK3MWTC-DZO-XBOO.js +24 -0
- package/dist/client/assets/diagram-I5XIIV2D-CWBbA1Pv.js +24 -0
- package/dist/client/assets/diagram-ODIL2UCW-hP5A1tGl.js +30 -0
- package/dist/client/assets/diagram-PFBEJUXE-EI_-RoN7.js +3 -0
- package/dist/client/assets/diagram-RJA3I4VV-TrYq9A4Z.js +41 -0
- package/dist/client/assets/diagram-TYUNFSNR-BAQq2OM5.js +200 -0
- package/dist/client/assets/ebnfDiagram-V4P3TTPT-cKbeW9dQ.js +1 -0
- package/dist/client/assets/elk-QONTBCTQ-wpfNPp0q.js +27 -0
- package/dist/client/assets/{empty-state-BgnQDiMZ.js → empty-state-DXWQsHMf.js} +1 -1
- package/dist/client/assets/erDiagram-KYQIGQAA-Dk0OrvjE.js +99 -0
- package/dist/client/assets/{execution-config-D5-SEt2t.js → execution-config-CAyT2Qoo.js} +1 -1
- package/dist/client/assets/{file-VHDTQub2.js → file-Bf7D_47y.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DbWvGys0.js → file-exclamation-point-DZXE9_8o.js} +1 -1
- package/dist/client/assets/{file-text-BAhi2zct.js → file-text-C1ougnBY.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-Z0HPVqeK.js → find-latest-widget-fence-B1_-pC-Z.js} +1 -1
- package/dist/client/assets/flowDiagram-IUGLLWBU-CdlOoRZV.js +213 -0
- package/dist/client/assets/{form-Blrb1xBU.js → form-D7kF-U0d.js} +1 -1
- package/dist/client/assets/{format-cron-lKWqEmle.js → format-cron-ZtliseYi.js} +1 -1
- package/dist/client/assets/ganttDiagram-R7GPNTJY-x0MJLv5d.js +292 -0
- package/dist/client/assets/{git-branch-BObm8Rlz.js → git-branch-B2k77X3Q.js} +1 -1
- package/dist/client/assets/gitGraphDiagram-PDYL7XHY-CruCvk7w.js +106 -0
- package/dist/client/assets/graph-5PBe05F8.js +1 -0
- package/dist/client/assets/{heart-Du7nuefC.js → heart-CmqGJPDc.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-B_GO7V1P.js → highlighted-body-KPVGNVTW-Bqu2cQDj.js} +1 -1
- package/dist/client/assets/{image-lightbox-BZ1TV3mN.js → image-lightbox-BBbz-ThL.js} +1 -1
- package/dist/client/assets/{image-off-hnjcBIzN.js → image-off-BCtWIY4q.js} +1 -1
- package/dist/client/assets/{index-Ch-ON5gw.js → index-1ShgR_xt.js} +1 -1
- package/dist/client/assets/{index-DoMJUxt_.js → index-8IAr9b71.js} +1 -1
- package/dist/client/assets/{index-EZHlD3gf.js → index-8TfzCkKR.js} +1 -1
- package/dist/client/assets/{index-B0tAedq7.js → index-B5rRtvWx.js} +1 -1
- package/dist/client/assets/index-B6dEbNhI.js +1 -0
- package/dist/client/assets/{index-WxtASL5_.js → index-BCk4wW-T.js} +1 -1
- package/dist/client/assets/{index-Ci74HAFs.js → index-BIIH5CXj.js} +1 -1
- package/dist/client/assets/{index-CiQxS4Bn.js → index-BXMxoWrk.js} +1 -1
- package/dist/client/assets/index-BXZlDqvy.js +74 -0
- package/dist/client/assets/{index-Bm0z9mHt.js → index-BfRW2WTx.js} +1 -1
- package/dist/client/assets/{index-CCg7yRe1.js → index-BpmmNapD.js} +1 -1
- package/dist/client/assets/{index-r_O6CmXY.js → index-BrQGZ6iF.js} +1 -1
- package/dist/client/assets/{index-Df7a-2P5.js → index-BuGQxHrf.js} +1 -1
- package/dist/client/assets/{index-BP68J4pb.js → index-BzPgsdPn.js} +1 -1
- package/dist/client/assets/{index-CqoIjNC2.js → index-C11Ssk2u.js} +2 -2
- package/dist/client/assets/{index-BnNTKsbt.js → index-CJ5v2_Cz.js} +1 -1
- package/dist/client/assets/{index-4PAAWURd.js → index-CMNc_OrC.js} +1 -1
- package/dist/client/assets/{index-BvjuGXcS.js → index-CQ0VLZf-.js} +1 -1
- package/dist/client/assets/{index-BaRQVgiN.js → index-ChwNEkM8.js} +1 -1
- package/dist/client/assets/index-Cl8trmnL.js +1 -0
- package/dist/client/assets/{index-1I8qHZDt.js → index-ClBIPuLA.js} +1 -1
- package/dist/client/assets/{index-D6y4WeTi.js → index-Cml5572f.js} +1 -1
- package/dist/client/assets/{index-DHYvT3nr.js → index-Cp3yShS8.js} +6 -6
- package/dist/client/assets/{index-DB8TDRSm.js → index-CtycM8wY.js} +1 -1
- package/dist/client/assets/{index-aXm0xP_2.js → index-Cv0GsC4n.js} +1 -1
- package/dist/client/assets/{index-ox3ce99A.js → index-DAdo_yIq.js} +1 -1
- package/dist/client/assets/{index-HxT_wkaZ.js → index-DIxzqCwG.js} +1 -1
- package/dist/client/assets/{index-Cdyszxoa.js → index-DKDK-3KH.js} +5 -5
- package/dist/client/assets/index-DPNBHwcQ.js +1 -0
- package/dist/client/assets/{index-BgzgdvDn.js → index-DbDI5BAA.js} +1 -1
- package/dist/client/assets/{index-Dc5cpBoO.js → index-DcZPWi_I.js} +248 -248
- package/dist/client/assets/{index-CBm3whA-.js → index-Dmn03xST.js} +1 -1
- package/dist/client/assets/{index-BeVbHOwX.js → index-Do6eeFps.js} +2 -2
- package/dist/client/assets/{index-BtbZpz4b.js → index-DrA03bMq.js} +1 -1
- package/dist/client/assets/{index-D5TZCu8j.js → index-DsJWzmWw.js} +1 -1
- package/dist/client/assets/{index-DRea_Gi0.js → index-EdJm7ZN-.js} +1 -1
- package/dist/client/assets/{index-CQCN6kWR.js → index-JxeBJIuE.js} +1 -1
- package/dist/client/assets/{index-BUOcbPfv.js → index-mFOJXyAE.js} +3 -3
- package/dist/client/assets/{index-BVKXIbLh.js → index-rWZWP3Wh.js} +1 -1
- package/dist/client/assets/{index-DkhM0fDi.js → index-t4Ud6YTX.js} +1 -1
- package/dist/client/assets/{index-Lh82Rz5C.js → index-xaMF1mrN.js} +1 -1
- package/dist/client/assets/{index-C60RrnTd.js → index-xmk9Ohv9.js} +1 -1
- package/dist/client/assets/{index-4GC2fkeO.js → index-yI1r4pSP.js} +1 -1
- package/dist/client/assets/{index.esm-DXsF3Bua.js → index.esm-CZZtbPRj.js} +1 -1
- package/dist/client/assets/infoDiagram-MVDRKAX5-Bj9DD77n.js +2 -0
- package/dist/client/assets/init-Gi6I4Gst.js +1 -0
- package/dist/client/assets/{inline-code-DAEoWvTf.js → inline-code-g9PVHZI2.js} +1 -1
- package/dist/client/assets/ishikawaDiagram-HPEHV2GE-DckI6dhS.js +70 -0
- package/dist/client/assets/journeyDiagram-BOSHW7O7-Ce1GAVa0.js +139 -0
- package/dist/client/assets/kanban-definition-FNSA4HC5-Kq5O9rZa.js +89 -0
- package/dist/client/assets/katex-DLorvT8M.js +257 -0
- package/dist/client/assets/{layers-CsM34LRv.js → layers-D3lEdRF0.js} +1 -1
- package/dist/client/assets/{lightbulb-B8JAixK_.js → lightbulb-BFE-KkFU.js} +1 -1
- package/dist/client/assets/linear-BT-xgETh.js +1 -0
- package/dist/client/assets/{link-2-Csc6okl3.js → link-2-Dvb6g-2Q.js} +1 -1
- package/dist/client/assets/{list-runtime-types-DQrZNB7x.js → list-runtime-types-8YGEK3Al.js} +1 -1
- package/dist/client/assets/{markdown-content-DPc7aD1j.js → markdown-content-Cqq_QMXA.js} +1 -1
- package/dist/client/assets/{mention-pill-8P_w4muj.js → mention-pill-Bnzt4u2l.js} +1 -1
- package/dist/client/assets/mermaid.core-dpp59v7L.js +312 -0
- package/dist/client/assets/{message-square-off-D5DXu2cY.js → message-square-off-BX2XnEDx.js} +1 -1
- package/dist/client/assets/mindmap-definition-6OY57UG3-CFdfJO6g.js +98 -0
- package/dist/client/assets/{more-details-DEeu2M-p.js → more-details-B4lBMpKi.js} +1 -1
- package/dist/client/assets/ordinal-Cboi1Yqb.js +1 -0
- package/dist/client/assets/{owner-notice-BW4k1ycg.js → owner-notice-ByjrIRmX.js} +1 -1
- package/dist/client/assets/{package-BSwwAFVm.js → package-6Rbxg35g.js} +1 -1
- package/dist/client/assets/{page-container-CjPUNtNw.js → page-container-DoZzad36.js} +1 -1
- package/dist/client/assets/{paperclip-DQaRz34E.js → paperclip-B-jDXtxw.js} +1 -1
- package/dist/client/assets/{path-input-CgXSYNZn.js → path-input-DpqUD8hN.js} +1 -1
- package/dist/client/assets/pegDiagram-ECIUJNBX-eVnSw2Ma.js +1 -0
- package/dist/client/assets/pieDiagram-GNMPY74T-BYG7LY5Q.js +39 -0
- package/dist/client/assets/{plug-BaUXMfIl.js → plug-DnaAhcy4.js} +1 -1
- package/dist/client/assets/{primer-trigger-DHB0vilf.js → primer-trigger-Da5ECjY8.js} +2 -2
- package/dist/client/assets/{profile-errors-JW2XTgia.js → profile-errors-GbTNc2-M.js} +1 -1
- package/dist/client/assets/{progress-CErAw8zp.js → progress-DlIRjXIA.js} +1 -1
- package/dist/client/assets/quadrantDiagram-D57K4MC3-CRgNKuHR.js +7 -0
- package/dist/client/assets/{query-error-state-BFWpEXsl.js → query-error-state-DB-Jby7_.js} +1 -1
- package/dist/client/assets/{radio-Bkx216ga.js → radio-CaaE60ws.js} +1 -1
- package/dist/client/assets/railroadDiagram-Y72NRBL7-DGL-Hqz9.js +1 -0
- package/dist/client/assets/registry-DS1Ghdft.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-DiZj_AFV.js → relay-trace-schemas-CcCqyOrA.js} +2 -2
- package/dist/client/assets/requirementDiagram-EQYSW5RA-DKsFpU3l.js +84 -0
- package/dist/client/assets/{room-files-source-BilZvdpf.js → room-files-source-CbbVpvSW.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-D_SO1stN.js → rotate-ccw-clock-CeY00nlZ.js} +1 -1
- package/dist/client/assets/{rotate-cw-C68kM23F.js → rotate-cw-Djl5J_x9.js} +1 -1
- package/dist/client/assets/sankeyDiagram-SY24JHO5-BFRkDxic.js +40 -0
- package/dist/client/assets/{scroll-area-CVWFUmJV.js → scroll-area-BOqrziJf.js} +1 -1
- package/dist/client/assets/{search-x-BTFVvyA2.js → search-x-B_mHjnlo.js} +1 -1
- package/dist/client/assets/sequenceDiagram-BLEHNHQU-fHea3KOI.js +169 -0
- package/dist/client/assets/{shield-check-Dpxi6WqO.js → shield-check-Csnr5rFy.js} +1 -1
- package/dist/client/assets/{shield-x-CdCCgyXk.js → shield-x-Dhl4YvvW.js} +1 -1
- package/dist/client/assets/{signed-in-BxAnDo0S.js → signed-in-BMqAss8c.js} +1 -1
- package/dist/client/assets/sizeCapture-INFHLROL-CztsD3qF.js +1 -0
- package/dist/client/assets/{soul-file-CRfKVJX3.js → soul-file-DOfamgB5.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-A6IESKWZ-CWyOqZ9S.js +291 -0
- package/dist/client/assets/swimlanes-B3ENRKFQ-0EfOxSAX.js +1 -0
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C7fkUKrq.js +8 -0
- package/dist/client/assets/{table-BL3xUC41.js → table-L7FvN6Or.js} +1 -1
- package/dist/client/assets/{terminal-u_UCRzSM.js → terminal-C9M5a_PS.js} +1 -1
- package/dist/client/assets/timeline-definition-JXYKGLGB-sFyYvZ20.js +120 -0
- package/dist/client/assets/transform-BqqRT-Iy.js +1 -0
- package/dist/client/assets/{trust-posture-B-v4BWo7.js → trust-posture-dl6qwDtI.js} +1 -1
- package/dist/client/assets/{unplug-CFbC-L5W.js → unplug-CFUEVRbc.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-ZUqscVFM.js → unverified-catalog-notice-CdYU3WEJ.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-Z4MDWZAZ.js → use-adapter-catalog-YTofdqDJ.js} +1 -1
- package/dist/client/assets/{use-bindings-CsTavmf-.js → use-bindings-CpyT6kNu.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-BY2dTvep.js → use-composer-prefs-CK_EK_QJ.js} +1 -1
- package/dist/client/assets/{use-connector-management-L9l21yTi.js → use-connector-management-DwoK8kon.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-Bn2ZUtDY.js → use-deep-link-scroll-CgRjt48R.js} +1 -1
- package/dist/client/assets/{use-delete-binding-DLvdHtPD.js → use-delete-binding-CfsnMXrL.js} +1 -1
- package/dist/client/assets/{use-dev-links-DFvL8mIg.js → use-dev-links-B3I-ZK34.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-Be57G4tz.js → use-external-adapter-catalog-aGlZNRrp.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-Cp3lYXdi.js → use-full-activity-feed-B61Olhdw.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-Qwyg-mFb.js +1 -0
- package/dist/client/assets/use-is-hub-CSz6NDaP.js +1 -0
- package/dist/client/assets/{use-jump-back-in-ChH1FSEK.js → use-jump-back-in-C39GOTHa.js} +3 -3
- package/dist/client/assets/{use-local-browser-zA8gMhcC.js → use-local-browser-DCwzB4D8.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-CvoD-L1G.js → use-mesh-topology-LRYxFuZp.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-Ch0wqQry.js → use-mounted-ref-CZaegwTr.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-DeR05zhp.js → use-notification-prefs-FtOiUS5H.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-DdjrmaoK.js → use-panel-tab-placements-Dv2OPvKh.js} +1 -1
- package/dist/client/assets/use-pending-read-DBOl1ee_.js +1 -0
- package/dist/client/assets/{use-personality-commit-qQfISO2-.js → use-personality-commit-BB5aeh6p.js} +1 -1
- package/dist/client/assets/{use-promo-activation-CwGoE7b-.js → use-promo-activation-BW0u7n7m.js} +2 -2
- package/dist/client/assets/{use-promo-dismissals-BBqVN4hx.js → use-promo-dismissals-BOXzW4kD.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-BKW7tjvX.js → use-pulse-freshness-ClW-MLMo.js} +1 -1
- package/dist/client/assets/{use-relay-config-D5iieBXl.js → use-relay-config-hItHtkSr.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BwZh2ZPH.js → use-room-follow-claim-wotzxUWc.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-Ct7yDAUE.js → use-roving-tab-list-DkbO6xSs.js} +1 -1
- package/dist/client/assets/use-session-canvas-C_fuAgW_.js +24 -0
- package/dist/client/assets/{use-session-diagnostics-Dn-Wnyhh.js → use-session-diagnostics-DmxvD-wy.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-M-c5tjXH.js → use-unclaimed-chats-DKpexDm3.js} +1 -1
- package/dist/client/assets/use-update-config-CSYwg557.js +1 -0
- package/dist/client/assets/{useMutationState-Cd-VqRAv.js → useMutationState-Btf2Hp1a.js} +1 -1
- package/dist/client/assets/usecaseDiagram-WPOLBNNX-DRngjDUq.js +370 -0
- package/dist/client/assets/value-wA6veExk.js +1 -0
- package/dist/client/assets/vennDiagram-Q3Y3IDCW-iK-dlS1-.js +34 -0
- package/dist/client/assets/wardleyDiagram-IVAIDKWA-sOS67Cks.js +78 -0
- package/dist/client/assets/xychartDiagram-4URNHDU4-EgnLiIao.js +7 -0
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +4223 -3493
- package/dist/server/index.js.map +2 -2
- package/package.json +6 -6
- package/dist/client/assets/BlintzCanvas-ClOKWzws.js +0 -1141
- package/dist/client/assets/CanvasFileContent-B_8zsIas.js +0 -2
- package/dist/client/assets/HandlePage-BdRWgke2.js +0 -1
- package/dist/client/assets/NamePage-DyH8JAqT.js +0 -1
- package/dist/client/assets/PhotoPage-BHvRQnex.js +0 -1
- package/dist/client/assets/TopologyGraph-D3CxaLGX.js +0 -30
- package/dist/client/assets/_shell.marketplace-DGN_IdZY.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-2YMpLInp.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-D3-n5IRW.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-D3-n5IRW.js +0 -1
- package/dist/client/assets/index-DCOOlbEt.js +0 -1
- package/dist/client/assets/index-Dain_3cO.js +0 -1
- package/dist/client/assets/index-_5Dn0bFm.js +0 -74
- package/dist/client/assets/registry-Ce1VRIS3.js +0 -1
- package/dist/client/assets/use-is-below-desktop-DmekpHAF.js +0 -1
- package/dist/client/assets/use-is-hub-el7LTkg3.js +0 -1
- package/dist/client/assets/use-pending-read-DBpte0GI.js +0 -1
- package/dist/client/assets/use-session-canvas-CJrfZrYG.js +0 -24
- package/dist/client/assets/use-update-config-DhlbZldm.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{W as ee,r as a,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DKDK-3KH.js","assets/index-DcZPWi_I.js","assets/index-CrflCTqO.css","assets/room-files-source-CbbVpvSW.js","assets/markdown-content-Cqq_QMXA.js","assets/file-exclamation-point-DZXE9_8o.js","assets/composer-insert-BpyATrmR.js","assets/index-yI1r4pSP.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-Djl5J_x9.js","assets/link-2-Dvb6g-2Q.js","assets/file-Bf7D_47y.js","assets/git-branch-B2k77X3Q.js","assets/more-details-B4lBMpKi.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{W as ee,r as a,mJ as Gt,j as i,g as Vt,ic as Qt,G as Q,a1 as te,a2 as Yt,bk as K,a3 as ye,lQ as Ke,aW as ne,mK as oe,mL as Jt,mM as Xt,aK as Zt,mN as re,mO as en,mP as tn,a4 as le,mQ as nn,mR as ke,mS as Ge,mT as sn,mU as on,mV as rn,lA as an,mW as ln,lC as cn,mX as dn,dz as un,g8 as mn,mG as fn,mY as pn,a0 as hn,bw as gn,mZ as xn,m_ as yn,iR as bn,hF as vn,ir as Y,kp as Ve,m$ as lt,bK as Rn,ko as ue,kt as ct,n0 as kn,ku as dt,ai as wn,bO as ut,hA as mt,B as Te,x as Sn,n1 as Nn,c4 as _e,n2 as In,s as fe,ep as Cn,jO as ft,n3 as pt,aX as An,e as ae,n4 as be,hb as ht,ks as gt,n5 as jn,n6 as Mn,n as On,q as Ie,kr as Tn,n7 as xt,eN as se,a7 as yt,fm as _n,n8 as En,n9 as Pn,na as Dn,nb as $n,l as bt,ar as Ee,kc as Ln,aj as Fn,nc as Bn,nd as qn,ne as Hn,b6 as zn,bW as Un,nf as Wn,ng as Kn,nh as Gn,ni as Vn,bx as Ce,dH as Qn,ki as Yn,kn as Jn,kg as Xn,nj as Zn,nk as es,nl as ts,nm as ns,eM as ss,kj as os,nn as rs,no as as,np as is,dM as ls,X as cs,nq as ds,nr as Qe,ns as us,ad as ms,nt as fs,iq as ps,nu as hs,nv as gs,aH as Ye}from"./index-DcZPWi_I.js";import{R as xs,A as ys,u as bs,P as vs,a as Rs}from"./use-jump-back-in-C39GOTHa.js";import{m as Ae,a as Je,f as Pe,b as De,d as vt,e as Rt,g as kt,E as ks,h as ws,i as Ss,M as V,F as Ns,D as Is,U as Cs,C as X,u as As,j as js,k as Ms}from"./index-Cp3yShS8.js";import{a as Os}from"./use-room-follow-claim-wotzxUWc.js";import"./WidgetErrorCard-Dx5oPMlF.js";import{M as Ts}from"./markdown-content-Cqq_QMXA.js";import{W as _s,a as Es}from"./find-latest-widget-fence-B1_-pC-Z.js";import{f as Ps}from"./format-duration-BCr6uzby.js";import{H as Ds,a as $s,b as Ls}from"./RuntimeSetupDialog-BK9yo7YF.js";import{M as Xe}from"./mention-pill-Bnzt4u2l.js";import{R as Fs}from"./rotate-ccw-clock-CeY00nlZ.js";import{U as Bs}from"./unplug-CFUEVRbc.js";import{M as qs}from"./message-square-off-BX2XnEDx.js";import{i as Hs}from"./registry-DS1Ghdft.js";import{f as zs}from"./use-connector-management-DwoK8kon.js";import{A as Us}from"./AgentRequestCard-CamX7Tvr.js";/**
|
|
3
3
|
* @license lucide-react v1.48.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -29,16 +29,16 @@ import{W as ee,r as a,mF as Gt,j as i,g as Vt,ia as Qt,G as Q,a1 as te,a2 as Yt,
|
|
|
29
29
|
*
|
|
30
30
|
* This source code is licensed under the ISC license.
|
|
31
31
|
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const
|
|
32
|
+
*/const At={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"}]]};At.node;const Ys=ee(At);/**
|
|
33
33
|
* @license lucide-react v1.48.0 - ISC
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the ISC license.
|
|
36
36
|
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const
|
|
37
|
+
*/const jt={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"}]]};jt.node;const Ze=ee(jt);/**
|
|
38
38
|
* @license lucide-react v1.48.0 - ISC
|
|
39
39
|
*
|
|
40
40
|
* This source code is licensed under the ISC license.
|
|
41
41
|
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const Mt={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"}]]};Mt.node;const Js=ee(Mt),Xs=300;function ce({className:e,children:t}){return i.jsx("span",{className:Q("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 Tt({identity:e,children:t,onViewProfile:s,className:n}){const{kind:o,displayName:r,handle:l,color:c,emoji:h,imageUrl:p,origin:u,agent:d}=e,k=c??"hsl(var(--muted-foreground))",f=typeof u=="object"&&u!==null,g=o==="agent"&&(d==null?void 0:d.working)!=null?d.working:null,[y,x]=a.useState(!1),N=a.useRef(!1),m=a.useRef(null),b=Gt({onLongPress:()=>{N.current&&x(!0)}});return i.jsxs(Ds,{open:y,onOpenChange:x,openDelay:Xs,children:[i.jsx(Ls,{asChild:!0,ref:m,"data-gesture-priority":"",...b,onPointerDown:T=>{N.current=T.pointerType==="touch"||T.pointerType==="pen",b.onPointerDown(T)},children:t}),i.jsxs($s,{"data-slot":"identity-hover-card",align:"start",className:Q("flex w-64 flex-col gap-0 overflow-hidden p-0",n),children:[i.jsxs("div",{className:"flex items-center gap-3 p-3",children:[i.jsx(Vt,{"aria-hidden":!0,color:k,emoji:h,imageUrl:p,fallback:Qt(r),kind:o,origin:u,status:g?"working":"idle",size:"md"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:r}),l&&i.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",l]})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[o==="agent"&&((d==null?void 0:d.runtime)||(d==null?void 0:d.model))&&i.jsx(ce,{children:[d.runtime,d.model].filter(Boolean).join(" · ")}),g&&i.jsxs(ce,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Ps(g.forMs)]}),o==="human"&&i.jsx(ce,{children:f?u.platform:"On this machine"}),o==="agent"&&(d==null?void 0:d.managedBy)&&i.jsxs(ce,{children:["Managed by"," ",d.managedBy.handle?`@${d.managedBy.handle}`:d.managedBy.displayName]})]}),s?i.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var T;(T=m.current)==null||T.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"}):i.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[i.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),i.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function _t(e,t={}){const s=te();return Yt({queryKey:K.sessions(e??""),queryFn:()=>s.listRoomSessions(e),enabled:e!==null&&t.enabled===!0})}function Zs(e,t){const s=e??[];return s.some(n=>n.seq===t.seq)?s:s.length===0||s[s.length-1].seq<t.seq?[...s,t]:[...s,t].sort((n,o)=>n.seq-o.seq)}function eo(e,t){const s=e??[],n=s.findIndex(c=>c.id===t.id);if(n===-1)return s;const o=s[n];if(o.seq!==t.seq||o.roomId!==t.roomId||JSON.stringify(o.body)===JSON.stringify(t.body)&&JSON.stringify(o.mentions)===JSON.stringify(t.mentions)&&JSON.stringify(o.mentionSpans)===JSON.stringify(t.mentionSpans))return s;const l=[...s];return l[n]={...o,body:t.body,mentions:t.mentions,mentionSpans:t.mentionSpans},l}function to(e,t){if(t.kind!=="notice"||t.body.notice!=="turn_failed")return;const s=t.body.subjectAuthorId;s!==void 0&&re.getState().clearAuthor(e,s)}function no(e,t){const s=e.getQueryData(K.entries(t));return s&&s.length>0?s[s.length-1].seq:0}function so(e,t){var s;return((s=e.getQueryData(K.detail(t)))==null?void 0:s.viewerAuthorId)??null}const oo=2e3;function ro(){const e=a.useRef(null),t=a.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),s=a.useCallback(o=>{t(),ne.getState().endRoomCanvasCycle(o)},[t]),n=a.useCallback(o=>{t(),e.current=setTimeout(()=>{e.current=null,ne.getState().endRoomCanvasCycle(o)},oo)},[t]);return a.useEffect(()=>t,[t]),{arm:n,now:s}}function ao(e){const t=Math.min(oe.BACKOFF_CAP_MS,oe.BACKOFF_BASE_MS*2**e);return Math.random()*t}const io=50;function lo(e,t){return new Promise(s=>{if(t.aborted)return s();const n=()=>{clearTimeout(o),t.removeEventListener("abort",n),s()},o=setTimeout(n,e);t.addEventListener("abort",n,{once:!0})})}function co(e,t){const s=te(),n=ye(),[o,r]=a.useState(null),[l,c]=a.useState(null),[h,p]=a.useState(0),u=a.useRef(!1),d=ro(),k=a.useCallback(()=>p(y=>y+1),[]),f=a.useRef(null),g=a.useCallback(()=>{f.current===null&&(f.current=setTimeout(()=>{f.current=null,p(y=>y+1)},io))},[]);return a.useEffect(()=>{if(e===null)return;const y=()=>g();let x=null;const N=()=>{if(document.visibilityState!=="visible"){x=Date.now();return}const T=x===null?0:Date.now()-x;x=null,(u.current||T>=oe.VISIBILITY_GRACE_MS)&&g()};let m=Ke.getListConnectionState();const b=Ke.subscribeListConnectionState(T=>{const _=T==="connected"&&m==="reconnecting";m=T,_&&g()});return window.addEventListener("online",y),document.addEventListener("visibilitychange",N),()=>{window.removeEventListener("online",y),document.removeEventListener("visibilitychange",N),b(),f.current!==null&&(clearTimeout(f.current),f.current=null)}},[e,g]),a.useEffect(()=>(ne.getState().setRoomCanvasLiveRoom(e),()=>ne.getState().setRoomCanvasLiveRoom(null)),[e]),a.useEffect(()=>{if(e===null||!t)return;const y=new AbortController;let x=!0,N;return(async()=>{r(null),c(null),u.current=!1;let m=0,b=!1;const T=()=>{m=0,u.current=!1,b&&(b=!1,r(_=>_===e?null:_))};for(;x&&!y.signal.aborted;){const _=Date.now();u.current=!1,ne.getState().beginRoomCanvasCycle(e),d.arm(e);const D=setTimeout(T,oe.STABILITY_WINDOW_MS);let C;try{if(C=Jt(s,e,no(n,e),y.signal),N=C,!x||y.signal.aborted){C.retire();return}for await(const S of C.stream){if(!x||y.signal.aborted||(T(),!C.current()))return;if(S.type==="canvas_event"||S.type==="canvas_channel_snapshot"){if(C.publish(S),!C.current())return;continue}if(S.type==="signal"){Xt(S)?Zt.getState().observe(e,S):(re.getState().observe(e,S),ne.getState().applyRoomCanvasPresence(e,S));continue}if(S.type==="reaction"){n.setQueryData(K.entries(e),O=>je(O,S.entryId,S.reactions));continue}if(S.type==="revision"){if(S.entry.roomId!==e)continue;n.setQueryData(K.entries(e),O=>eo(O,S.entry));continue}if(S.type==="canvas"){ne.getState().applyRoomCanvasFrame(e,S,so(n,e)),S.change!==void 0?d.now(e):d.arm(e);continue}re.getState().clearAuthor(e,S.entry.authorId),to(e,S.entry),en.getState().settle(e,S.entry.id),n.setQueryData(K.entries(e),O=>Zs(O,S.entry))}}catch(S){if(y.signal.aborted)return;if(console.warn("[rooms] live stream dropped",{roomId:e,err:S}),tn(S)){re.getState().clearRoom(e),c(e),r(e),clearTimeout(D);return}}finally{try{C==null||C.retire()}finally{clearTimeout(D)}}if(y.signal.aborted)return;Date.now()-_>=oe.STABILITY_WINDOW_MS&&(m=0),m+=1,u.current=!0,m>=oe.DISCONNECTED_THRESHOLD&&!b&&(re.getState().clearRoom(e),r(e),b=!0),await lo(ao(m),y.signal)}})(),()=>{x=!1;try{N==null||N.retire()}finally{y.abort()}}},[e,t,s,n,h]),{stalled:o!==null&&o===e,unavailable:l!==null&&l===e,retry:k}}function uo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.haltRoomAgent(t,s),meta:{errorLabel:"Couldn’t stop this agent"}})}function mo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.promoteHold(t,s),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function fo(){const e=te(),t=ye();return le({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var u;const l=t.getQueryData(K.entries(s)),c=(u=l==null?void 0:l.find(d=>d.id===n))==null?void 0:u.reactions,{reactions:h,on:p}=Je(c,o,r);return t.setQueryData(K.entries(s),d=>je(d,n,h)),{on:p}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var h,p;const l=t.getQueryData(K.entries(s)),c=((p=(h=l==null?void 0:l.find(u=>u.id===n))==null?void 0:h.reactions)==null?void 0:p.some(u=>u.emoji===o&&u.authorIds.includes(r)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:r,viewerAuthorId:l},c)=>{c!==void 0&&t.setQueryData(K.entries(n),h=>{var d;const p=(d=h==null?void 0:h.find(k=>k.id===o))==null?void 0:d.reactions,{reactions:u}=Je(p,r,l,!c.on);return je(h,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(K.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function Z(e){return e.threadRootEntryId??e.parentEntryId}function Et(e){return Z(e)??e.id}function Le(e,t){return Math.max(t??0,e)}function po(e,t,s){let n=e[0],o=0;for(const r of e)r.seq>n.seq&&(n=r),t!==null&&r.seq>t&&(o+=1);return{count:Le(e.length,s),lastAt:n.createdAt,unread:o}}function ho(e){const t=te(),s=ye(),n=nn(e),o=ke(u=>{var d;return e===null?null:((d=u.paging[e])==null?void 0:d.cursor)??null}),r=le({mutationFn:async u=>{var x;const d=(x=ke.getState().paging[u])==null?void 0:x.cursor;if(d==null)return;const k=await t.listRoomEntries(u,{before:d,limit:Ge}),f=K.entries(u),g=s.getQueryData(f),y=sn(g,k);s.setQueryData(f,y),ke.getState().notePage(u,on(k)??d,rn(k,Ge)||y.length===((g==null?void 0:g.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:l,isPending:c}=r,h=a.useRef(!1),p=a.useCallback(async()=>{if(!(e===null||h.current)){h.current=!0;try{await l(e).catch(()=>{})}finally{h.current=!1}}},[e,l]);return{canLoadOlder:n,isLoadingOlder:c,cursor:o,loadOlder:p}}function go(e){return i.jsx(Os,{code:e.code,isIncomplete:e.isIncomplete})}const xo=[{language:Es,component:go}],yo={turn_failed:{Icon:hn,tone:"text-status-warning"},agent_busy:{Icon:pn},agent_gone:{Icon:Js,tone:"text-status-warning"},agent_left:{Icon:Ze,tone:"text-status-warning"},room_archived:{Icon:fn},runtime_gone:{Icon:Vs,tone:"text-status-warning"},agent_paused:{Icon:mn},agent_declined:{Icon:qs},agent_unavailable:{Icon:un},awaiting_approval:{Icon:Ws,tone:"text-status-warning"},halted:{Icon:dn},budget_reached:{Icon:cn},cascade_stopped:{Icon:ln},addressing_changed:{Icon:Gs},bridge_blocked:{Icon:Bs,tone:"text-status-warning"},bridge_undelivered:{Icon:an,tone:"text-status-warning"},bridge_rate_limited:{Icon:Ys},bridge_second_agent_refused:{Icon:Ze},bridge_disconnected:{Icon:Ks},bridge_agent_swapped:{Icon:xs},bridge_history_note:{Icon:Fs}},bo={Icon:gn},we=80;function vo(e){const t=e.trim();if(t.length<=we)return t;const s=t.slice(0,we),n=s.lastIndexOf(" ");return`${(n>we/2?s.slice(0,n):s).trimEnd()}…`}function Ro(e,t,s){const n=ko(e,s),o=r=>i.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:r});return n===null?i.jsxs(i.Fragment,{children:[e," ",o("Open chat")]}):i.jsxs(i.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function ko(e,t){if(t!==void 0){const n=xn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=yn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function wo({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:r,tone:l}=(e.body.notice&&yo[e.body.notice])??bo;return i.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":vo(e.body.text)},...Pe(t),className:Q("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",l??"text-muted-foreground"),children:[i.jsx(r,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),i.jsx("span",{children:n?Ro(e.body.text,n,o):e.body.text})]})}const So=Hs.moment;function No({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:r}){const l=De(e.createdAt);return i.jsx("div",{id:r,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...Pe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:i.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[i.jsx(Tt,{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:i.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[i.jsx(vt,{author:s}),i.jsx("span",{className:"sr-only",children:s.displayName})]})}),i.jsx(So,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),i.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),l.length>0&&i.jsx("time",{dateTime:e.createdAt,title:Rt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:l})]})})}function Io({id:e,summary:t,open:s,onOpen:n}){const{capabilities:o}=kt(),{count:r,lastAt:l,unread:c}=t,h=De(l),[p,u]=a.useState({count:r,bumped:!1});p.count!==r&&u({count:r,bumped:!0});const d=p.count===r&&p.bumped;return o.threads?i.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":c>0?"":void 0,"aria-expanded":s,onClick:n,className:Q("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",c>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[i.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),i.jsx("span",{className:Q(d&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:r},r),r===1?" reply":" replies",h.length>0&&i.jsxs(i.Fragment,{children:[" · last ",i.jsx("time",{dateTime:l,title:Rt(l),children:h})]}),c>0&&` · ${c} new`]}):null}function Co(e,t){const s=ue.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
|
|
43
|
-
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function jo({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const r=Et(t),l=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,h=s==null?void 0:s.displayName,{copy:p}=bn({toastOnSettle:!0});return a.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Qs,run:()=>{Y.getState().openThread(e,r,!0),Ve.getState().requestFocus(lt(e,r))}},copy:{id:"copy",label:"Copy text",icon:vn,run:()=>void p(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:Rn,run:o}),c!==void 0&&(u.mention={id:"mention",label:h===void 0?"Mention author":`Mention ${h}`,icon:ys,run:()=>{Co(e,c),Ve.getState().requestFocus(e)}}),ks.map(d=>u[d]).filter(d=>d!==void 0)},[e,r,l,c,h,o,p])}function Ao(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function $e(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 pe(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function J(e,t,s){const n=t.get(e),o=ct({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 Mo(e){const t=new Set;for(const r of e)Z(r)===null&&t.add(r.id);const s=[],n=new Map,o=new Set;for(const r of e){const l=Z(r);if(l===null){s.push(r);continue}if(!t.has(l)){s.push(r),o.add(r.id);continue}const c=n.get(l);c?c.push(r):n.set(l,[r])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Ot(e){return`thread-${e}`}function he(e){return`thread-row-${e}`}function Ae(e){return`thread-panel-entry-${e}`}function ge(e){return`room-entry-${e}`}function Fe(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=Z(s)??null,o={rowId:t,domId:ge(t)};if(n===null)return o;const r=e.find(c=>c.id===n);return r!==void 0&&(Z(r)??null)===null?{rowId:Ot(n),domId:he(n)}:o}function To(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Fe(e,s.id)}const et=48;function Pt(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 r=o.body.text.replace(/\s+/gu," ").trim();return r.length===0?null:{entryId:n,excerpt:r.length>et?`${r.slice(0,et).trimEnd()}…`:r}}function _o(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const r=kn({runtime:o.runtime,model:o.model});s.set(dt(n.projectPath),{memberId:n.id,visual:wn(o),runtime:r.label,...r.modelLabel!==null&&{model:r.modelLabel}})}return s}function Eo(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Oo={info:new Map,faces:new Map},Be=a.createContext(Oo);function Dt({known:e,children:t}){return i.jsx(Be.Provider,{value:e,children:t})}function qe(){const e=ut(),t=a.useMemo(()=>{var l;return((l=e.data)==null?void 0:l.agents)??[]},[e.data]),s=a.useMemo(()=>t.map(l=>l.projectPath),[t]),n=mt(s),o=a.useMemo(()=>_o(t,n.data??{}),[t,n.data]),r=a.useMemo(()=>Eo(o),[o]);return a.useMemo(()=>({info:o,faces:r}),[o,r])}function Me(e){const t=a.useContext(Be);return e===void 0?void 0:t.info.get(e)}function Po(){return a.useContext(Be).faces}function Do({loading:e,onLoad:t}){return i.jsx("div",{className:"flex justify-center px-4 py-3",children:i.jsxs(_e,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&i.jsx(Sn,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}function Lo({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:r,summaryId:l,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?r:l,...Pe(c)}}const me=120,$o="code block";function Fo(e){if(e.length<=me&&!e.includes("```"))return null;const t=Bo(e);return t.length===0?null:t}function Bo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${$o} `).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<=me)return t;const s=qo(t,me),n=s.lastIndexOf(" ");return`${(n>me/2?s.slice(0,n):s).trimEnd()}…`}function qo(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:r}of n.segment(e)){if(o.length+r.length>t)break;o+=r}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Ho({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:r=!0}){const l=fo(),c=o===!0||!r,h=a.useMemo(()=>t.reactions??[],[t.reactions]),p=a.useMemo(()=>h.filter(k=>ws(k,s)).map(k=>k.emoji),[h,s]),u=a.useCallback(k=>l.mutate({roomId:e,entryId:t.id,emoji:k,viewerAuthorId:s}),[l,e,t.id,s]),d=a.useMemo(()=>({quick:n,mine:p,onToggle:u,disabled:c}),[n,p,u,c]);return{reactions:h,toggle:u,quickRow:d}}function zo({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var r,l;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(r=t.current)==null||r.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(l=e.current)==null||l.focusFirst())}}function Uo(e,t){var d,k;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Nn.includes(n),r=_t(e,{enabled:o}),l=Ee(),c=ye(),h=te(),p=o?((k=(d=r.data)==null?void 0:d.bindings.find(f=>f.authorId===s))==null?void 0:k.sessionId)??null:null,u=a.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(p===null||s===void 0)&&In({queryClient:c,transport:h},e,s).then(g=>{g.kind!=="none"&&l(fe({session:g.kind==="bound"?g.sessionId:p}))}))},[s,l,c,e,p,h]);return a.useMemo(()=>p===null?null:{href:Cn({session:p}),onOpen:u},[u,p])}const xe="mention",He="author_id",Wo={[xe]:[He]},Ko=[xe];function Go(e,t){if(!t||t.length===0)return e;const s=Vo(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:r,length:l,authorId:c}=s[o],h=n.slice(0,r),p=n.slice(r,r+l),u=n.slice(r+l);n=`${h}<${xe} ${He}="${c}">${p}</${xe}>${u}`}return n}function Vo(e,t){const s=[...t].sort((r,l)=>r.offset-l.offset),n=[];let o=0;for(const r of s)r.offset<o||r.offset+r.length>e.length||(n.push(r),o=r.offset+r.length);return n}const Qo=new Map,Lt=a.createContext(Qo);function Yo({authors:e,children:t}){return i.jsx(Lt.Provider,{value:e,children:t})}function Jo(e){const t=a.useContext(Lt);return e===void 0?void 0:t.get(e)}function Xo(e){return typeof e=="string"?e.replace(/^@/,""):""}function Zo({authorId:e,children:t}){const s=Jo(e),n=Me(s==null?void 0:s.agentRef),{open:o}=ft();if(!s)return i.jsx(Xe,{kind:"human",label:Xo(t),resolved:!1});const r=ct({record:s,override:n==null?void 0:n.visual}),l=pt(s,n==null?void 0:n.memberId),c=l===void 0?void 0:()=>o(l),h=c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),c())}}:{};return i.jsx(Tt,{onViewProfile:c,identity:{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:r.color,emoji:r.emoji,imageUrl:r.imageUrl,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}},children:i.jsx(Xe,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...h})})}function er(e){return{mention:t=>{const s=t[He],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?i.jsx(i.Fragment,{children:t.children}):i.jsx(Zo,{authorId:n,children:t.children})}}}function tr({entry:e,authors:t}){const s=a.useMemo(()=>Go(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=a.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(l=>l.authorId))??[])},[e.mentionSpans]),o=a.useMemo(()=>er(n),[n]);return i.jsx(Yo,{authors:t,children:i.jsx(_s,{content:s,className:"msg-prose",allowedTags:Wo,literalTagContent:Ko,components:o,renderers:xo})})}function nr(e){return function(s){return i.jsx(tr,{entry:s,authors:e})}}const $t="the top folder";function tt(e){return e.slice(e.lastIndexOf("/")+1)}function sr(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function or(e){return e===""?$t:`${e}/`}function Se(e){return e.target!==void 0?e.target===""?$t:e.target:or(sr(e.paths[0]??""))}function rr(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 ${tt(s)} to ${Se(e)}`:`${t} uploaded ${e.pathCount} files to ${Se(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 ${tt(s)} from the chat to ${Se(e)}`}}const ar=a.lazy(()=>jn(()=>import("./index-Cdyszxoa.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.SaveToRoomFilesButton})));function Ft({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:r,authorNames:l,reactionFrequents:c,streamStalled:h,isMember:p=!0,grouping:u,orphanedReply:d,answers:k,feedPosition:f,rowId:g}){const y=De(t.createdAt),x=a.useMemo(()=>{const G=Fo(t.body.text),Re=Ss(t.attachments??[]);if(Re===null)return G;const We=G??t.body.text.trim();return We.length>0?`${We} ${Re}`:Re},[t.body.text,t.attachments]),N=a.useId(),m=`${N}-author`,b=`${N}-content`,T=`${N}-summary`,_=a.useRef(null),D=a.useRef(null),C=a.useRef(null),{reactions:S,toggle:O,quickRow:I}=Ho({roomId:e,entry:t,viewerAuthorId:r,reactionFrequents:c,streamStalled:h,isMember:p}),$=Me(n==null?void 0:n.agentRef),{open:L}=ft(),E=n===void 0?void 0:pt(n,$==null?void 0:$.memberId),q=a.useCallback(()=>{E!==void 0&&L(E)},[L,E]),F=E===void 0?void 0:q,H=jo({roomId:e,entry:t,author:n,viewerAuthorId:r,onViewProfile:F}),W=zo({barRef:D,pillsRef:C,hasReactions:S.length>0}),B=a.useCallback(()=>{var G;return(G=_.current)==null?void 0:G.focus()},[]),z=a.useMemo(()=>nr(o),[o]),w=a.useCallback(G=>i.jsx(a.Suspense,{fallback:null,children:i.jsx(ar,{roomId:e,attachment:G})}),[e]),v=Po(),P=t.body.subjectAuthorId??t.authorId,M=o.get(P),R=Me(M==null?void 0:M.agentRef),A=Uo(e,t),j=Ao(t);if(j.kind==="notice")return i.jsx(wo,{entry:t,feedPosition:f,rowId:g,sessionLink:A,subjectName:M==null?void 0:M.displayName});if(j.kind==="moment")return i.jsx(No,{entry:t,moment:j.moment,subject:P===t.authorId?s:J(P,o,v),subjectIdentity:{handle:(M==null?void 0:M.handle)??void 0,origin:M==null?void 0:M.origin,agent:R&&{runtime:R.runtime,...R.model&&{model:R.model}}},feedPosition:f,rowId:g});const U=u.position==="first"||u.position==="only";return i.jsxs(V.Root,{ref:_,id:g,position:u.position,actions:H,reactions:I,"data-testid":"room-entry",tabIndex:0,...Lo({showAuthorHeader:U,headerId:m,displayName:s.displayName,time:y,summary:x,contentId:b,summaryId:T,feedPosition:f}),onKeyDown:W,children:[i.jsx(V.Gutter,{author:s,at:t.createdAt,onViewProfile:F,isSelf:t.authorId===r}),i.jsxs(V.Body,{children:[i.jsx(V.Author,{id:m,author:s,at:t.createdAt,origin:n==null?void 0:n.origin}),d===!0&&i.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),k!=null&&i.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${k.excerpt}”`}),i.jsx(V.Content,{id:b,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:t.body.fileChange?i.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:rr(t.body.fileChange,(M==null?void 0:M.displayName)??"Somebody")}):z(t,{rowId:t.id,isStreaming:!1})}),x!==null&&i.jsx("span",{id:T,className:"hidden",children:x}),i.jsx(V.Attachments,{items:t.attachments??[],renderAction:p?w:void 0}),i.jsx(V.Reactions,{ref:C,reactions:S,viewerAuthorId:r,names:l,frequents:c,onToggle:O,disabled:h===!0||!p,onExit:B}),i.jsx(V.Actions,{actions:H,reactions:I,barRef:D,onExit:B})]})]})}const ir="room-load-older",lr=4;function Bt({roomName:e}){return i.jsx(Ns,{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:lr},(t,s)=>i.jsxs("div",{className:"flex gap-3",children:[i.jsx(ae,{className:"size-7 shrink-0 rounded-full"}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${s}`))})}function cr({roomId:e,roomName:t,viewerAuthorId:s,entries:n,members:o,formerAuthors:r,lastReadSeq:l,reactionFrequents:c,streamStalled:h,isLoading:p,error:u,onAddAgents:d,openThreadId:k,onOpenThread:f,resumeRow:g,landOnRow:y,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:m=!1,onLoadOlder:b,ref:T}){const _=a.useMemo(()=>$e(o,r),[o,r]),D=be(o,s),C=qe(),S=a.useMemo(()=>new Map([..._].map(([v,P])=>[v,P.displayName])),[_]),O=ht(),I=gt(e,null),{topLevel:$,repliesByRoot:L,orphaned:E}=a.useMemo(()=>Mo(n),[n]),q=a.useMemo(()=>new Map(n.map(v=>[v.id,v])),[n]),F=a.useMemo(()=>{const v=An($,l),P=Mn($.map(R=>({id:R.id,authorId:R.body.moment?`moment:${R.id}`:R.authorId,timestamp:R.createdAt})),{now:O,lastSeenId:v.lastSeenId,unreadFromStart:v.fromStart}),M=[];N&&!p&&M.push({kind:"load-older",id:ir});for(const R of P){if(R.kind==="day-divider"){M.push({kind:"day-divider",id:R.key,label:R.label});continue}if(R.kind==="unread-divider"){M.push({kind:"unread-divider",id:R.key});continue}const A=$[R.index];M.push({kind:"message",id:A.id,entry:A,grouping:R.grouping,position:R.index+1,answers:Pt(A,$[R.index-1],q.get.bind(q))});const j=L.get(A.id);j&&M.push({kind:"thread-reply",id:Ot(A.id),rootId:A.id,replies:j,totalReplies:A.threadReplyCount})}return M},[$,L,q,l,O,N,p]),H=a.useMemo(()=>F.map(v=>v.kind==="load-older"?{kind:"notice",id:v.id,at:"",body:null}:v.kind==="day-divider"?{kind:"day-divider",id:v.id,label:v.label}:v.kind==="unread-divider"?{kind:"unread-divider",id:v.id}:v.kind==="thread-reply"?{kind:"thread-reply",id:v.id,rootId:v.rootId,replyCount:Le(v.replies.length,v.totalReplies),lastAt:v.replies[v.replies.length-1].createdAt}:{kind:"message",id:v.id,payload:v.entry,grouping:v.grouping,author:J(pe(v.entry,_),_,C.faces),at:v.entry.createdAt}),[F,_,C.faces]),W=a.useCallback((v,P)=>{const M=F[P.index];if(M.kind==="load-older")return b===void 0?null:i.jsx(Do,{loading:m,onLoad:b});if(M.kind==="day-divider")return i.jsx(Is,{label:M.label});if(M.kind==="unread-divider")return i.jsx(Cs,{});if(M.kind==="thread-reply"){if(P.onOpenThread===void 0)return null;const A=P.onOpenThread;return i.jsx(Io,{id:he(M.rootId),summary:po(M.replies,l,M.totalReplies),open:k===M.rootId,onOpen:()=>A(M.rootId)})}const R=pe(M.entry,_);return i.jsx(Ft,{roomId:e,entry:M.entry,author:J(R,_,C.faces),authorRef:_.get(R),authors:_,viewerAuthorId:s,authorNames:S,reactionFrequents:c,streamStalled:h,isMember:D,grouping:M.grouping,orphanedReply:E.has(M.entry.id),answers:M.answers,feedPosition:{index:M.position,total:-1},rowId:ge(M.entry.id)})},[F,e,_,C.faces,s,S,c,h,D,E,l,k,m,b]),B=a.useCallback(v=>{if(v.kind==="message")return ge(v.id);if(v.kind==="thread-reply")return he(v.rootId)},[]);if(u)return i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),i.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const z=o.some(v=>v.author.kind==="agent"),w=i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx(Tn,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),i.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),i.jsx("p",{className:"max-w-sm",children:z?"Say something to get it going.":"Nothing answers until you add an agent."}),i.jsx(_e,{type:"button",size:"sm",variant:z?"ghost":"default",onClick:d,className:"mt-1",children:z?"Add more agents":"Add agents"})]});return i.jsx(Dt,{known:C,children:i.jsx(X.Timeline,{ref:T,conversationId:e,label:`Messages in ${t}`,rows:H,renderRow:W,onOpenThread:f,domIdOf:B,...g===void 0?{}:{resumeRow:g},...y===void 0?{}:{landOnRow:y},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:p?i.jsx(Bt,{roomName:t}):void 0,empty:w,feedTestId:"room-timeline"})})}const ze={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function dr(e){const t=te(),[s,n]=a.useState([]),o=a.useRef(new Map),r=a.useCallback(f=>{const g=f.map(y=>({id:crypto.randomUUID(),file:y,status:"pending",progress:0}));n(y=>[...y,...g])},[]),l=a.useCallback(f=>{o.current.delete(f),n(g=>g.filter(y=>y.id!==f))},[]),c=a.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const g=new Set(f);for(const y of g)o.current.delete(y);n(y=>y.filter(x=>!g.has(x.id)))},[]),h=a.useCallback(f=>{o.current.delete(f),n(g=>g.map(y=>y.id===f&&y.status==="error"?{...y,status:"pending",progress:0,error:void 0}:y))},[]),p=a.useRef(null),u=le({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(N=>N.map(m=>f.some(b=>b.id===m.id)?{...m,status:"uploading"}:m));const g=N=>{n(m=>m.map(b=>b.status==="uploading"?{...b,progress:N.percentage}:b))},y=new AbortController;p.current=y;const x=f.map(N=>N.file);return t.uploadRoomAttachments(e,x,g,y.signal)},onSettled:()=>{p.current=null},onSuccess:(f,g)=>{g.forEach((y,x)=>{const N=f[x];N&&o.current.set(y.id,N.id)}),n(y=>y.map(x=>g.findIndex(m=>m.id===x.id)===-1?x:{...x,status:"uploaded",progress:100}))},onError:f=>{n(g=>g.map(y=>y.status==="uploading"?{...y,status:"error",error:f.message}:y))}}),d=a.useCallback(()=>{var f;(f=p.current)==null||f.abort()},[]),k=a.useCallback(async()=>{const f=s.filter(y=>y.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 g=s.filter(y=>y.status==="pending");return g.length>0&&await u.mutateAsync(g),s.map(y=>o.current.get(y.id)).filter(y=>y!==void 0)},[s,u]);return{pendingFiles:s,addFiles:r,removeFile:l,retryFile:h,clearFiles:c,cancelUpload:d,uploadAndGetIds:k,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function qt(e){const{room:t,threadRootId:s}=e,n=js(),o=As(),r=dr((t==null?void 0:t.id)??""),l=t!==void 0&&be(t.members,t.viewerAuthorId),c=a.useRef({attachments:r,post:n,reply:o,room:t,threadRootId:s});a.useEffect(()=>{c.current={attachments:r,post:n,reply:o,room:t,threadRootId:s}});const h=a.useCallback(m=>c.current.attachments.addFiles(m),[]),p=a.useCallback(m=>c.current.attachments.removeFile(m),[]),u=a.useCallback(m=>c.current.attachments.retryFile(m),[]),d=a.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:k,hasFailedUpload:f,isUploading:g}=r,y=a.useMemo(()=>({staged:k,add:h,remove:p,retry:u,cancel:d,hasFailed:f,isUploading:g,holdsSendWhileUploading:!1}),[k,f,g,h,p,u,d]),x=a.useCallback(async m=>{const{attachments:b,post:T,reply:_,room:D,threadRootId:C}=c.current;if(D===void 0)throw new Error("That room isn’t loaded yet.");if(D.archived)throw new Error("This room is archived.");Ie.getState().recordOpened("room",D.id);const S=_n(),O=b.pendingFiles.map(E=>E.file.name),I=b.pendingFiles.map(E=>E.id),$=await b.uploadAndGetIds();b.clearFiles(I);const L=m.parentEntryId??C;if(L!==void 0){_.mutate({roomId:D.id,rootEntryId:L,text:m.text,clientId:S,attachmentIds:$,attachmentNames:O});return}T.mutate({roomId:D.id,text:m.text,clientId:S,attachmentIds:$,attachmentNames:O})},[]);return{target:a.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&&l,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:l?{}:{canSendReason:xt},send:x,attachments:y}),[t,s,l,y,x]),attachments:r}}function ur(e){const{roomId:t,entrySeq:s,entries:n,historyLoaded:o}=e,r=s===void 0?null:`${t}:${s}`,l=a.useMemo(()=>{if(s===void 0)return null;const g=n.find(m=>m.seq===s);if(g===void 0)return null;const y=Fe(n,g.id);if(y===null)return null;const x=Z(g)??null,N=x!==null&&y.rowId!==g.id;return{roomRowId:y.rowId,threadRootId:N?x:null,entryId:g.id}},[n,s]),c=a.useRef(null),h=(l==null?void 0:l.threadRootId)??null;a.useEffect(()=>{r===null||h===null||c.current!==r&&(c.current=r,Y.getState().openThread(t,h))},[r,t,h]);const p=a.useRef(null);a.useEffect(()=>{r===null||!o||l===null&&p.current!==r&&(p.current=r,yt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=a.useRef(null),d=a.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),k=a.useRef(null),f=a.useCallback(()=>{if(!(r===null||k.current===r))return k.current=r,(l==null?void 0:l.threadRootId)===null||l==null?void 0:l.entryId},[r,l]);return{roomRow:s===void 0?void 0:d,threadRow:s===void 0?void 0:f}}function mr(e,t){const[s,n]=a.useState({roomId:null,seq:null});return s.roomId===e?s.seq:e===null?(n({roomId:null,seq:null}),null):t===null?null:(n({roomId:e,seq:t}),t)}const fr=600;function pr(e){return document.getElementById(he(e))??document.getElementById(ge(e))}function hr(){const e=a.useRef(null);return a.useEffect(()=>()=>{var s;return(s=e.current)==null?void 0:s.call(e)},[]),{arm:a.useCallback(s=>{var c;(c=e.current)==null||c.call(e);let n=0;const o=Date.now()+fr;let r=!1;const l=()=>{if(r)return;const h=document.activeElement;if(h===null||h===document.body||!h.isConnected){const u=pr(s);if(u!==null){u.focus();return}}Date.now()>=o||(n=requestAnimationFrame(l))};n=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(n)}},[])}}function gr({roomId:e,route:t,urlThreadId:s,openThreadId:n,entries:o,historyLoaded:r}){const l=En(),c=a.useRef(null);a.useEffect(()=>{if(e!==null){if(c.current!==e&&(c.current=e,s!==void 0)){Y.getState().openThread(e,s);return}if(r&&n!==void 0){const h=o.find(u=>u.id===n),p=h===void 0?void 0:Et(h);if(p!==void 0&&p!==n){const u=Y.getState().open[e];Y.getState().openThread(e,p,(u==null?void 0:u.focusComposer)??!1);return}}n!==s&&(l==null||l({to:t,search:h=>({...h,thread:n}),replace:!0}))}},[e,t,n,s,o,r,l])}const xr=6,Ht="jump-back-in-listbox";function Ue(e){return`jump-back-in-item-${e}`}const yr='[role="combobox"]';function ie(e){return e instanceof Element&&e.matches(yr)}function br({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=Ee(),o=On(),[r,l]=a.useState(!1),[c,h]=a.useState({stamp:"",index:0}),[p,u]=a.useState(!1),[d,k]=a.useState(!1);e.length>0&&!d&&k(!0);const f=a.useRef(!1);a.useEffect(()=>{f.current=!0},[]);const{data:g}=ut({enabled:s}),y=a.useMemo(()=>((g==null?void 0:g.agents)??[]).map(w=>w.projectPath),[g]),{data:x}=mt(y,{enabled:s}),N=a.useMemo(()=>x??{},[x]),m=a.useMemo(()=>Pn(y,N),[y,N]),b=a.useMemo(()=>new Map(y.map(w=>[dt(w),w])),[y]),T=a.useCallback(w=>Dn({room:w,agentsByPath:N,pathByAgentRef:b}),[N,b]),_=a.useMemo(()=>Ln(o.muted),[o.muted]),{items:D}=bs({mutedRoomIds:_,enabled:s}),C=a.useMemo(()=>D.slice(0,xr),[D]),S=s&&r&&!p&&!d&&!t&&e.length===0&&C.length>0,O=`${S}:${C.length}`,I=c.stamp===O?c.index:0,$=a.useCallback(w=>{f.current&&ie(w.target)&&(u(!1),k(!1),l(!0))},[]),L=a.useCallback(w=>{ie(w.target)&&l(!0)},[]),E=a.useCallback(w=>{ie(w.target)&&l(!1)},[]),q=a.useCallback(w=>{C.length!==0&&h(v=>{const P=v.stamp===O?v.index:0;return{stamp:O,index:(P+w+C.length)%C.length}})},[C.length,O]),F=a.useCallback(()=>q(1),[q]),H=a.useCallback(()=>q(-1),[q]),W=a.useCallback(()=>{u(!0)},[]),B=a.useCallback(w=>{if(u(!0),w.kind==="session"){w.session.cwd&&Ie.getState().recordOpened("agent",w.session.cwd),n(fe({dir:w.session.cwd??void 0,session:w.session.id}));return}Ie.getState().recordOpened("room",w.room.id),n({...bt.channels(),search:{id:w.room.id}})},[n]),z=a.useCallback(()=>{const w=C[I];!S||!w||B(w)},[S,C,I,B]);return{isOpen:S,hasRows:C.length>0,rows:C,agents:N,displayNames:m,visualOf:T,selectedIndex:I,activeDescendantId:S&&C[I]!==void 0?Ue(I):void 0,listboxId:S?Ht:void 0,handleFocus:$,handleBlur:E,handlePointerDown:L,moveDown:F,moveUp:H,selectHighlighted:z,selectRow:B,dismiss:W}}function zt({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:r,isSelected:l,now:c,onSelect:h}){const p=a.useMemo(()=>Number.isNaN(Date.parse(o))?null:zn(o),[o,c]);return i.jsxs("div",{id:Ue(r),role:"option","aria-selected":l,"data-selected":l,title:s,onClick:h,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:[i.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),i.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[i.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),p!==null&&i.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:p})]}),n!==null&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function vr({item:e,agent:t,displayName:s,index:n,isSelected:o,now:r,onSelect:l}){const c=$n(t,e.session.cwd??s);return i.jsx(zt,{mark:i.jsx(Fn,{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:r,onSelect:l})}function Rr({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:r}){return i.jsx(zt,{mark:i.jsx(qn,{room:e.room,participants:e.room.participants,visuals:Hn(t)}),label:i.jsx(Bn,{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:r})}function kr({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:r}){const l=ht(6e4);return a.useEffect(()=>{var c,h;(h=(c=document.getElementById(Ue(t)))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"})},[t]),i.jsx(Oe.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:i.jsx("div",{id:Ht,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,h)=>{var p;return c.kind==="session"?i.jsx(vr,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((p=c.session.cwd)==null?void 0:p.split("/").pop())||"Agent",index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`session-${c.id}`):i.jsx(Rr,{item:c,visual:o(c.room),index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`room-${c.id}`)})})})}const nt={people:"People",agents:"Agents"},wr=["people","agents"];function Sr(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 Nr(e,t,s){const n=t.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:Ir(r,n)})).filter(r=>r.tier!==null).sort((r,l)=>r.tier-l.tier||r.position-l.position);return s.flatMap(r=>o.filter(l=>l.row.section===r).map(({row:l})=>l))}function Ir(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(r=>r!==void 0);let n=null;for(const r of s){const l=r===t?0:r.startsWith(t)?1:r.includes(t)?2:null;l!==null&&(n===null||l<n)&&(n=l)}return n}function de(e,t,s){var r;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let l=0;l<n;l++){if(!((r=e[o])!=null&&r.disabled))return o;o=(o+s+n)%n}return 0}function Cr(e,t,s,n){const o=e.slice(0,t),r=e.slice(t+1+s.length),l=`@${n}`,c=r.startsWith(" ")?"":" ";return{value:o+l+c+r,cursorPos:o.length+l.length+1}}const jr=/(^|\s)@([A-Za-z0-9_.-]*)$/,Ut="mention-palette-listbox";function Te(e){return`mention-item-${e}`}function Ar({members:e,viewerAuthorId:t,text:s,sectionOrder:n=wr}){var L;const[o,r]=a.useState(!1),[l,c]=a.useState(""),[h,p]=a.useState(-1),u=Un(s),d=a.useRef(!1),k=a.useMemo(()=>Sr(e,t),[e,t]),f=a.useMemo(()=>o?Nr(k,l,n):[],[k,l,o,n]),[g,y]=a.useState(null),x=g!==null&&g.query===l&&g.open===o?g.index:de(f,0,1),N=f[x],m=f.length===0||N!==void 0&&!N.disabled?x:de(f,0,1),b=a.useCallback((E,q)=>{const F=E.slice(0,q).match(jr);if(!F){r(!1);return}r(!0),c(F[2]),p((F.index??0)+F[1].length)},[]),T=a.useCallback(E=>{u.write(E),d.current=!1},[u]),_=a.useCallback(E=>{d.current||b(u.read(),E)},[b,u]),D=a.useCallback(()=>{y({query:l,open:o,index:de(f,m+1,1)})},[f,m,l,o]),C=a.useCallback(()=>{y({query:l,open:o,index:de(f,m-1,-1)})},[f,m,l,o]),S=a.useCallback(E=>E.disabled||E.handle===void 0?null:(d.current=!0,r(!1),Cr(u.read(),h,l,E.handle)),[h,l,u]),O=a.useCallback(()=>{const E=f[m];return E?S(E):(r(!1),null)},[f,m,S]),I=a.useCallback(()=>{d.current=!0,r(!1)},[]),$=f.some(E=>!E.disabled);return{isOpen:o,hasSelectableRows:$,rows:f,selectedIndex:m,activeDescendantId:o&&((L=f[m])==null?void 0:L.disabled)===!1?Te(m):void 0,listboxId:o?Ut:void 0,noteTextChange:T,handleCursorChange:_,moveDown:D,moveUp:C,selectHighlighted:O,selectRow:S,dismiss:I}}function Mr({rows:e,selectedIndex:t,onSelect:s}){const n=a.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const c=o[o.length-1];c&&c.section===r.section?c.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return a.useEffect(()=>{var o;(o=document.getElementById(Te(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),i.jsx(Oe.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:i.jsx("div",{id:Ut,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?i.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:r},l)=>i.jsxs("div",{role:"group","aria-label":nt[o],children:[l>0&&i.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),i.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:nt[o]}),r.map(({row:c,index:h})=>{const p=h===t;return i.jsxs("div",{id:Te(h),role:"option","aria-selected":p,"aria-disabled":c.disabled,"data-selected":p,"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:[i.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),i.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&i.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function Wt({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:r}){const l=t===void 0?e.id:lt(e.id,t),c=Wn(l),{target:h}=kt(),p=Kn(),u=Gn(l),d=a.useRef(null),k=be(e.members,e.viewerAuthorId),f=a.useRef(!1),g=Ar({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),y=n===!0,x=br({value:c,yieldToPalette:g.isOpen,enabled:y}),N=a.useRef(u);a.useEffect(()=>{var I;u!==N.current&&(N.current=u,(I=d.current)==null||I.focus())},[u]),a.useEffect(()=>{var I;s===!0&&((I=d.current)==null||I.focusUnlessTouch())},[]);const m=a.useCallback(I=>ue.getState().set(l,I),[l]),[b,T]=a.useState(null);a.useLayoutEffect(()=>{var I;b!==null&&((I=d.current)==null||I.focusAt(b.pos))},[b]);const _=a.useCallback(I=>{I&&(m(I.value),T({pos:I.cursorPos}))},[m]),D=a.useCallback(I=>_(g.selectRow(I)),[g,_]),C=a.useCallback(()=>_(g.selectHighlighted()),[g,_]),S=()=>{if(h===null||!h.canSend||f.current)return;g.dismiss();const I=ue.getState().take(l).trim();if(I==="")return;const $=r.pendingFiles.length>0;$&&(f.current=!0),h.send({text:I}).catch(()=>{const L=ue.getState(),E=L.drafts[l]??"";L.set(l,E===""?I:`${I}
|
|
44
|
-
${E}`)}).finally(()=>{$&&(f.current=!1)})};if(!k)return i.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:xt}),i.jsx(_e,{type:"button",size:"sm",variant:"outline",disabled:p.isPending,onClick:()=>p.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>yt.success(`You joined ${se(e)}`)}),children:Vn})]});const O=i.jsx(X.Composer,{inputRef:d,value:c,onChange:I=>{m(I),g.noteTextChange(I)},onSubmit:S,head:i.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g.isOpen&&g.rows.length===0?"No one by that name.":""}),mentionPicker:i.jsx(Ce,{children:g.isOpen&&i.jsx(Mr,{rows:g.rows,selectedIndex:g.selectedIndex,onSelect:D})}),overlays:i.jsx(i.Fragment,{children:i.jsx(Ce,{children:x.isOpen&&i.jsx(kr,{rows:x.rows,selectedIndex:x.selectedIndex,agents:x.agents,displayNames:x.displayNames,visualOf:x.visualOf,onSelect:x.selectRow})})}),input:{onCursorChange:g.handleCursorChange,isStreaming:!1,isPaletteOpen:g.isOpen||x.isOpen,paletteHasResults:x.isOpen?x.hasRows:g.hasSelectableRows,onArrowUp:x.isOpen?x.moveUp:g.moveUp,onArrowDown:x.isOpen?x.moveDown:g.moveDown,onCommandSelect:x.isOpen?x.selectHighlighted:C,onEscape:x.isOpen?x.dismiss:g.dismiss,tabPicks:!x.isOpen,onClear:()=>{m(""),g.dismiss()},activeDescendantId:x.isOpen?x.activeDescendantId:g.activeDescendantId,paletteListboxId:x.isOpen?x.listboxId:g.listboxId,contextKey:l,...r.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!y&&o===void 0?O:i.jsx("section",{className:"flex flex-col","data-testid":Qn.homeComposer,onFocus:I=>{x.handleFocus(I),ie(I.target)&&(o==null||o(!0))},onBlur:I=>{x.handleBlur(I),ie(I.target)&&(o==null||o(!1))},onPointerDown:x.handlePointerDown,children:O})}function Tr(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(t=>t.author.kind==="agent")}function _r({room:e,hasEntries:t,onAddAgents:s}){return!t||!Tr(e)?null:i.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."," ",i.jsx("button",{type:"button",onClick:s,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 Er({roomId:e}){const{approvals:t}=Yn(),s=Jn(t).filter(n=>n.roomId===e);return s.length===0?null:i.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:i.jsx(Xn,{approvals:s})})}function Or({roomId:e}){const{data:t}=zs("pending"),s=(t??[]).filter(n=>n.roomId===e);return s.length===0?null:i.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:s.map(n=>i.jsx(Us,{request:n},n.requestId))})}const Pr="An agent",st=64,Ne=3,Dr=new Set;function Kt({room:e,entries:t,scope:s,laneScope:n,stalled:o,unavailable:r=!1,onRetry:l,onScrollToRow:c}){const h=Ee(),p=Zn(e.id,s),u=es(e.id,s),d=ts(e.id,s),[k,f]=a.useState(!1),g=_t(e.id,{enabled:k}),y=ns(),{mutate:x}=uo(),[N,m]=a.useState(Dr),b=a.useCallback(R=>{m(A=>new Set(A).add(R)),x({roomId:e.id,authorId:R},{onSettled:()=>m(A=>{const j=new Set(A);return j.delete(R),j})})},[x,e.id]),T=mo(),[_,D]=a.useState(()=>new Map),C=ss(),S=qe(),O=a.useMemo(()=>$e(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=a.useCallback(R=>{var A;return((A=O.get(R))==null?void 0:A.displayName)??Pr},[O]),{interactions:$}=os(),L=a.useMemo(()=>$.filter(R=>R.roomId===e.id),[$,e.id]),E=a.useMemo(()=>{var A;const R={};for(const j of L){if(j.roomAuthorId===void 0)continue;const U=(A=O.get(j.roomAuthorId))==null?void 0:A.displayName;U!==void 0&&(R[j.sessionId]=U)}return R},[L,O]),q=a.useMemo(()=>p.map(R=>({authorId:R.authorId,name:I(R.authorId),state:R.state,since:R.since,activity:R.activity??null})),[p,I]),F=a.useMemo(()=>u.map(R=>{var j;const A=(j=C.data)==null?void 0:j.find(U=>U.id===R.behindRoomId);return{authorId:R.authorId,name:I(R.authorId),since:R.since,behind:{roomId:R.behindRoomId,title:A===void 0?null:se(A)},othersWaiting:R.othersWaiting,severalInTheWay:R.severalInTheWay}}),[u,I,C.data]),H=a.useMemo(()=>{const R=new Set;for(const A of u)_.get(A.authorId)===A.entryId&&R.add(A.authorId);return R},[u,_]),W=a.useMemo(()=>d===null?null:{authorId:d.authorId,name:I(d.authorId)},[d,I]),B=a.useMemo(()=>Ms({capabilities:ze,asks:L,agentNames:E,stalled:o,presence:q,held:F,silentFinish:W,turn:null}),[L,E,q,F,W,o]),z=a.useMemo(()=>{var A;const R=new Map;for(const j of((A=g.data)==null?void 0:A.bindings)??[])R.set(j.authorId,j.sessionId);return R},[g.data]),w=a.useCallback(R=>{const A=t.find(U=>U.id===R);if(A===void 0)return null;const j=A.body.text.replace(/\s+/gu," ").trim();return j.length===0?null:j.length>st?`${j.slice(0,st).trimEnd()}…`:j},[t]),v=a.useCallback(R=>{var A;return n==="thread"?Ae(R):((A=Fe(t,R))==null?void 0:A.domId)??null},[t,n]),P=a.useMemo(()=>{const R=p.map(j=>{const U=w(j.entryId),G=v(j.entryId);return{authorId:j.authorId,author:J(j.authorId,O,S.faces),state:j.state,since:j.since,doing:rs(j.activity),replyingTo:U===null||G===null?null:{entryId:j.entryId,excerpt:U,rowId:G},sessionId:z.get(j.authorId)??null}}),A=F.map(j=>({authorId:j.authorId,author:J(j.authorId,O,S.faces),state:"held",since:j.since,doing:null,replyingTo:null,sessionId:null,behind:j.behind,othersWaiting:j.othersWaiting}));return[...R,...A]},[p,F,O,S.faces,w,v,z]),M=a.useMemo(()=>{if(p.length===0)return null;const R=p.slice(0,Ne);return i.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[R.map(A=>i.jsx(vt,{author:J(A.authorId,O,S.faces),className:"ring-background size-4 ring-2"},A.authorId)),p.length>Ne&&i.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${p.length-Ne}`})]})},[p,O,S.faces]);return i.jsx(X.LiveLane,{state:B,scope:n,onRetry:l,unavailable:r,faces:M,onPeekOpenChange:f,askCard:B.kind==="ask"?i.jsx(as,{ask:B.ask,...E[B.ask.sessionId]?{agentName:E[B.ask.sessionId]}:{},onOpenSession:R=>{h(fe({session:R}))},className:"border-l-0"}):void 0,peek:i.jsx(X.LivePeek,{rows:P,onScrollToRow:c,onOpenSession:R=>{h(fe({session:R}))},onOpenRoom:R=>{h({...bt.channels(),search:{id:R}})},onAnswerFirst:R=>{const A=u.find(j=>j.authorId===R);A!==void 0&&D(j=>new Map(j).set(R,A.entryId)),T.mutate({roomId:e.id,authorId:R})},promoted:H,onStopAll:()=>y.mutate({roomId:e.id}),stopping:y.isPending,onStopAgent:b,stoppingAgents:N})})}const ot=3e3;function Lr(e,t,s,n=Date.now){const o=a.useRef(null),r=a.useRef(new Map),l=a.useRef(new Map),c=o.current,h=r.current,p=l.current,u=n();for(const d of e){if(p.has(d.id))continue;if(c===null){p.set(d.id,"at-rest");continue}const k=h.get(d.authorId);p.set(d.id,k!==void 0&&u-k<ot?"handed-off":"dropped")}return a.useEffect(()=>{if(!s)return;o.current=new Set(e.map(k=>k.id));const d=n();for(const k of t)r.current.set(k,d);for(const[k,f]of r.current)d-f>ot&&r.current.delete(k);for(const k of l.current.keys())o.current.has(k)||l.current.delete(k)}),p}function $r({kind:e}){return e==="thread-error"?i.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:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),i.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?i.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-sm"})]}):i.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 Fr({room:e,rootEntryId:t,focusComposer:s,entries:n,reactionFrequents:o,streamStalled:r,streamUnavailable:l,onRetryStream:c,historyLoaded:h,historyFailed:p=!1,landOnRow:u,pushed:d,onClose:k}){const f=a.useMemo(()=>$e(e.members,e.formerAuthors),[e.members,e.formerAuthors]),g=qt({room:e,threadRootId:t}),y=be(e.members,e.viewerAuthorId),x=qe(),N=a.useMemo(()=>new Map([...f].map(([w,v])=>[w,v.displayName])),[f]),{root:m,replies:b}=a.useMemo(()=>{let w;const v=[];for(const P of n)P.id===t?w=P:Z(P)===t&&v.push(P);return{root:w,replies:v}},[n,t]),T=m==null?void 0:m.threadReplyCount,_=T!==void 0&&T>b.length,D=m===void 0||_?-1:1+b.length,C=Le(b.length,T),S=a.useMemo(()=>new Set(b.map(w=>w.id)),[b]),O=a.useMemo(()=>({replyIds:S,inside:!0}),[S]),I=is(e.id,O),$=gt(e.id,t),L=Lr(b,I,h),E=a.useRef(null),q=a.useCallback(w=>{var v;(v=E.current)==null||v.scrollToRow(w)},[]),F=a.useRef(null);a.useEffect(()=>{var w;s||(w=F.current)==null||w.focus()},[t,s]);const H=w=>{w.key!=="Escape"||w.defaultPrevented||(w.stopPropagation(),k())},W=a.useMemo(()=>{const w=[];if(m===void 0){const v=p?"thread-error":h?"thread-orphan":"thread-waiting";w.push({kind:"notice",id:v,at:"",body:null})}else w.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:J(pe(m,f),f,x.faces),at:m.createdAt});for(const v of b)w.push({kind:"message",id:v.id,payload:v,grouping:{position:"only"},author:J(pe(v,f),f,x.faces),at:v.createdAt});return w},[m,b,f,x.faces,p,h]),B=a.useCallback(w=>{if(w.kind==="notice")return i.jsx($r,{kind:w.id});if(w.kind!=="message")return null;const v=w.payload,P=m!==void 0&&v.id===m.id,M=b.findIndex(j=>j.id===v.id),R=i.jsx(Ft,{roomId:e.id,entry:v,rowId:Ae(v.id),author:w.author,authorRef:f.get(v.authorId),authors:f,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:o,streamStalled:r,isMember:y,grouping:{position:"only"},answers:Pt(v,M<=0?m:b[M-1],j=>(m==null?void 0:m.id)===j?m:b.find(U=>U.id===j)),feedPosition:{index:P?1:(m===void 0?0:1)+M+1,total:D}});if(P)return C===0?R:i.jsxs(i.Fragment,{children:[R,i.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:[i.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:C===1?"1 reply":`${C} replies`}),i.jsx("span",{className:"bg-border h-px flex-1"})]})]});const A=L.get(v.id)??"at-rest";return i.jsx("div",{className:Q(A==="dropped"&&"motion-safe:animate-thread-reply-in",A==="handed-off"&&"motion-safe:animate-reply-settle"),children:R})},[m,b,C,L,e.id,e.viewerAuthorId,f,N,o,r,y,D]),z=a.useCallback(w=>w.kind==="message"?Ae(w.id):void 0,[]);return i.jsx(Dt,{known:x,children:i.jsx(X.Root,{surface:"room",capabilities:ze,target:g.target,anchor:"rail",children:i.jsxs("section",{ref:F,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:H,className:Q("bg-card flex min-h-0 flex-col outline-none",d?"h-full w-full":"w-full border-l"),children:[i.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[i.jsx("button",{type:"button",onClick:k,"aria-label":d?`Back to ${se(e)}`:"Close thread",className:Q("focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1","after:absolute after:-inset-2.5 md:after:hidden"),children:d?i.jsx(ls,{"aria-hidden":!0,className:"size-4"}):i.jsx(cs,{"aria-hidden":!0,className:"size-4"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"Thread"}),i.jsx("p",{className:"text-muted-foreground truncate text-xs",children:se(e)})]})]}),i.jsx(X.Timeline,{ref:E,conversationId:`thread-${t}`,label:`Thread in ${se(e)}`,busy:!h&&!p,rows:W,renderRow:B,domIdOf:z,...u===void 0?{}:{landOnRow:u},pending:$,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),i.jsx(Kt,{room:e,entries:n,scope:O,laneScope:"thread",stalled:d&&r===!0,unavailable:l,onRetry:d?c:void 0,onScrollToRow:q}),i.jsx(Wt,{room:e,threadRootId:t,attachments:g.attachments,focusOnMount:s},t)]})})})}const ve="room-thread-split",Br=320,qr=360,Hr=40,zr=50,Ur=25;function rt(e,t){return t<=0?Ur:Math.min(Math.round(e/t*1e3)/10,zr)}function Wr(e){const t=rt(Br,e),s=Math.round((100-rt(qr,e))*10)/10;return{minPct:t,maxPct:s,defaultPct:Math.min(Math.max(Hr,t),s)}}function Kr(e,t,s){if(e===null||t===null||t<=0)return s.defaultPct;const n=e/t*100;return Math.round(Math.min(Math.max(n,s.minPct),s.maxPct)*10)/10}function Gr(e){try{const t=localStorage.getItem(e),s=t===null?NaN:Number(t);return Number.isFinite(s)&&s>0?s:null}catch{return null}}function Vr(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}const Qr="react-resizable-panels:room-thread-split";function Yr(){try{localStorage.removeItem(Qr)}catch{}}function Jr(){const[e,t]=a.useState(null),[s,n]=a.useState(null);return{ref:a.useCallback(r=>{if(r===null)return;t(r);const l=()=>n(r.offsetWidth);l();const c=new ResizeObserver(l);return c.observe(r),()=>{c.disconnect(),t(null),n(null)}},[]),element:e,width:s,sizing:Wr(s??0)}}const Xr=`${ve}-room`,at=`${ve}-thread`,it=`${ve}-handle`,Zr=4;function ea({room:e,thread:t,storageKey:s=us.ROOM_THREAD_WIDTH}){const{ref:n,element:o,width:r,sizing:l}=Jr(),[c,h]=a.useState(()=>Gr(s)),[p,u]=a.useState(null),d=a.useRef(null),k=Kr(c,r,l),f=r===null||(l.maxPct-l.minPct)/100*r<Zr,g=t!==!1;a.useEffect(Yr,[]);const y=a.useRef(!1);a.useLayoutEffect(()=>{var b;y.current&&((b=d.current)==null||b.resize(k))},[k,g]);const x=a.useRef(null),N=()=>{var D;const b=(D=d.current)==null?void 0:D.getSize(),T=x.current;if(x.current=null,b===void 0||r===null||r<=0||T===b)return;const _=Math.round(b/100*r);h(_),Vr(s,_)},m=p??k;return a.useLayoutEffect(()=>{const b=o==null?void 0:o.querySelector(`[data-panel-resize-handle-id="${it}"]`);b&&(b.setAttribute("aria-controls",at),b.setAttribute("aria-valuenow",String(Math.round(m))),b.setAttribute("aria-valuemin",String(Math.round(l.minPct))),b.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),i.jsx("div",{ref:n,className:"h-full overflow-hidden",children:i.jsxs(ds,{direction:"horizontal",id:ve,onLayout:b=>{y.current=b.length>1,u(y.current?b[1]:null)},children:[i.jsx(Qe,{id:Xr,order:1,className:"flex",children:e}),g&&i.jsxs(i.Fragment,{children:[i.jsx(vs,{id:it,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:f,onDragging:b=>{var T;b&&(x.current=((T=d.current)==null?void 0:T.getSize())??null)},onKeyDownCapture:b=>{var T,_;f||(x.current=((T=d.current)==null?void 0:T.getSize())??null,!(b.key!=="Home"&&b.key!=="End")&&(b.preventDefault(),(_=d.current)==null||_.resize(b.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),i.jsx(Qe,{ref:d,id:at,order:2,defaultSize:k,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:t})]})]})})}function xa({roomId:e,threadId:t,entrySeq:s,threadRoute:n,aboveTimeline:o,aboveComposer:r,offerJumpBackIn:l,onComposerFocusChange:c}){const h=ms(),p=Rs(),u=fs(e),d=u==null?void 0:u.rootEntryId,k=hr(),f=a.useCallback(()=>{var P;const v=(P=Y.getState().open[e])==null?void 0:P.rootEntryId;Y.getState().closeThread(e),v!==void 0&&k.arm(v)},[e,k]),g=a.useCallback(v=>{Y.getState().openThread(e,v)},[e]),y=ps(e),x=hs(e),N=co(e,x.isSuccess);Ts(e);const m=y.data,b=a.useMemo(()=>x.data??[],[x.data]),T=qt({room:m});gr({roomId:e,route:n,urlThreadId:t,openThreadId:d,entries:b,historyLoaded:x.isSuccess});const _=a.useMemo(()=>{var v;return((v=m==null?void 0:m.members.find(P=>P.author.id===m.viewerAuthorId))==null?void 0:v.lastReadSeq)??null},[m]),D=mr(e,_);gs(m,b);const C=a.useRef(null),S=a.useRef(void 0),O=a.useCallback(v=>{S.current=v},[]),I=a.useCallback(()=>S.current,[]);a.useLayoutEffect(()=>{S.current=void 0},[e]);const $=a.useCallback(v=>{var P;(P=C.current)==null||P.scrollToRow(v)},[]),L=ho(e),{loadOlder:E,cursor:q}=L,F=a.useCallback(()=>{const v=To(b,q);E().then(()=>{v!==null&&requestAnimationFrame(()=>{var P;return(P=C.current)==null?void 0:P.scrollToRow(v.domId)})})},[b,q,E]),H=ur({roomId:e,entrySeq:s,entries:b,historyLoaded:x.isSuccess}),W=a.useMemo(()=>d===void 0?void 0:{replyIds:new Set(b.filter(P=>Z(P)===d).map(P=>P.id)),inside:!1},[b,d]);if(y.isLoading)return i.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:i.jsx(Bt,{})});if(y.isError||!m)return i.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),i.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const B=u!==void 0&&i.jsx(Fr,{room:m,rootEntryId:u.rootEntryId,focusComposer:u.focusComposer,entries:b,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:x.isSuccess,historyFailed:x.isError,...H.threadRow===void 0?{}:{landOnRow:H.threadRow},pushed:h,onClose:f},u.rootEntryId),z=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o,i.jsx(cr,{ref:C,roomId:m.id,roomName:se(m),viewerAuthorId:m.viewerAuthorId,entries:b,members:m.members,formerAuthors:m.formerAuthors,lastReadSeq:D,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,isLoading:x.isLoading,error:x.error,onAddAgents:()=>Ye("add",m.id),openThreadId:d,onOpenThread:g,resumeRow:I,...H.roomRow===void 0?{}:{landOnRow:H.roomRow},onTopRow:O,canLoadOlder:L.canLoadOlder,isLoadingOlder:L.isLoadingOlder,onLoadOlder:F}),r,i.jsx(Er,{roomId:m.id}),i.jsx(Or,{roomId:m.id}),i.jsx(Kt,{room:m,entries:b,scope:W,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:$}),i.jsx(_r,{room:m,hasEntries:b.length>0,onAddAgents:()=>Ye("add",m.id)}),i.jsx(Wt,{room:m,attachments:T.attachments,offerJumpBackIn:l,onFocusChange:c},m.id)]}),w={surface:"room",capabilities:ze,target:T.target,anchor:"rail"};return h?i.jsx(X.Root,{...w,children:i.jsx(Ce,{initial:!1,mode:"wait",children:i.jsx(Oe.div,{initial:{opacity:0,x:16},animate:{opacity:1,x:0},exit:{opacity:0,x:16},transition:{duration:.15,ease:[0,0,.2,1]},style:{paddingBottom:p},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:B===!1?z:B},B?`thread-${d}`:"room")})}):i.jsx(X.Root,{...w,children:i.jsx(ea,{room:z,thread:B})})}export{Tt as I,Bt as R,Io as T,xa as a,ie as i};
|
|
42
|
+
*/const Mt={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"}]]};Mt.node;const Js=ee(Mt),Xs=300;function ce({className:e,children:t}){return i.jsx("span",{className:Q("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 Ot({identity:e,children:t,onViewProfile:s,className:n}){const{kind:o,displayName:r,handle:l,color:c,emoji:h,imageUrl:p,origin:u,agent:d}=e,k=c??"hsl(var(--muted-foreground))",f=typeof u=="object"&&u!==null,g=o==="agent"&&(d==null?void 0:d.working)!=null?d.working:null,[y,x]=a.useState(!1),N=a.useRef(!1),m=a.useRef(null),b=Gt({onLongPress:()=>{N.current&&x(!0)}});return i.jsxs(Ds,{open:y,onOpenChange:x,openDelay:Xs,children:[i.jsx($s,{asChild:!0,ref:m,"data-gesture-priority":"",...b,onPointerDown:O=>{N.current=O.pointerType==="touch"||O.pointerType==="pen",b.onPointerDown(O)},children:t}),i.jsxs(Ls,{"data-slot":"identity-hover-card",align:"start",className:Q("flex w-64 flex-col gap-0 overflow-hidden p-0",n),children:[i.jsxs("div",{className:"flex items-center gap-3 p-3",children:[i.jsx(Vt,{"aria-hidden":!0,color:k,emoji:h,imageUrl:p,fallback:Qt(r),kind:o,origin:u,status:g?"working":"idle",size:"md"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:r}),l&&i.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",l]})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[o==="agent"&&((d==null?void 0:d.runtime)||(d==null?void 0:d.model))&&i.jsx(ce,{children:[d.runtime,d.model].filter(Boolean).join(" · ")}),g&&i.jsxs(ce,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Ps(g.forMs)]}),o==="human"&&i.jsx(ce,{children:f?u.platform:"On this machine"}),o==="agent"&&(d==null?void 0:d.managedBy)&&i.jsxs(ce,{children:["Managed by"," ",d.managedBy.handle?`@${d.managedBy.handle}`:d.managedBy.displayName]})]}),s?i.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var O;(O=m.current)==null||O.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"}):i.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[i.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),i.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function Tt(e,t={}){const s=te();return Yt({queryKey:K.sessions(e??""),queryFn:()=>s.listRoomSessions(e),enabled:e!==null&&t.enabled===!0})}function Zs(e,t){const s=e??[];return s.some(n=>n.seq===t.seq)?s:s.length===0||s[s.length-1].seq<t.seq?[...s,t]:[...s,t].sort((n,o)=>n.seq-o.seq)}function eo(e,t){const s=e??[],n=s.findIndex(c=>c.id===t.id);if(n===-1)return s;const o=s[n];if(o.seq!==t.seq||o.roomId!==t.roomId||JSON.stringify(o.body)===JSON.stringify(t.body)&&JSON.stringify(o.mentions)===JSON.stringify(t.mentions)&&JSON.stringify(o.mentionSpans)===JSON.stringify(t.mentionSpans))return s;const l=[...s];return l[n]={...o,body:t.body,mentions:t.mentions,mentionSpans:t.mentionSpans},l}function to(e,t){if(t.kind!=="notice"||t.body.notice!=="turn_failed")return;const s=t.body.subjectAuthorId;s!==void 0&&re.getState().clearAuthor(e,s)}function no(e,t){const s=e.getQueryData(K.entries(t));return s&&s.length>0?s[s.length-1].seq:0}function so(e,t){var s;return((s=e.getQueryData(K.detail(t)))==null?void 0:s.viewerAuthorId)??null}const oo=2e3;function ro(){const e=a.useRef(null),t=a.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),s=a.useCallback(o=>{t(),ne.getState().endRoomCanvasCycle(o)},[t]),n=a.useCallback(o=>{t(),e.current=setTimeout(()=>{e.current=null,ne.getState().endRoomCanvasCycle(o)},oo)},[t]);return a.useEffect(()=>t,[t]),{arm:n,now:s}}function ao(e){const t=Math.min(oe.BACKOFF_CAP_MS,oe.BACKOFF_BASE_MS*2**e);return Math.random()*t}const io=50;function lo(e,t){return new Promise(s=>{if(t.aborted)return s();const n=()=>{clearTimeout(o),t.removeEventListener("abort",n),s()},o=setTimeout(n,e);t.addEventListener("abort",n,{once:!0})})}function co(e,t){const s=te(),n=ye(),[o,r]=a.useState(null),[l,c]=a.useState(null),[h,p]=a.useState(0),u=a.useRef(!1),d=ro(),k=a.useCallback(()=>p(y=>y+1),[]),f=a.useRef(null),g=a.useCallback(()=>{f.current===null&&(f.current=setTimeout(()=>{f.current=null,p(y=>y+1)},io))},[]);return a.useEffect(()=>{if(e===null)return;const y=()=>g();let x=null;const N=()=>{if(document.visibilityState!=="visible"){x=Date.now();return}const O=x===null?0:Date.now()-x;x=null,(u.current||O>=oe.VISIBILITY_GRACE_MS)&&g()};let m=Ke.getListConnectionState();const b=Ke.subscribeListConnectionState(O=>{const T=O==="connected"&&m==="reconnecting";m=O,T&&g()});return window.addEventListener("online",y),document.addEventListener("visibilitychange",N),()=>{window.removeEventListener("online",y),document.removeEventListener("visibilitychange",N),b(),f.current!==null&&(clearTimeout(f.current),f.current=null)}},[e,g]),a.useEffect(()=>(ne.getState().setRoomCanvasLiveRoom(e),()=>ne.getState().setRoomCanvasLiveRoom(null)),[e]),a.useEffect(()=>{if(e===null||!t)return;const y=new AbortController;let x=!0,N;return(async()=>{r(null),c(null),u.current=!1;let m=0,b=!1;const O=()=>{m=0,u.current=!1,b&&(b=!1,r(T=>T===e?null:T))};for(;x&&!y.signal.aborted;){const T=Date.now();u.current=!1,ne.getState().beginRoomCanvasCycle(e),d.arm(e);const D=setTimeout(O,oe.STABILITY_WINDOW_MS);let C;try{if(C=Jt(s,e,no(n,e),y.signal),N=C,!x||y.signal.aborted){C.retire();return}for await(const S of C.stream){if(!x||y.signal.aborted||(O(),!C.current()))return;if(S.type==="canvas_event"||S.type==="canvas_channel_snapshot"){if(C.publish(S),!C.current())return;continue}if(S.type==="signal"){Xt(S)?Zt.getState().observe(e,S):(re.getState().observe(e,S),ne.getState().applyRoomCanvasPresence(e,S));continue}if(S.type==="reaction"){n.setQueryData(K.entries(e),E=>Ae(E,S.entryId,S.reactions));continue}if(S.type==="revision"){if(S.entry.roomId!==e)continue;n.setQueryData(K.entries(e),E=>eo(E,S.entry));continue}if(S.type==="canvas"){ne.getState().applyRoomCanvasFrame(e,S,so(n,e)),S.change!==void 0?d.now(e):d.arm(e);continue}re.getState().clearAuthor(e,S.entry.authorId),to(e,S.entry),en.getState().settle(e,S.entry.id),n.setQueryData(K.entries(e),E=>Zs(E,S.entry))}}catch(S){if(y.signal.aborted)return;if(console.warn("[rooms] live stream dropped",{roomId:e,err:S}),tn(S)){re.getState().clearRoom(e),c(e),r(e),clearTimeout(D);return}}finally{try{C==null||C.retire()}finally{clearTimeout(D)}}if(y.signal.aborted)return;Date.now()-T>=oe.STABILITY_WINDOW_MS&&(m=0),m+=1,u.current=!0,m>=oe.DISCONNECTED_THRESHOLD&&!b&&(re.getState().clearRoom(e),r(e),b=!0),await lo(ao(m),y.signal)}})(),()=>{x=!1;try{N==null||N.retire()}finally{y.abort()}}},[e,t,s,n,h]),{stalled:o!==null&&o===e,unavailable:l!==null&&l===e,retry:k}}function uo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.haltRoomAgent(t,s),meta:{errorLabel:"Couldn’t stop this agent"}})}function mo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.promoteHold(t,s),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function fo(){const e=te(),t=ye();return le({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var u;const l=t.getQueryData(K.entries(s)),c=(u=l==null?void 0:l.find(d=>d.id===n))==null?void 0:u.reactions,{reactions:h,on:p}=Je(c,o,r);return t.setQueryData(K.entries(s),d=>Ae(d,n,h)),{on:p}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var h,p;const l=t.getQueryData(K.entries(s)),c=((p=(h=l==null?void 0:l.find(u=>u.id===n))==null?void 0:h.reactions)==null?void 0:p.some(u=>u.emoji===o&&u.authorIds.includes(r)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:r,viewerAuthorId:l},c)=>{c!==void 0&&t.setQueryData(K.entries(n),h=>{var d;const p=(d=h==null?void 0:h.find(k=>k.id===o))==null?void 0:d.reactions,{reactions:u}=Je(p,r,l,!c.on);return Ae(h,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(K.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function Z(e){return e.threadRootEntryId??e.parentEntryId}function _t(e){return Z(e)??e.id}function $e(e,t){return Math.max(t??0,e)}function po(e,t,s){let n=e[0],o=0;for(const r of e)r.seq>n.seq&&(n=r),t!==null&&r.seq>t&&(o+=1);return{count:$e(e.length,s),lastAt:n.createdAt,unread:o}}function ho(e){const t=te(),s=ye(),n=nn(e),o=ke(u=>{var d;return e===null?null:((d=u.paging[e])==null?void 0:d.cursor)??null}),r=le({mutationFn:async u=>{var x;const d=(x=ke.getState().paging[u])==null?void 0:x.cursor;if(d==null)return;const k=await t.listRoomEntries(u,{before:d,limit:Ge}),f=K.entries(u),g=s.getQueryData(f),y=sn(g,k);s.setQueryData(f,y),ke.getState().notePage(u,on(k)??d,rn(k,Ge)||y.length===((g==null?void 0:g.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:l,isPending:c}=r,h=a.useRef(!1),p=a.useCallback(async()=>{if(!(e===null||h.current)){h.current=!0;try{await l(e).catch(()=>{})}finally{h.current=!1}}},[e,l]);return{canLoadOlder:n,isLoadingOlder:c,cursor:o,loadOlder:p}}function go(e){return i.jsx(Es,{code:e.code,isIncomplete:e.isIncomplete})}const xo=[{language:_s,component:go}],yo={turn_failed:{Icon:hn,tone:"text-status-warning"},agent_busy:{Icon:pn},agent_gone:{Icon:Js,tone:"text-status-warning"},agent_left:{Icon:Ze,tone:"text-status-warning"},room_archived:{Icon:fn},runtime_gone:{Icon:Vs,tone:"text-status-warning"},agent_paused:{Icon:mn},agent_declined:{Icon:qs},agent_unavailable:{Icon:un},awaiting_approval:{Icon:Ws,tone:"text-status-warning"},halted:{Icon:dn},budget_reached:{Icon:cn},cascade_stopped:{Icon:ln},addressing_changed:{Icon:Gs},bridge_blocked:{Icon:Bs,tone:"text-status-warning"},bridge_undelivered:{Icon:an,tone:"text-status-warning"},bridge_rate_limited:{Icon:Ys},bridge_second_agent_refused:{Icon:Ze},bridge_disconnected:{Icon:Ks},bridge_agent_swapped:{Icon:xs},bridge_history_note:{Icon:Fs}},bo={Icon:gn},we=80;function vo(e){const t=e.trim();if(t.length<=we)return t;const s=t.slice(0,we),n=s.lastIndexOf(" ");return`${(n>we/2?s.slice(0,n):s).trimEnd()}…`}function Ro(e,t,s){const n=ko(e,s),o=r=>i.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:r});return n===null?i.jsxs(i.Fragment,{children:[e," ",o("Open chat")]}):i.jsxs(i.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function ko(e,t){if(t!==void 0){const n=xn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=yn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function wo({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:r,tone:l}=(e.body.notice&&yo[e.body.notice])??bo;return i.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":vo(e.body.text)},...Pe(t),className:Q("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",l??"text-muted-foreground"),children:[i.jsx(r,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),i.jsx("span",{children:n?Ro(e.body.text,n,o):e.body.text})]})}const So=Hs.moment;function No({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:r}){const l=De(e.createdAt);return i.jsx("div",{id:r,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...Pe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:i.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[i.jsx(Ot,{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:i.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[i.jsx(vt,{author:s}),i.jsx("span",{className:"sr-only",children:s.displayName})]})}),i.jsx(So,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),i.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),l.length>0&&i.jsx("time",{dateTime:e.createdAt,title:Rt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:l})]})})}function Io({id:e,summary:t,open:s,onOpen:n}){const{capabilities:o}=kt(),{count:r,lastAt:l,unread:c}=t,h=De(l),[p,u]=a.useState({count:r,bumped:!1});p.count!==r&&u({count:r,bumped:!0});const d=p.count===r&&p.bumped;return o.threads?i.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":c>0?"":void 0,"aria-expanded":s,onClick:n,className:Q("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",c>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[i.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),i.jsx("span",{className:Q(d&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:r},r),r===1?" reply":" replies",h.length>0&&i.jsxs(i.Fragment,{children:[" · last ",i.jsx("time",{dateTime:l,title:Rt(l),children:h})]}),c>0&&` · ${c} new`]}):null}function Co(e,t){const s=ue.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
|
|
43
|
+
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function Ao({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const r=_t(t),l=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,h=s==null?void 0:s.displayName,{copy:p}=bn({toastOnSettle:!0});return a.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Qs,run:()=>{Y.getState().openThread(e,r,!0),Ve.getState().requestFocus(lt(e,r))}},copy:{id:"copy",label:"Copy text",icon:vn,run:()=>void p(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:Rn,run:o}),c!==void 0&&(u.mention={id:"mention",label:h===void 0?"Mention author":`Mention ${h}`,icon:ys,run:()=>{Co(e,c),Ve.getState().requestFocus(e)}}),ks.map(d=>u[d]).filter(d=>d!==void 0)},[e,r,l,c,h,o,p])}function jo(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function Le(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 pe(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function J(e,t,s){const n=t.get(e),o=ct({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 Mo(e){const t=new Set;for(const r of e)Z(r)===null&&t.add(r.id);const s=[],n=new Map,o=new Set;for(const r of e){const l=Z(r);if(l===null){s.push(r);continue}if(!t.has(l)){s.push(r),o.add(r.id);continue}const c=n.get(l);c?c.push(r):n.set(l,[r])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Et(e){return`thread-${e}`}function he(e){return`thread-row-${e}`}function je(e){return`thread-panel-entry-${e}`}function ge(e){return`room-entry-${e}`}function Fe(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=Z(s)??null,o={rowId:t,domId:ge(t)};if(n===null)return o;const r=e.find(c=>c.id===n);return r!==void 0&&(Z(r)??null)===null?{rowId:Et(n),domId:he(n)}:o}function Oo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Fe(e,s.id)}const et=48;function Pt(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 r=o.body.text.replace(/\s+/gu," ").trim();return r.length===0?null:{entryId:n,excerpt:r.length>et?`${r.slice(0,et).trimEnd()}…`:r}}function To(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const r=kn({runtime:o.runtime,model:o.model});s.set(dt(n.projectPath),{memberId:n.id,visual:wn(o),runtime:r.label,...r.modelLabel!==null&&{model:r.modelLabel}})}return s}function _o(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Eo={info:new Map,faces:new Map},Be=a.createContext(Eo);function Dt({known:e,children:t}){return i.jsx(Be.Provider,{value:e,children:t})}function qe(){const e=ut(),t=a.useMemo(()=>{var l;return((l=e.data)==null?void 0:l.agents)??[]},[e.data]),s=a.useMemo(()=>t.map(l=>l.projectPath),[t]),n=mt(s),o=a.useMemo(()=>To(t,n.data??{}),[t,n.data]),r=a.useMemo(()=>_o(o),[o]);return a.useMemo(()=>({info:o,faces:r}),[o,r])}function Me(e){const t=a.useContext(Be);return e===void 0?void 0:t.info.get(e)}function Po(){return a.useContext(Be).faces}function Do({loading:e,onLoad:t}){return i.jsx("div",{className:"flex justify-center px-4 py-3",children:i.jsxs(Te,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&i.jsx(Sn,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}function $o({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:r,summaryId:l,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?r:l,...Pe(c)}}const me=120,Lo="code block";function Fo(e){if(e.length<=me&&!e.includes("```"))return null;const t=Bo(e);return t.length===0?null:t}function Bo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Lo} `).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<=me)return t;const s=qo(t,me),n=s.lastIndexOf(" ");return`${(n>me/2?s.slice(0,n):s).trimEnd()}…`}function qo(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:r}of n.segment(e)){if(o.length+r.length>t)break;o+=r}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function Ho({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:r=!0}){const l=fo(),c=o===!0||!r,h=a.useMemo(()=>t.reactions??[],[t.reactions]),p=a.useMemo(()=>h.filter(k=>ws(k,s)).map(k=>k.emoji),[h,s]),u=a.useCallback(k=>l.mutate({roomId:e,entryId:t.id,emoji:k,viewerAuthorId:s}),[l,e,t.id,s]),d=a.useMemo(()=>({quick:n,mine:p,onToggle:u,disabled:c}),[n,p,u,c]);return{reactions:h,toggle:u,quickRow:d}}function zo({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var r,l;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(r=t.current)==null||r.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(l=e.current)==null||l.focusFirst())}}function Uo(e,t){var d,k;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Nn.includes(n),r=Tt(e,{enabled:o}),l=_e(),c=ye(),h=te(),p=o?((k=(d=r.data)==null?void 0:d.bindings.find(f=>f.authorId===s))==null?void 0:k.sessionId)??null:null,u=a.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(p===null||s===void 0)&&In({queryClient:c,transport:h},e,s).then(g=>{g.kind!=="none"&&l(fe({session:g.kind==="bound"?g.sessionId:p}))}))},[s,l,c,e,p,h]);return a.useMemo(()=>p===null?null:{href:Cn({session:p}),onOpen:u},[u,p])}const xe="mention",He="author_id",Wo={[xe]:[He]},Ko=[xe];function Go(e,t){if(!t||t.length===0)return e;const s=Vo(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:r,length:l,authorId:c}=s[o],h=n.slice(0,r),p=n.slice(r,r+l),u=n.slice(r+l);n=`${h}<${xe} ${He}="${c}">${p}</${xe}>${u}`}return n}function Vo(e,t){const s=[...t].sort((r,l)=>r.offset-l.offset),n=[];let o=0;for(const r of s)r.offset<o||r.offset+r.length>e.length||(n.push(r),o=r.offset+r.length);return n}const Qo=new Map,$t=a.createContext(Qo);function Yo({authors:e,children:t}){return i.jsx($t.Provider,{value:e,children:t})}function Jo(e){const t=a.useContext($t);return e===void 0?void 0:t.get(e)}function Xo(e){return typeof e=="string"?e.replace(/^@/,""):""}function Zo({authorId:e,children:t}){const s=Jo(e),n=Me(s==null?void 0:s.agentRef),{open:o}=ft();if(!s)return i.jsx(Xe,{kind:"human",label:Xo(t),resolved:!1});const r=ct({record:s,override:n==null?void 0:n.visual}),l=pt(s,n==null?void 0:n.memberId),c=l===void 0?void 0:()=>o(l),h=c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),c())}}:{};return i.jsx(Ot,{onViewProfile:c,identity:{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:r.color,emoji:r.emoji,imageUrl:r.imageUrl,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}},children:i.jsx(Xe,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...h})})}function er(e){return{mention:t=>{const s=t[He],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?i.jsx(i.Fragment,{children:t.children}):i.jsx(Zo,{authorId:n,children:t.children})}}}function tr({entry:e,authors:t}){const s=a.useMemo(()=>Go(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=a.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(l=>l.authorId))??[])},[e.mentionSpans]),o=a.useMemo(()=>er(n),[n]);return i.jsx(Yo,{authors:t,children:i.jsx(Ts,{content:s,className:"msg-prose",allowedTags:Wo,literalTagContent:Ko,components:o,renderers:xo})})}function nr(e){return function(s){return i.jsx(tr,{entry:s,authors:e})}}const Lt="the top folder";function tt(e){return e.slice(e.lastIndexOf("/")+1)}function sr(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function or(e){return e===""?Lt:`${e}/`}function Se(e){return e.target!==void 0?e.target===""?Lt:e.target:or(sr(e.paths[0]??""))}function rr(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 ${tt(s)} to ${Se(e)}`:`${t} uploaded ${e.pathCount} files to ${Se(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 ${tt(s)} from the chat to ${Se(e)}`}}const ar=a.lazy(()=>An(()=>import("./index-DKDK-3KH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.SaveToRoomFilesButton})));function Ft({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:r,authorNames:l,reactionFrequents:c,streamStalled:h,isMember:p=!0,grouping:u,orphanedReply:d,answers:k,feedPosition:f,rowId:g}){const y=De(t.createdAt),x=a.useMemo(()=>{const G=Fo(t.body.text),Re=Ss(t.attachments??[]);if(Re===null)return G;const We=G??t.body.text.trim();return We.length>0?`${We} ${Re}`:Re},[t.body.text,t.attachments]),N=a.useId(),m=`${N}-author`,b=`${N}-content`,O=`${N}-summary`,T=a.useRef(null),D=a.useRef(null),C=a.useRef(null),{reactions:S,toggle:E,quickRow:I}=Ho({roomId:e,entry:t,viewerAuthorId:r,reactionFrequents:c,streamStalled:h,isMember:p}),L=Me(n==null?void 0:n.agentRef),{open:$}=ft(),_=n===void 0?void 0:pt(n,L==null?void 0:L.memberId),q=a.useCallback(()=>{_!==void 0&&$(_)},[$,_]),F=_===void 0?void 0:q,H=Ao({roomId:e,entry:t,author:n,viewerAuthorId:r,onViewProfile:F}),W=zo({barRef:D,pillsRef:C,hasReactions:S.length>0}),B=a.useCallback(()=>{var G;return(G=T.current)==null?void 0:G.focus()},[]),z=a.useMemo(()=>nr(o),[o]),w=a.useCallback(G=>i.jsx(a.Suspense,{fallback:null,children:i.jsx(ar,{roomId:e,attachment:G})}),[e]),v=Po(),P=t.body.subjectAuthorId??t.authorId,M=o.get(P),R=Me(M==null?void 0:M.agentRef),j=Uo(e,t),A=jo(t);if(A.kind==="notice")return i.jsx(wo,{entry:t,feedPosition:f,rowId:g,sessionLink:j,subjectName:M==null?void 0:M.displayName});if(A.kind==="moment")return i.jsx(No,{entry:t,moment:A.moment,subject:P===t.authorId?s:J(P,o,v),subjectIdentity:{handle:(M==null?void 0:M.handle)??void 0,origin:M==null?void 0:M.origin,agent:R&&{runtime:R.runtime,...R.model&&{model:R.model}}},feedPosition:f,rowId:g});const U=u.position==="first"||u.position==="only";return i.jsxs(V.Root,{ref:T,id:g,position:u.position,actions:H,reactions:I,"data-testid":"room-entry",tabIndex:0,...$o({showAuthorHeader:U,headerId:m,displayName:s.displayName,time:y,summary:x,contentId:b,summaryId:O,feedPosition:f}),onKeyDown:W,children:[i.jsx(V.Gutter,{author:s,at:t.createdAt,onViewProfile:F,isSelf:t.authorId===r}),i.jsxs(V.Body,{children:[i.jsx(V.Author,{id:m,author:s,at:t.createdAt,origin:n==null?void 0:n.origin}),d===!0&&i.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),k!=null&&i.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${k.excerpt}”`}),i.jsx(V.Content,{id:b,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:t.body.fileChange?i.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:rr(t.body.fileChange,(M==null?void 0:M.displayName)??"Somebody")}):z(t,{rowId:t.id,isStreaming:!1})}),x!==null&&i.jsx("span",{id:O,className:"hidden",children:x}),i.jsx(V.Attachments,{items:t.attachments??[],renderAction:p?w:void 0}),i.jsx(V.Reactions,{ref:C,reactions:S,viewerAuthorId:r,names:l,frequents:c,onToggle:E,disabled:h===!0||!p,onExit:B}),i.jsx(V.Actions,{actions:H,reactions:I,barRef:D,onExit:B})]})]})}const ir="room-load-older",lr=4;function Bt({roomName:e}){return i.jsx(Ns,{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:lr},(t,s)=>i.jsxs("div",{className:"flex gap-3",children:[i.jsx(ae,{className:"size-7 shrink-0 rounded-full"}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${s}`))})}function cr({roomId:e,roomName:t,viewerAuthorId:s,entries:n,members:o,formerAuthors:r,lastReadSeq:l,reactionFrequents:c,streamStalled:h,isLoading:p,error:u,onAddAgents:d,openThreadId:k,onOpenThread:f,resumeRow:g,landOnRow:y,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:m=!1,onLoadOlder:b,ref:O}){const T=a.useMemo(()=>Le(o,r),[o,r]),D=be(o,s),C=qe(),S=a.useMemo(()=>new Map([...T].map(([v,P])=>[v,P.displayName])),[T]),E=ht(),I=gt(e,null),{topLevel:L,repliesByRoot:$,orphaned:_}=a.useMemo(()=>Mo(n),[n]),q=a.useMemo(()=>new Map(n.map(v=>[v.id,v])),[n]),F=a.useMemo(()=>{const v=jn(L,l),P=Mn(L.map(R=>({id:R.id,authorId:R.body.moment?`moment:${R.id}`:R.authorId,timestamp:R.createdAt})),{now:E,lastSeenId:v.lastSeenId,unreadFromStart:v.fromStart}),M=[];N&&!p&&M.push({kind:"load-older",id:ir});for(const R of P){if(R.kind==="day-divider"){M.push({kind:"day-divider",id:R.key,label:R.label});continue}if(R.kind==="unread-divider"){M.push({kind:"unread-divider",id:R.key});continue}const j=L[R.index];M.push({kind:"message",id:j.id,entry:j,grouping:R.grouping,position:R.index+1,answers:Pt(j,L[R.index-1],q.get.bind(q))});const A=$.get(j.id);A&&M.push({kind:"thread-reply",id:Et(j.id),rootId:j.id,replies:A,totalReplies:j.threadReplyCount})}return M},[L,$,q,l,E,N,p]),H=a.useMemo(()=>F.map(v=>v.kind==="load-older"?{kind:"notice",id:v.id,at:"",body:null}:v.kind==="day-divider"?{kind:"day-divider",id:v.id,label:v.label}:v.kind==="unread-divider"?{kind:"unread-divider",id:v.id}:v.kind==="thread-reply"?{kind:"thread-reply",id:v.id,rootId:v.rootId,replyCount:$e(v.replies.length,v.totalReplies),lastAt:v.replies[v.replies.length-1].createdAt}:{kind:"message",id:v.id,payload:v.entry,grouping:v.grouping,author:J(pe(v.entry,T),T,C.faces),at:v.entry.createdAt}),[F,T,C.faces]),W=a.useCallback((v,P)=>{const M=F[P.index];if(M.kind==="load-older")return b===void 0?null:i.jsx(Do,{loading:m,onLoad:b});if(M.kind==="day-divider")return i.jsx(Is,{label:M.label});if(M.kind==="unread-divider")return i.jsx(Cs,{});if(M.kind==="thread-reply"){if(P.onOpenThread===void 0)return null;const j=P.onOpenThread;return i.jsx(Io,{id:he(M.rootId),summary:po(M.replies,l,M.totalReplies),open:k===M.rootId,onOpen:()=>j(M.rootId)})}const R=pe(M.entry,T);return i.jsx(Ft,{roomId:e,entry:M.entry,author:J(R,T,C.faces),authorRef:T.get(R),authors:T,viewerAuthorId:s,authorNames:S,reactionFrequents:c,streamStalled:h,isMember:D,grouping:M.grouping,orphanedReply:_.has(M.entry.id),answers:M.answers,feedPosition:{index:M.position,total:-1},rowId:ge(M.entry.id)})},[F,e,T,C.faces,s,S,c,h,D,_,l,k,m,b]),B=a.useCallback(v=>{if(v.kind==="message")return ge(v.id);if(v.kind==="thread-reply")return he(v.rootId)},[]);if(u)return i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),i.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const z=o.some(v=>v.author.kind==="agent"),w=i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx(On,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),i.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),i.jsx("p",{className:"max-w-sm",children:z?"Say something to get it going.":"Nothing answers until you add an agent."}),i.jsx(Te,{type:"button",size:"sm",variant:z?"ghost":"default",onClick:d,className:"mt-1",children:z?"Add more agents":"Add agents"})]});return i.jsx(Dt,{known:C,children:i.jsx(X.Timeline,{ref:O,conversationId:e,label:`Messages in ${t}`,rows:H,renderRow:W,onOpenThread:f,domIdOf:B,...g===void 0?{}:{resumeRow:g},...y===void 0?{}:{landOnRow:y},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:p?i.jsx(Bt,{roomName:t}):void 0,empty:w,feedTestId:"room-timeline"})})}const ze={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function dr(e){const t=te(),[s,n]=a.useState([]),o=a.useRef(new Map),r=a.useCallback(f=>{const g=f.map(y=>({id:crypto.randomUUID(),file:y,status:"pending",progress:0}));n(y=>[...y,...g])},[]),l=a.useCallback(f=>{o.current.delete(f),n(g=>g.filter(y=>y.id!==f))},[]),c=a.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const g=new Set(f);for(const y of g)o.current.delete(y);n(y=>y.filter(x=>!g.has(x.id)))},[]),h=a.useCallback(f=>{o.current.delete(f),n(g=>g.map(y=>y.id===f&&y.status==="error"?{...y,status:"pending",progress:0,error:void 0}:y))},[]),p=a.useRef(null),u=le({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(N=>N.map(m=>f.some(b=>b.id===m.id)?{...m,status:"uploading"}:m));const g=N=>{n(m=>m.map(b=>b.status==="uploading"?{...b,progress:N.percentage}:b))},y=new AbortController;p.current=y;const x=f.map(N=>N.file);return t.uploadRoomAttachments(e,x,g,y.signal)},onSettled:()=>{p.current=null},onSuccess:(f,g)=>{g.forEach((y,x)=>{const N=f[x];N&&o.current.set(y.id,N.id)}),n(y=>y.map(x=>g.findIndex(m=>m.id===x.id)===-1?x:{...x,status:"uploaded",progress:100}))},onError:f=>{n(g=>g.map(y=>y.status==="uploading"?{...y,status:"error",error:f.message}:y))}}),d=a.useCallback(()=>{var f;(f=p.current)==null||f.abort()},[]),k=a.useCallback(async()=>{const f=s.filter(y=>y.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 g=s.filter(y=>y.status==="pending");return g.length>0&&await u.mutateAsync(g),s.map(y=>o.current.get(y.id)).filter(y=>y!==void 0)},[s,u]);return{pendingFiles:s,addFiles:r,removeFile:l,retryFile:h,clearFiles:c,cancelUpload:d,uploadAndGetIds:k,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function qt(e){const{room:t,threadRootId:s}=e,n=As(),o=js(),r=dr((t==null?void 0:t.id)??""),l=t!==void 0&&be(t.members,t.viewerAuthorId),c=a.useRef({attachments:r,post:n,reply:o,room:t,threadRootId:s});a.useEffect(()=>{c.current={attachments:r,post:n,reply:o,room:t,threadRootId:s}});const h=a.useCallback(m=>c.current.attachments.addFiles(m),[]),p=a.useCallback(m=>c.current.attachments.removeFile(m),[]),u=a.useCallback(m=>c.current.attachments.retryFile(m),[]),d=a.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:k,hasFailedUpload:f,isUploading:g}=r,y=a.useMemo(()=>({staged:k,add:h,remove:p,retry:u,cancel:d,hasFailed:f,isUploading:g,holdsSendWhileUploading:!1}),[k,f,g,h,p,u,d]),x=a.useCallback(async m=>{const{attachments:b,post:O,reply:T,room:D,threadRootId:C}=c.current;if(D===void 0)throw new Error("That room isn’t loaded yet.");if(D.archived)throw new Error("This room is archived.");Ie.getState().recordOpened("room",D.id);const S=Tn(),E=b.pendingFiles.map(_=>_.file.name),I=b.pendingFiles.map(_=>_.id),L=await b.uploadAndGetIds();b.clearFiles(I);const $=m.parentEntryId??C;if($!==void 0){T.mutate({roomId:D.id,rootEntryId:$,text:m.text,clientId:S,attachmentIds:L,attachmentNames:E});return}O.mutate({roomId:D.id,text:m.text,clientId:S,attachmentIds:L,attachmentNames:E})},[]);return{target:a.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&&l,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:l?{}:{canSendReason:xt},send:x,attachments:y}),[t,s,l,y,x]),attachments:r}}function ur(e){const{roomId:t,entrySeq:s,entries:n,historyLoaded:o}=e,r=s===void 0?null:`${t}:${s}`,l=a.useMemo(()=>{if(s===void 0)return null;const g=n.find(m=>m.seq===s);if(g===void 0)return null;const y=Fe(n,g.id);if(y===null)return null;const x=Z(g)??null,N=x!==null&&y.rowId!==g.id;return{roomRowId:y.rowId,threadRootId:N?x:null,entryId:g.id}},[n,s]),c=a.useRef(null),h=(l==null?void 0:l.threadRootId)??null;a.useEffect(()=>{r===null||h===null||c.current!==r&&(c.current=r,Y.getState().openThread(t,h))},[r,t,h]);const p=a.useRef(null);a.useEffect(()=>{r===null||!o||l===null&&p.current!==r&&(p.current=r,yt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=a.useRef(null),d=a.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),k=a.useRef(null),f=a.useCallback(()=>{if(!(r===null||k.current===r))return k.current=r,(l==null?void 0:l.threadRootId)===null||l==null?void 0:l.entryId},[r,l]);return{roomRow:s===void 0?void 0:d,threadRow:s===void 0?void 0:f}}function mr(e,t){const[s,n]=a.useState({roomId:null,seq:null});return s.roomId===e?s.seq:e===null?(n({roomId:null,seq:null}),null):t===null?null:(n({roomId:e,seq:t}),t)}const fr=600;function pr(e){return document.getElementById(he(e))??document.getElementById(ge(e))}function hr(){const e=a.useRef(null);return a.useEffect(()=>()=>{var s;return(s=e.current)==null?void 0:s.call(e)},[]),{arm:a.useCallback(s=>{var c;(c=e.current)==null||c.call(e);let n=0;const o=Date.now()+fr;let r=!1;const l=()=>{if(r)return;const h=document.activeElement;if(h===null||h===document.body||!h.isConnected){const u=pr(s);if(u!==null){u.focus();return}}Date.now()>=o||(n=requestAnimationFrame(l))};n=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(n)}},[])}}function gr({roomId:e,route:t,urlThreadId:s,openThreadId:n,entries:o,historyLoaded:r}){const l=_n(),c=a.useRef(null);a.useEffect(()=>{if(e!==null){if(c.current!==e&&(c.current=e,s!==void 0)){Y.getState().openThread(e,s);return}if(r&&n!==void 0){const h=o.find(u=>u.id===n),p=h===void 0?void 0:_t(h);if(p!==void 0&&p!==n){const u=Y.getState().open[e];Y.getState().openThread(e,p,(u==null?void 0:u.focusComposer)??!1);return}}n!==s&&(l==null||l({to:t,search:h=>({...h,thread:n}),replace:!0}))}},[e,t,n,s,o,r,l])}const xr=6,Ht="jump-back-in-listbox";function Ue(e){return`jump-back-in-item-${e}`}const yr='[role="combobox"]';function ie(e){return e instanceof Element&&e.matches(yr)}function br({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=_e(),o=En(),[r,l]=a.useState(!1),[c,h]=a.useState({stamp:"",index:0}),[p,u]=a.useState(!1),[d,k]=a.useState(!1);e.length>0&&!d&&k(!0);const f=a.useRef(!1);a.useEffect(()=>{f.current=!0},[]);const{data:g}=ut({enabled:s}),y=a.useMemo(()=>((g==null?void 0:g.agents)??[]).map(w=>w.projectPath),[g]),{data:x}=mt(y,{enabled:s}),N=a.useMemo(()=>x??{},[x]),m=a.useMemo(()=>Pn(y,N),[y,N]),b=a.useMemo(()=>new Map(y.map(w=>[dt(w),w])),[y]),O=a.useCallback(w=>Dn({room:w,agentsByPath:N,pathByAgentRef:b}),[N,b]),T=a.useMemo(()=>$n(o.muted),[o.muted]),{items:D}=bs({mutedRoomIds:T,enabled:s}),C=a.useMemo(()=>D.slice(0,xr),[D]),S=s&&r&&!p&&!d&&!t&&e.length===0&&C.length>0,E=`${S}:${C.length}`,I=c.stamp===E?c.index:0,L=a.useCallback(w=>{f.current&&ie(w.target)&&(u(!1),k(!1),l(!0))},[]),$=a.useCallback(w=>{ie(w.target)&&l(!0)},[]),_=a.useCallback(w=>{ie(w.target)&&l(!1)},[]),q=a.useCallback(w=>{C.length!==0&&h(v=>{const P=v.stamp===E?v.index:0;return{stamp:E,index:(P+w+C.length)%C.length}})},[C.length,E]),F=a.useCallback(()=>q(1),[q]),H=a.useCallback(()=>q(-1),[q]),W=a.useCallback(()=>{u(!0)},[]),B=a.useCallback(w=>{if(u(!0),w.kind==="session"){w.session.cwd&&Ie.getState().recordOpened("agent",w.session.cwd),n(fe({dir:w.session.cwd??void 0,session:w.session.id}));return}Ie.getState().recordOpened("room",w.room.id),n({...bt.channels(),search:{id:w.room.id}})},[n]),z=a.useCallback(()=>{const w=C[I];!S||!w||B(w)},[S,C,I,B]);return{isOpen:S,hasRows:C.length>0,rows:C,agents:N,displayNames:m,visualOf:O,selectedIndex:I,activeDescendantId:S&&C[I]!==void 0?Ue(I):void 0,listboxId:S?Ht:void 0,handleFocus:L,handleBlur:_,handlePointerDown:$,moveDown:F,moveUp:H,selectHighlighted:z,selectRow:B,dismiss:W}}function zt({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:r,isSelected:l,now:c,onSelect:h}){const p=a.useMemo(()=>Number.isNaN(Date.parse(o))?null:zn(o),[o,c]);return i.jsxs("div",{id:Ue(r),role:"option","aria-selected":l,"data-selected":l,title:s,onClick:h,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:[i.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),i.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[i.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),p!==null&&i.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:p})]}),n!==null&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function vr({item:e,agent:t,displayName:s,index:n,isSelected:o,now:r,onSelect:l}){const c=Ln(t,e.session.cwd??s);return i.jsx(zt,{mark:i.jsx(Fn,{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:r,onSelect:l})}function Rr({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:r}){return i.jsx(zt,{mark:i.jsx(qn,{room:e.room,participants:e.room.participants,visuals:Hn(t)}),label:i.jsx(Bn,{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:r})}function kr({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:r}){const l=ht(6e4);return a.useEffect(()=>{var c,h;(h=(c=document.getElementById(Ue(t)))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"})},[t]),i.jsx(Ee.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:i.jsx("div",{id:Ht,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,h)=>{var p;return c.kind==="session"?i.jsx(vr,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((p=c.session.cwd)==null?void 0:p.split("/").pop())||"Agent",index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`session-${c.id}`):i.jsx(Rr,{item:c,visual:o(c.room),index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`room-${c.id}`)})})})}const nt={people:"People",agents:"Agents"},wr=["people","agents"];function Sr(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 Nr(e,t,s){const n=t.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:Ir(r,n)})).filter(r=>r.tier!==null).sort((r,l)=>r.tier-l.tier||r.position-l.position);return s.flatMap(r=>o.filter(l=>l.row.section===r).map(({row:l})=>l))}function Ir(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(r=>r!==void 0);let n=null;for(const r of s){const l=r===t?0:r.startsWith(t)?1:r.includes(t)?2:null;l!==null&&(n===null||l<n)&&(n=l)}return n}function de(e,t,s){var r;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let l=0;l<n;l++){if(!((r=e[o])!=null&&r.disabled))return o;o=(o+s+n)%n}return 0}function Cr(e,t,s,n){const o=e.slice(0,t),r=e.slice(t+1+s.length),l=`@${n}`,c=r.startsWith(" ")?"":" ";return{value:o+l+c+r,cursorPos:o.length+l.length+1}}const Ar=/(^|\s)@([A-Za-z0-9_.-]*)$/,Ut="mention-palette-listbox";function Oe(e){return`mention-item-${e}`}function jr({members:e,viewerAuthorId:t,text:s,sectionOrder:n=wr}){var $;const[o,r]=a.useState(!1),[l,c]=a.useState(""),[h,p]=a.useState(-1),u=Un(s),d=a.useRef(!1),k=a.useMemo(()=>Sr(e,t),[e,t]),f=a.useMemo(()=>o?Nr(k,l,n):[],[k,l,o,n]),[g,y]=a.useState(null),x=g!==null&&g.query===l&&g.open===o?g.index:de(f,0,1),N=f[x],m=f.length===0||N!==void 0&&!N.disabled?x:de(f,0,1),b=a.useCallback((_,q)=>{const F=_.slice(0,q).match(Ar);if(!F){r(!1);return}r(!0),c(F[2]),p((F.index??0)+F[1].length)},[]),O=a.useCallback(_=>{u.write(_),d.current=!1},[u]),T=a.useCallback(_=>{d.current||b(u.read(),_)},[b,u]),D=a.useCallback(()=>{y({query:l,open:o,index:de(f,m+1,1)})},[f,m,l,o]),C=a.useCallback(()=>{y({query:l,open:o,index:de(f,m-1,-1)})},[f,m,l,o]),S=a.useCallback(_=>_.disabled||_.handle===void 0?null:(d.current=!0,r(!1),Cr(u.read(),h,l,_.handle)),[h,l,u]),E=a.useCallback(()=>{const _=f[m];return _?S(_):(r(!1),null)},[f,m,S]),I=a.useCallback(()=>{d.current=!0,r(!1)},[]),L=f.some(_=>!_.disabled);return{isOpen:o,hasSelectableRows:L,rows:f,selectedIndex:m,activeDescendantId:o&&(($=f[m])==null?void 0:$.disabled)===!1?Oe(m):void 0,listboxId:o?Ut:void 0,noteTextChange:O,handleCursorChange:T,moveDown:D,moveUp:C,selectHighlighted:E,selectRow:S,dismiss:I}}function Mr({rows:e,selectedIndex:t,onSelect:s}){const n=a.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const c=o[o.length-1];c&&c.section===r.section?c.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return a.useEffect(()=>{var o;(o=document.getElementById(Oe(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),i.jsx(Ee.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:i.jsx("div",{id:Ut,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?i.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:r},l)=>i.jsxs("div",{role:"group","aria-label":nt[o],children:[l>0&&i.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),i.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:nt[o]}),r.map(({row:c,index:h})=>{const p=h===t;return i.jsxs("div",{id:Oe(h),role:"option","aria-selected":p,"aria-disabled":c.disabled,"data-selected":p,"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:[i.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),i.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&i.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function Wt({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:r}){const l=t===void 0?e.id:lt(e.id,t),c=Wn(l),{target:h}=kt(),p=Kn(),u=Gn(l),d=a.useRef(null),k=be(e.members,e.viewerAuthorId),f=a.useRef(!1),g=jr({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),y=n===!0,x=br({value:c,yieldToPalette:g.isOpen,enabled:y}),N=a.useRef(u);a.useEffect(()=>{var I;u!==N.current&&(N.current=u,(I=d.current)==null||I.focus())},[u]),a.useEffect(()=>{var I;s===!0&&((I=d.current)==null||I.focusUnlessTouch())},[]);const m=a.useCallback(I=>ue.getState().set(l,I),[l]),[b,O]=a.useState(null);a.useLayoutEffect(()=>{var I;b!==null&&((I=d.current)==null||I.focusAt(b.pos))},[b]);const T=a.useCallback(I=>{I&&(m(I.value),O({pos:I.cursorPos}))},[m]),D=a.useCallback(I=>T(g.selectRow(I)),[g,T]),C=a.useCallback(()=>T(g.selectHighlighted()),[g,T]),S=()=>{if(h===null||!h.canSend||f.current)return;g.dismiss();const I=ue.getState().take(l).trim();if(I==="")return;const L=r.pendingFiles.length>0;L&&(f.current=!0),h.send({text:I}).catch(()=>{const $=ue.getState(),_=$.drafts[l]??"";$.set(l,_===""?I:`${I}
|
|
44
|
+
${_}`)}).finally(()=>{L&&(f.current=!1)})};if(!k)return i.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:xt}),i.jsx(Te,{type:"button",size:"sm",variant:"outline",disabled:p.isPending,onClick:()=>p.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>yt.success(`You joined ${se(e)}`)}),children:Vn})]});const E=i.jsx(X.Composer,{inputRef:d,value:c,onChange:I=>{m(I),g.noteTextChange(I)},onSubmit:S,head:i.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g.isOpen&&g.rows.length===0?"No one by that name.":""}),mentionPicker:i.jsx(Ce,{children:g.isOpen&&i.jsx(Mr,{rows:g.rows,selectedIndex:g.selectedIndex,onSelect:D})}),overlays:i.jsx(i.Fragment,{children:i.jsx(Ce,{children:x.isOpen&&i.jsx(kr,{rows:x.rows,selectedIndex:x.selectedIndex,agents:x.agents,displayNames:x.displayNames,visualOf:x.visualOf,onSelect:x.selectRow})})}),input:{onCursorChange:g.handleCursorChange,isStreaming:!1,isPaletteOpen:g.isOpen||x.isOpen,paletteHasResults:x.isOpen?x.hasRows:g.hasSelectableRows,onArrowUp:x.isOpen?x.moveUp:g.moveUp,onArrowDown:x.isOpen?x.moveDown:g.moveDown,onCommandSelect:x.isOpen?x.selectHighlighted:C,onEscape:x.isOpen?x.dismiss:g.dismiss,tabPicks:!x.isOpen,onClear:()=>{m(""),g.dismiss()},activeDescendantId:x.isOpen?x.activeDescendantId:g.activeDescendantId,paletteListboxId:x.isOpen?x.listboxId:g.listboxId,contextKey:l,...r.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!y&&o===void 0?E:i.jsx("section",{className:"flex flex-col","data-testid":Qn.homeComposer,onFocus:I=>{x.handleFocus(I),ie(I.target)&&(o==null||o(!0))},onBlur:I=>{x.handleBlur(I),ie(I.target)&&(o==null||o(!1))},onPointerDown:x.handlePointerDown,children:E})}function Or(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(t=>t.author.kind==="agent")}function Tr({room:e,hasEntries:t,onAddAgents:s}){return!t||!Or(e)?null:i.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."," ",i.jsx("button",{type:"button",onClick:s,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 _r({roomId:e}){const{approvals:t}=Yn(),s=Jn(t).filter(n=>n.roomId===e);return s.length===0?null:i.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:i.jsx(Xn,{approvals:s})})}function Er({roomId:e}){const{data:t}=zs("pending"),s=(t??[]).filter(n=>n.roomId===e);return s.length===0?null:i.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:s.map(n=>i.jsx(Us,{request:n},n.requestId))})}const Pr="An agent",st=64,Ne=3,Dr=new Set;function Kt({room:e,entries:t,scope:s,laneScope:n,stalled:o,unavailable:r=!1,onRetry:l,onScrollToRow:c}){const h=_e(),p=Zn(e.id,s),u=es(e.id,s),d=ts(e.id,s),[k,f]=a.useState(!1),g=Tt(e.id,{enabled:k}),y=ns(),{mutate:x}=uo(),[N,m]=a.useState(Dr),b=a.useCallback(R=>{m(j=>new Set(j).add(R)),x({roomId:e.id,authorId:R},{onSettled:()=>m(j=>{const A=new Set(j);return A.delete(R),A})})},[x,e.id]),O=mo(),[T,D]=a.useState(()=>new Map),C=ss(),S=qe(),E=a.useMemo(()=>Le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=a.useCallback(R=>{var j;return((j=E.get(R))==null?void 0:j.displayName)??Pr},[E]),{interactions:L}=os(),$=a.useMemo(()=>L.filter(R=>R.roomId===e.id),[L,e.id]),_=a.useMemo(()=>{var j;const R={};for(const A of $){if(A.roomAuthorId===void 0)continue;const U=(j=E.get(A.roomAuthorId))==null?void 0:j.displayName;U!==void 0&&(R[A.sessionId]=U)}return R},[$,E]),q=a.useMemo(()=>p.map(R=>({authorId:R.authorId,name:I(R.authorId),state:R.state,since:R.since,activity:R.activity??null})),[p,I]),F=a.useMemo(()=>u.map(R=>{var A;const j=(A=C.data)==null?void 0:A.find(U=>U.id===R.behindRoomId);return{authorId:R.authorId,name:I(R.authorId),since:R.since,behind:{roomId:R.behindRoomId,title:j===void 0?null:se(j)},othersWaiting:R.othersWaiting,severalInTheWay:R.severalInTheWay}}),[u,I,C.data]),H=a.useMemo(()=>{const R=new Set;for(const j of u)T.get(j.authorId)===j.entryId&&R.add(j.authorId);return R},[u,T]),W=a.useMemo(()=>d===null?null:{authorId:d.authorId,name:I(d.authorId)},[d,I]),B=a.useMemo(()=>Ms({capabilities:ze,asks:$,agentNames:_,stalled:o,presence:q,held:F,silentFinish:W,turn:null}),[$,_,q,F,W,o]),z=a.useMemo(()=>{var j;const R=new Map;for(const A of((j=g.data)==null?void 0:j.bindings)??[])R.set(A.authorId,A.sessionId);return R},[g.data]),w=a.useCallback(R=>{const j=t.find(U=>U.id===R);if(j===void 0)return null;const A=j.body.text.replace(/\s+/gu," ").trim();return A.length===0?null:A.length>st?`${A.slice(0,st).trimEnd()}…`:A},[t]),v=a.useCallback(R=>{var j;return n==="thread"?je(R):((j=Fe(t,R))==null?void 0:j.domId)??null},[t,n]),P=a.useMemo(()=>{const R=p.map(A=>{const U=w(A.entryId),G=v(A.entryId);return{authorId:A.authorId,author:J(A.authorId,E,S.faces),state:A.state,since:A.since,doing:rs(A.activity),replyingTo:U===null||G===null?null:{entryId:A.entryId,excerpt:U,rowId:G},sessionId:z.get(A.authorId)??null}}),j=F.map(A=>({authorId:A.authorId,author:J(A.authorId,E,S.faces),state:"held",since:A.since,doing:null,replyingTo:null,sessionId:null,behind:A.behind,othersWaiting:A.othersWaiting}));return[...R,...j]},[p,F,E,S.faces,w,v,z]),M=a.useMemo(()=>{if(p.length===0)return null;const R=p.slice(0,Ne);return i.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[R.map(j=>i.jsx(vt,{author:J(j.authorId,E,S.faces),className:"ring-background size-4 ring-2"},j.authorId)),p.length>Ne&&i.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${p.length-Ne}`})]})},[p,E,S.faces]);return i.jsx(X.LiveLane,{state:B,scope:n,onRetry:l,unavailable:r,faces:M,onPeekOpenChange:f,askCard:B.kind==="ask"?i.jsx(as,{ask:B.ask,..._[B.ask.sessionId]?{agentName:_[B.ask.sessionId]}:{},onOpenSession:R=>{h(fe({session:R}))},className:"border-l-0"}):void 0,peek:i.jsx(X.LivePeek,{rows:P,onScrollToRow:c,onOpenSession:R=>{h(fe({session:R}))},onOpenRoom:R=>{h({...bt.channels(),search:{id:R}})},onAnswerFirst:R=>{const j=u.find(A=>A.authorId===R);j!==void 0&&D(A=>new Map(A).set(R,j.entryId)),O.mutate({roomId:e.id,authorId:R})},promoted:H,onStopAll:()=>y.mutate({roomId:e.id}),stopping:y.isPending,onStopAgent:b,stoppingAgents:N})})}const ot=3e3;function $r(e,t,s,n=Date.now){const o=a.useRef(null),r=a.useRef(new Map),l=a.useRef(new Map),c=o.current,h=r.current,p=l.current,u=n();for(const d of e){if(p.has(d.id))continue;if(c===null){p.set(d.id,"at-rest");continue}const k=h.get(d.authorId);p.set(d.id,k!==void 0&&u-k<ot?"handed-off":"dropped")}return a.useEffect(()=>{if(!s)return;o.current=new Set(e.map(k=>k.id));const d=n();for(const k of t)r.current.set(k,d);for(const[k,f]of r.current)d-f>ot&&r.current.delete(k);for(const k of l.current.keys())o.current.has(k)||l.current.delete(k)}),p}function Lr({kind:e}){return e==="thread-error"?i.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:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),i.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?i.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-sm"})]}):i.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 Fr({room:e,rootEntryId:t,focusComposer:s,entries:n,reactionFrequents:o,streamStalled:r,streamUnavailable:l,onRetryStream:c,historyLoaded:h,historyFailed:p=!1,landOnRow:u,pushed:d,onClose:k}){const f=a.useMemo(()=>Le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),g=qt({room:e,threadRootId:t}),y=be(e.members,e.viewerAuthorId),x=qe(),N=a.useMemo(()=>new Map([...f].map(([w,v])=>[w,v.displayName])),[f]),{root:m,replies:b}=a.useMemo(()=>{let w;const v=[];for(const P of n)P.id===t?w=P:Z(P)===t&&v.push(P);return{root:w,replies:v}},[n,t]),O=m==null?void 0:m.threadReplyCount,T=O!==void 0&&O>b.length,D=m===void 0||T?-1:1+b.length,C=$e(b.length,O),S=a.useMemo(()=>new Set(b.map(w=>w.id)),[b]),E=a.useMemo(()=>({replyIds:S,inside:!0}),[S]),I=is(e.id,E),L=gt(e.id,t),$=$r(b,I,h),_=a.useRef(null),q=a.useCallback(w=>{var v;(v=_.current)==null||v.scrollToRow(w)},[]),F=a.useRef(null);a.useEffect(()=>{var w;s||(w=F.current)==null||w.focus()},[t,s]);const H=w=>{w.key!=="Escape"||w.defaultPrevented||(w.stopPropagation(),k())},W=a.useMemo(()=>{const w=[];if(m===void 0){const v=p?"thread-error":h?"thread-orphan":"thread-waiting";w.push({kind:"notice",id:v,at:"",body:null})}else w.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:J(pe(m,f),f,x.faces),at:m.createdAt});for(const v of b)w.push({kind:"message",id:v.id,payload:v,grouping:{position:"only"},author:J(pe(v,f),f,x.faces),at:v.createdAt});return w},[m,b,f,x.faces,p,h]),B=a.useCallback(w=>{if(w.kind==="notice")return i.jsx(Lr,{kind:w.id});if(w.kind!=="message")return null;const v=w.payload,P=m!==void 0&&v.id===m.id,M=b.findIndex(A=>A.id===v.id),R=i.jsx(Ft,{roomId:e.id,entry:v,rowId:je(v.id),author:w.author,authorRef:f.get(v.authorId),authors:f,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:o,streamStalled:r,isMember:y,grouping:{position:"only"},answers:Pt(v,M<=0?m:b[M-1],A=>(m==null?void 0:m.id)===A?m:b.find(U=>U.id===A)),feedPosition:{index:P?1:(m===void 0?0:1)+M+1,total:D}});if(P)return C===0?R:i.jsxs(i.Fragment,{children:[R,i.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:[i.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:C===1?"1 reply":`${C} replies`}),i.jsx("span",{className:"bg-border h-px flex-1"})]})]});const j=$.get(v.id)??"at-rest";return i.jsx("div",{className:Q(j==="dropped"&&"motion-safe:animate-thread-reply-in",j==="handed-off"&&"motion-safe:animate-reply-settle"),children:R})},[m,b,C,$,e.id,e.viewerAuthorId,f,N,o,r,y,D]),z=a.useCallback(w=>w.kind==="message"?je(w.id):void 0,[]);return i.jsx(Dt,{known:x,children:i.jsx(X.Root,{surface:"room",capabilities:ze,target:g.target,anchor:"rail",children:i.jsxs("section",{ref:F,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:H,className:Q("bg-card flex min-h-0 flex-col outline-none",d?"h-full w-full":"w-full border-l"),children:[i.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[i.jsx("button",{type:"button",onClick:k,"aria-label":d?`Back to ${se(e)}`:"Close thread",className:Q("focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1","after:absolute after:-inset-2.5 md:after:hidden"),children:d?i.jsx(ls,{"aria-hidden":!0,className:"size-4"}):i.jsx(cs,{"aria-hidden":!0,className:"size-4"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"Thread"}),i.jsx("p",{className:"text-muted-foreground truncate text-xs",children:se(e)})]})]}),i.jsx(X.Timeline,{ref:_,conversationId:`thread-${t}`,label:`Thread in ${se(e)}`,busy:!h&&!p,rows:W,renderRow:B,domIdOf:z,...u===void 0?{}:{landOnRow:u},pending:L,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),i.jsx(Kt,{room:e,entries:n,scope:E,laneScope:"thread",stalled:d&&r===!0,unavailable:l,onRetry:d?c:void 0,onScrollToRow:q}),i.jsx(Wt,{room:e,threadRootId:t,attachments:g.attachments,focusOnMount:s},t)]})})})}const ve="room-thread-split",Br=320,qr=360,Hr=40,zr=50,Ur=25;function rt(e,t){return t<=0?Ur:Math.min(Math.round(e/t*1e3)/10,zr)}function Wr(e){const t=rt(Br,e),s=Math.round((100-rt(qr,e))*10)/10;return{minPct:t,maxPct:s,defaultPct:Math.min(Math.max(Hr,t),s)}}function Kr(e,t,s){if(e===null||t===null||t<=0)return s.defaultPct;const n=e/t*100;return Math.round(Math.min(Math.max(n,s.minPct),s.maxPct)*10)/10}function Gr(e){try{const t=localStorage.getItem(e),s=t===null?NaN:Number(t);return Number.isFinite(s)&&s>0?s:null}catch{return null}}function Vr(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}const Qr="react-resizable-panels:room-thread-split";function Yr(){try{localStorage.removeItem(Qr)}catch{}}function Jr(){const[e,t]=a.useState(null),[s,n]=a.useState(null);return{ref:a.useCallback(r=>{if(r===null)return;t(r);const l=()=>n(r.offsetWidth);l();const c=new ResizeObserver(l);return c.observe(r),()=>{c.disconnect(),t(null),n(null)}},[]),element:e,width:s,sizing:Wr(s??0)}}const Xr=`${ve}-room`,at=`${ve}-thread`,it=`${ve}-handle`,Zr=4;function ea({room:e,thread:t,storageKey:s=us.ROOM_THREAD_WIDTH}){const{ref:n,element:o,width:r,sizing:l}=Jr(),[c,h]=a.useState(()=>Gr(s)),[p,u]=a.useState(null),d=a.useRef(null),k=Kr(c,r,l),f=r===null||(l.maxPct-l.minPct)/100*r<Zr,g=t!==!1;a.useEffect(Yr,[]);const y=a.useRef(!1);a.useLayoutEffect(()=>{var b;y.current&&((b=d.current)==null||b.resize(k))},[k,g]);const x=a.useRef(null),N=()=>{var D;const b=(D=d.current)==null?void 0:D.getSize(),O=x.current;if(x.current=null,b===void 0||r===null||r<=0||O===b)return;const T=Math.round(b/100*r);h(T),Vr(s,T)},m=p??k;return a.useLayoutEffect(()=>{const b=o==null?void 0:o.querySelector(`[data-panel-resize-handle-id="${it}"]`);b&&(b.setAttribute("aria-controls",at),b.setAttribute("aria-valuenow",String(Math.round(m))),b.setAttribute("aria-valuemin",String(Math.round(l.minPct))),b.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),i.jsx("div",{ref:n,className:"h-full overflow-hidden",children:i.jsxs(ds,{direction:"horizontal",id:ve,onLayout:b=>{y.current=b.length>1,u(y.current?b[1]:null)},children:[i.jsx(Qe,{id:Xr,order:1,className:"flex",children:e}),g&&i.jsxs(i.Fragment,{children:[i.jsx(vs,{id:it,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:f,onDragging:b=>{var O;b&&(x.current=((O=d.current)==null?void 0:O.getSize())??null)},onKeyDownCapture:b=>{var O,T;f||(x.current=((O=d.current)==null?void 0:O.getSize())??null,!(b.key!=="Home"&&b.key!=="End")&&(b.preventDefault(),(T=d.current)==null||T.resize(b.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),i.jsx(Qe,{ref:d,id:at,order:2,defaultSize:k,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:t})]})]})})}function xa({roomId:e,threadId:t,entrySeq:s,threadRoute:n,aboveTimeline:o,aboveComposer:r,offerJumpBackIn:l,onComposerFocusChange:c}){const h=ms(),p=Rs(),u=fs(e),d=u==null?void 0:u.rootEntryId,k=hr(),f=a.useCallback(()=>{var P;const v=(P=Y.getState().open[e])==null?void 0:P.rootEntryId;Y.getState().closeThread(e),v!==void 0&&k.arm(v)},[e,k]),g=a.useCallback(v=>{Y.getState().openThread(e,v)},[e]),y=ps(e),x=hs(e),N=co(e,x.isSuccess);Os(e);const m=y.data,b=a.useMemo(()=>x.data??[],[x.data]),O=qt({room:m});gr({roomId:e,route:n,urlThreadId:t,openThreadId:d,entries:b,historyLoaded:x.isSuccess});const T=a.useMemo(()=>{var v;return((v=m==null?void 0:m.members.find(P=>P.author.id===m.viewerAuthorId))==null?void 0:v.lastReadSeq)??null},[m]),D=mr(e,T);gs(m,b);const C=a.useRef(null),S=a.useRef(void 0),E=a.useCallback(v=>{S.current=v},[]),I=a.useCallback(()=>S.current,[]);a.useLayoutEffect(()=>{S.current=void 0},[e]);const L=a.useCallback(v=>{var P;(P=C.current)==null||P.scrollToRow(v)},[]),$=ho(e),{loadOlder:_,cursor:q}=$,F=a.useCallback(()=>{const v=Oo(b,q);_().then(()=>{v!==null&&requestAnimationFrame(()=>{var P;return(P=C.current)==null?void 0:P.scrollToRow(v.domId)})})},[b,q,_]),H=ur({roomId:e,entrySeq:s,entries:b,historyLoaded:x.isSuccess}),W=a.useMemo(()=>d===void 0?void 0:{replyIds:new Set(b.filter(P=>Z(P)===d).map(P=>P.id)),inside:!1},[b,d]);if(y.isLoading)return i.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:i.jsx(Bt,{})});if(y.isError||!m)return i.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),i.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const B=u!==void 0&&i.jsx(Fr,{room:m,rootEntryId:u.rootEntryId,focusComposer:u.focusComposer,entries:b,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:x.isSuccess,historyFailed:x.isError,...H.threadRow===void 0?{}:{landOnRow:H.threadRow},pushed:h,onClose:f},u.rootEntryId),z=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o,i.jsx(cr,{ref:C,roomId:m.id,roomName:se(m),viewerAuthorId:m.viewerAuthorId,entries:b,members:m.members,formerAuthors:m.formerAuthors,lastReadSeq:D,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,isLoading:x.isLoading,error:x.error,onAddAgents:()=>Ye("add",m.id),openThreadId:d,onOpenThread:g,resumeRow:I,...H.roomRow===void 0?{}:{landOnRow:H.roomRow},onTopRow:E,canLoadOlder:$.canLoadOlder,isLoadingOlder:$.isLoadingOlder,onLoadOlder:F}),r,i.jsx(_r,{roomId:m.id}),i.jsx(Er,{roomId:m.id}),i.jsx(Kt,{room:m,entries:b,scope:W,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:L}),i.jsx(Tr,{room:m,hasEntries:b.length>0,onAddAgents:()=>Ye("add",m.id)}),i.jsx(Wt,{room:m,attachments:O.attachments,offerJumpBackIn:l,onFocusChange:c},m.id)]}),w={surface:"room",capabilities:ze,target:O.target,anchor:"rail"};return h?i.jsx(X.Root,{...w,children:i.jsx(Ce,{initial:!1,mode:"wait",children:i.jsx(Ee.div,{initial:{opacity:0,x:16},animate:{opacity:1,x:0},exit:{opacity:0,x:16},transition:{duration:.15,ease:[0,0,.2,1]},style:{paddingBottom:p},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:B===!1?z:B},B?`thread-${d}`:"room")})}):i.jsx(X.Root,{...w,children:i.jsx(ea,{room:z,thread:B})})}export{Ot as I,Bt as R,Io as T,xa as a,ie as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-
|
|
1
|
+
import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-DcZPWi_I.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as O,j as e,a0 as ye,bx as Ee,ar as we,G as N,dN as ie,by as ue,bz as fe,bA as me,bC as xe,dO as Te,a1 as Ae,a3 as ke,a4 as Oe,ad as pe,as as Le,du as he,dP as De,dQ as Ie,dR as Pe,a8 as j,dS as _e,dx as H,dT as Ue,am as be,B as $e,T as Re,b as He,e as Me,dU as Be,dV as ze,dW as Ke,dX as Qe,dY as Ve,dZ as qe}from"./index-Dc5cpBoO.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as k}from"./execution-config-D5-SEt2t.js";import{U as Fe}from"./unverified-catalog-notice-ZUqscVFM.js";import{s as Ge}from"./settings-for-runtime-BoOa-ZFG.js";const Ze={duration:.12,ease:"easeOut"},Je={type:"spring",stiffness:320,damping:28};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=O.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?ie.warning:ie.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":d,children:[r&&e.jsx(ye,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Ee,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Je},exit:{opacity:0},transition:Ze,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",Te.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Ae(),i=ke();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:et})}})}const ge="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:L}){const w=pe(),[S,h]=O.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ge,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Re,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:L??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,le,oe,re,de;const r=pe(),{data:s}=Le(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=De(),C=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,A;return((A=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:L}=Ie({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),y=c?(m??[]).find(t=>t.isDefault):void 0,T=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=T?(m??[]).find(t=>t.value===T):void 0,D=(n==null?void 0:n.supportsEffort)??((ae=Ge(d,o))==null?void 0:ae.supportsEffort),B=D===void 0&&u,z=D!==!1,K=p?p.supportsEffort??!1:void 0,Q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:V,creditsEntry:je,resolvedAccount:q}=Pe(),W=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),v=Q&&[...Q.flatMap(t=>t.id===null?[]:[{id:t.id,label:V(t.path),path:t.path}]),...W?[{id:j,label:_e,path:W.path}]:[]],g=a.account??null,X=g!==null,Y=o==="claude-code"&&g===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&q?V(q):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=O.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:v,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:D,runtimeLabel:t=>H(t).label}),E=t=>{var b;return((b=Ne.breakages.find(A=>t.includes(A.kind)))==null?void 0:b.message)??null},U=!B&&z&&K!==!1,F=a.effort??(n==null?void 0:n.effort)??null,G=H(o).label,Ce=o==="claude-code"&&v!==void 0&&(v.length>1||X),Se=E(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=O.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??T??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:T,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:E(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:M?ce:c&&!h?y?`Use the suggested model: ${y.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Fe,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&L&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ge,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:E(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${G} supports`,warning:null}):z?U?e.jsx($,{label:"Effort",valueLabel:k(F),options:Ue.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:k(t)})),selected:F,isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:E(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${G}`,warning:E(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:Y?I??"Default":g!==null?((de=v==null?void 0:v.find(t=>t.id===g))==null?void 0:de.label)??g:I??"Default",options:(v??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:X,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),Y&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx($e,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function it({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(Me,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(Be,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(ze,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Ke,{})}),e.jsx(Qe,{children:f.map(o=>e.jsx(Ve,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(qe,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{it as RunsOnPopover};
|
|
1
|
+
import{r as O,j as e,a0 as ye,bx as Ee,ar as we,G as N,dN as ie,by as ue,bz as fe,bA as me,bC as xe,dO as Te,a1 as Ae,a3 as ke,a4 as Oe,ad as pe,as as Le,du as he,dP as De,dQ as Ie,dR as Pe,a8 as j,dS as _e,dx as H,dT as Ue,am as be,B as $e,T as Re,b as He,e as Me,dU as Be,dV as ze,dW as Ke,dX as Qe,dY as Ve,dZ as qe}from"./index-DcZPWi_I.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as k}from"./execution-config-CAyT2Qoo.js";import{U as Fe}from"./unverified-catalog-notice-CdYU3WEJ.js";import{s as Ge}from"./settings-for-runtime-BoOa-ZFG.js";const Ze={duration:.12,ease:"easeOut"},Je={type:"spring",stiffness:320,damping:28};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=O.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?ie.warning:ie.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":d,children:[r&&e.jsx(ye,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Ee,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Je},exit:{opacity:0},transition:Ze,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",Te.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Ae(),i=ke();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:et})}})}const ge="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:L}){const w=pe(),[S,h]=O.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ge,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Re,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:L??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,le,oe,re,de;const r=pe(),{data:s}=Le(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=De(),C=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,A;return((A=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:L}=Ie({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),y=c?(m??[]).find(t=>t.isDefault):void 0,T=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=T?(m??[]).find(t=>t.value===T):void 0,D=(n==null?void 0:n.supportsEffort)??((ae=Ge(d,o))==null?void 0:ae.supportsEffort),B=D===void 0&&u,z=D!==!1,K=p?p.supportsEffort??!1:void 0,Q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:V,creditsEntry:je,resolvedAccount:q}=Pe(),W=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),v=Q&&[...Q.flatMap(t=>t.id===null?[]:[{id:t.id,label:V(t.path),path:t.path}]),...W?[{id:j,label:_e,path:W.path}]:[]],g=a.account??null,X=g!==null,Y=o==="claude-code"&&g===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&q?V(q):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=O.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:v,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:D,runtimeLabel:t=>H(t).label}),E=t=>{var b;return((b=Ne.breakages.find(A=>t.includes(A.kind)))==null?void 0:b.message)??null},U=!B&&z&&K!==!1,F=a.effort??(n==null?void 0:n.effort)??null,G=H(o).label,Ce=o==="claude-code"&&v!==void 0&&(v.length>1||X),Se=E(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=O.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??T??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:T,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:E(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:M?ce:c&&!h?y?`Use the suggested model: ${y.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Fe,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&L&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ge,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:E(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${G} supports`,warning:null}):z?U?e.jsx($,{label:"Effort",valueLabel:k(F),options:Ue.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:k(t)})),selected:F,isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:E(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${G}`,warning:E(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:Y?I??"Default":g!==null?((de=v==null?void 0:v.find(t=>t.id===g))==null?void 0:de.label)??g:I??"Default",options:(v??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:X,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),Y&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx($e,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function it({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(Me,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(Be,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(ze,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Ke,{})}),e.jsx(Qe,{children:f.map(o=>e.jsx(Ve,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(qe,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{it as RunsOnPopover};
|