dorkos 0.114.1 → 0.115.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +38561 -38244
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-BRHiWrvg.js → AboutPage-Cz8ijNrK.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-DGwKpdjB.js → ActivityErrorState-BzmfwxSZ.js} +1 -1
- package/dist/client/assets/ActivityPage-BK7T3OiI.js +1 -0
- package/dist/client/assets/{ActivityRow-TjAMUrcU.js → ActivityRow-Ig5atv15.js} +1 -1
- package/dist/client/assets/{AdapterIcon-B-NJfk_R.js → AdapterIcon-BXPv5J8h.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-CrdiWINL.js → AdapterSetupWizard-BEziztL3.js} +2 -2
- package/dist/client/assets/AgentOptionRow-BqFQvFeN.js +1 -0
- package/dist/client/assets/AgentPicker-dCfEIsU-.js +1 -0
- package/dist/client/assets/{AgentRequestCard-BRINjair.js → AgentRequestCard-BAhfGJxx.js} +3 -3
- package/dist/client/assets/AppearancePage-7qHhFeEv.js +1 -0
- package/dist/client/assets/ApplyToOverridesDialog-jqOFh0d1.js +1 -0
- package/dist/client/assets/AttentionSignalRow-3CgglXkd.js +1 -0
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-C-BpNthi.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-BMKtHI0D.js} +3 -3
- package/dist/client/assets/BindingDialog-DSBxRyzA.js +1 -0
- package/dist/client/assets/{BlintzCanvas-DCU4iOtF.js → BlintzCanvas-CyRuqAJV.js} +1 -1
- package/dist/client/assets/{CanvasCsvContent-oayJjsGq.js → CanvasCsvContent-Bd1c6TGx.js} +4 -4
- package/dist/client/assets/CanvasFileContent-DelYwSH8.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-BExIu4RY.js +2 -0
- package/dist/client/assets/ChatAppsOff-SWemSaUp.js +6 -0
- package/dist/client/assets/{CodeMirrorDiff-j0jAFw_i.js → CodeMirrorDiff-0WF4ITRZ.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-DWgnGEHZ.js → CodeMirrorEditor-Bg7wC_Q8.js} +1 -1
- package/dist/client/assets/CommitmentList-CTvEGUV3.js +1 -0
- package/dist/client/assets/{CommitmentsPage-_vCusfuJ.js → CommitmentsPage-C68etoLe.js} +1 -1
- package/dist/client/assets/ConnectionAccessLists-9oeVn_GK.js +1 -0
- package/dist/client/assets/ConnectionsPage-CJOY4-kp.js +6 -0
- package/dist/client/assets/ConventionPage-DD-f5o6y.js +11 -0
- package/dist/client/assets/{ExtensionPageRoute-XXcMwrQY.js → ExtensionPageRoute-C6fW17AG.js} +2 -2
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-C8yf1gK7.js → FloatingTanStackRouterDevtools-CqogiFob-Zccd0fv6.js} +1 -1
- package/dist/client/assets/HandlePage-DOxlquWl.js +1 -0
- package/dist/client/assets/HeartbeatPage-cJM6NuTD.js +1 -0
- package/dist/client/assets/KeyEntry-K5k_3TfU.js +6 -0
- package/dist/client/assets/{LexicalField-Dr5vnDVn.js → LexicalField-DB5V20zv.js} +2 -2
- package/dist/client/assets/{ManagesPage-Dj_UOeFQ.js → ManagesPage-Cj0-hwfr.js} +1 -1
- package/dist/client/assets/{Marketplace-RwZrKU4O.js → Marketplace-eWEtLmd9.js} +2 -2
- package/dist/client/assets/{MarketplaceSourcesView-xSimTjA0.js → MarketplaceSourcesView-B1h70C20.js} +1 -1
- package/dist/client/assets/{McpAppFrame-Er6EX82b.js → McpAppFrame-BaJ_r-QR.js} +2 -2
- package/dist/client/assets/McpSigninBody-Coaq5Fkf.js +1 -0
- package/dist/client/assets/{Model3dViewer-D5xu-FCi.js → Model3dViewer-cKa-Jnbl.js} +1 -1
- package/dist/client/assets/NamePage-W7Frb1yy.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-DiI_GTiE.js → NewDirectMessageMenu-C4zNIv9x.js} +1 -1
- package/dist/client/assets/{NotificationsPage-B_XMIlHt.js → NotificationsPage-gKNClvNU.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-BjiejioP.js → OpenMeshSwitch-RzB2u6-Q.js} +2 -2
- package/dist/client/assets/OperatorIdentityForm-B_78Vqh8.js +1 -0
- package/dist/client/assets/PermissionHistory-DrtlA4YM.js +1 -0
- package/dist/client/assets/PermissionsPage-O7kUVaQv.js +1 -0
- package/dist/client/assets/{PersonalityPopover-BT-aQ65s.js → PersonalityPopover-DiNuuoWu.js} +1 -1
- package/dist/client/assets/PhotoPage-DdBke3yj.js +1 -0
- package/dist/client/assets/PresetPicker-BUFwg8RS.js +19 -0
- package/dist/client/assets/{PreviewRefusedNotice-DJyQxUFv.js → PreviewRefusedNotice-DXZp669C.js} +1 -1
- package/dist/client/assets/ProfileFields-BCfMzNcT.js +1 -0
- package/dist/client/assets/ProfilePanelContainer-BzC2MGdi.js +1 -0
- package/dist/client/assets/ProfileRolePicker-f0FKXLtu.js +1 -0
- package/dist/client/assets/PromptSuggestionChips-EgeMFibt.js +1 -0
- package/dist/client/assets/ReportsToPopover-CQ4Xxslu.js +1 -0
- package/dist/client/assets/RoomSurface-oDbc6jnO.js +44 -0
- package/dist/client/assets/{RoomsPage-D0795GTq.js → RoomsPage-D_EbiSZ3.js} +1 -1
- package/dist/client/assets/RunsOnPopover-LtmmbIsD.js +1 -0
- package/dist/client/assets/RuntimeConnectFlow-Kv2ytk2m.js +1 -0
- package/dist/client/assets/RuntimeSetupDialog-CiWxlcPc.js +1 -0
- package/dist/client/assets/{SessionsPage-DbIKrtbg.js → SessionsPage-1rDO0SGV.js} +1 -1
- package/dist/client/assets/SettingsDialog-_ctp2AfE.js +12 -0
- package/dist/client/assets/SkillsPage-gPuQHKps.js +1 -0
- package/dist/client/assets/TaskDialogWrapper-BPFpCgsN.js +1 -0
- package/dist/client/assets/TasksEmptyState-D0Jlzmed.js +3 -0
- package/dist/client/assets/TasksPage-DvGfg5Bk.js +1 -0
- package/dist/client/assets/{ToolsPage-gUYaNA1-.js → ToolsPage-B0qZ85pR.js} +2 -2
- package/dist/client/assets/{TopologyGraph-KPxRfshp.js → TopologyGraph-q1ammgpG.js} +3 -3
- package/dist/client/assets/TourHost-Dc8qw1Ef.js +1 -0
- package/dist/client/assets/{UnlinkDialog-RuuQUyOF.js → UnlinkDialog-DXdrLsGV.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-BojvLOeP.js → WidgetErrorCard-ChDNC060.js} +23 -23
- package/dist/client/assets/_shell-BxPza3Lx.js +88 -0
- package/dist/client/assets/{_shell._home-C-OJaDmg.js → _shell._home-DjGunhLV.js} +1 -1
- package/dist/client/assets/_shell._home.activity-B014dET1.js +1 -0
- package/dist/client/assets/_shell._home.index-DEmtTHZg.js +3 -0
- package/dist/client/assets/_shell._home.tasks-CnDEbUOd.js +1 -0
- package/dist/client/assets/_shell._home.workspaces-AQtMUWuu.js +1 -0
- package/dist/client/assets/{_shell.channels-Cpde6Iix.js → _shell.channels-C8NOhmJd.js} +4 -4
- package/dist/client/assets/_shell.connections-Bxe0wxOB.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-BBEuotuF.js → _shell.feedback-requests-C6ku9F5_.js} +2 -2
- package/dist/client/assets/_shell.marketplace-CEnzWFmI.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-BZq1d2ih.js +1 -0
- package/dist/client/assets/_shell.session-Dn0C0mEZ.js +66 -0
- package/dist/client/assets/{_shell.team-4bF5Nn4_.js → _shell.team-DoLdOMoC.js} +5 -5
- package/dist/client/assets/_shell.x._extensionId-DhE3OYMF.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-DhE3OYMF.js +1 -0
- package/dist/client/assets/access-copy-CBGtcTk0.js +1 -0
- package/dist/client/assets/{agent-browser-BIsnzdje.js → agent-browser-DbcLtsAx.js} +1 -1
- package/dist/client/assets/{banner-Dll8KWyW.js → banner-rPsz3suJ.js} +2 -2
- package/dist/client/assets/{card-5POMzMJ6.js → card-BqN3lfJn.js} +1 -1
- package/dist/client/assets/command-ZTLTCj0l.js +1 -0
- package/dist/client/assets/cpu-D70xMHl2.js +11 -0
- package/dist/client/assets/dead-letter-reasons-DtBHju9v.js +1 -0
- package/dist/client/assets/empty-state-yl1dLwLN.js +1 -0
- package/dist/client/assets/execution-config-BbBEe6FO.js +1 -0
- package/dist/client/assets/{file-CY9v6yos.js → file-CGg2M6ED.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DNS4eVZR.js → file-exclamation-point-DZrVsShR.js} +1 -1
- package/dist/client/assets/{file-text-BQ5NBk6w.js → file-text-BYq_4IAt.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-BC8zM39x.js → find-latest-widget-fence-CWs9nr10.js} +4 -4
- package/dist/client/assets/form-vPuXuaYT.js +1 -0
- package/dist/client/assets/format-cron-D02Tnupo.js +1 -0
- package/dist/client/assets/{git-branch-34CUrn_R.js → git-branch-DbjXDO_F.js} +1 -1
- package/dist/client/assets/{heart-B5oPCBeT.js → heart-Dblp_miM.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-DeDxlHr7.js → highlighted-body-KPVGNVTW-CaMXMak-.js} +1 -1
- package/dist/client/assets/{index-Cdi4wcy2.js → index-B-WvQ24u.js} +7 -7
- package/dist/client/assets/{index-Bvr-_HFb.js → index-BKuzoeSn.js} +1 -1
- package/dist/client/assets/{index-CfPs0N2z.js → index-BOL391En.js} +1 -1
- package/dist/client/assets/{index-C6XffNP5.js → index-BPqkuMIa.js} +1 -1
- package/dist/client/assets/{index-Svn7q7Oq.js → index-BPwUl0Bz.js} +1 -1
- package/dist/client/assets/{index-CkfVcaGE.js → index-BV0tZnYg.js} +1 -1
- package/dist/client/assets/{index-obtMBZBo.js → index-BW98owO8.js} +1 -1
- package/dist/client/assets/{index-Cw1lCYXU.js → index-Bd23EYYT.js} +2 -2
- package/dist/client/assets/{index-hw9zI0x5.js → index-BdVOtoFr.js} +1 -1
- package/dist/client/assets/{index-C_nYZwKl.js → index-Bi7Um5RU.js} +1 -1
- package/dist/client/assets/{index-DvSjlchr.js → index-BiIbMZ6d.js} +36 -36
- package/dist/client/assets/{index-DipT3Tl7.js → index-BxqUb-n7.js} +1 -1
- package/dist/client/assets/{index-BfY2tknC.js → index-BzczIyv5.js} +1 -1
- package/dist/client/assets/index-C6NUjpzQ.js +38 -0
- package/dist/client/assets/{index-BCJdsNmC.js → index-C88NZagl.js} +1 -1
- package/dist/client/assets/{index-BM9_nnxH.js → index-CHvi6xUU.js} +1 -1
- package/dist/client/assets/{index-BWj2VXUd.js → index-CMWMhbec.js} +1 -1
- package/dist/client/assets/{index-HmNnK1_1.js → index-CN9fywRC.js} +1 -1
- package/dist/client/assets/{index-yDaSJS2Z.js → index-CRZXSh_q.js} +1 -1
- package/dist/client/assets/{index-sLuAyJv-.js → index-CWNsRK97.js} +1 -1
- package/dist/client/assets/index-CaLw69VE.js +1 -0
- package/dist/client/assets/index-CdKpQ1hI.js +1018 -0
- package/dist/client/assets/{index-CiOdQLWf.js → index-CrK4rKAq.js} +1 -1
- package/dist/client/assets/{index-B_LR9e6q.js → index-D16KF-iC.js} +3 -3
- package/dist/client/assets/index-D6m2SWHr.js +1 -0
- package/dist/client/assets/index-DDYi817r.js +1 -0
- package/dist/client/assets/{index-DjQZM7xU.js → index-Db2EOzA3.js} +1 -1
- package/dist/client/assets/index-DdbHrvr0.js +1 -0
- package/dist/client/assets/{index-D1AN47IZ.js → index-Dg_bax15.js} +3 -3
- package/dist/client/assets/index-DwUdUliR.js +1 -0
- package/dist/client/assets/{index-Dl3NBIFK.js → index-DzeYt-GT.js} +1 -1
- package/dist/client/assets/{index-D6QoZ_JK.js → index-Gq3gqBhY.js} +1 -1
- package/dist/client/assets/index-O_HMols_.js +1 -0
- package/dist/client/assets/{index-juObjGCH.js → index-P5j6zmcN.js} +1 -1
- package/dist/client/assets/{index-BeH3ljiU.js → index-XE46wAj9.js} +1 -1
- package/dist/client/assets/{index-BZYcFunZ.js → index-Z8YcKwIB.js} +1 -1
- package/dist/client/assets/{index-DFEF2MFy.css → index-kktlr1TJ.css} +1 -1
- package/dist/client/assets/{index-BfoRyh9U.js → index-lNMJBFB0.js} +1 -1
- package/dist/client/assets/{index-CFakjglG.js → index-oWLYcpm4.js} +1 -1
- package/dist/client/assets/{index-CbUkmP4v.js → index-vRc1D4KI.js} +1 -1
- package/dist/client/assets/inline-code-Cvn43Gqu.js +1 -0
- package/dist/client/assets/{layers-5nJbTYJI.js → layers-Bmz62WF4.js} +1 -1
- package/dist/client/assets/{lightbulb-CTbrj6Bh.js → lightbulb-CAd6slmc.js} +1 -1
- package/dist/client/assets/link-2-C0mn8T24.js +6 -0
- package/dist/client/assets/list-runtime-types-DxwGcKLx.js +1 -0
- package/dist/client/assets/{markdown-content-BWVUF3Ll.js → markdown-content-1-B7PdbY.js} +1 -1
- package/dist/client/assets/{mention-pill-DlZf_ikY.js → mention-pill-D_-KXznh.js} +1 -1
- package/dist/client/assets/{message-square-off-DwAOErT_.js → message-square-off-Di7kQvfe.js} +1 -1
- package/dist/client/assets/more-details-C6UGVeDE.js +1 -0
- package/dist/client/assets/{owner-notice-De98Vj3z.js → owner-notice-CudDDBX4.js} +1 -1
- package/dist/client/assets/{package-B1hSUoIL.js → package-D2eMoFCI.js} +1 -1
- package/dist/client/assets/{page-container-DTyW7UJt.js → page-container-CDHAACRA.js} +1 -1
- package/dist/client/assets/{paperclip-CoxP50ae.js → paperclip-p0W24D54.js} +1 -1
- package/dist/client/assets/path-input-j04LMj9z.js +1 -0
- package/dist/client/assets/primer-trigger-DkCcHf2Q.js +3 -0
- package/dist/client/assets/profile-errors-CqflLCzu.js +1 -0
- package/dist/client/assets/progress-BcuH4Eod.js +6 -0
- package/dist/client/assets/query-error-state-CEZs7dhg.js +1 -0
- package/dist/client/assets/{radio-WZhvBdvS.js → radio-DGWfQ5Rf.js} +1 -1
- package/dist/client/assets/registry-ChxwU0f4.js +1 -0
- package/dist/client/assets/relay-trace-schemas-y0nd8fzi.js +6 -0
- package/dist/client/assets/{room-files-source-B2H-CIeN.js → room-files-source-C1TCg4W_.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-DFGhE-_C.js → rotate-ccw-clock-DcBojy-0.js} +1 -1
- package/dist/client/assets/{rotate-cw-DiWMKflx.js → rotate-cw-D0vUyeR2.js} +1 -1
- package/dist/client/assets/runtime-connect-Dn0T5YWv.js +1 -0
- package/dist/client/assets/{scroll-area-BJrXoUrS.js → scroll-area-CQ9lO56h.js} +1 -1
- package/dist/client/assets/{search-x-CPf5yiSS.js → search-x-EJGj73JB.js} +2 -2
- package/dist/client/assets/settings-for-runtime-BoOa-ZFG.js +1 -0
- package/dist/client/assets/shield-check-Bp58y9u7.js +6 -0
- package/dist/client/assets/{shield-x-D-yr2n7H.js → shield-x-jF_NCCvp.js} +1 -1
- package/dist/client/assets/soul-file-Cag2i87x.js +1 -0
- package/dist/client/assets/{table-B3kRSRyK.js → table-D89CWVJX.js} +1 -1
- package/dist/client/assets/terminal-BUhNMZAt.js +6 -0
- package/dist/client/assets/trust-posture-15DMDZTA.js +1 -0
- package/dist/client/assets/unplug-opnrSXAi.js +6 -0
- package/dist/client/assets/unverified-catalog-notice-DHM5Coia.js +1 -0
- package/dist/client/assets/use-adapter-catalog-ClMqVelU.js +1 -0
- package/dist/client/assets/use-bindings-Ch6UUBvz.js +1 -0
- package/dist/client/assets/use-composer-prefs-Qn7KRpYe.js +1 -0
- package/dist/client/assets/{use-connector-management-2rrubqr1.js → use-connector-management-dX_4x0d3.js} +1 -1
- package/dist/client/assets/use-deep-link-scroll-BV2fY4gy.js +1 -0
- package/dist/client/assets/use-delete-binding-BklxjB_c.js +1 -0
- package/dist/client/assets/{use-dev-links-BIxj0Pjl.js → use-dev-links-D4Bqam6F.js} +1 -1
- package/dist/client/assets/use-external-adapter-catalog-nHiD8BKZ.js +1 -0
- package/dist/client/assets/use-full-activity-feed-vYU7wQWT.js +1 -0
- package/dist/client/assets/use-is-below-desktop-G-mTu2Ga.js +1 -0
- package/dist/client/assets/{use-jump-back-in-CD5wYoFA.js → use-jump-back-in-BVunjzyr.js} +3 -3
- package/dist/client/assets/{use-mesh-topology-3LbL6yfa.js → use-mesh-topology-NaUKSKol.js} +1 -1
- package/dist/client/assets/use-mounted-ref-BWpQ8f91.js +1 -0
- package/dist/client/assets/use-notification-prefs-qO1zRRFN.js +1 -0
- package/dist/client/assets/{use-panel-tab-placements-CTNXdvC6.js → use-panel-tab-placements-Db6p2vLD.js} +1 -1
- package/dist/client/assets/use-pending-read-DUqJZUza.js +1 -0
- package/dist/client/assets/use-personality-commit-DUEKxHt_.js +1 -0
- package/dist/client/assets/{use-promo-activation-DCy9ROgP.js → use-promo-activation-CnGaw39P.js} +2 -2
- package/dist/client/assets/use-promo-dismissals-bkSHhGhj.js +1 -0
- package/dist/client/assets/{use-pulse-freshness-CRHnQO_-.js → use-pulse-freshness-Oc_1gs-Y.js} +1 -1
- package/dist/client/assets/use-relay-config-Ba-S4wxY.js +1 -0
- package/dist/client/assets/{use-room-follow-claim-FWatOD5-.js → use-room-follow-claim-DqE5b95Z.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-C56ygMxj.js → use-roving-tab-list-DnMqliqf.js} +1 -1
- package/dist/client/assets/{use-session-canvas-Dsmt92or.js → use-session-canvas-OdljtBE8.js} +4 -4
- package/dist/client/assets/{use-session-diagnostics-ypmmhIlN.js → use-session-diagnostics-CtjxsM8_.js} +4 -4
- package/dist/client/assets/use-unclaimed-chats-5RCD5wIp.js +1 -0
- package/dist/client/assets/use-update-config-xkznZMHr.js +1 -0
- package/dist/client/assets/useMutationState-Mjr_y4xX.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +7086 -6336
- package/dist/server/index.js.map +2 -2
- package/package.json +5 -5
- package/dist/client/assets/ActivityPage-C-lpXfva.js +0 -1
- package/dist/client/assets/AppearancePage-COdpfn1g.js +0 -1
- package/dist/client/assets/AttentionSignalRow-Dc8laCri.js +0 -1
- package/dist/client/assets/CanvasFileContent-C-aDKKws.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-Dnx6oUx2.js +0 -2
- package/dist/client/assets/CommitmentList-CCsDbGY2.js +0 -1
- package/dist/client/assets/ConnectionAccessLists-umV6IbYS.js +0 -1
- package/dist/client/assets/ConnectionsPage-2iGwApEi.js +0 -6
- package/dist/client/assets/ConventionPage-Bucu3-TK.js +0 -11
- package/dist/client/assets/HandlePage-BotSAp8X.js +0 -1
- package/dist/client/assets/HeartbeatPage-CVAZeDqg.js +0 -1
- package/dist/client/assets/McpSigninBody-DMK94EGx.js +0 -1
- package/dist/client/assets/NamePage-NZ40HlPR.js +0 -1
- package/dist/client/assets/OperatorIdentityForm-H7l8r2VC.js +0 -1
- package/dist/client/assets/PermissionsPage-DVV9vtoW.js +0 -1
- package/dist/client/assets/PhotoPage-DKgOQCBH.js +0 -1
- package/dist/client/assets/PromptSuggestionChips-Dw7RA2P1.js +0 -1
- package/dist/client/assets/ReportsToPopover-fxu1r9iw.js +0 -1
- package/dist/client/assets/RoomSurface-D4Etqadg.js +0 -44
- package/dist/client/assets/RunsOnPopover-Cp8EMGHD.js +0 -1
- package/dist/client/assets/RuntimeSetupDialog-Cxtz9b_r.js +0 -1
- package/dist/client/assets/SkillsPage-DYSIGciZ.js +0 -1
- package/dist/client/assets/TasksPage-DoEP7ZsZ.js +0 -1
- package/dist/client/assets/TourHost-BIozl4IA.js +0 -1
- package/dist/client/assets/_shell-BMQyJ7r4.js +0 -88
- package/dist/client/assets/_shell._home.activity-Bvsxue6y.js +0 -1
- package/dist/client/assets/_shell._home.index-DXnd_q3h.js +0 -3
- package/dist/client/assets/_shell._home.tasks-Mz-iO--x.js +0 -1
- package/dist/client/assets/_shell._home.workspaces-ChuVp2dK.js +0 -1
- package/dist/client/assets/_shell.connections-CxgvSPjQ.js +0 -1
- package/dist/client/assets/_shell.marketplace-Hk6n4nNt.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-B8f38K6K.js +0 -1
- package/dist/client/assets/_shell.session-DsF1tXPP.js +0 -66
- package/dist/client/assets/_shell.x._extensionId-B6J6mDaT.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-B6J6mDaT.js +0 -1
- package/dist/client/assets/index-BTkflOTk.js +0 -1
- package/dist/client/assets/index-BqtFX8p5.js +0 -1
- package/dist/client/assets/index-C-DMBd4V.js +0 -1
- package/dist/client/assets/index-C4ZJEVQG.js +0 -1
- package/dist/client/assets/index-C9NjdeaX.js +0 -38
- package/dist/client/assets/index-d-DK54t2.js +0 -1099
- package/dist/client/assets/index-tdK5EJaB.js +0 -1
- package/dist/client/assets/index-wx8w6kby.js +0 -1
- package/dist/client/assets/kickoff-BwvlCy0n.js +0 -3
- package/dist/client/assets/soul-file-D0y7QIBL.js +0 -1
- package/dist/client/assets/use-delete-binding-BKhK3a7C.js +0 -1
- package/dist/client/assets/use-external-adapter-catalog-XS0vyTlS.js +0 -1
- package/dist/client/assets/use-full-activity-feed-CwqKSvpf.js +0 -1
- package/dist/client/assets/use-is-below-desktop-Dzs5i_TM.js +0 -1
- package/dist/client/assets/use-pending-read-sDmA-i7r.js +0 -1
- package/dist/client/assets/use-personality-commit-B13DSXxo.js +0 -1
- package/dist/client/assets/use-unclaimed-chats-C_bsrJFb.js +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{r as x,a2 as Jt,ny as wt,nz as sa,eH as Zt,j as e,nA as ta,nB as na,cE as Gs,cF as Qs,nC as aa,cG as ra,nD as ia,cI as Xs,cJ as Js,nE as oa,nF as la,nG as ca,nH as da,nI as ua,nJ as ma,Q as M,nK as xa,bF as Re,W as ke,nL as ha,nM as pa,e as X,bm as R,bn as E,f7 as oe,be as Ie,B as v,x as us,dE as Zs,bo as L,fY as ye,gE as ms,nN as ga,jV as fa,X as et,fZ as be,f_ as me,f$ as xe,g0 as he,g1 as pe,g2 as ge,g3 as fe,a7 as $e,ay as Se,fr as ja,g8 as en,nO as st,a9 as V,aa as G,e1 as Ee,I as re,dW as ee,dX as se,dY as te,dZ as ne,d_ as P,iq as tt,R as ze,hg as sn,et as ns,nP as ya,nQ as ba,a6 as nt,nR as va,eu as tn,ev as nn,ew as an,ex as rn,ey as on,nS as Na,a8 as W,bQ as ka,aw as Xe,a5 as ae,bL as we,fs as ln,nT as Ct,j_ as cn,h$ as wa,C as as,Y as xs,Z as hs,f as Ca,a0 as ps,kd as Sa,en as _,dC as le,dR as gs,iZ as fs,dz as qe,dT as js,hY as Aa,h_ as at,kO as Ta,nU as Fe,nV as Da,nW as Oa,nX as Ra,nY as Ea,ae as Le,nZ as Ia,e4 as ys,n_ as rs,cH as dn,dB as un,dh as mn,n$ as La,o0 as Pa,o1 as _a,o2 as $a,o3 as Fa,o4 as Ma,o5 as za,o6 as Ua,o7 as Ba,i_ as Ka,o8 as qa,i1 as As,b0 as Ce,aA as H,$ as Ue,dV as Wa,eL as bs,eM as Pe,kL as xn,gs as Ya,gz as Ha,gw as hn,bV as ie,gy as vs,h6 as Va,gv as Ga,o9 as Qa,aU as Xa,bG as Ja,bH as Za,oa as er,bI as sr,bK as tr,ob as nr,l3 as Ms,oc as zs,cv as ar,dP as rr,at as is,ab as Be,od as ir,oe as Oe,ic as or,id as St,of as lr,og as rt,oh as pn,oi as Ne,oj as cr,ok as dr,dU as gn,lB as ur,gF as mr,af as fn,ol as jn,dy as it,ag as ot,ap as xr,aq as hr,b$ as pr,g6 as gr,dQ as fr,om as jr,cB as yr,eR as br,eS as vr,eT as Nr,ar as kr,i$ as yn,j0 as wr,hD as Cr,on as Sr,dp as Ar,k5 as Tr,cU as Dr,cV as Or,cW as Rr,dd as bn,iz as lt,oo as Er,op as Ir,oq as Te,or as Je,os as At,ot as Tt,ou as Lr,ov as Pr,g4 as _r,cd as vn,l as Nn,y as $r,ow as Fr,ox as Mr,dA as zr,oy as Ur,hc as Br,dD as kn,dF as Kr,aP as qr,fq as Wr,h8 as _e,bl as Yr,oz as Hr,oA as Vr,oB as Gr,hX as Qr,ms as Xr,oC as Jr,oD as Zr,fU as ei,n as si,bg as ti,hl as ni,kc as ai,hk as ri,ju as ii}from"./index-CdKpQ1hI.js";import{a as oi}from"./ProfilePanelContainer-BzC2MGdi.js";import{u as je}from"./use-update-config-xkznZMHr.js";import{u as li,a as ci}from"./use-composer-prefs-Qn7KRpYe.js";import{I as Ke}from"./trust-posture-15DMDZTA.js";import{T as di,a as ui,B as os,u as mi,i as ls,f as ss,r as xi,b as Dt,w as Ts,c as ct,d as Us,C as wn,e as hi,g as pi,K as gi,U as fi,S as ji,h as yi,j as bi,k as vi,P as Ni,O as ki,W as wi}from"./PresetPicker-BUFwg8RS.js";import{u as Cn,a as Ci,i as Si}from"./use-notification-prefs-qO1zRRFN.js";import{u as Sn}from"./use-bindings-Ch6UUBvz.js";import{M as Ns}from"./more-details-C6UGVeDE.js";import{u as An}from"./use-deep-link-scroll-BV2fY4gy.js";import{a as Ai,u as dt}from"./use-relay-config-Ba-S4wxY.js";import{Q as ks}from"./query-error-state-CEZs7dhg.js";import{b as ws,c as Ti,C as Di,u as Oi,a as Ri,K as Ei}from"./KeyEntry-K5k_3TfU.js";import{s as Ii,e as ut}from"./access-copy-CBGtcTk0.js";import{u as Tn,b as Li}from"./use-adapter-catalog-ClMqVelU.js";import{C as Pi,R as _i,g as $i,u as Fi,r as Mi}from"./ChatAppsOff-SWemSaUp.js";import{a as zi,B as Ui}from"./BindingDialog-DSBxRyzA.js";import{D as Bi,a as Ki}from"./dead-letter-reasons-DtBHju9v.js";import{C as qi}from"./relay-trace-schemas-y0nd8fzi.js";import{u as Dn,B as Wi}from"./ApplyToOverridesDialog-jqOFh0d1.js";import{P as Yi,a as Hi,D as Vi}from"./PermissionHistory-DrtlA4YM.js";import{s as On}from"./settings-for-runtime-BoOa-ZFG.js";import{l as Gi}from"./list-runtime-types-DxwGcKLx.js";import{I as Qi}from"./inline-code-Cvn43Gqu.js";import{r as Bs,d as Rn,a as Xi,D as mt,u as Ji,C as Zi}from"./RuntimeConnectFlow-Kv2ytk2m.js";import{k as eo,e as ts}from"./execution-config-BbBEe6FO.js";import{U as so}from"./unverified-catalog-notice-DHM5Coia.js";import{P as to}from"./path-input-j04LMj9z.js";import{C as no}from"./runtime-connect-Dn0T5YWv.js";import{U as ao}from"./unplug-opnrSXAi.js";import{L as ro}from"./link-2-C0mn8T24.js";import{P as io,S as oo}from"./progress-BcuH4Eod.js";import{S as lo}from"./shield-check-Bp58y9u7.js";import{C as co,a as uo}from"./cpu-D70xMHl2.js";import"./ProfileFields-BCfMzNcT.js";import"./profile-errors-CqflLCzu.js";import"./use-mounted-ref-BWpQ8f91.js";import"./ProfileRolePicker-f0FKXLtu.js";import"./use-promo-dismissals-bkSHhGhj.js";import"./empty-state-yl1dLwLN.js";import"./form-vPuXuaYT.js";import"./useMutationState-Mjr_y4xX.js";import"./terminal-BUhNMZAt.js";function mo({open:s,initialTab:t,defaultTab:n}){const[a,r]=x.useState(t??n),[i,o]=x.useState(s);return s!==i&&(o(s),s&&t&&r(t)),[a,r]}/**
|
|
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 En={name:"palette",size:24,node:[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]]};En.node;const xo=Jt(En);/**
|
|
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 In={name:"settings-2",size:24,node:[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]};In.node;const ho=Jt(In);function po({storageKey:s,dialogOpen:t,activeInGroup:n,activeTab:a}){const[r,i]=x.useState(()=>wt(s,!1)),[o,l]=x.useState(t),c=t&&n?a:null,[d,u]=x.useState(null);let m=r;return t!==o&&(l(t),t&&(m=wt(s,!1))),c!==d&&(u(c),c!==null&&(m=!0)),m!==r&&i(m),[m,p=>{sa(s,p),i(p)}]}function go({open:s,onOpenChange:t,title:n,description:a,headerSlot:r,defaultTab:i,initialTab:o,tabs:l,extensionSlot:c,maxWidth:d="max-w-2xl",minHeight:u="min-h-[280px]",maximized:m=!1,foldedGroup:h,testId:p}){const g=Zt(c??"settings.tabs"),j=c?[...l,...g.map(jo)]:l,y=[];for(const C of j)y.includes(C.group)||y.push(C.group);const b=h==null?void 0:h.group;b!==void 0&&y.includes(b)&&(y.splice(y.indexOf(b),1),y.push(b));const f=j.some(C=>C.group),S=o&&j.some(C=>C.id===o)?o:null;x.useEffect(()=>{},[o,S,i]);const[D,A]=mo({open:s,initialTab:S,defaultTab:i}),T=b!==void 0&&j.some(C=>C.id===D&&C.group===b),[O,N]=po({storageKey:(h==null?void 0:h.storageKey)??"",dialogOpen:s,activeInGroup:T,activeTab:D}),k=x.useId(),Q=C=>C.map(U=>e.jsx(xa,{value:U.id,icon:U.icon,children:U.label},U.id)),q=b===void 0?[]:j.filter(C=>C.group===b&&(O||C.id===D)),$=b!==void 0&&j.some(C=>C.group===b),F=x.useRef(!1);x.useEffect(()=>{var C,U,I;!O||!F.current||(F.current=!1,(I=(U=(C=document.getElementById(k))==null?void 0:C.querySelector("[data-value]"))==null?void 0:U.scrollIntoView)==null||I.call(U,{block:"nearest"}))},[O,k]);const K=$?e.jsxs(e.Fragment,{children:[e.jsx(ta,{expanded:O,onExpandedChange:C=>{F.current=C,N(C)},controls:q.length>0?k:void 0,children:b}),q.length>0&&e.jsx(na,{id:k,label:b,children:Q(q)})]}):void 0;return e.jsx(Gs,{open:s,onOpenChange:t,children:e.jsx(Qs,{"data-testid":p,className:M("max-h-[85vh] gap-0 p-0",d,m&&"md:h-[92svh] md:max-h-[92svh] md:w-[95vw] md:max-w-[90rem]"),children:e.jsxs(aa,{value:D,onValueChange:C=>A(C),children:[e.jsx(ra,{}),e.jsxs(ia,{children:[e.jsx(Xs,{className:"text-sm font-medium",children:n}),e.jsx(Js,{className:a?"text-muted-foreground text-xs":"sr-only",children:a??"Dialog"}),r]}),e.jsxs(oa,{children:[e.jsx(la,{footer:K,children:f?y.filter(C=>C===void 0||C!==b).map(C=>e.jsxs(x.Fragment,{children:[C&&e.jsx(ca,{children:C}),Q(j.filter(U=>U.group===C))]},C??"__ungrouped")):Q(j)}),e.jsx(da,{className:M(u,"p-4"),children:j.map(C=>{const U=C.component;return e.jsx(ua,{value:C.id,children:e.jsxs("div",{className:"max-w-3xl space-y-4",children:[e.jsx(ma,{actions:C.actions,description:C.description,children:C.label}),e.jsx(x.Suspense,{fallback:e.jsx(fo,{}),children:e.jsx(U,{})})]})},C.id)})})]})]})})})}function fo(){return e.jsx("div",{className:"text-muted-foreground py-8 text-center text-sm",children:"Loading…"})}function jo(s){return{id:s.id,label:s.label,icon:s.icon,component:s.component,group:s.group??"Add-ons"}}function Ln(s){if(!(s instanceof Error))return null;const{status:t,body:n}=s;return typeof t=="number"&&typeof n=="object"&&n!==null&&n.error===s.message&&/[.!?]$/.test(s.message.trim())?s.message:null}function yo({className:s}){const[t,n]=x.useState(!1);return e.jsxs("div",{className:M("w-full",s),children:[e.jsx(di,{open:t,onToggle:()=>n(a=>!a)}),e.jsx(Re,{initial:!1,children:t&&e.jsx(ke.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.3,ease:[0,0,.2,1]},className:"overflow-hidden",children:e.jsx("div",{className:"pt-2",children:e.jsx(ui,{})})},"payload")})]})}function Pn(s){return{connectionId:s.connectionId,name:`${Ii(s.toolkit)} (${s.label})`,agentCount:s.agentCount,everyAgent:s.everyAgent!==null,usable:s.readiness.state==="ready"}}function xt(s){return s.filter(t=>t.readiness.state!=="gone"&&t.mode==="managed").map(Pn)}function _n(s){return{stopping:s.filter(t=>t.usable),idle:s.filter(t=>!t.usable)}}function cs(s){return`${s} ${s===1?"app":"apps"}`}function Ot({app:s}){return e.jsxs("li",{children:[s.name,s.everyAgent?e.jsx("span",{className:"text-muted-foreground",children:" · used by every agent"}):s.agentCount>0&&e.jsxs("span",{className:"text-muted-foreground",children:[" ","· used by ",s.agentCount," ",s.agentCount===1?"agent":"agents"]})]})}function Ks({stopping:s,idle:t,stopLine:n}){if(s.length===0&&t.length===0)return null;const a="text-foreground max-h-40 list-disc space-y-1 overflow-y-auto pl-5 text-sm";return e.jsxs("div",{className:"space-y-3 text-sm","data-testid":"connection-impact-list",children:[s.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:n}),e.jsx("ul",{className:a,children:s.map(r=>e.jsx(Ot,{app:r},r.connectionId))})]}),t.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("p",{className:"text-muted-foreground",children:[t.length===1?"This app":`These ${t.length} apps`," can’t be used now either way:"]}),e.jsx("ul",{className:a,children:t.map(r=>e.jsx(Ot,{app:r},r.connectionId))})]})]})}function bo({signedOut:s,children:t}){var m;const{view:n,start:a,unlink:r,cancel:i,starting:o,unlinking:l,startError:c,unlinkError:d}=ha();vo(n,a);const u=((m=pa().data)==null?void 0:m.linked)===!0;return n.kind==="loading"?e.jsx(X,{className:"h-24 w-full"}):n.kind==="linked"?e.jsxs("div",{className:"space-y-4",children:[e.jsx(wo,{view:n,start:a,starting:o,startError:c,dismiss:i}),t,e.jsx(Co,{unlink:r,unlinking:l,unlinkError:d})]}):e.jsxs("div",{className:"space-y-4",children:[!u&&s,e.jsx(R,{children:e.jsx(E,{children:e.jsx(No,{view:n,start:a,cancel:i,starting:o,startError:c,relinking:u})})})]})}function vo(s,t){const{section:n,setSection:a}=oe(),r=x.useRef(!1),i=n===fa;x.useEffect(()=>{if(!i){r.current=!1;return}r.current||s.kind==="loading"||(r.current=!0,a(null),s.kind!=="pending"&&t())},[i,s.kind,t,a])}function No({view:s,start:t,cancel:n,starting:a,startError:r,relinking:i}){switch(s.kind){case"idle":return e.jsx(ko,{start:t,starting:a,startError:r});case"pending":return e.jsx(ga,{view:s,cancel:n,relinking:i},s.userCode);case"expired":return e.jsx(Ds,{title:"Your code expired",description:"It ran out before you approved it.",actionLabel:"Get a new code",onAction:t,pending:a});case"denied":return e.jsx(Ds,{title:"Link request denied",description:"It was turned down on dorkos.ai.",actionLabel:"Link this computer",onAction:t,pending:a});case"revoked":return e.jsx(Ds,{title:"This computer was unlinked",description:"DorkOS removed its access to your account.",actionLabel:"Link again",onAction:t,pending:a})}}function ko({start:s,starting:t,startError:n}){var b;const a=x.useId(),{data:r}=Se(),i=je(),o=((b=r==null?void 0:r.telemetry)==null?void 0:b.linkAnalyticsToAccount)??!1,l=ja({value:o,generation:0});l.read().value!==o&&l.write({value:o,generation:l.read().generation+1});const c=l.read().generation,[d,u]=x.useState(null),m=d!==null&&d.generation===c?d.value:o,h=f=>u({generation:c,value:f}),[p,g]=x.useState(null),j=x.useCallback(async()=>{g(null);try{await i.mutateAsync({telemetry:{linkAnalyticsToAccount:m}})}catch{g("Couldn’t save your choice. Try again.");return}await s()},[i,m,s]),y=t||i.isPending;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(en,{id:a,checked:m,onCheckedChange:f=>h(f===!0),disabled:y,className:"mt-0.5"}),e.jsxs("label",{htmlFor:a,className:"space-y-1 text-sm leading-snug",children:[e.jsx("span",{className:"font-medium",children:"Link usage counts to your account"}),e.jsx("span",{className:"text-muted-foreground block text-xs",children:"See this install’s anonymous usage counts when signed in."}),e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Applies when you link. To change it later, link again."})]})]}),e.jsxs(v,{onClick:()=>void j(),disabled:y,children:[y?e.jsx(us,{className:"mr-1.5"}):e.jsx(ro,{className:"mr-1.5 size-(--size-icon-sm)"}),y?"Starting…":"Link this computer"]}),(p??n)&&e.jsx("p",{className:"text-destructive text-sm",role:"alert",children:p??n})]})}function wo({view:s,start:t,starting:n,startError:a,dismiss:r}){return e.jsxs("div",{className:"space-y-4",children:[s.relinkOutcome&&e.jsx(Ao,{outcome:s.relinkOutcome,dismiss:r}),e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Signed in"}),s.accountLabel?e.jsx("p",{className:"text-foreground truncate text-sm",children:s.accountLabel}):e.jsx("p",{className:"text-muted-foreground text-sm",children:"Syncing account…"}),s.lastHeartbeatAt&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Last synced ",Ie(s.lastHeartbeatAt).toLowerCase()]})]}),e.jsxs(v,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>void t(),disabled:n,children:[n?e.jsx(us,{className:"mr-1.5"}):e.jsx(Zs,{className:"mr-1.5 size-3.5"}),"Link again"]})]}),a&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:a})]})}function Co({unlink:s,unlinking:t,unlinkError:n}){return e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(L,{label:"Unlink this computer",description:"Stops using your DorkOS account. You can link again anytime.",children:e.jsxs(ye,{children:[e.jsx(ms,{asChild:!0,children:e.jsxs(v,{variant:"outline",size:"sm",disabled:t,"aria-label":"Unlink this computer",children:[e.jsx(ao,{className:M("mr-1.5 size-3.5",t&&"animate-pulse")}),t?"Unlinking…":"Unlink"]})}),e.jsx(To,{unlink:s})]})}),n&&e.jsx("p",{role:"alert",className:"text-destructive text-sm",children:n})]})})}const So={denied:"The new link was turned down on dorkos.ai.",expired:"The new link’s code expired.",failed:"The new link couldn’t finish."};function Ao({outcome:s,dismiss:t}){return e.jsxs("div",{role:"status",className:"bg-muted/40 flex items-start gap-2 rounded-lg p-3 text-sm",children:[e.jsxs("p",{className:"min-w-0 flex-1",children:[So[s]," This computer is still linked."]}),e.jsx(v,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",className:"-my-1 shrink-0",onClick:()=>void t(),children:e.jsx(et,{className:"size-3.5"})})]})}function To({unlink:s}){const t=ut(),n=t.data?xt(t.data.connections):[],{stopping:a,idle:r}=_n(n);return e.jsxs(be,{children:[e.jsxs(me,{children:[e.jsx(xe,{children:"Unlink this computer?"}),e.jsx(he,{children:"It stops using your DorkOS account. You can link again anytime."})]}),t.isPending?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Checking which apps use this account…"}):t.isError?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t check which apps use this account. Any that do will stop working."}):e.jsx(Ks,{stopping:a,idle:r,stopLine:`${a.length===1?"This app":`These ${a.length} apps`} will stop working for every agent:`}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(fe,{onClick:()=>void s(),children:a.length>0?`Unlink and stop ${cs(a.length)}`:"Unlink"})]})]})}function Ds({title:s,description:t,actionLabel:n,onAction:a,pending:r}){return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx($e,{className:"text-status-warning-dot mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:s}),e.jsx("p",{className:"text-muted-foreground text-sm",children:t})]})]}),e.jsxs(v,{onClick:()=>void a(),disabled:r,children:[r?e.jsx(us,{className:"mr-1.5"}):e.jsx(Zs,{className:"mr-1.5 size-(--size-icon-sm)"}),n]})]})}const ht=["auth","api-keys"];function Do(){const s=st();return V({queryKey:ht,queryFn:async()=>{const{data:t,error:n}=await s.apiKey.list();if(n||!t)throw new Error("Couldn’t load API keys. Try again.");return t.apiKeys},staleTime:3e4})}function Oo(){const s=st(),t=G(),[n,a]=x.useState(!1),[r,i]=x.useState(null);return{run:x.useCallback(async(l,c)=>{a(!0),i(null);const{data:d,error:u}=await s.apiKey.create({name:l.trim()||void 0,expiresIn:c??null});return a(!1),u||!d?(i(u??{message:"Couldn’t create the key. Try again.",status:0}),null):(await t.invalidateQueries({queryKey:ht}),d)},[s,t]),isPending:n,error:r,reset:()=>i(null)}}function Ro(){const s=st(),t=G(),[n,a]=x.useState(null),[r,i]=x.useState(null);return{run:x.useCallback(async l=>{a(l),i(null);const{error:c}=await s.apiKey.delete({keyId:l});return a(null),c?(i(c),!1):(await t.invalidateQueries({queryKey:ht}),!0)},[s,t]),pendingId:n,error:r,reset:()=>i(null)}}const Rt=[{label:"Never",value:"never",seconds:null},{label:"7 days",value:"7d",seconds:3600*24*7},{label:"30 days",value:"30d",seconds:3600*24*30},{label:"90 days",value:"90d",seconds:3600*24*90}];function Eo({loginRequired:s=!0}={}){const t=x.useId(),{data:n,isError:a,isFetching:r,isLoading:i,refetch:o}=Do(),l=Oo(),c=Ro(),[d,u]=x.useState(""),[m,h]=x.useState("never"),[p,g]=x.useState(null);async function j(){var f;const y=((f=Rt.find(S=>S.value===m))==null?void 0:f.seconds)??null,b=await l.run(d,y);b&&(g(b),u(""),h("never"))}return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"text-muted-foreground size-4"}),e.jsx("p",{className:"text-sm font-medium",children:"API keys"})]}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Keys for MCP clients, scripts and agents. Send one as a"," ",e.jsx("code",{className:"font-mono",children:"Bearer"})," token."]}),!s&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Keys still work with login off. Revoke any you don’t need."})]}),p?e.jsx(Io,{created:p,onDone:()=>g(null)}):e.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[e.jsxs("div",{className:"min-w-40 flex-1 space-y-1.5",children:[e.jsx(Ee,{htmlFor:t,children:"Name"}),e.jsx(re,{id:t,placeholder:"e.g. laptop-cli",value:d,onChange:y=>u(y.target.value)})]}),e.jsxs("div",{className:"w-32 space-y-1.5",children:[e.jsx(Ee,{children:"Expires"}),e.jsxs(ee,{value:m,onValueChange:h,children:[e.jsx(se,{children:e.jsx(te,{})}),e.jsx(ne,{children:Rt.map(y=>e.jsx(P,{value:y.value,children:y.label},y.value))})]})]}),e.jsx(v,{onClick:j,disabled:l.isPending,children:l.isPending?"Creating…":"Create key"})]}),l.error&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:l.error.message}),e.jsx("div",{className:"space-y-1.5",children:i?e.jsx(X,{className:"h-9 w-full"}):a?e.jsx(ks,{title:"Couldn’t load API keys",description:"No keys were changed. Try again.",onRetry:()=>void o(),isRetrying:r,className:"py-6"}):n&&n.length>0?n.map(y=>e.jsx(Lo,{apiKey:y,revoking:c.pendingId===y.id,onRevoke:()=>c.run(y.id)},y.id)):e.jsx("p",{className:"text-muted-foreground text-xs",children:"No API keys yet."})}),c.error&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:c.error.message})]})}function Io({created:s,onDone:t}){const{copied:n,failed:a,copy:r}=tt();return e.jsxs("div",{className:"border-primary/40 bg-primary/5 space-y-3 rounded-lg border p-3",children:[e.jsx("p",{className:"text-sm font-medium",children:"Copy your key now. It won’t be shown again."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"bg-muted min-w-0 flex-1 truncate rounded-md px-3 py-2 font-mono text-xs",children:s.key}),e.jsx("button",{className:"text-muted-foreground hover:text-foreground shrink-0 rounded-sm p-1.5 transition-colors",onClick:()=>void r(s.key),"aria-label":a?"Couldn’t copy API key. Try again":"Copy API key",children:n?e.jsx(ze,{className:"text-status-success size-4"}):a?e.jsx(et,{className:"text-destructive size-4"}):e.jsx(sn,{className:"size-4"})})]}),e.jsx(v,{variant:"outline",size:"sm",onClick:t,children:"Done"})]})}function Lo({apiKey:s,revoking:t,onRevoke:n}){const a=s.name||"Unnamed key",r=s.start?`${s.start}…`:s.prefix||"";return e.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border px-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:a}),e.jsxs("p",{className:"text-muted-foreground font-mono text-xs",children:[r,s.expiresAt?` · expires ${new Date(s.expiresAt).toLocaleDateString()}`:" · no expiry"]})]}),e.jsxs(ye,{children:[e.jsx(ms,{asChild:!0,children:e.jsx(v,{variant:"ghost",size:"sm",disabled:t,"aria-label":`Revoke ${a}`,children:e.jsx(ns,{className:"size-3.5"})})}),e.jsxs(be,{children:[e.jsxs(me,{children:[e.jsxs(xe,{children:["Revoke “",a,"”?"]}),e.jsx(he,{children:"Anything using it loses access right away. This can’t be undone."})]}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(fe,{onClick:n,children:"Revoke key"})]})]})]})]})}function Po(){var d;const{data:s}=Se(),t=je(),n=ya(),a=ba(),r=((d=s==null?void 0:s.auth)==null?void 0:d.enabled)??!1,[i,o]=x.useState(!1);function l(u){u?o(!0):t.mutate({auth:{enabled:!1}})}async function c(){await t.mutateAsync({auth:{enabled:!0}}),o(!1)}return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"space-y-1",children:e.jsx("p",{className:"text-muted-foreground text-sm",children:"Ask for a login to open DorkOS. Opening it from another device always does."})}),e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(L,{label:"Require login",description:r?"DorkOS asks for your login before it opens.":"No login. Only this computer can open DorkOS.",children:e.jsx(nt,{checked:r,onCheckedChange:l,"aria-label":"Require login"})}),r&&e.jsx(L,{label:"Signed in",description:(n==null?void 0:n.email)??"Owner account",children:e.jsxs(v,{variant:"outline",size:"sm",onClick:()=>a.run(),disabled:a.isPending,children:[e.jsx(va,{className:"mr-1.5 size-3.5"}),a.isPending?"Signing out…":"Sign out"]})})]})}),(r||n)&&e.jsx(R,{children:e.jsx(E,{children:e.jsx(Eo,{loginRequired:r})})}),e.jsx(tn,{open:i,onOpenChange:o,children:e.jsxs(nn,{children:[e.jsxs(an,{children:[e.jsx(rn,{children:"Create an owner account"}),e.jsx(on,{children:"This becomes the login for DorkOS on this computer."})]}),e.jsx(Na,{submitLabel:"Create account & require login",onCreated:c,onOwnerExists:c,onCancel:()=>o(!1)})]})})]})}function _o(s){const t=W();return V({queryKey:["relay","trace",s],queryFn:()=>t.getRelayTrace(s),enabled:!!s,staleTime:3e4})}function pt(){const s=W();return V({queryKey:["relay","metrics"],queryFn:()=>s.getRelayDeliveryMetrics(),staleTime:3e4,refetchInterval:3e4})}const Et=["relay","conversations"],$o=500,Fo=15e3;function Mo(s=!0){const t=W(),n=ka({coalesceMs:$o}),a=()=>{s&&n([{queryKey:[...Et]}])};return Xe("relay_message",a),Xe("relay_signal",a),Xe("relay_flow",a),Xe("relay_dead_letter",a),V({queryKey:[...Et],queryFn:()=>t.listRelayConversations(),enabled:s,refetchInterval:Fo})}function zo(s,t){var r,i;const n=new Set(t.map(o=>o.providerInstanceId)),a={dorkosAccount:xt(s),byKeyInstance:{}};for(const o of s)o.readiness.state==="gone"||o.mode==="managed"||n.has(o.providerInstanceId)&&((r=a.byKeyInstance)[i=o.providerInstanceId]??(r[i]=[])).push(Pn(o));return a}function $n({testId:s,name:t,detail:n,status:a,usedForNewApps:r=!1,actions:i,children:o}){return e.jsxs("li",{"data-testid":s,className:"space-y-3 px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[e.jsxs("div",{className:"min-w-0 flex-1 basis-48",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-x-2 text-sm font-medium",children:[t,r&&e.jsx(ae,{size:"xs",variant:"secondary","data-testid":"used-for-new-apps",children:"Used for new apps"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:n})]}),e.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:M("size-2 rounded-full",we[a.tone]),"aria-hidden":!0}),a.label]}),i&&e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:i})]}),o]})}function Uo(s){return s==="user"?"using your account key":s==="project"?"using your project key":null}function Bo(s,t){return s.registered&&!t?{tone:"warning",label:"Can’t run actions"}:s.registered?{tone:"success",label:"Working"}:s.configured?{tone:"error",label:"Not working"}:{tone:"warning",label:"Key removed"}}function Ko(s){return s==="composio"?"Composio project":s==="nango"?"Nango environment":`${ln(s)} account`}function qo({status:s,apps:t,usedForNewApps:n=!1,way:a}){const r=(a==null?void 0:a.canRunActions)!==!1,[i,o]=x.useState(!1),[l,c]=x.useState(null),d=Ti(),u=ln(s.type),m=s.configured?Uo(s.keyKind):null,h=[`${cs(t.length)} connected`,m].filter(Boolean).join(" · "),{stopping:p,idle:g}=_n(t),j=()=>{t.length===0||!s.configured?o(!0):c("change")};return e.jsxs($n,{testId:`connection-way-${s.type}`,name:cn(s.type),detail:h,status:Bo(s,r),usedForNewApps:n,actions:e.jsxs(e.Fragment,{children:[e.jsx(v,{size:"sm",variant:"outline",onClick:j,disabled:i,children:s.configured?"Change key":"Add key again"}),s.configured&&e.jsx(v,{size:"sm",variant:"ghost",className:"text-destructive",disabled:d.isPending,onClick:()=>c("remove"),children:d.isPending?"Removing…":"Remove…"})]}),children:[s.error&&e.jsx("p",{role:"alert",className:"text-destructive border-destructive/30 bg-destructive/5 rounded-md border px-3 py-2 text-xs leading-relaxed",children:s.error}),s.registered&&!r&&e.jsx("p",{className:"text-muted-foreground text-xs",children:a!=null&&a.keyCanFix?Ct.accountKeyCannotRunActions:Ct.cannotRunActions}),!s.configured&&t.length>0&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"These apps stopped when the key was removed. Add it again to restore them."}),i&&e.jsx(Di,{type:s.type,submitLabel:"Save key",onSaved:()=>o(!1),onCancel:()=>o(!1)}),e.jsx(ye,{open:l!==null,onOpenChange:y=>{y||c(null)},children:e.jsx(be,{children:l==="change"?e.jsxs(e.Fragment,{children:[e.jsxs(me,{children:[e.jsxs(xe,{children:["Change your ",u," key?"]}),e.jsx(he,{children:"A new key pauses these apps until you review their access."})]}),e.jsx(Ks,{stopping:p,idle:g,stopLine:p.length===1?"This app pauses until you review it on the Connections page:":`These ${p.length} apps pause until you review them on the Connections page:`}),e.jsxs("div",{className:"text-muted-foreground space-y-1 text-sm",children:[e.jsx("p",{children:"Nothing changes until you save the new key."}),e.jsx("p",{children:"A key that doesn’t work stops every app until you fix it."}),e.jsxs("p",{children:["A key from a different ",Ko(s.type)," can’t reach them at all."]})]}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Keep this key"}),e.jsx(fe,{onClick:()=>{c(null),o(!0)},children:"Continue to a new key"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs(me,{children:[e.jsxs(xe,{children:["Remove your ",u," key?"]}),e.jsx(he,{children:t.length===0?"No apps use this key right now.":"Your sign-ins are kept. Add the same key again to restore these apps."})]}),e.jsx(Ks,{stopping:p,idle:g,stopLine:`${p.length===1?"This app":`These ${p.length} apps`} will stop working for every agent:`}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Keep key"}),e.jsx(fe,{onClick:()=>d.mutate({provider:s.type}),className:"bg-destructive hover:bg-destructive/90 dark:bg-destructive/60 text-white",children:p.length>0?`Remove key and stop ${cs(p.length)}`:"Remove key"})]})]})})})]})}function Wo({onManageAccount:s,onOpenConnectionsPage:t}){var D,A,T,O;const n=W(),a=V({queryKey:wa,queryFn:()=>n.getCloudStatus(),staleTime:3e4}),r=Oi(),i=Ri(),o=ut();if(r.isPending||o.isPending)return e.jsxs("div",{className:"space-y-2","aria-label":"Loading how DorkOS reaches your apps",children:[e.jsx(X,{className:"h-16 rounded-lg"}),e.jsx(X,{className:"h-16 rounded-lg"})]});if(r.isError||o.isError)return e.jsx(ks,{title:"Couldn’t check how DorkOS reaches your apps",description:"Try again. Nothing was changed.",onRetry:()=>{r.isError&&r.refetch(),o.isError&&o.refetch()},isRetrying:r.isFetching||o.isFetching});const l=r.data,c=zo(o.data.connections,l),d=((D=a.data)==null?void 0:D.linked)===!0,u=d||a.isError||c.dorkosAccount.length>0,m=l.filter(N=>{var k;return N.configured||(((k=c.byKeyInstance[N.providerInstanceId])==null?void 0:k.length)??0)>0}),h=l.filter(N=>!m.includes(N)),p=a.isSuccess&&!u,g=!u&&m.length===0;if(g&&a.isPending)return e.jsx(X,{className:"h-16 rounded-lg","aria-label":"Checking your DorkOS account"});const j=((A=i.data)==null?void 0:A.newApps.status)==="ready"?i.data.newApps.way:null,y=((T=i.data)==null?void 0:T.ways)??[],b=((O=y.find(N=>N.kind==="dorkos_account"))==null?void 0:O.status)!=="unavailable",f=(u?1:0)+m.length>1,S=e.jsx(Vo,{keys:h,offerAccount:p,onManageAccount:s});return g?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-muted/40 space-y-3 rounded-lg p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"Set up with your first app"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Connect an app and DorkOS asks how to reach it. You answer once."})]}),e.jsx(v,{size:"sm",variant:"outline",onClick:t,children:"Open the Connections page"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Or set one up here now:"}),S]})]}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("ul",{className:"divide-border divide-y rounded-lg border",children:[u&&e.jsx(Yo,{linked:d,reachesApps:b,checkFailed:a.isError,retrying:a.isFetching,onRetry:()=>void a.refetch(),apps:c.dorkosAccount,usedForNewApps:f&&(j==null?void 0:j.kind)==="dorkos_account",onManageAccount:s}),m.map(N=>e.jsx(qo,{status:N,apps:c.byKeyInstance[N.providerInstanceId]??[],usedForNewApps:f&&(j==null?void 0:j.kind)==="own_key"&&j.type===N.type,way:y.find(k=>k.kind==="own_key"&&k.type===N.type)},N.providerInstanceId))]}),(h.length>0||p)&&e.jsx(Ho,{label:"Add another way",children:S})]})}function Yo({linked:s,reachesApps:t,checkFailed:n,retrying:a,onRetry:r,apps:i,usedForNewApps:o,onManageAccount:l}){const c=s?t?{tone:"success",label:"Working"}:{tone:"warning",label:"Can’t reach apps"}:n?{tone:"neutral",label:"Couldn’t check"}:{tone:"warning",label:"Not linked"};return e.jsxs($n,{testId:"connection-way-dorkos-account",name:"Your DorkOS account",detail:n&&i.length===0?"Couldn’t check your DorkOS account":`${cs(i.length)} connected`,status:c,usedForNewApps:o,actions:e.jsxs(e.Fragment,{children:[n&&e.jsx(v,{size:"sm",variant:"outline",onClick:r,disabled:a,children:a?"Checking…":"Try again"}),e.jsxs(v,{size:"sm",variant:"outline",onClick:l,children:["Manage account",e.jsx(as,{className:"size-3.5","aria-hidden":!0})]})]}),children:[s&&!t&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Linked, but can’t reach apps now. Its apps won’t work until then."}),!s&&!n&&i.length>0&&e.jsxs("div",{className:"text-muted-foreground space-y-0.5 text-xs",children:[e.jsx("p",{children:"These apps stopped when the account was unlinked."}),e.jsx("p",{children:"Linking the same DorkOS account again can restore them. Otherwise, reconnect them."})]})]})}function Ho({label:s,children:t}){return e.jsxs(xs,{children:[e.jsxs(hs,{className:"text-muted-foreground hover:text-foreground focus-ring flex items-center gap-1.5 rounded-md text-sm font-medium",children:[e.jsx(Ca,{className:"size-4","aria-hidden":!0}),s]}),e.jsx(ps,{className:"pt-3",children:t})]})}function Vo({keys:s,offerAccount:t,onManageAccount:n}){return s.length===0&&!t?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Every way is set up."}):e.jsxs("ul",{className:"divide-border divide-y rounded-lg border",children:[t&&e.jsxs("li",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 px-4 py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1 basis-48",children:[e.jsx("p",{className:"text-sm font-medium",children:"Your DorkOS account"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link this computer, then connect apps."})]}),e.jsxs(v,{size:"sm",variant:"outline",onClick:n,children:["Link account",e.jsx(as,{className:"size-3.5","aria-hidden":!0})]})]}),s.map(a=>e.jsxs("li",{"data-testid":`add-connection-way-${a.type}`,className:"space-y-2 px-4 py-3",children:[e.jsx("p",{className:"text-sm font-medium",children:cn(a.type)}),e.jsx(Ei,{status:a})]},a.providerInstanceId))]})}const Go=3,Qo=3e5,It={min:1,max:20},Lt={min:10,max:3600},Pt=1e3;function Xo(){const s=Ai();return s.isLoading?e.jsx(X,{className:"h-40 rounded-lg","aria-label":"Loading chat app settings"}):s.isError?e.jsx(ks,{title:"Couldn’t check chat apps",description:"Check that DorkOS is running, then try again.",onRetry:s.retry,isRetrying:s.isRetrying}):s.enabled?e.jsx(Jo,{}):e.jsx(Pi,{relay:s,variant:"block"})}function Jo(){var o,l,c;const s=Tn(!0),{mutate:t}=Sa(),{mutate:n}=Li();if(s.isPending)return e.jsx(X,{className:"h-40 rounded-lg","aria-label":"Loading chat app settings"});if(s.isError)return e.jsx(ks,{title:"Couldn’t load chat app settings",description:"Try again. Nothing was changed.",onRetry:()=>void s.refetch(),isRetrying:s.isFetching});const a=(o=s.data.find(d=>d.manifest.category==="internal"&&d.manifest.type==="claude-code"))==null?void 0:o.instances[0];if(!a)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Nothing to set. Chat messages can’t start agents here."});const r=Number(((l=a.config)==null?void 0:l.maxConcurrent)??Go),i=Number(((c=a.config)==null?void 0:c.defaultTimeoutMs)??Qo);return e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(_,{label:"Start working right away",description:"New messages start the agent at once.",checked:a.enabled,onCheckedChange:d=>t({id:a.id,enabled:d})}),e.jsx(L,{label:"Most chats at once",description:"More wait their turn.",children:e.jsx(os,{"aria-label":"Most chats at once",value:r,min:It.min,max:It.max,onCommit:d=>n({id:a.id,config:{maxConcurrent:d}})})}),e.jsx(L,{label:"Give up after",description:"Seconds a message waits before it’s turned away.",children:e.jsx(os,{"aria-label":"Give up after, in seconds",value:Math.round(i/Pt),min:Lt.min,max:Lt.max,onCommit:d=>n({id:a.id,config:{defaultTimeoutMs:d*Pt}})})})]})})}function Zo(s,t=()=>null,n={}){return s?[...new Set([...Object.keys(s.runtimes),...Object.keys(s.defaults??{})])].flatMap(r=>{var c,d,u,m,h,p;const i=(c=s.defaults)==null?void 0:c[r],o=(i==null?void 0:i.runsOn)==="credits",l=s.enabled&&s.runtimes[r]==="wired";return!l&&!o?[]:[{runtime:r,name:le(r).label,on:o,chosenBy:o?(i==null?void 0:i.chosenBy)??null:null,canTurnOn:l,canTurnOff:!0,unreachable:!l,previousSignIn:t(r),scope:(u=(d=n[r])==null?void 0:d.credits)==null?void 0:u.scope,caveat:(h=(m=n[r])==null?void 0:m.credits)==null?void 0:h.caveat,hasAccountPicks:((p=n[r])==null?void 0:p.supportsAccounts)===!0}]}):[]}function el(s){return!s||s.killed?[]:Object.entries(s.runtimes).filter(([,t])=>t==="wired").map(([t])=>le(t).label)}function Fn(){const{data:s}=gs(),t=fs(),{data:n}=qe(),{accounts:a,ownResolvedAccount:r,nameFor:i}=js(),o=Zo(s,d=>d==="claude-code"&&r?sl(r,a,i):null,n==null?void 0:n.capabilities),l=(d,u)=>{const m=o.find(h=>h.runtime===d);m===void 0||m.on===u||(u?!m.canTurnOn:!m.canTurnOff)||t.mutate({runtime:d,useCredits:u})},c=t.isError?`Couldn’t change that. ${Mn(t.error)}`:null;return{rows:o,pending:t.isPending,failure:c,setOn:l}}function sl(s,t,n){const a=t.find(i=>i.path===s);if(a)return a.label;const r=n(s);return r===Aa(s,[])?null:r}const tl="Try again in a moment.";function Mn(s){return Ln(s)??tl}function nl(){var c;const{rows:s}=Fn(),t=ut(),n=mi(!0),a=at(),r=s.filter(d=>d.on).map(d=>d.name),i=t.data?xt(t.data.connections):[],o=a&&((c=n.data)!=null&&c.available)?n.data.communities:[],l=r.length===0&&i.length===0&&o.length===0;return e.jsx(R,{children:e.jsxs(E,{className:"space-y-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs tracking-wide uppercase",children:"What’s on your account"}),l?e.jsx("p",{className:"text-muted-foreground text-sm",children:a?"Nothing uses this account yet. Agents on credits, connected apps and spaces show here.":"Nothing uses this account yet. Agents on credits and connected apps show here."}):e.jsxs("dl",{className:"space-y-3 text-sm",children:[r.length>0&&e.jsx(Os,{label:"Running on credits",items:r}),i.length>0&&e.jsx(Os,{label:"Connected apps",items:i.map(d=>d.name)}),o.length>0&&e.jsx(Os,{label:"Spaces",items:o.map(d=>d.name)})]})]})})}function Os({label:s,items:t}){return e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted-foreground text-xs",children:s}),e.jsx("dd",{className:"font-medium",children:t.join(", ")})]})}function al(){const s=Ta(n=>n.sessions),{data:t}=qe();return x.useMemo(()=>{var i;let n=0,a=0;for(const o of Object.values(s)){const l=(i=o.sessionStatus)==null?void 0:i.costUsd;typeof l=="number"&&l>0&&(n+=l,a+=1)}const r=Object.entries((t==null?void 0:t.capabilities)??{}).filter(([,o])=>o.supportsCostTracking===!1).map(([o])=>o).sort();return{totalUsd:n,sessionCount:a,runtimesWithoutCost:r,hasAnything:a>0||r.length>0}},[s,t])}function rl(s,t,n){return s===0&&BigInt(n)>0n?`<0.001 ${t}`:`${s.toLocaleString("en-US",{maximumFractionDigits:3})} ${t}`}const _t=new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",timeZone:"UTC"}),$t=1440*60*1e3;function il(s,t){const n=new Date(t),a=n.getTime()%$t===0?new Date(n.getTime()-$t):n;return`${_t.format(new Date(s))} – ${_t.format(a)}`}function ds(){return e.jsx("p",{className:"text-muted-foreground text-xs",children:"Couldn’t read the credit figures from your DorkOS account."})}function ol({otherCharges:s,denomination:t}){const n=(s==null?void 0:s.rows)??[];if(n.length===0)return null;const a=ls(t);return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Other charges"}),!a&&e.jsx(ds,{}),e.jsx("ul",{className:"space-y-2 text-sm",children:n.map((r,i)=>e.jsxs("li",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate",children:r.displayName}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:[rl(r.units,r.unit,r.dorkosPriceMicro)," ·"," ",e.jsx("span",{className:"whitespace-nowrap",children:il(r.periodStart,r.periodEnd)})]})]}),a&&e.jsx("span",{className:"text-muted-foreground shrink-0 tabular-nums",children:ss(r.dorkosPriceMicro,t)})]},`${i}-${r.periodStart}-${r.unit}`))})]})}function ll(){const{data:s}=Fe(),{data:t}=Da("seat"),n=al();if(!(s!=null&&s.available))return null;const a=s.balance,r=a===null?null:xi(a.allowance.remainingMicro,a.allowance.grantedMicro),i=a==null?void 0:a.denomination,o=Dt(a==null?void 0:a.allowance.remainingMicro,i),l=Ts(Dt(a==null?void 0:a.allowance.grantedMicro,i)),c=ct(a==null?void 0:a.purchased.remainingMicro,i,"position"),d=ss(a==null?void 0:a.owedMicro,i),u=d===null||d==="0"?null:Ts(d),m=a?cl(a.allowance.resetsAt):null,h=t!=null&&t.available?t.usage.rows:[],p=t!=null&&t.available?t.usage.denomination:void 0,g=ls(p),j=t!=null&&t.available?Ts(ss(t.usage.totals.dorkosPriceMicro,p)):null,y=t!=null&&t.available?t.usage.otherCharges:void 0;return e.jsx(R,{children:e.jsxs(E,{className:"space-y-4",children:[e.jsx("p",{className:"text-muted-foreground text-xs tracking-wide uppercase",children:"Credits"}),a!==null&&(ls(i)?e.jsxs("div",{className:"space-y-2",children:[e.jsxs("dl",{className:"grid grid-cols-2 gap-x-6 gap-y-3 text-sm",children:[o!==null&&l!==null&&e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted-foreground text-xs",children:"Included"}),e.jsxs("dd",{className:"font-medium",children:[o," of ",l," left"]})]}),c!==null&&e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted-foreground text-xs",children:"Added"}),e.jsx("dd",{className:"font-medium",children:c})]}),u!==null&&e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted-foreground text-xs",children:"Owed"}),e.jsx("dd",{className:"font-medium",children:u})]})]}),r!==null&&e.jsx(io,{value:r*100,"aria-label":"Included left"}),m!==null&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Included credits renew ",m,"."]})]}):e.jsx(ds,{})),h.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Where the credits went"}),!g&&e.jsx(ds,{}),e.jsx("ul",{className:"space-y-1 text-sm",children:h.map(b=>e.jsxs("li",{className:"flex items-baseline justify-between gap-4",children:[e.jsx("span",{className:"truncate",children:b.displayName}),g&&e.jsx("span",{className:"text-muted-foreground shrink-0 tabular-nums",children:ss(b.dorkosPriceMicro,p)})]},b.key))}),j!==null&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Total for the last 30 days: ",j]})]}),e.jsx(ol,{otherCharges:y,denomination:p}),n.hasAnything&&e.jsxs("div",{className:"space-y-1 border-t pt-3",children:[e.jsx("p",{className:"text-sm font-medium",children:"On this machine"}),n.sessionCount>0&&e.jsxs("p",{className:"text-sm",children:[n.totalUsd.toFixed(2)," across ",n.sessionCount," ",n.sessionCount===1?"open chat":"open chats",", by their own estimate."]}),n.runtimesWithoutCost.length>0&&e.jsxs("p",{className:"text-muted-foreground text-xs",children:[n.runtimesWithoutCost.join(", ")," report no cost, so they’re left out."]})]})]})})}function cl(s){const t=new Date(s);return Number.isNaN(t.getTime())?null:`on ${t.toLocaleDateString(void 0,{day:"numeric",month:"short"})}`}const dl=6e4,ul=2**31-1;function ml(){const s=W(),[t,n]=x.useState(null),[a,r]=x.useState({kind:"idle"}),[i,o]=x.useState(null),l=x.useRef(!1),c=x.useCallback(async()=>{if(l.current)return!1;l.current=!0,r({kind:"requesting"});try{const m=await s.requestCloudAccountDeletion();return m.ok?(n(m.deletion),r({kind:"idle"}),!0):(r({kind:"failed",notice:"problem"in m?{problem:m.problem}:{message:m.message}}),!1)}catch{return r({kind:"failed",notice:Oa}),!1}finally{l.current=!1}},[s]),d=x.useCallback(()=>{l.current||r({kind:"idle"})},[]);x.useEffect(()=>{if(t===null||t.confirmBy===null)return;const m=Date.parse(t.confirmBy)-Date.now();if(Number.isNaN(m)||m>ul)return;const h=setTimeout(()=>o(t),Math.max(0,m));return()=>clearTimeout(h)},[t]);const u=t!==null&&i===t;return xl(t!==null&&!u),{sent:t,expired:u,attempt:a,request:c,reset:d}}function xl(s){const t=G(),n=Ra();x.useEffect(()=>{if(!s)return;let a=!1,r=!1;const i=async()=>{if(a||r)return;r=!0;let d=null;try{d=await n({expected:!0})}catch{}finally{r=!1}a||d===null||d.linked||(a=!0,c(),t.invalidateQueries({queryKey:Ea.all}),Le.success("This computer is unlinked",{description:"The deletion is confirmed. Everything on this computer stays."}))},o=()=>void i();window.addEventListener("focus",o);const l=setInterval(()=>void i(),dl);function c(){window.removeEventListener("focus",o),clearInterval(l)}return()=>{a=!0,c()}},[s,n,t])}function zn({heading:s="Your data"}){const{data:t}=Fe(),{state:n,request:a,download:r}=Ia();return t!=null&&t.available?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:s}),n.kind==="requested"?n.export.downloadUrl!==null?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm",children:"Your export is ready."}),e.jsxs(v,{type:"button",size:"sm",variant:"outline",onClick:r,children:["Download your data",e.jsx(ys,{className:"size-3.5","aria-hidden":!0})]})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{role:"status",className:"text-sm",children:n.export.emailRequested?"Your export is being prepared. You’ll get an email when it’s ready.":"Your export is being prepared. Check back in a few minutes."}),e.jsx(v,{type:"button",size:"sm",variant:"outline",onClick:a,children:"Check again"})]}):e.jsx(v,{type:"button",size:"sm",variant:"outline",disabled:n.kind==="requesting","aria-busy":n.kind==="requesting",onClick:a,children:n.kind==="requesting"?"Asking…":"Export your account data"}),n.kind==="failed"&&e.jsx(rs,{notice:n.notice})]}):null}const Rs="delete";function hl(s){const t=new Date(s);return Number.isNaN(t.getTime())?null:new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function pl(){const{data:s}=Fe(),{sent:t,expired:n,attempt:a,request:r,reset:i}=ml(),[o,l]=x.useState(!1),[c,d]=x.useState(""),u=x.useRef(null),m=x.useRef(null),h=x.useRef(null);if(!(s!=null&&s.available))return null;const p=c.trim().toLowerCase()===Rs,g=a.kind==="requesting",j=a.kind==="failed"?a.notice:null,y=f=>{g||(l(f),f||(d(""),i()))},b=()=>{!p||g||r().then(f=>{f&&(l(!1),d(""))})};return e.jsxs("div",{className:"space-y-2 border-t pt-4",children:[e.jsx("p",{className:"text-sm font-medium",children:"Delete your DorkOS account"}),t!==null?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{ref:m,role:"status",tabIndex:-1,className:"text-sm outline-none",children:n?"The link has expired, so nothing was deleted. Send a new one to carry on.":e.jsx(gl,{sentTo:t.confirmationSentTo,confirmBy:t.confirmBy})}),e.jsx(v,{type:"button",size:"sm",variant:"outline",disabled:g,"aria-busy":g,onClick:()=>void r(),children:g?"Sending…":"Send a new link"}),j!==null&&e.jsx(rs,{notice:j})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Ends your plan and erases the account for good. Everything on this computer stays."}),e.jsx(v,{ref:h,type:"button",size:"sm",variant:"destructive",onClick:()=>l(!0),children:"Delete your DorkOS account…"})]}),e.jsx(Gs,{open:o,onOpenChange:y,children:e.jsxs(Qs,{className:"min-h-0 sm:max-w-md",onOpenAutoFocus:f=>{var S;f.preventDefault(),(S=u.current)==null||S.focus()},onCloseAutoFocus:f=>{const S=m.current??h.current;S!==null&&(f.preventDefault(),S.focus())},children:[e.jsxs(dn,{children:[e.jsx(Xs,{children:"Delete your DorkOS account?"}),e.jsx(Js,{children:"This can’t be undone. Nothing is deleted until you follow the emailed link."})]}),e.jsx(un,{children:e.jsxs("div",{className:"space-y-4 text-sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"What goes"}),e.jsxs("ul",{className:"text-muted-foreground list-inside list-disc space-y-1",children:[e.jsx("li",{children:"Your plan, which ends right away"}),e.jsx("li",{children:"Credits you haven’t used"}),e.jsx("li",{children:"The seats on your account"}),e.jsx("li",{children:"Everything else your DorkOS account holds"})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"font-medium",children:"What stays"}),e.jsx("p",{className:"text-muted-foreground",children:"Everything on this computer: your agents, chats, projects and files."}),e.jsx("p",{className:"text-muted-foreground",children:"This computer unlinks and keeps working on its own."})]}),e.jsx(zn,{heading:"Want a copy first?"}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{htmlFor:"delete-account-confirm",className:"font-medium",children:["Type ",e.jsx("strong",{children:Rs})," to confirm"]}),e.jsx(re,{ref:u,id:"delete-account-confirm","data-testid":"delete-account-confirm-input",value:c,onChange:f=>d(f.target.value),onKeyDown:f=>{f.key==="Enter"&&b()},placeholder:Rs,autoComplete:"off",disabled:g})]}),j!==null&&e.jsx(rs,{notice:j})]})}),e.jsxs(mn,{children:[e.jsx(La,{asChild:!0,children:e.jsx(v,{variant:"outline",disabled:g,children:"Cancel"})}),e.jsx(v,{variant:"destructive",disabled:!p||g,"aria-busy":g,onClick:b,children:g?"Sending…":"Email me the link"})]})]})})]})}function gl({sentTo:s,confirmBy:t}){const n=t===null?null:hl(t);return e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"block",children:["Check your email. A link went to ",e.jsx("span",{className:"font-medium",children:s}),"."]})," ",e.jsxs("span",{className:"block",children:["Your account is deleted only when you follow it",n===null?".":`, and the link works until ${n}.`]})," ",e.jsx("span",{className:"block",children:"This computer then unlinks on its own."})]})}const fl={month:"a month",year:"a year"};function jl(){const{data:s}=Fe(),t=Pa();return s!=null&&s.available?e.jsx(R,{children:e.jsxs(E,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs tracking-wide uppercase",children:"Manage on the web"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Payments happen on the DorkOS website. Each of these opens in your browser."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(qs,{billing:t,page:"portal",children:"Billing and invoices"}),e.jsx(qs,{billing:t,page:"topup",children:"Add credits"})]}),e.jsx(yl,{billing:t,currentPlanId:s.entitlements.planId}),e.jsx(rs,{notice:t.notice}),e.jsx(zn,{}),e.jsx(pl,{})]})}):null}function qs({billing:s,page:t,children:n}){var r;const a=((r=s.pending)==null?void 0:r.page)===t;return e.jsxs(v,{type:"button",size:"sm",variant:"outline",disabled:s.pending!==null,"aria-busy":a,onClick:()=>s.open({page:t}),children:[a?"Opening…":n,e.jsx(ys,{className:"size-3.5","aria-hidden":!0})]})}function yl({billing:s,currentPlanId:t}){const{data:n}=_a();if(!(n!=null&&n.available)||n.offers.offers.length===0)return null;const{offers:a,denomination:r}=n.offers;return a.some(i=>i.planId===t)?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Change plan"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Switch to another plan, or end yours, on the billing page."}),e.jsx(qs,{billing:s,page:"portal",children:"Change plan"})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Choose a plan"}),e.jsx("ul",{className:"divide-y rounded-md border",children:a.map(i=>{var d;const o=r?Us(i.amountMicro,r):null,l=fl[i.interval],c=((d=s.pending)==null?void 0:d.skuId)===i.skuId;return e.jsxs("li",{className:"flex items-center justify-between gap-3 px-3 py-2 text-sm",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate font-medium",children:i.displayName}),o!==null&&e.jsx("p",{className:"text-muted-foreground text-xs",children:l?`${o} ${l}`:o})]}),e.jsxs(v,{type:"button",size:"sm",variant:"outline",disabled:s.pending!==null,"aria-busy":c,"aria-label":`Choose ${i.displayName}${l?`, billed ${l}`:""}`,onClick:()=>s.open({page:"checkout",skuId:i.skuId}),children:[c?"Opening…":"Choose",e.jsx(ys,{className:"size-3.5","aria-hidden":!0})]})]},i.skuId)})})]})}const bl={byo:"Bring your own tunnel",on_demand:"Reachable when you open it",always_available:"Always reachable"},vl={none:"Not available",addon:"Available separately",included:"Included"},Nl={community:"Community",priority:"Priority"};function kl(){const{data:s}=Fe(),t=at();if(!(s!=null&&s.available))return null;const{entitlements:n}=s,{limits:a,seats:r}=n,i=n.denomination,o=ct(a.includedCreditsMicro,i,"position"),l=!ls(i);return e.jsx(R,{children:e.jsxs(E,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-muted-foreground text-xs tracking-wide uppercase",children:"Your plan"}),e.jsx("p",{className:"text-base font-semibold",children:n.planDisplayName})]}),e.jsxs("dl",{className:"grid grid-cols-2 gap-x-6 gap-y-3 text-sm sm:grid-cols-3",children:[e.jsx(ue,{label:"People",value:`${n.used.personSeats} of ${a.personSeatsIncluded}`}),e.jsx(ue,{label:"Agents with an address",value:`${n.used.agentSeats} of ${a.agentSeatsIncluded}`}),e.jsx(ue,{label:"Seats assigned",value:`${r.assigned} of ${r.total}`}),o!==null&&e.jsx(ue,{label:"Included credits",value:o}),e.jsx(ue,{label:"Cloud hours",value:`${a.cloudHours}`}),e.jsx(ue,{label:"Storage",value:`${a.storageGb} GB`}),e.jsx(ue,{label:"Remote access",value:bl[a.remoteAccess]}),e.jsx(ue,{label:"Custom address",value:vl[a.customAddress]}),e.jsx(ue,{label:"Support",value:Nl[a.support]})]}),l&&e.jsx(ds,{}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Only agents with an address take a seat. Local-only agents take none."}),e.jsx(wn,{withSpaces:t})]})]})})}function ue({label:s,value:t}){return e.jsxs("div",{children:[e.jsx("dt",{className:"text-muted-foreground text-xs",children:s}),e.jsx("dd",{className:"font-medium",children:t})]})}function wl(){const{data:s}=$a(),[t,n]=x.useState(null),a=s!=null&&s.available?s.orgs:[];x.useEffect(()=>{t===null&&a.length>0&&n(a[0].id)},[t,a]);const{data:r,isLoading:i,isError:o}=Fa(t),{data:l}=Ma(t),{assign:c,release:d}=za(t),[u,m]=x.useState(null),[h,p]=x.useState(null);if(!(s!=null&&s.available))return null;if(i&&!r)return e.jsx(X,{className:"h-24 w-full"});if(o)return e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t load your seats. Try again later."});if(!(r!=null&&r.available)||r.seats.length===0&&a.length<=1)return null;const g=l!=null&&l.available?l.members:[],j=f=>{m(null),p(null),!f.ok&&("problem"in f?m(f.problem):p(f.message))},y=async f=>{try{j(await d.mutateAsync(f))}catch{m(null),p("Couldn’t reach your account just now. Nothing changed.")}},b=async(f,S)=>{try{j(await c.mutateAsync({seatId:f,subject:{kind:"user",id:S}}))}catch{m(null),p("Couldn’t reach your account just now. Nothing changed.")}};return e.jsx(R,{children:e.jsxs(E,{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs tracking-wide uppercase",children:"Seats"}),a.length>1&&e.jsx("select",{className:"border-input bg-background rounded-md border px-2 py-1 text-sm","aria-label":"Organization",value:t??"",onChange:f=>n(f.target.value),children:a.map(f=>e.jsx("option",{value:f.id,children:f.name},f.id))})]}),r.seats.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"No seats in this organization."}):e.jsx("ul",{className:"divide-y",children:r.seats.map(f=>e.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:Sl(f)}),e.jsx("p",{className:"text-muted-foreground text-xs",children:f.assignedAt?`Assigned ${Ie(f.assignedAt)}`:"Not assigned"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(ae,{variant:"secondary",children:f.status}),f.status==="assigned"?e.jsx(v,{variant:"outline",size:"sm",disabled:d.isPending,onClick:()=>void y(f.id),children:"Release"}):g.length>0&&e.jsxs("select",{className:"border-input bg-background rounded-md border px-2 py-1 text-sm","aria-label":"Assign this seat to",defaultValue:"",disabled:c.isPending,onChange:S=>{const D=S.target.value;D!==""&&b(f.id,D)},children:[e.jsx("option",{value:"",children:"Assign to…"}),g.map(S=>e.jsx("option",{value:S.userId,children:Cl(S,g)},S.id))]})]})]},f.id))}),u!==null&&e.jsxs("div",{className:"border-destructive/40 bg-destructive/5 space-y-1 rounded-md border px-3 py-2",children:[e.jsx("p",{className:"text-sm font-medium",children:u.title}),u.detail!==void 0&&e.jsx("p",{className:"text-sm",children:u.detail}),u.requiredPlanDisplayName!==void 0&&e.jsxs("p",{className:"text-muted-foreground text-sm",children:["This needs ",u.requiredPlanDisplayName,"."]})]}),h!==null&&e.jsx("div",{className:"border-destructive/40 bg-destructive/5 rounded-md border px-3 py-2",children:e.jsx("p",{className:"text-sm",children:h})})]})})}function Cl(s,t){return t.filter(a=>a.role===s.role).length===1?s.role:`${s.role} · ${s.userId}`}function Sl(s){return s.address!==null?s.address.canonical:s.kind==="person"?"Person":"Agent"}function Al(){const{data:s}=Ua(),[t,n]=x.useState(!1);if(t||!(s!=null&&s.available))return null;const{nudge:a}=s,r=a.denomination,i=ct(a.trailing30Micro,r,"charge"),o=Us(a.suggestedPlanPriceMicro,r),l=Us(a.savingMicro,r);return l===null||i===null||o===null?null:e.jsxs("div",{className:"bg-muted/50 flex items-start justify-between gap-3 rounded-md border px-3 py-2",children:[e.jsxs("p",{className:"text-sm",children:["Your last 30 days: ",i,". ",a.suggestedPlanDisplayName,": ",o,". Difference: ",l,"."]}),a.dismissible&&e.jsx(v,{variant:"ghost",size:"icon-sm",className:"size-6 shrink-0","aria-label":"Dismiss",onClick:()=>n(!0),children:e.jsx(et,{className:"size-4"})})]})}function Un(s){return le(s).label}function Tl(s){const t=s.map(Un);return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function Dl(){const{data:s}=gs(),t=(s==null?void 0:s.notices)??[];return t.length===0?null:e.jsx("div",{className:"space-y-2","data-testid":"credits-notices",children:t.map(n=>e.jsx(Ol,{notice:n},n.kind==="signed-in"?`signed-in:${n.runtime}`:n.kind))})}function Ol({notice:s}){const t=Ba(),n=Ka(s.kind==="filled"?s.runtimes:[]),a=qa(),r=fs(),i=oe(),o=t.isPending||a.isPending||r.isPending,l=[r,a,t].find(u=>u.isError),c=l?e.jsxs("p",{role:"alert",className:"text-destructive text-sm",children:["Couldn’t change that. ",Mn(l.error)]}):null;if(s.kind==="filled"){const u=Tl(s.runtimes);return e.jsxs(As,{className:"space-y-2","data-testid":"credits-notice-filled",children:[e.jsxs("p",{className:"text-sm",children:[u," now ",s.runtimes.length===1?"runs":"run"," on your DorkOS credits."]}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.runtimes.length===1?"It":"They"," had no working sign-in when you linked."]}),n.map(m=>e.jsx("p",{className:"text-muted-foreground text-sm",children:m},m)),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(v,{size:"sm",variant:"outline",disabled:o,onClick:()=>{t.mutate({kind:"filled"}),i.open("runtimes")},children:"Change"}),e.jsx(v,{size:"sm",variant:"outline",disabled:o,onClick:()=>a.mutate(),children:"Undo all"}),e.jsx(v,{size:"sm",variant:"ghost",disabled:o,onClick:()=>t.mutate({kind:"filled"}),children:"OK"})]}),c]})}if(s.kind==="offer")return e.jsxs(As,{className:"space-y-2","data-testid":"credits-notice-offer",children:[e.jsx("p",{className:"text-sm",children:"Your DorkOS account can pay for Claude Code. Nothing changes until you turn it on."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(v,{size:"sm",disabled:o,onClick:()=>r.mutate({runtime:"claude-code",useCredits:!0}),children:"Use DorkOS credits"}),e.jsx(v,{size:"sm",variant:"ghost",disabled:o,onClick:()=>t.mutate({kind:"offer"}),children:"Not now"})]}),c]});const d=Un(s.runtime);return e.jsxs(As,{className:"space-y-2","data-testid":"credits-notice-signed-in",children:[e.jsxs("p",{className:"text-sm",children:["You’re signed in to ",d," now. It still uses your credits until you switch back."]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(v,{size:"sm",variant:"outline",disabled:o,onClick:()=>r.mutate({runtime:s.runtime,useCredits:!1}),children:["Use my ",d," sign-in"]}),e.jsx(v,{size:"sm",variant:"ghost",disabled:o,onClick:()=>t.mutate({kind:"signed-in",runtime:s.runtime}),children:"Keep credits"})]}),c]})}function Rl(){const{rows:s,pending:t,failure:n,setOn:a}=Fn();return s.length===0?null:e.jsx(R,{children:e.jsxs(E,{className:"space-y-3",children:[e.jsx("p",{className:"text-muted-foreground text-xs tracking-wide uppercase",children:"Use credits for"}),e.jsx(Dl,{}),s.map(r=>e.jsx(L,{label:r.name,description:El(r),children:e.jsx(nt,{checked:r.on,disabled:t||(r.on?!r.canTurnOff:!r.canTurnOn),onCheckedChange:i=>a(r.runtime,i),"aria-label":`Use credits for ${r.name}`})},r.runtime)),n!==null&&e.jsx("p",{className:"text-destructive text-sm",role:"alert",children:n})]})})}function El(s){const t=Il(s);return s.caveat?`${t} ${s.caveat}`:t}function Il(s){if(s.on&&s.unreachable)return`${s.name} can’t run on credits now, so new work stops. Turn this off to continue.`;if(!s.on)return s.previousSignIn===null?`New ${s.name} work uses its own sign-in.`:`New ${s.name} work uses ${s.previousSignIn}.`;const t=s.previousSignIn===null?"Turning this off puts it back on its own sign-in.":`Turning this off puts it back on ${s.previousSignIn}.`;return s.chosenBy==="default"?`DorkOS turned this on when you linked, because ${s.name} had no sign-in. ${t}`:s.scope==="runtime"?`${s.name} runs on your DorkOS credits, chats already going included. ${t} It can't be switched while ${s.name} is in the middle of a reply.`:s.hasAccountPicks?`New ${s.name} work runs on your DorkOS credits unless an agent or a chat picks another account. ${t}`:`New ${s.name} chats run on your DorkOS credits. ${t}`}function Ll(){const{data:s,isError:t,isPending:n}=Fe();return n?e.jsx(X,{className:"h-40 w-full"}):t?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t reach your DorkOS account. Local agents still work."}):e.jsxs("div",{className:"space-y-4",children:[s.available?e.jsxs(e.Fragment,{children:[e.jsx(Al,{}),e.jsx(kl,{}),e.jsx(ll,{})]}):e.jsx("p",{className:"text-muted-foreground text-sm",children:"No plan details to show yet."}),e.jsx(Rl,{}),e.jsx(nl,{}),e.jsx(wl,{}),e.jsx(jl,{})]})}function Pl(s){if(s<60)return`${s} minutes`;const t=Math.round(s/60);return t<48?t===1?"an hour":`${t} hours`:`${Math.round(t/24)} days`}function _l(){const{enabled:s,absenceThresholdMinutes:t,offersEnabled:n,setEnabled:a,setOffersEnabled:r,isAvailable:i}=hi();return i?e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Coming back"}),e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(_,{label:"Welcome-back notes",description:e.jsxs(e.Fragment,{children:[`Agents may leave a short note in your team channel after ${Pl(t)} away.`," ",e.jsxs(Ke,{label:"About welcome-back notes",children:[e.jsx("p",{children:"Off means no note, and no agent time spent checking."}),e.jsx("p",{children:"This setting follows you to every device."})]})]}),checked:s,onCheckedChange:a}),s&&e.jsx(_,{label:"Next-step offers",description:"Notes can end with a decision for you. Each runs that agent for a turn.",checked:n,onCheckedChange:r})]})})]}):null}function $l(){const{showTimestamps:s,setShowTimestamps:t,expandToolCalls:n,setExpandToolCalls:a,autoHideToolCalls:r,setAutoHideToolCalls:i,showTaskCelebrations:o,setShowTaskCelebrations:l,promoEnabled:c,setPromoEnabled:d,enableMessagePolling:u,setEnableMessagePolling:m,setOnboardingHiddenForSession:h}=Ce(),p=li(),{setRichText:g}=ci(),{close:j}=oe(),y=je(),b=G(),f=()=>{y.mutate({onboarding:{completedSteps:[],skippedSteps:[],startedAt:null,dismissedAt:null,completedAt:null}},{onSuccess:()=>{b.invalidateQueries({queryKey:H.all})}}),h(!1),j()};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Chat"}),e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(_,{label:"Show timestamps",description:"Shows the time on each message.",checked:s,onCheckedChange:t}),e.jsx(_,{label:"Expand tool calls",description:"Opens tool call details in messages.",checked:n,onCheckedChange:a}),e.jsx(_,{label:"Auto-hide tool calls",description:"Finished tool calls fade after a moment.",checked:r,onCheckedChange:i}),e.jsx(_,{label:"To-do celebrations",description:"Animates finished to-dos.",checked:o,onCheckedChange:l}),e.jsx(_,{label:"Format text as you type",description:"Bold, headings and lists show as you write.",checked:p,onCheckedChange:g}),e.jsx(_,{label:"Watch for work started elsewhere",description:"Work started in a terminal shows up here sooner.",checked:u,onCheckedChange:m})]})})]}),e.jsx(_l,{}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Discovery"}),e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(_,{label:"Feature suggestions",description:"Feature tips on the dashboard and sidebar.",checked:c,onCheckedChange:d}),e.jsx(L,{label:"Replay setup",description:"Go through first-run setup again.",children:e.jsx(v,{variant:"outline",size:"sm",onClick:f,disabled:y.isPending,children:"Replay setup"})})]})})]})]})}function Fl(){const s=pi(),t=W(),n=G(),a=x.useCallback(async i=>{await t.updateConfig({keepAwake:{whileAgentsWork:i}}),await Promise.all([n.invalidateQueries({queryKey:[...gi]}),n.invalidateQueries({queryKey:H.all})])},[t,n]);if(!s)return null;const r=s.supported?null:fi[s.reason??"platform"];return e.jsxs("div",{className:"space-y-2","data-section":ji.section,children:[e.jsx("p",{className:"text-sm font-medium",children:"Sleep"}),e.jsx(R,{children:e.jsx(E,{children:e.jsx(_,{label:"Keep this computer awake while agents work",description:e.jsxs("span",{className:"flex flex-col gap-1",children:[e.jsx("span",{children:"Stays awake during chats, rooms and tasks. Sleeps as usual when idle."}),e.jsx("span",{"data-testid":"sleep-settings-note",children:r??bi})]}),checked:s.enabled,onCheckedChange:i=>void a(i),disabled:!yi(s)})})})]})}const Ws={login:{id:"reconnect",label:"Fix sign-in"},"provider-picker":{id:"change",label:"Change"}};function Ml({type:s,subtitle:t,ready:n,isDefault:a,onMakeDefault:r,reconnect:i,toggleable:o,expanded:l,onToggleExpanded:c,bodyId:d,children:u}){const m=le(s),h=m.icon,p=e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-[var(--runtime-accent)]/10 text-[var(--runtime-accent)]",children:e.jsx(h,{size:24})}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium whitespace-nowrap",children:m.label}),a&&e.jsx(ae,{variant:"outline",className:"shrink-0 border-[var(--runtime-accent)]/40 bg-[var(--runtime-accent)]/10 text-[var(--runtime-accent)]","data-testid":`runtime-default-pill-${s}`,children:"Default"})]}),t&&e.jsx("span",{className:"text-muted-foreground truncate text-xs",children:t})]})]}),g=i?Ws[i.kind]:null;return e.jsxs("div",{className:"flex flex-col gap-1.5 p-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[o?e.jsx("button",{type:"button",onClick:c,"aria-expanded":l,"aria-controls":l?d:void 0,className:"focus-ring -m-1 flex min-w-0 flex-1 items-start gap-3 rounded-md p-1 text-left","data-testid":`runtime-card-toggle-${s}`,children:p}):e.jsx("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:p}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2 pt-0.5",children:[n&&e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs whitespace-nowrap","data-testid":`runtime-ready-${s}`,children:[e.jsx(ze,{className:"size-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Ready"})]}),n&&g&&e.jsx("button",{type:"button",onClick:i==null?void 0:i.onOpen,className:"focus-ring text-muted-foreground hover:text-foreground hidden rounded-sm text-xs whitespace-nowrap underline-offset-2 transition-colors hover:underline sm:inline-flex","data-testid":`runtime-${g.id}-${s}`,children:g.label}),n&&!a&&r&&e.jsx("button",{type:"button",onClick:r,className:"focus-ring text-muted-foreground hover:text-foreground hidden rounded-sm text-xs whitespace-nowrap underline-offset-2 transition-colors hover:underline sm:inline-flex","data-testid":`runtime-make-default-${s}`,children:"Make default"}),o&&e.jsx("button",{type:"button",onClick:c,"aria-expanded":l,"aria-controls":l?d:void 0,"aria-label":`${l?"Hide":"Show"} ${m.label} ${n?"settings":"setup"}`,className:"focus-ring text-muted-foreground hover:text-foreground -m-1 inline-flex rounded-sm p-1 transition-colors","data-testid":`runtime-card-chevron-${s}`,children:e.jsx(Ue,{className:M("size-4 transition-transform",l&&"rotate-180")})})]})]}),u&&(o?e.jsx("button",{type:"button",tabIndex:-1,onClick:c,className:"focus-ring w-full rounded-md pl-12 text-left","data-testid":`runtime-card-summary-toggle-${s}`,children:u}):e.jsx("div",{className:"w-full pl-12",children:u}))]})}const Es="__inherit__";function zl({runtimeType:s,runtimeLabel:t,models:n,value:a,onChange:r,disabled:i,inheritLabel:o="Automatic",description:l}){const c=eo(n),d=a!==null&&c!==void 0&&!c.includes(a),u=(n??[]).some(h=>h.unverified),m=x.useId();return e.jsx(L,{label:"Model",description:l??`Which ${t} model new chats start on. Automatic lets ${t} pick.`,orientation:"vertical",children:e.jsxs("div",{className:"w-52 space-y-1.5",children:[e.jsxs(ee,{value:a??Es,disabled:i,onValueChange:h=>r(h===Es?null:h),children:[e.jsx(se,{className:"w-full","aria-label":`Default ${t} model`,...u?{"aria-describedby":m}:{},"data-testid":`runtime-model-select-${s}`,children:e.jsx(te,{})}),e.jsxs(ne,{children:[e.jsx(P,{value:Es,children:o}),(n??[]).map(h=>e.jsx(P,{value:h.value,children:h.displayName},h.value)),a!==null&&!(n??[]).some(h=>h.value===a)&&e.jsx(P,{value:a,children:d?`${a} (no longer offered)`:a})]})]}),u&&e.jsx(so,{id:m})]})})}const De="__inherit__",Ul=5;function Bl({runtimeType:s,runtimeLabel:t,supportsEffort:n,selectedModel:a,configuredModelId:r,value:i,onChange:o,disabled:l}){const c=a?a.supportsEffort??!1:!0,d=Wa.filter(u=>!(a!=null&&a.supportedEffortLevels)||a.supportedEffortLevels.includes(u));return e.jsx(L,{label:"Effort",description:"How much effort new chats put into answers.",orientation:"vertical",children:n?c?d.length+1>Ul?e.jsxs(ee,{value:i??De,disabled:l,onValueChange:u=>o(u===De?null:u),children:[e.jsx(se,{className:"w-52","aria-label":`Default ${t} effort`,"data-testid":`runtime-effort-${s}`,children:e.jsx(te,{})}),e.jsxs(ne,{children:[e.jsx(P,{value:De,children:"Automatic"}),d.map(u=>e.jsx(P,{value:u,children:ts(u)},u))]})]}):e.jsxs(bs,{"aria-label":`Default ${t} effort`,"data-testid":`runtime-effort-${s}`,disabled:l,value:i??De,onValueChange:u=>o(u===De?null:u),children:[e.jsx(Pe,{value:De,children:e.jsx("span",{className:"truncate",children:"Automatic"})}),d.map(u=>e.jsx(Pe,{value:u,children:e.jsx("span",{className:"truncate",children:ts(u)})},u))]}):e.jsxs("div",{className:"flex flex-col gap-1","data-testid":`runtime-effort-model-unsupported-${s}`,children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:[(a==null?void 0:a.displayName)??r," doesn’t take an effort setting"]}),i&&e.jsxs("button",{type:"button",onClick:()=>o(null),disabled:l,className:"focus-ring text-status-warning-fg self-start rounded-sm text-xs underline-offset-2 hover:underline disabled:pointer-events-none disabled:opacity-50","data-testid":`runtime-effort-clear-${s}`,children:[ts(i)," is saved but unused. Clear it"]})]}):e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":`runtime-effort-unsupported-${s}`,children:["Not supported by ",t]})})}const Ys={ask:"Asks before acting",act:"Pauses at big steps",autonomy:"Full autonomy"};function Kl({runtimeType:s,runtimeLabel:t,descriptors:n,stop:a,globalStop:r,onChange:i,disabled:o}){var p;const l=a!==null,c=a??r,d=(p=xn(n).find(g=>g.stop===c))==null?void 0:p.mode,u=(d==null?void 0:d.id)??"",m=c==="autonomy"&&(a===null||a===r),h=d!==void 0&&Ya(d)&&!m;return e.jsxs("section",{className:"flex flex-col gap-1.5","data-testid":`runtime-trust-${s}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Where it stops for you"}),l?e.jsx(v,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",disabled:o,onClick:()=>i(null),children:"Use the shared setting"}):e.jsx("span",{className:"text-muted-foreground text-3xs tracking-wide uppercase","data-testid":`runtime-trust-global-${s}`,children:"Global setting"})]}),n.length===0?e.jsxs("p",{"data-testid":`runtime-trust-unavailable-${s}`,className:"text-muted-foreground px-1 text-xs leading-relaxed",children:[t," hasn’t listed its options yet. New chats use its own setting."]}):e.jsx(Ha,{mode:u,descriptors:n,stopLabels:Ys,disabled:o===!0,strandsWorkingMode:!0,strandedNote:`${t} has no setting here. New chats use its own.`,onChangeMode:g=>{const j=n.find(y=>y.id===g);j&&i(j.stop)}}),h&&e.jsx(hn,{mode:u,descriptor:d,className:"px-1"})]})}const ql="One sign-in away from its settings.",Wl="Your default isn’t connected, so new chats can’t start.",Yl=(s,t)=>`Your ${s} sign-in runs out in ${t}. Sign in again to keep agents working.`,Hl=s=>`Your ${s} sign-in stops working soon. Sign in again now.`,Vl=s=>`${s} keeps no settings here. It uses its own model and the setting below.`,Gl="Starts with";function Ql({type:s,subtitle:t,ready:n,isDefault:a,onMakeDefault:r,expanded:i,onToggleExpanded:o,summary:l,connectSlot:c,reconnect:d,reconnectPanel:u,model:m,effort:h,trust:p,storesDefaults:g=!0,sections:j,renderSection:y,setupDetails:b,setupBadge:f,expiringSignIn:S,className:D}){const A=le(s),T=x.useId(),[O,N]=x.useState(!1),k=n||!!b,Q=a&&!n,q=(j??[]).flatMap($=>{const F=y==null?void 0:y($.kind);return F?[e.jsx("div",{"data-testid":`runtime-card-section-${$.kind}-${s}`,children:F},$.kind)]:[]});return e.jsxs("article",{style:{"--runtime-accent":A.accent},className:M("bg-card border-border shadow-soft rounded-lg border",a&&"border-[var(--runtime-accent)]/40 ring-1 ring-[var(--runtime-accent)]/30",D),"data-testid":`runtime-card-${s}`,children:[e.jsx(Ml,{type:s,subtitle:t,ready:n,isDefault:a,onMakeDefault:r,reconnect:d,toggleable:k,expanded:i,onToggleExpanded:o,bodyId:T,children:n?!i&&l.length>0&&e.jsxs("span",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-1 text-xs","data-testid":`runtime-card-summary-${s}`,children:[e.jsx("span",{className:"text-muted-foreground whitespace-nowrap",children:Gl}),l.map(($,F)=>e.jsxs("span",{className:"inline-flex max-w-full items-center gap-x-1.5 whitespace-nowrap",children:[F>0&&e.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground/60 shrink-0",children:"·"}),e.jsx("span",{className:M("min-w-0 truncate",$.inherited?"text-muted-foreground":"text-foreground font-medium"),"data-inherited":$.inherited===!0,"data-testid":`runtime-card-summary-segment-${$.kind}-${F}`,children:$.label})]},`${$.kind}-${$.label}`))]}):e.jsx("span",{className:"text-muted-foreground text-xs","data-testid":`runtime-card-locked-${s}`,children:ql})}),Q&&e.jsxs("p",{className:"text-status-warning-fg flex items-start gap-1.5 px-4 pb-3 text-xs","data-testid":`runtime-default-broken-${s}`,children:[e.jsx(ie,{className:"mt-px size-3.5 shrink-0","aria-hidden":!0}),Wl]}),S&&e.jsxs("p",{className:"text-status-warning-fg flex items-start gap-1.5 px-4 pb-3 text-xs","data-testid":`runtime-sign-in-expiring-${s}`,children:[e.jsx(ie,{className:"mt-px size-3.5 shrink-0","aria-hidden":!0}),S.timeLeft===null?Hl(A.label):Yl(A.label,S.timeLeft)]}),!n&&c&&e.jsx("div",{className:"px-4 pb-4",children:c}),n&&u&&e.jsx("div",{className:"px-4 pb-4",children:u}),i&&k&&e.jsxs("div",{id:T,className:"border-border/60 space-y-5 border-t px-4 py-4","data-testid":`runtime-card-body-${s}`,children:[n&&(d||!a&&r)&&e.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 sm:hidden",children:[d&&e.jsx("button",{type:"button",onClick:d.onOpen,className:"focus-ring text-muted-foreground hover:text-foreground rounded-sm text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${Ws[d.kind].id}-compact-${s}`,children:Ws[d.kind].label}),!a&&r&&e.jsx("button",{type:"button",onClick:r,className:"focus-ring text-muted-foreground hover:text-foreground rounded-sm text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-make-default-compact-${s}`,children:"Make default"})]}),n&&(g?e.jsxs(e.Fragment,{children:[e.jsx(zl,{runtimeType:s,runtimeLabel:A.label,...m}),e.jsx(Bl,{runtimeType:s,runtimeLabel:A.label,...h}),e.jsx(Kl,{runtimeType:s,runtimeLabel:A.label,...p}),q]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":`runtime-card-no-settings-${s}`,children:Vl(A.label)}),q]})),b&&e.jsx(vs,{open:O,onOpenChange:N,trigger:"Setup details",badge:f,className:"bg-transparent",children:b})]})]})}const Xl="Automatic",Jl={ask:"Asks first",act:"Pauses at big steps",autonomy:"Full autonomy"},Zl={"claude-accounts":s=>`runs on ${s}`,"opencode-power-source":s=>s};function ec(s){var a,r,i,o,l,c;if(!s.ready)return[];const t=[],n=(a=s.model)==null?void 0:a.trim();if(n){const d=(r=s.models)==null?void 0:r.find(u=>u.value===n);t.push({kind:"model",label:(d==null?void 0:d.displayName)??n,inherited:!1})}else t.push({kind:"model",label:s.inheritModelLabel??Xl,inherited:!0});(i=s.settings)!=null&&i.supportsEffort&&s.effort&&s.modelTakesEffort!==!1&&t.push({kind:"effort",label:`${ts(s.effort)} effort`}),s.trustStop&&t.push({kind:"trust",label:Jl[s.trustStop],inherited:s.trustInherited??!1});for(const d of((o=s.settings)==null?void 0:o.sections)??[]){const u=(c=(l=s.sectionValues)==null?void 0:l[d.kind])==null?void 0:c.trim(),m=Zl[d.kind];u&&m&&t.push({kind:"section",label:m(u)})}return t}function sc(s){const t=s.map(n=>n.label);return t.length<=1?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function tc({stop:s,effectiveStop:t,runtimes:n,onChange:a,onChangeRuntime:r}){var m;const i=s??t,o=xn(Va),l=n.filter(h=>h.stop==="autonomy"),c=i==="autonomy",d=c||l.length>0,u=(m=o.find(h=>h.stop===(d?"autonomy":i)))==null?void 0:m.mode;return e.jsxs("section",{className:"@container/trust-row flex flex-col gap-2","data-testid":"global-trust-row",children:[e.jsxs("div",{className:"flex flex-col gap-3 @2xl/trust-row:flex-row @2xl/trust-row:items-center @2xl/trust-row:justify-between @2xl/trust-row:gap-6",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:"Where new chats stop for you"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Cards above use this unless set otherwise."})]}),e.jsx(bs,{"aria-label":"Where new chats stop for you",className:"w-full @2xl/trust-row:w-auto @2xl/trust-row:shrink-0",value:i,onValueChange:h=>a(h),children:o.map(({stop:h,mode:p})=>e.jsxs(Pe,{value:h,"aria-label":Ys[h],children:[e.jsx(Ga,{descriptor:p,className:"size-(--size-icon-xs) shrink-0"}),e.jsx("span",{className:"truncate",children:Ys[h]})]},h))})]}),(c||l.length>0)&&e.jsxs("p",{className:`flex items-start gap-1.5 px-1 text-xs ${Qa.power}`,"data-testid":"default-trust-stop-standing-note",children:[e.jsx(Xa,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsxs("span",{children:[c?"New chats run at full power":`New chats on ${sc(l)} run at full power`,"."," ",e.jsx("button",{type:"button",className:"focus-ring rounded-sm underline underline-offset-2",onClick:()=>{c&&a("ask");for(const h of l)r(h.runtime,null)},children:"Change"})]})]}),e.jsx(hn,{descriptor:u,className:"px-1"})]})}const nc=["blue","green","amber","purple","pink","teal","indigo","stone"],Ze=[...nr.map((s,t)=>({name:nc[t]??s,hex:s})),{name:"Default",hex:null}];function ac({name:s,color:t,colorIsDefault:n,onChoose:a,disabled:r,defaultOpen:i=!1}){const[o,l]=x.useState(i),c=x.useRef([]),d=Ze.findIndex(p=>p.hex===null?n:!n&&p.hex===t.toLowerCase()),u=d===-1?0:d;function m(p){l(!1),a(p)}function h(p){var f;const g=p.key==="ArrowRight"||p.key==="ArrowDown"?1:p.key==="ArrowLeft"||p.key==="ArrowUp"?-1:0;if(g===0)return;p.preventDefault();const j=c.current.findIndex(S=>S===document.activeElement),b=((j===-1?u:j)+g+Ze.length)%Ze.length;(f=c.current[b])==null||f.focus()}return e.jsxs(Ja,{open:o,onOpenChange:l,children:[e.jsx(Za,{asChild:!0,children:e.jsx("button",{type:"button","aria-label":`Color for ${s}`,"aria-haspopup":"dialog",disabled:r,className:"focus-visible:ring-ring -m-1 inline-flex shrink-0 rounded-full p-1 focus-visible:ring-2 focus-visible:outline-none",children:e.jsx(er,{color:t,name:s,size:"md"})})}),e.jsxs(sr,{className:"w-auto p-3",align:"start",children:[e.jsxs(tr,{className:"sr-only",children:["Color for ",s]}),e.jsx("div",{role:"radiogroup","aria-label":`Color for ${s}`,className:"flex flex-wrap items-center gap-1.5",onKeyDown:h,children:Ze.map((p,g)=>{const j=g===d;return e.jsx("button",{ref:y=>{c.current[g]=y},type:"button",role:"radio","aria-checked":j,"aria-label":p.name,title:p.name,tabIndex:g===u?0:-1,onClick:()=>m(p.hex),className:M("focus-visible:ring-ring inline-flex items-center justify-center rounded-full focus-visible:ring-2 focus-visible:outline-none",p.hex===null?"text-foreground hover:bg-muted h-6 gap-1 border px-2 text-xs":"size-6 bg-(--swatch) text-white",j&&p.hex!==null&&"ring-foreground ring-2 ring-offset-2"),style:p.hex?{"--swatch":p.hex}:void 0,children:p.hex===null?e.jsxs(e.Fragment,{children:[j&&e.jsx(ze,{className:"size-3","aria-hidden":!0}),"Default"]}):j&&e.jsx(ze,{className:"size-3.5","aria-hidden":!0})},p.name)})})]})]})}const rc=[{key:"five_hour",label:"5-hour window"},{key:"seven_day",label:"Weekly"}];function Bn(s,t=new Date){return!!s&&(s.windows.length>0||Kn(s.spend,t))}function Kn(s,t=new Date){if(!s)return!1;const n=new Date(s.periodStart);return Number.isNaN(n.getTime())?!1:n.getFullYear()===t.getFullYear()&&n.getMonth()===t.getMonth()}function ic({spend:s}){return e.jsxs("p",{className:"text-muted-foreground text-xs tabular-nums","data-slot":"spend-line",children:[ar(s.costUsd)," spent this month"]})}function qn({usage:s,name:t,now:n=new Date}){if(!Bn(s,n))return null;const a=s.windows.length>0;return e.jsxs("div",{className:"space-y-2","data-slot":"account-usage-bars",children:[t&&e.jsx("p",{className:"text-sm font-medium",children:t}),a?rc.map(({key:r,label:i})=>e.jsx(Ms,{window:zs(s,r),label:i},r)):Kn(s.spend,n)&&e.jsx(ic,{spend:s.spend})]})}function Ft(s){return new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime()}function oc(s,t){if(s===null)return null;const n=new Date(s);if(Number.isNaN(n.getTime()))return null;const a=Math.round((Ft(t)-Ft(n))/864e5);return a<=0?"used today":a===1?"used yesterday":`used ${a} days ago`}function lc({folders:s,onAdd:t,onDismiss:n,error:a=null,disabled:r=!1}){const i=x.useId();if(s.length===0)return null;const o=new Date;return e.jsxs("div",{role:"group","aria-labelledby":i,className:"bg-muted/50 rounded-md border border-dashed px-3 py-1.5","data-testid":"found-accounts-group",children:[e.jsx("p",{id:i,className:"text-muted-foreground py-1 text-xs",children:"Found on this computer"}),e.jsx("ul",{className:"divide-y",children:s.map(l=>{const c=oc(l.lastUsedAt,o),d=(a==null?void 0:a.path)===l.path?a.message:null;return e.jsxs("li",{className:"py-2","data-testid":"found-account-row",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("div",{className:"min-w-40 flex-1",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-sm",children:[e.jsx("span",{className:"font-semibold break-all",children:l.name}),c&&e.jsxs("span",{className:"text-muted-foreground text-xs whitespace-nowrap",children:["· ",c]}),l.orgManaged&&e.jsx("span",{className:M("text-2xs rounded-full px-2 leading-5 whitespace-nowrap",rr.warning),children:"managed by an organization"})]}),e.jsx("p",{className:"text-muted-foreground truncate font-mono text-xs",title:l.path,children:is(l.path)})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx(v,{size:"sm",variant:l.orgManaged?"outline":"default",onClick:()=>t(l),disabled:r,"aria-label":`Add ${l.name}`,children:"Add"}),e.jsx(v,{size:"sm",variant:"outline",onClick:()=>n(l),disabled:r,"aria-label":`Dismiss ${l.name}`,children:"Dismiss"})]})]}),d&&e.jsxs("p",{role:"alert",className:"text-destructive mt-1 flex items-start gap-1.5 text-xs","data-testid":"found-account-error",children:[e.jsx(ie,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:d})]})]},l.path)})})]})}function Wn(s){return s.length<=1?s[0]??"":`${s.slice(0,-1).join(", ")} and ${s[s.length-1]}`}function Yn(s){return s instanceof Error&&s.message||"Couldn’t save that. Try again."}function Hn(){const s=G();return()=>{s.invalidateQueries({queryKey:H.all}),s.invalidateQueries({queryKey:Oe.all})}}function cc({onlyProjects:s}){return s===null?null:e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"claude-account-only-for",children:s.length===0?ir:`Only for ${Wn(s.map(t=>t.name))}`})}function dc({open:s,onOpenChange:t,accountId:n,accountName:a,current:r}){const i=W(),o=Hn(),l=x.useId(),c=V({queryKey:Oe.projects(),queryFn:()=>i.listProjects(),enabled:s}),[d,u]=x.useState(r===null?"any":"only"),[m,h]=x.useState(()=>new Set((r??[]).map(A=>A.root))),[p,g]=x.useState(!1),j=Be({mutationFn:()=>i.setAccountOnlyProjects(n,d==="any"?null:[...m]),onSuccess:()=>{o(),t(!1)}}),y=c.data??[],b=(r??[]).filter(A=>!y.some(T=>T.root===A.root)),f=[...y,...b];function S(){if(d==="only"&&m.size===0){g(!0);return}g(!1),j.mutate()}function D(A,T){g(!1),h(O=>{const N=new Set(O);return T?N.add(A):N.delete(A),N})}return e.jsx(Gs,{open:s,onOpenChange:t,children:e.jsxs(Qs,{className:"max-h-[85vh] md:max-w-md",children:[e.jsxs(dn,{children:[e.jsxs(Xs,{className:"text-sm font-medium",children:["Where can ",a," work?"]}),e.jsx(Js,{className:"text-muted-foreground text-xs",children:"Nobody can use it anywhere else, even in folders outside a project."})]}),e.jsxs(un,{className:"space-y-3",children:[e.jsxs(or,{value:d,onValueChange:A=>u(A),"aria-labelledby":l,children:[e.jsxs("span",{id:l,className:"sr-only",children:["Where ",a," can work"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(St,{value:"any",id:`${l}-any`}),e.jsx(Ee,{htmlFor:`${l}-any`,className:"text-sm font-normal",children:"Any project"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(St,{value:"only",id:`${l}-only`}),e.jsx(Ee,{htmlFor:`${l}-only`,className:"text-sm font-normal",children:"Only these projects"})]})]}),d==="only"&&e.jsxs("div",{className:"space-y-1.5 pl-6","data-testid":"limit-projects-list",children:[c.isPending&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Looking for projects…"}),!c.isPending&&f.length===0&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"No projects yet. Start a chat in one first."}),f.map(A=>{const T=`${l}-${A.root}`;return e.jsxs("div",{className:"flex min-h-11 items-center gap-2 md:min-h-8",children:[e.jsx(en,{id:T,checked:m.has(A.root),onCheckedChange:O=>D(A.root,O===!0)}),e.jsx(Ee,{htmlFor:T,className:"min-w-0 text-sm font-normal",children:e.jsx("span",{className:"truncate",children:A.name})})]},A.root)})]}),p&&e.jsxs("p",{role:"alert",className:"text-destructive flex items-start gap-1.5 text-xs",children:[e.jsx(ie,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:"Pick a project, or choose Any project."})]}),j.isError&&e.jsxs("p",{role:"alert",className:"text-destructive flex items-start gap-1.5 text-xs",children:[e.jsx(ie,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:Yn(j.error)})]})]}),e.jsxs(mn,{children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>t(!1),children:"Cancel"}),e.jsx(v,{size:"sm",onClick:S,disabled:j.isPending,children:"Save"})]})]})})}function uc({limits:s,nameForId:t}){const n=W(),a=Hn(),r=x.useId(),i=Be({mutationFn:o=>n.setProjectAccounts(o,null),onSuccess:a});return s.length===0?null:e.jsxs("div",{role:"group","aria-labelledby":r,className:"rounded-md border px-3 py-1.5","data-testid":"project-limits",children:[e.jsxs("div",{className:"flex items-center gap-1.5 pt-1",children:[e.jsx("p",{id:r,className:"text-muted-foreground text-xs",children:"Project limits"}),e.jsxs(Ke,{label:"About project limits",children:[e.jsx("p",{children:"The Flow extension or a script sets each project’s list."}),e.jsx("p",{children:"Remove a limit to let that project use every account."})]})]}),e.jsx("p",{className:"text-muted-foreground pb-1 text-xs","data-testid":"project-limits-note",children:"These projects use only the accounts listed."}),e.jsx("ul",{className:"divide-y",children:s.map(({project:o,allow:l})=>e.jsxs("li",{className:"flex flex-wrap items-center gap-2 py-2","data-testid":"project-limit-row",children:[e.jsxs("div",{className:"min-w-40 flex-1",children:[e.jsx("p",{className:"text-sm font-medium break-all",children:o.name}),e.jsx("p",{className:"text-muted-foreground text-xs",children:l.length===0?"Uses no account":`Uses only ${Wn(l.map(t))}`})]}),e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>i.mutate(o.root),disabled:i.isPending,"aria-label":`Let ${o.name} use every account`,children:"Remove"})]},o.root))}),i.isError&&e.jsxs("p",{role:"alert",className:"text-destructive flex items-start gap-1.5 pb-1.5 text-xs",children:[e.jsx(ie,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:Yn(i.error)})]})]})}const Is="__default__",Ls="__credits__";function es(s){return s.flatMap(t=>t.id?[t.id]:[])}function Hs(s){const t=new Set([fn,...s.flatMap(n=>n.id?[n.id]:[])]);return s.map(n=>{const a=n.id??jn({label:n.label,path:n.path,taken:t});return t.add(a),{id:a,path:n.path,label:n.label,color:n.colorIsDefault?null:n.color}})}function Mt(s,t,n){const a=Hs(s),r=jn({label:n,path:t,taken:[fn,...a.map(i=>i.id)]});return[...a,{id:r,path:t,label:n,color:null}]}function Ps(s){return s instanceof Error&&s.message||"Couldn’t save that. Try again."}function mc(){var Ve;const{data:s}=Se(),{nameFor:t,credits:n}=js(),a=je(),r=fs(),i=G(),[o,l]=x.useState(""),[c,d]=x.useState(""),[u,m]=x.useState(!1),[h,p]=x.useState(!1),[g,j]=x.useState(null),[y,b]=x.useState(null),f=W(),S=V({queryKey:Oe.found(),queryFn:()=>f.getFoundClaudeFolders()}),D=Be({mutationFn:w=>f.dismissFoundClaudeFolder(w.path),onMutate:()=>b(null),onSuccess:()=>i.invalidateQueries({queryKey:Oe.found()}),onError:(w,B)=>b({path:B.path,message:Ps(w)})}),A=lr("claude-code"),T=rt("claude-code",{fetch:!0}),O=Zt("settings.tabs").some(w=>w.id===pn),N=s==null?void 0:s.claudeCode,k=(N==null?void 0:N.accounts)??[],Q=N==null?void 0:N.resolvedAccount,q=(N==null?void 0:N.inherited)??!0,$=N==null?void 0:N.resolvedAccountId,F=$&&$!==Ne?k.find(w=>w.id===$):void 0,K=(F==null?void 0:F.path)??Q,C=n!==null&&(n.available||n.isDefault),U=n!=null&&n.isDefault?Ls:q||!K?Is:K,I=A?T.byId.get(Ne):void 0,ce=o.trim(),Ae=k.some(w=>w.path===ce),We=ce.length>0&&!cr(ce),Ye=ce.length>0&&!Ae&&!We;function J(w,B,Y=j){j(null),b(null),a.mutate({runtimes:{claudeCode:w}},{onSuccess:()=>{i.invalidateQueries({queryKey:H.all}),i.invalidateQueries({queryKey:Oe.usage("claude-code")}),B==null||B()},onError:Z=>Y(Ps(Z))})}function He(w){j(null);const B=Z=>j(Ps(Z));if(w===Ls){r.mutate({runtime:"claude-code",useCredits:!0},{onError:B});return}const Y=w===Is?null:w;if(n!=null&&n.isDefault){r.mutate({runtime:"claude-code",useCredits:!1},{onError:B,onSuccess:()=>{const Z=q?null:(N==null?void 0:N.resolvedAccount)??null;Y!==Z&&J({defaultAccount:Y})}});return}J({defaultAccount:Y})}function Cs(){Ye&&J({accounts:Mt(k,ce,c.trim()||null),accountsSeen:es(k)},()=>{l(""),d(""),m(!1)})}function jt(w){J({accounts:Mt(k,w.path,null),accountsSeen:es(k)},()=>void i.invalidateQueries({queryKey:Oe.found()}),B=>b({path:w.path,message:B}))}function Ss(w,B){J({accounts:Hs(k).map((Y,Z)=>k[Z].path===w?{...Y,color:B}:Y),accountsSeen:es(k)})}function Me(w){const B=Hs(k.filter(Z=>Z.path!==w)),Y=!q&&F!==void 0&&F.path===w;J({accounts:B,accountsSeen:es(k),...Y&&{defaultAccount:null}})}return e.jsxs("section",{className:"bg-muted/30 space-y-3 rounded-lg border p-3","data-testid":"claude-accounts-section",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Runs on"}),e.jsx(v,{variant:"ghost",size:"sm",className:"text-muted-foreground h-auto px-1 py-0 text-xs",onClick:()=>m(w=>!w),"aria-expanded":u,children:"Add account"})]}),!A&&e.jsx(xc,{accounts:k,usage:T}),e.jsx(L,{label:"Default account",description:"New chats run on this unless the agent or the chat picks another.",children:e.jsxs(ee,{value:U,onValueChange:He,disabled:r.isPending,children:[e.jsx(se,{className:"w-52","aria-label":"Default account","data-testid":"claude-account-select",children:e.jsx(te,{})}),e.jsxs(ne,{children:[e.jsx(P,{value:Is,children:q&&Q?`Default (${is(Q)})`:"Default"}),dr(k,q?null:K).map(w=>e.jsx(P,{value:w.path,children:t(w.path)},w.path)),C&&e.jsx(P,{value:Ls,children:gn})]})]})}),(n==null?void 0:n.isDefault)&&n.chosenBy==="default"&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"claude-credits-chosen-for-you",children:"DorkOS chose this when you linked your account. Claude Code had no working sign-in."}),(n==null?void 0:n.isDefault)&&!n.available&&e.jsxs("div",{className:"text-muted-foreground text-xs","data-testid":"claude-credits-unavailable",children:[e.jsx("p",{children:"DorkOS credits aren’t available, so new chats here won’t start."}),e.jsx("p",{children:"Sign in to your DorkOS account again, or pick another account."})]}),(N==null?void 0:N.launchOverride)&&!$&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"claude-account-launch-override",children:["New chats use ",is(N.launchOverride.path),", from the server’s $CLAUDE_CONFIG_DIR."]}),k.map(w=>e.jsx(zt,{name:t(w.path),account:w,isActive:w.id!==null&&w.id===$,onRemove:()=>Me(w.path),onChooseColor:B=>Ss(w.path,B),rule:w.id?{accountId:w.id,onlyProjects:w.onlyProjects??null}:null,disabled:a.isPending,identity:A?{usage:(w.id?T.byId.get(w.id):void 0)??T.byPath.get(w.path)}:null},w.path)),I&&e.jsx(zt,{name:I.label??t(I.path),account:{path:I.path,color:(N==null?void 0:N.defaultAccountResolvedColor)??I.color,colorIsDefault:((N==null?void 0:N.defaultAccountColor)??null)===null,isAccountRoot:!0},isActive:$===Ne,onChooseColor:w=>J({defaultAccountColor:w}),rule:{accountId:Ne,onlyProjects:(N==null?void 0:N.defaultAccountOnlyProjects)??null},disabled:a.isPending,identity:{usage:I}}),e.jsx(uc,{limits:(N==null?void 0:N.projectAccounts)??[],nameForId:w=>{if(w===Ne)return(I==null?void 0:I.label)??"Main";const B=k.find(Y=>Y.id===w);return B?t(B.path):w}}),e.jsx(lc,{folders:((Ve=S.data)==null?void 0:Ve.folders)??[],onAdd:jt,onDismiss:w=>D.mutate(w),error:y,disabled:a.isPending||D.isPending}),A&&O&&e.jsx(hc,{}),u&&e.jsx(L,{orientation:"vertical",label:"Add an account",description:e.jsxs(e.Fragment,{children:["Pick the account’s Claude Code folder, then name it."," ",e.jsxs(Ke,{label:"About adding an account",children:[e.jsx("p",{children:"Name it after the client it bills."}),e.jsx("p",{children:"DorkOS only reads the folder. It never signs you in or moves anything."})]})]}),children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(to,{"aria-label":"Account folder",placeholder:"/Users/you/.claude2",value:o,onChange:l,onBrowse:()=>p(!0),browseTestId:"browse-claude-account","data-testid":"claude-account-path"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{htmlFor:"claude-account-label",className:"text-muted-foreground text-xs",children:"Name"}),e.jsx(re,{id:"claude-account-label",placeholder:"Acme Corp",value:c,onChange:w=>d(w.target.value),className:"h-11 flex-1 md:h-8"}),e.jsx(v,{size:"sm",onClick:Cs,disabled:!Ye||a.isPending,children:"Add"})]}),Ae&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"claude-account-duplicate",children:"That folder is already added."}),We&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"claude-account-not-absolute",children:["Use the full path, like ",e.jsx("code",{children:"/Users/you/.claude2"}),". A path starting with"," ",e.jsx("code",{children:"~"})," won’t work."]})]})}),g&&e.jsxs("p",{role:"alert",className:"text-destructive flex items-start gap-1.5 text-xs","data-testid":"claude-account-error",children:[e.jsx(ie,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:g})]}),e.jsx(ur,{open:h,onOpenChange:p,onSelect:l,initialPath:ce||null})]})}function xc({accounts:s,usage:t}){const{nameFor:n}=js();if(s.length>1)return null;const a=s[0],r=a?(a.id?t.byId.get(a.id):void 0)??t.byPath.get(a.path):t.byId.get(Ne);if(!r)return null;const i=a?n(a.path):r.label??n(r.path);return e.jsx(qn,{usage:r,name:i})}function hc(){const{setTab:s}=oe();return e.jsxs("p",{className:"bg-muted text-muted-foreground rounded-md px-3 py-2 text-xs",children:["Flow uses these accounts. Choose how in"," ",e.jsx("button",{type:"button",onClick:()=>s(pn),className:"text-foreground font-semibold underline-offset-2 hover:underline",children:"Settings → Flow"}),"."]})}function zt({name:s,account:t,isActive:n,onRemove:a,onChooseColor:r,rule:i,disabled:o,identity:l}){const[c,d]=x.useState(!1);return e.jsxs("div",{className:"flex items-start gap-3","data-testid":"claude-account-row",children:[l&&e.jsx("span",{className:"mt-1 flex",children:e.jsx(ac,{name:s,color:t.color,colorIsDefault:t.colorIsDefault,onChoose:r,disabled:o})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("p",{className:"text-sm font-medium",children:[s,n&&e.jsx("span",{className:"text-muted-foreground ml-2 text-xs",children:"in use"})]}),e.jsx("p",{className:"text-muted-foreground truncate font-mono text-xs",title:t.path,children:is(t.path)}),i&&e.jsxs(e.Fragment,{children:[e.jsx(cc,{onlyProjects:i.onlyProjects}),e.jsx(v,{variant:"link",size:"sm",className:"text-muted-foreground h-auto px-0 py-0.5 text-xs",onClick:()=>d(!0),disabled:o,children:"Limit to projects…"}),c&&e.jsx(dc,{open:!0,onOpenChange:d,accountId:i.accountId,accountName:s,current:i.onlyProjects})]}),!t.isAccountRoot&&e.jsxs("p",{className:"text-muted-foreground mt-1 flex items-start gap-1.5 text-xs","data-testid":"claude-account-not-ready",children:[e.jsx(ie,{className:"text-destructive mt-px size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:"Not a Claude Code account yet. No chats show from it."})]})]}),l&&e.jsxs("div",{className:"w-36 shrink-0 space-y-1 pt-0.5",children:[e.jsx(Ms,{window:zs(l.usage,"five_hour"),label:"5h",compact:!0}),e.jsx(Ms,{window:zs(l.usage,"seven_day"),label:"wk",compact:!0})]}),a?e.jsx(v,{variant:"ghost",size:"sm",onClick:a,disabled:o,"aria-label":`Remove ${s}`,children:e.jsx(ns,{className:"size-3.5"})}):e.jsx("span",{"aria-hidden":"true","data-testid":"claude-account-remove-spacer",className:M(mr({variant:"ghost",size:"sm"}),"invisible"),children:e.jsx(ns,{className:"size-3.5"})})]})}function pc({type:s,provider:t,renderConnect:n}){const[a,r]=x.useState(!1);return e.jsxs("section",{className:"bg-muted/30 space-y-3 rounded-lg border p-3","data-testid":"power-source-section",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Power source"}),t&&!a&&e.jsx(v,{variant:"ghost",size:"sm",className:"text-muted-foreground h-auto px-1 py-0 text-xs",onClick:()=>r(!0),"data-testid":"power-source-change",children:"Change"})]}),t?e.jsx("p",{className:"text-sm font-medium","data-testid":"power-source-current",children:Rn(t)}):e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"power-source-empty",children:[ot(s)," was signed in outside DorkOS, so its model source is unknown."]}),t&&a&&e.jsxs("div",{className:"space-y-2","data-testid":"power-source-panel",children:[n({type:s,connect:{kind:"provider-picker",label:"Change power source"},currentProvider:t,onConnected:()=>r(!1)}),e.jsx("button",{type:"button",onClick:()=>r(!1),className:"focus-ring text-muted-foreground hover:text-foreground rounded-sm text-xs transition-colors","data-testid":"power-source-cancel",children:"Keep current source"})]})]})}function gc({type:s}){var a;const{data:t}=it(),n=(a=t==null?void 0:t.runtimes[s])==null?void 0:a.provider;return e.jsx(pc,{type:s,...n?{provider:n}:{},renderConnect:Bs})}function fc(s,t){return s==="effort"?`effort ${t}`:s==="account"||s==="runtime"?`runs on ${t}`:`${s} ${t}`}function jc({exceptions:s}={}){const t=vi({checkModels:s===void 0}),n=s??t.exceptions,a=oe();function r(i){a.close(),pr.getState().openProfileDocked(i)}return n.length===0?null:e.jsxs("div",{className:"space-y-1","data-testid":"execution-exceptions-strip",children:[e.jsx("p",{className:"text-muted-foreground px-1 text-xs",children:"These agents run on something else:"}),e.jsx("ul",{className:"divide-border bg-card divide-y overflow-hidden rounded-lg border",children:n.map(({path:i,agent:o,report:l})=>{const c=l.isBroken?l.breakages.map(u=>u.message).join(" "):l.deviations.map(u=>fc(u.field,u.label)).join(", "),d=xr(o);return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>r(i),className:"hover:bg-accent flex w-full items-center gap-2 px-3 py-2 text-left transition-colors","data-testid":l.isBroken?"execution-exception-broken":"execution-exception",children:[e.jsx(hr,{color:d.color,emoji:d.emoji,size:"xs"}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5 sm:flex-row sm:items-start sm:gap-3",children:[e.jsx("span",{className:"truncate text-sm font-medium sm:pt-px",children:o.name}),e.jsxs("span",{className:M("flex min-w-0 items-start gap-1.5 text-xs sm:ml-auto sm:max-w-[65%]",l.isBroken?"text-status-warning-fg":"text-muted-foreground"),children:[l.isBroken&&e.jsx($e,{className:"mt-0.5 size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"line-clamp-2",title:c,children:c})]})]})]})},i)})})]})}function yc(s){return s instanceof Error&&s.message||"Couldn’t save that. Try again."}function Vn(){const{data:s}=qe(),t=je(),n=G(),[a,r]=x.useState(null),i=x.useCallback(c=>{r(null),t.mutate(c,{onSuccess:()=>{n.invalidateQueries({queryKey:H.all}),n.invalidateQueries({queryKey:gr.all})},onError:d=>r(yc(d))})},[t,n]),o=x.useCallback((c,d)=>{var m;if(c===null){i({runtimes:{defaultTrustStop:d}});return}const u=(m=On(s,c))==null?void 0:m.configSection;u&&i({runtimes:{[u]:{defaultTrustStop:d}}})},[s,i]),l=x.useCallback(()=>r(null),[]);return{changeTrustStop:o,writeError:a,clearWriteError:l,isPending:t.isPending}}const bc={healthy:"success",delivered:"success",connected:"success",pending:"info",starting:"info",new:"info",reconnecting:"warning",degraded:"warning",warning:"warning",rate_limited:"warning",failed:"error",error:"error",disconnected:"error",inactive:"neutral",stopped:"neutral"};function gt(s){return bc[s]??"neutral"}function vc(s){return we[gt(s)]}function Nc(s){return fr[gt(s)]}function kc(s){return jr[gt(s)]}const wc={delivered:"success",failed:"error",no_subscriber:"neutral",sent:"info",timeout:"neutral"};function Cc(s){return we[wc[s]]??we.neutral}function Sc(s){return new Date(s).toLocaleTimeString()}function Ut(s,t){if(s==null||t==null)return null;const n=new Date(t).getTime()-new Date(s).getTime();return n<1e3?`${n}ms`:`${(n/1e3).toFixed(1)}s`}function Ac({messageId:s,onClose:t}){const{data:n,isLoading:a,error:r}=_o(s);if(a)return e.jsx("div",{className:"text-muted-foreground p-4 text-sm",children:"Loading trace…"});if(r||!n)return e.jsx("div",{className:"text-destructive p-4 text-sm",children:"Couldn’t load where this message went."});const{traceId:i,spans:o}=n;return e.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-muted-foreground font-mono text-xs",children:["Trace: ",i.slice(0,8),"…"]}),t&&e.jsx("button",{onClick:t,className:"text-muted-foreground hover:text-foreground text-xs",children:"Close"})]}),e.jsx("div",{className:"border-border relative ml-3 border-l pl-6",children:o.map(l=>{const c=Ut(l.sentAt,l.deliveredAt),d=Ut(l.deliveredAt,l.processedAt);return e.jsxs("div",{className:"relative pb-4 last:pb-0",children:[e.jsx("div",{className:`absolute top-1 -left-[calc(1.5rem+0.3125rem)] h-2.5 w-2.5 rounded-full ${Cc(l.status)}`}),e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"font-medium",children:l.subject}),e.jsx("span",{className:"bg-muted rounded px-1.5 py-0.5 text-xs",children:l.status})]}),e.jsxs("div",{className:"text-muted-foreground flex gap-3 text-xs",children:[e.jsxs("span",{children:["Sent: ",Sc(l.sentAt)]}),c&&e.jsxs("span",{children:["Delivery: ",c]}),d&&e.jsxs("span",{children:["Processing: ",d]})]}),l.errorMessage&&e.jsx("div",{className:"bg-destructive/10 text-destructive mt-1 rounded px-2 py-1 text-xs",children:l.errorMessage})]})]},l.id)})})]})}function _s(s){if(s.payload&&typeof s.payload=="object"){const n=s.payload;if(typeof n.adapterId=="string")return n.adapterId}const t=s.from.raw.match(/^relay\.human\.([^.]+)/);return t?t[1]:""}function Bt(s){if(s.payload&&typeof s.payload=="object"){const t=s.payload;if(typeof t.chatId=="string")return t.chatId}}function Kt(s){if(s.payload&&typeof s.payload=="object"){const n=s.payload.channelType;if(n==="dm"||n==="group"||n==="channel"||n==="thread")return n}}const Tc={delivered:"Delivered",failed:"Error",pending:"Pending"};function qt(s){return new Date(s).toLocaleTimeString([],{hour:"numeric",minute:"2-digit",second:"2-digit"})}function Dc(s){return s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`}function Oc(s){return s.status==="delivered"?s.responseCount>0?`delivered · ${s.responseCount} chunks`:"delivered":s.failureReason??Tc[s.status].toLowerCase()}function Rc({conversation:s}){const[t,n]=x.useState(!1),[a,r]=x.useState(!1),[i,o]=x.useState(!1),[l,c]=x.useState(""),[d,u]=x.useState(!1),[m,h]=x.useState(!1),{data:p}=yr(),g=x.useMemo(()=>(p==null?void 0:p.agents)??[],[p]),{mutate:j}=zi(),{data:y=[]}=Sn(),b=_s(s),f=x.useMemo(()=>y.filter(k=>k.adapterId===b),[y,b]),S=vc(s.status),D=Nc(s.status),A=kc(s.status),T=x.useCallback(()=>{g.find(Q=>Q.id===l)&&(j({adapterId:_s(s),agentId:l,sessionStrategy:"per-chat",label:"",chatId:Bt(s),channelType:Kt(s)}),c(""),u(!1))},[g,l,s,j]),O=x.useCallback(()=>{u(!1),h(!0)},[]),N=x.useCallback(k=>{j({adapterId:k.adapterId,agentId:k.agentId,sessionStrategy:k.sessionStrategy,label:k.label,chatId:k.chatId,channelType:k.channelType,canInitiate:k.canInitiate,canReply:k.canReply,canReceive:k.canReceive}),h(!1)},[j]);return e.jsxs("div",{className:M("hover:bg-muted/50 w-full rounded-lg border border-l-2 text-left transition-colors hover:shadow-sm",A,t&&"bg-muted/30"),children:[e.jsxs("div",{className:"flex items-start gap-2 p-3",children:[e.jsxs("button",{type:"button",onClick:()=>n(!t),className:"flex min-w-0 flex-1 items-start gap-2",children:[e.jsx("span",{className:M("mt-1 size-2 shrink-0 rounded-full",S)}),e.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[e.jsxs("div",{className:"text-muted-foreground text-xs",children:[e.jsx("span",{className:"inline-block w-8 font-medium",children:"From"}),e.jsx("span",{className:"text-foreground",children:s.from.label})]}),e.jsxs("div",{className:"text-muted-foreground text-xs",children:[e.jsx("span",{className:"inline-block w-8 font-medium",children:"To"}),e.jsx("span",{className:"text-foreground",children:s.to.label})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[s.preview&&e.jsxs("span",{className:"text-muted-foreground min-w-0 flex-1 truncate text-xs",children:["“",s.preview,"”"]}),e.jsx("span",{className:M("shrink-0 text-xs",D),children:Oc(s)})]})]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[e.jsx("span",{className:"text-muted-foreground text-xs",children:Ie(s.sentAt)}),e.jsxs(br,{open:d,onOpenChange:u,children:[e.jsx(vr,{asChild:!0,children:e.jsxs(v,{variant:"ghost",size:"sm",className:"h-6 px-1.5 text-xs",onClick:k=>k.stopPropagation(),"aria-label":"Route to agent",children:[e.jsx(_i,{className:"mr-1 size-3"}),"Route"]})}),e.jsxs(Nr,{className:"w-64 space-y-3 p-3",align:"end",children:[e.jsx("p",{className:"text-xs font-medium",children:"Route to agent"}),f.length>0&&e.jsx("div",{className:"rounded border border-blue-200 bg-blue-50 px-2 py-1.5 text-xs dark:border-blue-900 dark:bg-blue-950",children:e.jsxs("p",{className:"font-medium text-blue-800 dark:text-blue-200",children:["Already goes to ",f.length," ",f.length===1?"agent":"agents"]})}),e.jsxs(ee,{value:l,onValueChange:c,children:[e.jsx(se,{responsive:!1,className:"h-8 text-xs",children:e.jsx(te,{placeholder:"Select agent"})}),e.jsx(ne,{children:g.map(k=>e.jsx(P,{value:k.id,children:kr(k)},k.id))})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(v,{variant:"link",size:"sm",className:"h-6 px-0 text-xs",onClick:O,children:"More options…"}),e.jsx(v,{size:"sm",className:"h-7 text-xs",disabled:!l,onClick:T,children:"Add connection"})]})]})]})]})]}),m&&e.jsx(Ui,{open:!0,onOpenChange:k=>{k||h(!1)},mode:"create",initialValues:{adapterId:_s(s),agentId:l||void 0,chatId:Bt(s),channelType:Kt(s)},onConfirm:N}),e.jsx(Re,{initial:!1,children:t&&e.jsx(ke.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"overflow-hidden",children:e.jsxs("div",{className:"space-y-3 border-t px-3 pt-3 pb-3",children:[s.payload!=null&&e.jsxs("div",{children:[e.jsx("span",{className:"text-muted-foreground text-xs font-medium",children:"Content"}),e.jsx("pre",{className:"bg-muted mt-1 max-h-40 overflow-auto rounded p-2 font-mono text-xs",children:JSON.stringify(s.payload,null,2)})]}),e.jsxs("div",{className:"text-muted-foreground text-xs",children:[e.jsxs("span",{children:["Sent ",qt(s.sentAt)]}),s.completedAt&&e.jsxs("span",{children:[" · Completed ",qt(s.completedAt)]}),s.durationMs!=null&&e.jsxs("span",{children:[" · Duration: ",Dc(s.durationMs)]}),s.responseCount>0&&e.jsxs("span",{children:[" · ",s.responseCount," reply parts"]})]}),s.failureReason&&e.jsx("div",{className:"bg-destructive/10 text-destructive rounded px-2 py-1 text-xs",children:s.failureReason}),e.jsxs("button",{type:"button",onClick:k=>{k.stopPropagation(),r(!a)},className:"text-muted-foreground hover:text-foreground flex items-center gap-1.5 text-xs",children:[a?e.jsx(Ue,{className:"size-3.5"}):e.jsx(as,{className:"size-3.5"}),"Technical details"]}),e.jsx(Re,{initial:!1,children:a&&e.jsx(ke.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},className:"overflow-hidden",children:e.jsxs("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 text-xs",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Subject"}),e.jsx("dd",{className:"truncate font-mono",children:s.subject}),s.sessionId&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Chat"}),e.jsx("dd",{className:"font-mono",children:s.sessionId.slice(0,8)})]}),s.traceId&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Trace ID"}),e.jsxs("dd",{className:"font-mono",children:[s.traceId.slice(0,12),"…"]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Source"}),e.jsx("dd",{className:"truncate font-mono",children:s.from.raw}),e.jsx("dt",{className:"text-muted-foreground",children:"Destination"}),e.jsx("dd",{className:"truncate font-mono",children:s.to.raw})]})})}),s.traceId&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:k=>{k.stopPropagation(),o(!i)},className:"text-muted-foreground hover:text-foreground flex items-center gap-1.5 text-xs",children:[i?e.jsx(Ue,{className:"size-3.5"}):e.jsx(as,{className:"size-3.5"}),"Trace timeline"]}),e.jsx(Re,{initial:!1,children:i&&e.jsx(ke.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15},className:"overflow-hidden",children:e.jsx(Ac,{messageId:s.traceId,onClose:()=>o(!1)})})})]})]})})})]})}const Ec={hop_limit:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",ttl_expired:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",cycle_detected:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",budget_exhausted:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"},Ic="bg-muted text-muted-foreground";function Lc(s,t){const n=Ie(s),a=Ie(t);return n===a?a:`${n} to ${a}`}function Pc({group:s}){const[t,n]=x.useState(!1),a=wr(),r=Bi[s.reason]??Ki,i=Ec[s.reason]??Ic;return e.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50/50 p-3 dark:border-red-900/40 dark:bg-red-950/20",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx($e,{className:"mt-0.5 size-4 shrink-0 text-red-500"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:s.source}),e.jsx(ae,{className:M("shrink-0 border-0 font-normal",i),children:r}),e.jsx(ae,{variant:"destructive",className:"shrink-0 tabular-nums",children:s.count.toLocaleString()})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:Lc(s.firstSeen,s.lastSeen)})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.sample!=null&&e.jsxs(e.Fragment,{children:[e.jsxs(v,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>n(!0),children:[e.jsx(Cr,{className:"mr-1 size-3"}),"See one"]}),e.jsx(tn,{open:t,onOpenChange:n,children:e.jsxs(nn,{className:"max-w-lg",children:[e.jsxs(an,{children:[e.jsx(rn,{children:"What was sent"}),e.jsxs(on,{children:["Never arrived: ",r,"."]})]}),e.jsx("pre",{className:"bg-muted max-h-80 overflow-auto rounded-md p-3 font-mono text-xs",children:JSON.stringify(s.sample,null,2)})]})})]}),e.jsxs(ye,{children:[e.jsx(ms,{asChild:!0,children:e.jsxs(v,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-7 px-2 text-xs",disabled:a.isPending,children:[e.jsx(ns,{className:"mr-1 size-3"}),"Clear these"]})}),e.jsxs(be,{children:[e.jsxs(me,{children:[e.jsx(xe,{children:"Clear these messages?"}),e.jsxs(he,{children:["Clears ",s.count," message",s.count!==1?"s":""," from"," ",e.jsx("span",{className:"font-medium",children:s.source})," (",r,"). They won’t be sent, and this can’t be undone."]})]}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(fe,{onClick:()=>a.mutate({source:s.source,reason:s.reason}),children:"Clear these"})]})]})]})]})]})})}function _c({enabled:s=!0}){const{data:t=[],isLoading:n}=yn(s),{data:a}=pt(),r=a==null?void 0:a.budgetRejections,i=r&&Object.values(r).some(o=>o>0);return n||t.length===0?null:e.jsxs("div",{className:"space-y-2",children:[i&&e.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 px-3 py-2 dark:border-amber-900 dark:bg-amber-950",children:e.jsxs("p",{className:"text-xs font-medium text-amber-800 dark:text-amber-200",children:["Not delivered: ",r.hopLimit," too many hand-offs,"," ",r.cycleDetected," loops, ",r.budgetExhausted," over limit,"," ",r.ttlExpired," expired"]})}),t.map(o=>e.jsx(Pc,{group:o},`${o.source}:${o.reason}`))]})}function $c({enabled:s}){const{data:t}=pt();if(!s||!t)return null;const n=[{label:"Total",value:t.totalMessages,variant:"default"},{label:"Delivered",value:t.deliveredCount,variant:"success"},{label:"Errors",value:t.failedCount,variant:t.failedCount>0?"danger":"default"},{label:"No listener",value:t.noSubscriberCount,variant:"default"},{label:"Never arrived",value:t.deadLetteredCount,variant:t.deadLetteredCount>0?"warning":"default"}];return e.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-2",children:[n.map(({label:a,value:r,variant:i})=>e.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:a}),e.jsx("span",{className:M("font-medium tabular-nums",i==="success"&&r>0&&"text-status-success-fg",i==="danger"&&"text-destructive",i==="warning"&&"text-status-warning-fg"),children:r.toLocaleString()})]},a)),t.avgDeliveryLatencyMs!=null&&e.jsxs("div",{className:"ml-auto flex items-center gap-1.5 text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Avg"}),e.jsx("span",{className:"font-medium tabular-nums",children:t.avgDeliveryLatencyMs<1e3?`${Math.round(t.avgDeliveryLatencyMs)}ms`:`${(t.avgDeliveryLatencyMs/1e3).toFixed(1)}s`})]})]})}function Fc(s){return s.startsWith("relay.agent.")?"chat":s.startsWith("relay.system.tasks.")?"tasks":"system"}const Mc={initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeOut"}},zc={initial:!1,animate:{opacity:1,y:0},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeOut"}};function Uc(s,t,n,a){return s.filter(r=>{if(t!=="all"&&Fc(r.subject)!==t||n!=="all"&&r.status!==n)return!1;if(a){const i=a.toLowerCase();if(!(r.from.label.toLowerCase().includes(i)||r.to.label.toLowerCase().includes(i)||r.preview.toLowerCase().includes(i)||r.subject.toLowerCase().includes(i)))return!1}return!0})}function Bc({enabled:s,deadLetterRef:t,onSwitchToIntegrations:n,autoShowFailures:a}){const[r,i]=x.useState("all"),[o,l]=x.useState("all"),[c,d]=x.useState(""),[u,m]=x.useState(null),{data:h,isLoading:p}=Mo(s),{data:g=[]}=yn(s),j=x.useMemo(()=>(h==null?void 0:h.conversations)??[],[h==null?void 0:h.conversations]);g.length>0;const y=x.useRef(null);x.useEffect(()=>{j.length>0&&y.current===null&&(y.current=new Set(j.map(O=>O.id)))},[j]);const b=u!==null&&(u.afterAutoShow||!a)?u:null,f=b!==null,S=b!==null?b.open:!!a||g.length>0,D=r!=="all"||o!=="all"||c!=="",A=Uc(j,r,o,c);function T(){i("all"),l("all"),d("")}return p?e.jsx("div",{className:"space-y-2 p-4",children:[1,2,3].map(O=>e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"bg-muted animate-breath size-4 rounded"}),e.jsx("div",{className:"bg-muted animate-breath h-4 w-40 rounded"}),e.jsx("div",{className:"bg-muted animate-breath ml-auto h-3 w-16 rounded"})]})},O))}):e.jsxs(e.Fragment,{children:[e.jsx($c,{enabled:s}),e.jsxs("div",{className:"flex flex-col gap-3 p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(ee,{value:r,onValueChange:O=>i(O),children:[e.jsx(se,{className:"w-32",children:e.jsx(te,{})}),e.jsxs(ne,{children:[e.jsx(P,{value:"all",children:"All sources"}),e.jsx(P,{value:"chat",children:"Chat messages"}),e.jsx(P,{value:"tasks",children:"Scheduled runs"}),e.jsx(P,{value:"system",children:"System"})]})]}),e.jsxs(ee,{value:o,onValueChange:O=>l(O),children:[e.jsx(se,{className:"w-32",children:e.jsx(te,{})}),e.jsxs(ne,{children:[e.jsx(P,{value:"all",children:"All statuses"}),e.jsx(P,{value:"delivered",children:"Delivered"}),e.jsx(P,{value:"failed",children:"Error"}),e.jsx(P,{value:"pending",children:"Pending"})]})]}),e.jsxs(v,{variant:S?"secondary":"ghost",size:"sm",className:"relative",onClick:()=>{m({open:!S,afterAutoShow:a??!1})},"aria-pressed":S,"aria-label":"Show messages that never arrived",children:[e.jsx($e,{className:"mr-1 size-3.5"}),"Never arrived",g.length>0&&!S&&f&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 size-2 rounded-full bg-red-500"})]}),e.jsx(re,{className:"h-9 w-44",placeholder:"Filter by agent or message…",value:c,onChange:O=>d(O.target.value),"aria-label":"Search chats"}),D&&e.jsx(v,{variant:"ghost",size:"sm",onClick:T,children:"Clear filters"}),e.jsx("div",{className:"ml-auto",children:e.jsx(qi,{})})]}),S&&e.jsx("div",{ref:t,children:e.jsx(_c,{enabled:s})}),A.length===0&&!D?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[e.jsx("div",{className:"pointer-events-none mb-2 w-full max-w-sm opacity-20 select-none",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"bg-muted size-4 rounded"}),e.jsx("div",{className:"bg-muted h-3 w-32 rounded"}),e.jsx("div",{className:"bg-muted ml-auto h-3 w-12 rounded"})]})}),e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"bg-muted size-4 rounded"}),e.jsx("div",{className:"bg-muted h-3 w-44 rounded"}),e.jsx("div",{className:"bg-muted ml-auto h-3 w-12 rounded"})]})}),e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"bg-muted size-4 rounded"}),e.jsx("div",{className:"bg-muted h-3 w-24 rounded"}),e.jsx("div",{className:"bg-muted ml-auto h-3 w-12 rounded"})]})})]})}),e.jsx(Sr,{className:"text-muted-foreground/50 size-10"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"No activity yet"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Messages between your agents show up here."})]})]}):A.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-12 text-center",children:[e.jsx(Ar,{className:"text-muted-foreground/50 size-10"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"No messages match your filters"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Try different filters."})]}),e.jsx(v,{variant:"ghost",size:"sm",onClick:T,children:"Clear filters"})]}):e.jsx("div",{className:"space-y-2",children:e.jsx(Re,{mode:"popLayout",children:A.map(O=>{const k=y.current!==null&&!y.current.has(O.id)?Mc:zc;return e.jsx(ke.div,{...k,children:e.jsx(Rc,{conversation:O})},O.id)})})})]})]})}const Wt={healthy:we.success,degraded:we.warning,critical:we.error};function Kc(s){return s==null?"—":s<1?"<1ms":`${Math.round(s)}ms`}function qc(s,t,n){const a=s.totalMessages>0?s.failedCount/s.totalMessages:0;if(n===0)return{state:"healthy",message:"No connections yet"};if(a>.5||t===0){const r=Math.round(a*100);return{state:"critical",message:`${s.failedCount} messages had errors today (${r}%)`}}if(t<n||a>=.05){const r=n-t;return r>0?{state:"degraded",message:`${r} connection${r>1?"s":""} disconnected`}:{state:"degraded",message:`${s.failedCount} error${s.failedCount!==1?"s":""} in the last day`}}return{state:"healthy",message:`${t} connection${t>1?"s":""} active`}}function Wc(s){const{data:t=[],isLoading:n}=Tn(s),a=t.flatMap(o=>o.instances),r=a.length,i=a.filter(o=>o.status.state==="connected").length;return{total:r,connected:i,isLoading:n}}function Yc({enabled:s=!0,onFailedClick:t}){const n=dt(),{data:a,isLoading:r}=pt(),{total:i,connected:o,isLoading:l}=Wc(s&&n);if(!n||!s||r||l||!a)return null;const{state:c,message:d}=qc(a,o,i),u=(c==="degraded"||c==="critical")&&t!=null,m=Kc(a.avgDeliveryLatencyMs),h=`${a.totalMessages} messages today · ${a.failedCount} errors · ${m} average delivery`;return e.jsx(Tr,{children:e.jsx("div",{className:"text-muted-foreground flex items-center gap-2 border-b px-3 py-1.5 text-xs",children:c==="healthy"?e.jsxs(Dr,{children:[e.jsx(Or,{asChild:!0,children:e.jsxs("span",{className:"flex min-w-0 flex-1 cursor-default items-center gap-1.5",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${Wt[c]}`,"aria-hidden":"true"}),e.jsx("span",{className:"truncate",children:d}),a.avgDeliveryLatencyMs!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",children:"·"}),e.jsx("span",{children:m})]})]})}),e.jsx(Rr,{side:"bottom",children:h})]}):e.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${Wt[c]}`,"aria-hidden":"true"}),u?e.jsx("button",{type:"button",onClick:t,className:"truncate text-left hover:underline","aria-label":`${d}. Show messages with problems`,children:d}):e.jsx("span",{className:"truncate",children:d})]})})})}function Hc(){const{data:s}=Dn();return s!=null&&s.newAgentRecordUnreadable?e.jsxs("div",{"data-testid":"permissions-record-unreadable",className:"text-muted-foreground rounded-md border px-3 py-2 text-sm",children:[e.jsx("p",{role:"status",children:"Some agents may do less than their own settings allow."}),e.jsxs(Ns,{className:"mt-1",children:[e.jsx("p",{children:"DorkOS couldn’t read its list of checked agents."}),e.jsx("p",{children:"Each agent gets the stricter of its own and everyone’s settings."}),e.jsx("p",{children:"It tries again when you add or remove an agent."})]})]}):null}const Gn="/sw.js",$s=["push","subscriptions"],Vc=["push","vapid-public-key"],ft="dorkos.push.device-id";function Gc(){var f,S;const s=W(),t=G(),[n,a]=x.useState(null),[r,i]=x.useState(Yt),o=Qc(),l=V({queryKey:[...Vc],queryFn:()=>s.getPushVapidPublicKey(),enabled:o==="available",staleTime:1/0}),c=V({queryKey:[...$s],queryFn:()=>s.listPushSubscriptions()}),d=Be({mutationFn:async D=>{const A=await Xc(D);return s.registerPushSubscription(A)},onSuccess:D=>{sd(D.subscription.id),i(D.subscription.id),t.invalidateQueries({queryKey:[...$s]})},meta:{suppressErrorToast:!0}}),u=Be({mutationFn:D=>s.deletePushSubscription(D),onSuccess:(D,A)=>{Yt()===A&&(Ht(),i(null),Jc()),t.invalidateQueries({queryKey:[...$s]})},meta:{suppressErrorToast:!0}}),m=(f=c.data)==null?void 0:f.subscriptions,h=m!==void 0&&r!==null&&!m.some(D=>D.id===r),p=h?null:r;x.useEffect(()=>{h&&Ht()},[h]);const g=((S=l.data)==null?void 0:S.key)??null,j=x.useCallback(async()=>{if(a(null),g===null){a("Couldn’t set up notifications on this computer. Try again later.");return}try{await d.mutateAsync(g)}catch(D){a(Zc(D))}},[d,g]),y=x.useCallback(async D=>{a(null);try{await u.mutateAsync(D)}catch{a("Couldn’t remove that device. Try again.")}},[u]);return{availability:o!=="available"?o:l.isSuccess&&g===null?"server-unavailable":"available",devices:m??[],devicesLoaded:c.isSuccess,localDeviceId:p,subscribe:j,remove:y,isPending:d.isPending||u.isPending,error:n}}function Qc(){return bn()?"desktop-shell":typeof window>"u"||typeof navigator>"u"||!("serviceWorker"in navigator)||!("PushManager"in window)?"unsupported":window.isSecureContext===!1?"insecure-context":"available"}async function Xc(s){var c,d;const t=await navigator.serviceWorker.register(Gn,{scope:"/"});await navigator.serviceWorker.ready;const n=await Notification.requestPermission();if(n!=="granted")throw new Qn(n);const i=(await t.pushManager.getSubscription()??await t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ed(s)})).toJSON(),o=(c=i.keys)==null?void 0:c.p256dh,l=(d=i.keys)==null?void 0:d.auth;if(typeof i.endpoint!="string"||!o||!l)throw new Error("This browser produced a subscription DorkOS cannot use.");return{endpoint:i.endpoint,keys:{p256dh:o,auth:l}}}async function Jc(){try{const s=await navigator.serviceWorker.getRegistration(Gn),t=await(s==null?void 0:s.pushManager.getSubscription());await(t==null?void 0:t.unsubscribe())}catch{}}class Qn extends Error{constructor(t){super(`Notification permission was ${t}`),this.permission=t,this.name="PushPermissionError"}}function Zc(s){return s instanceof Qn?s.permission==="denied"?"Your browser blocks notifications from DorkOS. Allow them in this site’s settings.":"Allow notifications so DorkOS can reach this device.":"Couldn’t set up this device for notifications. Try again."}function ed(s){const t=s.padEnd(s.length+(4-s.length%4)%4,"="),n=atob(t.replace(/-/g,"+").replace(/_/g,"/")),a=new Uint8Array(new ArrayBuffer(n.length));for(let r=0;r<n.length;r+=1)a[r]=n.charCodeAt(r);return a}function Yt(){try{return window.localStorage.getItem(ft)}catch{return null}}function sd(s){try{window.localStorage.setItem(ft,s)}catch{}}function Ht(){try{window.localStorage.removeItem(ft)}catch{}}const td=[{value:1,label:"1 min"},{value:2,label:"2 min"},{value:5,label:"5 min"},{value:15,label:"15 min"},{value:"never",label:"Never"}];function nd(s){return s==="never"?"never":Number(s)}function ad(){const{prefs:s,setPrefs:t,isPending:n}=Cn(),a=Gc(),r=Sn(),i=(r.data??[]).some(c=>c.enabled&&c.canInitiate),o=s.escalation.phoneAfterMinutes==="never",l=a.devicesLoaded&&r.isSuccess;return e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(L,{orientation:"vertical",label:"Reach you elsewhere after",description:"DorkOS pings your devices and chat apps. Answering one quiets the rest.",children:e.jsx(bs,{value:String(s.escalation.phoneAfterMinutes),onValueChange:c=>t({escalation:{phoneAfterMinutes:nd(c)}}),disabled:n,"aria-label":"Wait before reaching you elsewhere",children:td.map(c=>e.jsx(Pe,{value:String(c.value),children:c.label},String(c.value)))})}),l&&!o&&a.devices.length===0&&!i&&e.jsx("p",{className:"text-muted-foreground text-xs",role:"status",children:"Nothing can reach you yet. Add this device, or a chat app in Connections."}),e.jsx(L,{orientation:"vertical",label:"Devices DorkOS can reach",description:rd(a.availability),children:e.jsxs("div",{className:"w-full space-y-3",children:[a.devices.length>0&&e.jsx("ul",{className:"divide-border divide-y","aria-label":"Subscribed devices",children:a.devices.map(c=>e.jsxs("li",{className:"flex items-center justify-between gap-4 py-2 first:pt-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm",children:id(c,a.localDeviceId)}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Added ",Ie(c.createdAt)]})]}),e.jsx(v,{variant:"ghost",size:"sm",disabled:a.isPending,onClick:()=>void a.remove(c.id),children:"Remove"})]},c.id))}),a.availability==="available"&&a.localDeviceId===null&&e.jsx(v,{variant:"outline",size:"sm",disabled:a.isPending,onClick:()=>void a.subscribe(),children:"Add this device"}),a.error!==null&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:a.error})]})})]})})}function rd(s){switch(s){case"available":return"Added browsers get notified even when DorkOS is closed. Add your phone’s browser.";case"desktop-shell":return"The desktop app shows its own notifications. Add your phone’s browser instead.";case"unsupported":return"This browser can’t get notifications while DorkOS is closed. Other devices still work.";case"insecure-context":return"This needs a secure connection. Open DorkOS at localhost or over HTTPS.";case"server-unavailable":return"DorkOS couldn’t set up notifications on this computer. No device can be added now."}}function id(s,t){return s.id===t?"This device":s.service==="unknown"?"Another device":`Another device (${s.service})`}function od(){return e.jsx(oi,{})}function ld({onClick:s}){return e.jsx("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-foreground text-xs transition-colors duration-150",children:"Reset to defaults"})}function cd(){const{setTheme:s}=lt(),t=Ce(n=>n.resetAppearance);return e.jsx(ld,{onClick:()=>{t(),s("system")}})}function dd(){const{theme:s,setTheme:t}=lt(),{fontFamily:n,setFontFamily:a,fontSize:r,setFontSize:i}=Ce();return e.jsx("div",{className:"space-y-4",children:e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(L,{label:"Theme",children:e.jsxs(ee,{value:s,onValueChange:t,children:[e.jsx(se,{className:"w-32",children:e.jsx(te,{})}),e.jsxs(ne,{children:[e.jsx(P,{value:"light",children:"Light"}),e.jsx(P,{value:"dark",children:"Dark"}),e.jsx(P,{value:"system",children:"System"})]})]})}),e.jsx(L,{label:"Font family",children:e.jsxs(ee,{value:n,onValueChange:o=>a(o),children:[e.jsx(se,{className:"w-40",children:e.jsx(te,{})}),e.jsx(ne,{children:Er.map(o=>e.jsx(P,{value:o.key,children:e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"truncate",children:o.displayName}),e.jsx("span",{className:"text-muted-foreground truncate text-xs",children:o.description})]})},o.key))})]})}),e.jsx(L,{label:"Font size",children:e.jsxs(ee,{value:r,onValueChange:o=>i(o),children:[e.jsx(se,{className:"w-32",children:e.jsx(te,{})}),e.jsxs(ne,{children:[e.jsx(P,{value:"small",children:"Small"}),e.jsx(P,{value:"medium",children:"Medium"}),e.jsx(P,{value:"large",children:"Large"})]})]})})]})})})}function ud(){const{prefs:s,setPrefs:t,isPending:n}=Cn(),{permission:a,request:r}=Ci(),i=bn(),[o,l]=x.useState(!1);return e.jsxs("div",{className:"space-y-6",children:[e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(_,{label:"Knock when an agent needs you",description:"Plays when something waits on you.",checked:s.sounds.knock,onCheckedChange:c=>t({sounds:{knock:c}}),disabled:n}),e.jsx(_,{label:"Chime when everything is answered",description:"Plays when nothing is waiting.",checked:s.sounds.allClear,onCheckedChange:c=>t({sounds:{allClear:c}}),disabled:n}),e.jsx(_,{label:"Chime every time a turn finishes",description:"Every reply. Noisy with many agents.",checked:s.sounds.turnEnd,onCheckedChange:c=>t({sounds:{turnEnd:c}}),disabled:n})]})}),e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(L,{label:"Notifications from your browser",description:md(a,i),children:!i&&a==="default"&&e.jsx(v,{variant:"outline",size:"sm",onClick:()=>void r(),children:"Turn on"})}),e.jsx(_,{label:"Notify when work finishes while you’re away",description:"Anything waiting on you always gets through.",checked:s.notifyOnTurnCompleteWhileAway,onCheckedChange:c=>t({notifyOnTurnCompleteWhileAway:c}),disabled:n})]})}),e.jsx(ad,{}),e.jsx(vs,{open:o,onOpenChange:l,trigger:"Get these on your phone",children:e.jsxs("ol",{className:"text-muted-foreground list-decimal space-y-1.5 pl-4 text-xs",children:[e.jsx("li",{children:"Open DorkOS on your phone, at your Remote access address."}),e.jsx("li",{children:"Choose “Add to Home Screen”. iPhone needs this for notifications."}),e.jsx("li",{children:"Open Settings there and add it as a device above."})]})})]})}function md(s,t){return t?"The desktop app shows its own notifications.":s==="granted"?"Allowed, even while this tab is hidden.":s==="denied"?"Blocked. Change it in your browser’s settings for this site.":s==="unsupported"?"This browser cannot show notifications.":"Not turned on yet."}const xd=[{key:"maxAgentDepth",label:"Replies in a row",description:`Agents pause after this many replies in a row. Default: ${Je.maxAgentDepth}.`,details:["Your next message starts the count over.","Set it to 0 to stop automatic replies."],min:Te.maxAgentDepth.min,max:Te.maxAgentDepth.max},{key:"maxTurnsPerAgentPerCascade",label:"Replies from one agent",description:`Most turns one agent takes in one back-and-forth. Default: ${Je.maxTurnsPerAgentPerCascade}.`,details:["Progress notes an agent posts while it works don’t count extra."],min:Te.maxTurnsPerAgentPerCascade.min,max:Te.maxTurnsPerAgentPerCascade.max},{key:"maxAutomaticTurnsPerRoomPerHour",label:"Replies in one room each hour",description:`Most automatic replies one room runs in an hour. Default: ${Je.maxAutomaticTurnsPerRoomPerHour}.`,details:["It keeps one busy room from using up the whole allowance below."],min:Te.maxAutoTurnsPerHour.min,max:Te.maxAutoTurnsPerHour.max},{key:"maxAutomaticTurnsTotalPerHour",label:"Replies everywhere each hour",description:`Most automatic replies across all rooms in an hour. Default: ${Je.maxAutomaticTurnsTotalPerHour}.`,details:["This caps what automatic replies can cost you.","No room can set its own."],min:At.min,max:At.max}],Vt="Chats at once";function hd(){const{limits:s,unsupported:t,loadError:n,maxConcurrentTurnsPerAgent:a,setLimits:r}=Ir();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"How far agents reply to each other, and how many chats each runs."}),e.jsxs(Ns,{className:"text-xs",children:[e.jsx("p",{children:"Every message you send starts the reply counts over."}),e.jsx("p",{children:"A room can have limits of its own, in the panel beside it."})]})]}),s===null?e.jsx(R,{children:e.jsx(E,{children:n!==null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Couldn’t load these settings. Close Settings and open it again."}):t?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This version of DorkOS doesn’t have these settings. Update to change them."}):[0,1,2,3,4].map(i=>e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[e.jsx(X,{className:"h-4 w-40"}),e.jsx(X,{className:"h-3 w-full max-w-xs"})]}),e.jsx(X,{className:"h-9 w-24"})]},i))})}):e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(_,{label:"Limit automatic replies",description:s.turnLimitsEnabled?"Agents pause when they reach a limit below.":"Agents reply to each other without limit until you press Stop.",checked:s.turnLimitsEnabled,onCheckedChange:i=>r({turnLimitsEnabled:i})}),xd.map(i=>e.jsx(L,{orientation:"vertical",label:i.label,description:e.jsxs(e.Fragment,{children:[i.description," ",e.jsx(Ke,{label:`About ${i.label.toLowerCase()}`,children:i.details.map(o=>e.jsx("p",{children:o},o))})]}),children:e.jsx(os,{"aria-label":i.label,value:s[i.key],min:i.min,max:i.max,disabled:!s.turnLimitsEnabled,onCommit:o=>r({[i.key]:o})})},i.key))]})}),s!==null&&a!==null&&e.jsx(R,{children:e.jsx(E,{children:e.jsx(L,{orientation:"vertical",label:Vt,description:e.jsxs(e.Fragment,{children:[`How many chats one agent works in at once. Default: ${Lr}.`," ",e.jsx(Ke,{label:"About chats at once",children:e.jsx("p",{children:"Higher is faster, but turns that change the same files can collide."})})]}),children:e.jsx(os,{"aria-label":Vt,value:a,min:Tt.min,max:Tt.max,onCommit:i=>r({maxConcurrentTurnsPerAgent:i})})})})})]})}function pd(){const s=oe(),t=Pr(),n=_r(),a=dt();An(s.section);const r=()=>{s.close(),n()};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Access and chat app settings. Your apps are on the"," ",e.jsx(v,{variant:"link",className:"h-auto p-0 text-xs",onClick:r,children:"Connections page"}),"."]}),e.jsxs("section",{"data-section":"ways","aria-labelledby":"settings-connection-ways",className:"space-y-3",children:[e.jsx("h3",{id:"settings-connection-ways",className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"How DorkOS reaches your apps"}),e.jsx(Wo,{onManageAccount:()=>{t.onValueChange("account")},onOpenConnectionsPage:r})]}),e.jsxs("section",{"data-section":"chat-apps","aria-labelledby":"settings-chat-apps",className:"space-y-3",children:[e.jsx("h3",{id:"settings-chat-apps",className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Chat apps"}),e.jsx(Xo,{}),a&&e.jsxs(xs,{children:[e.jsx(hs,{className:"text-muted-foreground hover:text-foreground focus-ring rounded-md text-sm font-medium",children:"Message history"}),e.jsxs(ps,{className:"space-y-3 pt-3",children:[e.jsx(Yc,{enabled:!0}),e.jsx(Bc,{enabled:!0})]})]})]})]})}function gd(){const{data:s}=Dn(),t=Vn();return s?e.jsxs(e.Fragment,{children:[e.jsx(Vi,{files:s.filesAndCommands,preset:s.preset,onChange:n=>t.changeTrustStop(null,n),disabled:t.isPending,runtimeLabel:n=>le(n).label}),t.writeError?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:t.writeError}):null]}):null}function fd(){const s=vn(),{close:t}=oe();return e.jsxs("div",{className:"space-y-6",children:[e.jsx(Hc,{}),e.jsx(R,{children:e.jsx(E,{className:"@container space-y-2",children:e.jsx(Ni,{surface:"settings"})})}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"What agents may do"}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Allowed runs without asking. Ask waits for your yes. Blocked is refused."," ",Wi]}),e.jsx(R,{children:e.jsxs(E,{className:"divide-border divide-y",children:[e.jsx(gd,{}),e.jsx(Yi,{scope:{kind:"default"}})]})})]}),e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-semibold",children:"History"}),e.jsx(R,{children:e.jsx(E,{children:e.jsx(Hi,{})})})]}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:["Connected accounts have their own permissions, in"," ",e.jsx(v,{variant:"link",size:"sm",className:"h-auto p-0 text-sm",onClick:()=>{t(),s({...Nn.connections()})},children:"Connections"}),"."]})]})}function Xn(s,t){return(s==null?void 0:s.enabled)===!0&&s.runtimes[t]==="wired"}function jd(s,t){var n,a;return((a=(n=s==null?void 0:s.defaults)==null?void 0:n[t])==null?void 0:a.runsOn)==="credits"||Xn(s,t)}function yd(s,t,n){const a=t==="runtime"?`A change moves every ${s} chat, so it can't be made while ${s} is in the middle of a reply.`:`A change applies to new ${s} chats. One already going stays on what it started on.`;return n?`DorkOS chose credits when you linked, because ${s} had no sign-in. ${a}`:a}function bd({type:s,runsOn:t,chosenByDorkos:n,scope:a,caveat:r,canChooseCredits:i,pending:o,failure:l,onChange:c}){const d=ot(s);return e.jsxs("section",{className:"bg-muted/30 space-y-3 rounded-lg border p-3","data-testid":"credits-runs-on-section",children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Runs on"}),e.jsxs(bs,{"aria-label":`What ${d} runs on`,className:"w-full",value:t,disabled:o,onValueChange:u=>c(u),children:[e.jsx(Pe,{value:"own-sign-in",children:e.jsxs("span",{className:"truncate",children:["Your ",d," sign-in"]})}),e.jsx(Pe,{value:"credits",disabled:!i&&t!=="credits",children:e.jsx("span",{className:"truncate",children:gn})})]}),e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"credits-runs-on-note",children:t==="credits"&&!i?`${d} can’t run on credits now, so new work stops. Switch to your own sign-in.`:yd(d,a,n)}),r?e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"credits-runs-on-caveat",children:r}):null,l!==null&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:l})]})}function vd({type:s}){var l,c;const{data:t}=gs(),n=fs(),a=(l=$r(s))==null?void 0:l.credits,r=a==null?void 0:a.scope;if(!jd(t,s))return null;const i=(c=t==null?void 0:t.defaults)==null?void 0:c[s],o=(i==null?void 0:i.runsOn)==="credits"?"credits":"own-sign-in";return e.jsx(bd,{type:s,runsOn:o,chosenByDorkos:o==="credits"&&(i==null?void 0:i.chosenBy)==="default",scope:r,...a!=null&&a.caveat?{caveat:a.caveat}:{},canChooseCredits:Xn(t,s),pending:n.isPending,failure:n.isError?`Couldn’t change that. ${Ln(n.error)??"Try again in a moment."}`:null,onChange:d=>{d!==o&&n.mutate({runtime:s,useCredits:d==="credits"})}})}function Nd({type:s}){const{byId:t,byPath:n}=rt(s),a=t.get(Ne)??n.values().next().value;return Bn(a)?e.jsxs("section",{className:"bg-muted/30 space-y-3 rounded-lg border p-3","aria-label":`${le(s).label} usage`,children:[e.jsx("h3",{className:"text-muted-foreground text-xs font-semibold tracking-wide uppercase",children:"Usage"}),e.jsx(qn,{usage:a})]}):null}const Fs={"claude-accounts":()=>e.jsx(mc,{}),"credits-runs-on":({type:s})=>e.jsx(vd,{type:s}),"opencode-power-source":({type:s})=>e.jsx(gc,{type:s}),"runtime-usage":({type:s})=>e.jsx(Nd,{type:s})};function kd(s,t){var n;return((n=Fs[s])==null?void 0:n.call(Fs,t))??null}function wd(s){const t=W(),{data:n}=V({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference(),enabled:s}),a=(n==null?void 0:n.autoProtocol)??null,r=!s||n===void 0?null:n.inference!==null?"own":a!==null?"credits":"none",{data:i}=V({queryKey:["doe-credits-models",a],queryFn:()=>t.getDoeCreditsModels(a??"anthropic-messages"),enabled:r==="credits"});return{state:r,models:i==null?void 0:i.models.map(o=>({value:o.id,displayName:o.displayName,description:"",contextWindow:o.contextWindow,maxOutputTokens:o.maxOutputTokens,paidFromCredits:!0}))}}const Cd="a model chosen by DorkOS";function Sd(s){switch(s){case"credits":return{inheritLabel:no,description:"Which model new chats start on."};case"own":return{description:"Change it in the DorkOS setup."};case"none":return{inheritLabel:"None yet",description:"Connect AI to choose a model."};case null:return{}}}const Ad={login:{id:"reconnect",cancelLabel:"Keep current sign-in"},"provider-picker":{id:"change",cancelLabel:"Keep current source"}};function Td(s,t){return Kr(s)==="provider-picker"?t?{kind:"provider-picker",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:t}:null:qr.includes(s)?{kind:"login",connect:{kind:"login",label:`Reconnect ${ot(s)}`}}:null}function Dd(s){return s instanceof Error&&s.message||"Couldn’t save that. Try again."}function Od({type:s,isDefault:t,trustStop:n,globalStop:a,onChangeTrustStop:r,onMakeDefault:i}){var yt,bt,vt,Nt,kt;const{data:o}=Se(),{nameFor:l,resolvedAccount:c,inherited:d}=js();rt(Fr.includes(s)?s:null,{fetch:!0});const{data:u}=qe(),{data:m}=it(),{registered:h}=Mr(s),p=je(),g=G(),j=W(),[y,b]=x.useState(!1),[f,S]=x.useState(!1),[D,A]=x.useState(null),[T,O]=x.useState(!1),N=zr(m,s,h),k=N.state==="ready",Q=Xi(),q=wd(s==="doe"&&Q),$=q.state==="credits"&&k,F=le(s),K=On(u,s),C=(yt=o==null?void 0:o.executionDefaults)==null?void 0:yt.perRuntime.find(z=>z.runtime===s),U=(C==null?void 0:C.model)??null,I=m==null?void 0:m.runtimes[s],ce=Ur(m,s),{data:Ae}=V({...Br(j,{runtime:s}),enabled:k&&(y||U!==null)});function We(z){A(null),p.mutate({runtimes:z},{onSuccess:()=>{g.invalidateQueries({queryKey:H.all}),O(!0)},onError:Qe=>A(Dd(Qe))})}const Ye=K?K.configSection!==null:!0,J=K===void 0;function He(z){const Qe=K==null?void 0:K.configSection;Qe&&We({[Qe]:z})}const Cs=n??a,Ss={"claude-accounts":!(o==null?void 0:o.claudeCode)||d||!c?null:l(c),"opencode-power-source":I!=null&&I.provider?Rn(I.provider):null},Me=U?(Ae??[]).find(z=>z.value===U):void 0,Ve=ec({ready:k,settings:K,model:U,models:$?q.models:Ae,...$?{inheritModelLabel:Cd}:{},effort:C==null?void 0:C.effort,modelTakesEffort:Me?Me.supportsEffort??!1:void 0,trustStop:Cs,trustInherited:n===null,sectionValues:Ss}),w=I==null?void 0:I.dependencies.find(z=>z.status!=="satisfied"&&z.installHint),B=(w==null?void 0:w.installHint)??((bt=F.setup)==null?void 0:bt.installCommand),Y=(w==null?void 0:w.infoUrl)??((vt=F.setup)==null?void 0:vt.infoUrl),Z=!k&&N.connect?e.jsx("div",{"data-testid":`runtime-card-connect-${s}`,children:N.connect.kind==="install"?e.jsx(Rd,{type:s,label:N.connect.label,installCommand:B,installInfoUrl:Y}):Bs({type:s,connect:N.connect})}):null,de=k?Td(s,I==null?void 0:I.provider):null;!de&&f&&S(!1);const Ge=de?Ad[de.kind]:null,Jn=de&&Ge&&f?e.jsxs("div",{className:"space-y-2","data-testid":`runtime-${Ge.id}-panel-${s}`,children:[Bs({type:s,connect:de.connect,...de.currentProvider?{currentProvider:de.currentProvider}:{},onConnected:()=>S(!1)}),e.jsx("button",{type:"button",onClick:()=>S(!1),className:"focus-ring text-muted-foreground hover:text-foreground rounded-sm text-xs transition-colors","data-testid":`runtime-${Ge.id}-cancel-${s}`,children:Ge.cancelLabel})]}):null,Zn=I?I.dependencies.map(z=>e.jsx(Ed,{dep:z},z.name)):F.setup?e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not set up here. Install it, then turn on ",e.jsxs(Qi,{children:["runtimes.",s]})," in your DorkOS config."]}),e.jsx(mt,{command:F.setup.installCommand,infoUrl:F.setup.infoUrl,copyLabel:`Copy install command for ${F.label}`})]}):void 0,ve=I==null?void 0:I.dependencies.filter(z=>z.status!=="satisfied"),ea=I?e.jsx(ae,{variant:"secondary",className:M("text-xs",ve!=null&&ve.length?"text-status-warning-fg":""),children:ve!=null&&ve.length?`${ve.length} missing`:`${I.dependencies.length} ${I.dependencies.length===1?"check":"checks"}`}):void 0;return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Ql,{type:s,...F.subtitle?{subtitle:F.subtitle}:{},ready:k,isDefault:t,onMakeDefault:i,expanded:y,onToggleExpanded:()=>b(z=>!z),summary:Ve,...ce?{expiringSignIn:ce}:{},connectSlot:Z,...de&&!f?{reconnect:{kind:de.kind,onOpen:()=>S(!0)}}:{},reconnectPanel:Jn,model:{models:$?q.models:Ae,value:U,onChange:z=>He({defaultModel:z}),disabled:J||s==="doe"&&!$,...Sd(q.state==="credits"&&!k?"none":q.state)},effort:{supportsEffort:(K==null?void 0:K.supportsEffort)??!0,selectedModel:Me,configuredModelId:U,value:(C==null?void 0:C.effort)??null,onChange:z=>He({defaultEffort:z}),disabled:J},trust:{descriptors:((kt=(Nt=u==null?void 0:u.capabilities[s])==null?void 0:Nt.permissionModes)==null?void 0:kt.values)??[],stop:n,globalStop:a,onChange:r,disabled:J},storesDefaults:Ye,sections:K==null?void 0:K.sections,renderSection:z=>kd(z,{type:s}),setupDetails:Zn,setupBadge:ea}),T&&e.jsx("p",{className:"text-muted-foreground px-4 text-xs","data-testid":`runtime-card-timing-${s}`,children:"Applies to new chats only."}),D&&e.jsxs("p",{className:"text-destructive flex items-start gap-1.5 px-4 text-xs","data-testid":`runtime-card-error-${s}`,children:[e.jsx(ie,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:D})]})]})}function Rd({type:s,label:t,installCommand:n,installInfoUrl:a}){const r=le(s),i=kn(),{provision:o,isPending:l,isError:c,errorMessage:d,progress:u,result:m}=Ji(s);if(l||m!=null&&m.ok){const h=(u==null?void 0:u.message)??`Installing ${r.label}…`;return e.jsxs(ke.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:i?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(us,{size:"xs",className:M("text-muted-foreground shrink-0",i&&"animate-none")}),e.jsx(Re,{mode:"wait",children:e.jsx(ke.span,{className:"truncate text-xs",initial:i?!1:{opacity:0},animate:{opacity:1},exit:i?void 0:{opacity:0},transition:{duration:.2},children:h},h)})]})}return c?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:d}),n&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(mt,{command:n,infoUrl:a,copyLabel:`Copy install command for ${r.label}`})]}),e.jsx(v,{size:"sm",onClick:o,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(v,{size:"sm",onClick:o,children:t}),n&&e.jsx(Zi,{command:n,runtimeLabel:r.label})]})}function Ed({dep:s}){const t=s.status==="satisfied";return e.jsxs("div",{className:"space-y-2","data-testid":"runtime-setup-dependency",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[t?e.jsx(ze,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(ie,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:s.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:t&&s.version?`v${s.version}`:s.description})]}),!t&&(s.installHint||s.infoUrl)&&e.jsx(mt,{command:s.installHint,infoUrl:s.infoUrl,copyLabel:`Copy install command for ${s.name}`})]})}function Id(s){return s instanceof Error&&s.message||"Couldn’t save that. Try again."}function Ld(){var S,D,A;const s=it(),{data:t}=qe(),{data:n}=Se(),a=je(),r=G(),i=Vn(),o=kn(),[l,c]=x.useState(null),d=Gi(t?Object.keys(t.capabilities):[]),u=n==null?void 0:n.executionDefaults,m=(u==null?void 0:u.runtime)??"claude-code",h=(u==null?void 0:u.perRuntime)??[],p=(S=t==null?void 0:t.capabilities[m])==null?void 0:S.permissionModes,g=((A=(D=p==null?void 0:p.values)==null?void 0:D.find(T=>T.id===p.default))==null?void 0:A.stop)??"ask",j=(u==null?void 0:u.trustStop)??g;function y(T){c(null),a.mutate({runtimes:{default:T}},{onSuccess:()=>void r.invalidateQueries({queryKey:H.all}),onError:O=>c(Id(O))})}const b=h.map(T=>({runtime:T.runtime,label:le(T.runtime).label,stop:T.trustStop})),f=l??i.writeError;return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Runtimes are the AI tools that do the work."}),e.jsx("button",{type:"button",onClick:()=>void s.refetch(),disabled:s.isFetching,"aria-label":"Check runtimes again",title:"Check again",className:"focus-ring text-muted-foreground hover:text-foreground shrink-0 rounded-sm p-1 transition-colors disabled:opacity-50","data-testid":"runtimes-recheck",children:e.jsx(Zs,{className:M("size-3.5",s.isFetching&&!o&&"animate-spin")})})]}),e.jsx("div",{className:"space-y-3",children:d.map(T=>{var O;return e.jsx(Od,{type:T,isDefault:T===m,trustStop:((O=h.find(N=>N.runtime===T))==null?void 0:O.trustStop)??null,globalStop:j,onChangeTrustStop:N=>i.changeTrustStop(T,N),onMakeDefault:()=>y(T)},T)})}),f&&e.jsxs("p",{className:"text-destructive flex items-start gap-1.5 text-xs","data-testid":"runtimes-tab-error",children:[e.jsx(ie,{className:"mt-px size-3 shrink-0","aria-hidden":!0}),e.jsx("span",{children:f})]}),e.jsx(tc,{stop:(u==null?void 0:u.trustStop)??null,effectiveStop:g,runtimes:b,onChange:T=>i.changeTrustStop(null,T),onChangeRuntime:(T,O)=>i.changeTrustStop(T,O)}),e.jsx(jc,{})]})}const Pd=["fatal","error","warn","info","debug","trace"];function _d(){const s=W(),{data:t,isLoading:n,isError:a,error:r,refetch:i,isRefetching:o}=V({queryKey:H.current(),queryFn:()=>s.getConfig(),staleTime:3e4});return e.jsx("div",{className:"space-y-3",children:a&&!t?e.jsx(zd,{detail:r instanceof Error?r.message:null,onRetry:()=>void i(),isRetrying:o}):n?e.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((l,c)=>e.jsxs("div",{className:"flex items-center justify-between py-1",children:[e.jsx("div",{className:"bg-muted animate-breath h-4 w-24 rounded"}),e.jsx("div",{className:"bg-muted animate-breath h-4 w-16 rounded"})]},c))}):t?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[t.isDevMode?e.jsxs("div",{className:"-mx-1 rounded border border-amber-200 bg-amber-50 px-2 py-1.5 dark:border-amber-800 dark:bg-amber-950/30",children:[e.jsx("span",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Development build"}),e.jsx("p",{className:"mt-0.5 text-xs text-amber-700 dark:text-amber-300",children:"Running from source. Update checks are off."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Vs,{label:"Version",value:t.version}),t.latestVersion&&Si(t.latestVersion,t.version)&&e.jsxs("div",{className:"-mx-1 rounded border border-amber-200 bg-amber-50 px-2 py-1.5 dark:border-amber-800 dark:bg-amber-950/30",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("span",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:["Update available: v",t.latestVersion]})}),e.jsxs("p",{className:"mt-0.5 text-xs text-amber-700 dark:text-amber-300",children:["Run"," ",e.jsx("code",{className:"text-3xs rounded bg-amber-100 px-1 py-0.5 font-mono dark:bg-amber-900/50",children:"npm update -g dorkos"})," ","to update"]})]})]}),e.jsx(Ud,{port:t.port}),e.jsx(Vs,{label:"Uptime",value:Bd(t.uptime)})]}),e.jsx($d,{config:t}),e.jsx(Fd,{config:t})]}):null})}function $d({config:s}){const[t,n]=x.useState(!1),a=[{label:"Working folder",value:s.workingDirectory},{label:"Data folder",value:s.dorkHome},{label:"Boundary",value:s.boundary},{label:"Node.js",value:s.nodeVersion}];return e.jsx(vs,{open:t,onOpenChange:n,trigger:"Diagnostics",action:e.jsx(_e,{value:a.map(r=>`${r.label}: ${r.value}`).join(`
|
|
12
|
+
`),label:"Copy all diagnostics"}),children:e.jsx("div",{className:"space-y-1",children:a.map(r=>e.jsx(Vs,{label:r.label,value:r.value,mono:!0,truncate:!0},r.label))})})}function Fd({config:s}){const[t,n]=x.useState(!1),a=W(),r=G(),i=s.logging,o=x.useCallback(async l=>{const c=i??{level:"info",maxLogSizeKb:500,maxLogFiles:14};await a.updateConfig({logging:{...c,...l}}),await r.invalidateQueries({queryKey:H.all})},[a,r,i]);return i?e.jsxs(vs,{open:t,onOpenChange:n,trigger:"Logging",badge:e.jsx("span",{className:"text-muted-foreground text-xs",children:i.level}),children:[e.jsx(L,{label:"Log level",description:"How much detail DorkOS writes down.",children:e.jsxs(ee,{value:i.level,onValueChange:l=>o({level:l}),children:[e.jsx(se,{className:"w-28",children:e.jsx(te,{})}),e.jsx(ne,{children:Pd.map(l=>e.jsx(P,{value:l,children:l},l))})]})}),e.jsx(L,{label:"Biggest log file",description:"When DorkOS starts a new file.",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(re,{type:"number",min:100,max:10240,value:i.maxLogSizeKb,onChange:l=>{const c=parseInt(l.target.value,10);c>=100&&c<=10240&&o({maxLogSizeKb:c})},className:"w-24"}),e.jsx("span",{className:"text-muted-foreground text-xs",children:"KB"})]})}),e.jsx(L,{label:"Days of logs kept",description:"From 1 to 30, up to 200 MB in all.",children:e.jsx(re,{type:"number",min:1,max:30,value:i.maxLogFiles,onChange:l=>{const c=parseInt(l.target.value,10);c>=1&&c<=30&&o({maxLogFiles:c})},className:"w-20"})}),s.dorkHome&&e.jsx(Md,{dorkHome:s.dorkHome})]}):null}function Md({dorkHome:s}){const{copied:t,failed:n,copy:a}=tt(),r=`${s}/logs`;function i(){return t?e.jsx("span",{className:"text-xs",children:"Copied"}):n?e.jsx("span",{className:"text-destructive text-xs",children:"Couldn’t copy"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"max-w-40 truncate font-mono text-xs",dir:"rtl",title:r,children:e.jsx("bdi",{dir:"ltr",children:r})}),e.jsx(sn,{className:"size-3 shrink-0"})]})}return e.jsx(L,{label:"Log location",description:"Where DorkOS keeps these files.",children:e.jsx("button",{type:"button",onClick:()=>void a(r),className:"text-muted-foreground hover:text-foreground flex items-center gap-1.5 transition-colors",children:i()})})}function zd({detail:s,onRetry:t,isRetrying:n}){return e.jsxs("div",{className:"-mx-1 rounded border border-amber-200 bg-amber-50 px-2 py-1.5 dark:border-amber-800 dark:bg-amber-950/30",children:[e.jsx("span",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Can’t reach the DorkOS server"}),e.jsx("p",{className:"mt-0.5 text-xs text-amber-700 dark:text-amber-300",children:"It may be restarting. Try again shortly."}),s?e.jsx("p",{className:"text-3xs mt-1 font-mono break-words text-amber-700/80 dark:text-amber-300/80",children:s}):null,e.jsx(v,{variant:"outline",size:"sm",className:"mt-2",onClick:t,disabled:n,"aria-label":"Try reaching the server again",children:n?"Trying…":"Try again"})]})}function Ud({port:s}){const t=`http://localhost:${s}`;return e.jsxs("div",{className:"border-border/60 -mx-1 mt-3 mb-3 space-y-2 border-b px-1 pb-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Address"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Where DorkOS runs on this computer. Bookmark it or share it."})]}),e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-1.5 gap-y-2",children:[e.jsx(Gt,{url:t,label:"DorkOS address",children:e.jsx("button",{type:"button",onClick:()=>Wr(t),className:"text-muted-foreground hover:text-foreground focus-ring rounded-sm p-1 transition-colors","aria-label":"Open DorkOS in your browser",title:"Open in your browser",children:e.jsx(ys,{className:"size-3.5"})})}),e.jsx("p",{className:"text-muted-foreground col-span-2 text-xs",children:"For MCP clients like Claude Code or Cursor. Paste it, don’t visit it."}),e.jsx(Gt,{url:`${t}/mcp`,label:"MCP endpoint"})]})]})}function Gt({url:s,label:t,children:n}){return e.jsxs(e.Fragment,{children:[e.jsx("code",{className:"bg-muted min-w-0 truncate rounded-md px-3 py-2 font-mono text-xs",children:s}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(_e,{value:s,label:`Copy the ${t}`}),n]})]})}function Vs({label:s,value:t,mono:n,truncate:a,muted:r}){const{copied:i,failed:o,copy:l}=tt();function c(){return i?e.jsx("span",{className:"text-muted-foreground text-xs",children:"Copied"}):o?e.jsx("span",{className:"text-destructive text-xs",children:"Couldn’t copy"}):e.jsx("span",{className:M("text-right text-sm",n&&"font-mono",a&&"max-w-48 min-w-0 truncate",r&&"text-muted-foreground"),dir:a?"rtl":void 0,title:t,children:e.jsx("bdi",{dir:"ltr",children:t})})}return e.jsxs("button",{type:"button",onClick:()=>void l(t),className:"hover:bg-muted/50 active:bg-muted/70 -mx-1 flex w-full items-center justify-between gap-4 rounded px-1 py-1 transition-colors duration-100",children:[e.jsx("span",{className:"text-muted-foreground shrink-0 text-sm",children:s}),c()]})}function Bd(s){const t=Math.floor(s/3600),n=Math.floor(s%3600/60),a=Math.floor(s%60),r=[];return t>0&&r.push(`${t}h`),n>0&&r.push(`${n}m`),r.push(`${a}s`),r.join(" ")}function Kd({scheduler:s,onUpdate:t}){return e.jsxs(e.Fragment,{children:[e.jsx(L,{label:"Scheduled runs at once",description:"How many tasks can run at once.",children:e.jsx(re,{type:"number",min:1,max:10,value:s.maxConcurrentRuns,onChange:n=>{const a=parseInt(n.target.value,10);a>=1&&a<=10&&t({maxConcurrentRuns:a})},className:"w-20"})}),e.jsx(L,{label:"Run history",description:"How many finished runs to keep.",children:e.jsx(re,{type:"number",min:1,max:1e4,value:s.retentionCount,onChange:n=>{const a=parseInt(n.target.value,10);a>=1&&t({retentionCount:a})},className:"w-24"})})]})}function Qt(s){return s.lockedByEnv?s.running:s.enabledInConfig??s.running}function Xt(s,t,n){const a=qd(s,t);return a?`${n} ${a}`:n}function qd(s,t){if(s.lockedByEnv)return`${t} on this computer controls this switch.`;const n=s.enabledInConfig??s.running;return n&&!s.running&&s.initError?"It’s on, but didn’t start last time. Nothing is running.":n!==s.running?"Saved. Applies the next time DorkOS starts.":null}function Wd({tasks:s,relay:t,onTasksChange:n,onRelayChange:a}){return e.jsxs("div",{className:"space-y-4","data-testid":"background-systems",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"These run in the background. Turning one off also stops its tools."}),e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(_,{label:"Scheduled runs",description:Xt(s,"DORKOS_TASKS_ENABLED","Runs scheduled tasks when they’re due. Off means nothing runs on a schedule."),checked:Qt(s),onCheckedChange:n,disabled:s.lockedByEnv===!0}),e.jsx(_,{label:"Agent messaging",description:Xt(t,"DORKOS_RELAY_ENABLED","Carries messages between agents and chat apps. Off stops Telegram and Slack too."),checked:Qt(t),onCheckedChange:a,disabled:t.lockedByEnv===!0})]})})]})}function Yd(){return e.jsxs("div",{className:"flex gap-3 rounded-md border border-amber-500/20 bg-amber-500/10 p-3",children:[e.jsx($e,{className:"mt-0.5 size-4 shrink-0 text-amber-500"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium",children:"Not for agents that run inside DorkOS"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Those agents already have these tools. Adding them twice stops every tool call."}),e.jsxs(Ns,{className:"text-xs",children:[e.jsx("p",{children:"Claude rejects the repeated tool names with “Tool names must be unique”."}),e.jsx("p",{children:"This is for apps running on their own: Claude Code, Cursor, Windsurf."})]})]})]})}function Hd({endpoint:s}){return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:"Endpoint"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"The address to give other apps"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("code",{className:"bg-muted min-w-0 flex-1 truncate rounded-md px-3 py-2 font-mono text-xs",children:s}),e.jsx(_e,{value:s})]})]})}function Vd({rateLimit:s,onUpdate:t}){return e.jsxs("div",{className:"space-y-3",children:[e.jsx(_,{label:"Cap incoming requests",description:"Limits how often other apps can call DorkOS.",checked:s.enabled,onCheckedChange:n=>t({enabled:n}),ariaLabel:"Toggle rate limiting"}),s.enabled&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{htmlFor:"mcp-max-requests",className:"text-muted-foreground text-xs",children:"Max requests"}),e.jsx(re,{id:"mcp-max-requests",type:"number",min:1,max:1e3,value:s.maxPerWindow,onChange:n=>{const a=parseInt(n.target.value,10);a>=1&&a<=1e3&&t({maxPerWindow:a})},className:"w-20"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("label",{htmlFor:"mcp-window-secs",className:"text-muted-foreground text-xs",children:"Window (sec)"}),e.jsx(re,{id:"mcp-window-secs",type:"number",min:1,max:3600,value:s.windowSecs,onChange:n=>{const a=parseInt(n.target.value,10);a>=1&&a<=3600&&t({windowSecs:a})},className:"w-20"})]})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Changes apply after DorkOS restarts."})]})]})}function Gd(s,t){const n=t?`Bearer ${t}`:"Bearer dork_mcp_YOUR_API_KEY";return{claudeCode:JSON.stringify({mcpServers:{"dorkos-external":{type:"http",url:s,headers:{Authorization:n}}}},null,2),claudeCodeCli:`claude mcp add-json dorkos-external '${JSON.stringify({type:"http",url:s,headers:{Authorization:n}})}'`,cursor:JSON.stringify({mcpServers:{"dorkos-external":{url:s,headers:{Authorization:n}}}},null,2),windsurf:JSON.stringify({mcpServers:{"dorkos-external":{serverUrl:s,headers:{Authorization:n}}}},null,2)}}function Qd({endpoint:s,apiKey:t}){const[n,a]=x.useState(!1),[r,i]=x.useState("claude-code"),o=Gd(s,t),l=r==="claude-code"?o.claudeCode:r==="cursor"?o.cursor:o.windsurf;return e.jsxs(xs,{open:n,onOpenChange:a,children:[e.jsxs(hs,{className:"flex w-full items-center justify-between text-sm font-medium",children:[e.jsx("span",{children:"Setup instructions"}),e.jsx(Ue,{className:M("text-muted-foreground size-3.5 transition-transform duration-150",!n&&"-rotate-90")})]}),e.jsx(ps,{children:e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("div",{className:"bg-muted flex gap-0.5 rounded-md p-0.5",children:["claude-code","cursor","windsurf"].map(c=>e.jsx("button",{onClick:()=>i(c),className:M("flex-1 rounded-sm px-3 py-1.5 text-xs font-medium transition-colors",r===c?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:c==="claude-code"?"Claude Code":c==="cursor"?"Cursor":"Windsurf"},c))}),e.jsxs("div",{className:"relative",children:[e.jsx("pre",{className:"bg-muted overflow-x-auto rounded-md p-3 text-xs leading-relaxed",children:l}),e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(_e,{value:l})})]}),r==="claude-code"&&e.jsxs("div",{className:"relative",children:[e.jsx("p",{className:"text-muted-foreground mb-1 text-xs",children:"Or add it from the terminal:"}),e.jsx("pre",{className:"bg-muted overflow-x-auto rounded-md p-3 text-xs leading-relaxed",children:o.claudeCodeCli}),e.jsx("div",{className:"absolute right-2 bottom-2",children:e.jsx(_e,{value:o.claudeCodeCli})})]})]})})]})}function Xd({mcp:s,authEnabled:t}){const n=W(),a=G(),[r,i]=x.useState(!1),o=x.useCallback(()=>a.invalidateQueries({queryKey:H.all}),[a]),l=x.useCallback(async g=>{await n.updateConfig({mcp:{enabled:g,rateLimit:s.rateLimit}}),await o()},[n,s.rateLimit,o]),c=x.useCallback(async g=>{await n.updateConfig({mcp:{enabled:s.enabled,rateLimit:{...s.rateLimit,...g}}}),await o()},[n,s.enabled,s.rateLimit,o]),[d,u]=x.useState(null),m=x.useCallback(async()=>{const{localToken:g}=await n.revealMcpLocalToken();u(g)},[n]),h=x.useCallback(async()=>{const{localToken:g}=await n.rotateMcpLocalToken();u(g),await o()},[n,o]),p=s.enabled?s.authConfigured?e.jsx(ae,{variant:"outline",tone:"success",children:"Enabled"}):e.jsx(ae,{variant:"outline",tone:"warning",children:"Not protected"}):e.jsx(ae,{variant:"secondary",children:"Disabled"});return e.jsx(R,{children:e.jsxs(xs,{open:r,onOpenChange:i,children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:"Connect other apps to DorkOS"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Lets Claude Code, Cursor and others use DorkOS tools"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p,e.jsx(nt,{checked:s.enabled,onCheckedChange:l,"aria-label":"Toggle access for other apps"}),e.jsx(hs,{asChild:!0,children:e.jsx("button",{className:"text-muted-foreground hover:text-foreground rounded-sm p-0.5 transition-colors duration-150","aria-label":`${r?"Collapse":"Expand"} MCP server settings`,children:e.jsx(Ue,{className:M("size-3.5 transition-transform duration-150",!r&&"-rotate-90")})})})]})]}),e.jsx(ps,{children:e.jsxs(E,{className:"border-t",children:[e.jsx(Yd,{}),e.jsx(Jd,{}),e.jsx(Hd,{endpoint:s.endpoint}),e.jsx(Zd,{authSource:s.authSource,authEnabled:t,revealedToken:d,onReveal:m,onRotate:h}),e.jsx(Vd,{rateLimit:s.rateLimit,onUpdate:c}),e.jsx(Qd,{endpoint:s.endpoint,apiKey:d})]})})]})})}function Jd(){const s=vn(),{close:t}=oe();return e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["To give an agent another server’s tools, open its profile."," ",e.jsx(v,{variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>{t(),s({...Nn.team()})},children:"Open the Team page"})]})}function Zd({authSource:s,authEnabled:t,revealedToken:n,onReveal:a,onRotate:r}){return s==="env"?e.jsx(L,{label:"Authentication",description:"Protected by the MCP_API_KEY environment variable.",children:e.jsx(ae,{variant:"outline",children:"Environment variable"})}):s==="local-token"?e.jsx(eu,{revealedToken:n,onReveal:a,onRotate:r}):s==="none"&&!t?e.jsx(L,{label:"Authentication",description:"Couldn’t make a token for other apps. Restart DorkOS or turn on login.",children:e.jsx(ae,{variant:"outline",tone:"warning",children:"No key yet"})}):e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"text-muted-foreground size-3.5"}),e.jsx("p",{className:"text-sm font-medium",children:"Authentication"})]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Other apps sign in with a personal API key."}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Make one in Settings → Login & security. Send it as a"," ",e.jsx("code",{className:"font-mono",children:"Bearer"})," token."]})]})}function eu({revealedToken:s,onReveal:t,onRotate:n}){const[a,r]=x.useState(!1),[i,o]=x.useState(!1),[l,c]=x.useState(!1);async function d(){c(!0);try{await t()}catch(m){Le.error("Couldn’t show the token.",{description:m instanceof Error?m.message:"Try again in a moment."})}finally{c(!1)}}async function u(){o(!0);try{await n(),r(!1)}catch(m){Le.error("Couldn’t make a new token.",{description:m instanceof Error?m.message:"The old one still works."})}finally{o(!1)}}return e.jsxs("div",{className:"space-y-2",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(ws,{className:"text-muted-foreground size-3.5"}),e.jsx("p",{className:"text-sm font-medium",children:"Local MCP token"})]}),e.jsxs(ye,{open:a,onOpenChange:r,children:[e.jsx(ms,{asChild:!0,children:e.jsx(v,{variant:"outline",size:"sm",children:"Rotate"})}),e.jsxs(be,{children:[e.jsxs(me,{children:[e.jsx(xe,{children:"Rotate the local MCP token?"}),e.jsx(he,{children:"The old token stops working. Apps need the new one. This can’t be undone."})]}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(fe,{disabled:i,onClick:m=>{m.preventDefault(),u()},children:i?"Rotating…":"Rotate token"})]})]})]})]}),e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Paste it into your MCP client as a ",e.jsx("code",{className:"font-mono",children:"Bearer"})," token."]}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"It guards tools that change things. Read-only checks work without it."}),s?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("code",{className:"bg-muted min-w-0 flex-1 truncate rounded-md px-3 py-2 font-mono text-xs",children:s}),e.jsx(_e,{value:s})]}):e.jsx(v,{variant:"outline",size:"sm",onClick:d,disabled:l,children:l?"Revealing…":"Reveal token"})]})}function su(){var u,m,h,p,g,j,y;const s=dt(),t=Yr(),n=W(),a=G(),{section:r}=oe();An(r);const{data:i}=V({queryKey:H.current(),queryFn:()=>n.getConfig(),staleTime:3e4}),o=i==null?void 0:i.scheduler,l=x.useCallback(async b=>{const f=o??{maxConcurrentRuns:1,retentionCount:100};await n.updateConfig({scheduler:{...f,...b}}),await a.invalidateQueries({queryKey:H.all})},[n,a,o]),c=x.useCallback(async b=>{await n.updateConfig({scheduler:{enabled:b}}),await a.invalidateQueries({queryKey:H.all})},[n,a]),d=x.useCallback(async b=>{await n.updateConfig({relay:{enabled:b}}),await a.invalidateQueries({queryKey:H.all})},[n,a]);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(Wd,{tasks:{running:t,enabledInConfig:(u=i==null?void 0:i.tasks)==null?void 0:u.enabledInConfig,lockedByEnv:(m=i==null?void 0:i.tasks)==null?void 0:m.lockedByEnv,initError:(h=i==null?void 0:i.tasks)==null?void 0:h.initError},relay:{running:s,enabledInConfig:(p=i==null?void 0:i.relay)==null?void 0:p.enabledInConfig,lockedByEnv:(g=i==null?void 0:i.relay)==null?void 0:g.lockedByEnv,initError:(j=i==null?void 0:i.relay)==null?void 0:j.initError},onTasksChange:b=>void c(b),onRelayChange:b=>void d(b)}),o&&t&&e.jsx(R,{children:e.jsx(E,{children:e.jsx(Kd,{scheduler:o,onUpdate:l})})}),e.jsx(Fl,{}),(i==null?void 0:i.mcp)&&e.jsx("div",{"data-section":"external-mcp",children:e.jsx(Xd,{mcp:i.mcp,authEnabled:((y=i.auth)==null?void 0:y.enabled)===!0})})]})}function tu(){return e.jsxs(bo,{signedOut:e.jsx(nu,{}),children:[e.jsx(ki,{}),e.jsx(Ll,{})]})}function nu(){const{data:s}=gs(),t=el(s),n=at();return e.jsxs("div",{className:"space-y-2",children:[t.length>0?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm",children:"Link a DorkOS account to:"}),e.jsxs("ul",{className:"text-muted-foreground list-disc space-y-1 pl-5 text-sm",children:[e.jsxs("li",{children:["Use one account for ",t.join(" and "),": run"," ",t.length===1?"it":"them"," on your DorkOS credits."]}),e.jsx("li",{children:"See your plan, credits and seats here."})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Link a DorkOS account to see your plan, credits and seats here."}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Everything else works without one."})]}),e.jsx(wn,{withSpaces:n})]})}function au(){const s=Hr({open:!0}),t=Vr({machine:s});return e.jsx(Gr,{machine:s,actions:t})}function ru(){const{data:s}=Se(),t=je(),n=s==null?void 0:s.telemetry,a=(r,i)=>{t.mutate({telemetry:{[r]:i,userHasDecided:!0}})};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Nothing is shared unless a switch below is on."," ",e.jsx("a",{href:Qr("/telemetry"),target:"_blank",rel:"noopener noreferrer",className:"text-foreground underline underline-offset-2",children:"Read the full contract"}),"."]}),e.jsxs(Ns,{className:"text-xs",children:[e.jsx("p",{children:"The three count switches are anonymous. They never send prompts, code or file paths."}),e.jsx("p",{children:"The counts never send before the first-run notice."}),e.jsx("p",{children:"Crash reports and AI run data are separate. Both start off."})]})]}),e.jsx(R,{children:e.jsxs(E,{children:[e.jsx(_,{label:"Share anonymous install counts",description:"Counts marketplace installs, to rank packages and spot broken ones.",checked:(n==null?void 0:n.install)??!1,onCheckedChange:r=>a("install",r),disabled:t.isPending}),e.jsx(_,{label:"Share an anonymous daily heartbeat",description:"One anonymous ping a day, to count active installs. Exact payload below.",checked:(n==null?void 0:n.heartbeat)??!1,onCheckedChange:r=>a("heartbeat",r),disabled:t.isPending}),e.jsx(_,{label:"Share anonymous feature-usage events",description:"Counts events like app start and finished setup, plus any install tag.",checked:(n==null?void 0:n.usage)??!1,onCheckedChange:r=>a("usage",r),disabled:t.isPending}),e.jsx(_,{label:"Share AI run metadata",description:"Model, tokens, time and cost per turn. Never your prompts, code or chats.",checked:(n==null?void 0:n.aiMetadata)??!1,onCheckedChange:r=>a("aiMetadata",r),disabled:t.isPending}),e.jsx(_,{label:"Share crash reports",description:"A scrubbed report to dorkos.ai when something breaks. No error messages, paths or code.",checked:(n==null?void 0:n.errorReporting)??!1,onCheckedChange:r=>a("errorReporting",r),disabled:t.isPending})]})}),e.jsx(yo,{})]})}async function iu(s){const t=new Map;for(let n=0;n<localStorage.length;n++){const a=localStorage.key(n);if(a===null)continue;const r=localStorage.getItem(a);r!==null&&t.set(a,r)}localStorage.clear();try{return await s()}catch(n){for(const[a,r]of t)localStorage.setItem(a,r);throw n}}function ou({open:s,onOpenChange:t,onResetComplete:n}){const[a,r]=x.useState(""),[i,o]=x.useState(!1),l=W(),c=a==="reset";async function d(){o(!0);try{const m=$i();if(m)await iu(async()=>{Fi(await m.resetAllData())});else{const{token:h}=await l.prepareReset();await l.resetAllData("reset",h),localStorage.clear()}t(!1),n()}catch(m){Le.error("Couldn’t reset your data.",{description:m instanceof Error?m.message:"Some of it may already be gone. Try again."})}finally{o(!1)}}function u(m){m||(r(""),o(!1)),t(m)}return e.jsx(ye,{open:s,onOpenChange:u,children:e.jsxs(be,{children:[e.jsxs(me,{children:[e.jsx(xe,{children:"Reset all data?"}),e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{children:"This deletes all DorkOS data for good, including:"}),e.jsxs("ul",{className:"list-inside list-disc space-y-1 text-sm",children:[e.jsx("li",{children:"Scheduled tasks and their run history"}),e.jsx("li",{children:"Agent messaging setup and messages"}),e.jsx("li",{children:"DorkOS’s list of your agents"}),e.jsx("li",{children:"Your config file and preferences"}),e.jsx("li",{children:"Server logs"})]}),e.jsx("p",{children:"DorkOS restarts on its own. This device’s preferences are cleared too."}),e.jsx("p",{className:"font-semibold",children:"This can’t be undone."})]})})]}),e.jsx("div",{className:"py-2",children:e.jsx(re,{placeholder:"Type “reset” to continue",value:a,onChange:m=>r(m.target.value),"data-testid":"reset-confirm-input"})}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(fe,{disabled:!c||i,onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 dark:bg-destructive/60",children:i?"Resetting…":"Reset all data"})]})]})})}function lu({open:s,onOpenChange:t}){const n=Ce(i=>i.resetAllSettings),{setTheme:a}=lt();function r(){n(),a("system"),t(!1),Le.success("Settings are back to defaults")}return e.jsx(ye,{open:s,onOpenChange:t,children:e.jsxs(be,{children:[e.jsxs(me,{children:[e.jsx(xe,{children:"Reset all settings?"}),e.jsx(he,{asChild:!0,children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{children:"Theme, text, toggles and layouts on this device go back to default."}),e.jsx("p",{children:"Nothing you made is deleted. Your projects, agents and chats stay."})]})})]}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(fe,{onClick:r,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90 dark:bg-destructive/60",children:"Reset settings"})]})]})})}function cu({open:s,onOpenChange:t,onRestartComplete:n}){const[a,r]=x.useState(!1),i=W();async function o(){r(!0);try{await Mi(i),t(!1),n()}catch(l){Le.error("Couldn’t restart DorkOS.",{description:l instanceof Error?l.message:"It may not have restarted. Try again."})}finally{r(!1)}}return e.jsx(ye,{open:s,onOpenChange:t,children:e.jsxs(be,{children:[e.jsxs(me,{children:[e.jsx(xe,{children:"Restart DorkOS?"}),e.jsx(he,{children:"Anything running right now stops. DorkOS is back in seconds."})]}),e.jsxs(pe,{children:[e.jsx(ge,{children:"Cancel"}),e.jsx(fe,{disabled:a,onClick:o,children:a?"Restarting…":"Restart DorkOS"})]})]})})}function du(){const[s,t]=x.useState(!1),[n,a]=x.useState(!1),[r,i]=x.useState(!1),o=Ce(l=>l.setRestartOverlayOpen);return e.jsxs("div",{className:"space-y-4",children:[e.jsx(R,{className:"border-destructive/50",children:e.jsxs(E,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:"Reset all settings"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Theme, text, toggles and layouts on this device go back to default."}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Your projects, agents and chats stay."})]}),e.jsx(v,{variant:"destructive",size:"sm",onClick:()=>a(!0),children:"Reset settings"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:"Reset all data"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Deletes everything DorkOS saved, then restarts it. Can’t be undone."})]}),e.jsx(v,{variant:"destructive",size:"sm",onClick:()=>t(!0),children:"Reset data"})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:"Restart DorkOS"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Anything running right now stops."})]}),e.jsx(v,{variant:"destructive",size:"sm",onClick:()=>i(!0),children:"Restart"})]})]})}),e.jsx(lu,{open:n,onOpenChange:a}),e.jsx(ou,{open:s,onOpenChange:t,onResetComplete:()=>o(!0)}),e.jsx(cu,{open:r,onOpenChange:i,onRestartComplete:()=>o(!0)})]})}function uu(s,t){return s.split(".").reduceRight((a,r)=>({[r]:a}),t)}function mu(s,t,n){const a=[s];return t!==void 0&&a.push(t),n!==void 0&&a.push(`${n} on this computer controls this switch.`),a.join(" ")}function xu(){const{data:s,isLoading:t}=Se(),n=je(),a=Ce(o=>o.devtoolsOpen),r=Ce(o=>o.toggleDevtools),i=(s==null?void 0:s.experiments)??[];return e.jsxs("div",{className:"space-y-6","data-testid":"experiments-tab",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Unfinished features you can try early."}),e.jsx(R,{children:e.jsx(E,{children:e.jsx(_,{label:"Show dev tools",description:"Opens a panel showing what the app has loaded.",checked:a,onCheckedChange:()=>r()})})}),t?null:i.length===0?e.jsx("p",{className:"text-muted-foreground text-sm","data-testid":"experiments-empty",children:"No experiments right now. New ones show up here."}):e.jsx(R,{children:e.jsx(E,{children:i.map(o=>e.jsx(_,{label:o.title,description:mu(o.description,o.costNote,o.envOverride),checked:o.enabled,onCheckedChange:l=>n.mutate(uu(o.key,l)),disabled:o.lockedByEnv},o.key))})}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"These start off. Each one graduates or goes away."})]})}const hu={group:Jr,storageKey:Xr.SETTINGS_ADVANCED_OPEN},pu={profile:{icon:ii,component:od},account:{icon:uo,component:tu},appearance:{icon:xo,component:dd,actions:e.jsx(cd,{})},preferences:{icon:ho,component:$l},notifications:{icon:ri,component:ud},runtimes:{icon:co,component:Ld},permissions:{icon:ws,component:fd},connections:{icon:ai,component:pd},security:{icon:lo,component:Po},"remote-access":{icon:ni,component:au},privacy:{icon:ti,component:ru},server:{icon:oo,component:_d},tools:{icon:wi,component:su},rooms:{icon:si,component:hd},experiments:{icon:ei,component:xu},danger:{icon:$e,component:du}},gu=Zr.map(s=>({id:s.id,label:s.label,group:s.group,...pu[s.id]}));function im({open:s,onOpenChange:t}){const{activeTab:n}=oe();return e.jsx(go,{open:s,onOpenChange:t,title:"Settings",description:"Application settings",defaultTab:"appearance",initialTab:n,tabs:gu,extensionSlot:"settings.tabs",maximized:!0,foldedGroup:hu,testId:"settings-dialog"})}export{im as SettingsDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a8 as b,a9 as z,h2 as p,h3 as g,aa as w,ab as A,ae as M,aw as I,j as e,r as d,$ as O,Q as N,B as j,a7 as q,dP as y,fY as K,fZ as Q,f_ as W,f$ as U,g0 as Y,g1 as G,g2 as J,g3 as Z,h as H,l as E,e1 as V,a6 as X,e as D,e3 as ee,h4 as se,gy as R,a5 as L}from"./index-CdKpQ1hI.js";import{B as P}from"./banner-rPsz3suJ.js";import{I as C}from"./inline-code-Cvn43Gqu.js";import{P as _}from"./package-D2eMoFCI.js";function $(s){const t=b();return z({queryKey:p.status(s),queryFn:()=>t.getHarnessStatus(s),staleTime:3e4,refetchOnMount:"always"})}const te={native:"reads it",projected:"shared",drifted:"out of date",dropped:"can’t see it",warned:"may not work",conflict:"blocked","pending-approval":"needs your OK"},ne={native:"neutral",projected:"neutral",drifted:"info",dropped:"muted",warned:"warning",conflict:"warning","pending-approval":"warning"},k="\0",ae=new Set(["native","projected"]);function T(s){return`${s.scope??"project"}${k}${s.artifact}${k}${s.source??""}${k}${s.name}`}function re(s,t){return`${g[s]} ${te[t]}`}function le(s){return s.reason??s.target}function B(s,t){return t.flatMap(n=>{const a=s.cells[n];return a===void 0?[]:[{harness:n,cell:a}]})}function ie(s,t){if(t.length===0)return!1;const n=B(s,t);return n.length===t.length&&n.every(({cell:a})=>{var r;return ae.has(a.state)&&!((r=a.warnings)!=null&&r.length)})}function S(s){return`${s} ${s===1?"file":"files"}`}function oe(s){return s===1?"One package is waiting for your approval.":`${s} packages are waiting for your approval.`}function ce(s){return`Shared with all ${s}`}function de(s){return s===1?"1 agent file":`${s} agent files`}function ue(s){return`Agent files ${s} can’t see: skills, rules, commands and more.`}function xe(s){return s===1?"1 entry":`${s} entries`}function fe(s,t){return t.flatMap(n=>{const a=s.flatMap(r=>{const l=r.cells[n];return l===void 0||l.state!=="dropped"?[]:[{key:T(r),artifact:r.artifact,name:r.name,...l.reason===void 0?{}:{reason:l.reason}}]});return a.length===0?[]:[{harness:n,label:g[n],entries:a}]})}const me={drop:"Not shared",warning:"Couldn’t read",write:"Will be written",notice:"Notice"};function he(s){return`${me[s.kind]} · ${s.artifact} ${s.name}`}function pe(s){const t=b(),n=w();return A({mutationFn:()=>t.syncHarness(s),meta:{errorLabel:"Couldn’t share your agent files"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),M.success("Agent files updated.")}})}function ge(s){const t=w();I("approval_resolved",()=>{t.invalidateQueries({queryKey:p.status(s)})})}function je({result:s,onDismiss:t}){const{applied:n,removals:a,askedAbout:r}=s;return e.jsx(P,{variant:"neutral",onDismiss:t,dismissLabel:"Dismiss what changed","data-slot":"harness-sync-summary",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("p",{children:[e.jsx("span",{className:"font-medium",children:"Agent files updated."}),n>0&&e.jsxs(e.Fragment,{children:[" ",S(n)," written."]})]}),a.length>0&&e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsxs("p",{className:"font-medium",children:["Removed ",S(a.length)," DorkOS put here:"]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:a.map(({path:l,reason:c})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:l}),e.jsx("span",{className:"opacity-80",children:c})]},l))})]}),r.length>0&&e.jsx("p",{children:oe(r.length)})]})})}function ve(s){const{counts:t,sweepPreview:n}=s;return t.drifted>0||n.length>0?{message:"Some agent files are out of date.",variant:n.length>0?"warning":"info",actionable:!0}:t.conflicts>0?{message:"DorkOS can’t update some files. Something blocks them.",variant:"warning",actionable:!1}:t.adoptable>0?{message:"Some skills only reach a few of your agents.",variant:"info",actionable:!1}:null}function Ne({projectPath:s}){return ge(s),null}function ye({projectPath:s}){const{data:t}=$(s),n=pe(s),[a,r]=d.useState(!1),[l,c]=d.useState(!1);if(t===void 0||t.state!=="ready")return null;const u=e.jsx(Ne,{projectPath:s});if(n.data!==void 0&&!l)return e.jsxs(e.Fragment,{children:[u,e.jsx(je,{result:n.data,onDismiss:()=>c(!0)})]});const o=ve(t);if(o===null)return u;const{removals:x,sweepPreview:m}=t,i=m.length;return e.jsxs(e.Fragment,{children:[u,e.jsx(P,{variant:o.variant,"data-slot":"harness-drift-banner",detailsOpen:a,details:i===0?void 0:e.jsx("ul",{className:"flex flex-col gap-0.5",children:x.map(({path:f,reason:v})=>e.jsxs("li",{className:"text-3xs flex flex-col",children:[e.jsx("code",{className:"font-mono",children:f}),e.jsx("span",{className:"opacity-80",children:v})]},f))}),actions:o.actionable?e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:n.isPending,onClick:()=>{c(!1),n.mutate()},children:n.isPending?"Syncing…":"Sync now"}):void 0,children:e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("p",{children:o.message}),i>0&&e.jsxs("button",{type:"button","aria-expanded":a,onClick:()=>r(f=>!f),className:"text-3xs flex w-fit items-center gap-1 underline underline-offset-2 opacity-90 hover:opacity-100",children:["Syncing also removes ",S(i)," DorkOS put here",e.jsx(O,{"aria-hidden":!0,className:N("size-3 transition-transform",a&&"rotate-180")})]})]})})]})}function ke(s){const t=b(),n=w();return A({mutationFn:a=>t.adoptHarness(s,a),meta:{errorLabel:"Couldn’t move that skill"},onSuccess:a=>{n.setQueryData(p.status(s),a.status),n.setQueriesData({queryKey:p.all,predicate:r=>{var l;return((l=r.state.data)==null?void 0:l.projectPath)===a.status.projectPath}},a.status)}})}const Se={neutral:y.neutral,info:y.info,warning:y.warning,muted:"border border-dashed border-border text-muted-foreground"};function be({harness:s,cell:t}){var l;const n=re(s,t.state),a=le(t),r=(l=t.warnings)!=null&&l.length?t.warnings.join(" · "):void 0;return e.jsxs("li",{"aria-label":n,...a===void 0?{}:{title:a},className:N("text-3xs inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight",Se[ne[t.state]]),children:[n,r!==void 0&&e.jsx("span",{role:"img","aria-label":"May not work",title:r,className:"inline-flex",children:e.jsx(q,{"aria-hidden":!0,className:"text-status-warning-fg size-2.5"})})]})}function we(s){const t=s===void 0?-1:s.lastIndexOf("/"),n=t>0?s==null?void 0:s.slice(0,t):void 0;return n===void 0?"Only some agents can see it. Move it to .agents/skills to share it.":`Lives in ${n}. Move it to .agents/skills to share it.`}function Ce(s,t){return`dorkos harness adopt ${s} --project ${t}`}const $e="Share with every agent";function De(s,t,n){const a=`It moves from ${t} to .agents/skills/${s}`;return n?`${a}. A link stays behind for Claude Code.`:`${a}, where every agent reads it.`}const Ae="for all your projects";function Oe({row:s,enabled:t,projectPath:n,showEveryHarness:a}){var v;const[r,l]=d.useState(!1),[c,u]=d.useState(!1),o=ke(n),x=B(s,t),m=ie(s,t)&&!a,i=m&&!r,f=(v=o.data)==null?void 0:v.refusals[0];return e.jsxs("div",{role:"group","aria-label":s.name,className:"flex flex-col gap-1 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"min-w-0 shrink truncate text-xs font-medium",children:s.name}),s.scope==="global"&&e.jsx("span",{className:"text-muted-foreground text-3xs shrink-0",children:Ae}),s.source!==void 0&&e.jsx("span",{dir:"rtl",title:s.source,className:"text-muted-foreground text-3xs ml-auto min-w-0 truncate text-left font-mono",children:e.jsx("bdi",{dir:"ltr",children:s.source})})]}),e.jsxs("ul",{"aria-label":"Agent tools",className:"flex flex-wrap items-center gap-1",children:[m&&e.jsx("li",{children:e.jsxs("button",{type:"button","aria-expanded":!i,title:x.map(({harness:h})=>g[h]).join(" · "),onClick:()=>l(h=>!h),className:"bg-muted text-muted-foreground hover:bg-accent hover:text-accent-foreground text-3xs focus-visible:ring-ring inline-flex items-center gap-1 rounded-full px-2 py-0.5 leading-tight transition-colors focus-visible:ring-2 focus-visible:outline-none",children:[ce(x.length),e.jsx(O,{"aria-hidden":!0,className:N("size-2.5 transition-transform",i&&"-rotate-90")})]})}),!i&&x.map(({harness:h,cell:F})=>e.jsx(be,{harness:h,cell:F},h))]}),s.adoptable&&e.jsxs(e.Fragment,{children:[e.jsx("p",{role:"status","aria-live":"polite",className:"text-muted-foreground text-3xs",children:(f==null?void 0:f.reason)||we(s.source)}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run: ",e.jsx(C,{children:Ce(s.name,n)})]}),e.jsx("div",{children:e.jsx(j,{size:"sm",variant:"outline",className:"h-6 text-xs",disabled:o.isPending,onClick:()=>u(!0),children:$e})}),e.jsx(K,{open:c,onOpenChange:u,children:e.jsxs(Q,{children:[e.jsxs(W,{children:[e.jsxs(U,{children:["Move ",s.name," so every agent can read it?"]}),e.jsx(Y,{children:De(s.name,s.source??"",t.includes("claude-code"))})]}),e.jsxs(G,{children:[e.jsx(J,{children:"Cancel"}),e.jsx(Z,{onClick:()=>o.mutate(s.name),children:"Move it"})]})]})})]})]})}const He=se("/guides/cli-usage#agent-files");function Ee(){return e.jsxs(e.Fragment,{children:[e.jsx("span",{role:"status",className:"sr-only",children:"Loading skills…"}),e.jsx("div",{"aria-hidden":!0,className:"flex flex-col gap-3 py-1",children:[0,1,2].map(s=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(D,{className:"h-3 w-32"}),e.jsx(D,{className:"h-3 w-48"})]},s))})]})}function Re({projectPath:s,showBrowseLink:t=!0}){const{data:n,isPending:a,error:r,refetch:l}=$(s),[c,u]=d.useState(!1),o=d.useId(),x=H();if(a)return e.jsx(Ee,{});if(r)return e.jsxs("div",{className:"flex items-center gap-2 py-2",children:[e.jsx("p",{className:"text-destructive text-xs",children:"Couldn’t load skills."}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-6 text-xs",onClick:()=>void l(),children:"Retry"})]});if(n.state!=="ready")return e.jsx(Le,{status:n});const m=n.rows.filter(i=>i.artifact==="skill");return m.length===0?e.jsxs("div",{className:"flex flex-col items-start gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"No skills here yet."}),t&&x&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground h-6 px-1 text-xs",onClick:()=>void x({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]}):e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 pb-1",children:[e.jsx(V,{htmlFor:o,className:"text-muted-foreground text-3xs",children:"Show every agent tool"}),e.jsx(X,{id:o,size:"sm",checked:c,onCheckedChange:u})]}),e.jsx("div",{className:"divide-border divide-y",children:m.map(i=>e.jsx(Oe,{row:i,enabled:n.enabled,projectPath:n.projectPath,showEveryHarness:c},T(i)))})]})}function Le({status:s}){return s.state==="not-set-up"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS isn’t sharing agent files for this folder yet."}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(C,{children:"dorkos harness sync --fix"})," in this folder to set it up."]}),e.jsx(ee,{href:He,className:"text-3xs text-muted-foreground hover:text-foreground underline underline-offset-2",children:"How agent file sharing works"})]}):s.state==="unreadable"?e.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"DorkOS can’t read this folder’s agent file settings."}),s.detail!==void 0&&e.jsx("p",{className:"text-muted-foreground text-3xs",children:s.detail})]}):e.jsx("p",{className:"text-muted-foreground py-2 text-xs",children:"Agent file sharing runs in the DorkOS app."})}function Pe({group:s}){const[t,n]=d.useState(!1);return e.jsxs(R,{open:t,onOpenChange:n,trigger:e.jsxs("span",{className:"text-xs",children:["Not shared with ",s.label]}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:de(s.entries.length)}),children:[e.jsx("p",{className:"text-muted-foreground text-3xs px-4 pt-3",children:ue(s.label)}),e.jsx("ul",{className:"space-y-2 px-4 pt-2 pb-3",children:s.entries.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsxs("span",{className:"text-3xs font-medium",children:[a.artifact," ",a.name]}),a.reason!==void 0&&e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},a.key))})]})}function _e({rows:s,enabled:t}){const n=fe(s,t);return n.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5",children:n.map(a=>e.jsx(Pe,{group:a},a.harness))})}function Te({entries:s}){const[t,n]=d.useState(!1);return s.length===0?null:e.jsx(R,{open:t,onOpenChange:n,trigger:e.jsx("span",{className:"text-xs",children:"Project-level notices"}),badge:e.jsx(L,{variant:"secondary",size:"xs",className:"whitespace-nowrap",children:xe(s.length)}),children:e.jsx("ul",{className:"space-y-2 px-4 pb-3",children:s.map(a=>e.jsxs("li",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:N("text-3xs font-medium",a.kind==="notice"&&"text-muted-foreground font-normal"),children:he(a)}),e.jsx("span",{className:"text-muted-foreground text-3xs",children:a.reason})]},`${a.kind} ${a.artifact} ${a.source??""} ${a.name}`))})})}function Be({command:s}){return e.jsx(C,{className:"break-normal",children:s.split(" ").map((t,n)=>e.jsxs(d.Fragment,{children:[n>0&&" ",e.jsx("span",{className:"whitespace-nowrap",children:t})]},`${n}-${t}`))})}function Fe({notEnabled:s}){return s.length===0?null:e.jsx("div",{className:"flex flex-col gap-1.5 py-1",children:s.map(({harness:t,why:n,signal:a})=>e.jsxs("div",{title:a,className:"flex flex-col gap-0.5",children:[e.jsx("p",{className:"text-xs font-medium",children:n==="dorkos-runtime"?`DorkOS runs ${g[t]} here, but isn’t sharing to it.`:`${g[t]} files are here, but DorkOS isn’t sharing to it.`}),e.jsxs("p",{className:"text-muted-foreground text-3xs",children:["Run ",e.jsx(Be,{command:`dorkos harness sync --fix --enable ${t}`})," in this folder to turn it on."]})]},t))})}function ze({projectPath:s}){const t=H(),{data:n}=$(s),a=(n==null?void 0:n.state)==="ready"?n:null;return e.jsxs("div",{className:"flex flex-col gap-2","data-slot":"profile-skills",children:[e.jsx(ye,{projectPath:s}),a&&e.jsx(Fe,{notEnabled:a.notEnabled}),e.jsx(Re,{projectPath:s,showBrowseLink:!1}),a&&e.jsx(_e,{rows:a.rows,enabled:a.enabled}),a&&e.jsx(Te,{entries:a.projectLevel}),t&&e.jsxs(j,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:text-foreground w-full",onClick:()=>void t({...E.marketplace(),search:{type:"skill-pack"}}),children:[e.jsx(_,{"aria-hidden":!0,className:"mr-1.5 size-3.5"}),"Browse skill-packs"]})]})}function Qe({member:s}){var n;const t=((n=s.agent)==null?void 0:n.projectPath)??null;return t===null?e.jsx("p",{className:"text-muted-foreground text-sm",children:"This agent’s folder isn’t known here."}):e.jsx(ze,{projectPath:t})}export{Qe as SkillsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bl as A,b5 as F,r as i,b0 as c,cB as R,b8 as P,j as e,bF as O,W as B,cC as W,cD as M,cE as H,cF as L,cG as z,cH as G,cI as J,cJ as q}from"./index-CdKpQ1hI.js";import{F as K,T as Q,C}from"./TasksEmptyState-D0Jlzmed.js";import{i as U}from"./registry-ChxwU0f4.js";import"./inline-code-Cvn43Gqu.js";import"./form-vPuXuaYT.js";import"./command-ZTLTCj0l.js";import"./AgentPicker-dCfEIsU-.js";import"./AgentOptionRow-BqFQvFeN.js";import"./execution-config-BbBEe6FO.js";import"./settings-for-runtime-BoOa-ZFG.js";import"./list-runtime-types-DxwGcKLx.js";import"./format-cron-D02Tnupo.js";function V(){const l=A(),{data:n=[],isLoading:m}=F(l),[h,a]=i.useState(!1),[g,r]=i.useState(),[f,E]=i.useState(null),[v,u]=i.useState(null),t=c(s=>s.tasksAgentFilter),j=c(s=>s.setTasksAgentFilter),p=c(s=>s.tasksEditScheduleId),b=c(s=>s.setTasksEditScheduleId),N=t?n.filter(s=>s.agentId===t):n,w=n.some(s=>s.agentId),{data:o}=R(void 0,w),x=i.useMemo(()=>{const s=new Map;for(const d of(o==null?void 0:o.agents)??[])s.set(d.id,d);return s},[o]);i.useEffect(()=>{if(!p||m)return;const s=n.find(d=>d.id===p);s&&(r(s),a(!0)),b(null)},[p,n,m,b]);const k=i.useMemo(()=>{var s;return t?((s=x.get(t))==null?void 0:s.name)??t:null},[t,x]),{externalTrigger:y}=P();i.useEffect(()=>{y&&(r(void 0),a(!0))},[y]);const D=s=>{u(s),r(void 0),a(!0)},T=()=>{u(null),r(void 0),a(!0)},I=s=>{a(s),s||u(null)};return l?m?e.jsx("div",{className:"space-y-2 p-4",children:[1,2,3].map(s=>e.jsx("div",{className:"rounded-lg border p-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"bg-muted animate-breath size-2 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx("div",{className:"bg-muted animate-breath h-4 w-32 rounded"}),e.jsx("div",{className:"bg-muted animate-breath h-3 w-48 rounded"})]})]})},s))}):N.length===0?e.jsxs(e.Fragment,{children:[t?e.jsxs("div",{className:"flex flex-col items-center gap-3 p-8",children:[e.jsx(S,{name:k,onClear:()=>j(null)}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"No schedules for this agent."}),e.jsx("button",{onClick:T,className:"border-input hover:bg-accent hover:text-accent-foreground inline-flex items-center rounded-md border bg-transparent px-3 py-1.5 text-sm font-medium shadow-sm transition-colors",children:"New schedule"})]}):e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 pt-6",children:e.jsx(Q,{onCreateWithPreset:D,onCreateBlank:T})}),e.jsx(C,{open:h,onOpenChange:I,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[e.jsx("div",{className:"space-y-2 p-4",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("h3",{className:"text-muted-foreground text-sm font-medium",children:"Schedules"}),t&&e.jsx(S,{name:k,onClear:()=>j(null)})]}),e.jsx("button",{onClick:()=>{r(void 0),a(!0)},className:"border-input hover:bg-accent hover:text-accent-foreground inline-flex items-center rounded-md border bg-transparent px-3 py-1.5 text-sm font-medium shadow-sm transition-colors",children:"New schedule"})]})}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:e.jsx(O,{initial:!1,children:N.map(s=>e.jsx(B.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.2,ease:[0,0,.2,1]},className:"mb-2",children:e.jsx(W,{task:s,agent:s.agentId?x.get(s.agentId)??null:null,expanded:f===s.id,onToggleExpand:()=>E(f===s.id?null:s.id),onEdit:()=>{r(s),a(!0)}})},s.id))})}),e.jsx(C,{open:h,onOpenChange:a,editTask:g,initialPreset:v,initialAgentId:t??void 0})]}):e.jsx(K,{icon:U.tasks,name:"Scheduling",description:"Scheduled tasks let your agents work on a timer, even when you’re not here.",command:"dorkos --tasks"})}function S({name:l,onClear:n}){return e.jsx(M,{onRemove:n,removeLabel:"Clear agent filter",children:l??"Agent"})}function re({open:l,onOpenChange:n}){return e.jsx(H,{open:l,onOpenChange:n,children:e.jsxs(L,{className:"h-[85vh] max-w-2xl gap-0 p-0",children:[e.jsx(z,{}),e.jsxs(G,{className:"border-b px-4 py-3",children:[e.jsx(J,{className:"text-sm font-medium",children:"Scheduled tasks"}),e.jsx(q,{className:"sr-only",children:"See and change your scheduled tasks"})]}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:e.jsx(V,{})})]})})}export{re as TasksDialogWrapper};
|