dorkos 0.127.1 → 0.129.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/THIRD-PARTY-NOTICES.md +61 -0
- package/dist/bin/cli.js +1456 -927
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-CwNzli7O.js → AboutPage-CML_SdU1.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-D9UR9aYX.js → ActivityErrorState-TuQRJopr.js} +1 -1
- package/dist/client/assets/{ActivityPage-DeL7N0Rt.js → ActivityPage-CmSxeVSK.js} +1 -1
- package/dist/client/assets/ActivityRow-DJhDehIR.js +1 -0
- package/dist/client/assets/{AdapterIcon-bYKCnumH.js → AdapterIcon-CeRDpZGz.js} +1 -1
- package/dist/client/assets/AdapterSetupWizard-B6KkTuJo.js +2 -0
- package/dist/client/assets/{AgentOptionRow-CN9dDSeG.js → AgentOptionRow-388OJkPc.js} +1 -1
- package/dist/client/assets/{AgentPicker-Bbvnww9v.js → AgentPicker-C51wqToQ.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-DmLUHbGa.js → AgentRequestCard-Bz31ewIs.js} +4 -4
- package/dist/client/assets/AppearancePage-DSVeowGb.js +1 -0
- package/dist/client/assets/{ApplyToOverridesDialog-DG6pYkhN.js → ApplyToOverridesDialog-DRtcLrVY.js} +1 -1
- package/dist/client/assets/AttentionSignalRow-CqKZyoxB.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-CSaHAO1F.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-DA1jhqFy.js} +3 -3
- package/dist/client/assets/BindingDialog-D25PAed0.js +1 -0
- package/dist/client/assets/{BlintzCanvas-BXwncq3A.js → BlintzCanvas-BgIQdpTx.js} +3 -3
- package/dist/client/assets/{CanvasCsvContent-Dt7ko9e1.js → CanvasCsvContent-ZWHWmb88.js} +4 -4
- package/dist/client/assets/CanvasFileContent-DR5pUgca.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-OP1ZOMui.js +2 -0
- package/dist/client/assets/ChannelComposer-BJ0nNzQb.js +45 -0
- package/dist/client/assets/{ChatAppsOff-BxUf0caI.js → ChatAppsOff-ByitL4Xt.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-C78KCVkj.js → CodeMirrorDiff-JsV_vWBa.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-BWSTKK9s.js → CodeMirrorEditor-BfCJG9hQ.js} +1 -1
- package/dist/client/assets/{CommitmentList-oKrIigLt.js → CommitmentList-yFV3_m00.js} +1 -1
- package/dist/client/assets/{CommitmentsPage-DKtyvmFd.js → CommitmentsPage-DeERVg-2.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-DjtpGKRB.js → ComputerResourceView-CYMMSE8Y.js} +1 -1
- package/dist/client/assets/{ComputerViewer-B7a77fXa.js → ComputerViewer-H7kJSIj7.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-SRkf7-Y6.js +1 -0
- package/dist/client/assets/{ConnectionsPage-DQEOL79u.js → ConnectionsPage-D6e3hd4L.js} +2 -2
- package/dist/client/assets/{ConventionPage-BJ1Fkt7H.js → ConventionPage-CpvRMcSG.js} +2 -2
- package/dist/client/assets/{ExtensionPageRoute-DMbNbOMW.js → ExtensionPageRoute-CiFv6we8.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-BmisG40-.js → FloatingTanStackRouterDevtools-CqogiFob-D-8CeYC7.js} +1 -1
- package/dist/client/assets/{ForwardConsentHost-DdEYtIvk.js → ForwardConsentHost-ml3b_fsX.js} +1 -1
- package/dist/client/assets/HandlePage-Bq5qdCfY.js +1 -0
- package/dist/client/assets/HeartbeatPage-C0zSvWH4.js +1 -0
- package/dist/client/assets/{KeyEntry-B9twGZOd.js → KeyEntry-Dq6eKAbX.js} +1 -1
- package/dist/client/assets/{LexicalField-CBm1TZpt.js → LexicalField-CYOqOLpV.js} +1 -1
- package/dist/client/assets/{ManagesPage-bAtPePVC.js → ManagesPage-DZTMD3Al.js} +1 -1
- package/dist/client/assets/Marketplace-buSfuVrY.js +36 -0
- package/dist/client/assets/{MarketplaceSourcesView-lYEkmUGJ.js → MarketplaceSourcesView-BxwvBWgh.js} +1 -1
- package/dist/client/assets/{McpAppFrame-BzZqyRxQ.js → McpAppFrame-CWiRFp8o.js} +2 -2
- package/dist/client/assets/{McpSigninBody-oVPX3ZDZ.js → McpSigninBody-BpYSAV1h.js} +1 -1
- package/dist/client/assets/{Model3dViewer-DrS3qYW1.js → Model3dViewer-B2KTvx6d.js} +1 -1
- package/dist/client/assets/NamePage-_yT2RQvT.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-BkPbuzx8.js → NewDirectMessageMenu-CMp4ppiH.js} +1 -1
- package/dist/client/assets/{NotificationsPage-CKU37E34.js → NotificationsPage-CWXIghVM.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-B7z7XHNR.js → OpenMeshSwitch-C9hiAEHP.js} +2 -2
- package/dist/client/assets/OperatorIdentityForm-CjmMoP6n.js +1 -0
- package/dist/client/assets/{PermissionHistory-D_WFGZtw.js → PermissionHistory-D_Imuq02.js} +1 -1
- package/dist/client/assets/{PermissionsPage-15DeeKpE.js → PermissionsPage-QMLV8PfB.js} +1 -1
- package/dist/client/assets/{PersonalityPopover-CQ-iLQpo.js → PersonalityPopover-BL9DLK0Q.js} +1 -1
- package/dist/client/assets/PhotoPage-Djh4IZBF.js +1 -0
- package/dist/client/assets/PreviewRefusedNotice-Dt2hV0aJ.js +1 -0
- package/dist/client/assets/{ProfileFields-EgcVDViF.js → ProfileFields-DD6X85w2.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-zAOmdAo9.js → ProfilePanelContainer-DuFEpNJ3.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-D5ScObov.js → ProfileRolePicker-CT9eJ1J0.js} +1 -1
- package/dist/client/assets/PromptSuggestionChips-C8V611-5.js +1 -0
- package/dist/client/assets/{ReportsToPopover-BZBQY9rT.js → ReportsToPopover-Bs55bP7b.js} +1 -1
- package/dist/client/assets/RoomSurface-DXZ36tmU.js +1 -0
- package/dist/client/assets/{RoomsPage-BY2Yzdxs.js → RoomsPage-CDiSwt-I.js} +1 -1
- package/dist/client/assets/RunsOnPopover-CFBDa9DO.js +1 -0
- package/dist/client/assets/RuntimeConnectFlow-DsawxJN7.js +1 -0
- package/dist/client/assets/RuntimeSetupDialog-bdf844gx.js +1 -0
- package/dist/client/assets/{SeenDevices-C-4m1c9h.js → SeenDevices-Cix5nnGQ.js} +2 -2
- package/dist/client/assets/{SessionsPage-B5PdbDLK.js → SessionsPage-CCu8rM-J.js} +1 -1
- package/dist/client/assets/SettingsDialog-D7sVluoe.js +12 -0
- package/dist/client/assets/SkillsPage-SSq7ofgp.js +1 -0
- package/dist/client/assets/TaskDialogWrapper-CBIuIbmj.js +1 -0
- package/dist/client/assets/TasksEmptyState-C0K_NOA3.js +3 -0
- package/dist/client/assets/{TasksPage-BGtTF442.js → TasksPage-BpSn7GmR.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-BCW51xMv.js → TeamComputerEntry-BAi9omUC.js} +1 -1
- package/dist/client/assets/{ToolsPage-Craa3-78.js → ToolsPage-nkGWy6MR.js} +2 -2
- package/dist/client/assets/{TopologyGraph-BVbPyC0W.js → TopologyGraph-D6SSv0kC.js} +14 -14
- package/dist/client/assets/TourHost-CrZciWIf.js +1 -0
- package/dist/client/assets/{UnlinkDialog-BtQvTzCP.js → UnlinkDialog-B9zw8r6F.js} +1 -1
- package/dist/client/assets/UnreadDivider-BnJ06LmP.js +1 -0
- package/dist/client/assets/WidgetErrorCard-CQKYI7oK.js +108 -0
- package/dist/client/assets/{WithheldExtensionsNotice-Cts8hGJP.js → WithheldExtensionsNotice-VMM5NjL5.js} +1 -1
- package/dist/client/assets/WorkView-D5d8DDxS.js +51 -0
- package/dist/client/assets/_shell-CTKp94uQ.js +80 -0
- package/dist/client/assets/{_shell._home-BZpx4Mbk.js → _shell._home-CcfELPIk.js} +1 -1
- package/dist/client/assets/_shell._home.activity-CGKsuLq8.js +1 -0
- package/dist/client/assets/_shell._home.index-DrJRgJCb.js +3 -0
- package/dist/client/assets/_shell._home.tasks-B_lv_-fX.js +1 -0
- package/dist/client/assets/_shell._home.workspaces-CjBJymCW.js +1 -0
- package/dist/client/assets/{_shell.channels-myIv11W5.js → _shell.channels-CzQFR6pU.js} +4 -4
- package/dist/client/assets/_shell.connections-B5hafeep.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-tPcWZDaV.js → _shell.feedback-requests-DtD2bH-4.js} +2 -2
- package/dist/client/assets/_shell.marketplace-DUpaCb0r.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-C3pA7zZW.js +1 -0
- package/dist/client/assets/_shell.session-DH_9f3AK.js +1 -0
- package/dist/client/assets/{_shell.team-IofNRuKL.js → _shell.team-BrGo-IxK.js} +6 -6
- package/dist/client/assets/_shell.threads-Ceq_tmNk.js +1 -0
- package/dist/client/assets/_shell.x._extensionId-DaXLhYNr.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-DaXLhYNr.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-COAdUrvu.js → abnfDiagram-WEYOIA3C-BN5bqwbu.js} +1 -1
- package/dist/client/assets/{access-copy-laAy9--H.js → access-copy-BAhTOOsG.js} +1 -1
- package/dist/client/assets/{arc-2_zvZ-gp.js → arc-BfTE_VoF.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-D2vJp2ju.js → architectureDiagram-ZHVYKT53-Dc6keeDz.js} +1 -1
- package/dist/client/assets/{banner-Dq7DY4At.js → banner-DOgGDCJ5.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-CxjfUYKV.js → blockDiagram-RJAE7QA3-B4c6U-ob.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-DBtTwidp.js → c4Diagram-XDPPPE54-CCtD8QC8.js} +1 -1
- package/dist/client/assets/channel-CF9_Q7CV.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-BAzBaRVY.js → chunk-2E7WHVMD-DcDNqIJG.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-0_0KxG0G.js → chunk-2Q5K7J3B-DOVVK0B8.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-DmpZgXUr.js → chunk-4EMNKR2T-Cg-Do982.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-DOa5mrA1.js → chunk-55XCU76K-CDmULSeY.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-BqzmE_oJ.js → chunk-5VM5RSS4-Bi0yIWW1.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-C2F-qKzA.js → chunk-JWPE2WC7-ZHaJh6CV.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-Cj9J_zab.js → chunk-VQ5W62QI-DZi6GyW_.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-Cyiza8Ap.js → chunk-XXDRQBXY-D18oZOrd.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-ITupr164.js → chunk-ZCHMQSOR-BkZ0l0fE.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-BH0_3wSx.js → classDiagram-v2-4MYWR3UA-BfmK1buF.js} +1 -1
- package/dist/client/assets/{command-tbegvEE8.js → command-CZqA020F.js} +1 -1
- package/dist/client/assets/copy-button-ByA00JGh.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-sZqlNAZ4.js → cose-bilkent-JH36ORCC-B1NTVSbk.js} +1 -1
- package/dist/client/assets/{cpu-DDplcjVv.js → cpu-DNvpMmNN.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-6Kjz5H9v.js → cynefin-EF2NZ3EQ-CB_HMIZ8.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-DK7-moDM.js → cynefinDiagram-WF24UDRP-MmIWYdc2.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-C---Yw3S.js → dagre-NK4GIZVX-BQay0k4e.js} +1 -1
- package/dist/client/assets/detail-row-290qyusq.js +1 -0
- package/dist/client/assets/{diagram-CBK3MWTC-BZo3ih_3.js → diagram-CBK3MWTC-C1lRH4cb.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D-DsHN5Ikp.js → diagram-I5XIIV2D-CnANa27A.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-CVtFfjkm.js → diagram-ODIL2UCW-Cwt7hxes.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-RrxvbTzz.js → diagram-PFBEJUXE-DZtAER77.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-T4vRcsqE.js → diagram-RJA3I4VV-CbVXbiGs.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-DvgDENOh.js → diagram-TYUNFSNR-D-AcGdsL.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-CT_Ykhnb.js → ebnfDiagram-V4P3TTPT-DLkrFSAy.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-1cHLrAbL.js → elk-QONTBCTQ-DQM6Glxa.js} +1 -1
- package/dist/client/assets/{empty-state-BuerUR2L.js → empty-state-BnuM8oop.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-sKNWkMEB.js → erDiagram-KYQIGQAA-C1qgB1Mn.js} +1 -1
- package/dist/client/assets/{execution-config-b_HoE2gl.js → execution-config-BjLHHc9x.js} +1 -1
- package/dist/client/assets/{file-CG3ZGubn.js → file-D7_QdH_S.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-CVXN_udI.js → file-exclamation-point-Cdt8YqyQ.js} +1 -1
- package/dist/client/assets/{file-text-iUPjXTFV.js → file-text-CB9l6Ur-.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-DF1tpWBU.js → find-latest-widget-fence-SQB9WgjN.js} +5 -5
- package/dist/client/assets/{flowDiagram-IUGLLWBU-Dpro5XJ_.js → flowDiagram-IUGLLWBU-DH-ePeFu.js} +1 -1
- package/dist/client/assets/form--HjBAzX8.js +1 -0
- package/dist/client/assets/{format-cron-B88ttX8j.js → format-cron-svkfKW5b.js} +1 -1
- package/dist/client/assets/format-tokens-DymkROvy.js +1 -0
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-CtR4oMUH.js → ganttDiagram-R7GPNTJY-fjb_iAW1.js} +1 -1
- package/dist/client/assets/{git-branch-DZBdAsc0.js → git-branch-CPOwiT8a.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY--euaveVk.js → gitGraphDiagram-PDYL7XHY-CcCqH5T3.js} +1 -1
- package/dist/client/assets/{graph-jzPQScij.js → graph-DS3J2jnN.js} +1 -1
- package/dist/client/assets/{heart-CNrKCfIZ.js → heart-C6uRnXx3.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-3HmPoqzm.js → highlighted-body-KPVGNVTW-CNygKq0i.js} +1 -1
- package/dist/client/assets/image-lightbox-BQV3i0WJ.js +1 -0
- package/dist/client/assets/{image-off-0A5Y9ekR.js → image-off-B88WBkcV.js} +1 -1
- package/dist/client/assets/{index-mG1tkeJL.js → index-3CJSEcZE.js} +1 -1
- package/dist/client/assets/index-3JL8A9YZ.css +1 -0
- package/dist/client/assets/{index-DloK7L_D.js → index-57qzL_5b.js} +1 -1
- package/dist/client/assets/index-5RD9flqf.js +1 -0
- package/dist/client/assets/{index-JGRdQWAP.js → index-B6pmysqs.js} +1 -1
- package/dist/client/assets/{index-C2NwvhhG.js → index-BIZNH5u1.js} +1 -1
- package/dist/client/assets/{index-DKxKfg7Y.js → index-BKdXHSbr.js} +1 -1
- package/dist/client/assets/{index-BLHGc7hd.js → index-BN3zOTbR.js} +3 -3
- package/dist/client/assets/{index-DjmZGH7V.js → index-BNq_mnok.js} +1 -1
- package/dist/client/assets/index-BPp-rj-W.js +1 -0
- package/dist/client/assets/{index-BKDTRodW.js → index-BTqJGL1_.js} +1 -1
- package/dist/client/assets/{index-DxYiYBCN.js → index-B_YZ5cyn.js} +1 -1
- package/dist/client/assets/{index-CeqxJyr2.js → index-B_rc9Pb1.js} +1 -1
- package/dist/client/assets/{index-BU6kskMP.js → index-B_v2l2ND.js} +1 -1
- package/dist/client/assets/{index-BihGQXHU.js → index-Bktc0aFV.js} +1 -1
- package/dist/client/assets/index-BtTqA4_d.js +1 -0
- package/dist/client/assets/{index-BwqobvEU.js → index-BxsALYNM.js} +1 -1
- package/dist/client/assets/index-C4Uak2ha.js +1 -0
- package/dist/client/assets/{index-PQ9ky1pb.js → index-C7I0BjyX.js} +1 -1
- package/dist/client/assets/{index-DdLM7r4n.js → index-CEicS7Zi.js} +1 -1
- package/dist/client/assets/{index-qgNv3Cxj.js → index-CLTrC-a-.js} +3 -3
- package/dist/client/assets/{index-D0wnu6mZ.js → index-CLVvKY2v.js} +1 -1
- package/dist/client/assets/{index-DGl_kpd1.js → index-COXdXByr.js} +1 -1
- package/dist/client/assets/{index-DFSOBVsY.js → index-CTJA-mZu.js} +1 -1
- package/dist/client/assets/{index-D7HEC8Yo.js → index-CZmU-67J.js} +1 -1
- package/dist/client/assets/{index-D6lfnwuN.js → index-Cbbw2ByB.js} +1 -1
- package/dist/client/assets/{index-BL3de6b2.js → index-Cbk19RQp.js} +1 -1
- package/dist/client/assets/{index-Bgo2UMWk.js → index-D0QV18E0.js} +1 -1
- package/dist/client/assets/{index-COAKEYxS.js → index-D5fV4hrl.js} +1 -1
- package/dist/client/assets/{index-BBSooI6P.js → index-DBAPfYwE.js} +1 -1
- package/dist/client/assets/{index-Cu4ctkPn.js → index-DK8zHloW.js} +1 -1
- package/dist/client/assets/index-DO8NbOqk.js +1 -0
- package/dist/client/assets/{index-B2dE15Nh.js → index-DXZ-w0Z9.js} +1 -1
- package/dist/client/assets/{index-BP95cLC1.js → index-DYQjub9g.js} +1 -1
- package/dist/client/assets/index-Daoy3TZ8.js +1 -0
- package/dist/client/assets/{index-DyyjN4h7.js → index-DdBvjuc4.js} +1 -1
- package/dist/client/assets/{index-DTmOp_1r.js → index-DhqeMM58.js} +2 -2
- package/dist/client/assets/{index-DdHstbQU.js → index-Ds9wPt9M.js} +1 -1
- package/dist/client/assets/{index-ClIWAc6a.js → index-RQhQx8gq.js} +1 -1
- package/dist/client/assets/{index-1z7QYB4x.js → index-UJpgX--l.js} +2 -2
- package/dist/client/assets/index-YUtEyz7O.js +1053 -0
- package/dist/client/assets/{index-zQs7Z5os.js → index-oc-yQ5Q4.js} +1 -1
- package/dist/client/assets/index-tRdq7FGO.js +1 -0
- package/dist/client/assets/{index-GPUOanO_.js → index-um-0KSur.js} +1 -1
- package/dist/client/assets/{index.esm-C41qhCJ5.js → index.esm-B10OaB6F.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-DrdZIXXy.js → infoDiagram-MVDRKAX5-CGtvYWtj.js} +1 -1
- package/dist/client/assets/{inline-code-AHNJTNEg.js → inline-code-BL-6EKVP.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-DUbSK1_E.js → ishikawaDiagram-HPEHV2GE-ICsVVT2t.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-BR52zXJU.js → journeyDiagram-BOSHW7O7-DEmSX2Hn.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-_Wcjt7SY.js → kanban-definition-FNSA4HC5-SAV5PQOr.js} +1 -1
- package/dist/client/assets/{layers-IVPemhwp.js → layers-Bfdpn7ZM.js} +1 -1
- package/dist/client/assets/{lightbulb-DrVZQcOf.js → lightbulb-CSPTiZoi.js} +1 -1
- package/dist/client/assets/{link-2-Irbj23wB.js → link-2-ZzmN9B9k.js} +1 -1
- package/dist/client/assets/{list-runtime-types-BtXx3u9w.js → list-runtime-types-7qV7HQ7K.js} +1 -1
- package/dist/client/assets/{markdown-content-DBXaMyx0.js → markdown-content-CiDXslQf.js} +1 -1
- package/dist/client/assets/mention-pill-CuSUdpn7.js +1 -0
- package/dist/client/assets/{mermaid.core-BwsoL8Cm.js → mermaid.core-C-qvGQ5g.js} +4 -4
- package/dist/client/assets/{message-square-off-CIYKFEKw.js → message-square-off-BehEHG9c.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-1IqhYOl3.js → mindmap-definition-6OY57UG3-DzU2APoo.js} +1 -1
- package/dist/client/assets/{more-details-CEMEkDUz.js → more-details-DF2dJXMV.js} +1 -1
- package/dist/client/assets/{owner-notice-BJY5v-87.js → owner-notice-DoH-_Veh.js} +1 -1
- package/dist/client/assets/{package-CTn_hN2S.js → package-Fm_v1gMn.js} +1 -1
- package/dist/client/assets/{page-container-Cde6fRTi.js → page-container-Bcz5wJVR.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-CyT6JG8q.js → pane-resize-handle-_EuIpxzc.js} +1 -1
- package/dist/client/assets/{paperclip-szlXSQSk.js → paperclip-AGN67YEM.js} +1 -1
- package/dist/client/assets/path-input-jrT0Ap4j.js +1 -0
- package/dist/client/assets/{pegDiagram-ECIUJNBX-Djw-8h2r.js → pegDiagram-ECIUJNBX-CAyGJ7fm.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-DsZyw9x9.js → pieDiagram-GNMPY74T-tmLJe1p-.js} +1 -1
- package/dist/client/assets/{plug-CgD9bf2Y.js → plug-C-4o4Kb8.js} +1 -1
- package/dist/client/assets/primer-trigger-CmE4Ib-X.js +3 -0
- package/dist/client/assets/{profile-errors-Lfs66dvr.js → profile-errors-vJU1kT3U.js} +1 -1
- package/dist/client/assets/{progress-BKspNOdx.js → progress-BTu_QWg8.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-D_Vi6U-2.js → quadrantDiagram-D57K4MC3-CUr2zJoz.js} +1 -1
- package/dist/client/assets/{query-error-state-B9bR1eRh.js → query-error-state-BCX32dab.js} +1 -1
- package/dist/client/assets/{radio-CmZ30mVT.js → radio-DBitPjM1.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-C6PgeQHt.js → railroadDiagram-Y72NRBL7-Bk9OMEWz.js} +1 -1
- package/dist/client/assets/registry-DVPRVi8T.js +34 -0
- package/dist/client/assets/registry-DiFfRDdW.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-CdZnmG6_.js → relay-trace-schemas-C-1Js81V.js} +2 -2
- package/dist/client/assets/{repeat-DmCgFtjt.js → repeat-B1wCYWXI.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-CnNYn7qe.js → requirementDiagram-EQYSW5RA-B2pkljrw.js} +1 -1
- package/dist/client/assets/{room-files-source-BbEFTxX0.js → room-files-source-BDkq0-fd.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-k0vIMOao.js → rotate-ccw-clock-Ds8cHkxD.js} +1 -1
- package/dist/client/assets/{rotate-cw-OJ7jzj3C.js → rotate-cw-hUzouNTK.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-0KFthF8u.js → sankeyDiagram-SY24JHO5-DEW9eIPS.js} +1 -1
- package/dist/client/assets/scroll-area-RSd8NjrE.js +1 -0
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-BD3TzBXD.js → sequenceDiagram-BLEHNHQU-CoiCdD1D.js} +1 -1
- package/dist/client/assets/{shield-x-By16ILlp.js → shield-x-KL4ZbHfz.js} +1 -1
- package/dist/client/assets/signed-in-Dzxe2378.js +1 -0
- package/dist/client/assets/{sizeCapture-INFHLROL-BIJvrYdE.js → sizeCapture-INFHLROL-BWGf0Ghs.js} +1 -1
- package/dist/client/assets/{soul-file-C81l7z8x.js → soul-file-BQXbWArv.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-CtigYKfx.js → stateDiagram-v2-A6IESKWZ-aeqwGZMB.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-CPMK7lCN.js → swimlanes-B3ENRKFQ-BkWhAAlV.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-CS2DMvLi.js +8 -0
- package/dist/client/assets/{table-jPIEjPov.js → table-CfLst6CF.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-CtihfrW4.js → timeline-definition-JXYKGLGB-C1BUxIfq.js} +1 -1
- package/dist/client/assets/{trust-posture-olfknSP7.js → trust-posture-CfEIPM4Z.js} +1 -1
- package/dist/client/assets/{unplug-Bm7nHhBA.js → unplug-B3eDst8L.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-DogkKIUJ.js → unverified-catalog-notice-BqIWxQuN.js} +1 -1
- package/dist/client/assets/{use-bindings-C0bBY5jd.js → use-bindings-DhOKnybh.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-V6vxLUUc.js → use-composer-prefs-_rlNL0D8.js} +1 -1
- package/dist/client/assets/{use-connector-management-DLOJoz45.js → use-connector-management-CHLdhBhC.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-ODQAWdEP.js → use-deep-link-scroll-BVkszEn2.js} +1 -1
- package/dist/client/assets/{use-delete-binding-BL0OOgo0.js → use-delete-binding-BET7vH2R.js} +1 -1
- package/dist/client/assets/{use-dev-links-DmzL_awM.js → use-dev-links-BjLPuSUC.js} +1 -1
- package/dist/client/assets/{use-direct-message-panel-7DpsxnS_.js → use-direct-message-panel-ClXVf94w.js} +1 -1
- package/dist/client/assets/{use-external-adapter-catalog-D7yXhN3U.js → use-external-adapter-catalog-D1INoacX.js} +1 -1
- package/dist/client/assets/use-filter-state-BRlb3qG3.js +6 -0
- package/dist/client/assets/use-full-activity-feed-GWBg-_1B.js +1 -0
- package/dist/client/assets/use-is-below-desktop-BjWA-tqP.js +1 -0
- package/dist/client/assets/{use-local-browser-Ba-XDxE0.js → use-local-browser-C-V2n_wd.js} +1 -1
- package/dist/client/assets/{use-mesh-topology-DhUhzu7Y.js → use-mesh-topology-BzSFyR_s.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-Vm8D40hS.js → use-mounted-ref-1T3JbkY1.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-Cjb26GhZ.js → use-notification-prefs-qcYeVmLQ.js} +1 -1
- package/dist/client/assets/use-pending-read-C1oA2H00.js +1 -0
- package/dist/client/assets/use-personality-commit-CJb-rqmM.js +1 -0
- package/dist/client/assets/{use-promo-activation-D1DYLKS8.js → use-promo-activation-CAJItujg.js} +3 -3
- package/dist/client/assets/{use-promo-dismissals-ByGIekeo.js → use-promo-dismissals-C6bPU5Rm.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-CDqh0_k8.js → use-pulse-freshness-Y11Ibit1.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-ysyr_uyD.js → use-room-follow-claim-Di-yvoJD.js} +1 -1
- package/dist/client/assets/{use-room-sessions-_zhdKcKj.js → use-room-sessions-CPDRbQAW.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-CoJ0aHCJ.js → use-roving-tab-list-DK0OzOUz.js} +1 -1
- package/dist/client/assets/use-session-canvas-DA2i9Mdm.js +27 -0
- package/dist/client/assets/use-status-budget-jMg_w0rF.js +21 -0
- package/dist/client/assets/{use-transform-B5MsPCLG.js → use-transform-BX3r518L.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-CjOWILFh.js → use-unclaimed-chats-B0nk8b84.js} +1 -1
- package/dist/client/assets/use-update-config-Ce7sHmp2.js +1 -0
- package/dist/client/assets/{useMutationState-4dFTMb_f.js → useMutationState-Rlga1GBT.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-DD4D-089.js → usecaseDiagram-WPOLBNNX-mjIwRNL1.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-DjVDYX3w.js → vennDiagram-Q3Y3IDCW-BcDIpVa6.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-bupKx7P8.js → wardleyDiagram-IVAIDKWA-NFX31kox.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-DoCyS7MC.js → xychartDiagram-4URNHDU4-DZZY7dL1.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261031012841_dor3309_file_turn_on_offer.sql +2 -0
- package/dist/drizzle/20261101122330_schedule_declined_content_key.sql +1 -0
- package/dist/drizzle/meta/20261031012841_snapshot.json +14116 -0
- package/dist/drizzle/meta/20261101122330_snapshot.json +14123 -0
- package/dist/drizzle/meta/_journal.json +14 -0
- package/dist/server/index.js +21783 -17826
- package/dist/server/index.js.map +2 -2
- package/package.json +6 -5
- package/dist/client/assets/ActivityRow-DuuG4S5E.js +0 -1
- package/dist/client/assets/AdapterSetupWizard-ByQU3Ryd.js +0 -2
- package/dist/client/assets/AppearancePage-CS6bwH4x.js +0 -1
- package/dist/client/assets/AttentionSignalRow-ByeDJweR.js +0 -1
- package/dist/client/assets/BindingDialog-nNZW4-SF.js +0 -1
- package/dist/client/assets/CanvasFileContent-TO3VAFTI.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-DNK3EY5W.js +0 -2
- package/dist/client/assets/ChannelComposer-Bfi3hAgy.js +0 -44
- package/dist/client/assets/ConnectionAccessLists-BxLNtKdv.js +0 -1
- package/dist/client/assets/HandlePage-rhsJ5LBy.js +0 -1
- package/dist/client/assets/HeartbeatPage-DsVZLbVN.js +0 -1
- package/dist/client/assets/Marketplace-DRaPW5c2.js +0 -36
- package/dist/client/assets/NamePage-BvRDf9r1.js +0 -1
- package/dist/client/assets/OperatorIdentityForm-BzZoS4KD.js +0 -1
- package/dist/client/assets/PhotoPage-CDCmTcmR.js +0 -1
- package/dist/client/assets/PreviewRefusedNotice-DzvwQvMr.js +0 -1
- package/dist/client/assets/PromptSuggestionChips-DlajKFMJ.js +0 -1
- package/dist/client/assets/RoomSurface-YZW_jtGD.js +0 -1
- package/dist/client/assets/RunsOnPopover-CeQJLljM.js +0 -1
- package/dist/client/assets/RuntimeConnectFlow-BgLzK2Pf.js +0 -1
- package/dist/client/assets/RuntimeSetupDialog-B9dgB_DN.js +0 -1
- package/dist/client/assets/SettingsDialog-C8TP1x7g.js +0 -12
- package/dist/client/assets/SkillsPage-D5GNx64I.js +0 -1
- package/dist/client/assets/TaskDialogWrapper-DOpxfrLl.js +0 -1
- package/dist/client/assets/TasksEmptyState-sW-pmnOm.js +0 -3
- package/dist/client/assets/TourHost-ChgzKB0c.js +0 -1
- package/dist/client/assets/UnreadDivider-qMUA2rFP.js +0 -1
- package/dist/client/assets/WidgetErrorCard-DcsOHVds.js +0 -108
- package/dist/client/assets/WorkView-ynqZVa-o.js +0 -51
- package/dist/client/assets/_shell-DOg4Lmhv.js +0 -80
- package/dist/client/assets/_shell._home.activity-Dk3nKLHQ.js +0 -1
- package/dist/client/assets/_shell._home.index-B9rvWnn_.js +0 -3
- package/dist/client/assets/_shell._home.tasks-BCPd5sNc.js +0 -1
- package/dist/client/assets/_shell._home.workspaces-BVBkkkT0.js +0 -1
- package/dist/client/assets/_shell.connections-DFZFVHNc.js +0 -1
- package/dist/client/assets/_shell.marketplace-DIC-vQZq.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-Dk7fKhJ6.js +0 -1
- package/dist/client/assets/_shell.session-BAq7SnHK.js +0 -1
- package/dist/client/assets/_shell.threads-B-nWDy_6.js +0 -1
- package/dist/client/assets/_shell.x._extensionId-B9CWzm8d.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-B9CWzm8d.js +0 -1
- package/dist/client/assets/card-fYp8lOoT.js +0 -1
- package/dist/client/assets/channel-ByM_gaT3.js +0 -1
- package/dist/client/assets/form-CiD71zin.js +0 -1
- package/dist/client/assets/image-lightbox-CV8y6iVA.js +0 -1
- package/dist/client/assets/index-BUTqV5Hw.js +0 -1
- package/dist/client/assets/index-BZkrahcw.js +0 -1
- package/dist/client/assets/index-B_ScMg0T.js +0 -1
- package/dist/client/assets/index-BuLpfIsj.js +0 -1
- package/dist/client/assets/index-CsGjmUNs.js +0 -1
- package/dist/client/assets/index-Dry_agqN.css +0 -1
- package/dist/client/assets/index-KUHF1hd1.js +0 -1
- package/dist/client/assets/index-ZV77GAWw.js +0 -1
- package/dist/client/assets/index-_8SHxs8S.js +0 -1058
- package/dist/client/assets/mention-pill-BjC9bceV.js +0 -1
- package/dist/client/assets/path-input-AlewPslD.js +0 -1
- package/dist/client/assets/primer-trigger-ZBFgqPeY.js +0 -3
- package/dist/client/assets/registry-CSe_ncC2.js +0 -34
- package/dist/client/assets/registry-D10b3VBA.js +0 -1
- package/dist/client/assets/scroll-area-vYE-OvYe.js +0 -1
- package/dist/client/assets/search-x-mbqB9SFV.js +0 -6
- package/dist/client/assets/signed-in-DNUF_3Fa.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-C24DKoiY.js +0 -8
- package/dist/client/assets/use-full-activity-feed-CnShEfSU.js +0 -1
- package/dist/client/assets/use-is-below-desktop-C1nTBNsP.js +0 -1
- package/dist/client/assets/use-pending-read-r81zBhY9.js +0 -1
- package/dist/client/assets/use-personality-commit-D1SSZI1q.js +0 -1
- package/dist/client/assets/use-session-canvas-IKy8PO1l.js +0 -27
- package/dist/client/assets/use-status-budget-yYQ7GR9y.js +0 -16
- package/dist/client/assets/use-update-config-B49bVEOw.js +0 -1
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import{O as te,a1 as B,a2 as de,a8 as P,a3 as ae,a4 as ue,r as p,u as ke,nz as Ce,j as s,eg as ln,eh as on,ei as cn,ej as dn,ek as un,fB as mn,en as ee,dU as hn,I as pn,nA as We,nB as be,nC as Ge,nD as us,nE as ms,e as W,l$ as fn,a0 as me,nF as xn,B as C,e3 as gn,nG as Ke,nH as kn,nI as jn,ap as Qe,P as vn,G as oe,dD as S,dM as K,fV as bn,hU as yn,nJ as Nn,dL as wn,hh as Cn,nK as Pn,nL as Je,nM as Y,nN as Sn,nO as ve,J as hs,ig as Ve,jT as $n,b7 as In,f$ as qe,gX as ps,_ as se,hC as Rn,C as Pe,aL as fs,i1 as Tn,i2 as Dn,i3 as En,i4 as Ln,nP as xs,i5 as An,bU as Un,eq as On,er as Fn,kJ as Mn,ao as gs,aT as ks,hz as js,eR as He,fh as vs,gd as zn,aW as bs,nQ as _n,a as Ae,bY as ys,d0 as Se,d1 as $e,d3 as Ie,d4 as Re,d5 as Te,lo as Ns,lp as ye,eC as De,dN as Ee,x as Fe,bc as ws,au as Kn,gs as Me,gQ as Vn,nR as qn,ix as Hn,nS as Bn,nT as Wn,jI as Gn,nU as Qn,e1 as Jn,nV as Yn}from"./index-_8SHxs8S.js";import{r as Xn,d as Zn,u as Cs,P as Ps,T as et,a as st,b as Ye}from"./PreviewRefusedNotice-DzvwQvMr.js";import{C as nt}from"./card-fYp8lOoT.js";import{E as tt}from"./empty-state-BuerUR2L.js";import{M as at}from"./markdown-content-DBXaMyx0.js";import{U as rt}from"./use-unclaimed-chats-CjOWILFh.js";import{d as lt,f as it,a as ot,b as ct,c as dt,U as Ss,u as ut,e as mt}from"./UnlinkDialog-BtQvTzCP.js";import{M as ht}from"./more-details-CEMEkDUz.js";import{a as $s}from"./use-dev-links-DmzL_awM.js";import{F as Is}from"./file-CG3ZGubn.js";import{A as Rs}from"./AgentPicker-Bbvnww9v.js";import{u as pt}from"./useMutationState-4dFTMb_f.js";import{F as ft}from"./file-exclamation-point-CVXN_udI.js";import{R as Ts}from"./rotate-ccw-clock-k0vIMOao.js";import{P as xt}from"./path-input-AlewPslD.js";/**
|
|
2
|
-
* @license lucide-react v1.48.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
5
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const Ds={name:"arrow-down-to-line",size:24,node:[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]};Ds.node;const gt=te(Ds);/**
|
|
7
|
-
* @license lucide-react v1.48.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
10
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const Es={name:"circle-arrow-up",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],aliases:["arrow-up-circle"]};Es.node;const kt=te(Es);/**
|
|
12
|
-
* @license lucide-react v1.48.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
15
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const Ls={name:"file-check-corner",size:24,node:[["path",{d:"M10.5 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v6",key:"g5mvt7"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14 20 2 2 4-4",key:"15kota"}]],aliases:["file-check-2"]};Ls.node;const jt=te(Ls);/**
|
|
17
|
-
* @license lucide-react v1.48.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
20
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const As={name:"key",size:24,node:[["path",{d:"m2 21 9.6-9.6",key:"9l79m3"}],["path",{d:"m7.5 15.5 2.3 2.3a1 1 0 0 1 0 1.4l-2.1 2.1a1 1 0 0 1-1.4 0L4 19",key:"fw8biw"}],["circle",{cx:"15.5",cy:"7.5",r:"5.5",key:"4wxmhb"}]]};As.node;const vt=te(As);/**
|
|
22
|
-
* @license lucide-react v1.48.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
25
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const Us={name:"package-search",size:24,node:[["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"M20.27 18.27 22 20",key:"er2am"}],["path",{d:"M21 10.498V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l.98-.559",key:"tok1h1"}],["path",{d:"M3.29 7 12 12l8.71-5",key:"19ckod"}],["path",{d:"m7.5 4.27 8.997 5.148",key:"9yrvtv"}],["circle",{cx:"18.5",cy:"16.5",r:"2.5",key:"ke13xx"}]]};Us.node;const bt=te(Us);/**
|
|
27
|
-
* @license lucide-react v1.48.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
30
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const Os={name:"scale",size:24,node:[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"m19 8 3 8a5 5 0 0 1-6 0zV7",key:"zcdpyk"}],["path",{d:"M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1",key:"1yorad"}],["path",{d:"m5 8 3 8a5 5 0 0 1-6 0zV7",key:"eua70x"}],["path",{d:"M7 21h10",key:"1b0cd5"}]]};Os.node;const yt=te(Os);/**
|
|
32
|
-
* @license lucide-react v1.48.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const Fs={name:"unlink",size:24,node:[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]};Fs.node;const Nt=te(Fs);function wt(e,n){const t=B(),{enabled:r=!0,marketplace:a}=n??{};return de({queryKey:P.packageDetail(e??""),queryFn:()=>t.getMarketplacePackage(e,a),enabled:r&&e!==null,staleTime:6e4})}function je(e){const n=B();return de({queryKey:P.installed(e),queryFn:()=>n.listInstalledPackages(e),staleTime:6e4})}function Ct(e,n){const t=B();return de({queryKey:P.installedDetail(e??""),queryFn:()=>t.listPackageInstallations(e),enabled:((n==null?void 0:n.enabled)??!0)&&e!==null,staleTime:6e4})}function Pt(){const e=B();return de({queryKey:P.integrity(),queryFn:()=>e.listInstalledPackages(void 0,{verify:!0}),select:n=>new Map(n.flatMap(t=>t.integrity?[[t.installPath,t.integrity]]:[])),staleTime:6e4})}const St=10*6e4;function $t(e,n={}){const t=B();return de({queryKey:P.updates(e),queryFn:()=>t.checkMarketplaceUpdates(e),enabled:n.enabled??!0,staleTime:St,refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:!1})}function It(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.installMarketplacePackage(t,r),onError:t=>{t.code==="disclosure_changed"&&n.invalidateQueries({queryKey:P.preview()})},onSuccess:(t,{name:r,options:a})=>{n.invalidateQueries({queryKey:P.installed()}),a!=null&&a.projectPath&&n.invalidateQueries({queryKey:P.installed(a.projectPath)}),n.invalidateQueries({queryKey:P.packages()}),n.invalidateQueries({queryKey:P.packageDetail(r)}),n.invalidateQueries({queryKey:["commands"]}),n.invalidateQueries({queryKey:P.updates(),refetchType:"none"})}})}function Rt(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.uninstallMarketplacePackage(t,r),onSuccess:(t,{name:r,options:a})=>{n.invalidateQueries({queryKey:P.installed()}),a!=null&&a.projectPath&&n.invalidateQueries({queryKey:P.installed(a.projectPath)}),n.invalidateQueries({queryKey:P.packageDetail(r)}),n.invalidateQueries({queryKey:["commands"]})}})}function Tt(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.checkPackageFiles(t,r),onSettled:()=>{n.invalidateQueries({queryKey:P.integrity()})}})}function Ms(e){if(!e.applied)return e;const{applied:n,applyError:t,note:r,...a}=e;return{...a,status:"current",hasUpdate:!1,installedVersion:n.version,installedVersionSource:n.version===e.latestVersion?e.latestVersionSource:"package"}}function Dt(){const e=B(),n=ae();return ue({mutationKey:P.applyUpdates(),mutationFn:t=>e.applyMarketplaceUpdates(t),meta:{suppressErrorToast:!0},onError:t=>{t.code==="disclosure_changed"&&n.invalidateQueries({queryKey:P.updates()})},onSuccess:async t=>{const r=new Map(t.checks.map(l=>[l.installPath,Ms(l)]));n.setQueriesData({queryKey:P.updates()},l=>l&&{checks:l.checks.map(i=>r.get(i.installPath)??i)});const a=t.checks.filter(l=>l.applied);if(a.length!==0){for(const l of new Set(a.map(i=>i.packageName)))n.invalidateQueries({queryKey:P.installedDetail(l)}),n.invalidateQueries({queryKey:P.packageDetail(l)});n.invalidateQueries({queryKey:["commands"]}),await n.invalidateQueries({queryKey:P.installed()})}}})}function Et(){const e=pt({filters:{mutationKey:P.applyUpdates(),status:"pending"},select:n=>{var t;return(t=n.state.variables)==null?void 0:t.targets.map(r=>r.installPath)}});return p.useMemo(()=>new Set(e.flatMap(n=>n??[])),[e])}function Lt(){const e=B();return ue({mutationFn:n=>e.reviewHeldBackPackage(n),meta:{suppressErrorToast:!0}})}function At(e){const n=B();return de({queryKey:P.heldBack(),queryFn:()=>n.listHeldBackPackages(),enabled:e})}function Ut(){const e=B(),n=ae();return ue({mutationFn:({name:t,options:r})=>e.keepPackageFiles(t,r),meta:{suppressErrorToast:!0},onSettled:()=>{n.invalidateQueries({queryKey:P.installed()})}})}function Ot(e,n){return e.name.toLowerCase().includes(n)||(e.description??"").toLowerCase().includes(n)||(e.keywords??[]).some(t=>t.toLowerCase().includes(n))?!0:(e.tags??[]).some(t=>t.toLowerCase().includes(n))}const Ft=300,Mt=[{value:"featured",label:"Featured"},{value:"name",label:"A–Z"},{value:"popular",label:"Popular"},{value:"recent",label:"Recent"}];function zt(){const{sort:e,setSort:n}=ke(),{data:t}=Ce(),r=p.useMemo(()=>(t??[]).some(i=>i.installCount!==void 0),[t]),a=p.useMemo(()=>(t??[]).some(i=>i.updatedAt!==void 0),[t]),l=i=>i==="popular"?!r:i==="recent"?!a:!1;return s.jsxs("header",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(_t,{})}),s.jsxs(ln,{value:e,onValueChange:i=>n(i),children:[s.jsx(on,{"aria-label":"Sort packages",className:"w-28 shrink-0 text-xs sm:w-32",children:s.jsx(cn,{})}),s.jsx(dn,{children:Mt.map(i=>s.jsx(un,{value:i.value,disabled:l(i.value),className:"text-xs",children:i.label},i.value))})]})]})}function _t(){const{search:e,setSearch:n}=ke(),t=p.useRef(null),r=mn({value:e,generation:0});r.read().value!==e&&r.write({value:e,generation:r.read().generation+1});const a=r.read().generation,[l,i]=p.useState(null),o=l!==null&&l.generation===a?l.value:e,d=c=>i({generation:a,value:c});p.useEffect(()=>{if(o===e)return;const c=setTimeout(()=>n(o),Ft);return()=>clearTimeout(c)},[o,e,n]);const u=p.useCallback(c=>{var w;if(c.key!=="/"||c.metaKey||c.ctrlKey||c.altKey)return;const h=c.target,f=h==null?void 0:h.tagName;f==="INPUT"||f==="TEXTAREA"||f==="SELECT"||h!=null&&h.isContentEditable||(c.preventDefault(),(w=t.current)==null||w.focus())},[]);return p.useEffect(()=>(document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)),[u]),s.jsxs("div",{className:"group/search relative",children:[s.jsx(ee,{htmlFor:"marketplace-search",className:"sr-only",children:"Search packages"}),s.jsx(hn,{className:"text-muted-foreground group-focus-within/search:text-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2 transition-colors duration-200","aria-hidden":!0}),s.jsx(pn,{ref:t,id:"marketplace-search","data-testid":"marketplace-search",value:o,onChange:c=>d(c.target.value),placeholder:"Search…",className:"pl-9 transition-shadow duration-200 focus:shadow-md max-sm:pr-3 sm:pr-10"}),s.jsx("kbd",{className:"text-muted-foreground/60 text-3xs pointer-events-none absolute top-1/2 right-3 hidden -translate-y-1/2 rounded border border-current/20 px-1.5 py-0.5 font-mono leading-none group-focus-within/search:opacity-0 sm:block",children:"/"})]})}function Kt(e,n){if(n==="all")return!0;const t=e.type??"plugin";return n===We?t==="adapter"&&e.adapterType===We:t===n}function Vt(e,n){const t=n.search.trim().toLowerCase();return e.filter(r=>!(!Kt(r,n.type)||n.categories.length>0&&!n.categories.some(l=>{var i;return(((i=r.categories)==null?void 0:i.includes(l))??!1)||r.category===l})||n.sources.length>0&&!n.sources.includes(r.marketplace)||t&&!Ot(r,t)))}function Le(e,n){return be(e).localeCompare(be(n))}function qt(e,n){const t=e.marketplace===Ge?1:0,r=n.marketplace===Ge?1:0;if(t!==r)return r-t;const a=e.featured?1:0,l=n.featured?1:0;return a!==l?l-a:Le(e,n)}function Ht(e,n){const t=e.installCount??0,r=n.installCount??0;return t!==r?r-t:Le(e,n)}function Bt(e,n){const t=e.updatedAt??"",r=n.updatedAt??"";return t!==r?r.localeCompare(t):Le(e,n)}function Wt(e,n){const t=[...e];switch(n){case"featured":return t.sort(qt);case"name":return t.sort(Le);case"popular":return t.sort(Ht);case"recent":return t.sort(Bt)}}function zs({count:e=8}){return s.jsx("div",{className:us,children:s.jsx("div",{"data-slot":"package-grid",className:ms,"aria-busy":"true","aria-label":"Loading packages",children:Array.from({length:e}).map((n,t)=>s.jsxs(nt,{radius:"lg",gap:"none",className:"p-6",children:[s.jsx("div",{className:"mb-3 flex items-start justify-between gap-2",children:s.jsx(W,{className:"size-6 rounded-full"})}),s.jsx(W,{className:"mb-1 h-4 w-3/4"}),s.jsx(W,{className:"mb-3 h-3 w-16"}),s.jsx(W,{className:"mb-1 h-3 w-full"}),s.jsx(W,{className:"mb-4 h-3 w-2/3"}),s.jsx("div",{className:"flex items-center justify-end",children:s.jsx(W,{className:"h-7 w-16"})})]},t))})})}function xe({onResetFilters:e,resetLabel:n="Reset filters",title:t="No packages match your filters",description:r="Try another search or filter."}){return s.jsx(tt,{className:"rounded-xl border border-dashed",icon:bt,headline:t,headingLevel:3,description:r,action:e?{label:n,onClick:e,variant:"outline"}:void 0})}const Gt=/network|fetch|offline/i;function _s({error:e,onRetry:n}){const t=Gt.test(e.message),r=t?fn:me,a=t?"Couldn’t reach the marketplace":"Couldn’t load packages";return s.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed py-16 text-center",children:[s.jsx(r,{className:"text-muted-foreground mb-4 size-10","aria-hidden":!0}),s.jsx("h3",{className:"mb-2 text-base font-semibold",children:a}),s.jsx("p",{className:"text-muted-foreground mb-4 max-w-sm text-sm",children:s.jsx(xn,{text:e.message})}),s.jsx(C,{variant:"outline",onClick:n,children:"Try again"})]})}const ze=20,Qt=.03,Jt={hidden:{},visible:{transition:{staggerChildren:Qt}}},Yt={hidden:e=>({opacity:e<ze?0:1,y:e<ze?12:0}),visible:{opacity:1,y:0,transition:{duration:.25,ease:"easeOut"}}};function Xt(){const{data:e,isLoading:n,error:t,refetch:r}=Ce(),{data:a}=je(),l=gn(),{type:i,categories:o,sources:d,search:u,sort:c,resetFilters:h,clearCategories:f,clearSources:w,openDetail:T}=ke(),v=Ke(),x=p.useMemo(()=>e?Wt(Vt(e,{type:i,categories:o,sources:d,search:u}),c):[],[e,i,o,d,u,c]),N=p.useMemo(()=>new Set((a??[]).map(k=>k.name)),[a]),$=p.useMemo(()=>new Set((a??[]).filter(k=>k.devLink).map(k=>k.name)),[a]);if(n)return s.jsx(zs,{});if(t)return s.jsx(_s,{error:t,onRetry:()=>void r()});if(x.length===0){const k=o.length>0&&d.length===0,I=d.length>0&&o.length===0;if(k){const A=o.length===1?o[0]:null,D=A?kn(A):void 0,E=A?D?jn[D]:A:null;return s.jsx(xe,{title:E?`No packages in ${E} yet`:"No packages in these categories yet",description:"Try another category.",resetLabel:o.length===1?"Clear category":"Clear categories",onResetFilters:f})}if(I){const A=d.length===1?d[0]:null;return s.jsx(xe,{title:A?`No packages from ${A} yet`:"No packages from these sources yet",description:"Try another source.",resetLabel:d.length===1?"Clear source":"Clear sources",onResetFilters:w})}return o.length>0&&d.length>0?s.jsx(xe,{title:"No packages match these filters",description:"Reset the filters to see everything.",onResetFilters:h}):s.jsx(xe,{onResetFilters:h})}return s.jsxs("div",{className:oe(us,"space-y-4"),children:[s.jsx("div",{className:"flex items-center justify-between gap-4",children:s.jsxs("h2",{className:"text-base font-semibold",children:["All packages",s.jsxs("span",{className:"text-muted-foreground ml-2 text-sm font-normal",children:["(",x.length,")"]})]})}),s.jsx(Qe.div,{variants:l?void 0:Jt,initial:"hidden",animate:"visible","data-slot":"package-grid",className:ms,children:x.map((k,I)=>s.jsx(Qe.div,{variants:l?void 0:Yt,custom:I<ze?I:0,className:"h-full",children:s.jsx(vn,{pkg:k,installed:N.has(k.name),devLinked:$.has(k.name),onClick:()=>T(k.name),onInstallClick:()=>v(k)})},k.name))})]})}function Xe(e,n){return e instanceof Error?`Couldn’t uninstall ${n}: ${e.message}`:`Couldn’t uninstall ${n}. Try again.`}function re(e){const n=K(e.name);return e.where?`${n} from ${e.where}`:n}function Ze(e){const n=(e==null?void 0:e.warnings)??[];return n.length>0?{description:n.join(" ")}:{}}function Ks(){const e=Rt(),n=ae(),{mutate:t,mutateAsync:r}=e,a=p.useCallback(()=>{n.invalidateQueries({queryKey:[...rt]})},[n]),l=p.useCallback(({where:o,...d})=>{const u=S.loading(`Uninstalling ${re({...d,where:o})}…`);t(d,{onSuccess:c=>{a(),S.success(`Uninstalled ${re({...d,where:o})}`,{id:u,...Ze(c)})},onError:c=>{S.error(Xe(c,re({...d,where:o})),{id:u})}})},[t,a]),i=p.useCallback(async({where:o,...d})=>{const u=S.loading(`Uninstalling ${re({...d,where:o})}…`);try{const c=await r(d);return a(),S.success(`Uninstalled ${re({...d,where:o})}`,{id:u,...Ze(c)}),c}catch(c){throw S.error(Xe(c,re({...d,where:o})),{id:u}),c}},[r,a]);return{...e,mutate:l,mutateAsync:i}}function Vs(){const[e,n]=p.useState(null),[t,r]=p.useState(null),a=Ke(),l=c=>{var h;return{name:c.name,...lt(c),parked:((h=c.devLink)==null?void 0:h.parked)===!0}},i=p.useCallback(c=>{r(null),n(l(c))},[]),o=p.useCallback((c,h)=>{r({pkg:h,installation:c}),n({...l(c),then:"install"})},[]),d=p.useCallback(()=>n(null),[]),u=p.useCallback(c=>{if(c.then!=="install"||!t)return;const{pkg:h,installation:f}=t;r(null),a(h,f.agentPath?{agentPath:f.agentPath,agentName:f.agentName??f.agentPath}:void 0)},[t,a]);return{target:e,askUnlink:i,askInstallPublished:o,close:d,onUnlinked:u}}function Zt(e){const{data:n}=$s(),t=it(n==null?void 0:n.links,e),r=Nn(ot(e,t)),a=wn(l=>l.latest[r]);return e.devLink?ct(e.devLink,a,t):null}function ea({status:e}){switch(e.kind){case"reloaded":return s.jsx(sa,{at:e.at});case"watching":return s.jsx("p",{className:"text-muted-foreground text-xs",children:"Watching for edits."});case"reload-failed":return s.jsxs("div",{className:"text-status-warning-fg space-y-1 text-xs",children:[s.jsxs("p",{className:"flex items-start gap-1",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"[overflow-wrap:anywhere]",children:e.headline})]}),s.jsx(ht,{label:"Details",openLabel:"Hide details",className:"ml-4",children:e.details.map((n,t)=>s.jsx("p",{className:"font-mono text-xs [overflow-wrap:anywhere]",children:n},`${t}-${n}`))})]});case"folder-missing":return s.jsx(Ue,{children:"Folder missing. Restore it or unlink."});case"link-missing":return s.jsx(Ue,{children:"Its link is gone. Unlink to finish."});case"link-replaced":return s.jsx(Ue,{children:"Something else is in its place. Unlink to finish."})}}function sa({at:e}){const n=Cn(1e3);return s.jsx("time",{dateTime:e,title:new Date(e).toLocaleString(),className:"text-muted-foreground text-xs",children:dt(e,n)})}function Ue({children:e}){return s.jsxs("p",{className:"text-status-warning-fg flex items-start gap-1 text-xs",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{children:e})]})}function qs({installation:e}){const n=Zt(e);return!e.devLink||!n?null:s.jsxs("div",{className:"mt-1.5 space-y-1","data-testid":"dev-link-details",children:[s.jsx(bn,{path:e.devLink.path}),s.jsx("div",{role:"status","aria-live":"polite","data-testid":"dev-link-status",children:s.jsx(ea,{status:n})})]})}function Hs({installation:e,published:n,label:t,onUnlink:r,onInstallPublished:a,disabled:l}){return e.devLink?e.devLink.parked?s.jsxs(C,{size:"sm",variant:"outline",onClick:r,disabled:l,"aria-label":`Use the installed copy of ${t}`,children:[s.jsx(yn,{className:"mr-1 size-3","aria-hidden":!0}),"Use installed copy"]}):s.jsxs(s.Fragment,{children:[n&&s.jsxs(C,{size:"sm",variant:"outline",onClick:()=>a(n),disabled:l,"aria-label":`Install the published version of ${t}`,children:[s.jsx(gt,{className:"mr-1 size-3","aria-hidden":!0}),"Install published version"]}),s.jsxs(C,{size:"sm",variant:"ghost",onClick:r,disabled:l,"aria-label":`Unlink ${t}`,children:[s.jsx(Nt,{className:"mr-1 size-3","aria-hidden":!0}),"Unlink"]})]}):null}function Bs(e){return e.includes("\\")&&!e.includes("/")?"\\":"/"}function es(e){return e.split(/[\\/]/)}function na(e){const n=e[0];if(n===void 0)return"";const t=Bs(n);let r=es(n).slice(0,-1);for(const a of e.slice(1)){const l=es(a).slice(0,-1);let i=0;for(;i<r.length&&i<l.length&&r[i]===l[i];)i+=1;if(r=r.slice(0,i),r.length===0)break}return r.length===0?"":r.length===1&&r[0]===""?t:r.join(t)}function ta(e,n){if(n==="")return e;const t=Bs(e),r=n.endsWith(t)?n:n+t;return e.startsWith(r)?e.slice(r.length):e}function ss(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/(^|\/)\.(?=\/|$)/g,"$1").replace(/\/+/g,"/").replace(/(.)\/$/,"$1")}function aa(e,n){if(n==="")return!1;const t=ss(n);if(t==="/"||t==="")return!0;const r=ss(e);return r===t||r.startsWith(`${t}/`)}const ra={delete:"removed",modify:"changed",create:"new"},la=["delete","modify","create"];function ns(e,n){const t=[];for(const r of la){const a=e.filter(l=>l.action===r).map(l=>ta(l.path,n)).sort((l,i)=>l.localeCompare(i));for(const l of a)t.push({text:l,tag:ra[r],...r==="delete"?{severity:"warning"}:{}})}return t}function ia(e,n){if(e.length===0)return[];const t=na(e.map(d=>d.path)),r={create:e.filter(d=>d.action==="create").length,modify:e.filter(d=>d.action==="modify").length,delete:e.filter(d=>d.action==="delete").length},a=e.length===1?"file":"files",l=t===""?"":` under ${t}`,i=[{icon:"file",label:`${e.length} ${a}${l}: ${r.create} new, ${r.modify} changed, ${r.delete} removed`,details:ns(e,t),detailsLabel:`Show ${e.length} ${a}`}];if(!n)return i;const o=e.filter(d=>!aa(d.path,n));return o.length>0&&i.push({icon:"alert-triangle",label:`${o.length} ${o.length===1?"file lands":"files land"} outside ${n}.`,severity:"warning",details:ns(o,""),detailsLabel:`Show ${o.length} ${o.length===1?"file":"files"}`}),i}function oa(e,n){const t=ia(e.fileChanges,n);if(e.npmDependencies.length>0){const r=e.npmDependencies.length;t.push({icon:"globe",label:`Download ${r} npm ${r===1?"library":"libraries"} and their dependencies`,description:e.npmDependencies.map(a=>`${a.name}@${a.range}${a.optional?" (optional)":""}`).join(", ")})}for(const r of e.extensions)t.push({icon:"puzzle",label:`Register UI extension: ${r.id}`,description:r.slots.length>0?`Slots: ${r.slots.join(", ")}`:void 0});for(const r of e.skippedLinks)t.push({icon:"alert-triangle",label:"Part of this package won’t be installed",description:r.message,severity:"warning"});return t}function Ws(e,n=Pn){const t=e.hooks.map(a=>({icon:"terminal",label:Y(a.command),description:a.source?`Runs ${Je(a.event,a.matcher)}, while ${Y(a.source)} is in use`:`Runs ${Je(a.event,a.matcher)}`,mono:!0}));for(const a of e.skillCommands){const l=Sn(a.source);t.push({icon:"terminal",label:Y(a.command),description:`Runs when the ${l} "${Y(a.skill)}" is used (${Y(a.source)})`+(a.usesArguments?". Uses what you type after it":""),mono:!0})}for(const a of e.unreadableHooks)t.push({icon:"alert-triangle",label:"Sets up a command DorkOS couldn’t read",description:a.event?`${a.path} declares "${a.event}" in a form DorkOS can’t read`:`DorkOS can’t read ${a.path}`,severity:"warning"});const r=(a,l,i=!0)=>({icon:i?"terminal":"globe",label:a,description:`${l}. ${n}`,mono:!0});for(const a of e.mcpServers)t.push(a.command!==void 0?r(ve(a.command,a.args),`MCP server "${a.name}"`):r(Y(JSON.stringify(a.url??"")),`Remote MCP server "${a.name}"`,!1));for(const a of e.lspServers)t.push(r(ve(a.command,a.args),`Language server "${a.name}"`));for(const a of e.monitors)t.push(r(ve(a.command),`Background monitor "${a.name}"${a.when?`, ${a.when}`:""}`));for(const a of e.executables)t.push(r(ve(a),"Added to the agent’s commands (bin/)"));for(const a of e.skillTools)t.push({icon:"key",label:a.tools.map(l=>Y(JSON.stringify(l))).join(", "),description:`Skill "${Y(a.skill)}" may use these without asking you`,mono:!0});for(const a of e.unreadableDeclarations)t.push({icon:"alert-triangle",label:"Sets up a program DorkOS couldn’t read",description:a.entry?`${a.path} declares "${a.entry}" in a form DorkOS can’t read`:`DorkOS can’t read ${a.path}`,severity:"warning"});return t}function Gs(e){return e.schedules.map(n=>({icon:"clock",label:n.name,description:Zn(n),severity:Xn(n.permissionMode)&&n.startsEnabled?"warning":"info"}))}function ca(e){return e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function da(e){const n={create:e.fileChanges.filter(u=>u.action==="create").length,modify:e.fileChanges.filter(u=>u.action==="modify").length,delete:e.fileChanges.filter(u=>u.action==="delete").length},r=[{verb:"Adds",count:n.create},{verb:"Changes",count:n.modify},{verb:"Removes",count:n.delete}].filter(u=>u.count>0).map((u,c)=>{const h=c===0?u.verb:u.verb.toLowerCase(),f=c===0?` ${u.count===1?"file":"files"}`:"";return`${h} ${u.count}${f}`}),a=r.length===0?"Changes no files":ca(r),l=e.hooks.length+e.skillCommands.length+e.unreadableHooks.length,i=l===0?"Declares no commands":`Declares ${l} ${l===1?"command":"commands"}`,o=e.mcpServers.length+e.lspServers.length+e.monitors.length+e.executables.length,d=o===0?"":` Includes ${o} ${o===1?"program":"programs"}.`;return`${a}. ${i}.${d}`}function ua(e,n={}){return{effects:oa(e,n.installBase),commands:Ws(e),schedules:Gs(e),secrets:e.secrets.map(t=>({icon:"key",label:t.key+(t.required?"":" (optional)"),description:t.description,severity:t.required?"warning":"info"})),hosts:e.externalHosts.map(t=>({icon:"globe",label:t})),dependencies:e.requires.map(t=>({icon:t.satisfied?"check":"alert-triangle",label:`${t.type}:${t.name}${t.version?`@${t.version}`:""}`,severity:t.satisfied?"info":"warning"})),conflicts:e.conflicts.map(t=>({icon:"alert-triangle",label:t.description,description:t.conflictingPackage?`Conflicts with: ${t.conflictingPackage}`:void 0,severity:t.level==="error"?"error":"warning"}))}}const ma={global:"Starts in every chat.",project:"Declared, but not started for a project install."};function Be(e,n){const t={hooks:e.hooks.map(a=>({event:a.event,...a.matcher!==null&&{matcher:a.matcher},command:a.command,...a.source!==null&&{source:a.source}})),unreadableHooks:[],mcpServers:e.mcpServers.map(a=>({name:a.name,transport:a.transport,...a.command!==null&&{command:a.command,args:a.args},...a.url!==null&&{url:a.url}})),lspServers:e.lspServers.map(({name:a,command:l,args:i})=>({name:a,command:l,args:i})),monitors:e.monitors.map(({name:a,command:l,when:i})=>({name:a,command:l,...i!==null&&{when:i}})),executables:e.executables,skillTools:e.skillTools,skillCommands:e.skillCommands,unreadableDeclarations:[]},r=e.schedules.map(a=>({name:a.name,cron:a.cron,permissionMode:a.permissionMode,startsEnabled:a.startsEnabled}));return[...Ws(t,ma[n]),...Gs({schedules:r})]}const ha={hooks:[],schedules:[],mcpServers:[],lspServers:[],monitors:[],executables:[],skillTools:[],skillCommands:[]},pa=["hooks","skillCommands","mcpServers","lspServers","monitors","executables","skillTools","schedules"];function Ne(e,n){if(!(e==="hooks"||e==="skillCommands"||e==="executables"))return e==="skillTools"?n.source:n.name}function fa(e,n,t){const r=[],a=(l,i)=>Be({...ha,[l]:[i]},t)[0];for(const l of pa)for(const i of e[l]){const o=a(l,i);if(!o)continue;const d=xa(l,i,n),u=d==="changed"?n[l].find(h=>Ne(l,h)===Ne(l,i)):void 0,c=u===void 0?void 0:a(l,u);r.push({row:o,change:d,...c&&{previous:c}})}return r}function xa(e,n,t){if(!t)return"unknown";const r=t[e],a=JSON.stringify(n);if(r.some(i=>JSON.stringify(i)===a))return"unchanged";const l=Ne(e,n);return l!==void 0&&r.some(i=>Ne(e,i)===l)?"changed":"new"}const ga={file:Is,puzzle:qe,clock:In,terminal:$n,key:vt,globe:Ve,check:hs,"alert-triangle":me},we={info:"text-muted-foreground",warning:"text-status-warning-fg",error:"text-destructive"};function ka({items:e,label:n}){return s.jsxs("details",{className:"group/details mt-1.5",children:[s.jsxs("summary",{className:oe("text-muted-foreground hover:text-foreground focus-ring inline-flex cursor-pointer","list-none items-center gap-1 rounded-sm text-xs select-none","[&::-webkit-details-marker]:hidden"),children:[s.jsx(Pe,{className:"size-3 shrink-0 transition-transform duration-200 group-open/details:rotate-90"}),n]}),s.jsx("ul",{className:"bg-muted/40 mt-1.5 max-h-64 space-y-0.5 overflow-y-auto rounded-md p-2",children:e.map((t,r)=>s.jsxs("li",{className:"text-2xs flex items-baseline gap-2 font-mono",children:[t.tag&&s.jsx("span",{className:oe("w-14 shrink-0",t.severity?we[t.severity]:we.info),children:t.tag}),s.jsx("span",{className:"text-foreground min-w-0 break-all","data-testid":"file-change-path",children:t.text})]},r))})]})}function Qs(e){const n=e.split(new RegExp(`(?<=\\/)|(?=["'])`));return n.map((t,r)=>s.jsxs(p.Fragment,{children:[t,r<n.length-1&&s.jsx("wbr",{})]},r))}function ge({item:e}){const n=ga[e.icon]??Is,t=e.severity?we[e.severity]:we.info;return s.jsxs("li",{className:oe("flex items-start gap-2 text-sm",t),children:[s.jsx(n,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[e.mono?s.jsx("code",{className:"bg-muted text-foreground block rounded px-1.5 py-1 font-mono text-xs [overflow-wrap:anywhere] whitespace-pre-wrap",children:Qs(e.label)}):s.jsx("span",{className:"break-words",children:e.label}),e.description&&s.jsx("p",{className:"text-muted-foreground mt-0.5 text-xs break-words",children:e.description}),e.details&&e.details.length>0&&s.jsx(ka,{items:e.details,label:e.detailsLabel??"Show details"})]})]})}function Z({title:e,items:n,tone:t,defaultOpen:r=!1}){const[a,l]=p.useState(r);return n.length===0?null:s.jsx(ps,{open:a,onOpenChange:l,trigger:s.jsx("span",{className:oe("text-xs font-semibold tracking-wider uppercase",t==="warning"?"text-status-warning-fg":"text-muted-foreground"),children:e}),badge:s.jsx(se,{variant:"secondary",className:"text-xs",children:n.length}),children:s.jsx("ul",{className:"space-y-1.5",children:n.map((i,o)=>s.jsx(ge,{item:i},o))})})}function ja(e){return e.isolation!==void 0}function va({extensions:e}){const[n,t]=p.useState(!0),r=e.filter(ja);return r.length===0?null:s.jsx(ps,{open:n,onOpenChange:t,trigger:s.jsx("span",{className:"text-muted-foreground text-xs font-semibold tracking-wider uppercase",children:"What its extensions can reach"}),badge:s.jsx(se,{variant:"secondary",className:"text-xs",children:r.length}),children:s.jsx("ul",{className:"space-y-3","data-testid":"preview-extension-reach",children:r.map(a=>s.jsxs("li",{className:"flex min-w-0 items-start gap-2 text-sm",children:[s.jsx(qe,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsx("p",{className:"text-foreground font-mono text-xs break-all",children:s.jsx("bdi",{children:a.id})}),s.jsx(Rn,{permissions:{runtime:a.isolation.runtime,net:a.isolation.net,run:a.isolation.run.map(l=>({name:l})),agents:a.isolation.agents,...a.hasServer!==void 0?{hasServer:a.hasServer}:{}},"data-testid":`preview-extension-reach-${a.id}`})]})]},a.id))})})}function Js({preview:e,installBase:n}){const t=ua(e,{installBase:n}),r=Object.values(t).some(a=>a.length>0);return s.jsxs("div",{className:"space-y-6",children:[r&&s.jsx("p",{className:"text-sm",children:da(e)}),s.jsx(Z,{title:"What this package will do",items:t.effects}),s.jsx(va,{extensions:e.extensions}),s.jsx(Z,{title:"Commands this package declares",items:t.commands,defaultOpen:!0}),s.jsx(Z,{title:"Jobs it will schedule",items:t.schedules,defaultOpen:!0}),s.jsx(Z,{title:"Secrets required",items:t.secrets}),s.jsx(Z,{title:"External hosts",items:t.hosts}),s.jsx(Z,{title:"Dependencies",items:t.dependencies}),s.jsx(Z,{title:"Conflicts",items:t.conflicts,tone:"warning",defaultOpen:!0})]})}function ba(e){if(typeof e=="string")return e;if(e&&typeof e=="object"&&"name"in e)return String(e.name)}function Ys(e){return e.scope===void 0||e.scope==="global"}function _e(e){var n;return Ys(e)?"All agents (global)":e.agentName??((n=e.agentPath)==null?void 0:n.split("/").filter(Boolean).pop())??"This agent"}function ya(e){if(!e)return null;const n=[];return e.commands>0&&n.push(`${e.commands} command${e.commands===1?"":"s"}`),e.skills>0&&n.push(`${e.skills} skill${e.skills===1?"":"s"}`),e.hooks&&n.push("hooks"),n.length>0?n.join(" · "):null}const Na=3e3;function wa(){return s.jsxs("div",{className:"space-y-4",children:[s.jsx(W,{className:"h-4 w-3/4"}),s.jsx(W,{className:"h-4 w-1/2"}),s.jsx(W,{className:"h-20 w-full rounded-lg"}),s.jsx(W,{className:"h-4 w-2/3"})]})}function Oe({icon:e,children:n}){return s.jsxs("div",{className:"bg-muted/50 flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs",children:[s.jsx(e,{className:"text-muted-foreground size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:n})]})}function Ca({installation:e,isRemoving:n,isConfirmingUninstall:t,disabled:r,onReinstall:a,onUninstallClick:l,published:i,onUnlink:o,onInstallPublished:d}){const u=Ys(e),c=_e(e),h=u?Ve:ks,f=e.installedAt?new Date(e.installedAt).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):null;return e.devLink?s.jsxs("div",{className:"space-y-2 rounded-lg border p-3",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2.5",children:[s.jsx(h,{className:"text-muted-foreground mt-0.5 size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:c}),s.jsx(js,{})]}),s.jsx(qs,{installation:e})]})]}),s.jsx("div",{className:"flex flex-wrap items-center justify-end gap-1",children:s.jsx(Hs,{installation:e,published:i,label:c,onUnlink:o,onInstallPublished:d,disabled:r})})]}):s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border p-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[s.jsx(h,{className:"text-muted-foreground size-4 shrink-0","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:c}),e.scope==="override"&&s.jsx("span",{className:"text-3xs shrink-0 rounded-full bg-amber-100 px-1.5 py-0.5 font-medium text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:"Overrides global"})]}),s.jsxs("div",{className:"text-muted-foreground text-xs",children:["v",e.version,f&&` · ${f}`]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsxs(C,{size:"sm",variant:"ghost",disabled:r,onClick:a,"aria-label":`Reinstall for ${c}`,children:[s.jsx(He,{className:"mr-1 size-3","aria-hidden":!0}),"Reinstall"]}),s.jsxs(C,{size:"sm",variant:t?"destructive":"ghost",disabled:r,onClick:l,"aria-label":t?`Uninstall ${c} now`:`Uninstall for ${c}`,className:t?"":"text-destructive hover:text-destructive",children:[s.jsx(vs,{className:"mr-1 size-3","aria-hidden":!0}),n?"Removing…":t?"Uninstall now":"Uninstall"]})]})]})}function Pa({installations:e,uninstallPendingFor:n,anyMutationPending:t,onReinstall:r,onUninstall:a,published:l,onUnlink:i,onInstallPublished:o}){var T,v;const[d,u]=p.useState(null);function c(x){d===x.installPath?(u(null),a(x)):(u(x.installPath),setTimeout(()=>{u(N=>N===x.installPath?null:N)},Na))}const h=e.some(x=>x.type==="shape"),f=ya((T=e.find(x=>x.provides))==null?void 0:T.provides)??(h?"a workspace layout, agents, and schedules":null),w=(v=e.find(x=>x.installedFrom))==null?void 0:v.installedFrom;return s.jsxs("section",{className:"space-y-3",children:[s.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 text-sm font-medium",children:[s.jsx(hs,{className:"size-4 shrink-0","aria-hidden":!0}),e.every(x=>x.devLink)?"Dev link":e.length===1?"Installed":`Installed in ${e.length} locations`]}),s.jsx("div",{className:"space-y-2",role:"list","aria-label":"Installations",children:e.map(x=>s.jsx("div",{role:"listitem",children:s.jsx(Ca,{installation:x,isRemoving:n===x.installPath,isConfirmingUninstall:d===x.installPath,disabled:t,onReinstall:()=>r(x),onUninstallClick:()=>c(x),published:l,onUnlink:()=>i(x),onInstallPublished:N=>o(x,N)})},x.installPath))}),s.jsxs("dl",{className:"text-muted-foreground space-y-1.5 text-xs",children:[w&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(gs,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:["from ",w]})]}),f&&s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(qe,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:["Provides ",f]})]})]})]})}function Sa(){var b;const{selectedPackageName:e,closeDetail:n}=ke(),t=Ke(),{data:r}=Ce(),a=e?(r??[]).find(y=>y.name===e)??null:null;p.useEffect(()=>{e&&r&&!r.some(y=>y.name===e)&&n()},[e,r,n]);const l=a!==null,i=(a==null?void 0:a.name)??null,{data:o,isLoading:d}=wt(i,{enabled:l}),{data:u,isLoading:c}=je(),h=a!==null?(u??[]).filter(y=>y.name===a.name):[],f=h.length>0,{data:w}=Ct(i,{enabled:f}),{data:T,isLoading:v,error:x}=Cs(i,{enabled:l&&!f&&!c}),{data:N}=fs(),$=Ks(),k=Vs(),A=d||v||l&&c,D=(T==null?void 0:T.preview)??(o==null?void 0:o.preview),E=ba((o==null?void 0:o.manifest.author)??(a==null?void 0:a.author)),M=o==null?void 0:o.manifest.version,H=o==null?void 0:o.manifest.license,U=a==null?void 0:a.homepage,R=a==null?void 0:a.marketplace;function O(y){a&&t(a,y.agentPath?{agentPath:y.agentPath,agentName:_e(y)}:void 0)}function F(y){a&&$.mutate({name:a.name,options:y.agentPath?{projectPath:y.agentPath}:void 0,where:y.agentPath?_e(y):void 0})}const _=$.isPending&&$.variables?((b=h.find(y=>{var V,j;return(y.agentPath??void 0)===((j=(V=$.variables)==null?void 0:V.options)==null?void 0:j.projectPath)}))==null?void 0:b.installPath)??null:null;return s.jsxs(Tn,{open:a!==null,onOpenChange:y=>!y&&n(),children:[s.jsx(Dn,{side:"right",className:"flex w-full flex-col overflow-hidden sm:max-w-xl",children:a&&s.jsxs(s.Fragment,{children:[s.jsxs(En,{className:"shrink-0 space-y-4 border-b pb-6",children:[s.jsxs("div",{className:"flex items-start gap-4 pr-8",children:[s.jsx("div",{className:"bg-muted flex size-14 shrink-0 items-center justify-center rounded-xl text-3xl",children:a.icon??"📦"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx(Ln,{className:"text-lg",children:be(a)}),s.jsx(xs,{type:a.type??"plugin",adapterType:a.adapterType,className:"shrink-0"})]}),a.description&&s.jsx(An,{className:"mt-1.5 line-clamp-3 text-sm",children:a.description})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[M&&s.jsxs(se,{size:"xs",variant:"outline",className:"font-mono",children:["v",M]}),E&&s.jsx(Oe,{icon:Un,children:E}),R&&s.jsx(Oe,{icon:Ve,children:R}),H&&s.jsx(Oe,{icon:yt,children:H})]}),U&&s.jsxs(On,{href:U,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1.5 text-xs transition-colors",children:[s.jsx(Fn,{className:"size-3","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:U})]})]}),s.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto px-4 py-6",children:[A?s.jsx(wa,{}):f?s.jsx(Pa,{installations:w??h,uninstallPendingFor:_,anyMutationPending:$.isPending,onReinstall:O,onUninstall:F,published:a,onUnlink:k.askUnlink,onInstallPublished:k.askInstallPublished}):x?s.jsx(Ps,{error:x}):D?s.jsxs("section",{children:[s.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"What this can do"}),s.jsx(Js,{preview:D,installBase:N==null?void 0:N.dorkHome})]}):s.jsx("p",{className:"text-muted-foreground text-sm",children:"No special permissions required."}),!A&&(o==null?void 0:o.readme)&&s.jsxs("section",{children:[s.jsx("h3",{className:"mb-3 text-sm font-semibold",children:"About"}),s.jsx(at,{content:o.readme,className:"text-sm",errorFallback:s.jsx("p",{className:"text-muted-foreground text-sm",children:"This README couldn’t be displayed."})})]})]}),s.jsxs(Mn,{className:"flex-row gap-2 border-t pt-4",children:[s.jsx(C,{variant:"ghost",onClick:n,className:"flex-1",children:"Close"}),f?s.jsx(C,{variant:"outline",disabled:$.isPending,onClick:()=>t(a),className:"flex-1",children:"Install…"}):s.jsx(C,{onClick:()=>t(a),className:"flex-1",children:"Install"})]})]})}),s.jsx(Ss,{target:k.target,onClose:k.close,onUnlinked:k.onUnlinked})]})}function ts(e,n){return e instanceof Error?`Couldn’t install ${n}: ${e.message}`:`Couldn’t install ${n}. Try again.`}function as(e,n,t){var l;const r=e.warnings.length>0?e.warnings.join(" "):void 0;return e.type==="shape"?{id:n,description:r,action:{label:"Apply…",onClick:()=>bs.getState().openShapeSwitcherToShape(e.packageName)}}:_n(e.type,(l=e.manifest)==null?void 0:l.adapterType)?{id:n,description:r,action:{label:"Open Connections",onClick:()=>t()}}:{id:n,description:r}}function $a(){const e=It(),n=zn(),{mutate:t,mutateAsync:r}=e,a=p.useCallback(i=>{const o=K(i.name),d=S.loading(`Installing ${o}…`);t(i,{onSuccess:u=>{S.success(`Installed ${o}`,as(u,d,n))},onError:u=>{S.error(ts(u,o),{id:d})}})},[t,n]),l=p.useCallback(async i=>{const o=K(i.name),d=S.loading(`Installing ${o}…`);try{const u=await r(i);return S.success(`Installed ${o}`,as(u,d,n)),u}catch(u){throw S.error(ts(u,o),{id:d}),u}},[r,n]);return{...e,mutate:a,mutateAsync:l}}function Ia(e,n){return n==="global"?e===void 0||e==="global":e==="agent-local"||e==="override"}function Ra(e){return e.isPending?e.isReinstall?"Reinstalling…":"Installing…":e.hasBlockingConflicts?"Can’t install: conflicts found":e.isReinstall?"Reinstall":"Install"}function Ta(){var V;const e=Ae(j=>j.installConfirmPackage),n=Ae(j=>j.installContext),t=Ae(j=>j.closeInstallConfirm),r=$a(),{data:a}=ys(),l=(a==null?void 0:a.agents)??[],i=(e==null?void 0:e.type)==="shape",o=n?"agent-local":"global",d=n?(V=l.find(j=>j.projectPath===n.agentPath))==null?void 0:V.id:void 0,[u,c]=p.useState(null),h=u!==null&&u.forContext===n?u:null,f=(h==null?void 0:h.scope)??o,w=h===null?d:h.agentId,T=j=>c({forContext:n,scope:j.scope??f,agentId:"agentId"in j?j.agentId:w}),v=i?"global":f,x=l.find(j=>j.id===w),N=v==="agent-local"?x==null?void 0:x.projectPath:void 0,$=v==="agent-local"&&!w,{data:k,isLoading:I,error:A}=Cs((e==null?void 0:e.name)??null,{enabled:e!==null&&!$,...N?{projectPath:N}:{}}),D=$?null:(k==null?void 0:k.preview)??null,{data:E}=fs(),M=N?`${N}/.dork`:E==null?void 0:E.dorkHome,H=D!==null&&D.conflicts.some(j=>j.level==="error"),{data:U}=je(N),R=!$&&(U??[]).some(j=>j.name===(e==null?void 0:e.name)&&Ia(j.scope,v)),O=!$&&A!==null,F=r.isPending||I||O||H||e===null||$,_=Ra({isPending:r.isPending,isReinstall:R,hasBlockingConflicts:H});async function b(){if(e)try{const j={...N&&{projectPath:N},...(k==null?void 0:k.disclosed)&&{approvedDisclosure:k.disclosed,approvedContentHash:k.contentHash}};await r.mutateAsync({name:e.name,options:Object.keys(j).length>0?j:void 0}),t()}catch{}}function y(j){j||t()}return s.jsx(Se,{open:e!==null,onOpenChange:y,children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-2xl",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0",children:[s.jsxs(Re,{children:[R?"Reinstall":"Install"," ",be(e),"?"]}),s.jsx(Te,{children:R?"This replaces the installed copy. Check what it does below.":"Check what this package does before you install it."})]}),s.jsx("div",{className:"shrink-0 space-y-2 px-4 sm:px-6",children:i?s.jsx("p",{className:"text-muted-foreground text-sm",children:"Shapes apply to your whole app."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:"Install for"}),s.jsxs(Ns,{value:f,onValueChange:j=>{const G=j;T(G==="global"?{scope:G,agentId:void 0}:{scope:G})},className:"gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{value:"global",id:"scope-global"}),s.jsx(ee,{htmlFor:"scope-global",className:"text-sm font-normal",children:"All agents (global)"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{value:"agent-local",id:"scope-agent"}),s.jsx(ee,{htmlFor:"scope-agent",className:"text-sm font-normal",children:"Specific agent"})]})]}),f==="agent-local"&&s.jsx("div",{className:"pl-6",children:s.jsx(Rs,{agents:l,value:w,onValueChange:j=>T({agentId:j})})})]})}),s.jsxs(De,{className:"mt-4",children:[$&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"Pick an agent to preview this install."}),I&&s.jsx("p",{className:"text-muted-foreground text-sm",children:"Loading preview…"}),O&&s.jsx(Ps,{error:A}),D&&s.jsx(Js,{preview:D,installBase:M})]}),s.jsxs(Ee,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:t,disabled:r.isPending,children:"Cancel"}),s.jsx(C,{onClick:b,disabled:F,children:_})]})]})})})}function Da(e){return new Map((e??[]).map(n=>[n.installPath,n]))}function rs(e){return e.startsWith("v")?e.slice(1):e}function Xs(e,n){const t=n.get(e.installPath);if(t)return t.installedVersionSource!=="package"||rs(t.installedVersion)===rs(e.version)?t:void 0}function Ea(e,n,t){const r=Xs(e,n);return t.applying.has(e.installPath)?{kind:"applying",check:r}:t.isChecking?{kind:"checking"}:r?{kind:r.status,check:r}:{kind:"unchecked"}}function La(e,n){const t={available:[],current:0,unknown:0};for(const r of e){if(r.devLink)continue;const a=Xs(r,n);(a==null?void 0:a.status)==="update-available"?t.available.push({installation:r,check:a}):(a==null?void 0:a.status)==="current"?t.current+=1:(a==null?void 0:a.status)==="unknown"&&(t.unknown+=1)}return t}const Aa=7;function X(e,n){return n==="commit"?e.slice(0,Aa):e.startsWith("v")?e:`v${e}`}function ce(e){var n;return e.scope!=="agent-local"&&e.scope!=="override"?null:e.agentName??((n=e.agentPath)==null?void 0:n.split("/").filter(Boolean).pop())??"agent"}function Ua(e){var n,t;return((t=(n=e.applied)==null?void 0:n.fileNotices)==null?void 0:t.some(r=>r.outcome==="kept-unproven"))??!1}function Zs({installation:e}){const n=K(e.name),t=ce(e);return t?`${n} on ${t}`:n}function Oa(e,n){if(n!=null&&n.applied){const t=Ms(n),r=X(t.installedVersion,t.installedVersionSource),a=n.applied.warnings??[];return{kind:"success",message:`Updated ${e} to ${r}`,...a.length>0&&{description:a.join(" ")}}}if(n!=null&&n.applyError)return{kind:"error",message:`Couldn’t update ${e}: ${n.applyError}`};if((n==null?void 0:n.status)==="current")return{kind:"success",message:`${e} is already up to date`};if((n==null?void 0:n.status)==="unknown"){const t=n.note?`: ${n.note}`:"";return{kind:"warning",message:`Couldn’t check ${e} for updates${t}`}}return{kind:"warning",message:`${e} wasn’t updated`}}function Fa(e){const n=e.length,t=e.filter(a=>a.applied).length,r=e.filter(a=>a.applyError).length;return t===n?{kind:"success",message:e.some(Ua)?`Updated ${n} packages. Some kept files need sorting; see their rows.`:`Updated ${n} packages`}:t>0?{kind:"warning",message:`Updated ${t} of ${n} packages. Each row shows why.`}:r>0?{kind:"error",message:`Couldn’t update ${r===n?`${n}`:`${r} of ${n}`} packages. Each row shows why.`}:e.every(a=>a.status==="current")?{kind:"success",message:`All ${n} packages are up to date`}:{kind:"warning",message:"Nothing was updated. Each row shows why."}}function Ma(e,n){const t=new Map(n.checks.map(r=>[r.installPath,r]));if(e.length===1){const r=e[0];return Oa(Zs(r),t.get(r.check.installPath))}return Fa(e.map(({check:r})=>t.get(r.installPath)??r))}function za(e,n){S[e.kind](e.message,{id:n,...e.description&&{description:e.description}})}const _a="batch_update_needs_approval",Ka="disclosure_changed";function Va(e,n){const t=e==null?void 0:e.code;return t===Ka?`${n.length===1?"This package":"One of these packages"} changed what it runs since you looked. Review it again.`:t===_a?n.length===1?`It needs your approval. Run \`dorkos marketplace update ${n[0].check.packageName} --apply\` in a terminal.`:"Each needs your approval. Run `dorkos marketplace update <name> --apply` in a terminal.":e instanceof Error?e.message:String(e)}function qa(){const{mutateAsync:e}=Dt(),n=p.useRef(new Set);return{apply:p.useCallback(r=>{const a=r.filter(({check:c})=>!n.current.has(c.installPath)),[l,...i]=a.map(({check:c})=>({installPath:c.installPath,latestVersion:c.latestVersion,disclosed:c.disclosed??null,contentHash:c.contentHash??""}));if(l===void 0)return;const o=a.map(({check:c})=>c.installPath);for(const c of o)n.current.add(c);const d=a.length===1?Zs(a[0]):`${a.length} packages`,u=S.loading(`Updating ${d}…`);e({targets:[l,...i]}).then(c=>za(Ma(a,c),u)).catch(c=>S.error(`Couldn’t update ${d}`,{id:u,description:Va(c,a)})).finally(()=>{for(const c of o)n.current.delete(c)})},[e])}}function Ha(){const e=Tt(),{mutate:n}=e,t=p.useCallback(({where:r,...a})=>{const l=r?`${K(a.name)} on ${r}`:K(a.name),i=S.loading(`Checking the files of ${l}…`);n(a,{onSuccess:o=>{(o.outcome==="rebuilt"||o.outcome==="not-needed"?S.success:S.warning)(o.message,{id:i})},onError:o=>{S.error(`Couldn’t check the files of ${l}: ${o.message}`,{id:i})}})},[n]);return{...e,mutate:t}}function Ba(){const e=Ut(),{mutate:n}=e,t=p.useCallback(r=>{n(r,{onSuccess:a=>{S.success(a.message)},onError:a=>{S.error(a.message)}})},[n]);return{...e,mutate:t}}function en(){const e=ae(),{data:n}=je(),t=((n==null?void 0:n.length)??0)>0,r=$t(void 0,{enabled:t}),{data:a,isFetching:l,error:i,refetch:o}=r,d=p.useRef(n);p.useEffect(()=>{const h=d.current;d.current=n,!(h===void 0||h===n)&&e.invalidateQueries({queryKey:P.updates(),refetchType:"none"})},[n,e]);const u=p.useMemo(()=>Da(i||a==null?void 0:a.checks),[a,i]),c=p.useMemo(()=>La(n??[],u),[n,u]);return{checks:u,summary:c,isChecking:l,error:i,recheck:()=>void o()}}function sn(e){const n=p.useRef(null),t=p.useRef(!1);p.useEffect(()=>{var l;if(e||!t.current)return;t.current=!1;const a=document.activeElement;(a===null||a===document.body)&&((l=n.current)==null||l.focus())},[e]);const r=p.useMemo(()=>({onFocus:()=>{t.current=!0},onBlur:a=>{a.relatedTarget!==null&&(t.current=!1)}}),[]);return{targetRef:n,controlProps:r}}function Wa(e){return e===1?"1 package is":`${e} packages are`}function Ga(e){return`${e} ${e===1?"package":"packages"}`}function Qa(e){const n=[];return e.current>0&&n.push(`${Wa(e.current)} up to date.`),e.unknown>0&&n.push(`${Ga(e.unknown)} couldn’t be checked.`),n}function Ja(e){const n=e.available.length;return n>0?{headline:`${n} ${n===1?"update":"updates"} available.`,allCurrent:!1}:e.current>0&&e.unknown===0?{headline:"All packages are up to date.",allCurrent:!0}:e.current===0&&e.unknown===0?{headline:"Not checked for updates yet.",allCurrent:!1}:{headline:"No updates found.",allCurrent:!1}}function Ya({summary:e,isChecking:n,error:t,isApplying:r,onUpdateAll:a,onRecheck:l}){const{headline:i,allCurrent:o}=Ja(e),d=o?[]:Qa(e),u=!n&&!t&&e.available.length>0,{targetRef:c,controlProps:h}=sn(u);return s.jsxs("div",{className:"bg-muted/40 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 rounded-xl px-4 py-3",children:[s.jsx("p",{ref:c,tabIndex:-1,role:"status","aria-live":"polite",className:"focus-visible:ring-ring min-w-0 rounded-sm text-sm outline-none focus-visible:ring-2",children:n?s.jsxs("span",{className:"text-muted-foreground flex items-center gap-2",children:[s.jsx(Fe,{size:"xs"}),"Checking your packages for updates…"]}):t?s.jsxs("span",{children:["Couldn’t check for updates: ",t.message]}):s.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5",children:[o&&s.jsx(ws,{className:"text-status-success-fg size-4 shrink-0","aria-hidden":!0}),s.jsx("span",{className:e.available.length>0?"font-medium":void 0,children:i}),d.map(f=>s.jsx("span",{className:"text-muted-foreground",children:f},f))]})}),!n&&s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsxs(C,{size:"sm",variant:"ghost",onClick:l,disabled:r,children:[s.jsx(He,{className:"mr-1 size-3","aria-hidden":!0}),t?"Try again":"Check again"]}),u&&s.jsx(C,{size:"sm","aria-disabled":r||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50",onClick:r?void 0:a,...h,children:"Update all…"})]})]})}const le="flex items-start gap-1.5 text-xs",ie="mt-0.5 size-3 shrink-0";function ls({text:e}){return s.jsx("p",{className:"text-muted-foreground pl-4.5 text-xs",children:e})}function Xa({state:e}){switch(e.kind){case"checking":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Fe,{size:"xs",className:ie}),"Checking for updates…"]});case"applying":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Fe,{size:"xs",className:ie}),e.check?`Updating to ${X(e.check.latestVersion,e.check.latestVersionSource)}…`:"Updating…"]});case"update-available":{const{check:n}=e,t=X(n.installedVersion,n.installedVersionSource),r=X(n.latestVersion,n.latestVersionSource);return s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("p",{className:`${le} text-status-info-fg font-medium`,children:[s.jsx(kt,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Update available: ",t," ",s.jsx("span",{"aria-hidden":!0,children:"→"}),s.jsx("span",{className:"sr-only",children:"to"})," ",r]})]}),n.note&&s.jsx(ls,{text:n.note}),n.applyError&&s.jsxs("p",{className:`${le} text-destructive`,children:[s.jsx(me,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Couldn’t update: ",n.applyError]})]})]})}case"current":return s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(ws,{className:ie,"aria-hidden":!0}),"Up to date"]}),e.check.note&&s.jsx(ls,{text:e.check.note})]});case"unknown":return s.jsxs("p",{className:`${le} text-muted-foreground`,children:[s.jsx(Kn,{className:ie,"aria-hidden":!0}),s.jsxs("span",{children:["Couldn’t check for updates",e.check.note?`: ${e.check.note}`:""]})]});case"unchecked":return null}}const Za="Check files so updates keep your edits.";function er(e,n){return e===1?`the file you ${n}`:`the ${e} files you ${n}`}function nn(e){return[e.changed.length>0&&`Updating replaces ${er(e.changed.length,"edited")} and keeps your copies beside them.`,e.added.length>0&&(e.added.length===1?"The file you added stays.":`The ${e.added.length} files you added stay.`),e.missing.length>0&&(e.missing.length===1?"The file you removed comes back.":`The ${e.missing.length} files you removed come back.`)].filter(n=>typeof n=="string")}function sr(e){if(e.changed.length>0)return"Updating replaces your edits; copies are kept.";if(e.missing.length>0)return"Updating puts back files you removed.";if(e.added.length>0)return"Updating keeps the files you added."}function nr(e){const t=[[e.changed.length,"edited"],[e.added.length,"added"],[e.missing.length,"removed"]].filter(([i])=>i>0),r=t.reduce((i,[o])=>i+o,0),a=e.truncated?"+":"",l=`${r}${a} ${r===1?"file":"files"} changed since install`;return t.length>1?`${l} (${t.map(([i,o])=>`${i} ${o}`).join(", ")})`:l}function tn(e){return(e==null?void 0:e.status)==="unknown"&&(e.reason==="no-record"||e.reason==="inferred")}function tr(e){var r,a;const n=tn(e)?e.check:(e==null?void 0:e.status)==="clean"||(e==null?void 0:e.status)==="modified"?(r=e.unproven)==null?void 0:r.check:void 0;if(!n||n.source==="local")return!1;const t=(a=n.last)==null?void 0:a.outcome;return t!=="mismatch"&&t!=="no-source"}function ar(e){var n;return e.check.source==="local"||((n=e.check.last)==null?void 0:n.outcome)==="fetch-failed"}function ne({title:e,paths:n}){return n.length===0?null:s.jsxs("div",{children:[s.jsx("p",{className:"text-3xs font-medium tracking-wide uppercase",children:e}),s.jsx("ul",{"aria-label":e,className:"mt-0.5 space-y-0.5",children:n.map(t=>s.jsx("li",{className:"font-mono text-xs [overflow-wrap:anywhere]",children:t},t))})]})}function rr({unproven:e,label:n,onKeepFiles:t}){const r=e.files.length,a=e.running,l=a.length>0,i=e.check.source==="local",o=e.files.filter(d=>!a.includes(d));return s.jsxs("details",{"data-testid":"installation-integrity-unproven","data-runs":l?"true":"false",className:"group/kept mt-1 text-xs",children:[s.jsxs("summary",{className:oe("focus-ring flex cursor-pointer list-none items-start gap-1 rounded-sm select-none [&::-webkit-details-marker]:hidden",l?"text-amber-700 hover:text-amber-800 dark:text-amber-400 dark:hover:text-amber-300":"text-muted-foreground hover:text-foreground"),children:[s.jsx(Ts,{className:"mt-0.5 size-3 shrink-0 text-amber-600 dark:text-amber-400","aria-hidden":!0}),s.jsxs("span",{children:["Kept ",r," ",r===1?"file":"files"," an update couldn’t sort.",l&&` ${a.length} of ${r===1?"it":"them"} still ${a.length===1?"runs":"run"}.`]}),s.jsx(Pe,{className:"mt-0.5 size-3 shrink-0 transition-transform duration-200 group-open/kept:rotate-90","aria-hidden":!0})]}),s.jsxs("div",{className:"text-muted-foreground mt-1.5 space-y-1.5 pl-4",children:[s.jsx("p",{children:"Unclear if these are yours or leftovers, so DorkOS kept them."}),s.jsx("p",{children:i?"Keep them as yours, or delete any you don’t need.":"Check files sets aside the leftovers and keeps yours."}),e.check.last&&s.jsx("p",{children:e.check.last.message}),s.jsx(ne,{title:"Still runs",paths:a}),s.jsx(ne,{title:"Kept",paths:o}),t&&ar(e)&&s.jsx(C,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",onClick:t,"aria-label":`Keep the files ${n??"this package"} kept as mine`,children:"Keep these as mine"})]})]})}function lr(e){const{integrity:n}=e,t=(n==null?void 0:n.status)==="clean"||(n==null?void 0:n.status)==="modified"?n.unproven:void 0;return t?s.jsxs(s.Fragment,{children:[s.jsx(is,{...e}),s.jsx(rr,{unproven:t,label:e.label,onKeepFiles:e.onKeepFiles})]}):s.jsx(is,{...e})}function is({integrity:e,updateAvailable:n,label:t,onCheckFiles:r,isCheckingFiles:a=!1}){var l,i;if((e==null?void 0:e.status)==="modified"){const o=n?nn(e):[],d=n?sr(e):void 0;return s.jsxs("details",{"data-testid":"installation-integrity",className:"group/files mt-1 text-xs",children:[s.jsxs("summary",{className:"text-muted-foreground hover:text-foreground focus-ring flex cursor-pointer list-none items-start gap-1 rounded-sm select-none [&::-webkit-details-marker]:hidden",children:[s.jsx(ft,{className:"text-status-warning-dot mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{className:"flex flex-col",children:[s.jsxs("span",{children:[nr(e),"."]}),d&&s.jsx("span",{"data-testid":"installation-integrity-update",children:d})]}),s.jsx(Pe,{className:"mt-0.5 size-3 shrink-0 transition-transform duration-200 group-open/files:rotate-90","aria-hidden":!0})]}),s.jsxs("div",{className:"text-muted-foreground mt-1.5 space-y-1.5 pl-4",children:[o.map(u=>s.jsx("p",{children:u},u)),s.jsx(ne,{title:"Edited",paths:e.changed}),s.jsx(ne,{title:"Added",paths:e.added}),s.jsx(ne,{title:"Removed",paths:e.missing}),e.truncated&&s.jsx("p",{children:"Showing the first 50 of each."})]})]})}if(tn(e)){const o=((l=e.check)==null?void 0:l.source)==="local",d=(i=e.check)==null?void 0:i.last,u=o?"Installed from a folder by an older DorkOS. Reinstall so updates keep your edits.":d?d.message:`Installed by an older DorkOS. ${Za}`,c=!o&&(d==null?void 0:d.outcome)==="mismatch"&&r;return s.jsxs("p",{"data-testid":"installation-integrity",className:"text-muted-foreground mt-1 flex items-start gap-1 text-xs",children:[s.jsx(Ts,{className:"text-status-warning-dot mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsxs("span",{children:[u,c&&s.jsxs(s.Fragment,{children:[" ",s.jsx("button",{type:"button",onClick:r,disabled:a,"aria-label":`Check the files of ${t??"this package"} again`,className:"text-foreground focus-ring rounded-sm underline underline-offset-2 disabled:opacity-50",children:a?"Checking…":"Try again"})]})]})]})}return null}function os(e){if(e.length!==1)return`${e.length} packages`;const[{installation:n}]=e,t=ce(n),r=K(n.name);return t?`${r} on ${t}`:r}function an({check:e}){return e.disclosed?fa(e.disclosed,e.installedDisclosed,e.scope==="global"?"global":"project"):[]}function ir(e){const n=e.map(an),t=n.filter(i=>i.length>0).length,r=n.filter(i=>i.some(o=>o.change==="new"||o.change==="changed")).length,a=e.length===1?t===1?"The new version runs things on its own":"The new version runs nothing on its own":`${t} of ${e.length} run things on their own`;if(r===0)return a;const l=e.length===1?"it adds or changes something":`${r} ${r===1?"adds":"add"} or ${r===1?"changes":"change"} something`;return`${a} · ${l}`}function or({change:e}){return e!=="new"&&e!=="changed"?null:s.jsx(se,{variant:"outline",className:"text-3xs shrink-0 border-amber-500/60 text-amber-700 dark:text-amber-300",children:e==="new"?"New":"Changed"})}function cs({row:e,change:n,previous:t}){return s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("ul",{children:s.jsx(ge,{item:e})}),t&&s.jsxs("div",{className:"mt-1 pl-6 opacity-70",children:[s.jsx("p",{className:"text-muted-foreground text-3xs mb-0.5 font-medium tracking-wide uppercase",children:"Installed now"}),s.jsx("ul",{"aria-label":"What the installed version runs instead",children:s.jsx(ge,{item:{...t,description:void 0,details:void 0}})})]})]}),s.jsx(or,{change:n})]})}function cr(e){const n=an(e);if(n.length===0)return s.jsx("p",{className:"text-muted-foreground text-xs",children:"The new version runs nothing on its own."});const t=n.filter(a=>a.change!=="unchanged"),r=n.filter(a=>a.change==="unchanged");return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("p",{className:"text-muted-foreground text-xs",children:["The new version runs ",n.length===1?"this":`these ${n.length}`," on its own:"]}),s.jsxs("div",{role:"list","aria-label":"What the new version runs",className:"space-y-2",children:[t.map((a,l)=>s.jsx("div",{role:"listitem",children:s.jsx(cs,{...a})},`lead-${l}`)),r.length>0&&s.jsxs("details",{className:"group/unchanged",role:"listitem",children:[s.jsxs("summary",{className:"text-muted-foreground hover:text-foreground focus-ring inline-flex cursor-pointer list-none items-center gap-1 rounded-sm text-xs select-none [&::-webkit-details-marker]:hidden",children:[s.jsx(Pe,{className:"size-3 shrink-0 transition-transform duration-200 group-open/unchanged:rotate-90"}),r.length," unchanged"]}),s.jsx("div",{className:"mt-2 space-y-2",children:r.map((a,l)=>s.jsx(cs,{...a},`same-${l}`))})]})]})]})}function dr({integrity:e,...n}){const{installation:t,check:r}=n,a=ce(t),l=X(r.installedVersion,r.installedVersionSource),i=X(r.latestVersion,r.latestVersionSource);return s.jsxs("li",{className:"bg-muted/40 space-y-2 rounded-lg px-3 py-2",children:[s.jsxs("div",{className:"flex items-start justify-between gap-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:K(t.name)}),s.jsx("div",{className:"text-muted-foreground text-xs",children:a??"All agents"}),a&&t.agentPath&&s.jsx("div",{className:"text-muted-foreground text-2xs font-mono [overflow-wrap:anywhere]",children:Qs(t.agentPath)})]}),s.jsxs("div",{className:"shrink-0 font-mono text-xs",children:[l," ",s.jsx("span",{"aria-hidden":!0,children:"→"}),s.jsx("span",{className:"sr-only",children:"to"})," ",i]})]}),(e==null?void 0:e.status)==="modified"&&nn(e).map(o=>s.jsx("p",{className:"text-muted-foreground text-xs",children:o},o)),s.jsx(cr,{...n})]})}function ur({stale:e,onCancel:n,onConfirm:t,integrityByPath:r}){return s.jsx(Se,{open:e!==null,onOpenChange:a=>!a&&n(),children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-xl",children:e&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsxs(Re,{className:"text-left",children:["Update ",os(e),"?"]}),s.jsx(Te,{className:"text-left",children:e.length===1?"The newest version replaces this one in place. Check what it runs first.":"Each newest version replaces the one installed. Check what each runs first."}),s.jsx("p",{className:"text-foreground text-left text-xs font-medium","data-testid":"update-disclosure-summary",children:ir(e)})]}),s.jsx(De,{children:s.jsx("ul",{"aria-label":"Packages to update",className:"space-y-2",children:e.map(a=>s.jsx(dr,{...a,integrity:r==null?void 0:r.get(a.installation.installPath)},a.check.installPath))})}),s.jsxs(Ee,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:n,children:"Cancel"}),s.jsxs(C,{onClick:()=>t(e),children:["Update ",os(e)]})]})]})})})}function mr(e){return e!==null&&e.heldBack!==void 0&&(e.scope===void 0||e.scope==="global")}function hr({installation:e,unproven:n,onCancel:t,onConfirm:r}){var T;const a=mr(e),l=At(a),i=a?(T=l.data)==null?void 0:T.find(v=>v.name===(e==null?void 0:e.name)):void 0,o=i!=null&&i.effects&&i.bindsTo?{effects:i.effects,bindsTo:i.bindsTo}:void 0,d=a&&l.isPending,u=e!==null&&n!==void 0,c=e?K(e.name):"",h=(n==null?void 0:n.running)??[],f=(n==null?void 0:n.files.filter(v=>!h.includes(v)))??[],w=o?Be(o.effects,"global"):[];return s.jsx(Se,{open:u,onOpenChange:v=>!v&&t(),children:s.jsx($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-lg",children:u&&e&&n&&s.jsxs(s.Fragment,{children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsxs(Re,{className:"text-left",children:["Keep these ",c," files as yours?"]}),s.jsx(Te,{className:"text-left",children:"An update couldn’t tell if these are yours or leftovers."})]}),s.jsxs(De,{className:"space-y-3 text-xs",children:[s.jsxs("div",{className:"text-muted-foreground space-y-1",children:[s.jsx("p",{children:n.check.source==="local"?"No earlier version to compare with.":"DorkOS couldn’t download the old version to compare."}),s.jsx("p",{children:"Keeping makes them yours. Updates leave them alone."}),s.jsx("p",{children:"Nothing is moved or deleted."}),h.length>0&&s.jsx("p",{children:"They now run as your own files."})]}),s.jsx(ne,{title:"Still runs",paths:h}),s.jsx(ne,{title:"Kept",paths:f}),a&&s.jsx("div",{"data-testid":"keep-files-activation",className:"space-y-1.5",children:d?s.jsxs("p",{className:"text-muted-foreground",children:["Reading what ",c," runs…"]}):o?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"text-foreground font-medium",children:[c," is held back from chats."]}),s.jsx("p",{className:"text-foreground",children:"Keeping also lets it run in every chat, as it is now:"}),s.jsx("ul",{"aria-label":`What ${c} runs`,className:"space-y-1.5",children:w.map((v,x)=>s.jsx(ge,{item:v},x))})]}):s.jsxs("p",{className:"text-muted-foreground",children:[c," stays held back until you review it."]})})]}),s.jsxs(Ee,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:t,children:"Cancel"}),s.jsx(C,{disabled:d,onClick:()=>r({installRoot:e.installPath,keepKey:n.keepKey,...e.agentPath&&{projectPath:e.agentPath},...o&&{review:o}}),children:o?"Keep them and let it run":"Keep them as mine"})]})]})})})}const pr="dev_link_changed",fe={card:null,refusal:null,checking:!1};function ds(e){const n=e;return{message:(n==null?void 0:n.message)||"Couldn’t check this folder. Try again.",code:n==null?void 0:n.code}}function fr({open:e,onOpenChange:n}){var z;const[t,r]=p.useState(""),[a,l]=p.useState("global"),[i,o]=p.useState(void 0),[d,u]=p.useState(!1),[c,h]=p.useState(fe),[f,w]=p.useState(!1),[T,v]=p.useState(null),[x,N]=p.useState(null),[$,k]=p.useState(!1),I=p.useRef(0),A=ut(),D=mt(),{data:E}=ys({enabled:e}),M=(E==null?void 0:E.agents)??[],H=a==="agent-local"?(z=M.find(g=>g.id===i))==null?void 0:z.projectPath:void 0,U=a==="agent-local"&&H===void 0;function R(){I.current+=1,n(!1)}async function O(g){const q=(g.path??t).trim(),Q="projectPath"in g?g.projectPath:H,J=g.replaceInstalled??!1;u(J),N(null),v(null),g.keepChangedNotice||w(!1);const he=++I.current,rn=!("projectPath"in g)&&U;if(q===""||rn){h(fe);return}h(pe=>({card:g.keepCard?pe.card:null,refusal:null,checking:!0}));try{const pe=await A.mutateAsync({path:q,...Q?{scope:"project",projectPath:Q}:{scope:"global"},...J&&{replaceInstalled:!0}});if(he!==I.current)return;h({card:{preview:pe,replaceInstalled:J,projectPath:Q},refusal:null,checking:!1})}catch(pe){if(he!==I.current)return;h({card:null,refusal:ds(pe).message,checking:!1})}}function F(g){c.card&&O({path:c.card.preview.path,projectPath:c.card.projectPath,replaceInstalled:g,keepCard:!0})}async function _(){if(!c.card||c.checking)return;N(null);const{preview:g,replaceInstalled:q,projectPath:Q}=c.card;try{const J=await D.mutateAsync({path:g.path,...Q?{scope:"project",projectPath:Q}:{scope:"global"},...q&&{replaceInstalled:!0},via:"app",expectedChange:g.change});if(J.status==="approval_required"){v(J.approval);return}S.success(`${K(g.name)} runs from your folder.`),R()}catch(J){const he=ds(J);if(he.code===pr){w(!0),await O({path:g.path,projectPath:Q,replaceInstalled:q,keepChangedNotice:!0});return}N(he.message)}}const b=c.card,y=(b==null?void 0:b.preview.replaces)??null,V=b?K(b.preview.name):"",j=b!=null&&b.preview.effects?Be(b.preview.effects,b.projectPath?"project":"global"):[],G=(b==null?void 0:b.preview.extensions)??[],m=y===null||d&&(b==null?void 0:b.replaceInstalled)===!0,L=b===null||c.checking||!m||D.isPending||T!==null;return s.jsxs(Se,{open:e,onOpenChange:g=>g?n(!0):R(),children:[s.jsxs($e,{className:"max-h-[85vh] !min-h-0 sm:max-w-lg",children:[s.jsxs(Ie,{className:"shrink-0 text-left",children:[s.jsx(Re,{className:"text-left",children:b?`Run ${V} from this folder?`:"Link a folder"}),s.jsx(Te,{className:"text-left",children:"Run a plugin or skill pack from your own folder."})]}),s.jsxs(De,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(ee,{htmlFor:"dev-link-path",children:"Folder"}),s.jsx(xt,{id:"dev-link-path",value:t,placeholder:"/Users/you/code/my-plugin",onChange:g=>{r(g),c!==fe&&(I.current+=1,h(fe),u(!1))},onBlur:()=>void O({}),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),O({}))},onBrowse:()=>k(!0),browseTestId:"dev-link-browse","aria-describedby":c.refusal?"dev-link-refusal":void 0,"aria-invalid":c.refusal?!0:void 0,autoComplete:"off",spellCheck:!1}),c.refusal&&s.jsx("p",{id:"dev-link-refusal",role:"alert",className:"text-status-warning-fg text-xs [overflow-wrap:anywhere]",children:c.refusal}),s.jsx("p",{className:"text-muted-foreground text-xs empty:hidden","aria-live":"polite",children:c.checking?"Checking the folder…":""})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-muted-foreground text-3xs font-medium tracking-wider uppercase",children:"Run for"}),s.jsxs(Ns,{value:a,onValueChange:g=>{const q=g;l(q),q==="global"?(o(void 0),O({projectPath:void 0})):(I.current+=1,h(fe),u(!1))},className:"gap-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{value:"global",id:"dev-link-scope-global"}),s.jsx(ee,{htmlFor:"dev-link-scope-global",className:"text-sm font-normal",children:"All agents (global)"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ye,{value:"agent-local",id:"dev-link-scope-agent"}),s.jsx(ee,{htmlFor:"dev-link-scope-agent",className:"text-sm font-normal",children:"Specific agent"})]})]}),a==="agent-local"&&s.jsx("div",{className:"pl-6",children:s.jsx(Rs,{agents:M,value:i,onValueChange:g=>{var q;o(g),O({projectPath:(q=M.find(Q=>Q.id===g))==null?void 0:q.projectPath})}})}),U&&t.trim()!==""&&s.jsx("p",{className:"text-muted-foreground text-xs",children:"Pick an agent to check this folder."})]}),f&&s.jsx(Me,{tone:"info",role:"alert",children:"The folder changed. Check it again."}),b&&s.jsxs("section",{"aria-label":"What linking does",className:"space-y-3 text-sm",children:[s.jsx("code",{className:"bg-muted block rounded px-2 py-1.5 font-mono text-xs [overflow-wrap:anywhere]",children:b.preview.path}),s.jsx("p",{children:"Edits here run in DorkOS right away, without asking."}),y&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{children:["Your installed copy (v",y.version,") is set aside, not deleted."]}),s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Vn,{id:"dev-link-replace",checked:d,onCheckedChange:g=>{c.checking||F(g===!0)},"aria-disabled":c.checking||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50"}),s.jsx(ee,{htmlFor:"dev-link-replace",className:"text-sm leading-snug font-normal",children:"Use my folder instead of the installed copy"})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"font-medium",children:"It runs:"}),j.length===0&&G.length===0?s.jsx("p",{className:"text-muted-foreground",children:"Nothing on its own."}):s.jsxs("ul",{"aria-label":`What ${V} runs`,className:"space-y-1.5",children:[G.map(g=>s.jsxs("li",{className:"text-sm [overflow-wrap:anywhere]",children:["Extension ",g]},g)),j.map((g,q)=>s.jsx(ge,{item:g},q))]})]})]}),T&&s.jsx(Me,{tone:"info",role:"status",children:"Approve it where DorkOS asks. This dialog can close."}),x&&s.jsx("p",{role:"alert",className:"text-status-warning-fg text-xs [overflow-wrap:anywhere]",children:x})]}),s.jsxs(Ee,{className:"shrink-0",children:[s.jsx(C,{variant:"ghost",onClick:R,disabled:D.isPending,children:"Cancel"}),s.jsx(C,{onClick:()=>void _(),disabled:L,children:D.isPending?"Linking…":"Link folder"})]})]}),$&&s.jsx(qn,{open:!0,onOpenChange:k,initialPath:t.trim()||null,onSelect:g=>{r(g),k(!1),O({path:g})}})]})}function xr({heldBack:e,label:n,onReviewClick:t,isRaisingReview:r}){return s.jsxs("div",{className:"text-status-warning-fg mt-1.5 flex flex-col items-start gap-1.5 text-xs sm:flex-row sm:gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[s.jsx(Hn,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:e.note})]}),e.reviewable&&s.jsx(C,{size:"sm",variant:"outline",className:"ml-5 h-6 shrink-0 px-2 text-xs sm:ml-0",onClick:t,disabled:r,"aria-label":`Review ${n}`,children:r?"Asking…":"Review"})]})}function gr({state:e,label:n,onClick:t,focusProps:r}){if(e.kind!=="update-available"&&e.kind!=="applying")return null;const a=e.kind==="applying",{check:l}=e,i=l&&X(l.installedVersion,l.installedVersionSource),o=l&&X(l.latestVersion,l.latestVersionSource);return s.jsxs(C,{size:"sm",variant:"outline","aria-disabled":a||void 0,className:"aria-disabled:cursor-not-allowed aria-disabled:opacity-50",onClick:a?void 0:t,"aria-label":a?`Updating ${n}`:`Update ${n} from ${i} to ${o}`,...r,children:[s.jsx(He,{className:`mr-1 size-3 ${a?"animate-spin motion-reduce:animate-none":""}`,"aria-hidden":!0}),a?"Updating…":`Update to ${o}`]})}function kr(e){return(e==null?void 0:e.status)==="clean"||(e==null?void 0:e.status)==="modified"?e.unproven:void 0}function jr({installation:e,isActiveShape:n,isConfirmingUninstall:t,isUninstalling:r,updateState:a,integrity:l,isCheckingFiles:i,onCheckFilesClick:o,onKeepFilesClick:d,onApplyClick:u,onUpdateClick:c,onUninstallClick:h,onReviewClick:f,isRaisingReview:w,published:T,onUnlinkClick:v,onInstallPublishedClick:x}){const{name:N,version:$,type:k,scope:I,installedFrom:A,installedAt:D,adapterType:E}=e,M=e.dependencyWarnings??[],H=k==="shape",U=e.devLink!==void 0,R=K(N),O=D?new Date(D).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"}):null,F=ce(e),_=F?`${R} on ${F}`:R,{targetRef:b,controlProps:y}=sn(a.kind==="update-available"||a.kind==="applying");return s.jsxs("div",{className:"bg-card flex flex-col gap-3 rounded-xl border p-4 @2xl:flex-row @2xl:items-center @2xl:justify-between @2xl:gap-4 @2xl:p-6",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold",children:R}),s.jsx(xs,{type:k,adapterType:E}),U&&s.jsx(js,{}),e.heldBack&&s.jsx(se,{variant:"outline",className:"border-amber-500/60 text-amber-700 dark:text-amber-300",children:"Held back"}),n&&s.jsx(se,{variant:"secondary",children:"Active"}),s.jsxs(se,{variant:"outline",className:"font-mono",children:["v",$]}),I==="agent-local"&&s.jsx("span",{className:"text-3xs rounded-full bg-blue-100 px-1.5 py-0.5 font-medium text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:"Local"}),I==="override"&&s.jsx("span",{className:"text-3xs rounded-full bg-amber-100 px-1.5 py-0.5 font-medium text-amber-700 dark:bg-amber-900 dark:text-amber-300",children:"Overrides global"})]}),s.jsxs("div",{className:"text-muted-foreground flex flex-wrap items-center gap-x-3 gap-y-0.5 text-xs",children:[F&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ks,{className:"size-3","aria-hidden":!0}),F]}),A&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(gs,{className:"size-3","aria-hidden":!0}),A]}),O&&s.jsxs("span",{children:["Installed ",O]})]}),U?s.jsx(qs,{installation:e}):s.jsx("div",{ref:b,tabIndex:-1,"data-testid":"installation-update-status",className:"focus-visible:ring-ring mt-1.5 rounded-sm outline-none focus-visible:ring-2",children:s.jsx(Xa,{state:a})}),e.heldBack&&s.jsx(xr,{heldBack:e.heldBack,label:_,onReviewClick:f,isRaisingReview:w}),!U&&s.jsx(lr,{integrity:l,updateAvailable:a.kind==="update-available"||a.kind==="applying",label:_,onCheckFiles:o,isCheckingFiles:i,onKeepFiles:d}),M.length>0&&s.jsx("div",{className:"mt-1 space-y-0.5",children:M.map(V=>s.jsxs("p",{className:"text-status-warning-fg flex items-start gap-1 text-xs",children:[s.jsx(me,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{children:V})]},V))})]}),s.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2",children:[H&&!n&&s.jsxs(C,{size:"sm",variant:"outline",onClick:u,"aria-label":`Apply ${R}`,children:[s.jsx(Qn,{className:"mr-1 size-3","aria-hidden":!0}),"Apply…"]}),U&&s.jsx(Hs,{installation:e,published:T,label:_,onUnlink:v,onInstallPublished:x}),!U&&tr(l)&&s.jsxs(C,{size:"sm",variant:"outline",onClick:o,disabled:i,"aria-label":i?`Checking the files of ${_}`:`Check the files of ${_}`,children:[s.jsx(jt,{className:"mr-1 size-3","aria-hidden":!0}),i?"Checking…":"Check files"]}),!U&&s.jsx(gr,{state:a,label:_,onClick:c,focusProps:y}),!U&&s.jsxs(C,{size:"sm",variant:t?"destructive":"ghost",onClick:h,disabled:r,"aria-label":t?`Uninstall ${R}${F?` from ${F}`:""} now`:`Uninstall ${R}${F?` from ${F}`:""}`,className:t?"":"text-destructive hover:text-destructive",children:[s.jsx(vs,{className:"mr-1 size-3","aria-hidden":!0}),r?"Removing…":t?"Uninstall now":"Uninstall"]})]})]})}const vr=3e3;function br(){var G;const{data:e,isLoading:n,error:t,refetch:r}=je(),{data:a}=Bn(),l=(G=a==null?void 0:a.find(m=>m.active))==null?void 0:G.name,i=bs(m=>m.openShapeSwitcherToShape),o=Ks(),d=en(),u=Et(),{apply:c}=qa(),h=Lt(),{data:f}=Pt(),w=Ha(),T=Ba(),[v,x]=p.useState(null),[N,$]=p.useState(null),[k,I]=p.useState(null),[A,D]=p.useState(!1),E=Vs(),{data:M}=$s(),H=(e??[]).some(m=>m.devLink&&!m.devLink.parked),{data:U}=Ce(void 0,{enabled:H}),R=m=>s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"flex justify-end",children:s.jsxs(C,{size:"sm",variant:"outline",onClick:()=>D(!0),children:[s.jsx(Gn,{className:"mr-1 size-3","aria-hidden":!0}),"Link a folder"]})}),(M==null?void 0:M.registryUnreadable)&&s.jsx(Me,{tone:"error",children:"Dev links can’t be read right now."}),m,A&&s.jsx(fr,{open:!0,onOpenChange:D}),s.jsx(Ss,{target:E.target,onClose:E.close,onUnlinked:E.onUnlinked})]});if(n)return R(s.jsx(zs,{count:3}));if(t)return R(s.jsx(_s,{error:t,onRetry:()=>void r()}));if(!e||e.length===0)return R(s.jsx(xe,{title:"No packages installed",description:"Browse the marketplace to find one."}));function O(m){N===m.installPath?(o.mutate({name:m.name,options:{purge:!1,...m.agentPath&&{projectPath:m.agentPath}},where:ce(m)??void 0}),$(null)):($(m.installPath),setTimeout(()=>{$(L=>L===m.installPath?null:L)},vr))}function F(m){h.mutate(m.name,{onSuccess:()=>S.info(`Review ${K(m.name)} on the approval card`,{description:"It stays held back until you allow it."}),onError:L=>S.error(`Couldn’t ask about ${K(m.name)}`,{description:L.message})})}function _(m){I(null),c(m)}function b(m){w.mutate({name:m.name,options:{installRoot:m.installPath,...m.agentPath&&{projectPath:m.agentPath}},where:ce(m)??void 0})}function y(m){var L,z,g;return w.isPending&&((L=w.variables)==null?void 0:L.name)===m.name&&(((g=(z=w.variables)==null?void 0:z.options)==null?void 0:g.installRoot)??m.installPath)===m.installPath}function V(m){var z;const L=o.variables;return o.isPending&&(L==null?void 0:L.name)===m.name&&(((z=L==null?void 0:L.options)==null?void 0:z.projectPath)??void 0)===(m.agentPath??void 0)}const j={isChecking:d.isChecking,applying:u};return R(s.jsxs(s.Fragment,{children:[s.jsx(Ya,{summary:d.summary,isChecking:d.isChecking,error:d.error,isApplying:u.size>0,onUpdateAll:()=>I(d.summary.available),onRecheck:d.recheck}),s.jsx("div",{className:"@container space-y-3",role:"list","aria-label":"Installed packages",children:e.map(m=>{const L=Ea(m,d.checks,j);return s.jsx("div",{role:"listitem",children:s.jsx(jr,{installation:m,isActiveShape:m.type==="shape"&&m.name===l,isConfirmingUninstall:N===m.installPath,isUninstalling:V(m),updateState:L,integrity:f==null?void 0:f.get(m.installPath),isCheckingFiles:y(m),onCheckFilesClick:()=>b(m),onKeepFilesClick:()=>x(m),onApplyClick:()=>i(m.name),onUpdateClick:()=>{if(L.kind!=="update-available")return;const z={installation:m,check:L.check};Wn(L.check.disclosed)?I([z]):c([z])},onUninstallClick:()=>O(m),onReviewClick:()=>F(m),isRaisingReview:h.isPending&&h.variables===m.name,published:U==null?void 0:U.find(z=>z.name===m.name),onUnlinkClick:()=>E.askUnlink(m),onInstallPublishedClick:z=>E.askInstallPublished(m,z)})},m.installPath)})}),s.jsx(ur,{stale:k,integrityByPath:f,onCancel:()=>I(null),onConfirm:_}),s.jsx(hr,{installation:v,unproven:v?kr(f==null?void 0:f.get(v.installPath)):void 0,onCancel:()=>x(null),onConfirm:m=>{v&&T.mutate({name:v.name,options:m}),x(null)}})]}))}function Or(){const{view:e,setView:n}=ke(),t=en().summary.available.length;return s.jsxs("div",{className:"space-y-8",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx(Jn,{children:"Marketplace"}),s.jsx("p",{className:"text-muted-foreground text-sm",children:e==="installed"?"Everything you’ve installed.":"Packages for your agents and for DorkOS."})]}),s.jsx(et,{value:e,onValueChange:r=>n(r),children:s.jsxs(st,{"aria-label":"Marketplace view",children:[s.jsx(Ye,{value:"browse",children:"Browse"}),s.jsxs(Ye,{value:"installed",children:["Installed",t>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{"aria-hidden":!0,className:"bg-status-info-bg text-status-info-fg text-2xs ml-1.5 rounded-full px-1.5 font-medium tabular-nums",children:t}),s.jsxs("span",{className:"sr-only",children:[", ",t," ",t===1?"update":"updates"," available"]})]})]})]})})]}),e==="installed"?s.jsx("section",{"aria-label":"Installed packages",children:s.jsx(br,{})}):s.jsxs(s.Fragment,{children:[s.jsx(zt,{}),s.jsx(Yn,{}),s.jsx("section",{"aria-label":"All packages",children:s.jsx(Xt,{})})]}),s.jsx(Sa,{}),s.jsx(Ta,{})]})}export{br as I,Or as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./index-_8SHxs8S.js";import{P as m}from"./ProfileFields-EgcVDViF.js";import"./profile-errors-Lfs66dvr.js";import"./use-mounted-ref-Vm8D40hS.js";function a({member:r}){return o.jsx(m,{member:r})}export{a as NamePage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bh as j,fv as F,fw as H,aW as x,r as g,ca as P,ce as B,cm as w,fx as G,a1 as D,a2 as K,b$ as M,bW as W,fy as Y,z as q,bi as z,j as i,en as N,I as R,B as A}from"./index-_8SHxs8S.js";import{d as Q,c as U,n as V,h as $}from"./profile-errors-Lfs66dvr.js";import{u as J}from"./use-mounted-ref-Vm8D40hS.js";import{u as L,F as k}from"./ProfileFields-EgcVDViF.js";function X(e){return{name:e.displayName.trim()===""||e.displayName===j,handle:!e.handle}}function de(e){const r=X(e);return r.name||r.handle}function Z(e,r){var t,s,d;const a=(d=(s=(t=e.person)==null?void 0:t.email)==null?void 0:s.split("@")[0])==null?void 0:d.trim();if(!a)return"";const o=new Set([...F,...r.filter(l=>l.id!==e.id&&l.handle).map(l=>l.handle.toLowerCase())]);return H(a,o)??""}function ue(){const e=x(a=>a.setRightPanelOpen),r=x(a=>a.setActiveRightPanelTab);g.useEffect(()=>{const a=o=>{if((o.metaKey||o.ctrlKey)&&o.shiftKey&&o.key==="A"){o.preventDefault();const{rightPanelOpen:t,activeRightPanelTab:s}=x.getState();t&&s===P?e(!1):(r(P),e(!0))}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[e,r])}const ee="agent-hub",te={sessions:"sessions",tasks:"tasks",tools:"tools",channels:"rooms",config:null,toolkit:null,identity:null,overview:null,profile:null,personality:null};function ae(e){return(typeof e=="string"?te[e]:null)??void 0}const I=new Set(["identity","personality","channels","tools"]);function ne(){var n;const e=w(),r=D(),a=K({queryKey:["profile-location",e.profileRef],queryFn:()=>r.getSessionLocation(e.profileRef),enabled:!!e.profileRef}),o=M(m=>m.openProfileDockedFromLink),t=x(m=>m.requestRightPanel),s=x(m=>m.setExplicitAgentPath),d=W(),l=e.panel===P,c=e.agentPath??((n=a.data)==null?void 0:n.cwd)??null,u=Y(e.profilePage)??void 0,h=g.useRef(null);g.useEffect(()=>{!l&&c&&h.current!==c&&(h.current=c,s(c))},[l,c,s]);const f=g.useRef(new Map);g.useEffect(()=>{if(!l){f.current.clear();return}if(e.profileRef&&!c)return;const m=c??d;if(m){const p=f.current.get(m);if(p!==void 0&&(u===void 0||p.has(u)))return;f.current.set(m,(p??new Set).add(u??"")),o(m,u);return}t(P,null)},[l,e.profileRef,c,d,u,o,t])}function se(){const e=w(),r=G(),a=D(),o=e.panel===ee,t=e.dialog==="agent"||!!e.agent&&I.has(e.agent),s=o||t,d=o?e.hubTab:e.agent;g.useEffect(()=>{if(!s&&!e.agentPath||!r)return;let l=!1;return(async()=>{const u=e.profileRef??(e.agentPath?(await a.createSessionLocation(e.agentPath)).id:void 0);if(l)return;const h=ae(d);r({search:f=>{const n={...f};return e.dialog==="agent"&&delete n.dialog,typeof n.agent=="string"&&I.has(n.agent)&&delete n.agent,u&&(n.profileRef=u,delete n.agentPath),s&&(delete n.hubTab,n.panel=P,h?n.profilePage=h:delete n.profilePage),n},replace:!0})})().catch(()=>{}),()=>{l=!0}},[s,e.dialog,e.agentPath,e.profileRef,d,r,a])}function fe(){se(),ne(),B()}function re(){var S,b;const r=((S=q().data)==null?void 0:S.members)??[],a=r.find(y=>y.isSelf),o=J(),t=Q({isShownInline:()=>o.current}),s=U({isShownInline:()=>o.current}),[d,l]=g.useState(!1),c=!a||a.displayName===j?"":a.displayName,u=(a==null?void 0:a.handle)??"",[h,f]=L(c),[n,m]=L(a?u||Z(a,r):""),p=h.trim(),v=n.trim(),E=a?z(a):null,T=p.length>0&&(p!==c||E!==null),C=t.isError&&t.variables===p?V(t.error):null,O=s.isError&&((b=s.variables)==null?void 0:b.handle)===v?$(s.error,v):null,_=async()=>{if(!a)return!1;l(!0);let y=!0;return T&&(y=await t.mutateAsync(p).then(()=>y,()=>!1)),v&&v!==u&&(y=await s.mutateAsync({authorId:a.id,handle:v}).then(()=>y,()=>!1)),l(!1),y};return{ready:a!==void 0,name:h,setName:f,handle:n,setHandle:m,canSave:a!==void 0&&!d&&(p.length>0||v.length>0),saving:d,nameError:C,nameSuggestion:E!==null&&p===c?E:null,handleError:O,save:_}}function he({onSaved:e,confirmLabel:r="Save",onSkip:a,skipLabel:o="Skip"}){const t=re(),s=g.useId(),d=g.useId(),l=g.useId(),c=f=>{f.preventDefault(),t.canSave&&t.save().then(n=>{n&&e()})},u=t.nameError!==null||t.handleError!==null;let h=r;return t.saving?h="Saving…":u&&(h="Try again"),i.jsxs("form",{onSubmit:c,className:"flex flex-col gap-3","data-testid":"operator-identity-form",children:[i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:s,className:"text-xs",children:"Your name"}),i.jsx(R,{id:s,value:t.name,maxLength:80,autoComplete:"name",placeholder:"What you go by",disabled:!t.ready,onChange:f=>t.setName(f.target.value),className:"h-8 text-sm"}),t.nameSuggestion&&!t.nameError&&i.jsxs("p",{className:"text-muted-foreground text-xs",children:[t.nameSuggestion,". Save it to make it yours."]}),t.nameError&&i.jsx(k,{tone:"error",children:t.nameError})]}),i.jsxs("div",{className:"flex flex-col gap-1.5",children:[i.jsx(N,{htmlFor:d,className:"text-xs",children:"Handle"}),i.jsxs("div",{className:"relative",children:[i.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2 text-sm",children:"@"}),i.jsx(R,{id:d,value:t.handle,maxLength:64,autoComplete:"username",autoCapitalize:"none",spellCheck:!1,placeholder:"yourname","aria-describedby":l,disabled:!t.ready,onChange:f=>t.setHandle(f.target.value),className:"h-8 pl-6 text-sm"})]}),i.jsx("p",{id:l,className:"text-muted-foreground text-xs",children:"What others type after @ to reach you."}),t.handleError&&i.jsx(k,{tone:"error",children:t.handleError})]}),i.jsxs("div",{className:"flex flex-wrap gap-2",children:[i.jsx(A,{type:"submit",size:"sm",disabled:!t.canSave,"data-testid":"confirm-identity",children:h}),a&&i.jsx(A,{type:"button",size:"sm",variant:"ghost",onClick:a,disabled:t.saving,"data-testid":"skip-identity",children:o})]})]})}export{he as O,ne as a,fe as b,ue as c,de as i,se as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./index-_8SHxs8S.js";import{b as t}from"./ProfileFields-EgcVDViF.js";import"./profile-errors-Lfs66dvr.js";import"./use-mounted-ref-Vm8D40hS.js";function s({member:o}){return r.jsx(t,{member:o})}export{s as PhotoPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as b,j as n,bk as _,bn as m,bo as S,fo as j,br as E,eH as I,dO as N,fp as R,fq as A,bl as T,bt as h,fr as M,fs as O,ft as $,fu as D,a1 as F,a2 as V,a8 as G}from"./index-_8SHxs8S.js";import{S as L}from"./shield-x-By16ILlp.js";var K=Object.defineProperty,g=(e,t)=>K(e,"name",{value:t,configurable:!0}),x="Tabs",[q,oe]=S(x,[j]),C=j(),[H,y]=q(x),U=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,onValueChange:o,defaultValue:d,orientation:i="horizontal",dir:l,activationMode:v="automatic",...p}=t,u=E(l),[c,f]=I({prop:s,onChange:o,defaultProp:d??"",caller:x});return n.jsx(H,{scope:r,baseId:N(),value:c,onValueChange:f,orientation:i,dir:u,activationMode:v,children:n.jsx(m.div,{dir:u,"data-orientation":i,...p,ref:a})})},"Tabs")),z="TabsList",B=b.forwardRef(g(function(t,a){const{__scopeTabs:r,loop:s=!0,...o}=t,d=y(z,r),i=C(r);return n.jsx(R,{asChild:!0,...i,orientation:d.orientation,dir:d.dir,loop:s,children:n.jsx(m.div,{role:"tablist","aria-orientation":d.orientation,...o,ref:a})})},"TabsList")),Q="TabsTrigger",W=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,disabled:o=!1,...d}=t,i=y(Q,r),l=C(r),v=w(i.baseId,s),p=k(i.baseId,s),u=s===i.value;return n.jsx(A,{asChild:!0,...l,focusable:!o,active:u,children:n.jsx(m.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":p,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:v,...d,ref:a,onMouseDown:T(t.onMouseDown,c=>{!o&&c.button===0&&c.ctrlKey===!1?i.onValueChange(s):c.preventDefault()}),onKeyDown:T(t.onKeyDown,c=>{o||c.target!==c.currentTarget||[" ","Enter"].includes(c.key)&&i.onValueChange(s)}),onFocus:T(t.onFocus,()=>{const c=i.activationMode!=="manual";!u&&!o&&c&&i.onValueChange(s)})})})},"TabsTrigger")),X="TabsContent",J=b.forwardRef(g(function(t,a){const{__scopeTabs:r,value:s,forceMount:o,children:d,...i}=t,l=y(X,r),v=w(l.baseId,s),p=k(l.baseId,s),u=s===l.value,c=b.useRef(u);return b.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),n.jsx(_,{present:o||u,children:({present:f})=>n.jsx(m.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":v,hidden:!f,id:p,tabIndex:0,...i,ref:a,style:{...t.style,animationDuration:c.current?"0s":void 0},children:f&&d})})},"TabsContent"));function w(e,t){return`${e}-trigger-${t}`}g(w,"makeTriggerId");function k(e,t){return`${e}-content-${t}`}g(k,"makeContentId");var Y=U,Z=B,ee=W,te=J;function ie({...e}){return n.jsx(Y,{"data-slot":"tabs",...e})}function ce({className:e,responsive:t=!0,...a}){return n.jsx(Z,{"data-slot":"tabs-list",className:h("bg-dui-muted text-dui-muted-foreground inline-flex items-center justify-center rounded-lg p-1",t?M:"h-9",e),...a})}function ue({className:e,...t}){return n.jsx(ee,{"data-slot":"tabs-trigger",className:h("ring-offset-dui-background inline-flex items-center justify-center rounded-md px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-[color,background-color,box-shadow,opacity] motion-reduce:transition-none! md:py-1","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none","disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-dui-background data-[state=active]:text-dui-foreground data-[state=active]:shadow",e),...t})}function de({className:e,...t}){return n.jsx(te,{"data-slot":"tabs-content",className:h("ring-offset-dui-background mt-2","data-[state=active]:animate-in data-[state=active]:fade-in-0 data-[state=active]:duration-150 motion-reduce:animate-none!","focus-visible:ring-dui-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none",e),...t})}const ae={default:!1,plan:!1,acceptEdits:!1,dontAsk:!0,bypassPermissions:!0,auto:!0};function le(e){return ae[e]??!1}function se(e){try{return D.toString(e)}catch{return`On the schedule ${e}`}}function fe(e){const t=e.cron?se(e.cron):"Runs only when you ask",a=O(e.startsEnabled);return`${t}, ${a}. This job ${$(e.permissionMode)}.`}function be(e,t){const a=F(),{enabled:r=!0,...s}=t??{},o=Object.keys(s).length>0;return V({queryKey:G.permissionPreview(e??"",o?s:void 0),queryFn:()=>a.previewMarketplacePackage(e,o?s:void 0),enabled:r&&e!==null,staleTime:3e4,networkMode:"always"})}function P(e){const t=e==null?void 0:e.body,a=Array.isArray(t==null?void 0:t.errors)?t.errors.filter(r=>typeof r=="string"):[];return a.length>0?{reasons:a,checked:!0}:{reasons:e instanceof Error&&e.message?[e.message]:[],checked:!1}}function ge(e){return P(e).checked}function ve({error:e}){const{reasons:t,checked:a}=P(e);return n.jsxs("div",{role:"alert",className:"border-destructive/40 bg-destructive/5 space-y-2 rounded-md border p-3 text-sm",children:[n.jsxs("p",{className:"text-destructive flex items-center gap-2 font-medium",children:[n.jsx(L,{className:"size-4 shrink-0","aria-hidden":!0}),"DorkOS won’t install this package"]}),n.jsx("p",{className:"text-muted-foreground text-xs",children:a?"What it found:":"It couldn’t check what this package does."}),t.length>0&&n.jsx("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-xs [overflow-wrap:anywhere]",children:t.map(r=>n.jsx("li",{children:r},r))})]})}export{ve as P,ie as T,ce as a,ue as b,de as c,fe as d,ge as i,le as r,be as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,ap as c,aO as p,G as i}from"./index-_8SHxs8S.js";const l=4,m={compact:"max-w-[200px] gap-1.5 px-2.5 py-1 text-xs",comfortable:"min-h-9 max-w-[280px] gap-2 px-3 py-1.5 text-sm"};function u({suggestions:o,onChipClick:s,ariaLabel:r="Suggested follow-ups",size:a="compact"}){const n=o.slice(0,l);return e.jsx(c.div,{"data-slot":"prompt-suggestion-chips",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},role:"group","aria-label":r,className:"mt-1.5 flex flex-wrap items-center gap-2",children:n.map(t=>e.jsxs("button",{type:"button","aria-label":t,title:t,onClick:()=>s(t),className:i("bg-secondary text-muted-foreground hover:text-foreground hover:bg-muted focus-visible:ring-ring inline-flex items-center truncate rounded-md transition-colors duration-150 focus-visible:ring-2 focus-visible:ring-offset-2",m[a]),children:[e.jsx(p,{className:i("shrink-0",a==="compact"?"size-3":"size-3.5")}),e.jsx("span",{className:"truncate",children:t})]},t))})}export{u as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as ie,a4 as de,a3 as Oe,j0 as _e,j1 as ne,j2 as me,j3 as Le,j4 as De,j5 as Fe,aN as ze,r as s,j as t,G as ee,B as we,x as He,e as Q,gy as Ie,hh as qe,gx as ke,j6 as $e,j7 as We,n as Be,gB as U,dD as Ke,fx as Ge,j8 as Ue,j9 as Xe,ja as Ye,cs as Qe,jb as Ve,jc as Ze,jd as Je,je as et,co as tt,jf as nt,gw as Y,jg as st,l as rt,s as he,jh as ot,ji as at,e6 as it,X as dt,e3 as lt,ap as ut,jj as ct,jk as pe,jl as ft,ab as mt,jm as ht,gv as pt,gu as gt,jn as xt,aD as ge,bw as Rt}from"./index-_8SHxs8S.js";import{P as yt,u as vt}from"./pane-resize-handle-CyT6JG8q.js";import{D as bt,U as jt,u as wt}from"./UnreadDivider-qMUA2rFP.js";import{u as It}from"./use-room-follow-claim-ysyr_uyD.js";import{a as le,e as ue,g as kt,f as Ae,h as At,i as Ne,c as G,d as V,j as Nt,k as re,b as oe,l as ae,A as Se,m as Ce,t as ce,r as St,n as J,R as fe,u as Me,C as Te,o as Ct}from"./ChannelComposer-Bfi3hAgy.js";import{u as Mt,f as Tt,a as Et,F as Pt,C as X,d as Ot,M as _t}from"./registry-CSe_ncC2.js";import{u as Lt}from"./use-connector-management-DLOJoz45.js";import{A as Dt}from"./AgentRequestCard-DmLUHbGa.js";import{u as Ft}from"./use-room-sessions-_zhdKcKj.js";function zt(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.haltRoomAgent(o,r),meta:{errorLabel:"Couldn’t stop this agent"}})}function Ht(){const e=ie();return de({mutationFn:({roomId:o,authorId:r})=>e.promoteHold(o,r),meta:{errorLabel:"Couldn’t ask to be answered first"}})}function qt(e){const o=ie(),r=Oe(),u=_e(e),y=ne(p=>{var f;return e===null?null:((f=p.paging[e])==null?void 0:f.cursor)??null}),i=de({mutationFn:async p=>{var j;const f=(j=ne.getState().paging[p])==null?void 0:j.cursor;if(f==null)return;const v=await o.listRoomEntries(p,{before:f,limit:me}),I=ze.entries(p),k=r.getQueryData(I),A=Le(k,v);r.setQueryData(I,A),ne.getState().notePage(p,De(v)??f,Fe(v,me)||A.length===((k==null?void 0:k.length)??0))},meta:{errorLabel:"Couldn't load older messages"}}),{mutateAsync:d,isPending:w}=i,R=s.useRef(!1),x=s.useCallback(async()=>{if(!(e===null||R.current)){R.current=!0;try{await d(e).catch(()=>{})}finally{R.current=!1}}},[e,d]);return{canLoadOlder:u,isLoadingOlder:w,cursor:y,loadOlder:x}}function $t({id:e,summary:o,open:r,onOpen:u}){const{capabilities:y}=Mt(),{count:i,lastAt:d,unread:w}=o,R=Tt(d),[x,p]=s.useState({count:i,bumped:!1});x.count!==i&&p({count:i,bumped:!0});const f=x.count===i&&x.bumped;return y.threads?t.jsxs("button",{type:"button",id:e,"data-slot":"thread-reply-row","data-testid":"room-thread-replies","data-unread":w>0?"":void 0,"aria-expanded":r,onClick:u,className:ee("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",w>0?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground hover:text-foreground"),children:[t.jsx("span",{"aria-hidden":!0,className:"mr-1",children:"↳"}),t.jsx("span",{className:ee(f&&"motion-safe:animate-count-flip"),"data-testid":"room-thread-reply-count",children:i},i),i===1?" reply":" replies",R.length>0&&t.jsxs(t.Fragment,{children:[" · last ",t.jsx("time",{dateTime:d,title:Et(d),children:R})]}),w>0&&` · ${w} new`]}):null}function Wt({loading:e,onLoad:o}){return t.jsx("div",{className:"flex justify-center px-4 py-3",children:t.jsxs(we,{type:"button",variant:"ghost",size:"sm",onClick:o,disabled:e,"data-testid":"room-load-older",className:"text-muted-foreground hover:text-foreground h-7 gap-2 text-xs",children:[e&&t.jsx(He,{size:"xs"}),e?"Loading older messages…":"Older messages"]})})}const Bt="room-load-older",Kt=4;function Ee({roomName:e}){return t.jsx(Pt,{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:Kt},(o,r)=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(Q,{className:"size-7 shrink-0 rounded-full"}),t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-md"})]})]},`room-skeleton-${r}`))})}function Gt({roomId:e,roomName:o,viewerAuthorId:r,entries:u,members:y,formerAuthors:i,lastReadSeq:d,reactionFrequents:w,streamStalled:R,isLoading:x,error:p,onAddAgents:f,openThreadId:v,onOpenThread:I,resumeRow:k,landOnRow:A,onTopRow:j,canLoadOlder:S=!1,isLoadingOlder:l=!1,onLoadOlder:c,ref:C}){const N=s.useMemo(()=>le(y,i),[y,i]),E=Ie(y,r),P=ue(),T=s.useMemo(()=>new Map([...N].map(([n,m])=>[n,m.displayName])),[N]),M=qe(),L=ke(e,null),{topLevel:H,repliesByRoot:D,orphaned:F}=s.useMemo(()=>kt(u),[u]),q=s.useMemo(()=>new Map(u.map(n=>[n.id,n])),[u]),z=s.useMemo(()=>{const n=$e(H,d),m=We(H.map(a=>({id:a.id,authorId:a.body.moment?`moment:${a.id}`:a.authorId,timestamp:a.createdAt})),{now:M,lastSeenId:n.lastSeenId,unreadFromStart:n.fromStart}),b=[];S&&!x&&b.push({kind:"load-older",id:Bt});for(const a of m){if(a.kind==="day-divider"){b.push({kind:"day-divider",id:a.key,label:a.label});continue}if(a.kind==="unread-divider"){b.push({kind:"unread-divider",id:a.key});continue}const h=H[a.index];b.push({kind:"message",id:h.id,entry:h,grouping:a.grouping,position:a.index+1,answers:Ae(h,H[a.index-1],q.get.bind(q))});const g=D.get(h.id);g&&b.push({kind:"thread-reply",id:At(h.id),rootId:h.id,replies:g,totalReplies:h.threadReplyCount})}return b},[H,D,q,d,M,S,x]),$=s.useMemo(()=>z.map(n=>n.kind==="load-older"?{kind:"notice",id:n.id,at:"",body:null}:n.kind==="day-divider"?{kind:"day-divider",id:n.id,label:n.label}:n.kind==="unread-divider"?{kind:"unread-divider",id:n.id}:n.kind==="thread-reply"?{kind:"thread-reply",id:n.id,rootId:n.rootId,replyCount:Ne(n.replies.length,n.totalReplies),lastAt:n.replies[n.replies.length-1].createdAt}:{kind:"message",id:n.id,payload:n.entry,grouping:n.grouping,author:G(V(n.entry,N),N,P.faces),at:n.entry.createdAt}),[z,N,P.faces]),K=s.useCallback((n,m)=>{const b=z[m.index];if(b.kind==="load-older")return c===void 0?null:t.jsx(Wt,{loading:l,onLoad:c});if(b.kind==="day-divider")return t.jsx(bt,{label:b.label});if(b.kind==="unread-divider")return t.jsx(jt,{});if(b.kind==="thread-reply"){if(m.onOpenThread===void 0)return null;const h=m.onOpenThread;return t.jsx($t,{id:re(b.rootId),summary:Nt(b.replies,d,b.totalReplies),open:v===b.rootId,onOpen:()=>h(b.rootId)})}const a=V(b.entry,N);return t.jsx(oe,{roomId:e,entry:b.entry,author:G(a,N,P.faces),authorRef:N.get(a),authors:N,viewerAuthorId:r,authorNames:T,reactionFrequents:w,streamStalled:R,isMember:E,grouping:b.grouping,orphanedReply:F.has(b.entry.id),answers:b.answers,feedPosition:{index:b.position,total:-1},rowId:ae(b.entry.id)})},[z,e,N,P.faces,r,T,w,R,E,F,d,v,l,c]),O=s.useCallback(n=>{if(n.kind==="message")return ae(n.id);if(n.kind==="thread-reply")return re(n.rootId)},[]);if(p)return t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load these messages"}),t.jsx("p",{className:"max-w-sm",children:"Nothing was lost. Reload to try again."})]});const W=y.some(n=>n.author.kind==="agent"),B=t.jsxs("div",{className:"text-muted-foreground flex flex-col items-center gap-2 p-10 text-center text-sm",children:[t.jsx(Be,{className:"text-muted-foreground/50 size-8","aria-hidden":!0}),t.jsx("p",{className:"text-foreground font-medium",children:"Nothing said here yet"}),t.jsx("p",{className:"max-w-sm",children:W?"Say something to get it going.":"Nothing answers until you add an agent."}),t.jsx(we,{type:"button",size:"sm",variant:W?"ghost":"default",onClick:f,className:"mt-1",children:W?"Add more agents":"Add agents"})]});return t.jsx(Se,{known:P,children:t.jsx(X.Timeline,{ref:C,conversationId:e,label:`Messages in ${o}`,rows:$,renderRow:K,onOpenThread:I,domIdOf:O,...k===void 0?{}:{resumeRow:k},...A===void 0?{}:{landOnRow:A},...j===void 0?{}:{onTopRow:j},pending:L,viewerAuthorId:r,loading:x?t.jsx(Ee,{roomName:o}):void 0,empty:B,feedTestId:"room-timeline"})})}function Ut(e){const{roomId:o,entrySeq:r,entries:u,historyLoaded:y}=e,i=r===void 0?null:`${o}:${r}`,d=s.useMemo(()=>{if(r===void 0)return null;const k=u.find(l=>l.seq===r);if(k===void 0)return null;const A=Ce(u,k.id);if(A===null)return null;const j=ce(k)??null,S=j!==null&&A.rowId!==k.id;return{roomRowId:A.rowId,threadRootId:S?j:null,entryId:k.id}},[u,r]),w=s.useRef(null),R=(d==null?void 0:d.threadRootId)??null;s.useEffect(()=>{i===null||R===null||w.current!==i&&(w.current=i,U.getState().openThread(o,R))},[i,o,R]);const x=s.useRef(null);s.useEffect(()=>{i===null||!y||d===null&&x.current!==i&&(x.current=i,Ke.info("That message isn’t in the loaded history",{description:"Only recent messages are open. Nothing was lost."}))},[i,y,d]);const p=s.useRef(null),f=s.useCallback(()=>{if(!(i===null||p.current===i))return p.current=i,d==null?void 0:d.roomRowId},[i,d]),v=s.useRef(null),I=s.useCallback(()=>{if(!(i===null||v.current===i))return v.current=i,(d==null?void 0:d.threadRootId)===null||d==null?void 0:d.entryId},[i,d]);return{roomRow:r===void 0?void 0:f,threadRow:r===void 0?void 0:I}}function Xt(e,o){const[r,u]=s.useState({roomId:null,seq:null});return r.roomId===e?r.seq:e===null?(u({roomId:null,seq:null}),null):o===null?null:(u({roomId:e,seq:o}),o)}const Yt=600;function Qt(e){return document.getElementById(re(e))??document.getElementById(ae(e))}function Vt(){const e=s.useRef(null);return s.useEffect(()=>()=>{var r;return(r=e.current)==null?void 0:r.call(e)},[]),{arm:s.useCallback(r=>{var w;(w=e.current)==null||w.call(e);let u=0;const y=Date.now()+Yt;let i=!1;const d=()=>{if(i)return;const R=document.activeElement;if(R===null||R===document.body||!R.isConnected){const p=Qt(r);if(p!==null){p.focus();return}}Date.now()>=y||(u=requestAnimationFrame(d))};u=requestAnimationFrame(d),e.current=()=>{i=!0,cancelAnimationFrame(u)}},[])}}function Zt({roomId:e,route:o,urlThreadId:r,openThreadId:u,entries:y,historyLoaded:i}){const d=Ge(),w=s.useRef(null);s.useEffect(()=>{if(e!==null){if(w.current!==e&&(w.current=e,r!==void 0)){U.getState().openThread(e,r);return}if(i&&u!==void 0){const R=y.find(p=>p.id===u),x=R===void 0?void 0:St(R);if(x!==void 0&&x!==u){const p=U.getState().open[e];U.getState().openThread(e,x,(p==null?void 0:p.focusComposer)??!1);return}}u!==r&&(d==null||d({to:o,search:R=>({...R,thread:u}),replace:!0}))}},[e,o,u,r,y,i,d])}function Jt(e){return e.kind!=="channel"||e.bridge!=null||e.archived?!1:!e.members.some(o=>o.author.kind==="agent")}function en({room:e,hasEntries:o,onAddAgents:r}){return!o||!Jt(e)?null:t.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."," ",t.jsx("button",{type:"button",onClick:r,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 tn({roomId:e}){const{approvals:o}=Ue(),r=Xe(o).filter(u=>u.roomId===e);return r.length===0?null:t.jsx("section",{"data-slot":"room-approvals","aria-label":"Requests waiting on you",className:"shrink-0 px-3 pb-2 md:px-4",children:t.jsx(Ye,{approvals:r})})}function nn({roomId:e}){const{data:o}=Lt("pending"),r=(o??[]).filter(u=>u.roomId===e);return r.length===0?null:t.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:r.map(u=>t.jsx(Dt,{request:u},u.requestId))})}const sn="An agent",xe=64,se=3,rn=new Set;function Pe({room:e,entries:o,scope:r,laneScope:u,stalled:y,unavailable:i=!1,onRetry:d,onScrollToRow:w}){const R=Qe(),x=Ve(e.id,r),p=Ze(e.id,r),f=Je(e.id,r),[v,I]=s.useState(!1),k=Ft(e.id,{enabled:v}),A=et(),{mutate:j}=zt(),[S,l]=s.useState(rn),c=s.useCallback(a=>{l(h=>new Set(h).add(a)),j({roomId:e.id,authorId:a},{onSettled:()=>l(h=>{const g=new Set(h);return g.delete(a),g})})},[j,e.id]),C=Ht(),[N,E]=s.useState(()=>new Map),P=tt(),T=ue(),M=s.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),L=s.useCallback(a=>{var h;return((h=M.get(a))==null?void 0:h.displayName)??sn},[M]),{interactions:H}=nt(),D=s.useMemo(()=>H.filter(a=>a.roomId===e.id),[H,e.id]),F=s.useMemo(()=>{var h;const a={};for(const g of D){if(g.roomAuthorId===void 0)continue;const _=(h=M.get(g.roomAuthorId))==null?void 0:h.displayName;_!==void 0&&(a[g.sessionId]=_)}return a},[D,M]),q=s.useMemo(()=>x.map(a=>({authorId:a.authorId,name:L(a.authorId),state:a.state,since:a.since,activity:a.activity??null})),[x,L]),z=s.useMemo(()=>p.map(a=>{var g;const h=(g=P.data)==null?void 0:g.find(_=>_.id===a.behindRoomId);return{authorId:a.authorId,name:L(a.authorId),since:a.since,behind:{roomId:a.behindRoomId,title:h===void 0?null:Y(h)},othersWaiting:a.othersWaiting,severalInTheWay:a.severalInTheWay}}),[p,L,P.data]),$=s.useMemo(()=>{const a=new Set;for(const h of p)N.get(h.authorId)===h.entryId&&a.add(h.authorId);return a},[p,N]),K=s.useMemo(()=>f===null?null:{authorId:f.authorId,name:L(f.authorId)},[f,L]),O=s.useMemo(()=>Ot({capabilities:fe,asks:D,agentNames:F,stalled:y,presence:q,held:z,silentFinish:K,turn:null}),[D,F,q,z,K,y]),W=s.useMemo(()=>{var h;const a=new Map;for(const g of((h=k.data)==null?void 0:h.bindings)??[])a.set(g.authorId,g.sessionId);return a},[k.data]),B=s.useCallback(a=>{const h=o.find(_=>_.id===a);if(h===void 0)return null;const g=h.body.text.replace(/\s+/gu," ").trim();return g.length===0?null:g.length>xe?`${g.slice(0,xe).trimEnd()}…`:g},[o]),n=s.useCallback(a=>{var h;return u==="thread"?J(a):((h=Ce(o,a))==null?void 0:h.domId)??null},[o,u]),m=s.useMemo(()=>{const a=x.map(g=>{const _=B(g.entryId),Z=n(g.entryId);return{authorId:g.authorId,author:G(g.authorId,M,T.faces),state:g.state,since:g.since,doing:st(g.activity),replyingTo:_===null||Z===null?null:{entryId:g.entryId,excerpt:_,rowId:Z},sessionId:W.get(g.authorId)??null}}),h=z.map(g=>({authorId:g.authorId,author:G(g.authorId,M,T.faces),state:"held",since:g.since,doing:null,replyingTo:null,sessionId:null,behind:g.behind,othersWaiting:g.othersWaiting}));return[...a,...h]},[x,z,M,T.faces,B,n,W]),b=s.useMemo(()=>{if(x.length===0)return null;const a=x.slice(0,se);return t.jsxs("span",{"aria-hidden":"true",className:"flex shrink-0 -space-x-1",children:[a.map(h=>t.jsx(_t,{author:G(h.authorId,M,T.faces),className:"ring-background size-4 ring-2"},h.authorId)),x.length>se&&t.jsx("span",{className:"bg-muted text-muted-foreground ring-background text-3xs flex size-4 items-center justify-center rounded-full ring-2",children:`+${x.length-se}`})]})},[x,M,T.faces]);return t.jsx(X.LiveLane,{state:O,scope:u,onRetry:d,unavailable:i,faces:b,onPeekOpenChange:I,askCard:O.kind==="ask"?t.jsx(ot,{ask:O.ask,...F[O.ask.sessionId]?{agentName:F[O.ask.sessionId]}:{},onOpenSession:a=>{R(he({session:a}))},className:"border-l-0"}):void 0,peek:t.jsx(X.LivePeek,{rows:m,onScrollToRow:w,onOpenSession:a=>{R(he({session:a}))},onOpenRoom:a=>{R({...rt.channels(),search:{id:a}})},onAnswerFirst:a=>{const h=p.find(g=>g.authorId===a);h!==void 0&&E(g=>new Map(g).set(a,h.entryId)),C.mutate({roomId:e.id,authorId:a})},promoted:$,onStopAll:()=>A.mutate({roomId:e.id}),stopping:A.isPending,onStopAgent:c,stoppingAgents:S})})}const Re=3e3;function on(e,o,r,u=Date.now){const y=s.useRef(null),i=s.useRef(new Map),d=s.useRef(new Map),w=y.current,R=i.current,x=d.current,p=u();for(const f of e){if(x.has(f.id))continue;if(w===null){x.set(f.id,"at-rest");continue}const v=R.get(f.authorId);x.set(f.id,v!==void 0&&p-v<Re?"handed-off":"dropped")}return s.useEffect(()=>{if(!r)return;y.current=new Set(e.map(v=>v.id));const f=u();for(const v of o)i.current.set(v,f);for(const[v,I]of i.current)f-I>Re&&i.current.delete(v);for(const v of d.current.keys())y.current.has(v)||d.current.delete(v)}),x}function an({kind:e}){return e==="thread-error"?t.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:[t.jsx("p",{className:"text-foreground font-medium",children:"Couldn’t load this thread"}),t.jsx("p",{className:"max-w-sm text-xs",children:"Nothing was lost. Reload to try again."})]}):e==="thread-waiting"?t.jsxs("div",{"data-slot":"thread-notice",className:"flex flex-col gap-2 px-[var(--msg-padding-x)]",children:[t.jsx(Q,{className:"h-3 w-24"}),t.jsx(Q,{className:"h-3 w-full max-w-sm"})]}):t.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 dn({room:e,rootEntryId:o,focusComposer:r,entries:u,reactionFrequents:y,streamStalled:i,streamUnavailable:d,onRetryStream:w,historyLoaded:R,historyFailed:x=!1,landOnRow:p,pushed:f,onClose:v}){const I=s.useMemo(()=>le(e.members,e.formerAuthors),[e.members,e.formerAuthors]),k=Me({room:e,threadRootId:o}),A=Ie(e.members,e.viewerAuthorId),j=ue(),S=s.useMemo(()=>new Map([...I].map(([n,m])=>[n,m.displayName])),[I]),{root:l,replies:c}=s.useMemo(()=>{let n;const m=[];for(const b of u)b.id===o?n=b:ce(b)===o&&m.push(b);return{root:n,replies:m}},[u,o]),C=l==null?void 0:l.threadReplyCount,N=C!==void 0&&C>c.length,E=!f,P=l===void 0||N?-1:(E?1:0)+c.length,T=Ne(c.length,C),M=s.useMemo(()=>new Set(c.map(n=>n.id)),[c]),L=s.useMemo(()=>({replyIds:M,inside:!0}),[M]),H=at(e.id,L),D=ke(e.id,o),F=on(c,H,R),q=s.useRef(null),z=s.useCallback(n=>{var m;(m=q.current)==null||m.scrollToRow(n)},[]),$=s.useRef(null);s.useEffect(()=>{var n;r||(n=$.current)==null||n.focus()},[o,r]);const K=n=>{n.key!=="Escape"||n.defaultPrevented||(n.stopPropagation(),v())},O=s.useMemo(()=>{const n=[];if(l===void 0){const m=x?"thread-error":R?"thread-orphan":"thread-waiting";n.push({kind:"notice",id:m,at:"",body:null})}else E&&n.push({kind:"message",id:l.id,payload:l,grouping:{position:"only"},author:G(V(l,I),I,j.faces),at:l.createdAt});for(const m of c)n.push({kind:"message",id:m.id,payload:m,grouping:{position:"only"},author:G(V(m,I),I,j.faces),at:m.createdAt});return n},[l,E,c,I,j.faces,x,R]),W=s.useCallback(n=>{if(n.kind==="notice")return t.jsx(an,{kind:n.id});if(n.kind!=="message")return null;const m=n.payload,b=l!==void 0&&m.id===l.id,a=c.findIndex(_=>_.id===m.id),h=t.jsx(oe,{roomId:e.id,entry:m,rowId:J(m.id),author:n.author,authorRef:I.get(m.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:y,streamStalled:i,isMember:A,grouping:{position:"only"},answers:Ae(m,a<=0?l:c[a-1],_=>(l==null?void 0:l.id)===_?l:c.find(Z=>Z.id===_)),feedPosition:{index:b?1:(l===void 0||!E?0:1)+a+1,total:P}});if(b)return t.jsxs(t.Fragment,{children:[h,t.jsx(ye,{count:T})]});const g=F.get(m.id)??"at-rest";return t.jsx("div",{className:ee(g==="dropped"&&"motion-safe:animate-thread-reply-in",g==="handed-off"&&"motion-safe:animate-reply-settle"),children:h})},[l,E,c,T,F,e.id,e.viewerAuthorId,I,S,y,i,A,P]),B=s.useCallback(n=>n.kind==="message"?J(n.id):void 0,[]);return t.jsx(Se,{known:j,children:t.jsx(X.Root,{surface:"room",capabilities:fe,target:k.target,anchor:"rail",children:t.jsxs("section",{ref:$,"aria-label":"Thread","data-testid":"room-thread-panel",tabIndex:-1,onKeyDown:K,className:ee("bg-card flex min-h-0 flex-col outline-none",f?"h-full w-full":"w-full border-l"),children:[f?t.jsxs("header",{className:"flex items-center gap-2 border-b px-1 py-1",children:[t.jsxs("button",{type:"button",onClick:v,"aria-label":`Back to ${Y(e)}`,"data-testid":"room-thread-back",className:"focus-ring text-muted-foreground hover:text-foreground flex h-11 min-w-0 items-center gap-1 rounded px-2 text-sm",children:[t.jsx(it,{"aria-hidden":!0,className:"size-4 shrink-0"}),t.jsx("span",{className:"truncate",children:Y(e)})]}),t.jsx("p",{className:"ml-auto shrink-0 pr-3 text-sm font-medium",children:"Thread"})]}):t.jsxs("header",{className:"flex items-center gap-2 border-b px-3 py-2",children:[t.jsx("button",{type:"button",onClick:v,"aria-label":"Close thread",className:"focus-ring text-muted-foreground hover:text-foreground relative -ml-1 rounded p-1",children:t.jsx(dt,{"aria-hidden":!0,className:"size-4"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"text-sm font-medium",children:"Thread"}),t.jsx("p",{className:"text-muted-foreground truncate text-xs",children:Y(e)})]})]}),f&&l!==void 0&&t.jsxs("div",{"data-testid":"room-thread-pinned-root",className:"max-h-[40%] shrink-0 overflow-y-auto border-b pt-2",children:[t.jsx(oe,{roomId:e.id,entry:l,rowId:J(l.id),author:G(V(l,I),I,j.faces),authorRef:I.get(l.authorId),authors:I,viewerAuthorId:e.viewerAuthorId,authorNames:S,reactionFrequents:y,streamStalled:i,isMember:A,grouping:{position:"only"}}),t.jsx(ye,{count:T})]}),t.jsx(X.Timeline,{ref:q,conversationId:`thread-${o}`,label:`Thread in ${Y(e)}`,busy:!R&&!x,rows:O,renderRow:W,domIdOf:B,...p===void 0?{}:{landOnRow:p},pending:D,viewerAuthorId:e.viewerAuthorId,className:"py-3",feedTestId:"room-thread-feed"}),t.jsx(Pe,{room:e,entries:u,scope:L,laneScope:"thread",stalled:f&&i===!0,unavailable:d,onRetry:f?w:void 0,onScrollToRow:z}),t.jsx(Te,{room:e,threadRootId:o,attachments:k.attachments,focusOnMount:r},o)]})})})}function ye({count:e}){return e===0?null:t.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:[t.jsx("span",{className:"text-muted-foreground shrink-0 text-xs",children:e===1?"1 reply":`${e} replies`}),t.jsx("span",{className:"bg-border h-px flex-1"})]})}const ln=96,un=500;function cn(e){return e.offset.x>ln||e.velocity.x>un}function fn({children:e,onClose:o}){const r=lt()===!0,u=r?{x:0}:{x:"100%"};return t.jsx(ut.div,{"data-testid":"room-thread-sheet",className:"bg-card absolute inset-0 z-10 flex flex-col shadow-xl",initial:u,animate:{x:0},exit:u,transition:r?{duration:0}:{duration:.22,ease:[.32,.72,0,1]},drag:"x",dragDirectionLock:!0,dragConstraints:{left:0,right:0},dragElastic:{left:0,right:.9},dragMomentum:!1,onDragEnd:(y,i)=>{cn(i)&&o()},children:e})}const te="room-thread-split",mn=320,hn=360,pn=40,gn=50,xn=25;function ve(e,o){return o<=0?xn:Math.min(Math.round(e/o*1e3)/10,gn)}function Rn(e){const o=ve(mn,e),r=Math.round((100-ve(hn,e))*10)/10;return{minPct:o,maxPct:r,defaultPct:Math.min(Math.max(pn,o),r)}}function yn(e,o,r){if(e===null||o===null||o<=0)return r.defaultPct;const u=e/o*100;return Math.round(Math.min(Math.max(u,r.minPct),r.maxPct)*10)/10}function vn(e){try{const o=localStorage.getItem(e),r=o===null?NaN:Number(o);return Number.isFinite(r)&&r>0?r:null}catch{return null}}function bn(e,o){try{localStorage.setItem(e,String(Math.round(o)))}catch{}}const jn="react-resizable-panels:room-thread-split";function wn(){try{localStorage.removeItem(jn)}catch{}}function In(){const[e,o]=s.useState(null),[r,u]=s.useState(null);return{ref:s.useCallback(i=>{if(i===null)return;o(i);const d=()=>u(i.offsetWidth);d();const w=new ResizeObserver(d);return w.observe(i),()=>{w.disconnect(),o(null),u(null)}},[]),element:e,width:r,sizing:Rn(r??0)}}const kn=`${te}-room`,be=`${te}-thread`,je=`${te}-handle`,An=4;function Nn({room:e,thread:o,storageKey:r=ft.ROOM_THREAD_WIDTH}){const{ref:u,element:y,width:i,sizing:d}=In(),[w,R]=s.useState(()=>vn(r)),[x,p]=s.useState(null),f=s.useRef(null),v=yn(w,i,d),I=i===null||(d.maxPct-d.minPct)/100*i<An,k=o!==!1;s.useEffect(wn,[]);const A=s.useRef(!1);s.useLayoutEffect(()=>{var c;A.current&&((c=f.current)==null||c.resize(v))},[v,k]);const j=s.useRef(null),S=()=>{var E;const c=(E=f.current)==null?void 0:E.getSize(),C=j.current;if(j.current=null,c===void 0||i===null||i<=0||C===c)return;const N=Math.round(c/100*i);R(N),bn(r,N)},l=x??v;return s.useLayoutEffect(()=>{const c=y==null?void 0:y.querySelector(`[data-panel-resize-handle-id="${je}"]`);c&&(c.setAttribute("aria-controls",be),c.setAttribute("aria-valuenow",String(Math.round(l))),c.setAttribute("aria-valuemin",String(Math.round(d.minPct))),c.setAttribute("aria-valuemax",String(Math.round(d.maxPct))))}),t.jsx("div",{ref:u,className:"h-full overflow-hidden",children:t.jsxs(ct,{direction:"horizontal",id:te,onLayout:c=>{A.current=c.length>1,p(A.current?c[1]:null)},children:[t.jsx(pe,{id:kn,order:1,className:"flex",children:e}),k&&t.jsxs(t.Fragment,{children:[t.jsx(yt,{id:je,"aria-label":"Resize thread","data-testid":"room-thread-resize-handle",disabled:I,onDragging:c=>{var C;c&&(j.current=((C=f.current)==null?void 0:C.getSize())??null)},onKeyDownCapture:c=>{var C,N;I||(j.current=((C=f.current)==null?void 0:C.getSize())??null,!(c.key!=="Home"&&c.key!=="End")&&(c.preventDefault(),(N=f.current)==null||N.resize(c.key==="Home"?d.minPct:d.maxPct)))},onResizeEnd:S}),t.jsx(pe,{ref:f,id:be,order:2,defaultSize:v,minSize:d.minPct,maxSize:d.maxPct,className:"flex",children:o})]})]})})}function Dn({roomId:e,threadId:o,entrySeq:r,threadRoute:u,aboveTimeline:y,aboveComposer:i,offerJumpBackIn:d,onComposerFocusChange:w}){const R=mt(),x=vt(),p=ht(e),f=p==null?void 0:p.rootEntryId,v=Vt(),I=s.useCallback(()=>{var m;const n=(m=U.getState().open[e])==null?void 0:m.rootEntryId;U.getState().closeThread(e),n!==void 0&&v.arm(n)},[e,v]),k=s.useCallback(n=>{U.getState().openThread(e,n)},[e]),A=pt(e),j=gt(e),S=wt(e,j.isSuccess);It(e);const l=A.data,c=s.useMemo(()=>j.data??[],[j.data]),C=Me({room:l});Zt({roomId:e,route:u,urlThreadId:o,openThreadId:f,entries:c,historyLoaded:j.isSuccess});const N=s.useMemo(()=>{var n;return((n=l==null?void 0:l.members.find(m=>m.author.id===l.viewerAuthorId))==null?void 0:n.lastReadSeq)??null},[l]),E=Xt(e,N);xt(l,c);const P=s.useRef(null),T=s.useRef(void 0),M=s.useCallback(n=>{T.current=n},[]),L=s.useCallback(()=>T.current,[]);s.useLayoutEffect(()=>{T.current=void 0},[e]);const H=s.useCallback(n=>{var m;(m=P.current)==null||m.scrollToRow(n)},[]),D=qt(e),{loadOlder:F,cursor:q}=D,z=s.useCallback(()=>{const n=Ct(c,q);F().then(()=>{n!==null&&requestAnimationFrame(()=>{var m;return(m=P.current)==null?void 0:m.scrollToRow(n.domId)})})},[c,q,F]),$=Ut({roomId:e,entrySeq:r,entries:c,historyLoaded:j.isSuccess}),K=s.useMemo(()=>f===void 0?void 0:{replyIds:new Set(c.filter(m=>ce(m)===f).map(m=>m.id)),inside:!1},[c,f]);if(A.isLoading)return t.jsx("div",{className:"flex h-full flex-col","aria-busy":!0,children:t.jsx(Ee,{})});if(A.isError||!l)return t.jsxs("div",{className:"text-muted-foreground flex h-full flex-col items-center justify-center gap-2 p-10 text-center text-sm",children:[t.jsx("p",{className:"text-foreground font-medium",children:"That channel or DM isn’t here"}),t.jsx("p",{className:"max-w-sm",children:"It may be archived, or the link is old."})]});const O=p!==void 0&&t.jsx(dn,{room:l,rootEntryId:p.rootEntryId,focusComposer:p.focusComposer,entries:c,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,streamUnavailable:S.unavailable,onRetryStream:S.retry,historyLoaded:j.isSuccess,historyFailed:j.isError,...$.threadRow===void 0?{}:{landOnRow:$.threadRow},pushed:R,onClose:I},p.rootEntryId),W=t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[y,t.jsx(Gt,{ref:P,roomId:l.id,roomName:Y(l),viewerAuthorId:l.viewerAuthorId,entries:c,members:l.members,formerAuthors:l.formerAuthors,lastReadSeq:E,reactionFrequents:l.reactionFrequents,streamStalled:S.stalled,isLoading:j.isLoading,error:j.error,onAddAgents:()=>ge("add",l.id),openThreadId:f,onOpenThread:k,resumeRow:L,...$.roomRow===void 0?{}:{landOnRow:$.roomRow},onTopRow:M,canLoadOlder:D.canLoadOlder,isLoadingOlder:D.isLoadingOlder,onLoadOlder:z}),i,t.jsx(tn,{roomId:l.id}),t.jsx(nn,{roomId:l.id}),t.jsx(Pe,{room:l,entries:c,scope:K,laneScope:"room",stalled:S.stalled,unavailable:S.unavailable,onRetry:S.retry,onScrollToRow:H}),t.jsx(en,{room:l,hasEntries:c.length>0,onAddAgents:()=>ge("add",l.id)}),t.jsx(Te,{room:l,attachments:C.attachments,offerJumpBackIn:d,onFocusChange:w},l.id)]}),B={surface:"room",capabilities:fe,target:C.target,anchor:"rail"};return R?t.jsx(X.Root,{...B,children:t.jsx("div",{style:{paddingBottom:x},"data-testid":"room-surface",className:"flex h-full flex-col overflow-hidden",children:t.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",inert:O!==!1,"data-testid":"room-under-thread",children:W}),t.jsx(Rt,{initial:!1,children:O!==!1&&t.jsx(fn,{onClose:I,children:O},`thread-${f}`)})]})})}):t.jsx(X.Root,{...B,children:t.jsx(Nn,{room:W,thread:O})})}export{Dn as R,$t as T,Ee as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as L,j as e,a0 as ye,bw as Ee,ap as we,G as N,e7 as de,bx as ue,by as fe,bz as me,bB as xe,e8 as ke,a1 as Te,a3 as Ae,a4 as Le,ab as pe,aL as Oe,e9 as he,ea as De,eb as Ie,ec as Pe,a6 as j,ed as _e,ee as H,ef as Ue,ak as be,B as $e,U as Re,b as He,e as Me,eg as Be,eh as ze,ei as Ke,ej as qe,ek as Qe,el as Ve}from"./index-_8SHxs8S.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as Fe,d as Ge,k as We,e as A}from"./execution-config-b_HoE2gl.js";import{U as Xe}from"./unverified-catalog-notice-DogkKIUJ.js";import{s as Ye}from"./settings-for-runtime-BoOa-ZFG.js";const Je={duration:.12,ease:"easeOut"},Ze={type:"spring",stiffness:320,damping:28};function ge({isSetHere:a,serverDefault:l,onUseServerDefault:d,warning:r,className:s,"data-testid":i}){const[u,f]=L.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!d,x=e.jsxs("span",{className:N("text-3xs inline-flex h-5 items-center gap-1 rounded-full px-2 leading-none whitespace-nowrap",r?de.warning:de.neutral,n&&"hover:bg-accent hover:text-accent-foreground transition-colors",s),"data-testid":i,children:[r&&e.jsx(ye,{className:"size-2.5 shrink-0","aria-hidden":!0}),e.jsx(Ee,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0,y:2},animate:{opacity:1,y:0,transition:Ze},exit:{opacity:0},transition:Je,children:o},o)})]});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Set here${r?`: ${r}`:""}`,children:x})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:N("px-2 pt-1 text-xs",ke.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{d(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":i?`${i}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):r?e.jsx("span",{title:r,"aria-label":`${o}: ${r}`,children:x}):x}const et=["agents"];function tt(a){const l=Te(),d=Ae();return Le({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{d.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{d.invalidateQueries({queryKey:et})}})}const ve="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function $({label:a,valueLabel:l,options:d,selected:r,isSetHere:s,serverDefault:i,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:x=!0,className:C,describedBy:m,inheritText:O}){const w=pe(),[S,h]=L.useState(!1);return e.jsxs("div",{className:N("space-y-1",C),children:[x&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:a}),!w&&e.jsx(ge,{isSetHere:s,serverDefault:i,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:N("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Re,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:d.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:N("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:O??(i?`Use server default: ${i}`:"Use server default")})]})]})]})}function st({agent:a,onUpdate:l,className:d}){var ee,te,se,ae,ne,le,oe,re,ie;const r=pe(),{data:s}=Oe(),{data:i,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:x}=De(),C=Fe(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=i==null?void 0:i.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,T;return((T=(b=x==null?void 0:x.defaults)==null?void 0:b[t])==null?void 0:T.runsOn)==="credits"}}),{data:m,isError:O}=Ie({runtime:o,...C?{account:j}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=C&&(m??[]).some(t=>t.paidFromCredits),y=c?(m??[]).find(t=>t.isDefault):void 0,k=a.model??h??(y==null?void 0:y.value)??null,M=o==="doe"&&c&&!w&&!h,p=k?(m??[]).find(t=>t.value===k):void 0,D=(n==null?void 0:n.supportsEffort)??((ae=Ye(i,o))==null?void 0:ae.supportsEffort),B=D===void 0&&u,z=D!==!1,K=p?p.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:Q,creditsEntry:je,resolvedAccount:V}=Pe(),F=je??(a.account===j&&((le=s==null?void 0:s.claudeCode)!=null&&le.credits)?{path:s.claudeCode.credits.path}:null),g=q&&[...q.flatMap(t=>t.id===null?[]:[{id:t.id,label:Q(t.path),path:t.path}]),...F?[{id:j,label:_e,path:F.path}]:[]],v=a.account??null,G=v!==null,W=o==="claude-code"&&v===j&&((oe=s==null?void 0:s.claudeCode)==null?void 0:oe.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),I=s!=null&&s.claudeCode&&V?Q(V):null,P=tt({errorLabel:"Couldn’t change this agent’s account"}),_=L.useCallback(t=>{P.mutate({id:a.id,updates:{account:t}})},[a.id,P]),Ne=Ge({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:We(m),knownAccounts:g,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:D,runtimeLabel:t=>H(t).label}),E=t=>{var b;return((b=Ne.breakages.find(T=>t.includes(T.kind)))==null?void 0:b.message)??null},U=!B&&z&&K!==!1,X=a.effort??(n==null?void 0:n.effort)??null,Y=H(o).label,Ce=o==="claude-code"&&g!==void 0&&(g.length>1||G),Se=E(["account-unregistered"]),J=(m??[]).some(t=>t.unverified),Z=L.useId();return e.jsxs("div",{className:N("grid grid-cols-2 gap-3",d),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx($,{label:"Model",valueLabel:M?ce:(p==null?void 0:p.displayName)??k??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:k,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:E(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:J?Z:void 0,inheritText:M?ce:c&&!h?y?`Use the suggested model: ${y.displayName}`:"Use the default model":void 0}),J&&e.jsx(Xe,{id:Z}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),C&&O&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:ve,children:"Effort"}),(!r||!U)&&(S||U)&&e.jsx(ge,{isSetHere:S,serverDefault:n!=null&&n.effort?A(n.effort):null,warning:E(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),B?e.jsx(R,{testId:"agent-effort-pending",text:`Checking what ${Y} supports`,warning:null}):z?U?e.jsx($,{label:"Effort",valueLabel:A(X),options:Ue.filter(t=>!(p!=null&&p.supportedEffortLevels)||p.supportedEffortLevels.includes(t)).map(t=>({value:t,label:A(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?A(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(R,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:E(["effort-unsupported-model"])}):e.jsx(R,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${Y}`,warning:E(["effort-unsupported-runtime"])})]}),Ce&&e.jsx($,{label:"Account",valueLabel:W?I??"Default":v!==null?((ie=g==null?void 0:g.find(t=>t.id===v))==null?void 0:ie.label)??v:I??"Default",options:(g??[]).map(t=>({value:t.id,label:t.label,hint:t.id===j?"Paid from your DorkOS account":be(t.path)})),selected:v,isSetHere:G,serverDefault:I,warning:Se,onSelect:t=>_(t),onInherit:()=>_(null),testId:"agent-account-row",className:"col-span-full"}),W&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx($e,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:P.isPending,onClick:()=>_(j),children:"Allow"})]})]})}function R({text:a,warning:l,testId:d}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":d,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const at="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function dt({member:a}){const{agent:l,projectPath:d,isPending:r,update:s}=He(a),{data:i}=he();if(r)return e.jsx(Me,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=i?Object.keys(i.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:at,children:"Runs on"}),e.jsxs(Be,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(ze,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Ke,{})}),e.jsx(qe,{children:f.map(o=>e.jsx(Qe,{value:o,responsive:!1,children:H(o).label},o))})]})]}),e.jsx(st,{agent:l,onUpdate:s,className:"grid-cols-1"}),d&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ve,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(d)})]})]})}export{dt as RunsOnPopover};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aL as Ee,a1 as b,a3 as T,r as u,a4 as I,jQ as q,jR as M,ec as Be,jS as Ge,a2 as Q,j as e,jT as We,ij as we,eq as Ye,er as V,Q as Re,T as Ie,V as Le,B as O,hU as Ve,G as H,eP as He,ea as Je,jU as Xe,jV as Ze,e3 as Ae,ap as te,x as de,bw as es,J as ue,ee as me,en as C,eo as ne,aG as ss,jW as ts,I as U,jX as ns,jY as Ke,jZ as rs,_ as De,fA as as,eg as is,eh as os,ei as ls,ej as cs,ek as be,e6 as ds,C as us,j_ as ms,j$ as xs,k0 as hs,U as fs}from"./index-_8SHxs8S.js";import{I as gs}from"./inline-code-AHNJTNEg.js";import{u as ps}from"./useMutationState-4dFTMb_f.js";import{O as ys,a as Y}from"./runtime-connect-Dn0T5YWv.js";function js(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function Ct(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Ot(s){var d,m;const t=b(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:()=>(a(null),t.provisionRuntime(s,x=>a(x))),onSuccess:x=>{x.ok&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((d=r.data)==null?void 0:d.ok)===!1,o=r.isError?r.error.message:((m=r.data)==null?void 0:m.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 Te(s){return["runtime-key-status",s]}function vs(s,t=!0){const n=b();return Q({queryKey:Te(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function ks(s){const t=b(),n=I({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 Ns(s){var o,c,d;const t=b(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:async m=>{a("checking");const x=await t.checkRuntimeCredential(s,m);return x.ok?(a("saving"),await t.storeRuntimeCredential(s,m),{saved:!0,message:null}):{saved:!1,message:x.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:m=>{m.saved&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Te(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:m=>{m.trim().length!==0&&r.mutate(m)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((d=r.data)==null?void 0:d.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function bs(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function Ss(s,t){var E,K,L,S,v;const n=b(),i=T(),{sessionId:a,accountRoot:r,accountId:l,onCompleted:o}=t??{},c=Be(),d=l??(r?((E=c.accounts.find(N=>N.path===r))==null?void 0:E.id)??(c.ownResolvedAccount===r?"default":void 0):a?void 0:"default"),m=u.useMemo(()=>["runtime-login",s,a??"",d??r??""],[s,a,d,r]),x=I({mutationKey:m,mutationFn:()=>{if(s==="claude-code"&&r&&!d&&!a)throw new Error("Choose this account in Runtimes.");return n.delegateRuntimeLogin(s,s==="claude-code"?{sessionId:a,accountId:d}:a?{sessionId:a}:void 0)},onSuccess:N=>{i.invalidateQueries({queryKey:["claude-signin-policy"]}),N.ok&&(i.invalidateQueries({queryKey:Ge.all}),i.invalidateQueries({queryKey:[...q]}),i.invalidateQueries({queryKey:[...M]}))}}),p=ps({filters:{mutationKey:m,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),y=p.some(N=>N.state.status==="pending"),f=p[p.length-1],h=y||f==null?void 0:f.state,k=y||f==null?void 0:f.id,w=!y&&((h==null?void 0:h.status)==="error"||((K=h==null?void 0:h.data)==null?void 0:K.ok)===!1),F=(h==null?void 0:h.status)==="error"?((L=h.error)==null?void 0:L.message)??null:((S=h==null?void 0:h.data)==null?void 0:S.error)??null,R=((v=h==null?void 0:h.data)==null?void 0:v.ok)===!0,P=u.useRef(o);return P.current=o,u.useEffect(()=>{var _;if(!R||k===void 0)return;const N=bs(i);N.has(k)||(N.add(k),(_=P.current)==null||_.call(P))},[R,k,i]),{login:()=>{y||x.mutate()},isPending:y,isSuccess:R,isError:w,errorMessage:w?F??"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 Cs(s){return Ce[s]??Ce["claude-code"]}function Os({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(We,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(we,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(Ye,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(V,{className:"size-3"})]})]})}function Pt({command:s,runtimeLabel:t}){const[n,i]=u.useState(!1);return e.jsxs(Re,{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(Ie,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Le,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(gs,{children:s}),e.jsx(we,{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(O,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ve,{className:"size-3"}),"Retry"]})]})}function Ps({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 Es(s){const t=He(),{data:n}=Je();return s?Xe(Ze(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",ws={title:xe,body:`Frontier models are unlocked. ${he}`},Rs={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Me(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function Is(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=Ae();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(es,{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 z({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(O,{size:"sm",onClick:t,children:"Try again"})]})}function Ls({type:s,onConnected:t,asOtherWay:n=!1}){const i=Cs(s),a=Ss(s),[r,l]=u.useState(!1),o=u.useRef(!1);return u.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Me(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(z,{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(O,{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(As,{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(O,{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 As({type:s,copy:t,onConnected:n}){var f,h;const[i,a]=u.useState(""),r=Ns(s),l=vs(s),o=ks(s),c=u.useRef(!1),d=u.useRef(null);if(u.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Me(me(s).label)))},[r.isSuccess,n,s]),u.useEffect(()=>{var k;r.isError&&((k=d.current)==null||k.focus())},[r.isError]),r.isSuccess)return e.jsx(z,{});const m=(f=l.data)!=null&&f.key.saved?l.data.key:null,x=i.trim().length>0,p=r.isPending||o.isPending,y=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:k=>{k.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(C,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:d,value:i,disabled:p,onChange:k=>{a(k.target.value),y()},placeholder:m?`Saved key ends in ${m.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(V,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"ghost",disabled:!x&&m===null||p,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:!x||p,children:"Save key"})]})]}),p?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((h=o.result)==null?void 0:h.ok)===!0?e.jsx(z,{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 Ks(s){const t=b(),n=Q({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(Ds,{saved:n.data,...s},JSON.stringify(n.data))}function Ds({saved:s,onConnected:t,onSave:n}){var D,X,W,Z,j,$,fe,ge,pe,ye,je,ve;const i=b(),a=T(),r=u.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=u.useState(n&&l==="dorkos-credits"?"api-key":l),[d,m]=u.useState(((X=s.inference)==null?void 0:X.protocol)??"openai-chat-completions"),[x,p]=u.useState(((W=s.inference)==null?void 0:W.endpoint)??""),[y,f]=u.useState(((Z=s.inference)==null?void 0:Z.provider)??""),[h,k]=u.useState(((j=s.inference)==null?void 0:j.model)??""),[w,F]=u.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[R,P]=u.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[E,K]=u.useState(""),[L,S]=u.useState(null),v=Q({queryKey:["doe-credits-models",d],queryFn:()=>i.getDoeCreditsModels(d),enabled:o==="dorkos-credits"}),N=o==="dorkos-credits"?(ge=v.data)==null?void 0:ge.models.find(g=>g.id===h):void 0,_=s.hasKey&&((pe=s.inference)==null?void 0:pe.endpoint)===x&&s.inference.source==="api-key",J=I({mutationFn:async g=>{if(n)return n(g,E.trim()||null);o==="api-key"&&E.trim()?await i.storeDoeCredential(g,E.trim()):await i.setDoeInference(g),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{K("");for(const g of[["doe-inference"],q,M,ss.all,ts.status()])a.invalidateQueries({queryKey:g});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:g=>S(n&&g instanceof Error&&g.message?g.message:"Couldn’t save model settings. Try again.")});function re(g){var ke,Ne;if(g.preventDefault(),S(null),E.trim().startsWith("sk-ant-oat")){S("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!E.trim()&&!_){S("Enter an API key.");return}if(o==="dorkos-credits"&&(!N||!((ke=v.data)!=null&&ke.endpoint))){S("Link DorkOS credits and choose an available model.");return}const ae=ns.safeParse({source:o,protocol:d,provider:o==="dorkos-credits"?"dorkos":y,endpoint:o==="dorkos-credits"?(Ne=v.data)==null?void 0:Ne.endpoint:x,model:h,contextWindow:(N==null?void 0:N.contextWindow)??Number(w),maxOutputTokens:(N==null?void 0:N.maxOutputTokens)??Number(R)});if(!ae.success){S("Check the model, endpoint, and token limits.");return}J.mutate(ae.data)}const G="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(C,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:G,value:o,onChange:g=>{c(g.target.value),k("")},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(C,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:G,value:d,onChange:g=>{m(g.target.value),o==="dorkos-credits"&&k("")},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(C,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:G,value:h,onChange:g=>k(g.target.value),disabled:v.isPending||!((ye=v.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(je=v.data)==null?void 0:je.models.map(g=>e.jsx("option",{value:g.id,children:g.displayName},g.id))]}),!((ve=v.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(C,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(U,{id:`${r}-service`,value:y,onChange:g=>f(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(U,{id:`${r}-endpoint`,type:"url",value:x,onChange:g=>p(g.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(C,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(U,{id:`${r}-model`,value:h,onChange:g=>k(g.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(C,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(U,{id:`${r}-context`,type:"number",min:1,value:w,onChange:g=>F(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(U,{id:`${r}-output`,type:"number",min:1,value:R,onChange:g=>P(g.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:E,onChange:g=>K(g.target.value),autoComplete:"off"}),_&&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(O,{type:"submit",disabled:J.isPending,children:J.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ts={openai:"OpenAI",anthropic:"Anthropic"};function Ms(s){return Ts[s]??s}function qs(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ms(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function Fs(s){const t=b();return Q({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function $s(){const s=b(),t=T(),n=I({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]})}});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 $e=["runtime-connect","opencode","direct"];function _s(){const s=b();return Q({queryKey:$e,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function Us(){var i;const s=b(),t=I({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 zs(){var l,o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async({providerId:d,key:m,baseURL:x})=>{const p=(x==null?void 0:x.trim())||null;i("checking");const y=await s.checkProviderCredential(d,m.trim().length>0?m:null,p);return y.ok?(i("saving"),await s.storeProviderCredential(d,m,p),{saved:!0,message:null}):{saved:!1,message:y.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[...$e]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:d=>{d.providerId.trim().length!==0&&a.mutate(d)},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 Qs(s){const t=b();return Q({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Bs(){var o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async d=>{i(null);const m=await s.pullOllamaModel(d,x=>i(x));return m.ok&&await s.updateConfig({runtimes:{opencode:{provider:qe}}}),m},onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))}}),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:d=>a.mutate(d),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Gs(){var o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:()=>(i(null),s.provisionOllama(d=>i(d))),onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...M]}))}}),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 Ws="https://ollama.com/download",Ys="curl -fsSL https://ollama.com/install.sh | sh";function Vs({installMethod:s}){const t=Gs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Hs,{}),n?e.jsx(Js,{provision:t}):e.jsx(Xs,{}),e.jsx(Zs,{})]})}function Hs(){const s=Ke();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 Js({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(O,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Xs(){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(Os,{command:Ys,copyLabel:"Copy the Ollama install command"})]})}function Zs(){return e.jsxs("a",{href:Ws,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(V,{className:"size-3"})]})}const et="https://ollama.com/library",st={"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"}},tt={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function nt({active:s,onConnected:t,onConnectDirectly:n}){var R,P,E,K,L,S;const i=Fs(s),a=$s(),r=Bs(),l=((R=i.data)==null?void 0:R.running)??!1,o=Qs(l),[c,d]=u.useState(null),[m,x]=u.useState(null);u.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),u.useEffect(()=>{var v;(v=r.result)!=null&&v.ok&&(t==null||t(Pe))},[(P=r.result)==null?void 0:P.ok,t]);const p=v=>{d(v),a.connect(v)},y=v=>{x(v),r.pull(v)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Vs,{installMethod:(E=i.data)==null?void 0:E.installMethod});if(a.isSuccess)return t?null:e.jsx(z,{message:"Connected to Ollama"});if((K=r.result)!=null&&K.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(rs,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const f=i.data,h=(f==null?void 0:f.installed)??[],k=((L=f==null?void 0:f.installed)==null?void 0:L.length)??(f==null?void 0:f.models.length)??0,w=((S=o.data)==null?void 0:S.models.some(v=>v.model.id===m))??!1,F=m!==null&&!w?m:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(rt,{count:k}),h.length>0&&e.jsx(at,{installed:h,connect:a,connectingId:c,onUse:p}),e.jsx(it,{catalogQuery:o,pull:r,pullingId:m,onGet:y}),e.jsx(ot,{pull:r,activePull:F,onSubmit:y}),e.jsx(lt,{}),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 rt({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=st[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 Ue({tier:s}){return e.jsx(De,{size:"xs",variant:"outline",className:"font-normal",children:tt[s]})}function at({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(O,{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(Ue,{tier:a.assessment.model.tier})]}),e.jsx(_e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function it({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 d=n===l.id,m=()=>i(l.id);return d&&(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(ze,{progress:t.progress}):e.jsx(B,{message:t.errorMessage??"Couldn’t download the model.",onRetry:m})]},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(Ue,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx(_e,{verdict:o,explanation:c})]}),e.jsx(O,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:m,children:"Get"})]},l.id)})})]})}function ot({pull:s,activePull:t,onSubmit:n}){const[i,a]=u.useState(""),r=i.trim(),l=ys.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(ze,{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(C,{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(U,{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(O,{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 lt(){return e.jsxs("a",{href:et,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(V,{className:"size-3"})]})}function ze({progress:s}){const t=Ae(),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 ct(){var r,l,o;const s=b(),t=T(),n=I({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))}}),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 dt(){var p,y;const s=b(),t=T(),[n,i]=u.useState(null),[a,r]=u.useState(null),l=I({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:f,state:h})=>{if(!as(f)){r("Couldn’t open the OpenRouter sign-in page.");return}i(h)},onError:f=>r(f.message??"Couldn’t start OpenRouter sign-in.")}),o=Q({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="pending"?1500:!1},refetchOnWindowFocus:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="error"}}),c=(p=o.data)==null?void 0:p.status;u.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const d=l.isPending||n!==null&&c==="pending",m=!!a||c==="error",x=m?a??((y=o.data)==null?void 0:y.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:d,isSuccess:c==="connected",isError:m,errorMessage:x}}const ut="https://openrouter.ai/keys";function mt({onConnected:s}){const[t,n]=u.useState(""),i=ct(),a=dt(),r=i.isSuccess||a.isSuccess;return u.useEffect(()=>{r&&(s==null||s(ws))},[r,s]),r?e.jsx(z,{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(O,{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(C,{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:ut,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(V,{className:"size-3"})]}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function ee(s){return Y.find(t=>t.id===s)}function xt(s){var t;return((t=ee(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=Y.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??Y[0].defaultBaseURL}function Qe(s){return Y.some(t=>t.id===s.providerId)}function ie(s){return Qe(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function ht({onConnected:s}){const t=_s();return t.isError&&!t.data?e.jsx(B,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ft,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ft({setup:s,onConnected:t}){var Z;const n=Qe(s)?s:null,[i,a]=u.useState(()=>ie(s)),[r,l]=u.useState(""),[o,c]=u.useState(()=>{var j;return(n==null?void 0:n.baseURL)??((j=ee(ie(s)))==null?void 0:j.defaultBaseURL)??""}),[d,m]=u.useState(()=>{var $;const j=ie(s);return j!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=ee(j))==null?void 0:$.defaultBaseURL)}),x=zs(),p=Us(),y=ee(i),f=xt(i),h=n!=null&&n.key.saved&&n.providerId===f?n.key.last4:null,k=o.trim(),w=i===se,F=!w||k.length>0,R=ce(f),P=k||R,E=P===R?"":P,K=n===null?null:n.baseURL??ce(n.providerId),L=f!==((n==null?void 0:n.providerId)??null)||P!==K,S=r.trim().length>0,N=(S||h!==null&&!L)&&F,_=S&&F,J=!S&&h!==null&&L,re=P.startsWith("http://"),G={providerId:f,key:r,baseURL:E},D=x.isPending||p.isPending,X=u.useRef(null),W=()=>{p.reset(),x.reset()};return u.useEffect(()=>{x.isSuccess&&(t==null||t(Rs))},[x.isSuccess,t]),u.useEffect(()=>{var j;x.isError&&((j=X.current)==null||j.focus())},[x.isError]),x.isSuccess?e.jsx(z,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:j=>{j.preventDefault(),p.reset(),x.connect(G)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(is,{value:i,disabled:D,onValueChange:j=>{var $;a(j),c((($=ee(j))==null?void 0:$.defaultBaseURL)??""),W()},children:[e.jsx(os,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(ls,{})}),e.jsxs(cs,{children:[Y.map(j=>e.jsx(be,{value:j.id,children:j.label},j.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(w||d)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!w&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(U,{id:"direct-provider-base-url",value:o,disabled:D,onChange:j=>{c(j.target.value),W()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!w&&!d&&e.jsx("button",{type:"button",onClick:()=>m(!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(C,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:X,value:r,disabled:D,onChange:j=>{l(j.target.value),W()},placeholder:h===null?(y==null?void 0:y.keyPlaceholder)??Y[0].keyPlaceholder:`Saved key ends in ${h}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),x.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x.errorMessage}),J&&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:[y===void 0?e.jsx("span",{}):e.jsxs("a",{href:y.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(V,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"outline",disabled:!N||D,"data-testid":"direct-provider-test",onClick:()=>{x.reset(),p.reset(),p.check(G)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",disabled:!_||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:x.phase==="saving"?"Saving…":"Checking your key…"}):((Z=p.result)==null?void 0:Z.ok)===!0?e.jsx(z,{message:p.checkedSavedKey?"Your saved key works":"Key works"}):p.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:p.result.message}):null]})}function gt({currentProvider:s,onConnected:t}){const[n,i]=u.useState("choose"),a=pt();if(n==="choose")return e.jsx(yt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(mt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(nt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(ht,{onConnected:t})})}function pt(){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 ${Ke()}. 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 yt({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: ",qs(n)]}),Object.values(s).map(i=>e.jsx(jt,{source:i,onChoose:t},i.step))]})}function jt({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(us,{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(ds,{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 vt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=js(),r=Es(s),l=ms(),o=xs(),c=hs([s]);if(s==="doe")return a?e.jsx(Ks,{onConnected:i}):e.jsx(Oe,{});const d=r==="lead"&&l!==null,m=a?t.kind==="provider-picker"?e.jsx(gt,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Ls,{type:s,onConnected:i,asOtherWay:d}):null:e.jsx(Oe,{});if(m===null)return null;const x=me(s).label,p=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 ",x," runs on your DorkOS credits.",c.map(f=>` ${f}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:m})]});const y=f=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:f,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Is(x))}});return d?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[y(!0),e.jsx(le,{children:m}),e.jsx(Ps,{ollama:p,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[m,e.jsx(le,{children:y(!1)})]}):m}function le({collapsed:s=!1,children:t}){const[n,i]=u.useState(!s);return s?e.jsxs(Re,{open:n,onOpenChange:i,children:[e.jsxs(Ie,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(fs,{className:H("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Le,{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 Et=s=>e.jsx(vt,{...s});export{Pt as C,Os as D,Ps as K,Oe as R,Ss as a,js as b,Ct as c,qs as d,Es as e,Ks as f,Cs as g,Et as r,Ot as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,bo as G,eG as U,eH as Y,j as e,eI as Q,eJ as V,bn as W,bl as C,bk as M,eK as J,bm as X,eL as Z,eM as q,eN as ee,bt as te,eO as ne,aH as se,a7 as re,eP as ae,e9 as oe,eQ as z,d0 as ie,d1 as ce,d3 as le,d4 as de,d5 as ue,eC as fe,ee as y,J as D,B as S,e3 as A,eR as me,G as E,Q as xe,T as pe,U as ve,V as he,bV as ge,ap as I,x as Ce,bw as be}from"./index-_8SHxs8S.js";import{I as je}from"./inline-code-AHNJTNEg.js";import{l as Re}from"./list-runtime-types-BtXx3u9w.js";import{D as O,u as Ne,C as Pe}from"./RuntimeConnectFlow-BgLzK2Pf.js";var Se=Object.defineProperty,b=(t,n)=>Se(t,"name",{value:n,configurable:!0}),T,_="HoverCard",[F,Ze]=G(_,[U]),L=U(),[we,H]=F(_),He=b(t=>{const{__scopeHoverCard:n,children:r,open:o,defaultOpen:s,onOpenChange:c,openDelay:a=700,closeDelay:f=300}=t,x=L(n),i=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,m]=Y({prop:o,defaultProp:s??!1,onChange:c,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),i.current=window.setTimeout(()=>m(!0),a)},[a,m]),j=l.useCallback(()=>{clearTimeout(i.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>m(!1),f))},[f,m]),h=l.useCallback(()=>m(!1),[m]);return l.useEffect(()=>()=>{clearTimeout(i.current),clearTimeout(p.current)},[]),e.jsx(we,{scope:n,open:u,onOpenChange:m,onOpen:d,onClose:j,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(Q,{...x,children:r})})},"HoverCard"),Te="HoverCardTrigger",ke=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,...s}=n,c=H(Te,o),a=L(o);return e.jsx(V,{asChild:!0,...a,children:e.jsx(W.a,{"data-state":c.open?"open":"closed",...s,ref:r,onPointerEnter:C(n.onPointerEnter,w(c.onOpen)),onPointerLeave:C(n.onPointerLeave,w(c.onClose)),onFocus:C(n.onFocus,c.onOpen),onBlur:C(n.onBlur,c.onClose),onTouchStart:C(n.onTouchStart,f=>f.preventDefault())})})},"HoverCardTrigger")),B="HoverCardPortal",[ye,De]=F(B,{forceMount:void 0}),Ee=b(t=>{const{__scopeHoverCard:n,forceMount:r,children:o,container:s}=t,c=H(B,n);return e.jsx(ye,{scope:n,forceMount:r,children:e.jsx(M,{present:r||c.open,children:e.jsx(J,{asChild:!0,container:s,children:o})})})},"HoverCardPortal"),k="HoverCardContent",Oe=l.forwardRef(b(function(n,r){const o=De(k,n.__scopeHoverCard),{forceMount:s=o.forceMount,...c}=n,a=H(k,n.__scopeHoverCard);return e.jsx(M,{present:s||a.open,children:e.jsx(_e,{"data-state":a.open?"open":"closed",...c,onPointerEnter:C(n.onPointerEnter,w(a.onOpen)),onPointerLeave:C(n.onPointerLeave,w(a.onClose)),ref:r})})},"HoverCardContent")),_e=l.forwardRef(b(function(n,r){const{__scopeHoverCard:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:a,onInteractOutside:f,...x}=n,i=H(k,o),p=L(o),v=l.useRef(null),g=X(r,v),[u,m]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return T=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=T,d.style.webkitUserSelect=T}}},[u]),l.useEffect(()=>{if(v.current){const d=b(()=>{m(!1),i.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(i.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!1}}},[i.isPointerDownOnContentRef,i.hasSelectionRef]),l.useEffect(()=>{v.current&&K(v.current).forEach(j=>j.setAttribute("tabindex","-1"))}),e.jsx(Z,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:C(a,d=>{d.preventDefault()}),onDismiss:i.onDismiss,children:e.jsx(q,{...p,...x,onPointerDown:C(x.onPointerDown,d=>{d.currentTarget.contains(d.target)&&m(!0),i.hasSelectionRef.current=!1,i.isPointerDownOnContentRef.current=!0}),ref:g,style:{...x.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function w(t){return n=>n.pointerType==="touch"?void 0:t()}b(w,"excludeTouch");function K(t){const n=[],r=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:b(o=>o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;r.nextNode();)n.push(r.currentNode);return n}b(K,"getTabbableNodes");var Le=He,$e=ke,Ie=Ee,Ue=Oe;function qe({...t}){return e.jsx(Le,{"data-slot":"hover-card",...t})}function et({...t}){return e.jsx($e,{"data-slot":"hover-card-trigger",...t})}function tt({className:t,align:n="center",sideOffset:r=4,...o}){const s=ee();return e.jsx(Ie,{"data-slot":"hover-card-portal",container:s,children:e.jsx(Ue,{"data-slot":"hover-card-content",align:n,sideOffset:r,className:te("bg-dui-popover text-dui-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 border-dui-border z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden motion-reduce:animate-none!",t),...o})})}function Me(t,n,r){return r?ne(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:se.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${re(t)}`}}:null:null}function ze(t,n,r){return t?[t]:n||Re(r)}function Ae({runtime:t,types:n,requirements:r,registeredTypes:o=[],onRecheck:s,isRechecking:c=!1,renderConnect:a}){const f=A(),x=ze(t,n,o);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[x.map(i=>e.jsx(Fe,{type:i,requirements:r,registered:o.includes(i),renderConnect:a},i)),s&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:s,disabled:c,children:[e.jsx(me,{className:E("size-3.5",c&&!f&&"animate-spin")}),"Check again"]})]})]})}function Fe({type:t,requirements:n,registered:r,renderConnect:o}){var N,P,$;const s=y(t),c=s.icon,a=n==null?void 0:n.runtimes[t],f=z(n,t,r),x=f.state==="ready",[i,p]=l.useState(!1),[v,g]=l.useState(!1);!x&&v&&g(!1);const u=x?Me(t,a==null?void 0:a.provider,!!o):null,m=a==null?void 0:a.dependencies.find(R=>R.status!=="satisfied"&&R.installHint),d=(m==null?void 0:m.installHint)??((N=s.setup)==null?void 0:N.installCommand),j=(m==null?void 0:m.infoUrl)??((P=s.setup)==null?void 0:P.infoUrl),h=!!a||!!s.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:s.label})]}),x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(D,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[o==null?void 0:o({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),f.state==="unknown"&&e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:($=a==null?void 0:a.dependencies.find(R=>R.status==="unknown"))==null?void 0:$.description}),!x&&f.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Be,{type:t,connect:f.connect,renderConnect:o,installCommand:d,installInfoUrl:j,onShowDetails:()=>p(!0)})}),h&&e.jsxs(xe,{open:i,onOpenChange:p,className:"mt-3",children:[e.jsxs(pe,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(ve,{className:E("size-3.5 transition-transform",i&&"rotate-180")}),"Setup details"]}),e.jsx(he,{className:"mt-3 space-y-3",children:a?a.dependencies.map(R=>e.jsx(Ye,{dep:R},R.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(je,{children:["runtimes.",t]})," in your DorkOS config."]}),s.setup&&e.jsx(O,{command:s.setup.installCommand,infoUrl:s.setup.infoUrl,copyLabel:`Copy install command for ${s.label}`})]})})]})]})}function Be({type:t,connect:n,renderConnect:r,installCommand:o,installInfoUrl:s,onShowDetails:c}){return n.kind==="install"?e.jsx(Ke,{type:t,label:n.label,installCommand:o,installInfoUrl:s}):r&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:r({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:c,children:n.label})}function Ke({type:t,label:n,installCommand:r,installInfoUrl:o}){const s=y(t),{provision:c,isPending:a,isError:f,errorMessage:x,progress:i,result:p}=Ne(t);return a||p!=null&&p.ok?e.jsx(Ge,{message:(i==null?void 0:i.message)??`Installing ${s.label}…`}):f?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x}),r&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:r,infoUrl:o,copyLabel:`Copy install command for ${s.label}`})]}),e.jsx(S,{size:"sm",onClick:c,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:c,children:n}),r&&e.jsx(Pe,{command:r,runtimeLabel:s.label})]})}function Ge({message:t}){const n=A();return e.jsxs(I.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(Ce,{size:"xs",className:E("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(be,{mode:"wait",children:e.jsx(I.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ye({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(D,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(ge,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function nt({runtime:t,open:n,onOpenChange:r,renderConnect:o,onRuntimeReady:s,showConnectSuccess:c=!1}){const a=ae(),{data:f}=oe(),x=t?y(t):null,i=z(a.data,t??"",f?t!==void 0&&t in f.capabilities:!0),p=a.data!==void 0,v=x!==null&&p&&i.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(s==null||s(t))},[n,p,v,t,s]);const[u,m]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&m(null),d.current=n},[n]);const j=o&&(c?h=>o({...h,onConnected:N=>{var P;(P=h.onConnected)==null||P.call(h,N),m(N)}}):o);return e.jsx(ie,{open:n,onOpenChange:r,children:e.jsxs(ce,{className:"sm:max-w-md",children:[e.jsxs(le,{children:[e.jsx(de,{children:x?x.label:"Your runtimes"}),e.jsx(ue,{children:u?"Connected.":x?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(fe,{children:u?e.jsx(Qe,{success:u,onDone:()=>r(!1)}):e.jsx(Ae,{runtime:t,requirements:a.data,registeredTypes:f?Object.keys(f.capabilities):void 0,onRecheck:()=>void a.refetch(),isRechecking:a.isFetching,renderConnect:j})})]})})}function Qe({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(D,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{qe as H,nt as R,et as a,tt as b,Ae as c};
|