dorkos 0.101.0 → 0.103.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/README.md +10 -10
- package/dist/bin/cli.js +2935 -1738
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-CwxCTicf.js → AboutPage-BNVLNd3q.js} +1 -1
- package/dist/client/assets/{ActivityRow-D0QQ0SFu.js → ActivityRow-CvjAfRBM.js} +1 -1
- package/dist/client/assets/AdapterIcon-wGSXBn-k.js +1 -0
- package/dist/client/assets/AdapterSetupWizard-CmSJ2sno.js +2 -0
- package/dist/client/assets/{AgentRequestCard-BLLmoAES.js → AgentRequestCard-D62XQXBM.js} +4 -4
- package/dist/client/assets/{AppearancePage-GqrWckTQ.js → AppearancePage-Bds0L-wm.js} +1 -1
- package/dist/client/assets/{AttentionSignalRow-sEhnIPBB.js → AttentionSignalRow-C6RkjCWK.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-BXjzhT_D.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-CerNarG-.js} +24 -24
- package/dist/client/assets/{BlintzCanvas-CXi0fvcM.js → BlintzCanvas-CUqethk_.js} +24 -24
- package/dist/client/assets/{CanvasCsvContent-QhDSf8Pd.js → CanvasCsvContent-DdbIUPMJ.js} +1 -1
- package/dist/client/assets/CanvasFileContent-CX2VNF4o.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-OprkQsgq.js +2 -0
- package/dist/client/assets/{CodeMirrorDiff-BMG7DBg2.js → CodeMirrorDiff-BnMdmI0K.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BYdz0ipX.js → CodeMirrorEditor-C7T-DaVA.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-B3QGnSxM.js +1 -0
- package/dist/client/assets/ConnectionsPage-E3br6maQ.js +11 -0
- package/dist/client/assets/{ConventionPage-y-Zq3Klp.js → ConventionPage-vMN5qEwP.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-gZKKPhaj.js → ExtensionPageRoute-DFkPAzjs.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-CbKIa11X.js → FloatingTanStackRouterDevtools-CqogiFob-BP4itJWW.js} +1 -1
- package/dist/client/assets/HandlePage-De4D_IVs.js +1 -0
- package/dist/client/assets/{LexicalField-Ceoa9flp.js → LexicalField-BbUXXxTw.js} +1 -1
- package/dist/client/assets/{ManagesPage-Dcqdm6I8.js → ManagesPage-DsNSZHug.js} +1 -1
- package/dist/client/assets/Marketplace-D4zHIIak.js +36 -0
- package/dist/client/assets/MarketplaceSourcesView-DILS8-ca.js +1 -0
- package/dist/client/assets/{McpAppFrame-B1ThSf2U.js → McpAppFrame-Cl_2azg-.js} +2 -2
- package/dist/client/assets/McpSigninBody-TpoSImsV.js +1 -0
- package/dist/client/assets/{Model3dViewer-DlcQ3-LS.js → Model3dViewer-C-iyu5eV.js} +1 -1
- package/dist/client/assets/NamePage-C-3w8oeg.js +1 -0
- package/dist/client/assets/NewDirectMessageMenu-bJE7b4lX.js +1 -0
- package/dist/client/assets/{NotificationsPage-CQQIdLtI.js → NotificationsPage-CL23qwVw.js} +1 -1
- package/dist/client/assets/OperatorIdentityForm-ixaqUfIO.js +1 -0
- package/dist/client/assets/{PermissionsPage-TX-d7aVQ.js → PermissionsPage-D4xbxTkc.js} +1 -1
- package/dist/client/assets/{PersonalityPicker-C_9JVOva.js → PersonalityPicker-CTvPlN-k.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BoTED73t.js → PersonalityPopover-Coy0eaIg.js} +1 -1
- package/dist/client/assets/PhotoPage-DpEEXO3e.js +1 -0
- package/dist/client/assets/PreviewRefusedNotice-B2GLqLYi.js +1 -0
- package/dist/client/assets/{PromptSuggestionChips-B_oUtFMI.js → PromptSuggestionChips-YdKEWyNT.js} +1 -1
- package/dist/client/assets/RoomSurface-BwIBBvYq.js +44 -0
- package/dist/client/assets/{RoomsPage-zOjjpHdA.js → RoomsPage-DaEXPz65.js} +1 -1
- package/dist/client/assets/RunsOnPopover-tvbVPKVf.js +1 -0
- package/dist/client/assets/SessionsPage-CAdV_XBY.js +1 -0
- package/dist/client/assets/SkillsPage-B4F19LmV.js +1 -0
- package/dist/client/assets/{TasksPage-BZapA_v6.js → TasksPage-BXcaEx3V.js} +1 -1
- package/dist/client/assets/ToolsPage-BYBwPql_.js +2 -0
- package/dist/client/assets/{TopologyGraph-BMcPxZsA.js → TopologyGraph-CZ2Y5I2e.js} +1 -1
- package/dist/client/assets/TourHost-BNpDrN0O.js +1 -0
- package/dist/client/assets/UnlinkDialog-Zyuh5qZY.js +1 -0
- package/dist/client/assets/{UnreadDivider-KSqqcHKN.js → UnreadDivider-Dh67_mAz.js} +1 -1
- package/dist/client/assets/_shell-lcu5vkQ7.js +98 -0
- package/dist/client/assets/{_shell._home-Bp_p1VUv.js → _shell._home-CPV1Z64k.js} +1 -1
- package/dist/client/assets/_shell._home.activity-CEvkKYBD.js +1 -0
- package/dist/client/assets/_shell._home.index-tGnRLvY-.js +3 -0
- package/dist/client/assets/{_shell._home.tasks-BsBH_4tZ.js → _shell._home.tasks-CtpZNevK.js} +1 -1
- package/dist/client/assets/_shell._home.workspaces-D6tkWdS8.js +1 -0
- package/dist/client/assets/{_shell.channels-DWAHkDPV.js → _shell.channels-DbrQXIVv.js} +4 -4
- package/dist/client/assets/_shell.connections-C3Ho4S8R.js +6 -0
- package/dist/client/assets/{_shell.feedback-requests-Hjv640j9.js → _shell.feedback-requests-D9l7SJi1.js} +1 -1
- package/dist/client/assets/_shell.marketplace-BfY-kBJk.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-B0km_EUs.js +1 -0
- package/dist/client/assets/_shell.session-O8MC-USm.js +54 -0
- package/dist/client/assets/{_shell.team-ctLQztjw.js → _shell.team-DvJK7irE.js} +4 -4
- package/dist/client/assets/_shell.x._extensionId-_-fII74H.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-_-fII74H.js +1 -0
- package/dist/client/assets/agent-attention-BvnWcLpc.js +5 -0
- package/dist/client/assets/{agent-browser-CCN16ZOz.js → agent-browser-DsDp0cSX.js} +1 -1
- package/dist/client/assets/{banner-DOm9_4l-.js → banner-Cja2VfwN.js} +2 -2
- package/dist/client/assets/{file-exclamation-point-BKzL0QhY.js → file-exclamation-point-D8KYFYSh.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-DTxMTVdP.js → highlighted-body-KPVGNVTW-Chp5pHWq.js} +1 -1
- package/dist/client/assets/{hover-card-qzuFUCaR.js → hover-card-FvX18DHP.js} +1 -1
- package/dist/client/assets/{index-Dcs6e-U_.js → index-BFPRILKF.js} +1 -1
- package/dist/client/assets/{index-CtOB9fS3.js → index-BKCteC7q.js} +1 -1
- package/dist/client/assets/index-Bbffv0TQ.js +1247 -0
- package/dist/client/assets/{index-BMOfHKE0.js → index-BhatJcNc.js} +1 -1
- package/dist/client/assets/index-BroohPSu.js +1 -0
- package/dist/client/assets/{index-DT_v3O-B.js → index-Bt4vTnDj.js} +1 -1
- package/dist/client/assets/{index-DwzSdOh3.js → index-BwkmCRvO.js} +1 -1
- package/dist/client/assets/{index-CTai_TxZ.js → index-BzS1K2wS.js} +1 -1
- package/dist/client/assets/{index-C3XnoXTY.js → index-C6F5gzX-.js} +1 -1
- package/dist/client/assets/{index-BaB-skF0.js → index-CIzSi3tA.js} +3 -3
- package/dist/client/assets/{index-BPcwoJoz.js → index-CLCbHvV5.js} +1 -1
- package/dist/client/assets/{index-DA-i3I4q.js → index-CXjobHw0.js} +1 -1
- package/dist/client/assets/{index-DgH_dl1a.js → index-CYcJ7ENW.js} +2 -2
- package/dist/client/assets/{index-3lQkXKcq.js → index-CeqzGl3y.js} +1 -1
- package/dist/client/assets/{index-DgtF-nBt.js → index-CknNaeS2.js} +1 -1
- package/dist/client/assets/{index-Bk98IpMn.js → index-CtK6WJzD.js} +1 -1
- package/dist/client/assets/{index-C8ZMfyGc.js → index-CvxLe-_3.js} +1 -1
- package/dist/client/assets/{index-CF9fqPef.js → index-D24Ttd-y.js} +4 -4
- package/dist/client/assets/{index-CIPHHziB.js → index-D6Jn2eBq.js} +1 -1
- package/dist/client/assets/{index-D3DXMH4x.js → index-DDibi3-x.js} +1 -1
- package/dist/client/assets/{index-C7B2uRgo.js → index-DElGMXW8.js} +2 -2
- package/dist/client/assets/{index-CmlaXay_.js → index-DGNJkiFb.js} +1 -1
- package/dist/client/assets/{index-WjW-NUCp.js → index-DI2T-dXr.js} +1 -1
- package/dist/client/assets/{index-CLhD0Bno.js → index-DZf_utaG.js} +1 -1
- package/dist/client/assets/{index-CTXNRyRE.js → index-D_XtXoLp.js} +1 -1
- package/dist/client/assets/{index-CDTumWMC.js → index-DjdQaKwP.js} +1 -1
- package/dist/client/assets/index-Do18O9VZ.js +1 -0
- package/dist/client/assets/{index-CVl132_4.js → index-Do1vOFrm.js} +1 -1
- package/dist/client/assets/{index-BIMClIrX.js → index-Dv1DkyeB.js} +1 -1
- package/dist/client/assets/{index-IgIVF9T_.js → index-DyvLJ_Z5.js} +1 -1
- package/dist/client/assets/index-HgvJwMGi.js +5 -0
- package/dist/client/assets/{index-DR1JT9Uz.js → index-OxwtxTFo.js} +3 -3
- package/dist/client/assets/index-QSDTjavn.js +1 -0
- package/dist/client/assets/{index-DOxEmnH2.js → index-ZLdoJdwS.js} +1 -1
- package/dist/client/assets/index-_GlgFH88.css +1 -0
- package/dist/client/assets/{index-CScfHuKF.js → index-euarUu2E.js} +1 -1
- package/dist/client/assets/{index-B-z7hA9x.js → index-jYh6X22t.js} +1 -1
- package/dist/client/assets/{index-CIfwPLXd.js → index-uQ1vTS05.js} +1 -1
- package/dist/client/assets/{index-CejezM4U.js → index-xfBvKz-h.js} +1 -1
- package/dist/client/assets/{index-BW5ce4t8.js → index-znQ5q2gV.js} +1 -1
- package/dist/client/assets/{layers-CJHXSEKK.js → layers-8-cbYlfw.js} +1 -1
- package/dist/client/assets/{lightbulb-DWjxw7lb.js → lightbulb-DoB0IKly.js} +1 -1
- package/dist/client/assets/{mention-pill-akMU3IVs.js → mention-pill-BHC6tMG9.js} +1 -1
- package/dist/client/assets/{message-square-off-DEagHpQY.js → message-square-off-CEHuZJtY.js} +1 -1
- package/dist/client/assets/{owner-notice-CLsx0s7q.js → owner-notice-dtDSKfGs.js} +1 -1
- package/dist/client/assets/{page-container-W7byjRmk.js → page-container-BOrdASM1.js} +1 -1
- package/dist/client/assets/primer-trigger-CC-cR5zN.js +3 -0
- package/dist/client/assets/{radio-B8Ozjv9U.js → radio-BfZPhctR.js} +1 -1
- package/dist/client/assets/{room-files-source-Bsc3YA91.js → room-files-source-BHupFaLE.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-CNcDcTvq.js → rotate-ccw-clock-BvzfP8lR.js} +1 -1
- package/dist/client/assets/{rotate-cw-xvfipJLN.js → rotate-cw-BDweizfR.js} +1 -1
- package/dist/client/assets/{scroll-area-C95q3ss7.js → scroll-area-Dph6w3a6.js} +1 -1
- package/dist/client/assets/{search-x-C6SAxw7a.js → search-x-CoFJOP2l.js} +2 -2
- package/dist/client/assets/{shield-x-DxOGc0dW.js → shield-x-BZ6rhiT0.js} +1 -1
- package/dist/client/assets/{soul-file-pg0ShYy3.js → soul-file-H8fwhgiL.js} +1 -1
- package/dist/client/assets/use-delete-binding-CUsepFIL.js +1 -0
- package/dist/client/assets/use-dev-links-DYYe0vvP.js +1 -0
- package/dist/client/assets/{use-external-adapter-catalog-B0gcY-k7.js → use-external-adapter-catalog-CAl3MNq-.js} +1 -1
- package/dist/client/assets/use-full-activity-feed-Bb7BUusp.js +1 -0
- package/dist/client/assets/use-is-below-desktop-CIgGSgoL.js +1 -0
- package/dist/client/assets/use-jump-back-in-BdLBzvDr.js +11 -0
- package/dist/client/assets/use-mesh-topology-wYtCBbF_.js +1 -0
- package/dist/client/assets/use-pending-read-9UcfnDwF.js +1 -0
- package/dist/client/assets/{use-personality-commit-OH7d0xl_.js → use-personality-commit-CaxUHrX5.js} +1 -1
- package/dist/client/assets/{use-promo-activation-BgdGasXE.js → use-promo-activation-rNaAOdoh.js} +2 -2
- package/dist/client/assets/use-pulse-freshness-CygG3s-S.js +1 -0
- package/dist/client/assets/use-room-follow-claim-BIK37Iy3.js +1 -0
- package/dist/client/assets/{use-roving-tab-list-Be60AWK3.js → use-roving-tab-list-DQgkKGzc.js} +1 -1
- package/dist/client/assets/{use-session-canvas-Bqs6IQO7.js → use-session-canvas-Dpy5BEId.js} +5 -5
- package/dist/client/assets/use-session-diagnostics-atu9cfgr.js +16 -0
- package/dist/client/assets/use-unclaimed-chats-qUI5vY5K.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261008170031_session_touches.sql +5 -0
- package/dist/drizzle/20261009171311_chat_messages.sql +41 -0
- package/dist/drizzle/20261009173712_started_by_report_back.sql +1 -0
- package/dist/drizzle/meta/20261008170031_snapshot.json +12642 -0
- package/dist/drizzle/meta/20261009171311_snapshot.json +12906 -0
- package/dist/drizzle/meta/20261009173712_snapshot.json +12914 -0
- package/dist/drizzle/meta/_journal.json +21 -0
- package/dist/server/index.js +23608 -19236
- package/dist/server/index.js.map +2 -2
- package/package.json +6 -6
- package/dist/client/assets/AdapterIcon-CL-MyyKy.js +0 -1
- package/dist/client/assets/AdapterSetupWizard-C8HOvHLF.js +0 -2
- package/dist/client/assets/CanvasFileContent-ZZhdofR4.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-DMMMZh4o.js +0 -2
- package/dist/client/assets/ConnectionAccessLists-PW1uzcGU.js +0 -1
- package/dist/client/assets/ConnectionsPage-EwitZwOE.js +0 -11
- package/dist/client/assets/HandlePage-CL3_n1CI.js +0 -1
- package/dist/client/assets/Marketplace-DsU-q1ZZ.js +0 -36
- package/dist/client/assets/MarketplaceSourcesView-D72YoKNR.js +0 -1
- package/dist/client/assets/McpSigninBody-Btg3PnYN.js +0 -1
- package/dist/client/assets/NamePage-Bzqj4Eob.js +0 -1
- package/dist/client/assets/NewDirectMessageMenu-89yeGqvy.js +0 -1
- package/dist/client/assets/OperatorIdentityForm-BhiB9tQp.js +0 -1
- package/dist/client/assets/PhotoPage-C3fMlebQ.js +0 -1
- package/dist/client/assets/PreviewRefusedNotice-ChCgdKWN.js +0 -1
- package/dist/client/assets/RoomSurface-CgtNuYhl.js +0 -39
- package/dist/client/assets/RunsOnPopover-JTm1cYuw.js +0 -1
- package/dist/client/assets/SessionsPage-D4kyvHQf.js +0 -6
- package/dist/client/assets/SkillsPage-KYUVzuVa.js +0 -1
- package/dist/client/assets/ToolsPage-CWpHMlrR.js +0 -2
- package/dist/client/assets/TourHost-VY1-sy1Y.js +0 -1
- package/dist/client/assets/UnlinkDialog-3p38G_9q.js +0 -1
- package/dist/client/assets/_shell-DAjwimLg.js +0 -93
- package/dist/client/assets/_shell._home.activity-tk-XApvX.js +0 -1
- package/dist/client/assets/_shell._home.index-BNVhSN0y.js +0 -3
- package/dist/client/assets/_shell._home.workspaces-DuXnjQh0.js +0 -1
- package/dist/client/assets/_shell.connections-DIm3mUHy.js +0 -6
- package/dist/client/assets/_shell.marketplace-DF6Y7mc0.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-Do8cm7kq.js +0 -1
- package/dist/client/assets/_shell.session-DlN8iOl-.js +0 -43
- package/dist/client/assets/_shell.x._extensionId-0Q1rJtud.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-0Q1rJtud.js +0 -1
- package/dist/client/assets/agent-attention-Dn__3LQE.js +0 -5
- package/dist/client/assets/hand-DLUdsiuR.js +0 -6
- package/dist/client/assets/index-CQWqpw_G.js +0 -1
- package/dist/client/assets/index-D5uYwabS.js +0 -1
- package/dist/client/assets/index-DFMDv6qR.js +0 -1
- package/dist/client/assets/index-DMYBI16t.js +0 -1252
- package/dist/client/assets/index-DbbZNAKk.js +0 -5
- package/dist/client/assets/index-Dgp1LmEk.css +0 -1
- package/dist/client/assets/primer-trigger-DuM9vVnV.js +0 -3
- package/dist/client/assets/use-delete-binding-CZVeHqn0.js +0 -1
- package/dist/client/assets/use-dev-links-Df2WkCic.js +0 -1
- package/dist/client/assets/use-full-activity-feed-SYcgdMZu.js +0 -1
- package/dist/client/assets/use-is-below-desktop-C5_YenEp.js +0 -1
- package/dist/client/assets/use-jump-back-in-DWUPb1gi.js +0 -11
- package/dist/client/assets/use-mesh-topology-HLzZIgis.js +0 -1
- package/dist/client/assets/use-pending-read-BuJknrxG.js +0 -1
- package/dist/client/assets/use-pulse-freshness-BlD-dM_g.js +0 -1
- package/dist/client/assets/use-rename-session-D3MuyK-F.js +0 -1
- package/dist/client/assets/use-room-follow-claim-CyjhzbRJ.js +0 -1
- package/dist/client/assets/use-session-diagnostics-CfKdB2iY.js +0 -16
- package/dist/client/assets/use-unclaimed-chats-lqMhotUB.js +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CF9fqPef.js","assets/index-DMYBI16t.js","assets/index-Dgp1LmEk.css","assets/room-files-source-Bsc3YA91.js","assets/file-exclamation-point-BKzL0QhY.js","assets/composer-insert-BpyATrmR.js","assets/index-CejezM4U.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-xvfipJLN.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{Y as se,r as a,mP as Wt,j as i,g as Kt,hS as Gt,aa as V,Q as ee,ad as Qt,eu as K,R as ve,m6 as Ke,aD as te,mQ as oe,mR as Vt,mS as Yt,ax as Jt,mT as re,mU as je,lx as Xt,mV as Zt,U as le,mW as Ge,mX as en,mY as we,mZ as Qe,m_ as tn,m$ as nn,n0 as sn,lj as on,n1 as rn,n2 as an,ln,n3 as cn,e6 as dn,n4 as un,n5 as mn,am as fn,bc as pn,n6 as hn,n7 as gn,d9 as xn,lP as it,gV as yn,n8 as vn,n9 as bn,i2 as Y,jk as Ve,na as lt,bl as Rn,jj as ue,nb as kn,nc as wn,jm as ct,nd as Sn,jn as dt,ga as Nn,bp as ut,js as mt,B as Oe,aU as In,ne as jn,nf as Cn,bM as Ee,ng as An,hx as pe,nh as Mn,iF as ft,ni as pt,ft as Tn,aH as On,e as ae,nj as be,hj as ht,ju as gt,n as En,hw as me,nk as _n,nl as xt,fg as ne,W as yt,e$ as Pn,nm as Dn,nn as $n,no as Fn,np as Ln,l as vt,O as _e,j7 as Bn,gb as qn,nq as Hn,nr as Un,ns as zn,aV as Wn,by as Kn,nt as Gn,nu as Qn,nv as Vn,nw as Yn,bd as Ce,d4 as Jn,jd as Xn,ji as Zn,jb as es,nx as ts,ny as ns,nz as ss,nA as os,fj as rs,je as as,nB as is,nC as ls,nD as cs,nE as ds,X as us,nF as ms,nG as Ye,nH as fs,dr as ps,nI as hs,i1 as gs,nJ as xs,nK as ys,av as vs}from"./index-DMYBI16t.js";import{R as bs,A as Rs,u as ks,P as ws,a as Ss}from"./use-jump-back-in-DWUPb1gi.js";import{a as Ns}from"./use-room-follow-claim-CyjhzbRJ.js";import{f as Pe,a as bt,b as Rt,c as Is,M as Q,d as js,C as X,u as Cs,e as As,g as Ms}from"./index-DbbZNAKk.js";import{f as De,u as Ts,b as Os,D as Es,U as _s}from"./UnreadDivider-KSqqcHKN.js";import{f as Ps}from"./format-duration-BCr6uzby.js";import{H as Ds,a as $s,b as Fs}from"./hover-card-qzuFUCaR.js";import{M as Je}from"./mention-pill-akMU3IVs.js";import{R as Ls}from"./rotate-ccw-clock-CNcDcTvq.js";import{H as Bs}from"./hand-DLUdsiuR.js";import{M as qs}from"./message-square-off-DEagHpQY.js";import{m as Hs,A as Us}from"./AgentRequestCard-BLLmoAES.js";/**
|
|
3
|
-
* @license lucide-react v1.48.0 - ISC
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the ISC license.
|
|
6
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
7
|
-
*/const kt={name:"link-2-off",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]};kt.node;const zs=se(kt);/**
|
|
8
|
-
* @license lucide-react v1.48.0 - ISC
|
|
9
|
-
*
|
|
10
|
-
* This source code is licensed under the ISC license.
|
|
11
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
-
*/const wt={name:"megaphone",size:24,node:[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]]};wt.node;const Ws=se(wt);/**
|
|
13
|
-
* @license lucide-react v1.48.0 - ISC
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the ISC license.
|
|
16
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/const St={name:"power-off",size:24,node:[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};St.node;const Ks=se(St);/**
|
|
18
|
-
* @license lucide-react v1.48.0 - ISC
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the ISC license.
|
|
21
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/const Nt={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};Nt.node;const Gs=se(Nt);/**
|
|
23
|
-
* @license lucide-react v1.48.0 - ISC
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the ISC license.
|
|
26
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/const It={name:"timer",size:24,node:[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]};It.node;const Qs=se(It);/**
|
|
28
|
-
* @license lucide-react v1.48.0 - ISC
|
|
29
|
-
*
|
|
30
|
-
* This source code is licensed under the ISC license.
|
|
31
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
32
|
-
*/const jt={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};jt.node;const Xe=se(jt);/**
|
|
33
|
-
* @license lucide-react v1.48.0 - ISC
|
|
34
|
-
*
|
|
35
|
-
* This source code is licensed under the ISC license.
|
|
36
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/const Ct={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"}]]};Ct.node;const Vs=se(Ct),Ys=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 At({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,w=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),v=Wt({onLongPress:()=>{N.current&&x(!0)}});return i.jsxs(Ds,{open:y,onOpenChange:x,openDelay:Ys,children:[i.jsx($s,{asChild:!0,ref:m,"data-gesture-priority":"",...v,onPointerDown:T=>{N.current=T.pointerType==="touch"||T.pointerType==="pen",v.onPointerDown(T)},children:t}),i.jsxs(Fs,{"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(Kt,{"aria-hidden":!0,color:w,emoji:h,imageUrl:p,fallback:Gt(r),kind:o,origin:u,status:g?"working":"idle",size:"md"}),i.jsxs("div",{className:"min-w-0",children:[i.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:r}),l&&i.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",l]})]})]}),i.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[o==="agent"&&((d==null?void 0:d.runtime)||(d==null?void 0:d.model))&&i.jsx(ce,{children:[d.runtime,d.model].filter(Boolean).join(" · ")}),g&&i.jsxs(ce,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Ps(g.forMs)]}),o==="human"&&i.jsx(ce,{children:f?u.platform:"On this machine"}),o==="agent"&&(d==null?void 0:d.managedBy)&&i.jsxs(ce,{children:["Managed by"," ",d.managedBy.handle?`@${d.managedBy.handle}`:d.managedBy.displayName]})]}),s?i.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var T;(T=m.current)==null||T.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand 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 Mt(e,t={}){const s=ee();return Qt({queryKey:K.sessions(e??""),queryFn:()=>s.listRoomSessions(e),enabled:e!==null&&t.enabled===!0})}function Js(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 Xs(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 Zs(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 eo(e,t){const s=e.getQueryData(K.entries(t));return s&&s.length>0?s[s.length-1].seq:0}function to(e,t){var s;return((s=e.getQueryData(K.detail(t)))==null?void 0:s.viewerAuthorId)??null}const no=2e3;function so(){const e=a.useRef(null),t=a.useCallback(()=>{e.current!==null&&(clearTimeout(e.current),e.current=null)},[]),s=a.useCallback(o=>{t(),te.getState().endRoomCanvasCycle(o)},[t]),n=a.useCallback(o=>{t(),e.current=setTimeout(()=>{e.current=null,te.getState().endRoomCanvasCycle(o)},no)},[t]);return a.useEffect(()=>t,[t]),{arm:n,now:s}}function oo(e){const t=Math.min(oe.BACKOFF_CAP_MS,oe.BACKOFF_BASE_MS*2**e);return Math.random()*t}const ro=50;function ao(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 io(e,t){const s=ee(),n=ve(),[o,r]=a.useState(null),[l,c]=a.useState(null),[h,p]=a.useState(0),u=a.useRef(!1),d=so(),w=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)},ro))},[]);return a.useEffect(()=>{if(e===null)return;const y=()=>g();let x=null;const N=()=>{if(document.visibilityState!=="visible"){x=Date.now();return}const T=x===null?0:Date.now()-x;x=null,(u.current||T>=oe.VISIBILITY_GRACE_MS)&&g()};let m=Ke.getListConnectionState();const v=Ke.subscribeListConnectionState(T=>{const O=T==="connected"&&m==="reconnecting";m=T,O&&g()});return window.addEventListener("online",y),document.addEventListener("visibilitychange",N),()=>{window.removeEventListener("online",y),document.removeEventListener("visibilitychange",N),v(),f.current!==null&&(clearTimeout(f.current),f.current=null)}},[e,g]),a.useEffect(()=>(te.getState().setRoomCanvasLiveRoom(e),()=>te.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,v=!1;const T=()=>{m=0,u.current=!1,v&&(v=!1,r(O=>O===e?null:O))};for(;x&&!y.signal.aborted;){const O=Date.now();u.current=!1,te.getState().beginRoomCanvasCycle(e),d.arm(e);const D=setTimeout(T,oe.STABILITY_WINDOW_MS);let j;try{if(j=Vt(s,e,eo(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||(T(),!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"){Yt(S)?Jt.getState().observe(e,S):(re.getState().observe(e,S),te.getState().applyRoomCanvasPresence(e,S));continue}if(S.type==="reaction"){n.setQueryData(K.entries(e),_=>je(_,S.entryId,S.reactions));continue}if(S.type==="revision"){if(S.entry.roomId!==e)continue;n.setQueryData(K.entries(e),_=>Xs(_,S.entry));continue}if(S.type==="canvas"){te.getState().applyRoomCanvasFrame(e,S,to(n,e)),S.change!==void 0?d.now(e):d.arm(e);continue}re.getState().clearAuthor(e,S.entry.authorId),Zs(e,S.entry),Xt.getState().settle(e,S.entry.id),n.setQueryData(K.entries(e),_=>Js(_,S.entry))}}catch(S){if(y.signal.aborted)return;if(console.warn("[rooms] live stream dropped",{roomId:e,err:S}),Zt(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()-O>=oe.STABILITY_WINDOW_MS&&(m=0),m+=1,u.current=!0,m>=oe.DISCONNECTED_THRESHOLD&&!v&&(re.getState().clearRoom(e),r(e),v=!0),await ao(oo(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:w}}function lo(){const e=ee();return le({mutationFn:({roomId:t,authorId:s})=>e.haltRoomAgent(t,s),meta:{errorLabel:"Couldn’t stop this agent"}})}function co(){const e=ee();return le({mutationFn:({roomId:t,authorId:s})=>e.promoteHold(t,s),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function uo(){const e=ee(),t=ve();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}=Ge(c,o,r);return t.setQueryData(K.entries(s),d=>je(d,n,h)),{on:p}},mutationFn:({roomId:s,entryId:n,emoji:o,viewerAuthorId:r})=>{var h,p;const l=t.getQueryData(K.entries(s)),c=((p=(h=l==null?void 0:l.find(u=>u.id===n))==null?void 0:h.reactions)==null?void 0:p.some(u=>u.emoji===o&&u.authorIds.includes(r)))??!1;return e.toggleReaction(s,n,{emoji:o,on:c})},onError:(s,{roomId:n,entryId:o,emoji:r,viewerAuthorId:l},c)=>{c!==void 0&&t.setQueryData(K.entries(n),h=>{var d;const p=(d=h==null?void 0:h.find(w=>w.id===o))==null?void 0:d.reactions,{reactions:u}=Ge(p,r,l,!c.on);return je(h,o,u)})},onSuccess:({frequents:s},{roomId:n})=>{t.setQueryData(K.detail(n),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function Z(e){return e.threadRootEntryId??e.parentEntryId}function Tt(e){return Z(e)??e.id}function $e(e,t){return Math.max(t??0,e)}function mo(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 fo(e){const t=ee(),s=ve(),n=en(e),o=we(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=we.getState().paging[u])==null?void 0:x.cursor;if(d==null)return;const w=await t.listRoomEntries(u,{before:d,limit:Qe}),f=K.entries(u),g=s.getQueryData(f),y=tn(g,w);s.setQueryData(f,y),we.getState().notePage(u,nn(w)??d,sn(w,Qe)||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}}const po={turn_failed:{Icon:fn,tone:"text-status-warning"},agent_busy:{Icon:mn},agent_gone:{Icon:Vs,tone:"text-status-warning"},agent_left:{Icon:Xe,tone:"text-status-warning"},room_archived:{Icon:un},runtime_gone:{Icon:Ks,tone:"text-status-warning"},agent_declined:{Icon:qs},agent_unavailable:{Icon:dn},awaiting_approval:{Icon:Bs,tone:"text-status-warning"},halted:{Icon:cn},budget_reached:{Icon:ln},cascade_stopped:{Icon:an},addressing_changed:{Icon:Ws},bridge_blocked:{Icon:rn,tone:"text-status-warning"},bridge_undelivered:{Icon:on,tone:"text-status-warning"},bridge_rate_limited:{Icon:Qs},bridge_second_agent_refused:{Icon:Xe},bridge_disconnected:{Icon:zs},bridge_agent_swapped:{Icon:bs},bridge_history_note:{Icon:Ls}},ho={Icon:pn},Se=80;function go(e){const t=e.trim();if(t.length<=Se)return t;const s=t.slice(0,Se),n=s.lastIndexOf(" ");return`${(n>Se/2?s.slice(0,n):s).trimEnd()}…`}function xo(e,t,s){const n=yo(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 session")]}):i.jsxs(i.Fragment,{children:[e.slice(0,n.index),o(n.words),e.slice(n.index+n.words.length)]})}function yo(e,t){if(t!==void 0){const n=hn(t),o=e.lastIndexOf(n);if(o!==-1)return{index:o,words:n}}const s=gn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function vo({entry:e,feedPosition:t,rowId:s,sessionLink:n,subjectName:o}){const{Icon:r,tone:l}=(e.body.notice&&po[e.body.notice])??ho;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":go(e.body.text)},...De(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?xo(e.body.text,n,o):e.body.text})]})}const bo=xn.moment;function Ro({entry:e,moment:t,subject:s,subjectIdentity:n,feedPosition:o,rowId:r}){const l=Pe(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}`,...De(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(At,{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(bt,{author:s}),i.jsx("span",{className:"sr-only",children:s.displayName})]})}),i.jsx(bo,{"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 ko({id:e,summary:t,open:s,onOpen:n}){const{capabilities:o}=it(),{count:r,lastAt:l,unread:c}=t,h=Pe(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 wo(e,t){const s=ue.getState(),n=s.drafts[e]??"",o=n===""||n.endsWith(" ")||n.endsWith(`
|
|
38
|
-
`)?"":" ";s.set(e,`${n}${o}@${t} `)}function So({roomId:e,entry:t,author:s,viewerAuthorId:n,onViewProfile:o}){const r=Tt(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}=yn({toastOnSettle:!0});return a.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Gs,run:()=>{Y.getState().openThread(e,r,!0),Ve.getState().requestFocus(lt(e,r))}},copy:{id:"copy",label:"Copy text",icon:bn,run:()=>void p(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:Rn,run:o}),c!==void 0&&(u.mention={id:"mention",label:h===void 0?"Mention author":`Mention ${h}`,icon:Rs,run:()=>{wo(e,c),Ve.getState().requestFocus(e)}}),vn.map(d=>u[d]).filter(d=>d!==void 0)},[e,r,l,c,h,o,p])}function No(e){return i.jsx(wn,{code:e.code,isIncomplete:e.isIncomplete})}const Io=[{language:kn,component:No}];function jo(e){if(e.kind==="notice")return{kind:"notice"};const t=e.body.moment;return t?{kind:"moment",moment:t}:{kind:"message"}}function Fe(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 he(e,t){const s=e.body.subjectAuthorId;return s===void 0||t.has(e.authorId)?e.authorId:s}function J(e,t,s){const n=t.get(e),o=ct({record:{kind:(n==null?void 0:n.kind)??"system",id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:n==null?void 0:n.emoji,color:n==null?void 0:n.color,imageUrl:n==null?void 0:n.imageUrl},override:(n==null?void 0:n.agentRef)===void 0?null:s==null?void 0:s.get(n.agentRef)});return{kind:o.kind,id:e,displayName:(n==null?void 0:n.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(n==null?void 0:n.origin)=="object"&&(n==null?void 0:n.origin)!==null,...(n==null?void 0:n.retired)===!0?{retired:!0}:{}}}function Co(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 ge(e){return`thread-row-${e}`}function Ae(e){return`thread-panel-entry-${e}`}function xe(e){return`room-entry-${e}`}function Le(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:xe(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:ge(n)}:o}function Ao(e,t){if(t===null)return null;const s=e.find(n=>n.seq===t);return s===void 0?null:Le(e,s.id)}const Ze=48;function Et(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>Ze?`${r.slice(0,Ze).trimEnd()}…`:r}}function Mo(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 To(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 _t({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(()=>Mo(t,n.data??{}),[t,n.data]),r=a.useMemo(()=>To(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 Eo(){return a.useContext(Be).faces}function _o({loading:e,onLoad:t}){return i.jsx("div",{className:"flex justify-center px-4 py-3",children:i.jsxs(Oe,{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 Po({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,...De(c)}}const fe=120,Do="code block";function $o(e){if(e.length<=fe&&!e.includes("```"))return null;const t=Fo(e);return t.length===0?null:t}function Fo(e){const t=e.replace(/```[\s\S]*?(?:```|$)/g,` ${Do} `).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<=fe)return t;const s=Lo(t,fe),n=s.lastIndexOf(" ");return`${(n>fe/2?s.slice(0,n):s).trimEnd()}…`}function Lo(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 Bo({roomId:e,entry:t,viewerAuthorId:s,reactionFrequents:n,streamStalled:o,isMember:r=!0}){const l=uo(),c=o===!0||!r,h=a.useMemo(()=>t.reactions??[],[t.reactions]),p=a.useMemo(()=>h.filter(w=>jn(w,s)).map(w=>w.emoji),[h,s]),u=a.useCallback(w=>l.mutate({roomId:e,entryId:t.id,emoji:w,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 qo({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 Ho(e,t){var d,w;const s=t.body.subjectAuthorId,n=t.body.notice,o=t.kind==="notice"&&n!==void 0&&s!==void 0&&Cn.includes(n),r=Mt(e,{enabled:o}),l=Ee(),c=ve(),h=ee(),p=o?((w=(d=r.data)==null?void 0:d.bindings.find(f=>f.authorId===s))==null?void 0:w.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)&&An({queryClient:c,transport:h},e,s).then(g=>{g.kind!=="none"&&l(pe({session:g.kind==="bound"?g.sessionId:p}))}))},[s,l,c,e,p,h]);return a.useMemo(()=>p===null?null:{href:Mn({session:p}),onOpen:u},[u,p])}const ye="mention",He="author_id",Uo={[ye]:[He]},zo=[ye];function Wo(e,t){if(!t||t.length===0)return e;const s=Ko(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}<${ye} ${He}="${c}">${p}</${ye}>${u}`}return n}function Ko(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 Go=new Map,Pt=a.createContext(Go);function Qo({authors:e,children:t}){return i.jsx(Pt.Provider,{value:e,children:t})}function Vo(e){const t=a.useContext(Pt);return e===void 0?void 0:t.get(e)}function Yo(e){return typeof e=="string"?e.replace(/^@/,""):""}function Jo({authorId:e,children:t}){const s=Vo(e),n=Me(s==null?void 0:s.agentRef),{open:o}=ft();if(!s)return i.jsx(Je,{kind:"human",label:Yo(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(At,{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(Je,{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 Xo(e){return{mention:t=>{const s=t[He],n=typeof s=="string"?s:void 0;return!n||!e.has(n)?i.jsx(i.Fragment,{children:t.children}):i.jsx(Jo,{authorId:n,children:t.children})}}}function Zo({entry:e,authors:t}){const s=a.useMemo(()=>Wo(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(()=>Xo(n),[n]);return i.jsx(Qo,{authors:t,children:i.jsx(Tn,{content:s,className:"msg-prose",allowedTags:Uo,literalTagContent:zo,components:o,renderers:Io})})}function er(e){return function(s){return i.jsx(Zo,{entry:s,authors:e})}}const Dt="the top folder";function et(e){return e.slice(e.lastIndexOf("/")+1)}function tr(e){const t=e.lastIndexOf("/");return t===-1?"":e.slice(0,t)}function nr(e){return e===""?Dt:`${e}/`}function Ne(e){return e.target!==void 0?e.target===""?Dt:e.target:nr(tr(e.paths[0]??""))}function sr(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 ${et(s)} to ${Ne(e)}`:`${t} uploaded ${e.pathCount} files to ${Ne(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 ${et(s)} from the chat to ${Ne(e)}`}}const or=a.lazy(()=>On(()=>import("./index-CF9fqPef.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(e=>({default:e.SaveToRoomFilesButton})));function $t({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:w,feedPosition:f,rowId:g}){const y=Pe(t.createdAt),x=a.useMemo(()=>{const G=$o(t.body.text),ke=Is(t.attachments??[]);if(ke===null)return G;const We=G??t.body.text.trim();return We.length>0?`${We} ${ke}`:ke},[t.body.text,t.attachments]),N=a.useId(),m=`${N}-author`,v=`${N}-content`,T=`${N}-summary`,O=a.useRef(null),D=a.useRef(null),j=a.useRef(null),{reactions:S,toggle:_,quickRow:I}=Bo({roomId:e,entry:t,viewerAuthorId:r,reactionFrequents:c,streamStalled:h,isMember:p}),F=Me(n==null?void 0:n.agentRef),{open:$}=ft(),E=n===void 0?void 0:pt(n,F==null?void 0:F.memberId),q=a.useCallback(()=>{E!==void 0&&$(E)},[$,E]),L=E===void 0?void 0:q,H=So({roomId:e,entry:t,author:n,viewerAuthorId:r,onViewProfile:L}),W=qo({barRef:D,pillsRef:j,hasReactions:S.length>0}),B=a.useCallback(()=>{var G;return(G=O.current)==null?void 0:G.focus()},[]),U=a.useMemo(()=>er(o),[o]),k=a.useCallback(G=>i.jsx(a.Suspense,{fallback:null,children:i.jsx(or,{roomId:e,attachment:G})}),[e]),b=Eo(),P=t.body.subjectAuthorId??t.authorId,M=o.get(P),R=Me(M==null?void 0:M.agentRef),A=Ho(e,t),C=jo(t);if(C.kind==="notice")return i.jsx(vo,{entry:t,feedPosition:f,rowId:g,sessionLink:A,subjectName:M==null?void 0:M.displayName});if(C.kind==="moment")return i.jsx(Ro,{entry:t,moment:C.moment,subject:P===t.authorId?s:J(P,o,b),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 z=u.position==="first"||u.position==="only";return i.jsxs(Q.Root,{ref:O,id:g,position:u.position,actions:H,reactions:I,"data-testid":"room-entry",tabIndex:0,...Po({showAuthorHeader:z,headerId:m,displayName:s.displayName,time:y,summary:x,contentId:v,summaryId:T,feedPosition:f}),onKeyDown:W,children:[i.jsx(Q.Gutter,{author:s,at:t.createdAt,onViewProfile:L,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"}),w!=null&&i.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${w.excerpt}”`}),i.jsx(Q.Content,{id:v,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:sr(t.body.fileChange,(M==null?void 0:M.displayName)??"Somebody")}):U(t,{rowId:t.id,isStreaming:!1})}),x!==null&&i.jsx("span",{id:T,className:"hidden",children:x}),i.jsx(Q.Attachments,{items:t.attachments??[],renderAction:p?k:void 0}),i.jsx(Q.Reactions,{ref:j,reactions:S,viewerAuthorId:r,names:l,frequents:c,onToggle:_,disabled:h===!0||!p,onExit:B}),i.jsx(Q.Actions,{actions:H,reactions:I,barRef:D,onExit:B})]})]})}const rr="room-load-older",ar=4;function Ft({roomName:e}){return i.jsx(js,{label:e===void 0?"Conversation":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:ar},(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 ir({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:w,onOpenThread:f,resumeRow:g,landOnRow:y,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:m=!1,onLoadOlder:v,ref:T}){const O=a.useMemo(()=>Fe(o,r),[o,r]),D=be(o,s),j=qe(),S=a.useMemo(()=>new Map([...O].map(([b,P])=>[b,P.displayName])),[O]),_=ht(),I=gt(e,null),{topLevel:F,repliesByRoot:$,orphaned:E}=a.useMemo(()=>Co(n),[n]),q=a.useMemo(()=>new Map(n.map(b=>[b.id,b])),[n]),L=a.useMemo(()=>{const b=Ts(F,l),P=Os(F.map(R=>({id:R.id,authorId:R.body.moment?`moment:${R.id}`:R.authorId,timestamp:R.createdAt})),{now:_,lastSeenId:b.lastSeenId,unreadFromStart:b.fromStart}),M=[];N&&!p&&M.push({kind:"load-older",id:rr});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=F[R.index];M.push({kind:"message",id:A.id,entry:A,grouping:R.grouping,position:R.index+1,answers:Et(A,F[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},[F,$,q,l,_,N,p]),H=a.useMemo(()=>L.map(b=>b.kind==="load-older"?{kind:"notice",id:b.id,at:"",body:null}:b.kind==="day-divider"?{kind:"day-divider",id:b.id,label:b.label}:b.kind==="unread-divider"?{kind:"unread-divider",id:b.id}:b.kind==="thread-reply"?{kind:"thread-reply",id:b.id,rootId:b.rootId,replyCount:$e(b.replies.length,b.totalReplies),lastAt:b.replies[b.replies.length-1].createdAt}:{kind:"message",id:b.id,payload:b.entry,grouping:b.grouping,author:J(he(b.entry,O),O,j.faces),at:b.entry.createdAt}),[L,O,j.faces]),W=a.useCallback((b,P)=>{const M=L[P.index];if(M.kind==="load-older")return v===void 0?null:i.jsx(_o,{loading:m,onLoad:v});if(M.kind==="day-divider")return i.jsx(Es,{label:M.label});if(M.kind==="unread-divider")return i.jsx(_s,{});if(M.kind==="thread-reply"){if(P.onOpenThread===void 0)return null;const A=P.onOpenThread;return i.jsx(ko,{id:ge(M.rootId),summary:mo(M.replies,l,M.totalReplies),open:w===M.rootId,onOpen:()=>A(M.rootId)})}const R=he(M.entry,O);return i.jsx($t,{roomId:e,entry:M.entry,author:J(R,O,j.faces),authorRef:O.get(R),authors:O,viewerAuthorId:s,authorNames:S,reactionFrequents:c,streamStalled:h,isMember:D,grouping:M.grouping,orphanedReply:E.has(M.entry.id),answers:M.answers,feedPosition:{index:M.position,total:-1},rowId:xe(M.entry.id)})},[L,e,O,j.faces,s,S,c,h,D,E,l,w,m,v]),B=a.useCallback(b=>{if(b.kind==="message")return xe(b.id);if(b.kind==="thread-reply")return ge(b.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 this conversation"}),i.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const U=o.some(b=>b.author.kind==="agent"),k=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:U?"Say something to get it going.":"Nothing answers until you add an agent."}),i.jsx(Oe,{type:"button",size:"sm",variant:U?"ghost":"default",onClick:d,className:"mt-1",children:U?"Add more agents":"Add agents"})]});return i.jsx(_t,{known:j,children:i.jsx(X.Timeline,{ref:T,conversationId:e,label:`Messages in ${t}`,rows:H,renderRow:W,onOpenThread:f,domIdOf:B,...g===void 0?{}:{resumeRow:g},...y===void 0?{}:{landOnRow:y},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:p?i.jsx(Ft,{roomName:t}):void 0,empty:k,feedTestId:"room-timeline"})})}const Ue={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function lr(e){const t=ee(),[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(v=>v.id===m.id)?{...m,status:"uploading"}:m));const g=N=>{n(m=>m.map(v=>v.status==="uploading"?{...v,progress:N.percentage}:v))},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()},[]),w=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:w,hasPendingFiles:s.length>0,hasFailedUpload:s.some(f=>f.status==="error"),isUploading:u.isPending}}function Lt(e){const{room:t,threadRootId:s}=e,n=Cs(),o=As(),r=lr((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:w,hasFailedUpload:f,isUploading:g}=r,y=a.useMemo(()=>({staged:w,add:h,remove:p,retry:u,cancel:d,hasFailed:f,isUploading:g,holdsSendWhileUploading:!1}),[w,f,g,h,p,u,d]),x=a.useCallback(async m=>{const{attachments:v,post:T,reply:O,room:D,threadRootId:j}=c.current;if(D===void 0)throw new Error("That conversation is not loaded yet.");if(D.archived)throw new Error("This conversation is archived.");me.getState().recordOpened("room",D.id);const S=_n(),_=v.pendingFiles.map(E=>E.file.name),I=v.pendingFiles.map(E=>E.id),F=await v.uploadAndGetIds();v.clearFiles(I);const $=m.parentEntryId??j;if($!==void 0){O.mutate({roomId:D.id,rootEntryId:$,text:m.text,clientId:S,attachmentIds:F,attachmentNames:_});return}T.mutate({roomId:D.id,text:m.text,clientId:S,attachmentIds:F,attachmentNames:_})},[]);return{target:a.useMemo(()=>({kind:"room",id:(t==null?void 0:t.id)??"",placeholder:t===void 0?"Message…":s===void 0?`Message ${ne(t)}…`:"Reply in this thread…",canSend:t!==void 0&&!t.archived&&l,...t===void 0?{canSendReason:"Still opening this conversation…"}:t.archived?{canSendReason:"This conversation 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 cr(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=Le(n,g.id);if(y===null)return null;const x=Z(g)??null,N=x!==null&&y.rowId!==g.id;return{roomRowId:y.rowId,threadRootId:N?x:null,entryId:g.id}},[n,s]),c=a.useRef(null),h=(l==null?void 0:l.threadRootId)??null;a.useEffect(()=>{r===null||h===null||c.current!==r&&(c.current=r,Y.getState().openThread(t,h))},[r,t,h]);const p=a.useRef(null);a.useEffect(()=>{r===null||!o||l===null&&p.current!==r&&(p.current=r,yt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=a.useRef(null),d=a.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),w=a.useRef(null),f=a.useCallback(()=>{if(!(r===null||w.current===r))return w.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 dr(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 ur=600;function mr(e){return document.getElementById(ge(e))??document.getElementById(xe(e))}function fr(){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()+ur;let r=!1;const l=()=>{if(r)return;const h=document.activeElement;if(h===null||h===document.body||!h.isConnected){const u=mr(s);if(u!==null){u.focus();return}}Date.now()>=o||(n=requestAnimationFrame(l))};n=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(n)}},[])}}function pr({roomId:e,route:t,urlThreadId:s,openThreadId:n,entries:o,historyLoaded:r}){const l=Pn(),c=a.useRef(null);a.useEffect(()=>{if(e!==null){if(c.current!==e&&(c.current=e,s!==void 0)){Y.getState().openThread(e,s);return}if(r&&n!==void 0){const h=o.find(u=>u.id===n),p=h===void 0?void 0:Tt(h);if(p!==void 0&&p!==n){const u=Y.getState().open[e];Y.getState().openThread(e,p,(u==null?void 0:u.focusComposer)??!1);return}}n!==s&&(l==null||l({to:t,search:h=>({...h,thread:n}),replace:!0}))}},[e,t,n,s,o,r,l])}const hr=6,Bt="jump-back-in-listbox";function ze(e){return`jump-back-in-item-${e}`}const gr='[role="combobox"]';function ie(e){return e instanceof Element&&e.matches(gr)}function xr({value:e,yieldToPalette:t=!1,enabled:s=!0}){const n=Ee(),o=Dn(),[r,l]=a.useState(!1),[c,h]=a.useState({stamp:"",index:0}),[p,u]=a.useState(!1),[d,w]=a.useState(!1);e.length>0&&!d&&w(!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(k=>k.projectPath),[g]),{data:x}=mt(y,{enabled:s}),N=a.useMemo(()=>x??{},[x]),m=a.useMemo(()=>$n(y,N),[y,N]),v=a.useMemo(()=>new Map(y.map(k=>[dt(k),k])),[y]),T=a.useCallback(k=>Fn({room:k,agentsByPath:N,pathByAgentRef:v}),[N,v]),O=a.useMemo(()=>Ln(o.muted),[o.muted]),{items:D}=ks({mutedRoomIds:O,enabled:s}),j=a.useMemo(()=>D.slice(0,hr),[D]),S=s&&r&&!p&&!d&&!t&&e.length===0&&j.length>0,_=`${S}:${j.length}`,I=c.stamp===_?c.index:0,F=a.useCallback(k=>{f.current&&ie(k.target)&&(u(!1),w(!1),l(!0))},[]),$=a.useCallback(k=>{ie(k.target)&&l(!0)},[]),E=a.useCallback(k=>{ie(k.target)&&l(!1)},[]),q=a.useCallback(k=>{j.length!==0&&h(b=>{const P=b.stamp===_?b.index:0;return{stamp:_,index:(P+k+j.length)%j.length}})},[j.length,_]),L=a.useCallback(()=>q(1),[q]),H=a.useCallback(()=>q(-1),[q]),W=a.useCallback(()=>{u(!0)},[]),B=a.useCallback(k=>{if(u(!0),k.kind==="session"){me.getState().recordOpened("session",k.session.id),k.session.cwd&&me.getState().recordOpened("agent",k.session.cwd),n(pe({dir:k.session.cwd??void 0,session:k.session.id}));return}me.getState().recordOpened("room",k.room.id),n({...vt.channels(),search:{id:k.room.id}})},[n]),U=a.useCallback(()=>{const k=j[I];!S||!k||B(k)},[S,j,I,B]);return{isOpen:S,hasRows:j.length>0,rows:j,agents:N,displayNames:m,visualOf:T,selectedIndex:I,activeDescendantId:S&&j[I]!==void 0?ze(I):void 0,listboxId:S?Bt:void 0,handleFocus:F,handleBlur:E,handlePointerDown:$,moveDown:L,moveUp:H,selectHighlighted:U,selectRow:B,dismiss:W}}function qt({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:Wn(o),[o,c]);return i.jsxs("div",{id:ze(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 yr({item:e,agent:t,displayName:s,index:n,isSelected:o,now:r,onSelect:l}){const c=Bn(t,e.session.cwd??s);return i.jsx(qt,{mark:i.jsx(qn,{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 vr({item:e,visual:t,index:s,isSelected:n,now:o,onSelect:r}){return i.jsx(qt,{mark:i.jsx(Un,{room:e.room,participants:e.room.participants,visuals:zn(t)}),label:i.jsx(Hn,{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 br({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(ze(t)))==null?void 0:c.scrollIntoView)==null||h.call(c,{block:"nearest"})},[t]),i.jsx(_e.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:Bt,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(yr,{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(vr,{item:c,visual:o(c.room),index:h,isSelected:h===t,now:l,onSelect:()=>r(c)},`room-${c.id}`)})})})}const tt={people:"People",agents:"Agents"},Rr=["people","agents"];function kr(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 wr(e,t,s){const n=t.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:Sr(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 Sr(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 Nr(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 Ir=/(^|\s)@([A-Za-z0-9_.-]*)$/,Ht="mention-palette-listbox";function Te(e){return`mention-item-${e}`}function jr({members:e,viewerAuthorId:t,text:s,sectionOrder:n=Rr}){var $;const[o,r]=a.useState(!1),[l,c]=a.useState(""),[h,p]=a.useState(-1),u=Kn(s),d=a.useRef(!1),w=a.useMemo(()=>kr(e,t),[e,t]),f=a.useMemo(()=>o?wr(w,l,n):[],[w,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),v=a.useCallback((E,q)=>{const L=E.slice(0,q).match(Ir);if(!L){r(!1);return}r(!0),c(L[2]),p((L.index??0)+L[1].length)},[]),T=a.useCallback(E=>{u.write(E),d.current=!1},[u]),O=a.useCallback(E=>{d.current||v(u.read(),E)},[v,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(E=>E.disabled||E.handle===void 0?null:(d.current=!0,r(!1),Nr(u.read(),h,l,E.handle)),[h,l,u]),_=a.useCallback(()=>{const E=f[m];return E?S(E):(r(!1),null)},[f,m,S]),I=a.useCallback(()=>{d.current=!0,r(!1)},[]),F=f.some(E=>!E.disabled);return{isOpen:o,hasSelectableRows:F,rows:f,selectedIndex:m,activeDescendantId:o&&(($=f[m])==null?void 0:$.disabled)===!1?Te(m):void 0,listboxId:o?Ht:void 0,noteTextChange:T,handleCursorChange:O,moveDown:D,moveUp:j,selectHighlighted:_,selectRow:S,dismiss:I}}function Cr({rows:e,selectedIndex:t,onSelect:s}){const n=a.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const c=o[o.length-1];c&&c.section===r.section?c.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return a.useEffect(()=>{var o;(o=document.getElementById(Te(t)))==null||o.scrollIntoView({block:"nearest"})},[t]),i.jsx(_e.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:Ht,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":tt[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:tt[o]}),r.map(({row:c,index:h})=>{const p=h===t;return i.jsxs("div",{id:Te(h),role:"option","aria-selected":p,"aria-disabled":c.disabled,"data-selected":p,"data-disabled":c.disabled,onClick:()=>{c.disabled||s(c)},className:c.disabled?"flex cursor-not-allowed items-center gap-2 rounded-md px-2 py-1.5 opacity-45":"data-[selected=true]:bg-accent hover:bg-muted flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 transition-colors duration-100",children:[i.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:c.emoji}),i.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:c.label}),c.handle!==void 0&&i.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",c.handle]}),c.disabledReason!==void 0&&i.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:c.disabledReason})]},c.authorId)})]},o))})})}function Ut({room:e,threadRootId:t,focusOnMount:s,offerJumpBackIn:n,onFocusChange:o,attachments:r}){const l=t===void 0?e.id:lt(e.id,t),c=Gn(l),{target:h}=it(),p=Qn(),u=Vn(l),d=a.useRef(null),w=be(e.members,e.viewerAuthorId),f=a.useRef(!1),g=jr({members:e.members,viewerAuthorId:e.viewerAuthorId,text:c}),y=n===!0,x=xr({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]),[v,T]=a.useState(null);a.useLayoutEffect(()=>{var I;v!==null&&((I=d.current)==null||I.focusAt(v.pos))},[v]);const O=a.useCallback(I=>{I&&(m(I.value),T({pos:I.cursorPos}))},[m]),D=a.useCallback(I=>O(g.selectRow(I)),[g,O]),j=a.useCallback(()=>O(g.selectHighlighted()),[g,O]),S=()=>{if(h===null||!h.canSend||f.current)return;g.dismiss();const I=ue.getState().take(l).trim();if(I==="")return;const F=r.pendingFiles.length>0;F&&(f.current=!0),h.send({text:I}).catch(()=>{const $=ue.getState(),E=$.drafts[l]??"";$.set(l,E===""?I:`${I}
|
|
39
|
-
${E}`)}).finally(()=>{F&&(f.current=!1)})};if(!w)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(Oe,{type:"button",size:"sm",variant:"outline",disabled:p.isPending,onClick:()=>p.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>yt.success(`You joined ${ne(e)}`)}),children:Yn})]});const _=i.jsx(X.Composer,{inputRef:d,value:c,onChange:I=>{m(I),g.noteTextChange(I)},onSubmit:S,head:i.jsx("span",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:g.isOpen&&g.rows.length===0?"No one by that name.":""}),mentionPicker:i.jsx(Ce,{children:g.isOpen&&i.jsx(Cr,{rows:g.rows,selectedIndex:g.selectedIndex,onSelect:D})}),overlays:i.jsx(i.Fragment,{children:i.jsx(Ce,{children:x.isOpen&&i.jsx(br,{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?_:i.jsx("section",{className:"flex flex-col","data-testid":Jn.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:_})}function Ar({roomId:e}){const{approvals:t}=Xn(),s=Zn(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(es,{approvals:s})})}function Mr({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 Tr="An agent",nt=64,Ie=3,Or=new Set;function zt({room:e,entries:t,scope:s,laneScope:n,stalled:o,unavailable:r=!1,onRetry:l,onScrollToRow:c}){const h=Ee(),p=ts(e.id,s),u=ns(e.id,s),d=ss(e.id,s),[w,f]=a.useState(!1),g=Mt(e.id,{enabled:w}),y=os(),{mutate:x}=lo(),[N,m]=a.useState(Or),v=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]),T=co(),[O,D]=a.useState(()=>new Map),j=rs(),S=qe(),_=a.useMemo(()=>Fe(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=a.useCallback(R=>{var A;return((A=_.get(R))==null?void 0:A.displayName)??Tr},[_]),{interactions:F}=as(),$=a.useMemo(()=>F.filter(R=>R.roomId===e.id),[F,e.id]),E=a.useMemo(()=>{var A;const R={};for(const C of $){if(C.roomAuthorId===void 0)continue;const z=(A=_.get(C.roomAuthorId))==null?void 0:A.displayName;z!==void 0&&(R[C.sessionId]=z)}return R},[$,_]),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]),L=a.useMemo(()=>u.map(R=>{var C;const A=(C=j.data)==null?void 0:C.find(z=>z.id===R.behindRoomId);return{authorId:R.authorId,name:I(R.authorId),since:R.since,behind:{roomId:R.behindRoomId,title:A===void 0?null:ne(A)},othersWaiting:R.othersWaiting,severalInTheWay:R.severalInTheWay}}),[u,I,j.data]),H=a.useMemo(()=>{const R=new Set;for(const A of u)O.get(A.authorId)===A.entryId&&R.add(A.authorId);return R},[u,O]),W=a.useMemo(()=>d===null?null:{authorId:d.authorId,name:I(d.authorId)},[d,I]),B=a.useMemo(()=>Ms({capabilities:Ue,asks:$,agentNames:E,stalled:o,presence:q,held:L,silentFinish:W,turn:null}),[$,E,q,L,W,o]),U=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]),k=a.useCallback(R=>{const A=t.find(z=>z.id===R);if(A===void 0)return null;const C=A.body.text.replace(/\s+/gu," ").trim();return C.length===0?null:C.length>nt?`${C.slice(0,nt).trimEnd()}…`:C},[t]),b=a.useCallback(R=>{var A;return n==="thread"?Ae(R):((A=Le(t,R))==null?void 0:A.domId)??null},[t,n]),P=a.useMemo(()=>{const R=p.map(C=>{const z=k(C.entryId),G=b(C.entryId);return{authorId:C.authorId,author:J(C.authorId,_,S.faces),state:C.state,since:C.since,doing:is(C.activity),replyingTo:z===null||G===null?null:{entryId:C.entryId,excerpt:z,rowId:G},sessionId:U.get(C.authorId)??null}}),A=L.map(C=>({authorId:C.authorId,author:J(C.authorId,_,S.faces),state:"held",since:C.since,doing:null,replyingTo:null,sessionId:null,behind:C.behind,othersWaiting:C.othersWaiting}));return[...R,...A]},[p,L,_,S.faces,k,b,U]),M=a.useMemo(()=>{if(p.length===0)return null;const R=p.slice(0,Ie);return i.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[R.map(A=>i.jsx(bt,{author:J(A.authorId,_,S.faces),className:"ring-background size-4 ring-2"},A.authorId)),p.length>Ie&&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-Ie}`})]})},[p,_,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(ls,{ask:B.ask,...E[B.ask.sessionId]?{agentName:E[B.ask.sessionId]}:{},onOpenSession:R=>{h(pe({session:R}))},className:"border-l-0"}):void 0,peek:i.jsx(X.LivePeek,{rows:P,onScrollToRow:c,onOpenSession:R=>{h(pe({session:R}))},onOpenRoom:R=>{h({...vt.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)),T.mutate({roomId:e.id,authorId:R})},promoted:H,onStopAll:()=>y.mutate({roomId:e.id}),stopping:y.isPending,onStopAgent:v,stoppingAgents:N})})}const st=3e3;function Er(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 w=h.get(d.authorId);p.set(d.id,w!==void 0&&u-w<st?"handed-off":"dropped")}return a.useEffect(()=>{if(!s)return;o.current=new Set(e.map(w=>w.id));const d=n();for(const w of t)r.current.set(w,d);for(const[w,f]of r.current)d-f>st&&r.current.delete(w);for(const w of l.current.keys())o.current.has(w)||l.current.delete(w)}),p}function _r({kind:e}){return e==="thread-error"?i.jsxs("div",{"data-slot":"thread-notice","data-testid":"room-thread-error",className:"text-muted-foreground flex flex-col items-center gap-2 px-[var(--msg-padding-x)] py-6 text-center text-sm",children:[i.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),i.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?i.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[i.jsx(ae,{className:"h-3 w-24"}),i.jsx(ae,{className:"h-3 w-full max-w-sm"})]}):i.jsx("p",{"data-slot":"thread-notice","data-testid":"room-thread-orphan",className:"text-muted-foreground border-b px-[var(--msg-padding-x)] pb-3 text-xs italic",children:"This thread’s first message is gone. Its replies remain."})}function Pr({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:w}){const f=a.useMemo(()=>Fe(e.members,e.formerAuthors),[e.members,e.formerAuthors]),g=Lt({room:e,threadRootId:t}),y=be(e.members,e.viewerAuthorId),x=qe(),N=a.useMemo(()=>new Map([...f].map(([k,b])=>[k,b.displayName])),[f]),{root:m,replies:v}=a.useMemo(()=>{let k;const b=[];for(const P of n)P.id===t?k=P:Z(P)===t&&b.push(P);return{root:k,replies:b}},[n,t]),T=m==null?void 0:m.threadReplyCount,O=T!==void 0&&T>v.length,D=m===void 0||O?-1:1+v.length,j=$e(v.length,T),S=a.useMemo(()=>new Set(v.map(k=>k.id)),[v]),_=a.useMemo(()=>({replyIds:S,inside:!0}),[S]),I=cs(e.id,_),F=gt(e.id,t),$=Er(v,I,h),E=a.useRef(null),q=a.useCallback(k=>{var b;(b=E.current)==null||b.scrollToRow(k)},[]),L=a.useRef(null);a.useEffect(()=>{var k;s||(k=L.current)==null||k.focus()},[t,s]);const H=k=>{k.key!=="Escape"||k.defaultPrevented||(k.stopPropagation(),w())},W=a.useMemo(()=>{const k=[];if(m===void 0){const b=p?"thread-error":h?"thread-orphan":"thread-waiting";k.push({kind:"notice",id:b,at:"",body:null})}else k.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:J(he(m,f),f,x.faces),at:m.createdAt});for(const b of v)k.push({kind:"message",id:b.id,payload:b,grouping:{position:"only"},author:J(he(b,f),f,x.faces),at:b.createdAt});return k},[m,v,f,x.faces,p,h]),B=a.useCallback(k=>{if(k.kind==="notice")return i.jsx(_r,{kind:k.id});if(k.kind!=="message")return null;const b=k.payload,P=m!==void 0&&b.id===m.id,M=v.findIndex(C=>C.id===b.id),R=i.jsx($t,{roomId:e.id,entry:b,rowId:Ae(b.id),author:k.author,authorRef:f.get(b.authorId),authors:f,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:o,streamStalled:r,isMember:y,grouping:{position:"only"},answers:Et(b,M<=0?m:v[M-1],C=>(m==null?void 0:m.id)===C?m:v.find(z=>z.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(b.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,v,j,$,e.id,e.viewerAuthorId,f,N,o,r,y,D]),U=a.useCallback(k=>k.kind==="message"?Ae(k.id):void 0,[]);return i.jsx(_t,{known:x,children:i.jsx(X.Root,{surface:"room",capabilities:Ue,target:g.target,anchor:"rail",children:i.jsxs("section",{ref:L,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:H,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:w,"aria-label":d?`Back to ${ne(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(ds,{"aria-hidden":!0,className:"size-4"}):i.jsx(us,{"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:ne(e)})]})]}),i.jsx(X.Timeline,{ref:E,conversationId:`thread-${t}`,label:`Thread in ${ne(e)}`,busy:!h&&!p,rows:W,renderRow:B,domIdOf:U,...u===void 0?{}:{landOnRow:u},pending:F,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),i.jsx(zt,{room:e,entries:n,scope:_,laneScope:"thread",stalled:d&&r===!0,unavailable:l,onRetry:d?c:void 0,onScrollToRow:q}),i.jsx(Ut,{room:e,threadRootId:t,attachments:g.attachments,focusOnMount:s},t)]})})})}const Re="room-thread-split",Dr=320,$r=360,Fr=40,Lr=50,Br=25;function ot(e,t){return t<=0?Br:Math.min(Math.round(e/t*1e3)/10,Lr)}function qr(e){const t=ot(Dr,e),s=Math.round((100-ot($r,e))*10)/10;return{minPct:t,maxPct:s,defaultPct:Math.min(Math.max(Fr,t),s)}}function Hr(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 Ur(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 zr(e,t){try{localStorage.setItem(e,String(Math.round(t)))}catch{}}const Wr="react-resizable-panels:room-thread-split";function Kr(){try{localStorage.removeItem(Wr)}catch{}}function Gr(){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:qr(s??0)}}const Qr=`${Re}-room`,rt=`${Re}-thread`,at=`${Re}-handle`,Vr=4;function Yr({room:e,thread:t,storageKey:s=fs.ROOM_THREAD_WIDTH}){const{ref:n,element:o,width:r,sizing:l}=Gr(),[c,h]=a.useState(()=>Ur(s)),[p,u]=a.useState(null),d=a.useRef(null),w=Hr(c,r,l),f=r===null||(l.maxPct-l.minPct)/100*r<Vr,g=t!==!1;a.useEffect(Kr,[]);const y=a.useRef(!1);a.useLayoutEffect(()=>{var v;y.current&&((v=d.current)==null||v.resize(w))},[w,g]);const x=a.useRef(null),N=()=>{var D;const v=(D=d.current)==null?void 0:D.getSize(),T=x.current;if(x.current=null,v===void 0||r===null||r<=0||T===v)return;const O=Math.round(v/100*r);h(O),zr(s,O)},m=p??w;return a.useLayoutEffect(()=>{const v=o==null?void 0:o.querySelector(`[data-panel-resize-handle-id="${at}"]`);v&&(v.setAttribute("aria-controls",rt),v.setAttribute("aria-valuenow",String(Math.round(m))),v.setAttribute("aria-valuemin",String(Math.round(l.minPct))),v.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),i.jsx("div",{ref:n,className:"h-full overflow-hidden",children:i.jsxs(ms,{direction:"horizontal",id:Re,onLayout:v=>{y.current=v.length>1,u(y.current?v[1]:null)},children:[i.jsx(Ye,{id:Qr,order:1,className:"flex",children:e}),g&&i.jsxs(i.Fragment,{children:[i.jsx(ws,{id:at,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:f,onDragging:v=>{var T;v&&(x.current=((T=d.current)==null?void 0:T.getSize())??null)},onKeyDownCapture:v=>{var T,O;f||(x.current=((T=d.current)==null?void 0:T.getSize())??null,!(v.key!=="Home"&&v.key!=="End")&&(v.preventDefault(),(O=d.current)==null||O.resize(v.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),i.jsx(Ye,{ref:d,id:rt,order:2,defaultSize:w,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:t})]})]})})}function ca({roomId:e,threadId:t,entrySeq:s,threadRoute:n,aboveTimeline:o,aboveComposer:r,offerJumpBackIn:l,onComposerFocusChange:c}){const h=ps(),p=Ss(),u=hs(e),d=u==null?void 0:u.rootEntryId,w=fr(),f=a.useCallback(()=>{var P;const b=(P=Y.getState().open[e])==null?void 0:P.rootEntryId;Y.getState().closeThread(e),b!==void 0&&w.arm(b)},[e,w]),g=a.useCallback(b=>{Y.getState().openThread(e,b)},[e]),y=gs(e),x=xs(e),N=io(e,x.isSuccess);Ns(e);const m=y.data,v=a.useMemo(()=>x.data??[],[x.data]),T=Lt({room:m});pr({roomId:e,route:n,urlThreadId:t,openThreadId:d,entries:v,historyLoaded:x.isSuccess});const O=a.useMemo(()=>{var b;return((b=m==null?void 0:m.members.find(P=>P.author.id===m.viewerAuthorId))==null?void 0:b.lastReadSeq)??null},[m]),D=dr(e,O);ys(m,v);const j=a.useRef(null),S=a.useRef(void 0),_=a.useCallback(b=>{S.current=b},[]),I=a.useCallback(()=>S.current,[]);a.useLayoutEffect(()=>{S.current=void 0},[e]);const F=a.useCallback(b=>{var P;(P=j.current)==null||P.scrollToRow(b)},[]),$=fo(e),{loadOlder:E,cursor:q}=$,L=a.useCallback(()=>{const b=Ao(v,q);E().then(()=>{b!==null&&requestAnimationFrame(()=>{var P;return(P=j.current)==null?void 0:P.scrollToRow(b.domId)})})},[v,q,E]),H=cr({roomId:e,entrySeq:s,entries:v,historyLoaded:x.isSuccess}),W=a.useMemo(()=>d===void 0?void 0:{replyIds:new Set(v.filter(P=>Z(P)===d).map(P=>P.id)),inside:!1},[v,d]);if(y.isLoading)return i.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:i.jsx(Ft,{})});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 conversation 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(Pr,{room:m,rootEntryId:u.rootEntryId,focusComposer:u.focusComposer,entries:v,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:x.isSuccess,historyFailed:x.isError,...H.threadRow===void 0?{}:{landOnRow:H.threadRow},pushed:h,onClose:f},u.rootEntryId),U=i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o,i.jsx(ir,{ref:j,roomId:m.id,roomName:ne(m),viewerAuthorId:m.viewerAuthorId,entries:v,members:m.members,formerAuthors:m.formerAuthors,lastReadSeq:D,reactionFrequents:m.reactionFrequents,streamStalled:N.stalled,isLoading:x.isLoading,error:x.error,onAddAgents:()=>vs("add",m.id),openThreadId:d,onOpenThread:g,resumeRow:I,...H.roomRow===void 0?{}:{landOnRow:H.roomRow},onTopRow:_,canLoadOlder:$.canLoadOlder,isLoadingOlder:$.isLoadingOlder,onLoadOlder:L}),r,i.jsx(Ar,{roomId:m.id}),i.jsx(Mr,{roomId:m.id}),i.jsx(zt,{room:m,entries:v,scope:W,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:F}),i.jsx(Ut,{room:m,attachments:T.attachments,offerJumpBackIn:l,onFocusChange:c},m.id)]}),k={surface:"room",capabilities:Ue,target:T.target,anchor:"rail"};return h?i.jsx(X.Root,{...k,children:i.jsx(Ce,{initial:!1,mode:"wait",children:i.jsx(_e.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?U:B},B?`thread-${d}`:"room")})}):i.jsx(X.Root,{...k,children:i.jsx(Yr,{room:U,thread:B})})}export{At as I,Ft as R,ko as T,ca as a,ie as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as k,j as e,am as Ce,bd as Se,O as Ee,aa as N,dk as de,dl as ie,dm as ce,dn as ue,dp as fe,dq as ye,Q as we,R as Te,U as Ae,dr as me,ds as ke,dt as xe,du as Le,dv as Ie,dw as De,dx as j,dy as Oe,T as Pe,dz as Ue,dA as _e,dB as $e,dC as H,dD as Re,dE as A,dF as He,dc as pe,B as Me,dG as Be,b as ze,e as Ke,dH as qe,dI as Qe,dJ as Fe,dK as Ve,dL as Ge,dM as We}from"./index-DMYBI16t.js";const Xe={duration:.12,ease:"easeOut"},Je={type:"spring",stiffness:320,damping:28};function he({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=k.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?de.warning:de.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":d,children:[r&&e.jsx(Ce,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Se,{mode:"wait",initial:!1,children:e.jsx(Ee.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Je},exit:{opacity:0},transition:Xe,children:o},o)})]});return n?e.jsxs(ie,{open:u,onOpenChange:f,children:[e.jsx(ce,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(ue,{className:"w-64 p-2",align:"start",children:[e.jsx(fe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",ye.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 Ye=["agents"];function Ze(a){const l=we(),i=Te();return Ae({...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:Ye})}})}const be="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:L}){const I=me(),[S,b]=k.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:be,children:a}),!I&&e.jsx(he,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ie,{open:S,onOpenChange:b,children:[e.jsx(ce,{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(Be,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(ue,{className:"w-64 p-1",align:"start",children:[e.jsx(fe,{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),b(!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(),b(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:L??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function et({agent:a,onUpdate:l,className:i}){var Z,ee,te,se,ae,ne,le,oe,re;const r=me(),{data:s}=ke(),{data:d,isPending:u}=xe(),f=((Z=s==null?void 0:s.executionDefaults)==null?void 0:Z.runtime)??"claude-code",o=a.runtime??f,n=(ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.perRuntime.find(t=>t.runtime===o),{data:x}=Le(),C=Ie(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var h;return((h=d==null?void 0:d.capabilities[t])==null?void 0:h.credits)!==void 0},credits:(te=s==null?void 0:s.claudeCode)==null?void 0:te.credits,runtimeDefaultsToCredits:t=>{var h,T;return((T=(h=x==null?void 0:x.defaults)==null?void 0:h[t])==null?void 0:T.runsOn)==="credits"}}),{data:m,isError:L}=De({runtime:o,...C?{account:j}:{}}),I=a.model!=null,S=a.effort!=null,b=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,w=a.model??b??(E==null?void 0:E.value)??null,p=w?(m??[]).find(t=>t.value===w):void 0,D=(n==null?void 0:n.supportsEffort)??((se=Oe(d,o))==null?void 0:se.supportsEffort),M=D===void 0&&u,B=D!==!1,z=p?p.supportsEffort??!1:void 0,K=(ae=s==null?void 0:s.claudeCode)==null?void 0:ae.accounts,{nameFor:q,creditsEntry:ve,resolvedAccount:Q}=Pe(),F=ve??(a.account===j&&((ne=s==null?void 0:s.claudeCode)!=null&&ne.credits)?{path:s.claudeCode.credits.path}:null),v=K&&[...K.flatMap(t=>t.id===null?[]:[{id:t.id,label:q(t.path),path:t.path}]),...F?[{id:j,label:Ue,path:F.path}]:[]],g=a.account??null,V=g!==null,G=o==="claude-code"&&g===j&&((le=s==null?void 0:s.claudeCode)==null?void 0:le.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),O=s!=null&&s.claudeCode&&Q?q(Q):null,P=Ze({errorLabel:"Couldn’t change this agent’s account"}),U=k.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),ge=_e({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:b,knownModels:$e(m),knownAccounts:v,accountsUnavailable:(oe=s==null?void 0:s.claudeCode)==null?void 0:oe.accountsUnavailable,modelSupportsEffort:z,runtimeSupportsEffort:D,runtimeLabel:t=>H(t).label}),y=t=>{var h;return((h=ge.breakages.find(T=>t.includes(T.kind)))==null?void 0:h.message)??null},_=!M&&B&&z!==!1,W=a.effort??(n==null?void 0:n.effort)??null,X=H(o).label,je=o==="claude-code"&&v!==void 0&&(v.length>1||V),Ne=y(["account-unregistered"]),J=(m??[]).some(t=>t.unverified),Y=k.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:(p==null?void 0:p.displayName)??w??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:w,isSetHere:I,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:J?Y:void 0,inheritText:c&&!b?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),J&&e.jsx(Re,{id:Y}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&L&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:be,children:"Effort"}),(!r||!_)&&(S||_)&&e.jsx(he,{isSetHere:S,serverDefault:n!=null&&n.effort?A(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),M?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${X} supports`,warning:null}):B?_?e.jsx($,{label:"Effort",valueLabel:A(W),options:He.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:A(t)})),selected:W,isSetHere:S,serverDefault:n!=null&&n.effort?A(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${X}`,warning:y(["effort-unsupported-runtime"])})]}),je&&e.jsx($,{label:"Account",valueLabel:G?O??"Default":g!==null?((re=v==null?void 0:v.find(t=>t.id===g))==null?void 0:re.label)??g:O??"Default",options:(v??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":pe(t.path)})),selected:g,isSetHere:V,serverDefault:O,warning:Ne,onSelect:t=>U(t),onInherit:()=>U(null),testId:"agent-account-row",className:"col-span-full"}),G&&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(Me,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>U(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 tt="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function at({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=ze(a),{data:d}=xe();if(r)return e.jsx(Ke,{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:tt,children:"Runs on"}),e.jsxs(qe,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(Qe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Fe,{})}),e.jsx(Ve,{children:f.map(o=>e.jsx(Ge,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(et,{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(We,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:pe(i)})]})]})}export{at as RunsOnPopover};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{Y as de,gY as me,eB as xe,Q as O,r as x,gZ as pe,g_ as fe,g$ as he,g3 as ge,by as T,h0 as ve,w as be,h1 as je,h2 as ye,h3 as Se,T as _,h4 as we,h5 as Ce,h6 as Ne,h7 as ke,j as e,h8 as Re,h9 as Ae,ha as Te,hb as z,aG as V,hc as Me,bd as Ie,O as R,hd as Pe,he as Le,bP as N,dC as Ee,hf as Fe,aa as A,hg as B,hh as ze,hi as De,hj as K,aV as G,hk as Q,ff as M,cr as I,cs as P,hl as U,hm as Oe,dG as _e,hn as $,ho as q,ct as L,dk as W,hp as Ve,hq as Be,hr as Ke,hs as Ge,aP as Qe,aQ as Ue,aR as $e,aS as qe,ht as We,h as He,R as Ye,hu as Xe,e as Ze,hv as Je,I as et,hw as tt,hx as nt,V as st,W as at}from"./index-DMYBI16t.js";import{u as it}from"./use-rename-session-D3MuyK-F.js";import{S as ot}from"./scroll-area-C95q3ss7.js";import{H}from"./hand-DLUdsiuR.js";/**
|
|
2
|
-
* @license lucide-react v1.48.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Y={name:"git-fork",size:24,node:[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]};Y.node;const X=de(Y);function rt(){const t=me(),n=xe(a=>a.contextReadings),s=O(),o=x.useMemo(()=>Array.from(new Set(t.map(a=>a.runtime))),[t]),i=x.useCallback(a=>{const u={};return o.forEach((l,f)=>{var m;const d=(m=a[f])==null?void 0:m.data;if(!d)return;const b={};for(const p of d)p.contextWindow!=null&&(b[p.value]=p.contextWindow);u[l]=b}),u},[o]),r=pe({queries:o.map(a=>fe(s,{runtime:a})),combine:i});return x.useMemo(()=>{var u;const a={total:0,known:0,unknown:0,warning:0,critical:0,autoCompacted:0};for(const l of t){a.total+=1;const f=l.model?(u=r[l.runtime])==null?void 0:u[l.model]:void 0,d=he(l,{reading:n[l.id]??null,window:f});d.autoCompactedAt&&(a.autoCompacted+=1),d.status==="known"?(a.known+=1,d.severity==="warning"?a.warning+=1:d.severity==="critical"&&(a.critical+=1)):a.unknown+=1}return a},[t,n,r])}function lt(t,n,s){return t&&n!==void 0&&!s}function Z(t,n,s,o="borderLeftColor"){const i=ge()??!1,r=lt(t,s,i);return x.useMemo(()=>!r||!s?{animate:void 0,transition:void 0,pulsing:!1}:{animate:{[o]:[n,s,n]},transition:{[o]:{duration:2,repeat:1/0,ease:"easeInOut"}},pulsing:!0},[r,n,s,o])}function J({value:t,onCommit:n,onEnd:s}){const[o,i]=x.useState(!1),[r,a]=x.useState(""),u=x.useRef(null),l=x.useRef(!1),f=T(t),d=T(n),b=T(s);x.useEffect(()=>{if(!o)return;l.current=!1;const c=requestAnimationFrame(()=>{var g,v;(g=u.current)==null||g.focus(),(v=u.current)==null||v.select()});return()=>cancelAnimationFrame(c)},[o]);const m=x.useCallback(()=>{var c;i(!1),(c=b.read())==null||c()},[b]),p=x.useCallback(()=>{a(f.read()),i(!0)},[f]),h=x.useCallback(()=>{if(l.current)return;l.current=!0,m();const c=r.trim();c.length===0||c===f.read()||d.read()(c)},[m,r,f,d]),y=x.useCallback(()=>{l.current=!0,m()},[m]),w=x.useCallback(c=>{c.key==="Enter"?(c.preventDefault(),h()):c.key==="Escape"&&(c.preventDefault(),y())},[h,y]);return{isRenaming:o,renameValue:r,setRenameValue:a,inputRef:u,start:p,commit:h,cancel:y,handleKeyDown:w}}function ee(t){const n=ve(t.id,{enabled:!1,fallback:t.permissionMode})??t.permissionMode,s=be(t.runtime),o=s==null?void 0:s.permissionModes.values.find(r=>r.id===n),i=o?je(o):ye(n);return{permissionMode:n,isFullPower:i}}function te(t){var p,h;const n=Se(t.runtime),{accounts:s,nameFor:o,colorFor:i}=_(),r=we(t.id),a=t.accountId??null,u=t.account??null,l=Ce(n?t.runtime:null,{accountId:a,path:u}),{name:f,color:d}=Ne({accountId:a,path:u,accounts:s,usage:l,nameFor:o,colorFor:i});if(!n)return{visible:n,name:f,color:d,limitStatus:null,limitDisplay:null};const b=r?r.limit:((p=t.status)==null?void 0:p.limit)??null,m=(r==null?void 0:r.lifecycle)??((h=t.status)==null?void 0:h.lifecycle)??"idle";return{visible:n,name:f,color:d,limitStatus:{lifecycle:m,limit:b},limitDisplay:ke(b)}}function ne({children:t,onRename:n,onFork:s}){return!n&&!s?e.jsx(e.Fragment,{children:t}):e.jsxs(Re,{children:[e.jsx(Ae,{asChild:!0,children:t}),e.jsxs(Te,{className:"w-44",children:[n&&e.jsxs(z,{onClick:n,children:[e.jsx(V,{className:"mr-2 size-4"}),"Rename"]}),n&&s&&e.jsx(Me,{}),s&&e.jsxs(z,{onClick:s,children:[e.jsx(X,{className:"mr-2 size-4"}),"Fork session"]})]})]})}const k="font-mono select-all";function D(t){try{return new Date(t).toLocaleString([],{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return t}}function ct({session:t,expanded:n,onFork:s,className:o}){var f;const{permissionMode:i,isFullPower:r}=ee(t),a=r?"Full power":ze(i),{nameFor:u}=_(),l=t.account?u(t.account):null;return e.jsx(Ie,{initial:!1,children:n&&e.jsx(R.div,{variants:Le,initial:"initial",animate:"animate",exit:"exit",transition:Pe,className:"relative z-10 overflow-hidden","data-slot":"session-details-panel",children:e.jsxs("div",{className:A("text-muted-foreground text-2xs mx-2 space-y-1.5 px-3 pt-2 pb-2",o),children:[e.jsx(N,{label:"Session ID",align:"start",copyValue:t.id,valueClassName:k,children:t.id}),e.jsx(N,{label:"Created",align:"start",valueClassName:k,children:D(t.createdAt)}),e.jsx(N,{label:"Updated",align:"start",valueClassName:k,children:D(t.updatedAt)}),e.jsx(N,{label:"Runs on",align:"start",valueClassName:k,children:Ee(t.runtime).label}),l&&e.jsx(N,{label:"Account",align:"start",copyValue:t.account,valueClassName:k,children:l}),e.jsx(N,{label:"Origin",align:"start",valueClassName:k,children:t.originLabel??((f=Fe(t.origin))==null?void 0:f.label)??"You"}),e.jsx(N,{label:"Permissions",align:"start",valueClassName:A(k,r&&B.power),children:a}),s&&e.jsxs("button",{type:"button",onClick:d=>{d.stopPropagation(),s(t.id)},className:"hover:bg-secondary/80 text-muted-foreground/60 hover:text-muted-foreground mt-1 inline-flex items-center gap-1 rounded px-1.5 py-0.5 transition-colors duration-100","aria-label":"Fork session",children:[e.jsx(X,{className:"size-(--size-icon-xs)"}),e.jsx("span",{children:"Fork"})]})]})})})}function se({account:t,tooltip:n=!0,className:s}){return!t.visible||!t.name||!t.color?null:e.jsx(De,{color:t.color,name:t.name,tooltip:n,className:s})}function ut({session:t,isActive:n,onClick:s,onFork:o,onRename:i,isNew:r=!1}){const[a,u]=x.useState(!1),{isRenaming:l,renameValue:f,setRenameValue:d,inputRef:b,start:m,commit:p,handleKeyDown:h}=J({value:t.title,onCommit:j=>i==null?void 0:i(t.id,j)}),{isFullPower:y}=ee(t),w=K(6e4),c=x.useMemo(()=>G(t.updatedAt),[t.updatedAt,w]),g=te(t),v=g.limitDisplay,S=Q(t.id,g.limitStatus),C=g.visible&&g.color?g.name:null,E=[C,S.kind==="idle"?null:S.label].filter(Boolean).join(" · "),ae=[`Session: ${M(t.title)}`,C,v==null?void 0:v.text,S.label].filter(Boolean).map(j=>`${j}.`).join(" "),ie=x.useCallback(j=>{j.stopPropagation(),u(ue=>!ue)},[]),oe=x.useCallback(j=>{j.stopPropagation(),m()},[m]),{animate:re,transition:le,initial:ce,pulsing:F}=mt({isNew:r,borderState:S});return e.jsx(I,{children:e.jsxs(R.div,{"data-testid":"session-row",initial:ce,animate:re,transition:le,"data-pulsing":F?"true":"false","data-limit":v?v.needsAction?"action":"waiting":void 0,style:F?void 0:{borderLeftColor:S.color},className:A("group relative rounded-lg border-l-2 transition-colors duration-150",(v==null?void 0:v.needsAction)&&W.error,n?"text-foreground":"hover:bg-secondary/60"),children:[n&&e.jsx(R.div,{layoutId:"active-session-bg",className:"bg-secondary absolute inset-0 rounded-lg",transition:{type:"spring",stiffness:280,damping:32}}),e.jsx(ne,{onRename:i?m:void 0,onFork:o?()=>o(t.id):void 0,children:e.jsx(P,{asChild:!0,disabled:!E,children:e.jsxs(R.div,{onClick:s,tabIndex:-1,whileTap:{scale:.98},transition:{type:"spring",stiffness:400,damping:30},className:"relative z-10 cursor-pointer px-3 py-2",children:[e.jsx("button",{type:"button","data-slot":"session-row-open","aria-current":n?"page":void 0,"aria-label":ae,className:"absolute inset-0 cursor-pointer"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"text-muted-foreground flex items-center gap-1 text-xs",children:[v?e.jsx("span",{className:A("min-w-0 flex-1 truncate",v.needsAction&&U),children:v.text}):e.jsx("span",{className:"min-w-0 flex-1",children:c}),e.jsxs("span",{className:"flex flex-shrink-0 items-center gap-1",children:[e.jsx(Oe,{session:t}),S.kind==="pendingApproval"&&e.jsx(H,{className:"text-status-warning-fg size-(--size-icon-xs)","aria-label":"Awaiting your approval"}),y&&e.jsx(dt,{}),i&&!l&&e.jsx("button",{type:"button",onClick:oe,className:"text-muted-foreground/60 hover:text-muted-foreground rounded p-0.5 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-visible:opacity-100 max-md:p-1.5 max-md:opacity-100","aria-label":"Rename session",children:e.jsx(V,{className:"size-(--size-icon-xs)"})}),e.jsx("button",{type:"button",onClick:ie,className:A("rounded p-0.5 transition-opacity duration-150 max-md:p-1.5",a?"text-muted-foreground opacity-100":"text-muted-foreground/60 hover:text-muted-foreground opacity-0 group-hover:opacity-100 focus-visible:opacity-100 max-md:opacity-100"),"aria-label":"Session details","aria-expanded":a,children:e.jsx(R.div,{animate:{rotate:a?180:0},transition:{type:"spring",stiffness:400,damping:30},children:e.jsx(_e,{className:"size-(--size-icon-sm)"})})})]})]}),l?e.jsx("input",{ref:b,autoFocus:!0,value:f,onChange:j=>d(j.target.value),onBlur:p,onKeyDown:h,onClick:j=>j.stopPropagation(),className:"bg-background text-foreground mt-0.5 w-full rounded border px-1 text-xs outline-none","aria-label":"Session title"}):e.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[e.jsx($,{origin:t.origin,label:t.originLabel,className:"text-muted-foreground/50"}),e.jsx(q,{type:t.runtime,model:t.model,className:"text-muted-foreground/50"}),e.jsx(se,{account:g,tooltip:!1}),e.jsx("div",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",title:i?"Click the pencil icon to rename":void 0,children:M(t.title)})]})]})]})})}),e.jsx(L,{side:"right",sideOffset:8,children:E||S.label}),e.jsx(ct,{session:t,expanded:a,className:"border-border/30 border-t",...o?{onFork:o}:{}})]})})}function dt(){return e.jsxs(I,{children:[e.jsx(P,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex cursor-help","aria-label":Ve,onClick:t=>t.stopPropagation(),children:e.jsx(Be,{className:`size-(--size-icon-xs) ${B.power}`})})}),e.jsx(L,{side:"top",sideOffset:4,children:"This chat runs commands without asking."})]})}function mt({isNew:t,borderState:n}){const{animate:s,transition:o,pulsing:i}=Z(n.pulse,n.color,n.dimColor);return x.useMemo(()=>{if(!(t||i))return{initial:void 0,animate:void 0,transition:void 0,pulsing:i};const a={...t?{opacity:1,y:0}:{},...s},u={...t?{opacity:{duration:.2,ease:[0,0,.2,1]},y:{duration:.2,ease:[0,0,.2,1]}}:{},...o};return{initial:t?{opacity:0,y:-8}:void 0,animate:a,transition:u,pulsing:i}},[t,i,s,o])}function xt({session:t,isActive:n,onClick:s,onFork:o,onRename:i}){const{isRenaming:r,renameValue:a,setRenameValue:u,inputRef:l,start:f,commit:d,handleKeyDown:b}=J({value:t.title,onCommit:C=>i==null?void 0:i(t.id,C)}),m=te(t),p=m.limitDisplay,h=Q(t.id,m.limitStatus),y=[m.visible&&m.color?m.name:null,h.kind==="idle"?null:h.label].filter(Boolean).join(" · "),w=K(6e4),c=x.useMemo(()=>G(t.updatedAt),[t.updatedAt,w]),{animate:g,transition:v,pulsing:S}=Z(h.pulse,h.color,h.dimColor,"backgroundColor");return e.jsxs(I,{children:[e.jsx(ne,{onRename:i?f:void 0,onFork:o?()=>o(t.id):void 0,children:e.jsx(P,{asChild:!0,children:e.jsxs("button",{type:"button","data-testid":"session-row","data-limit":p?p.needsAction?"action":"waiting":void 0,onClick:s,className:A("flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-xs",Ke,(p==null?void 0:p.needsAction)&&W.error,n?"bg-secondary text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[e.jsx(R.span,{"aria-hidden":!0,"data-pulsing":S?"true":"false",animate:g,transition:v,style:S?void 0:{backgroundColor:h.color},className:"size-1.5 shrink-0 rounded-full"}),e.jsx(se,{account:m,tooltip:!1}),r?e.jsx("input",{ref:l,autoFocus:!0,value:a,onChange:C=>u(C.target.value),onBlur:d,onKeyDown:b,onClick:C=>C.stopPropagation(),className:"bg-background text-foreground min-w-0 flex-1 rounded border px-1 text-xs outline-none","aria-label":"Session title"}):e.jsx("span",{className:"min-w-0 flex-1 truncate",children:M(t.title)}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[h.kind==="pendingApproval"&&e.jsx(H,{className:"text-status-warning-fg size-(--size-icon-xs)","aria-label":"Awaiting approval"}),e.jsx($,{origin:t.origin,label:t.originLabel,className:"text-muted-foreground/50"}),e.jsx(q,{type:t.runtime,model:t.model,className:"text-muted-foreground/50"}),p?e.jsx("span",{className:A("text-3xs whitespace-nowrap",p.needsAction?U:"text-muted-foreground"),children:p.text}):e.jsx("span",{className:"text-muted-foreground text-3xs",children:c})]})]})})}),y&&e.jsx(L,{side:"right",sideOffset:8,children:y})]})}function pt({variant:t,session:n,isActive:s,onClick:o,onFork:i,onRename:r,isNew:a}){return t==="compact"?e.jsx(xt,{session:n,isActive:s,onClick:o,onFork:i,onRename:r}):e.jsx(ut,{session:n,isActive:s,onClick:o,onFork:i,onRename:r,isNew:a})}function ft(){const{known:t,warning:n,critical:s,autoCompacted:o}=rt(),i=n+s;if(t===0&&i===0&&o===0)return null;const r=i>0||o>0,a=r?s>0?"bg-red-500":i>0?"bg-amber-500":"bg-muted-foreground/40":"bg-emerald-500",u=r?[i>0?`${i} near full`:null,o>0?`${o} auto-compacted`:null].filter(Boolean).join(" · "):"All sessions have room.";return e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1.5 text-xs","data-testid":"fleet-context-bar",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${a}`,"aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:u})]})}function ht({activeSessionId:t,groupedSessions:n,onSessionClick:s,onForkSession:o,onRenameSession:i}){const r=x.useId();return e.jsxs(ot,{type:"scroll",className:"h-full",viewportClassName:"[&>div]:!block",children:[e.jsx(ft,{}),e.jsx(R.div,{layout:!0,children:e.jsx(Ge,{id:r,children:n.length>0?e.jsx(e.Fragment,{children:n.map(a=>{const u=n.length===1&&a.label==="Today";return e.jsxs(Qe,{children:[!u&&e.jsx(Ue,{className:"text-2xs text-muted-foreground/70 font-medium tracking-wider uppercase",children:a.label}),e.jsx($e,{children:a.sessions.map(l=>e.jsx(qe,{children:e.jsx(pt,{variant:"full",session:l,isActive:l.id===t,onClick:()=>s(l.id),onFork:o,onRename:i})},l.id))})]},a.label)})}):e.jsx("div",{className:"flex h-32 items-center justify-center",children:e.jsx("p",{className:"text-muted-foreground/60 text-sm",children:"No conversations yet"})})})})]})}function gt(t,n){return n===""?!0:(t.title??"").toLowerCase().includes(n)}function St({member:t}){var w;const n=((w=t.agent)==null?void 0:w.projectPath)??null,{sessions:s,isLoading:o,isError:i,activeSessionId:r}=We(n),a=He(),u=O(),l=Ye(),f=it(n),[d,b]=x.useState(""),m=d.trim().toLowerCase(),p=x.useMemo(()=>Xe(s.filter(c=>gt(c,m))),[s,m]);function h(c){!a||n===null||(tt.getState().recordOpened("agent",n),a(nt({dir:n,session:c})))}async function y(c){try{const g=await u.forkSession(c,void 0,n??void 0);await l.invalidateQueries({queryKey:st.listRoot}),h(g.id)}catch(g){at.error("Couldn’t branch off this conversation.",{description:g instanceof Error?g.message:"The original is untouched."})}}return o?e.jsx(Ze,{className:"h-16 w-full"}):i?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Couldn’t read ",t.displayName,"’s conversations."]}):s.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversations yet. Message ",t.displayName," to start one."]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx(Je,{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2"}),e.jsx(et,{value:d,onChange:c=>b(c.target.value),placeholder:"Search conversations","aria-label":"Search conversations",className:"h-8 pl-7 text-sm"})]}),p.length===0?e.jsxs("p",{className:"text-muted-foreground text-sm",children:["No conversation matches “",d.trim(),"”."]}):e.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:e.jsx(ht,{activeSessionId:r,groupedSessions:p,onSessionClick:h,onForkSession:c=>void y(c),onRenameSession:(c,g)=>f.mutate({sessionId:c,title:g})})})]})}export{St as SessionsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as b,ad as z,gy as h,gz as g,R as w,U as $,W as M,ah as I,j as e,r as d,dG as O,aa as N,B as j,am as K,dk as y,de as C,fG as W,fH as q,fI as Q,fJ as U,fK as G,fL as J,fM as Y,fN as V,h as H,gA as E,l as R,ep as X,a6 as Z,e as D,er as ee,gB as L,a3 as P}from"./index-DMYBI16t.js";import{B as _}from"./banner-DOm9_4l-.js";function A(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 B(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 T(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=T(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:B(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();I("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(_,{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}=A(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(_,{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(K,{"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 Ae(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 De="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=T(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:De}),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(W,{open:c,onOpenChange:u,children:e.jsxs(q,{children:[e.jsxs(Q,{children:[e.jsxs(U,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(G,{children:Ae(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(J,{children:[e.jsx(Y,{children:"Cancel"}),e.jsx(V,{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(D,{className:"h-3 w-32"}),e.jsx(D,{className:"h-3 w-48"})]},s))})]})}function Ee({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=A(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({...R.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(E,{"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(X,{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},B(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(L,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(P,{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 _e({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(L,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(P,{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 Be({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 Te({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(Be,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function Fe({projectPath:s}){const t=H(),{data:n}=A(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(Te,{notEnabled:a.notEnabled}),e.jsx(Ee,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(Pe,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(_e,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...R.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(E,{"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,2 +0,0 @@
|
|
|
1
|
-
import{Q as W,ad as Fe,U as se,R as he,eo as De,r as l,j as n,cw as F,cx as D,B as f,f as pe,hG as te,ep as L,I as G,dH as Le,dI as _e,dJ as $e,dK as Ke,dL as Be,gl as ce,bO as Ue,hH as Ve,C as Z,aa as le,a9 as ae,cr as fe,cs as xe,a3 as qe,ct as je,bP as _,dX as He,hI as de,aU as ee,fy as Ye,fz as Ge,fA as Qe,fB as We,fC as X,fE as Je,a6 as Xe,hJ as Ze,hB as en,hK as nn,hL as sn,w as tn,e as ne,hM as an,b as rn}from"./index-DMYBI16t.js";import{a as on}from"./agent-browser-CCN16ZOz.js";import{u as ve,M as Ne}from"./McpSigninBody-Btg3PnYN.js";import{R as cn}from"./rotate-cw-xvfipJLN.js";function ln(e,s){const t=W();return Fe({queryKey:["mcp-config",e,s??null],queryFn:()=>t.getMcpConfig(e,{runtime:s??void 0}),enabled:!!e,staleTime:3e4})}function be(e,s){e.invalidateQueries({queryKey:De.mcpServers(s)}),e.invalidateQueries({queryKey:["mcp-config"]})}function Se(e){const s=W(),t=he();return se({mutationFn:async({input:i,approval:a})=>a?(await s.grantApproval(a.approvalId),e(s,i,a.approvalToken)):e(s,i),onSuccess:(i,{input:a})=>{i.status==="ok"&&be(t,a.agentId)}})}function ye(){return Se((e,s,t)=>e.addAgentMcpServer(s,t?{approvalToken:t}:void 0))}function dn(){return Se((e,s,t)=>e.importAgentMcpServer(s,t?{approvalToken:t}:void 0))}function re(e){const s=W(),t=he();return se({mutationFn:({agentId:i,name:a})=>e(s,i,a),onSuccess:(i,{agentId:a})=>be(t,a)})}function un(){return re((e,s,t)=>e.removeAgentMcpServer(s,t))}function mn(){return re((e,s,t)=>e.enableAgentMcpServer(s,t))}function gn(){return re((e,s,t)=>e.disableAgentMcpServer(s,t))}function hn(){const e=W();return se({mutationFn:({agentId:s,name:t})=>e.testAgentMcpServer(s,t)})}function pn({agentId:e,serverName:s,onDone:t}){const i=ve(e,s),{start:a}=i,r=l.useRef(!1);return l.useEffect(()=>{r.current||(r.current=!0,a())},[a]),n.jsx(F,{children:n.jsxs(D,{className:"space-y-2",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Sign in to ",s]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Sign in so your agent can use this server."}),n.jsx(Ne,{flow:i,serverName:s,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>i.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Done"})}),i.state.step!=="failed"&&i.state.step!=="connected"&&n.jsx(f,{variant:"ghost",size:"sm",onClick:t,className:"focus-visible:ring-2",children:"Later"})]})})}const fn=["stdio","http","sse"],xn=/^[a-zA-Z0-9_-]+$/;function ue(e){const s={};for(const t of e.split(`
|
|
2
|
-
`)){const i=t.trim();if(!i)continue;const a=i.indexOf("=");if(a===-1)continue;const r=i.slice(0,a).trim();r&&(s[r]=i.slice(a+1).trim())}return s}function me(e){return e.trim().length?e.trim().split(/\s+/):[]}function jn(e,s){if(e.status!=="ok")return!1;const t=e.servers.find(a=>a.name===s),i=t==null?void 0:t.connection;return i!==void 0&&"authKind"in i&&i.authKind==="oauth2"}function vn({agentId:e,agentLabel:s,supportedTransports:t,onAdded:i,oauthDetectedFor:a=null}){const r=ye(),[c,u]=l.useState(!1),[g,x]=l.useState(""),[p,m]=l.useState(t[0]??"stdio"),o=t.includes(p)?p:t[0]??"stdio",[j,C]=l.useState(""),[b,k]=l.useState(""),[v,z]=l.useState(""),[y,M]=l.useState(""),[P,A]=l.useState(""),[O,R]=l.useState(null),[T,I]=l.useState(null),[J,U]=l.useState(null),[K,V]=l.useState(null),B=xn.test(g)&&g.length<=64,q=o==="stdio"?j.trim().length>0:y.trim().length>0,d=B&&q&&!r.isPending,N=l.useCallback(()=>o==="stdio"?{transport:"stdio",command:j.trim(),args:me(b),env:ue(v)}:{transport:o,url:y.trim(),headers:ue(P)},[o,j,b,v,y,P]),w=l.useCallback(()=>({agentId:e,name:g.trim(),connection:N()}),[e,g,N]),E=l.useCallback(()=>{u(!1),R(null),I(null),x(""),m(t[0]??"stdio"),C(""),k(""),z(""),M(""),A("")},[t]),oe=l.useCallback(h=>{i({name:h.name,transport:h.connection.transport}),E()},[i,E]),H=l.useCallback((h,S)=>{const Ie=jn(h,S.name);oe(S),Ie&&U(S.name)},[oe]),Ee=l.useCallback(async()=>{I(null);const h=w();try{const S=await r.mutateAsync({input:h});S.status==="approval_required"?R(S.approval):H(S,h)}catch(S){I(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,H]),ze=l.useCallback(async()=>{if(!O)return;I(null);const h=w();try{const S=await r.mutateAsync({input:h,approval:O});S.status==="ok"?H(S,h):I("The server still needs approval. Try again.")}catch(S){I(S instanceof Error?S.message:"Couldn’t add the server.")}},[r,w,O,H]),Y=J??(a&&a!==K?a:null),Pe=l.useCallback(()=>{V(Y),U(null)},[Y]),Re=l.useMemo(()=>[j.trim(),...me(b)].filter(Boolean).join(" "),[j,b]);return Y?n.jsx(pn,{agentId:e,serverName:Y,onDone:Pe}):c?O?n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(te,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add this server to ",s,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:o==="stdio"?"Runs on this computer when a session starts.":"The agent connects here when a session starts."})]})]}),n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:o==="stdio"?Re:y.trim()}),T&&n.jsx("p",{className:"text-destructive text-xs",children:T}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>R(null),disabled:r.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{size:"sm",onClick:ze,disabled:r.isPending,className:"focus-visible:ring-2",children:r.isPending?"Adding…":"Add server"})]})]})}):n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-name",children:"Name"}),n.jsx(G,{id:"mcp-name",value:g,onChange:h=>x(h.target.value),placeholder:"my-server","aria-invalid":g.length>0&&!B}),g.length>0&&!B&&n.jsx("p",{className:"text-destructive text-xs",children:"Letters, numbers, dashes, underscores only."})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-transport",children:"Transport"}),n.jsxs(Le,{value:o,onValueChange:h=>m(h),children:[n.jsx(_e,{id:"mcp-transport",className:"w-full",children:n.jsx($e,{})}),n.jsx(Ke,{children:t.map(h=>n.jsx(Be,{value:h,children:h},h))})]})]}),o==="stdio"?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-command",children:"Command"}),n.jsx(G,{id:"mcp-command",value:j,onChange:h=>C(h.target.value),placeholder:"npx",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-args",children:"Arguments"}),n.jsx(G,{id:"mcp-args",value:b,onChange:h=>k(h.target.value),placeholder:"-y @modelcontextprotocol/server-filesystem",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-env",children:"Environment (KEY=VALUE per line)"}),n.jsx(ce,{id:"mcp-env",value:v,onChange:h=>z(h.target.value),placeholder:"API_KEY=…",rows:2,className:"font-mono text-xs"})]})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-url",children:"URL"}),n.jsx(G,{id:"mcp-url",value:y,onChange:h=>M(h.target.value),placeholder:"https://example.com/mcp",className:"font-mono"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(L,{htmlFor:"mcp-headers",children:"Headers (KEY=VALUE per line)"}),n.jsx(ce,{id:"mcp-headers",value:P,onChange:h=>A(h.target.value),placeholder:"Authorization=Bearer …",rows:2,className:"font-mono text-xs"})]})]}),T&&n.jsx("p",{className:"text-destructive text-xs",children:T}),n.jsx(Ue,{}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:E,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:Ee,disabled:!d,className:"focus-visible:ring-2",children:"Continue"})]})]})}):n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>u(!0),className:"focus-visible:ring-2",children:[n.jsx(pe,{className:"size-4"}),"Add server"]})}const Nn={connected:"connected","needs-auth":"needs-sign-in",pending:"connecting",disabled:"off"},bn=["validation","invalid config","invalid configuration","missing required","command not found","enoent"];function ie(e){if(!e)return"cant-reach";const s=e.toLowerCase();return bn.some(t=>s.includes(t))?"setup-problem":"cant-reach"}function Ce(e){return e.transport==="stdio"||e.authKind==="oauth2"?!1:Object.keys(e.headers).some(s=>s.toLowerCase()==="authorization")}function Sn(e){const{connection:s,authStatus:t}=e;return s.transport!=="stdio"&&s.authKind==="oauth2"?!0:t!==void 0}function we(e){const{enabled:s,testedOk:t,signedInNow:i,runtimeStatus:a,runtimeError:r,authStatus:c,ownKey:u}=e;return s?t?"connected":i?"signed-in":a==="failed"?ie(r):c==="connected"&&a==="needs-auth"?"signed-in":c==="needs-auth"&&(a==="connected"||a==="pending")?"needs-sign-in":a?Nn[a]:c==="connected"?"signed-in":c==="needs-auth"?"needs-sign-in":u?"uses-your-key":"not-checked":"off"}function yn(e){const{statusKey:s,testResult:t,signedInNow:i}=e;return s==="off"||i?!1:(t==null?void 0:t.needsAuth)===!0?!0:s==="needs-sign-in"}function Cn(e){const{stamped:s,signedInNow:t,authStatus:i,rosterUpdatedAt:a}=e;if(!s)return;const{result:r}=s;if(!(t&&r.needsAuth===!0)&&!(s.at<=a&&(i==="needs-auth"&&r.ok||i==="connected"&&r.needsAuth===!0)))return r}function wn(e){const{status:s,probe:t}=e;return s==="off"||!t||t.ok?s:t.needsAuth===!0?"needs-sign-in":ie(t.error)}const Q={attention:0,working:1,elsewhere:2,off:3};function kn(e){return e==="off"?Q.off:e==="needs-sign-in"||e==="cant-reach"||e==="setup-problem"?Q.attention:Q.working}function An(e){const{managed:s,live:t,discovered:i}=e;return[...s.map(r=>{var c,u;return{name:r.name,band:kn(we({enabled:r.enabled,testedOk:!1,signedInNow:!1,runtimeStatus:(c=t.get(r.name))==null?void 0:c.status,runtimeError:(u=t.get(r.name))==null?void 0:u.error,authStatus:r.authStatus,ownKey:Ce(r.connection)}))}}),...i.map(r=>({name:r.name,band:Q.elsewhere}))].map((r,c)=>({entry:r,index:c})).sort((r,c)=>r.entry.band-c.entry.band||r.index-c.index).map(({entry:r})=>r.name)}function Tn(e){const{frozen:s,present:t}=e,i=new Set(t),a=new Set(s);return{ordered:s.filter(r=>i.has(r)),added:t.filter(r=>!a.has(r))}}function Mn(){const e=Ve(null);return({bothSettled:s,managed:t,live:i,discovered:a,present:r})=>{e.read()===null&&s&&r.length>0&&e.write(An({managed:t,live:i,discovered:a}));const{ordered:c,added:u}=Tn({frozen:e.read()??[],present:r});return u.length>0&&e.read()!==null&&e.write([...c,...u]),[...c,...u]}}const ke={"needs-sign-in":{label:"Needs sign-in",tooltip:"Sign in to use it.",tone:"attention"},"signing-in":{label:"Signing in…",tooltip:"Finish in the new tab.",tone:"attention"},connected:{label:"Connected",tooltip:"It answered. Its tools are ready.",tone:"calm"},"signed-in":{label:"Signed in",tooltip:"Signed in, not tested yet.",tone:"calm"},"uses-your-key":{label:"Uses your key",tooltip:"Uses a key you added.",tone:"calm"},"cant-reach":{label:"Can’t reach",tooltip:"No answer. See Details.",tone:"error"},"setup-problem":{label:"Setup problem",tooltip:"Couldn’t start. See Details.",tone:"error"},connecting:{label:"Connecting…",tooltip:"Connecting to this server.",tone:"calm"},"not-checked":{label:"Not checked yet",tooltip:"Nothing has checked it yet.",tone:"calm"},off:{label:"Off",tooltip:"Hidden from the agent.",tone:"calm"}},On={"needs-sign-in":"sign-in","signing-in":"none",connected:"none","signed-in":"test","uses-your-key":"test","cant-reach":"try-again","setup-problem":"try-again",connecting:"none","not-checked":"test",off:"none"};function En(e){return On[e]}function zn({toolCount:e,justSignedIn:s}){const t=s?"Signed in just now. ":"";return e===null?`${t||"This server answered. "}Its tools are available.`:`${t}${e} tool${e===1?"":"s"} available.`}function Pn(e,s){switch(e){case"needs-sign-in":return`Sign in to ${s.displayName} to use its tools.`;case"signing-in":return null;case"connected":return zn(s);case"signed-in":return s.justSignedIn?"Signed in just now. Test to check it answers.":"Signed in. Test to check it answers.";case"uses-your-key":return"You added an access key when setting this up.";case"cant-reach":return"This server didn’t answer. It may be down.";case"setup-problem":return"This server’s setup has a problem.";case"connecting":return"Connecting to this server.";case"not-checked":return"Nothing has checked this server yet.";case"off":return"Turned off. The agent doesn’t see this server."}}function Rn(e){const{connection:s,authStatus:t,clientOrigin:i}=e;return s.transport==="stdio"?"None. This server doesn’t need one.":s.authKind==="oauth2"?i==="manual"?`Your own app credentials, ${t==="connected"?"signed in, renews automatically":"not signed in yet"}. DorkOS holds the key, not the agent.`:t==="connected"?"Signed in, and it renews automatically. DorkOS holds the key, not the agent.":"DorkOS will hold the key, not the agent.":Object.keys(s.headers).some(r=>r.toLowerCase()==="authorization")?"Access key: you added a key when setting this up.":t===void 0?"Nothing has checked this yet.":"None. This server doesn’t need one."}function In(e){if(e.transport==="stdio")return`Runs \`${e.command}\` on this computer`;const s=Fn(e.url);return s?`${s} (web service)`:`${e.url} (web service)`}function Fn(e){try{return new URL(e).host}catch{return null}}const Dn={agent:"Added to this agent through DorkOS",project:"From this project’s config files",plugin:"Comes with a plugin",computer:"From your computer-wide config"},Ln={agent:"Added to this agent through DorkOS.",project:"From this project’s config. Add it to manage it here.",plugin:"Comes with a plugin. Add it to manage it here.",computer:"From your computer-wide config. Add it to manage it here."},_n=[{runtime:"claude-code",pattern:/^plugin:([^:]+):(.+)$/,read:e=>({pluginName:e[1],displayName:e[2]})},{runtime:"claude-code",pattern:/^plugin:(.+)$/,read:e=>({pluginName:e[1],displayName:e[1]})}];function Ae(e){for(const s of _n){const t=e.match(s.pattern);if(!t)continue;const{displayName:i,pluginName:a}=s.read(t);if(!(!i||!a))return{displayName:i,pluginName:a,rawName:e}}return{displayName:e,pluginName:null,rawName:e}}function $n(e,s){return s.pluginName?"plugin":e.scope==="project"||e.scope==="local"?"project":e.scope==="user"?"computer":null}const Kn="Loaded from outside DorkOS. Add it to manage it here.";function Te(e,s){return e==="plugin"&&s?`Comes with the ${s} plugin`:Dn[e]}function Bn(e,s){return e===null?Kn:e==="plugin"&&s?`Comes with the ${s} plugin. Add it to manage it here.`:Ln[e]}const Un=ae("border-border/60 relative overflow-hidden rounded-md border px-3 py-2.5 transition-colors",{variants:{managed:{true:"bg-card",false:"bg-muted/30"},dimmed:{true:"opacity-65",false:""}},defaultVariants:{managed:!0,dimmed:!1}}),Vn=ae("pointer-events-none absolute inset-y-0 left-0 w-0.5",{variants:{tone:{calm:"hidden",attention:"bg-status-warning",error:"bg-status-error"}},defaultVariants:{tone:"calm"}}),qn=ae("shrink-0 rounded-full px-2 py-0.5 text-2xs leading-4 font-medium whitespace-nowrap",{variants:{chip:{success:"bg-status-success-bg text-status-success-fg",info:"bg-status-info-bg text-status-info-fg",warning:"bg-status-warning-bg text-status-warning-fg",error:"bg-status-error-bg text-status-error-fg",neutral:"bg-muted text-muted-foreground"}},defaultVariants:{chip:"neutral"}}),Hn={connected:"success","signed-in":"info","needs-sign-in":"warning","signing-in":"warning","cant-reach":"error","setup-problem":"error","uses-your-key":"neutral",connecting:"neutral","not-checked":"neutral",off:"neutral"};function Yn({status:e}){const s=ke[e];return n.jsxs(fe,{children:[n.jsx(xe,{asChild:!0,children:n.jsx("span",{className:qn({chip:Hn[e]}),children:s.label})}),n.jsx(je,{children:s.tooltip})]})}function Gn({scope:e,pluginName:s}){return n.jsxs(fe,{children:[n.jsx(xe,{asChild:!0,children:n.jsx(qe,{size:"xs",tone:"neutral",variant:"secondary",className:"shrink-0 font-normal",children:e})}),n.jsx(je,{children:Te(e,s)})]})}function Me({displayName:e,rawName:s,scope:t,pluginName:i,status:a,sentence:r,managed:c,toggle:u,actions:g,children:x,details:p,defaultDetailsOpen:m=!1}){const[o,j]=l.useState(m),C=l.useId(),b=ke[a].tone;return n.jsxs("div",{"data-mcp-server":s,className:le(Un({managed:c,dimmed:a==="off"}),"mb-2 last:mb-0"),children:[n.jsx("span",{className:Vn({tone:b}),"aria-hidden":!0}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:e}),t&&n.jsx(Gn,{scope:t,pluginName:i}),n.jsx(Yn,{status:a}),u]}),r&&n.jsx("p",{className:"text-muted-foreground mt-1 text-xs leading-relaxed",children:r}),x,g&&n.jsx("div",{className:"mt-2 flex items-center gap-1",children:g}),p&&n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",onClick:()=>j(k=>!k),"aria-expanded":o,"aria-controls":C,className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(Z,{className:le("size-3 transition-transform",o&&"rotate-90"),"aria-hidden":!0}),"Details"]}),o&&n.jsxs("div",{id:C,children:[p,n.jsxs("button",{type:"button",onClick:()=>j(!1),className:"text-muted-foreground hover:text-foreground mt-2 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(Z,{className:"size-3 -rotate-90","aria-hidden":!0}),"Collapse details"]})]})]})]})}const Qn=3,$="text-muted-foreground/70";function Wn({tools:e}){const[s,t]=l.useState(!1),i=s?e:e.slice(0,Qn),a=e.length-i.length;return n.jsxs("div",{className:"mt-1.5",children:[i.map(r=>n.jsxs("div",{className:"border-border/40 flex items-baseline gap-2 border-b py-1 last:border-b-0",children:[n.jsx("code",{className:"text-foreground text-2xs shrink-0 font-mono",children:r.name}),r.description&&n.jsx("span",{className:"text-muted-foreground text-2xs truncate",children:r.description})]},r.name)),a>0&&n.jsxs("button",{type:"button",onClick:()=>t(!0),className:"text-muted-foreground hover:text-foreground mt-1 flex items-center gap-1 text-xs focus-visible:ring-2",children:[n.jsx(Z,{className:"size-3","aria-hidden":!0}),"Show ",a," more"]})]})}function Jn(e){const{scope:s,pluginName:t,connection:i}=e;return s==="plugin"&&t?`Comes with the ${t} plugin`:i?In(i):s?Te(s,t):null}function Oe({connection:e,authStatus:s,authClientOrigin:t,scope:i,pluginName:a,rawName:r,displayName:c,toolCount:u,tools:g,serverInfo:x,alsoUsedBy:p,error:m}){const o=Jn({scope:i,pluginName:a,connection:e});return n.jsxs("div",{className:"border-border/60 text-muted-foreground mt-2 space-y-1 border-t pt-2 text-xs leading-relaxed",children:[e&&n.jsx(_,{label:"Sign-in",align:"start",wrap:!0,labelClassName:$,children:n.jsxs("span",{className:"inline-flex items-start gap-1.5",children:[n.jsx(He,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),Rn({connection:e,authStatus:s,clientOrigin:t})]})}),o&&n.jsx(_,{label:"Source",align:"start",wrap:!0,labelClassName:$,children:o}),r!==c&&n.jsx(_,{label:"Raw id",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono",children:r})}),x&&n.jsx(_,{label:"Server",align:"start",wrap:!0,labelClassName:$,children:x}),p&&n.jsx(_,{label:"Also used by",align:"start",wrap:!0,labelClassName:$,children:p}),typeof u=="number"&&n.jsx(_,{label:"Tools",align:"start",labelClassName:$,children:u}),g&&g.length>0&&n.jsx(Wn,{tools:g}),m&&n.jsx(_,{label:"Error",align:"start",wrap:!0,labelClassName:$,children:n.jsx("code",{className:"text-2xs font-mono break-all",children:m})})]})}function Xn({flow:e,serverName:s}){return n.jsxs(n.Fragment,{children:[n.jsx(Ne,{flow:e,serverName:s,failedActions:n.jsxs(n.Fragment,{children:[n.jsx(f,{variant:"secondary",size:"sm",onClick:()=>e.start(),className:"focus-visible:ring-2",children:"Try again"}),n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})]}),connectedActions:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),className:"focus-visible:ring-2",children:"Dismiss"})}),(e.state.step==="disclosure"||e.state.step==="waiting")&&n.jsx("div",{className:"mt-2",children:n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>e.reset(),"aria-label":`Cancel signing in to ${s}`,className:"focus-visible:ring-2",children:"Cancel"})})]})}function Zn({server:e,agentId:s,live:t,testResult:i,rosterUpdatedAt:a,testing:r,busy:c,onToggle:u,onTest:g,onRemove:x}){const p=ve(s,e.name),m=p.state.step==="connected",o=Cn({stamped:i,signedInNow:m,authStatus:e.authStatus,rosterUpdatedAt:a}),j=Ce(e.connection),C=we({enabled:e.enabled,testedOk:(o==null?void 0:o.ok)===!0,signedInNow:m,runtimeStatus:t==null?void 0:t.status,runtimeError:t==null?void 0:t.error,authStatus:e.authStatus,ownKey:j}),b=p.state.step==="starting",k=p.state.step==="disclosure"||p.state.step==="waiting"||b,v=k?"signing-in":C,z=yn({statusKey:C,testResult:o,signedInNow:m})&&(p.state.step==="idle"||b),y=Ae(e.name),M=o!=null&&o.ok?o.toolCount??null:p.state.toolCount,P=k?v:wn({status:v,probe:o}),A=Pn(P,{displayName:y.displayName,toolCount:M,justSignedIn:m}),O=k?"none":En(P),R=Sn({connection:e.connection,authStatus:e.authStatus});return n.jsx(Me,{displayName:y.displayName,rawName:e.name,scope:"agent",pluginName:y.pluginName,status:v,sentence:A,managed:!0,toggle:n.jsx(Xe,{checked:e.enabled,onCheckedChange:T=>u(e.name,T),disabled:c,"aria-label":`Enable ${e.name}`}),actions:n.jsxs(n.Fragment,{children:[z&&n.jsxs(f,{variant:"default",size:"sm",onClick:()=>p.start(),disabled:c||b,"aria-label":`Sign in to ${e.name}`,className:"gap-1.5 focus-visible:ring-2",children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in"]}),!z&&O==="try-again"&&n.jsxs(f,{variant:"outline",size:"sm",onClick:()=>g(e.name),disabled:r||c,"aria-label":`Try ${e.name} again`,className:"gap-1.5 focus-visible:ring-2",children:[r?n.jsx(ee,{size:"xs"}):null,"Try again"]}),!z&&O==="test"&&n.jsx(f,{variant:"outline",size:"sm",onClick:()=>g(e.name),disabled:r||c,className:"focus-visible:ring-2",children:r?n.jsx(ee,{size:"xs"}):"Test"}),n.jsxs(Ye,{children:[n.jsx(Ge,{asChild:!0,children:n.jsx(f,{variant:"ghost",size:"sm","aria-label":`More actions for ${e.name}`,className:"ml-auto focus-visible:ring-2",children:n.jsx(Qe,{className:"size-4","aria-hidden":!0})})}),n.jsxs(We,{align:"end",children:[n.jsxs(X,{onSelect:()=>g(e.name),disabled:r||c,children:[n.jsx(cn,{className:"size-3.5","aria-hidden":!0}),"Test"]}),R&&n.jsxs(X,{onSelect:()=>p.start(),disabled:c,children:[n.jsx(de,{className:"size-3.5","aria-hidden":!0}),"Sign in again"]}),n.jsx(Je,{}),n.jsx(X,{variant:"destructive",onSelect:()=>x(e.name),disabled:c,children:"Remove"})]})]})]}),details:n.jsx(Oe,{connection:e.connection,authStatus:e.authStatus,authClientOrigin:e.authClientOrigin,scope:"agent",pluginName:y.pluginName,rawName:y.rawName,displayName:y.displayName,toolCount:M,error:(o==null?void 0:o.ok)===!1?o.error:t==null?void 0:t.error}),children:n.jsx(Xn,{flow:p,serverName:y.displayName})})}function es(e){switch(e.status){case"connected":return"connected";case"failed":return ie(e.error);case"needs-auth":return"needs-sign-in";case"pending":return"connecting";case"disabled":return"off";default:return"not-checked"}}function ns(e){const{displayName:s,scope:t,pluginName:i}=e,a=ss(t,i);return`${s} ${a}. Manage it here to enable, disable, or sign in from DorkOS.`}function ss(e,s){return e==="plugin"&&s?`comes with the ${s} plugin`:e==="project"?"comes from this project’s own config":e==="computer"?"comes from your computer-wide config":"is loaded from outside DorkOS"}function ts({entry:e,agentId:s,agentLabel:t,canImport:i}){const a=dn(),[r,c]=l.useState(null),[u,g]=l.useState(null),x=l.useCallback(async()=>{g(null);try{const v=await a.mutateAsync({input:{agentId:s,name:e.name}});v.status==="approval_required"&&c(v.approval)}catch(v){g(v instanceof Error?v.message:"Couldn’t add the server.")}},[a,s,e.name]),p=l.useCallback(async()=>{if(r){g(null);try{(await a.mutateAsync({input:{agentId:s,name:e.name},approval:r})).status!=="ok"&&g("Adding it still needs approval. Try again.")}catch(v){g(v instanceof Error?v.message:"Couldn’t add the server.")}}},[a,s,e.name,r]),m=Ae(e.name),o=$n(e,m),j=o!==null,C=m.rawName!==m.displayName,b=e.error!==void 0,k=j||C||b;return r?n.jsxs("div",{className:"border-border/60 mb-2 space-y-3 rounded-md border p-3 last:mb-0",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(te,{className:"text-status-warning mt-0.5 size-4 shrink-0","aria-hidden":!0}),n.jsxs("div",{className:"space-y-1",children:[n.jsxs("p",{className:"text-sm font-medium",children:["Add “",m.displayName,"” to ",t,"?"]}),n.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:ns({displayName:m.displayName,scope:o,pluginName:m.pluginName})})]})]}),u&&n.jsx("p",{className:"text-destructive text-xs",children:u}),n.jsxs("div",{className:"flex justify-end gap-2",children:[n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>c(null),disabled:a.isPending,className:"focus-visible:ring-2",children:"Cancel"}),n.jsx(f,{size:"sm",onClick:p,disabled:a.isPending,className:"focus-visible:ring-2",children:a.isPending?"Adding…":"Add to agent"})]})]}):n.jsx(Me,{displayName:m.displayName,rawName:e.name,scope:o,pluginName:m.pluginName,status:es(e),sentence:Bn(o,m.pluginName),managed:!1,actions:i?n.jsxs(n.Fragment,{children:[n.jsxs(f,{variant:"outline",size:"sm",onClick:x,disabled:a.isPending,"aria-label":`Add ${e.name} to agent`,className:"gap-1.5 focus-visible:ring-2",children:[a.isPending?n.jsx(ee,{size:"xs"}):n.jsx(pe,{className:"size-(--size-icon-xs)","aria-hidden":!0}),"Add to agent"]}),u&&n.jsx("p",{className:"text-destructive text-xs",children:u})]}):void 0,details:k?n.jsx(Oe,{scope:o,pluginName:m.pluginName,rawName:m.rawName,displayName:m.displayName,error:e.error}):void 0})}function as(e,s){return{agentId:e,name:s.server.name,connection:s.server.connection}}function rs(e){const s=e.sites.filter(t=>!t.expired).map(t=>t.site);return s.length<=3?s.join(", "):`${s.slice(0,3).join(", ")} and ${s.length-3} more`}function is({agentId:e,agentLabel:s}){const t=Ze(),i=ye(),[a,r]=l.useState(null),[c,u]=l.useState(null),g=l.useCallback(async o=>{if(t.data){u(null);try{const j=await i.mutateAsync({input:as(e,t.data),...o?{approval:o}:{}});j.status!=="approval_required"?r(null):o?u("The browser still needs approval. Try again."):r(j.approval)}catch(j){u(j instanceof Error?j.message:"Couldn’t add the browser.")}}},[i,e,t.data]);if(!t.data)return null;const x=t.data,p=rs(x),m=`${x.loginCommand} <site>`;return n.jsx(F,{children:n.jsxs(D,{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[a?n.jsx(te,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}):n.jsx(en,{className:"text-muted-foreground mt-0.5 size-4 shrink-0"}),n.jsxs("div",{className:"min-w-0 space-y-1",children:[n.jsx("p",{className:"text-sm font-medium",children:a?`Give ${s} the signed-in browser?`:"Signed-in browser"}),a?n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-muted-foreground text-xs",children:"Runs on this computer when a session starts."}),n.jsx("p",{className:"text-muted-foreground text-xs",children:"Each session gets its own browser."})]}):n.jsx("p",{className:"text-muted-foreground text-xs",children:"Starts signed in to your saved sites. The agent never sees your passwords."}),x.saved?n.jsxs("p",{className:"text-xs",children:["Signed in to ",p,"."]}):n.jsxs("p",{className:"text-status-warning-fg text-xs",children:["Starts signed out. Run ",n.jsx("code",{className:"font-mono",children:m}),n.jsx(nn,{value:m,label:"Copy the sign-in command",size:"xs",className:"mx-0.5 inline-flex align-middle"})," ","in a terminal first."]})]})]}),a&&n.jsx("pre",{className:"bg-muted text-foreground overflow-x-auto rounded-md px-3 py-2 font-mono text-xs",children:[x.server.connection.command,...x.server.connection.args].join(" ")}),c&&n.jsx("p",{className:"text-destructive text-xs",children:c}),n.jsxs("div",{className:"flex justify-end gap-2",children:[a&&n.jsx(f,{variant:"ghost",size:"sm",onClick:()=>r(null),disabled:i.isPending,className:"focus-visible:ring-2",children:"Back"}),n.jsx(f,{variant:a?"default":"outline",size:"sm",onClick:()=>void g(a??void 0),disabled:i.isPending,className:"focus-visible:ring-2",children:i.isPending?"Adding…":a?"Add browser":"Give it the browser"})]})]})})}const os={codex:["stdio","http"],opencode:["stdio","http"]};function ge(e){return os[e]??fn}function cs(){const{open:e}=an();return n.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Want other apps to use DorkOS’s tools?"," ",n.jsx(f,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>e("tools","external-mcp"),children:"See Settings → Advanced → Tools"})]})}function ls({agent:e,projectPath:s}){var q;const t=sn(e.id),i=ln(s,e.runtime),a=i.data,r=tn(e.runtime),c=(r==null?void 0:r.supportsManagedMcpServers)??!0,u=mn(),g=gn(),x=un(),p=hn(),[m,o]=l.useState({}),[j,C]=l.useState(null),[b,k]=l.useState(null),v=Mn(),z=l.useCallback((d,N)=>{(N?u:g).mutate({agentId:e.id,name:d})},[e.id,u,g]),y=l.useCallback(d=>{x.mutate({agentId:e.id,name:d}),o(N=>{const w={...N};return delete w[d],w})},[e.id,x]),M=l.useCallback(async d=>{C(d);try{const N=await p.mutateAsync({agentId:e.id,name:d});o(w=>({...w,[d]:{result:N,at:Date.now()}}))}finally{C(null)}},[e.id,p]),P=l.useCallback(({name:d,transport:N})=>{k(d),N!=="stdio"&&M(d).catch(()=>{})},[M]),A=t.data??[],O=new Set(A.map(d=>d.name)),R=new Map(((a==null?void 0:a.servers)??[]).map(d=>[d.name,d])),T=((a==null?void 0:a.servers)??[]).filter(d=>!O.has(d.name)),I=u.isPending||g.isPending||x.isPending,J=A.some(d=>on(d.connection)!==void 0),U=c&&!t.isPending&&!J&&ge(e.runtime).includes("stdio"),K=new Map;A.forEach((d,N)=>K.set(d.name,{kind:"managed",index:N})),T.forEach((d,N)=>K.set(d.name,{kind:"discovered",index:N}));const V=v({bothSettled:!t.isPending&&!i.isPending,managed:A,live:R,discovered:T,present:[...A.map(d=>d.name),...T.map(d=>d.name)]});function B(d){const N=K.get(d);if(!N)return null;if(N.kind==="managed"){const E=A[N.index];return n.jsx(Zn,{server:E,agentId:e.id,live:R.get(E.name),testResult:m[E.name],rosterUpdatedAt:t.dataUpdatedAt,testing:j===E.name,busy:I,onToggle:z,onTest:M,onRemove:y},E.name)}const w=T[N.index];return n.jsx(ts,{entry:w,agentId:e.id,agentLabel:e.displayName??e.name,canImport:c},w.name)}return n.jsxs("section",{className:"space-y-3","aria-label":"MCP servers",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h3",{className:"text-sm font-semibold",children:"MCP Servers"}),c&&n.jsx(vn,{agentId:e.id,agentLabel:e.displayName??e.name,supportedTransports:ge(e.runtime),onAdded:P,oauthDetectedFor:b&&((q=m[b])==null?void 0:q.result.needsAuth)===!0?b:null})]}),n.jsx(cs,{}),U&&n.jsx(is,{agentId:e.id,agentLabel:e.displayName??e.name}),!c&&n.jsx("p",{className:"text-muted-foreground text-xs",children:"This agent can’t use added servers yet. View only."}),t.isLoading?n.jsx(F,{children:n.jsxs(D,{className:"space-y-2",children:[n.jsx(ne,{className:"h-5 w-full"}),n.jsx(ne,{className:"h-5 w-3/4"})]})}):t.isError?n.jsx(F,{children:n.jsxs(D,{className:"flex items-center justify-between gap-2",children:[n.jsx("p",{className:"text-destructive text-sm",children:"Couldn’t load managed servers."}),n.jsx(f,{variant:"outline",size:"sm",onClick:()=>t.refetch(),className:"focus-visible:ring-2",children:"Try again"})]})}):V.length===0?n.jsx(F,{children:n.jsx(D,{children:n.jsxs("p",{className:"text-muted-foreground text-sm",children:["No MCP servers yet."," ",c?"Add one for more tools.":"This agent can’t use them yet."]})})}):n.jsx(F,{children:n.jsx(D,{children:V.map(B)})})]})}function hs({member:e}){const{agent:s,projectPath:t,isPending:i}=rn(e);return i?n.jsx(ne,{className:"h-32 w-full"}):!s||t===null?n.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s MCP servers."}):n.jsx(ls,{agent:s,projectPath:t})}export{hs as ToolsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,i7 as b,j as L,B as ve,aa as Ye,i8 as Ce,dr as Ze,et as Qe,d4 as Y,l as X,i9 as Xe,Q as Je,R as et,ad as tt,hz as me,U as nt,ia as rt,eB as ot,fS as it,b0 as st,aJ as at,d7 as lt,bM as ct,eG as ut,aD as ge}from"./index-DMYBI16t.js";import{D as z}from"./dorkbot-templates-cu4wApxb.js";import{u as ft}from"./use-external-adapter-catalog-B0gcY-k7.js";var dt={attributes:!0,characterData:!0,subtree:!0,childList:!0};function ht(e,t,n=dt){d.useEffect(()=>{if(e.current){const r=new MutationObserver(t);return r.observe(e.current,n),()=>{r.disconnect()}}},[t,n])}var Le=(function(){if(typeof Map<"u")return Map;function e(t,n){var r=-1;return t.some(function(o,s){return o[0]===n?(r=s,!0):!1}),r}return(function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(n){var r=e(this.__entries__,n),o=this.__entries__[r];return o&&o[1]},t.prototype.set=function(n,r){var o=e(this.__entries__,n);~o?this.__entries__[o][1]=r:this.__entries__.push([n,r])},t.prototype.delete=function(n){var r=this.__entries__,o=e(r,n);~o&&r.splice(o,1)},t.prototype.has=function(n){return!!~e(this.__entries__,n)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var o=0,s=this.__entries__;o<s.length;o++){var i=s[o];n.call(r,i[1],i[0])}},t})()})(),ue=typeof window<"u"&&typeof document<"u"&&window.document===document,te=(function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()})(),pt=(function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(te):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)}})(),vt=2;function mt(e,t){var n=!1,r=!1,o=0;function s(){n&&(n=!1,e()),r&&a()}function i(){pt(s)}function a(){var c=Date.now();if(n){if(c-o<vt)return;r=!0}else n=!0,r=!1,setTimeout(i,t);o=c}return a}var gt=20,bt=["top","right","bottom","left","width","height","size","weight"],yt=typeof MutationObserver<"u",wt=(function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=mt(this.refresh.bind(this),gt)}return e.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},e.prototype.removeObserver=function(t){var n=this.observers_,r=n.indexOf(t);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){var t=this.updateObservers_();t&&this.refresh()},e.prototype.updateObservers_=function(){var t=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return t.forEach(function(n){return n.broadcastActive()}),t.length>0},e.prototype.connect_=function(){!ue||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),yt?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!ue||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var n=t.propertyName,r=n===void 0?"":n,o=bt.some(function(s){return!!~r.indexOf(s)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e})(),Me=(function(e,t){for(var n=0,r=Object.keys(t);n<r.length;n++){var o=r[n];Object.defineProperty(e,o,{value:t[o],enumerable:!1,writable:!1,configurable:!0})}return e}),B=(function(e){var t=e&&e.ownerDocument&&e.ownerDocument.defaultView;return t||te}),Te=ie(0,0,0,0);function ne(e){return parseFloat(e)||0}function be(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return t.reduce(function(r,o){var s=e["border-"+o+"-width"];return r+ne(s)},0)}function _t(e){for(var t=["top","right","bottom","left"],n={},r=0,o=t;r<o.length;r++){var s=o[r],i=e["padding-"+s];n[s]=ne(i)}return n}function Et(e){var t=e.getBBox();return ie(0,0,t.width,t.height)}function Ot(e){var t=e.clientWidth,n=e.clientHeight;if(!t&&!n)return Te;var r=B(e).getComputedStyle(e),o=_t(r),s=o.left+o.right,i=o.top+o.bottom,a=ne(r.width),c=ne(r.height);if(r.boxSizing==="border-box"&&(Math.round(a+s)!==t&&(a-=be(r,"left","right")+s),Math.round(c+i)!==n&&(c-=be(r,"top","bottom")+i)),!Rt(e)){var u=Math.round(a+s)-t,l=Math.round(c+i)-n;Math.abs(u)!==1&&(a-=u),Math.abs(l)!==1&&(c-=l)}return ie(o.left,o.top,a,c)}var xt=(function(){return typeof SVGGraphicsElement<"u"?function(e){return e instanceof B(e).SVGGraphicsElement}:function(e){return e instanceof B(e).SVGElement&&typeof e.getBBox=="function"}})();function Rt(e){return e===B(e).document.documentElement}function St(e){return ue?xt(e)?Et(e):Ot(e):Te}function kt(e){var t=e.x,n=e.y,r=e.width,o=e.height,s=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,i=Object.create(s.prototype);return Me(i,{x:t,y:n,width:r,height:o,top:n,right:t+r,bottom:o+n,left:t}),i}function ie(e,t,n,r){return{x:e,y:t,width:n,height:r}}var Ct=(function(){function e(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=ie(0,0,0,0),this.target=t}return e.prototype.isActive=function(){var t=St(this.target);return this.contentRect_=t,t.width!==this.broadcastWidth||t.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},e})(),Lt=(function(){function e(t,n){var r=kt(n);Me(this,{target:t,contentRect:r})}return e})(),Mt=(function(){function e(t,n,r){if(this.activeObservations_=[],this.observations_=new Le,typeof t!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=n,this.callbackCtx_=r}return e.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof B(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)||(n.set(t,new Ct(t)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(t instanceof B(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(t)&&(n.delete(t),n.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&t.activeObservations_.push(n)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new Lt(r.target,r.broadcastRect())});this.callback_.call(t,n,t),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e})(),Ae=typeof WeakMap<"u"?new WeakMap:new Le,Ie=(function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=wt.getInstance(),r=new Mt(t,n,this);Ae.set(this,r)}return e})();["observe","unobserve","disconnect"].forEach(function(e){Ie.prototype[e]=function(){var t;return(t=Ae.get(this))[e].apply(t,arguments)}});var Tt=(function(){return typeof te.ResizeObserver<"u"?te.ResizeObserver:Ie})(),At=({mutationObservables:e,resizeObservables:t,refresh:n})=>{const[r,o]=d.useState(0),s=d.useRef(document.documentElement||document.body);function i(c){const u=Array.from(c);for(const l of u)if(e){if(!l.attributes)continue;e.find(v=>l.matches(v))&&n(!0)}}function a(c){const u=Array.from(c);for(const l of u)if(t){if(!l.attributes)continue;t.find(v=>l.matches(v))&&o(r+1)}}return ht(s,c=>{for(const u of c)u.addedNodes.length!==0&&(i(u.addedNodes),a(u.addedNodes)),u.removedNodes.length!==0&&(i(u.removedNodes),a(u.removedNodes))},{childList:!0,subtree:!0}),d.useEffect(()=>{if(!t)return;const c=new Tt(()=>{n()});for(const u of t){const l=document.querySelector(u);l&&c.observe(l)}return()=>{c.disconnect()}},[t,r]),null},It=At;function ee(e){let t=Pe;return e&&(t=e.getBoundingClientRect()),t}function Pt(e,t){const[n,r]=d.useState(Pe),o=d.useCallback(()=>{e!=null&&e.current&&r(ee(e==null?void 0:e.current))},[e==null?void 0:e.current]);return d.useEffect(()=>(o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)),[e==null?void 0:e.current,t]),n}var Pe={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0};function Dt(e,t){return new Promise(n=>{if(!(e instanceof Element))throw new TypeError("Argument 1 must be an Element");let r=0,o=null;const s=Object.assign({behavior:"smooth"},t);e.scrollIntoView(s),requestAnimationFrame(i);function i(){const a=e==null?void 0:e.getBoundingClientRect().top;if(a===o){if(r++>2)return n(null)}else r=0,o=a;requestAnimationFrame(i)}})}function J(e){return e<0?0:e}function Ht(e){return typeof e=="object"&&e!==null?{thresholdX:e.x||0,thresholdY:e.y||0}:{thresholdX:e||0,thresholdY:e||0}}function se(){const e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),t=Math.max(document.documentElement.clientHeight,window.innerHeight||0);return{w:e,h:t}}function Nt({top:e,right:t,bottom:n,left:r,threshold:o}){const{w:s,h:i}=se(),{thresholdX:a,thresholdY:c}=Ht(o);return e<0&&n-e>i?!0:e>=0+c&&r>=0+a&&n<=i-c&&t<=s-a}var ye=(e,t)=>e>t,we=(e,t)=>e>t;function jt(e,t=[]){const n=(r,o)=>t.includes(r)?1:t.includes(o)?-1:0;return Object.keys(e).map(r=>({position:r,value:e[r]})).sort((r,o)=>o.value-r.value).sort((r,o)=>n(r.position,o.position)).filter(r=>r.value>0).map(r=>r.position)}var ce=10;function fe(e=ce){return Array.isArray(e)?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[1],e[0],e[1],e[0]]:e.length===3?[e[0],e[1],e[2],e[1]]:e.length>3?[e[0],e[1],e[2],e[3]]:[ce,ce]:[e,e,e,e]}var $t={maskWrapper:()=>({opacity:.7,left:0,top:0,position:"fixed",zIndex:99999,pointerEvents:"none",color:"#000"}),svgWrapper:({windowWidth:e,windowHeight:t,wpt:n,wpl:r})=>({width:e,height:t,left:Number(r),top:Number(n),position:"fixed"}),maskArea:({x:e,y:t,width:n,height:r})=>({x:e,y:t,width:n,height:r,fill:"black",rx:0}),maskRect:({windowWidth:e,windowHeight:t,maskID:n})=>({x:0,y:0,width:e,height:t,fill:"currentColor",mask:`url(#${n})`}),clickArea:({windowWidth:e,windowHeight:t,clipID:n})=>({x:0,y:0,width:e,height:t,fill:"currentcolor",pointerEvents:"auto",clipPath:`url(#${n})`}),highlightedArea:({x:e,y:t,width:n,height:r})=>({x:e,y:t,width:n,height:r,pointerEvents:"auto",fill:"transparent",display:"none"})};function zt(e){return(t,n)=>{const r=$t[t](n),o=e[t];return o?o(r,n):r}}var Ft=({padding:e=10,wrapperPadding:t=0,onClick:n,onClickHighlighted:r,styles:o={},sizes:s,className:i,highlightedAreaClassName:a,maskId:c,clipId:u})=>{const l=c||_e("mask__"),f=u||_e("clip__"),v=zt(o),[g,_,O,y]=fe(e),[p,E,x,k]=fe(t),{w:h,h:T}=se(),M=J((s==null?void 0:s.width)+y+_),C=J((s==null?void 0:s.height)+g+O),w=J((s==null?void 0:s.top)-g-p),R=J((s==null?void 0:s.left)-y-k),A=h-k-E,S=T-p-x,j=v("maskArea",{x:R,y:w,width:M,height:C}),$=v("highlightedArea",{x:R,y:w,width:M,height:C});return b.createElement("div",{style:v("maskWrapper",{}),onClick:n,className:i},b.createElement("svg",{width:A,height:S,xmlns:"http://www.w3.org/2000/svg",style:v("svgWrapper",{windowWidth:A,windowHeight:S,wpt:p,wpl:k})},b.createElement("defs",null,b.createElement("mask",{id:l},b.createElement("rect",{x:0,y:0,width:A,height:S,fill:"white"}),b.createElement("rect",{style:j,rx:j.rx?1:void 0})),b.createElement("clipPath",{id:f},b.createElement("polygon",{points:`0 0, 0 ${S}, ${R} ${S}, ${R} ${w}, ${R+M} ${w}, ${R+M} ${w+C}, ${R} ${w+C}, ${R} ${S}, ${A} ${S}, ${A} 0`}))),b.createElement("rect",{style:v("maskRect",{windowWidth:A,windowHeight:S,maskID:l})}),b.createElement("rect",{style:v("clickArea",{windowWidth:A,windowHeight:S,top:w,left:R,width:M,height:C,clipID:f})}),b.createElement("rect",{style:$,className:a,onClick:r,rx:$.rx?1:void 0})))},Vt=Ft;function _e(e){return e+Math.random().toString(36).substring(2,16)}var Wt=Object.defineProperty,re=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,Ee=(e,t,n)=>t in e?Wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oe=(e,t)=>{for(var n in t||(t={}))De.call(t,n)&&Ee(e,n,t[n]);if(re)for(var n of re(t))He.call(t,n)&&Ee(e,n,t[n]);return e},Bt=(e,t)=>{var n={};for(var r in e)De.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&re)for(var r of re(e))t.indexOf(r)<0&&He.call(e,r)&&(n[r]=e[r]);return n},qt={popover:()=>({position:"fixed",maxWidth:353,backgroundColor:"#fff",padding:"24px 30px",boxShadow:"0 0.5em 3em rgba(0, 0, 0, 0.3)",color:"inherit",zIndex:1e5,transition:"transform 0.3s",top:0,left:0})};function Gt(e){return(t,n)=>{const r=qt[t](n),o=e[t];return o?o(r,n):r}}var Kt=e=>{var t=e,{children:n,position:r="bottom",padding:o=10,styles:s={},sizes:i,refresher:a}=t,c=Bt(t,["children","position","padding","styles","sizes","refresher"]);const u=d.useRef(null),l=d.useRef(""),f=d.useRef(""),v=d.useRef(""),{w:g,h:_}=se(),O=Gt(s),y=Pt(u,a),{width:p,height:E}=y,[x,k,h,T]=fe(o),M=(i==null?void 0:i.left)-T,C=(i==null?void 0:i.top)-x,w=(i==null?void 0:i.right)+k,R=(i==null?void 0:i.bottom)+h,A=r&&typeof r=="function"?r({width:p,height:E,windowWidth:g,windowHeight:_,top:C,left:M,right:w,bottom:R,x:i.x,y:i.y},y):r,S={left:M,right:g-w,top:C,bottom:_-R},j=(I,D,H)=>{switch(I){case"top":return S.top>E+h;case"right":return D?!1:S.right>p+T;case"bottom":return H?!1:S.bottom>E+x;case"left":return S.left>p+k;default:return!1}},$=(I,D,H)=>{const m=jt(S,H?["right","left"]:D?["top","bottom"]:[]);for(let N=0;N<m.length;N++)if(j(m[N],D,H))return l.current=m[N],I[m[N]];return l.current="center",I.center},G=(I=>{if(Array.isArray(I)){const V=ye(I[0],g),le=we(I[1],_);return l.current="custom",[V?g/2-p/2:I[0],le?_/2-E/2:I[1]]}const D=ye(M+p,g),H=we(R+E,_),m=D?Math.min(M,g-p):Math.max(M,0),N=H?E>S.bottom?Math.max(R-E,0):Math.max(C,0):C;H&&E>S.bottom?f.current="bottom":f.current="top",D?v.current="left":v.current="right";const K={top:[m-T,C-E-h],right:[w+T,N-x],bottom:[m-T,R+x],left:[M-p-k,N-x],center:[g/2-p/2,_/2-E/2]};return I==="center"||j(I,D,H)&&!D&&!H?(l.current=I,K[I]):$(K,D,H)})(A);return b.createElement("div",Oe({className:"reactour__popover",style:Oe({transform:`translate(${Math.round(G[0])}px, ${Math.round(G[1])}px)`},O("popover",{position:l.current,verticalAlign:f.current,horizontalAlign:v.current,helperRect:y,targetRect:i})),ref:u},c),n)},Ut=Kt,Yt=Object.defineProperty,Zt=Object.defineProperties,Qt=Object.getOwnPropertyDescriptors,oe=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,xe=(e,t,n)=>t in e?Yt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t)=>{for(var n in t||(t={}))Ne.call(t,n)&&xe(e,n,t[n]);if(oe)for(var n of oe(t))je.call(t,n)&&xe(e,n,t[n]);return e},he=(e,t)=>Zt(e,Qt(t)),Z=(e,t)=>{var n={};for(var r in e)Ne.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&oe)for(var r of oe(e))t.indexOf(r)<0&&je.call(e,r)&&(n[r]=e[r]);return n},Xt={bottom:0,height:0,left:0,right:0,top:0,width:0,windowWidth:0,windowHeight:0,x:0,y:0};function Jt(e,t={block:"center",behavior:"smooth",inViewThreshold:0}){const[n,r]=d.useState(!1),[o,s]=d.useState(!1),[i,a]=d.useState(!1),[c,u]=d.useState(null),[l,f]=d.useState(Xt),v=(e==null?void 0:e.selector)instanceof Element?e==null?void 0:e.selector:document.querySelector(e==null?void 0:e.selector),g=d.useCallback(()=>{const O=Re(v,e==null?void 0:e.highlightedSelectors,e==null?void 0:e.bypassElem),{hasHighligtedElems:y}=O,p=Z(O,["hasHighligtedElems"]);Object.entries(l).some(([E,x])=>p[E]!==x)&&f(p)},[v,e==null?void 0:e.highlightedSelectors,l]);d.useEffect(()=>(g(),window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)),[v,e==null?void 0:e.highlightedSelectors,c]),d.useEffect(()=>{!Nt(he(P({},l),{threshold:t.inViewThreshold}))&&v&&(r(!0),Dt(v,t).then(()=>{o||u(Date.now())}).finally(()=>{r(!1)}))},[l]);const _=d.useCallback(()=>{s(!0);const O=Re(v,e==null?void 0:e.highlightedSelectors,e==null?void 0:e.bypassElem),{hasHighligtedElems:y}=O,p=Z(O,["hasHighligtedElems"]);a(y),f(p),s(!1)},[v,e==null?void 0:e.highlightedSelectors,l]);return{sizes:l,transition:n,target:v,observableRefresher:_,isHighlightingObserved:i}}function Re(e,t=[],n=!0){let r=!1;const{w:o,h:s}=se();if(!t)return he(P({},ee(e)),{windowWidth:o,windowHeight:s,hasHighligtedElems:!1});let i=ee(e),a={bottom:0,height:0,left:o,right:0,top:s,width:0};for(const u of t){const l=document.querySelector(u);if(!l||l.style.display==="none"||l.style.visibility==="hidden")continue;const f=ee(l);r=!0,n||!e?(f.top<a.top&&(a.top=f.top),f.right>a.right&&(a.right=f.right),f.bottom>a.bottom&&(a.bottom=f.bottom),f.left<a.left&&(a.left=f.left),a.width=a.right-a.left,a.height=a.bottom-a.top):(f.top<i.top&&(i.top=f.top),f.right>i.right&&(i.right=f.right),f.bottom>i.bottom&&(i.bottom=f.bottom),f.left<i.left&&(i.left=f.left),i.width=i.right-i.left,i.height=i.bottom-i.top)}const c=n||!e?a.width>0&&a.height>0:!1;return{left:(c?a:i).left,top:(c?a:i).top,right:(c?a:i).right,bottom:(c?a:i).bottom,width:(c?a:i).width,height:(c?a:i).height,windowWidth:o,windowHeight:s,hasHighligtedElems:r,x:i.x,y:i.y}}var en=({disableKeyboardNavigation:e,setCurrentStep:t,currentStep:n,setIsOpen:r,stepsLength:o,disable:s,rtl:i,clickProps:a,keyboardHandler:c})=>{function u(l){if(l.stopPropagation(),e===!0||s)return;let f,v,g;e&&(f=e.includes("esc"),v=e.includes("right"),g=e.includes("left"));function _(){t(Math.min(n+1,o-1))}function O(){t(Math.max(n-1,0))}c&&typeof c=="function"?c(l,a,{isEscDisabled:f,isRightDisabled:v,isLeftDisabled:g}):(l.keyCode===27&&!f&&(l.preventDefault(),r(!1)),l.keyCode===39&&!v&&(l.preventDefault(),i?O():_()),l.keyCode===37&&!g&&(l.preventDefault(),i?_():O()))}return d.useEffect(()=>(window.addEventListener("keydown",u,!1),()=>{window.removeEventListener("keydown",u)}),[s,t,n]),null},tn=en,nn={badge:()=>({position:"absolute",fontFamily:"monospace",background:"var(--reactour-accent,#007aff)",height:"1.875em",lineHeight:2,paddingLeft:"0.8125em",paddingRight:"0.8125em",fontSize:"1em",borderRadius:"1.625em",color:"white",textAlign:"center",boxShadow:"0 0.25em 0.5em rgba(0, 0, 0, 0.3)",top:"-0.8125em",left:"-0.8125em"}),controls:()=>({display:"flex",marginTop:24,alignItems:"center",justifyContent:"space-between"}),navigation:()=>({counterReset:"dot",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap"}),button:({disabled:e})=>({display:"block",padding:0,border:0,background:"none",cursor:e?"not-allowed":"pointer"}),arrow:({disabled:e})=>({color:e?"#caccce":"#646464",width:16,height:12,flex:"0 0 16px"}),dot:({current:e,disabled:t,showNumber:n})=>({counterIncrement:"dot",width:8,height:8,border:e?"0":"1px solid #caccce",borderRadius:"100%",padding:0,display:"block",margin:4,transition:"opacity 0.3s, transform 0.3s",cursor:t?"not-allowed":"pointer",transform:`scale(${e?1.25:1})`,color:e?"var(--reactour-accent, #007aff)":"#caccce",background:e?"var(--reactour-accent, #007aff)":"none"}),close:({disabled:e})=>({position:"absolute",top:22,right:22,width:9,height:9,"--rt-close-btn":e?"#caccce":"#5e5e5e","--rt-close-btn-disabled":e?"#caccce":"#000"}),svg:()=>({display:"block"})};function ae(e){return(t,n)=>{const r=nn[t](n),o=e[t];return o?o(r,n):r}}var rn=({styles:e={},children:t})=>{const n=ae(e);return b.createElement("span",{style:n("badge",{})},t)},on=rn,sn=e=>{var t=e,{styles:n={},onClick:r,disabled:o}=t,s=Z(t,["styles","onClick","disabled"]);const i=ae(n);return b.createElement("button",P({className:"reactour__close-button",style:P(P({},i("button",{})),i("close",{disabled:o})),onClick:r},s),b.createElement("svg",{viewBox:"0 0 9.1 9.1","aria-hidden":!0,role:"presentation",style:P({},i("svg",{}))},b.createElement("path",{fill:"currentColor",d:"M5.9 4.5l2.8-2.8c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L4.5 3.1 1.7.3C1.3-.1.7-.1.3.3c-.4.4-.4 1 0 1.4l2.8 2.8L.3 7.4c-.4.4-.4 1 0 1.4.2.2.4.3.7.3s.5-.1.7-.3L4.5 6l2.8 2.8c.3.2.5.3.8.3s.5-.1.7-.3c.4-.4.4-1 0-1.4L5.9 4.5z"})))},an=sn,ln=({content:e,setCurrentStep:t,transition:n,isHighlightingObserved:r,currentStep:o,setIsOpen:s})=>typeof e=="function"?e({setCurrentStep:t,transition:n,isHighlightingObserved:r,currentStep:o,setIsOpen:s}):e,cn=ln,un=({styles:e={},steps:t,setCurrentStep:n,currentStep:r,setIsOpen:o,nextButton:s,prevButton:i,disableDots:a,hideDots:c,hideButtons:u,disableAll:l,rtl:f,Arrow:v=$e})=>{const g=t.length,_=ae(e),O=({onClick:y,kind:p="next",children:E,hideArrow:x})=>{function k(){l||(y&&typeof y=="function"?y():n(p==="next"?Math.min(r+1,g-1):Math.max(r-1,0)))}return b.createElement("button",{style:_("button",{kind:p,disabled:l||(p==="next"?g-1===r:r===0)}),onClick:k,"aria-label":`Go to ${p} step`},x?null:b.createElement(v,{styles:e,inverted:f?p==="prev":p==="next",disabled:l||(p==="next"?g-1===r:r===0)}),E)};return b.createElement("div",{style:_("controls",{}),dir:f?"rtl":"ltr"},u?null:i&&typeof i=="function"?i({Button:O,setCurrentStep:n,currentStep:r,stepsLength:g,setIsOpen:o,steps:t}):b.createElement(O,{kind:"prev"}),c?null:b.createElement("div",{style:_("navigation",{})},Array.from({length:g},(y,p)=>p).map(y=>{var p;return b.createElement("button",{style:_("dot",{current:y===r,disabled:a||l}),onClick:()=>{!a&&!l&&n(y)},key:`navigation_dot_${y}`,"aria-label":((p=t[y])==null?void 0:p.navDotAriaLabel)||`Go to step ${y+1}`})})),u?null:s&&typeof s=="function"?s({Button:O,setCurrentStep:n,currentStep:r,stepsLength:g,setIsOpen:o,steps:t}):b.createElement(O,null))},fn=un,$e=({styles:e={},inverted:t=!1,disabled:n})=>{const r=ae(e);return b.createElement("svg",{viewBox:"0 0 18.4 14.4",style:r("arrow",{inverted:t,disabled:n})},b.createElement("path",{d:t?"M17 7.2H1M10.8 1L17 7.2l-6.2 6.2":"M1.4 7.2h16M7.6 1L1.4 7.2l6.2 6.2",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeMiterlimit:"10"}))},dn={Badge:on,Close:an,Content:cn,Navigation:fn,Arrow:$e},hn=e=>P(P({},dn),e),pn=({styles:e,components:t={},badgeContent:n,accessibilityOptions:r,disabledActions:o,onClickClose:s,steps:i,setCurrentStep:a,currentStep:c,transition:u,isHighlightingObserved:l,setIsOpen:f,nextButton:v,prevButton:g,disableDotsNavigation:_,rtl:O,showPrevNextButtons:y=!0,showCloseButton:p=!0,showNavigation:E=!0,showBadge:x=!0,showDots:k=!0,meta:h,setMeta:T,setSteps:M})=>{const C=i[c],{Badge:w,Close:R,Content:A,Navigation:S,Arrow:j}=hn(t),$=n&&typeof n=="function"?n({currentStep:c,totalSteps:i.length,transition:u}):c+1;function q(){o||(s&&typeof s=="function"?s({setCurrentStep:a,setIsOpen:f,currentStep:c,steps:i,meta:h,setMeta:T,setSteps:M}):f(!1))}return b.createElement(b.Fragment,null,x?b.createElement(w,{styles:e},$):null,p?b.createElement(R,{styles:e,"aria-label":r==null?void 0:r.closeButtonAriaLabel,disabled:o,onClick:q}):null,b.createElement(A,{content:C==null?void 0:C.content,setCurrentStep:a,currentStep:c,transition:u,isHighlightingObserved:l,setIsOpen:f}),E?b.createElement(S,{setCurrentStep:a,currentStep:c,setIsOpen:f,steps:i,styles:e,"aria-hidden":!(r!=null&&r.showNavigationScreenReaders),nextButton:v,prevButton:g,disableDots:_,hideButtons:!y,hideDots:!k,disableAll:o,rtl:O,Arrow:j}):null)},vn=pn,mn=e=>{var t=e,{currentStep:n,setCurrentStep:r,setIsOpen:o,steps:s=[],setSteps:i,styles:a={},scrollSmooth:c,afterOpen:u,beforeClose:l,padding:f=10,position:v,onClickMask:g,onClickHighlighted:_,keyboardHandler:O,className:y="reactour__popover",maskClassName:p="reactour__mask",highlightedMaskClassName:E,clipId:x,maskId:k,disableInteraction:h,disableKeyboardNavigation:T,inViewThreshold:M,disabledActions:C,setDisabledActions:w,disableWhenSelectorFalsy:R,rtl:A,accessibilityOptions:S={closeButtonAriaLabel:"Close Tour",showNavigationScreenReaders:!0},ContentComponent:j,Wrapper:$,meta:q,setMeta:G,onTransition:I=()=>"center"}=t,D=Z(t,["currentStep","setCurrentStep","setIsOpen","steps","setSteps","styles","scrollSmooth","afterOpen","beforeClose","padding","position","onClickMask","onClickHighlighted","keyboardHandler","className","maskClassName","highlightedMaskClassName","clipId","maskId","disableInteraction","disableKeyboardNavigation","inViewThreshold","disabledActions","setDisabledActions","disableWhenSelectorFalsy","rtl","accessibilityOptions","ContentComponent","Wrapper","meta","setMeta","onTransition"]),H;const m=s[n],N=P(P({},a),m==null?void 0:m.styles),{sizes:K,transition:V,observableRefresher:le,isHighlightingObserved:pe,target:W}=Jt(m,{block:"center",behavior:c?"smooth":"auto",inViewThreshold:M});d.useEffect(()=>(u&&typeof u=="function"&&u(W),()=>{l&&typeof l=="function"&&l(W)}),[]);const{maskPadding:Ve,popoverPadding:We,wrapperPadding:Be}=bn((H=m==null?void 0:m.padding)!=null?H:f),Q={setCurrentStep:r,setIsOpen:o,currentStep:n,setSteps:i,steps:s,setMeta:G,meta:q};function qe(){C||(g&&typeof g=="function"?g(Q):o(!1))}const Ge=typeof(m==null?void 0:m.stepInteraction)=="boolean"?!(m!=null&&m.stepInteraction):h?typeof h=="boolean"?h:h(Q):!1;d.useEffect(()=>(m!=null&&m.action&&typeof(m==null?void 0:m.action)=="function"&&(m==null||m.action(W)),(m==null?void 0:m.disableActions)!==void 0&&w(m==null?void 0:m.disableActions),()=>{m!=null&&m.actionAfter&&typeof(m==null?void 0:m.actionAfter)=="function"&&(m==null||m.actionAfter(W))}),[m]);const Ke=V?I:m!=null&&m.position?m==null?void 0:m.position:v,Ue=$||b.Fragment;return m?b.createElement(Ue,null,b.createElement(It,{mutationObservables:m==null?void 0:m.mutationObservables,resizeObservables:m==null?void 0:m.resizeObservables,refresh:le}),b.createElement(tn,{setCurrentStep:r,currentStep:n,setIsOpen:o,stepsLength:s.length,disableKeyboardNavigation:T,disable:C,rtl:A,clickProps:Q,keyboardHandler:O}),(!R||W)&&b.createElement(Vt,{sizes:V?yn:K,onClick:qe,styles:P({highlightedArea:U=>he(P({},U),{display:Ge?"block":"none"})},N),padding:V?0:Ve,highlightedAreaClassName:E,className:p,onClickHighlighted:U=>{U.preventDefault(),U.stopPropagation(),_&&_(U,Q)},wrapperPadding:Be,clipId:x,maskId:k}),(!R||W)&&b.createElement(Ut,{sizes:K,styles:N,position:Ke,padding:We,"aria-labelledby":S==null?void 0:S.ariaLabelledBy,className:y,refresher:n},j?b.createElement(j,P({styles:N,setCurrentStep:r,currentStep:n,setIsOpen:o,steps:s,accessibilityOptions:S,disabledActions:C,transition:V,isHighlightingObserved:pe,rtl:A},D)):b.createElement(vn,P({styles:N,setCurrentStep:r,currentStep:n,setIsOpen:o,steps:s,setSteps:i,accessibilityOptions:S,disabledActions:C,transition:V,isHighlightingObserved:pe,rtl:A,meta:q,setMeta:G},D)))):null},gn=mn;function bn(e){return typeof e=="object"&&e!==null?{maskPadding:e.mask,popoverPadding:e.popover,wrapperPadding:e.wrapper}:{maskPadding:e,popoverPadding:e,wrapperPadding:0}}var yn={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},wn={isOpen:!1,setIsOpen:()=>!1,currentStep:0,setCurrentStep:()=>0,steps:[],setSteps:()=>[],setMeta:()=>"",disabledActions:!1,setDisabledActions:()=>!1,components:{}},_n=b.createContext(wn),En=e=>{var t=e,{children:n,defaultOpen:r=!1,startAt:o=0,steps:s,setCurrentStep:i,currentStep:a}=t,c=Z(t,["children","defaultOpen","startAt","steps","setCurrentStep","currentStep"]);const[u,l]=d.useState(r),[f,v]=d.useState(o),[g,_]=d.useState(s),[O,y]=d.useState(""),[p,E]=d.useState(!1),x=P({isOpen:u,setIsOpen:l,currentStep:a||f,setCurrentStep:i&&typeof i=="function"?i:v,steps:g,setSteps:_,disabledActions:p,setDisabledActions:E,meta:O,setMeta:y},c);return b.createElement(_n.Provider,{value:x},n,u?b.createElement(gn,P({},x)):null)};const On={default:"#1A1A1A",white:"#FFFFFF",orange:"#CE2021",current:"currentColor"};function Se({variant:e="default",size:t=40,className:n,style:r}){const o=On[e],s=t*(799/2325);return L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:s,viewBox:"0 0 2325 799",fill:"none",className:n,style:r,"aria-hidden":"true",children:[L.jsx("rect",{x:"50",y:"50",width:"2225",height:"699",stroke:o,strokeWidth:"100"}),L.jsx("path",{d:"M492.333 199.627L599.833 295.627L600 295.776V491.707L492.207 599.5H199.5V199.5H492.19L492.333 199.627ZM334 347.5V448.5H435V347.5H334Z",fill:o}),L.jsx("path",{d:"M1108.5 497.715L1108.34 497.862L1001.34 599.362L1001.2 599.5H699V296.283L699.158 296.135L802.158 199.635L802.303 199.5H1108.5V497.715ZM855 347.5V448.5H956V347.5H855Z",fill:o}),L.jsx("path",{d:"M1616.94 200.24L1510.07 395.005L1616.94 598.768L1617.64 600.103L1616.28 599.451L1409 500.056L1208.22 599.448L1207.5 599.806V199.5H1617.34L1616.94 200.24ZM1332 337.5V439.207L1433.71 337.5H1332Z",fill:o}),L.jsx("path",{d:"M1716.5 599V200L1841 291.5L2125 200L2017.5 400L2125 599L1841 501L1716.5 599Z",fill:o,stroke:o})]})}function xn({caption:e,chipLabel:t,isLast:n,onAdvance:r,onEnd:o}){const s=t??(n?"Got it":"Next");return L.jsxs("div",{className:Ye("flex max-w-[min(20rem,calc(100vw-2rem))] flex-col gap-3 rounded-lg border","bg-popover text-popover-foreground shadow-floating p-4"),children:[L.jsxs("div",{className:"flex items-start gap-3",children:[L.jsxs("span",{className:"mt-0.5 shrink-0",children:[L.jsx(Se,{size:28,className:"dark:hidden"}),L.jsx(Se,{variant:"white",size:28,className:"hidden dark:block"})]}),L.jsx("p",{className:"text-sm leading-relaxed",children:e})]}),L.jsxs("div",{className:"flex items-center justify-end gap-2",children:[L.jsx(ve,{variant:"ghost",size:"sm",onClick:o,children:"Done"}),L.jsx(ve,{variant:"default",size:"sm",onClick:r,children:s})]})]})}const Rn=4e3,Sn=100;function kn(e){const[t,n]=d.useState({element:null,status:"resolving",anchor:e}),[r,o]=d.useState(e);return e!==r&&(o(e),n({element:null,status:"resolving",anchor:e})),d.useEffect(()=>{if(e===null)return;const s=Ce(e);let i=null,a=!1;const c=Date.now()+Rn,u=()=>{const f=document.querySelector(s);return f?(f!==i&&(f.scrollIntoView({block:"center",inline:"center"}),i=f,a=!0,n({element:f,status:"found",anchor:e})),!1):a?!1:Date.now()>=c?(n({element:null,status:"timeout",anchor:e}),!0):!1},l=setInterval(()=>{u()&&clearInterval(l)},Sn);return()=>clearInterval(l)},[e]),t}const Cn=".reactour__popover",Ln=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(", ");function ke(e){return Array.from(e.querySelectorAll(Ln))}function Mn(e,t){d.useEffect(()=>{var o;if(!e)return;const n=document.querySelector(Cn);if(!n)return;(o=ke(n)[0])==null||o.focus();const r=s=>{if(s.key!=="Tab")return;const i=ke(n);if(i.length===0)return;const a=i[0],c=i[i.length-1],u=document.activeElement;n.contains(u)?s.shiftKey&&u===a?(s.preventDefault(),c.focus()):!s.shiftKey&&u===c&&(s.preventDefault(),a.focus()):(s.preventDefault(),a.focus())};return document.addEventListener("keydown",r,!0),()=>document.removeEventListener("keydown",r,!0)},[e,t])}const ze="(prefers-reduced-motion: reduce)";function Tn(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia(ze).matches}function An(){const[e,t]=d.useState(Tn);return d.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia(ze),r=o=>t(o.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const In="dork-tour-mask--reduced-motion",Pn={mask:8,popover:10},Dn="x 280ms ease, y 280ms ease, width 280ms ease, height 280ms ease";function Hn({steps:e,activeIndex:t,onAdvance:n,onEnd:r}){const o=e[t],s=t>=e.length-1,i=Ze(),a=An(),c=kn((o==null?void 0:o.anchor)??null),[u,l]=d.useState(null);c.status==="found"&&c.element!==null&&c.anchor===(o==null?void 0:o.anchor)&&u!==t?l(t):!o&&u!==null&&l(null);const f=u!==null,v=u!==null?e[u]:void 0,g=d.useCallback(()=>{s?r():n()},[s,r,n]),_=d.useRef(g);d.useEffect(()=>{_.current=g},[g]),d.useEffect(()=>{c.status==="timeout"&&_.current()},[c.status]);const O=d.useRef(n),y=d.useRef(r);d.useEffect(()=>{O.current=n,y.current=r},[n,r]);const p=d.useRef(!1);d.useEffect(()=>{p.current=u===t},[u,t]);const[E,x]=d.useState(!1);d.useEffect(()=>{if(f&&!E){const w=requestAnimationFrame(()=>x(!0));return()=>cancelAnimationFrame(w)}},[f,E]),d.useEffect(()=>{if(!f)return;const w=document.getElementById("root");if(w)return w.inert=!0,()=>{w.inert=!1}},[f]),Mn(f,u??-1);const k=d.useMemo(()=>w=>{const R={...w,backgroundColor:"transparent",padding:0,boxShadow:"none",maxWidth:"none",color:"inherit"};return i?{...R,position:"fixed",top:"auto",left:0,right:0,bottom:0,transform:"none",display:"flex",justifyContent:"center",padding:"0 1rem 1rem"}:R},[i]),h=d.useCallback(w=>E?{...w,transition:Dn}:w,[E]),T=d.useMemo(()=>({popover:k,maskArea:h}),[k,h]),M=d.useMemo(()=>e.map((w,R)=>{const A=R===e.length-1;return{selector:Ce(w.anchor),stepInteraction:!1,content:L.jsx(xn,{caption:w.caption,chipLabel:w.chipLabel,isLast:A,onAdvance:()=>A?y.current():O.current(),onEnd:()=>y.current()})}}),[e]),C=d.useMemo(()=>e.map(w=>w.anchor).join("|"),[e]);return o?Qe.createPortal(L.jsxs(L.Fragment,{children:[L.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:f?(v==null?void 0:v.caption)??"":""}),f&&L.jsx(En,{steps:M,currentStep:u??0,defaultOpen:!0,showNavigation:!1,showPrevNextButtons:!1,showCloseButton:!1,showBadge:!1,showDots:!1,disableInteraction:!0,padding:Pn,styles:T,maskClassName:a?In:void 0,onClickMask:()=>r(),keyboardHandler:w=>{w.key==="Escape"?(w.preventDefault(),y.current()):w.key==="ArrowRight"&&p.current&&_.current()},children:L.jsx("span",{className:"hidden","aria-hidden":!0})},C)]}),document.body):null}const de={general:{id:"general",deepLink:{kind:"route",...X.home()},steps:[{anchor:Y.homeComposer,caption:z.general.composer,chipLabel:"Next"},{anchor:Y.homeTabs,caption:z.general.homeTabs,chipLabel:"Got it"}]},tasks:{id:"tasks",occasion:"tasks",offerLine:z.offers.tasks,deepLink:{kind:"route",...X.tasks()},steps:[{anchor:Y.tasksList,caption:z.tasks.tasksList,chipLabel:"Got it"}]},relay:{id:"relay",occasion:"relay",offerLine:z.offers.relay,deepLink:{kind:"route",...X.connections()},steps:[{anchor:Y.relayIntegrations,caption:z.relay.relayIntegrations,chipLabel:"Got it"}]},mesh:{id:"mesh",occasion:"mesh",offerLine:z.offers.mesh,deepLink:{kind:"route",...X.team()},steps:[{anchor:Y.teamRoster,caption:z.mesh.teamRoster,chipLabel:"Got it"}]}},F=Xe()(e=>({runningTourId:null,activeIndex:0,pendingOfferId:null,startTour:t=>e({runningTourId:t,activeIndex:0,pendingOfferId:null}),advanceStep:()=>e(t=>({activeIndex:t.activeIndex+1})),endTour:()=>e({runningTourId:null,activeIndex:0}),setPendingOffer:t=>e({pendingOfferId:t}),clearPendingOffer:()=>e({pendingOfferId:null})}));function Fe(){var x,k;const e=Je(),t=et(),{data:n}=tt({queryKey:me.current(),queryFn:()=>e.getConfig(),staleTime:rt}),r=((x=n==null?void 0:n.tours)==null?void 0:x.seen)??[],o=((k=n==null?void 0:n.tours)==null?void 0:k.declined)??[],s=F(h=>h.runningTourId),i=F(h=>h.activeIndex),a=F(h=>h.pendingOfferId),c=F(h=>h.startTour),u=F(h=>h.advanceStep),l=F(h=>h.endTour),f=F(h=>h.setPendingOffer),v=F(h=>h.clearPendingOffer),g=nt({mutationFn:h=>e.updateConfig({tours:h}),onSuccess:()=>t.invalidateQueries({queryKey:me.all}),meta:{errorLabel:"Couldn’t save your tour progress"}});function _(h){r.includes(h)||g.mutate({seen:[...r,h]})}function O(h){o.includes(h)||g.mutate({declined:[...o,h]})}function y(h){return r.includes(h)||o.includes(h)}function p(h){_(h),c(h)}function E(h){O(h),v()}return{seen:r,declined:o,isSuppressed:y,runningDefinition:s?de[s]:null,activeIndex:i,pendingOffer:a?de[a]:null,pendingOfferId:a,runTour:c,acceptOffer:p,declineOffer:E,setPendingOffer:f,advanceStep:u,endTour:l}}const Nn=1,jn=1,$n=2;function zn(){const{isSuppressed:e,setPendingOffer:t,pendingOfferId:n,runningDefinition:r}=Fe(),o=ot(y=>Object.values(y.statuses).some(p=>p.lifecycle==="streaming")),s=it(),i=st(),{data:a}=at(i),{data:c}=ft(s),{data:u}=lt(),l=a==null?void 0:a.length,f=s&&c?c.reduce((y,p)=>y+p.instances.length,0):void 0,v=u==null?void 0:u.agents.length,g=d.useRef(void 0),_=d.useRef(void 0),O=d.useRef(void 0);d.useEffect(()=>{const y=(E,x,k,h,T)=>{if(x===void 0)return T;const M=h.current;return M===void 0||!(M<k&&x>=k)?(h.current=x,T):o||T||(h.current=x,e(E))?T:(t(E),!0)};let p=n!==null||r!==null;p=y("tasks",l,Nn,g,p),p=y("relay",f,jn,_,p),y("mesh",v,$n,O,p)},[l,f,v,o,n,r,e,t])}function Bn(){zn();const{runningDefinition:e,activeIndex:t,advanceStep:n,endTour:r,runTour:o}=Fe(),s=ct(),i=ut({select:l=>l.location.pathname}),a=ge(l=>l.requestedTour),c=ge(l=>l.clearRequestedTour),u=(e==null?void 0:e.id)??null;return d.useEffect(()=>{if(a!==null){if(!(a in de)){c();return}if(u===a){c();return}o(a)}},[a,u,o,c]),d.useEffect(()=>{if(!e)return;const{to:l}=e.deepLink;i!==l&&s({to:l})},[e,i,s]),e?L.jsx(Hn,{steps:e.steps,activeIndex:t,onAdvance:n,onEnd:r}):null}export{Se as D,de as T,Bn as a,zn as b,Fe as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Q as u,cP as h,U as p,cQ as k,j as r,cR as D,cS as j,cT as x,cU as R,cV as L,cW as P,B as f,W as l}from"./index-DMYBI16t.js";import{u as m}from"./use-dev-links-Df2WkCic.js";function y(){const e=u();return p({mutationFn:t=>e.previewDevLink(t),meta:{suppressErrorToast:!0}})}function A(){const e=u(),t=m(),o=h(n=>n.forget);return p({mutationFn:n=>e.linkDevLink(n),meta:{suppressErrorToast:!0},onSuccess:n=>{n.status==="linked"&&(o(n.link),t())}})}function $(){const e=u(),t=m(),o=h(n=>n.forget);return p({mutationFn:({name:n,...s})=>e.unlinkDevLink(n,s),meta:{suppressErrorToast:!0},onSuccess:(n,s)=>{o(s),t()}})}const w=/^(\S+) didn't build:/;function g(e){const t=e.length===1?w.exec(e[0]):null;return t?`Couldn’t reload: ${t[1]} has a build error.`:"Couldn’t reload your last edit."}function T(e,t,o){if(e.state!=="active")return{kind:e.state};const n=o==null?void 0:o.lastReloadAt,s=t!==void 0&&(o===void 0||t.at>=o.linkedAt)?t:void 0,i=s!==void 0&&(n===void 0||s.at>=n);if(i&&s.errors&&s.errors.length>0)return{kind:"reload-failed",at:s.at,headline:g(s.errors),details:s.errors};const c=i?s.at:n;return c?{kind:"reloaded",at:c}:{kind:"watching"}}function C(e,t){const o=Math.max(0,Math.floor((t-new Date(e).getTime())/1e3));if(o<2)return"Reloaded just now";if(o<60)return`Reloaded ${o}s ago`;const n=Math.floor(o/60);if(n<60)return`Reloaded ${n}m ago`;const s=Math.floor(n/60);return s<24?`Reloaded ${s}h ago`:`Reloaded ${new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}`}function v(e){return e.agentPath?{scope:"project",projectPath:e.agentPath}:{scope:"global"}}function F(e,t){var s;const{scope:o}=v(t),n=(s=t.devLink)==null?void 0:s.path;return e==null?void 0:e.find(i=>i.name===t.name&&i.scope===o&&i.path===n)}function N(e,t){return t?{name:t.name,scope:t.scope,...t.projectPath!==void 0&&{projectPath:t.projectPath}}:{name:e.name,...v(e)}}function I(e,t){return t.restored==="installed"?{title:`${e} runs from the installed copy.`}:t.parkedLeftAt?{title:`${e} unlinked. Its installed copy couldn’t come back.`,description:`It’s still set aside at ${t.parkedLeftAt}.`}:t.leftInPlace?{title:`${e} unlinked.`,description:"Something else was in its place. It was left as it is."}:{title:`${e} removed.`}}function U({target:e,onClose:t,onUnlinked:o}){const n=$(),s=e?k(e.name):"",i=(e==null?void 0:e.then)==="install";async function c(){if(e)try{const a=await n.mutateAsync({name:e.name,scope:e.scope,...e.projectPath!==void 0&&{projectPath:e.projectPath}});if(i&&a.restored==="removed"&&!a.parkedLeftAt)l.success(`${s} unlinked.`,{description:a.leftInPlace?"Something else was in its place. It was left as it is.":"It’s not installed until you finish the install."});else{const d=I(s,a);l.success(d.title,d.description?{description:d.description}:void 0)}o==null||o(e,a),t()}catch(a){l.error(`Couldn’t unlink ${s}`,{description:a instanceof Error?a.message:void 0})}}return r.jsx(D,{open:e!==null,onOpenChange:a=>!a&&t(),children:r.jsx(j,{className:"!min-h-0 sm:max-w-md",children:e&&r.jsxs(r.Fragment,{children:[r.jsxs(x,{className:"text-left",children:[r.jsx(R,{className:"text-left",children:i?`Install the published ${s}?`:`Unlink ${s}?`}),r.jsx(L,{className:"text-left",children:i?`${s} is unlinked first. Your folder is not touched.`:e.parked?"Your installed copy comes back.":`${s} is removed. Your folder is not touched.`})]}),r.jsxs(P,{children:[r.jsx(f,{variant:"ghost",onClick:t,disabled:n.isPending,children:"Cancel"}),r.jsx(f,{onClick:()=>void c(),disabled:n.isPending,children:n.isPending?"Unlinking…":i?"Unlink and install":"Unlink"})]})]})})})}export{U,N as a,T as b,C as c,v as d,A as e,F as f,y as u};
|