dorkos 0.124.1 → 0.125.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 +1406 -954
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-DHaZvsJE.js → AboutPage-GdrU2Z3k.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-BP-qFk2S.js → ActivityErrorState-D1T74VJE.js} +1 -1
- package/dist/client/assets/{ActivityPage-Bme3TzdQ.js → ActivityPage-7GXGUwd1.js} +1 -1
- package/dist/client/assets/{ActivityRow-BRZyW9MA.js → ActivityRow-C-8dACWp.js} +1 -1
- package/dist/client/assets/{AdapterIcon-BcfquTja.js → AdapterIcon-CRRs6yil.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-B4I23pBg.js → AdapterSetupWizard-K6DsejqG.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-Cb34LtmH.js → AgentOptionRow-CF5XZmBx.js} +1 -1
- package/dist/client/assets/{AgentPicker-ouNRFSDh.js → AgentPicker-BXes2ymU.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-B6MHIsxa.js → AgentRequestCard-BuXVpWfb.js} +4 -4
- package/dist/client/assets/{AppearancePage-CutehigK.js → AppearancePage-DoqoCU4j.js} +1 -1
- package/dist/client/assets/{ApplyToOverridesDialog-B-wIUI27.js → ApplyToOverridesDialog-By8jgPX3.js} +1 -1
- package/dist/client/assets/AttentionSignalRow-CgGyTDmT.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CdWF4WLz.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BzDxZ-G5.js} +3 -3
- package/dist/client/assets/{BindingDialog-BAdueON5.js → BindingDialog-BXfjFGvP.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-b30dG4gx.js → BlintzCanvas-C-dobEns.js} +4 -4
- package/dist/client/assets/{CanvasCsvContent-DGHgSikG.js → CanvasCsvContent-ClMFJX7T.js} +4 -4
- package/dist/client/assets/CanvasFileContent-BoDE2jjA.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-fnWc0B7B.js +2 -0
- package/dist/client/assets/ChannelComposer-DIRPjyyf.js +44 -0
- package/dist/client/assets/{ChatAppsOff-DiObvmJS.js → ChatAppsOff-DlCWmwEz.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-BncI1OY1.js → CodeMirrorDiff-COsbYyNC.js} +2 -2
- package/dist/client/assets/{CodeMirrorEditor-DV6psv19.js → CodeMirrorEditor-n3l14rY7.js} +1 -1
- package/dist/client/assets/{CommitmentList-Dx_Ek_Gl.js → CommitmentList-S2O_hvwR.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-Bca8NMUa.js → CommitmentsPage-COOCQFpL.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-DNVNFTdn.js → ComputerResourceView-PA9T4FZP.js} +1 -1
- package/dist/client/assets/{ComputerViewer-D8SxJdMm.js → ComputerViewer-CnYUWQBS.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-Bhj1YT15.js → ConnectionAccessLists-C1ZJtNl-.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-B20JZxoK.js → ConnectionsPage-BBpWiN4-.js} +2 -2
- package/dist/client/assets/{ConventionPage-De645wxU.js → ConventionPage-sa0Yn2uq.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-nTeiOBRQ.js → ExtensionPageRoute-BztrmZNp.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-DM79UITv.js → FloatingTanStackRouterDevtools-CqogiFob-CJrqr29-.js} +1 -1
- package/dist/client/assets/HandlePage-tZidnrlt.js +1 -0
- package/dist/client/assets/{HeartbeatPage-CBoUxz6t.js → HeartbeatPage-BkyUpdZt.js} +1 -1
- package/dist/client/assets/{KeyEntry-Cug8ocpX.js → KeyEntry-DAMr1NNY.js} +1 -1
- package/dist/client/assets/{LexicalField-Bv_ogmAq.js → LexicalField-Cnzrh08A.js} +2 -2
- package/dist/client/assets/{ManagesPage-DfJBQKK3.js → ManagesPage-EAbQtygH.js} +1 -1
- package/dist/client/assets/{Marketplace-swCVUbdY.js → Marketplace-BfADALGd.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-CDZDChpV.js → MarketplaceSourcesView-u1WKUk-p.js} +1 -1
- package/dist/client/assets/{McpAppFrame-BM9cNPPd.js → McpAppFrame-Cz-Ttlqr.js} +1 -1
- package/dist/client/assets/{McpSigninBody-DKyUKrEE.js → McpSigninBody-CkOBUhOz.js} +1 -1
- package/dist/client/assets/{Model3dViewer-rXSL5y2P.js → Model3dViewer-CvLaSO7V.js} +1 -1
- package/dist/client/assets/NamePage-BS-oN_Hi.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-GCEMS5oV.js → NewDirectMessageMenu-Be_4mBPd.js} +1 -1
- package/dist/client/assets/{NotificationsPage-DSWsOVLa.js → NotificationsPage-GCk9gfsW.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BTuctDj4.js → OpenMeshSwitch-BBzgYSUc.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-ODDMd2YN.js → OperatorIdentityForm-ZAbJ4FJn.js} +1 -1
- package/dist/client/assets/{PermissionHistory-41a58Se7.js → PermissionHistory-DgmFpdJK.js} +1 -1
- package/dist/client/assets/{PermissionsPage-DefmymZ6.js → PermissionsPage-DHFt_34a.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-7zPVBI1I.js → PersonalityPopover-CobRy95S.js} +1 -1
- package/dist/client/assets/PhotoPage-BmFypD13.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-CwGlBJ7U.js → PreviewRefusedNotice-Ux5sq2Om.js} +1 -1
- package/dist/client/assets/ProfileFields-kBzeRPfc.js +1 -0
- package/dist/client/assets/{ProfilePanelContainer-RrhoPD3T.js → ProfilePanelContainer-CREt4ZC3.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-CXRVBCAu.js → ProfileRolePicker-hQbo8P6M.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-bBroJdTi.js → PromptSuggestionChips-CmW1lIso.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-CfPatsWM.js → ReportsToPopover-Dpa-_NsO.js} +1 -1
- package/dist/client/assets/RoomSurface-BQhgKnIE.js +1 -0
- package/dist/client/assets/{RoomsPage-C3dDp1Mb.js → RoomsPage-BHUDRYzJ.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-BcKjfQi-.js → RunsOnPopover-bGZ6VJoF.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-DN2ElvcH.js +1 -0
- package/dist/client/assets/{RuntimeSetupDialog-Bg-0b-LC.js → RuntimeSetupDialog-CUFie4LV.js} +1 -1
- package/dist/client/assets/SeenDevices-D_FnsL7V.js +19 -0
- package/dist/client/assets/{SessionsPage-Cqfx4FGW.js → SessionsPage-1uOPUCP9.js} +1 -1
- package/dist/client/assets/SettingsDialog-AbwEHDG8.js +12 -0
- package/dist/client/assets/{SkillsPage-BleHQavF.js → SkillsPage-BEobBuAr.js} +1 -1
- package/dist/client/assets/TaskDialogWrapper-BAFSmT-z.js +1 -0
- package/dist/client/assets/{TasksEmptyState-Bprx1k8M.js → TasksEmptyState-BFw2ODM-.js} +2 -2
- package/dist/client/assets/{TasksPage-Dub39yEJ.js → TasksPage-C0CMgSFx.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CJ-NG0u5.js → TeamComputerEntry-BpjxLA1n.js} +1 -1
- package/dist/client/assets/{ToolsPage-IsD6M-ZW.js → ToolsPage-dx-rQ2F1.js} +2 -2
- package/dist/client/assets/TopologyGraph-LpxkBhGK.js +30 -0
- package/dist/client/assets/{TourHost-BYfztuPb.js → TourHost--UYZoKlJ.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-BKhgxVdF.js → UnlinkDialog-BN2odbqD.js} +1 -1
- package/dist/client/assets/UnreadDivider-LbVIAoxM.js +1 -0
- package/dist/client/assets/{WidgetErrorCard-1NyzIJBj.js → WidgetErrorCard-CAUx4KUI.js} +3 -3
- package/dist/client/assets/WorkView-DVx4WoVI.js +63 -0
- package/dist/client/assets/_shell-D7Jp6t6_.js +80 -0
- package/dist/client/assets/{_shell._home-xWj7wO5z.js → _shell._home-uuqgFA3M.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BqcLoaB1.js → _shell._home.activity-CiMsy7bF.js} +1 -1
- package/dist/client/assets/_shell._home.index-0Zm5q3-G.js +3 -0
- package/dist/client/assets/{_shell._home.tasks--UhQB6h3.js → _shell._home.tasks-BClPai4g.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-BPFD8Of2.js → _shell._home.workspaces-DH4BgLT0.js} +1 -1
- package/dist/client/assets/{_shell.channels-CnFdvRzc.js → _shell.channels-BGXkXPhY.js} +4 -4
- package/dist/client/assets/{_shell.connections-Ik01wS5M.js → _shell.connections-BwjXkgi1.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-Czu42kzo.js → _shell.feedback-requests-j7gTBF5b.js} +1 -1
- package/dist/client/assets/_shell.marketplace-6JRXJ9gt.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-DriHXfBM.js +1 -0
- package/dist/client/assets/_shell.session-BXSWGdwi.js +1 -0
- package/dist/client/assets/{_shell.team-UfaJqohh.js → _shell.team-BgJu1gDa.js} +5 -5
- package/dist/client/assets/_shell.threads-C1IJJzcf.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-BNgicBXG.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-BNgicBXG.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-oxkfGyl6.js → abnfDiagram-WEYOIA3C-BuEHMh0D.js} +1 -1
- package/dist/client/assets/{access-copy-Dggxx2cX.js → access-copy-BZNjpw9v.js} +1 -1
- package/dist/client/assets/{arc-CqQdP0Qe.js → arc-BbGU9Ctb.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-89xM7zJD.js → architectureDiagram-ZHVYKT53-CdRG5sTM.js} +2 -2
- package/dist/client/assets/{banner-DqJ2pM0Y.js → banner-C7kHJJGz.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-CcxwDmZC.js → blockDiagram-RJAE7QA3-CBQ6YXoI.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DCIhIyXa.js → c4Diagram-XDPPPE54-DavNcKCF.js} +1 -1
- package/dist/client/assets/{card-DT-vFAns.js → card-D4ek-VvX.js} +1 -1
- package/dist/client/assets/channel-ClNeQ2PQ.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-BfWEXcCj.js → chunk-2E7WHVMD-ClO15ze9.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-KLXLZXlR.js → chunk-2Q5K7J3B-DsLDzf_i.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-CL5Gttmj.js → chunk-4EMNKR2T-D20fXIIK.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-cfAl84Mv.js → chunk-55XCU76K-no_S5sRX.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BqUyGgoH.js → chunk-5VM5RSS4-D5xWEZ2p.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-BWr2ST9i.js → chunk-JWPE2WC7-CnsdZOv0.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-V5zYx50O.js → chunk-VQ5W62QI-DxYg8tsH.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-gnvheN_J.js → chunk-XXDRQBXY-7CQ-MKdC.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-ClGxxZvV.js → chunk-ZCHMQSOR-Ca7Jh42b.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-DvmHzDb5.js → classDiagram-v2-4MYWR3UA-BvZXavcI.js} +1 -1
- package/dist/client/assets/{command-CNx4L11m.js → command-srO4Wv-5.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-Df8nXBRj.js → cose-bilkent-JH36ORCC-1NCiJaHv.js} +1 -1
- package/dist/client/assets/{cpu-D8KJEkdh.js → cpu-CFIu4JtK.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-CAn6ufHs.js → cynefin-EF2NZ3EQ-DgZeohG3.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-Cep_NrRw.js → cynefinDiagram-WF24UDRP-MQB2xbJK.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-sWD3z9wf.js → dagre-NK4GIZVX-BFHk_Y44.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-CUpaBATr.js → diagram-CBK3MWTC-CloEvZfp.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-BejWB2ry.js → diagram-I5XIIV2D-9nzUtfKI.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-BGKJfNk9.js → diagram-ODIL2UCW-DVdnelgu.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-V0dP8H8k.js → diagram-PFBEJUXE-tTEeiAHa.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-Bf5dVsFX.js → diagram-RJA3I4VV-QFehV9_1.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-CLrMSqb4.js → diagram-TYUNFSNR-CYU5li-4.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-BGG4CWA0.js → ebnfDiagram-V4P3TTPT-Cn040Beg.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-bf9D6f0w.js → elk-QONTBCTQ-tBbnwcb3.js} +1 -1
- package/dist/client/assets/{empty-state-CDoXnrKn.js → empty-state-Bxfi7_ss.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-fEUv-33P.js → erDiagram-KYQIGQAA-DAA0fFlD.js} +1 -1
- package/dist/client/assets/{execution-config-Ca9MDOtV.js → execution-config-afKaYukD.js} +1 -1
- package/dist/client/assets/{file-CiyVL55_.js → file-C-ooqbRY.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DaFRIKco.js → file-exclamation-point-BWWgLsMF.js} +1 -1
- package/dist/client/assets/{file-text-DsnD-A8g.js → file-text-BJt8biPY.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-CNsnCgbB.js → find-latest-widget-fence-DPQimlUD.js} +2 -2
- package/dist/client/assets/{flowDiagram-IUGLLWBU-CRbeSDod.js → flowDiagram-IUGLLWBU-vYI6TodS.js} +1 -1
- package/dist/client/assets/{form-Cru78aT-.js → form-LJ2Rf9ny.js} +1 -1
- package/dist/client/assets/{format-cron-9K38-tn1.js → format-cron-DrUISrHj.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-Mkk7zgs_.js → ganttDiagram-R7GPNTJY-DLYpSX7r.js} +3 -3
- package/dist/client/assets/{git-branch-CONwEYiR.js → git-branch-D5xr7U5P.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-Drre0vyA.js → gitGraphDiagram-PDYL7XHY-DNIbVOaY.js} +1 -1
- package/dist/client/assets/{graph-BJlnKWgo.js → graph-DNjxkUSL.js} +1 -1
- package/dist/client/assets/{heart-CqwUlIUG.js → heart-DnR_GX4I.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-e4LXC_pS.js → highlighted-body-KPVGNVTW-L_Jd2uei.js} +1 -1
- package/dist/client/assets/image-lightbox-DZIhMyF3.js +1 -0
- package/dist/client/assets/{image-off-DZuLkaRJ.js → image-off-DdvvVxmq.js} +2 -2
- package/dist/client/assets/index-5eNHb7up.js +1 -0
- package/dist/client/assets/{index-BV2Ezdxv.js → index-5hCWBj-r.js} +1 -1
- package/dist/client/assets/{index-A41zxoWk.js → index-9GoQjBFo.js} +1 -1
- package/dist/client/assets/{index-By58MgcZ.js → index-ANmu61E0.js} +1 -1
- package/dist/client/assets/{index-pVFjKNjX.js → index-B0jt7Nng.js} +1 -1
- package/dist/client/assets/index-B1gC3xYN.js +1 -0
- package/dist/client/assets/{index-Bd7vUYhr.js → index-B2wx4J9U.js} +1 -1
- package/dist/client/assets/{index-BIB-maE5.js → index-BAIKz_P0.js} +1 -1
- package/dist/client/assets/{index-DdJBZE0H.js → index-BFecX5dC.js} +1 -1
- package/dist/client/assets/{index-CyVH876g.js → index-BWQfqbbe.js} +1 -1
- package/dist/client/assets/{index-Bo7x9IkO.js → index-BYeyKNKj.js} +1 -1
- package/dist/client/assets/{index-DL8ISRMH.js → index-Ba9q2CoQ.js} +1 -1
- package/dist/client/assets/{index-B25gvCK_.js → index-Blhsfk7u.js} +1 -1
- package/dist/client/assets/{index-x1yAu9zJ.js → index-Bpwvxz0c.js} +1 -1
- package/dist/client/assets/{index-mZqojApH.js → index-BqKjnd_r.js} +1 -1
- package/dist/client/assets/{index-cI2u8WZS.js → index-Bri5bZfv.js} +1 -1
- package/dist/client/assets/{index-HR8BYVRQ.js → index-BsHyymmC.js} +1 -1
- package/dist/client/assets/index-BsmR2hi4.js +23 -0
- package/dist/client/assets/index-By-VWzSF.js +43 -0
- package/dist/client/assets/{index-BtDxwJsM.js → index-By8pKNSM.js} +1 -1
- package/dist/client/assets/{index-DijWcSDZ.js → index-BzKkoaB1.js} +3 -3
- package/dist/client/assets/{index-BBmkfbXd.js → index-CDGWl8qL.js} +1 -1
- package/dist/client/assets/{index-LEcodwyW.js → index-CDo6TA8n.js} +1 -1
- package/dist/client/assets/{index-DzwZJuO1.js → index-CLQIvYHP.js} +1 -1
- package/dist/client/assets/{index-DAlpmAIA.js → index-CLbs0fcq.js} +1 -1
- package/dist/client/assets/{index-skAhJyIF.js → index-CQ2atcs_.js} +1 -1
- package/dist/client/assets/index-CSqz4B0v.js +1 -0
- package/dist/client/assets/{index-vJy88bwb.js → index-CXWlrRzK.js} +1 -1
- package/dist/client/assets/{index-BKp2B9JS.js → index-D-Q7CW4p.js} +1 -1
- package/dist/client/assets/index-D0ujPZdD.js +1 -0
- package/dist/client/assets/index-D1kQ19Gb.css +1 -0
- package/dist/client/assets/index-DHi8-3w0.js +1 -0
- package/dist/client/assets/index-DKTd8X7n.js +1053 -0
- package/dist/client/assets/{index-1yEXEZiH.js → index-DTuNXPGU.js} +1 -1
- package/dist/client/assets/{index-BFNy-Yp3.js → index-DXWsH2Ep.js} +1 -1
- package/dist/client/assets/index-DjFFFMc-.js +2 -0
- package/dist/client/assets/{index-B_0LYi32.js → index-DqCxUalt.js} +1 -1
- package/dist/client/assets/{index-CVuEUzi5.js → index-Ixk2o7yl.js} +1 -1
- package/dist/client/assets/{index-DabU6r9W.js → index-ZYbeRA5f.js} +3 -3
- package/dist/client/assets/index-a6ojvFqI.js +1 -0
- package/dist/client/assets/{index-Vz7VUm9l.js → index-adYd35CJ.js} +1 -1
- package/dist/client/assets/{index-BTjZIgFn.js → index-ld6lMfGU.js} +1 -1
- package/dist/client/assets/{index-BDD2EyoW.js → index-r0stHl-2.js} +1 -1
- package/dist/client/assets/index-uIonuakd.js +1 -0
- package/dist/client/assets/{index-DDNwNOHF.js → index-xfRcAp50.js} +1 -1
- package/dist/client/assets/{index.esm-BUPoRUaG.js → index.esm-j5KQ_b6S.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-B_Wyzufh.js → infoDiagram-MVDRKAX5-DjvSkTas.js} +1 -1
- package/dist/client/assets/{inline-code-BIzGDx6z.js → inline-code-DlVYFFW7.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BDk2-6Pd.js → ishikawaDiagram-HPEHV2GE-BBivrI5n.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-7qf9KWEQ.js → journeyDiagram-BOSHW7O7-DKdhbtdx.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-CFYDQmXn.js → kanban-definition-FNSA4HC5-CkgAodR5.js} +1 -1
- package/dist/client/assets/{layers-C9tVVcXg.js → layers-CzyhuVSM.js} +1 -1
- package/dist/client/assets/{lightbulb-f4jtsAh0.js → lightbulb-DwGE7s99.js} +1 -1
- package/dist/client/assets/{link-2-ZNlK1BG1.js → link-2-CljREnN9.js} +1 -1
- package/dist/client/assets/{list-runtime-types-CqO-QFYD.js → list-runtime-types-D5ZO30FL.js} +1 -1
- package/dist/client/assets/{markdown-content-DaEVxezf.js → markdown-content-CN_dGlgE.js} +1 -1
- package/dist/client/assets/{mention-pill-BiCPflY-.js → mention-pill-C6OT4gx4.js} +1 -1
- package/dist/client/assets/{mermaid.core-SX8SzrsU.js → mermaid.core-DNuzxE7q.js} +4 -4
- package/dist/client/assets/{message-square-off-_qbedNGF.js → message-square-off-DlkAPJdd.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-BloJIArH.js → mindmap-definition-6OY57UG3-f9ygKKO1.js} +1 -1
- package/dist/client/assets/{more-details-CdJT0Ehl.js → more-details-DRPervoL.js} +1 -1
- package/dist/client/assets/{owner-notice-BDafFD_I.js → owner-notice-C-Q9ySA7.js} +1 -1
- package/dist/client/assets/{package-Cb7lEm7t.js → package-BVNiaGrb.js} +1 -1
- package/dist/client/assets/{page-container-DsRgIMAL.js → page-container-D03bhclt.js} +1 -1
- package/dist/client/assets/pane-resize-handle-CZ9rHhNr.js +1 -0
- package/dist/client/assets/{paperclip-DNu1VtoX.js → paperclip-DQQVX5tJ.js} +1 -1
- package/dist/client/assets/{path-input-D3O71b-X.js → path-input-CQ16nhYd.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-Di48kPNu.js → pegDiagram-ECIUJNBX-CZ_YkcKh.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-DY8B_SPD.js → pieDiagram-GNMPY74T-DLHSPEH7.js} +1 -1
- package/dist/client/assets/{plug-IIS_cL9-.js → plug-CadJyjTp.js} +1 -1
- package/dist/client/assets/primer-trigger-DH4xfrlM.js +3 -0
- package/dist/client/assets/profile-errors-DSnHlauU.js +1 -0
- package/dist/client/assets/{progress-g5kkqvlR.js → progress-BB97hlmb.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-Depv_dON.js → quadrantDiagram-D57K4MC3-BWcUu48x.js} +1 -1
- package/dist/client/assets/{query-error-state-PuLGD7Jp.js → query-error-state-B456s96E.js} +1 -1
- package/dist/client/assets/{radio-QOLZSBz1.js → radio-DrpN3x3S.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-BfD2AiZM.js → railroadDiagram-Y72NRBL7-C2VRM83h.js} +1 -1
- package/dist/client/assets/registry-DRvQ3ChB.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-DF_DfZ7s.js → relay-trace-schemas-BYCaGsVJ.js} +2 -2
- package/dist/client/assets/repeat-DPzic7-j.js +11 -0
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-B1iTjrkD.js → requirementDiagram-EQYSW5RA-B1bpdcM7.js} +1 -1
- package/dist/client/assets/{room-files-source-g1th8mWs.js → room-files-source-aN4p_kDV.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-BGwYMaGL.js → rotate-ccw-clock-gqBy98sI.js} +1 -1
- package/dist/client/assets/{rotate-cw-B4Y0q4GY.js → rotate-cw-mHsqEte-.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-D5TzVJrQ.js → sankeyDiagram-SY24JHO5-QCGTTh9k.js} +1 -1
- package/dist/client/assets/{scroll-area-BvScZKSa.js → scroll-area-DVd6ctli.js} +1 -1
- package/dist/client/assets/{search-x-CqN5twBj.js → search-x-CzgTzL0z.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BhUahaNf.js → sequenceDiagram-BLEHNHQU-kiR1gX_u.js} +1 -1
- package/dist/client/assets/{shield-x-DHJrwtKp.js → shield-x-Btfd3Xnx.js} +1 -1
- package/dist/client/assets/signed-in-gS3tMpTW.js +1 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-D2Vi1Kq9.js → sizeCapture-INFHLROL-Da56aMj0.js} +1 -1
- package/dist/client/assets/{soul-file-BMpVFN7U.js → soul-file-C7zd1yXt.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-b9gSbZnF.js → stateDiagram-v2-A6IESKWZ-BZ3qlQWl.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-i47jxLY6.js → swimlanes-B3ENRKFQ-B-wp91_T.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Drg_8k1s.js +8 -0
- package/dist/client/assets/{table-CN2HCi4p.js → table-BIdFvzBs.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-eY5gj0js.js → timeline-definition-JXYKGLGB-CQojjy-8.js} +1 -1
- package/dist/client/assets/{trust-posture-Bcyy5Fub.js → trust-posture-DszobEjt.js} +1 -1
- package/dist/client/assets/{unplug-lkD35Rwp.js → unplug-xlfZ61jC.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-DiCIrrhU.js → unverified-catalog-notice-DymrAwtm.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-BrqVd-47.js → use-adapter-catalog-CytBTafV.js} +1 -1
- package/dist/client/assets/{use-bindings-CU2RSXOy.js → use-bindings-BPNK3sUh.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-Dy2oTM8Y.js → use-composer-prefs-DMQT0qiv.js} +1 -1
- package/dist/client/assets/{use-connector-management-5oRqzydY.js → use-connector-management-PDVdWccW.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-Bg5nW8qq.js → use-deep-link-scroll-CwapSmGj.js} +1 -1
- package/dist/client/assets/{use-delete-binding-qeyRkvR1.js → use-delete-binding-CgTwS83G.js} +1 -1
- package/dist/client/assets/{use-dev-links-FY4J_PjA.js → use-dev-links-BoZCIc4h.js} +1 -1
- package/dist/client/assets/use-direct-message-panel-Cs4I6669.js +1 -0
- package/dist/client/assets/{use-external-adapter-catalog-HiWFZZrW.js → use-external-adapter-catalog-PBrsasQ8.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-K1uk9Wya.js → use-full-activity-feed-C2seN-V1.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-pvzUlnxh.js +1 -0
- package/dist/client/assets/use-is-hub-CvEPWuj0.js +1 -0
- package/dist/client/assets/{use-local-browser-CTFiF0wf.js → use-local-browser-CF0uGQ6e.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-CafidaIH.js → use-mesh-topology-CnCeK4gS.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-B38uSLCx.js → use-mounted-ref-BtAb14HI.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-m9XSNB6W.js → use-notification-prefs-B8LHpZTt.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-D9n6rNJ1.js → use-panel-tab-placements-DOXj0Pii.js} +1 -1
- package/dist/client/assets/use-pending-read-DBaC7e8N.js +1 -0
- package/dist/client/assets/{use-personality-commit-ChLQfLrK.js → use-personality-commit-YV9FVC-a.js} +1 -1
- package/dist/client/assets/{use-promo-activation-DbJDgp4_.js → use-promo-activation-CjtGhz_3.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-Csw0j0N0.js → use-promo-dismissals-4rbLgSDG.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-BIZ7daHW.js → use-pulse-freshness-CGqANpVO.js} +1 -1
- package/dist/client/assets/{use-relay-config-hUB3lVFv.js → use-relay-config-CvU_70WJ.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-BpKzhniV.js → use-room-follow-claim-Doq_lWjk.js} +1 -1
- package/dist/client/assets/use-room-sessions-CoEIaBRt.js +1 -0
- package/dist/client/assets/{use-roving-tab-list-BtM0bZL7.js → use-roving-tab-list-BzsrpjWV.js} +1 -1
- package/dist/client/assets/use-session-canvas-DQ9ND8il.js +27 -0
- package/dist/client/assets/use-status-budget-AnHroEO0.js +16 -0
- package/dist/client/assets/{use-unclaimed-chats-BbMZtNG9.js → use-unclaimed-chats-DzOLK27i.js} +1 -1
- package/dist/client/assets/use-update-config-NRkQbxae.js +1 -0
- package/dist/client/assets/{useMutationState-CVpvw27W.js → useMutationState-BAU_J-u3.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-CHcpeLg4.js → usecaseDiagram-WPOLBNNX-BrHN0c6G.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-gQbZL_A6.js → vennDiagram-Q3Y3IDCW-CbeP0Pbp.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-BFH_WHzZ.js → wardleyDiagram-IVAIDKWA-mn5ebFhs.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-B0QpyqeZ.js → xychartDiagram-4URNHDU4-C8fXRQEv.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261020142444_read_cursor_room_thread.sql +17 -0
- package/dist/drizzle/20261021004938_dor3203_settle_turn_holds.sql +7 -0
- package/dist/drizzle/20261021153328_dor3175_person_chat_mode.sql +1 -0
- package/dist/drizzle/meta/20261020142444_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021004938_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021153328_snapshot.json +14086 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/server/extension-child.cjs +27 -1
- package/dist/server/index.js +12384 -9857
- package/dist/server/index.js.map +2 -2
- package/package.json +8 -8
- package/dist/client/assets/AttentionSignalRow-B1aMjgX_.js +0 -1
- package/dist/client/assets/CanvasFileContent-D1bFaUeh.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-dST7g1v2.js +0 -2
- package/dist/client/assets/HandlePage-B08V-om7.js +0 -1
- package/dist/client/assets/NamePage-JwMDK1JD.js +0 -1
- package/dist/client/assets/PhotoPage-DlOVhkW9.js +0 -1
- package/dist/client/assets/ProfileFields-DVMkpJSb.js +0 -1
- package/dist/client/assets/RoomSurface-CdgCdV6h.js +0 -44
- package/dist/client/assets/RuntimeConnectFlow-DCIRnvOH.js +0 -1
- package/dist/client/assets/SeenDevices-nMsGUQTv.js +0 -19
- package/dist/client/assets/SettingsDialog-C8r2igJ_.js +0 -12
- package/dist/client/assets/TaskDialogWrapper-BhTEvf-u.js +0 -1
- package/dist/client/assets/TopologyGraph-CwyasvFI.js +0 -30
- package/dist/client/assets/_shell-Ct2Bz7D0.js +0 -80
- package/dist/client/assets/_shell._home.index-D4sQsKKk.js +0 -3
- package/dist/client/assets/_shell.marketplace-Cezv-i16.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-BTENmr4W.js +0 -1
- package/dist/client/assets/_shell.session-BjevHF_O.js +0 -63
- package/dist/client/assets/_shell.x._extensionId-0OO_Xr72.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-0OO_Xr72.js +0 -1
- package/dist/client/assets/channel-Ngk70nQZ.js +0 -1
- package/dist/client/assets/image-lightbox-DHDtzoja.js +0 -1
- package/dist/client/assets/index-B9bZYNKR.js +0 -1
- package/dist/client/assets/index-BLP5O7X9.js +0 -1
- package/dist/client/assets/index-C3cvP8Fo.js +0 -1033
- package/dist/client/assets/index-CoWJD3Jg.js +0 -2
- package/dist/client/assets/index-D67Kfy-M.js +0 -1
- package/dist/client/assets/index-DyRGZyur.css +0 -1
- package/dist/client/assets/index-UPF8suf2.js +0 -1
- package/dist/client/assets/index-YW-v746p.js +0 -1
- package/dist/client/assets/index-iTQUa_b2.js +0 -23
- package/dist/client/assets/index-wY5OcS4a.js +0 -43
- package/dist/client/assets/index-xAgihCJ7.js +0 -1
- package/dist/client/assets/primer-trigger-DurKYe8C.js +0 -3
- package/dist/client/assets/profile-errors-BdhZfdvZ.js +0 -1
- package/dist/client/assets/registry-Ck8p6n1T.js +0 -1
- package/dist/client/assets/signed-in-BmywDpR5.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CA9gW19w.js +0 -8
- package/dist/client/assets/terminal-BORQniao.js +0 -6
- package/dist/client/assets/use-is-below-desktop-Cu_jKnft.js +0 -1
- package/dist/client/assets/use-is-hub-BX7ypNRJ.js +0 -1
- package/dist/client/assets/use-jump-back-in-BjZ8EswV.js +0 -11
- package/dist/client/assets/use-pending-read-BoV-UI1E.js +0 -1
- package/dist/client/assets/use-session-canvas-DRrkNRcL.js +0 -25
- package/dist/client/assets/use-session-diagnostics-BTNgouum.js +0 -16
- package/dist/client/assets/use-update-config-CkWwKNkY.js +0 -1
- /package/dist/client/assets/{_shell-DIs3GY4I.css → WorkView-DIs3GY4I.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,
|
|
1
|
+
import{j as o,c_ as t}from"./index-DKTd8X7n.js";function e(){return o.jsx("div",{className:"h-full min-h-0 overflow-hidden",children:o.jsx(t,{})})}const s=e;export{s as component};
|
package/dist/client/assets/{_shell._home.activity-BqcLoaB1.js → _shell._home.activity-CiMsy7bF.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c6 as R,cF as D,r as l,ih as C,ii as V,j as e,bx as G,ar as g,B as M,X as Y,G as f,A as j,eN as K,eO as k,_ as W,e as v,x as q,a1 as z,a2 as U,ij as X,eJ as J,ik as Q,dK as Z}from"./index-C3cvP8Fo.js";import{P as ee}from"./page-container-DsRgIMAL.js";import{g as te,A as se,a as ne,b as ie}from"./ActivityErrorState-BP-qFk2S.js";import{u as ae}from"./use-full-activity-feed-K1uk9Wya.js";import{C as A,A as re}from"./ActivityRow-BRZyW9MA.js";import{T as P,a as _,b as oe,c as p}from"./table-CN2HCi4p.js";import{E as b}from"./empty-state-CDoXnrKn.js";const S=["categories","actorType","actorId","since"];function w(){const s=R(),n=D({strict:!1}),t={categories:n.categories,actorType:n.actorType,actorId:n.actorId,since:n.since},i=S.some(c=>n[c]!==void 0),a={};t.categories&&(a.categories=t.categories),t.actorType&&(a.actorType=t.actorType),t.actorId&&(a.actorId=t.actorId),t.since&&(a.since=t.since);const r=l.useCallback(c=>{s({search:c})},[s]),o=l.useCallback(c=>{r(x=>{const y=x.categories?x.categories.split(","):[],N=y.includes(c)?y.filter(B=>B!==c):[...y,c];return{...x,categories:N.length>0?N.join(","):void 0}})},[r]),d=l.useCallback(c=>{r(x=>({...x,actorType:c}))},[r]),m=l.useCallback(c=>{r(x=>({...x,actorId:c}))},[r]),u=l.useCallback(c=>{r(x=>({...x,since:c}))},[r]),h=l.useCallback(()=>{r(c=>{const x={...c};for(const y of S)delete x[y];return x})},[r]);return{filters:t,queryFilters:a,isFiltered:i,toggleCategory:o,setActorType:d,setActorId:m,setSince:u,clearAll:h}}function ce(){const s=R(),t=D({strict:!1}).view==="all"?"all":"activity",i=l.useCallback(a=>{s({search:(r=>({...r,view:a==="all"?"all":void 0}))})},[s]);return{view:t,setView:i}}function le(){const[s]=l.useState(()=>C.getState().lastSeenAt);return l.useEffect(()=>{const{markSeen:n,setViewing:t}=C.getState();return n(),t(!0),()=>{n(),t(!1)}},[]),s}function ue(s){const n=l.useRef(null),t=l.useCallback(i=>{var d,m,u;const a=n.current;if(!a)return;const r=a.querySelectorAll("[data-activity-row]"),o=Array.from(r).findIndex(h=>h===document.activeElement||h.contains(document.activeElement));switch(i.key){case"ArrowDown":{i.preventDefault();const h=Math.min(o+1,r.length-1);(d=r[h])==null||d.focus();break}case"ArrowUp":{i.preventDefault();const h=Math.max(o-1,0);(m=r[h])==null||m.focus();break}case"Escape":{(u=document.activeElement)==null||u.blur();break}}},[s]);return{containerRef:n,handleKeyDown:t}}const de=["tasks","relay","agent","config","system","permissions"],L="group inline-flex min-h-11 shrink-0 items-center outline-none md:min-h-0",$="inline-flex h-6 items-center rounded-full px-2.5 text-xs font-medium transition-colors group-focus-visible:ring-ring group-focus-visible:ring-2 group-focus-visible:ring-offset-1";function me({category:s,isActive:n,onToggle:t}){const i=A[s];return e.jsx(g.button,{type:"button",layout:!0,onClick:t,"aria-pressed":n,transition:{duration:.15},className:L,children:e.jsx("span",{className:f($,n?f(i.bg,i.text):"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:i.label})})}function he({isActive:s,onClick:n}){return e.jsx(g.button,{type:"button",layout:!0,onClick:n,"aria-pressed":s,transition:{duration:.15},className:L,children:e.jsx("span",{className:f($,s?"bg-foreground text-background":"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:"All"})})}function fe({className:s}){const{filters:n,isFiltered:t,toggleCategory:i,clearAll:a}=w(),r=l.useRef(null),o=V(r,"horizontal"),d=new Set(n.categories?n.categories.split(","):[]),m=()=>{t&&a()};return e.jsxs("div",{className:f("relative",s),children:[e.jsxs("div",{ref:r,onScroll:o.onScroll,"data-slot":"activity-filter-bar",className:"flex items-center gap-1 overflow-x-auto",children:[e.jsx(he,{isActive:!t,onClick:m}),de.map(u=>e.jsx(me,{category:u,isActive:d.has(u),onToggle:()=>i(u)},u)),e.jsx(G,{children:t&&e.jsx(g.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},children:e.jsxs(M,{variant:"ghost",size:"xs",className:"ml-1",onClick:a,children:[e.jsx(Y,{"aria-hidden":!0}),"Clear"]})},"clear-filters")})]}),o.start&&e.jsx("div",{"aria-hidden":!0,"data-testid":"activity-filter-bar-fade-start",className:"from-background via-background/70 pointer-events-none absolute inset-y-0 left-0 w-8 bg-gradient-to-r to-transparent"}),o.end&&e.jsx("div",{"aria-hidden":!0,"data-testid":"activity-filter-bar-fade-end",className:"from-background via-background/70 pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l to-transparent"})]})}function xe({isFiltered:s=!1,view:n="activity",className:t}){const{filters:i,clearAll:a}=w();return n==="all"?e.jsx(b,{className:t,icon:j,headline:"No actions yet",description:"Every action a person or agent takes shows up here."}):s?e.jsx(b,{className:t,icon:j,headline:`No ${ge(i.categories)} activity found`,description:"Try other filters.",action:{label:"Clear filters",onClick:a,variant:"outline"}}):e.jsx(b,{className:t,icon:j,headline:"No activity yet",description:"Your agents’ work shows up here."})}function ge(s){if(!s)return"matching";const t=s.split(",").map(r=>{var o;return((o=A[r])==null?void 0:o.label)??r});if(t.length===1)return t[0];const i=t[t.length-1];return`${t.slice(0,-1).join(", ")} or ${i}`}function ye({view:s,onViewChange:n,className:t}){return e.jsxs(K,{"aria-label":"Which list to show",className:f("w-fit shrink-0",t),value:s,onValueChange:i=>n(i),children:[e.jsx(k,{value:"activity",children:"Activity"}),e.jsx(k,{value:"all",children:"All actions"})]})}function pe(s){const n=Date.now()-new Date(s).getTime(),t=Math.floor(n/36e5);return t<1?"recently":t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function ve(s,n){const t=new Date(n),i={};for(const a of s)new Date(a.occurredAt)>t&&(i[a.category]=(i[a.category]??0)+1);return i}function je(s){const n={tasks:"scheduled run",relay:"message",agent:"agent update",config:"settings change",system:"system event",permissions:"permission change"};return Object.entries(s).filter(([,t])=>t>0).map(([t,i])=>{const a=n[t];return`${i} ${i===1?a:`${a}s`}`}).join(" · ")}function be({lastVisitedAt:s,items:n,className:t}){if(!s)return null;const i=ve(n,s);if(Object.values(i).reduce((d,m)=>d+(m??0),0)===0)return null;const r=pe(s),o=je(i);return e.jsxs(g.div,{"data-slot":"activity-since-last-visit",initial:{opacity:0,y:-6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},className:f("rounded-lg border px-4 py-3","bg-card border-border",t),children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.jsx("span",{className:"text-foreground font-medium",children:"Since your last visit"})," ",e.jsxs("span",{children:["(",r,")"]})]}),e.jsx("p",{className:"text-foreground/80 mt-0.5 text-sm",children:o}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Object.keys(i).map(d=>{const m=i[d];if(!m)return null;const u=A[d];return e.jsxs(W,{shape:"pill",className:f("border-transparent",u.bg,u.text),children:[m," ",u.label]},d)})})]})}const Ae={initial:{opacity:0,y:6},animate:{opacity:1,y:0,transition:{duration:.2,ease:"easeOut"}}};function we(){const s=l.useId(),n=l.useMemo(()=>`${s.split("").reduce((i,a)=>i+a.charCodeAt(0),0)%40+50}%`,[s]);return e.jsxs(oe,{children:[e.jsx(p,{className:"w-28 py-1.5 pr-0 pl-2 max-sm:hidden",children:e.jsx(v,{className:"h-3 w-20"})}),e.jsx(p,{className:"w-24 py-1.5 pr-0 max-sm:hidden",children:e.jsx(v,{className:"h-5 w-20 rounded-full"})}),e.jsx(p,{className:"py-1.5 max-sm:pl-2",children:e.jsx(v,{className:"h-3 rounded",style:{width:n}})}),e.jsx(p,{className:"w-16 py-1.5 max-sm:w-10"})]})}function Ne(){return e.jsxs("div",{"data-slot":"activity-timeline-skeleton",className:"space-y-1",children:[e.jsx("div",{className:"py-2",children:e.jsx(v,{className:"h-3 w-16 rounded"})}),e.jsx(P,{children:e.jsx(_,{children:Array.from({length:5}).map((s,n)=>e.jsx(we,{},n))})})]})}function H({items:s,isLoading:n,isError:t,onRetry:i,isFiltered:a,view:r="activity",className:o}){const d=l.useMemo(()=>te(s,new Date),[s]),{containerRef:m,handleKeyDown:u}=ue(s.length);return n&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(Ne,{})}):t&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(se,{onRetry:i})}):s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(xe,{isFiltered:a,view:r})}):e.jsx("div",{ref:m,onKeyDown:u,"data-slot":"activity-timeline",className:f(o),children:d.map(h=>e.jsxs("section",{children:[e.jsx(ne,{label:h.label}),e.jsx(g.div,{variants:Ae,initial:"initial",animate:"animate",children:e.jsx(P,{children:e.jsx(_,{children:h.items.map(c=>e.jsx(re,{item:c},c.id))})})})]},h.label))})}function O({onLoadMore:s,isFetching:n,hasNextPage:t,className:i}){return t?e.jsx(g.div,{"data-slot":"activity-load-more",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.1},className:f("flex justify-center py-4",i),children:e.jsxs(M,{variant:"outline",size:"sm",onClick:s,disabled:n,className:"gap-2",children:[n&&e.jsx(q,{size:"xs"}),"Load 50 more events"]})}):null}const T=7;function Ce(){var t;const s=z(),{data:n}=U({queryKey:X.dailyCounts(T),queryFn:()=>s.getSessionDailyCounts(T),staleTime:6e4});return!n||n.dailyCounts.length===0?null:{dailyCounts:n.dailyCounts,degraded:(((t=n.warnings)==null?void 0:t.length)??0)>0}}function ke(s,n){const t=s.reduce((a,r)=>a+r,0),i=t===1?"session":"sessions";return n?t===0?"This week’s count is incomplete":`Your agents started at least ${t} ${i} this week`:t===0?"Your agents started no chats this week":`Your agents started ${t} ${i} this week`}const I=10,Se=4,E=30,F=1;function Te({data:s,className:n}){const t=Math.max(...s,1);return e.jsx("svg",{viewBox:"0 0 100 30",className:f("text-muted-foreground",n),"aria-hidden":"true",children:s.map((i,a)=>{const r=i/t*E;return e.jsx("rect",{x:a*(I+Se)+1,y:E-Math.max(r,F),width:I,height:Math.max(r,F),rx:2,fill:"currentColor",opacity:.6},a)})})}function Ie(){const s=Ce();return s===null?null:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:ke(s.dailyCounts,s.degraded)}),e.jsx(Te,{data:s.dailyCounts,className:"h-6 w-24 shrink-0"})]})}function Ee(){const s=l.useId(),n=J("dashboard.sections"),t=l.useMemo(()=>n.filter(i=>Q(i.id)&&(!i.visibleWhen||i.visibleWhen())),[n]);return t.length===0?null:e.jsxs("section",{className:"space-y-3","aria-labelledby":s,children:[e.jsx("h2",{id:s,className:"text-muted-foreground text-xs font-medium tracking-widest uppercase",children:"From your extensions"}),e.jsx("div",{className:"space-y-4",children:t.map(i=>e.jsx(i.component,{},i.id))})]})}function Fe(){const{view:s,setView:n}=ce();return e.jsxs(e.Fragment,{children:[e.jsx(Z,{children:"Activity"}),e.jsxs(ee,{width:"wide",className:"space-y-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(ye,{view:s,onViewChange:n}),s==="activity"&&e.jsx(fe,{className:"min-w-0 flex-1"})]}),e.jsx(Ie,{}),e.jsx(Ee,{}),s==="all"?e.jsx(De,{}):e.jsx(Re,{})]})]})}function Re(){const{queryFilters:s,isFiltered:n}=w(),t=le(),{data:i,isLoading:a,isError:r,refetch:o,isFetchingNextPage:d,hasNextPage:m,fetchNextPage:u}=ae(s),h=l.useMemo(()=>(i==null?void 0:i.pages.flatMap(c=>c.items))??[],[i]);return e.jsxs(e.Fragment,{children:[e.jsx(be,{lastVisitedAt:t,items:h}),e.jsx(H,{items:h,isLoading:a,isError:r,onRetry:()=>void o(),isFiltered:n}),e.jsx(O,{onLoadMore:()=>void u(),isFetching:d,hasNextPage:!!m})]})}function De(){const{data:s,isLoading:n,isError:t,refetch:i,isFetchingNextPage:a,hasNextPage:r,fetchNextPage:o}=ie();return e.jsxs(e.Fragment,{children:[e.jsx(H,{items:s??[],isLoading:n,isError:t,onRetry:()=>void i(),isFiltered:!1,view:"all"}),e.jsx(O,{onLoadMore:()=>void o(),isFetching:a,hasNextPage:!!r})]})}const Be=Fe;export{Be as component};
|
|
1
|
+
import{cj as R,c$ as M,r as l,iK as C,iL as V,j as e,by as G,ar as g,B as D,X as Y,G as f,A as j,gi as K,gj as k,_ as W,e as v,x as q,a1 as z,a2 as U,iM as X,ge as Q,iN as J,eb as Z}from"./index-DKTd8X7n.js";import{P as ee}from"./page-container-D03bhclt.js";import{g as te,A as se,a as ne,b as ie}from"./ActivityErrorState-D1T74VJE.js";import{u as ae}from"./use-full-activity-feed-C2seN-V1.js";import{C as A,A as re}from"./ActivityRow-C-8dACWp.js";import{T as P,a as L,b as oe,c as p}from"./table-BIdFvzBs.js";import{E as b}from"./empty-state-Bxfi7_ss.js";const S=["categories","actorType","actorId","since"];function w(){const s=R(),n=M({strict:!1}),t={categories:n.categories,actorType:n.actorType,actorId:n.actorId,since:n.since},i=S.some(c=>n[c]!==void 0),a={};t.categories&&(a.categories=t.categories),t.actorType&&(a.actorType=t.actorType),t.actorId&&(a.actorId=t.actorId),t.since&&(a.since=t.since);const r=l.useCallback(c=>{s({search:c})},[s]),o=l.useCallback(c=>{r(x=>{const y=x.categories?x.categories.split(","):[],N=y.includes(c)?y.filter(O=>O!==c):[...y,c];return{...x,categories:N.length>0?N.join(","):void 0}})},[r]),d=l.useCallback(c=>{r(x=>({...x,actorType:c}))},[r]),m=l.useCallback(c=>{r(x=>({...x,actorId:c}))},[r]),u=l.useCallback(c=>{r(x=>({...x,since:c}))},[r]),h=l.useCallback(()=>{r(c=>{const x={...c};for(const y of S)delete x[y];return x})},[r]);return{filters:t,queryFilters:a,isFiltered:i,toggleCategory:o,setActorType:d,setActorId:m,setSince:u,clearAll:h}}function ce(){const s=R(),t=M({strict:!1}).view==="all"?"all":"activity",i=l.useCallback(a=>{s({search:(r=>({...r,view:a==="all"?"all":void 0}))})},[s]);return{view:t,setView:i}}function le(){const[s]=l.useState(()=>C.getState().lastSeenAt);return l.useEffect(()=>{const{markSeen:n,setViewing:t}=C.getState();return n(),t(!0),()=>{n(),t(!1)}},[]),s}function ue(s){const n=l.useRef(null),t=l.useCallback(i=>{var d,m,u;const a=n.current;if(!a)return;const r=a.querySelectorAll("[data-activity-row]"),o=Array.from(r).findIndex(h=>h===document.activeElement||h.contains(document.activeElement));switch(i.key){case"ArrowDown":{i.preventDefault();const h=Math.min(o+1,r.length-1);(d=r[h])==null||d.focus();break}case"ArrowUp":{i.preventDefault();const h=Math.max(o-1,0);(m=r[h])==null||m.focus();break}case"Escape":{(u=document.activeElement)==null||u.blur();break}}},[s]);return{containerRef:n,handleKeyDown:t}}const de=["tasks","relay","agent","config","system","permissions"],_="group inline-flex min-h-11 shrink-0 items-center outline-none md:min-h-0",$="inline-flex h-6 items-center rounded-full px-2.5 text-xs font-medium transition-colors group-focus-visible:ring-ring group-focus-visible:ring-2 group-focus-visible:ring-offset-1";function me({category:s,isActive:n,onToggle:t}){const i=A[s];return e.jsx(g.button,{type:"button",layout:!0,onClick:t,"aria-pressed":n,transition:{duration:.15},className:_,children:e.jsx("span",{className:f($,n?f(i.bg,i.text):"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:i.label})})}function he({isActive:s,onClick:n}){return e.jsx(g.button,{type:"button",layout:!0,onClick:n,"aria-pressed":s,transition:{duration:.15},className:_,children:e.jsx("span",{className:f($,s?"bg-foreground text-background":"text-muted-foreground group-hover:bg-muted group-hover:text-foreground"),children:"All"})})}function fe({className:s}){const{filters:n,isFiltered:t,toggleCategory:i,clearAll:a}=w(),r=l.useRef(null),o=V(r,"horizontal"),d=new Set(n.categories?n.categories.split(","):[]),m=()=>{t&&a()};return e.jsxs("div",{className:f("relative",s),children:[e.jsxs("div",{ref:r,onScroll:o.onScroll,"data-slot":"activity-filter-bar",className:"flex items-center gap-1 overflow-x-auto",children:[e.jsx(he,{isActive:!t,onClick:m}),de.map(u=>e.jsx(me,{category:u,isActive:d.has(u),onToggle:()=>i(u)},u)),e.jsx(G,{children:t&&e.jsx(g.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},transition:{duration:.15},children:e.jsxs(D,{variant:"ghost",size:"xs",className:"ml-1",onClick:a,children:[e.jsx(Y,{"aria-hidden":!0}),"Clear"]})},"clear-filters")})]}),o.start&&e.jsx("div",{"aria-hidden":!0,"data-testid":"activity-filter-bar-fade-start",className:"from-background via-background/70 pointer-events-none absolute inset-y-0 left-0 w-8 bg-gradient-to-r to-transparent"}),o.end&&e.jsx("div",{"aria-hidden":!0,"data-testid":"activity-filter-bar-fade-end",className:"from-background via-background/70 pointer-events-none absolute inset-y-0 right-0 w-8 bg-gradient-to-l to-transparent"})]})}function xe({isFiltered:s=!1,view:n="activity",className:t}){const{filters:i,clearAll:a}=w();return n==="all"?e.jsx(b,{className:t,icon:j,headline:"No actions yet",description:"Every action a person or agent takes shows up here."}):s?e.jsx(b,{className:t,icon:j,headline:`No ${ge(i.categories)} activity found`,description:"Try other filters.",action:{label:"Clear filters",onClick:a,variant:"outline"}}):e.jsx(b,{className:t,icon:j,headline:"No activity yet",description:"Your agents’ work shows up here."})}function ge(s){if(!s)return"matching";const t=s.split(",").map(r=>{var o;return((o=A[r])==null?void 0:o.label)??r});if(t.length===1)return t[0];const i=t[t.length-1];return`${t.slice(0,-1).join(", ")} or ${i}`}function ye({view:s,onViewChange:n,className:t}){return e.jsxs(K,{"aria-label":"Which list to show",className:f("w-fit shrink-0",t),value:s,onValueChange:i=>n(i),children:[e.jsx(k,{value:"activity",children:"Activity"}),e.jsx(k,{value:"all",children:"All actions"})]})}function pe(s){const n=Date.now()-new Date(s).getTime(),t=Math.floor(n/36e5);return t<1?"recently":t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function ve(s,n){const t=new Date(n),i={};for(const a of s)new Date(a.occurredAt)>t&&(i[a.category]=(i[a.category]??0)+1);return i}function je(s){const n={tasks:"scheduled run",relay:"message",agent:"agent update",config:"settings change",system:"system event",permissions:"permission change"};return Object.entries(s).filter(([,t])=>t>0).map(([t,i])=>{const a=n[t];return`${i} ${i===1?a:`${a}s`}`}).join(" · ")}function be({lastVisitedAt:s,items:n,className:t}){if(!s)return null;const i=ve(n,s);if(Object.values(i).reduce((d,m)=>d+(m??0),0)===0)return null;const r=pe(s),o=je(i);return e.jsxs(g.div,{"data-slot":"activity-since-last-visit",initial:{opacity:0,y:-6},animate:{opacity:1,y:0},transition:{duration:.2,ease:"easeOut"},className:f("rounded-lg border px-4 py-3","bg-card border-border",t),children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.jsx("span",{className:"text-foreground font-medium",children:"Since your last visit"})," ",e.jsxs("span",{children:["(",r,")"]})]}),e.jsx("p",{className:"text-foreground/80 mt-0.5 text-sm",children:o}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:Object.keys(i).map(d=>{const m=i[d];if(!m)return null;const u=A[d];return e.jsxs(W,{shape:"pill",className:f("border-transparent",u.bg,u.text),children:[m," ",u.label]},d)})})]})}const Ae={initial:{opacity:0,y:6},animate:{opacity:1,y:0,transition:{duration:.2,ease:"easeOut"}}};function we(){const s=l.useId(),n=l.useMemo(()=>`${s.split("").reduce((i,a)=>i+a.charCodeAt(0),0)%40+50}%`,[s]);return e.jsxs(oe,{children:[e.jsx(p,{className:"w-28 py-1.5 pr-0 pl-2 max-sm:hidden",children:e.jsx(v,{className:"h-3 w-20"})}),e.jsx(p,{className:"w-24 py-1.5 pr-0 max-sm:hidden",children:e.jsx(v,{className:"h-5 w-20 rounded-full"})}),e.jsx(p,{className:"py-1.5 max-sm:pl-2",children:e.jsx(v,{className:"h-3 rounded",style:{width:n}})}),e.jsx(p,{className:"w-16 py-1.5 max-sm:w-10"})]})}function Ne(){return e.jsxs("div",{"data-slot":"activity-timeline-skeleton",className:"space-y-1",children:[e.jsx("div",{className:"py-2",children:e.jsx(v,{className:"h-3 w-16 rounded"})}),e.jsx(P,{children:e.jsx(L,{children:Array.from({length:5}).map((s,n)=>e.jsx(we,{},n))})})]})}function H({items:s,isLoading:n,isError:t,onRetry:i,isFiltered:a,view:r="activity",className:o}){const d=l.useMemo(()=>te(s,new Date),[s]),{containerRef:m,handleKeyDown:u}=ue(s.length);return n&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(Ne,{})}):t&&s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(se,{onRetry:i})}):s.length===0?e.jsx("div",{"data-slot":"activity-timeline",className:f(o),children:e.jsx(xe,{isFiltered:a,view:r})}):e.jsx("div",{ref:m,onKeyDown:u,"data-slot":"activity-timeline",className:f(o),children:d.map(h=>e.jsxs("section",{children:[e.jsx(ne,{label:h.label}),e.jsx(g.div,{variants:Ae,initial:"initial",animate:"animate",children:e.jsx(P,{children:e.jsx(L,{children:h.items.map(c=>e.jsx(re,{item:c},c.id))})})})]},h.label))})}function B({onLoadMore:s,isFetching:n,hasNextPage:t,className:i}){return t?e.jsx(g.div,{"data-slot":"activity-load-more",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.1},className:f("flex justify-center py-4",i),children:e.jsxs(D,{variant:"outline",size:"sm",onClick:s,disabled:n,className:"gap-2",children:[n&&e.jsx(q,{size:"xs"}),"Load 50 more events"]})}):null}const T=7;function Ce(){var t;const s=z(),{data:n}=U({queryKey:X.dailyCounts(T),queryFn:()=>s.getSessionDailyCounts(T),staleTime:6e4});return!n||n.dailyCounts.length===0?null:{dailyCounts:n.dailyCounts,degraded:(((t=n.warnings)==null?void 0:t.length)??0)>0}}function ke(s,n){const t=s.reduce((a,r)=>a+r,0),i=t===1?"session":"sessions";return n?t===0?"This week’s count is incomplete":`Your agents started at least ${t} ${i} this week`:t===0?"Your agents started no chats this week":`Your agents started ${t} ${i} this week`}const I=10,Se=4,E=30,F=1;function Te({data:s,className:n}){const t=Math.max(...s,1);return e.jsx("svg",{viewBox:"0 0 100 30",className:f("text-muted-foreground",n),"aria-hidden":"true",children:s.map((i,a)=>{const r=i/t*E;return e.jsx("rect",{x:a*(I+Se)+1,y:E-Math.max(r,F),width:I,height:Math.max(r,F),rx:2,fill:"currentColor",opacity:.6},a)})})}function Ie(){const s=Ce();return s===null?null:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:ke(s.dailyCounts,s.degraded)}),e.jsx(Te,{data:s.dailyCounts,className:"h-6 w-24 shrink-0"})]})}function Ee(){const s=l.useId(),n=Q("dashboard.sections"),t=l.useMemo(()=>n.filter(i=>J(i.id)&&(!i.visibleWhen||i.visibleWhen())),[n]);return t.length===0?null:e.jsxs("section",{className:"space-y-3","aria-labelledby":s,children:[e.jsx("h2",{id:s,className:"text-muted-foreground text-xs font-medium tracking-widest uppercase",children:"From your extensions"}),e.jsx("div",{className:"space-y-4",children:t.map(i=>e.jsx(i.component,{},i.id))})]})}function Fe(){const{view:s,setView:n}=ce();return e.jsxs(e.Fragment,{children:[e.jsx(Z,{children:"Activity"}),e.jsxs(ee,{width:"wide",className:"space-y-4",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx(ye,{view:s,onViewChange:n}),s==="activity"&&e.jsx(fe,{className:"min-w-0 flex-1"})]}),e.jsx(Ie,{}),e.jsx(Ee,{}),s==="all"?e.jsx(Me,{}):e.jsx(Re,{})]})]})}function Re(){const{queryFilters:s,isFiltered:n}=w(),t=le(),{data:i,isLoading:a,isError:r,refetch:o,isFetchingNextPage:d,hasNextPage:m,fetchNextPage:u}=ae(s),h=l.useMemo(()=>(i==null?void 0:i.pages.flatMap(c=>c.items))??[],[i]);return e.jsxs(e.Fragment,{children:[e.jsx(be,{lastVisitedAt:t,items:h}),e.jsx(H,{items:h,isLoading:a,isError:r,onRetry:()=>void o(),isFiltered:n}),e.jsx(B,{onLoadMore:()=>void u(),isFetching:d,hasNextPage:!!m})]})}function Me(){const{data:s,isLoading:n,isError:t,refetch:i,isFetchingNextPage:a,hasNextPage:r,fetchNextPage:o}=ie();return e.jsxs(e.Fragment,{children:[e.jsx(H,{items:s??[],isLoading:n,isError:t,onRetry:()=>void i(),isFiltered:!1,view:"all"}),e.jsx(B,{onLoadMore:()=>void o(),isFetching:a,hasNextPage:!!r})]})}const Oe=Fe;export{Oe as component};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{lf as be,lg as ye,j as t,hV as $,hW as F,hX as L,hY as B,hZ as q,_ as I,ay as A,O as Se,Q as Ne,C as ke,U as we,lh as z,B as b,li as Re,lj as Ce,cj as W,e as C,G as y,s as H,r as m,J as Ie,lk as Ae,aj as Pe,ak as De,dV as Oe,aY as Me,X as oe,ll as Te,lm as Ee,aQ as $e,dW as ie,iL as Fe,by as G,ar as R,T as Le,ln as Be,i_ as qe,lo as ze,eG as We,eH as He,iY as _e,j3 as Ue,lp as Ve,lq as Ge,eA as ae,eC as Ke,lr as Ye,c$ as re,ad as Qe,eD as Xe,iZ as Je,l as le,ls as de,lt as ce,gX as Ze,lu as _,eB as et,bf as tt,a$ as st,hI as nt,gB as ot,lv as it,as as at,gY as ue,g as rt,gk as me,lw as K,ai as Y,c7 as lt,lx as dt,ly as ct,lz as ut,a1 as mt,lA as ht,cf as gt,bP as ft,jl as pt,aP as xt,i6 as jt,eM as M,k7 as vt,q as Q,eb as bt,g$ as yt,lB as St,n as Nt}from"./index-DKTd8X7n.js";import{I as kt,p as wt}from"./ChannelComposer-DIRPjyyf.js";import{c as Rt}from"./index-BsmR2hi4.js";import{a as Ct}from"./RoomSurface-BQhgKnIE.js";import{P as he}from"./PromptSuggestionChips-CmW1lIso.js";import{S as U}from"./scroll-area-DVd6ctli.js";import{d as It}from"./dead-letter-reasons-DtBHju9v.js";import{u as At}from"./use-mesh-topology-CnCeK4gS.js";import{A as Pt}from"./AttentionSignalRow-CgGyTDmT.js";import{u as ge}from"./use-promo-dismissals-4rbLgSDG.js";import{u as Dt,s as Ot,P as Mt,a as Tt}from"./use-promo-activation-CjtGhz_3.js";import"./repeat-DPzic7-j.js";import"./use-room-sessions-CoEIaBRt.js";import"./WidgetErrorCard-CAUx4KUI.js";import"./index-CSqz4B0v.js";import"./card-D4ek-VvX.js";import"./progress-BB97hlmb.js";import"./markdown-content-CN_dGlgE.js";import"./table-BIdFvzBs.js";import"./package-BVNiaGrb.js";import"./heart-DnR_GX4I.js";import"./git-branch-D5xr7U5P.js";import"./file-text-BJt8biPY.js";import"./file-C-ooqbRY.js";import"./find-latest-widget-fence-DPQimlUD.js";import"./format-duration-BCr6uzby.js";import"./RuntimeSetupDialog-CUFie4LV.js";import"./inline-code-DlVYFFW7.js";import"./list-runtime-types-D5ZO30FL.js";import"./RuntimeConnectFlow-DN2ElvcH.js";import"./useMutationState-BAU_J-u3.js";import"./runtime-connect-Dn0T5YWv.js";import"./mention-pill-C6OT4gx4.js";import"./rotate-ccw-clock-gqBy98sI.js";import"./unplug-xlfZ61jC.js";import"./message-square-off-DlkAPJdd.js";import"./registry-DRvQ3ChB.js";import"./file-drag-GDx2qhdk.js";import"./paperclip-DQQVX5tJ.js";import"./index-B0jt7Nng.js";import"./pane-resize-handle-CZ9rHhNr.js";import"./UnreadDivider-LbVIAoxM.js";import"./use-room-follow-claim-Doq_lWjk.js";import"./use-connector-management-PDVdWccW.js";import"./AgentRequestCard-BuXVpWfb.js";import"./access-copy-BZNjpw9v.js";import"./query-error-state-B456s96E.js";import"./empty-state-Bxfi7_ss.js";import"./use-bindings-BPNK3sUh.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-DAMr1NNY.js";import"./use-update-config-NRkQbxae.js";import"./use-relay-config-CvU_70WJ.js";function Et({open:e,itemId:n,onClose:o}){const{data:s}=be(),i=ye(),a=(n==null?void 0:n.indexOf("::"))??-1,r=a>=0?n.slice(0,a):void 0,l=a>=0?n.slice(a+2):void 0,d=s==null?void 0:s.find(h=>h.source===r&&h.reason===l),c=()=>{!r||!l||i.mutate({source:r,reason:l},{onSuccess:o})};return t.jsx($,{open:e,onOpenChange:h=>!h&&o(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:"Messages that never arrived"}),t.jsx(q,{children:r??"Source unknown"})]}),t.jsx(U,{className:"flex-1 px-4",children:d?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{className:"text-muted-foreground text-sm",children:"These never reached an agent. Clearing them doesn’t send them."}),t.jsxs("p",{className:"text-foreground text-sm",children:[d.count," message",d.count===1?"":"s"," couldn’t be delivered"]}),t.jsx(I,{variant:"secondary",children:It(d.reason)})]}),t.jsxs("div",{className:"space-y-1 text-sm",children:[t.jsxs("p",{className:"text-muted-foreground",children:["First happened ",A(d.firstSeen)," ago"]}),t.jsxs("p",{className:"text-muted-foreground",children:["Last happened ",A(d.lastSeen)," ago"]})]}),d.sample!=null&&t.jsxs(Se,{children:[t.jsxs(Ne,{className:"text-muted-foreground hover:text-foreground group flex items-center gap-1 text-xs font-medium transition-colors",children:[t.jsx(ke,{className:"size-3 transition-transform group-data-[state=open]:rotate-90"}),"What one of them looked like"]}),t.jsx(we,{children:t.jsx("pre",{className:"bg-muted mt-1 overflow-x-auto rounded-md p-3 font-mono text-xs",children:JSON.stringify(d.sample,null,2)})})]})]}):t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:"These are cleared already."})}),t.jsxs(z,{children:[d&&t.jsx(b,{variant:"destructive",onClick:c,disabled:i.isPending,children:i.isPending?"Clearing…":"Clear these"}),t.jsx(b,{variant:"outline",onClick:o,children:"Close"})]})]})})}function $t(e){const n=Math.floor(e/1e3);if(n<60)return`${n}s`;const o=Math.floor(n/60),s=n%60;if(o<60)return`${o}m ${s}s`;const i=Math.floor(o/60),a=o%60;return`${i}h ${a}m`}function Ft(e){switch(e){case"blocked":return{label:"Blocked",badge:"outline",tone:"warning",heading:"What it needed",title:"Run that couldn’t use its tools"};case"failed":return{label:"Didn’t finish",badge:"destructive",tone:"error",heading:"Error",title:"Run that didn’t finish"};case"cancelled":return{label:"Cancelled",badge:"secondary",tone:"neutral",heading:"Stopped",title:"Run that was stopped"};case"skipped":return{label:"Skipped",badge:"secondary",tone:"neutral",heading:"Why",title:"Run that never started"};case"running":return{label:"Running",badge:"secondary",tone:"neutral",heading:"Latest",title:"Run that is still going"};default:return{label:"Completed",badge:"secondary",tone:"neutral",heading:"Note",title:"Run that finished"}}}const Lt={error:{box:"bg-destructive/10 border-destructive/20",heading:"text-destructive",body:"text-destructive"},warning:{box:"bg-status-warning-bg border-status-warning-border",heading:"text-status-warning-fg",body:"text-status-warning-fg"},neutral:{box:"bg-muted border-border",heading:"text-foreground",body:"text-foreground/80"}};function Bt({open:e,itemId:n,onClose:o}){const{data:s,isLoading:i,isError:a}=Re(e?n??null:null),r=Ce(),l=W(),d=()=>{s!=null&&s.sessionId&&l(H({session:s.sessionId}))},c=()=>{s&&r.mutate(s.id)},h=s?Ft(s.status):null,g=h?Lt[h.tone]:null;return t.jsx($,{open:e,onOpenChange:f=>!f&&o(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:(h==null?void 0:h.title)??"Run that needs a look"}),t.jsx(q,{children:n?n.slice(0,8):"Unknown"})]}),t.jsxs(U,{className:"flex-1 px-4",children:[i&&t.jsxs("div",{className:"space-y-4",children:[t.jsx(C,{className:"h-6 w-24"}),t.jsx(C,{className:"h-4 w-48"}),t.jsx(C,{className:"h-20 w-full"})]}),a&&t.jsx("p",{className:"text-destructive py-8 text-center text-sm",children:"Couldn’t load this run."}),!i&&!a&&!s&&t.jsx("p",{className:"text-muted-foreground py-8 text-center text-sm",children:"Already resolved."}),s&&t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(I,{variant:h.badge,children:h.label}),t.jsx(I,{variant:"secondary",children:s.trigger==="scheduled"?"Scheduled":"Manual"})]}),t.jsxs("div",{className:"space-y-1 text-sm",children:[s.startedAt&&t.jsxs("p",{className:"text-muted-foreground",children:["Started: ",A(s.startedAt)," ago"]}),s.finishedAt&&t.jsxs("p",{className:"text-muted-foreground",children:["Finished: ",A(s.finishedAt)," ago"]}),s.durationMs!=null&&t.jsxs("p",{className:"text-muted-foreground",children:["Duration: ",$t(s.durationMs)]})]}),s.error&&t.jsxs("div",{className:y("rounded-md border p-3",g.box),children:[t.jsx("p",{className:y("text-sm font-medium",g.heading),children:h.heading}),t.jsx("p",{className:y("mt-1 text-sm",g.body),children:s.error})]}),s.outputSummary&&t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-muted-foreground text-xs font-medium",children:"Output"}),t.jsx("pre",{className:"bg-muted max-h-48 overflow-auto rounded-md p-3 font-mono text-xs",children:s.outputSummary})]})]})]}),t.jsxs(z,{children:[(s==null?void 0:s.sessionId)&&t.jsx(b,{variant:"default",onClick:d,children:"View chat"}),(s==null?void 0:s.status)==="running"&&t.jsx(b,{variant:"destructive",onClick:c,disabled:r.isPending,children:r.isPending?"Cancelling…":"Cancel run"}),t.jsx(b,{variant:"outline",onClick:o,children:"Close"})]})]})})}function qt({agent:e}){const n=Ae(e,e.projectPath??"");return t.jsxs("div",{className:"flex items-center gap-3 py-2",children:[t.jsx(Pe,{color:n.color,emoji:n.emoji,size:"sm",className:"shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-foreground truncate text-sm font-medium",children:De(e)}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(I,{variant:"destructive",children:"Unreachable"}),e.runtime&&t.jsx(I,{variant:"secondary",children:Oe(e.runtime).label})]})]}),e.lastSeenAt&&t.jsxs("span",{className:"text-muted-foreground shrink-0 text-xs",children:[A(e.lastSeenAt)," ago"]})]})}function zt({open:e,onClose:n}){const{data:o}=At(void 0,e),s=m.useMemo(()=>o?o.namespaces.flatMap(i=>i.agents).filter(i=>i.healthStatus==="unreachable"):[],[o]);return t.jsx($,{open:e,onOpenChange:i=>!i&&n(),children:t.jsxs(F,{side:"right",children:[t.jsxs(L,{children:[t.jsx(B,{children:"Agents that aren’t answering"}),t.jsxs(q,{children:["DorkOS can’t reach ",s.length," agent",s.length===1?"":"s"," right now"]})]}),t.jsx(U,{className:"flex-1 px-4",children:s.length>0?t.jsx("div",{className:"divide-y",children:s.map(i=>t.jsx(qt,{agent:i},i.id))}):t.jsxs("div",{className:"flex flex-col items-center gap-2 py-8",children:[t.jsx(Ie,{className:"text-status-success size-6"}),t.jsx("p",{className:"text-muted-foreground text-sm",children:"All agents are online"})]})}),t.jsx(z,{children:t.jsx(b,{variant:"outline",onClick:n,children:"Close"})})]})})}function Wt(e){return e.content.suggestion!==void 0}function Ht(){const e=Dt(),{dismissedIds:n}=ge(),o=Me(s=>s.promoEnabled);return m.useMemo(()=>{if(!o)return null;const[s]=Ot(Mt.filter(Wt),e,n,1);return s??null},[e,n,o])}function _t({suggestion:e,promoTitle:n,onAccept:o,onDismiss:s}){return t.jsxs("p",{"data-slot":"quiet-suggestion",className:"text-muted-foreground/70 text-2xs mt-1",children:[e.question," ",t.jsx("button",{type:"button",onClick:o,className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm font-medium underline-offset-4 transition-colors hover:underline focus-visible:underline",children:e.action}),t.jsx("button",{type:"button","aria-label":`Dismiss suggestion: ${n}`,onClick:s,className:"text-muted-foreground/60 hover:text-foreground focus-ring -my-1.5 ml-0.5 inline-flex translate-y-[3px] items-center justify-center rounded-sm p-1.5 align-baseline transition-colors",children:t.jsx(oe,{className:"size-3"})})]})}function Ut({promo:e}){const{dismissPromo:n}=ge(),{activate:o,dialog:s}=Tt(e);return t.jsxs(t.Fragment,{children:[t.jsx(_t,{suggestion:e.content.suggestion,promoTitle:e.content.title,onAccept:o,onDismiss:()=>n(e.id)}),s]})}function Vt(){const e=Ht();return e===null?null:t.jsx(Ut,{promo:e},e.id)}const Gt=["report.daily"];function fe(){const{notifications:e}=Te({kinds:Gt,unread:!0});return m.useMemo(()=>e[0],[e])}function Kt({questions:e,requests:n,schedules:o,approvalsUnavailable:s,attention:i}){const a=[],r=[],l=e+n+o;return l>0?(a.push(`${Ee(e,n,o)} ${l===1?"is":"are"} waiting on you.`),r.push(`${l} waiting`)):s&&(a.push("Couldn’t read approvals."),r.push("Couldn’t read approvals")),i===1?(a.push("1 thing needs attention."),r.push("1 needs attention")):i>1&&(a.push(`${i} things need attention.`),r.push(`${i} need attention`)),{spoken:a.join(" "),compact:r.join(" · ")}}function Yt({notification:e,onDismiss:n}){return t.jsxs("div",{"data-slot":"shift-report-card",className:"border-border/60 bg-background/60 relative rounded-lg border p-3 pr-8",children:[t.jsxs("div",{className:"flex items-start gap-2.5",children:[t.jsx($e,{"aria-hidden":!0,className:"text-muted-foreground mt-0.5 size-3.5 shrink-0"}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-foreground text-xs font-medium",children:e.title}),e.body!==void 0&&t.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:e.body})]})]}),t.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss",className:"text-muted-foreground hover:text-foreground focus-ring absolute top-2 right-2 rounded-md p-1 transition-colors",children:t.jsx(oe,{className:"size-3.5"})})]})}const Qt="max-h-[40svh] sm:max-h-[50svh]",Xt={initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0}};function T({title:e,tone:n="waiting",children:o}){const s=m.useId();return t.jsxs("section",{"aria-labelledby":s,className:"min-w-0",children:[t.jsx("h2",{id:s,className:y("mb-2 text-xs font-medium",n==="waiting"?"text-status-warning-fg":"text-muted-foreground"),children:e}),o]})}function X({edge:e}){return t.jsx("div",{"aria-hidden":"true","data-slot":`pinned-triage-fade-${e}`,className:y("from-background/95 via-background/65 pointer-events-none absolute inset-x-0 h-6 to-transparent",e==="bottom"?"bottom-0 bg-gradient-to-t":"top-0 bg-gradient-to-b")})}const J={animate:{transition:{staggerChildren:.04}}};function Jt(e){return e?0:.18}function Zt({approvals:e,asks:n,settlingAsks:o,askAgentNames:s,onOpenSession:i,approvalsUnavailable:a,onRetryApprovals:r,scheduleApprovals:l,errorSignals:d,activityItems:c,onOpenActivity:h,shiftReport:g,presence:f,condensed:j,onExpand:x,className:u}){const p=ie(),v=m.useRef(null),N=Fe(v),k=e.length>0||n.length>0||o.length>0||l.length>0||a,P=d.length>0,w=c.length>0,je=k||P||w||g!==void 0||(f==null?void 0:f.occupied)===!0,O=Kt({questions:n.length,requests:e.length,schedules:l.length,approvalsUnavailable:a,attention:d.length+c.length}),ve=j===!0&&O.compact!=="";return t.jsxs(t.Fragment,{children:[t.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:O.spoken}),t.jsxs(G,{initial:!1,children:[ve&&t.jsx(R.div,{"data-slot":"pinned-triage-summary",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:Jt(p===!0)},className:y("bg-background/95 border-border/60 shrink-0 border-b backdrop-blur-sm",u),children:t.jsxs("button",{type:"button",onClick:x,className:"text-muted-foreground hover:text-foreground flex min-h-11 w-full min-w-0 items-center gap-2 px-[var(--msg-padding-x)] text-left text-xs",children:[t.jsx("span",{className:"bg-status-warning-dot size-1.5 shrink-0 rounded-full","aria-hidden":!0}),t.jsx("span",{className:"min-w-0 flex-1 truncate",children:O.compact}),t.jsx(Le,{className:"size-3.5 shrink-0","aria-hidden":!0})]})},"triage-summary"),je&&j!==!0&&t.jsxs(R.div,{"data-slot":"pinned-triage-header",...Xt,transition:{duration:p?0:.25,ease:[0,0,.2,1]},className:y("bg-background/95 border-border/60 relative shrink-0 overflow-hidden border-b backdrop-blur-sm",u),children:[t.jsxs("div",{ref:v,onScroll:N.onScroll,"data-slot":"pinned-triage-scroller",className:y("flex w-full min-w-0 scroll-py-6 flex-col gap-3 overflow-y-auto overscroll-contain px-[var(--msg-padding-x)] py-3",Qt),children:[k&&t.jsxs(T,{title:"Waiting on you",children:[(n.length>0||o.length>0)&&t.jsx(Be,{asks:n,agentNames:s,onOpenSession:i,emptyState:t.jsx("p",{className:"text-muted-foreground text-xs",children:"Nothing needs you"})}),e.length>0&&t.jsx(qe,{approvals:e}),e.length===0&&a&&t.jsx(ze,{onRetry:r}),t.jsx(G,{initial:!1,children:l.map(S=>t.jsx(We,{task:S,className:"mt-2"},S.id))})]}),P&&t.jsx(T,{title:"Needs attention",children:t.jsx("div",{className:"border-status-warning-border/40 bg-background/60 rounded-lg border p-2",children:t.jsx(R.div,{variants:J,initial:"initial",animate:"animate",children:d.map(S=>t.jsx(Pt,{signal:S},S.id))})})}),g&&t.jsx(Yt,{notification:g.notification,onDismiss:g.onDismiss}),w&&t.jsx(T,{title:"Recent activity",tone:"neutral",children:t.jsx("div",{className:"border-border/60 bg-background/60 rounded-lg border p-2",children:t.jsx(R.div,{variants:J,initial:"initial",animate:"animate",children:c.map(S=>t.jsx(He,{notification:S,onOpen:()=>h(S)},S.id))})})}),f==null?void 0:f.node]}),N.start&&t.jsx(X,{edge:"top"}),N.end&&t.jsx(X,{edge:"bottom"})]},"triage-header")]})]})}function es({presence:e,composerFocused:n,onExpand:o,className:s}){const{approvals:i,isError:a,retry:r}=_e(),{interactions:l}=Ue(),d=Ve(),c=Ge(l),{schedules:h,errors:g,activity:f}=ae(),j=Ke(),x=fe(),{mutate:u}=Ye(),p=re({strict:!1}),v=W(),N=Qe(),k=Xe(h),P=Je(i),w=m.useCallback(()=>{v({...le.home(),search:{}})},[v]);return t.jsxs(t.Fragment,{children:[t.jsx(Zt,{approvals:P,asks:l,settlingAsks:d,askAgentNames:c,onOpenSession:V=>{v(H({session:V}))},approvalsUnavailable:a&&i.length===0,onRetryApprovals:r,scheduleApprovals:k,errorSignals:g,activityItems:f,onOpenActivity:j,shiftReport:x===void 0?void 0:{notification:x,onDismiss:()=>u(x.id)},presence:e,condensed:N&&n===!0,onExpand:o,className:s}),t.jsx(Et,{open:p.detail==="dead-letter",itemId:p.itemId,onClose:w}),t.jsx(Bt,{open:p.detail==="failed-run",itemId:p.itemId,onClose:w}),t.jsx(zt,{open:p.detail==="offline-agent",onClose:w})]})}const ts=["What can you help with?","Make my first agent","What’s in this project?","Set up a daily run"];function ss({roomId:e}){const n=m.useCallback(o=>{de.getState().set(e,o),ce.getState().requestFocus(e)},[e]);return t.jsx("div",{className:"w-full px-[var(--msg-padding-x)] pb-1",children:t.jsx(he,{suggestions:ts,onChipClick:n,ariaLabel:"Ways to start",size:"comfortable"})})}function ns(e){var a;const{data:n}=Ze(e),o=((a=n==null?void 0:n.members.find(r=>r.author.id===n.viewerAuthorId))==null?void 0:a.lastReadSeq)??null,[s,i]=m.useState({roomId:null,seq:null});return s.roomId===e?s.seq:o===null?null:(i({roomId:e,seq:o}),o)}function os(e,n){if(e===void 0)return null;let o=null,s=1/0;for(const i of e){if(!i.enabled||i.status!=="active")continue;const a=i.nextRun;if(a==null)continue;const r=Date.parse(a);Number.isNaN(r)||r<=n||r>=s||(s=r,o={name:i.displayName??i.name,at:a})}return o}function is(e,n){const o=new Date(e),s=o.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),i=as(new Date(n),o);return i===0?`today at ${s}`:i===1?`tomorrow at ${s}`:`on ${o.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})} at ${s}`}function as(e,n){const o=s=>new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime();return Math.round((o(n)-o(e))/864e5)}function rs(e,n){return e===null?null:`Next up: ${e.name} runs ${is(e.at,n)}.`}function ls({forwardLook:e,suggestion:n}){return t.jsx(R.div,{"data-slot":"home-quiet-state",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2},className:"border-border/60 shrink-0 border-b",children:t.jsxs("div",{className:"w-full px-[var(--msg-padding-x)] py-2",children:[t.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.jsx("span",{className:"text-foreground/80 font-medium",children:"All quiet."}),e!==null&&t.jsxs(t.Fragment,{children:[" ",e]})]}),n]})})}function ds({roomId:e,presenceOccupied:n}){const o=_(e),s=ns(e),{items:i,isLoading:a,isAnyError:r}=et(),{total:l}=ae(),d=fe(),c=o!==void 0&&o.length>0,h=s!==null&&o!==void 0&&o.every(k=>k.seq<=s),g=i.length>0||a||r||l>0||d!==void 0||n,f=c&&h&&!g,[j,x]=m.useState("waiting");f&&j==="waiting"?x("shown"):!f&&j==="shown"&&x("retired");const u=f&&j!=="retired",p=tt(),{data:v}=st(p&&u),N=nt();return u?t.jsx(ls,{forwardLook:rs(os(v,N),N),suggestion:t.jsx(Vt,{})}):null}const pe="dorkos:home-opened-on";function Z(){const e=new Date,n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${n}-${o}`}function cs(){try{return localStorage.getItem(pe)}catch{return null}}function us(e){try{localStorage.setItem(pe,e)}catch{}}function ms(){const[e]=m.useState(()=>cs()!==Z());return m.useEffect(()=>{e&&us(Z())},[e]),e}function hs({children:e}){const n=ms(),o=ie(),s=n&&o!==!0;return t.jsx(R.div,{className:"h-full",initial:s?{opacity:0}:!1,animate:{opacity:1},transition:{duration:.45,ease:[0,0,.2,1]},children:e})}const ee="@dorkbot",gs="Build me a tracker for my customers",fs="Make a daily plan board",xe="Something else",ps=[gs,fs,xe];function xs({roomId:e,mode:n}){const o=Rt(),s=ot(),i=m.useCallback(a=>{if(a===xe){de.getState().set(e,`${ee} `),ce.getState().requestFocus(e);return}o.mutate({roomId:e,text:`${ee} ${a}`,clientId:it()})},[e,o]);return n==="starters"?t.jsx("div",{className:"w-full px-[var(--msg-padding-x)] pb-1","data-testid":"first-run-chips",children:t.jsx(he,{suggestions:ps,onChipClick:i,ariaLabel:"First jobs for DorkBot",size:"comfortable"})}):t.jsxs("div",{className:"flex w-full flex-wrap gap-2 px-[var(--msg-padding-x)] pb-1","data-testid":"first-run-connect-chips",children:[t.jsx(b,{size:"sm",onClick:()=>s.open("account"),children:"Continue with DorkOS"}),t.jsx(b,{size:"sm",variant:"outline",onClick:()=>s.open("runtimes"),children:"Use my own AI"})]})}function js(e){var r,l;const{data:n}=at(),o=_(e),s=ue(e,null),i=((r=n==null?void 0:n.onboarding)==null?void 0:r.welcomeEntryId)??null;if(e===null||i===null||!o||s.length>0)return null;const a=o.reduce((d,c)=>d===void 0||c.seq>d.seq?c:d,void 0);return(a==null?void 0:a.id)!==i?null:((l=n==null?void 0:n.onboarding)==null?void 0:l.firstRunPath)==="none"?"connect":"starters"}const vs=5,bs="relative after:absolute after:-inset-x-1 after:-inset-y-2.5 md:after:hidden";function ys(e,n){return e===null||n===null?null:Math.max(0,n-Date.parse(e))}function Ss({row:e,onFollow:n,onViewProfile:o}){const[s,i]=m.useState(null),a=ys(e.since,s),r=e.profileMemberId,l=o===void 0||r===null?void 0:()=>o(r);return t.jsx(kt,{onViewProfile:l,identity:{kind:e.face.kind,displayName:e.name,...e.handle!==null?{handle:e.handle}:{},color:e.face.color,...e.face.emoji!==void 0?{emoji:e.face.emoji}:{},...e.face.imageUrl!==void 0?{imageUrl:e.face.imageUrl}:{},...e.face.origin!==void 0?{origin:e.face.origin}:{},...e.face.kind==="agent"?{agent:{...e.runtime!==null?{runtime:e.runtime}:{},...a!==null?{working:{...e.roomTitle!==null?{room:e.roomTitle}:{},forMs:a}}:{}}}:{}},children:t.jsxs("button",{type:"button","aria-label":e.detail===null?`Watch ${e.name}`:`Watch ${e.name}: ${e.detail}`,onClick:()=>n(e.follow),onPointerEnter:()=>i(Date.now()),onPointerLeave:()=>i(null),onFocus:()=>i(Date.now()),onBlur:()=>i(null),className:y("focus-ring group/identity hover:bg-muted/60 flex min-w-0 items-center gap-1.5 rounded-full py-1 pr-2.5 pl-1 text-xs transition-colors",bs),children:[t.jsx(rt,{size:"xs",kind:e.face.kind,color:e.face.color,...e.face.emoji!==void 0?{emoji:e.face.emoji}:{},...e.face.imageUrl!==void 0?{imageUrl:e.face.imageUrl}:{},...e.face.origin!==void 0?{origin:e.face.origin}:{},fallback:e.face.fallback,status:"working"}),t.jsx("span",{className:"text-foreground shrink-0 font-medium",children:e.name}),e.detail!==null&&t.jsxs("span",{"aria-hidden":!0,className:"text-muted-foreground truncate",children:["· ",e.detail]})]})})}function Ns({rows:e,onFollow:n,onViewProfile:o,className:s}){if(e.length===0)return null;const i=e.slice(0,vs),a=e.length-i.length;return t.jsxs("ul",{"data-testid":"presence-strip","aria-label":"Working right now",className:y("flex items-center gap-x-2 overflow-hidden",s),children:[i.map(r=>t.jsx("li",{className:"min-w-0",children:t.jsx(Ss,{row:r,onFollow:n,onViewProfile:o})},r.id)),a>0&&t.jsx("li",{"aria-label":a===1?"1 more agent is working":`${a} more agents are working`,className:"text-muted-foreground shrink-0 text-xs",children:t.jsxs("span",{"aria-hidden":!0,children:["+",a," more"]})})]})}function ks(e){return`replying in ${e}`}const ws="working in a chat";function Rs(e,n){var i;const o=n.rosters[e];if(o!==void 0)return o.members.map(a=>({author:a.author,origin:a.origin}));const s=(i=n.rooms[e])==null?void 0:i.participants;return s==null?[]:s.map(a=>({author:a}))}function Cs(e){const n=new Map;for(const[o,s]of Object.entries(e))s!==null&&n.set(lt(o),{path:o,manifest:s});return n}function te(e){return{...e,line:ct(e.name,e.binding,e.state),detail:dt(e.binding,e.state)}}function Is(e){const n=Cs(e.agents),o=new Set(e.excludeRoomIds??[]),s=[],i=new Set;for(const l of e.claims){const d=Rs(l.roomId,e).find(f=>f.author.id===l.authorId);if(d===void 0)continue;const c=d.author.agentRef===void 0?void 0:n.get(d.author.agentRef);if(c!==void 0&&i.add(c.path),o.has(l.roomId))continue;const h=e.rooms[l.roomId],g=h===void 0?null:me(h);s.push(te({id:`room:${l.roomId}:${l.authorId}`,name:d.author.displayName,handle:d.author.handle,face:K({record:d.author,override:c===void 0?null:Y(c.manifest),...d.origin!==void 0?{origin:d.origin}:{}}),binding:g===null?null:ks(g),state:l.state,since:l.since,roomTitle:g,runtime:(c==null?void 0:c.manifest.runtime)??null,profileMemberId:c===void 0?null:e.meshIdByPath[c.path]??null,follow:{kind:"room",roomId:l.roomId}}))}const a=new Set(i),r=[];for(const l of e.sessions){if(a.has(l.cwd))continue;const d=e.agents[l.cwd];if(d==null)continue;a.add(l.cwd);const c=d.displayName??d.name;r.push(te({id:`session:${l.sessionId}`,name:c,handle:null,face:K({record:{id:d.id,kind:"agent",displayName:c},override:Y(d)}),binding:ws,state:"working",since:null,roomTitle:null,runtime:d.runtime,profileMemberId:e.meshIdByPath[l.cwd]??null,follow:{kind:"session",sessionId:l.sessionId,cwd:l.cwd}}))}return r.sort((l,d)=>l.name.localeCompare(d.name)||l.id.localeCompare(d.id)),[...s,...r]}function As(e,n,o){var a;const s=new Set(ut(Object.keys(n),Object.values(o))),i=[];for(const[r,l]of Object.entries(n))((a=e[r])==null?void 0:a.lifecycle)==="streaming"&&s.has(r)&&i.push({sessionId:r,cwd:l});return i}const se=[],Ps=[],ne="\0",D="";function Ds(){const e=M(m.useCallback(i=>i.statuses,[])),n=M(m.useCallback(i=>i.statusCwds,[])),o=M(m.useCallback(i=>i.sessions,[])),s=m.useMemo(()=>As(e,n,o).map(i=>`${i.sessionId}${ne}${i.cwd}`).sort().join(D),[e,n,o]);return m.useMemo(()=>s.length===0?Ps:s.split(D).map(i=>{const[a,r]=i.split(ne);return{sessionId:a,cwd:r}}),[s])}function Os(e=[]){const n=mt(),o=ht(),s=Ds(),{data:i}=gt(),{data:a}=ft(),r=m.useMemo(()=>[...new Set(o.map(u=>u.roomId))].sort().join(`
|
|
2
|
+
`),[o]),l=m.useMemo(()=>r.length===0?[]:r.split(`
|
|
3
|
+
`),[r]),d=pt({queries:l.map(u=>({queryKey:xt.detail(u),queryFn:()=>n.getRoom(u)})),combine:u=>{const p={};for(const v of u)v.data!==void 0&&(p[v.data.id]=v.data);return p}}),c=m.useMemo(()=>{const u={};for(const p of i??[])u[p.id]=p;return u},[i]),h=m.useMemo(()=>((a==null?void 0:a.agents)??[]).map(u=>u.projectPath),[a]),{data:g}=jt(h),f=m.useMemo(()=>g??{},[g]),j=m.useMemo(()=>{const u={};for(const p of(a==null?void 0:a.agents)??[])u[p.projectPath]=p.id;return u},[a]),x=e.join(D);return m.useMemo(()=>{if(o.length===0&&s.length===0)return se;const u=Is({claims:o,rosters:d,rooms:c,sessions:s,agents:f,meshIdByPath:j,excludeRoomIds:x.length===0?[]:x.split(D)});return u.length===0?se:u},[o,d,c,s,f,j,x])}function Ms(e=[]){const n=Os(e),o=W(),{open:s}=vt(),i=m.useCallback(r=>{if(r.kind==="room"){Q.getState().recordOpened("room",r.roomId),o({...le.channels(),search:{id:r.roomId}});return}r.cwd&&Q.getState().recordOpened("agent",r.cwd),o(H({session:r.sessionId,dir:r.cwd}))},[o]),a=m.useMemo(()=>t.jsx(Ns,{rows:n,onFollow:i,onViewProfile:s}),[n,i,s]);return{occupied:n.length>0,node:a}}function E({title:e,children:n,action:o}){return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(Nt,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:e}),t.jsx("p",{className:"max-w-sm",children:n}),o]})}function Ts(){return t.jsxs(t.Fragment,{children:[t.jsx(bt,{children:"Home"}),t.jsx(Es,{})]})}function Es(){var f,j,x;const e=yt(),[n,o]=m.useState(!1),s=m.useCallback(()=>{const u=document.activeElement;wt(u)&&u.blur()},[]),{thread:i,entry:a}=re({strict:!1}),r=St(),l=Ms(e.room===null?[]:[e.room.id]),d=_(((f=e.room)==null?void 0:f.id)??null),c=ue(((j=e.room)==null?void 0:j.id)??null,null),h=d!==void 0&&d.length===0&&c.length===0,g=js(((x=e.room)==null?void 0:x.id)??null);if(e.status==="loading")return t.jsxs("div",{className:"flex h-full flex-col","aria-busy":!0,children:[t.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3",children:[t.jsx(C,{className:"size-7 rounded-full"}),t.jsx(C,{className:"h-4 w-40"})]}),t.jsx("div",{className:"flex-1"})]});if(e.status==="error")return t.jsx(E,{title:"Couldn’t load your team room",action:t.jsx(b,{variant:"outline",size:"sm",className:"mt-2",onClick:e.retry,children:"Try again"}),children:"Its messages are safe."});if(e.status==="missing")return t.jsx(E,{title:"Your team room isn’t open yet",children:"DorkOS opens it at startup. Still missing? Restart DorkOS."});if(e.status==="archived"){const u=e.room;return t.jsx(E,{title:`${me(u)} is archived`,action:t.jsx(b,{variant:"outline",size:"sm",className:"mt-2",disabled:r.isPending,onClick:()=>r.mutate({roomId:u.id}),children:r.isPending?"Bringing it back…":"Bring it back"}),children:"Its messages are safe."})}return t.jsx(hs,{children:t.jsx(Ct,{roomId:e.room.id,threadId:i,entrySeq:a,threadRoute:"/",offerJumpBackIn:!0,onComposerFocusChange:o,aboveTimeline:t.jsxs(t.Fragment,{children:[t.jsx(es,{presence:l,composerFocused:n,onExpand:s}),t.jsx(ds,{roomId:e.room.id,presenceOccupied:l.occupied})]}),aboveComposer:g?t.jsx(xs,{roomId:e.room.id,mode:g}):h?t.jsx(ss,{roomId:e.room.id}):void 0})})}const $n=Ts;export{$n as component};
|
package/dist/client/assets/{_shell._home.tasks--UhQB6h3.js → _shell._home.tasks-BClPai4g.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{e5 as k,r as i,e6 as w,e7 as C,e8 as E,j as e,e as R,e9 as o,ea as D,ar as x,B as M,cR as B,eb as _,bf as L,a$ as Q,cQ as z,b2 as G}from"./index-DKTd8X7n.js";import{Q as H}from"./query-error-state-B456s96E.js";import{P as F}from"./page-container-D03bhclt.js";import{F as K,T as U,C as V}from"./TasksEmptyState-BFw2ODM-.js";import{i as W}from"./registry-DRvQ3ChB.js";import{u as $,S as X}from"./search-x-CzgTzL0z.js";import{S as q}from"./scroll-area-DVd6ctli.js";import"./empty-state-Bxfi7_ss.js";import"./inline-code-DlVYFFW7.js";import"./form-LJ2Rf9ny.js";import"./command-srO4Wv-5.js";import"./AgentPicker-BXes2ymU.js";import"./AgentOptionRow-CF5XZmBx.js";import"./execution-config-afKaYukD.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./list-runtime-types-D5ZO30FL.js";import"./format-cron-DrUISrHj.js";const J=8,Y={visible:{transition:{staggerChildren:.04}},hidden:{}},Z={hidden:{opacity:0,y:8},visible:{opacity:1,y:0}};function ee({tasks:l,isLoading:c,agentMap:u,onEditTask:j,agentId:m}){const s=$(k,{debounce:{search:200}}),[r]=i.useState(0),[f,d]=i.useState(null),n=i.useMemo(()=>m?l.filter(t=>t.agentId===m):l,[l,m]),p=i.useMemo(()=>[...new Set(n.map(t=>t.agentId).filter(t=>!!t))],[n]),h=i.useMemo(()=>w(n,k,s.values,E,{field:s.sortField||C,direction:s.sortDirection}),[n,s.values,s.sortField,s.sortDirection]);return c?e.jsx("div",{className:"space-y-3 py-4",children:Array.from({length:3}).map((t,g)=>e.jsx(R,{className:"h-14 w-full rounded-xl"},g))}):e.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[e.jsxs(o,{state:s,className:"px-0",children:[e.jsx(o.Search,{placeholder:"Filter tasks…"}),e.jsx(o.Primary,{name:"status"}),e.jsx(o.AddFilter,{dynamicOptions:{agent:p}}),e.jsx(o.Sort,{options:E,defaultField:C}),e.jsx(o.ResultCount,{count:h.length,total:n.length,noun:"task"}),e.jsx(o.ActiveFilters,{})]}),e.jsx(q,{className:"min-h-0 flex-1","data-testid":D.tasksList,children:e.jsx("div",{className:"space-y-2 pb-4",children:h.length===0&&n.length>0?e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[e.jsx(X,{className:"text-muted-foreground/50 size-10"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:s.describeActive()?`No tasks match ${s.describeActive()}`:"No tasks match your filters"}),e.jsx(M,{variant:"outline",size:"sm",onClick:s.clearAll,children:"Clear filters"})]}):e.jsx(x.div,{initial:"hidden",animate:"visible",variants:Y,className:"space-y-2",children:h.map((t,g)=>e.jsx(x.div,{variants:g<J?Z:void 0,transition:{duration:.15},children:e.jsx(B,{task:t,agent:(t.agentId?u.get(t.agentId):void 0)??null,expanded:f===t.id,onToggleExpand:()=>d(f===t.id?null:t.id),onEdit:()=>j(t)})},t.id))},r)})})]})}function te(){return e.jsxs(e.Fragment,{children:[e.jsx(_,{children:"Schedules"}),e.jsx(se,{})]})}function se(){const l=L(),{data:c=[],isLoading:u,isError:j,refetch:m}=Q(l),[s,r]=i.useState(!1),[f,d]=i.useState(),[n,p]=i.useState(null),h=c.some(a=>a.agentId),{data:t}=z(void 0,h||!u),g=i.useMemo(()=>{const a=new Map;for(const S of(t==null?void 0:t.agents)??[])a.set(S.id,S);return a},[t]),{externalTrigger:T,clear:N}=G(),[v,y]=i.useState(!1);T&&!v&&!s?(y(!0),d(void 0),r(!0),N()):!T&&v&&y(!1);const A=a=>{p(a),d(void 0),r(!0)},b=()=>{p(null),d(void 0),r(!0)},O=a=>{d(a),r(!0)},P=a=>{r(a),a||p(null)};if(!l)return e.jsx(K,{icon:W.tasks,name:"Scheduling",description:"Agents run tasks on a schedule, even while you’re away.",command:"dorkos --tasks"});if(j)return e.jsx(H,{className:"h-full",title:"Couldn’t load your scheduled tasks",description:"The DorkOS server didn’t answer. Check that it’s running.",onRetry:()=>void m()});const I=c.length>0;return e.jsxs(e.Fragment,{children:[!I&&!u?e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"h-full min-h-0",children:e.jsx(F,{width:"full",children:e.jsx(U,{onCreateWithPreset:A,onCreateBlank:b})})}):e.jsx(x.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.15},className:"h-full min-h-0",children:e.jsx(F,{width:"full",scroll:!1,children:e.jsx(ee,{tasks:c,isLoading:u,agentMap:g,onEditTask:O})})}),e.jsx(V,{open:s,onOpenChange:P,editTask:f,initialPreset:n})]})}const ve=te;export{ve as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a1 as j,a2 as g,r as f,j as e,
|
|
1
|
+
import{a1 as j,a2 as g,r as f,j as e,eb as N,am as i,a0 as b,ec as y,_ as u,b8 as w}from"./index-DKTd8X7n.js";import{I as C}from"./inline-code-DlVYFFW7.js";import{T,d as v,b as p,e as c,a as S,c as d}from"./table-BIdFvzBs.js";import{P as k}from"./page-container-D03bhclt.js";import{G as L}from"./git-branch-D5xr7U5P.js";const F=["workspaces","scan"],P=6e4;function W(){var a,n,l;const s=j(),t=g({queryKey:F,queryFn:()=>s.scanWorktrees(),staleTime:P,refetchOnWindowFocus:!0});return{root:((a=t.data)==null?void 0:a.root)??null,worktrees:((n=t.data)==null?void 0:n.worktrees)??[],warnings:((l=t.data)==null?void 0:l.warnings)??[],isLoading:t.isLoading,isError:t.isError}}const m="—";function A(s){return s.changedFiles===null?m:s.changedFiles===0?"Clean":`${s.changedFiles} changed`}function B(s){const{ahead:t,behind:a,upstreamGone:n}=s;return n?"Branch merged or deleted":t===null||a===null?m:t===0&&a===0?"In sync":[t>0&&`${t} ahead`,a>0&&`${a} behind`].filter(Boolean).join(" · ")}function E({worktree:s}){const t=(s.changedFiles??0)>0;return e.jsxs(p,{children:[e.jsxs(d,{className:"max-w-0",children:[e.jsx("div",{className:"truncate font-medium",children:s.name}),e.jsx("div",{className:"text-muted-foreground truncate text-xs",title:s.path,children:i(s.path)})]}),e.jsx(d,{className:"max-w-0",children:s.readable?s.branch?e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx(L,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("span",{className:"truncate text-xs",children:s.branch})]}):e.jsx("span",{className:"text-muted-foreground text-xs",children:"No branch"}):e.jsx(u,{variant:"outline",title:"DorkOS couldn’t read this folder with git.",children:"Can’t read"})}),e.jsx(d,{className:t?"text-status-warning-fg":"text-muted-foreground",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:A(s)})}),e.jsx(d,{className:"text-muted-foreground hidden md:table-cell",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:B(s)})}),e.jsx(d,{className:"text-muted-foreground hidden sm:table-cell",children:e.jsx("span",{className:"text-xs whitespace-nowrap",children:s.lastCommitAt?w(s.lastCommitAt):m})})]})}function G({project:s,worktrees:t}){return e.jsxs("section",{children:[e.jsxs("h2",{className:"mb-3 flex items-center gap-2 text-sm font-semibold",children:[s,e.jsx(u,{variant:"secondary",children:t.length})]}),e.jsx("div",{className:"bg-card rounded-lg border",children:e.jsxs(T,{children:[e.jsx(v,{children:e.jsxs(p,{children:[e.jsx(c,{children:"Folder"}),e.jsx(c,{children:"Branch"}),e.jsx(c,{children:"Changes"}),e.jsx(c,{className:"hidden md:table-cell",children:"Compared to remote"}),e.jsx(c,{className:"hidden sm:table-cell",children:"Last commit"})]})}),e.jsx(S,{children:t.map(a=>e.jsx(E,{worktree:a},a.path))})]})})]})}function H(){const{root:s,worktrees:t,warnings:a,isLoading:n,isError:l}=W(),x=f.useMemo(()=>{const r=new Map;for(const o of t){const h=r.get(o.project)??[];h.push(o),r.set(o.project,h)}return[...r.entries()]},[t]);return e.jsxs(k,{width:"wide",children:[e.jsx(N,{children:"Workspaces"}),e.jsx("p",{className:"text-muted-foreground mb-6 text-sm",children:"Copies of your code, per agent."}),a.length>0&&e.jsxs("div",{className:"mb-6 rounded-lg border border-amber-600/40 bg-amber-500/10 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Some folders couldn’t be read"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"This list may be missing what’s inside them."}),e.jsx("ul",{className:"text-muted-foreground mt-2 space-y-0.5 text-xs",children:a.map(r=>e.jsxs("li",{className:"truncate",title:r.path,children:[i(r.path)," (",r.reason,")"]},r.path))})]}),n?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Looking for your worktrees…"}):l?e.jsxs("div",{className:"bg-card rounded-xl border p-10 text-center",children:[e.jsx(b,{className:"text-muted-foreground/60 mx-auto size-8"}),e.jsx("p",{className:"mt-3 font-medium",children:"Couldn’t check your worktrees"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"The scan didn’t finish. DorkOS tries again on its own."})]}):x.length===0?e.jsxs("div",{className:"bg-card rounded-xl border p-10 text-center",children:[e.jsx(y,{className:"text-muted-foreground/60 mx-auto size-8"}),e.jsx("p",{className:"mt-3 font-medium",children:"No worktrees yet"}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:"A worktree is a copy of your project, so agents’ edits never collide."}),s&&e.jsxs("p",{className:"text-muted-foreground mt-3 truncate text-xs",title:s,"data-slot":"workspaces-root-path",children:["Looking in ",e.jsx(C,{children:i(s)})]})]}):e.jsx("div",{className:"flex flex-col gap-8",children:x.map(([r,o])=>e.jsx(G,{project:r,worktrees:o},r))})]})}const K=H;export{K as component};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{W as Mt,r as f,j as t,
|
|
1
|
+
import{W as Mt,r as f,j as t,gU as Ot,a1 as V,ks as Xe,a2 as Ze,kt as z,a3 as le,a4 as we,ku as $t,kv as ue,kw as X,cf as Ut,kx as It,c6 as Lt,g$ as Ft,cj as Re,l as xe,ky as Kt,kz as _t,kA as Pt,kB as je,kC as Ae,B as S,kD as qt,cQ as zt,kE as et,eu as ae,en as tt,eo as st,ep as nt,eq as at,er as Te,I as Me,fX as rt,hs as Yt,fY as it,fZ as ot,f_ as lt,f$ as ct,g0 as dt,g1 as ut,g2 as Ht,$ as Qt,kF as Bt,kG as Jt,kH as Wt,kI as ge,cT as Oe,cU as $e,cW as Ue,cX as Ie,cY as Le,dU as Fe,dB as Ke,a7 as mt,kJ as Gt,kK as Vt,hT as Xt,kL as Zt,kM as _e,kN as es,kO as ts,kP as ft,kQ as ss,kR as pt,kS as ht,kT as ns,eb as xt,kU as as,kV as rs,kW as is,ji as os,a0 as ls,ey as cs,fe as ds,kX as us,c$ as gt,kY as ms,kZ as fs,ad as ps,n as Qe}from"./index-DKTd8X7n.js";import{T as hs,R as xs,a as gs}from"./RoomSurface-BQhgKnIE.js";import{b as pe,C as Ne}from"./index-BsmR2hi4.js";import{M as ys}from"./markdown-content-CN_dGlgE.js";import{o as vs,a as js,c as Ns}from"./owner-notice-C-Q9ySA7.js";import"./ChannelComposer-DIRPjyyf.js";import"./pane-resize-handle-CZ9rHhNr.js";import"./UnreadDivider-LbVIAoxM.js";import"./use-room-follow-claim-Doq_lWjk.js";import"./use-connector-management-PDVdWccW.js";import"./AgentRequestCard-BuXVpWfb.js";import"./access-copy-BZNjpw9v.js";import"./query-error-state-B456s96E.js";import"./empty-state-Bxfi7_ss.js";import"./use-bindings-BPNK3sUh.js";import"./connection-copy--MA7AN04.js";import"./KeyEntry-DAMr1NNY.js";import"./use-room-sessions-CoEIaBRt.js";import"./file-C-ooqbRY.js";import"./file-drag-GDx2qhdk.js";import"./find-latest-widget-fence-DPQimlUD.js";import"./WidgetErrorCard-CAUx4KUI.js";import"./index-CSqz4B0v.js";import"./card-D4ek-VvX.js";import"./progress-BB97hlmb.js";import"./table-BIdFvzBs.js";import"./package-BVNiaGrb.js";import"./heart-DnR_GX4I.js";import"./git-branch-D5xr7U5P.js";import"./file-text-BJt8biPY.js";import"./paperclip-DQQVX5tJ.js";import"./index-B0jt7Nng.js";import"./RuntimeSetupDialog-CUFie4LV.js";import"./inline-code-DlVYFFW7.js";import"./list-runtime-types-D5ZO30FL.js";import"./RuntimeConnectFlow-DN2ElvcH.js";import"./useMutationState-BAU_J-u3.js";import"./runtime-connect-Dn0T5YWv.js";import"./repeat-DPzic7-j.js";import"./format-duration-BCr6uzby.js";import"./mention-pill-C6OT4gx4.js";import"./rotate-ccw-clock-gqBy98sI.js";import"./unplug-xlfZ61jC.js";import"./message-square-off-DlkAPJdd.js";import"./registry-DRvQ3ChB.js";/**
|
|
2
2
|
* @license lucide-react v1.48.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const yt={name:"circle-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]};yt.node;const Cs=Mt(yt),ws=5e3;function Rs({connection:e}){var l;const s=e.official===!0&&e.status==="connected"&&((l=e.access)==null?void 0:l.state)==="unverified",n=f.useMemo(()=>s?{}:null,[s]),[a,i]=f.useState(null);return f.useEffect(()=>{if(!n)return;const d=setTimeout(()=>i(n),ws);return()=>clearTimeout(d)},[n]),n===null||a!==n?null:t.jsx(Ot,{tone:"info",role:"status",className:"m-3","data-testid":"official-space-unreachable",children:"The DorkOS community isn’t reachable right now. Try again in a few minutes."})}function vt(e,s){return[...
|
|
6
|
+
*/const yt={name:"circle-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]};yt.node;const Cs=Mt(yt),ws=5e3;function Rs({connection:e}){var l;const s=e.official===!0&&e.status==="connected"&&((l=e.access)==null?void 0:l.state)==="unverified",n=f.useMemo(()=>s?{}:null,[s]),[a,i]=f.useState(null);return f.useEffect(()=>{if(!n)return;const d=setTimeout(()=>i(n),ws);return()=>clearTimeout(d)},[n]),n===null||a!==n?null:t.jsx(Ot,{tone:"info",role:"status",className:"m-3","data-testid":"official-space-unreachable",children:"The DorkOS community isn’t reachable right now. Try again in a few minutes."})}function vt(e,s){return[...z.remote(e,s),"teammates"]}function Ss(e,s=!0){const n=V(),a=Xe(s);return Ze({queryKey:a?vt(a,e):[...z.all,"owner","unresolved",e,"teammates"],queryFn:()=>$t(a,async()=>{const[i,l]=await Promise.all([n.getCommunityWakeAgentsFrom(e),n.getCommunityTeammateSpend(e)]);return{wakeAgentsFrom:i.wakeAgentsFrom,spend:l}}),enabled:s&&a!==null})}function ks(e){const s=V(),n=le(),a=Xe(!0);return we({mutationFn:async i=>{"wakeAgentsFrom"in i?await s.setCommunityWakeAgentsFrom(e,i.wakeAgentsFrom):await s.setCommunityTeammateSpendLimit(e,i.monthlyLimitUsd)},onSettled:async()=>{a&&await n.invalidateQueries({queryKey:vt(a,e)})}})}const bs=500,oe=new Map;function jt(e,s){return e.id!==s.id||e.community!==s.community||e.roomId!==s.roomId||e.text===s.text&&e.authorDisplayName===s.authorDisplayName&&JSON.stringify(e.mentions)===JSON.stringify(s.mentions)&&JSON.stringify(e.attachments)===JSON.stringify(s.attachments)?e:{...e,text:s.text,mentions:s.mentions,attachments:s.attachments,authorDisplayName:s.authorDisplayName}}function Ee(e,s){if(s.size===0)return e;let n=!1;const a=e.map(i=>{const l=s.get(i.id),d=l?jt(i,l):i;return d!==i&&(n=!0),d});return n?a:e}function Ce(e,s,...n){const a=new Map;for(const i of n)for(const l of i){if(l.community!==e||l.roomId!==s)throw new Error("Community history contains a different room.");a.set(l.id,l)}return[...a.values()].sort((i,l)=>i.remoteSeq-l.remoteSeq)}function As(e,s,n=!0,a=0,i="legacy",l=!1,d){const c=V(),r=f.useRef(d);f.useEffect(()=>{r.current=d},[d]);const o=le(),h=ue(!0,i,e),u=JSON.stringify([h==null?void 0:h.ownerKey,h==null?void 0:h.epoch,h==null?void 0:h.route.epoch,h==null?void 0:h.accessFingerprint,e,s]),[y,N]=f.useState(()=>({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"connecting"}));return f.useEffect(()=>{if(!h||!n)return;const v=h,w=new AbortController;let g,O=0,A,_,Y=!1;N({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"connecting"});function M(){Y=!0,A=void 0,_=void 0,o.removeQueries({queryKey:z.remote(v,e)}),N({address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"removed"})}async function q(){try{await c.subscribeRemoteCommunityRoom(e,s,C=>{var U;if(!(w.signal.aborted||Y||!X(v))){if(C.type==="closed"){(C.reason==="removed"||C.reason==="revoked")&&M();return}if(O=0,C.type==="snapshot")A=C.cursor??void 0,C.redactionCursor&&(_=C.redactionCursor),o.setQueryData(z.room(v,e,s),C.room),N(j=>({address:u,room:C.room,entries:Ee(Ce(e,s,j.address===u?j.entries:[],C.entries).slice(-500),j.address===u?j.revisions:oe),revisions:j.address===u?j.revisions:oe,deliveries:j.deliveries.filter(x=>!C.entries.some(I=>I.originIdempotencyKey===x.idempotencyKey)),status:C.stale?"offline":"live"}));else if(C.type==="revision"){const j=C.entry;C.redactionCursor&&(_=C.redactionCursor);const x=[...z.room(v,e,s),"entries"],b=o.getQueriesData({queryKey:x}).some(([,k])=>k==null?void 0:k.pages.some(F=>F.entries.some(H=>H.id===j.id)))||o.isFetching({queryKey:x})>0||((U=r.current)==null?void 0:U.call(r,j.id))===!0;o.setQueriesData({queryKey:x},k=>{if(!k)return k;let F=!1;const H=k.pages.map(Z=>{const re=Z.entries.map(ee=>jt(ee,j));return re.some((ee,me)=>ee!==Z.entries[me])?(F=!0,{...Z,entries:re}):Z});return F?{...k,pages:H}:k}),N(k=>{if(!b&&!k.entries.some(H=>H.id===j.id))return k;const F=new Map(k.revisions);for(F.delete(j.id),F.set(j.id,j);F.size>bs;)F.delete(F.keys().next().value);return{...k,entries:Ee(k.entries,F),revisions:F}})}else C.type==="deliveries"?N(j=>({...j,deliveries:C.deliveries.filter(x=>!j.entries.some(I=>I.originIdempotencyKey===x.idempotencyKey))})):(A=C.entry.cursor,N(j=>({...j,entries:Ce(e,s,j.entries,[C.entry]).slice(-500),deliveries:j.deliveries.filter(x=>x.idempotencyKey!==C.entry.originIdempotencyKey),status:"live"})))}},{since:A,redactions:_,signal:w.signal})}catch(C){if(w.signal.aborted||!X(v))return;const U=C&&typeof C=="object"&&"status"in C?C.status:void 0,j=C&&typeof C=="object"&&"code"in C?C.code:void 0;j==="COMMUNITY_DELETED"||j==="COMMUNITY_TAKEN_DOWN"?(M(),o.invalidateQueries({queryKey:z.connections(v)})):U===401||U===403||U===404?M():U===410&&j==="COMMUNITY_CURSOR_STALE"&&(A=void 0)}if(w.signal.aborted||Y||!X(v))return;const L=o.getQueryData(z.room(v,e,s));L&&o.setQueryData(z.room(v,e,s),{...L,stale:!0,writable:!1}),N(C=>({...C,room:C.room?{...C.room,stale:!0,writable:!1}:null,status:"offline"})),g=setTimeout(()=>{q()},Math.min(3e4,1e3*2**Math.min(O++,5)))}return q(),()=>{w.abort(),clearTimeout(g)}},[u,e,s,n,a,o,c,h,l]),y.address!==u||!h?{address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"connecting"}:n?y:l?{...y,room:y.room?{...y.room,stale:!0,writable:!1}:null,deliveries:[],status:"offline"}:{address:u,room:null,entries:[],revisions:oe,deliveries:[],status:"removed"}}function Ds(e){var h;const s=Ut(),n=It(),a=e===void 0||(h=s.data)==null?void 0:h.find(u=>u.id===e),i=a!==void 0&&Lt(a)!==null,l=e===void 0||s.data!==void 0||s.isError,[d,c]=f.useState(void 0),r=e!==void 0&&d===e,o=f.useRef(void 0);return f.useEffect(()=>{!i||e===void 0||r||o.current===e||(o.current=e,n({roomId:e},{replace:!0,quiet:!0}).then(u=>{u||c(e)}))},[i,e,r,n]),l?i&&!r?"redirecting":"show":"pending"}function Ts(e,s,n){var c;const a=Ft(),i=Re(),l=e!==void 0&&((c=a.room)==null?void 0:c.id)===e,d=a.status!=="loading";return f.useEffect(()=>{l&&i({...xe.home(),search:{...s===void 0?{}:{thread:s},...n===void 0?{}:{entry:n}},replace:!0})},[l,s,n,i]),e===void 0?"show":l?"redirecting":d?"show":"pending"}function Es(e){return e?{ownerAddress:JSON.stringify([e.ownerKey,e.epoch]),contextAddress:JSON.stringify([e.ownerKey,e.epoch,e.route.epoch,e.accessFingerprint])}:{ownerAddress:"",contextAddress:""}}const Ms=new Set(["COMMUNITY_MUTED","COMMUNITY_SLOW_MODE","COMMUNITY_RULES_NOT_ACCEPTED"]);function Os(e){const s=e==null?void 0:e.code;return typeof s=="string"&&Ms.has(s)}function $s(e,s=new Date){return e.kind==="muted"?`You’re muted here until ${Kt(e.until,s)??"later"}.`:e.kind==="rules"?"Accept this space’s rules to post.":`Slow mode. Post again in ${e.secondsLeft}s.`}function Us(e,s){if(!e)return null;if(e.mutedUntil&&Date.parse(e.mutedUntil)>s)return{kind:"muted",until:e.mutedUntil};const{rules:n}=e;return n.text!==null&&n.version>0&&n.acceptedVersion<n.version?{kind:"rules"}:null}function Is({community:e,roomId:s,enabled:n,accessFingerprint:a}){var Y;const i=V(),l=le(),d=ue(n,a,e),c=d?[...z.room(d,e,s),"standing"]:[...z.all,"owner","unresolved",e,"room",s,"standing"],r=Ze({queryKey:c,queryFn:()=>_t(d,()=>i.getRemoteCommunityStanding(e,s)),enabled:n&&d!==null,staleTime:3e4,retry:!1,refetchInterval:M=>{var q;return(q=M.state.data)!=null&&q.mutedUntil&&Date.parse(M.state.data.mutedUntil)>Date.now()?6e4:!1}}),[o,h]=f.useState(null),[u,y]=f.useState(()=>Date.now()),N=(Y=r.data)!=null&&Y.mutedUntil?Date.parse(r.data.mutedUntil):null;f.useEffect(()=>{if(o!==null&&o>u){const M=setTimeout(()=>y(Date.now()),1e3);return()=>clearTimeout(M)}if(N!==null&&N>u){const M=setTimeout(()=>y(Date.now()),Math.min(N-u+50,1073741824));return()=>clearTimeout(M)}},[N,u,o]);const v=r.refetch,w=f.useCallback(M=>{if((M==null?void 0:M.code)==="COMMUNITY_SLOW_MODE"){const L=M.retryAfterMs;if(typeof L=="number"&&L>0){const C=Date.now();y(C),h(C+L)}return}v()},[v]),g=we({meta:{suppressErrorToast:!0},mutationFn:M=>i.acceptRemoteCommunityRules(e,M),onSuccess:M=>{l.setQueryData(c,q=>q&&{...q,rules:M})},onError:()=>void v()}),O=Us(r.data,u),A=o===null?0:Math.ceil((o-u)/1e3),_=O??(A>0?{kind:"slow",secondsLeft:A}:null);return{standing:r.data,hold:_,noteHold:w,accept:g}}const Ls=new Set(["COMMUNITY_DELETED","COMMUNITY_TAKEN_DOWN"]),Fs=30*6e4,he=new Map;function Nt(e,s,n){return JSON.stringify([e,s,n])}function Ct(e){return Date.now()-e<Fs}function Ks(e){for(const[s,n]of he)Ct(n.at)||he.delete(s);return he.get(e)}function _s(){return Date.now()}function Ps(e,s,n){he.set(e,{attachmentId:s,at:n})}function Be(e){for(const s of e.files)he.delete(Nt(e.ref,e.roomId,s.id))}function Je(e){return e.filter(s=>s.trim()).join(`
|
|
7
7
|
|
|
8
|
-
`)}function zs(e){const s=e==null?void 0:e.code;return typeof s=="string"&&Ls.has(s)}function De(e){return e.map(({id:s,file:n})=>({id:s,file:n,status:"pending",progress:0}))}function qs({ref:e,roomId:s,canSend:n,entries:a,onReceipt:i,draft:l,ownerKey:d,contextKey:c=d,onHold:r}){const o=V(),h=JSON.stringify([d,e,s,c]),u=Pt(l),y=u.text,N=f.useMemo(()=>De(u.files),[u.files]),v=f.useRef(l);f.useLayoutEffect(()=>{v.current=l},[l]);function w(m){const R=v.current;if(!R)return;const $=je.getState(),T=$.drafts[Ae(R)],E=m({text:(T==null?void 0:T.text)??"",files:De((T==null?void 0:T.files)??[])});$.write(R,{text:E.text,files:E.files.map(({id:P,file:B})=>({id:P,file:B}))})}function g(m){w(R=>({...R,text:m}))}function O(m){w(R=>({...R,files:m(R.files)}))}const[A,_]=f.useState(null);function H(m){_(m===null?null:{address:h,context:c,message:m})}const[M,z]=f.useState([]),L=f.useRef(new Map),C=f.useRef(0),U=f.useRef(new Map),j=f.useRef(new Set),x=f.useRef(h),I=f.useRef(c),b=f.useRef(!0),k=f.useRef(n),F=f.useRef(i),Y=f.useRef(r);f.useLayoutEffect(()=>{x.current=h,I.current=c,k.current=n,F.current=i,Y.current=r},[h,n,c,i,r]),f.useEffect(()=>(b.current=!0,()=>{b.current=!1}),[]),f.useEffect(()=>{let m=!1;for(const R of a){if(!R.originIdempotencyKey)continue;const $=L.current.get(R.originIdempotencyKey);($==null?void 0:$.address)===x.current&&$.context===I.current&&L.current.delete(R.originIdempotencyKey)&&(Be($),m=!0)}m&&z([...L.current.values()])},[a]);function Z(){b.current&&z([...L.current.values()].filter(m=>m.address===x.current&&m.context===I.current).map(m=>({...m})))}async function re(m){var R,$;if(!(j.current.has(m.key)||!k.current||!b.current||m.address!==x.current)){j.current.add(m.key),m.status="sending",m.error=void 0,Z();try{!m.posted&&m.uploadedAt.some(E=>!Ct(E))&&(m.attachmentIds=[],m.uploadedAt=[],m.triedAt=[],m.uploadRound+=1);for(let E=m.attachmentIds.length;E<m.files.length;E++){if(!k.current||!b.current||m.address!==x.current)throw new Error("Reconnect to this channel, then try again.");const P=m.files[E],B=Nt(m.ref,m.roomId,P.id),J=Ks(B);if(J){m.attachmentIds.push(J.attachmentId),m.uploadedAt.push(J.at);continue}const te=(R=m.triedAt)[E]??(R[E]=_s()),W=await o.uploadRemoteCommunityAttachment(m.ref,m.roomId,P.file,m.uploadRound?`${m.key}:file:${E}:${m.uploadRound}`:`${m.key}:file:${E}`);Ps(B,W.id,te),m.uploadedAt.push(te),m.attachmentIds.push(W.id)}if(!k.current||!b.current||m.address!==x.current)throw new Error("Reconnect to this channel, then try again.");m.posted=!0;const T=await o.postRemoteCommunityEntry(m.ref,m.roomId,{text:m.text,parentEntryId:m.parentEntryId,attachmentIds:m.attachmentIds,idempotencyKey:m.key});L.current.delete(m.key),Be(m),b.current&&m.address===x.current&&m.context===I.current&&F.current(T)}catch(T){if(zs(T)&&ee(m)){L.current.delete(m.key);return}if(Os(T)&&ee(m)){L.current.delete(m.key),b.current&&m.address===x.current&&(($=Y.current)==null||$.call(Y,T));return}m.status="failed",m.error=T instanceof Error?T.message:"Not confirmed. Try this message again."}finally{j.current.delete(m.key),Z()}}}function ee(m){const{draft:R}=m.origin,$=Ae(R),T=je.getState(),E=T.drafts[$],P=(E==null?void 0:E.text)??"";let B=U.current.get($)??[];const J=Je(B.map(G=>G.origin.typed));let te=P;J&&P.startsWith(J)?te=P.slice(J.length).replace(/^\n+/,""):B=[];const W=[...B,m].sort((G,se)=>G.origin.seq-se.origin.seq),ye=new Set(W.flatMap(G=>G.files.map(se=>se.id))),ie=[...W.flatMap(G=>G.files.map(({id:se,file:fe})=>({id:se,file:fe}))),...((E==null?void 0:E.files)??[]).filter(G=>!ye.has(G.id))];return T.write(R,{text:Je([...W.map(G=>G.origin.typed),te]),files:ie}),$ in je.getState().drafts?(U.current.set($,W),!0):!1}function me(m){const R=v.current;if(!R||!k.current)return;const $=je.getState(),T=$.drafts[Ae(R)];if(!T||!T.text.trim()&&T.files.length===0)return;if(L.current.size>=30){H("Too many messages waiting. Let them send, or retry them first.");return}const E=$.take(R),P=De(E.files),B={address:h,context:c,ref:e,roomId:s,key:crypto.randomUUID(),text:E.text.trim()?E.text:P.map(J=>J.file.name).join(", "),parentEntryId:m,files:P,attachmentIds:[],uploadedAt:[],triedAt:[],posted:!1,uploadRound:0,status:"sending",origin:{draft:R,typed:E.text,seq:C.current+=1}};L.current.set(B.key,B),H(null),re(B)}return{text:y,setText:g,attachments:{staged:N,add(m){if(m.some(R=>R.size>25*1024*1024)){H("Each file must be 25 MB or smaller.");return}O(R=>R.length+m.length>8?(H("Attach up to eight files to one message."),R):[...R,...m.map($=>({id:crypto.randomUUID(),file:$,status:"pending",progress:0}))])},remove(m){O(R=>R.filter($=>$.id!==m))},retry(){},cancel(){O(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:M.filter(m=>m.address===h&&m.context===c),error:(A==null?void 0:A.address)===h&&A.context===c?A.message:null,send:me,retry(m){const R=L.current.get(m);R&&re(R)}}}function wt({entry:e,onThread:s,onReport:n}){const a=V(),i=f.useId(),[l,d]=f.useState(null),[c,r]=f.useState(null),o={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function h(u,y){if(c)return;r(u),d(null);let N;try{const v=await a.downloadRemoteCommunityAttachment(e.community,e.roomId,u);N=URL.createObjectURL(v);const w=document.createElement("a");w.href=N,w.download=Array.from(y,g=>g==="/"||g==="\\"||g.charCodeAt(0)<32?"_":g).join(""),document.body.append(w),w.click(),w.remove()}catch(v){d(v instanceof Error?v.message:"Couldn’t download the file. Try again.")}finally{N&&setTimeout(()=>URL.revokeObjectURL(N),1e3),r(null)}}return t.jsxs(pe.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":i,children:[t.jsx(pe.Gutter,{author:o,at:e.createdAt}),t.jsxs(pe.Body,{children:[t.jsx(pe.Author,{id:i,author:o,at:e.createdAt}),t.jsxs(pe.Content,{children:[t.jsx(ys,{content:e.text}),e.attachments.map(u=>t.jsx(S,{variant:"outline",size:"sm",disabled:c!==null,onClick:()=>void h(u.id,u.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:c===u.id?"Downloading…":u.name})},u.id)),l&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:l}),s&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"}),n&&t.jsx(S,{variant:"ghost",size:"sm",onClick:n,children:"Report"})]})]})]})}function Hs({community:e,roomId:s,online:n,canEnroll:a,accessFingerprint:i}){var j,x,I;const l=V(),d=le(),c=ue(!0,i,e),r=zt(e,a,i),o=qt(),h=et(e,a,i),[u,y]=f.useState(""),[N,v]=f.useState(""),[w,g]=f.useState(!1),[O,A]=f.useState(null),[_,H]=f.useState(null),M=f.useId(),z=((j=r.data)==null?void 0:j.filter(b=>b.active))??[],L=((x=o.data)==null?void 0:x.agents.filter(b=>!z.some(k=>k.localAgentId===b.id)))??[];async function C(){c&&X(c)&&await d.invalidateQueries({queryKey:q.remote(c,e)})}async function U(b){if(b.preventDefault(),!u||w||!n||!a||!c)return;const k=c;g(!0),A(null);try{if(await l.enrollRemoteCommunityAgent(e,u,N.trim()?{handle:N.trim()}:{}),!X(k))return;y(""),v(""),await C()}catch(F){X(k)&&A(F instanceof Error?F.message:"Couldn’t add the agent. Try again.")}finally{X(k)&&g(!1)}}return t.jsxs("section",{className:"mt-3 space-y-2 border-t pt-3","aria-label":"Your agents in this space",children:[t.jsx("h3",{className:"text-sm font-medium",children:"My agents"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Add an agent from here, then choose whether it joins this channel."}),r.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void r.refetch(),children:"Retry"})]}),(I=r.data)==null?void 0:I.map(b=>{var k;return t.jsx(Ys,{agent:b,roomId:s,online:n,canEnroll:a,takesDms:((k=h.data)==null?void 0:k.available)===!0,onChanged:C,onNotice:H},b.localAgentId)}),o.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),a&&L.length>0&&t.jsxs("form",{onSubmit:b=>void U(b),className:"flex flex-wrap items-end gap-2",children:[t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(ae,{htmlFor:`${M}-agent`,children:"Local agent"}),t.jsxs(tt,{value:u,onValueChange:y,disabled:!n||w,children:[t.jsx(st,{id:`${M}-agent`,children:t.jsx(nt,{placeholder:"Choose an agent"})}),t.jsx(at,{children:L.map(b=>t.jsx(Te,{value:b.id,children:b.name},b.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(ae,{htmlFor:`${M}-handle`,children:"Space handle (optional)"}),t.jsx(Me,{id:`${M}-handle`,value:N,onChange:b=>v(b.target.value),disabled:!n||w,placeholder:"Use the agent’s handle"})]}),t.jsx(S,{type:"submit",disabled:!u||!n||w,children:w?"Adding…":"Add to space"})]}),_&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:_}),O&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:O})]})}function Ys({agent:e,roomId:s,online:n,canEnroll:a,takesDms:i,onChanged:l,onNotice:d}){const c=V(),[r,o]=f.useState(null),[h,u]=f.useState(null),y=e.roomIds.includes(s),N=f.useId();async function v(g,O){if(!r){o(g),u(null);try{await O(),await l()}catch(A){u(A instanceof Error?A.message:"Couldn’t finish that. Try again.")}finally{o(null)}}}function w(g){d(g.remoteRevoked?"Stopped taking part.":"Stopped here, but the space wasn’t told. Try again when it’s reachable.")}return t.jsxs("div",{className:"space-y-1 rounded-md border p-2",children:[t.jsxs("p",{className:"text-sm font-medium",children:[e.displayName,!e.active&&" · stopped here"," ",t.jsxs("span",{className:"text-muted-foreground font-normal",children:["· owned by ",e.ownerDisplayName]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsx(S,{variant:"outline",size:"sm",disabled:r!==null||!a||!e.active||!y&&!n,onClick:()=>void v("membership",async()=>{y?w(await c.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await c.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:y?"Leave channel":"Join channel"}),t.jsx(S,{variant:"ghost",size:"sm",disabled:r!==null||!a,onClick:()=>void v("stop",()=>c.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(rt,{children:[t.jsx(Ht,{asChild:!0,children:t.jsx(S,{variant:"ghost",size:"sm",disabled:r!==null||!a,children:"Remove from space"})}),t.jsxs(it,{children:[t.jsxs(ot,{children:[t.jsxs(lt,{children:["Remove ",e.displayName,"?"]}),t.jsx(ct,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(dt,{children:[t.jsx(ut,{children:"Cancel"}),t.jsx(Yt,{onClick:()=>void v("remove",async()=>w(await c.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),i&&e.active&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Qt,{id:N,checked:e.acceptsDms===!0,disabled:r!==null||!a||!n,onCheckedChange:g=>void v("dms",()=>c.setRemoteCommunityAgentDms(e.community,e.localAgentId,g))}),t.jsx(ae,{htmlFor:N,className:"text-xs font-normal",children:"Takes direct messages"})]}),h&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:h})]})}function Qs({community:e,agent:s,disabled:n,accessFingerprint:a}){const i=V(),l=Re(),d=le(),c=ue(!0,a,e),[r,o]=f.useState(!1),[h,u]=f.useState(null);async function y(){if(!r){o(!0),u(null);try{const N=await i.startRemoteCommunityDm(e,s.memberId);c&&await d.invalidateQueries({queryKey:q.dms(c,e)}),l({...xe.channels(),search:{community:e,id:N.roomId}})}catch(N){u(N.code===Bt?`${s.displayName} isn’t taking direct messages.`:"Couldn’t open the direct message. Try again.")}finally{o(!1)}}}return t.jsxs("span",{className:"flex flex-wrap items-center justify-end gap-x-2",children:[h&&t.jsx("span",{role:"status",className:"text-muted-foreground order-last w-full text-right text-xs sm:order-none sm:w-auto",children:h}),t.jsx(S,{variant:"ghost",size:"sm",disabled:n||r,onClick:()=>void y(),"aria-label":`Message ${s.displayName}`,children:"Message"})]})}function We(e){return`$${e.toFixed(2)}`}function Bs({community:e,online:s,canEnroll:n}){var w;const a=f.useId(),i=Ss(e),l=ks(e),d=(w=i.data)==null?void 0:w.spend,[c,r]=f.useState(null),o=(d==null?void 0:d.monthlyLimitUsd)!=null?String(d.monthlyLimitUsd):"",h=c??o,u=h.trim()===""?null:Jt(Number(h)),y=u===null||Number.isFinite(u)&&u>=Wt,N=u!==((d==null?void 0:d.monthlyLimitUsd)??null);function v(g){g.preventDefault(),!(!y||!N||l.isPending)&&l.mutate({monthlyLimitUsd:u},{onSuccess:()=>r(null)})}return!n&&!(d!=null&&d.hasAgentsHere)?null:t.jsxs("section",{className:"mt-3 space-y-2 border-t pt-3","aria-labelledby":`${a}-heading`,children:[t.jsx("h3",{id:`${a}-heading`,className:"text-sm font-medium",children:"Teammates"}),i.isError&&t.jsxs("p",{role:"alert",className:"text-sm",children:["Couldn’t load teammate settings."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Retry"})]}),i.data&&d&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(ae,{htmlFor:`${a}-wake`,children:"Who can wake your agents"}),t.jsxs(tt,{value:i.data.wakeAgentsFrom,onValueChange:g=>l.mutate({wakeAgentsFrom:g==="me"?"me":"members"}),disabled:!s||l.isPending,children:[t.jsx(st,{id:`${a}-wake`,className:"max-w-64",children:t.jsx(nt,{})}),t.jsxs(at,{children:[t.jsx(Te,{value:"members",children:"Anyone in this space"}),t.jsx(Te,{value:"me",children:"Only me"})]})]})]}),t.jsxs("form",{onSubmit:v,className:"space-y-1",children:[t.jsx(ae,{htmlFor:`${a}-limit`,children:"Monthly limit for teammates"}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-muted-foreground text-sm","aria-hidden":!0,children:"$"}),t.jsx(Me,{id:`${a}-limit`,inputMode:"decimal",value:h,onChange:g=>r(g.target.value),placeholder:"No limit","aria-invalid":!y,disabled:!s||l.isPending,className:"w-32"}),t.jsx(S,{type:"submit",size:"sm",disabled:!s||!y||!N||l.isPending,children:"Save"})]}),t.jsxs("p",{className:"text-muted-foreground text-xs",children:[d.monthlyLimitUsd===null?"No limit":`Limit ${We(d.monthlyLimitUsd)} a month`,` · ${We(d.spentUsd)} spent this month${d.approximate?", approximate":""}`]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Past the limit, teammates’ messages wake nobody. A running turn may go slightly over."}),!y&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Enter at least $0.01, or leave it empty."})]}),l.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t save. Try again."})]})]})}function Js(e,s){const n=new Date(e),a=n.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return n.toDateString()===s.toDateString()?a:`${n.toLocaleDateString([],{month:"short",day:"numeric",...n.getFullYear()===s.getFullYear()?{}:{year:"numeric"}})}, ${a}`}function Ws(e,s=new Date){return e.kind!=="agent"?null:e.availability==="available"?{text:"Available"}:e.availability==="offline"&&e.lastSeenAt?{text:"Offline since",since:{dateTime:new Date(e.lastSeenAt).toISOString(),label:Js(e.lastSeenAt,s)}}:null}function Gs({roster:e,failed:s,canMention:n,onMention:a,community:i,roomId:l,online:d,canEnroll:c,agentsKey:r,accessFingerprint:o}){var N,v,w;const u=((N=et(i,!0,o).data)==null?void 0:N.available)===!0,y=(w=(v=ge().data)==null?void 0:v.find(g=>g.ref===i))==null?void 0:w.connectedHumanMemberId;return t.jsxs("div",{className:"max-h-48 overflow-auto border-b p-3","aria-label":"Channel members",children:[s&&t.jsx("p",{role:"alert",children:"Couldn’t load members."}),(e==null?void 0:e.stale)&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"Saved member list"}),e==null?void 0:e.members.map(g=>{var A;const O=Ws(g);return t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-2 text-sm",children:[t.jsxs("span",{children:[g.displayName,g.kind==="agent"?" · Agent":"",g.ownerMemberId&&` · owned by ${((A=e.members.find(_=>_.memberId===g.ownerMemberId))==null?void 0:A.displayName)??"a space member"}`,O&&t.jsxs("span",{className:"text-muted-foreground",children:[` · ${O.text}`,O.since&&t.jsxs(t.Fragment,{children:[" ",t.jsx("time",{dateTime:O.since.dateTime,children:O.since.label})]})]})]}),t.jsxs("span",{className:"flex flex-wrap items-center justify-end",children:[u&&g.kind==="agent"&&g.ownerMemberId!==y&&t.jsx(Qs,{community:i,agent:g,disabled:!d,accessFingerprint:o}),g.handle&&t.jsxs(S,{variant:"ghost",size:"sm",disabled:!n,onClick:()=>a(g.handle),children:["Mention @",g.handle]})]})]},g.memberId)}),c&&t.jsx(Hs,{community:i,roomId:l,online:d,canEnroll:!0,accessFingerprint:o},r),t.jsx(Bs,{community:i,online:d,canEnroll:c})]})}function Rt(e,s){return e instanceof Error&&e.message?e.message:s}function Vs({conduct:e,staff:s,onReadRules:n}){const{hold:a,standing:i}=e;return(a==null?void 0:a.kind)==="rules"?t.jsx("div",{className:"px-1 pb-1",children:t.jsx(S,{size:"sm",variant:"outline",onClick:n,children:"Read the rules"})}):a||s||!(i!=null&&i.slowModeSeconds)?null:t.jsxs("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:["Slow mode: one message every ",i.slowModeSeconds,"s."]})}function Xs({conduct:e,open:s,onOpenChange:n}){var l;const a=(l=e.standing)==null?void 0:l.rules,i=a?a.acceptedVersion>=a.version:!1;return t.jsx(Oe,{open:s,onOpenChange:n,children:t.jsxs($e,{className:"sm:max-w-lg",children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Space rules"}),t.jsx(Le,{children:i?"You accepted these rules.":"Accept these rules to post here."})]}),t.jsxs(Fe,{children:[t.jsx("div",{className:"max-h-[50vh] overflow-y-auto rounded-md border p-3 text-sm leading-relaxed whitespace-pre-wrap",children:(a==null?void 0:a.text)??"This space has no rules."}),e.accept.error&&t.jsx("p",{role:"alert",className:"text-destructive mt-2 text-sm",children:Rt(e.accept.error,"Couldn’t accept the rules. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(S,{variant:"outline",onClick:()=>n(!1),children:"Close"}),(a==null?void 0:a.text)&&!i&&t.jsx(S,{disabled:e.accept.isPending,onClick:()=>e.accept.mutate(a.version,{onSuccess:()=>n(!1)}),children:e.accept.isPending?"Accepting…":"Accept rules"})]})]})})}function Zs({community:e,accessFingerprint:s,currentName:n,open:a,onOpenChange:i}){return t.jsx(Oe,{open:a,onOpenChange:i,children:t.jsx($e,{className:"sm:max-w-md",children:a&&t.jsx(en,{community:e,accessFingerprint:s,currentName:n,onDone:()=>i(!1)})})})}function en({community:e,accessFingerprint:s,currentName:n,onDone:a}){const i=V(),l=le(),d=ue(!0,s,e),[c,r]=f.useState(n),o=we({meta:{suppressErrorToast:!0},mutationFn:u=>i.setRemoteCommunityDisplayName(e,u),onSuccess:async()=>{d&&await l.invalidateQueries({queryKey:q.content(d,e)}),a()}}),h=c.trim();return t.jsxs("form",{onSubmit:u=>{u.preventDefault(),h&&h!==n&&o.mutate(h)},children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Your name in this space"}),t.jsx(Le,{children:"Other spaces keep the name they show."})]}),t.jsxs(Fe,{className:"space-y-2",children:[t.jsx(ae,{htmlFor:"remote-community-display-name",children:"Name"}),t.jsx(Me,{id:"remote-community-display-name",value:c,maxLength:128,autoComplete:"nickname",onChange:u=>r(u.target.value)}),o.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Rt(o.error,"Couldn’t change your name. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:!h||h===n||o.isPending,children:o.isPending?"Saving…":"Save name"})]})]})}const tn=[{value:"spam",label:"Spam"},{value:"harassment",label:"Harassment"},{value:"off_topic",label:"Off topic"},{value:"illegal",label:"Against the law"},{value:"other",label:"Something else"}];function sn({entry:e,onClose:s}){return t.jsx(Oe,{open:e!==null,onOpenChange:n=>!n&&s(),children:t.jsx($e,{className:"sm:max-w-md",children:e&&t.jsx(nn,{entry:e,onClose:s},e.id)})})}function nn({entry:e,onClose:s}){const n=V(),a=f.useId(),[i,l]=f.useState(null),[d,c]=f.useState(""),r=we({meta:{suppressErrorToast:!0},mutationFn:o=>n.reportRemoteCommunityEntry(e.community,e.roomId,e.id,o),onSuccess:()=>{mt("Message reported"),s()}});return t.jsxs("form",{onSubmit:o=>{o.preventDefault(),i&&r.mutate({reason:i,...d.trim()?{note:d.trim()}:{}})},children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Report message"}),t.jsx(Le,{children:"This space’s owners and admins review reports."})]}),t.jsxs(Fe,{className:"space-y-4",children:[t.jsxs("p",{className:"text-muted-foreground line-clamp-3 text-sm",children:[e.authorDisplayName,": ",e.text]}),t.jsx(Gt,{"aria-label":"Reason",value:i??"",onValueChange:o=>l(o),children:tn.map(o=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Vt,{value:o.value,id:`${a}-${o.value}`}),t.jsx(ae,{htmlFor:`${a}-${o.value}`,children:o.label})]},o.value))}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ae,{htmlFor:`${a}-note`,children:"Note (optional)"}),t.jsx(Xt,{id:`${a}-note`,value:d,maxLength:Zt,onChange:o=>c(o.target.value),rows:3}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Only owners and admins see this."})]}),r.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:r.error instanceof Error&&r.error.message?r.error.message:"Couldn’t send the report. Try again."})]}),t.jsxs(Ke,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:!i||r.isPending,children:r.isPending?"Sending…":"Send report"})]})]})}function an({agentDeliveries:e,drafts:s,entries:n,threadId:a,canSend:i,action:l,onRetryAgent:d,onRetryDraft:c}){return t.jsxs(t.Fragment,{children:[e.filter(r=>r.parentEntryId===(a??null)&&!n.some(o=>o.originIdempotencyKey===r.idempotencyKey)).map(r=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[r.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:r.text}),r.attachments.map((o,h)=>t.jsx("span",{className:"mr-2",children:o.name},h)),t.jsx("p",{className:"text-muted-foreground",children:r.state==="pending"?"Waiting for the space to confirm…":r.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),r.state==="pending"&&r.retryable&&t.jsx(S,{variant:"outline",size:"sm",disabled:!i||l!==null,onClick:()=>d(r.idempotencyKey),children:l===`retry:${r.idempotencyKey}`?"Retrying…":"Retry now"})]},r.idempotencyKey)),s.filter(r=>r.parentEntryId===a&&!n.some(o=>o.originIdempotencyKey===r.key)).map(r=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:r.text}),r.files.map(o=>t.jsx("span",{className:"mr-2",children:o.file.name},o.id)),t.jsx("p",{className:"text-muted-foreground",children:r.status==="sending"?"Sending…":"Delivery not confirmed."}),r.error&&t.jsx("p",{children:r.error}),r.status==="failed"&&t.jsx(S,{variant:"outline",size:"sm",disabled:!i,onClick:()=>c(r.key),children:"Retry message"})]},r.key))]})}function rn(e,s){var l;const n=new Map;for(const d of e)d.thread&&n.set(d.id,{count:d.thread.replyCount,lastAt:d.thread.lastReplyAt,through:d.threadLastReplySeq});const a=new Map;for(const d of s){const c=d.threadRootEntryId;if(d.depth===0||c===null)continue;const r=(l=n.get(c))==null?void 0:l.through;if(r!==void 0&&d.remoteSeq<=r)continue;const o=a.get(c);a.set(c,{count:((o==null?void 0:o.count)??0)+1,newest:o&&o.newest.remoteSeq>d.remoteSeq?o.newest:d})}const i=new Map;for(const d of new Set([...n.keys(),...a.keys()])){const c=n.get(d),r=a.get(d),o=c===void 0?r.count:c.through===void 0?Math.max(c.count,(r==null?void 0:r.count)??0):c.count+((r==null?void 0:r.count)??0);i.set(d,{count:o,lastAt:(r==null?void 0:r.newest.createdAt)??c.lastAt,unread:0})}return i}const on={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function ln({community:e,roomId:s,threadId:n,onThread:a,dmAgentName:i}){var ze,qe,He,Ye;const l=V(),c=(ze=ge().data)==null?void 0:ze.find(p=>p.ref===e),r=_e(c==null?void 0:c.access),o=ue(!0,r.fingerprint,e),{ownerAddress:h,contextAddress:u}=Es(o),y=le(),N=es(),v=ts(),w=(qe=N.data)==null?void 0:qe.destinations.find(p=>p.ref===e&&p.roomId===s),g=f.useRef(null),O=f.useRef(void 0),A=(w==null?void 0:w.scrollAnchorEntryId)??null,_=f.useCallback(p=>{if(!o||n)return;g.current&&clearTimeout(g.current),g.current=null;const D=p??null,K=O.current===void 0?A:O.current;D===null&&K===null||(g.current=setTimeout(()=>{g.current=null,O.current=D,v.mutate({ref:e,roomId:s,threadId:n??null,scrollAnchorEntryId:D})},400))},[o,e,v,A,s,n]);f.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]),f.useEffect(()=>{(c==null?void 0:c.status)==="reconnect-required"&&o&&y.removeQueries({queryKey:q.remote(o,e)})},[o,e,c==null?void 0:c.status,y]);const H=ft(e,s,r.capabilities.read,r.fingerprint),[M,z]=f.useState(0),L=f.useRef([]),C=f.useCallback(p=>L.current.some(D=>D.id===p),[]),U=As(e,s,r.capabilities.stream,M,r.fingerprint,r.cacheReadable,C),j=U.status==="removed",x=j?null:U.room??H.data,I=ss(e,s,n,!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,r.fingerprint),b=pt(e,s,!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,r.fingerprint),[k,F]=f.useState(()=>({address:u,entries:[]})),Y=f.useMemo(()=>k.address===u?k.entries:[],[u,k]);f.useEffect(()=>{L.current=Y},[Y]);const[Z,re]=f.useState(0),[ee,me]=f.useState(!1),[Se,m]=f.useState(null),[R,$]=f.useState(null),T=Is({community:e,roomId:s,enabled:!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,accessFingerprint:r.fingerprint}),E=(c==null?void 0:c.connectedHumanMemberId)??null,P=(He=b.data)==null?void 0:He.members.find(p=>p.memberId===E),B=p=>{var D;return p===E||((D=b.data)==null?void 0:D.members.some(K=>K.memberId===p&&K.ownerMemberId===E))===!0},[J,te]=f.useState({address:"",name:null,error:null}),W=J.address===u?J.name:null,ye=J.address===u?J.error:null,ie=f.useRef(null),G=f.useRef(null),se=f.useRef(null),fe=!j&&r.capabilities.post&&U.status==="live"&&(x==null?void 0:x.writable)===!0,ke=fe&&T.hold===null,ce=f.useMemo(()=>{var p;return j?[]:Ee(Ce(e,s,...((p=I.data)==null?void 0:p.pages.map(D=>D.entries))??[],U.entries,Y),U.revisions)},[e,s,I.data,U.entries,U.revisions,Y,j]),kt=f.useCallback(p=>{F(D=>({address:u,entries:Ce(e,s,D.address===u?D.entries:[],[p]).slice(-500)})),re(D=>D+1)},[u,e,s]);f.useLayoutEffect(()=>{var p;Z>0&&((p=se.current)==null||p.scrollToBottom())},[Z]);const bt=f.useMemo(()=>{var p;return o?{ownerKey:o.ownerKey,epoch:o.epoch,ref:e,generation:((p=o.connection)==null?void 0:p.generation)??0,roomId:s,threadId:n}:null},[o,e,s,n]),Q=qs({ref:e,roomId:s,canSend:ke,entries:ce,onReceipt:kt,draft:bt,ownerKey:h||"unresolved",contextKey:u||"unresolved",onHold:T.noteHold}),At=ce.filter(p=>n?p.id===n||p.threadRootEntryId===n:p.depth===0),Dt=f.useMemo(()=>{var p;return n?new Map:rn(((p=I.data)==null?void 0:p.pages.flatMap(D=>D.entries))??[],ce)},[n,I.data,ce]),Pe=At.flatMap(p=>{const D=Dt.get(p.id);return D?[{kind:"message",entry:p},{kind:"replies",rootId:p.id,summary:D}]:[{kind:"message",entry:p}]}),Tt=Pe.map(p=>p.kind==="replies"?{kind:"thread-reply",id:`${p.rootId}:replies`,rootId:p.rootId,replyCount:p.summary.count,lastAt:p.summary.lastAt}:{kind:"message",id:p.entry.id,payload:p.entry,grouping:{position:"only"},author:{id:JSON.stringify([e,p.entry.authorId]),kind:p.entry.authorKind,displayName:p.entry.authorDisplayName},at:p.entry.createdAt}),be={kind:"room",id:JSON.stringify([e,s,n]),placeholder:n?"Reply in thread…":`Message ${i??(x==null?void 0:x.title)??"this channel"}…`,canSend:ke,canSendReason:j?"You no longer have access to this channel.":T.hold?$s(T.hold):!r.capabilities.post&&r.cacheReadable?"This space is read-only.":x!=null&&x.archived?"This channel is archived.":x!=null&&x.joined?"Reconnecting. You can send once the space is back.":"Join this channel to send messages.",attachments:Q.attachments,async send(){Q.send(n)}};async function ve(p,D){if(W||!o)return;const K=o,de=u;te({address:de,name:p,error:null});try{if(await D(),!X(K))return;(p==="join"||p==="leave"||p.startsWith("retry:"))&&z(ne=>ne+1),await y.invalidateQueries({queryKey:q.remote(K,e)})}catch(ne){X(K)&&te({address:de,name:p,error:ne instanceof Error?ne.message:"Couldn’t finish that. Try again."})}finally{X(K)&&te(ne=>ne.address===de?{...ne,name:null}:ne)}}function Et(){var K;const p=ce.at(-1);if(n||I.hasNextPage||!p||U.status!=="live"||((K=ie.current)==null?void 0:K.address)===u&&ie.current.cursor===p.cursor||!o)return;const D=o;ie.current={address:u,cursor:p.cursor},l.setRemoteCommunityReadCursor(e,s,p.cursor).then(()=>{X(D)&&y.invalidateQueries({queryKey:q.rooms(D,e)})}).catch(()=>{var de;((de=ie.current)==null?void 0:de.address)===u&&(ie.current=null)})}return t.jsxs(Ne.Root,{surface:"room",capabilities:on,target:be,children:[t.jsxs("section",{className:"flex h-full min-h-0 flex-col","aria-label":(x==null?void 0:x.title)??"Space channel",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-3 py-2",children:[n&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>a(),children:"Back to channel"}),!j&&r.capabilities.post&&x&&!x.joined&&!x.stale&&t.jsx(S,{size:"sm",disabled:W!==null,onClick:()=>void ve("join",()=>l.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),r.cacheReadable&&t.jsx(S,{variant:"ghost",size:"sm",disabled:j,onClick:()=>me(!ee),children:ee?"Hide members":"Members"}),((Ye=T.standing)==null?void 0:Ye.rules.text)&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>m("rules"),children:"Rules"}),r.capabilities.post&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>m("name"),children:"Your name"}),r.capabilities.enrollAgent&&t.jsx(S,{variant:"outline",size:"sm",disabled:W!==null,onClick:()=>void ve("stop",()=>l.haltRemoteCommunityRoom(e,s)),children:W==="stop"?"Stopping…":"Stop my agents"}),r.capabilities.post&&(x==null?void 0:x.joined)&&!i&&t.jsx(S,{variant:"ghost",size:"sm",disabled:W!==null||!fe,onClick:()=>void ve("leave",async()=>{await l.leaveRemoteCommunityRoom(e,s),o&&y.removeQueries({queryKey:q.room(o,e,s)})}),children:"Leave channel"})]}),ye&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:ye}),j?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[U.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:U.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),H.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),ee&&t.jsx(Gs,{roster:b.data,failed:b.isError,canMention:fe,onMention:p=>{var D;Q.setText(`${Q.text}${Q.text&&!Q.text.endsWith(" ")?" ":""}@${p} `),(D=G.current)==null||D.focus()},community:e,roomId:s,online:U.status==="live",canEnroll:r.capabilities.enrollAgent,agentsKey:u,accessFingerprint:r.fingerprint}),I.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void I.refetch(),children:"Retry"})]}),I.hasNextPage&&t.jsx(S,{variant:"ghost",size:"sm",disabled:I.isFetchingNextPage,onClick:()=>void I.fetchNextPage(),children:"Load the next page of history"}),t.jsx(Ne.Timeline,{ref:se,conversationId:be.id,rows:Tt,label:n?"Space thread":"Space messages",busy:I.isFetching,resumeRow:()=>n?void 0:A??void 0,onTopRow:_,onReachedBottom:Et,onOpenThread:a,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:I.isPending?"Loading messages…":"No messages here yet."}),renderRow:(p,D)=>{const K=Pe[D.index];return K.kind==="message"?t.jsx(wt,{entry:K.entry,onThread:a,onReport:r.capabilities.post&&b.data&&!B(K.entry.authorId)?()=>$(K.entry):void 0}):t.jsx(hs,{summary:K.summary,open:!1,onOpen:()=>a(K.rootId)})}}),t.jsx(an,{agentDeliveries:U.deliveries,drafts:Q.deliveries,entries:ce,threadId:n,canSend:ke,action:W,onRetryAgent:p=>void ve(`retry:${p}`,()=>l.retryRemoteCommunityDelivery(e,s,p)),onRetryDraft:Q.retry}),Q.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:Q.error}),t.jsx(Ne.Composer,{inputRef:G,aboveInput:t.jsx(Vs,{conduct:T,staff:["owner","admin"].includes((P==null?void 0:P.role)??""),onReadRules:()=>m("rules")}),className:"m-3",value:Q.text,onChange:Q.setText,onSubmit:()=>Q.send(n),input:{isStreaming:!1,contextKey:be.id,canSubmit:Q.text.trim().length>0||Q.attachments.staged.length>0}})]})]}),t.jsx(Xs,{conduct:T,open:Se==="rules",onOpenChange:p=>m(p?"rules":null)}),t.jsx(Zs,{community:e,accessFingerprint:r.fingerprint,currentName:(P==null?void 0:P.displayName)??"",open:Se==="name",onOpenChange:p=>m(p?"name":null)}),t.jsx(sn,{entry:R,onClose:()=>$(null)})]})}function cn({community:e,roomId:s}){var h,u;const n=ge(),a=(h=n.data)==null?void 0:h.find(y=>y.ref===e),i=_e(a==null?void 0:a.access),l=ft(e,s??"",!!s&&i.capabilities.read,i.fingerprint),{dm:d}=ht(e,s??"",!!s&&i.capabilities.read,i.fingerprint),c=(a==null?void 0:a.label)??"Space",r=s?d?ns(d):(u=l.data)==null?void 0:u.title:void 0,o=a===void 0&&n.fetchStatus==="fetching"||s!==void 0&&r===void 0&&l.fetchStatus==="fetching";return t.jsx(xt,{pending:o,children:r?`${c} · ${r}`:c})}function St(e){var s,n,a,i;return!e||e.status==="reconnect-required"?null:((n=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:n.lifecycle)==="deleted"?"deleted":((i=(a=e.access)==null?void 0:a.lastKnown)==null?void 0:i.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function Ge(e,s,n){return`${e} ${e===1?s:n}`}function dn(e,s){const n=[e>0?Ge(e,"message from your agents","messages from your agents"):null,s>0?Ge(s,"draft of yours","drafts of yours"):null].filter(i=>i!==null);if(n.length===0)return null;const a=n.length===1&&(e===1||s===1);return`${n.join(" and ")} ${a?"wasn’t":"weren’t"} sent.`}function un({connection:e,onRemoved:s}){const n=St(e),a=as(),[i,l]=f.useState(!1),{ownerKey:d}=rs(),c=is(d,e.ref),{copied:r,failed:o,copy:h}=os(),u=e.label,y=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function N(){a.mutate(e,{onSuccess:()=>{l(!1),mt.success(`${u} is removed from DorkOS.`),s()}})}const v=n==="deleted"||n==="taken-down",w=n==="taken-down"?"This space was taken down":n==="deleted"?"This space was deleted":"This space seems to be gone",g=n==="taken-down"?`DorkOS removed its copy here. If ${u} returns, you can connect again.`:n==="deleted"?"DorkOS removed its copy from this computer.":`Since ${y}, ${u} says it doesn’t exist. Its channels, messages and files are still here.`,O=dn(v?e.undeliveredAgentMessages??0:0,c.length),A=c.length===0?null:c.length===1?"Your unsent draft is cleared too.":`Your ${c.length} unsent drafts are cleared too.`;return t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-10 text-center text-sm","data-testid":"community-gone",children:[t.jsx(Cs,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:w}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:g}),O&&t.jsx("p",{role:"status",className:"text-foreground max-w-sm","data-testid":"community-gone-unsent",children:O}),t.jsx("span",{className:"sr-only","aria-live":"polite","data-testid":"community-gone-copy-status",children:r?"Copied.":o?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[c.length>0&&t.jsx(S,{variant:"outline",onClick:()=>void h(c.join(`
|
|
8
|
+
`)}function qs(e){const s=e==null?void 0:e.code;return typeof s=="string"&&Ls.has(s)}function De(e){return e.map(({id:s,file:n})=>({id:s,file:n,status:"pending",progress:0}))}function zs({ref:e,roomId:s,canSend:n,entries:a,onReceipt:i,draft:l,ownerKey:d,contextKey:c=d,onHold:r}){const o=V(),h=JSON.stringify([d,e,s,c]),u=Pt(l),y=u.text,N=f.useMemo(()=>De(u.files),[u.files]),v=f.useRef(l);f.useLayoutEffect(()=>{v.current=l},[l]);function w(m){const R=v.current;if(!R)return;const $=je.getState(),T=$.drafts[Ae(R)],E=m({text:(T==null?void 0:T.text)??"",files:De((T==null?void 0:T.files)??[])});$.write(R,{text:E.text,files:E.files.map(({id:P,file:B})=>({id:P,file:B}))})}function g(m){w(R=>({...R,text:m}))}function O(m){w(R=>({...R,files:m(R.files)}))}const[A,_]=f.useState(null);function Y(m){_(m===null?null:{address:h,context:c,message:m})}const[M,q]=f.useState([]),L=f.useRef(new Map),C=f.useRef(0),U=f.useRef(new Map),j=f.useRef(new Set),x=f.useRef(h),I=f.useRef(c),b=f.useRef(!0),k=f.useRef(n),F=f.useRef(i),H=f.useRef(r);f.useLayoutEffect(()=>{x.current=h,I.current=c,k.current=n,F.current=i,H.current=r},[h,n,c,i,r]),f.useEffect(()=>(b.current=!0,()=>{b.current=!1}),[]),f.useEffect(()=>{let m=!1;for(const R of a){if(!R.originIdempotencyKey)continue;const $=L.current.get(R.originIdempotencyKey);($==null?void 0:$.address)===x.current&&$.context===I.current&&L.current.delete(R.originIdempotencyKey)&&(Be($),m=!0)}m&&q([...L.current.values()])},[a]);function Z(){b.current&&q([...L.current.values()].filter(m=>m.address===x.current&&m.context===I.current).map(m=>({...m})))}async function re(m){var R,$;if(!(j.current.has(m.key)||!k.current||!b.current||m.address!==x.current)){j.current.add(m.key),m.status="sending",m.error=void 0,Z();try{!m.posted&&m.uploadedAt.some(E=>!Ct(E))&&(m.attachmentIds=[],m.uploadedAt=[],m.triedAt=[],m.uploadRound+=1);for(let E=m.attachmentIds.length;E<m.files.length;E++){if(!k.current||!b.current||m.address!==x.current)throw new Error("Reconnect to this channel, then try again.");const P=m.files[E],B=Nt(m.ref,m.roomId,P.id),J=Ks(B);if(J){m.attachmentIds.push(J.attachmentId),m.uploadedAt.push(J.at);continue}const te=(R=m.triedAt)[E]??(R[E]=_s()),W=await o.uploadRemoteCommunityAttachment(m.ref,m.roomId,P.file,m.uploadRound?`${m.key}:file:${E}:${m.uploadRound}`:`${m.key}:file:${E}`);Ps(B,W.id,te),m.uploadedAt.push(te),m.attachmentIds.push(W.id)}if(!k.current||!b.current||m.address!==x.current)throw new Error("Reconnect to this channel, then try again.");m.posted=!0;const T=await o.postRemoteCommunityEntry(m.ref,m.roomId,{text:m.text,parentEntryId:m.parentEntryId,attachmentIds:m.attachmentIds,idempotencyKey:m.key});L.current.delete(m.key),Be(m),b.current&&m.address===x.current&&m.context===I.current&&F.current(T)}catch(T){if(qs(T)&&ee(m)){L.current.delete(m.key);return}if(Os(T)&&ee(m)){L.current.delete(m.key),b.current&&m.address===x.current&&(($=H.current)==null||$.call(H,T));return}m.status="failed",m.error=T instanceof Error?T.message:"Not confirmed. Try this message again."}finally{j.current.delete(m.key),Z()}}}function ee(m){const{draft:R}=m.origin,$=Ae(R),T=je.getState(),E=T.drafts[$],P=(E==null?void 0:E.text)??"";let B=U.current.get($)??[];const J=Je(B.map(G=>G.origin.typed));let te=P;J&&P.startsWith(J)?te=P.slice(J.length).replace(/^\n+/,""):B=[];const W=[...B,m].sort((G,se)=>G.origin.seq-se.origin.seq),ye=new Set(W.flatMap(G=>G.files.map(se=>se.id))),ie=[...W.flatMap(G=>G.files.map(({id:se,file:fe})=>({id:se,file:fe}))),...((E==null?void 0:E.files)??[]).filter(G=>!ye.has(G.id))];return T.write(R,{text:Je([...W.map(G=>G.origin.typed),te]),files:ie}),$ in je.getState().drafts?(U.current.set($,W),!0):!1}function me(m){const R=v.current;if(!R||!k.current)return;const $=je.getState(),T=$.drafts[Ae(R)];if(!T||!T.text.trim()&&T.files.length===0)return;if(L.current.size>=30){Y("Too many messages waiting. Let them send, or retry them first.");return}const E=$.take(R),P=De(E.files),B={address:h,context:c,ref:e,roomId:s,key:crypto.randomUUID(),text:E.text.trim()?E.text:P.map(J=>J.file.name).join(", "),parentEntryId:m,files:P,attachmentIds:[],uploadedAt:[],triedAt:[],posted:!1,uploadRound:0,status:"sending",origin:{draft:R,typed:E.text,seq:C.current+=1}};L.current.set(B.key,B),Y(null),re(B)}return{text:y,setText:g,attachments:{staged:N,add(m){if(m.some(R=>R.size>25*1024*1024)){Y("Each file must be 25 MB or smaller.");return}O(R=>R.length+m.length>8?(Y("Attach up to eight files to one message."),R):[...R,...m.map($=>({id:crypto.randomUUID(),file:$,status:"pending",progress:0}))])},remove(m){O(R=>R.filter($=>$.id!==m))},retry(){},cancel(){O(()=>[])},hasFailed:!1,isUploading:!1,holdsSendWhileUploading:!1},deliveries:M.filter(m=>m.address===h&&m.context===c),error:(A==null?void 0:A.address)===h&&A.context===c?A.message:null,send:me,retry(m){const R=L.current.get(m);R&&re(R)}}}function wt({entry:e,onThread:s,onReport:n}){const a=V(),i=f.useId(),[l,d]=f.useState(null),[c,r]=f.useState(null),o={id:JSON.stringify([e.community,e.authorId]),kind:e.authorKind,displayName:e.authorDisplayName};async function h(u,y){if(c)return;r(u),d(null);let N;try{const v=await a.downloadRemoteCommunityAttachment(e.community,e.roomId,u);N=URL.createObjectURL(v);const w=document.createElement("a");w.href=N,w.download=Array.from(y,g=>g==="/"||g==="\\"||g.charCodeAt(0)<32?"_":g).join(""),document.body.append(w),w.click(),w.remove()}catch(v){d(v instanceof Error?v.message:"Couldn’t download the file. Try again.")}finally{N&&setTimeout(()=>URL.revokeObjectURL(N),1e3),r(null)}}return t.jsxs(pe.Root,{role:e.authorKind==="human"?"user":"assistant","aria-labelledby":i,children:[t.jsx(pe.Gutter,{author:o,at:e.createdAt}),t.jsxs(pe.Body,{children:[t.jsx(pe.Author,{id:i,author:o,at:e.createdAt}),t.jsxs(pe.Content,{children:[t.jsx(ys,{content:e.text}),e.attachments.map(u=>t.jsx(S,{variant:"outline",size:"sm",disabled:c!==null,onClick:()=>void h(u.id,u.name),className:"max-w-full",children:t.jsx("span",{className:"min-w-0 truncate",children:c===u.id?"Downloading…":u.name})},u.id)),l&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:l}),s&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>s(e.threadRootEntryId??e.id),children:e.depth===0?"Reply in thread":"Open thread"}),n&&t.jsx(S,{variant:"ghost",size:"sm",onClick:n,children:"Report"})]})]})]})}function Ys({community:e,roomId:s,online:n,canEnroll:a,accessFingerprint:i}){var j,x,I;const l=V(),d=le(),c=ue(!0,i,e),r=qt(e,a,i),o=zt(),h=et(e,a,i),[u,y]=f.useState(""),[N,v]=f.useState(""),[w,g]=f.useState(!1),[O,A]=f.useState(null),[_,Y]=f.useState(null),M=f.useId(),q=((j=r.data)==null?void 0:j.filter(b=>b.active))??[],L=((x=o.data)==null?void 0:x.agents.filter(b=>!q.some(k=>k.localAgentId===b.id)))??[];async function C(){c&&X(c)&&await d.invalidateQueries({queryKey:z.remote(c,e)})}async function U(b){if(b.preventDefault(),!u||w||!n||!a||!c)return;const k=c;g(!0),A(null);try{if(await l.enrollRemoteCommunityAgent(e,u,N.trim()?{handle:N.trim()}:{}),!X(k))return;y(""),v(""),await C()}catch(F){X(k)&&A(F instanceof Error?F.message:"Couldn’t add the agent. Try again.")}finally{X(k)&&g(!1)}}return t.jsxs("section",{className:"mt-3 space-y-2 border-t pt-3","aria-label":"Your agents in this space",children:[t.jsx("h3",{className:"text-sm font-medium",children:"My agents"}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Add an agent from here, then choose whether it joins this channel."}),r.isError&&t.jsxs("p",{role:"alert",children:["Couldn’t load your agents in this space."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void r.refetch(),children:"Retry"})]}),(I=r.data)==null?void 0:I.map(b=>{var k;return t.jsx(Hs,{agent:b,roomId:s,online:n,canEnroll:a,takesDms:((k=h.data)==null?void 0:k.available)===!0,onChanged:C,onNotice:Y},b.localAgentId)}),o.isError&&t.jsx("p",{role:"alert",children:"Couldn’t load the agents on this computer."}),a&&L.length>0&&t.jsxs("form",{onSubmit:b=>void U(b),className:"flex flex-wrap items-end gap-2",children:[t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(ae,{htmlFor:`${M}-agent`,children:"Local agent"}),t.jsxs(tt,{value:u,onValueChange:y,disabled:!n||w,children:[t.jsx(st,{id:`${M}-agent`,children:t.jsx(nt,{placeholder:"Choose an agent"})}),t.jsx(at,{children:L.map(b=>t.jsx(Te,{value:b.id,children:b.name},b.id))})]})]}),t.jsxs("div",{className:"min-w-40 flex-1 space-y-1",children:[t.jsx(ae,{htmlFor:`${M}-handle`,children:"Space handle (optional)"}),t.jsx(Me,{id:`${M}-handle`,value:N,onChange:b=>v(b.target.value),disabled:!n||w,placeholder:"Use the agent’s handle"})]}),t.jsx(S,{type:"submit",disabled:!u||!n||w,children:w?"Adding…":"Add to space"})]}),_&&t.jsx("p",{role:"status",className:"text-muted-foreground text-sm",children:_}),O&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:O})]})}function Hs({agent:e,roomId:s,online:n,canEnroll:a,takesDms:i,onChanged:l,onNotice:d}){const c=V(),[r,o]=f.useState(null),[h,u]=f.useState(null),y=e.roomIds.includes(s),N=f.useId();async function v(g,O){if(!r){o(g),u(null);try{await O(),await l()}catch(A){u(A instanceof Error?A.message:"Couldn’t finish that. Try again.")}finally{o(null)}}}function w(g){d(g.remoteRevoked?"Stopped taking part.":"Stopped here, but the space wasn’t told. Try again when it’s reachable.")}return t.jsxs("div",{className:"space-y-1 rounded-md border p-2",children:[t.jsxs("p",{className:"text-sm font-medium",children:[e.displayName,!e.active&&" · stopped here"," ",t.jsxs("span",{className:"text-muted-foreground font-normal",children:["· owned by ",e.ownerDisplayName]})]}),t.jsxs("div",{className:"flex flex-wrap gap-1",children:[t.jsx(S,{variant:"outline",size:"sm",disabled:r!==null||!a||!e.active||!y&&!n,onClick:()=>void v("membership",async()=>{y?w(await c.leaveRemoteCommunityAgentRoom(e.community,s,e.localAgentId)):await c.joinRemoteCommunityAgentRoom(e.community,s,e.localAgentId)}),children:y?"Leave channel":"Join channel"}),t.jsx(S,{variant:"ghost",size:"sm",disabled:r!==null||!a,onClick:()=>void v("stop",()=>c.haltRemoteCommunityAgent(e.community,s,e.localAgentId)),children:"Stop agent"}),t.jsxs(rt,{children:[t.jsx(Yt,{asChild:!0,children:t.jsx(S,{variant:"ghost",size:"sm",disabled:r!==null||!a,children:"Remove from space"})}),t.jsxs(it,{children:[t.jsxs(ot,{children:[t.jsxs(lt,{children:["Remove ",e.displayName,"?"]}),t.jsx(ct,{children:"It leaves every channel in this space. You can re-add it."})]}),t.jsxs(dt,{children:[t.jsx(ut,{children:"Cancel"}),t.jsx(Ht,{onClick:()=>void v("remove",async()=>w(await c.ejectRemoteCommunityAgent(e.community,e.localAgentId))),children:"Remove agent"})]})]})]})]}),i&&e.active&&t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Qt,{id:N,checked:e.acceptsDms===!0,disabled:r!==null||!a||!n,onCheckedChange:g=>void v("dms",()=>c.setRemoteCommunityAgentDms(e.community,e.localAgentId,g))}),t.jsx(ae,{htmlFor:N,className:"text-xs font-normal",children:"Takes direct messages"})]}),h&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:h})]})}function Qs({community:e,agent:s,disabled:n,accessFingerprint:a}){const i=V(),l=Re(),d=le(),c=ue(!0,a,e),[r,o]=f.useState(!1),[h,u]=f.useState(null);async function y(){if(!r){o(!0),u(null);try{const N=await i.startRemoteCommunityDm(e,s.memberId);c&&await d.invalidateQueries({queryKey:z.dms(c,e)}),l({...xe.channels(),search:{community:e,id:N.roomId}})}catch(N){u(N.code===Bt?`${s.displayName} isn’t taking direct messages.`:"Couldn’t open the direct message. Try again.")}finally{o(!1)}}}return t.jsxs("span",{className:"flex flex-wrap items-center justify-end gap-x-2",children:[h&&t.jsx("span",{role:"status",className:"text-muted-foreground order-last w-full text-right text-xs sm:order-none sm:w-auto",children:h}),t.jsx(S,{variant:"ghost",size:"sm",disabled:n||r,onClick:()=>void y(),"aria-label":`Message ${s.displayName}`,children:"Message"})]})}function We(e){return`$${e.toFixed(2)}`}function Bs({community:e,online:s,canEnroll:n}){var w;const a=f.useId(),i=Ss(e),l=ks(e),d=(w=i.data)==null?void 0:w.spend,[c,r]=f.useState(null),o=(d==null?void 0:d.monthlyLimitUsd)!=null?String(d.monthlyLimitUsd):"",h=c??o,u=h.trim()===""?null:Jt(Number(h)),y=u===null||Number.isFinite(u)&&u>=Wt,N=u!==((d==null?void 0:d.monthlyLimitUsd)??null);function v(g){g.preventDefault(),!(!y||!N||l.isPending)&&l.mutate({monthlyLimitUsd:u},{onSuccess:()=>r(null)})}return!n&&!(d!=null&&d.hasAgentsHere)?null:t.jsxs("section",{className:"mt-3 space-y-2 border-t pt-3","aria-labelledby":`${a}-heading`,children:[t.jsx("h3",{id:`${a}-heading`,className:"text-sm font-medium",children:"Teammates"}),i.isError&&t.jsxs("p",{role:"alert",className:"text-sm",children:["Couldn’t load teammate settings."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void i.refetch(),children:"Retry"})]}),i.data&&d&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1",children:[t.jsx(ae,{htmlFor:`${a}-wake`,children:"Who can wake your agents"}),t.jsxs(tt,{value:i.data.wakeAgentsFrom,onValueChange:g=>l.mutate({wakeAgentsFrom:g==="me"?"me":"members"}),disabled:!s||l.isPending,children:[t.jsx(st,{id:`${a}-wake`,className:"max-w-64",children:t.jsx(nt,{})}),t.jsxs(at,{children:[t.jsx(Te,{value:"members",children:"Anyone in this space"}),t.jsx(Te,{value:"me",children:"Only me"})]})]})]}),t.jsxs("form",{onSubmit:v,className:"space-y-1",children:[t.jsx(ae,{htmlFor:`${a}-limit`,children:"Monthly limit for teammates"}),t.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[t.jsx("span",{className:"text-muted-foreground text-sm","aria-hidden":!0,children:"$"}),t.jsx(Me,{id:`${a}-limit`,inputMode:"decimal",value:h,onChange:g=>r(g.target.value),placeholder:"No limit","aria-invalid":!y,disabled:!s||l.isPending,className:"w-32"}),t.jsx(S,{type:"submit",size:"sm",disabled:!s||!y||!N||l.isPending,children:"Save"})]}),t.jsxs("p",{className:"text-muted-foreground text-xs",children:[d.monthlyLimitUsd===null?"No limit":`Limit ${We(d.monthlyLimitUsd)} a month`,` · ${We(d.spentUsd)} spent this month${d.approximate?", approximate":""}`]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Past the limit, teammates’ messages wake nobody. A running turn may go slightly over."}),!y&&t.jsx("p",{role:"alert",className:"text-destructive text-xs",children:"Enter at least $0.01, or leave it empty."})]}),l.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t save. Try again."})]})]})}function Js(e,s){const n=new Date(e),a=n.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return n.toDateString()===s.toDateString()?a:`${n.toLocaleDateString([],{month:"short",day:"numeric",...n.getFullYear()===s.getFullYear()?{}:{year:"numeric"}})}, ${a}`}function Ws(e,s=new Date){return e.kind!=="agent"?null:e.availability==="available"?{text:"Available"}:e.availability==="offline"&&e.lastSeenAt?{text:"Offline since",since:{dateTime:new Date(e.lastSeenAt).toISOString(),label:Js(e.lastSeenAt,s)}}:null}function Gs({roster:e,failed:s,canMention:n,onMention:a,community:i,roomId:l,online:d,canEnroll:c,agentsKey:r,accessFingerprint:o}){var N,v,w;const u=((N=et(i,!0,o).data)==null?void 0:N.available)===!0,y=(w=(v=ge().data)==null?void 0:v.find(g=>g.ref===i))==null?void 0:w.connectedHumanMemberId;return t.jsxs("div",{className:"max-h-48 overflow-auto border-b p-3","aria-label":"Channel members",children:[s&&t.jsx("p",{role:"alert",children:"Couldn’t load members."}),(e==null?void 0:e.stale)&&t.jsx("p",{className:"text-muted-foreground text-sm",children:"Saved member list"}),e==null?void 0:e.members.map(g=>{var A;const O=Ws(g);return t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-2 text-sm",children:[t.jsxs("span",{children:[g.displayName,g.kind==="agent"?" · Agent":"",g.ownerMemberId&&` · owned by ${((A=e.members.find(_=>_.memberId===g.ownerMemberId))==null?void 0:A.displayName)??"a space member"}`,O&&t.jsxs("span",{className:"text-muted-foreground",children:[` · ${O.text}`,O.since&&t.jsxs(t.Fragment,{children:[" ",t.jsx("time",{dateTime:O.since.dateTime,children:O.since.label})]})]})]}),t.jsxs("span",{className:"flex flex-wrap items-center justify-end",children:[u&&g.kind==="agent"&&g.ownerMemberId!==y&&t.jsx(Qs,{community:i,agent:g,disabled:!d,accessFingerprint:o}),g.handle&&t.jsxs(S,{variant:"ghost",size:"sm",disabled:!n,onClick:()=>a(g.handle),children:["Mention @",g.handle]})]})]},g.memberId)}),c&&t.jsx(Ys,{community:i,roomId:l,online:d,canEnroll:!0,accessFingerprint:o},r),t.jsx(Bs,{community:i,online:d,canEnroll:c})]})}function Rt(e,s){return e instanceof Error&&e.message?e.message:s}function Vs({conduct:e,staff:s,onReadRules:n}){const{hold:a,standing:i}=e;return(a==null?void 0:a.kind)==="rules"?t.jsx("div",{className:"px-1 pb-1",children:t.jsx(S,{size:"sm",variant:"outline",onClick:n,children:"Read the rules"})}):a||s||!(i!=null&&i.slowModeSeconds)?null:t.jsxs("p",{className:"text-muted-foreground px-1 pb-1 text-xs",children:["Slow mode: one message every ",i.slowModeSeconds,"s."]})}function Xs({conduct:e,open:s,onOpenChange:n}){var l;const a=(l=e.standing)==null?void 0:l.rules,i=a?a.acceptedVersion>=a.version:!1;return t.jsx(Oe,{open:s,onOpenChange:n,children:t.jsxs($e,{className:"sm:max-w-lg",children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Space rules"}),t.jsx(Le,{children:i?"You accepted these rules.":"Accept these rules to post here."})]}),t.jsxs(Fe,{children:[t.jsx("div",{className:"max-h-[50vh] overflow-y-auto rounded-md border p-3 text-sm leading-relaxed whitespace-pre-wrap",children:(a==null?void 0:a.text)??"This space has no rules."}),e.accept.error&&t.jsx("p",{role:"alert",className:"text-destructive mt-2 text-sm",children:Rt(e.accept.error,"Couldn’t accept the rules. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(S,{variant:"outline",onClick:()=>n(!1),children:"Close"}),(a==null?void 0:a.text)&&!i&&t.jsx(S,{disabled:e.accept.isPending,onClick:()=>e.accept.mutate(a.version,{onSuccess:()=>n(!1)}),children:e.accept.isPending?"Accepting…":"Accept rules"})]})]})})}function Zs({community:e,accessFingerprint:s,currentName:n,open:a,onOpenChange:i}){return t.jsx(Oe,{open:a,onOpenChange:i,children:t.jsx($e,{className:"sm:max-w-md",children:a&&t.jsx(en,{community:e,accessFingerprint:s,currentName:n,onDone:()=>i(!1)})})})}function en({community:e,accessFingerprint:s,currentName:n,onDone:a}){const i=V(),l=le(),d=ue(!0,s,e),[c,r]=f.useState(n),o=we({meta:{suppressErrorToast:!0},mutationFn:u=>i.setRemoteCommunityDisplayName(e,u),onSuccess:async()=>{d&&await l.invalidateQueries({queryKey:z.content(d,e)}),a()}}),h=c.trim();return t.jsxs("form",{onSubmit:u=>{u.preventDefault(),h&&h!==n&&o.mutate(h)},children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Your name in this space"}),t.jsx(Le,{children:"Other spaces keep the name they show."})]}),t.jsxs(Fe,{className:"space-y-2",children:[t.jsx(ae,{htmlFor:"remote-community-display-name",children:"Name"}),t.jsx(Me,{id:"remote-community-display-name",value:c,maxLength:128,autoComplete:"nickname",onChange:u=>r(u.target.value)}),o.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:Rt(o.error,"Couldn’t change your name. Try again.")})]}),t.jsxs(Ke,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:a,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:!h||h===n||o.isPending,children:o.isPending?"Saving…":"Save name"})]})]})}const tn=[{value:"spam",label:"Spam"},{value:"harassment",label:"Harassment"},{value:"off_topic",label:"Off topic"},{value:"illegal",label:"Against the law"},{value:"other",label:"Something else"}];function sn({entry:e,onClose:s}){return t.jsx(Oe,{open:e!==null,onOpenChange:n=>!n&&s(),children:t.jsx($e,{className:"sm:max-w-md",children:e&&t.jsx(nn,{entry:e,onClose:s},e.id)})})}function nn({entry:e,onClose:s}){const n=V(),a=f.useId(),[i,l]=f.useState(null),[d,c]=f.useState(""),r=we({meta:{suppressErrorToast:!0},mutationFn:o=>n.reportRemoteCommunityEntry(e.community,e.roomId,e.id,o),onSuccess:()=>{mt("Message reported"),s()}});return t.jsxs("form",{onSubmit:o=>{o.preventDefault(),i&&r.mutate({reason:i,...d.trim()?{note:d.trim()}:{}})},children:[t.jsxs(Ue,{children:[t.jsx(Ie,{children:"Report message"}),t.jsx(Le,{children:"This space’s owners and admins review reports."})]}),t.jsxs(Fe,{className:"space-y-4",children:[t.jsxs("p",{className:"text-muted-foreground line-clamp-3 text-sm",children:[e.authorDisplayName,": ",e.text]}),t.jsx(Gt,{"aria-label":"Reason",value:i??"",onValueChange:o=>l(o),children:tn.map(o=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Vt,{value:o.value,id:`${a}-${o.value}`}),t.jsx(ae,{htmlFor:`${a}-${o.value}`,children:o.label})]},o.value))}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(ae,{htmlFor:`${a}-note`,children:"Note (optional)"}),t.jsx(Xt,{id:`${a}-note`,value:d,maxLength:Zt,onChange:o=>c(o.target.value),rows:3}),t.jsx("p",{className:"text-muted-foreground text-xs",children:"Only owners and admins see this."})]}),r.error&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:r.error instanceof Error&&r.error.message?r.error.message:"Couldn’t send the report. Try again."})]}),t.jsxs(Ke,{children:[t.jsx(S,{type:"button",variant:"outline",onClick:s,children:"Cancel"}),t.jsx(S,{type:"submit",disabled:!i||r.isPending,children:r.isPending?"Sending…":"Send report"})]})]})}function an({agentDeliveries:e,drafts:s,entries:n,threadId:a,canSend:i,action:l,onRetryAgent:d,onRetryDraft:c}){return t.jsxs(t.Fragment,{children:[e.filter(r=>r.parentEntryId===(a??null)&&!n.some(o=>o.originIdempotencyKey===r.idempotencyKey)).map(r=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsxs("p",{className:"font-medium",children:[r.author.displayName," · Agent"]}),t.jsx("p",{className:"whitespace-pre-wrap",children:r.text}),r.attachments.map((o,h)=>t.jsx("span",{className:"mr-2",children:o.name},h)),t.jsx("p",{className:"text-muted-foreground",children:r.state==="pending"?"Waiting for the space to confirm…":r.failure==="expired"?"Not confirmed. Too late to try again.":"Not confirmed. Check the space and the agent’s channel access."}),r.state==="pending"&&r.retryable&&t.jsx(S,{variant:"outline",size:"sm",disabled:!i||l!==null,onClick:()=>d(r.idempotencyKey),children:l===`retry:${r.idempotencyKey}`?"Retrying…":"Retry now"})]},r.idempotencyKey)),s.filter(r=>r.parentEntryId===a&&!n.some(o=>o.originIdempotencyKey===r.key)).map(r=>t.jsxs("div",{className:"border-t px-4 py-2 text-sm",role:"status",children:[t.jsx("p",{className:"whitespace-pre-wrap",children:r.text}),r.files.map(o=>t.jsx("span",{className:"mr-2",children:o.file.name},o.id)),t.jsx("p",{className:"text-muted-foreground",children:r.status==="sending"?"Sending…":"Delivery not confirmed."}),r.error&&t.jsx("p",{children:r.error}),r.status==="failed"&&t.jsx(S,{variant:"outline",size:"sm",disabled:!i,onClick:()=>c(r.key),children:"Retry message"})]},r.key))]})}function rn(e,s){var l;const n=new Map;for(const d of e)d.thread&&n.set(d.id,{count:d.thread.replyCount,lastAt:d.thread.lastReplyAt,through:d.threadLastReplySeq});const a=new Map;for(const d of s){const c=d.threadRootEntryId;if(d.depth===0||c===null)continue;const r=(l=n.get(c))==null?void 0:l.through;if(r!==void 0&&d.remoteSeq<=r)continue;const o=a.get(c);a.set(c,{count:((o==null?void 0:o.count)??0)+1,newest:o&&o.newest.remoteSeq>d.remoteSeq?o.newest:d})}const i=new Map;for(const d of new Set([...n.keys(),...a.keys()])){const c=n.get(d),r=a.get(d),o=c===void 0?r.count:c.through===void 0?Math.max(c.count,(r==null?void 0:r.count)??0):c.count+((r==null?void 0:r.count)??0);i.set(d,{count:o,lastAt:(r==null?void 0:r.newest.createdAt)??c.lastAt,unread:0})}return i}const on={reactions:!1,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!1,turnStatus:!1,asks:!1};function ln({community:e,roomId:s,threadId:n,onThread:a,dmAgentName:i}){var qe,ze,Ye,He;const l=V(),c=(qe=ge().data)==null?void 0:qe.find(p=>p.ref===e),r=_e(c==null?void 0:c.access),o=ue(!0,r.fingerprint,e),{ownerAddress:h,contextAddress:u}=Es(o),y=le(),N=es(),v=ts(),w=(ze=N.data)==null?void 0:ze.destinations.find(p=>p.ref===e&&p.roomId===s),g=f.useRef(null),O=f.useRef(void 0),A=(w==null?void 0:w.scrollAnchorEntryId)??null,_=f.useCallback(p=>{if(!o||n)return;g.current&&clearTimeout(g.current),g.current=null;const D=p??null,K=O.current===void 0?A:O.current;D===null&&K===null||(g.current=setTimeout(()=>{g.current=null,O.current=D,v.mutate({ref:e,roomId:s,threadId:n??null,scrollAnchorEntryId:D})},400))},[o,e,v,A,s,n]);f.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]),f.useEffect(()=>{(c==null?void 0:c.status)==="reconnect-required"&&o&&y.removeQueries({queryKey:z.remote(o,e)})},[o,e,c==null?void 0:c.status,y]);const Y=ft(e,s,r.capabilities.read,r.fingerprint),[M,q]=f.useState(0),L=f.useRef([]),C=f.useCallback(p=>L.current.some(D=>D.id===p),[]),U=As(e,s,r.capabilities.stream,M,r.fingerprint,r.cacheReadable,C),j=U.status==="removed",x=j?null:U.room??Y.data,I=ss(e,s,n,!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,r.fingerprint),b=pt(e,s,!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,r.fingerprint),[k,F]=f.useState(()=>({address:u,entries:[]})),H=f.useMemo(()=>k.address===u?k.entries:[],[u,k]);f.useEffect(()=>{L.current=H},[H]);const[Z,re]=f.useState(0),[ee,me]=f.useState(!1),[Se,m]=f.useState(null),[R,$]=f.useState(null),T=Is({community:e,roomId:s,enabled:!j&&r.capabilities.read&&(x==null?void 0:x.readable)===!0,accessFingerprint:r.fingerprint}),E=(c==null?void 0:c.connectedHumanMemberId)??null,P=(Ye=b.data)==null?void 0:Ye.members.find(p=>p.memberId===E),B=p=>{var D;return p===E||((D=b.data)==null?void 0:D.members.some(K=>K.memberId===p&&K.ownerMemberId===E))===!0},[J,te]=f.useState({address:"",name:null,error:null}),W=J.address===u?J.name:null,ye=J.address===u?J.error:null,ie=f.useRef(null),G=f.useRef(null),se=f.useRef(null),fe=!j&&r.capabilities.post&&U.status==="live"&&(x==null?void 0:x.writable)===!0,ke=fe&&T.hold===null,ce=f.useMemo(()=>{var p;return j?[]:Ee(Ce(e,s,...((p=I.data)==null?void 0:p.pages.map(D=>D.entries))??[],U.entries,H),U.revisions)},[e,s,I.data,U.entries,U.revisions,H,j]),kt=f.useCallback(p=>{F(D=>({address:u,entries:Ce(e,s,D.address===u?D.entries:[],[p]).slice(-500)})),re(D=>D+1)},[u,e,s]);f.useLayoutEffect(()=>{var p;Z>0&&((p=se.current)==null||p.scrollToBottom())},[Z]);const bt=f.useMemo(()=>{var p;return o?{ownerKey:o.ownerKey,epoch:o.epoch,ref:e,generation:((p=o.connection)==null?void 0:p.generation)??0,roomId:s,threadId:n}:null},[o,e,s,n]),Q=zs({ref:e,roomId:s,canSend:ke,entries:ce,onReceipt:kt,draft:bt,ownerKey:h||"unresolved",contextKey:u||"unresolved",onHold:T.noteHold}),At=ce.filter(p=>n?p.id===n||p.threadRootEntryId===n:p.depth===0),Dt=f.useMemo(()=>{var p;return n?new Map:rn(((p=I.data)==null?void 0:p.pages.flatMap(D=>D.entries))??[],ce)},[n,I.data,ce]),Pe=At.flatMap(p=>{const D=Dt.get(p.id);return D?[{kind:"message",entry:p},{kind:"replies",rootId:p.id,summary:D}]:[{kind:"message",entry:p}]}),Tt=Pe.map(p=>p.kind==="replies"?{kind:"thread-reply",id:`${p.rootId}:replies`,rootId:p.rootId,replyCount:p.summary.count,lastAt:p.summary.lastAt}:{kind:"message",id:p.entry.id,payload:p.entry,grouping:{position:"only"},author:{id:JSON.stringify([e,p.entry.authorId]),kind:p.entry.authorKind,displayName:p.entry.authorDisplayName},at:p.entry.createdAt}),be={kind:"room",id:JSON.stringify([e,s,n]),placeholder:n?"Reply in thread…":`Message ${i??(x==null?void 0:x.title)??"this channel"}…`,canSend:ke,canSendReason:j?"You no longer have access to this channel.":T.hold?$s(T.hold):!r.capabilities.post&&r.cacheReadable?"This space is read-only.":x!=null&&x.archived?"This channel is archived.":x!=null&&x.joined?"Reconnecting. You can send once the space is back.":"Join this channel to send messages.",attachments:Q.attachments,async send(){Q.send(n)}};async function ve(p,D){if(W||!o)return;const K=o,de=u;te({address:de,name:p,error:null});try{if(await D(),!X(K))return;(p==="join"||p==="leave"||p.startsWith("retry:"))&&q(ne=>ne+1),await y.invalidateQueries({queryKey:z.remote(K,e)})}catch(ne){X(K)&&te({address:de,name:p,error:ne instanceof Error?ne.message:"Couldn’t finish that. Try again."})}finally{X(K)&&te(ne=>ne.address===de?{...ne,name:null}:ne)}}function Et(){var K;const p=ce.at(-1);if(n||I.hasNextPage||!p||U.status!=="live"||((K=ie.current)==null?void 0:K.address)===u&&ie.current.cursor===p.cursor||!o)return;const D=o;ie.current={address:u,cursor:p.cursor},l.setRemoteCommunityReadCursor(e,s,p.cursor).then(()=>{X(D)&&y.invalidateQueries({queryKey:z.rooms(D,e)})}).catch(()=>{var de;((de=ie.current)==null?void 0:de.address)===u&&(ie.current=null)})}return t.jsxs(Ne.Root,{surface:"room",capabilities:on,target:be,children:[t.jsxs("section",{className:"flex h-full min-h-0 flex-col","aria-label":(x==null?void 0:x.title)??"Space channel",children:[t.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b px-3 py-2",children:[n&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>a(),children:"Back to channel"}),!j&&r.capabilities.post&&x&&!x.joined&&!x.stale&&t.jsx(S,{size:"sm",disabled:W!==null,onClick:()=>void ve("join",()=>l.joinRemoteCommunityRoom(e,s)),children:"Join channel"}),r.cacheReadable&&t.jsx(S,{variant:"ghost",size:"sm",disabled:j,onClick:()=>me(!ee),children:ee?"Hide members":"Members"}),((He=T.standing)==null?void 0:He.rules.text)&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>m("rules"),children:"Rules"}),r.capabilities.post&&t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>m("name"),children:"Your name"}),r.capabilities.enrollAgent&&t.jsx(S,{variant:"outline",size:"sm",disabled:W!==null,onClick:()=>void ve("stop",()=>l.haltRemoteCommunityRoom(e,s)),children:W==="stop"?"Stopping…":"Stop my agents"}),r.capabilities.post&&(x==null?void 0:x.joined)&&!i&&t.jsx(S,{variant:"ghost",size:"sm",disabled:W!==null||!fe,onClick:()=>void ve("leave",async()=>{await l.leaveRemoteCommunityRoom(e,s),o&&y.removeQueries({queryKey:z.room(o,e,s)})}),children:"Leave channel"})]}),ye&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:ye}),j?t.jsx("p",{role:"status",className:"p-6 text-sm",children:"You no longer have access to this channel."}):t.jsxs(t.Fragment,{children:[U.status!=="live"&&t.jsx("p",{role:"status",className:"text-muted-foreground px-4 py-2 text-sm",children:U.status==="connecting"?"Connecting to the space…":"Space unavailable. Showing saved messages."}),Y.isError&&t.jsx("p",{role:"alert",className:"px-4 py-2 text-sm",children:"Couldn’t load this channel."}),ee&&t.jsx(Gs,{roster:b.data,failed:b.isError,canMention:fe,onMention:p=>{var D;Q.setText(`${Q.text}${Q.text&&!Q.text.endsWith(" ")?" ":""}@${p} `),(D=G.current)==null||D.focus()},community:e,roomId:s,online:U.status==="live",canEnroll:r.capabilities.enrollAgent,agentsKey:u,accessFingerprint:r.fingerprint}),I.isError&&t.jsxs("p",{role:"alert",className:"p-3 text-sm",children:["Some messages could not be loaded."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void I.refetch(),children:"Retry"})]}),I.hasNextPage&&t.jsx(S,{variant:"ghost",size:"sm",disabled:I.isFetchingNextPage,onClick:()=>void I.fetchNextPage(),children:"Load the next page of history"}),t.jsx(Ne.Timeline,{ref:se,conversationId:be.id,rows:Tt,label:n?"Space thread":"Space messages",busy:I.isFetching,resumeRow:()=>n?void 0:A??void 0,onTopRow:_,onReachedBottom:Et,onOpenThread:a,empty:t.jsx("p",{className:"text-muted-foreground p-6 text-sm",children:I.isPending?"Loading messages…":"No messages here yet."}),renderRow:(p,D)=>{const K=Pe[D.index];return K.kind==="message"?t.jsx(wt,{entry:K.entry,onThread:a,onReport:r.capabilities.post&&b.data&&!B(K.entry.authorId)?()=>$(K.entry):void 0}):t.jsx(hs,{summary:K.summary,open:!1,onOpen:()=>a(K.rootId)})}}),t.jsx(an,{agentDeliveries:U.deliveries,drafts:Q.deliveries,entries:ce,threadId:n,canSend:ke,action:W,onRetryAgent:p=>void ve(`retry:${p}`,()=>l.retryRemoteCommunityDelivery(e,s,p)),onRetryDraft:Q.retry}),Q.error&&t.jsx("p",{role:"alert",className:"text-destructive px-4 py-2 text-sm",children:Q.error}),t.jsx(Ne.Composer,{inputRef:G,aboveInput:t.jsx(Vs,{conduct:T,staff:["owner","admin"].includes((P==null?void 0:P.role)??""),onReadRules:()=>m("rules")}),className:"m-3",value:Q.text,onChange:Q.setText,onSubmit:()=>Q.send(n),input:{isStreaming:!1,contextKey:be.id,canSubmit:Q.text.trim().length>0||Q.attachments.staged.length>0}})]})]}),t.jsx(Xs,{conduct:T,open:Se==="rules",onOpenChange:p=>m(p?"rules":null)}),t.jsx(Zs,{community:e,accessFingerprint:r.fingerprint,currentName:(P==null?void 0:P.displayName)??"",open:Se==="name",onOpenChange:p=>m(p?"name":null)}),t.jsx(sn,{entry:R,onClose:()=>$(null)})]})}function cn({community:e,roomId:s}){var h,u;const n=ge(),a=(h=n.data)==null?void 0:h.find(y=>y.ref===e),i=_e(a==null?void 0:a.access),l=ft(e,s??"",!!s&&i.capabilities.read,i.fingerprint),{dm:d}=ht(e,s??"",!!s&&i.capabilities.read,i.fingerprint),c=(a==null?void 0:a.label)??"Space",r=s?d?ns(d):(u=l.data)==null?void 0:u.title:void 0,o=a===void 0&&n.fetchStatus==="fetching"||s!==void 0&&r===void 0&&l.fetchStatus==="fetching";return t.jsx(xt,{pending:o,children:r?`${c} · ${r}`:c})}function St(e){var s,n,a,i;return!e||e.status==="reconnect-required"?null:((n=(s=e.access)==null?void 0:s.lastKnown)==null?void 0:n.lifecycle)==="deleted"?"deleted":((i=(a=e.access)==null?void 0:a.lastKnown)==null?void 0:i.lifecycle)==="taken_down"?"taken-down":e.seemsGoneSince?"seems-gone":null}function Ge(e,s,n){return`${e} ${e===1?s:n}`}function dn(e,s){const n=[e>0?Ge(e,"message from your agents","messages from your agents"):null,s>0?Ge(s,"draft of yours","drafts of yours"):null].filter(i=>i!==null);if(n.length===0)return null;const a=n.length===1&&(e===1||s===1);return`${n.join(" and ")} ${a?"wasn’t":"weren’t"} sent.`}function un({connection:e,onRemoved:s}){const n=St(e),a=as(),[i,l]=f.useState(!1),{ownerKey:d}=rs(),c=is(d,e.ref),{copied:r,failed:o,copy:h}=os(),u=e.label,y=e.seemsGoneSince?new Date(e.seemsGoneSince).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"}):null;function N(){a.mutate(e,{onSuccess:()=>{l(!1),mt.success(`${u} is removed from DorkOS.`),s()}})}const v=n==="deleted"||n==="taken-down",w=n==="taken-down"?"This space was taken down":n==="deleted"?"This space was deleted":"This space seems to be gone",g=n==="taken-down"?`DorkOS removed its copy here. If ${u} returns, you can connect again.`:n==="deleted"?"DorkOS removed its copy from this computer.":`Since ${y}, ${u} says it doesn’t exist. Its channels, messages and files are still here.`,O=dn(v?e.undeliveredAgentMessages??0:0,c.length),A=c.length===0?null:c.length===1?"Your unsent draft is cleared too.":`Your ${c.length} unsent drafts are cleared too.`;return t.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-10 text-center text-sm","data-testid":"community-gone",children:[t.jsx(Cs,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:w}),t.jsx("p",{className:"text-muted-foreground max-w-sm",children:g}),O&&t.jsx("p",{role:"status",className:"text-foreground max-w-sm","data-testid":"community-gone-unsent",children:O}),t.jsx("span",{className:"sr-only","aria-live":"polite","data-testid":"community-gone-copy-status",children:r?"Copied.":o?"Couldn’t copy to the clipboard.":""}),t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[c.length>0&&t.jsx(S,{variant:"outline",onClick:()=>void h(c.join(`
|
|
9
9
|
|
|
10
|
-
`)),children:r?"Copied":o?"Couldn’t copy":c.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(S,{variant:v?"outline":"destructive",onClick:()=>l(!0),children:v?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(rt,{open:i,onOpenChange:_=>{_||a.reset(),l(_)},children:t.jsxs(it,{children:[t.jsxs(ot,{children:[t.jsx(lt,{children:v?`Remove ${u} from DorkOS?`:`Remove your copy of ${u}?`}),t.jsx(ct,{asChild:!0,children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:v?`${u} leaves this app. Nothing else is stored here.`:"This deletes its channels, messages and files from this computer."}),!v&&t.jsx("p",{children:"Your agents stop answering there. If it’s still around, you can connect again."}),A&&t.jsx("p",{children:A})]})})]}),a.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t remove it. Check that DorkOS is running, then try again."}),t.jsxs(dt,{children:[t.jsx(ut,{disabled:a.isPending,children:"Cancel"}),t.jsx(S,{variant:"destructive",disabled:a.isPending,onClick:N,children:a.isPending?"Removing…":v?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function mn({connection:e,dateFormat:s}){var l,d;const n=vs(e);if(!n)return null;const[a,...i]=js(n,(d=(l=e.access)==null?void 0:l.lastKnown)==null?void 0:d.lifecycle,s);return t.jsxs("section",{"aria-label":"Request to take over this space",className:"border-status-warning-border bg-status-warning-bg text-status-warning-fg flex flex-wrap items-start gap-x-3 gap-y-2 border-b px-4 py-3 text-sm",children:[t.jsx(ls,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1 basis-60 space-y-1",children:[t.jsx("p",{className:"text-foreground font-medium",children:a}),i.map(c=>t.jsx("p",{children:c},c))]}),t.jsxs(S,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>ds(Ns(e)),children:["Open space",t.jsx(cs,{className:"size-3.5","aria-hidden":!0})]})]})}const fn={reactions:!1,threads:!1,runWith:!1,attachments:!1,mentions:!1,streamHealth:!1,presence:!1,turnStatus:!1,asks:!1};function pn({dm:e,localAgentId:s,access:n}){var r,o,h,u;const a=us(e.community,e.roomId,s,n),i=f.useRef(null),l=f.useRef(!0),d=(o=(r=a.data)==null?void 0:r.entries.at(-1))==null?void 0:o.id;f.useLayoutEffect(()=>{const y=i.current;y&&l.current&&(y.scrollTop=y.scrollHeight)},[d]);const c={kind:"room",id:JSON.stringify([e.community,e.roomId,"read-only"]),placeholder:"",canSend:!1,canSendReason:"This direct message is read-only.",attachments:null,send:()=>Promise.reject(new Error("This direct message is read-only."))};return t.jsx(Ne.Root,{surface:"room",capabilities:fn,target:c,children:t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("section",{className:"border-b px-4 py-2 text-sm","aria-label":"About this direct message",children:[t.jsxs("p",{children:[t.jsx("span",{className:"font-medium",children:`${e.member.displayName} with ${e.agent.displayName}`}),t.jsx("span",{className:"text-muted-foreground",children:" · Read-only"})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:`Only ${e.member.displayName} and ${e.agent.displayName} can post here.`})]}),t.jsxs("section",{ref:i,onScroll:y=>{const N=y.currentTarget;l.current=N.scrollHeight-N.scrollTop-N.clientHeight<40},className:"min-h-0 flex-1 overflow-auto py-2","aria-label":"Messages",children:[a.isError&&t.jsxs("p",{role:"alert",className:"px-4 text-sm",children:["Couldn’t load this direct message."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void a.refetch(),children:"Retry"})]}),((h=a.data)==null?void 0:h.entries.length)===0&&t.jsx("p",{className:"text-muted-foreground px-4 text-sm",children:"No messages yet."}),(u=a.data)==null?void 0:u.entries.map(y=>t.jsx(wt,{entry:y},y.id))]})]})})}function hn({community:e,roomId:s,children:n}){var d;const a=(d=ge().data)==null?void 0:d.find(c=>c.ref===e),i=_e(a==null?void 0:a.access),{dm:l}=ht(e,s,i.verified&&i.capabilities.read,i.fingerprint);return l?l.readOnly&&l.localAgentId?t.jsx(pn,{dm:l,localAgentId:l.localAgentId,access:i.fingerprint}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsx(xn,{dm:l,accessFingerprint:i.fingerprint}),t.jsx("div",{className:"min-h-0 flex-1",children:n(l.agent.displayName)})]}):n()}function xn({dm:e,accessFingerprint:s}){var l;const a=(l=pt(e.community,e.roomId,!0,s).data)==null?void 0:l.members.find(d=>d.memberId===e.agent.memberId),i=e.agent.ownerDisplayName;return t.jsxs("section",{className:"border-b px-4 py-2 text-sm","aria-label":"About this direct message",children:[t.jsxs("p",{children:[t.jsx("span",{className:"font-medium",children:e.agent.displayName}),t.jsx("span",{className:"text-muted-foreground",children:` · ${i}’s agent · ${i} can read this`})]}),(a==null?void 0:a.availability)==="offline"&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:`Offline. ${e.agent.displayName} won’t answer until its computer is back on.`})]})}function gn(){const{id:e,community:s}=gt({from:"/_shell/channels"}),n=ms(s);return s&&!n.visible?n.isLoading?null:t.jsx(fs,{...xe.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(cn,{community:s,roomId:e}):e===void 0&&t.jsx(xt,{children:"Channels"}),t.jsx(yn,{})]})}function yn(){const{id:e,thread:s,entry:n,community:a}=gt({from:"/_shell/channels"}),i=Re(),l=Ts(a?void 0:e,s,n),d=Ds(a?void 0:e),c=ps();return a&&e?t.jsx(Ve,{community:a,children:t.jsx(hn,{community:a,roomId:e,children:r=>t.jsx(ln,{community:a,roomId:e,threadId:s,dmAgentName:r,onThread:o=>{i({...xe.channels(),search:{community:a,id:e,thread:o}})}})},JSON.stringify([a,e]))}):a?t.jsx(Ve,{community:a,children:t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(Qe,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"No channel selected"}),t.jsx("p",{className:"max-w-sm",children:"Choose a channel from this space."})]})}):l==="pending"||d==="pending"?t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(xs,{})}):l==="redirecting"||d==="redirecting"?null:e===void 0?t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(Qe,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Pick a channel or DM"}),t.jsx("p",{className:"max-w-sm",children:c?"Open one from All, at the bottom of the screen.":"Open one from the sidebar, or use + next to Channels."})]}):t.jsx(gs,{roomId:e,threadId:s,entrySeq:n,threadRoute:"/channels"})}function Ve({community:e,children:s}){var i;const n=Re(),a=(i=ge().data)==null?void 0:i.find(l=>l.ref===e);return a&&St(a)?t.jsx(un,{connection:a,onRemoved:()=>void n({...xe.channels(),search:{}})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[a&&t.jsx(mn,{connection:a}),a&&t.jsx(Rs,{connection:a}),t.jsx("div",{className:"min-h-0 flex-1",children:s})]})}const
|
|
10
|
+
`)),children:r?"Copied":o?"Couldn’t copy":c.length===1?"Copy your draft":"Copy your drafts"}),t.jsx(S,{variant:v?"outline":"destructive",onClick:()=>l(!0),children:v?"Remove from DorkOS":"Remove local copy"})]}),t.jsx(rt,{open:i,onOpenChange:_=>{_||a.reset(),l(_)},children:t.jsxs(it,{children:[t.jsxs(ot,{children:[t.jsx(lt,{children:v?`Remove ${u} from DorkOS?`:`Remove your copy of ${u}?`}),t.jsx(ct,{asChild:!0,children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("p",{children:v?`${u} leaves this app. Nothing else is stored here.`:"This deletes its channels, messages and files from this computer."}),!v&&t.jsx("p",{children:"Your agents stop answering there. If it’s still around, you can connect again."}),A&&t.jsx("p",{children:A})]})})]}),a.isError&&t.jsx("p",{role:"alert",className:"text-destructive text-sm",children:"Couldn’t remove it. Check that DorkOS is running, then try again."}),t.jsxs(dt,{children:[t.jsx(ut,{disabled:a.isPending,children:"Cancel"}),t.jsx(S,{variant:"destructive",disabled:a.isPending,onClick:N,children:a.isPending?"Removing…":v?"Remove from DorkOS":"Remove local copy"})]})]})})]})}function mn({connection:e,dateFormat:s}){var l,d;const n=vs(e);if(!n)return null;const[a,...i]=js(n,(d=(l=e.access)==null?void 0:l.lastKnown)==null?void 0:d.lifecycle,s);return t.jsxs("section",{"aria-label":"Request to take over this space",className:"border-status-warning-border bg-status-warning-bg text-status-warning-fg flex flex-wrap items-start gap-x-3 gap-y-2 border-b px-4 py-3 text-sm",children:[t.jsx(ls,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),t.jsxs("div",{className:"min-w-0 flex-1 basis-60 space-y-1",children:[t.jsx("p",{className:"text-foreground font-medium",children:a}),i.map(c=>t.jsx("p",{children:c},c))]}),t.jsxs(S,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>ds(Ns(e)),children:["Open space",t.jsx(cs,{className:"size-3.5","aria-hidden":!0})]})]})}const fn={reactions:!1,threads:!1,runWith:!1,attachments:!1,mentions:!1,streamHealth:!1,presence:!1,turnStatus:!1,asks:!1};function pn({dm:e,localAgentId:s,access:n}){var r,o,h,u;const a=us(e.community,e.roomId,s,n),i=f.useRef(null),l=f.useRef(!0),d=(o=(r=a.data)==null?void 0:r.entries.at(-1))==null?void 0:o.id;f.useLayoutEffect(()=>{const y=i.current;y&&l.current&&(y.scrollTop=y.scrollHeight)},[d]);const c={kind:"room",id:JSON.stringify([e.community,e.roomId,"read-only"]),placeholder:"",canSend:!1,canSendReason:"This direct message is read-only.",attachments:null,send:()=>Promise.reject(new Error("This direct message is read-only."))};return t.jsx(Ne.Root,{surface:"room",capabilities:fn,target:c,children:t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsxs("section",{className:"border-b px-4 py-2 text-sm","aria-label":"About this direct message",children:[t.jsxs("p",{children:[t.jsx("span",{className:"font-medium",children:`${e.member.displayName} with ${e.agent.displayName}`}),t.jsx("span",{className:"text-muted-foreground",children:" · Read-only"})]}),t.jsx("p",{className:"text-muted-foreground text-xs",children:`Only ${e.member.displayName} and ${e.agent.displayName} can post here.`})]}),t.jsxs("section",{ref:i,onScroll:y=>{const N=y.currentTarget;l.current=N.scrollHeight-N.scrollTop-N.clientHeight<40},className:"min-h-0 flex-1 overflow-auto py-2","aria-label":"Messages",children:[a.isError&&t.jsxs("p",{role:"alert",className:"px-4 text-sm",children:["Couldn’t load this direct message."," ",t.jsx(S,{variant:"ghost",size:"sm",onClick:()=>void a.refetch(),children:"Retry"})]}),((h=a.data)==null?void 0:h.entries.length)===0&&t.jsx("p",{className:"text-muted-foreground px-4 text-sm",children:"No messages yet."}),(u=a.data)==null?void 0:u.entries.map(y=>t.jsx(wt,{entry:y},y.id))]})]})})}function hn({community:e,roomId:s,children:n}){var d;const a=(d=ge().data)==null?void 0:d.find(c=>c.ref===e),i=_e(a==null?void 0:a.access),{dm:l}=ht(e,s,i.verified&&i.capabilities.read,i.fingerprint);return l?l.readOnly&&l.localAgentId?t.jsx(pn,{dm:l,localAgentId:l.localAgentId,access:i.fingerprint}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.jsx(xn,{dm:l,accessFingerprint:i.fingerprint}),t.jsx("div",{className:"min-h-0 flex-1",children:n(l.agent.displayName)})]}):n()}function xn({dm:e,accessFingerprint:s}){var l;const a=(l=pt(e.community,e.roomId,!0,s).data)==null?void 0:l.members.find(d=>d.memberId===e.agent.memberId),i=e.agent.ownerDisplayName;return t.jsxs("section",{className:"border-b px-4 py-2 text-sm","aria-label":"About this direct message",children:[t.jsxs("p",{children:[t.jsx("span",{className:"font-medium",children:e.agent.displayName}),t.jsx("span",{className:"text-muted-foreground",children:` · ${i}’s agent · ${i} can read this`})]}),(a==null?void 0:a.availability)==="offline"&&t.jsx("p",{role:"status",className:"text-muted-foreground text-xs",children:`Offline. ${e.agent.displayName} won’t answer until its computer is back on.`})]})}function gn(){const{id:e,community:s}=gt({from:"/_shell/channels"}),n=ms(s);return s&&!n.visible?n.isLoading?null:t.jsx(fs,{...xe.channels(),search:{},replace:!0}):t.jsxs(t.Fragment,{children:[s?t.jsx(cn,{community:s,roomId:e}):e===void 0&&t.jsx(xt,{children:"Channels"}),t.jsx(yn,{})]})}function yn(){const{id:e,thread:s,entry:n,community:a}=gt({from:"/_shell/channels"}),i=Re(),l=Ts(a?void 0:e,s,n),d=Ds(a?void 0:e),c=ps();return a&&e?t.jsx(Ve,{community:a,children:t.jsx(hn,{community:a,roomId:e,children:r=>t.jsx(ln,{community:a,roomId:e,threadId:s,dmAgentName:r,onThread:o=>{i({...xe.channels(),search:{community:a,id:e,thread:o}})}})},JSON.stringify([a,e]))}):a?t.jsx(Ve,{community:a,children:t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(Qe,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"No channel selected"}),t.jsx("p",{className:"max-w-sm",children:"Choose a channel from this space."})]})}):l==="pending"||d==="pending"?t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(xs,{})}):l==="redirecting"||d==="redirecting"?null:e===void 0?t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx(Qe,{className:"text-muted-foreground/50 size-10","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Pick a channel or DM"}),t.jsx("p",{className:"max-w-sm",children:c?"Open one from All, at the bottom of the screen.":"Open one from the sidebar, or use + next to Channels."})]}):t.jsx(gs,{roomId:e,threadId:s,entrySeq:n,threadRoute:"/channels"})}function Ve({community:e,children:s}){var i;const n=Re(),a=(i=ge().data)==null?void 0:i.find(l=>l.ref===e);return a&&St(a)?t.jsx(un,{connection:a,onRemoved:()=>void n({...xe.channels(),search:{}})}):t.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[a&&t.jsx(mn,{connection:a}),a&&t.jsx(Rs,{connection:a}),t.jsx("div",{className:"min-h-0 flex-1",children:s})]})}const da=gn;export{da as component};
|