dorkos 0.110.0 → 0.111.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 +57 -17
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-C4kqKgU6.js → AboutPage-BKzqcz_A.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-DiSxgHLa.js → ActivityErrorState-BXOZg9ve.js} +1 -1
- package/dist/client/assets/{ActivityPage-BQneQ83b.js → ActivityPage-CFN2MEAV.js} +1 -1
- package/dist/client/assets/{ActivityRow-BEKcGUIZ.js → ActivityRow-CujXx04u.js} +1 -1
- package/dist/client/assets/{AdapterIcon-CyEZ9jER.js → AdapterIcon-BdM7K69W.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-DpnW23lt.js → AdapterSetupWizard-3Bt9HEWF.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-DosR0AYu.js → AgentRequestCard-CAaBGC0L.js} +1 -1
- package/dist/client/assets/{AppearancePage-DIeNtC-G.js → AppearancePage-BEe-Gssu.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-B0nSHLwZ.js → AttentionSignalRow-Cp0AJs73.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BXMeIZyY.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CN1iW2cB.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-D-7b_-SG.js → BlintzCanvas-B7qs2dxW.js} +1 -1
- package/dist/client/assets/{CanvasCsvContent-iBvH55TS.js → CanvasCsvContent-DiB5zXOC.js} +1 -1
- package/dist/client/assets/{CanvasFileContent-C4LA1NRl.js → CanvasFileContent-CDNfnWMW.js} +2 -2
- package/dist/client/assets/{CanvasModel3dContent-BqLPKItZ.js → CanvasModel3dContent-C7EINmuq.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-BfF4jWmG.js → CodeMirrorDiff-BJhflpbC.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-gShkyo4u.js → CodeMirrorEditor-SkdXRKSN.js} +1 -1
- package/dist/client/assets/{CommitmentList-Bz1qfyAm.js → CommitmentList-DsEn6iK1.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-BFnrzM5F.js → CommitmentsPage-W5h0GjRr.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-C5dmaUUD.js → ConnectionAccessLists-DVFqelmV.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-BX_hUzvu.js → ConnectionsPage-CZhSh2mO.js} +1 -1
- package/dist/client/assets/{ConventionPage-DHtiOJYZ.js → ConventionPage-DcDBP-vR.js} +1 -1
- package/dist/client/assets/{ExtensionPageRoute-DluAWT6h.js → ExtensionPageRoute-mKN8Jqyx.js} +1 -1
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-IBBeJf7u.js → FloatingTanStackRouterDevtools-CqogiFob-CGXG-x9g.js} +1 -1
- package/dist/client/assets/HandlePage-Bun58ePo.js +1 -0
- package/dist/client/assets/{HeartbeatPage-DcispKV9.js → HeartbeatPage-DFf7Udem.js} +1 -1
- package/dist/client/assets/{LexicalField-CvW19ipK.js → LexicalField-vJ284m2H.js} +1 -1
- package/dist/client/assets/{ManagesPage-Dru8_kTd.js → ManagesPage-mDuaA2JT.js} +1 -1
- package/dist/client/assets/{Marketplace-UEST-d72.js → Marketplace-BoiupH2Z.js} +1 -1
- package/dist/client/assets/{MarketplaceSourcesView-2XwWS0fF.js → MarketplaceSourcesView-krw9hUyu.js} +1 -1
- package/dist/client/assets/{McpAppFrame-DcPNmy1o.js → McpAppFrame-DmHduNgp.js} +1 -1
- package/dist/client/assets/{McpSigninBody-YXQtYFSW.js → McpSigninBody-DoY09n4J.js} +1 -1
- package/dist/client/assets/{Model3dViewer-D9HznL8w.js → Model3dViewer-BZEdR7-9.js} +1 -1
- package/dist/client/assets/NamePage-CXyClUPJ.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-DNd6s2qQ.js → NewDirectMessageMenu-BjqYwnXW.js} +1 -1
- package/dist/client/assets/{NotificationsPage-Dg7_d0Fo.js → NotificationsPage-CybW1eIb.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-Dw8ylRP7.js → OpenMeshSwitch-DrmjsCDY.js} +1 -1
- package/dist/client/assets/{OperatorIdentityForm-DtA4qIAR.js → OperatorIdentityForm-byU2FeSU.js} +1 -1
- package/dist/client/assets/{PermissionsPage-ZEO9Crz4.js → PermissionsPage-CP3kbqyJ.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-Cv26YoDX.js → PersonalityPopover-BLsjgaum.js} +1 -1
- package/dist/client/assets/PhotoPage-hn5b42qN.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-CLOum_3D.js → PreviewRefusedNotice-fTN8MJ1h.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-BMFNtxGR.js → PromptSuggestionChips-BZOaY5Tx.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-CR7Exvh7.js → ReportsToPopover-B6JvfRt3.js} +1 -1
- package/dist/client/assets/{RoomSurface-Bq7667r4.js → RoomSurface-BM0QO_av.js} +3 -3
- package/dist/client/assets/{RoomsPage-DGOvUZFv.js → RoomsPage-B-NOCLXC.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-CpS43xkI.js → RunsOnPopover-D1jQQatj.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-Bh0jopL-.js → RuntimeSetupDialog-ufwCvCJB.js} +1 -1
- package/dist/client/assets/{SessionsPage-Zfpi_q-8.js → SessionsPage-CBE1KHYg.js} +1 -1
- package/dist/client/assets/{SkillsPage-cjkbMED1.js → SkillsPage-CPTFjEUe.js} +1 -1
- package/dist/client/assets/{TasksPage-HQqmMSc-.js → TasksPage-BRUqs3v5.js} +1 -1
- package/dist/client/assets/{ToolsPage-Bo2_xjXO.js → ToolsPage-C25kL822.js} +1 -1
- package/dist/client/assets/{TopologyGraph-Is22VGxs.js → TopologyGraph-of6Cp5Kj.js} +1 -1
- package/dist/client/assets/{TourHost-DxBh58jt.js → TourHost-zwSilkjm.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-B70UThXm.js → UnlinkDialog-BgwHAqdW.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-l8cP9oJc.js → WidgetErrorCard-BQwrR6PJ.js} +6 -6
- package/dist/client/assets/{_shell-pedi36wq.js → _shell-bcx2y7VT.js} +1 -1
- package/dist/client/assets/{_shell._home-9g2nykRD.js → _shell._home-BkP0NafS.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-M0V2vwFy.js → _shell._home.activity-BO_2ciGK.js} +1 -1
- package/dist/client/assets/{_shell._home.index-8qVMuOhT.js → _shell._home.index-B-OFwU9u.js} +1 -1
- package/dist/client/assets/{_shell._home.tasks-fGzbxCP4.js → _shell._home.tasks-jAQczH7j.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-BSeaYQDz.js → _shell._home.workspaces-B34Uk1SP.js} +1 -1
- package/dist/client/assets/{_shell.channels-DwyPOJGL.js → _shell.channels-CGzsxvXD.js} +1 -1
- package/dist/client/assets/_shell.connections-BNbeBrxQ.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-BPwtAQNY.js → _shell.feedback-requests-B71l48KB.js} +1 -1
- package/dist/client/assets/_shell.marketplace-3YAsNaRk.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-cI3nNBXr.js +1 -0
- package/dist/client/assets/_shell.session-ybAc0bwn.js +66 -0
- package/dist/client/assets/{_shell.team-DKZ4y6kn.js → _shell.team-BE_60YS4.js} +3 -3
- package/dist/client/assets/_shell.x._extensionId-jiyP599c.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-jiyP599c.js +1 -0
- package/dist/client/assets/{agent-browser-CSBlgMiw.js → agent-browser-Cs8abkZs.js} +1 -1
- package/dist/client/assets/{banner-D26eekSD.js → banner-CU2Nh3Kv.js} +1 -1
- package/dist/client/assets/{card-CTGm0Blo.js → card-BTgwskmX.js} +1 -1
- package/dist/client/assets/{file-B6neiwXF.js → file-DlQX-hKl.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-B-iziRzy.js → file-exclamation-point-Dg2iCyPM.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-Dw4BJ_cR.js → find-latest-widget-fence-BGiexm6r.js} +1 -1
- package/dist/client/assets/{git-branch-D9jctpSd.js → git-branch-Dq_w3Iyx.js} +1 -1
- package/dist/client/assets/{heart-cgLUdSV5.js → heart-Bp14wOx6.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-CEOricmN.js → highlighted-body-KPVGNVTW-kD1HK_wk.js} +1 -1
- package/dist/client/assets/{index-DcqBUr0N.js → index--3UwFg2s.js} +1 -1
- package/dist/client/assets/{index-CVzwL_3n.js → index-5OyUurJr.js} +1 -1
- package/dist/client/assets/{index-CUu6WsiU.js → index-B0OZehWe.js} +1 -1
- package/dist/client/assets/{index-BWnfydnq.js → index-B2JJZXsq.js} +1 -1
- package/dist/client/assets/{index-ZNJbhnlq.js → index-B6_ikFYj.js} +1 -1
- package/dist/client/assets/{index-1flHw44u.js → index-B8R78Nnj.js} +2 -2
- package/dist/client/assets/{index-bHlg-Jp8.js → index-BA-nPsLw.js} +1 -1
- package/dist/client/assets/{index-jD4A_p4E.js → index-BAjUSKoJ.js} +1 -1
- package/dist/client/assets/{index-CiIZQZuK.js → index-BHsZlKfx.js} +1 -1
- package/dist/client/assets/{index-BO2LMWbR.js → index-BeBmUxo_.js} +1 -1
- package/dist/client/assets/index-BpDY3eoD.js +1 -0
- package/dist/client/assets/{index-CqHifKay.js → index-BxUoa3yn.js} +1 -1
- package/dist/client/assets/{index-CLuxURdA.js → index-BxrZwUJp.js} +1 -1
- package/dist/client/assets/{index-vkTtWH-G.js → index-C-DN0Vg_.js} +1 -1
- package/dist/client/assets/{index-ClIP6HHR.js → index-C99173Ze.js} +1 -1
- package/dist/client/assets/{index-DKjP63zN.js → index-CAhJGlSW.js} +1 -1
- package/dist/client/assets/{index-CeCuaX5y.js → index-CDWsIVX7.js} +1 -1
- package/dist/client/assets/{index-tf4Y0hYZ.js → index-CKCMjqcu.js} +1 -1
- package/dist/client/assets/{index-K2hqr6x6.js → index-C_uYJzKi.js} +3 -3
- package/dist/client/assets/{index-CupP-VJi.js → index-Cc280M3V.js} +1 -1
- package/dist/client/assets/{index-D4em25Xt.js → index-CcV9S7cO.js} +1 -1
- package/dist/client/assets/{index-Bkfi8Myj.js → index-DHUToGjI.js} +1 -1
- package/dist/client/assets/{index-LP8S5WuT.js → index-DKQDBIWq.js} +1 -1
- package/dist/client/assets/{index-BfgOj4sK.js → index-DKlxz3u7.js} +1 -1
- package/dist/client/assets/{index-CBQqdBKL.js → index-DNglWRBB.js} +1 -1
- package/dist/client/assets/{index-CbDB1su1.js → index-DO6a5Hey.js} +1 -1
- package/dist/client/assets/{index-DQDCxGNh.js → index-DS-thlE8.js} +1 -1
- package/dist/client/assets/{index-CsjcT6BA.js → index-DSPs6GF4.js} +1 -1
- package/dist/client/assets/{index-DMmU6ZLq.js → index-DW6zqLoM.js} +1 -1
- package/dist/client/assets/{index-_nhqr_iZ.js → index-Dm53S0up.js} +1 -1
- package/dist/client/assets/{index-DckajKF2.js → index-DnmtTIUB.js} +1 -1
- package/dist/client/assets/{index-BZKMWkth.js → index-Dr-0P6rd.js} +239 -234
- package/dist/client/assets/{index-CGLE5zMG.js → index-F7Lcwnfm.js} +1 -1
- package/dist/client/assets/{index-B38pxhxw.js → index-LszRbEbX.js} +1 -1
- package/dist/client/assets/{index-lKqCjbqn.js → index-PxSRtDpP.js} +1 -1
- package/dist/client/assets/{index-BkYvXnXR.js → index-aDNEGBTK.js} +1 -1
- package/dist/client/assets/{index-C3tcDwG6.js → index-gu2JYnOq.js} +1 -1
- package/dist/client/assets/{index-BfDqp5Sv.js → index-kHXlTLUx.js} +7 -7
- package/dist/client/assets/{index-CSQHKTvU.js → index-knGXyHhh.js} +1 -1
- package/dist/client/assets/{kickoff-D-oHin9P.js → kickoff-Btbza7bw.js} +1 -1
- package/dist/client/assets/{layers-BpMm7sp6.js → layers-B0oCOfxz.js} +1 -1
- package/dist/client/assets/{lightbulb-CxP8HLlU.js → lightbulb-D80IzMqz.js} +1 -1
- package/dist/client/assets/{markdown-content-plNIomQc.js → markdown-content-aNzh-54y.js} +1 -1
- package/dist/client/assets/{mention-pill-B9c_KFvY.js → mention-pill-BxMK0xuY.js} +1 -1
- package/dist/client/assets/{message-square-off-8wAP6cRG.js → message-square-off-D-CJXmTq.js} +1 -1
- package/dist/client/assets/{owner-notice-CopwUeso.js → owner-notice-BkrTEMDm.js} +1 -1
- package/dist/client/assets/{package-B7amjGSw.js → package-CoTlAnXZ.js} +1 -1
- package/dist/client/assets/{page-container-DMx2f-Ca.js → page-container-CPxW5T9E.js} +1 -1
- package/dist/client/assets/{paperclip-CA9pcNn6.js → paperclip-Cj1P85mz.js} +1 -1
- package/dist/client/assets/{radio-B4GY45ie.js → radio-DICkTr_p.js} +1 -1
- package/dist/client/assets/{room-files-source-91oNy8mM.js → room-files-source-BywWQPBN.js} +1 -1
- package/dist/client/assets/{rotate-ccw-clock-C-ftj_rU.js → rotate-ccw-clock-cx5RyP4l.js} +1 -1
- package/dist/client/assets/{rotate-cw-TrlUqVdq.js → rotate-cw-DrGRGSwy.js} +1 -1
- package/dist/client/assets/{scroll-area-DKse0rZa.js → scroll-area-XlDz8u4m.js} +1 -1
- package/dist/client/assets/{search-x-DvMuhABO.js → search-x-LIKnWE64.js} +1 -1
- package/dist/client/assets/{shield-x-ZcQ8NB0Z.js → shield-x-DioB6qH_.js} +1 -1
- package/dist/client/assets/{soul-file-B_MwZHvh.js → soul-file-C7YgkNET.js} +1 -1
- package/dist/client/assets/{table-BJDpTBxJ.js → table-P4N5xQn2.js} +1 -1
- package/dist/client/assets/{use-connector-management-BZ-sfu8O.js → use-connector-management-pgVHbXoO.js} +1 -1
- package/dist/client/assets/{use-delete-binding-XWrr4lIB.js → use-delete-binding-DxEiOjjh.js} +1 -1
- package/dist/client/assets/{use-dev-links-daERqZ4e.js → use-dev-links-BImQrE6g.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-DE5zmChu.js → use-external-adapter-catalog-D8KHMSZU.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-DkDB2i0G.js → use-full-activity-feed-2o7GNAMe.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-DBet5zg_.js +1 -0
- package/dist/client/assets/{use-jump-back-in-Dm-2B4la.js → use-jump-back-in-D9tBJ4v5.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-DXFAk9hJ.js → use-mesh-topology-DBeqzUoy.js} +1 -1
- package/dist/client/assets/use-pending-read-DmrlNHS0.js +1 -0
- package/dist/client/assets/{use-personality-commit-CgQm9Y7m.js → use-personality-commit-Gfoi__sT.js} +1 -1
- package/dist/client/assets/{use-promo-activation-CZMwcIvl.js → use-promo-activation-Bv1gnqKq.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-CKzRoyfz.js → use-pulse-freshness-SFRdnugS.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-TvE0bgPq.js → use-room-follow-claim-Cf20JiJ_.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-DlrB639e.js → use-roving-tab-list-3Pb7ps4E.js} +1 -1
- package/dist/client/assets/{use-session-canvas-8hTR83y8.js → use-session-canvas-BaXuEhw8.js} +4 -4
- package/dist/client/assets/{use-session-diagnostics-DAd4CfKM.js → use-session-diagnostics-7xxJ6zQQ.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-DKLFamqB.js → use-unclaimed-chats-D4k-EK_f.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/index.js +865 -216
- package/dist/server/index.js.map +2 -2
- package/package.json +3 -3
- package/dist/client/assets/HandlePage-CjinTYw3.js +0 -1
- package/dist/client/assets/NamePage-D5q8YN0G.js +0 -1
- package/dist/client/assets/PhotoPage-BYtfMHJD.js +0 -1
- package/dist/client/assets/_shell.connections-DQ8AztAx.js +0 -6
- package/dist/client/assets/_shell.marketplace-CiM3PSqV.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-C5u-WJmL.js +0 -1
- package/dist/client/assets/_shell.session-DYCz4inz.js +0 -66
- package/dist/client/assets/_shell.x._extensionId-C1fzIfH4.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-C1fzIfH4.js +0 -1
- package/dist/client/assets/index-AYHwV9IU.js +0 -1
- package/dist/client/assets/use-is-below-desktop-B-Dt4c9S.js +0 -1
- package/dist/client/assets/use-pending-read-CH_0XPYp.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{a4 as ee,r as a,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BxUoa3yn.js","assets/index-Dr-0P6rd.js","assets/index-ExcAk4pE.css","assets/room-files-source-BywWQPBN.js","assets/markdown-content-aNzh-54y.js","assets/file-exclamation-point-Dg2iCyPM.js","assets/composer-insert-BpyATrmR.js","assets/index-CcV9S7cO.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-DrGRGSwy.js","assets/file-DlQX-hKl.js","assets/git-branch-Dq_w3Iyx.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a4 as ee,r as a,m7 as Gt,j as i,g as Qt,hd as Vt,Z as V,ae as te,aj as Jt,eJ as K,af as ye,ks as Ke,aN as ne,m8 as oe,m9 as Yt,ma as Xt,aE as Zt,mb as re,mc as en,md as tn,ag as le,me as nn,mf as ke,mg as Ge,mh as sn,mi as on,mj as rn,lq as an,mk as ln,ml as cn,lu as dn,mm as un,dd as mn,fQ as fn,mn as pn,mo as hn,at as gn,bk as xn,mp as yn,mq as bn,dy as vn,i3 as Rn,mr as kn,hp as J,jl as Qe,ms as lt,bv as wn,jk as ue,jp as ct,mt as Sn,jq as dt,iB as Nn,bz as ut,jv as mt,B as Te,F as In,mu as jn,bV as _e,mv as Cn,x as fe,eU as An,iE as ft,mw as pt,aQ as Mn,e as ae,mx as be,gB as ht,jo as gt,n as En,w as Ie,jn as Tn,my as xt,fy as se,cQ as yt,fe as _n,mz as On,mA as Pn,mB as Dn,mC as $n,l as bt,a3 as Oe,j7 as Ln,iC as Fn,mD as Bn,mE as qn,mF as zn,b1 as Hn,bH as Un,mG as Wn,mH as Kn,mI as Gn,mJ as Qn,bl as je,dt as Vn,je as Jn,jj as Yn,jc as Xn,mK as Zn,mL as es,mM as ts,mN as ns,fB as ss,jf as os,mO as rs,mP as as,mQ as is,mR as ls,X as cs,mS as ds,mT as Ve,mU as us,dJ as ms,mV as fs,ho as ps,mW as hs,mX as gs,aC as Je}from"./index-Dr-0P6rd.js";import{R as xs,A as ys,u as bs,P as vs,a as Rs}from"./use-jump-back-in-D9tBJ4v5.js";import{m as Ce,a as Ye,f as Pe,b as De,d as vt,e as Rt,g as kt,E as ks,h as ws,i as Ss,M as Q,F as Ns,j as Is,k as js,D as Cs,U as As,C as X,u as Ms,l as Es,n as Ts}from"./index-kHXlTLUx.js";import{a as _s}from"./use-room-follow-claim-Cf20JiJ_.js";import"./WidgetErrorCard-BQwrR6PJ.js";import{M as Os}from"./markdown-content-aNzh-54y.js";import{W as Ps,a as Ds}from"./find-latest-widget-fence-BGiexm6r.js";import{f as $s}from"./format-duration-BCr6uzby.js";import{H as Ls,a as Fs,b as Bs}from"./RuntimeSetupDialog-ufwCvCJB.js";import{M as Xe}from"./mention-pill-BxMK0xuY.js";import{R as qs}from"./rotate-ccw-clock-cx5RyP4l.js";import{M as zs}from"./message-square-off-D-CJXmTq.js";import{f as Hs}from"./use-connector-management-pgVHbXoO.js";import{A as Us}from"./AgentRequestCard-CAaBGC0L.js";/**
|
|
3
3
|
* @license lucide-react v1.48.0 - ISC
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the ISC license.
|
|
@@ -40,5 +40,5 @@ import{a4 as ee,r as a,m6 as Gt,j as i,g as Qt,hd as Vt,Z as V,ae as te,aj as Jt
|
|
|
40
40
|
* This source code is licensed under the ISC license.
|
|
41
41
|
* See the LICENSE file in the root directory of this source tree.
|
|
42
42
|
*/const Mt={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};Mt.node;const Ys=ee(Mt),Xs=300;function ce({className:e,children:t}){return i.jsx("span",{className:V("bg-muted text-muted-foreground text-2xs inline-flex max-w-full items-center gap-1 truncate rounded-full px-2 py-0.5",e),children:t})}function Et({identity:e,children:t,onViewProfile:s,className:n}){const{kind:o,displayName:r,handle:l,color:c,emoji:h,imageUrl:p,origin:u,agent:d}=e,k=c??"hsl(var(--muted-foreground))",f=typeof u=="object"&&u!==null,g=o==="agent"&&(d==null?void 0:d.working)!=null?d.working:null,[y,x]=a.useState(!1),N=a.useRef(!1),m=a.useRef(null),b=Gt({onLongPress:()=>{N.current&&x(!0)}});return i.jsxs(Ls,{open:y,onOpenChange:x,openDelay:Xs,children:[i.jsx(Fs,{asChild:!0,ref:m,"data-gesture-priority":"",...b,onPointerDown:E=>{N.current=E.pointerType==="touch"||E.pointerType==="pen",b.onPointerDown(E)},children:t}),i.jsxs(Bs,{"data-slot":"identity-hover-card",align:"start",className:V("flex w-64 flex-col gap-0 overflow-hidden p-0",n),children:[i.jsxs("div",{className:"flex items-center gap-3 p-3",children:[i.jsx(Qt,{"aria-hidden":!0,color:k,emoji:h,imageUrl:p,fallback:Vt(r),kind:o,origin:u,status:g?"working":"idle",size:"md"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:r}),l&&i.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",l]})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[o==="agent"&&((d==null?void 0:d.runtime)||(d==null?void 0:d.model))&&i.jsx(ce,{children:[d.runtime,d.model].filter(Boolean).join(" · ")}),g&&i.jsxs(ce,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",$s(g.forMs)]}),o==="human"&&i.jsx(ce,{children:f?u.platform:"On this machine"}),o==="agent"&&(d==null?void 0:d.managedBy)&&i.jsxs(ce,{children:["Managed by"," ",d.managedBy.handle?`@${d.managedBy.handle}`:d.managedBy.displayName]})]}),s?i.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var E;(E=m.current)==null||E.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):i.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[i.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),i.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function Tt(e,t={}){const s=te();return Jt({queryKey:K.sessions(e??""),queryFn:()=>s.listRoomSessions(e),enabled:e!==null&&t.enabled===!0})}function Zs(e,t){const s=e??[];return s.some(n=>n.seq===t.seq)?s:s.length===0||s[s.length-1].seq<t.seq?[...s,t]:[...s,t].sort((n,o)=>n.seq-o.seq)}function eo(e,t){const s=e??[],n=s.findIndex(c=>c.id===t.id);if(n===-1)return s;const o=s[n];if(o.seq!==t.seq||o.roomId!==t.roomId||JSON.stringify(o.body)===JSON.stringify(t.body)&&JSON.stringify(o.mentions)===JSON.stringify(t.mentions)&&JSON.stringify(o.mentionSpans)===JSON.stringify(t.mentionSpans))return s;const l=[...s];return l[n]={...o,body:t.body,mentions:t.mentions,mentionSpans:t.mentionSpans},l}function to(e,t){if(t.kind!=="notice"||t.body.notice!=="turn_failed")return;const s=t.body.subjectAuthorId;s!==void 0&&re.getState().clearAuthor(e,s)}function no(e,t){const s=e.getQueryData(K.entries(t));return s&&s.length>0?s[s.length-1].seq:0}function so(e,t){var s;return((s=e.getQueryData(K.detail(t)))==null?void 0:s.viewerAuthorId)??null}const oo=2e3;function ro(){const e=a.useRef(null),t=a.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),s=a.useCallback(o=>{t(),ne.getState().endRoomCanvasCycle(o)},[t]),n=a.useCallback(o=>{t(),e.current=setTimeout(()=>{e.current=null,ne.getState().endRoomCanvasCycle(o)},oo)},[t]);return a.useEffect(()=>t,[t]),{arm:n,now:s}}function ao(e){const t=Math.min(oe.BACKOFF_CAP_MS,oe.BACKOFF_BASE_MS*2**e);return Math.random()*t}const io=50;function lo(e,t){return new Promise(s=>{if(t.aborted)return s();const n=()=>{clearTimeout(o),t.removeEventListener("abort",n),s()},o=setTimeout(n,e);t.addEventListener("abort",n,{once:!0})})}function co(e,t){const s=te(),n=ye(),[o,r]=a.useState(null),[l,c]=a.useState(null),[h,p]=a.useState(0),u=a.useRef(!1),d=ro(),k=a.useCallback(()=>p(y=>y+1),[]),f=a.useRef(null),g=a.useCallback(()=>{f.current===null&&(f.current=setTimeout(()=>{f.current=null,p(y=>y+1)},io))},[]);return a.useEffect(()=>{if(e===null)return;const y=()=>g();let x=null;const N=()=>{if(document.visibilityState!=="visible"){x=Date.now();return}const E=x===null?0:Date.now()-x;x=null,(u.current||E>=oe.VISIBILITY_GRACE_MS)&&g()};let m=Ke.getListConnectionState();const b=Ke.subscribeListConnectionState(E=>{const T=E==="connected"&&m==="reconnecting";m=E,T&&g()});return window.addEventListener("online",y),document.addEventListener("visibilitychange",N),()=>{window.removeEventListener("online",y),document.removeEventListener("visibilitychange",N),b(),f.current!==null&&(clearTimeout(f.current),f.current=null)}},[e,g]),a.useEffect(()=>(ne.getState().setRoomCanvasLiveRoom(e),()=>ne.getState().setRoomCanvasLiveRoom(null)),[e]),a.useEffect(()=>{if(e===null||!t)return;const y=new AbortController;let x=!0,N;return(async()=>{r(null),c(null),u.current=!1;let m=0,b=!1;const E=()=>{m=0,u.current=!1,b&&(b=!1,r(T=>T===e?null:T))};for(;x&&!y.signal.aborted;){const T=Date.now();u.current=!1,ne.getState().beginRoomCanvasCycle(e),d.arm(e);const D=setTimeout(E,oe.STABILITY_WINDOW_MS);let j;try{if(j=Yt(s,e,no(n,e),y.signal),N=j,!x||y.signal.aborted){j.retire();return}for await(const S of j.stream){if(!x||y.signal.aborted||(E(),!j.current()))return;if(S.type==="canvas_event"||S.type==="canvas_channel_snapshot"){if(j.publish(S),!j.current())return;continue}if(S.type==="signal"){Xt(S)?Zt.getState().observe(e,S):(re.getState().observe(e,S),ne.getState().applyRoomCanvasPresence(e,S));continue}if(S.type==="reaction"){n.setQueryData(K.entries(e),O=>Ce(O,S.entryId,S.reactions));continue}if(S.type==="revision"){if(S.entry.roomId!==e)continue;n.setQueryData(K.entries(e),O=>eo(O,S.entry));continue}if(S.type==="canvas"){ne.getState().applyRoomCanvasFrame(e,S,so(n,e)),S.change!==void 0?d.now(e):d.arm(e);continue}re.getState().clearAuthor(e,S.entry.authorId),to(e,S.entry),en.getState().settle(e,S.entry.id),n.setQueryData(K.entries(e),O=>Zs(O,S.entry))}}catch(S){if(y.signal.aborted)return;if(console.warn("[rooms] live stream dropped",{roomId:e,err:S}),tn(S)){re.getState().clearRoom(e),c(e),r(e),clearTimeout(D);return}}finally{try{j==null||j.retire()}finally{clearTimeout(D)}}if(y.signal.aborted)return;Date.now()-T>=oe.STABILITY_WINDOW_MS&&(m=0),m+=1,u.current=!0,m>=oe.DISCONNECTED_THRESHOLD&&!b&&(re.getState().clearRoom(e),r(e),b=!0),await lo(ao(m),y.signal)}})(),()=>{x=!1;try{N==null||N.retire()}finally{y.abort()}}},[e,t,s,n,h]),{stalled:o!==null&&o===e,unavailable:l!==null&&l===e,retry:k}}function uo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.haltRoomAgent(t,s),meta:{errorLabel:"Couldn’t stop this agent"}})}function mo(){const e=te();return le({mutationFn:({roomId:t,authorId:s})=>e.promoteHold(t,s),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function fo(){const e=te(),t=ye();return le({onMutate:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var u;const l=t.getQueryData(K.entries(s)),c=(u=l==null?void 0:l.find(d=>d.id===n))==null?void 0:u.reactions,{reactions:h,on:p}=Ye(c,o,r);return t.setQueryData(K.entries(s),d=>Ce(d,n,h)),{on:p}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var h,p;const l=t.getQueryData(K.entries(s)),c=((p=(h=l==null?void 0:l.find(u=>u.id===n))==null?void 0:h.reactions)==null?void 0:p.some(u=>u.emoji===o&&u.authorIds.includes(r)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:r,viewerAuthorId:l},c)=>{c!==void 0&&t.setQueryData(K.entries(n),h=>{var d;const p=(d=h==null?void 0:h.find(k=>k.id===o))==null?void 0:d.reactions,{reactions:u}=Ye(p,r,l,!c.on);return Ce(h,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(K.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function Z(e){return e.threadRootEntryId??e.parentEntryId}function _t(e){return Z(e)??e.id}function $e(e,t){return Math.max(t??0,e)}function po(e,t,s){let n=e[0],o=0;for(const r of e)r.seq>n.seq&&(n=r),t!==null&&r.seq>t&&(o+=1);return{count:$e(e.length,s),lastAt:n.createdAt,unread:o}}function ho(e){const t=te(),s=ye(),n=nn(e),o=ke(u=>{var d;return e===null?null:((d=u.paging[e])==null?void 0:d.cursor)??null}),r=le({mutationFn:async u=>{var x;const d=(x=ke.getState().paging[u])==null?void 0:x.cursor;if(d==null)return;const k=await t.listRoomEntries(u,{before:d,limit:Ge}),f=K.entries(u),g=s.getQueryData(f),y=sn(g,k);s.setQueryData(f,y),ke.getState().notePage(u,on(k)??d,rn(k,Ge)||y.length===((g==null?void 0:g.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:l,isPending:c}=r,h=a.useRef(!1),p=a.useCallback(async()=>{if(!(e===null||h.current)){h.current=!0;try{await l(e).catch(()=>{})}finally{h.current=!1}}},[e,l]);return{canLoadOlder:n,isLoadingOlder:c,cursor:o,loadOlder:p}}function go(e){return i.jsx(Ds,{code:e.code,isIncomplete:e.isIncomplete})}const xo=[{language:Ps,component:go}],yo={turn_failed:{Icon:gn,tone:"text-status-warning"},agent_busy:{Icon:hn},agent_gone:{Icon:Ys,tone:"text-status-warning"},agent_left:{Icon:Ze,tone:"text-status-warning"},room_archived:{Icon:pn},runtime_gone:{Icon:Qs,tone:"text-status-warning"},agent_paused:{Icon:fn},agent_declined:{Icon:zs},agent_unavailable:{Icon:mn},awaiting_approval:{Icon:Ws,tone:"text-status-warning"},halted:{Icon:un},budget_reached:{Icon:dn},cascade_stopped:{Icon:cn},addressing_changed:{Icon:Gs},bridge_blocked:{Icon:ln,tone:"text-status-warning"},bridge_undelivered:{Icon:an,tone:"text-status-warning"},bridge_rate_limited:{Icon:Js},bridge_second_agent_refused:{Icon:Ze},bridge_disconnected:{Icon:Ks},bridge_agent_swapped:{Icon:xs},bridge_history_note:{Icon:qs}},bo={Icon:xn},we=80;function vo(e){const t=e.trim();if(t.length<=we)return t;const s=t.slice(0,we),n=s.lastIndexOf(" ");return`${(n>we/2?s.slice(0,n):s).trimEnd()}…`}function Ro(e,t,s){const n=ko(e,s),o=r=>i.jsx("a",{href:t.href,onClick:t.onOpen,"data-testid":"room-notice-session-link",className:"focus-ring hover:text-foreground rounded py-2 font-medium underline underline-offset-2",children:r});return n===null?i.jsxs(i.Fragment,{children:[e," ",o("Open chat")]}):i.jsxs(i.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function ko(e,t){if(t!==void 0){const n=yn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=bn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function wo({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:r,tone:l}=(e.body.notice&&yo[e.body.notice])??bo;return i.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...t&&{role:"article","aria-label":vo(e.body.text)},...Pe(t),className:V("focus-visible:ring-ring flex items-start gap-2 px-[var(--msg-padding-x)] py-2 text-xs outline-none focus-visible:ring-2",l??"text-muted-foreground"),children:[i.jsx(r,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),i.jsx("span",{children:n?Ro(e.body.text,n,o):e.body.text})]})}const So=vn.moment;function No({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:r}){const l=De(e.createdAt);return i.jsx("div",{id:r,"data-slot":"moment-row","data-testid":"room-moment","data-moment":t.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...Pe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:i.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[i.jsx(Et,{identity:{kind:s.kind,displayName:s.displayName,handle:n==null?void 0:n.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:n==null?void 0:n.origin,agent:n==null?void 0:n.agent},children:i.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[i.jsx(vt,{author:s}),i.jsx("span",{className:"sr-only",children:s.displayName})]})}),i.jsx(So,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),i.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),l.length>0&&i.jsx("time",{dateTime:e.createdAt,title:Rt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:l})]})})}function Io({id:e,summary:t,open:s,onOpen:n}){const{capabilities:o}=kt(),{count:r,lastAt:l,unread:c}=t,h=De(l),[p,u]=a.useState({count:r,bumped:!1});p.count!==r&&u({count:r,bumped:!0});const d=p.count===r&&p.bumped;return o.threads?i.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":c>0?"":void 0,"aria-expanded":s,onClick:n,className:V("focus-ring ml-[calc(var(--msg-padding-x)_+_var(--msg-gutter-width)_+_var(--msg-gap))]","mb-1 w-fit rounded text-left text-xs transition-colors","px-2 py-2 md:px-1 md:py-0.5",c>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[i.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),i.jsx("span",{className:V(d&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:r},r),r===1?" reply":" replies",h.length>0&&i.jsxs(i.Fragment,{children:[" · last ",i.jsx("time",{dateTime:l,title:Rt(l),children:h})]}),c>0&&` · ${c} new`]}):null}function jo(e,t){const s=ue.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
|
|
43
|
-
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function Co({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const r=_t(t),l=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,h=s==null?void 0:s.displayName,{copy:p}=Rn({toastOnSettle:!0});return a.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Vs,run:()=>{J.getState().openThread(e,r,!0),Qe.getState().requestFocus(lt(e,r))}},copy:{id:"copy",label:"Copy text",icon:kn,run:()=>void p(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:wn,run:o}),c!==void 0&&(u.mention={id:"mention",label:h===void 0?"Mention author":`Mention ${h}`,icon:ys,run:()=>{jo(e,c),Qe.getState().requestFocus(e)}}),ks.map(d=>u[d]).filter(d=>d!==void 0)},[e,r,l,c,h,o,p])}function Ao(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function Le(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function pe(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Y(e,t,s){const n=t.get(e),o=ct({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Mo(e){const t=new Set;for(const r of e)Z(r)===null&&t.add(r.id);const s=[],n=new Map,o=new Set;for(const r of e){const l=Z(r);if(l===null){s.push(r);continue}if(!t.has(l)){s.push(r),o.add(r.id);continue}const c=n.get(l);c?c.push(r):n.set(l,[r])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Ot(e){return`thread-${e}`}function he(e){return`thread-row-${e}`}function Ae(e){return`thread-panel-entry-${e}`}function ge(e){return`room-entry-${e}`}function Fe(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=Z(s)??null,o={rowId:t,domId:ge(t)};if(n===null)return o;const r=e.find(c=>c.id===n);return r!==void 0&&(Z(r)??null)===null?{rowId:Ot(n),domId:he(n)}:o}function Eo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Fe(e,s.id)}const et=48;function Pt(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const r=o.body.text.replace(/\s+/gu," ").trim();return r.length===0?null:{entryId:n,excerpt:r.length>et?`${r.slice(0,et).trimEnd()}…`:r}}function To(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const r=Sn({runtime:o.runtime,model:o.model});s.set(dt(n.projectPath),{memberId:n.id,visual:Nn(o),runtime:r.label,...r.modelLabel!==null&&{model:r.modelLabel}})}return s}function _o(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Oo={info:new Map,faces:new Map},Be=a.createContext(Oo);function Dt({known:e,children:t}){return i.jsx(Be.Provider,{value:e,children:t})}function qe(){const e=ut(),t=a.useMemo(()=>{var l;return((l=e.data)==null?void 0:l.agents)??[]},[e.data]),s=a.useMemo(()=>t.map(l=>l.projectPath),[t]),n=mt(s),o=a.useMemo(()=>To(t,n.data??{}),[t,n.data]),r=a.useMemo(()=>_o(o),[o]);return a.useMemo(()=>({info:o,faces:r}),[o,r])}function Me(e){const t=a.useContext(Be);return e===void 0?void 0:t.info.get(e)}function Po(){return a.useContext(Be).faces}function Do({loading:e,onLoad:t}){return i.jsx("div",{className:"flex justify-center px-4 py-3",children:i.jsxs(Te,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&i.jsx(In,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}function $o({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:r,summaryId:l,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?r:l,...Pe(c)}}const me=120,Lo="code block";function Fo(e){if(e.length<=me&&!e.includes("```"))return null;const t=Bo(e);return t.length===0?null:t}function Bo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Lo} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=me)return t;const s=qo(t,me),n=s.lastIndexOf(" ");return`${(n>me/2?s.slice(0,n):s).trimEnd()}…`}function qo(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:r}of n.segment(e)){if(o.length+r.length>t)break;o+=r}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function zo({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:r=!0}){const l=fo(),c=o===!0||!r,h=a.useMemo(()=>t.reactions??[],[t.reactions]),p=a.useMemo(()=>h.filter(k=>ws(k,s)).map(k=>k.emoji),[h,s]),u=a.useCallback(k=>l.mutate({roomId:e,entryId:t.id,emoji:k,viewerAuthorId:s}),[l,e,t.id,s]),d=a.useMemo(()=>({quick:n,mine:p,onToggle:u,disabled:c}),[n,p,u,c]);return{reactions:h,toggle:u,quickRow:d}}function Ho({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var r,l;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(r=t.current)==null||r.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(l=e.current)==null||l.focusFirst())}}function Uo(e,t){var d,k;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&jn.includes(n),r=Tt(e,{enabled:o}),l=_e(),c=ye(),h=te(),p=o?((k=(d=r.data)==null?void 0:d.bindings.find(f=>f.authorId===s))==null?void 0:k.sessionId)??null:null,u=a.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(p===null||s===void 0)&&Cn({queryClient:c,transport:h},e,s).then(g=>{g.kind!=="none"&&l(fe({session:g.kind==="bound"?g.sessionId:p}))}))},[s,l,c,e,p,h]);return a.useMemo(()=>p===null?null:{href:An({session:p}),onOpen:u},[u,p])}const xe="mention",ze="author_id",Wo={[xe]:[ze]},Ko=[xe];function Go(e,t){if(!t||t.length===0)return e;const s=Qo(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:r,length:l,authorId:c}=s[o],h=n.slice(0,r),p=n.slice(r,r+l),u=n.slice(r+l);n=`${h}<${xe} ${ze}="${c}">${p}</${xe}>${u}`}return n}function Qo(e,t){const s=[...t].sort((r,l)=>r.offset-l.offset),n=[];let o=0;for(const r of s)r.offset<o||r.offset+r.length>e.length||(n.push(r),o=r.offset+r.length);return n}const Vo=new Map,$t=a.createContext(Vo);function Jo({authors:e,children:t}){return i.jsx($t.Provider,{value:e,children:t})}function Yo(e){const t=a.useContext($t);return e===void 0?void 0:t.get(e)}function Xo(e){return typeof e=="string"?e.replace(/^@/,""):""}function Zo({authorId:e,children:t}){const s=Yo(e),n=Me(s==null?void 0:s.agentRef),{open:o}=ft();if(!s)return i.jsx(Xe,{kind:"human",label:Xo(t),resolved:!1});const r=ct({record:s,override:n==null?void 0:n.visual}),l=pt(s,n==null?void 0:n.memberId),c=l===void 0?void 0:()=>o(l),h=c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),c())}}:{};return i.jsx(Et,{onViewProfile:c,identity:{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:r.color,emoji:r.emoji,imageUrl:r.imageUrl,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}},children:i.jsx(Xe,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...h})})}function er(e){return{mention:t=>{const s=t[ze],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?i.jsx(i.Fragment,{children:t.children}):i.jsx(Zo,{authorId:n,children:t.children})}}}function tr({entry:e,authors:t}){const s=a.useMemo(()=>Go(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=a.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(l=>l.authorId))??[])},[e.mentionSpans]),o=a.useMemo(()=>er(n),[n]);return i.jsx(Jo,{authors:t,children:i.jsx(Os,{content:s,className:"msg-prose",allowedTags:Wo,literalTagContent:Ko,components:o,renderers:xo})})}function nr(e){return function(s){return i.jsx(tr,{entry:s,authors:e})}}const Lt="the top folder";function tt(e){return e.slice(e.lastIndexOf("/")+1)}function sr(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function or(e){return e===""?Lt:`${e}/`}function Se(e){return e.target!==void 0?e.target===""?Lt:e.target:or(sr(e.paths[0]??""))}function rr(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${tt(s)} to ${Se(e)}`:`${t} uploaded ${e.pathCount} files to ${Se(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${tt(s)} from the chat to ${Se(e)}`}}const ar=a.lazy(()=>Mn(()=>import("./index-CqHifKay.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(e=>({default:e.SaveToRoomFilesButton})));function Ft({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:r,authorNames:l,reactionFrequents:c,streamStalled:h,isMember:p=!0,grouping:u,orphanedReply:d,answers:k,feedPosition:f,rowId:g}){const y=De(t.createdAt),x=a.useMemo(()=>{const G=Fo(t.body.text),Re=Ss(t.attachments??[]);if(Re===null)return G;const We=G??t.body.text.trim();return We.length>0?`${We} ${Re}`:Re},[t.body.text,t.attachments]),N=a.useId(),m=`${N}-author`,b=`${N}-content`,E=`${N}-summary`,T=a.useRef(null),D=a.useRef(null),j=a.useRef(null),{reactions:S,toggle:O,quickRow:I}=zo({roomId:e,entry:t,viewerAuthorId:r,reactionFrequents:c,streamStalled:h,isMember:p}),L=Me(n==null?void 0:n.agentRef),{open:$}=ft(),_=n===void 0?void 0:pt(n,L==null?void 0:L.memberId),q=a.useCallback(()=>{_!==void 0&&$(_)},[$,_]),F=_===void 0?void 0:q,z=Co({roomId:e,entry:t,author:n,viewerAuthorId:r,onViewProfile:F}),W=Ho({barRef:D,pillsRef:j,hasReactions:S.length>0}),B=a.useCallback(()=>{var G;return(G=T.current)==null?void 0:G.focus()},[]),H=a.useMemo(()=>nr(o),[o]),w=a.useCallback(G=>i.jsx(a.Suspense,{fallback:null,children:i.jsx(ar,{roomId:e,attachment:G})}),[e]),v=Po(),P=t.body.subjectAuthorId??t.authorId,M=o.get(P),R=Me(M==null?void 0:M.agentRef),A=Uo(e,t),C=Ao(t);if(C.kind==="notice")return i.jsx(wo,{entry:t,feedPosition:f,rowId:g,sessionLink:A,subjectName:M==null?void 0:M.displayName});if(C.kind==="moment")return i.jsx(No,{entry:t,moment:C.moment,subject:P===t.authorId?s:Y(P,o,v),subjectIdentity:{handle:(M==null?void 0:M.handle)??void 0,origin:M==null?void 0:M.origin,agent:R&&{runtime:R.runtime,...R.model&&{model:R.model}}},feedPosition:f,rowId:g});const U=u.position==="first"||u.position==="only";return i.jsxs(Q.Root,{ref:T,id:g,position:u.position,actions:z,reactions:I,"data-testid":"room-entry",tabIndex:0,...$o({showAuthorHeader:U,headerId:m,displayName:s.displayName,time:y,summary:x,contentId:b,summaryId:E,feedPosition:f}),onKeyDown:W,children:[i.jsx(Q.Gutter,{author:s,at:t.createdAt,onViewProfile:F,isSelf:t.authorId===r}),i.jsxs(Q.Body,{children:[i.jsx(Q.Author,{id:m,author:s,at:t.createdAt,origin:n==null?void 0:n.origin}),d===!0&&i.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),k!=null&&i.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${k.excerpt}”`}),i.jsx(Q.Content,{id:b,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:t.body.fileChange?i.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:rr(t.body.fileChange,(M==null?void 0:M.displayName)??"Somebody")}):H(t,{rowId:t.id,isStreaming:!1})}),x!==null&&i.jsx("span",{id:E,className:"hidden",children:x}),i.jsx(Q.Attachments,{items:t.attachments??[],renderAction:p?w:void 0}),i.jsx(Q.Reactions,{ref:j,reactions:S,viewerAuthorId:r,names:l,frequents:c,onToggle:O,disabled:h===!0||!p,onExit:B}),i.jsx(Q.Actions,{actions:z,reactions:I,barRef:D,onExit:B})]})]})}const ir="room-load-older",lr=4;function Bt({roomName:e}){return i.jsx(Ns,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:lr},(t,s)=>i.jsxs("div",{className:"flex gap-3",children:[i.jsx(ae,{className:"size-7 shrink-0 rounded-full"}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${s}`))})}function cr({roomId:e,roomName:t,viewerAuthorId:s,entries:n,members:o,formerAuthors:r,lastReadSeq:l,reactionFrequents:c,streamStalled:h,isLoading:p,error:u,onAddAgents:d,openThreadId:k,onOpenThread:f,resumeRow:g,landOnRow:y,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:m=!1,onLoadOlder:b,ref:E}){const T=a.useMemo(()=>Le(o,r),[o,r]),D=be(o,s),j=qe(),S=a.useMemo(()=>new Map([...T].map(([v,P])=>[v,P.displayName])),[T]),O=ht(),I=gt(e,null),{topLevel:L,repliesByRoot:$,orphaned:_}=a.useMemo(()=>Mo(n),[n]),q=a.useMemo(()=>new Map(n.map(v=>[v.id,v])),[n]),F=a.useMemo(()=>{const v=Is(L,l),P=js(L.map(R=>({id:R.id,authorId:R.body.moment?`moment:${R.id}`:R.authorId,timestamp:R.createdAt})),{now:O,lastSeenId:v.lastSeenId,unreadFromStart:v.fromStart}),M=[];N&&!p&&M.push({kind:"load-older",id:ir});for(const R of P){if(R.kind==="day-divider"){M.push({kind:"day-divider",id:R.key,label:R.label});continue}if(R.kind==="unread-divider"){M.push({kind:"unread-divider",id:R.key});continue}const A=L[R.index];M.push({kind:"message",id:A.id,entry:A,grouping:R.grouping,position:R.index+1,answers:Pt(A,L[R.index-1],q.get.bind(q))});const C=$.get(A.id);C&&M.push({kind:"thread-reply",id:Ot(A.id),rootId:A.id,replies:C,totalReplies:A.threadReplyCount})}return M},[L,$,q,l,O,N,p]),z=a.useMemo(()=>F.map(v=>v.kind==="load-older"?{kind:"notice",id:v.id,at:"",body:null}:v.kind==="day-divider"?{kind:"day-divider",id:v.id,label:v.label}:v.kind==="unread-divider"?{kind:"unread-divider",id:v.id}:v.kind==="thread-reply"?{kind:"thread-reply",id:v.id,rootId:v.rootId,replyCount:$e(v.replies.length,v.totalReplies),lastAt:v.replies[v.replies.length-1].createdAt}:{kind:"message",id:v.id,payload:v.entry,grouping:v.grouping,author:Y(pe(v.entry,T),T,j.faces),at:v.entry.createdAt}),[F,T,j.faces]),W=a.useCallback((v,P)=>{const M=F[P.index];if(M.kind==="load-older")return b===void 0?null:i.jsx(Do,{loading:m,onLoad:b});if(M.kind==="day-divider")return i.jsx(Cs,{label:M.label});if(M.kind==="unread-divider")return i.jsx(As,{});if(M.kind==="thread-reply"){if(P.onOpenThread===void 0)return null;const A=P.onOpenThread;return i.jsx(Io,{id:he(M.rootId),summary:po(M.replies,l,M.totalReplies),open:k===M.rootId,onOpen:()=>A(M.rootId)})}const R=pe(M.entry,T);return i.jsx(Ft,{roomId:e,entry:M.entry,author:Y(R,T,j.faces),authorRef:T.get(R),authors:T,viewerAuthorId:s,authorNames:S,reactionFrequents:c,streamStalled:h,isMember:D,grouping:M.grouping,orphanedReply:_.has(M.entry.id),answers:M.answers,feedPosition:{index:M.position,total:-1},rowId:ge(M.entry.id)})},[F,e,T,j.faces,s,S,c,h,D,_,l,k,m,b]),B=a.useCallback(v=>{if(v.kind==="message")return ge(v.id);if(v.kind==="thread-reply")return he(v.rootId)},[]);if(u)return i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),i.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const H=o.some(v=>v.author.kind==="agent"),w=i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx(En,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),i.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),i.jsx("p",{className:"max-w-sm",children:H?"Say something to get it going.":"Nothing answers until you add an agent."}),i.jsx(Te,{type:"button",size:"sm",variant:H?"ghost":"default",onClick:d,className:"mt-1",children:H?"Add more agents":"Add agents"})]});return i.jsx(Dt,{known:j,children:i.jsx(X.Timeline,{ref:E,conversationId:e,label:`Messages in ${t}`,rows:z,renderRow:W,onOpenThread:f,domIdOf:B,...g===void 0?{}:{resumeRow:g},...y===void 0?{}:{landOnRow:y},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:p?i.jsx(Bt,{roomName:t}):void 0,empty:w,feedTestId:"room-timeline"})})}const He={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function dr(e){const t=te(),[s,n]=a.useState([]),o=a.useRef(new Map),r=a.useCallback(f=>{const g=f.map(y=>({id:crypto.randomUUID(),file:y,status:"pending",progress:0}));n(y=>[...y,...g])},[]),l=a.useCallback(f=>{o.current.delete(f),n(g=>g.filter(y=>y.id!==f))},[]),c=a.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const g=new Set(f);for(const y of g)o.current.delete(y);n(y=>y.filter(x=>!g.has(x.id)))},[]),h=a.useCallback(f=>{o.current.delete(f),n(g=>g.map(y=>y.id===f&&y.status==="error"?{...y,status:"pending",progress:0,error:void 0}:y))},[]),p=a.useRef(null),u=le({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(N=>N.map(m=>f.some(b=>b.id===m.id)?{...m,status:"uploading"}:m));const g=N=>{n(m=>m.map(b=>b.status==="uploading"?{...b,progress:N.percentage}:b))},y=new AbortController;p.current=y;const x=f.map(N=>N.file);return t.uploadRoomAttachments(e,x,g,y.signal)},onSettled:()=>{p.current=null},onSuccess:(f,g)=>{g.forEach((y,x)=>{const N=f[x];N&&o.current.set(y.id,N.id)}),n(y=>y.map(x=>g.findIndex(m=>m.id===x.id)===-1?x:{...x,status:"uploaded",progress:100}))},onError:f=>{n(g=>g.map(y=>y.status==="uploading"?{...y,status:"error",error:f.message}:y))}}),d=a.useCallback(()=>{var f;(f=p.current)==null||f.abort()},[]),k=a.useCallback(async()=>{const f=s.filter(y=>y.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const g=s.filter(y=>y.status==="pending");return g.length>0&&await u.mutateAsync(g),s.map(y=>o.current.get(y.id)).filter(y=>y!==void 0)},[s,u]);return{pendingFiles:s,addFiles:r,removeFile:l,retryFile:h,clearFiles:c,cancelUpload:d,uploadAndGetIds:k,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function qt(e){const{room:t,threadRootId:s}=e,n=Ms(),o=Es(),r=dr((t==null?void 0:t.id)??""),l=t!==void 0&&be(t.members,t.viewerAuthorId),c=a.useRef({attachments:r,post:n,reply:o,room:t,threadRootId:s});a.useEffect(()=>{c.current={attachments:r,post:n,reply:o,room:t,threadRootId:s}});const h=a.useCallback(m=>c.current.attachments.addFiles(m),[]),p=a.useCallback(m=>c.current.attachments.removeFile(m),[]),u=a.useCallback(m=>c.current.attachments.retryFile(m),[]),d=a.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:k,hasFailedUpload:f,isUploading:g}=r,y=a.useMemo(()=>({staged:k,add:h,remove:p,retry:u,cancel:d,hasFailed:f,isUploading:g,holdsSendWhileUploading:!1}),[k,f,g,h,p,u,d]),x=a.useCallback(async m=>{const{attachments:b,post:E,reply:T,room:D,threadRootId:j}=c.current;if(D===void 0)throw new Error("That room isn’t loaded yet.");if(D.archived)throw new Error("This room is archived.");Ie.getState().recordOpened("room",D.id);const S=Tn(),O=b.pendingFiles.map(_=>_.file.name),I=b.pendingFiles.map(_=>_.id),L=await b.uploadAndGetIds();b.clearFiles(I);const $=m.parentEntryId??j;if($!==void 0){T.mutate({roomId:D.id,rootEntryId:$,text:m.text,clientId:S,attachmentIds:L,attachmentNames:O});return}E.mutate({roomId:D.id,text:m.text,clientId:S,attachmentIds:L,attachmentNames:O})},[]);return{target:a.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&l,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:l?{}:{canSendReason:xt},send:x,attachments:y}),[t,s,l,y,x]),attachments:r}}function ur(e){const{roomId:t,entrySeq:s,entries:n,historyLoaded:o}=e,r=s===void 0?null:`${t}:${s}`,l=a.useMemo(()=>{if(s===void 0)return null;const g=n.find(m=>m.seq===s);if(g===void 0)return null;const y=Fe(n,g.id);if(y===null)return null;const x=Z(g)??null,N=x!==null&&y.rowId!==g.id;return{roomRowId:y.rowId,threadRootId:N?x:null,entryId:g.id}},[n,s]),c=a.useRef(null),h=(l==null?void 0:l.threadRootId)??null;a.useEffect(()=>{r===null||h===null||c.current!==r&&(c.current=r,J.getState().openThread(t,h))},[r,t,h]);const p=a.useRef(null);a.useEffect(()=>{r===null||!o||l===null&&p.current!==r&&(p.current=r,yt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=a.useRef(null),d=a.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),k=a.useRef(null),f=a.useCallback(()=>{if(!(r===null||k.current===r))return k.current=r,(l==null?void 0:l.threadRootId)===null||l==null?void 0:l.entryId},[r,l]);return{roomRow:s===void 0?void 0:d,threadRow:s===void 0?void 0:f}}function mr(e,t){const[s,n]=a.useState({roomId:null,seq:null});return s.roomId===e?s.seq:e===null?(n({roomId:null,seq:null}),null):t===null?null:(n({roomId:e,seq:t}),t)}const fr=600;function pr(e){return document.getElementById(he(e))??document.getElementById(ge(e))}function hr(){const e=a.useRef(null);return a.useEffect(()=>()=>{var s;return(s=e.current)==null?void 0:s.call(e)},[]),{arm:a.useCallback(s=>{var c;(c=e.current)==null||c.call(e);let n=0;const o=Date.now()+fr;let r=!1;const l=()=>{if(r)return;const h=document.activeElement;if(h===null||h===document.body||!h.isConnected){const u=pr(s);if(u!==null){u.focus();return}}Date.now()>=o||(n=requestAnimationFrame(l))};n=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(n)}},[])}}function gr({roomId:e,route:t,urlThreadId:s,openThreadId:n,entries:o,historyLoaded:r}){const l=_n(),c=a.useRef(null);a.useEffect(()=>{if(e!==null){if(c.current!==e&&(c.current=e,s!==void 0)){J.getState().openThread(e,s);return}if(r&&n!==void 0){const h=o.find(u=>u.id===n),p=h===void 0?void 0:_t(h);if(p!==void 0&&p!==n){const u=J.getState().open[e];J.getState().openThread(e,p,(u==null?void 0:u.focusComposer)??!1);return}}n!==s&&(l==null||l({to:t,search:h=>({...h,thread:n}),replace:!0}))}},[e,t,n,s,o,r,l])}const xr=6,zt="jump-back-in-listbox";function Ue(e){return`jump-back-in-item-${e}`}const yr='[role="combobox"]';function ie(e){return e instanceof Element&&e.matches(yr)}function br({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=_e(),o=On(),[r,l]=a.useState(!1),[c,h]=a.useState({stamp:"",index:0}),[p,u]=a.useState(!1),[d,k]=a.useState(!1);e.length>0&&!d&&k(!0);const f=a.useRef(!1);a.useEffect(()=>{f.current=!0},[]);const{data:g}=ut({enabled:s}),y=a.useMemo(()=>((g==null?void 0:g.agents)??[]).map(w=>w.projectPath),[g]),{data:x}=mt(y,{enabled:s}),N=a.useMemo(()=>x??{},[x]),m=a.useMemo(()=>Pn(y,N),[y,N]),b=a.useMemo(()=>new Map(y.map(w=>[dt(w),w])),[y]),E=a.useCallback(w=>Dn({room:w,agentsByPath:N,pathByAgentRef:b}),[N,b]),T=a.useMemo(()=>$n(o.muted),[o.muted]),{items:D}=bs({mutedRoomIds:T,enabled:s}),j=a.useMemo(()=>D.slice(0,xr),[D]),S=s&&r&&!p&&!d&&!t&&e.length===0&&j.length>0,O=`${S}:${j.length}`,I=c.stamp===O?c.index:0,L=a.useCallback(w=>{f.current&&ie(w.target)&&(u(!1),k(!1),l(!0))},[]),$=a.useCallback(w=>{ie(w.target)&&l(!0)},[]),_=a.useCallback(w=>{ie(w.target)&&l(!1)},[]),q=a.useCallback(w=>{j.length!==0&&h(v=>{const P=v.stamp===O?v.index:0;return{stamp:O,index:(P+w+j.length)%j.length}})},[j.length,O]),F=a.useCallback(()=>q(1),[q]),z=a.useCallback(()=>q(-1),[q]),W=a.useCallback(()=>{u(!0)},[]),B=a.useCallback(w=>{if(u(!0),w.kind==="session"){w.session.cwd&&Ie.getState().recordOpened("agent",w.session.cwd),n(fe({dir:w.session.cwd??void 0,session:w.session.id}));return}Ie.getState().recordOpened("room",w.room.id),n({...bt.channels(),search:{id:w.room.id}})},[n]),H=a.useCallback(()=>{const w=j[I];!S||!w||B(w)},[S,j,I,B]);return{isOpen:S,hasRows:j.length>0,rows:j,agents:N,displayNames:m,visualOf:E,selectedIndex:I,activeDescendantId:S&&j[I]!==void 0?Ue(I):void 0,listboxId:S?zt:void 0,handleFocus:L,handleBlur:_,handlePointerDown:$,moveDown:F,moveUp:z,selectHighlighted:H,selectRow:B,dismiss:W}}function Ht({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:r,isSelected:l,now:c,onSelect:h}){const p=a.useMemo(()=>Number.isNaN(Date.parse(o))?null:Hn(o),[o,c]);return i.jsxs("div",{id:Ue(r),role:"option","aria-selected":l,"data-selected":l,title:s,onClick:h,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[i.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),i.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[i.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),p!==null&&i.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:p})]}),n!==null&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function vr({item:e,agent:t,displayName:s,index:n,isSelected:o,now:r,onSelect:l}){const c=Ln(t,e.session.cwd??s);return i.jsx(Ht,{mark:i.jsx(Fn,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:r,onSelect:l})}function Rr({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:r}){return i.jsx(Ht,{mark:i.jsx(qn,{room:e.room,participants:e.room.participants,visuals:zn(t)}),label:i.jsx(Bn,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:r})}function kr({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:r}){const l=ht(6e4);return a.useEffect(()=>{var c,h;(h=(c=document.getElementById(Ue(t)))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"})},[t]),i.jsx(Oe.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:i.jsx("div",{id:zt,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,h)=>{var p;return c.kind==="session"?i.jsx(vr,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((p=c.session.cwd)==null?void 0:p.split("/").pop())||"Agent",index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`session-${c.id}`):i.jsx(Rr,{item:c,visual:o(c.room),index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`room-${c.id}`)})})})}const nt={people:"People",agents:"Agents"},wr=["people","agents"];function Sr(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Nr(e,t,s){const n=t.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:Ir(r,n)})).filter(r=>r.tier!==null).sort((r,l)=>r.tier-l.tier||r.position-l.position);return s.flatMap(r=>o.filter(l=>l.row.section===r).map(({row:l})=>l))}function Ir(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(r=>r!==void 0);let n=null;for(const r of s){const l=r===t?0:r.startsWith(t)?1:r.includes(t)?2:null;l!==null&&(n===null||l<n)&&(n=l)}return n}function de(e,t,s){var r;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let l=0;l<n;l++){if(!((r=e[o])!=null&&r.disabled))return o;o=(o+s+n)%n}return 0}function jr(e,t,s,n){const o=e.slice(0,t),r=e.slice(t+1+s.length),l=`@${n}`,c=r.startsWith(" ")?"":" ";return{value:o+l+c+r,cursorPos:o.length+l.length+1}}const Cr=/(^|\s)@([A-Za-z0-9_.-]*)$/,Ut="mention-palette-listbox";function Ee(e){return`mention-item-${e}`}function Ar({members:e,viewerAuthorId:t,text:s,sectionOrder:n=wr}){var $;const[o,r]=a.useState(!1),[l,c]=a.useState(""),[h,p]=a.useState(-1),u=Un(s),d=a.useRef(!1),k=a.useMemo(()=>Sr(e,t),[e,t]),f=a.useMemo(()=>o?Nr(k,l,n):[],[k,l,o,n]),[g,y]=a.useState(null),x=g!==null&&g.query===l&&g.open===o?g.index:de(f,0,1),N=f[x],m=f.length===0||N!==void 0&&!N.disabled?x:de(f,0,1),b=a.useCallback((_,q)=>{const F=_.slice(0,q).match(Cr);if(!F){r(!1);return}r(!0),c(F[2]),p((F.index??0)+F[1].length)},[]),E=a.useCallback(_=>{u.write(_),d.current=!1},[u]),T=a.useCallback(_=>{d.current||b(u.read(),_)},[b,u]),D=a.useCallback(()=>{y({query:l,open:o,index:de(f,m+1,1)})},[f,m,l,o]),j=a.useCallback(()=>{y({query:l,open:o,index:de(f,m-1,-1)})},[f,m,l,o]),S=a.useCallback(_=>_.disabled||_.handle===void 0?null:(d.current=!0,r(!1),jr(u.read(),h,l,_.handle)),[h,l,u]),O=a.useCallback(()=>{const _=f[m];return _?S(_):(r(!1),null)},[f,m,S]),I=a.useCallback(()=>{d.current=!0,r(!1)},[]),L=f.some(_=>!_.disabled);return{isOpen:o,hasSelectableRows:L,rows:f,selectedIndex:m,activeDescendantId:o&&(($=f[m])==null?void 0:$.disabled)===!1?Ee(m):void 0,listboxId:o?Ut:void 0,noteTextChange:E,handleCursorChange:T,moveDown:D,moveUp:j,selectHighlighted:O,selectRow:S,dismiss:I}}function Mr({rows:e,selectedIndex:t,onSelect:s}){const n=a.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const c=o[o.length-1];c&&c.section===r.section?c.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return a.useEffect(()=>{var o;(o=document.getElementById(Ee(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),i.jsx(Oe.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:i.jsx("div",{id:Ut,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?i.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:r},l)=>i.jsxs("div",{role:"group","aria-label":nt[o],children:[l>0&&i.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),i.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:nt[o]}),r.map(({row:c,index:h})=>{const p=h===t;return i.jsxs("div",{id:Ee(h),role:"option","aria-selected":p,"aria-disabled":c.disabled,"data-selected":p,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[i.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),i.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&i.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function Wt({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:r}){const l=t===void 0?e.id:lt(e.id,t),c=Wn(l),{target:h}=kt(),p=Kn(),u=Gn(l),d=a.useRef(null),k=be(e.members,e.viewerAuthorId),f=a.useRef(!1),g=Ar({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),y=n===!0,x=br({value:c,yieldToPalette:g.isOpen,enabled:y}),N=a.useRef(u);a.useEffect(()=>{var I;u!==N.current&&(N.current=u,(I=d.current)==null||I.focus())},[u]),a.useEffect(()=>{var I;s===!0&&((I=d.current)==null||I.focusUnlessTouch())},[]);const m=a.useCallback(I=>ue.getState().set(l,I),[l]),[b,E]=a.useState(null);a.useLayoutEffect(()=>{var I;b!==null&&((I=d.current)==null||I.focusAt(b.pos))},[b]);const T=a.useCallback(I=>{I&&(m(I.value),E({pos:I.cursorPos}))},[m]),D=a.useCallback(I=>T(g.selectRow(I)),[g,T]),j=a.useCallback(()=>T(g.selectHighlighted()),[g,T]),S=()=>{if(h===null||!h.canSend||f.current)return;g.dismiss();const I=ue.getState().take(l).trim();if(I==="")return;const L=r.pendingFiles.length>0;L&&(f.current=!0),h.send({text:I}).catch(()=>{const $=ue.getState(),_=$.drafts[l]??"";$.set(l,_===""?I:`${I}
|
|
43
|
+
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function Co({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const r=_t(t),l=t.body.text,c=(s==null?void 0:s.id)===n?void 0:(s==null?void 0:s.handle)??void 0,h=s==null?void 0:s.displayName,{copy:p}=Rn({toastOnSettle:!0});return a.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Vs,run:()=>{J.getState().openThread(e,r,!0),Qe.getState().requestFocus(lt(e,r))}},copy:{id:"copy",label:"Copy text",icon:kn,run:()=>void p(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:wn,run:o}),c!==void 0&&(u.mention={id:"mention",label:h===void 0?"Mention author":`Mention ${h}`,icon:ys,run:()=>{jo(e,c),Qe.getState().requestFocus(e)}}),ks.map(d=>u[d]).filter(d=>d!==void 0)},[e,r,l,c,h,o,p])}function Ao(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function Le(e,t=[]){return new Map([...t.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function pe(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function Y(e,t,s){const n=t.get(e),o=ct({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Mo(e){const t=new Set;for(const r of e)Z(r)===null&&t.add(r.id);const s=[],n=new Map,o=new Set;for(const r of e){const l=Z(r);if(l===null){s.push(r);continue}if(!t.has(l)){s.push(r),o.add(r.id);continue}const c=n.get(l);c?c.push(r):n.set(l,[r])}return{topLevel:s,repliesByRoot:n,orphaned:o}}function Ot(e){return`thread-${e}`}function he(e){return`thread-row-${e}`}function Ae(e){return`thread-panel-entry-${e}`}function ge(e){return`room-entry-${e}`}function Fe(e,t){const s=e.find(c=>c.id===t);if(s===void 0)return null;const n=Z(s)??null,o={rowId:t,domId:ge(t)};if(n===null)return o;const r=e.find(c=>c.id===n);return r!==void 0&&(Z(r)??null)===null?{rowId:Ot(n),domId:he(n)}:o}function Eo(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Fe(e,s.id)}const et=48;function Pt(e,t,s){const n=e.body.answersEntryId;if(n===void 0||n===e.id||t!==void 0&&t.id===n)return null;const o=s(n);if(o===void 0)return null;const r=o.body.text.replace(/\s+/gu," ").trim();return r.length===0?null:{entryId:n,excerpt:r.length>et?`${r.slice(0,et).trimEnd()}…`:r}}function To(e,t){const s=new Map;for(const n of e){const o=t[n.projectPath];if(!o)continue;const r=Sn({runtime:o.runtime,model:o.model});s.set(dt(n.projectPath),{memberId:n.id,visual:Nn(o),runtime:r.label,...r.modelLabel!==null&&{model:r.modelLabel}})}return s}function _o(e){const t=new Map;for(const[s,n]of e)t.set(s,n.visual);return t}const Oo={info:new Map,faces:new Map},Be=a.createContext(Oo);function Dt({known:e,children:t}){return i.jsx(Be.Provider,{value:e,children:t})}function qe(){const e=ut(),t=a.useMemo(()=>{var l;return((l=e.data)==null?void 0:l.agents)??[]},[e.data]),s=a.useMemo(()=>t.map(l=>l.projectPath),[t]),n=mt(s),o=a.useMemo(()=>To(t,n.data??{}),[t,n.data]),r=a.useMemo(()=>_o(o),[o]);return a.useMemo(()=>({info:o,faces:r}),[o,r])}function Me(e){const t=a.useContext(Be);return e===void 0?void 0:t.info.get(e)}function Po(){return a.useContext(Be).faces}function Do({loading:e,onLoad:t}){return i.jsx("div",{className:"flex justify-center px-4 py-3",children:i.jsxs(Te,{type:"button",variant:"ghost",size:"sm",onClick:t,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&i.jsx(In,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}function $o({showAuthorHeader:e,headerId:t,displayName:s,time:n,summary:o,contentId:r,summaryId:l,feedPosition:c}){return{...e?{"aria-labelledby":t}:{"aria-label":n.length>0?`${s}, ${n}`:s},"aria-describedby":o===null?r:l,...Pe(c)}}const me=120,Lo="code block";function Fo(e){if(e.length<=me&&!e.includes("```"))return null;const t=Bo(e);return t.length===0?null:t}function Bo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Lo} `).replace(/`([^`]*)`/g,"$1").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^\s{0,3}(?:#{1,6}\s+|>\s?|[-*+]\s+)/gm,"").replace(/^\s{0,3}\|?[\s:|-]*\|[\s:|-]*$/gm," ").replace(/\|/g," ").replace(/[*_~]{1,3}/g,"").replace(/\s+/g," ").trim();if(t.length<=me)return t;const s=qo(t,me),n=s.lastIndexOf(" ");return`${(n>me/2?s.slice(0,n):s).trimEnd()}…`}function qo(e,t){if(typeof Intl.Segmenter=="function"){const n=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:r}of n.segment(e)){if(o.length+r.length>t)break;o+=r}return o}let s="";for(const n of e){if(s.length+n.length>t)break;s+=n}return s}function zo({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:r=!0}){const l=fo(),c=o===!0||!r,h=a.useMemo(()=>t.reactions??[],[t.reactions]),p=a.useMemo(()=>h.filter(k=>ws(k,s)).map(k=>k.emoji),[h,s]),u=a.useCallback(k=>l.mutate({roomId:e,entryId:t.id,emoji:k,viewerAuthorId:s}),[l,e,t.id,s]),d=a.useMemo(()=>({quick:n,mine:p,onToggle:u,disabled:c}),[n,p,u,c]);return{reactions:h,toggle:u,quickRow:d}}function Ho({barRef:e,pillsRef:t,hasReactions:s}){return n=>{var r,l;if(n.target!==n.currentTarget)return;const{key:o}=n;if(o==="ArrowDown"&&s){n.preventDefault(),(r=t.current)==null||r.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(n.preventDefault(),(l=e.current)==null||l.focusFirst())}}function Uo(e,t){var d,k;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&jn.includes(n),r=Tt(e,{enabled:o}),l=_e(),c=ye(),h=te(),p=o?((k=(d=r.data)==null?void 0:d.bindings.find(f=>f.authorId===s))==null?void 0:k.sessionId)??null:null,u=a.useCallback(f=>{f.button!==0||f.metaKey||f.ctrlKey||f.shiftKey||f.altKey||(f.preventDefault(),!(p===null||s===void 0)&&Cn({queryClient:c,transport:h},e,s).then(g=>{g.kind!=="none"&&l(fe({session:g.kind==="bound"?g.sessionId:p}))}))},[s,l,c,e,p,h]);return a.useMemo(()=>p===null?null:{href:An({session:p}),onOpen:u},[u,p])}const xe="mention",ze="author_id",Wo={[xe]:[ze]},Ko=[xe];function Go(e,t){if(!t||t.length===0)return e;const s=Qo(e,t);if(s.length===0)return e;let n=e;for(let o=s.length-1;o>=0;o--){const{offset:r,length:l,authorId:c}=s[o],h=n.slice(0,r),p=n.slice(r,r+l),u=n.slice(r+l);n=`${h}<${xe} ${ze}="${c}">${p}</${xe}>${u}`}return n}function Qo(e,t){const s=[...t].sort((r,l)=>r.offset-l.offset),n=[];let o=0;for(const r of s)r.offset<o||r.offset+r.length>e.length||(n.push(r),o=r.offset+r.length);return n}const Vo=new Map,$t=a.createContext(Vo);function Jo({authors:e,children:t}){return i.jsx($t.Provider,{value:e,children:t})}function Yo(e){const t=a.useContext($t);return e===void 0?void 0:t.get(e)}function Xo(e){return typeof e=="string"?e.replace(/^@/,""):""}function Zo({authorId:e,children:t}){const s=Yo(e),n=Me(s==null?void 0:s.agentRef),{open:o}=ft();if(!s)return i.jsx(Xe,{kind:"human",label:Xo(t),resolved:!1});const r=ct({record:s,override:n==null?void 0:n.visual}),l=pt(s,n==null?void 0:n.memberId),c=l===void 0?void 0:()=>o(l),h=c?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:c,onKeyDown:p=>{p.key!=="Enter"&&p.key!==" "||(p.preventDefault(),c())}}:{};return i.jsx(Et,{onViewProfile:c,identity:{kind:s.kind,displayName:s.displayName,handle:s.handle??void 0,color:r.color,emoji:r.emoji,imageUrl:r.imageUrl,origin:s.origin,agent:n&&{runtime:n.runtime,...n.model&&{model:n.model}}},children:i.jsx(Xe,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:c!==void 0,...h})})}function er(e){return{mention:t=>{const s=t[ze],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?i.jsx(i.Fragment,{children:t.children}):i.jsx(Zo,{authorId:n,children:t.children})}}}function tr({entry:e,authors:t}){const s=a.useMemo(()=>Go(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),n=a.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(l=>l.authorId))??[])},[e.mentionSpans]),o=a.useMemo(()=>er(n),[n]);return i.jsx(Jo,{authors:t,children:i.jsx(Os,{content:s,className:"msg-prose",allowedTags:Wo,literalTagContent:Ko,components:o,renderers:xo})})}function nr(e){return function(s){return i.jsx(tr,{entry:s,authors:e})}}const Lt="the top folder";function tt(e){return e.slice(e.lastIndexOf("/")+1)}function sr(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function or(e){return e===""?Lt:`${e}/`}function Se(e){return e.target!==void 0?e.target===""?Lt:e.target:or(sr(e.paths[0]??""))}function rr(e,t){const s=e.paths[0]??"",n=e.target;switch(e.kind){case"edit":return`${t} edited ${n??s}`;case"add":return`${t} added ${n??s}`;case"upload":return e.pathCount===1?`${t} uploaded ${tt(s)} to ${Se(e)}`:`${t} uploaded ${e.pathCount} files to ${Se(e)}`;case"rename":{const o=e.from??"";return n!==void 0?`${t} renamed ${o} to ${n}`:o.endsWith("/")?`${t} renamed ${o}`:`${t} renamed ${o} to ${s}`}case"delete":return n!==void 0?`${t} deleted ${n}`:e.pathCount===1?`${t} deleted ${s}`:`${t} deleted ${e.pathCount} files`;case"from-attachment":return`${t} saved ${tt(s)} from the chat to ${Se(e)}`}}const ar=a.lazy(()=>Mn(()=>import("./index-BxUoa3yn.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).then(e=>({default:e.SaveToRoomFilesButton})));function Ft({roomId:e,entry:t,author:s,authorRef:n,authors:o,viewerAuthorId:r,authorNames:l,reactionFrequents:c,streamStalled:h,isMember:p=!0,grouping:u,orphanedReply:d,answers:k,feedPosition:f,rowId:g}){const y=De(t.createdAt),x=a.useMemo(()=>{const G=Fo(t.body.text),Re=Ss(t.attachments??[]);if(Re===null)return G;const We=G??t.body.text.trim();return We.length>0?`${We} ${Re}`:Re},[t.body.text,t.attachments]),N=a.useId(),m=`${N}-author`,b=`${N}-content`,E=`${N}-summary`,T=a.useRef(null),D=a.useRef(null),j=a.useRef(null),{reactions:S,toggle:O,quickRow:I}=zo({roomId:e,entry:t,viewerAuthorId:r,reactionFrequents:c,streamStalled:h,isMember:p}),L=Me(n==null?void 0:n.agentRef),{open:$}=ft(),_=n===void 0?void 0:pt(n,L==null?void 0:L.memberId),q=a.useCallback(()=>{_!==void 0&&$(_)},[$,_]),F=_===void 0?void 0:q,z=Co({roomId:e,entry:t,author:n,viewerAuthorId:r,onViewProfile:F}),W=Ho({barRef:D,pillsRef:j,hasReactions:S.length>0}),B=a.useCallback(()=>{var G;return(G=T.current)==null?void 0:G.focus()},[]),H=a.useMemo(()=>nr(o),[o]),w=a.useCallback(G=>i.jsx(a.Suspense,{fallback:null,children:i.jsx(ar,{roomId:e,attachment:G})}),[e]),v=Po(),P=t.body.subjectAuthorId??t.authorId,M=o.get(P),R=Me(M==null?void 0:M.agentRef),A=Uo(e,t),C=Ao(t);if(C.kind==="notice")return i.jsx(wo,{entry:t,feedPosition:f,rowId:g,sessionLink:A,subjectName:M==null?void 0:M.displayName});if(C.kind==="moment")return i.jsx(No,{entry:t,moment:C.moment,subject:P===t.authorId?s:Y(P,o,v),subjectIdentity:{handle:(M==null?void 0:M.handle)??void 0,origin:M==null?void 0:M.origin,agent:R&&{runtime:R.runtime,...R.model&&{model:R.model}}},feedPosition:f,rowId:g});const U=u.position==="first"||u.position==="only";return i.jsxs(Q.Root,{ref:T,id:g,position:u.position,actions:z,reactions:I,"data-testid":"room-entry",tabIndex:0,...$o({showAuthorHeader:U,headerId:m,displayName:s.displayName,time:y,summary:x,contentId:b,summaryId:E,feedPosition:f}),onKeyDown:W,children:[i.jsx(Q.Gutter,{author:s,at:t.createdAt,onViewProfile:F,isSelf:t.authorId===r}),i.jsxs(Q.Body,{children:[i.jsx(Q.Author,{id:m,author:s,at:t.createdAt,origin:n==null?void 0:n.origin}),d===!0&&i.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),k!=null&&i.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${k.excerpt}”`}),i.jsx(Q.Content,{id:b,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:t.body.fileChange?i.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:rr(t.body.fileChange,(M==null?void 0:M.displayName)??"Somebody")}):H(t,{rowId:t.id,isStreaming:!1})}),x!==null&&i.jsx("span",{id:E,className:"hidden",children:x}),i.jsx(Q.Attachments,{items:t.attachments??[],renderAction:p?w:void 0}),i.jsx(Q.Reactions,{ref:j,reactions:S,viewerAuthorId:r,names:l,frequents:c,onToggle:O,disabled:h===!0||!p,onExit:B}),i.jsx(Q.Actions,{actions:z,reactions:I,barRef:D,onExit:B})]})]})}const ir="room-load-older",lr=4;function Bt({roomName:e}){return i.jsx(Ns,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:lr},(t,s)=>i.jsxs("div",{className:"flex gap-3",children:[i.jsx(ae,{className:"size-7 shrink-0 rounded-full"}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${s}`))})}function cr({roomId:e,roomName:t,viewerAuthorId:s,entries:n,members:o,formerAuthors:r,lastReadSeq:l,reactionFrequents:c,streamStalled:h,isLoading:p,error:u,onAddAgents:d,openThreadId:k,onOpenThread:f,resumeRow:g,landOnRow:y,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:m=!1,onLoadOlder:b,ref:E}){const T=a.useMemo(()=>Le(o,r),[o,r]),D=be(o,s),j=qe(),S=a.useMemo(()=>new Map([...T].map(([v,P])=>[v,P.displayName])),[T]),O=ht(),I=gt(e,null),{topLevel:L,repliesByRoot:$,orphaned:_}=a.useMemo(()=>Mo(n),[n]),q=a.useMemo(()=>new Map(n.map(v=>[v.id,v])),[n]),F=a.useMemo(()=>{const v=Is(L,l),P=js(L.map(R=>({id:R.id,authorId:R.body.moment?`moment:${R.id}`:R.authorId,timestamp:R.createdAt})),{now:O,lastSeenId:v.lastSeenId,unreadFromStart:v.fromStart}),M=[];N&&!p&&M.push({kind:"load-older",id:ir});for(const R of P){if(R.kind==="day-divider"){M.push({kind:"day-divider",id:R.key,label:R.label});continue}if(R.kind==="unread-divider"){M.push({kind:"unread-divider",id:R.key});continue}const A=L[R.index];M.push({kind:"message",id:A.id,entry:A,grouping:R.grouping,position:R.index+1,answers:Pt(A,L[R.index-1],q.get.bind(q))});const C=$.get(A.id);C&&M.push({kind:"thread-reply",id:Ot(A.id),rootId:A.id,replies:C,totalReplies:A.threadReplyCount})}return M},[L,$,q,l,O,N,p]),z=a.useMemo(()=>F.map(v=>v.kind==="load-older"?{kind:"notice",id:v.id,at:"",body:null}:v.kind==="day-divider"?{kind:"day-divider",id:v.id,label:v.label}:v.kind==="unread-divider"?{kind:"unread-divider",id:v.id}:v.kind==="thread-reply"?{kind:"thread-reply",id:v.id,rootId:v.rootId,replyCount:$e(v.replies.length,v.totalReplies),lastAt:v.replies[v.replies.length-1].createdAt}:{kind:"message",id:v.id,payload:v.entry,grouping:v.grouping,author:Y(pe(v.entry,T),T,j.faces),at:v.entry.createdAt}),[F,T,j.faces]),W=a.useCallback((v,P)=>{const M=F[P.index];if(M.kind==="load-older")return b===void 0?null:i.jsx(Do,{loading:m,onLoad:b});if(M.kind==="day-divider")return i.jsx(Cs,{label:M.label});if(M.kind==="unread-divider")return i.jsx(As,{});if(M.kind==="thread-reply"){if(P.onOpenThread===void 0)return null;const A=P.onOpenThread;return i.jsx(Io,{id:he(M.rootId),summary:po(M.replies,l,M.totalReplies),open:k===M.rootId,onOpen:()=>A(M.rootId)})}const R=pe(M.entry,T);return i.jsx(Ft,{roomId:e,entry:M.entry,author:Y(R,T,j.faces),authorRef:T.get(R),authors:T,viewerAuthorId:s,authorNames:S,reactionFrequents:c,streamStalled:h,isMember:D,grouping:M.grouping,orphanedReply:_.has(M.entry.id),answers:M.answers,feedPosition:{index:M.position,total:-1},rowId:ge(M.entry.id)})},[F,e,T,j.faces,s,S,c,h,D,_,l,k,m,b]),B=a.useCallback(v=>{if(v.kind==="message")return ge(v.id);if(v.kind==="thread-reply")return he(v.rootId)},[]);if(u)return i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),i.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const H=o.some(v=>v.author.kind==="agent"),w=i.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[i.jsx(En,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),i.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),i.jsx("p",{className:"max-w-sm",children:H?"Say something to get it going.":"Nothing answers until you add an agent."}),i.jsx(Te,{type:"button",size:"sm",variant:H?"ghost":"default",onClick:d,className:"mt-1",children:H?"Add more agents":"Add agents"})]});return i.jsx(Dt,{known:j,children:i.jsx(X.Timeline,{ref:E,conversationId:e,label:`Messages in ${t}`,rows:z,renderRow:W,onOpenThread:f,domIdOf:B,...g===void 0?{}:{resumeRow:g},...y===void 0?{}:{landOnRow:y},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:p?i.jsx(Bt,{roomName:t}):void 0,empty:w,feedTestId:"room-timeline"})})}const He={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function dr(e){const t=te(),[s,n]=a.useState([]),o=a.useRef(new Map),r=a.useCallback(f=>{const g=f.map(y=>({id:crypto.randomUUID(),file:y,status:"pending",progress:0}));n(y=>[...y,...g])},[]),l=a.useCallback(f=>{o.current.delete(f),n(g=>g.filter(y=>y.id!==f))},[]),c=a.useCallback(f=>{if(!f){o.current.clear(),n([]);return}const g=new Set(f);for(const y of g)o.current.delete(y);n(y=>y.filter(x=>!g.has(x.id)))},[]),h=a.useCallback(f=>{o.current.delete(f),n(g=>g.map(y=>y.id===f&&y.status==="error"?{...y,status:"pending",progress:0,error:void 0}:y))},[]),p=a.useRef(null),u=le({meta:{suppressErrorToast:!0},mutationFn:async f=>{n(N=>N.map(m=>f.some(b=>b.id===m.id)?{...m,status:"uploading"}:m));const g=N=>{n(m=>m.map(b=>b.status==="uploading"?{...b,progress:N.percentage}:b))},y=new AbortController;p.current=y;const x=f.map(N=>N.file);return t.uploadRoomAttachments(e,x,g,y.signal)},onSettled:()=>{p.current=null},onSuccess:(f,g)=>{g.forEach((y,x)=>{const N=f[x];N&&o.current.set(y.id,N.id)}),n(y=>y.map(x=>g.findIndex(m=>m.id===x.id)===-1?x:{...x,status:"uploaded",progress:100}))},onError:f=>{n(g=>g.map(y=>y.status==="uploading"?{...y,status:"error",error:f.message}:y))}}),d=a.useCallback(()=>{var f;(f=p.current)==null||f.abort()},[]),k=a.useCallback(async()=>{const f=s.filter(y=>y.status==="error");if(f.length>0)throw new Error(f.length===1?`${f[0].file.name} didn’t upload. Try again or remove it.`:`${f.length} files didn’t upload. Try again or remove them.`);const g=s.filter(y=>y.status==="pending");return g.length>0&&await u.mutateAsync(g),s.map(y=>o.current.get(y.id)).filter(y=>y!==void 0)},[s,u]);return{pendingFiles:s,addFiles:r,removeFile:l,retryFile:h,clearFiles:c,cancelUpload:d,uploadAndGetIds:k,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function qt(e){const{room:t,threadRootId:s}=e,n=Ms(),o=Es(),r=dr((t==null?void 0:t.id)??""),l=t!==void 0&&be(t.members,t.viewerAuthorId),c=a.useRef({attachments:r,post:n,reply:o,room:t,threadRootId:s});a.useEffect(()=>{c.current={attachments:r,post:n,reply:o,room:t,threadRootId:s}});const h=a.useCallback(m=>c.current.attachments.addFiles(m),[]),p=a.useCallback(m=>c.current.attachments.removeFile(m),[]),u=a.useCallback(m=>c.current.attachments.retryFile(m),[]),d=a.useCallback(()=>c.current.attachments.cancelUpload(),[]),{pendingFiles:k,hasFailedUpload:f,isUploading:g}=r,y=a.useMemo(()=>({staged:k,add:h,remove:p,retry:u,cancel:d,hasFailed:f,isUploading:g,holdsSendWhileUploading:!1}),[k,f,g,h,p,u,d]),x=a.useCallback(async m=>{const{attachments:b,post:E,reply:T,room:D,threadRootId:j}=c.current;if(D===void 0)throw new Error("That room isn’t loaded yet.");if(D.archived)throw new Error("This room is archived.");Ie.getState().recordOpened("room",D.id);const S=Tn(),O=b.pendingFiles.map(_=>_.file.name),I=b.pendingFiles.map(_=>_.id),L=await b.uploadAndGetIds();b.clearFiles(I);const $=m.parentEntryId??j;if($!==void 0){T.mutate({roomId:D.id,rootEntryId:$,text:m.text,clientId:S,attachmentIds:L,attachmentNames:O});return}E.mutate({roomId:D.id,text:m.text,clientId:S,attachmentIds:L,attachmentNames:O})},[]);return{target:a.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${se(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&l,...t===void 0?{canSendReason:"Still opening this room…"}:t.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:l?{}:{canSendReason:xt},send:x,attachments:y}),[t,s,l,y,x]),attachments:r}}function ur(e){const{roomId:t,entrySeq:s,entries:n,historyLoaded:o}=e,r=s===void 0?null:`${t}:${s}`,l=a.useMemo(()=>{if(s===void 0)return null;const g=n.find(m=>m.seq===s);if(g===void 0)return null;const y=Fe(n,g.id);if(y===null)return null;const x=Z(g)??null,N=x!==null&&y.rowId!==g.id;return{roomRowId:y.rowId,threadRootId:N?x:null,entryId:g.id}},[n,s]),c=a.useRef(null),h=(l==null?void 0:l.threadRootId)??null;a.useEffect(()=>{r===null||h===null||c.current!==r&&(c.current=r,J.getState().openThread(t,h))},[r,t,h]);const p=a.useRef(null);a.useEffect(()=>{r===null||!o||l===null&&p.current!==r&&(p.current=r,yt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=a.useRef(null),d=a.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),k=a.useRef(null),f=a.useCallback(()=>{if(!(r===null||k.current===r))return k.current=r,(l==null?void 0:l.threadRootId)===null||l==null?void 0:l.entryId},[r,l]);return{roomRow:s===void 0?void 0:d,threadRow:s===void 0?void 0:f}}function mr(e,t){const[s,n]=a.useState({roomId:null,seq:null});return s.roomId===e?s.seq:e===null?(n({roomId:null,seq:null}),null):t===null?null:(n({roomId:e,seq:t}),t)}const fr=600;function pr(e){return document.getElementById(he(e))??document.getElementById(ge(e))}function hr(){const e=a.useRef(null);return a.useEffect(()=>()=>{var s;return(s=e.current)==null?void 0:s.call(e)},[]),{arm:a.useCallback(s=>{var c;(c=e.current)==null||c.call(e);let n=0;const o=Date.now()+fr;let r=!1;const l=()=>{if(r)return;const h=document.activeElement;if(h===null||h===document.body||!h.isConnected){const u=pr(s);if(u!==null){u.focus();return}}Date.now()>=o||(n=requestAnimationFrame(l))};n=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(n)}},[])}}function gr({roomId:e,route:t,urlThreadId:s,openThreadId:n,entries:o,historyLoaded:r}){const l=_n(),c=a.useRef(null);a.useEffect(()=>{if(e!==null){if(c.current!==e&&(c.current=e,s!==void 0)){J.getState().openThread(e,s);return}if(r&&n!==void 0){const h=o.find(u=>u.id===n),p=h===void 0?void 0:_t(h);if(p!==void 0&&p!==n){const u=J.getState().open[e];J.getState().openThread(e,p,(u==null?void 0:u.focusComposer)??!1);return}}n!==s&&(l==null||l({to:t,search:h=>({...h,thread:n}),replace:!0}))}},[e,t,n,s,o,r,l])}const xr=6,zt="jump-back-in-listbox";function Ue(e){return`jump-back-in-item-${e}`}const yr='[role="combobox"]';function ie(e){return e instanceof Element&&e.matches(yr)}function br({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=_e(),o=On(),[r,l]=a.useState(!1),[c,h]=a.useState({stamp:"",index:0}),[p,u]=a.useState(!1),[d,k]=a.useState(!1);e.length>0&&!d&&k(!0);const f=a.useRef(!1);a.useEffect(()=>{f.current=!0},[]);const{data:g}=ut({enabled:s}),y=a.useMemo(()=>((g==null?void 0:g.agents)??[]).map(w=>w.projectPath),[g]),{data:x}=mt(y,{enabled:s}),N=a.useMemo(()=>x??{},[x]),m=a.useMemo(()=>Pn(y,N),[y,N]),b=a.useMemo(()=>new Map(y.map(w=>[dt(w),w])),[y]),E=a.useCallback(w=>Dn({room:w,agentsByPath:N,pathByAgentRef:b}),[N,b]),T=a.useMemo(()=>$n(o.muted),[o.muted]),{items:D}=bs({mutedRoomIds:T,enabled:s}),j=a.useMemo(()=>D.slice(0,xr),[D]),S=s&&r&&!p&&!d&&!t&&e.length===0&&j.length>0,O=`${S}:${j.length}`,I=c.stamp===O?c.index:0,L=a.useCallback(w=>{f.current&&ie(w.target)&&(u(!1),k(!1),l(!0))},[]),$=a.useCallback(w=>{ie(w.target)&&l(!0)},[]),_=a.useCallback(w=>{ie(w.target)&&l(!1)},[]),q=a.useCallback(w=>{j.length!==0&&h(v=>{const P=v.stamp===O?v.index:0;return{stamp:O,index:(P+w+j.length)%j.length}})},[j.length,O]),F=a.useCallback(()=>q(1),[q]),z=a.useCallback(()=>q(-1),[q]),W=a.useCallback(()=>{u(!0)},[]),B=a.useCallback(w=>{if(u(!0),w.kind==="session"){w.session.cwd&&Ie.getState().recordOpened("agent",w.session.cwd),n(fe({dir:w.session.cwd??void 0,session:w.session.id}));return}Ie.getState().recordOpened("room",w.room.id),n({...bt.channels(),search:{id:w.room.id}})},[n]),H=a.useCallback(()=>{const w=j[I];!S||!w||B(w)},[S,j,I,B]);return{isOpen:S,hasRows:j.length>0,rows:j,agents:N,displayNames:m,visualOf:E,selectedIndex:I,activeDescendantId:S&&j[I]!==void 0?Ue(I):void 0,listboxId:S?zt:void 0,handleFocus:L,handleBlur:_,handlePointerDown:$,moveDown:F,moveUp:z,selectHighlighted:H,selectRow:B,dismiss:W}}function Ht({mark:e,label:t,title:s,summary:n,lastActivityAt:o,index:r,isSelected:l,now:c,onSelect:h}){const p=a.useMemo(()=>Number.isNaN(Date.parse(o))?null:Hn(o),[o,c]);return i.jsxs("div",{id:Ue(r),role:"option","aria-selected":l,"data-selected":l,title:s,onClick:h,className:"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-start gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[i.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),i.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[i.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:t}),p!==null&&i.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:p})]}),n!==null&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:n})]})]})}function vr({item:e,agent:t,displayName:s,index:n,isSelected:o,now:r,onSelect:l}){const c=Ln(t,e.session.cwd??s);return i.jsx(Ht,{mark:i.jsx(Fn,{color:c.color,emoji:c.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:n,isSelected:o,now:r,onSelect:l})}function Rr({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:r}){return i.jsx(Ht,{mark:i.jsx(qn,{room:e.room,participants:e.room.participants,visuals:zn(t)}),label:i.jsx(Bn,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:n,now:o,onSelect:r})}function kr({rows:e,selectedIndex:t,agents:s={},displayNames:n={},visualOf:o,onSelect:r}){const l=ht(6e4);return a.useEffect(()=>{var c,h;(h=(c=document.getElementById(Ue(t)))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"})},[t]),i.jsx(Oe.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:c=>c.preventDefault(),children:i.jsx("div",{id:zt,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((c,h)=>{var p;return c.kind==="session"?i.jsx(vr,{item:c,agent:c.session.cwd&&s[c.session.cwd]||null,displayName:c.session.cwd&&n[c.session.cwd]||((p=c.session.cwd)==null?void 0:p.split("/").pop())||"Agent",index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`session-${c.id}`):i.jsx(Rr,{item:c,visual:o(c.room),index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`room-${c.id}`)})})})}const nt={people:"People",agents:"Agents"},wr=["people","agents"];function Sr(e,t){const s=[];for(const{author:n}of e){if(n.kind==="system"||n.id===t||n.retired)continue;const o=n.handle;s.push({section:n.kind==="agent"?"agents":"people",authorId:n.id,label:n.displayName,...o?{handle:o}:{},...n.emoji?{emoji:n.emoji}:{},...n.color?{color:n.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function Nr(e,t,s){const n=t.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:Ir(r,n)})).filter(r=>r.tier!==null).sort((r,l)=>r.tier-l.tier||r.position-l.position);return s.flatMap(r=>o.filter(l=>l.row.section===r).map(({row:l})=>l))}function Ir(e,t){var o;if(t==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(r=>r!==void 0);let n=null;for(const r of s){const l=r===t?0:r.startsWith(t)?1:r.includes(t)?2:null;l!==null&&(n===null||l<n)&&(n=l)}return n}function de(e,t,s){var r;const n=e.length;if(n===0)return 0;let o=(t%n+n)%n;for(let l=0;l<n;l++){if(!((r=e[o])!=null&&r.disabled))return o;o=(o+s+n)%n}return 0}function jr(e,t,s,n){const o=e.slice(0,t),r=e.slice(t+1+s.length),l=`@${n}`,c=r.startsWith(" ")?"":" ";return{value:o+l+c+r,cursorPos:o.length+l.length+1}}const Cr=/(^|\s)@([A-Za-z0-9_.-]*)$/,Ut="mention-palette-listbox";function Ee(e){return`mention-item-${e}`}function Ar({members:e,viewerAuthorId:t,text:s,sectionOrder:n=wr}){var $;const[o,r]=a.useState(!1),[l,c]=a.useState(""),[h,p]=a.useState(-1),u=Un(s),d=a.useRef(!1),k=a.useMemo(()=>Sr(e,t),[e,t]),f=a.useMemo(()=>o?Nr(k,l,n):[],[k,l,o,n]),[g,y]=a.useState(null),x=g!==null&&g.query===l&&g.open===o?g.index:de(f,0,1),N=f[x],m=f.length===0||N!==void 0&&!N.disabled?x:de(f,0,1),b=a.useCallback((_,q)=>{const F=_.slice(0,q).match(Cr);if(!F){r(!1);return}r(!0),c(F[2]),p((F.index??0)+F[1].length)},[]),E=a.useCallback(_=>{u.write(_),d.current=!1},[u]),T=a.useCallback(_=>{d.current||b(u.read(),_)},[b,u]),D=a.useCallback(()=>{y({query:l,open:o,index:de(f,m+1,1)})},[f,m,l,o]),j=a.useCallback(()=>{y({query:l,open:o,index:de(f,m-1,-1)})},[f,m,l,o]),S=a.useCallback(_=>_.disabled||_.handle===void 0?null:(d.current=!0,r(!1),jr(u.read(),h,l,_.handle)),[h,l,u]),O=a.useCallback(()=>{const _=f[m];return _?S(_):(r(!1),null)},[f,m,S]),I=a.useCallback(()=>{d.current=!0,r(!1)},[]),L=f.some(_=>!_.disabled);return{isOpen:o,hasSelectableRows:L,rows:f,selectedIndex:m,activeDescendantId:o&&(($=f[m])==null?void 0:$.disabled)===!1?Ee(m):void 0,listboxId:o?Ut:void 0,noteTextChange:E,handleCursorChange:T,moveDown:D,moveUp:j,selectHighlighted:O,selectRow:S,dismiss:I}}function Mr({rows:e,selectedIndex:t,onSelect:s}){const n=a.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const c=o[o.length-1];c&&c.section===r.section?c.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return a.useEffect(()=>{var o;(o=document.getElementById(Ee(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),i.jsx(Oe.div,{initial:{opacity:0,scale:.98,y:4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.98,y:4},transition:{duration:.15,ease:[0,0,.2,1]},className:"bg-popover max-h-80 overflow-hidden rounded-lg border shadow-lg",onMouseDown:o=>o.preventDefault(),children:i.jsx("div",{id:Ut,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?i.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):n.map(({section:o,items:r},l)=>i.jsxs("div",{role:"group","aria-label":nt[o],children:[l>0&&i.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),i.jsx("div",{"aria-hidden":!0,className:"text-muted-foreground/70 text-2xs px-2 pt-1.5 pb-1 font-medium tracking-wide uppercase",children:nt[o]}),r.map(({row:c,index:h})=>{const p=h===t;return i.jsxs("div",{id:Ee(h),role:"option","aria-selected":p,"aria-disabled":c.disabled,"data-selected":p,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[i.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),i.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&i.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function Wt({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:r}){const l=t===void 0?e.id:lt(e.id,t),c=Wn(l),{target:h}=kt(),p=Kn(),u=Gn(l),d=a.useRef(null),k=be(e.members,e.viewerAuthorId),f=a.useRef(!1),g=Ar({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),y=n===!0,x=br({value:c,yieldToPalette:g.isOpen,enabled:y}),N=a.useRef(u);a.useEffect(()=>{var I;u!==N.current&&(N.current=u,(I=d.current)==null||I.focus())},[u]),a.useEffect(()=>{var I;s===!0&&((I=d.current)==null||I.focusUnlessTouch())},[]);const m=a.useCallback(I=>ue.getState().set(l,I),[l]),[b,E]=a.useState(null);a.useLayoutEffect(()=>{var I;b!==null&&((I=d.current)==null||I.focusAt(b.pos))},[b]);const T=a.useCallback(I=>{I&&(m(I.value),E({pos:I.cursorPos}))},[m]),D=a.useCallback(I=>T(g.selectRow(I)),[g,T]),j=a.useCallback(()=>T(g.selectHighlighted()),[g,T]),S=()=>{if(h===null||!h.canSend||f.current)return;g.dismiss();const I=ue.getState().take(l).trim();if(I==="")return;const L=r.pendingFiles.length>0;L&&(f.current=!0),h.send({text:I}).catch(()=>{const $=ue.getState(),_=$.drafts[l]??"";$.set(l,_===""?I:`${I}
|
|
44
44
|
${_}`)}).finally(()=>{L&&(f.current=!1)})};if(!k)return i.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:xt}),i.jsx(Te,{type:"button",size:"sm",variant:"outline",disabled:p.isPending,onClick:()=>p.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>yt.success(`You joined ${se(e)}`)}),children:Qn})]});const O=i.jsx(X.Composer,{inputRef:d,value:c,onChange:I=>{m(I),g.noteTextChange(I)},onSubmit:S,head:i.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g.isOpen&&g.rows.length===0?"No one by that name.":""}),mentionPicker:i.jsx(je,{children:g.isOpen&&i.jsx(Mr,{rows:g.rows,selectedIndex:g.selectedIndex,onSelect:D})}),overlays:i.jsx(i.Fragment,{children:i.jsx(je,{children:x.isOpen&&i.jsx(kr,{rows:x.rows,selectedIndex:x.selectedIndex,agents:x.agents,displayNames:x.displayNames,visualOf:x.visualOf,onSelect:x.selectRow})})}),input:{onCursorChange:g.handleCursorChange,isStreaming:!1,isPaletteOpen:g.isOpen||x.isOpen,paletteHasResults:x.isOpen?x.hasRows:g.hasSelectableRows,onArrowUp:x.isOpen?x.moveUp:g.moveUp,onArrowDown:x.isOpen?x.moveDown:g.moveDown,onCommandSelect:x.isOpen?x.selectHighlighted:j,onEscape:x.isOpen?x.dismiss:g.dismiss,tabPicks:!x.isOpen,onClear:()=>{m(""),g.dismiss()},activeDescendantId:x.isOpen?x.activeDescendantId:g.activeDescendantId,paletteListboxId:x.isOpen?x.listboxId:g.listboxId,contextKey:l,...r.hasFailedUpload?{canSubmitReason:"A file didn’t upload. Try it again or remove it, then send."}:{}}});return!y&&o===void 0?O:i.jsx("section",{className:"flex flex-col","data-testid":Vn.homeComposer,onFocus:I=>{x.handleFocus(I),ie(I.target)&&(o==null||o(!0))},onBlur:I=>{x.handleBlur(I),ie(I.target)&&(o==null||o(!1))},onPointerDown:x.handlePointerDown,children:O})}function Er(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(t=>t.author.kind==="agent")}function Tr({room:e,hasEntries:t,onAddAgents:s}){return!t||!Er(e)?null:i.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",i.jsx("button",{type:"button",onClick:s,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function _r({roomId:e}){const{approvals:t}=Jn(),s=Yn(t).filter(n=>n.roomId===e);return s.length===0?null:i.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:i.jsx(Xn,{approvals:s})})}function Or({roomId:e}){const{data:t}=Hs("pending"),s=(t??[]).filter(n=>n.roomId===e);return s.length===0?null:i.jsx("section",{"data-slot":"room-agent-requests","aria-label":"Apps agents are asking for",className:"shrink-0 space-y-2 px-3 pb-2 md:px-4",children:s.map(n=>i.jsx(Us,{request:n},n.requestId))})}const Pr="An agent",st=64,Ne=3,Dr=new Set;function Kt({room:e,entries:t,scope:s,laneScope:n,stalled:o,unavailable:r=!1,onRetry:l,onScrollToRow:c}){const h=_e(),p=Zn(e.id,s),u=es(e.id,s),d=ts(e.id,s),[k,f]=a.useState(!1),g=Tt(e.id,{enabled:k}),y=ns(),{mutate:x}=uo(),[N,m]=a.useState(Dr),b=a.useCallback(R=>{m(A=>new Set(A).add(R)),x({roomId:e.id,authorId:R},{onSettled:()=>m(A=>{const C=new Set(A);return C.delete(R),C})})},[x,e.id]),E=mo(),[T,D]=a.useState(()=>new Map),j=ss(),S=qe(),O=a.useMemo(()=>Le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=a.useCallback(R=>{var A;return((A=O.get(R))==null?void 0:A.displayName)??Pr},[O]),{interactions:L}=os(),$=a.useMemo(()=>L.filter(R=>R.roomId===e.id),[L,e.id]),_=a.useMemo(()=>{var A;const R={};for(const C of $){if(C.roomAuthorId===void 0)continue;const U=(A=O.get(C.roomAuthorId))==null?void 0:A.displayName;U!==void 0&&(R[C.sessionId]=U)}return R},[$,O]),q=a.useMemo(()=>p.map(R=>({authorId:R.authorId,name:I(R.authorId),state:R.state,since:R.since,activity:R.activity??null})),[p,I]),F=a.useMemo(()=>u.map(R=>{var C;const A=(C=j.data)==null?void 0:C.find(U=>U.id===R.behindRoomId);return{authorId:R.authorId,name:I(R.authorId),since:R.since,behind:{roomId:R.behindRoomId,title:A===void 0?null:se(A)},othersWaiting:R.othersWaiting,severalInTheWay:R.severalInTheWay}}),[u,I,j.data]),z=a.useMemo(()=>{const R=new Set;for(const A of u)T.get(A.authorId)===A.entryId&&R.add(A.authorId);return R},[u,T]),W=a.useMemo(()=>d===null?null:{authorId:d.authorId,name:I(d.authorId)},[d,I]),B=a.useMemo(()=>Ts({capabilities:He,asks:$,agentNames:_,stalled:o,presence:q,held:F,silentFinish:W,turn:null}),[$,_,q,F,W,o]),H=a.useMemo(()=>{var A;const R=new Map;for(const C of((A=g.data)==null?void 0:A.bindings)??[])R.set(C.authorId,C.sessionId);return R},[g.data]),w=a.useCallback(R=>{const A=t.find(U=>U.id===R);if(A===void 0)return null;const C=A.body.text.replace(/\s+/gu," ").trim();return C.length===0?null:C.length>st?`${C.slice(0,st).trimEnd()}…`:C},[t]),v=a.useCallback(R=>{var A;return n==="thread"?Ae(R):((A=Fe(t,R))==null?void 0:A.domId)??null},[t,n]),P=a.useMemo(()=>{const R=p.map(C=>{const U=w(C.entryId),G=v(C.entryId);return{authorId:C.authorId,author:Y(C.authorId,O,S.faces),state:C.state,since:C.since,doing:rs(C.activity),replyingTo:U===null||G===null?null:{entryId:C.entryId,excerpt:U,rowId:G},sessionId:H.get(C.authorId)??null}}),A=F.map(C=>({authorId:C.authorId,author:Y(C.authorId,O,S.faces),state:"held",since:C.since,doing:null,replyingTo:null,sessionId:null,behind:C.behind,othersWaiting:C.othersWaiting}));return[...R,...A]},[p,F,O,S.faces,w,v,H]),M=a.useMemo(()=>{if(p.length===0)return null;const R=p.slice(0,Ne);return i.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[R.map(A=>i.jsx(vt,{author:Y(A.authorId,O,S.faces),className:"ring-background size-4 ring-2"},A.authorId)),p.length>Ne&&i.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${p.length-Ne}`})]})},[p,O,S.faces]);return i.jsx(X.LiveLane,{state:B,scope:n,onRetry:l,unavailable:r,faces:M,onPeekOpenChange:f,askCard:B.kind==="ask"?i.jsx(as,{ask:B.ask,..._[B.ask.sessionId]?{agentName:_[B.ask.sessionId]}:{},onOpenSession:R=>{h(fe({session:R}))},className:"border-l-0"}):void 0,peek:i.jsx(X.LivePeek,{rows:P,onScrollToRow:c,onOpenSession:R=>{h(fe({session:R}))},onOpenRoom:R=>{h({...bt.channels(),search:{id:R}})},onAnswerFirst:R=>{const A=u.find(C=>C.authorId===R);A!==void 0&&D(C=>new Map(C).set(R,A.entryId)),E.mutate({roomId:e.id,authorId:R})},promoted:z,onStopAll:()=>y.mutate({roomId:e.id}),stopping:y.isPending,onStopAgent:b,stoppingAgents:N})})}const ot=3e3;function $r(e,t,s,n=Date.now){const o=a.useRef(null),r=a.useRef(new Map),l=a.useRef(new Map),c=o.current,h=r.current,p=l.current,u=n();for(const d of e){if(p.has(d.id))continue;if(c===null){p.set(d.id,"at-rest");continue}const k=h.get(d.authorId);p.set(d.id,k!==void 0&&u-k<ot?"handed-off":"dropped")}return a.useEffect(()=>{if(!s)return;o.current=new Set(e.map(k=>k.id));const d=n();for(const k of t)r.current.set(k,d);for(const[k,f]of r.current)d-f>ot&&r.current.delete(k);for(const k of l.current.keys())o.current.has(k)||l.current.delete(k)}),p}function Lr({kind:e}){return e==="thread-error"?i.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),i.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?i.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-sm"})]}):i.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function Fr({room:e,rootEntryId:t,focusComposer:s,entries:n,reactionFrequents:o,streamStalled:r,streamUnavailable:l,onRetryStream:c,historyLoaded:h,historyFailed:p=!1,landOnRow:u,pushed:d,onClose:k}){const f=a.useMemo(()=>Le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),g=qt({room:e,threadRootId:t}),y=be(e.members,e.viewerAuthorId),x=qe(),N=a.useMemo(()=>new Map([...f].map(([w,v])=>[w,v.displayName])),[f]),{root:m,replies:b}=a.useMemo(()=>{let w;const v=[];for(const P of n)P.id===t?w=P:Z(P)===t&&v.push(P);return{root:w,replies:v}},[n,t]),E=m==null?void 0:m.threadReplyCount,T=E!==void 0&&E>b.length,D=m===void 0||T?-1:1+b.length,j=$e(b.length,E),S=a.useMemo(()=>new Set(b.map(w=>w.id)),[b]),O=a.useMemo(()=>({replyIds:S,inside:!0}),[S]),I=is(e.id,O),L=gt(e.id,t),$=$r(b,I,h),_=a.useRef(null),q=a.useCallback(w=>{var v;(v=_.current)==null||v.scrollToRow(w)},[]),F=a.useRef(null);a.useEffect(()=>{var w;s||(w=F.current)==null||w.focus()},[t,s]);const z=w=>{w.key!=="Escape"||w.defaultPrevented||(w.stopPropagation(),k())},W=a.useMemo(()=>{const w=[];if(m===void 0){const v=p?"thread-error":h?"thread-orphan":"thread-waiting";w.push({kind:"notice",id:v,at:"",body:null})}else w.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:Y(pe(m,f),f,x.faces),at:m.createdAt});for(const v of b)w.push({kind:"message",id:v.id,payload:v,grouping:{position:"only"},author:Y(pe(v,f),f,x.faces),at:v.createdAt});return w},[m,b,f,x.faces,p,h]),B=a.useCallback(w=>{if(w.kind==="notice")return i.jsx(Lr,{kind:w.id});if(w.kind!=="message")return null;const v=w.payload,P=m!==void 0&&v.id===m.id,M=b.findIndex(C=>C.id===v.id),R=i.jsx(Ft,{roomId:e.id,entry:v,rowId:Ae(v.id),author:w.author,authorRef:f.get(v.authorId),authors:f,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:o,streamStalled:r,isMember:y,grouping:{position:"only"},answers:Pt(v,M<=0?m:b[M-1],C=>(m==null?void 0:m.id)===C?m:b.find(U=>U.id===C)),feedPosition:{index:P?1:(m===void 0?0:1)+M+1,total:D}});if(P)return j===0?R:i.jsxs(i.Fragment,{children:[R,i.jsxs("div",{"aria-hidden":!0,"data-testid":"room-thread-divider",className:"flex items-center gap-2 px-[var(--msg-padding-x)] pt-1 pb-2",children:[i.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:j===1?"1 reply":`${j} replies`}),i.jsx("span",{className:"bg-border h-px flex-1"})]})]});const A=$.get(v.id)??"at-rest";return i.jsx("div",{className:V(A==="dropped"&&"motion-safe:animate-thread-reply-in",A==="handed-off"&&"motion-safe:animate-reply-settle"),children:R})},[m,b,j,$,e.id,e.viewerAuthorId,f,N,o,r,y,D]),H=a.useCallback(w=>w.kind==="message"?Ae(w.id):void 0,[]);return i.jsx(Dt,{known:x,children:i.jsx(X.Root,{surface:"room",capabilities:He,target:g.target,anchor:"rail",children:i.jsxs("section",{ref:F,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:z,className:V("bg-card flex min-h-0 flex-col outline-none",d?"h-full w-full":"w-full border-l"),children:[i.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[i.jsx("button",{type:"button",onClick:k,"aria-label":d?`Back to ${se(e)}`:"Close thread",className:V("focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1","after:absolute after:-inset-2.5 md:after:hidden"),children:d?i.jsx(ls,{"aria-hidden":!0,className:"size-4"}):i.jsx(cs,{"aria-hidden":!0,className:"size-4"})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"text-sm font-medium",children:"Thread"}),i.jsx("p",{className:"text-muted-foreground truncate text-xs",children:se(e)})]})]}),i.jsx(X.Timeline,{ref:_,conversationId:`thread-${t}`,label:`Thread in ${se(e)}`,busy:!h&&!p,rows:W,renderRow:B,domIdOf:H,...u===void 0?{}:{landOnRow:u},pending:L,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),i.jsx(Kt,{room:e,entries:n,scope:O,laneScope:"thread",stalled:d&&r===!0,unavailable:l,onRetry:d?c:void 0,onScrollToRow:q}),i.jsx(Wt,{room:e,threadRootId:t,attachments:g.attachments,focusOnMount:s},t)]})})})}const ve="room-thread-split",Br=320,qr=360,zr=40,Hr=50,Ur=25;function rt(e,t){return t<=0?Ur:Math.min(Math.round(e/t*1e3)/10,Hr)}function Wr(e){const t=rt(Br,e),s=Math.round((100-rt(qr,e))*10)/10;return{minPct:t,maxPct:s,defaultPct:Math.min(Math.max(zr,t),s)}}function Kr(e,t,s){if(e===null||t===null||t<=0)return s.defaultPct;const n=e/t*100;return Math.round(Math.min(Math.max(n,s.minPct),s.maxPct)*10)/10}function Gr(e){try{const t=localStorage.getItem(e),s=t===null?NaN:Number(t);return Number.isFinite(s)&&s>0?s:null}catch{return null}}function Qr(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}const Vr="react-resizable-panels:room-thread-split";function Jr(){try{localStorage.removeItem(Vr)}catch{}}function Yr(){const[e,t]=a.useState(null),[s,n]=a.useState(null);return{ref:a.useCallback(r=>{if(r===null)return;t(r);const l=()=>n(r.offsetWidth);l();const c=new ResizeObserver(l);return c.observe(r),()=>{c.disconnect(),t(null),n(null)}},[]),element:e,width:s,sizing:Wr(s??0)}}const Xr=`${ve}-room`,at=`${ve}-thread`,it=`${ve}-handle`,Zr=4;function ea({room:e,thread:t,storageKey:s=us.ROOM_THREAD_WIDTH}){const{ref:n,element:o,width:r,sizing:l}=Yr(),[c,h]=a.useState(()=>Gr(s)),[p,u]=a.useState(null),d=a.useRef(null),k=Kr(c,r,l),f=r===null||(l.maxPct-l.minPct)/100*r<Zr,g=t!==!1;a.useEffect(Jr,[]);const y=a.useRef(!1);a.useLayoutEffect(()=>{var b;y.current&&((b=d.current)==null||b.resize(k))},[k,g]);const x=a.useRef(null),N=()=>{var D;const b=(D=d.current)==null?void 0:D.getSize(),E=x.current;if(x.current=null,b===void 0||r===null||r<=0||E===b)return;const T=Math.round(b/100*r);h(T),Qr(s,T)},m=p??k;return a.useLayoutEffect(()=>{const b=o==null?void 0:o.querySelector(`[data-panel-resize-handle-id="${it}"]`);b&&(b.setAttribute("aria-controls",at),b.setAttribute("aria-valuenow",String(Math.round(m))),b.setAttribute("aria-valuemin",String(Math.round(l.minPct))),b.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),i.jsx("div",{ref:n,className:"h-full overflow-hidden",children:i.jsxs(ds,{direction:"horizontal",id:ve,onLayout:b=>{y.current=b.length>1,u(y.current?b[1]:null)},children:[i.jsx(Ve,{id:Xr,order:1,className:"flex",children:e}),g&&i.jsxs(i.Fragment,{children:[i.jsx(vs,{id:it,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:f,onDragging:b=>{var E;b&&(x.current=((E=d.current)==null?void 0:E.getSize())??null)},onKeyDownCapture:b=>{var E,T;f||(x.current=((E=d.current)==null?void 0:E.getSize())??null,!(b.key!=="Home"&&b.key!=="End")&&(b.preventDefault(),(T=d.current)==null||T.resize(b.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),i.jsx(Ve,{ref:d,id:at,order:2,defaultSize:k,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:t})]})]})})}function ha({roomId:e,threadId:t,entrySeq:s,threadRoute:n,aboveTimeline:o,aboveComposer:r,offerJumpBackIn:l,onComposerFocusChange:c}){const h=ms(),p=Rs(),u=fs(e),d=u==null?void 0:u.rootEntryId,k=hr(),f=a.useCallback(()=>{var P;const v=(P=J.getState().open[e])==null?void 0:P.rootEntryId;J.getState().closeThread(e),v!==void 0&&k.arm(v)},[e,k]),g=a.useCallback(v=>{J.getState().openThread(e,v)},[e]),y=ps(e),x=hs(e),N=co(e,x.isSuccess);_s(e);const m=y.data,b=a.useMemo(()=>x.data??[],[x.data]),E=qt({room:m});gr({roomId:e,route:n,urlThreadId:t,openThreadId:d,entries:b,historyLoaded:x.isSuccess});const T=a.useMemo(()=>{var v;return((v=m==null?void 0:m.members.find(P=>P.author.id===m.viewerAuthorId))==null?void 0:v.lastReadSeq)??null},[m]),D=mr(e,T);gs(m,b);const j=a.useRef(null),S=a.useRef(void 0),O=a.useCallback(v=>{S.current=v},[]),I=a.useCallback(()=>S.current,[]);a.useLayoutEffect(()=>{S.current=void 0},[e]);const L=a.useCallback(v=>{var P;(P=j.current)==null||P.scrollToRow(v)},[]),$=ho(e),{loadOlder:_,cursor:q}=$,F=a.useCallback(()=>{const v=Eo(b,q);_().then(()=>{v!==null&&requestAnimationFrame(()=>{var P;return(P=j.current)==null?void 0:P.scrollToRow(v.domId)})})},[b,q,_]),z=ur({roomId:e,entrySeq:s,entries:b,historyLoaded:x.isSuccess}),W=a.useMemo(()=>d===void 0?void 0:{replyIds:new Set(b.filter(P=>Z(P)===d).map(P=>P.id)),inside:!1},[b,d]);if(y.isLoading)return i.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:i.jsx(Bt,{})});if(y.isError||!m)return i.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),i.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const B=u!==void 0&&i.jsx(Fr,{room:m,rootEntryId:u.rootEntryId,focusComposer:u.focusComposer,entries:b,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:x.isSuccess,historyFailed:x.isError,...z.threadRow===void 0?{}:{landOnRow:z.threadRow},pushed:h,onClose:f},u.rootEntryId),H=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o,i.jsx(cr,{ref:j,roomId:m.id,roomName:se(m),viewerAuthorId:m.viewerAuthorId,entries:b,members:m.members,formerAuthors:m.formerAuthors,lastReadSeq:D,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,isLoading:x.isLoading,error:x.error,onAddAgents:()=>Je("add",m.id),openThreadId:d,onOpenThread:g,resumeRow:I,...z.roomRow===void 0?{}:{landOnRow:z.roomRow},onTopRow:O,canLoadOlder:$.canLoadOlder,isLoadingOlder:$.isLoadingOlder,onLoadOlder:F}),r,i.jsx(_r,{roomId:m.id}),i.jsx(Or,{roomId:m.id}),i.jsx(Kt,{room:m,entries:b,scope:W,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:L}),i.jsx(Tr,{room:m,hasEntries:b.length>0,onAddAgents:()=>Je("add",m.id)}),i.jsx(Wt,{room:m,attachments:E.attachments,offerJumpBackIn:l,onFocusChange:c},m.id)]}),w={surface:"room",capabilities:He,target:E.target,anchor:"rail"};return h?i.jsx(X.Root,{...w,children:i.jsx(je,{initial:!1,mode:"wait",children:i.jsx(Oe.div,{initial:{opacity:0,x:16},animate:{opacity:1,x:0},exit:{opacity:0,x:16},transition:{duration:.15,ease:[0,0,.2,1]},style:{paddingBottom:p},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:B===!1?H:B},B?`thread-${d}`:"room")})}):i.jsx(X.Root,{...w,children:i.jsx(ea,{room:H,thread:B})})}export{Et as I,Bt as R,Io as T,ha as a,ie as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-
|
|
1
|
+
import{h as d,i as l,j as e,e as m,k as u,C as c,l as x,n as h,H as f}from"./index-Dr-0P6rd.js";function g({kind:s}){const r="text-muted-foreground size-3.5 shrink-0";return s==="dm"?e.jsx(h,{"aria-hidden":!0,className:r}):e.jsx(f,{"aria-hidden":!0,className:r})}function p(s){return s===1?"1 member":`${s} members`}function N({member:s}){var i;const r=d(),n=l(s.id);if(n.isPending)return e.jsx(m,{className:"h-16 w-full"});if(n.isError)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this member’s rooms."});const a=((i=n.data)==null?void 0:i.rooms)??[];return a.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.isSelf?"You aren’t":`${s.displayName} isn’t`," in any rooms yet."]}):e.jsx("div",{className:"flex flex-col",children:a.map(t=>{const o=e.jsxs(e.Fragment,{children:[e.jsx(g,{kind:t.kind}),e.jsx("span",{className:"min-w-0 truncate text-sm",children:u({kind:t.kind,slug:t.slug,title:t.name})}),e.jsx("span",{className:"text-muted-foreground ml-auto shrink-0 text-xs",children:p(t.memberCount)})]});return r?e.jsxs("button",{type:"button","data-slot":"profile-room-row",onClick:()=>void r({...x.channels(),search:{id:t.id}}),className:"focus-ring hover:bg-muted/50 flex h-9 items-center gap-2 rounded-md px-2 text-left transition-colors",children:[o,e.jsx(c,{"aria-hidden":!0,className:"text-muted-foreground/70 size-3.5 shrink-0"})]},t.id):e.jsx("div",{"data-slot":"profile-room-row",className:"flex h-9 items-center gap-2 rounded-md px-2",children:o},t.id)})})}export{N as RoomsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as L,j as e,at as Ee,bl as ye,a3 as we,Z as N,dD as ie,dE as ue,dF as fe,dG as me,dH as xe,dI as Te,ae as Ae,af as ke,ag as Le,dJ as pe,dK as Oe,d8 as he,dL as De,dM as Ie,dN as Pe,dO as _e,dP as Ue,dQ as j,dR as $e,dS as Re,dT as He,db as H,dU as ce,dV as Me,dW as k,dX as Be,dB as be,B as Ke,df as ze,b as Qe,e as Ve,dY as qe,dZ as Fe,d_ as We,d$ as Xe,e0 as Ye,e1 as Ge}from"./index-BZKMWkth.js";const Ze={duration:.12,ease:"easeOut"},Je={type:"spring",stiffness:320,damping:28};function ge({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=L.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?ie.warning:ie.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":d,children:[r&&e.jsx(Ee,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(ye,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Je},exit:{opacity:0},transition:Ze,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",Te.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Ae(),i=ke();return Le({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:et})}})}const ve="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:O}){const w=pe(),[S,h]=L.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:a}),!w&&e.jsx(ge,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(ze,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:O??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,le,oe,re,de;const r=pe(),{data:s}=Oe(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=De(),C=Ie(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,A;return((A=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:O}=Pe({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,T=a.model??h??(E==null?void 0:E.value)??null,M=o==="doe"&&c&&!w&&!h,p=T?(m??[]).find(t=>t.value===T):void 0,D=(n==null?void 0:n.supportsEffort)??((ae=_e(d,o))==null?void 0:ae.supportsEffort),B=D===void 0&&u,K=D!==!1,z=p?p.supportsEffort??!1:void 0,Q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:V,creditsEntry:je,resolvedAccount:q}=Ue(),F=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),g=Q&&[...Q.flatMap(t=>t.id===null?[]:[{id:t.id,label:V(t.path),path:t.path}]),...F?[{id:j,label:$e,path:F.path}]:[]],v=a.account??null,W=v!==null,X=o==="claude-code"&&v===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&q?V(q):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=L.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Re({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:He(m),knownAccounts:g,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:z,runtimeSupportsEffort:D,runtimeLabel:t=>H(t).label}),y=t=>{var b;return((b=Ne.breakages.find(A=>t.includes(A.kind)))==null?void 0:b.message)??null},U=!B&&K&&z!==!1,Y=a.effort??(n==null?void 0:n.effort)??null,G=H(o).label,Ce=o==="claude-code"&&g!==void 0&&(g.length>1||W),Se=y(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=L.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??T??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:T,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:y(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:M?ce:c&&!h?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Me,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&O&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ge,{isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${G} supports`,warning:null}):K?U?e.jsx($,{label:"Effort",valueLabel:k(Y),options:Be.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:k(t)})),selected:Y,isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${G}`,warning:y(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:X?I??"Default":v!==null?((de=g==null?void 0:g.find(t=>t.id===v))==null?void 0:de.label)??v:I??"Default",options:(g??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:v,isSetHere:W,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),X&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx(Ke,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function lt({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=Qe(a),{data:d}=he();if(r)return e.jsx(Ve,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(qe,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(Fe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(We,{})}),e.jsx(Xe,{children:f.map(o=>e.jsx(Ye,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ge,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{lt as RunsOnPopover};
|
|
1
|
+
import{r as L,j as e,at as Ee,bl as ye,a3 as we,Z as N,dD as ie,dE as ue,dF as fe,dG as me,dH as xe,dI as Te,ae as Ae,af as ke,ag as Le,dJ as pe,dK as Oe,d8 as he,dL as De,dM as Ie,dN as Pe,dO as _e,dP as Ue,dQ as j,dR as $e,dS as Re,dT as He,db as H,dU as ce,dV as Me,dW as k,dX as Be,dB as be,B as Ke,df as ze,b as Qe,e as Ve,dY as qe,dZ as Fe,d_ as We,d$ as Xe,e0 as Ye,e1 as Ge}from"./index-Dr-0P6rd.js";const Ze={duration:.12,ease:"easeOut"},Je={type:"spring",stiffness:320,damping:28};function ge({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=L.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?ie.warning:ie.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":d,children:[r&&e.jsx(Ee,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(ye,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Je},exit:{opacity:0},transition:Ze,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",Te.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Ae(),i=ke();return Le({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:et})}})}const ve="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:O}){const w=pe(),[S,h]=L.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:a}),!w&&e.jsx(ge,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(ze,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:O??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,le,oe,re,de;const r=pe(),{data:s}=Oe(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=De(),C=Ie(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,A;return((A=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:A.runsOn)==="credits"}}),{data:m,isError:O}=Pe({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,T=a.model??h??(E==null?void 0:E.value)??null,M=o==="doe"&&c&&!w&&!h,p=T?(m??[]).find(t=>t.value===T):void 0,D=(n==null?void 0:n.supportsEffort)??((ae=_e(d,o))==null?void 0:ae.supportsEffort),B=D===void 0&&u,K=D!==!1,z=p?p.supportsEffort??!1:void 0,Q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:V,creditsEntry:je,resolvedAccount:q}=Ue(),F=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),g=Q&&[...Q.flatMap(t=>t.id===null?[]:[{id:t.id,label:V(t.path),path:t.path}]),...F?[{id:j,label:$e,path:F.path}]:[]],v=a.account??null,W=v!==null,X=o==="claude-code"&&v===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&q?V(q):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=L.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Re({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:He(m),knownAccounts:g,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:z,runtimeSupportsEffort:D,runtimeLabel:t=>H(t).label}),y=t=>{var b;return((b=Ne.breakages.find(A=>t.includes(A.kind)))==null?void 0:b.message)??null},U=!B&&K&&z!==!1,Y=a.effort??(n==null?void 0:n.effort)??null,G=H(o).label,Ce=o==="claude-code"&&g!==void 0&&(g.length>1||W),Se=y(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=L.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??T??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:T,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:y(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:M?ce:c&&!h?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Me,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&O&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ge,{isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${G} supports`,warning:null}):K?U?e.jsx($,{label:"Effort",valueLabel:k(Y),options:Be.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:k(t)})),selected:Y,isSetHere:S,serverDefault:n!=null&&n.effort?k(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${G}`,warning:y(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:X?I??"Default":v!==null?((de=g==null?void 0:g.find(t=>t.id===v))==null?void 0:de.label)??v:I??"Default",options:(g??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:v,isSetHere:W,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),X&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx(Ke,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function lt({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=Qe(a),{data:d}=he();if(r)return e.jsx(Ve,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(qe,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(Fe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(We,{})}),e.jsx(Xe,{children:f.map(o=>e.jsx(Ye,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ge,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{lt as RunsOnPopover};
|
package/dist/client/assets/{RuntimeSetupDialog-Bh0jopL-.js → RuntimeSetupDialog-ufwCvCJB.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,bd as K,c$ as A,d0 as Y,j as e,d1 as W,d2 as G,bc as V,ba as C,b9 as I,d3 as Z,bb as Q,d4 as X,d5 as J,d6 as q,bi as ee,d7 as te,d8 as ne,d9 as U,cV as se,cW as re,cX as ae,cY as oe,cZ as ie,da as ce,db as k,$ as E,B as S,dc as z,dd as le,Z as D,de,cA as ue,cB as fe,df as me,cC as xe,dg as pe,dh as O,di as ve,dj as he,dk as ge,bw as Ce,dl as be,dm as je,a3 as $,F as Re,bl as Ne}from"./index-BZKMWkth.js";var Pe=Object.defineProperty,b=(t,n)=>Pe(t,"name",{value:n,configurable:!0}),T,_="HoverCard",[M,Ve]=K(_,[A]),L=A(),[Se,H]=M(_),we=b(t=>{const{__scopeHoverCard:n,children:r,open:a,defaultOpen:s,onOpenChange:c,openDelay:o=700,closeDelay:m=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,f]=Y({prop:a,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>f(!0),o)},[o,f]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>f(!1),m))},[m,f]),h=l.useCallback(()=>f(!1),[f]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(Se,{scope:n,open:u,onOpenChange:f,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(W,{...x,children:r})})},"HoverCard"),He="HoverCardTrigger",Te=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,...s}=n,c=H(He,a),o=L(a);return e.jsx(G,{asChild:!0,...o,children:e.jsx(V.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,w(c.onOpen)),onPointerLeave:C(n.onPointerLeave,w(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,m=>m.preventDefault())})})},"HoverCardTrigger")),F="HoverCardPortal",[ye,ke]=M(F,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:a,container:s}=t,c=H(F,n);return e.jsx(ye,{scope:n,forceMount:r,children:e.jsx(I,{present:r||c.open,children:e.jsx(Z,{asChild:!0,container:s,children:a})})})},"HoverCardPortal"),y="HoverCardContent",De=l.forwardRef(b(function(n,r){const a=ke(y,n.__scopeHoverCard),{forceMount:s=a.forceMount,...c}=n,o=H(y,n.__scopeHoverCard);return e.jsx(I,{present:s||o.open,children:e.jsx(Oe,{"data-state":o.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,w(o.onOpen)),onPointerLeave:C(n.onPointerLeave,w(o.onClose)),ref:r})})},"HoverCardContent")),Oe=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:o,onInteractOutside:m,...x}=n,i=H(y,a),p=L(a),v=l.useRef(null),g=Q(r,v),[u,f]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return T=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=T,d.style.webkitUserSelect=T}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{f(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&B(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(X,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:m,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(o,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(J,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&f(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function w(t){return n=>n.pointerType==="touch"?void 0:t()}b(w,"excludeTouch");function B(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(a=>a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(B,"getTabbableNodes");var _e=we,Le=Te,$e=Ee,Ae=De;function Ze({...t}){return e.jsx(_e,{"data-slot":"hover-card",...t})}function Qe({...t}){return e.jsx(Le,{"data-slot":"hover-card-trigger",...t})}function Xe({className:t,align:n="center",sideOffset:r=4,...a}){const s=q();return e.jsx($e,{"data-slot":"hover-card-portal",container:s,children:e.jsx(Ae,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:ee("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-dui-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden motion-reduce:animate-none!",t),...a})})}function Ie(t,n,r){return t?[t]:n||de(r)}function Ue({runtime:t,types:n,requirements:r,registeredTypes:a=[],onRecheck:s,isRechecking:c=!1,renderConnect:o}){const m=z(),x=Ie(t,n,a);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Me,{type:i,requirements:r,registered:a.includes(i),renderConnect:o},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(le,{className:D("size-3.5",c&&!m&&"animate-spin")}),"Check again"]})]})]})}function ze(t,n,r){return r?ve(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:he.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${ge(t)}`}}:null:null}function Me({type:t,requirements:n,registered:r,renderConnect:a}){var R,N;const s=k(t),c=s.icon,o=n==null?void 0:n.runtimes[t],m=U(n,t,r),x=m.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?ze(t,o==null?void 0:o.provider,!!a):null,f=o==null?void 0:o.dependencies.find(P=>P.status!=="satisfied"&&P.installHint),d=(f==null?void 0:f.installHint)??((R=s.setup)==null?void 0:R.installCommand),j=(f==null?void 0:f.infoUrl)??((N=s.setup)==null?void 0:N.infoUrl),h=!!o||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(E,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[a==null?void 0:a({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),!x&&m.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Fe,{type:t,connect:m.connect,renderConnect:a,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(ue,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(fe,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(me,{className:D("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(xe,{className:"mt-3 space-y-3",children:o?o.dependencies.map(P=>e.jsx(Ye,{dep:P},P.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(pe,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Fe({type:t,connect:n,renderConnect:r,installCommand:a,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Be,{type:t,label:n.label,installCommand:a,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Be({type:t,label:n,installCommand:r,installInfoUrl:a}){const s=k(t),{provision:c,isPending:o,isError:m,errorMessage:x,progress:i,result:p}=be(t);return o||p!=null&&p.ok?e.jsx(Ke,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):m?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:a,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(je,{command:r,runtimeLabel:s.label})]})}function Ke({message:t}){const n=z();return e.jsxs($.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(Re,{size:"xs",className:D("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(Ne,{mode:"wait",children:e.jsx($.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ye({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(E,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(Ce,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function Je({runtime:t,open:n,onOpenChange:r,renderConnect:a,onRuntimeReady:s,showConnectSuccess:c=!1}){const o=te(),{data:m}=ne(),x=t?k(t):null,i=U(o.data,t??"",m?t!==void 0&&t in m.capabilities:!0),p=o.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,f]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&f(null),d.current=n},[n]);const j=a&&(c?h=>a({...h,onConnected:R=>{var N;(N=h.onConnected)==null||N.call(h,R),f(R)}}):a);return e.jsx(se,{open:n,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(ae,{children:[e.jsx(oe,{children:x?x.label:"Your runtimes"}),e.jsx(ie,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(ce,{children:u?e.jsx(We,{success:u,onDone:()=>r(!1)}):e.jsx(Ue,{runtime:t,requirements:o.data,registeredTypes:m?Object.keys(m.capabilities):void 0,onRecheck:()=>void o.refetch(),isRechecking:o.isFetching,renderConnect:j})})]})})}function We({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(E,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{Ze as H,Je as R,Qe as a,Xe as b,Ue as c};
|
|
1
|
+
import{r as l,bd as K,c$ as A,d0 as Y,j as e,d1 as W,d2 as G,bc as V,ba as C,b9 as I,d3 as Z,bb as Q,d4 as X,d5 as J,d6 as q,bi as ee,d7 as te,d8 as ne,d9 as U,cV as se,cW as re,cX as ae,cY as oe,cZ as ie,da as ce,db as k,$ as E,B as S,dc as z,dd as le,Z as D,de,cA as ue,cB as fe,df as me,cC as xe,dg as pe,dh as O,di as ve,dj as he,dk as ge,bw as Ce,dl as be,dm as je,a3 as $,F as Re,bl as Ne}from"./index-Dr-0P6rd.js";var Pe=Object.defineProperty,b=(t,n)=>Pe(t,"name",{value:n,configurable:!0}),T,_="HoverCard",[M,Ve]=K(_,[A]),L=A(),[Se,H]=M(_),we=b(t=>{const{__scopeHoverCard:n,children:r,open:a,defaultOpen:s,onOpenChange:c,openDelay:o=700,closeDelay:m=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,f]=Y({prop:a,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>f(!0),o)},[o,f]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>f(!1),m))},[m,f]),h=l.useCallback(()=>f(!1),[f]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(Se,{scope:n,open:u,onOpenChange:f,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(W,{...x,children:r})})},"HoverCard"),He="HoverCardTrigger",Te=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,...s}=n,c=H(He,a),o=L(a);return e.jsx(G,{asChild:!0,...o,children:e.jsx(V.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,w(c.onOpen)),onPointerLeave:C(n.onPointerLeave,w(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,m=>m.preventDefault())})})},"HoverCardTrigger")),F="HoverCardPortal",[ye,ke]=M(F,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:a,container:s}=t,c=H(F,n);return e.jsx(ye,{scope:n,forceMount:r,children:e.jsx(I,{present:r||c.open,children:e.jsx(Z,{asChild:!0,container:s,children:a})})})},"HoverCardPortal"),y="HoverCardContent",De=l.forwardRef(b(function(n,r){const a=ke(y,n.__scopeHoverCard),{forceMount:s=a.forceMount,...c}=n,o=H(y,n.__scopeHoverCard);return e.jsx(I,{present:s||o.open,children:e.jsx(Oe,{"data-state":o.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,w(o.onOpen)),onPointerLeave:C(n.onPointerLeave,w(o.onClose)),ref:r})})},"HoverCardContent")),Oe=l.forwardRef(b(function(n,r){const{__scopeHoverCard:a,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:o,onInteractOutside:m,...x}=n,i=H(y,a),p=L(a),v=l.useRef(null),g=Q(r,v),[u,f]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return T=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=T,d.style.webkitUserSelect=T}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{f(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&B(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(X,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:m,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(o,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(J,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&f(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function w(t){return n=>n.pointerType==="touch"?void 0:t()}b(w,"excludeTouch");function B(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(a=>a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(B,"getTabbableNodes");var _e=we,Le=Te,$e=Ee,Ae=De;function Ze({...t}){return e.jsx(_e,{"data-slot":"hover-card",...t})}function Qe({...t}){return e.jsx(Le,{"data-slot":"hover-card-trigger",...t})}function Xe({className:t,align:n="center",sideOffset:r=4,...a}){const s=q();return e.jsx($e,{"data-slot":"hover-card-portal",container:s,children:e.jsx(Ae,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:ee("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-dui-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden motion-reduce:animate-none!",t),...a})})}function Ie(t,n,r){return t?[t]:n||de(r)}function Ue({runtime:t,types:n,requirements:r,registeredTypes:a=[],onRecheck:s,isRechecking:c=!1,renderConnect:o}){const m=z(),x=Ie(t,n,a);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Me,{type:i,requirements:r,registered:a.includes(i),renderConnect:o},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(le,{className:D("size-3.5",c&&!m&&"animate-spin")}),"Check again"]})]})]})}function ze(t,n,r){return r?ve(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:he.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${ge(t)}`}}:null:null}function Me({type:t,requirements:n,registered:r,renderConnect:a}){var R,N;const s=k(t),c=s.icon,o=n==null?void 0:n.runtimes[t],m=U(n,t,r),x=m.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?ze(t,o==null?void 0:o.provider,!!a):null,f=o==null?void 0:o.dependencies.find(P=>P.status!=="satisfied"&&P.installHint),d=(f==null?void 0:f.installHint)??((R=s.setup)==null?void 0:R.installCommand),j=(f==null?void 0:f.infoUrl)??((N=s.setup)==null?void 0:N.infoUrl),h=!!o||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(E,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[a==null?void 0:a({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),!x&&m.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Fe,{type:t,connect:m.connect,renderConnect:a,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(ue,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(fe,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(me,{className:D("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(xe,{className:"mt-3 space-y-3",children:o?o.dependencies.map(P=>e.jsx(Ye,{dep:P},P.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(pe,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Fe({type:t,connect:n,renderConnect:r,installCommand:a,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Be,{type:t,label:n.label,installCommand:a,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Be({type:t,label:n,installCommand:r,installInfoUrl:a}){const s=k(t),{provision:c,isPending:o,isError:m,errorMessage:x,progress:i,result:p}=be(t);return o||p!=null&&p.ok?e.jsx(Ke,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):m?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:a,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(je,{command:r,runtimeLabel:s.label})]})}function Ke({message:t}){const n=z();return e.jsxs($.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(Re,{size:"xs",className:D("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(Ne,{mode:"wait",children:e.jsx($.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ye({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(E,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(Ce,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function Je({runtime:t,open:n,onOpenChange:r,renderConnect:a,onRuntimeReady:s,showConnectSuccess:c=!1}){const o=te(),{data:m}=ne(),x=t?k(t):null,i=U(o.data,t??"",m?t!==void 0&&t in m.capabilities:!0),p=o.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,f]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&f(null),d.current=n},[n]);const j=a&&(c?h=>a({...h,onConnected:R=>{var N;(N=h.onConnected)==null||N.call(h,R),f(R)}}):a);return e.jsx(se,{open:n,onOpenChange:r,children:e.jsxs(re,{className:"sm:max-w-md",children:[e.jsxs(ae,{children:[e.jsx(oe,{children:x?x.label:"Your runtimes"}),e.jsx(ie,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(ce,{children:u?e.jsx(We,{success:u,onDone:()=>r(!1)}):e.jsx(Ue,{runtime:t,requirements:o.data,registeredTypes:m?Object.keys(m.capabilities):void 0,onRecheck:()=>void o.refetch(),isRechecking:o.isFetching,renderConnect:j})})]})})}function We({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(E,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{Ze as H,Je as R,Qe as a,Xe as b,Ue as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as u,v as p,r as o,w as r,x as g,j as S,y as h}from"./index-
|
|
1
|
+
import{h as u,v as p,r as o,w as r,x as g,j as S,y as h}from"./index-Dr-0P6rd.js";function d({member:a}){var n;const e=((n=a.agent)==null?void 0:n.projectPath)??null,t=u(),s=p(),i=o.useCallback(l=>{!t||e===null||(r.getState().recordOpened("agent",e),t(g({dir:e,session:l})))},[t,e]),c=o.useCallback(()=>{e!==null&&(r.getState().recordOpened("agent",e),s(e))},[e,s]);return S.jsx(h,{agentPath:e,agentName:a.displayName,onOpenChat:i,onNewChat:c,searchable:!0,className:"flex-1"})}export{d as SessionsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ae as b,aj as z,gW as h,gX as g,af as w,ag as $,cQ as M,an as W,j as e,r as d,df as O,Z as N,B as j,at as I,dD as y,dg as C,fR as q,fS as K,fT as Q,fU as U,fV as Y,fW as G,fX as X,fY as J,h as H,l as E,e3 as V,ad as Z,e as A,e6 as ee,gY as R,aa as L}from"./index-BZKMWkth.js";import{B as P}from"./banner-D26eekSD.js";import{P as T}from"./package-B7amjGSw.js";function D(s){const t=b();return z({queryKey:h.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const se={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},te={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},k="\0",ne=new Set(["native","projected"]);function _(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function ae(s,t){return`${g[s]} ${se[t]}`}function re(s){return s.reason??s.target}function B(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function le(s,t){if(t.length===0)return!1;const n=B(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return ne.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function S(s){return`${s} ${s===1?"file":"files"}`}function ie(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function oe(s){return`Shared with all ${s}`}function ce(s){return s===1?"1 agent file":`${s} agent files`}function de(s){return`Agent files ${s} can’t see: skills, rules, commands and more.`}function ue(s){return s===1?"1 entry":`${s} entries`}function xe(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:_(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const fe={drop:"Not shared",warning:"Couldn’t read",write:"Will be written",notice:"Notice"};function me(s){return`${fe[s.kind]} · ${s.artifact} ${s.name}`}function pe(s){const t=b(),n=w();return $({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),M.success("Agent files updated.")}})}function he(s){const t=w();W("approval_resolved",()=>{t.invalidateQueries({queryKey:h.status(s)})})}function ge({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(P,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),r.length>0&&e.jsx("p",{children:ie(r.length)})]})})}function je(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something blocks them.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills only reach a few of your agents.",variant:"info",actionable:!1}:null}function ve({projectPath:s}){return he(s),null}function Ne({projectPath:s}){const{data:t}=D(s),n=pe(s),[a,r]=d.useState(!1),[l,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(ve,{projectPath:s});if(n.data!==void 0&&!l)return e.jsxs(e.Fragment,{children:[u,e.jsx(ge,{result:n.data,onDismiss:()=>c(!0)})]});const o=je(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(P,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),i>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",S(i)," DorkOS put here",e.jsx(O,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function ye(s){const t=b(),n=w();return $({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),n.setQueriesData({queryKey:h.all,predicate:r=>{var l;return((l=r.state.data)==null?void 0:l.projectPath)===a.status.projectPath}},a.status)}})}const ke={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function Se({harness:s,cell:t}){var l;const n=ae(s,t.state),a=re(t),r=(l=t.warnings)!=null&&l.length?t.warnings.join(" · "):void 0;return e.jsxs("li",{"aria-label":n,...a===void 0?{}:{title:a},className:N("text-3xs inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight",ke[te[t.state]]),children:[n,r!==void 0&&e.jsx("span",{role:"img","aria-label":"May not work",title:r,className:"inline-flex",children:e.jsx(I,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function be(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Only some agents can see it. Move it to .agents/skills to share it.":`Lives in ${n}. Move it to .agents/skills to share it.`}function we(s,t){return`dorkos harness adopt ${s} --project ${t}`}const Ce="Share with every agent";function De(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}. A link stays behind for Claude Code.`:`${a}, where every agent reads it.`}const Ae="for all your projects";function $e({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,l]=d.useState(!1),[c,u]=d.useState(!1),o=ye(n),x=B(s,t),m=le(s,t)&&!a,i=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:Ae}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!i,title:x.map(({harness:p})=>g[p]).join(" · "),onClick:()=>l(p=>!p),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[oe(x.length),e.jsx(O,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:p,cell:F})=>e.jsx(Se,{harness:p,cell:F},p))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||be(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(C,{children:we(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:Ce})}),e.jsx(q,{open:c,onOpenChange:u,children:e.jsxs(K,{children:[e.jsxs(Q,{children:[e.jsxs(U,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(Y,{children:De(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(G,{children:[e.jsx(X,{children:"Cancel"}),e.jsx(J,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const Oe="https://dorkos.ai/docs/guides/cli-usage#agent-files";function He(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{className:"h-3 w-32"}),e.jsx(A,{className:"h-3 w-48"})]},s))})]})}function Ee({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=D(s),[c,u]=d.useState(!1),o=d.useId(),x=H();if(a)return e.jsx(He,{});if(r)return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsx("p",{className:"text-destructive text-xs",children:"Couldn’t load skills."}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>void l(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Re,{status:n});const m=n.rows.filter(i=>i.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(T,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(Z,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(i=>e.jsx($e,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},_(i)))})]})}function Re({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(C,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(ee,{href:Oe,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Le({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:ce(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:de(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function Pe({rows:s,enabled:t}){const n=xe(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Le,{group:a},a.harness))})}function Te({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:ue(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:me(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function _e({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Be({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but isn’t sharing to it.`:`${g[t]} files are here, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(_e,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function Fe({projectPath:s}){const t=H(),{data:n}=D(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(Ne,{projectPath:s}),a&&e.jsx(Be,{notEnabled:a.notEnabled}),e.jsx(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Pe,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Te,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(T,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function Ie({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(Fe,{projectPath:t})}export{Ie as SkillsPage};
|
|
1
|
+
import{ae as b,aj as z,gW as h,gX as g,af as w,ag as $,cQ as M,an as W,j as e,r as d,df as O,Z as N,B as j,at as I,dD as y,dg as C,fR as q,fS as K,fT as Q,fU as U,fV as Y,fW as G,fX as X,fY as J,h as H,l as E,e3 as V,ad as Z,e as A,e6 as ee,gY as R,aa as L}from"./index-Dr-0P6rd.js";import{B as P}from"./banner-CU2Nh3Kv.js";import{P as T}from"./package-CoTlAnXZ.js";function D(s){const t=b();return z({queryKey:h.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const se={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},te={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},k="\0",ne=new Set(["native","projected"]);function _(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function ae(s,t){return`${g[s]} ${se[t]}`}function re(s){return s.reason??s.target}function B(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function le(s,t){if(t.length===0)return!1;const n=B(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return ne.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function S(s){return`${s} ${s===1?"file":"files"}`}function ie(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function oe(s){return`Shared with all ${s}`}function ce(s){return s===1?"1 agent file":`${s} agent files`}function de(s){return`Agent files ${s} can’t see: skills, rules, commands and more.`}function ue(s){return s===1?"1 entry":`${s} entries`}function xe(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:_(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const fe={drop:"Not shared",warning:"Couldn’t read",write:"Will be written",notice:"Notice"};function me(s){return`${fe[s.kind]} · ${s.artifact} ${s.name}`}function pe(s){const t=b(),n=w();return $({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),M.success("Agent files updated.")}})}function he(s){const t=w();W("approval_resolved",()=>{t.invalidateQueries({queryKey:h.status(s)})})}function ge({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(P,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),r.length>0&&e.jsx("p",{children:ie(r.length)})]})})}function je(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something blocks them.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills only reach a few of your agents.",variant:"info",actionable:!1}:null}function ve({projectPath:s}){return he(s),null}function Ne({projectPath:s}){const{data:t}=D(s),n=pe(s),[a,r]=d.useState(!1),[l,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(ve,{projectPath:s});if(n.data!==void 0&&!l)return e.jsxs(e.Fragment,{children:[u,e.jsx(ge,{result:n.data,onDismiss:()=>c(!0)})]});const o=je(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(P,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),i>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",S(i)," DorkOS put here",e.jsx(O,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function ye(s){const t=b(),n=w();return $({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(h.status(s),a.status),n.setQueriesData({queryKey:h.all,predicate:r=>{var l;return((l=r.state.data)==null?void 0:l.projectPath)===a.status.projectPath}},a.status)}})}const ke={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function Se({harness:s,cell:t}){var l;const n=ae(s,t.state),a=re(t),r=(l=t.warnings)!=null&&l.length?t.warnings.join(" · "):void 0;return e.jsxs("li",{"aria-label":n,...a===void 0?{}:{title:a},className:N("text-3xs inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight",ke[te[t.state]]),children:[n,r!==void 0&&e.jsx("span",{role:"img","aria-label":"May not work",title:r,className:"inline-flex",children:e.jsx(I,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function be(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Only some agents can see it. Move it to .agents/skills to share it.":`Lives in ${n}. Move it to .agents/skills to share it.`}function we(s,t){return`dorkos harness adopt ${s} --project ${t}`}const Ce="Share with every agent";function De(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}. A link stays behind for Claude Code.`:`${a}, where every agent reads it.`}const Ae="for all your projects";function $e({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,l]=d.useState(!1),[c,u]=d.useState(!1),o=ye(n),x=B(s,t),m=le(s,t)&&!a,i=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:Ae}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!i,title:x.map(({harness:p})=>g[p]).join(" · "),onClick:()=>l(p=>!p),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[oe(x.length),e.jsx(O,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:p,cell:F})=>e.jsx(Se,{harness:p,cell:F},p))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||be(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(C,{children:we(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:Ce})}),e.jsx(q,{open:c,onOpenChange:u,children:e.jsxs(K,{children:[e.jsxs(Q,{children:[e.jsxs(U,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(Y,{children:De(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(G,{children:[e.jsx(X,{children:"Cancel"}),e.jsx(J,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const Oe="https://dorkos.ai/docs/guides/cli-usage#agent-files";function He(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{className:"h-3 w-32"}),e.jsx(A,{className:"h-3 w-48"})]},s))})]})}function Ee({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=D(s),[c,u]=d.useState(!1),o=d.useId(),x=H();if(a)return e.jsx(He,{});if(r)return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsx("p",{className:"text-destructive text-xs",children:"Couldn’t load skills."}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>void l(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Re,{status:n});const m=n.rows.filter(i=>i.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(T,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(Z,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(i=>e.jsx($e,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},_(i)))})]})}function Re({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(C,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(ee,{href:Oe,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Le({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:ce(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:de(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function Pe({rows:s,enabled:t}){const n=xe(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Le,{group:a},a.harness))})}function Te({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:ue(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:me(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function _e({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Be({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but isn’t sharing to it.`:`${g[t]} files are here, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(_e,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function Fe({projectPath:s}){const t=H(),{data:n}=D(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(Ne,{projectPath:s}),a&&e.jsx(Be,{notEnabled:a.notEnabled}),e.jsx(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Pe,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Te,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(T,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function Ie({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(Fe,{projectPath:t})}export{Ie as SkillsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aR as F,aN as w,aS as U,aT as D,aU as L,aV as $,aW as X,r as o,j as e,aX as _,aY as p,aZ as f,a_ as j,a$ as g,b0 as k,F as E,b1 as N,b2 as B,b3 as G,b4 as O,b5 as P,b6 as V,b7 as W,b8 as Y}from"./index-
|
|
1
|
+
import{aR as F,aN as w,aS as U,aT as D,aU as L,aV as $,aW as X,r as o,j as e,aX as _,aY as p,aZ as f,a_ as j,a$ as g,b0 as k,F as E,b1 as N,b2 as B,b3 as G,b4 as O,b5 as P,b6 as V,b7 as W,b8 as Y}from"./index-Dr-0P6rd.js";import{S as Z}from"./scroll-area-XlDz8u4m.js";const q=5;function H({status:t}){switch(t){case"running":return e.jsx(E,{size:"xs",className:"text-status-info shrink-0"});case"completed":return e.jsx(W,{className:"text-status-success size-3 shrink-0","aria-hidden":!0});case"failed":return e.jsx(V,{className:"text-destructive size-3 shrink-0","aria-hidden":!0});case"cancelled":return e.jsx(P,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"skipped":return e.jsx(O,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0});case"blocked":return e.jsx(G,{className:"text-status-warning-dot size-3 shrink-0","aria-hidden":!0});default:return null}}function J(t){if(t===null)return"";if(t<1e3)return"< 1s";const n=Math.floor(t/1e3);if(n<60)return`${n}s`;const a=Math.floor(n/60),i=n%60;return`${a}m ${i}s`}function K({run:t,scheduleName:n}){return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(E,{size:"xs",className:"text-status-info shrink-0"}),e.jsx("span",{className:"truncate",children:n}),t.startedAt&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:N(t.startedAt)})]})})}function Q({schedule:t,onEdit:n}){return e.jsx(g,{children:e.jsxs(k,{onClick:()=>n(t.id),className:"text-sm",children:[e.jsx(B,{className:"text-muted-foreground/50 size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:t.name}),t.nextRun&&e.jsx("span",{className:"text-muted-foreground/50 ml-auto shrink-0 text-xs",children:N(t.nextRun)})]})})}function ee({run:t,scheduleName:n}){const a=t.status==="running"&&t.finishedAt?t.error?"failed":"completed":t.status;return e.jsx(g,{children:e.jsxs(k,{className:"text-sm",children:[e.jsx(H,{status:a}),e.jsx("span",{className:"truncate",children:n}),e.jsxs("span",{className:"text-muted-foreground/50 ml-auto flex shrink-0 items-center gap-1.5 text-xs",children:[t.durationMs!==null&&e.jsx("span",{children:J(t.durationMs)}),t.finishedAt&&e.jsx("span",{children:N(t.finishedAt)})]})]})})}function se({available:t,agentId:n}){const a=F(),i=w(s=>s.setTasksAgentFilter),R=w(s=>s.setTasksEditScheduleId),u=t,{data:x=[]}=U(u),{data:I=0}=D(u),{data:b=[]}=L(void 0,u),{data:T=[]}=$(),{openWithTemplate:y}=X(),S=[T[0],T[2]].filter(Boolean),l=o.useMemo(()=>n?x.filter(s=>s.agentId===n):x,[n,x]),d=o.useMemo(()=>{const s=new Map;for(const r of l)s.set(r.id,r.name);return s},[l]),v=o.useMemo(()=>b.filter(s=>d.has(s.scheduleId)),[b,d]),{runningRuns:A,recentRuns:M}=o.useMemo(()=>{const s=[],r=[];for(const c of v)c.finishedAt!=null||c.status!=="running"?r.push(c):s.push(c);return r.sort((c,h)=>(h.finishedAt??h.createdAt).localeCompare(c.finishedAt??c.createdAt)),{runningRuns:s,recentRuns:r.slice(0,q)}},[v]),C=o.useMemo(()=>l.filter(s=>s.enabled&&s.status==="active"&&s.nextRun).sort((s,r)=>(s.nextRun??"").localeCompare(r.nextRun??"")),[l]),m=()=>{n&&(i(n),R(null)),a.open()},z=s=>{R(s),i(null),a.open()};return l.length===0?e.jsxs("div",{className:"flex flex-col gap-3 px-3 py-4",children:[e.jsx("p",{className:"text-muted-foreground/70 text-xs",children:"No schedules yet."}),S.length>0&&e.jsx("div",{className:"space-y-2",children:S.map(s=>e.jsxs("div",{className:"rounded-lg border p-3 text-sm",children:[e.jsx("div",{className:"font-medium",children:s.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:_(s.cron)}),e.jsx("button",{type:"button",onClick:()=>{y(s),m()},className:"text-primary mt-2 text-xs hover:underline",children:"+ Use preset"})]},s.id))}),e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open schedules →"})]}):e.jsx(Z,{type:"scroll",className:"h-full",children:e.jsxs("div",{className:"pr-1",children:[A.length>0&&e.jsxs(p,{children:[e.jsxs(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:["Running",e.jsx("span",{className:"text-muted-foreground/50 ml-auto text-xs font-normal normal-case",children:I})]}),e.jsx(j,{children:A.map(s=>e.jsx(K,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),C.length>0&&e.jsxs(p,{children:[e.jsx(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Upcoming"}),e.jsx(j,{children:C.map(s=>e.jsx(Q,{schedule:s,onEdit:z},s.id))})]}),M.length>0&&e.jsxs(p,{children:[e.jsx(f,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:"Recent runs"}),e.jsx(j,{children:M.map(s=>e.jsx(ee,{run:s,scheduleName:d.get(s.scheduleId)??"Unknown"},s.id))})]}),e.jsx("div",{className:"px-3 py-2",children:e.jsx("button",{onClick:m,className:"text-muted-foreground hover:text-foreground text-xs transition-colors",children:"Open schedules →"})})]})})}function ae({member:t}){var i;const n=Y(),a=((i=t.agent)==null?void 0:i.manifestId)??null;return e.jsx("div",{className:"min-h-0 flex-1","data-slot":"profile-tasks",children:e.jsx(se,{available:n,agentId:a})})}export{ae as TasksPage};
|