dorkos 0.124.0 → 0.125.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +2319 -1483
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-BH8Ndn3e.js → AboutPage-GdrU2Z3k.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-K5Mew9EX.js → ActivityErrorState-D1T74VJE.js} +1 -1
- package/dist/client/assets/{ActivityPage-BB20L5HU.js → ActivityPage-7GXGUwd1.js} +1 -1
- package/dist/client/assets/{ActivityRow-C5O7rnmS.js → ActivityRow-C-8dACWp.js} +1 -1
- package/dist/client/assets/{AdapterIcon-Bmybvrzb.js → AdapterIcon-CRRs6yil.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-CkdV7Hhh.js → AdapterSetupWizard-K6DsejqG.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-BA2cDa7r.js → AgentOptionRow-CF5XZmBx.js} +1 -1
- package/dist/client/assets/{AgentPicker-CsIIPGZJ.js → AgentPicker-BXes2ymU.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-0fOxvaoe.js → AgentRequestCard-BuXVpWfb.js} +4 -4
- package/dist/client/assets/{AppearancePage-XOjkkoli.js → AppearancePage-DoqoCU4j.js} +1 -1
- package/dist/client/assets/ApplyToOverridesDialog-By8jgPX3.js +1 -0
- package/dist/client/assets/AttentionSignalRow-CgGyTDmT.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-9TVHyRPJ.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BzDxZ-G5.js} +3 -3
- package/dist/client/assets/{BindingDialog-DLoAQauL.js → BindingDialog-BXfjFGvP.js} +1 -1
- package/dist/client/assets/{BlintzCanvas-CYHsXAcY.js → BlintzCanvas-C-dobEns.js} +4 -4
- package/dist/client/assets/{CanvasCsvContent--Gr7Fe_U.js → CanvasCsvContent-ClMFJX7T.js} +4 -4
- package/dist/client/assets/CanvasFileContent-BoDE2jjA.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-fnWc0B7B.js +2 -0
- package/dist/client/assets/ChannelComposer-DIRPjyyf.js +44 -0
- package/dist/client/assets/{ChatAppsOff-D4L1zJVN.js → ChatAppsOff-DlCWmwEz.js} +1 -1
- package/dist/client/assets/{CodeMirrorDiff-DY_6ju-z.js → CodeMirrorDiff-COsbYyNC.js} +2 -2
- package/dist/client/assets/{CodeMirrorEditor-BUoDBsBv.js → CodeMirrorEditor-n3l14rY7.js} +1 -1
- package/dist/client/assets/{CommitmentList-wDkcVP9c.js → CommitmentList-S2O_hvwR.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-CzSM6b8R.js → CommitmentsPage-COOCQFpL.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-cERD9H2L.js → ComputerResourceView-PA9T4FZP.js} +1 -1
- package/dist/client/assets/{ComputerViewer-rMcfbk2_.js → ComputerViewer-CnYUWQBS.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-f7QeQbQo.js → ConnectionAccessLists-C1ZJtNl-.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-BmjtA6pw.js → ConnectionsPage-BBpWiN4-.js} +2 -2
- package/dist/client/assets/{ConventionPage-CH-ah6nI.js → ConventionPage-sa0Yn2uq.js} +3 -3
- package/dist/client/assets/{ExtensionPageRoute-CJIxa6ST.js → ExtensionPageRoute-BztrmZNp.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BP7EJ2JL.js → FloatingTanStackRouterDevtools-CqogiFob-CJrqr29-.js} +1 -1
- package/dist/client/assets/HandlePage-tZidnrlt.js +1 -0
- package/dist/client/assets/{HeartbeatPage-BUsf-qrU.js → HeartbeatPage-BkyUpdZt.js} +1 -1
- package/dist/client/assets/{KeyEntry-C2kWdN8q.js → KeyEntry-DAMr1NNY.js} +1 -1
- package/dist/client/assets/{LexicalField-CR8ulsI_.js → LexicalField-Cnzrh08A.js} +2 -2
- package/dist/client/assets/{ManagesPage-DTtsIOGi.js → ManagesPage-EAbQtygH.js} +1 -1
- package/dist/client/assets/{Marketplace-iaV5XAzv.js → Marketplace-BfADALGd.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-6tgzUfFj.js → MarketplaceSourcesView-u1WKUk-p.js} +1 -1
- package/dist/client/assets/{McpAppFrame-C7eYYdI9.js → McpAppFrame-Cz-Ttlqr.js} +1 -1
- package/dist/client/assets/{McpSigninBody-BDyGbJ7I.js → McpSigninBody-CkOBUhOz.js} +1 -1
- package/dist/client/assets/{Model3dViewer-BujDNuVS.js → Model3dViewer-CvLaSO7V.js} +1 -1
- package/dist/client/assets/NamePage-BS-oN_Hi.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-D4e-z2Jt.js → NewDirectMessageMenu-Be_4mBPd.js} +1 -1
- package/dist/client/assets/{NotificationsPage-CkDeTaJp.js → NotificationsPage-GCk9gfsW.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-CtbOt3r5.js → OpenMeshSwitch-BBzgYSUc.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-Vr4qZnmM.js → OperatorIdentityForm-ZAbJ4FJn.js} +1 -1
- package/dist/client/assets/PermissionHistory-DgmFpdJK.js +1 -0
- package/dist/client/assets/{PermissionsPage-f4QaX8oM.js → PermissionsPage-DHFt_34a.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-BkZruwF-.js → PersonalityPopover-CobRy95S.js} +1 -1
- package/dist/client/assets/PhotoPage-BmFypD13.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-BXC2K0tx.js → PreviewRefusedNotice-Ux5sq2Om.js} +1 -1
- package/dist/client/assets/ProfileFields-kBzeRPfc.js +1 -0
- package/dist/client/assets/{ProfilePanelContainer-DZoL65zQ.js → ProfilePanelContainer-CREt4ZC3.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-D9H7wsuT.js → ProfileRolePicker-hQbo8P6M.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-B5fDmc-g.js → PromptSuggestionChips-CmW1lIso.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-uVYhSqj7.js → ReportsToPopover-Dpa-_NsO.js} +1 -1
- package/dist/client/assets/RoomSurface-BQhgKnIE.js +1 -0
- package/dist/client/assets/{RoomsPage-yflYFulU.js → RoomsPage-BHUDRYzJ.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-DtGrX1Vq.js → RunsOnPopover-bGZ6VJoF.js} +1 -1
- package/dist/client/assets/RuntimeConnectFlow-DN2ElvcH.js +1 -0
- package/dist/client/assets/{RuntimeSetupDialog-Cr4GRi8c.js → RuntimeSetupDialog-CUFie4LV.js} +1 -1
- package/dist/client/assets/SeenDevices-D_FnsL7V.js +19 -0
- package/dist/client/assets/{SessionsPage-BWu-en78.js → SessionsPage-1uOPUCP9.js} +1 -1
- package/dist/client/assets/SettingsDialog-AbwEHDG8.js +12 -0
- package/dist/client/assets/{SkillsPage-BdUb9SZy.js → SkillsPage-BEobBuAr.js} +1 -1
- package/dist/client/assets/TaskDialogWrapper-BAFSmT-z.js +1 -0
- package/dist/client/assets/{TasksEmptyState-Bgcg9vxF.js → TasksEmptyState-BFw2ODM-.js} +2 -2
- package/dist/client/assets/{TasksPage-Ch5W2WQS.js → TasksPage-C0CMgSFx.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-CPwSIMRw.js → TeamComputerEntry-BpjxLA1n.js} +1 -1
- package/dist/client/assets/ToolsPage-dx-rQ2F1.js +2 -0
- package/dist/client/assets/TopologyGraph-LpxkBhGK.js +30 -0
- package/dist/client/assets/{TourHost-BPaSwh9I.js → TourHost--UYZoKlJ.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-BUWZUu5P.js → UnlinkDialog-BN2odbqD.js} +1 -1
- package/dist/client/assets/UnreadDivider-LbVIAoxM.js +1 -0
- package/dist/client/assets/{WidgetErrorCard-cS8yMCxU.js → WidgetErrorCard-CAUx4KUI.js} +7 -7
- package/dist/client/assets/WorkView-DVx4WoVI.js +63 -0
- package/dist/client/assets/_shell-D7Jp6t6_.js +80 -0
- package/dist/client/assets/{_shell._home-DCA5k-jb.js → _shell._home-uuqgFA3M.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BX4nFLna.js → _shell._home.activity-CiMsy7bF.js} +1 -1
- package/dist/client/assets/_shell._home.index-0Zm5q3-G.js +3 -0
- package/dist/client/assets/{_shell._home.tasks-BgUeEvhK.js → _shell._home.tasks-BClPai4g.js} +1 -1
- package/dist/client/assets/{_shell._home.workspaces-BPBdnkRt.js → _shell._home.workspaces-DH4BgLT0.js} +1 -1
- package/dist/client/assets/{_shell.channels-CX4kki7G.js → _shell.channels-BGXkXPhY.js} +4 -4
- package/dist/client/assets/{_shell.connections-0vP7g7E4.js → _shell.connections-BwjXkgi1.js} +1 -1
- package/dist/client/assets/{_shell.feedback-requests-TsuaO4eR.js → _shell.feedback-requests-j7gTBF5b.js} +1 -1
- package/dist/client/assets/_shell.marketplace-6JRXJ9gt.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-DriHXfBM.js +1 -0
- package/dist/client/assets/_shell.session-BXSWGdwi.js +1 -0
- package/dist/client/assets/{_shell.team-Bm6cOBhR.js → _shell.team-BgJu1gDa.js} +5 -5
- package/dist/client/assets/_shell.threads-C1IJJzcf.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-BNgicBXG.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-BNgicBXG.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-CrvoN15x.js → abnfDiagram-WEYOIA3C-BuEHMh0D.js} +1 -1
- package/dist/client/assets/{access-copy-B3yNZ7Gz.js → access-copy-BZNjpw9v.js} +1 -1
- package/dist/client/assets/{arc-CuT6QA_y.js → arc-BbGU9Ctb.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-CPXCZ9H4.js → architectureDiagram-ZHVYKT53-CdRG5sTM.js} +2 -2
- package/dist/client/assets/{banner-DRumuw3F.js → banner-C7kHJJGz.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-CM0rka9p.js → blockDiagram-RJAE7QA3-CBQ6YXoI.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-D4j2cXRy.js → c4Diagram-XDPPPE54-DavNcKCF.js} +1 -1
- package/dist/client/assets/{card-B3CtfC3R.js → card-D4ek-VvX.js} +1 -1
- package/dist/client/assets/channel-ClNeQ2PQ.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-KGyqhVpO.js → chunk-2E7WHVMD-ClO15ze9.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-Dl0BHoqK.js → chunk-2Q5K7J3B-DsLDzf_i.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-Da7vH6Kv.js → chunk-4EMNKR2T-D20fXIIK.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-DgBUEROO.js → chunk-55XCU76K-no_S5sRX.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BQ4mn-_I.js → chunk-5VM5RSS4-D5xWEZ2p.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-8LPR3mXf.js → chunk-JWPE2WC7-CnsdZOv0.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-BkIVXi4W.js → chunk-VQ5W62QI-DxYg8tsH.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-DQXJx06h.js → chunk-XXDRQBXY-7CQ-MKdC.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-DzCE7qlD.js → chunk-ZCHMQSOR-Ca7Jh42b.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-C_cZra7c.js → classDiagram-v2-4MYWR3UA-BvZXavcI.js} +1 -1
- package/dist/client/assets/{command-CDKbyppr.js → command-srO4Wv-5.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-DlXHdGwT.js → cose-bilkent-JH36ORCC-1NCiJaHv.js} +1 -1
- package/dist/client/assets/{cpu-B7xLO7jn.js → cpu-CFIu4JtK.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-HhP4ArLc.js → cynefin-EF2NZ3EQ-DgZeohG3.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-D4GgWnZV.js → cynefinDiagram-WF24UDRP-MQB2xbJK.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-SZ_OI2Zi.js → dagre-NK4GIZVX-BFHk_Y44.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-BN-_Ja5m.js → diagram-CBK3MWTC-CloEvZfp.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-t7AK6xnL.js → diagram-I5XIIV2D-9nzUtfKI.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-C1V7szSc.js → diagram-ODIL2UCW-DVdnelgu.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-DPtraQ2g.js → diagram-PFBEJUXE-tTEeiAHa.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-D2XNRB2b.js → diagram-RJA3I4VV-QFehV9_1.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-BieaRy38.js → diagram-TYUNFSNR-CYU5li-4.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-Bwki86UY.js → ebnfDiagram-V4P3TTPT-Cn040Beg.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-WEXSAyHB.js → elk-QONTBCTQ-tBbnwcb3.js} +1 -1
- package/dist/client/assets/{empty-state-J-UJ0BUU.js → empty-state-Bxfi7_ss.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-DIKASnoc.js → erDiagram-KYQIGQAA-DAA0fFlD.js} +1 -1
- package/dist/client/assets/{execution-config-ILQiJAmy.js → execution-config-afKaYukD.js} +1 -1
- package/dist/client/assets/{file-D40js1Zx.js → file-C-ooqbRY.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-Dg3ZpiAe.js → file-exclamation-point-BWWgLsMF.js} +1 -1
- package/dist/client/assets/{file-text-DgdvRfMk.js → file-text-BJt8biPY.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-D4kBWC_1.js → find-latest-widget-fence-DPQimlUD.js} +2 -2
- package/dist/client/assets/{flowDiagram-IUGLLWBU-CoavNw0M.js → flowDiagram-IUGLLWBU-vYI6TodS.js} +1 -1
- package/dist/client/assets/{form-DlPwEgQH.js → form-LJ2Rf9ny.js} +1 -1
- package/dist/client/assets/{format-cron-BrK8RzgT.js → format-cron-DrUISrHj.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-DccKAz7f.js → ganttDiagram-R7GPNTJY-DLYpSX7r.js} +3 -3
- package/dist/client/assets/{git-branch-BpxhecMq.js → git-branch-D5xr7U5P.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-DEbo_dgQ.js → gitGraphDiagram-PDYL7XHY-DNIbVOaY.js} +1 -1
- package/dist/client/assets/{graph-DROgI3M3.js → graph-DNjxkUSL.js} +1 -1
- package/dist/client/assets/{heart-c7u4Ezxt.js → heart-DnR_GX4I.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-CrATNdTR.js → highlighted-body-KPVGNVTW-L_Jd2uei.js} +1 -1
- package/dist/client/assets/image-lightbox-DZIhMyF3.js +1 -0
- package/dist/client/assets/{image-off-BExgZjfM.js → image-off-DdvvVxmq.js} +2 -2
- package/dist/client/assets/index-5eNHb7up.js +1 -0
- package/dist/client/assets/{index-BVqSmajJ.js → index-5hCWBj-r.js} +1 -1
- package/dist/client/assets/{index-Be0OJLWK.js → index-9GoQjBFo.js} +1 -1
- package/dist/client/assets/{index-DswGXheF.js → index-ANmu61E0.js} +1 -1
- package/dist/client/assets/{index-dyAahqKe.js → index-B0jt7Nng.js} +1 -1
- package/dist/client/assets/index-B1gC3xYN.js +1 -0
- package/dist/client/assets/{index-DDgOoXP1.js → index-B2wx4J9U.js} +1 -1
- package/dist/client/assets/{index-DksjixUS.js → index-BAIKz_P0.js} +1 -1
- package/dist/client/assets/{index-CT_pFeX_.js → index-BFecX5dC.js} +1 -1
- package/dist/client/assets/{index-CqPRAM_6.js → index-BWQfqbbe.js} +1 -1
- package/dist/client/assets/{index-BlyoyIck.js → index-BYeyKNKj.js} +1 -1
- package/dist/client/assets/{index-CD8aw6Jb.js → index-Ba9q2CoQ.js} +1 -1
- package/dist/client/assets/{index-DeRDq7bD.js → index-Blhsfk7u.js} +1 -1
- package/dist/client/assets/{index-mwf7ZNk2.js → index-Bpwvxz0c.js} +1 -1
- package/dist/client/assets/{index-CYy1cjtq.js → index-BqKjnd_r.js} +1 -1
- package/dist/client/assets/{index-2wezsLA_.js → index-Bri5bZfv.js} +1 -1
- package/dist/client/assets/{index-CZmqtJWZ.js → index-BsHyymmC.js} +1 -1
- package/dist/client/assets/index-BsmR2hi4.js +23 -0
- package/dist/client/assets/index-By-VWzSF.js +43 -0
- package/dist/client/assets/{index-D150FXCC.js → index-By8pKNSM.js} +1 -1
- package/dist/client/assets/{index-B3eeEDWj.js → index-BzKkoaB1.js} +3 -3
- package/dist/client/assets/{index-DaZ1I8s-.js → index-CDGWl8qL.js} +1 -1
- package/dist/client/assets/{index-J3Hh1MnL.js → index-CDo6TA8n.js} +1 -1
- package/dist/client/assets/{index-DINk1YfD.js → index-CLQIvYHP.js} +1 -1
- package/dist/client/assets/{index-D3YeRrne.js → index-CLbs0fcq.js} +1 -1
- package/dist/client/assets/{index-DxiRRZRo.js → index-CQ2atcs_.js} +1 -1
- package/dist/client/assets/index-CSqz4B0v.js +1 -0
- package/dist/client/assets/{index-BizvylBV.js → index-CXWlrRzK.js} +1 -1
- package/dist/client/assets/{index-CbHCZsbE.js → index-D-Q7CW4p.js} +1 -1
- package/dist/client/assets/index-D0ujPZdD.js +1 -0
- package/dist/client/assets/index-D1kQ19Gb.css +1 -0
- package/dist/client/assets/index-DHi8-3w0.js +1 -0
- package/dist/client/assets/index-DKTd8X7n.js +1053 -0
- package/dist/client/assets/{index-D0eJtRlK.js → index-DTuNXPGU.js} +1 -1
- package/dist/client/assets/{index-Ccf1XBTs.js → index-DXWsH2Ep.js} +1 -1
- package/dist/client/assets/index-DjFFFMc-.js +2 -0
- package/dist/client/assets/{index-C7B3eSOP.js → index-DqCxUalt.js} +1 -1
- package/dist/client/assets/{index-C5or4L_3.js → index-Ixk2o7yl.js} +1 -1
- package/dist/client/assets/{index-AzyLwYS_.js → index-ZYbeRA5f.js} +3 -3
- package/dist/client/assets/index-a6ojvFqI.js +1 -0
- package/dist/client/assets/{index-DT7pv2iW.js → index-adYd35CJ.js} +1 -1
- package/dist/client/assets/{index-DhHobJd3.js → index-ld6lMfGU.js} +1 -1
- package/dist/client/assets/{index-DNGNMW3c.js → index-r0stHl-2.js} +1 -1
- package/dist/client/assets/index-uIonuakd.js +1 -0
- package/dist/client/assets/{index-BEkYBuOq.js → index-xfRcAp50.js} +1 -1
- package/dist/client/assets/{index.esm-BFJ9SG0n.js → index.esm-j5KQ_b6S.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-VL8q5pKx.js → infoDiagram-MVDRKAX5-DjvSkTas.js} +1 -1
- package/dist/client/assets/{inline-code-BE9ckzPs.js → inline-code-DlVYFFW7.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-BLKkPYF-.js → ishikawaDiagram-HPEHV2GE-BBivrI5n.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-CSYpRobu.js → journeyDiagram-BOSHW7O7-DKdhbtdx.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-HilAqtZo.js → kanban-definition-FNSA4HC5-CkgAodR5.js} +1 -1
- package/dist/client/assets/{layers-Cm7coqdo.js → layers-CzyhuVSM.js} +1 -1
- package/dist/client/assets/{lightbulb-DqdWS75d.js → lightbulb-DwGE7s99.js} +1 -1
- package/dist/client/assets/{link-2-CDJapTSa.js → link-2-CljREnN9.js} +1 -1
- package/dist/client/assets/{list-runtime-types-CP82p1u4.js → list-runtime-types-D5ZO30FL.js} +1 -1
- package/dist/client/assets/{markdown-content-m_qereFc.js → markdown-content-CN_dGlgE.js} +1 -1
- package/dist/client/assets/{mention-pill-DV5HIG5Q.js → mention-pill-C6OT4gx4.js} +1 -1
- package/dist/client/assets/{mermaid.core-zxW6MBr-.js → mermaid.core-DNuzxE7q.js} +4 -4
- package/dist/client/assets/{message-square-off-YVtpbaJ0.js → message-square-off-DlkAPJdd.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-IAYemvOg.js → mindmap-definition-6OY57UG3-f9ygKKO1.js} +1 -1
- package/dist/client/assets/{more-details-ReA2ZFBn.js → more-details-DRPervoL.js} +1 -1
- package/dist/client/assets/{owner-notice-M4hn_1ep.js → owner-notice-C-Q9ySA7.js} +1 -1
- package/dist/client/assets/{package-CUuTl39E.js → package-BVNiaGrb.js} +1 -1
- package/dist/client/assets/{page-container-BnmNikNZ.js → page-container-D03bhclt.js} +1 -1
- package/dist/client/assets/pane-resize-handle-CZ9rHhNr.js +1 -0
- package/dist/client/assets/{paperclip-C6fYq5Zf.js → paperclip-DQQVX5tJ.js} +1 -1
- package/dist/client/assets/{path-input-DHn9-XaE.js → path-input-CQ16nhYd.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-CojaUwe7.js → pegDiagram-ECIUJNBX-CZ_YkcKh.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-CjP3pw6V.js → pieDiagram-GNMPY74T-DLHSPEH7.js} +1 -1
- package/dist/client/assets/{plug-DHQcxt7N.js → plug-CadJyjTp.js} +1 -1
- package/dist/client/assets/primer-trigger-DH4xfrlM.js +3 -0
- package/dist/client/assets/profile-errors-DSnHlauU.js +1 -0
- package/dist/client/assets/{progress-4FQQfnS6.js → progress-BB97hlmb.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-OP0Z8zcR.js → quadrantDiagram-D57K4MC3-BWcUu48x.js} +1 -1
- package/dist/client/assets/{query-error-state-BkUdxenP.js → query-error-state-B456s96E.js} +1 -1
- package/dist/client/assets/{radio-ta5Bw763.js → radio-DrpN3x3S.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-CT3NCb9b.js → railroadDiagram-Y72NRBL7-C2VRM83h.js} +1 -1
- package/dist/client/assets/registry-DRvQ3ChB.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-DwUuyxao.js → relay-trace-schemas-BYCaGsVJ.js} +2 -2
- package/dist/client/assets/repeat-DPzic7-j.js +11 -0
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-tde4lYGp.js → requirementDiagram-EQYSW5RA-B1bpdcM7.js} +1 -1
- package/dist/client/assets/{room-files-source-CZWhaaOy.js → room-files-source-aN4p_kDV.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-RfbbgUa4.js → rotate-ccw-clock-gqBy98sI.js} +1 -1
- package/dist/client/assets/{rotate-cw-B3rB_YSw.js → rotate-cw-mHsqEte-.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-sdCzIA7-.js → sankeyDiagram-SY24JHO5-QCGTTh9k.js} +1 -1
- package/dist/client/assets/{scroll-area-B4WB7Q40.js → scroll-area-DVd6ctli.js} +1 -1
- package/dist/client/assets/{search-x-DCUmWW2_.js → search-x-CzgTzL0z.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-DvzTJcKu.js → sequenceDiagram-BLEHNHQU-kiR1gX_u.js} +1 -1
- package/dist/client/assets/{shield-x-CANziVLc.js → shield-x-Btfd3Xnx.js} +1 -1
- package/dist/client/assets/{signed-in-DctJ2IWe.js → signed-in-gS3tMpTW.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-DuDA7TKE.js → sizeCapture-INFHLROL-Da56aMj0.js} +1 -1
- package/dist/client/assets/{soul-file-Co_8f1qw.js → soul-file-C7zd1yXt.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BJPX5JTC.js → stateDiagram-v2-A6IESKWZ-BZ3qlQWl.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-CiLSffGv.js → swimlanes-B3ENRKFQ-B-wp91_T.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Drg_8k1s.js +8 -0
- package/dist/client/assets/{table-BSAvOYPp.js → table-BIdFvzBs.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-5oq8sl82.js → timeline-definition-JXYKGLGB-CQojjy-8.js} +1 -1
- package/dist/client/assets/{trust-posture-D-Yjm6ot.js → trust-posture-DszobEjt.js} +1 -1
- package/dist/client/assets/{unplug-Bq_1WdV7.js → unplug-xlfZ61jC.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-CEzu54YH.js → unverified-catalog-notice-DymrAwtm.js} +1 -1
- package/dist/client/assets/{use-adapter-catalog-Tn3ZbPAj.js → use-adapter-catalog-CytBTafV.js} +1 -1
- package/dist/client/assets/{use-bindings-Bz9YRgO7.js → use-bindings-BPNK3sUh.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-D9oKJSQN.js → use-composer-prefs-DMQT0qiv.js} +1 -1
- package/dist/client/assets/{use-connector-management-CLYFraXN.js → use-connector-management-PDVdWccW.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-DkS713kG.js → use-deep-link-scroll-CwapSmGj.js} +1 -1
- package/dist/client/assets/{use-delete-binding-CukKpHBK.js → use-delete-binding-CgTwS83G.js} +1 -1
- package/dist/client/assets/{use-dev-links-DQ32IcGe.js → use-dev-links-BoZCIc4h.js} +1 -1
- package/dist/client/assets/use-direct-message-panel-Cs4I6669.js +1 -0
- package/dist/client/assets/{use-external-adapter-catalog-D-FO_XW6.js → use-external-adapter-catalog-PBrsasQ8.js} +1 -1
- package/dist/client/assets/{use-full-activity-feed-BNxcyb1j.js → use-full-activity-feed-C2seN-V1.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-pvzUlnxh.js +1 -0
- package/dist/client/assets/use-is-hub-CvEPWuj0.js +1 -0
- package/dist/client/assets/{use-local-browser-xg7WXAVK.js → use-local-browser-CF0uGQ6e.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-BgCSFw8s.js → use-mesh-topology-CnCeK4gS.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-qRbdZfOU.js → use-mounted-ref-BtAb14HI.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-B-4kZR7I.js → use-notification-prefs-B8LHpZTt.js} +1 -1
- package/dist/client/assets/{use-panel-tab-placements-CCq-mZlY.js → use-panel-tab-placements-DOXj0Pii.js} +1 -1
- package/dist/client/assets/use-pending-read-DBaC7e8N.js +1 -0
- package/dist/client/assets/{use-personality-commit-DwSisUfF.js → use-personality-commit-YV9FVC-a.js} +1 -1
- package/dist/client/assets/{use-promo-activation-Botoso6l.js → use-promo-activation-CjtGhz_3.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-RJXp-r_J.js → use-promo-dismissals-4rbLgSDG.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-B3390hGg.js → use-pulse-freshness-CGqANpVO.js} +1 -1
- package/dist/client/assets/{use-relay-config-BV0xcLwS.js → use-relay-config-CvU_70WJ.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-Du4hKHIJ.js → use-room-follow-claim-Doq_lWjk.js} +1 -1
- package/dist/client/assets/use-room-sessions-CoEIaBRt.js +1 -0
- package/dist/client/assets/{use-roving-tab-list-g2hO6Ruz.js → use-roving-tab-list-BzsrpjWV.js} +1 -1
- package/dist/client/assets/use-session-canvas-DQ9ND8il.js +27 -0
- package/dist/client/assets/use-status-budget-AnHroEO0.js +16 -0
- package/dist/client/assets/{use-unclaimed-chats-B92om889.js → use-unclaimed-chats-DzOLK27i.js} +1 -1
- package/dist/client/assets/use-update-config-NRkQbxae.js +1 -0
- package/dist/client/assets/{useMutationState-DdOGdpjP.js → useMutationState-BAU_J-u3.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-Di5pJvcw.js → usecaseDiagram-WPOLBNNX-BrHN0c6G.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-K7KAf26T.js → vennDiagram-Q3Y3IDCW-CbeP0Pbp.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-DVTaxQt9.js → wardleyDiagram-IVAIDKWA-mn5ebFhs.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-x-lSJm_B.js → xychartDiagram-4URNHDU4-C8fXRQEv.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261019185620_dor3037_wifi_holds.sql +8 -0
- package/dist/drizzle/20261020142444_read_cursor_room_thread.sql +17 -0
- package/dist/drizzle/20261021004938_dor3203_settle_turn_holds.sql +7 -0
- package/dist/drizzle/20261021153328_dor3175_person_chat_mode.sql +1 -0
- package/dist/drizzle/meta/20261019185620_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261020142444_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021004938_snapshot.json +14079 -0
- package/dist/drizzle/meta/20261021153328_snapshot.json +14086 -0
- package/dist/drizzle/meta/_journal.json +28 -0
- package/dist/server/extension-child.cjs +45 -3
- package/dist/server/index.js +61358 -29913
- package/dist/server/index.js.map +2 -2
- package/package.json +9 -9
- package/dist/client/assets/ApplyToOverridesDialog-CoO6V1G4.js +0 -1
- package/dist/client/assets/AttentionSignalRow-CjjZobp7.js +0 -1
- package/dist/client/assets/CanvasFileContent-estXyAbr.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-CkOo930M.js +0 -2
- package/dist/client/assets/HandlePage-Cg8H3mQS.js +0 -1
- package/dist/client/assets/NamePage-Bx8T98OF.js +0 -1
- package/dist/client/assets/PermissionHistory-DzU1rf2B.js +0 -1
- package/dist/client/assets/PhotoPage-CmrOIRjf.js +0 -1
- package/dist/client/assets/ProfileFields-BebX5oiv.js +0 -1
- package/dist/client/assets/RoomSurface-Bg5WV4Ep.js +0 -44
- package/dist/client/assets/RuntimeConnectFlow-DjReuQ-T.js +0 -1
- package/dist/client/assets/SeenDevices-SPWkdzoK.js +0 -19
- package/dist/client/assets/SettingsDialog-_dEXUhHe.js +0 -12
- package/dist/client/assets/TaskDialogWrapper-qYJPEoSR.js +0 -1
- package/dist/client/assets/ToolsPage-Idimrn3o.js +0 -2
- package/dist/client/assets/TopologyGraph-I4_mkMHM.js +0 -30
- package/dist/client/assets/_shell-ClVN2pUj.js +0 -80
- package/dist/client/assets/_shell._home.index-C8t8cw72.js +0 -3
- package/dist/client/assets/_shell.marketplace-CiL6YRbl.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-C0sI8e21.js +0 -1
- package/dist/client/assets/_shell.session-_hhBvFc6.js +0 -63
- package/dist/client/assets/_shell.x._extensionId-BWy5v1YE.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-BWy5v1YE.js +0 -1
- package/dist/client/assets/channel-DjBlTcCV.js +0 -1
- package/dist/client/assets/image-lightbox-DE_fHkw-.js +0 -1
- package/dist/client/assets/index-7jby-RRg.js +0 -1
- package/dist/client/assets/index-BGqvci3k.js +0 -1
- package/dist/client/assets/index-BkoMsjtM.js +0 -2
- package/dist/client/assets/index-BqIHtiaE.js +0 -1
- package/dist/client/assets/index-Cga0qx1T.js +0 -1033
- package/dist/client/assets/index-Ct4At33X.js +0 -1
- package/dist/client/assets/index-DCJQGDZk.js +0 -1
- package/dist/client/assets/index-DITPwUa9.js +0 -38
- package/dist/client/assets/index-DUZrTFYD.css +0 -1
- package/dist/client/assets/index-F-vqXYqa.js +0 -1
- package/dist/client/assets/index-InEBtYxw.js +0 -23
- package/dist/client/assets/primer-trigger-BmV5wjek.js +0 -3
- package/dist/client/assets/profile-errors-BSCuj3rT.js +0 -1
- package/dist/client/assets/registry-Dc102rws.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-Dv1-QS9J.js +0 -8
- package/dist/client/assets/terminal-6CdY-T1V.js +0 -6
- package/dist/client/assets/use-is-below-desktop-gTvJDvw4.js +0 -1
- package/dist/client/assets/use-is-hub-B1vPpkYU.js +0 -1
- package/dist/client/assets/use-jump-back-in-Bibj5tVk.js +0 -11
- package/dist/client/assets/use-pending-read-C8L_v4Zw.js +0 -1
- package/dist/client/assets/use-session-canvas-i30oMO_Q.js +0 -25
- package/dist/client/assets/use-session-diagnostics-a4b83F5J.js +0 -16
- package/dist/client/assets/use-update-config-Tbn3SodN.js +0 -1
- /package/dist/client/assets/{_shell-DIs3GY4I.css → WorkView-DIs3GY4I.css} +0 -0
package/dist/server/index.js.map
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/dist/server/index.js.map
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 64235504 bytes
|
|
4
|
+
sha256: db043cfcbf6f04487c8ce7dbee43f742b49f44a339a1427d441795ab3dc0ed30
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dorkos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.125.0",
|
|
4
4
|
"description": "You, multiplied. Build and run your business with an agent team. Your agents join your team chat, take on real work, and build the tools your company runs on.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Dorian Collier",
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
"node": ">=22.22.3"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
52
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.304",
|
|
53
53
|
"@anthropic-ai/sdk": "^0.123.0",
|
|
54
54
|
"@asteasolutions/zod-to-openapi": "9.1.0",
|
|
55
55
|
"@composio/core": "0.21.0",
|
|
56
56
|
"@inquirer/prompts": "^8.7.2",
|
|
57
57
|
"@modelcontextprotocol/sdk": "1.31.0",
|
|
58
58
|
"@ngrok/ngrok": "^1.7.0",
|
|
59
|
-
"@openai/codex": "0.
|
|
60
|
-
"@openai/codex-sdk": "~0.
|
|
61
|
-
"@opencode-ai/sdk": "^1.
|
|
59
|
+
"@openai/codex": "0.163.0",
|
|
60
|
+
"@openai/codex-sdk": "~0.163.0",
|
|
61
|
+
"@opencode-ai/sdk": "^1.19.3",
|
|
62
62
|
"better-sqlite3": "^12.11.1",
|
|
63
63
|
"dotenv": "^17.4.2",
|
|
64
64
|
"esbuild": "^0.28.2",
|
|
@@ -84,13 +84,13 @@
|
|
|
84
84
|
"vitest": "^4.1.11",
|
|
85
85
|
"@dorkos/browser": "0.0.0",
|
|
86
86
|
"@dorkos/db": "0.0.0",
|
|
87
|
-
"@dorkos/client": "0.0.0",
|
|
88
|
-
"@dorkos/eslint-config": "0.0.0",
|
|
89
|
-
"@dorkos/server": "0.0.0",
|
|
90
87
|
"@dorkos/harness": "0.0.0",
|
|
88
|
+
"@dorkos/eslint-config": "0.0.0",
|
|
89
|
+
"@dorkos/marketplace": "0.0.0",
|
|
91
90
|
"@dorkos/shared": "0.0.0",
|
|
92
91
|
"@dorkos/typescript-config": "0.0.0",
|
|
93
|
-
"@dorkos/
|
|
92
|
+
"@dorkos/server": "0.0.0",
|
|
93
|
+
"@dorkos/client": "0.0.0"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"build": "tsx scripts/build.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{gl as k,a1 as A,a2 as C,gm as x,a3 as j,a4 as T,au as R,gn as D,j as n,by as N,bz as I,G as P,bA as E,bC as L,r as B,cy as q,cz as _,cB as F,cC as K,cD as O,dy as z,go as M,e1 as W,de as Q,B as p}from"./index-Cga0qx1T.js";function Y(e,s){const a=new Set(e.filesAndCommands.followingAgentIds);if(s.kind==="files")return a.size;const t=e.exceptions.filter(o=>o.action===void 0),r=new Set;if(s.kind==="preset"){const o=new Map;for(const c of t){const l=o.get(c.agentId)??new Set;l.add(c.area),o.set(c.agentId,l)}for(const[c,l]of o)l.size>=k.length&&!a.has(c)&&r.add(c)}else{for(const o of t)o.area===s.area&&r.add(o.agentId);if(s.kind==="action")for(const o of e.exceptions)o.action===s.action&&r.add(o.agentId)}return Math.max(0,e.agentCount-r.size)}function J(e){return`affects ${e} ${e===1?"agent":"agents"}`}function V(){const e=A();return C({queryKey:x.overview(),queryFn:()=>e.getPermissions()})}function Z(e){const s=A(),a=j();return T({mutationFn:async t=>{if(t.kind==="preset"){if(e.kind!=="default")throw new Error("A preset is chosen for everyone.");return s.setPermissionPreset({preset:t.preset,surface:t.surface,...t.applyToAgents?{applyToAgents:t.applyToAgents}:{}})}const r={...t.areas?{areas:t.areas}:{},...t.actions?{actions:t.actions}:{},surface:t.surface};return e.kind==="agent"?s.patchAgentPermissions(e.agentId,{...r,...t.filesAndCommands!==void 0?{filesAndCommands:t.filesAndCommands}:{}}):s.patchPermissionDefaults({...r,...t.applyToAgents?{applyToAgents:t.applyToAgents}:{}})},onSettled:()=>{a.invalidateQueries({queryKey:x.all}),a.invalidateQueries({queryKey:["mesh","agents"]}),a.invalidateQueries({queryKey:R.all})}})}const h={blocked:"Blocked",ask:"Ask",allowed:"Allowed"},v={careful:"Careful",balanced:"Balanced",full:"Full power",trusted:"Trusted"},ee={careful:"Agents ask before they change anything, and can’t reach outside DorkOS.",balanced:"Agents run their rooms and ask before anything wider.",full:"Agents do everyday work alone and ask before installs or settings changes.",trusted:"Agents work on their own, and everything they do is recorded."};function se(e,s){switch(e){case"default-area":case"default-action":return"Changed from your preset";case"preset":return`From ${v[s??"trusted"]}`;case"floor":return"Never Allowed";case"always-asks":return"Always asks, so you see the change first";default:return""}}const te="Blocked stops agents that follow the rules. It isn’t a sandbox.";function ne(e){switch(e){case"agent":return"Set for this agent";case"runtime":return"Set in Settings → Runtimes";case"default":return"The setting everyone has";case"runtime-own":return"Not set, so each AI tool uses its own default"}}function w(e){return`the default (${v[e??"trusted"]})`}function ae(e){const s=h[e.state],a=e.agentName??"this agent";switch(e.source){case"inactive":return"Blocked, because this agent’s access was turned off.";case"floor":return`${s}. This area is locked, so it’s never Allowed.`;case"always-asks":return e.fromExtension?`${s}. Extension tools that can delete things always ask.`:`${s}. It always shows you the change first, so it’s never Allowed.`}if(e.destructiveAsk)return"Ask. Actions that run someone else’s code ask unless set one by one.";switch(e.source){case"agent-area":return`${s}, set for ${a}.`;case"agent-action":return`${s}, set for this one action on ${a}.`;case"default-area":return`${s} for everyone, changed from ${w(e.preset)}.`;case"default-action":return`${s} for everyone, set for this one action.`;case"preset":return`${s}, from ${w(e.preset)}.`}}function re(e,s,a){const t=e?D(e):null;switch(s){case"agent":return`${t}, set for ${a??"this agent"}.`;case"runtime":return`${t}, set in Settings → Runtimes.`;case"default":return`${t}, the setting everyone has.`;case"runtime-own":return"Not set, so each AI tool uses its own default."}}const U={settings:" in Settings","agent-page":" on the agent’s page","control-center":" in the Control Center","request-card":" from a request card","first-run":" during setup","agent-request":" from an agent's request",api:" through the API",cli:" from the command line",upgrade:"",undo:" with Undo","file-edit":""};function H(e){return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function G(e){if(!e)return null;const s=`on ${H(e.occurredAt)}`,a=U[e.surface];switch(e.attribution){case"signed-in":return`Changed by ${e.actorLabel.charAt(0).toLowerCase()+e.actorLabel.slice(1)} ${s}${a}.`;case"local-trust":return`Changed ${s}${a}. With login off, who is unknown.`;case"agent-request-approved":return`Changed ${s}: ${e.actorLabel}.`;case"agent":return`Changed by ${e.actorLabel} ${s}.`;case"upgrade":return`Set by an upgrade ${s}.`;case"outside":return`Changed outside DorkOS ${s}, in the agent’s settings file.`}}function oe({question:e,sentence:s,lastChange:a,className:t}){const r=G(a);return n.jsxs(N,{children:[n.jsx(I,{asChild:!0,children:n.jsx("button",{type:"button","aria-label":e,className:P("text-muted-foreground hover:text-foreground focus-visible:ring-ring inline rounded-sm py-2 text-xs underline decoration-dotted underline-offset-2 transition-colors focus-visible:ring-2 focus-visible:outline-none md:py-0",t),children:"Why?"})}),n.jsxs(E,{className:"w-72 space-y-1.5",align:"start",children:[n.jsx(L,{className:"text-sm font-medium",children:e}),n.jsx("p",{className:"text-sm","data-testid":"permission-why-source",children:s}),r?n.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"permission-why-change",children:r}):null]})]})}function ie({open:e,onCancel:s,subject:a,title:t,next:r,agents:o,affectedCount:c,onKeep:l,onUpdate:b,pending:m=!1}){const[u,f]=B.useState(new Set),S=r in h?h[r]:r,y=o.length,$=(i,g)=>{const d=new Set(u);g?d.add(i):d.delete(i),f(d)};return n.jsx(q,{open:e,onOpenChange:i=>{i||(f(new Set),s())},children:n.jsxs(_,{className:"!min-h-0 sm:max-w-md",children:[n.jsxs(F,{children:[n.jsx(K,{children:t??`Set ${a} to ${S} for everyone?`}),n.jsxs(O,{children:[y===1?"1 agent is":`${y} agents are`," set differently. Pick any that should follow."]})]}),n.jsxs(z,{className:"space-y-3",children:[n.jsx("ul",{className:"space-y-2","aria-label":"Agents set differently",children:o.map(i=>{const g=`apply-${i.agentId}`;return n.jsxs("li",{className:"flex items-center gap-2",children:[n.jsx(M,{id:g,checked:u.has(i.agentId),onCheckedChange:d=>$(i.agentId,d===!0)}),n.jsxs(W,{htmlFor:g,className:"text-sm font-normal",children:[i.agentName,": ",i.detail]})]},i.agentId)})}),n.jsxs("p",{className:"text-muted-foreground text-sm",children:["This affects ",c," ",c===1?"agent":"agents"," now."]})]}),n.jsxs(Q,{className:"gap-2",children:[n.jsx(p,{variant:"outline",onClick:()=>{f(new Set),l()},disabled:m,children:"Keep their settings"}),n.jsx(p,{onClick:()=>{const i=[...u];f(new Set),b(i)},disabled:m||u.size===0,children:"Update selected"})]})]})})}export{ie as A,te as B,oe as P,h as S,Z as a,re as b,Y as c,J as d,v as e,ne as f,se as g,ee as h,G as l,ae as s,V as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ax as r,ay as n,j as e,ar as i,a0 as o,B as d}from"./index-Cga0qx1T.js";const c={initial:{opacity:0,y:8},animate:{opacity:1,y:0}};function l({signal:t}){const a=r(),s=n(t.since);return e.jsxs(i.div,{variants:c,"data-slot":"attention-signal-row",className:"hover:bg-accent/50 flex min-w-0 items-center gap-2.5 rounded-md px-2 py-1 transition-colors",children:[e.jsx("span",{className:"bg-status-error size-1.5 shrink-0 rounded-full","aria-hidden":!0}),e.jsx(o,{className:"text-status-error/70 size-3.5 shrink-0","aria-hidden":!0}),e.jsxs("span",{className:"text-foreground/90 min-w-0 flex-1 truncate text-xs",children:[t.primary,t.secondary!==void 0&&e.jsxs("span",{className:"text-muted-foreground",children:[" · ",t.secondary]})]}),e.jsx("span",{className:"text-muted-foreground shrink-0 text-xs tabular-nums",children:s}),e.jsx(d,{variant:"ghost",size:"sm",className:"relative h-6 shrink-0 px-2 text-xs after:absolute after:-inset-3 md:after:hidden","aria-label":`Open ${t.primary}`,onClick:()=>void a.navigate({href:t.deepLink}),children:"Open →"})]})}export{l as A};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeMirrorEditor-BUoDBsBv.js","assets/index-Cga0qx1T.js","assets/index-DUZrTFYD.css","assets/index-DNGNMW3c.js","assets/index-AzyLwYS_.js","assets/BlintzCanvas-CYHsXAcY.js","assets/index-DksjixUS.js","assets/BlintzCanvas-DCXOV_yN.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as n,aW as B,gF as ne,j as t,B as L,a3 as se,G as ae,J as ie,gs as ce,gG as ue,aX as $,a1 as oe,gH as le,a2 as de}from"./index-Cga0qx1T.js";import{u as fe,a as he,b as ve}from"./use-session-canvas-i30oMO_Q.js";import{R as pe}from"./rotate-cw-B3rB_YSw.js";import"./query-keys-DeYqUDia.js";import"./index.esm-BFJ9SG0n.js";import"./WidgetErrorCard-cS8yMCxU.js";import"./index-F-vqXYqa.js";import"./card-B3CtfC3R.js";import"./progress-4FQQfnS6.js";import"./markdown-content-m_qereFc.js";import"./table-BSAvOYPp.js";import"./terminal-6CdY-T1V.js";import"./package-CUuTl39E.js";import"./heart-c7u4Ezxt.js";import"./git-branch-BpxhecMq.js";import"./file-text-DgdvRfMk.js";import"./file-D40js1Zx.js";import"./McpAppFrame-C7eYYdI9.js";import"./more-details-ReA2ZFBn.js";function O(e,i){return["canvas-file",e,i]}function me({documentId:e,sourcePath:i,binding:g,save:u,draftRef:y,revisionRef:r,finishAttemptRef:C,timerRef:b,finalSaveRef:x,invalidateConfirmedFile:f}){const p=n.useRef({binding:g,save:u,invalidateConfirmedFile:f}),P=n.useRef(null),o=n.useRef(null);return n.useLayoutEffect(()=>{p.current={binding:g,save:u,invalidateConfirmedFile:f}}),n.useLayoutEffect(()=>{const R=B.getState().openDocuments.find(h=>h.id===e);if(!R||typeof R.openedAt!="number")return;const w=ne(e,R.openedAt,i,{required:()=>!!p.current.binding,current:()=>{const h=o.current;return!!h&&h.revision===r.current&&h.attempt===C.current&&h.binding===p.current.binding&&h.save===p.current.save&&h.binding.current()},invalidateConfirmedFile:()=>p.current.invalidateConfirmedFile(),prepare:async()=>{var a;o.current=null;const{binding:h,save:_}=p.current;if(!(h!=null&&h.current()))return!1;b.current&&(clearTimeout(b.current),b.current=null);const F=y.current,m=r.current,c=++C.current,s=await _(F);return s.status!=="changed"&&s.status!=="no_op"||s.confirmed.content!==F||r.current!==m||C.current!==c||p.current.binding!==h||p.current.save!==_||!h.current()?!1:((a=x.current)==null||a.cancel(),x.current=null,o.current={revision:m,attempt:c,binding:h,save:_},!0)}});return P.current=w,()=>w.retire()},[e,i,y,r,C,b,x]),P}function ye(e,i,g){var c;const u=n.useRef(e),y=n.useRef(null),r=n.useRef(null),[C,b]=n.useState({identity:e.identity,phase:"pending",busy:!1});n.useLayoutEffect(()=>{u.current=e},[e]);const x=n.useCallback((s,a)=>{y.current===s&&u.current.identity===s&&u.current.current()&&b(d=>({identity:s,...a,historical:a.historical??(d.identity===s?d.historical:void 0)}))},[]),f=n.useCallback(s=>{y.current!==s||u.current.identity!==s||b(a=>a.identity===s?{...a,phase:"unavailable",busy:!1}:{identity:s,phase:"unavailable",busy:!1})},[]),p=e.identity,P=e.supported;n.useLayoutEffect(()=>{const s=u.current;r.current=null,y.current=p;let a=!1;return P&&i==="ready"&&s.discover().then(d=>{a||(d.status==="observed"?x(p,{phase:"ready",discovery:d.value,busy:!1}):d.status!=="idle"?x(p,{phase:"unavailable",busy:!1}):f(p))}),()=>{a=!0,r.current=null,y.current===p&&(y.current=null)}},[p,P,i,g,x,f]);const o=C.identity===e.identity?C:void 0,R=n.useCallback(async()=>{const s=u.current,a=s.identity;if(y.current!==a||!s.current())return;r.current=null,b(j=>({identity:a,phase:"pending",busy:!0,historical:j.identity===a?j.historical:void 0}));const d=await s.discover(!0);d.status==="observed"?x(a,{phase:"ready",discovery:d.value,busy:!1}):d.status!=="idle"?x(a,{phase:"unavailable",busy:!1}):f(a)},[x,f]),w=n.useCallback(async s=>{const a=u.current,d=a.identity;if(y.current!==d||!a.current())return;r.current=null,b(l=>({identity:d,phase:"pending",busy:!0,discovery:l.identity===d?l.discovery:void 0,historical:l.identity===d?l.historical:void 0}));const j=await a.recover(s);j.status==="observed"?x(d,{phase:"ready",discovery:j.value.discovery,historical:j.value.result.entry,busy:!1}):j.status!=="idle"?x(d,{phase:j.status==="local_uncertain"?"local_uncertain":"unavailable",busy:!1}):f(d)},[x,f]),h=n.useCallback(async()=>{const s=u.current,a=s.identity;if(y.current!==a||!s.current())return{status:"idle"};const d={};r.current=d,b(l=>l.identity===a?{...l,phase:"pending",busy:!0}:l);const j=await s.inspectCurrent();return r.current!==d?{status:"idle"}:(r.current=null,j.status==="idle"&&f(a),y.current===a&&u.current.identity===a&&s.current()&&j.status!=="idle"&&b(l=>l.identity===a?{...l,phase:j.status==="observed"?"ready":j.status==="local_uncertain"?"local_uncertain":"unavailable",busy:!1}:l),j)},[f]),_=e.supported&&i==="ready",F=i==="pending"?"pending":(o==null?void 0:o.phase)??"pending",m=_&&(F!=="ready"||((c=o==null?void 0:o.discovery)==null?void 0:c.admission)==="blocked");return{supported:_,phase:F,editBlocked:m,busy:(o==null?void 0:o.busy)??F==="pending",discovery:o==null?void 0:o.discovery,historical:o==null?void 0:o.historical,refresh:R,recover:w,inspectCurrent:h}}function xe({recovery:e,editing:i,loadCurrent:g}){var u,y;return e.supported?t.jsxs("section",{"aria-label":"Previous file saves",className:"mx-2 mt-2 rounded border p-2 text-sm",children:[e.phase==="pending"&&t.jsx("p",{role:"status",children:"Checking previous saves…"}),e.phase==="unavailable"&&t.jsx("p",{role:"alert",children:"Previous save evidence is unavailable. New saves stay blocked until it can be checked."}),e.phase==="local_uncertain"&&t.jsx("p",{role:"alert",children:"Use Retry original save. Checking previous saves won’t confirm this save."}),((u=e.discovery)==null?void 0:u.admission)==="blocked"&&t.jsx("p",{role:"alert",children:"An unresolved original save blocks this file. This list may not include the blocking operation."}),e.discovery&&t.jsxs(t.Fragment,{children:[!e.discovery.entries.length&&t.jsx("p",{children:"No matching recent saves."}),e.discovery.hasMore&&t.jsx("p",{children:"Only the latest 25 matching saves are shown. Older evidence is omitted."}),t.jsx("ul",{children:e.discovery.entries.map(r=>t.jsxs("li",{children:[t.jsxs("span",{children:[r.eventId,":"," ",r.state==="receipt"?"Historical save recorded":r.state==="review"?"Original save needs review":r.state==="no_op"?"Original save made no change":"Original save failed before replacement"]}),r.state==="review"&&(r.reason==="prepared_without_replacement"?t.jsx("p",{children:"This save needs manual review. These controls won’t write the file."}):t.jsxs(t.Fragment,{children:[t.jsx("p",{children:"The original saved replacement must be proven before its receipt can be settled."}),t.jsx(L,{type:"button",size:"sm",variant:"ghost",disabled:e.busy||i,onClick:()=>void e.recover(r.eventId),children:"Recover original receipt"})]}))]},r.eventId))})]}),((y=e.historical)==null?void 0:y.state)==="receipt"&&t.jsxs("div",{role:"status",children:[t.jsx("p",{children:"Previous save confirmed. Your current draft may differ."}),t.jsx("p",{children:e.historical.currentFileMatch==="different"?"The current file differs from that historical save.":e.historical.currentFileMatch==="same_saved_replacement"?"The saved replacement matched when checked; current bytes still require a fresh load.":"The current file was not checked."})]}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(L,{type:"button",size:"sm",variant:"ghost",disabled:e.busy||i,onClick:()=>void e.refresh(),children:"Check previous saves"}),t.jsx(L,{type:"button",size:"sm",variant:"ghost",disabled:i||e.editBlocked||e.busy,onClick:g,children:"Load current file"})]}),t.jsx("p",{children:"These controls don’t resend drafts or confirm agent delivery. Use Load current file."})]}):null}const be=n.lazy(()=>$(()=>import("./CodeMirrorEditor-BUoDBsBv.js"),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.CodeMirrorEditor}))),ge=n.lazy(()=>$(()=>import("./BlintzCanvas-CYHsXAcY.js").then(e=>e.B),__vite__mapDeps([5,1,2,6,4,7])).then(e=>({default:e.BlintzCanvas}))),je=500;function Ce(e,i){return i==="markdown"||/\.(md|markdown|mdx)$/i.test(e)}function ke(e){switch(e){case"saving":return"Saving…";case"saved":return"Saved";case"error":return"Couldn’t save";case"uncertain":return"Save not confirmed";default:return null}}function W({content:e,documentId:i,cwd:g,loaded:u,theme:y,isEditing:r,onEditingChange:C,setDocumentEditing:b,observedBinding:x,fileSaveObservation:f="unavailable",recoveryBinding:p}){const P=e.readOnly!==!0,o=Ce(e.sourcePath,e.language),R=se(),[w,h]=n.useState(u),[_,F]=n.useState(),m=n.useRef(x);n.useLayoutEffect(()=>{m.current=x},[x]);const c=fe({documentId:i,sourcePath:e.sourcePath,cwd:g,loadedContent:u,documentSaveBinding:_,documentRecoveryBinding:p}),s=ye(c.recovery,f,p),a=he({cwd:g,sourcePath:o?e.sourcePath:null,content:w,saved:c.status==="saved"}),d=n.useRef(!1),j=n.useRef(r);n.useLayoutEffect(()=>(d.current=!0,j.current=r,()=>{d.current=!1}),[r]);const l=n.useRef(null),S=n.useRef(w),D=n.useRef(0),E=n.useRef(0),A=n.useRef(c.save),Q=n.useRef(c.prepareFinalSave),H=n.useRef(c.waitForCloseDrain),z=n.useRef(null),U=n.useRef(C),K=me({documentId:i,sourcePath:e.sourcePath,binding:_,save:c.save,draftRef:S,revisionRef:D,finishAttemptRef:E,timerRef:l,finalSaveRef:z,invalidateConfirmedFile:()=>{R.invalidateQueries({queryKey:O(g,e.sourcePath)}).catch(()=>{})}});n.useEffect(()=>{S.current=w,A.current=c.save,Q.current=c.prepareFinalSave,H.current=c.waitForCloseDrain,U.current=C});const G=n.useCallback(v=>{var k;D.current+=1,S.current=v,h(v),(k=z.current)==null||k.cancel(),z.current=Q.current(v),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,A.current(S.current)},je)},[]),J=()=>{var N;if(s.editBlocked||f==="pending"||f==="ready"&&!((N=m.current)!=null&&N.current()))return;const v=m.current,k=v&&Object.freeze({...v.incarnation});F(v!=null&&v.current()&&k?{incarnation:k,current:()=>{const T=m.current;return!!T&&ue(k,T.incarnation)&&T.current()}}:void 0),D.current+=1,S.current=u,h(u),C(!0),b(i,!0)},X=async()=>{l.current&&(clearTimeout(l.current),l.current=null);const v=S.current,k=D.current,N=++E.current,T=await A.current(v);if(T.status!=="changed"&&T.status!=="no_op"||D.current!==k||E.current!==N||T.confirmed.content!==v)return;const M=T.confirmed;M.content===S.current&&R.setQueryData(O(g,e.sourcePath),q=>q&&{...q,content:M.content,hash:M.hash}),C(!1),b(i,!1)},Z=()=>{R.invalidateQueries({queryKey:O(g,e.sourcePath)})};n.useEffect(()=>{var v;r||(l.current&&clearTimeout(l.current),l.current=null,(v=z.current)==null||v.cancel(),z.current=null)},[r]),n.useEffect(()=>{const v=K.current;return()=>{var T;l.current&&(clearTimeout(l.current),l.current=null);const k=(T=z.current)==null?void 0:T.flush(),N=S.current;v==null||v.settleRetirement(Promise.resolve(k).then(()=>H.current(N))),z.current=null,b(i,!1),U.current(!1)}},[i,b,K]);const ee=async()=>{if(r||!d.current||s.editBlocked)return;const v=D.current,k=await s.inspectCurrent();k.status!=="observed"||!d.current||j.current||D.current!==v||!c.recovery.current()||R.setQueryData(O(g,e.sourcePath),N=>N&&{...N,...k.value})},te=()=>{const v=c.adoptDisk();v!=null&&h(v)},re=()=>{c.overwrite(S.current)},V=c.status==="saved"?c.confirmedContent!==w?"Unsaved changes":c.documentReceipt?"Save recorded":"Saved to file":ke(c.status),Y=r?w:u;return t.jsxs("div",{className:"relative flex h-full flex-col",children:[t.jsxs("div",{className:"sticky top-0 z-10 flex h-0 items-start justify-end gap-2 pr-2",children:[P&&V&&t.jsx("span",{className:ae("mt-3 text-xs",c.status==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",children:V}),!r&&f==="pending"&&t.jsx("span",{role:"status",children:"Checking document…"}),!r&&t.jsx(L,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:Z,"aria-label":"Refresh from disk",children:t.jsx(pe,{className:"size-4"})}),P&&t.jsx(L,{type:"button",variant:"ghost",size:"icon-md",className:"text-muted-foreground hover:text-foreground mt-2",onClick:r?()=>void X():J,"aria-label":r?"Finish editing":"Edit file",disabled:!r&&(f==="pending"||s.editBlocked),"data-document-save-observation":f,children:r?t.jsx(ie,{className:"size-4"}):t.jsx(ce,{className:"size-4"})})]}),t.jsx(xe,{recovery:s,editing:r,loadCurrent:()=>void ee()}),c.status==="uncertain"&&t.jsxs("div",{role:"status",className:"mx-2 mt-2 flex items-center gap-2 text-sm",children:[t.jsx("span",{children:"Save not confirmed. Retry the original save before saving another draft."}),t.jsx(L,{type:"button",variant:"ghost",size:"sm",onClick:()=>void c.retryUnconfirmed(),children:"Retry original save"})]}),c.status==="conflict"&&t.jsxs("div",{className:"bg-destructive/10 text-destructive mx-2 mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md px-3 py-2 text-sm",children:[t.jsx("span",{className:"flex-1",children:"This file changed on disk since you opened it."}),t.jsx(L,{type:"button",variant:"ghost",size:"sm",className:"h-7",onClick:te,children:"Reload"}),t.jsx(L,{type:"button",variant:"destructive",size:"sm",className:"h-7",onClick:re,children:"Overwrite"})]}),t.jsx("div",{className:"min-h-0 flex-1",children:t.jsx(n.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading editor…"}),children:o?t.jsx("div",{className:"px-2 pb-6",children:t.jsx(ge,{value:Y,editable:r,onChange:r?G:void 0,wikiLinks:a})}):t.jsx(be,{value:Y,editable:r,filename:e.sourcePath,languageHint:e.language,theme:y,onChange:r?G:void 0})})})]})}function Re(e){const{fileSaveBinding:i,fileSaveObservation:g}=ve(e.documentId);return t.jsx(W,{...e,observedBinding:i,recoveryBinding:i,fileSaveObservation:g})}function we(e){switch(e==null?void 0:e.code){case"NOT_FOUND":return"This file doesn’t exist.";case"NOT_A_FILE":return"This path is a directory, not a file.";case"TOO_LARGE":return"This file is too large to open here.";case"BINARY_FILE":return"This file isn’t text, so the editor can’t show it.";default:return"This file couldn’t be loaded."}}function Ke({content:e,documentId:i}){const g=oe(),u=B(m=>m.selectedCwd),y=B(m=>m.setDocumentEditing),r=B(m=>{var c;return((c=m.openDocuments.find(s=>s.id===i))==null?void 0:c.editing)??!1}),C=le(),b=B(m=>m.canvasSessionId),x=B(m=>m.roomCanvasLiveRoomId),{data:f,error:p,isLoading:P}=de({queryKey:O(u,e.sourcePath),enabled:u!==null,queryFn:()=>g.readFileContent(u,e.sourcePath),staleTime:3e4,retry:!1}),[o,R]=n.useState(null),w=m=>{R(m&&f?{pinnedHash:f.hash}:null)};if(u===null)return t.jsx(I,{children:"Open a chat to view files."});if(P)return t.jsx(I,{children:"Loading file…"});if(p||!f)return t.jsx(I,{children:we(p)});const h=o!==null&&r,_=(h?o==null?void 0:o.pinnedHash:null)??f.hash,F=b&&!x?Re:W;return t.jsx(F,{content:e,documentId:i,cwd:u,loaded:f.content,theme:C,isEditing:h,onEditingChange:w,setDocumentEditing:y},`${e.sourcePath}:${_}`)}function I({children:e}){return t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:e})})}export{Ke as CanvasFileContent};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Model3dViewer-BujDNuVS.js","assets/index-Cga0qx1T.js","assets/index-DUZrTFYD.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a1 as a,aW as n,r as s,j as t,aX as p}from"./index-Cga0qx1T.js";import{r as u}from"./use-session-canvas-i30oMO_Q.js";import"./rotate-cw-B3rB_YSw.js";import"./query-keys-DeYqUDia.js";import"./index.esm-BFJ9SG0n.js";import"./WidgetErrorCard-cS8yMCxU.js";import"./index-F-vqXYqa.js";import"./card-B3CtfC3R.js";import"./progress-4FQQfnS6.js";import"./markdown-content-m_qereFc.js";import"./table-BSAvOYPp.js";import"./terminal-6CdY-T1V.js";import"./package-CUuTl39E.js";import"./heart-c7u4Ezxt.js";import"./git-branch-BpxhecMq.js";import"./file-text-DgdvRfMk.js";import"./file-D40js1Zx.js";import"./McpAppFrame-C7eYYdI9.js";import"./more-details-ReA2ZFBn.js";const d=s.lazy(()=>p(()=>import("./Model3dViewer-BujDNuVS.js"),__vite__mapDeps([0,1,2])).then(e=>({default:e.Model3dViewer})));function f(e){var o;const r=(o=e.split(".").pop())==null?void 0:o.toLowerCase();return r==="glb"||r==="gltf"?"gltf":r==="stl"?"stl":r==="obj"?"obj":r==="3mf"?"3mf":r==="ply"?"ply":r==="fbx"?"fbx":r==="dae"?"dae":null}function O({content:e}){const r=a(),o=n(i=>i.selectedCwd),l=s.useMemo(()=>u(e.src,i=>r.mediaUrl(o??"",i)),[e.src,r,o]),m=s.useMemo(()=>f(e.src),[e.src]);return l.url===null||m===null?t.jsx("div",{className:"text-muted-foreground flex h-full items-center justify-center p-8 text-center",children:t.jsx("p",{children:"This 3D model can’t be displayed here."})}):t.jsx("div",{className:"bg-muted/40 h-full w-full",children:t.jsx(s.Suspense,{fallback:t.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading 3D viewer…"}),children:t.jsx(d,{url:l.url,format:m,label:e.title??"Canvas 3D model"})})})}export{O as CanvasModel3dContent,f as formatOf};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Cga0qx1T.js";import{a as t}from"./ProfileFields-BebX5oiv.js";import"./profile-errors-BSCuj3rT.js";import"./use-mounted-ref-qRbdZfOU.js";function n({member:r}){return o.jsx(t,{member:r})}export{n as HandlePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-Cga0qx1T.js";import{P as m}from"./ProfileFields-BebX5oiv.js";import"./profile-errors-BSCuj3rT.js";import"./use-mounted-ref-qRbdZfOU.js";function a({member:r}){return o.jsx(m,{member:r})}export{a as NamePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s,eN as A,eO as P,G as k,gz as Y,a1 as E,a2 as q,gm as R,r as N,a3 as Z,a4 as ee,au as se,a7 as te,b8 as ne,B as x,hy as v,by as W,bz as L,C as U,bA as B,bC as D,T as ae,gn as g,hz as w,gV as _,gW as H,e as C,b6 as ie,hA as le,hB as re}from"./index-Cga0qx1T.js";import{u as y,c as oe,a as p,l as K,S as f,P as b,s as z,d as T,f as $,b as M,e as S,g as de,A as ce}from"./ApplyToOverridesDialog-CoO6V1G4.js";const I=[{value:"blocked",label:"Blocked"},{value:"ask",label:"Ask"},{value:"allowed",label:"Allowed"}];function Q({value:e,onChange:t,floor:n=!1,disabled:a=!1,className:l,"aria-label":o}){const d=n?I.filter(i=>i.value!=="allowed"):I;return s.jsx(A,{"aria-label":o,value:e??"",onValueChange:i=>t(i),disabled:a,className:k("w-full md:w-auto",l),children:d.map(i=>s.jsx(P,{value:i.value,className:k(Y,"md:min-h-0 md:min-w-16"),children:i.label},i.value))})}function ue(e){const t=E();return q({queryKey:R.agent(e??""),queryFn:()=>t.getAgentPermissions(e),enabled:!!e})}function me(e){const{data:t}=y();return N.useMemo(()=>{const n=new Map;for(const a of(t==null?void 0:t.exceptions)??[]){if(a.area!==e)continue;const l=n.get(a.agentId);(!l||l.action&&!a.action)&&n.set(a.agentId,a)}return[...n.values()]},[t,e])}function he(e){const t=E();return q({queryKey:R.history(e),queryFn:()=>t.getPermissionHistory(e?{agentId:e,limit:50}:{limit:50})})}function xe(e){var n;const t=e;return(t==null?void 0:t.code)!=="UNDO_CONFLICT"?null:((n=t.body)==null?void 0:n.conflicts)??[]}function fe(){const e=E(),t=Z();return ee({mutationFn:({eventId:n,force:a})=>e.undoPermissionChange(n,a?{force:!0}:{}),meta:{suppressErrorToast:!0},onSettled:()=>{t.invalidateQueries({queryKey:R.all}),t.invalidateQueries({queryKey:["mesh","agents"]}),t.invalidateQueries({queryKey:se.all})}})}function F(e){const{data:t}=y();return t?oe(t,e):void 0}function j(e){te.error(e instanceof Error&&e.message?e.message:"Couldn’t save that change. Try again.")}function V({areaId:e,label:t,description:n,floor:a,value:l,sourceText:o,why:d,changed:i=!1,onChange:m,onReset:r,disabled:u=!1,footer:c,details:h}){return s.jsxs("div",{className:"@container","data-testid":`permission-row-${e}`,children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[i?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:t}),a?s.jsx(ne,{className:"text-muted-foreground size-3.5","aria-label":"Never Allowed"}):null]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:n}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:o}),d?s.jsxs(s.Fragment,{children:[o?" · ":null,d]}):null]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(Q,{value:l,onChange:m,floor:a,disabled:u,"aria-label":t}),i&&r?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:r,disabled:u,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null,c]})]}),h]})}function ge({area:e,exception:t}){const n=p({kind:"agent",agentId:t.agentId}),a=()=>n.mutate({kind:"patch",...t.action?{actions:{[t.action]:null}}:{areas:{[e]:null}},surface:"settings"}),l=K(t.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[t.agentName,": ",f[t.state],t.action?" (one action)":""]}),l?s.jsx("span",{className:"text-muted-foreground block text-xs",children:l}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",onClick:a,disabled:n.isPending,"aria-label":`Reset ${t.agentName} to the default`,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function pe({area:e,areaLabel:t,agents:n}){if(n.length===0)return null;const a=n.length===1?"1 agent differs":`${n.length} agents differ`;return s.jsxs(W,{children:[s.jsx(L,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start md:self-end",children:[a,s.jsx(U,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(B,{className:"w-80 space-y-2",children:[s.jsxs(D,{className:"text-sm font-medium",children:["Set differently for ",t]}),s.jsx("ul",{className:"space-y-1",children:n.map(l=>s.jsx(ge,{area:e,exception:l},l.agentId))})]})]})}function G(e,t){return e.resolved.source===(t.kind==="agent"?"agent-action":"default-action")}function J({action:e,preset:t,agentName:n}){const a=f[e.resolved.state];return s.jsx(b,{question:`Why is ${e.title} set to ${a}${n?` for ${n}`:""}?`,sentence:z({...e.resolved,preset:t,fromExtension:e.source!==void 0}),...e.lastChange?{lastChange:e.lastChange}:{}})}function je({action:e,area:t,scope:n,preset:a,agentName:l,disabled:o,reset:d,onSave:i}){const m=G(e,n),r=F({kind:"action",action:e.id,area:t.id}),u=m?"Set on its own":e.alwaysAsks?e.source?"Always asks: an extension tool that can delete things":"Always asks, so you see the change first":e.resolved.destructiveAsk?"Always asks unless you set it here":`Follows ${t.label}`,c=n.kind==="default"&&r!==void 0?T(r):null;return s.jsxs("li",{className:"flex flex-col gap-2 py-2 @md:flex-row @md:items-center @md:justify-between","data-testid":`permission-action-${e.id}`,children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm",children:e.title}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.source?s.jsxs("span",{children:["From ",e.source.name," · "]}):null,s.jsx("span",{children:u}),c?s.jsxs("span",{children:[" · ",c]}):null," ·"," ",s.jsx(J,{action:e,preset:a,...l?{agentName:l}:{}})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[m?d:null,s.jsx(Q,{value:e.resolved.state,floor:t.floor||e.alwaysAsks===!0,disabled:o,"aria-label":e.title,onChange:h=>{h!==e.resolved.state&&i(h)}})]})]})}function X({scope:e,area:t,surface:n,preset:a,agentName:l}){const o=p(e),[d,i]=N.useState(!1);if(t.actions.length===0)return null;const m=t.actions.filter(c=>G(c,e)),r=(c,h)=>o.mutate({kind:"patch",actions:{[c.id]:h},surface:n},{onError:j}),u=c=>s.jsxs(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:o.isPending,"aria-label":`Put ${c.title} back to ${t.label}`,onClick:()=>r(c,null),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]});return s.jsxs("div",{className:"flex flex-col items-start gap-1 pb-3","data-testid":`permission-actions-${t.id}`,children:[!d&&m.length>0?s.jsx("ul",{className:"w-full space-y-1","data-testid":`permission-action-exceptions-${t.id}`,children:m.map(c=>s.jsxs("li",{className:"flex items-center gap-2 text-xs",children:[s.jsxs("span",{className:"text-muted-foreground min-w-0",children:[s.jsxs("span",{children:["Except ",c.title,": ",f[c.resolved.state]]})," ","·"," ",s.jsx(J,{action:c,preset:a,...l?{agentName:l}:{}})]}),u(c)]},c.id))}):null,s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground -ml-2 h-7 px-2 text-xs","aria-expanded":d,onClick:()=>i(c=>!c),children:[s.jsx(ae,{className:k("size-3.5 transition-transform",d&&"rotate-180"),"aria-hidden":!0}),d?"Hide individual actions":"Show individual actions"]}),d?s.jsx("ul",{className:"divide-border w-full divide-y","aria-label":`${t.label} actions`,children:t.actions.map(c=>s.jsx(je,{action:c,area:t,scope:e,preset:a,...l?{agentName:l}:{},disabled:o.isPending,reset:u(c),onSave:h=>r(c,h)},c.id))}):null]})}function Ne({agentId:e,agentName:t,files:n}){const a=p({kind:"agent",agentId:e}),l=n.source==="agent",o=n.inherited.stop,d=n.stop,i=r=>a.mutate({kind:"patch",filesAndCommands:r,surface:"agent-page"},{onError:j}),m=o?`${l?`Everyone else: ${g(o)}`:`Same as everyone (${g(o)})`}${n.inherited.source==="runtime"?` · ${$("runtime")}`:""}`:$(n.inherited.source);return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[l?s.jsx("span",{className:"bg-primary size-1.5 shrink-0 rounded-full","aria-label":"Set differently for this agent",role:"img"}):null,s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"})]}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands in this agent’s chats"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:m})," ·"," ",s.jsx(b,{question:`Why is Files & commands ${d?`set to ${g(d)}`:"not set"} for ${t}?`,sentence:M(d,n.source),...n.lastChange?{lastChange:n.lastChange}:{}})]})]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:d??"",disabled:a.isPending,onValueChange:r=>{r&&r!==d&&i(r)},children:w.map(r=>s.jsxs(P,{value:r.id,"aria-label":r.label,children:[s.jsx(_,{descriptor:r,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:r.label})]},r.id))}),l?s.jsxs(x,{variant:"ghost",size:"sm",className:"self-start @lg:self-end",onClick:()=>i(null),disabled:a.isPending,children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset to default"]}):null]})]}),s.jsx(H,{descriptor:w.find(r=>r.stop===d),className:"pb-3"})]})}function Re({files:e,preset:t,onChange:n,disabled:a=!1,runtimeLabel:l=o=>o}){const o=F({kind:"files"}),d=e.stop===null?$("runtime-own"):e.stop===e.presetStop?`From ${S[t??"trusted"]}`:"Changed from your preset";return s.jsxs("div",{className:"@container","data-testid":"permission-row-files",children:[s.jsxs("div",{className:"flex flex-col gap-3 py-3 @lg:flex-row @lg:items-start @lg:justify-between @lg:gap-6",children:[s.jsxs("div",{className:"min-w-0 space-y-1",children:[s.jsx("span",{className:"text-sm font-medium",children:"Files & commands"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:"Editing files and running commands"}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[s.jsx("span",{children:[d,o!==void 0?T(o):""].filter(Boolean).join(" · ")})," ","·"," ",s.jsx(b,{question:`Why is Files & commands ${e.stop?`set to ${g(e.stop)}`:"not set"}?`,sentence:M(e.stop,e.stop===null?"runtime-own":"default"),...e.lastChange?{lastChange:e.lastChange}:{}})]}),e.runtimes.map(i=>s.jsxs("p",{className:"text-muted-foreground text-xs",children:[l(i.runtime)," starts at ",g(i.stop)," (Settings → Runtimes)"]},i.runtime))]}),s.jsxs("div",{className:"flex shrink-0 flex-col gap-2 @lg:items-end",children:[s.jsx(A,{"aria-label":"Files & commands",className:"w-full @lg:w-auto",value:e.stop??"",disabled:a,onValueChange:i=>{i&&i!==e.stop&&n(i)},children:w.map(i=>s.jsxs(P,{value:i.id,"aria-label":i.label,children:[s.jsx(_,{descriptor:i,className:"size-(--size-icon-xs) shrink-0"}),s.jsx("span",{className:"truncate",children:i.label})]},i.id))}),s.jsx(be,{agents:e.exceptions})]})]}),s.jsx(H,{descriptor:w.find(i=>i.stop===e.stop),className:"pb-3"})]})}function ve({agent:e}){const t=p({kind:"agent",agentId:e.agentId}),n=K(e.lastChange);return s.jsxs("li",{className:"flex items-center justify-between gap-3",children:[s.jsxs("span",{className:"min-w-0 text-sm",children:[s.jsxs("span",{className:"block break-words",children:[e.agentName,": ",g(e.stop)]}),n?s.jsx("span",{className:"text-muted-foreground block text-xs",children:n}):null]}),s.jsxs(x,{variant:"ghost",size:"sm",disabled:t.isPending,"aria-label":`Reset ${e.agentName} to the default`,onClick:()=>t.mutate({kind:"patch",filesAndCommands:null,surface:"settings"},{onError:j}),children:[s.jsx(v,{className:"size-3.5","aria-hidden":!0}),"Reset"]})]})}function be({agents:e}){return e.length===0?null:s.jsxs(W,{children:[s.jsx(L,{asChild:!0,children:s.jsxs(x,{variant:"ghost",size:"sm",className:"text-muted-foreground self-start @lg:self-end",children:[e.length===1?"1 agent differs":`${e.length} agents differ`,s.jsx(U,{className:"size-3.5","aria-hidden":!0})]})}),s.jsxs(B,{className:"w-80 space-y-2",children:[s.jsx(D,{className:"text-sm font-medium",children:"Set differently for Files & commands"}),s.jsx("ul",{className:"space-y-1",children:e.map(t=>s.jsx(ve,{agent:t},t.agentId))})]})]})}function O(e){return e.filter(t=>t.kind==="state")}function we({area:e,overview:t}){const n=p({kind:"default"}),a=me(e.id),l=F({kind:"area",area:e.id})??0,[o,d]=N.useState(null),i=(r,u)=>{n.mutate({kind:"patch",areas:{[e.id]:r},...u&&u.length>0?{applyToAgents:u}:{},surface:"settings"},{onError:j,onSettled:()=>d(null)})},m=r=>{r!==e.resolved.state&&(a.length>0?d(r):i(r))};return s.jsxs(s.Fragment,{children:[s.jsx(V,{areaId:e.id,label:e.label,description:e.description,floor:e.floor,value:e.resolved.state,sourceText:[de(e.resolved.source,t.preset),T(l)].filter(Boolean).join(" · "),why:s.jsx(b,{question:`Why is ${e.label} set to ${f[e.resolved.state]}?`,sentence:z({...e.resolved,preset:t.preset}),...e.lastChange?{lastChange:e.lastChange}:{}}),onChange:m,disabled:n.isPending,footer:s.jsx(pe,{area:e.id,areaLabel:e.label,agents:a}),details:s.jsx(X,{scope:{kind:"default"},area:e,surface:"settings",preset:t.preset})}),s.jsx(ce,{open:o!==null,onCancel:()=>d(null),subject:e.label,next:o??"ask",agents:a.map(r=>({agentId:r.agentId,agentName:r.agentName,detail:`${f[r.state]}${r.action?" (one action)":""}`})),affectedCount:l,onKeep:()=>o&&i(o),onUpdate:r=>o&&i(o,r),pending:n.isPending})]})}function ye({agentId:e,agentName:t,area:n}){var r;const a=((r=y().data)==null?void 0:r.preset)??null,l=p({kind:"agent",agentId:e}),o=n.resolved.source==="agent-area"||n.resolved.source==="agent-action",d=o?`Everyone else: ${f[n.inherited.state]}`:`Same as everyone (${f[n.inherited.state]})`,i=n.changedOutsideAt?`Changed outside DorkOS · ${d}`:d,m=u=>l.mutate({kind:"patch",areas:{[n.id]:u},surface:"agent-page"},{onError:j});return s.jsx(V,{areaId:n.id,label:n.label,description:n.description,floor:n.floor,value:n.resolved.state,sourceText:i,why:s.jsx(b,{question:`Why is ${n.label} set to ${f[n.resolved.state]} for ${t}?`,sentence:z({...n.resolved,preset:a}),...n.lastChange?{lastChange:n.lastChange}:{}}),changed:o,onChange:u=>{u!==n.resolved.state&&m(u)},onReset:()=>m(null),disabled:l.isPending,details:s.jsx(X,{scope:{kind:"agent",agentId:e},area:n,surface:"agent-page",preset:a,agentName:t})})}function ze({scope:e}){const t=y(),n=ue(e.kind==="agent"?e.agentId:void 0);return e.kind==="default"?t.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the permissions."}):t.data?s.jsx("div",{className:"divide-border divide-y","data-testid":"permission-list-default",children:O(t.data.areas).map(a=>s.jsx(we,{area:a,overview:t.data},a.id))}):s.jsx(C,{className:"h-20 w-full"}):n.isError?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read this agent’s permissions."}):n.data?s.jsxs("div",{className:"divide-border divide-y","data-testid":"permission-list-agent",children:[s.jsx(Ne,{agentId:e.agentId,agentName:n.data.agentName,files:n.data.filesAndCommands}),O(n.data.areas).map(a=>s.jsx(ye,{agentId:e.agentId,agentName:n.data.agentName,area:a},a.id))]}):s.jsx(C,{className:"h-20 w-full"})}function ke(e,t){if(t.key.kind==="chat")return le(e);if(e===null)return t.target.kind==="agent"?"the default":"the preset";switch(t.key.kind){case"files":return Ce(e)?g(e):e;case"preset":return e in S?S[e]:e;default:return e in f?f[e]:e}}function Ce(e){return re.includes(e)}function $e(e){if(e.length===1){const{change:t}=e[0];return`This has changed since. Set it back to ${ke(t.before,t)} anyway?`}return"Some of this has changed since. Set it all back anyway?"}function Se(e){if(e.suggestionRestored)return null;if(e.changes.length===0&&e.skipped.length===0)return"Nothing to undo. It was already back.";if(e.skipped.length===0)return null;const t=e.changes.length,n=`Undid ${t} ${t===1?"change":"changes"}.`,a=e.skipped.filter(i=>i.reason==="changed-since").length,l=e.skipped.filter(i=>i.reason==="floor").length,o=e.skipped.filter(i=>i.reason==="gone").length,d=[];if(a>0&&d.push(`${a} had changed since and ${a===1?"was":"were"} left alone.`),l>0&&d.push(`${l} can’t be set to Allowed and ${l===1?"was":"were"} left alone.`),o>0&&d.push(`${o} ${o===1?"was about an agent":"were about agents"} no longer here.`),d.length>1){const i=e.skipped.length;return`${n} ${i} ${i===1?"was":"were"} left alone.`}return[n,...d].join(" ")}function Ae({item:e}){const t=fe(),[n,a]=N.useState(null),[l,o]=N.useState(null),d=e.undone,i=e.undoable&&!d,m=ie(e.occurredAt),r=u=>t.mutate({eventId:e.id,...u?{force:!0}:{}},{onSuccess:c=>{a(null),o(Se(c))},onError:c=>{const h=xe(c);h?a(h):j(c)}});return s.jsxs("li",{className:"space-y-1","data-testid":"permission-history-row",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0 space-y-0.5",children:[s.jsx("p",{className:"text-sm",children:e.summary}),s.jsxs("p",{className:"text-muted-foreground text-xs",children:[e.actorLabel," · ",m]}),e.actorDetail?s.jsx("p",{className:"text-muted-foreground text-xs",children:e.actorDetail}):null]}),d?s.jsx("span",{className:"text-muted-foreground shrink-0 pt-0.5 text-xs",children:"Undone"}):i&&n===null?s.jsx(x,{variant:"ghost",size:"sm",className:"h-7 shrink-0 px-2 text-xs",disabled:t.isPending,"aria-label":`Undo: ${e.summary}, ${m}`,onClick:()=>r(!1),children:"Undo"}):null]}),n!==null?s.jsxs("div",{role:"group","aria-label":"Undo conflict",className:"bg-muted/50 flex flex-col gap-2 rounded-md p-2 @md:flex-row @md:items-center @md:justify-between",children:[s.jsx("p",{className:"text-sm",children:$e(n)}),s.jsxs("div",{className:"flex shrink-0 gap-2",children:[s.jsx(x,{variant:"outline",size:"sm",disabled:t.isPending,onClick:()=>a(null),children:"Cancel"}),s.jsx(x,{size:"sm",disabled:t.isPending,onClick:()=>r(!0),children:"Set it back"})]})]}):null,l?s.jsx("p",{className:"text-muted-foreground text-xs",role:"status",children:l}):null]})}function Te({agentId:e}){const{data:t,isPending:n,isError:a}=he(e);if(a)return s.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t read the history."});if(n)return s.jsx(C,{className:"h-12 w-full"});const l=(t==null?void 0:t.items)??[];return l.length===0?s.jsx("p",{className:"text-muted-foreground text-sm",children:"No permission changes yet."}):s.jsx("ul",{className:"@container space-y-3","aria-label":"Permission history",children:l.map(o=>s.jsx(Ae,{item:o},o.id))})}export{Re as D,ze as P,Te as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-Cga0qx1T.js";import{b as t}from"./ProfileFields-BebX5oiv.js";import"./profile-errors-BSCuj3rT.js";import"./use-mounted-ref-qRbdZfOU.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as x,t as S,j as e,be as u,bf as h,bg as m,g as E,B as d,I as p,bh as g,bi as b}from"./index-Cga0qx1T.js";import{u as y,a as C,b as f,c as k,h as A,d as F,n as I}from"./profile-errors-BSCuj3rT.js";import{u as j}from"./use-mounted-ref-qRbdZfOU.js";function v(t){const[r,a]=x.useState(t),[n,s]=x.useState(t);return n!==t&&(s(t),a(t)),[r,a]}const D="image/png,image/jpeg,image/webp";function l({tone:t,children:r}){return e.jsx("p",{role:t==="error"?"alert":"status",className:t==="error"?"text-destructive text-xs":"text-muted-foreground text-xs",children:r})}function H({member:t}){const r=S(t),a=x.useRef(null),n=y(),s=C();function c(i){const o=i==null?void 0:i[0];o&&(n.mutate({file:o}),a.current&&(a.current.value=""))}return e.jsx(u,{children:e.jsxs(h,{className:"space-y-3",children:[e.jsx(m,{label:"Photo",description:"PNG, JPEG or WebP, up to 2 MB.",orientation:"vertical",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(E,{size:"lg",kind:r.kind,color:r.color,emoji:r.emoji,imageUrl:r.imageUrl,fallback:r.fallback,origin:r.origin}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("input",{ref:a,type:"file",accept:D,className:"hidden","data-testid":"profile-photo-input",onChange:i=>c(i.target.files)}),e.jsx(d,{size:"sm",variant:"outline",disabled:n.isPending,onClick:()=>{var i;return(i=a.current)==null?void 0:i.click()},children:t.imageUrl?"Change photo":"Upload a photo"}),t.imageUrl&&e.jsx(d,{size:"sm",variant:"ghost",disabled:s.isPending,onClick:()=>s.mutate(),children:"Remove"})]})]})}),n.isError&&e.jsx(l,{tone:"error",children:f(n.error)}),s.isError&&e.jsx(l,{tone:"error",children:f(s.error)})]})})}function L({member:t}){const r=j(),a=F({isShownInline:()=>r.current}),n=t.displayName===g?"":t.displayName,[s,c]=v(n),i=b(t),o=s.trim().length>0&&s.trim()!==n,N=s.trim().length>0&&(o||i!==null);return e.jsx(u,{children:e.jsxs(h,{className:"space-y-3",children:[e.jsx(m,{label:"Display name",description:i?`${i}. Save it to make it yours.`:"What DorkOS calls you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{value:s,maxLength:80,"aria-label":"Display name",placeholder:g,onChange:P=>c(P.target.value)}),e.jsx(d,{size:"sm",disabled:!N||a.isPending,onClick:()=>a.mutate(s.trim()),children:"Save"})]})}),a.isError&&e.jsx(l,{tone:"error",children:I(a.error)}),a.isSuccess&&s.trim()===a.variables&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function w({member:t}){var i;const r=j(),a=k({isShownInline:()=>r.current}),[n,s]=v(t.handle??""),c=n.trim()!==(t.handle??"");return e.jsx(u,{children:e.jsxs(h,{className:"space-y-3",children:[e.jsx(m,{label:"Handle",description:"What others type after @ to reach you.",orientation:"vertical",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(p,{value:n,maxLength:64,placeholder:"yourname","aria-label":"Handle",onChange:o=>s(o.target.value)}),e.jsx(d,{size:"sm",disabled:!c||a.isPending,onClick:()=>a.mutate({authorId:t.id,handle:n.trim()}),children:"Save"})]})}),a.isError&&e.jsx(l,{tone:"error",children:A(a.error,n.trim())}),a.isSuccess&&n.trim()===((i=a.variables)==null?void 0:i.handle)&&e.jsx(l,{tone:"ok",children:"Saved."})]})})}function z({member:t}){var r,a;return e.jsx(u,{children:e.jsx(h,{children:e.jsx(m,{label:"Email",description:(r=t.person)!=null&&r.email?"Your sign-in email. It stays fixed.":"No login on this machine. Turn one on in Settings › Login & security.",orientation:"vertical",children:e.jsx(p,{readOnly:!0,"aria-label":"Email",value:((a=t.person)==null?void 0:a.email)??"",placeholder:"No email on this machine",className:"text-muted-foreground"})})})})}export{l as F,L as P,w as a,H as b,z as c,v as u};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B3eeEDWj.js","assets/index-Cga0qx1T.js","assets/index-DUZrTFYD.css","assets/room-files-source-CZWhaaOy.js","assets/markdown-content-m_qereFc.js","assets/file-exclamation-point-Dg3ZpiAe.js","assets/query-keys-DeYqUDia.js","assets/composer-insert-BpyATrmR.js","assets/index-dyAahqKe.js","assets/file-drag-GDx2qhdk.js","assets/rotate-cw-B3rB_YSw.js","assets/link-2-CDJapTSa.js","assets/file-D40js1Zx.js","assets/git-branch-BpxhecMq.js","assets/more-details-ReA2ZFBn.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{W as Z,r as i,m_ as Ut,j as a,g as qt,ii as Wt,G as V,a1 as ne,a2 as Kt,bk as ee,a4 as re,a3 as Se,m$ as Gt,n0 as ye,n1 as He,n2 as Vt,n3 as Xt,n4 as Yt,lR as Qt,n5 as Jt,lT as Zt,n6 as en,dB as tn,gb as nn,mX as sn,n7 as on,a0 as rn,bw as an,n8 as ln,n9 as dn,iN as cn,hK as un,iw as X,kG as Ue,na as ot,bK as mn,kF as le,kK as rt,nb as fn,kL as at,ai as pn,bO as it,hF as lt,B as Ae,x as hn,nc as gn,c6 as Ce,nd as xn,s as ce,es as yn,jw as dt,ne as ct,aX as bn,e as se,nf as he,hf as ut,kJ as mt,ng as vn,nh as kn,n as Rn,q as Re,kI as wn,ni as ft,eQ as te,a7 as pt,fp as In,nj as Nn,nk as jn,nl as Sn,nm as An,l as ht,ar as Me,kt as Cn,aj as Mn,nn as On,no as Tn,np as _n,b6 as En,bW as Pn,nq as $n,nr as Dn,ns as Fn,nt as Ln,bx as we,dJ as zn,kz as Bn,kE as Hn,kx as Un,nu as qn,nv as Wn,nw as Kn,nx as Gn,eP as Vn,kA as Xn,ny as Yn,nz as Qn,nA as Jn,dO as Zn,X as es,nB as ts,nC as qe,nD as ns,ad as ss,nE as os,iv as rs,nF as as,nG as is,aH as We}from"./index-Cga0qx1T.js";import{R as ls,A as ds,u as cs,P as us,a as ms}from"./use-jump-back-in-Bibj5tVk.js";import{a as Ke,m as Ge,f as Oe,b as Te,d as gt,e as xt,g as yt,E as fs,h as ps,i as hs,M as G,F as gs,D as xs,U as ys,C as Q,u as bs,j as vs,k as ks,l as Rs}from"./index-InEBtYxw.js";import{a as ws}from"./use-room-follow-claim-Du4hKHIJ.js";import"./WidgetErrorCard-cS8yMCxU.js";import{M as Is}from"./markdown-content-m_qereFc.js";import{W as Ns,a as js}from"./find-latest-widget-fence-D4kBWC_1.js";import{f as Ss}from"./format-duration-BCr6uzby.js";import{H as As,a as Cs,b as Ms}from"./RuntimeSetupDialog-Cr4GRi8c.js";import{M as Ve}from"./mention-pill-DV5HIG5Q.js";import{R as Os}from"./rotate-ccw-clock-RfbbgUa4.js";import{U as Ts}from"./unplug-Bq_1WdV7.js";import{M as _s}from"./message-square-off-YVtpbaJ0.js";import{i as Es}from"./registry-Dc102rws.js";import{f as Ps}from"./use-connector-management-CLYFraXN.js";import{A as $s}from"./AgentRequestCard-0fOxvaoe.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 bt={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};bt.node;const Ds=Z(bt);/**
|
|
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 vt={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"}]]};vt.node;const Fs=Z(vt);/**
|
|
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 kt={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"}]]};kt.node;const Ls=Z(kt);/**
|
|
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 Rt={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"}]]};Rt.node;const zs=Z(Rt);/**
|
|
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 wt={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"}]]};wt.node;const Bs=Z(wt);/**
|
|
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 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 Hs=Z(It);/**
|
|
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 Nt={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"}]]};Nt.node;const Xe=Z(Nt);/**
|
|
38
|
-
* @license lucide-react v1.48.0 - ISC
|
|
39
|
-
*
|
|
40
|
-
* This source code is licensed under the ISC license.
|
|
41
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
42
|
-
*/const jt={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"}]]};jt.node;const Us=Z(jt),qs=300;function ae({className:e,children:n}){return a.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:n})}function St({identity:e,children:n,onViewProfile:s,className:t}){const{kind:o,displayName:r,handle:l,color:d,emoji:m,imageUrl:f,origin:u,agent:c}=e,w=d??"hsl(var(--muted-foreground))",h=typeof u=="object"&&u!==null,g=o==="agent"&&(c==null?void 0:c.working)!=null?c.working:null,[k,x]=i.useState(!1),N=i.useRef(!1),p=i.useRef(null),b=Ut({onLongPress:()=>{N.current&&x(!0)}});return a.jsxs(As,{open:k,onOpenChange:x,openDelay:qs,children:[a.jsx(Cs,{asChild:!0,ref:p,"data-gesture-priority":"",...b,onPointerDown:_=>{N.current=_.pointerType==="touch"||_.pointerType==="pen",b.onPointerDown(_)},children:n}),a.jsxs(Ms,{"data-slot":"identity-hover-card",align:"start",className:V("flex w-64 flex-col gap-0 overflow-hidden p-0",t),children:[a.jsxs("div",{className:"flex items-center gap-3 p-3",children:[a.jsx(qt,{"aria-hidden":!0,color:w,emoji:m,imageUrl:f,fallback:Wt(r),kind:o,origin:u,status:g?"working":"idle",size:"md"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-foreground truncate text-sm font-semibold",children:r}),l&&a.jsxs("p",{className:"text-muted-foreground truncate text-xs font-medium",children:["@",l]})]})]}),a.jsxs("div",{className:"flex flex-wrap gap-1.5 px-3 pb-3 empty:hidden",children:[o==="agent"&&((c==null?void 0:c.runtime)||(c==null?void 0:c.model))&&a.jsx(ae,{children:[c.runtime,c.model].filter(Boolean).join(" · ")}),g&&a.jsxs(ae,{className:"bg-status-success-bg text-status-success-fg",children:["Working · ",Ss(g.forMs)]}),o==="human"&&a.jsx(ae,{children:h?u.platform:"On this machine"}),o==="agent"&&(c==null?void 0:c.managedBy)&&a.jsxs(ae,{children:["Managed by"," ",c.managedBy.handle?`@${c.managedBy.handle}`:c.managedBy.displayName]})]}),s?a.jsx("button",{type:"button","data-slot":"identity-hover-card-profile",onClick:()=>{var _;(_=p.current)==null||_.focus(),s()},className:"border-border hover:bg-accent focus-visible:ring-ring text-brand-text mt-auto flex w-full items-center border-t px-3 py-2 text-left text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none",children:"View profile"}):a.jsxs("div",{className:"border-border mt-auto flex items-center justify-between border-t px-3 py-2",children:[a.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"View profile"}),a.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase",children:"soon"})]})]})]})}function At(e,n={}){const s=ne();return Kt({queryKey:ee.sessions(e??""),queryFn:()=>s.listRoomSessions(e),enabled:e!==null&&n.enabled===!0})}function Ws(){const e=ne();return re({mutationFn:({roomId:n,authorId:s})=>e.haltRoomAgent(n,s),meta:{errorLabel:"Couldn’t stop this agent"}})}function Ks(){const e=ne();return re({mutationFn:({roomId:n,authorId:s})=>e.promoteHold(n,s),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function Gs(){const e=ne(),n=Se();return re({onMutate:({roomId:s,entryId:t,emoji:o,viewerAuthorId:r})=>{var u;const l=n.getQueryData(ee.entries(s)),d=(u=l==null?void 0:l.find(c=>c.id===t))==null?void 0:u.reactions,{reactions:m,on:f}=Ke(d,o,r);return n.setQueryData(ee.entries(s),c=>Ge(c,t,m)),{on:f}},mutationFn:({roomId:s,entryId:t,emoji:o,viewerAuthorId:r})=>{var m,f;const l=n.getQueryData(ee.entries(s)),d=((f=(m=l==null?void 0:l.find(u=>u.id===t))==null?void 0:m.reactions)==null?void 0:f.some(u=>u.emoji===o&&u.authorIds.includes(r)))??!1;return e.toggleReaction(s,t,{emoji:o,on:d})},onError:(s,{roomId:t,entryId:o,emoji:r,viewerAuthorId:l},d)=>{d!==void 0&&n.setQueryData(ee.entries(t),m=>{var c;const f=(c=m==null?void 0:m.find(w=>w.id===o))==null?void 0:c.reactions,{reactions:u}=Ke(f,r,l,!d.on);return Ge(m,o,u)})},onSuccess:({frequents:s},{roomId:t})=>{n.setQueryData(ee.detail(t),o=>o&&{...o,reactionFrequents:s})},meta:{errorLabel:"Couldn’t add your reaction",errorToastId:"room-reaction"}})}function J(e){return e.threadRootEntryId??e.parentEntryId}function Ct(e){return J(e)??e.id}function _e(e,n){return Math.max(n??0,e)}function Vs(e,n,s){let t=e[0],o=0;for(const r of e)r.seq>t.seq&&(t=r),n!==null&&r.seq>n&&(o+=1);return{count:_e(e.length,s),lastAt:t.createdAt,unread:o}}function Xs(e){const n=ne(),s=Se(),t=Gt(e),o=ye(u=>{var c;return e===null?null:((c=u.paging[e])==null?void 0:c.cursor)??null}),r=re({mutationFn:async u=>{var x;const c=(x=ye.getState().paging[u])==null?void 0:x.cursor;if(c==null)return;const w=await n.listRoomEntries(u,{before:c,limit:He}),h=ee.entries(u),g=s.getQueryData(h),k=Vt(g,w);s.setQueryData(h,k),ye.getState().notePage(u,Xt(w)??c,Yt(w,He)||k.length===((g==null?void 0:g.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:l,isPending:d}=r,m=i.useRef(!1),f=i.useCallback(async()=>{if(!(e===null||m.current)){m.current=!0;try{await l(e).catch(()=>{})}finally{m.current=!1}}},[e,l]);return{canLoadOlder:t,isLoadingOlder:d,cursor:o,loadOlder:f}}function Ys(e){return a.jsx(js,{code:e.code,isIncomplete:e.isIncomplete})}const Qs=[{language:Ns,component:Ys}],Js={turn_failed:{Icon:rn,tone:"text-status-warning"},agent_busy:{Icon:on},agent_gone:{Icon:Us,tone:"text-status-warning"},agent_left:{Icon:Xe,tone:"text-status-warning"},room_archived:{Icon:sn},runtime_gone:{Icon:zs,tone:"text-status-warning"},agent_paused:{Icon:nn},agent_declined:{Icon:_s},agent_unavailable:{Icon:tn},awaiting_approval:{Icon:Ds,tone:"text-status-warning"},halted:{Icon:en},budget_reached:{Icon:Zt},cascade_stopped:{Icon:Jt},addressing_changed:{Icon:Ls},bridge_blocked:{Icon:Ts,tone:"text-status-warning"},bridge_undelivered:{Icon:Qt,tone:"text-status-warning"},bridge_rate_limited:{Icon:Hs},bridge_second_agent_refused:{Icon:Xe},bridge_disconnected:{Icon:Fs},bridge_agent_swapped:{Icon:ls},bridge_history_note:{Icon:Os}},Zs={Icon:an},be=80;function eo(e){const n=e.trim();if(n.length<=be)return n;const s=n.slice(0,be),t=s.lastIndexOf(" ");return`${(t>be/2?s.slice(0,t):s).trimEnd()}…`}function to(e,n,s){const t=no(e,s),o=r=>a.jsx("a",{href:n.href,onClick:n.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 t===null?a.jsxs(a.Fragment,{children:[e," ",o("Open chat")]}):a.jsxs(a.Fragment,{children:[e.slice(0,t.index),o(t.words),e.slice(t.index+t.words.length)]})}function no(e,n){if(n!==void 0){const t=ln(n),o=e.lastIndexOf(t);if(o!==-1)return{index:o,words:t}}const s=dn.exec(e);return s===null?null:{index:s.index,words:s[0]}}function so({entry:e,feedPosition:n,rowId:s,sessionLink:t,subjectName:o}){const{Icon:r,tone:l}=(e.body.notice&&Js[e.body.notice])??Zs;return a.jsxs("p",{id:s,"data-slot":"notice-row","data-testid":"room-notice","data-notice":e.body.notice??"unknown",...n&&{role:"article","aria-label":eo(e.body.text)},...Oe(n),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:[a.jsx(r,{"aria-hidden":!0,className:"mt-px size-3.5 shrink-0"}),a.jsx("span",{children:t?to(e.body.text,t,o):e.body.text})]})}const oo=Es.moment;function ro({entry:e,moment:n,subject:s,subjectIdentity:t,feedPosition:o,rowId:r}){const l=Te(e.createdAt);return a.jsx("div",{id:r,"data-slot":"moment-row","data-testid":"room-moment","data-moment":n.kind,role:"article","aria-label":`Moment: ${e.body.text}`,...Oe(o),className:"focus-visible:ring-ring px-[var(--msg-padding-x)] py-1 outline-none focus-visible:ring-2",children:a.jsxs("div",{className:"border-border/60 bg-muted/40 flex items-center gap-2.5 rounded-lg border px-3 py-2",children:[a.jsx(St,{identity:{kind:s.kind,displayName:s.displayName,handle:t==null?void 0:t.handle,color:s.color,emoji:s.emoji,imageUrl:s.imageUrl,origin:t==null?void 0:t.origin,agent:t==null?void 0:t.agent},children:a.jsxs("span",{"data-testid":"room-moment-identity",className:"flex shrink-0 items-center",children:[a.jsx(gt,{author:s}),a.jsx("span",{className:"sr-only",children:s.displayName})]})}),a.jsx(oo,{"data-testid":"room-moment-mark","aria-hidden":!0,className:"text-muted-foreground size-3.5 shrink-0"}),a.jsx("p",{className:"min-w-0 flex-1 text-sm",children:e.body.text}),l.length>0&&a.jsx("time",{dateTime:e.createdAt,title:xt(e.createdAt),className:"text-msg-timestamp shrink-0 text-xs",children:l})]})})}function ao({id:e,summary:n,open:s,onOpen:t}){const{capabilities:o}=yt(),{count:r,lastAt:l,unread:d}=n,m=Te(l),[f,u]=i.useState({count:r,bumped:!1});f.count!==r&&u({count:r,bumped:!0});const c=f.count===r&&f.bumped;return o.threads?a.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":d>0?"":void 0,"aria-expanded":s,onClick:t,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",d>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[a.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),a.jsx("span",{className:V(c&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:r},r),r===1?" reply":" replies",m.length>0&&a.jsxs(a.Fragment,{children:[" · last ",a.jsx("time",{dateTime:l,title:xt(l),children:m})]}),d>0&&` · ${d} new`]}):null}function io(e,n){const s=le.getState(),t=s.drafts[e]??"",o=t===""||t.endsWith(" ")||t.endsWith(`
|
|
43
|
-
`)?"":" ";s.set(e,`${t}${o}@${n} `)}function lo({roomId:e,entry:n,author:s,viewerAuthorId:t,onViewProfile:o}){const r=Ct(n),l=n.body.text,d=(s==null?void 0:s.id)===t?void 0:(s==null?void 0:s.handle)??void 0,m=s==null?void 0:s.displayName,{copy:f}=cn({toastOnSettle:!0});return i.useMemo(()=>{const u={reply:{id:"reply",label:"Reply in thread",icon:Bs,run:()=>{X.getState().openThread(e,r,!0),Ue.getState().requestFocus(ot(e,r))}},copy:{id:"copy",label:"Copy text",icon:un,run:()=>void f(l)}};return o!==void 0&&(u.profile={id:"profile",label:"View profile",icon:mn,run:o}),d!==void 0&&(u.mention={id:"mention",label:m===void 0?"Mention author":`Mention ${m}`,icon:ds,run:()=>{io(e,d),Ue.getState().requestFocus(e)}}),fs.map(c=>u[c]).filter(c=>c!==void 0)},[e,r,l,d,m,o,f])}function co(e){if(e.kind==="notice")return{kind:"notice"};const n=e.body.moment;return n?{kind:"moment",moment:n}:{kind:"message"}}function Ee(e,n=[]){return new Map([...n.map(s=>[s.author.id,{...s.author,origin:s.origin}]),...e.map(s=>[s.author.id,{...s.author,origin:s.origin}])])}function ue(e,n){const s=e.body.subjectAuthorId;return s===void 0||n.has(e.authorId)?e.authorId:s}function Y(e,n,s){const t=n.get(e),o=rt({record:{kind:(t==null?void 0:t.kind)??"system",id:e,displayName:(t==null?void 0:t.displayName)??"Unknown",emoji:t==null?void 0:t.emoji,color:t==null?void 0:t.color,imageUrl:t==null?void 0:t.imageUrl},override:(t==null?void 0:t.agentRef)===void 0?null:s==null?void 0:s.get(t.agentRef)});return{kind:o.kind,id:e,displayName:(t==null?void 0:t.displayName)??"Unknown",emoji:o.emoji,imageUrl:o.imageUrl,color:o.color,isExternal:typeof(t==null?void 0:t.origin)=="object"&&(t==null?void 0:t.origin)!==null,...(t==null?void 0:t.retired)===!0?{retired:!0}:{}}}function uo(e){const n=new Set;for(const r of e)J(r)===null&&n.add(r.id);const s=[],t=new Map,o=new Set;for(const r of e){const l=J(r);if(l===null){s.push(r);continue}if(!n.has(l)){s.push(r),o.add(r.id);continue}const d=t.get(l);d?d.push(r):t.set(l,[r])}return{topLevel:s,repliesByRoot:t,orphaned:o}}function Mt(e){return`thread-${e}`}function me(e){return`thread-row-${e}`}function Ie(e){return`thread-panel-entry-${e}`}function fe(e){return`room-entry-${e}`}function Pe(e,n){const s=e.find(d=>d.id===n);if(s===void 0)return null;const t=J(s)??null,o={rowId:n,domId:fe(n)};if(t===null)return o;const r=e.find(d=>d.id===t);return r!==void 0&&(J(r)??null)===null?{rowId:Mt(t),domId:me(t)}:o}function mo(e,n){if(n===null)return null;const s=e.find(t=>t.seq===n);return s===void 0?null:Pe(e,s.id)}const Ye=48;function Ot(e,n,s){const t=e.body.answersEntryId;if(t===void 0||t===e.id||n!==void 0&&n.id===t)return null;const o=s(t);if(o===void 0)return null;const r=o.body.text.replace(/\s+/gu," ").trim();return r.length===0?null:{entryId:t,excerpt:r.length>Ye?`${r.slice(0,Ye).trimEnd()}…`:r}}function fo(e,n){const s=new Map;for(const t of e){const o=n[t.projectPath];if(!o)continue;const r=fn({runtime:o.runtime,model:o.model});s.set(at(t.projectPath),{memberId:t.id,visual:pn(o),runtime:r.label,...r.modelLabel!==null&&{model:r.modelLabel}})}return s}function po(e){const n=new Map;for(const[s,t]of e)n.set(s,t.visual);return n}const ho={info:new Map,faces:new Map},$e=i.createContext(ho);function Tt({known:e,children:n}){return a.jsx($e.Provider,{value:e,children:n})}function De(){const e=it(),n=i.useMemo(()=>{var l;return((l=e.data)==null?void 0:l.agents)??[]},[e.data]),s=i.useMemo(()=>n.map(l=>l.projectPath),[n]),t=lt(s),o=i.useMemo(()=>fo(n,t.data??{}),[n,t.data]),r=i.useMemo(()=>po(o),[o]);return i.useMemo(()=>({info:o,faces:r}),[o,r])}function Ne(e){const n=i.useContext($e);return e===void 0?void 0:n.info.get(e)}function go(){return i.useContext($e).faces}function xo({loading:e,onLoad:n}){return a.jsx("div",{className:"flex justify-center px-4 py-3",children:a.jsxs(Ae,{type:"button",variant:"ghost",size:"sm",onClick:n,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&a.jsx(hn,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}function yo({showAuthorHeader:e,headerId:n,displayName:s,time:t,summary:o,contentId:r,summaryId:l,feedPosition:d}){return{...e?{"aria-labelledby":n}:{"aria-label":t.length>0?`${s}, ${t}`:s},"aria-describedby":o===null?r:l,...Oe(d)}}const de=120,bo="code block";function vo(e){if(e.length<=de&&!e.includes("```"))return null;const n=ko(e);return n.length===0?null:n}function ko(e){const n=e.replace(/```[\s\S]*?(?:```|$)/g,` ${bo} `).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(n.length<=de)return n;const s=Ro(n,de),t=s.lastIndexOf(" ");return`${(t>de/2?s.slice(0,t):s).trimEnd()}…`}function Ro(e,n){if(typeof Intl.Segmenter=="function"){const t=new Intl.Segmenter(void 0,{granularity:"grapheme"});let o="";for(const{segment:r}of t.segment(e)){if(o.length+r.length>n)break;o+=r}return o}let s="";for(const t of e){if(s.length+t.length>n)break;s+=t}return s}function wo({roomId:e,entry:n,viewerAuthorId:s,reactionFrequents:t,streamStalled:o,isMember:r=!0}){const l=Gs(),d=o===!0||!r,m=i.useMemo(()=>n.reactions??[],[n.reactions]),f=i.useMemo(()=>m.filter(w=>ps(w,s)).map(w=>w.emoji),[m,s]),u=i.useCallback(w=>l.mutate({roomId:e,entryId:n.id,emoji:w,viewerAuthorId:s}),[l,e,n.id,s]),c=i.useMemo(()=>({quick:t,mine:f,onToggle:u,disabled:d}),[t,f,u,d]);return{reactions:m,toggle:u,quickRow:c}}function Io({barRef:e,pillsRef:n,hasReactions:s}){return t=>{var r,l;if(t.target!==t.currentTarget)return;const{key:o}=t;if(o==="ArrowDown"&&s){t.preventDefault(),(r=n.current)==null||r.focusFirst();return}o!=="ArrowRight"&&o!=="Enter"||(t.preventDefault(),(l=e.current)==null||l.focusFirst())}}function No(e,n){var c,w;const s=n.body.subjectAuthorId,t=n.body.notice,o=n.kind==="notice"&&t!==void 0&&s!==void 0&&gn.includes(t),r=At(e,{enabled:o}),l=Ce(),d=Se(),m=ne(),f=o?((w=(c=r.data)==null?void 0:c.bindings.find(h=>h.authorId===s))==null?void 0:w.sessionId)??null:null,u=i.useCallback(h=>{h.button!==0||h.metaKey||h.ctrlKey||h.shiftKey||h.altKey||(h.preventDefault(),!(f===null||s===void 0)&&xn({queryClient:d,transport:m},e,s).then(g=>{g.kind!=="none"&&l(ce({session:g.kind==="bound"?g.sessionId:f}))}))},[s,l,d,e,f,m]);return i.useMemo(()=>f===null?null:{href:yn({session:f}),onOpen:u},[u,f])}const pe="mention",Fe="author_id",jo={[pe]:[Fe]},So=[pe];function Ao(e,n){if(!n||n.length===0)return e;const s=Co(e,n);if(s.length===0)return e;let t=e;for(let o=s.length-1;o>=0;o--){const{offset:r,length:l,authorId:d}=s[o],m=t.slice(0,r),f=t.slice(r,r+l),u=t.slice(r+l);t=`${m}<${pe} ${Fe}="${d}">${f}</${pe}>${u}`}return t}function Co(e,n){const s=[...n].sort((r,l)=>r.offset-l.offset),t=[];let o=0;for(const r of s)r.offset<o||r.offset+r.length>e.length||(t.push(r),o=r.offset+r.length);return t}const Mo=new Map,_t=i.createContext(Mo);function Oo({authors:e,children:n}){return a.jsx(_t.Provider,{value:e,children:n})}function To(e){const n=i.useContext(_t);return e===void 0?void 0:n.get(e)}function _o(e){return typeof e=="string"?e.replace(/^@/,""):""}function Eo({authorId:e,children:n}){const s=To(e),t=Ne(s==null?void 0:s.agentRef),{open:o}=dt();if(!s)return a.jsx(Ve,{kind:"human",label:_o(n),resolved:!1});const r=rt({record:s,override:t==null?void 0:t.visual}),l=ct(s,t==null?void 0:t.memberId),d=l===void 0?void 0:()=>o(l),m=d?{role:"button",tabIndex:0,"aria-label":`View ${s.displayName}’s profile`,onClick:d,onKeyDown:f=>{f.key!=="Enter"&&f.key!==" "||(f.preventDefault(),d())}}:{};return a.jsx(St,{onViewProfile:d,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:t&&{runtime:t.runtime,...t.model&&{model:t.model}}},children:a.jsx(Ve,{kind:s.kind,label:s.displayName,handle:s.handle??void 0,color:s.color,origin:s.origin,resolved:!0,interactive:d!==void 0,...m})})}function Po(e){return{mention:n=>{const s=n[Fe],t=typeof s=="string"?s:void 0;return!t||!e.has(t)?a.jsx(a.Fragment,{children:n.children}):a.jsx(Eo,{authorId:t,children:n.children})}}}function $o({entry:e,authors:n}){const s=i.useMemo(()=>Ao(e.body.text,e.mentionSpans),[e.body.text,e.mentionSpans]),t=i.useMemo(()=>{var r;return new Set(((r=e.mentionSpans)==null?void 0:r.map(l=>l.authorId))??[])},[e.mentionSpans]),o=i.useMemo(()=>Po(t),[t]);return a.jsx(Oo,{authors:n,children:a.jsx(Is,{content:s,className:"msg-prose",allowedTags:jo,literalTagContent:So,components:o,renderers:Qs})})}function Do(e){return function(s){return a.jsx($o,{entry:s,authors:e})}}const Et="the top folder";function Qe(e){return e.slice(e.lastIndexOf("/")+1)}function Fo(e){const n=e.lastIndexOf("/");return n===-1?"":e.slice(0,n)}function Lo(e){return e===""?Et:`${e}/`}function ve(e){return e.target!==void 0?e.target===""?Et:e.target:Lo(Fo(e.paths[0]??""))}function zo(e,n){const s=e.paths[0]??"",t=e.target;switch(e.kind){case"edit":return`${n} edited ${t??s}`;case"add":return`${n} added ${t??s}`;case"upload":return e.pathCount===1?`${n} uploaded ${Qe(s)} to ${ve(e)}`:`${n} uploaded ${e.pathCount} files to ${ve(e)}`;case"rename":{const o=e.from??"";return t!==void 0?`${n} renamed ${o} to ${t}`:o.endsWith("/")?`${n} renamed ${o}`:`${n} renamed ${o} to ${s}`}case"delete":return t!==void 0?`${n} deleted ${t}`:e.pathCount===1?`${n} deleted ${s}`:`${n} deleted ${e.pathCount} files`;case"from-attachment":return`${n} saved ${Qe(s)} from the chat to ${ve(e)}`}}const Bo=i.lazy(()=>bn(()=>import("./index-B3eeEDWj.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.SaveToRoomFilesButton})));function Pt({roomId:e,entry:n,author:s,authorRef:t,authors:o,viewerAuthorId:r,authorNames:l,reactionFrequents:d,streamStalled:m,isMember:f=!0,grouping:u,orphanedReply:c,answers:w,feedPosition:h,rowId:g}){const k=Te(n.createdAt),x=i.useMemo(()=>{const K=vo(n.body.text),xe=hs(n.attachments??[]);if(xe===null)return K;const Be=K??n.body.text.trim();return Be.length>0?`${Be} ${xe}`:xe},[n.body.text,n.attachments]),N=i.useId(),p=`${N}-author`,b=`${N}-content`,_=`${N}-summary`,T=i.useRef(null),$=i.useRef(null),M=i.useRef(null),{reactions:E,toggle:P,quickRow:I}=wo({roomId:e,entry:n,viewerAuthorId:r,reactionFrequents:d,streamStalled:m,isMember:f}),F=Ne(t==null?void 0:t.agentRef),{open:D}=dt(),C=t===void 0?void 0:ct(t,F==null?void 0:F.memberId),B=i.useCallback(()=>{C!==void 0&&D(C)},[D,C]),L=C===void 0?void 0:B,H=lo({roomId:e,entry:n,author:t,viewerAuthorId:r,onViewProfile:L}),W=Io({barRef:$,pillsRef:M,hasReactions:E.length>0}),z=i.useCallback(()=>{var K;return(K=T.current)==null?void 0:K.focus()},[]),U=i.useMemo(()=>Do(o),[o]),R=i.useCallback(K=>a.jsx(i.Suspense,{fallback:null,children:a.jsx(Bo,{roomId:e,attachment:K})}),[e]),y=go(),O=n.body.subjectAuthorId??n.authorId,A=o.get(O),v=Ne(A==null?void 0:A.agentRef),S=No(e,n),j=co(n);if(j.kind==="notice")return a.jsx(so,{entry:n,feedPosition:h,rowId:g,sessionLink:S,subjectName:A==null?void 0:A.displayName});if(j.kind==="moment")return a.jsx(ro,{entry:n,moment:j.moment,subject:O===n.authorId?s:Y(O,o,y),subjectIdentity:{handle:(A==null?void 0:A.handle)??void 0,origin:A==null?void 0:A.origin,agent:v&&{runtime:v.runtime,...v.model&&{model:v.model}}},feedPosition:h,rowId:g});const q=u.position==="first"||u.position==="only";return a.jsxs(G.Root,{ref:T,id:g,position:u.position,actions:H,reactions:I,"data-testid":"room-entry",tabIndex:0,...yo({showAuthorHeader:q,headerId:p,displayName:s.displayName,time:k,summary:x,contentId:b,summaryId:_,feedPosition:h}),onKeyDown:W,children:[a.jsx(G.Gutter,{author:s,at:n.createdAt,onViewProfile:L,isSelf:n.authorId===r}),a.jsxs(G.Body,{children:[a.jsx(G.Author,{id:p,author:s,at:n.createdAt,origin:t==null?void 0:t.origin}),c===!0&&a.jsx("p",{"data-testid":"room-entry-orphan",className:"text-muted-foreground text-xs italic",children:"Replying to an earlier message"}),w!=null&&a.jsx("p",{"data-testid":"room-entry-answers",className:"text-muted-foreground mb-1 truncate text-xs italic",children:`Answering “${w.excerpt}”`}),a.jsx(G.Content,{id:b,className:"[&_:not(pre)>code]:wrap-anywhere [&_pre]:overflow-x-auto",children:n.body.fileChange?a.jsx("p",{"data-testid":"room-entry-file-change",className:"wrap-anywhere",children:zo(n.body.fileChange,(A==null?void 0:A.displayName)??"Somebody")}):U(n,{rowId:n.id,isStreaming:!1})}),x!==null&&a.jsx("span",{id:_,className:"hidden",children:x}),a.jsx(G.Attachments,{items:n.attachments??[],renderAction:f?R:void 0}),a.jsx(G.Reactions,{ref:M,reactions:E,viewerAuthorId:r,names:l,frequents:d,onToggle:P,disabled:m===!0||!f,onExit:z}),a.jsx(G.Actions,{actions:H,reactions:I,barRef:$,onExit:z})]})]})}const Ho="room-load-older",Uo=4;function $t({roomName:e}){return a.jsx(gs,{label:e===void 0?"Messages":`Messages in ${e}`,busy:!0,className:"flex flex-col gap-4 p-4","data-testid":"room-timeline-loading",children:Array.from({length:Uo},(n,s)=>a.jsxs("div",{className:"flex gap-3",children:[a.jsx(se,{className:"size-7 shrink-0 rounded-full"}),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[a.jsx(se,{className:"h-3 w-24"}),a.jsx(se,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${s}`))})}function qo({roomId:e,roomName:n,viewerAuthorId:s,entries:t,members:o,formerAuthors:r,lastReadSeq:l,reactionFrequents:d,streamStalled:m,isLoading:f,error:u,onAddAgents:c,openThreadId:w,onOpenThread:h,resumeRow:g,landOnRow:k,onTopRow:x,canLoadOlder:N=!1,isLoadingOlder:p=!1,onLoadOlder:b,ref:_}){const T=i.useMemo(()=>Ee(o,r),[o,r]),$=he(o,s),M=De(),E=i.useMemo(()=>new Map([...T].map(([y,O])=>[y,O.displayName])),[T]),P=ut(),I=mt(e,null),{topLevel:F,repliesByRoot:D,orphaned:C}=i.useMemo(()=>uo(t),[t]),B=i.useMemo(()=>new Map(t.map(y=>[y.id,y])),[t]),L=i.useMemo(()=>{const y=vn(F,l),O=kn(F.map(v=>({id:v.id,authorId:v.body.moment?`moment:${v.id}`:v.authorId,timestamp:v.createdAt})),{now:P,lastSeenId:y.lastSeenId,unreadFromStart:y.fromStart}),A=[];N&&!f&&A.push({kind:"load-older",id:Ho});for(const v of O){if(v.kind==="day-divider"){A.push({kind:"day-divider",id:v.key,label:v.label});continue}if(v.kind==="unread-divider"){A.push({kind:"unread-divider",id:v.key});continue}const S=F[v.index];A.push({kind:"message",id:S.id,entry:S,grouping:v.grouping,position:v.index+1,answers:Ot(S,F[v.index-1],B.get.bind(B))});const j=D.get(S.id);j&&A.push({kind:"thread-reply",id:Mt(S.id),rootId:S.id,replies:j,totalReplies:S.threadReplyCount})}return A},[F,D,B,l,P,N,f]),H=i.useMemo(()=>L.map(y=>y.kind==="load-older"?{kind:"notice",id:y.id,at:"",body:null}:y.kind==="day-divider"?{kind:"day-divider",id:y.id,label:y.label}:y.kind==="unread-divider"?{kind:"unread-divider",id:y.id}:y.kind==="thread-reply"?{kind:"thread-reply",id:y.id,rootId:y.rootId,replyCount:_e(y.replies.length,y.totalReplies),lastAt:y.replies[y.replies.length-1].createdAt}:{kind:"message",id:y.id,payload:y.entry,grouping:y.grouping,author:Y(ue(y.entry,T),T,M.faces),at:y.entry.createdAt}),[L,T,M.faces]),W=i.useCallback((y,O)=>{const A=L[O.index];if(A.kind==="load-older")return b===void 0?null:a.jsx(xo,{loading:p,onLoad:b});if(A.kind==="day-divider")return a.jsx(xs,{label:A.label});if(A.kind==="unread-divider")return a.jsx(ys,{});if(A.kind==="thread-reply"){if(O.onOpenThread===void 0)return null;const S=O.onOpenThread;return a.jsx(ao,{id:me(A.rootId),summary:Vs(A.replies,l,A.totalReplies),open:w===A.rootId,onOpen:()=>S(A.rootId)})}const v=ue(A.entry,T);return a.jsx(Pt,{roomId:e,entry:A.entry,author:Y(v,T,M.faces),authorRef:T.get(v),authors:T,viewerAuthorId:s,authorNames:E,reactionFrequents:d,streamStalled:m,isMember:$,grouping:A.grouping,orphanedReply:C.has(A.entry.id),answers:A.answers,feedPosition:{index:A.position,total:-1},rowId:fe(A.entry.id)})},[L,e,T,M.faces,s,E,d,m,$,C,l,w,p,b]),z=i.useCallback(y=>{if(y.kind==="message")return fe(y.id);if(y.kind==="thread-reply")return me(y.rootId)},[]);if(u)return a.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[a.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),a.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const U=o.some(y=>y.author.kind==="agent"),R=a.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[a.jsx(Rn,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),a.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),a.jsx("p",{className:"max-w-sm",children:U?"Say something to get it going.":"Nothing answers until you add an agent."}),a.jsx(Ae,{type:"button",size:"sm",variant:U?"ghost":"default",onClick:c,className:"mt-1",children:U?"Add more agents":"Add agents"})]});return a.jsx(Tt,{known:M,children:a.jsx(Q.Timeline,{ref:_,conversationId:e,label:`Messages in ${n}`,rows:H,renderRow:W,onOpenThread:h,domIdOf:z,...g===void 0?{}:{resumeRow:g},...k===void 0?{}:{landOnRow:k},...x===void 0?{}:{onTopRow:x},pending:I,viewerAuthorId:s,loading:f?a.jsx($t,{roomName:n}):void 0,empty:R,feedTestId:"room-timeline"})})}const Le={reactions:!0,threads:!0,runWith:!1,attachments:!0,mentions:!0,streamHealth:!0,presence:!0,turnStatus:!1,asks:!0};function Wo(e){const n=ne(),[s,t]=i.useState([]),o=i.useRef(new Map),r=i.useCallback(h=>{const g=h.map(k=>({id:crypto.randomUUID(),file:k,status:"pending",progress:0}));t(k=>[...k,...g])},[]),l=i.useCallback(h=>{o.current.delete(h),t(g=>g.filter(k=>k.id!==h))},[]),d=i.useCallback(h=>{if(!h){o.current.clear(),t([]);return}const g=new Set(h);for(const k of g)o.current.delete(k);t(k=>k.filter(x=>!g.has(x.id)))},[]),m=i.useCallback(h=>{o.current.delete(h),t(g=>g.map(k=>k.id===h&&k.status==="error"?{...k,status:"pending",progress:0,error:void 0}:k))},[]),f=i.useRef(null),u=re({meta:{suppressErrorToast:!0},mutationFn:async h=>{t(N=>N.map(p=>h.some(b=>b.id===p.id)?{...p,status:"uploading"}:p));const g=N=>{t(p=>p.map(b=>b.status==="uploading"?{...b,progress:N.percentage}:b))},k=new AbortController;f.current=k;const x=h.map(N=>N.file);return n.uploadRoomAttachments(e,x,g,k.signal)},onSettled:()=>{f.current=null},onSuccess:(h,g)=>{g.forEach((k,x)=>{const N=h[x];N&&o.current.set(k.id,N.id)}),t(k=>k.map(x=>g.findIndex(p=>p.id===x.id)===-1?x:{...x,status:"uploaded",progress:100}))},onError:h=>{t(g=>g.map(k=>k.status==="uploading"?{...k,status:"error",error:h.message}:k))}}),c=i.useCallback(()=>{var h;(h=f.current)==null||h.abort()},[]),w=i.useCallback(async()=>{const h=s.filter(k=>k.status==="error");if(h.length>0)throw new Error(h.length===1?`${h[0].file.name} didn’t upload. Try again or remove it.`:`${h.length} files didn’t upload. Try again or remove them.`);const g=s.filter(k=>k.status==="pending");return g.length>0&&await u.mutateAsync(g),s.map(k=>o.current.get(k.id)).filter(k=>k!==void 0)},[s,u]);return{pendingFiles:s,addFiles:r,removeFile:l,retryFile:m,clearFiles:d,cancelUpload:c,uploadAndGetIds:w,hasPendingFiles:s.length>0,hasFailedUpload:s.some(h=>h.status==="error"),isUploading:u.isPending}}function Dt(e){const{room:n,threadRootId:s}=e,t=bs(),o=vs(),r=Wo((n==null?void 0:n.id)??""),l=n!==void 0&&he(n.members,n.viewerAuthorId),d=i.useRef({attachments:r,post:t,reply:o,room:n,threadRootId:s});i.useEffect(()=>{d.current={attachments:r,post:t,reply:o,room:n,threadRootId:s}});const m=i.useCallback(p=>d.current.attachments.addFiles(p),[]),f=i.useCallback(p=>d.current.attachments.removeFile(p),[]),u=i.useCallback(p=>d.current.attachments.retryFile(p),[]),c=i.useCallback(()=>d.current.attachments.cancelUpload(),[]),{pendingFiles:w,hasFailedUpload:h,isUploading:g}=r,k=i.useMemo(()=>({staged:w,add:m,remove:f,retry:u,cancel:c,hasFailed:h,isUploading:g,holdsSendWhileUploading:!1}),[w,h,g,m,f,u,c]),x=i.useCallback(async p=>{const{attachments:b,post:_,reply:T,room:$,threadRootId:M}=d.current;if($===void 0)throw new Error("That room isn’t loaded yet.");if($.archived)throw new Error("This room is archived.");Re.getState().recordOpened("room",$.id);const E=wn(),P=b.pendingFiles.map(C=>C.file.name),I=b.pendingFiles.map(C=>C.id),F=await b.uploadAndGetIds();b.clearFiles(I);const D=p.parentEntryId??M;if(D!==void 0){T.mutate({roomId:$.id,rootEntryId:D,text:p.text,clientId:E,attachmentIds:F,attachmentNames:P});return}_.mutate({roomId:$.id,text:p.text,clientId:E,attachmentIds:F,attachmentNames:P})},[]);return{target:i.useMemo(()=>({kind:"room",id:(n==null?void 0:n.id)??"",placeholder:n===void 0?"Message…":s===void 0?`Message ${te(n)}…`:"Reply in this thread…",canSend:n!==void 0&&!n.archived&&l,...n===void 0?{canSendReason:"Still opening this room…"}:n.archived?{canSendReason:"This room is archived. You can read it, but not add to it."}:l?{}:{canSendReason:ft},send:x,attachments:k}),[n,s,l,k,x]),attachments:r}}function Ko(e){const{roomId:n,entrySeq:s,entries:t,historyLoaded:o}=e,r=s===void 0?null:`${n}:${s}`,l=i.useMemo(()=>{if(s===void 0)return null;const g=t.find(p=>p.seq===s);if(g===void 0)return null;const k=Pe(t,g.id);if(k===null)return null;const x=J(g)??null,N=x!==null&&k.rowId!==g.id;return{roomRowId:k.rowId,threadRootId:N?x:null,entryId:g.id}},[t,s]),d=i.useRef(null),m=(l==null?void 0:l.threadRootId)??null;i.useEffect(()=>{r===null||m===null||d.current!==r&&(d.current=r,X.getState().openThread(n,m))},[r,n,m]);const f=i.useRef(null);i.useEffect(()=>{r===null||!o||l===null&&f.current!==r&&(f.current=r,pt.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[r,o,l]);const u=i.useRef(null),c=i.useCallback(()=>{if(!(r===null||u.current===r))return u.current=r,l==null?void 0:l.roomRowId},[r,l]),w=i.useRef(null),h=i.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:c,threadRow:s===void 0?void 0:h}}function Go(e,n){const[s,t]=i.useState({roomId:null,seq:null});return s.roomId===e?s.seq:e===null?(t({roomId:null,seq:null}),null):n===null?null:(t({roomId:e,seq:n}),n)}const Vo=600;function Xo(e){return document.getElementById(me(e))??document.getElementById(fe(e))}function Yo(){const e=i.useRef(null);return i.useEffect(()=>()=>{var s;return(s=e.current)==null?void 0:s.call(e)},[]),{arm:i.useCallback(s=>{var d;(d=e.current)==null||d.call(e);let t=0;const o=Date.now()+Vo;let r=!1;const l=()=>{if(r)return;const m=document.activeElement;if(m===null||m===document.body||!m.isConnected){const u=Xo(s);if(u!==null){u.focus();return}}Date.now()>=o||(t=requestAnimationFrame(l))};t=requestAnimationFrame(l),e.current=()=>{r=!0,cancelAnimationFrame(t)}},[])}}function Qo({roomId:e,route:n,urlThreadId:s,openThreadId:t,entries:o,historyLoaded:r}){const l=In(),d=i.useRef(null);i.useEffect(()=>{if(e!==null){if(d.current!==e&&(d.current=e,s!==void 0)){X.getState().openThread(e,s);return}if(r&&t!==void 0){const m=o.find(u=>u.id===t),f=m===void 0?void 0:Ct(m);if(f!==void 0&&f!==t){const u=X.getState().open[e];X.getState().openThread(e,f,(u==null?void 0:u.focusComposer)??!1);return}}t!==s&&(l==null||l({to:n,search:m=>({...m,thread:t}),replace:!0}))}},[e,n,t,s,o,r,l])}const Jo=6,Ft="jump-back-in-listbox";function ze(e){return`jump-back-in-item-${e}`}const Zo='[role="combobox"]';function oe(e){return e instanceof Element&&e.matches(Zo)}function er({value:e,yieldToPalette:n=!1,enabled:s=!0}){const t=Ce(),o=Nn(),[r,l]=i.useState(!1),[d,m]=i.useState({stamp:"",index:0}),[f,u]=i.useState(!1),[c,w]=i.useState(!1);e.length>0&&!c&&w(!0);const h=i.useRef(!1);i.useEffect(()=>{h.current=!0},[]);const{data:g}=it({enabled:s}),k=i.useMemo(()=>((g==null?void 0:g.agents)??[]).map(R=>R.projectPath),[g]),{data:x}=lt(k,{enabled:s}),N=i.useMemo(()=>x??{},[x]),p=i.useMemo(()=>jn(k,N),[k,N]),b=i.useMemo(()=>new Map(k.map(R=>[at(R),R])),[k]),_=i.useCallback(R=>Sn({room:R,agentsByPath:N,pathByAgentRef:b}),[N,b]),T=i.useMemo(()=>An(o.muted),[o.muted]),{items:$}=cs({mutedRoomIds:T,enabled:s}),M=i.useMemo(()=>$.slice(0,Jo),[$]),E=s&&r&&!f&&!c&&!n&&e.length===0&&M.length>0,P=`${E}:${M.length}`,I=d.stamp===P?d.index:0,F=i.useCallback(R=>{h.current&&oe(R.target)&&(u(!1),w(!1),l(!0))},[]),D=i.useCallback(R=>{oe(R.target)&&l(!0)},[]),C=i.useCallback(R=>{oe(R.target)&&l(!1)},[]),B=i.useCallback(R=>{M.length!==0&&m(y=>{const O=y.stamp===P?y.index:0;return{stamp:P,index:(O+R+M.length)%M.length}})},[M.length,P]),L=i.useCallback(()=>B(1),[B]),H=i.useCallback(()=>B(-1),[B]),W=i.useCallback(()=>{u(!0)},[]),z=i.useCallback(R=>{if(u(!0),R.kind==="session"){R.session.cwd&&Re.getState().recordOpened("agent",R.session.cwd),t(ce({dir:R.session.cwd??void 0,session:R.session.id}));return}Re.getState().recordOpened("room",R.room.id),t({...ht.channels(),search:{id:R.room.id}})},[t]),U=i.useCallback(()=>{const R=M[I];!E||!R||z(R)},[E,M,I,z]);return{isOpen:E,hasRows:M.length>0,rows:M,agents:N,displayNames:p,visualOf:_,selectedIndex:I,activeDescendantId:E&&M[I]!==void 0?ze(I):void 0,listboxId:E?Ft:void 0,handleFocus:F,handleBlur:C,handlePointerDown:D,moveDown:L,moveUp:H,selectHighlighted:U,selectRow:z,dismiss:W}}function Lt({mark:e,label:n,title:s,summary:t,lastActivityAt:o,index:r,isSelected:l,now:d,onSelect:m}){const f=i.useMemo(()=>Number.isNaN(Date.parse(o))?null:En(o),[o,d]);return a.jsxs("div",{id:ze(r),role:"option","aria-selected":l,"data-selected":l,title:s,onClick:m,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:[a.jsx("span",{className:"mt-px flex shrink-0 items-center",children:e}),a.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[a.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[a.jsx("span",{className:"text-foreground min-w-0 flex-1 truncate text-sm",children:n}),f!==null&&a.jsx("span",{className:"text-muted-foreground/60 text-3xs shrink-0",children:f})]}),t!==null&&a.jsx("span",{className:"text-muted-foreground/70 text-2xs truncate",children:t})]})]})}function tr({item:e,agent:n,displayName:s,index:t,isSelected:o,now:r,onSelect:l}){const d=Cn(n,e.session.cwd??s);return a.jsx(Lt,{mark:a.jsx(Mn,{color:d.color,emoji:d.emoji,size:"xs"}),label:e.name,title:`${s} · ${e.name}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:t,isSelected:o,now:r,onSelect:l})}function nr({item:e,visual:n,index:s,isSelected:t,now:o,onSelect:r}){return a.jsx(Lt,{mark:a.jsx(Tn,{room:e.room,participants:e.room.participants,visuals:_n(n)}),label:a.jsx(On,{room:e.room}),title:e.summary===null?e.name:`${e.name} · ${e.summary}`,summary:e.summary,lastActivityAt:e.lastActivityAt,index:s,isSelected:t,now:o,onSelect:r})}function sr({rows:e,selectedIndex:n,agents:s={},displayNames:t={},visualOf:o,onSelect:r}){const l=ut(6e4);return i.useEffect(()=>{var d,m;(m=(d=document.getElementById(ze(n)))==null?void 0:d.scrollIntoView)==null||m.call(d,{block:"nearest"})},[n]),a.jsx(Me.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:d=>d.preventDefault(),children:a.jsx("div",{id:Ft,role:"listbox","aria-label":"Jump back in",className:"max-h-72 overflow-y-auto p-1.5",children:e.map((d,m)=>{var f;return d.kind==="session"?a.jsx(tr,{item:d,agent:d.session.cwd&&s[d.session.cwd]||null,displayName:d.session.cwd&&t[d.session.cwd]||((f=d.session.cwd)==null?void 0:f.split("/").pop())||"Agent",index:m,isSelected:m===n,now:l,onSelect:()=>r(d)},`session-${d.id}`):a.jsx(nr,{item:d,visual:o(d.room),index:m,isSelected:m===n,now:l,onSelect:()=>r(d)},`room-${d.id}`)})})})}const Je={people:"People",agents:"Agents"},or=["people","agents"];function rr(e,n){const s=[];for(const{author:t}of e){if(t.kind==="system"||t.id===n||t.retired)continue;const o=t.handle;s.push({section:t.kind==="agent"?"agents":"people",authorId:t.id,label:t.displayName,...o?{handle:o}:{},...t.emoji?{emoji:t.emoji}:{},...t.color?{color:t.color}:{},disabled:!o,...o?{}:{disabledReason:"No @name"}})}return s}function ar(e,n,s){const t=n.trim().toLowerCase(),o=e.map((r,l)=>({row:r,position:l,tier:ir(r,t)})).filter(r=>r.tier!==null).sort((r,l)=>r.tier-l.tier||r.position-l.position);return s.flatMap(r=>o.filter(l=>l.row.section===r).map(({row:l})=>l))}function ir(e,n){var o;if(n==="")return 0;const s=[(o=e.handle)==null?void 0:o.toLowerCase(),e.label.toLowerCase()].filter(r=>r!==void 0);let t=null;for(const r of s){const l=r===n?0:r.startsWith(n)?1:r.includes(n)?2:null;l!==null&&(t===null||l<t)&&(t=l)}return t}function ie(e,n,s){var r;const t=e.length;if(t===0)return 0;let o=(n%t+t)%t;for(let l=0;l<t;l++){if(!((r=e[o])!=null&&r.disabled))return o;o=(o+s+t)%t}return 0}function lr(e,n,s,t){const o=e.slice(0,n),r=e.slice(n+1+s.length),l=`@${t}`,d=r.startsWith(" ")?"":" ";return{value:o+l+d+r,cursorPos:o.length+l.length+1}}const dr=/(^|\s)@([A-Za-z0-9_.-]*)$/,zt="mention-palette-listbox";function je(e){return`mention-item-${e}`}function cr({members:e,viewerAuthorId:n,text:s,sectionOrder:t=or}){var D;const[o,r]=i.useState(!1),[l,d]=i.useState(""),[m,f]=i.useState(-1),u=Pn(s),c=i.useRef(!1),w=i.useMemo(()=>rr(e,n),[e,n]),h=i.useMemo(()=>o?ar(w,l,t):[],[w,l,o,t]),[g,k]=i.useState(null),x=g!==null&&g.query===l&&g.open===o?g.index:ie(h,0,1),N=h[x],p=h.length===0||N!==void 0&&!N.disabled?x:ie(h,0,1),b=i.useCallback((C,B)=>{const L=C.slice(0,B).match(dr);if(!L){r(!1);return}r(!0),d(L[2]),f((L.index??0)+L[1].length)},[]),_=i.useCallback(C=>{u.write(C),c.current=!1},[u]),T=i.useCallback(C=>{c.current||b(u.read(),C)},[b,u]),$=i.useCallback(()=>{k({query:l,open:o,index:ie(h,p+1,1)})},[h,p,l,o]),M=i.useCallback(()=>{k({query:l,open:o,index:ie(h,p-1,-1)})},[h,p,l,o]),E=i.useCallback(C=>C.disabled||C.handle===void 0?null:(c.current=!0,r(!1),lr(u.read(),m,l,C.handle)),[m,l,u]),P=i.useCallback(()=>{const C=h[p];return C?E(C):(r(!1),null)},[h,p,E]),I=i.useCallback(()=>{c.current=!0,r(!1)},[]),F=h.some(C=>!C.disabled);return{isOpen:o,hasSelectableRows:F,rows:h,selectedIndex:p,activeDescendantId:o&&((D=h[p])==null?void 0:D.disabled)===!1?je(p):void 0,listboxId:o?zt:void 0,noteTextChange:_,handleCursorChange:T,moveDown:$,moveUp:M,selectHighlighted:P,selectRow:E,dismiss:I}}function ur({rows:e,selectedIndex:n,onSelect:s}){const t=i.useMemo(()=>{const o=[];return e.forEach((r,l)=>{const d=o[o.length-1];d&&d.section===r.section?d.items.push({row:r,index:l}):o.push({section:r.section,items:[{row:r,index:l}]})}),o},[e]);return i.useEffect(()=>{var o;(o=document.getElementById(je(n)))==null||o.scrollIntoView({block:"nearest"})},[n]),a.jsx(Me.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:a.jsx("div",{id:zt,role:"listbox","aria-label":"Mentions",className:"max-h-72 overflow-y-auto p-1.5",children:e.length===0?a.jsx("div",{className:"text-muted-foreground px-2 py-4 text-center text-sm",children:"No one by that name."}):t.map(({section:o,items:r},l)=>a.jsxs("div",{role:"group","aria-label":Je[o],children:[l>0&&a.jsx("div",{className:"bg-border mx-2 my-1.5 h-px"}),a.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:Je[o]}),r.map(({row:d,index:m})=>{const f=m===n;return a.jsxs("div",{id:je(m),role:"option","aria-selected":f,"aria-disabled":d.disabled,"data-selected":f,"data-disabled":d.disabled,onClick:()=>{d.disabled||s(d)},className:d.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:[a.jsx("span",{"aria-hidden":!0,className:"size-4 shrink-0 text-center text-sm leading-none",children:d.emoji}),a.jsx("span",{className:"text-foreground truncate text-sm font-medium",children:d.label}),d.handle!==void 0&&a.jsxs("span",{className:"text-muted-foreground/70 truncate font-mono text-xs",children:["@",d.handle]}),d.disabledReason!==void 0&&a.jsx("span",{className:"text-muted-foreground/70 text-2xs ml-auto shrink-0",children:d.disabledReason})]},d.authorId)})]},o))})})}function Bt({room:e,threadRootId:n,focusOnMount:s,offerJumpBackIn:t,onFocusChange:o,attachments:r}){const l=n===void 0?e.id:ot(e.id,n),d=$n(l),{target:m}=yt(),f=Dn(),u=Fn(l),c=i.useRef(null),w=he(e.members,e.viewerAuthorId),h=i.useRef(!1),g=cr({members:e.members,viewerAuthorId:e.viewerAuthorId,text:d}),k=t===!0,x=er({value:d,yieldToPalette:g.isOpen,enabled:k}),N=i.useRef(u);i.useEffect(()=>{var I;u!==N.current&&(N.current=u,(I=c.current)==null||I.focus())},[u]),i.useEffect(()=>{var I;s===!0&&((I=c.current)==null||I.focusUnlessTouch())},[]);const p=i.useCallback(I=>le.getState().set(l,I),[l]),[b,_]=i.useState(null);i.useLayoutEffect(()=>{var I;b!==null&&((I=c.current)==null||I.focusAt(b.pos))},[b]);const T=i.useCallback(I=>{I&&(p(I.value),_({pos:I.cursorPos}))},[p]),$=i.useCallback(I=>T(g.selectRow(I)),[g,T]),M=i.useCallback(()=>T(g.selectHighlighted()),[g,T]),E=()=>{if(m===null||!m.canSend||h.current)return;g.dismiss();const I=le.getState().take(l).trim();if(I==="")return;const F=r.pendingFiles.length>0;F&&(h.current=!0),m.send({text:I}).catch(()=>{const D=le.getState(),C=D.drafts[l]??"";D.set(l,C===""?I:`${I}
|
|
44
|
-
${C}`)}).finally(()=>{F&&(h.current=!1)})};if(!w)return a.jsxs("div",{className:"flex items-center justify-between gap-3 border-t px-4 py-3",children:[a.jsx("p",{className:"text-muted-foreground text-sm",children:ft}),a.jsx(Ae,{type:"button",size:"sm",variant:"outline",disabled:f.isPending,onClick:()=>f.mutate({roomId:e.id,authorId:e.viewerAuthorId},{onSuccess:()=>pt.success(`You joined ${te(e)}`)}),children:Ln})]});const P=a.jsx(Q.Composer,{inputRef:c,value:d,onChange:I=>{p(I),g.noteTextChange(I)},onSubmit:E,head:a.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:a.jsx(we,{children:g.isOpen&&a.jsx(ur,{rows:g.rows,selectedIndex:g.selectedIndex,onSelect:$})}),overlays:a.jsx(a.Fragment,{children:a.jsx(we,{children:x.isOpen&&a.jsx(sr,{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:M,onEscape:x.isOpen?x.dismiss:g.dismiss,tabPicks:!x.isOpen,onClear:()=>{p(""),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!k&&o===void 0?P:a.jsx("section",{className:"flex flex-col","data-testid":zn.homeComposer,onFocus:I=>{x.handleFocus(I),oe(I.target)&&(o==null||o(!0))},onBlur:I=>{x.handleBlur(I),oe(I.target)&&(o==null||o(!1))},onPointerDown:x.handlePointerDown,children:P})}function mr(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(n=>n.author.kind==="agent")}function fr({room:e,hasEntries:n,onAddAgents:s}){return!n||!mr(e)?null:a.jsxs("p",{className:"text-muted-foreground shrink-0 px-4 pb-1 text-xs","data-testid":"no-agent-hint",children:["No agent is in this channel to answer."," ",a.jsx("button",{type:"button",onClick:s,className:"text-foreground focus-visible:ring-ring rounded-sm underline underline-offset-2 focus-visible:ring-2 focus-visible:outline-none",children:"Add one"})," ","to get answers here."]})}function pr({roomId:e}){const{approvals:n}=Bn(),s=Hn(n).filter(t=>t.roomId===e);return s.length===0?null:a.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:a.jsx(Un,{approvals:s})})}function hr({roomId:e}){const{data:n}=Ps("pending"),s=(n??[]).filter(t=>t.roomId===e);return s.length===0?null:a.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(t=>a.jsx($s,{request:t},t.requestId))})}const gr="An agent",Ze=64,ke=3,xr=new Set;function Ht({room:e,entries:n,scope:s,laneScope:t,stalled:o,unavailable:r=!1,onRetry:l,onScrollToRow:d}){const m=Ce(),f=qn(e.id,s),u=Wn(e.id,s),c=Kn(e.id,s),[w,h]=i.useState(!1),g=At(e.id,{enabled:w}),k=Gn(),{mutate:x}=Ws(),[N,p]=i.useState(xr),b=i.useCallback(v=>{p(S=>new Set(S).add(v)),x({roomId:e.id,authorId:v},{onSettled:()=>p(S=>{const j=new Set(S);return j.delete(v),j})})},[x,e.id]),_=Ks(),[T,$]=i.useState(()=>new Map),M=Vn(),E=De(),P=i.useMemo(()=>Ee(e.members,e.formerAuthors),[e.members,e.formerAuthors]),I=i.useCallback(v=>{var S;return((S=P.get(v))==null?void 0:S.displayName)??gr},[P]),{interactions:F}=Xn(),D=i.useMemo(()=>F.filter(v=>v.roomId===e.id),[F,e.id]),C=i.useMemo(()=>{var S;const v={};for(const j of D){if(j.roomAuthorId===void 0)continue;const q=(S=P.get(j.roomAuthorId))==null?void 0:S.displayName;q!==void 0&&(v[j.sessionId]=q)}return v},[D,P]),B=i.useMemo(()=>f.map(v=>({authorId:v.authorId,name:I(v.authorId),state:v.state,since:v.since,activity:v.activity??null})),[f,I]),L=i.useMemo(()=>u.map(v=>{var j;const S=(j=M.data)==null?void 0:j.find(q=>q.id===v.behindRoomId);return{authorId:v.authorId,name:I(v.authorId),since:v.since,behind:{roomId:v.behindRoomId,title:S===void 0?null:te(S)},othersWaiting:v.othersWaiting,severalInTheWay:v.severalInTheWay}}),[u,I,M.data]),H=i.useMemo(()=>{const v=new Set;for(const S of u)T.get(S.authorId)===S.entryId&&v.add(S.authorId);return v},[u,T]),W=i.useMemo(()=>c===null?null:{authorId:c.authorId,name:I(c.authorId)},[c,I]),z=i.useMemo(()=>ks({capabilities:Le,asks:D,agentNames:C,stalled:o,presence:B,held:L,silentFinish:W,turn:null}),[D,C,B,L,W,o]),U=i.useMemo(()=>{var S;const v=new Map;for(const j of((S=g.data)==null?void 0:S.bindings)??[])v.set(j.authorId,j.sessionId);return v},[g.data]),R=i.useCallback(v=>{const S=n.find(q=>q.id===v);if(S===void 0)return null;const j=S.body.text.replace(/\s+/gu," ").trim();return j.length===0?null:j.length>Ze?`${j.slice(0,Ze).trimEnd()}…`:j},[n]),y=i.useCallback(v=>{var S;return t==="thread"?Ie(v):((S=Pe(n,v))==null?void 0:S.domId)??null},[n,t]),O=i.useMemo(()=>{const v=f.map(j=>{const q=R(j.entryId),K=y(j.entryId);return{authorId:j.authorId,author:Y(j.authorId,P,E.faces),state:j.state,since:j.since,doing:Yn(j.activity),replyingTo:q===null||K===null?null:{entryId:j.entryId,excerpt:q,rowId:K},sessionId:U.get(j.authorId)??null}}),S=L.map(j=>({authorId:j.authorId,author:Y(j.authorId,P,E.faces),state:"held",since:j.since,doing:null,replyingTo:null,sessionId:null,behind:j.behind,othersWaiting:j.othersWaiting}));return[...v,...S]},[f,L,P,E.faces,R,y,U]),A=i.useMemo(()=>{if(f.length===0)return null;const v=f.slice(0,ke);return a.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[v.map(S=>a.jsx(gt,{author:Y(S.authorId,P,E.faces),className:"ring-background size-4 ring-2"},S.authorId)),f.length>ke&&a.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${f.length-ke}`})]})},[f,P,E.faces]);return a.jsx(Q.LiveLane,{state:z,scope:t,onRetry:l,unavailable:r,faces:A,onPeekOpenChange:h,askCard:z.kind==="ask"?a.jsx(Qn,{ask:z.ask,...C[z.ask.sessionId]?{agentName:C[z.ask.sessionId]}:{},onOpenSession:v=>{m(ce({session:v}))},className:"border-l-0"}):void 0,peek:a.jsx(Q.LivePeek,{rows:O,onScrollToRow:d,onOpenSession:v=>{m(ce({session:v}))},onOpenRoom:v=>{m({...ht.channels(),search:{id:v}})},onAnswerFirst:v=>{const S=u.find(j=>j.authorId===v);S!==void 0&&$(j=>new Map(j).set(v,S.entryId)),_.mutate({roomId:e.id,authorId:v})},promoted:H,onStopAll:()=>k.mutate({roomId:e.id}),stopping:k.isPending,onStopAgent:b,stoppingAgents:N})})}const et=3e3;function yr(e,n,s,t=Date.now){const o=i.useRef(null),r=i.useRef(new Map),l=i.useRef(new Map),d=o.current,m=r.current,f=l.current,u=t();for(const c of e){if(f.has(c.id))continue;if(d===null){f.set(c.id,"at-rest");continue}const w=m.get(c.authorId);f.set(c.id,w!==void 0&&u-w<et?"handed-off":"dropped")}return i.useEffect(()=>{if(!s)return;o.current=new Set(e.map(w=>w.id));const c=t();for(const w of n)r.current.set(w,c);for(const[w,h]of r.current)c-h>et&&r.current.delete(w);for(const w of l.current.keys())o.current.has(w)||l.current.delete(w)}),f}function br({kind:e}){return e==="thread-error"?a.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:[a.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),a.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?a.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[a.jsx(se,{className:"h-3 w-24"}),a.jsx(se,{className:"h-3 w-full max-w-sm"})]}):a.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 vr({room:e,rootEntryId:n,focusComposer:s,entries:t,reactionFrequents:o,streamStalled:r,streamUnavailable:l,onRetryStream:d,historyLoaded:m,historyFailed:f=!1,landOnRow:u,pushed:c,onClose:w}){const h=i.useMemo(()=>Ee(e.members,e.formerAuthors),[e.members,e.formerAuthors]),g=Dt({room:e,threadRootId:n}),k=he(e.members,e.viewerAuthorId),x=De(),N=i.useMemo(()=>new Map([...h].map(([R,y])=>[R,y.displayName])),[h]),{root:p,replies:b}=i.useMemo(()=>{let R;const y=[];for(const O of t)O.id===n?R=O:J(O)===n&&y.push(O);return{root:R,replies:y}},[t,n]),_=p==null?void 0:p.threadReplyCount,T=_!==void 0&&_>b.length,$=p===void 0||T?-1:1+b.length,M=_e(b.length,_),E=i.useMemo(()=>new Set(b.map(R=>R.id)),[b]),P=i.useMemo(()=>({replyIds:E,inside:!0}),[E]),I=Jn(e.id,P),F=mt(e.id,n),D=yr(b,I,m),C=i.useRef(null),B=i.useCallback(R=>{var y;(y=C.current)==null||y.scrollToRow(R)},[]),L=i.useRef(null);i.useEffect(()=>{var R;s||(R=L.current)==null||R.focus()},[n,s]);const H=R=>{R.key!=="Escape"||R.defaultPrevented||(R.stopPropagation(),w())},W=i.useMemo(()=>{const R=[];if(p===void 0){const y=f?"thread-error":m?"thread-orphan":"thread-waiting";R.push({kind:"notice",id:y,at:"",body:null})}else R.push({kind:"message",id:p.id,payload:p,grouping:{position:"only"},author:Y(ue(p,h),h,x.faces),at:p.createdAt});for(const y of b)R.push({kind:"message",id:y.id,payload:y,grouping:{position:"only"},author:Y(ue(y,h),h,x.faces),at:y.createdAt});return R},[p,b,h,x.faces,f,m]),z=i.useCallback(R=>{if(R.kind==="notice")return a.jsx(br,{kind:R.id});if(R.kind!=="message")return null;const y=R.payload,O=p!==void 0&&y.id===p.id,A=b.findIndex(j=>j.id===y.id),v=a.jsx(Pt,{roomId:e.id,entry:y,rowId:Ie(y.id),author:R.author,authorRef:h.get(y.authorId),authors:h,viewerAuthorId:e.viewerAuthorId,authorNames:N,reactionFrequents:o,streamStalled:r,isMember:k,grouping:{position:"only"},answers:Ot(y,A<=0?p:b[A-1],j=>(p==null?void 0:p.id)===j?p:b.find(q=>q.id===j)),feedPosition:{index:O?1:(p===void 0?0:1)+A+1,total:$}});if(O)return M===0?v:a.jsxs(a.Fragment,{children:[v,a.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:[a.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:M===1?"1 reply":`${M} replies`}),a.jsx("span",{className:"bg-border h-px flex-1"})]})]});const S=D.get(y.id)??"at-rest";return a.jsx("div",{className:V(S==="dropped"&&"motion-safe:animate-thread-reply-in",S==="handed-off"&&"motion-safe:animate-reply-settle"),children:v})},[p,b,M,D,e.id,e.viewerAuthorId,h,N,o,r,k,$]),U=i.useCallback(R=>R.kind==="message"?Ie(R.id):void 0,[]);return a.jsx(Tt,{known:x,children:a.jsx(Q.Root,{surface:"room",capabilities:Le,target:g.target,anchor:"rail",children:a.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",c?"h-full w-full":"w-full border-l"),children:[a.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[a.jsx("button",{type:"button",onClick:w,"aria-label":c?`Back to ${te(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:c?a.jsx(Zn,{"aria-hidden":!0,className:"size-4"}):a.jsx(es,{"aria-hidden":!0,className:"size-4"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-sm font-medium",children:"Thread"}),a.jsx("p",{className:"text-muted-foreground truncate text-xs",children:te(e)})]})]}),a.jsx(Q.Timeline,{ref:C,conversationId:`thread-${n}`,label:`Thread in ${te(e)}`,busy:!m&&!f,rows:W,renderRow:z,domIdOf:U,...u===void 0?{}:{landOnRow:u},pending:F,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),a.jsx(Ht,{room:e,entries:t,scope:P,laneScope:"thread",stalled:c&&r===!0,unavailable:l,onRetry:c?d:void 0,onScrollToRow:B}),a.jsx(Bt,{room:e,threadRootId:n,attachments:g.attachments,focusOnMount:s},n)]})})})}const ge="room-thread-split",kr=320,Rr=360,wr=40,Ir=50,Nr=25;function tt(e,n){return n<=0?Nr:Math.min(Math.round(e/n*1e3)/10,Ir)}function jr(e){const n=tt(kr,e),s=Math.round((100-tt(Rr,e))*10)/10;return{minPct:n,maxPct:s,defaultPct:Math.min(Math.max(wr,n),s)}}function Sr(e,n,s){if(e===null||n===null||n<=0)return s.defaultPct;const t=e/n*100;return Math.round(Math.min(Math.max(t,s.minPct),s.maxPct)*10)/10}function Ar(e){try{const n=localStorage.getItem(e),s=n===null?NaN:Number(n);return Number.isFinite(s)&&s>0?s:null}catch{return null}}function Cr(e,n){try{localStorage.setItem(e,String(Math.round(n)))}catch{}}const Mr="react-resizable-panels:room-thread-split";function Or(){try{localStorage.removeItem(Mr)}catch{}}function Tr(){const[e,n]=i.useState(null),[s,t]=i.useState(null);return{ref:i.useCallback(r=>{if(r===null)return;n(r);const l=()=>t(r.offsetWidth);l();const d=new ResizeObserver(l);return d.observe(r),()=>{d.disconnect(),n(null),t(null)}},[]),element:e,width:s,sizing:jr(s??0)}}const _r=`${ge}-room`,nt=`${ge}-thread`,st=`${ge}-handle`,Er=4;function Pr({room:e,thread:n,storageKey:s=ns.ROOM_THREAD_WIDTH}){const{ref:t,element:o,width:r,sizing:l}=Tr(),[d,m]=i.useState(()=>Ar(s)),[f,u]=i.useState(null),c=i.useRef(null),w=Sr(d,r,l),h=r===null||(l.maxPct-l.minPct)/100*r<Er,g=n!==!1;i.useEffect(Or,[]);const k=i.useRef(!1);i.useLayoutEffect(()=>{var b;k.current&&((b=c.current)==null||b.resize(w))},[w,g]);const x=i.useRef(null),N=()=>{var $;const b=($=c.current)==null?void 0:$.getSize(),_=x.current;if(x.current=null,b===void 0||r===null||r<=0||_===b)return;const T=Math.round(b/100*r);m(T),Cr(s,T)},p=f??w;return i.useLayoutEffect(()=>{const b=o==null?void 0:o.querySelector(`[data-panel-resize-handle-id="${st}"]`);b&&(b.setAttribute("aria-controls",nt),b.setAttribute("aria-valuenow",String(Math.round(p))),b.setAttribute("aria-valuemin",String(Math.round(l.minPct))),b.setAttribute("aria-valuemax",String(Math.round(l.maxPct))))}),a.jsx("div",{ref:t,className:"h-full overflow-hidden",children:a.jsxs(ts,{direction:"horizontal",id:ge,onLayout:b=>{k.current=b.length>1,u(k.current?b[1]:null)},children:[a.jsx(qe,{id:_r,order:1,className:"flex",children:e}),g&&a.jsxs(a.Fragment,{children:[a.jsx(us,{id:st,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:h,onDragging:b=>{var _;b&&(x.current=((_=c.current)==null?void 0:_.getSize())??null)},onKeyDownCapture:b=>{var _,T;h||(x.current=((_=c.current)==null?void 0:_.getSize())??null,!(b.key!=="Home"&&b.key!=="End")&&(b.preventDefault(),(T=c.current)==null||T.resize(b.key==="Home"?l.minPct:l.maxPct)))},onResizeEnd:N}),a.jsx(qe,{ref:c,id:nt,order:2,defaultSize:w,minSize:l.minPct,maxSize:l.maxPct,className:"flex",children:n})]})]})})}function Jr({roomId:e,threadId:n,entrySeq:s,threadRoute:t,aboveTimeline:o,aboveComposer:r,offerJumpBackIn:l,onComposerFocusChange:d}){const m=ss(),f=ms(),u=os(e),c=u==null?void 0:u.rootEntryId,w=Yo(),h=i.useCallback(()=>{var O;const y=(O=X.getState().open[e])==null?void 0:O.rootEntryId;X.getState().closeThread(e),y!==void 0&&w.arm(y)},[e,w]),g=i.useCallback(y=>{X.getState().openThread(e,y)},[e]),k=rs(e),x=as(e),N=Rs(e,x.isSuccess);ws(e);const p=k.data,b=i.useMemo(()=>x.data??[],[x.data]),_=Dt({room:p});Qo({roomId:e,route:t,urlThreadId:n,openThreadId:c,entries:b,historyLoaded:x.isSuccess});const T=i.useMemo(()=>{var y;return((y=p==null?void 0:p.members.find(O=>O.author.id===p.viewerAuthorId))==null?void 0:y.lastReadSeq)??null},[p]),$=Go(e,T);is(p,b);const M=i.useRef(null),E=i.useRef(void 0),P=i.useCallback(y=>{E.current=y},[]),I=i.useCallback(()=>E.current,[]);i.useLayoutEffect(()=>{E.current=void 0},[e]);const F=i.useCallback(y=>{var O;(O=M.current)==null||O.scrollToRow(y)},[]),D=Xs(e),{loadOlder:C,cursor:B}=D,L=i.useCallback(()=>{const y=mo(b,B);C().then(()=>{y!==null&&requestAnimationFrame(()=>{var O;return(O=M.current)==null?void 0:O.scrollToRow(y.domId)})})},[b,B,C]),H=Ko({roomId:e,entrySeq:s,entries:b,historyLoaded:x.isSuccess}),W=i.useMemo(()=>c===void 0?void 0:{replyIds:new Set(b.filter(O=>J(O)===c).map(O=>O.id)),inside:!1},[b,c]);if(k.isLoading)return a.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:a.jsx($t,{})});if(k.isError||!p)return a.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[a.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),a.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const z=u!==void 0&&a.jsx(vr,{room:p,rootEntryId:u.rootEntryId,focusComposer:u.focusComposer,entries:b,reactionFrequents:p.reactionFrequents,streamStalled:N.stalled,streamUnavailable:N.unavailable,onRetryStream:N.retry,historyLoaded:x.isSuccess,historyFailed:x.isError,...H.threadRow===void 0?{}:{landOnRow:H.threadRow},pushed:m,onClose:h},u.rootEntryId),U=a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[o,a.jsx(qo,{ref:M,roomId:p.id,roomName:te(p),viewerAuthorId:p.viewerAuthorId,entries:b,members:p.members,formerAuthors:p.formerAuthors,lastReadSeq:$,reactionFrequents:p.reactionFrequents,streamStalled:N.stalled,isLoading:x.isLoading,error:x.error,onAddAgents:()=>We("add",p.id),openThreadId:c,onOpenThread:g,resumeRow:I,...H.roomRow===void 0?{}:{landOnRow:H.roomRow},onTopRow:P,canLoadOlder:D.canLoadOlder,isLoadingOlder:D.isLoadingOlder,onLoadOlder:L}),r,a.jsx(pr,{roomId:p.id}),a.jsx(hr,{roomId:p.id}),a.jsx(Ht,{room:p,entries:b,scope:W,laneScope:"room",stalled:N.stalled,unavailable:N.unavailable,onRetry:N.retry,onScrollToRow:F}),a.jsx(fr,{room:p,hasEntries:b.length>0,onAddAgents:()=>We("add",p.id)}),a.jsx(Bt,{room:p,attachments:_.attachments,offerJumpBackIn:l,onFocusChange:d},p.id)]}),R={surface:"room",capabilities:Le,target:_.target,anchor:"rail"};return m?a.jsx(Q.Root,{...R,children:a.jsx(we,{initial:!1,mode:"wait",children:a.jsx(Me.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:f},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:z===!1?U:z},z?`thread-${c}`:"room")})}):a.jsx(Q.Root,{...R,children:a.jsx(Pr,{room:U,thread:z})})}export{St as I,$t as R,ao as T,Jr as a,oe as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{as as Be,a1 as b,a3 as K,r as x,a4 as R,j4 as F,j5 as T,a2 as z,j as e,hC as Ee,e4 as Qe,e5 as Y,O as we,Q as Re,U as Ie,B as C,hy as Ge,G as H,dv as We,dR as Ye,j6 as He,j7 as Ve,dA as Le,ar as te,x as de,bx as Je,J as ue,dz as me,e1 as S,e2 as ne,au as Xe,j8 as Ze,I as $,j9 as es,ja as Ae,jb as ss,_ as De,fs as ts,dW as ns,dX as rs,dY as as,dZ as is,d_ as be,dO as os,C as ls,jc as cs,jd as ds,je as us,T as ms}from"./index-Cga0qx1T.js";import{I as xs}from"./inline-code-BE9ckzPs.js";import{u as hs}from"./useMutationState-DdOGdpjP.js";import{O as fs,a as W}from"./runtime-connect-Dn0T5YWv.js";import{T as ps}from"./terminal-6CdY-T1V.js";function gs(){var s;return((s=Be().data)==null?void 0:s.isLocalCaller)!==!1}function St(s){var u,d;const t=b(),n=K(),[i,a]=x.useState(null),r=R({mutationFn:()=>(a(null),t.provisionRuntime(s,m=>a(m))),onSuccess:m=>{m.ok&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...T]}))}}),l=r.isError||((u=r.data)==null?void 0:u.ok)===!1,o=r.isError?r.error.message:((d=r.data)==null?void 0:d.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Ke(s){return["runtime-key-status",s]}function ys(s,t=!0){const n=b();return z({queryKey:Ke(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function js(s){const t=b(),n=R({mutationFn:a=>t.checkRuntimeCredential(s,a.trim().length>0?a:null),meta:{suppressErrorToast:!0}}),i=n.data??(n.isError?{ok:!1,reason:"unexpected",message:n.error.message||"Couldn’t check the key."}:null);return{check:a=>n.mutate(a),isPending:n.isPending,result:i,checkedSavedKey:i!==null&&(n.variables??"").trim().length===0,reset:n.reset}}function vs(s){var o,c,u;const t=b(),n=K(),[i,a]=x.useState(null),r=R({mutationFn:async d=>{a("checking");const m=await t.checkRuntimeCredential(s,d);return m.ok?(a("saving"),await t.storeRuntimeCredential(s,d),{saved:!0,message:null}):{saved:!1,message:m.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(n.invalidateQueries({queryKey:[...F]}),n.invalidateQueries({queryKey:[...T]}),n.invalidateQueries({queryKey:[...Ke(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:d=>{d.trim().length!==0&&r.mutate(d)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((u=r.data)==null?void 0:u.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function ks(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function Ns(s,t){var M,I,w,P;const n=b(),i=K(),{sessionId:a,accountRoot:r,onCompleted:l}=t??{},o=x.useMemo(()=>["runtime-login",s,a??"",r??""],[s,a,r]),c=R({mutationKey:o,mutationFn:()=>n.delegateRuntimeLogin(s,a===void 0&&r===void 0?void 0:{sessionId:a,accountRoot:r}),onSuccess:N=>{N.ok&&(i.invalidateQueries({queryKey:[...F]}),i.invalidateQueries({queryKey:[...T]}))}}),u=hs({filters:{mutationKey:o,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),d=u.some(N=>N.state.status==="pending"),m=u[u.length-1],h=d||m==null?void 0:m.state,g=d||m==null?void 0:m.id,p=!d&&((h==null?void 0:h.status)==="error"||((M=h==null?void 0:h.data)==null?void 0:M.ok)===!1),y=(h==null?void 0:h.status)==="error"?((I=h.error)==null?void 0:I.message)??null:((w=h==null?void 0:h.data)==null?void 0:w.error)??null,v=((P=h==null?void 0:h.data)==null?void 0:P.ok)===!0,O=x.useRef(l);return O.current=l,x.useEffect(()=>{var L;if(!v||g===void 0)return;const N=ks(i);N.has(g)||(N.add(g),(L=O.current)==null||L.call(O))},[v,g,i]),{login:()=>{d||c.mutate()},isPending:d,isSuccess:v,isError:p,errorMessage:p?y??"Couldn’t sign in. Try again.":null}}const Ce={"claude-code":{signInLabel:"Sign in",otherWayLabel:"Sign in with Claude",signInHint:"Use your Claude subscription or Anthropic account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"Anthropic API key",keyPlaceholder:"sk-ant-…",getKeyUrl:"https://console.anthropic.com/settings/keys"},codex:{signInLabel:"Sign in with ChatGPT",otherWayLabel:"Sign in with ChatGPT",signInHint:"Use your ChatGPT account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"OpenAI API key",keyPlaceholder:"sk-…",getKeyUrl:"https://platform.openai.com/api-keys"}};function bs(s){return Ce[s]??Ce["claude-code"]}function Ss({command:s,infoUrl:t,copyLabel:n}){return!s&&!t?null:e.jsxs("div",{className:"space-y-2",children:[s&&e.jsxs("div",{className:"bg-muted flex items-center justify-between gap-2 rounded-lg px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(ps,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(Ee,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(Qe,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(Y,{className:"size-3"})]})]})}function Ct({command:s,runtimeLabel:t}){const[n,i]=x.useState(!1);return e.jsxs(we,{open:n,onOpenChange:i,className:"mt-2",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["DorkOS installs ",t," for you."," ",e.jsx(Re,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Ie,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(xs,{children:s}),e.jsx(Ee,{value:s,label:`Copy command: ${s}`,className:"shrink-0"})]})]})}function Oe({onRetry:s}){return e.jsxs("div",{"data-testid":"remote-signin-notice",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Signing in needs the computer DorkOS runs on."}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s?"Sign in to DorkOS there, then press Retry.":"Sign in to DorkOS there."}),e.jsx("p",{className:"text-muted-foreground/80 mt-2 text-xs",children:"Already on that computer? Open DorkOS at localhost instead."}),s&&e.jsxs(C,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ge,{className:"size-3"}),"Retry"]})]})}function Cs({ollama:s=!1,remote:t=!1,className:n}){return e.jsxs("p",{className:H("text-muted-foreground text-xs",n),"data-testid":"keep-it-local-note",children:[t?"Prefer everything on the computer DorkOS runs on? Use your own sign-in there":"Prefer to keep everything on this computer? Use your own sign-in",s?", or Ollama":"","."]})}function Os(s){const t=We(),{data:n}=Ye();return s?He(Ve(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",Ps={title:xe,body:`Frontier models are unlocked. ${he}`},Es={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Te(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function ws(s){return{title:`${s} is ready`,body:`New work on ${s} runs on your DorkOS credits. Change it any time in Settings › Runtimes.`}}function A({message:s}){const t=Le();return e.jsxs(te.div,{role:"status",className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:t?!1:{opacity:0},animate:{opacity:1},"data-testid":"connect-progress",children:[e.jsx(de,{size:"xs",className:H("text-muted-foreground shrink-0",t&&"animate-none")}),e.jsx(Je,{mode:"wait",children:e.jsx(te.span,{className:"truncate text-xs",initial:t?!1:{opacity:0},animate:{opacity:1},exit:t?void 0:{opacity:0},transition:{duration:.2},children:s},s)})]})}function U({message:s="Connected"}){return e.jsxs("div",{role:"status",className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"connect-connected",children:[e.jsx(ue,{className:"size-3.5"}),s]})}function B({message:s,onRetry:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:s}),e.jsx(C,{size:"sm",onClick:t,children:"Try again"})]})}function Rs({type:s,onConnected:t,asOtherWay:n=!1}){const i=bs(s),a=Ns(s),[r,l]=x.useState(!1),o=x.useRef(!1);return x.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Te(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(U,{message:"Signed in"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",variant:n?"outline":"default",className:"w-full",onClick:a.login,children:n?i.otherWayLabel:i.signInLabel}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i.signInHint})]})}),r?e.jsxs("div",{className:"space-y-3","data-testid":`login-connect-key-${s}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),e.jsx(Is,{type:s,copy:i,onConnected:t}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Back to sign in"})]}):n?e.jsx(C,{size:"sm",variant:"outline",className:"w-full",onClick:()=>l(!0),"data-testid":`login-connect-use-key-${s}`,children:"Paste a key"}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors","data-testid":`login-connect-use-key-${s}`,children:"Use an API key instead"})]})}function Is({type:s,copy:t,onConnected:n}){var p,y;const[i,a]=x.useState(""),r=vs(s),l=ys(s),o=js(s),c=x.useRef(!1),u=x.useRef(null);if(x.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Te(me(s).label)))},[r.isSuccess,n,s]),x.useEffect(()=>{var v;r.isError&&((v=u.current)==null||v.focus())},[r.isError]),r.isSuccess)return e.jsx(U,{});const d=(p=l.data)!=null&&p.key.saved?l.data.key:null,m=i.trim().length>0,h=r.isPending||o.isPending,g=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:v=>{v.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(S,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:u,value:i,disabled:h,onChange:v=>{a(v.target.value),g()},placeholder:d?`Saved key ends in ${d.last4}. Paste to replace.`:t.keyPlaceholder,autoComplete:"off",spellCheck:!1}),r.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:r.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.getKeyUrl?e.jsxs("a",{href:t.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"ghost",disabled:!m&&d===null||h,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:!m||h,children:"Save key"})]})]}),h?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((y=o.result)==null?void 0:y.ok)===!0?e.jsx(U,{message:o.checkedSavedKey?"Your saved key works":"Key works"}):o.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o.result.message}):null]})}function Ls(s){const t=b(),n=z({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference()});return n.isPending?e.jsx(de,{"aria-label":"Loading model settings"}):n.isError?e.jsx("p",{role:"alert",children:"Couldn’t load model settings. Try again."}):e.jsx(As,{saved:n.data,...s},JSON.stringify(n.data))}function As({saved:s,onConnected:t,onSave:n}){var D,J,G,X,j,_,fe,pe,ge,ye,je,ve;const i=b(),a=K(),r=x.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=x.useState(n&&l==="dorkos-credits"?"api-key":l),[u,d]=x.useState(((J=s.inference)==null?void 0:J.protocol)??"openai-chat-completions"),[m,h]=x.useState(((G=s.inference)==null?void 0:G.endpoint)??""),[g,p]=x.useState(((X=s.inference)==null?void 0:X.provider)??""),[y,v]=x.useState(((j=s.inference)==null?void 0:j.model)??""),[O,M]=x.useState(String(((_=s.inference)==null?void 0:_.contextWindow)??8192)),[I,w]=x.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[P,N]=x.useState(""),[L,E]=x.useState(null),k=z({queryKey:["doe-credits-models",u],queryFn:()=>i.getDoeCreditsModels(u),enabled:o==="dorkos-credits"}),q=o==="dorkos-credits"?(pe=k.data)==null?void 0:pe.models.find(f=>f.id===y):void 0,ee=s.hasKey&&((ge=s.inference)==null?void 0:ge.endpoint)===m&&s.inference.source==="api-key",V=R({mutationFn:async f=>{if(n)return n(f,P.trim()||null);o==="api-key"&&P.trim()?await i.storeDoeCredential(f,P.trim()):await i.setDoeInference(f),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{N("");for(const f of[["doe-inference"],F,T,Xe.all,Ze.status()])a.invalidateQueries({queryKey:f});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:f=>E(n&&f instanceof Error&&f.message?f.message:"Couldn’t save model settings. Try again.")});function re(f){var ke,Ne;if(f.preventDefault(),E(null),P.trim().startsWith("sk-ant-oat")){E("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!P.trim()&&!ee){E("Enter an API key.");return}if(o==="dorkos-credits"&&(!q||!((ke=k.data)!=null&&ke.endpoint))){E("Link DorkOS credits and choose an available model.");return}const ae=es.safeParse({source:o,protocol:u,provider:o==="dorkos-credits"?"dorkos":g,endpoint:o==="dorkos-credits"?(Ne=k.data)==null?void 0:Ne.endpoint:m,model:y,contextWindow:(q==null?void 0:q.contextWindow)??Number(O),maxOutputTokens:(q==null?void 0:q.maxOutputTokens)??Number(I)});if(!ae.success){E("Check the model, endpoint, and token limits.");return}V.mutate(ae.data)}const Q="bg-background border-input focus-visible:ring-ring h-11 w-full rounded-md md:h-9 border px-3 text-sm focus-visible:ring-2";return e.jsxs("form",{onSubmit:re,className:"space-y-3","aria-label":"DorkOS model settings",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:Q,value:o,onChange:f=>{c(f.target.value),v("")},children:[e.jsx("option",{value:"api-key",children:"My API key"}),e.jsx("option",{value:"local",children:"Local model"}),!n&&e.jsx("option",{value:"dorkos-credits",children:"DorkOS credits"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:Q,value:u,onChange:f=>{d(f.target.value),o==="dorkos-credits"&&v("")},children:[e.jsx("option",{value:"openai-chat-completions",children:"OpenAI Chat Completions"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"})]})]}),o==="dorkos-credits"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:Q,value:y,onChange:f=>v(f.target.value),disabled:k.isPending||!((ye=k.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=k.data)==null?void 0:je.models.map(f=>e.jsx("option",{value:f.id,children:f.displayName},f.id))]}),!((ve=k.data)!=null&&ve.endpoint)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link DorkOS credits in Settings to choose a model."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx($,{id:`${r}-service`,value:g,onChange:f=>p(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx($,{id:`${r}-endpoint`,type:"url",value:m,onChange:f=>h(f.target.value),required:!0}),o==="local"&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Use a loopback address. No API key is needed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx($,{id:`${r}-model`,value:y,onChange:f=>v(f.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx($,{id:`${r}-context`,type:"number",min:1,value:O,onChange:f=>M(f.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx($,{id:`${r}-output`,type:"number",min:1,value:I,onChange:f=>w(f.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:P,onChange:f=>N(f.target.value),autoComplete:"off"}),ee&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"API key saved. Leave blank to keep it."})]})]}),L&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:L}),e.jsx(C,{type:"submit",disabled:V.isPending,children:V.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ds={openai:"OpenAI",anthropic:"Anthropic"};function Ks(s){return Ds[s]??s}function Ts(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ks(s)})`}}const Me="ollama",qe=["runtime-connect","ollama"];function Ms(s){const t=b();return z({queryKey:qe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function qs(){const s=b(),t=K(),n=R({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:Me}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]})}});return{connect:i=>n.mutate(i),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,errorMessage:n.isError?n.error.message??"Couldn’t connect to Ollama.":null}}const Fe=["runtime-connect","opencode","direct"];function Fs(){const s=b();return z({queryKey:Fe,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function _s(){var i;const s=b(),t=R({mutationFn:({providerId:a,key:r,baseURL:l})=>s.checkProviderCredential(a,r.trim().length>0?r:null,(l==null?void 0:l.trim())||null),meta:{suppressErrorToast:!0}}),n=t.data??(t.isError?{ok:!1,reason:"unexpected",message:t.error.message||"Couldn’t check the key."}:null);return{check:a=>t.mutate(a),isPending:t.isPending,result:n,checkedSavedKey:n!==null&&(((i=t.variables)==null?void 0:i.key)??"").trim().length===0,reset:t.reset}}function $s(){var l,o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:async({providerId:u,key:d,baseURL:m})=>{const h=(m==null?void 0:m.trim())||null;i("checking");const g=await s.checkProviderCredential(u,d.trim().length>0?d:null,h);return g.ok?(i("saving"),await s.storeProviderCredential(u,d,h),{saved:!0,message:null}):{saved:!1,message:g.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:u=>{u.saved&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}),t.invalidateQueries({queryKey:[...Fe]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:u=>{u.providerId.trim().length!==0&&a.mutate(u)},isPending:a.isPending,phase:n,isSuccess:((o=a.data)==null?void 0:o.saved)===!0,isError:a.isError||r,errorMessage:r?((c=a.data)==null?void 0:c.message)??null:a.isError?a.error.message??"Couldn’t save your key.":null,reset:a.reset}}function Us(s){const t=b();return z({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function zs(){var o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:async u=>{i(null);const d=await s.pullOllamaModel(u,m=>i(m));return d.ok&&await s.updateConfig({runtimes:{opencode:{provider:Me}}}),d},onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{pull:u=>a.mutate(u),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Bs(){var o,c;const s=b(),t=K(),[n,i]=x.useState(null),a=R({mutationFn:()=>(i(null),s.provisionOllama(u=>i(u))),onSuccess:u=>{u.ok&&(t.invalidateQueries({queryKey:qe}),t.invalidateQueries({queryKey:[...T]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{provision:()=>a.mutate(),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t install Ollama.":null,progress:n,result:a.data}}const Qs="https://ollama.com/download",Gs="curl -fsSL https://ollama.com/install.sh | sh";function Ws({installMethod:s}){const t=Bs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Ys,{}),n?e.jsx(Hs,{provision:t}):e.jsx(Vs,{}),e.jsx(Js,{})]})}function Ys(){const s=Ae();return e.jsxs("div",{className:"space-y-1.5","data-testid":"ollama-explainer",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Run AI models on ",s]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Ollama is a free app that runs AI models on ",s,"."]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Nothing you type leaves ",s,"."]})]})}function Hs({provision:s}){var t,n,i;return s.isPending?e.jsx(A,{message:((t=s.progress)==null?void 0:t.message)??"Installing Ollama…"}):(n=s.result)!=null&&n.ok?(i=s.result.status)!=null&&i.running?e.jsx(A,{message:"Ollama is ready…"}):e.jsx("p",{className:"text-xs","data-testid":"ollama-installed-not-running",children:"Ollama isn’t running. Open the Ollama app to start it."}):s.isError?e.jsx(B,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(C,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Vs(){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-manual-install",children:[e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Installing Ollama needs administrator access. Run this in a terminal:"}),e.jsx(Ss,{command:Gs,copyLabel:"Copy the Ollama install command"})]})}function Js(){return e.jsxs("a",{href:Qs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Or download Ollama from ollama.com ",e.jsx(Y,{className:"size-3"})]})}const Xs="https://ollama.com/library",Zs={"runs-well":{label:"Runs well on your machine",tone:"text-status-success-fg"},"may-be-slow":{label:"May be slow on your machine",tone:"text-status-warning-fg"},"too-large":{label:"Too large for your machine",tone:"text-destructive"}},et={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function st({active:s,onConnected:t,onConnectDirectly:n}){var I,w,P,N,L,E;const i=Ms(s),a=qs(),r=zs(),l=((I=i.data)==null?void 0:I.running)??!1,o=Us(l),[c,u]=x.useState(null),[d,m]=x.useState(null);x.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),x.useEffect(()=>{var k;(k=r.result)!=null&&k.ok&&(t==null||t(Pe))},[(w=r.result)==null?void 0:w.ok,t]);const h=k=>{u(k),a.connect(k)},g=k=>{m(k),r.pull(k)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Ws,{installMethod:(P=i.data)==null?void 0:P.installMethod});if(a.isSuccess)return t?null:e.jsx(U,{message:"Connected to Ollama"});if((N=r.result)!=null&&N.ok)return t?null:e.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"guided-pull-connected",children:[e.jsx(ue,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Connected:"}),e.jsx(ss,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const p=i.data,y=(p==null?void 0:p.installed)??[],v=((L=p==null?void 0:p.installed)==null?void 0:L.length)??(p==null?void 0:p.models.length)??0,O=((E=o.data)==null?void 0:E.models.some(k=>k.model.id===d))??!1,M=d!==null&&!O?d:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(tt,{count:v}),y.length>0&&e.jsx(nt,{installed:y,connect:a,connectingId:c,onUse:h}),e.jsx(rt,{catalogQuery:o,pull:r,pullingId:d,onGet:g}),e.jsx(at,{pull:r,activePull:M,onSubmit:g}),e.jsx(it,{}),n&&e.jsxs("button",{type:"button",onClick:n,"data-testid":"local-connect-directly",className:"focus-ring text-muted-foreground hover:text-foreground block rounded-md text-left text-xs transition-colors",children:["Using LM Studio or another server? ",e.jsx("span",{className:"underline",children:"Connect it directly"})]})]})}function tt({count:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-xs","data-testid":"ollama-status-line",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-emerald-500","aria-hidden":!0}),e.jsxs("span",{children:["Ollama is running · ",s," ",s===1?"model":"models"," installed"]})]})}function _e({verdict:s,explanation:t}){const n=Zs[s];return e.jsxs("div",{"data-testid":"ollama-verdict","data-verdict":s,children:[e.jsx("p",{className:H("text-xs font-medium",n.tone),children:n.label}),e.jsx("p",{className:"text-muted-foreground/80 text-2xs leading-snug",children:t})]})}function $e({tier:s}){return e.jsx(De,{size:"xs",variant:"outline",className:"font-normal",children:et[s]})}function nt({installed:s,connect:t,connectingId:n,onUse:i}){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-installed",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Installed"}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>{const r=n===a.id&&t.isPending,l=n===a.id&&t.isError,o=()=>i(a.id);let c=e.jsx(C,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(B,{message:t.errorMessage??"Couldn’t connect to Ollama.",onRetry:o})),e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"ollama-installed-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:a.id}),a.assessment.model.tier&&e.jsx($e,{tier:a.assessment.model.tier})]}),e.jsx(_e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function rt({catalogQuery:s,pull:t,pullingId:n,onGet:i}){var r;if(s.isPending)return e.jsx(A,{message:"Checking which models fit your machine…"});const a=((r=s.data)==null?void 0:r.models)??[];return s.isError||a.length===0?null:e.jsxs("div",{className:"space-y-2","data-testid":"ollama-shelf",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add a model"}),e.jsx("ul",{className:"space-y-1.5",children:a.map(({model:l,verdict:o,explanation:c})=>{const u=n===l.id,d=()=>i(l.id);return u&&(t.isPending||t.isError)?e.jsxs("li",{className:"border-border rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:l.label}),t.isPending?e.jsx(Ue,{progress:t.progress}):e.jsx(B,{message:t.errorMessage??"Couldn’t download the model.",onRetry:d})]},l.id):e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:l.label}),l.tier&&e.jsx($e,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx(_e,{verdict:o,explanation:c})]}),e.jsx(C,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:d,children:"Get"})]},l.id)})})]})}function at({pull:s,activePull:t,onSubmit:n}){const[i,a]=x.useState(""),r=i.trim(),l=fs.test(r);if(t&&s.isPending)return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Downloading ",t,"…"]}),e.jsx(Ue,{progress:s.progress})]});const o=c=>{c.preventDefault(),l&&n(r)};return e.jsxs("form",{onSubmit:o,className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"ollama-pull-tag",className:"text-xs font-normal",children:"Download any model by name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx($,{id:"ollama-pull-tag","data-testid":"ollama-pull-by-name",value:i,onChange:c=>a(c.target.value),placeholder:"qwen2.5-coder:32b","aria-invalid":r.length>0&&!l}),e.jsx(C,{type:"submit",size:"sm",disabled:!l||s.isPending,children:"Download"})]}),r.length>0&&!l&&e.jsxs("p",{className:"text-muted-foreground text-2xs",children:["Use a tag like ",e.jsx("code",{className:"text-2xs",children:"qwen2.5-coder:32b"}),"."]}),t&&s.isError&&e.jsx(B,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function it(){return e.jsxs("a",{href:Xs,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Browse the library ",e.jsx(Y,{className:"size-3"})]})}function Ue({progress:s}){const t=Le(),n=s==null?void 0:s.percent,i=(s==null?void 0:s.status)??"Starting download…";return e.jsxs("div",{className:"space-y-2","data-testid":"guided-pull-progress",children:[e.jsx("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:n===void 0?e.jsx(te.div,{className:"bg-primary/70 h-full w-1/3 rounded-full",animate:t?{}:{x:["-100%","300%"]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"}}):e.jsx(te.div,{className:"bg-primary h-full rounded-full",initial:!1,animate:{width:`${Math.min(100,Math.max(0,n))}%`},transition:t?{duration:0}:{duration:.3,ease:"easeOut"},"data-testid":"guided-pull-bar"})}),e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.jsx(de,{size:"xs",className:H("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function ot(){var r,l,o;const s=b(),t=K(),n=R({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))}}),i=n.isError||((r=n.data)==null?void 0:r.ok)===!1,a=n.isError?n.error.message:((l=n.data)==null?void 0:l.error)??null;return{store:c=>{c.trim().length!==0&&n.mutate(c)},isPending:n.isPending,isSuccess:((o=n.data)==null?void 0:o.ok)===!0,isError:i,errorMessage:i?a??"Couldn’t save the OpenRouter key.":null}}function lt(){var h,g;const s=b(),t=K(),[n,i]=x.useState(null),[a,r]=x.useState(null),l=R({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:p,state:y})=>{if(!ts(p)){r("Couldn’t open the OpenRouter sign-in page.");return}i(y)},onError:p=>r(p.message??"Couldn’t start OpenRouter sign-in.")}),o=z({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="pending"?1500:!1},refetchOnWindowFocus:p=>{var y;return((y=p.state.data)==null?void 0:y.status)==="error"}}),c=(h=o.data)==null?void 0:h.status;x.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...F]}),t.invalidateQueries({queryKey:[...T]}))},[c,t]);const u=l.isPending||n!==null&&c==="pending",d=!!a||c==="error",m=d?a??((g=o.data)==null?void 0:g.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:u,isSuccess:c==="connected",isError:d,errorMessage:m}}const ct="https://openrouter.ai/keys";function dt({onConnected:s}){const[t,n]=x.useState(""),i=ot(),a=lt(),r=i.isSuccess||a.isSuccess;return x.useEffect(()=>{r&&(s==null||s(Ps))},[r,s]),r?e.jsx(U,{message:"Connected to OpenRouter"}):e.jsxs("div",{className:"space-y-4","data-testid":"openrouter-gateway",children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:"Sign in to OpenRouter in the new tab…"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(C,{size:"sm",className:"w-full",onClick:a.begin,children:"Connect OpenRouter"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Makes a limited key for you."})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),i.isPending?e.jsx(A,{message:"Checking your OpenRouter key…"}):e.jsxs("form",{className:"space-y-2",onSubmit:l=>{l.preventDefault(),i.store(t)},children:[e.jsx(S,{htmlFor:"openrouter-key",className:"text-xs",children:"OpenRouter key"}),e.jsx(ne,{id:"openrouter-key",value:t,onChange:l=>n(l.target.value),placeholder:"sk-or-…",autoComplete:"off",spellCheck:!1}),i.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:i.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("a",{href:ct,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an OpenRouter key ",e.jsx(Y,{className:"size-3"})]}),e.jsx(C,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function Z(s){return W.find(t=>t.id===s)}function ut(s){var t;return((t=Z(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=W.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??W[0].defaultBaseURL}function ze(s){return W.some(t=>t.id===s.providerId)}function ie(s){return ze(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function mt({onConnected:s}){const t=Fs();return t.isError&&!t.data?e.jsx(B,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(xt,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function xt({setup:s,onConnected:t}){var X;const n=ze(s)?s:null,[i,a]=x.useState(()=>ie(s)),[r,l]=x.useState(""),[o,c]=x.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=Z(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[u,d]=x.useState(()=>{var _;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==((_=Z(j))==null?void 0:_.defaultBaseURL)}),m=$s(),h=_s(),g=Z(i),p=ut(i),y=n!=null&&n.key.saved&&n.providerId===p?n.key.last4:null,v=o.trim(),O=i===se,M=!O||v.length>0,I=ce(p),w=v||I,P=w===I?"":w,N=n===null?null:n.baseURL??ce(n.providerId),L=p!==((n==null?void 0:n.providerId)??null)||w!==N,E=r.trim().length>0,q=(E||y!==null&&!L)&&M,ee=E&&M,V=!E&&y!==null&&L,re=w.startsWith("http://"),Q={providerId:p,key:r,baseURL:P},D=m.isPending||h.isPending,J=x.useRef(null),G=()=>{h.reset(),m.reset()};return x.useEffect(()=>{m.isSuccess&&(t==null||t(Es))},[m.isSuccess,t]),x.useEffect(()=>{var j;m.isError&&((j=J.current)==null||j.focus())},[m.isError]),m.isSuccess?e.jsx(U,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),h.reset(),m.connect(Q)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(ns,{value:i,disabled:D,onValueChange:j=>{var _;a(j),c(((_=Z(j))==null?void 0:_.defaultBaseURL)??""),G()},children:[e.jsx(rs,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(as,{})}),e.jsxs(is,{children:[W.map(j=>e.jsx(be,{value:j.id,children:j.label},j.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(O||u)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(S,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!O&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx($,{id:"direct-provider-base-url",value:o,disabled:D,onChange:j=>{c(j.target.value),G()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!O&&!u&&e.jsx("button",{type:"button",onClick:()=>d(!0),disabled:D,"data-testid":"direct-provider-advanced",className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Advanced"}),re&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-insecure",children:"This address isn’t encrypted. Your key travels in the open."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(S,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:J,value:r,disabled:D,onChange:j=>{l(j.target.value),G()},placeholder:y===null?(g==null?void 0:g.keyPlaceholder)??W[0].keyPlaceholder:`Saved key ends in ${y}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),m.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:m.errorMessage}),V&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-repaste",children:"Paste your key again to change the address."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[g===void 0?e.jsx("span",{}):e.jsxs("a",{href:g.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(Y,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{type:"button",size:"sm",variant:"outline",disabled:!q||D,"data-testid":"direct-provider-test",onClick:()=>{m.reset(),h.reset(),h.check(Q)},children:"Test key"}),e.jsx(C,{type:"submit",size:"sm",disabled:!ee||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:m.phase==="saving"?"Saving…":"Checking your key…"}):((X=h.result)==null?void 0:X.ok)===!0?e.jsx(U,{message:h.checkedSavedKey?"Your saved key works":"Key works"}):h.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:h.result.message}):null]})}function ht({currentProvider:s,onConnected:t}){const[n,i]=x.useState("choose"),a=ft();if(n==="choose")return e.jsx(pt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(dt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(st,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(mt,{onConnected:t})})}function ft(){return{cloud:{step:"cloud",title:"Best models, zero setup",description:"Claude, GPT, Gemini and 300+ more, in the cloud.",sub:"One OpenRouter account covers them all. Pay for what you use.",tradeOff:"Your prompts and code are sent to the model’s provider.",recommended:!0},local:{step:"local",title:"Private and free, on your computer",description:`Models run on ${Ae()}. Nothing you type ever leaves it.`,sub:"Runs Quick helpers and Solid coders. Frontier models stay cloud-only.",tradeOff:"Smaller models: good for edits and quick help."},direct:{step:"direct",title:"Use your own API key",stepTitle:"Your own API key",description:"Anthropic, OpenAI, or any OpenAI-compatible server, like LM Studio.",sub:"",quiet:!0}}}function pt({sources:s,onChoose:t,currentProvider:n}){return e.jsxs("div",{className:"space-y-2","data-testid":"opencode-power-sources",children:[n&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"opencode-current-source",children:["Currently: ",Ts(n)]}),Object.values(s).map(i=>e.jsx(gt,{source:i,onChoose:t},i.step))]})}function gt({source:s,onChoose:t}){return e.jsxs("button",{type:"button",onClick:()=>t(s.step),"data-testid":`power-source-${s.step}`,className:H("card-interactive focus-ring group flex w-full items-start gap-3 rounded-lg border p-3 text-left",s.recommended?"border-primary/40 bg-card shadow-soft":"border-border bg-card shadow-soft",s.quiet&&"shadow-none"),children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.title}),s.recommended&&e.jsx(De,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(ls,{className:"text-muted-foreground/60 mt-0.5 size-4 shrink-0"})]})}function oe({source:s,onBack:t,children:n}){const i=!!(s.sub||s.tradeOff);return e.jsxs("div",{className:"space-y-3","data-testid":"opencode-connect-step",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:t,className:"focus-ring text-muted-foreground hover:text-foreground -ml-1 inline-flex items-center gap-1 rounded-md px-1 py-0.5 text-xs transition-colors","data-testid":"connect-step-back",children:[e.jsx(os,{className:"size-3.5"}),"Back"]}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{className:"text-sm font-medium",children:s.stepTitle??s.title})]}),i&&e.jsxs("div",{className:"space-y-1","data-testid":"connect-step-details",children:[s.sub&&e.jsx("p",{className:"text-muted-foreground/80 text-xs",children:s.sub}),s.tradeOff&&e.jsxs("p",{className:"text-muted-foreground/70 text-2xs leading-snug",children:[e.jsx("span",{className:"font-medium",children:"Trade-off:"})," ",s.tradeOff]})]}),n]})}function yt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=gs(),r=Os(s),l=cs(),o=ds(),c=us([s]);if(s==="doe")return a?e.jsx(Ls,{onConnected:i}):e.jsx(Oe,{});const u=r==="lead"&&l!==null,d=a?t.kind==="provider-picker"?e.jsx(ht,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Rs,{type:s,onConnected:i,asOtherWay:u}):null:e.jsx(Oe,{});if(d===null)return null;const m=me(s).label,h=t.kind==="provider-picker";if(r==="on-credits")return e.jsxs("div",{className:"space-y-3","data-testid":`credits-ready-${s}`,children:[e.jsxs("div",{role:"status",children:[e.jsxs("p",{className:"text-status-success-fg flex items-center gap-1.5 text-sm font-medium",children:[e.jsx(ue,{className:"size-3.5","aria-hidden":!0}),"You’re ready"]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["New work on ",m," runs on your DorkOS credits.",c.map(p=>` ${p}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:d})]});const g=p=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:p,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(ws(m))}});return u?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[g(!0),e.jsx(le,{children:d}),e.jsx(Cs,{ollama:h,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[d,e.jsx(le,{children:g(!1)})]}):d}function le({collapsed:s=!1,children:t}){const[n,i]=x.useState(!s);return s?e.jsxs(we,{open:n,onOpenChange:i,children:[e.jsxs(Re,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ms,{className:H("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Ie,{className:"mt-3",children:t})]}):e.jsxs("section",{className:"space-y-2","aria-label":"Other ways",children:[e.jsx("p",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:"Other ways"}),t]})}const Ot=s=>e.jsx(yt,{...s});export{Ct as C,Ss as D,Cs as K,Oe as R,gs as a,Os as b,Ns as c,Ts as d,Ls as e,bs as g,Ot as r,St as u};
|