dorkos 0.131.0 → 0.133.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 +499 -314
- package/dist/browser/fresh-verifier.mjs +13 -13
- package/dist/browser/native/darwin-supervisor-worker.mjs +3 -3
- package/dist/browser/native/package-manifest.json +1 -1
- package/dist/browser/source-manifest.json +1 -1
- package/dist/client/assets/{AboutPage-BZ2LLJ0k.js → AboutPage-D-EHHVPa.js} +1 -1
- package/dist/client/assets/{ActivityErrorState-BnqAwUiy.js → ActivityErrorState-BTHnE1vP.js} +1 -1
- package/dist/client/assets/{ActivityPage-BlZKrSVo.js → ActivityPage-BfSLPIdR.js} +1 -1
- package/dist/client/assets/{ActivityRow-Ch8HxQ2m.js → ActivityRow-PwUBjQw8.js} +1 -1
- package/dist/client/assets/{AdapterIcon-CfocFMw-.js → AdapterIcon-DgkNN6bi.js} +1 -1
- package/dist/client/assets/{AdapterSetupWizard-Dtjx1Oad.js → AdapterSetupWizard-DX0dzp7q.js} +2 -2
- package/dist/client/assets/{AgentOptionRow-BGRvUeF7.js → AgentOptionRow-ApuDEKqq.js} +1 -1
- package/dist/client/assets/{AgentPicker-BcURPZQp.js → AgentPicker-BDci-9aL.js} +1 -1
- package/dist/client/assets/{AgentRequestCard-kNq5A_IN.js → AgentRequestCard-B2gxCMGi.js} +3 -3
- package/dist/client/assets/{AppearancePage-Cd-k7dcc.js → AppearancePage-8SVnFe0k.js} +1 -1
- package/dist/client/assets/ApplyToOverridesDialog-CnL1ubxL.js +1 -0
- package/dist/client/assets/{AttentionSignalRow-QY8AIjf9.js → AttentionSignalRow-CCKhUtil.js} +1 -1
- package/dist/client/assets/{BaseTanStackRouterDevtoolsPanel-B-iktbLX-Cgkvajbw.js → BaseTanStackRouterDevtoolsPanel-B-iktbLX-B7wFPzG4.js} +3 -3
- package/dist/client/assets/BindingDialog-C4BHVXno.js +1 -0
- package/dist/client/assets/{BlintzCanvas-CMzZnmWK.js → BlintzCanvas-7E5uwVms.js} +3 -3
- package/dist/client/assets/{CanvasCsvContent-uxMaHePf.js → CanvasCsvContent-l7lfyDGn.js} +4 -4
- package/dist/client/assets/CanvasFileContent-Bqd0IEfK.js +2 -0
- package/dist/client/assets/CanvasModel3dContent-DqL0Sy4r.js +2 -0
- package/dist/client/assets/{ChannelComposer-BAg0a29Q.js → ChannelComposer-CAYvz_ZB.js} +12 -17
- package/dist/client/assets/{ChatAppsOff-DD28V0vX.js → ChatAppsOff-CNeKBVNz.js} +2 -2
- package/dist/client/assets/{CodeMirrorDiff-CyoduBgM.js → CodeMirrorDiff-BZRcNFsS.js} +1 -1
- package/dist/client/assets/{CodeMirrorEditor-DGccoZ8Q.js → CodeMirrorEditor-DD5tArRn.js} +1 -1
- package/dist/client/assets/{ComputerResourceView-Dk98shko.js → ComputerResourceView-BUmsVssG.js} +1 -1
- package/dist/client/assets/{ComputerViewer-Broprz4q.js → ComputerViewer-BKMR5LkF.js} +1 -1
- package/dist/client/assets/{ConnectionAccessLists-C_qLz8GJ.js → ConnectionAccessLists-DYUiFmPY.js} +1 -1
- package/dist/client/assets/{ConnectionsPage-CmGgGmDO.js → ConnectionsPage-DR2Kfm9Q.js} +2 -2
- package/dist/client/assets/{ConventionPage-BxWLIUUC.js → ConventionPage-Do6q8873.js} +2 -2
- package/dist/client/assets/{ExtensionPageRoute-CyfIRaGs.js → ExtensionPageRoute-CP7NM7fw.js} +2 -2
- package/dist/client/assets/{FeatureDisabledState-By2dhVpu.js → FeatureDisabledState-Bi23k3rg.js} +1 -1
- package/dist/client/assets/{FloatingTanStackRouterDevtools-CqogiFob-B6wKQpLR.js → FloatingTanStackRouterDevtools-CqogiFob-lRlmDXYz.js} +1 -1
- package/dist/client/assets/{ForwardConsentHost-kDdpyBgA.js → ForwardConsentHost-DSR1pEEK.js} +1 -1
- package/dist/client/assets/HandlePage-aHId3bYX.js +1 -0
- package/dist/client/assets/HeartbeatPage-BTNVcHOI.js +1 -0
- package/dist/client/assets/{KeyEntry-Ctc1zp2J.js → KeyEntry-67acsEG2.js} +1 -1
- package/dist/client/assets/{LexicalField-7zd4B8f1.js → LexicalField-Cb68LIar.js} +2 -2
- package/dist/client/assets/{ManagesPage-BG1TIMP3.js → ManagesPage-ChPlBF42.js} +1 -1
- package/dist/client/assets/{Marketplace-C9r4jRJf.js → Marketplace-CzPhJEE1.js} +4 -4
- package/dist/client/assets/{MarketplaceSourcesView-C01Cdrge.js → MarketplaceSourcesView-CmQgxQmU.js} +1 -1
- package/dist/client/assets/{McpAppFrame-Dm7MqOhc.js → McpAppFrame-z5JUaCSA.js} +2 -2
- package/dist/client/assets/{McpSigninBody-CsXP_7lE.js → McpSigninBody-ZrnzwrOH.js} +1 -1
- package/dist/client/assets/{Model3dViewer-DOl8ZkrU.js → Model3dViewer-HJpWK-JI.js} +1 -1
- package/dist/client/assets/NamePage-C7F-SotG.js +1 -0
- package/dist/client/assets/{NewDirectMessageMenu-Dj-Qw8zA.js → NewDirectMessageMenu-CjBjzsDe.js} +1 -1
- package/dist/client/assets/{NotificationsPage-UExs4YE2.js → NotificationsPage-DwNUI0Z3.js} +1 -1
- package/dist/client/assets/{OpenMeshSwitch-Dx3M3wwS.js → OpenMeshSwitch-RNAZY1vn.js} +2 -2
- package/dist/client/assets/{OperatorIdentityForm-Bz5570RF.js → OperatorIdentityForm-B7S2C_eT.js} +1 -1
- package/dist/client/assets/PermissionHistory-D0chstxf.js +1 -0
- package/dist/client/assets/PermissionsPage-ToK0DZVV.js +1 -0
- package/dist/client/assets/{PersonalityPopover-Do-k_Hhw.js → PersonalityPopover-BvMtUQRM.js} +1 -1
- package/dist/client/assets/PhotoPage-Cqo3PNO_.js +1 -0
- package/dist/client/assets/{PreviewRefusedNotice-B-yyzQZP.js → PreviewRefusedNotice-DzbkMrUo.js} +1 -1
- package/dist/client/assets/{ProfileFields-DiarOK2y.js → ProfileFields-DU8dTGHT.js} +1 -1
- package/dist/client/assets/{ProfilePanelContainer-33Xkwoc3.js → ProfilePanelContainer-BfT-ufV7.js} +1 -1
- package/dist/client/assets/{ProfileRolePicker-BI6T4hj8.js → ProfileRolePicker-DrOtV-0N.js} +1 -1
- package/dist/client/assets/{PromptSuggestionChips-v5MScpZF.js → PromptSuggestionChips-CEnhme_V.js} +1 -1
- package/dist/client/assets/{ReportsToPopover-BALADuTO.js → ReportsToPopover-CwjpR1Tw.js} +1 -1
- package/dist/client/assets/{RoomSurface-BatV7gf5.js → RoomSurface-CChzNJKw.js} +1 -1
- package/dist/client/assets/{RoomsPage-DCCC3Dst.js → RoomsPage-Dbf6ijKr.js} +1 -1
- package/dist/client/assets/{RunsOnPopover-C7hMPyrb.js → RunsOnPopover-Bh5sSsSC.js} +1 -1
- package/dist/client/assets/{RuntimeConnectFlow-Dc5a8dlJ.js → RuntimeConnectFlow-BYQnY5vv.js} +1 -1
- package/dist/client/assets/{RuntimeSetupDialog-w90VGjJ4.js → RuntimeSetupDialog-DTO5v0dP.js} +1 -1
- package/dist/client/assets/{SeenDevices-BIMmbMWC.js → SeenDevices-cuY7ASEy.js} +3 -3
- package/dist/client/assets/{SessionsPage-0lwvSYHB.js → SessionsPage-BrqpVx-t.js} +1 -1
- package/dist/client/assets/{SettingsDialog-CrP6JzPg.js → SettingsDialog-DCAZX_1d.js} +4 -4
- package/dist/client/assets/{SkillsPage-BDgKWTfe.js → SkillsPage-D5who_ZH.js} +1 -1
- package/dist/client/assets/TaskDialogWrapper-BJ6XtOC5.js +1 -0
- package/dist/client/assets/TasksEmptyState-B3SjsxQa.js +3 -0
- package/dist/client/assets/{TasksPage-DjGbMGvn.js → TasksPage-B72w7J87.js} +1 -1
- package/dist/client/assets/{TeamComputerEntry-B_sM9Fik.js → TeamComputerEntry-B9ma5j-X.js} +1 -1
- package/dist/client/assets/TodoPromiseList-DDKWAfmv.js +1 -0
- package/dist/client/assets/TodoPromisesPage-BNXpvXzS.js +1 -0
- package/dist/client/assets/{ToolsPage-CeETRCd8.js → ToolsPage-DbJykCG3.js} +2 -2
- package/dist/client/assets/{TopologyGraph-CnpH2NjE.js → TopologyGraph-DKZS3nlr.js} +3 -3
- package/dist/client/assets/{TourHost-BQHrS47S.js → TourHost-Bw3Uoea5.js} +1 -1
- package/dist/client/assets/{UnlinkDialog-DOQLeNx4.js → UnlinkDialog-B-XCFNSd.js} +1 -1
- package/dist/client/assets/{UnreadDivider-DhyK6uGG.js → UnreadDivider-1aPVzwd7.js} +1 -1
- package/dist/client/assets/{WidgetErrorCard-Bwlfu514.js → WidgetErrorCard-C5ieVv_9.js} +6 -6
- package/dist/client/assets/{WithheldExtensionsNotice-BDc-CM2t.js → WithheldExtensionsNotice-CCO4ClRZ.js} +1 -1
- package/dist/client/assets/{WorkQueuePage-iO_DO1YK.js → WorkQueuePage-BbPKNwDg.js} +1 -1
- package/dist/client/assets/WorkView-BRcytACJ.js +51 -0
- package/dist/client/assets/_shell-EwFeSIGp.js +80 -0
- package/dist/client/assets/{_shell._home-BWi5YPaR.js → _shell._home-DD2mg-iK.js} +1 -1
- package/dist/client/assets/{_shell._home.activity-BU1NIGb7.js → _shell._home.activity-Z1QuU2M4.js} +1 -1
- package/dist/client/assets/_shell._home.index-BzTYr8Bw.js +3 -0
- package/dist/client/assets/_shell._home.tasks-BtC85Iut.js +1 -0
- package/dist/client/assets/{_shell._home.workspaces-wbnqJ58w.js → _shell._home.workspaces-qMG5OJYR.js} +1 -1
- package/dist/client/assets/{_shell.channels-D1KdvWZF.js → _shell.channels-BE4EK-iM.js} +2 -2
- package/dist/client/assets/_shell.connections-CBx0ogzx.js +1 -0
- package/dist/client/assets/{_shell.feedback-requests-DzHWC1fJ.js → _shell.feedback-requests-CwKSkkuD.js} +2 -2
- package/dist/client/assets/_shell.marketplace-CgWBUKSA.js +1 -0
- package/dist/client/assets/_shell.marketplace_.sources-8HZpKFDI.js +1 -0
- package/dist/client/assets/_shell.session-D6HcVbnm.js +1 -0
- package/dist/client/assets/{_shell.team-BMNSUpQQ.js → _shell.team-Dm5a4f8_.js} +4 -4
- package/dist/client/assets/_shell.threads-BavVtQOE.js +1 -0
- package/dist/client/assets/_shell.todos-B6uWr0zA.js +6 -0
- package/dist/client/assets/_shell.x._extensionId-DaELdkCH.js +1 -0
- package/dist/client/assets/_shell.x._extensionId_._-DaELdkCH.js +1 -0
- package/dist/client/assets/{abnfDiagram-WEYOIA3C-Co2k29JX.js → abnfDiagram-WEYOIA3C-Bu2T3jVw.js} +1 -1
- package/dist/client/assets/{access-copy-D6BUySpp.js → access-copy-tkiFMhRf.js} +1 -1
- package/dist/client/assets/{arc-DLZZpkuJ.js → arc-5q4SfXO9.js} +1 -1
- package/dist/client/assets/{architectureDiagram-ZHVYKT53-ClS9xqK5.js → architectureDiagram-ZHVYKT53-BnDMOBhV.js} +1 -1
- package/dist/client/assets/{banner-B8iMuXCP.js → banner-CSKUrrI0.js} +2 -2
- package/dist/client/assets/{blockDiagram-RJAE7QA3-DheoOELu.js → blockDiagram-RJAE7QA3-CtushlEs.js} +1 -1
- package/dist/client/assets/{c4Diagram-XDPPPE54-VWWZJ5x4.js → c4Diagram-XDPPPE54-7L-qYwKH.js} +1 -1
- package/dist/client/assets/channel-A3XT7_2L.js +1 -0
- package/dist/client/assets/{chunk-2E7WHVMD-BqPLJVkv.js → chunk-2E7WHVMD-ksBVyqQ3.js} +1 -1
- package/dist/client/assets/{chunk-2Q5K7J3B-DZn6OnKe.js → chunk-2Q5K7J3B-Bfqdkihb.js} +1 -1
- package/dist/client/assets/{chunk-4EMNKR2T-Dl9Poajp.js → chunk-4EMNKR2T-Brf2dH9x.js} +1 -1
- package/dist/client/assets/{chunk-55XCU76K-RoKuZPUc.js → chunk-55XCU76K-BlE7Cq40.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-DV_1XHtU.js → chunk-5VM5RSS4-Bkgg3j7L.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-B_IuS45y.js → chunk-JWPE2WC7-B9TRpN4O.js} +1 -1
- package/dist/client/assets/{chunk-VQ5W62QI-DkLNi45x.js → chunk-VQ5W62QI-ZoILnIYi.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-ISM-1Dpw.js → chunk-XXDRQBXY-r2xNhaKz.js} +1 -1
- package/dist/client/assets/{chunk-ZCHMQSOR-MKaLMW8o.js → chunk-ZCHMQSOR-DfV3cF7d.js} +2 -2
- package/dist/client/assets/{classDiagram-v2-4MYWR3UA-CIWuu4ht.js → classDiagram-v2-4MYWR3UA-VOVqMNNP.js} +1 -1
- package/dist/client/assets/{command-CxGYZKco.js → command-CaUEAy3b.js} +1 -1
- package/dist/client/assets/{copy-button-DjAoGwds.js → copy-button-BOznikwM.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-HiCifRyi.js → cose-bilkent-JH36ORCC-CAdBvyLz.js} +1 -1
- package/dist/client/assets/{cpu-DHHTTvp_.js → cpu-j9vX9Wfk.js} +1 -1
- package/dist/client/assets/{cynefin-EF2NZ3EQ-DjJGZrPz.js → cynefin-EF2NZ3EQ-DcH1A9Oo.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-WF24UDRP-DE2NdiJ2.js → cynefinDiagram-WF24UDRP-DJuKBXHi.js} +1 -1
- package/dist/client/assets/{dagre-NK4GIZVX-C6gDOD26.js → dagre-NK4GIZVX-D099H_0S.js} +1 -1
- package/dist/client/assets/{detail-row-CjwI1iuc.js → detail-row-Crl89jnh.js} +1 -1
- package/dist/client/assets/{diagram-CBK3MWTC-38LckcsL.js → diagram-CBK3MWTC-Cd_4W9XO.js} +1 -1
- package/dist/client/assets/{diagram-I5XIIV2D--8L6D9Ra.js → diagram-I5XIIV2D-Bc7aQKt3.js} +1 -1
- package/dist/client/assets/{diagram-ODIL2UCW-DGC2Inhd.js → diagram-ODIL2UCW-awVJZ4Bg.js} +1 -1
- package/dist/client/assets/{diagram-PFBEJUXE-BDHp0AyR.js → diagram-PFBEJUXE-dhsj9aeU.js} +1 -1
- package/dist/client/assets/{diagram-RJA3I4VV-uBatJYPi.js → diagram-RJA3I4VV-Dm59CbiV.js} +1 -1
- package/dist/client/assets/{diagram-TYUNFSNR-C8e1EH9X.js → diagram-TYUNFSNR-BhvcIjA9.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-V4P3TTPT-DimRzU5B.js → ebnfDiagram-V4P3TTPT-C4wT_MTC.js} +1 -1
- package/dist/client/assets/{elk-QONTBCTQ-Dz6_Y2-G.js → elk-QONTBCTQ-CPI0zjmW.js} +1 -1
- package/dist/client/assets/{empty-state-saV209Il.js → empty-state-BHcmkSzu.js} +1 -1
- package/dist/client/assets/{erDiagram-KYQIGQAA-JeuTF8w6.js → erDiagram-KYQIGQAA-C_vGcbOB.js} +1 -1
- package/dist/client/assets/{execution-config-ClQZyDs9.js → execution-config-BS5rtvTZ.js} +1 -1
- package/dist/client/assets/{file-BIF-4ARS.js → file-CQGljfDT.js} +1 -1
- package/dist/client/assets/{file-exclamation-point-DxadH2b-.js → file-exclamation-point-B0a55VME.js} +1 -1
- package/dist/client/assets/{file-text-C_NPIQr4.js → file-text-Cycq_S0e.js} +1 -1
- package/dist/client/assets/{find-latest-widget-fence-CXai_zs0.js → find-latest-widget-fence-B6sJdG3Q.js} +4 -4
- package/dist/client/assets/{flowDiagram-IUGLLWBU-9FHDdK4j.js → flowDiagram-IUGLLWBU-_VNfmnxx.js} +1 -1
- package/dist/client/assets/{form-D3VdAYl4.js → form-BL14vwyB.js} +1 -1
- package/dist/client/assets/{format-cron-BqRDcFZM.js → format-cron-meJMgYNe.js} +1 -1
- package/dist/client/assets/{ganttDiagram-R7GPNTJY-CLMuXlHt.js → ganttDiagram-R7GPNTJY-o0gGU7X_.js} +1 -1
- package/dist/client/assets/{git-branch-Df7a5_fb.js → git-branch-CsLE6G0Y.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PDYL7XHY-sE7Rlpr6.js → gitGraphDiagram-PDYL7XHY-DjXjUpJo.js} +1 -1
- package/dist/client/assets/{graph-iNVyFhBQ.js → graph-BMYee_VK.js} +1 -1
- package/dist/client/assets/{heart-BHMhDZ0K.js → heart-Cn3a-UQI.js} +1 -1
- package/dist/client/assets/{highlighted-body-KPVGNVTW-VvvsrJbu.js → highlighted-body-KPVGNVTW-DsX5yCC0.js} +1 -1
- package/dist/client/assets/{image-lightbox-CGEIRguA.js → image-lightbox-BZ_eBZgA.js} +1 -1
- package/dist/client/assets/{image-off-C5-TmSq8.js → image-off-DjR7LI5G.js} +1 -1
- package/dist/client/assets/{index-C3zS0ghJ.js → index-1MwES_vb.js} +1 -1
- package/dist/client/assets/{index-ClyRhxV_.js → index-47--OGKJ.js} +1 -1
- package/dist/client/assets/{index-CTgUh4p3.js → index-4rSR8lau.js} +1 -1
- package/dist/client/assets/{index-D9bEy8X-.js → index-B4TxpTKD.js} +1 -1
- package/dist/client/assets/{index-Dw-4S640.js → index-B8LqLhq7.js} +1 -1
- package/dist/client/assets/index-BJRgbiEd.js +1 -0
- package/dist/client/assets/{index-DWZ5M321.js → index-BOCclWF3.js} +1 -1
- package/dist/client/assets/index-BR1m9FON.js +1066 -0
- package/dist/client/assets/index-BcFn_S6b.js +1 -0
- package/dist/client/assets/{index-DRtg_sGG.js → index-BcnwvTnt.js} +1 -1
- package/dist/client/assets/index-BdVQOlVQ.css +1 -0
- package/dist/client/assets/{index-DEvpdTo6.js → index-BmKHO-FD.js} +1 -1
- package/dist/client/assets/{index-Bd0PAkxf.js → index-BsZkXHsH.js} +1 -1
- package/dist/client/assets/{index-Cudi8rs6.js → index-BxWr8Mrf.js} +1 -1
- package/dist/client/assets/index-C5EvpXcq.js +1 -0
- package/dist/client/assets/{index-CExh9cKN.js → index-Cb_p_ynP.js} +1 -1
- package/dist/client/assets/{index-YZbu9tke.js → index-CczLBUKI.js} +1 -1
- package/dist/client/assets/{index-264YDu-W.js → index-Cf4Gtxf9.js} +1 -1
- package/dist/client/assets/{index-Dpu2CORc.js → index-CfKSlYjb.js} +1 -1
- package/dist/client/assets/{index-Bzm9YMbr.js → index-Cgjq7a-8.js} +1 -1
- package/dist/client/assets/{index-Ci_J5Q-6.js → index-CpWxcN5D.js} +1 -1
- package/dist/client/assets/{index-BK5QrGfQ.js → index-Cv67OXfk.js} +1 -1
- package/dist/client/assets/{index-Di-MIFQG.js → index-D5Qmx1JR.js} +3 -3
- package/dist/client/assets/{index-LPrq0pOA.js → index-DARchye_.js} +1 -1
- package/dist/client/assets/{index-DMwivStD.js → index-DFb4kOjm.js} +2 -2
- package/dist/client/assets/{index-WeLoaNzW.js → index-DLN0kcME.js} +1 -1
- package/dist/client/assets/{index-BMLCfTba.js → index-DMSSN08i.js} +1 -1
- package/dist/client/assets/{index-Y6BDhuGt.js → index-DQ8uADJF.js} +1 -1
- package/dist/client/assets/index-DZhMvc9m.js +1 -0
- package/dist/client/assets/{index-CLsoFUml.js → index-Dfko0tSp.js} +1 -1
- package/dist/client/assets/{index-BgdYXP8E.js → index-DiM3QX-4.js} +3 -3
- package/dist/client/assets/{index-BxFLHNLg.js → index-DlvUENo4.js} +1 -1
- package/dist/client/assets/{index-BLUUshO9.js → index-DqZmnJED.js} +1 -1
- package/dist/client/assets/{index-D_bAtIJZ.js → index-DrlB9RSk.js} +1 -1
- package/dist/client/assets/{index-CgWzzIbx.js → index-H4e5Wpmi.js} +1 -1
- package/dist/client/assets/{index-k67dvyau.js → index-Joav7LQU.js} +1 -1
- package/dist/client/assets/{index-B0FHRkHM.js → index-KganLhU1.js} +2 -2
- package/dist/client/assets/{index-DFkofTx1.js → index-Kt6r3DQg.js} +1 -1
- package/dist/client/assets/{index-B8I1k-z9.js → index-Z2ApBQt4.js} +1 -1
- package/dist/client/assets/index-dY7IFpet.js +1 -0
- package/dist/client/assets/{index-DYVNSRDk.js → index-faSyUc2q.js} +1 -1
- package/dist/client/assets/{index-BgRYuqWs.js → index-gmyiXkmr.js} +1 -1
- package/dist/client/assets/{index-BZTLFzJp.js → index-o6kGmVGx.js} +1 -1
- package/dist/client/assets/{index-C_0JoCV6.js → index-vHKVYcH7.js} +1 -1
- package/dist/client/assets/{index.esm-CYmalBux.js → index.esm-CJIDYBqd.js} +1 -1
- package/dist/client/assets/{infoDiagram-MVDRKAX5-0aR9wjgO.js → infoDiagram-MVDRKAX5-B1mMyUlp.js} +1 -1
- package/dist/client/assets/{inline-code-DyTKSC5b.js → inline-code-mh48Uhbi.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-HPEHV2GE-D1lN8x2t.js → ishikawaDiagram-HPEHV2GE-efEMQ0_X.js} +1 -1
- package/dist/client/assets/{journeyDiagram-BOSHW7O7-CkXITXiJ.js → journeyDiagram-BOSHW7O7-DSAywiVk.js} +1 -1
- package/dist/client/assets/{kanban-definition-FNSA4HC5-ge33IiSq.js → kanban-definition-FNSA4HC5-B9pbU4zK.js} +1 -1
- package/dist/client/assets/{layers-Bx3K7OUm.js → layers-B0Z5Od3N.js} +1 -1
- package/dist/client/assets/{lightbulb-C5LvXkvM.js → lightbulb-Cfb5ecEd.js} +1 -1
- package/dist/client/assets/{link-2-Bj0_Zkvr.js → link-2-Dzy5BUL3.js} +1 -1
- package/dist/client/assets/{list-runtime-types-VNj1C8TB.js → list-runtime-types-DLmjtBMq.js} +1 -1
- package/dist/client/assets/{markdown-content-BRaPEOC7.js → markdown-content-DhAtZOfj.js} +1 -1
- package/dist/client/assets/{mention-pill-B_MiJWfo.js → mention-pill-DmA8FxL4.js} +1 -1
- package/dist/client/assets/{mermaid.core-B2hil_4a.js → mermaid.core-DUIkdbeL.js} +4 -4
- package/dist/client/assets/{message-square-off-T33FHpr7.js → message-square-off-BowIzJUV.js} +1 -1
- package/dist/client/assets/{mindmap-definition-6OY57UG3-Bu_Ia4Xz.js → mindmap-definition-6OY57UG3-Dz7ZOR4C.js} +1 -1
- package/dist/client/assets/{more-details-oDazWBxm.js → more-details-DV7LmY0E.js} +1 -1
- package/dist/client/assets/{owner-notice-VepbAQhj.js → owner-notice-DdFc2P8z.js} +1 -1
- package/dist/client/assets/{package-DBsl3ao5.js → package-BhKXbvU_.js} +1 -1
- package/dist/client/assets/{page-container-Bkarym6m.js → page-container-0sWZ3xh9.js} +1 -1
- package/dist/client/assets/{pane-resize-handle-gBlb5k1v.js → pane-resize-handle-Bjy4udre.js} +1 -1
- package/dist/client/assets/{paperclip-BeFttiUK.js → paperclip-C-7LhBfl.js} +1 -1
- package/dist/client/assets/{path-input-NY_yCBHb.js → path-input-BPVyI72G.js} +1 -1
- package/dist/client/assets/{pegDiagram-ECIUJNBX-0KmJlW0E.js → pegDiagram-ECIUJNBX-C4EOP-Fa.js} +1 -1
- package/dist/client/assets/{pieDiagram-GNMPY74T-IjeZXicv.js → pieDiagram-GNMPY74T-CQ1OxRkv.js} +1 -1
- package/dist/client/assets/{plug-CTqOZ7cA.js → plug-CIZ-wWL8.js} +1 -1
- package/dist/client/assets/{primer-trigger-CjaGrT2u.js → primer-trigger-XA5fLzR5.js} +2 -2
- package/dist/client/assets/{profile-errors-B8XkL2Rp.js → profile-errors-C1XACbc9.js} +1 -1
- package/dist/client/assets/{progress-Cr-4myw6.js → progress-BA2JPtb6.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-D57K4MC3-CP6kLJKa.js → quadrantDiagram-D57K4MC3-Cw4BdkpS.js} +1 -1
- package/dist/client/assets/{query-error-state-DvhY-YKM.js → query-error-state-Cm-Lozlb.js} +1 -1
- package/dist/client/assets/{radio-CmDmmJy6.js → radio-DQ29H26H.js} +1 -1
- package/dist/client/assets/{railroadDiagram-Y72NRBL7-Bcto__oE.js → railroadDiagram-Y72NRBL7-CSKtYLmm.js} +1 -1
- package/dist/client/assets/registry-Tbt9pcZl.js +39 -0
- package/dist/client/assets/registry-jD9zw538.js +1 -0
- package/dist/client/assets/{relay-trace-schemas-ZLR1S8ft.js → relay-trace-schemas-4AAUf-Zl.js} +2 -2
- package/dist/client/assets/{repeat-DVTM8et8.js → repeat-B8g-x-Sc.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EQYSW5RA-DNJrds3m.js → requirementDiagram-EQYSW5RA-BPSBZr7X.js} +1 -1
- package/dist/client/assets/{room-files-source-9Wdtc-bG.js → room-files-source-BkiK4-ZI.js} +2 -2
- package/dist/client/assets/{rotate-ccw-clock-qJSWqifh.js → rotate-ccw-clock-DRtL-2nr.js} +1 -1
- package/dist/client/assets/{rotate-cw-uoeBxIeM.js → rotate-cw-BbHkWN-J.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-SY24JHO5-DNlU7xGI.js → sankeyDiagram-SY24JHO5-DVlHablQ.js} +1 -1
- package/dist/client/assets/{scroll-area-B1d3NfEn.js → scroll-area-DAC7NrVU.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-BLEHNHQU-CRk71coF.js → sequenceDiagram-BLEHNHQU--wZkN8xk.js} +1 -1
- package/dist/client/assets/{shield-x-BpQmg1qz.js → shield-x-CEWfkzDN.js} +1 -1
- package/dist/client/assets/{signed-in-CTmJ3OqM.js → signed-in-CMhCR-m8.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-cihX3QNq.js → sizeCapture-INFHLROL-CLXc7d3S.js} +1 -1
- package/dist/client/assets/{soul-file-BwiyiI5v.js → soul-file-CbX7rNqz.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-A6IESKWZ-BAwwRsnH.js → stateDiagram-v2-A6IESKWZ-5xa1FM_X.js} +1 -1
- package/dist/client/assets/{swimlanes-B3ENRKFQ-CpDB6CUC.js → swimlanes-B3ENRKFQ-DKgxJxjE.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-f6MOc3pl.js +8 -0
- package/dist/client/assets/{table-dWrfPeX-.js → table-D0EJT0uP.js} +1 -1
- package/dist/client/assets/{tabs-D4txthOi.js → tabs-Ctjzrm8t.js} +1 -1
- package/dist/client/assets/{timeline-definition-JXYKGLGB-RDrKgCoU.js → timeline-definition-JXYKGLGB-B9P7ituI.js} +1 -1
- package/dist/client/assets/trust-dial-D__tIhzt.js +11 -0
- package/dist/client/assets/{trust-posture-atZIh8tf.js → trust-posture-DaHHtOZn.js} +1 -1
- package/dist/client/assets/{unplug-CnevV4yX.js → unplug-B-ipHefz.js} +1 -1
- package/dist/client/assets/{unverified-catalog-notice-BQwT36FA.js → unverified-catalog-notice-C8swqaTn.js} +1 -1
- package/dist/client/assets/{use-bindings-CltfjAWW.js → use-bindings-gLHRNAFU.js} +1 -1
- package/dist/client/assets/{use-composer-prefs-D-Zlt6z2.js → use-composer-prefs-CjpxcBIe.js} +1 -1
- package/dist/client/assets/{use-connector-management-C3CLnOOt.js → use-connector-management-BLiCJMgU.js} +1 -1
- package/dist/client/assets/{use-deep-link-scroll-DQlz-scx.js → use-deep-link-scroll-r2nKjzA-.js} +1 -1
- package/dist/client/assets/{use-delete-binding-D73CLm_7.js → use-delete-binding-BSiOik_K.js} +1 -1
- package/dist/client/assets/{use-dev-links-BqVFsMKU.js → use-dev-links-DXcIlMf-.js} +1 -1
- package/dist/client/assets/use-direct-message-panel-BbH8N4mE.js +1 -0
- package/dist/client/assets/{use-external-adapter-catalog-DrnksH0t.js → use-external-adapter-catalog-mmKni5ui.js} +1 -1
- package/dist/client/assets/{use-filter-state-D4i-hDOk.js → use-filter-state-CiPZ0AIH.js} +2 -2
- package/dist/client/assets/{use-full-activity-feed-DdDsRg8s.js → use-full-activity-feed-DXroUzfN.js} +1 -1
- package/dist/client/assets/use-is-below-desktop-LUZL5z5t.js +1 -0
- package/dist/client/assets/{use-mesh-topology-B7aLtPkZ.js → use-mesh-topology-upehQ5Cv.js} +1 -1
- package/dist/client/assets/{use-mounted-ref-DSSTCJfY.js → use-mounted-ref-IHwyriaF.js} +1 -1
- package/dist/client/assets/{use-notification-prefs-DaF3kwmq.js → use-notification-prefs-BHOK2P2l.js} +1 -1
- package/dist/client/assets/use-pending-read-mVsOBTzn.js +1 -0
- package/dist/client/assets/{use-personality-commit-D5b90JPX.js → use-personality-commit-Chf3UX8P.js} +1 -1
- package/dist/client/assets/{use-promo-activation-CPAOQpfe.js → use-promo-activation-Dlw6bg7G.js} +2 -2
- package/dist/client/assets/{use-promo-dismissals-Bx1gz1R1.js → use-promo-dismissals-Dx_fli7I.js} +1 -1
- package/dist/client/assets/{use-pulse-freshness-DeulB37O.js → use-pulse-freshness-CG_I6a-O.js} +1 -1
- package/dist/client/assets/{use-room-follow-claim-Dwke6RFQ.js → use-room-follow-claim-Bgrpr3bO.js} +1 -1
- package/dist/client/assets/{use-room-sessions-iepVrIMm.js → use-room-sessions-DecGrP3E.js} +1 -1
- package/dist/client/assets/{use-roving-tab-list-pCPKNQKv.js → use-roving-tab-list-CDkh-Ujm.js} +1 -1
- package/dist/client/assets/{use-session-canvas-BvvO-_V1.js → use-session-canvas-tvLLPQcm.js} +6 -6
- package/dist/client/assets/{use-status-budget-Bs7MMriS.js → use-status-budget-BBl2yxLR.js} +2 -2
- package/dist/client/assets/{use-todos-C-eREuDS.js → use-todos-BzRauzdQ.js} +1 -1
- package/dist/client/assets/{use-transform-lj3TkjYO.js → use-transform-DzJeHpxm.js} +1 -1
- package/dist/client/assets/{use-unclaimed-chats-BF3-0jHC.js → use-unclaimed-chats--HZdmq4F.js} +1 -1
- package/dist/client/assets/use-update-config-DjL7-nUR.js +1 -0
- package/dist/client/assets/{useMutationState-B_x_4f2K.js → useMutationState-DIywUTDG.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-WPOLBNNX-DBsRYa4J.js → usecaseDiagram-WPOLBNNX-C9aLJ03F.js} +1 -1
- package/dist/client/assets/{vennDiagram-Q3Y3IDCW-rFAXvcQI.js → vennDiagram-Q3Y3IDCW-ChBIWbL0.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-IVAIDKWA-bI0JZkO3.js → wardleyDiagram-IVAIDKWA-DvQDOaTm.js} +1 -1
- package/dist/client/assets/{xychartDiagram-4URNHDU4-DZUd8iln.js → xychartDiagram-4URNHDU4-8FxLPP2c.js} +1 -1
- package/dist/client/assets/zap-DSllMMHe.js +6 -0
- package/dist/client/index.html +2 -2
- package/dist/drizzle/20261104060919_package_approval_request.sql +1 -0
- package/dist/drizzle/20261104081935_hook_decline_review.sql +3 -0
- package/dist/drizzle/20261107183323_dor3933_todos_rename.sql +64 -0
- package/dist/drizzle/20261108014418_dor3938_cross_agent_writer.sql +4 -0
- package/dist/drizzle/meta/20261104060919_snapshot.json +14889 -0
- package/dist/drizzle/meta/20261104081935_snapshot.json +14910 -0
- package/dist/drizzle/meta/20261107183323_snapshot.json +14910 -0
- package/dist/drizzle/meta/20261108014418_snapshot.json +14938 -0
- package/dist/drizzle/meta/_journal.json +28 -0
- package/dist/server/index.js +24875 -21931
- package/dist/server/index.js.map +2 -2
- package/package.json +5 -5
- package/dist/client/assets/ApplyToOverridesDialog-DE9VVQCA.js +0 -1
- package/dist/client/assets/BindingDialog-C_yflKOE.js +0 -1
- package/dist/client/assets/CanvasFileContent-C3ZKszxn.js +0 -2
- package/dist/client/assets/CanvasModel3dContent-CsNUuaj6.js +0 -2
- package/dist/client/assets/CommitmentList-DOvfnyDA.js +0 -1
- package/dist/client/assets/CommitmentsPage-D81vxHUk.js +0 -1
- package/dist/client/assets/HandlePage-vsG04kBg.js +0 -1
- package/dist/client/assets/HeartbeatPage-CMj1SS30.js +0 -1
- package/dist/client/assets/NamePage-DdX2yQ5f.js +0 -1
- package/dist/client/assets/PermissionHistory-Bhl2kr1R.js +0 -1
- package/dist/client/assets/PermissionsPage-DUbenFkt.js +0 -1
- package/dist/client/assets/PhotoPage-CExABoHA.js +0 -1
- package/dist/client/assets/TaskDialogWrapper-BVb8gAr0.js +0 -1
- package/dist/client/assets/TasksEmptyState-RkUEEU2r.js +0 -3
- package/dist/client/assets/WorkView-BDk_vwu3.js +0 -51
- package/dist/client/assets/_shell-CMNFxZKJ.js +0 -80
- package/dist/client/assets/_shell._home.index-BjR-d3_s.js +0 -3
- package/dist/client/assets/_shell._home.tasks-CqURPMQD.js +0 -1
- package/dist/client/assets/_shell.connections-D3gJrBTQ.js +0 -1
- package/dist/client/assets/_shell.marketplace-HdefWdN_.js +0 -1
- package/dist/client/assets/_shell.marketplace_.sources-wAZKfDQF.js +0 -1
- package/dist/client/assets/_shell.session-C0utZeSI.js +0 -1
- package/dist/client/assets/_shell.threads-TvzYRNMt.js +0 -1
- package/dist/client/assets/_shell.todos-sOFmsIPE.js +0 -6
- package/dist/client/assets/_shell.x._extensionId-DiEQZIvl.js +0 -1
- package/dist/client/assets/_shell.x._extensionId_._-DiEQZIvl.js +0 -1
- package/dist/client/assets/channel-B0WiEIVe.js +0 -1
- package/dist/client/assets/index-BwTGkJbK.js +0 -1071
- package/dist/client/assets/index-CCHGVclj.js +0 -1
- package/dist/client/assets/index-CiUmx-i3.js +0 -1
- package/dist/client/assets/index-Dd4JoHFP.js +0 -1
- package/dist/client/assets/index-DlmGvYpy.js +0 -1
- package/dist/client/assets/index-EXJsA5kw.js +0 -1
- package/dist/client/assets/index-MpS13vhQ.css +0 -1
- package/dist/client/assets/registry-BQTcAm5U.js +0 -39
- package/dist/client/assets/registry-HencHRXy.js +0 -1
- package/dist/client/assets/swimlanesDiagram-AYQRV4AK-nJfOIWYW.js +0 -8
- package/dist/client/assets/use-direct-message-panel-B3qfpDjY.js +0 -1
- package/dist/client/assets/use-is-below-desktop-BXHT3oPL.js +0 -1
- package/dist/client/assets/use-local-browser-DDWknHZE.js +0 -1
- package/dist/client/assets/use-pending-read-uvmEJ7H9.js +0 -1
- package/dist/client/assets/use-update-config-D-OGlXGR.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as L,ek as Ee,j as e,Z as ye,_ as we,a2 as Ae,G as C,bz as ue,bA as fe,eo as ke,ep as ie,a4 as De,bB as me,bD as xe,a5 as Le,a7 as Te,a8 as Oe,af as pe,aO as $e,eq as he,er as Ie,es as Pe,et as _e,aa as N,eu as Ue,ev as M,ew as Be,ao as be,B as Me,U as Re,b as He,e as ze,ex as Ke,ey as qe,ez as Qe,eA as Ve,eB as Fe,eC as Ge}from"./index-BwTGkJbK.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as D}from"./execution-config-ClQZyDs9.js";import{U as Ze}from"./unverified-catalog-notice-BQwT36FA.js";import{s as Je}from"./settings-for-runtime-BoOa-ZFG.js";const et={duration:.12,ease:"easeOut"};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=L.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,v=Ee(),p=e.jsx(ye,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:v?{duration:0}:et,className:"block truncate",children:o},o)});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx(ke,{size:"sm",icon:r?De:void 0,iconClassName:r?ie.warning:void 0,"aria-label":`Set here${r?`: ${r}`:""}`,title:r?`${o}: ${r}`:o,className:s,"data-testid":d,children:p})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:C("px-2 pt-1 text-xs",ie.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):e.jsx(Ae,{size:"xs",tone:r?"warning":"neutral",title:r?`${o}: ${r}`:o,"aria-label":r?`${o}: ${r}`:void 0,className:C("max-w-56",s),"data-testid":d,children:p})}const tt=["agents"];function st(a){const l=Le(),i=Te();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:tt})}})}const je="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function U({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:v=!0,className:p,describedBy:m,inheritText:T}){const w=pe(),[S,h]=L.useState(!1);return e.jsxs("div",{className:C("space-y-1",p),children:[v&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:C("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Re,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:C("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:T??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function at({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,oe,le,re,de;const r=pe(),{data:s}=$e(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:v}=Ie(),p=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,k;return((k=(b=v==null?void 0:v.defaults)==null?void 0:b[t])==null?void 0:k.runsOn)==="credits"}}),{data:m,isError:T}=Pe({runtime:o,...p?{account:N}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=p&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,A=a.model??h??(E==null?void 0:E.value)??null,R=o==="doe"&&c&&!w&&!h,x=A?(m??[]).find(t=>t.value===A):void 0,O=(n==null?void 0:n.supportsEffort)??((ae=Je(d,o))==null?void 0:ae.supportsEffort),H=O===void 0&&u,z=O!==!1,K=x?x.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:Q,creditsEntry:ge,resolvedAccount:V}=_e(),F=ge??(a.account===N&&((oe=s==null?void 0:s.claudeCode)!=null&&oe.credits)?{path:s.claudeCode.credits.path}:null),j=q&&[...q.flatMap(t=>t.id===null?[]:[{id:t.id,label:Q(t.path),path:t.path}]),...F?[{id:N,label:Ue,path:F.path}]:[]],g=a.account??null,G=g!==null,W=o==="claude-code"&&g===N&&((le=s==null?void 0:s.claudeCode)==null?void 0:le.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),$=s!=null&&s.claudeCode&&V?Q(V):null,I=st({errorLabel:"Couldn’t change this agent’s account"}),P=L.useCallback(t=>{I.mutate({id:a.id,updates:{account:t}})},[a.id,I]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:j,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:O,runtimeLabel:t=>M(t).label}),y=t=>{var b;return((b=Ne.breakages.find(k=>t.includes(k.kind)))==null?void 0:b.message)??null},_=!H&&z&&K!==!1,X=a.effort??(n==null?void 0:n.effort)??null,Y=M(o).label,Ce=o==="claude-code"&&j!==void 0&&(j.length>1||G),Se=y(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=L.useId();return e.jsxs("div",{className:C("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(U,{label:"Model",valueLabel:R?ce:(x==null?void 0:x.displayName)??A??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:A,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:y(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:R?ce:c&&!h?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Ze,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),p&&T&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:"Effort"}),(!r||!_)&&(S||_)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?D(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),H?e.jsx(B,{testId:"agent-effort-pending",text:`Checking what ${Y} supports`,warning:null}):z?_?e.jsx(U,{label:"Effort",valueLabel:D(X),options:Be.filter(t=>!(x!=null&&x.supportedEffortLevels)||x.supportedEffortLevels.includes(t)).map(t=>({value:t,label:D(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?D(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(B,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(B,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${Y}`,warning:y(["effort-unsupported-runtime"])})]}),Ce&&e.jsx(U,{label:"Account",valueLabel:W?$??"Default":g!==null?((de=j==null?void 0:j.find(t=>t.id===g))==null?void 0:de.label)??g:$??"Default",options:(j??[]).map(t=>({value:t.id,label:t.label,hint:t.id===N?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:G,serverDefault:$,warning:Se,onSelect:t=>P(t),onInherit:()=>P(null),testId:"agent-account-row",className:"col-span-full"}),W&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx(Me,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:I.isPending,onClick:()=>P(N),children:"Allow"})]})]})}function B({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const nt="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function ct({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(ze,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:nt,children:"Runs on"}),e.jsxs(Ke,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(qe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Qe,{})}),e.jsx(Ve,{children:f.map(o=>e.jsx(Fe,{value:o,responsive:!1,children:M(o).label},o))})]})]}),e.jsx(at,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ge,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{ct as RunsOnPopover};
|
|
1
|
+
import{r as D,ej as Ee,j as e,Z as ye,_ as we,a2 as Ae,G as C,by as ue,bz as fe,en as ke,eo as ie,a4 as Le,bA as me,bC as xe,a5 as De,a7 as Te,a8 as Oe,af as pe,aO as $e,ep as he,eq as Ie,er as Pe,es as _e,aa as N,et as Ue,eu as R,ev as Me,ao as be,B as Re,U as Be,b as He,e as ze,ew as Ke,ex as qe,ey as Qe,ez as Ve,eA as Fe,eB as Ge}from"./index-BR1m9FON.js";import{C as ce}from"./runtime-connect-Dn0T5YWv.js";import{a as We,d as Xe,k as Ye,e as L}from"./execution-config-BS5rtvTZ.js";import{U as Ze}from"./unverified-catalog-notice-C8swqaTn.js";import{s as Je}from"./settings-for-runtime-BoOa-ZFG.js";const et={duration:.12,ease:"easeOut"};function ve({isSetHere:a,serverDefault:l,onUseServerDefault:i,warning:r,className:s,"data-testid":d}){const[u,f]=D.useState(!1),o=a?"Set here":`Server default · ${l??"none"}`,n=a&&!!i,v=Ee(),p=e.jsx(ye,{mode:"wait",initial:!1,children:e.jsx(we.span,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:v?{duration:0}:et,className:"block truncate",children:o},o)});return n?e.jsxs(ue,{open:u,onOpenChange:f,children:[e.jsx(fe,{asChild:!0,children:e.jsx(ke,{size:"sm",icon:r?Le:void 0,iconClassName:r?ie.warning:void 0,"aria-label":`Set here${r?`: ${r}`:""}`,title:r?`${o}: ${r}`:o,className:s,"data-testid":d,children:p})}),e.jsxs(me,{className:"w-64 p-2",align:"start",children:[e.jsx(xe,{children:"Where this value comes from"}),r&&e.jsx("p",{className:C("px-2 pt-1 text-xs",ie.warning),children:r}),e.jsxs("button",{type:"button",onClick:()=>{i(),f(!1)},className:"hover:bg-accent mt-1 w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors","data-testid":d?`${d}-reset`:void 0,children:["Use server default",l?e.jsxs("span",{className:"text-muted-foreground block text-xs",children:["Currently ",l]}):e.jsx("span",{className:"text-muted-foreground block text-xs",children:"Not set. Uses the built-in default."})]})]})]}):e.jsx(Ae,{size:"xs",tone:r?"warning":"neutral",title:r?`${o}: ${r}`:o,"aria-label":r?`${o}: ${r}`:void 0,className:C("max-w-56",s),"data-testid":d,children:p})}const tt=["agents"];function st(a){const l=De(),i=Te();return Oe({...a!=null&&a.errorLabel?{meta:{errorLabel:a.errorLabel}}:{},mutationFn:r=>l.updateMeshAgent(r.id,r.updates),onSuccess:()=>{i.invalidateQueries({queryKey:["mesh","agents"]})},onSettled:()=>{i.invalidateQueries({queryKey:tt})}})}const je="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function U({label:a,valueLabel:l,options:i,selected:r,isSetHere:s,serverDefault:d,warning:u,onSelect:f,onInherit:o,testId:n,showHeader:v=!0,className:p,describedBy:m,inheritText:T}){const w=pe(),[S,h]=D.useState(!1);return e.jsxs("div",{className:C("space-y-1",p),children:[v&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:a}),!w&&e.jsx(ve,{isSetHere:s,serverDefault:d,warning:u,onUseServerDefault:o,"data-testid":`${n}-chip`})]}),e.jsxs(ue,{open:S,onOpenChange:h,children:[e.jsx(fe,{asChild:!0,children:e.jsxs("button",{type:"button",className:"border-input hover:bg-accent flex h-8 w-full items-center gap-1 rounded-md border px-2 text-sm transition-colors",...m?{"aria-describedby":m}:{},"data-testid":n,children:[e.jsx("span",{className:C("truncate",u?"text-status-warning-fg":s?"md:text-foreground text-status-warning-fg":"md:text-foreground text-status-success-fg"),children:l}),e.jsx(Be,{className:"text-muted-foreground ml-auto size-3.5 shrink-0"})]})}),e.jsxs(me,{className:"w-64 p-1",align:"start",children:[e.jsx(xe,{children:a}),e.jsx("div",{className:"max-h-72 overflow-y-auto",children:i.map(c=>e.jsxs("button",{type:"button","data-testid":`${n}-option-${c.value}`,onClick:()=>{f(c.value),h(!1)},className:C("hover:bg-accent w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors",c.value===r&&"bg-accent"),children:[c.label,c.hint&&e.jsx("span",{className:"text-muted-foreground block text-xs",children:c.hint})]},c.value))}),e.jsx("button",{type:"button",onClick:()=>{o(),h(!1)},className:"hover:bg-accent border-border text-muted-foreground mt-1 w-full border-t px-2 py-2 text-left text-xs transition-colors","data-testid":`${n}-inherit`,children:T??(d?`Use server default: ${d}`:"Use server default")})]})]})]})}function at({agent:a,onUpdate:l,className:i}){var ee,te,se,ae,ne,oe,le,re,de;const r=pe(),{data:s}=$e(),{data:d,isPending:u}=he(),f=((ee=s==null?void 0:s.executionDefaults)==null?void 0:ee.runtime)??"claude-code",o=a.runtime??f,n=(te=s==null?void 0:s.executionDefaults)==null?void 0:te.perRuntime.find(t=>t.runtime===o),{data:v}=Ie(),p=We(a,{defaultRuntime:f,runtimeDeclaresCredits:t=>{var b;return((b=d==null?void 0:d.capabilities[t])==null?void 0:b.credits)!==void 0},credits:(se=s==null?void 0:s.claudeCode)==null?void 0:se.credits,runtimeDefaultsToCredits:t=>{var b,k;return((k=(b=v==null?void 0:v.defaults)==null?void 0:b[t])==null?void 0:k.runsOn)==="credits"}}),{data:m,isError:T}=Pe({runtime:o,...p?{account:N}:{}}),w=a.model!=null,S=a.effort!=null,h=(n==null?void 0:n.model)??null,c=p&&(m??[]).some(t=>t.paidFromCredits),E=c?(m??[]).find(t=>t.isDefault):void 0,A=a.model??h??(E==null?void 0:E.value)??null,B=o==="doe"&&c&&!w&&!h,x=A?(m??[]).find(t=>t.value===A):void 0,O=(n==null?void 0:n.supportsEffort)??((ae=Je(d,o))==null?void 0:ae.supportsEffort),H=O===void 0&&u,z=O!==!1,K=x?x.supportsEffort??!1:void 0,q=(ne=s==null?void 0:s.claudeCode)==null?void 0:ne.accounts,{nameFor:Q,creditsEntry:ge,resolvedAccount:V}=_e(),F=ge??(a.account===N&&((oe=s==null?void 0:s.claudeCode)!=null&&oe.credits)?{path:s.claudeCode.credits.path}:null),j=q&&[...q.flatMap(t=>t.id===null?[]:[{id:t.id,label:Q(t.path),path:t.path}]),...F?[{id:N,label:Ue,path:F.path}]:[]],g=a.account??null,G=g!==null,W=o==="claude-code"&&g===N&&((le=s==null?void 0:s.claudeCode)==null?void 0:le.credits)!==void 0&&!s.claudeCode.credits.allowedAgents.includes(a.id),$=s!=null&&s.claudeCode&&V?Q(V):null,I=st({errorLabel:"Couldn’t change this agent’s account"}),P=D.useCallback(t=>{I.mutate({id:a.id,updates:{account:t}})},[a.id,I]),Ne=Xe({agent:{runtime:a.runtime,model:a.model,effort:a.effort,account:a.account},defaultRuntime:f,serverDefaultModel:h,knownModels:Ye(m),knownAccounts:j,accountsUnavailable:(re=s==null?void 0:s.claudeCode)==null?void 0:re.accountsUnavailable,modelSupportsEffort:K,runtimeSupportsEffort:O,runtimeLabel:t=>R(t).label}),y=t=>{var b;return((b=Ne.breakages.find(k=>t.includes(k.kind)))==null?void 0:b.message)??null},_=!H&&z&&K!==!1,X=a.effort??(n==null?void 0:n.effort)??null,Y=R(o).label,Ce=o==="claude-code"&&j!==void 0&&(j.length>1||G),Se=y(["account-unregistered"]),Z=(m??[]).some(t=>t.unverified),J=D.useId();return e.jsxs("div",{className:C("grid grid-cols-2 gap-3",i),children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(U,{label:"Model",valueLabel:B?ce:(x==null?void 0:x.displayName)??A??(c?"Default":"Automatic"),options:[...(m??[]).map(t=>({value:t.value,label:t.displayName,hint:t.description}))],selected:A,isSetHere:w,serverDefault:(n==null?void 0:n.model)??null,warning:y(["model-unavailable"]),onSelect:t=>l({model:t}),onInherit:()=>l({model:null}),testId:"agent-model-row",describedBy:Z?J:void 0,inheritText:B?ce:c&&!h?E?`Use the suggested model: ${E.displayName}`:"Use the default model":void 0}),Z&&e.jsx(Ze,{id:J}),c&&(m??[]).some(t=>t.creditsListOutOfDate)&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-out-of-date",children:"The models your DorkOS credits cover may be out of date."}),p&&T&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"agent-credits-models-unavailable",children:"Couldn’t load the models DorkOS credits cover. Try again in a moment."})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:je,children:"Effort"}),(!r||!_)&&(S||_)&&e.jsx(ve,{isSetHere:S,serverDefault:n!=null&&n.effort?L(n.effort):null,warning:y(["effort-unsupported-runtime","effort-unsupported-model"]),onUseServerDefault:()=>l({effort:null}),"data-testid":"agent-effort-row-chip"})]}),H?e.jsx(M,{testId:"agent-effort-pending",text:`Checking what ${Y} supports`,warning:null}):z?_?e.jsx(U,{label:"Effort",valueLabel:L(X),options:Me.filter(t=>!(x!=null&&x.supportedEffortLevels)||x.supportedEffortLevels.includes(t)).map(t=>({value:t,label:L(t)})),selected:X,isSetHere:S,serverDefault:n!=null&&n.effort?L(n.effort):null,warning:null,showHeader:!1,onSelect:t=>l({effort:t}),onInherit:()=>l({effort:null}),testId:"agent-effort-row"}):e.jsx(M,{testId:"agent-effort-unsupported-model",text:"This model doesn’t take an effort setting",warning:y(["effort-unsupported-model"])}):e.jsx(M,{testId:"agent-effort-unsupported-runtime",text:`Not supported by ${Y}`,warning:y(["effort-unsupported-runtime"])})]}),Ce&&e.jsx(U,{label:"Account",valueLabel:W?$??"Default":g!==null?((de=j==null?void 0:j.find(t=>t.id===g))==null?void 0:de.label)??g:$??"Default",options:(j??[]).map(t=>({value:t.id,label:t.label,hint:t.id===N?"Paid from your DorkOS account":be(t.path)})),selected:g,isSetHere:G,serverDefault:$,warning:Se,onSelect:t=>P(t),onInherit:()=>P(null),testId:"agent-account-row",className:"col-span-full"}),W&&e.jsxs("div",{className:"text-muted-foreground col-span-full flex flex-wrap items-center gap-2 text-xs","data-testid":"agent-credits-not-allowed",children:[e.jsx("span",{children:"This agent’s settings name DorkOS credits. It uses your default until you allow it."}),e.jsx(Re,{size:"sm",variant:"outline",className:"h-6 px-2 text-xs",disabled:I.isPending,onClick:()=>P(N),children:"Allow"})]})]})}function M({text:a,warning:l,testId:i}){return e.jsxs("div",{className:"flex h-8 flex-col justify-center","data-testid":i,children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:a}),l&&e.jsx("p",{className:"text-status-warning-fg text-xs",children:l})]})}const nt="text-muted-foreground text-3xs font-medium tracking-wider uppercase";function ct({member:a}){const{agent:l,projectPath:i,isPending:r,update:s}=He(a),{data:d}=he();if(r)return e.jsx(ze,{className:"h-24 w-full"});if(!l)return e.jsx("p",{className:"text-muted-foreground p-1 text-sm",children:"Couldn’t read this agent’s settings."});const u=d?Object.keys(d.capabilities):[l.runtime],f=u.includes(l.runtime)?u:[l.runtime,...u];return e.jsxs("div",{className:"space-y-3 p-1","data-slot":"profile-runs-on",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:nt,children:"Runs on"}),e.jsxs(Ke,{value:l.runtime??"claude-code",onValueChange:o=>s({runtime:o}),children:[e.jsx(qe,{className:"h-8 text-sm",responsive:!1,children:e.jsx(Qe,{})}),e.jsx(Ve,{children:f.map(o=>e.jsx(Fe,{value:o,responsive:!1,children:R(o).label},o))})]})]}),e.jsx(at,{agent:l,onUpdate:s,className:"grid-cols-1"}),i&&e.jsxs("div",{className:"text-muted-foreground flex min-w-0 items-center gap-1.5",children:[e.jsx(Ge,{"aria-hidden":!0,className:"size-3.5 shrink-0"}),e.jsx("span",{className:"min-w-0 truncate font-mono text-xs",children:be(i)})]})]})}export{ct as RunsOnPopover};
|
package/dist/client/assets/{RuntimeConnectFlow-Dc5a8dlJ.js → RuntimeConnectFlow-BYQnY5vv.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aO as Pe,a5 as b,a7 as T,r as u,a8 as I,ko as q,kp as M,et as Be,kq as Ge,a6 as Q,j as e,kr as We,eH as Ye,eI as H,Q as we,T as Re,V as Ie,B as O,i2 as He,G as V,f6 as Ve,er as Je,ks as Ze,kt as Xe,ek as Le,_ as te,x as de,Z as es,J as ue,ev as me,eE as C,eF as ne,aJ as ss,ku as ts,I as U,kv as ns,kw as Ae,kx as rs,a2 as Ke,fQ as as,ex as is,ey as os,ez as ls,eA as cs,eB as be,en as ds,C as us,ky as ms,kz as xs,kA as hs,U as fs}from"./index-BwTGkJbK.js";import{C as De}from"./copy-button-DjAoGwds.js";import{I as gs}from"./inline-code-DyTKSC5b.js";import{u as ps}from"./useMutationState-B_x_4f2K.js";import{O as ys,a as Y}from"./runtime-connect-Dn0T5YWv.js";function vs(){var s;return((s=Pe().data)==null?void 0:s.isLocalCaller)!==!1}function Ot(){const s=Pe().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Et(s){var d,m;const t=b(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:()=>(a(null),t.provisionRuntime(s,x=>a(x))),onSuccess:x=>{x.ok&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((d=r.data)==null?void 0:d.ok)===!1,o=r.isError?r.error.message:((m=r.data)==null?void 0:m.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Te(s){return["runtime-key-status",s]}function js(s,t=!0){const n=b();return Q({queryKey:Te(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function ks(s){const t=b(),n=I({mutationFn:a=>t.checkRuntimeCredential(s,a.trim().length>0?a:null),meta:{suppressErrorToast:!0}}),i=n.data??(n.isError?{ok:!1,reason:"unexpected",message:n.error.message||"Couldn’t check the key."}:null);return{check:a=>n.mutate(a),isPending:n.isPending,result:i,checkedSavedKey:i!==null&&(n.variables??"").trim().length===0,reset:n.reset}}function Ns(s){var o,c,d;const t=b(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:async m=>{a("checking");const x=await t.checkRuntimeCredential(s,m);return x.ok?(a("saving"),await t.storeRuntimeCredential(s,m),{saved:!0,message:null}):{saved:!1,message:x.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:m=>{m.saved&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Te(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:m=>{m.trim().length!==0&&r.mutate(m)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((d=r.data)==null?void 0:d.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function bs(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function Ss(s,t){var P,K,L,S,j;const n=b(),i=T(),{sessionId:a,accountRoot:r,accountId:l,onCompleted:o}=t??{},c=Be(),d=l??(r?((P=c.accounts.find(N=>N.path===r))==null?void 0:P.id)??(c.ownResolvedAccount===r?"default":void 0):a?void 0:"default"),m=u.useMemo(()=>["runtime-login",s,a??"",d??r??""],[s,a,d,r]),x=I({mutationKey:m,mutationFn:()=>{if(s==="claude-code"&&r&&!d&&!a)throw new Error("Choose this account in Runtimes.");return n.delegateRuntimeLogin(s,s==="claude-code"?{sessionId:a,accountId:d}:a?{sessionId:a}:void 0)},onSuccess:N=>{i.invalidateQueries({queryKey:["claude-signin-policy"]}),N.ok&&(i.invalidateQueries({queryKey:Ge.all}),i.invalidateQueries({queryKey:[...q]}),i.invalidateQueries({queryKey:[...M]}))}}),p=ps({filters:{mutationKey:m,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),y=p.some(N=>N.state.status==="pending"),f=p[p.length-1],h=y||f==null?void 0:f.state,k=y||f==null?void 0:f.id,w=!y&&((h==null?void 0:h.status)==="error"||((K=h==null?void 0:h.data)==null?void 0:K.ok)===!1),F=(h==null?void 0:h.status)==="error"?((L=h.error)==null?void 0:L.message)??null:((S=h==null?void 0:h.data)==null?void 0:S.error)??null,R=((j=h==null?void 0:h.data)==null?void 0:j.ok)===!0,E=u.useRef(o);return E.current=o,u.useEffect(()=>{var _;if(!R||k===void 0)return;const N=bs(i);N.has(k)||(N.add(k),(_=E.current)==null||_.call(E))},[R,k,i]),{login:()=>{y||x.mutate()},isPending:y,isSuccess:R,isError:w,errorMessage:w?F??"Couldn’t sign in. Try again.":null}}const Ce={"claude-code":{signInLabel:"Sign in",otherWayLabel:"Sign in with Claude",signInHint:"Use your Claude subscription or Anthropic account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"Anthropic API key",keyPlaceholder:"sk-ant-…",getKeyUrl:"https://console.anthropic.com/settings/keys"},codex:{signInLabel:"Sign in with ChatGPT",otherWayLabel:"Sign in with ChatGPT",signInHint:"Use your ChatGPT account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"OpenAI API key",keyPlaceholder:"sk-…",getKeyUrl:"https://platform.openai.com/api-keys"}};function Cs(s){return Ce[s]??Ce["claude-code"]}function Os({command:s,infoUrl:t,copyLabel:n}){return!s&&!t?null:e.jsxs("div",{className:"space-y-2",children:[s&&e.jsxs("div",{className:"bg-muted flex items-center justify-between gap-2 rounded-lg px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(We,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(De,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(Ye,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(H,{className:"size-3"})]})]})}function Pt({command:s,runtimeLabel:t}){const[n,i]=u.useState(!1);return e.jsxs(we,{open:n,onOpenChange:i,className:"mt-2",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["DorkOS installs ",t," for you."," ",e.jsx(Re,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Ie,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(gs,{children:s}),e.jsx(De,{value:s,label:`Copy command: ${s}`,className:"shrink-0"})]})]})}function Oe({onRetry:s}){return e.jsxs("div",{"data-testid":"remote-signin-notice",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Signing in needs the computer DorkOS runs on."}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s?"Sign in to DorkOS there, then press Retry.":"Sign in to DorkOS there."}),e.jsx("p",{className:"text-muted-foreground/80 mt-2 text-xs",children:"Already on that computer? Open DorkOS at localhost instead."}),s&&e.jsxs(O,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(He,{className:"size-3"}),"Retry"]})]})}function Es({ollama:s=!1,remote:t=!1,className:n}){return e.jsxs("p",{className:V("text-muted-foreground text-xs",n),"data-testid":"keep-it-local-note",children:[t?"Prefer everything on the computer DorkOS runs on? Use your own sign-in there":"Prefer to keep everything on this computer? Use your own sign-in",s?", or Ollama":"","."]})}function Ps(s){const t=Ve(),{data:n}=Je();return s?Ze(Xe(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",ws={title:xe,body:`Frontier models are unlocked. ${he}`},Rs={title:xe,body:he},Ee={title:xe,body:`Your local models are ready. ${he}`};function Me(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function Is(s){return{title:`${s} is ready`,body:`New work on ${s} runs on your DorkOS credits. Change it any time in Settings › Runtimes.`}}function A({message:s}){const t=Le();return e.jsxs(te.div,{role:"status",className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:t?!1:{opacity:0},animate:{opacity:1},"data-testid":"connect-progress",children:[e.jsx(de,{size:"xs",className:V("text-muted-foreground shrink-0",t&&"animate-none")}),e.jsx(es,{mode:"wait",children:e.jsx(te.span,{className:"truncate text-xs",initial:t?!1:{opacity:0},animate:{opacity:1},exit:t?void 0:{opacity:0},transition:{duration:.2},children:s},s)})]})}function z({message:s="Connected"}){return e.jsxs("div",{role:"status",className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"connect-connected",children:[e.jsx(ue,{className:"size-3.5"}),s]})}function B({message:s,onRetry:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:s}),e.jsx(O,{size:"sm",onClick:t,children:"Try again"})]})}function Ls({type:s,onConnected:t,asOtherWay:n=!1}){const i=Cs(s),a=Ss(s),[r,l]=u.useState(!1),o=u.useRef(!1);return u.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Me(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(z,{message:"Signed in"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(O,{size:"sm",variant:n?"outline":"default",className:"w-full",onClick:a.login,children:n?i.otherWayLabel:i.signInLabel}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i.signInHint})]})}),r?e.jsxs("div",{className:"space-y-3","data-testid":`login-connect-key-${s}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),e.jsx(As,{type:s,copy:i,onConnected:t}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Back to sign in"})]}):n?e.jsx(O,{size:"sm",variant:"outline",className:"w-full",onClick:()=>l(!0),"data-testid":`login-connect-use-key-${s}`,children:"Paste a key"}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors","data-testid":`login-connect-use-key-${s}`,children:"Use an API key instead"})]})}function As({type:s,copy:t,onConnected:n}){var f,h;const[i,a]=u.useState(""),r=Ns(s),l=js(s),o=ks(s),c=u.useRef(!1),d=u.useRef(null);if(u.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Me(me(s).label)))},[r.isSuccess,n,s]),u.useEffect(()=>{var k;r.isError&&((k=d.current)==null||k.focus())},[r.isError]),r.isSuccess)return e.jsx(z,{});const m=(f=l.data)!=null&&f.key.saved?l.data.key:null,x=i.trim().length>0,p=r.isPending||o.isPending,y=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:k=>{k.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(C,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:d,value:i,disabled:p,onChange:k=>{a(k.target.value),y()},placeholder:m?`Saved key ends in ${m.last4}. Paste to replace.`:t.keyPlaceholder,autoComplete:"off",spellCheck:!1}),r.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:r.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.getKeyUrl?e.jsxs("a",{href:t.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(H,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"ghost",disabled:!x&&m===null||p,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:!x||p,children:"Save key"})]})]}),p?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((h=o.result)==null?void 0:h.ok)===!0?e.jsx(z,{message:o.checkedSavedKey?"Your saved key works":"Key works"}):o.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o.result.message}):null]})}function Ks(s){const t=b(),n=Q({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference()});return n.isPending?e.jsx(de,{"aria-label":"Loading model settings"}):n.isError?e.jsx("p",{role:"alert",children:"Couldn’t load model settings. Try again."}):e.jsx(Ds,{saved:n.data,...s},JSON.stringify(n.data))}function Ds({saved:s,onConnected:t,onSave:n}){var D,Z,W,X,v,$,fe,ge,pe,ye,ve,je;const i=b(),a=T(),r=u.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=u.useState(n&&l==="dorkos-credits"?"api-key":l),[d,m]=u.useState(((Z=s.inference)==null?void 0:Z.protocol)??"openai-chat-completions"),[x,p]=u.useState(((W=s.inference)==null?void 0:W.endpoint)??""),[y,f]=u.useState(((X=s.inference)==null?void 0:X.provider)??""),[h,k]=u.useState(((v=s.inference)==null?void 0:v.model)??""),[w,F]=u.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[R,E]=u.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[P,K]=u.useState(""),[L,S]=u.useState(null),j=Q({queryKey:["doe-credits-models",d],queryFn:()=>i.getDoeCreditsModels(d),enabled:o==="dorkos-credits"}),N=o==="dorkos-credits"?(ge=j.data)==null?void 0:ge.models.find(g=>g.id===h):void 0,_=s.hasKey&&((pe=s.inference)==null?void 0:pe.endpoint)===x&&s.inference.source==="api-key",J=I({mutationFn:async g=>{if(n)return n(g,P.trim()||null);o==="api-key"&&P.trim()?await i.storeDoeCredential(g,P.trim()):await i.setDoeInference(g),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{K("");for(const g of[["doe-inference"],q,M,ss.all,ts.status()])a.invalidateQueries({queryKey:g});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:g=>S(n&&g instanceof Error&&g.message?g.message:"Couldn’t save model settings. Try again.")});function re(g){var ke,Ne;if(g.preventDefault(),S(null),P.trim().startsWith("sk-ant-oat")){S("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!P.trim()&&!_){S("Enter an API key.");return}if(o==="dorkos-credits"&&(!N||!((ke=j.data)!=null&&ke.endpoint))){S("Link DorkOS credits and choose an available model.");return}const ae=ns.safeParse({source:o,protocol:d,provider:o==="dorkos-credits"?"dorkos":y,endpoint:o==="dorkos-credits"?(Ne=j.data)==null?void 0:Ne.endpoint:x,model:h,contextWindow:(N==null?void 0:N.contextWindow)??Number(w),maxOutputTokens:(N==null?void 0:N.maxOutputTokens)??Number(R)});if(!ae.success){S("Check the model, endpoint, and token limits.");return}J.mutate(ae.data)}const G="bg-background border-input focus-visible:ring-ring h-11 w-full rounded-md md:h-9 border px-3 text-sm focus-visible:ring-2";return e.jsxs("form",{onSubmit:re,className:"space-y-3","aria-label":"DorkOS model settings",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:G,value:o,onChange:g=>{c(g.target.value),k("")},children:[e.jsx("option",{value:"api-key",children:"My API key"}),e.jsx("option",{value:"local",children:"Local model"}),!n&&e.jsx("option",{value:"dorkos-credits",children:"DorkOS credits"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:G,value:d,onChange:g=>{m(g.target.value),o==="dorkos-credits"&&k("")},children:[e.jsx("option",{value:"openai-chat-completions",children:"OpenAI Chat Completions"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"})]})]}),o==="dorkos-credits"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:G,value:h,onChange:g=>k(g.target.value),disabled:j.isPending||!((ye=j.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(ve=j.data)==null?void 0:ve.models.map(g=>e.jsx("option",{value:g.id,children:g.displayName},g.id))]}),!((je=j.data)!=null&&je.endpoint)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link DorkOS credits in Settings to choose a model."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(U,{id:`${r}-service`,value:y,onChange:g=>f(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(U,{id:`${r}-endpoint`,type:"url",value:x,onChange:g=>p(g.target.value),required:!0}),o==="local"&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Use a loopback address. No API key is needed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(U,{id:`${r}-model`,value:h,onChange:g=>k(g.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(U,{id:`${r}-context`,type:"number",min:1,value:w,onChange:g=>F(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(U,{id:`${r}-output`,type:"number",min:1,value:R,onChange:g=>E(g.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:P,onChange:g=>K(g.target.value),autoComplete:"off"}),_&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"API key saved. Leave blank to keep it."})]})]}),L&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:L}),e.jsx(O,{type:"submit",disabled:J.isPending,children:J.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ts={openai:"OpenAI",anthropic:"Anthropic"};function Ms(s){return Ts[s]??s}function qs(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ms(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function Fs(s){const t=b();return Q({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function $s(){const s=b(),t=T(),n=I({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]})}});return{connect:i=>n.mutate(i),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,errorMessage:n.isError?n.error.message??"Couldn’t connect to Ollama.":null}}const $e=["runtime-connect","opencode","direct"];function _s(){const s=b();return Q({queryKey:$e,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function Us(){var i;const s=b(),t=I({mutationFn:({providerId:a,key:r,baseURL:l})=>s.checkProviderCredential(a,r.trim().length>0?r:null,(l==null?void 0:l.trim())||null),meta:{suppressErrorToast:!0}}),n=t.data??(t.isError?{ok:!1,reason:"unexpected",message:t.error.message||"Couldn’t check the key."}:null);return{check:a=>t.mutate(a),isPending:t.isPending,result:n,checkedSavedKey:n!==null&&(((i=t.variables)==null?void 0:i.key)??"").trim().length===0,reset:t.reset}}function zs(){var l,o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async({providerId:d,key:m,baseURL:x})=>{const p=(x==null?void 0:x.trim())||null;i("checking");const y=await s.checkProviderCredential(d,m.trim().length>0?m:null,p);return y.ok?(i("saving"),await s.storeProviderCredential(d,m,p),{saved:!0,message:null}):{saved:!1,message:y.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[...$e]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:d=>{d.providerId.trim().length!==0&&a.mutate(d)},isPending:a.isPending,phase:n,isSuccess:((o=a.data)==null?void 0:o.saved)===!0,isError:a.isError||r,errorMessage:r?((c=a.data)==null?void 0:c.message)??null:a.isError?a.error.message??"Couldn’t save your key.":null,reset:a.reset}}function Qs(s){const t=b();return Q({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Bs(){var o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async d=>{i(null);const m=await s.pullOllamaModel(d,x=>i(x));return m.ok&&await s.updateConfig({runtimes:{opencode:{provider:qe}}}),m},onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{pull:d=>a.mutate(d),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Gs(){var o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:()=>(i(null),s.provisionOllama(d=>i(d))),onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{provision:()=>a.mutate(),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t install Ollama.":null,progress:n,result:a.data}}const Ws="https://ollama.com/download",Ys="curl -fsSL https://ollama.com/install.sh | sh";function Hs({installMethod:s}){const t=Gs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Vs,{}),n?e.jsx(Js,{provision:t}):e.jsx(Zs,{}),e.jsx(Xs,{})]})}function Vs(){const s=Ae();return e.jsxs("div",{className:"space-y-1.5","data-testid":"ollama-explainer",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Run AI models on ",s]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Ollama is a free app that runs AI models on ",s,"."]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Nothing you type leaves ",s,"."]})]})}function Js({provision:s}){var t,n,i;return s.isPending?e.jsx(A,{message:((t=s.progress)==null?void 0:t.message)??"Installing Ollama…"}):(n=s.result)!=null&&n.ok?(i=s.result.status)!=null&&i.running?e.jsx(A,{message:"Ollama is ready…"}):e.jsx("p",{className:"text-xs","data-testid":"ollama-installed-not-running",children:"Ollama isn’t running. Open the Ollama app to start it."}):s.isError?e.jsx(B,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(O,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Zs(){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-manual-install",children:[e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Installing Ollama needs administrator access. Run this in a terminal:"}),e.jsx(Os,{command:Ys,copyLabel:"Copy the Ollama install command"})]})}function Xs(){return e.jsxs("a",{href:Ws,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Or download Ollama from ollama.com ",e.jsx(H,{className:"size-3"})]})}const et="https://ollama.com/library",st={"runs-well":{label:"Runs well on your machine",tone:"text-status-success-fg"},"may-be-slow":{label:"May be slow on your machine",tone:"text-status-warning-fg"},"too-large":{label:"Too large for your machine",tone:"text-destructive"}},tt={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function nt({active:s,onConnected:t,onConnectDirectly:n}){var R,E,P,K,L,S;const i=Fs(s),a=$s(),r=Bs(),l=((R=i.data)==null?void 0:R.running)??!1,o=Qs(l),[c,d]=u.useState(null),[m,x]=u.useState(null);u.useEffect(()=>{a.isSuccess&&(t==null||t(Ee))},[a.isSuccess,t]),u.useEffect(()=>{var j;(j=r.result)!=null&&j.ok&&(t==null||t(Ee))},[(E=r.result)==null?void 0:E.ok,t]);const p=j=>{d(j),a.connect(j)},y=j=>{x(j),r.pull(j)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Hs,{installMethod:(P=i.data)==null?void 0:P.installMethod});if(a.isSuccess)return t?null:e.jsx(z,{message:"Connected to Ollama"});if((K=r.result)!=null&&K.ok)return t?null:e.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"guided-pull-connected",children:[e.jsx(ue,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Connected:"}),e.jsx(rs,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const f=i.data,h=(f==null?void 0:f.installed)??[],k=((L=f==null?void 0:f.installed)==null?void 0:L.length)??(f==null?void 0:f.models.length)??0,w=((S=o.data)==null?void 0:S.models.some(j=>j.model.id===m))??!1,F=m!==null&&!w?m:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(rt,{count:k}),h.length>0&&e.jsx(at,{installed:h,connect:a,connectingId:c,onUse:p}),e.jsx(it,{catalogQuery:o,pull:r,pullingId:m,onGet:y}),e.jsx(ot,{pull:r,activePull:F,onSubmit:y}),e.jsx(lt,{}),n&&e.jsxs("button",{type:"button",onClick:n,"data-testid":"local-connect-directly",className:"focus-ring text-muted-foreground hover:text-foreground block rounded-md text-left text-xs transition-colors",children:["Using LM Studio or another server? ",e.jsx("span",{className:"underline",children:"Connect it directly"})]})]})}function rt({count:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-xs","data-testid":"ollama-status-line",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-emerald-500","aria-hidden":!0}),e.jsxs("span",{children:["Ollama is running · ",s," ",s===1?"model":"models"," installed"]})]})}function _e({verdict:s,explanation:t}){const n=st[s];return e.jsxs("div",{"data-testid":"ollama-verdict","data-verdict":s,children:[e.jsx("p",{className:V("text-xs font-medium",n.tone),children:n.label}),e.jsx("p",{className:"text-muted-foreground/80 text-2xs leading-snug",children:t})]})}function Ue({tier:s}){return e.jsx(Ke,{size:"xs",variant:"outline",className:"font-normal",children:tt[s]})}function at({installed:s,connect:t,connectingId:n,onUse:i}){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-installed",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Installed"}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>{const r=n===a.id&&t.isPending,l=n===a.id&&t.isError,o=()=>i(a.id);let c=e.jsx(O,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(B,{message:t.errorMessage??"Couldn’t connect to Ollama.",onRetry:o})),e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"ollama-installed-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:a.id}),a.assessment.model.tier&&e.jsx(Ue,{tier:a.assessment.model.tier})]}),e.jsx(_e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function it({catalogQuery:s,pull:t,pullingId:n,onGet:i}){var r;if(s.isPending)return e.jsx(A,{message:"Checking which models fit your machine…"});const a=((r=s.data)==null?void 0:r.models)??[];return s.isError||a.length===0?null:e.jsxs("div",{className:"space-y-2","data-testid":"ollama-shelf",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add a model"}),e.jsx("ul",{className:"space-y-1.5",children:a.map(({model:l,verdict:o,explanation:c})=>{const d=n===l.id,m=()=>i(l.id);return d&&(t.isPending||t.isError)?e.jsxs("li",{className:"border-border rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:l.label}),t.isPending?e.jsx(ze,{progress:t.progress}):e.jsx(B,{message:t.errorMessage??"Couldn’t download the model.",onRetry:m})]},l.id):e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:l.label}),l.tier&&e.jsx(Ue,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx(_e,{verdict:o,explanation:c})]}),e.jsx(O,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:m,children:"Get"})]},l.id)})})]})}function ot({pull:s,activePull:t,onSubmit:n}){const[i,a]=u.useState(""),r=i.trim(),l=ys.test(r);if(t&&s.isPending)return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Downloading ",t,"…"]}),e.jsx(ze,{progress:s.progress})]});const o=c=>{c.preventDefault(),l&&n(r)};return e.jsxs("form",{onSubmit:o,className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"ollama-pull-tag",className:"text-xs font-normal",children:"Download any model by name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{id:"ollama-pull-tag","data-testid":"ollama-pull-by-name",value:i,onChange:c=>a(c.target.value),placeholder:"qwen2.5-coder:32b","aria-invalid":r.length>0&&!l}),e.jsx(O,{type:"submit",size:"sm",disabled:!l||s.isPending,children:"Download"})]}),r.length>0&&!l&&e.jsxs("p",{className:"text-muted-foreground text-2xs",children:["Use a tag like ",e.jsx("code",{className:"text-2xs",children:"qwen2.5-coder:32b"}),"."]}),t&&s.isError&&e.jsx(B,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function lt(){return e.jsxs("a",{href:et,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Browse the library ",e.jsx(H,{className:"size-3"})]})}function ze({progress:s}){const t=Le(),n=s==null?void 0:s.percent,i=(s==null?void 0:s.status)??"Starting download…";return e.jsxs("div",{className:"space-y-2","data-testid":"guided-pull-progress",children:[e.jsx("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:n===void 0?e.jsx(te.div,{className:"bg-primary/70 h-full w-1/3 rounded-full",animate:t?{}:{x:["-100%","300%"]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"}}):e.jsx(te.div,{className:"bg-primary h-full rounded-full",initial:!1,animate:{width:`${Math.min(100,Math.max(0,n))}%`},transition:t?{duration:0}:{duration:.3,ease:"easeOut"},"data-testid":"guided-pull-bar"})}),e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.jsx(de,{size:"xs",className:V("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function ct(){var r,l,o;const s=b(),t=T(),n=I({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))}}),i=n.isError||((r=n.data)==null?void 0:r.ok)===!1,a=n.isError?n.error.message:((l=n.data)==null?void 0:l.error)??null;return{store:c=>{c.trim().length!==0&&n.mutate(c)},isPending:n.isPending,isSuccess:((o=n.data)==null?void 0:o.ok)===!0,isError:i,errorMessage:i?a??"Couldn’t save the OpenRouter key.":null}}function dt(){var p,y;const s=b(),t=T(),[n,i]=u.useState(null),[a,r]=u.useState(null),l=I({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:f,state:h})=>{if(!as(f)){r("Couldn’t open the OpenRouter sign-in page.");return}i(h)},onError:f=>r(f.message??"Couldn’t start OpenRouter sign-in.")}),o=Q({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="pending"?1500:!1},refetchOnWindowFocus:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="error"}}),c=(p=o.data)==null?void 0:p.status;u.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const d=l.isPending||n!==null&&c==="pending",m=!!a||c==="error",x=m?a??((y=o.data)==null?void 0:y.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:d,isSuccess:c==="connected",isError:m,errorMessage:x}}const ut="https://openrouter.ai/keys";function mt({onConnected:s}){const[t,n]=u.useState(""),i=ct(),a=dt(),r=i.isSuccess||a.isSuccess;return u.useEffect(()=>{r&&(s==null||s(ws))},[r,s]),r?e.jsx(z,{message:"Connected to OpenRouter"}):e.jsxs("div",{className:"space-y-4","data-testid":"openrouter-gateway",children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:"Sign in to OpenRouter in the new tab…"}):a.isError?e.jsx(B,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(O,{size:"sm",className:"w-full",onClick:a.begin,children:"Connect OpenRouter"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Makes a limited key for you."})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),i.isPending?e.jsx(A,{message:"Checking your OpenRouter key…"}):e.jsxs("form",{className:"space-y-2",onSubmit:l=>{l.preventDefault(),i.store(t)},children:[e.jsx(C,{htmlFor:"openrouter-key",className:"text-xs",children:"OpenRouter key"}),e.jsx(ne,{id:"openrouter-key",value:t,onChange:l=>n(l.target.value),placeholder:"sk-or-…",autoComplete:"off",spellCheck:!1}),i.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:i.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("a",{href:ut,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an OpenRouter key ",e.jsx(H,{className:"size-3"})]}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function ee(s){return Y.find(t=>t.id===s)}function xt(s){var t;return((t=ee(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=Y.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??Y[0].defaultBaseURL}function Qe(s){return Y.some(t=>t.id===s.providerId)}function ie(s){return Qe(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function ht({onConnected:s}){const t=_s();return t.isError&&!t.data?e.jsx(B,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ft,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ft({setup:s,onConnected:t}){var X;const n=Qe(s)?s:null,[i,a]=u.useState(()=>ie(s)),[r,l]=u.useState(""),[o,c]=u.useState(()=>{var v;return(n==null?void 0:n.baseURL)??((v=ee(ie(s)))==null?void 0:v.defaultBaseURL)??""}),[d,m]=u.useState(()=>{var $;const v=ie(s);return v!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=ee(v))==null?void 0:$.defaultBaseURL)}),x=zs(),p=Us(),y=ee(i),f=xt(i),h=n!=null&&n.key.saved&&n.providerId===f?n.key.last4:null,k=o.trim(),w=i===se,F=!w||k.length>0,R=ce(f),E=k||R,P=E===R?"":E,K=n===null?null:n.baseURL??ce(n.providerId),L=f!==((n==null?void 0:n.providerId)??null)||E!==K,S=r.trim().length>0,N=(S||h!==null&&!L)&&F,_=S&&F,J=!S&&h!==null&&L,re=E.startsWith("http://"),G={providerId:f,key:r,baseURL:P},D=x.isPending||p.isPending,Z=u.useRef(null),W=()=>{p.reset(),x.reset()};return u.useEffect(()=>{x.isSuccess&&(t==null||t(Rs))},[x.isSuccess,t]),u.useEffect(()=>{var v;x.isError&&((v=Z.current)==null||v.focus())},[x.isError]),x.isSuccess?e.jsx(z,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:v=>{v.preventDefault(),p.reset(),x.connect(G)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(is,{value:i,disabled:D,onValueChange:v=>{var $;a(v),c((($=ee(v))==null?void 0:$.defaultBaseURL)??""),W()},children:[e.jsx(os,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(ls,{})}),e.jsxs(cs,{children:[Y.map(v=>e.jsx(be,{value:v.id,children:v.label},v.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(w||d)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!w&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(U,{id:"direct-provider-base-url",value:o,disabled:D,onChange:v=>{c(v.target.value),W()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!w&&!d&&e.jsx("button",{type:"button",onClick:()=>m(!0),disabled:D,"data-testid":"direct-provider-advanced",className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Advanced"}),re&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-insecure",children:"This address isn’t encrypted. Your key travels in the open."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:Z,value:r,disabled:D,onChange:v=>{l(v.target.value),W()},placeholder:h===null?(y==null?void 0:y.keyPlaceholder)??Y[0].keyPlaceholder:`Saved key ends in ${h}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),x.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x.errorMessage}),J&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-repaste",children:"Paste your key again to change the address."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y===void 0?e.jsx("span",{}):e.jsxs("a",{href:y.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(H,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"outline",disabled:!N||D,"data-testid":"direct-provider-test",onClick:()=>{x.reset(),p.reset(),p.check(G)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",disabled:!_||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:x.phase==="saving"?"Saving…":"Checking your key…"}):((X=p.result)==null?void 0:X.ok)===!0?e.jsx(z,{message:p.checkedSavedKey?"Your saved key works":"Key works"}):p.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:p.result.message}):null]})}function gt({currentProvider:s,onConnected:t}){const[n,i]=u.useState("choose"),a=pt();if(n==="choose")return e.jsx(yt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(mt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(nt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(ht,{onConnected:t})})}function pt(){return{cloud:{step:"cloud",title:"Best models, zero setup",description:"Claude, GPT, Gemini and 300+ more, in the cloud.",sub:"One OpenRouter account covers them all. Pay for what you use.",tradeOff:"Your prompts and code are sent to the model’s provider.",recommended:!0},local:{step:"local",title:"Private and free, on your computer",description:`Models run on ${Ae()}. Nothing you type ever leaves it.`,sub:"Runs Quick helpers and Solid coders. Frontier models stay cloud-only.",tradeOff:"Smaller models: good for edits and quick help."},direct:{step:"direct",title:"Use your own API key",stepTitle:"Your own API key",description:"Anthropic, OpenAI, or any OpenAI-compatible server, like LM Studio.",sub:"",quiet:!0}}}function yt({sources:s,onChoose:t,currentProvider:n}){return e.jsxs("div",{className:"space-y-2","data-testid":"opencode-power-sources",children:[n&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"opencode-current-source",children:["Currently: ",qs(n)]}),Object.values(s).map(i=>e.jsx(vt,{source:i,onChoose:t},i.step))]})}function vt({source:s,onChoose:t}){return e.jsxs("button",{type:"button",onClick:()=>t(s.step),"data-testid":`power-source-${s.step}`,className:V("card-interactive focus-ring group flex w-full items-start gap-3 rounded-lg border p-3 text-left",s.recommended?"border-primary/40 bg-card shadow-soft":"border-border bg-card shadow-soft",s.quiet&&"shadow-none"),children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.title}),s.recommended&&e.jsx(Ke,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(us,{className:"text-muted-foreground/60 mt-0.5 size-4 shrink-0"})]})}function oe({source:s,onBack:t,children:n}){const i=!!(s.sub||s.tradeOff);return e.jsxs("div",{className:"space-y-3","data-testid":"opencode-connect-step",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:t,className:"focus-ring text-muted-foreground hover:text-foreground -ml-1 inline-flex items-center gap-1 rounded-md px-1 py-0.5 text-xs transition-colors","data-testid":"connect-step-back",children:[e.jsx(ds,{className:"size-3.5"}),"Back"]}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{className:"text-sm font-medium",children:s.stepTitle??s.title})]}),i&&e.jsxs("div",{className:"space-y-1","data-testid":"connect-step-details",children:[s.sub&&e.jsx("p",{className:"text-muted-foreground/80 text-xs",children:s.sub}),s.tradeOff&&e.jsxs("p",{className:"text-muted-foreground/70 text-2xs leading-snug",children:[e.jsx("span",{className:"font-medium",children:"Trade-off:"})," ",s.tradeOff]})]}),n]})}function jt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=vs(),r=Ps(s),l=ms(),o=xs(),c=hs([s]);if(s==="doe")return a?e.jsx(Ks,{onConnected:i}):e.jsx(Oe,{});const d=r==="lead"&&l!==null,m=a?t.kind==="provider-picker"?e.jsx(gt,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Ls,{type:s,onConnected:i,asOtherWay:d}):null:e.jsx(Oe,{});if(m===null)return null;const x=me(s).label,p=t.kind==="provider-picker";if(r==="on-credits")return e.jsxs("div",{className:"space-y-3","data-testid":`credits-ready-${s}`,children:[e.jsxs("div",{role:"status",children:[e.jsxs("p",{className:"text-status-success-fg flex items-center gap-1.5 text-sm font-medium",children:[e.jsx(ue,{className:"size-3.5","aria-hidden":!0}),"You’re ready"]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["New work on ",x," runs on your DorkOS credits.",c.map(f=>` ${f}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:m})]});const y=f=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:f,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Is(x))}});return d?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[y(!0),e.jsx(le,{children:m}),e.jsx(Es,{ollama:p,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[m,e.jsx(le,{children:y(!1)})]}):m}function le({collapsed:s=!1,children:t}){const[n,i]=u.useState(!s);return s?e.jsxs(we,{open:n,onOpenChange:i,children:[e.jsxs(Re,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(fs,{className:V("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Ie,{className:"mt-3",children:t})]}):e.jsxs("section",{className:"space-y-2","aria-label":"Other ways",children:[e.jsx("p",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:"Other ways"}),t]})}const wt=s=>e.jsx(jt,{...s});export{Pt as C,Os as D,Es as K,Oe as R,Ss as a,vs as b,Ot as c,qs as d,Ps as e,Ks as f,Cs as g,wt as r,Et as u};
|
|
1
|
+
import{aO as Ee,a5 as b,a7 as T,r as u,a8 as I,kr as q,ks as M,es as Qe,kt as Ge,a6 as B,j as e,ku as We,eO as Ye,eP as V,Q as we,T as Re,V as Ie,B as O,i2 as Ve,G as H,fd as He,eq as Je,kv as Xe,kw as Ze,ej as Le,_ as te,x as de,Z as es,J as ue,eu as me,eL as C,eM as ne,aJ as ss,kx as ts,I as U,ky as ns,kz as Ae,kA as rs,a2 as Ke,fX as as,ew as is,ex as os,ey as ls,ez as cs,eA as be,em as ds,C as us,kB as ms,kC as xs,kD as hs,U as fs}from"./index-BR1m9FON.js";import{C as De}from"./copy-button-BOznikwM.js";import{I as gs}from"./inline-code-mh48Uhbi.js";import{u as ps}from"./useMutationState-DIywUTDG.js";import{O as ys,a as Y}from"./runtime-connect-Dn0T5YWv.js";function vs(){var s;return((s=Ee().data)==null?void 0:s.isLocalCaller)!==!1}function Ot(){const s=Ee().data;return((s==null?void 0:s.onTrustedConnection)??(s==null?void 0:s.isLocalCaller))!==!1}function Pt(s){var d,m;const t=b(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:()=>(a(null),t.provisionRuntime(s,x=>a(x))),onSuccess:x=>{x.ok&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}))}}),l=r.isError||((d=r.data)==null?void 0:d.ok)===!1,o=r.isError?r.error.message:((m=r.data)==null?void 0:m.error)??null,c=(o==null?void 0:o.trim().toLowerCase())==="not found"?"One-click install isn’t available here.":o;return{provision:()=>r.mutate(),isPending:r.isPending,isError:l,errorMessage:l?c??"Couldn’t install. Try again.":null,progress:i,result:r.data}}function Te(s){return["runtime-key-status",s]}function js(s,t=!0){const n=b();return B({queryKey:Te(s),queryFn:()=>n.getRuntimeKeyStatus(s),enabled:t,staleTime:3e4})}function ks(s){const t=b(),n=I({mutationFn:a=>t.checkRuntimeCredential(s,a.trim().length>0?a:null),meta:{suppressErrorToast:!0}}),i=n.data??(n.isError?{ok:!1,reason:"unexpected",message:n.error.message||"Couldn’t check the key."}:null);return{check:a=>n.mutate(a),isPending:n.isPending,result:i,checkedSavedKey:i!==null&&(n.variables??"").trim().length===0,reset:n.reset}}function Ns(s){var o,c,d;const t=b(),n=T(),[i,a]=u.useState(null),r=I({mutationFn:async m=>{a("checking");const x=await t.checkRuntimeCredential(s,m);return x.ok?(a("saving"),await t.storeRuntimeCredential(s,m),{saved:!0,message:null}):{saved:!1,message:x.message}},onSettled:()=>a(null),meta:{suppressErrorToast:!0},onSuccess:m=>{m.saved&&(n.invalidateQueries({queryKey:[...q]}),n.invalidateQueries({queryKey:[...M]}),n.invalidateQueries({queryKey:[...Te(s)]}))}}),l=((o=r.data)==null?void 0:o.saved)===!1;return{store:m=>{m.trim().length!==0&&r.mutate(m)},isPending:r.isPending,phase:i,isSuccess:((c=r.data)==null?void 0:c.saved)===!0,isError:r.isError||l,errorMessage:l?((d=r.data)==null?void 0:d.message)??null:r.isError?r.error.message??"Couldn’t save the API key.":null,reset:r.reset}}const Se=new WeakMap;function bs(s){const t=Se.get(s);if(t)return t;const n=new Set;return Se.set(s,n),n}function Ss(s,t){var E,K,L,S,j;const n=b(),i=T(),{sessionId:a,accountRoot:r,accountId:l,onCompleted:o}=t??{},c=Qe(),d=l??(r?((E=c.accounts.find(N=>N.path===r))==null?void 0:E.id)??(c.ownResolvedAccount===r?"default":void 0):a?void 0:"default"),m=u.useMemo(()=>["runtime-login",s,a??"",d??r??""],[s,a,d,r]),x=I({mutationKey:m,mutationFn:()=>{if(s==="claude-code"&&r&&!d&&!a)throw new Error("Choose this account in Runtimes.");return n.delegateRuntimeLogin(s,s==="claude-code"?{sessionId:a,accountId:d}:a?{sessionId:a}:void 0)},onSuccess:N=>{i.invalidateQueries({queryKey:["claude-signin-policy"]}),N.ok&&(i.invalidateQueries({queryKey:Ge.all}),i.invalidateQueries({queryKey:[...q]}),i.invalidateQueries({queryKey:[...M]}))}}),p=ps({filters:{mutationKey:m,exact:!0},select:N=>({id:N.mutationId,state:N.state})}),y=p.some(N=>N.state.status==="pending"),f=p[p.length-1],h=y||f==null?void 0:f.state,k=y||f==null?void 0:f.id,w=!y&&((h==null?void 0:h.status)==="error"||((K=h==null?void 0:h.data)==null?void 0:K.ok)===!1),F=(h==null?void 0:h.status)==="error"?((L=h.error)==null?void 0:L.message)??null:((S=h==null?void 0:h.data)==null?void 0:S.error)??null,R=((j=h==null?void 0:h.data)==null?void 0:j.ok)===!0,P=u.useRef(o);return P.current=o,u.useEffect(()=>{var _;if(!R||k===void 0)return;const N=bs(i);N.has(k)||(N.add(k),(_=P.current)==null||_.call(P))},[R,k,i]),{login:()=>{y||x.mutate()},isPending:y,isSuccess:R,isError:w,errorMessage:w?F??"Couldn’t sign in. Try again.":null}}const Ce={"claude-code":{signInLabel:"Sign in",otherWayLabel:"Sign in with Claude",signInHint:"Use your Claude subscription or Anthropic account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"Anthropic API key",keyPlaceholder:"sk-ant-…",getKeyUrl:"https://console.anthropic.com/settings/keys"},codex:{signInLabel:"Sign in with ChatGPT",otherWayLabel:"Sign in with ChatGPT",signInHint:"Use your ChatGPT account.",signInPending:"Waiting for sign-in to complete…",keyLabel:"OpenAI API key",keyPlaceholder:"sk-…",getKeyUrl:"https://platform.openai.com/api-keys"}};function Cs(s){return Ce[s]??Ce["claude-code"]}function Os({command:s,infoUrl:t,copyLabel:n}){return!s&&!t?null:e.jsxs("div",{className:"space-y-2",children:[s&&e.jsxs("div",{className:"bg-muted flex items-center justify-between gap-2 rounded-lg px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[e.jsx(We,{className:"text-muted-foreground size-3.5 shrink-0"}),e.jsx("code",{className:"truncate text-xs",children:s})]}),e.jsx(De,{value:s,label:n??"Copy install command",className:"shrink-0"})]}),t&&e.jsxs(Ye,{href:t,className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Learn more ",e.jsx(V,{className:"size-3"})]})]})}function Et({command:s,runtimeLabel:t}){const[n,i]=u.useState(!1);return e.jsxs(we,{open:n,onOpenChange:i,className:"mt-2",children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["DorkOS installs ",t," for you."," ",e.jsx(Re,{className:"hover:text-foreground underline decoration-dotted underline-offset-2 transition-colors",children:n?"Hide command":"What runs?"})]}),e.jsxs(Ie,{className:"mt-1.5 flex items-center gap-1.5",children:[e.jsx(gs,{children:s}),e.jsx(De,{value:s,label:`Copy command: ${s}`,className:"shrink-0"})]})]})}function Oe({onRetry:s}){return e.jsxs("div",{"data-testid":"remote-signin-notice",children:[e.jsx("p",{className:"text-muted-foreground text-sm",children:"Signing in needs the computer DorkOS runs on."}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm",children:s?"Sign in to DorkOS there, then press Retry.":"Sign in to DorkOS there."}),e.jsx("p",{className:"text-muted-foreground/80 mt-2 text-xs",children:"Already on that computer? Open DorkOS at localhost instead."}),s&&e.jsxs(O,{variant:"outline",size:"sm",onClick:s,className:"mt-3 gap-1.5",children:[e.jsx(Ve,{className:"size-3"}),"Retry"]})]})}function Ps({ollama:s=!1,remote:t=!1,className:n}){return e.jsxs("p",{className:H("text-muted-foreground text-xs",n),"data-testid":"keep-it-local-note",children:[t?"Prefer everything on the computer DorkOS runs on? Use your own sign-in there":"Prefer to keep everything on this computer? Use your own sign-in",s?", or Ollama":"","."]})}function Es(s){const t=He(),{data:n}=Je();return s?Xe(Ze(t.data,s),n,s):"none"}const xe="OpenCode is connected",he="This chat uses OpenCode. Change models from the model menu.",ws={title:xe,body:`Frontier models are unlocked. ${he}`},Rs={title:xe,body:he},Pe={title:xe,body:`Your local models are ready. ${he}`};function Me(s){return{title:`${s} is connected`,body:`This chat uses ${s}. Change models from the model menu.`}}function Is(s){return{title:`${s} is ready`,body:`New work on ${s} runs on your DorkOS credits. Change it any time in Settings › Runtimes.`}}function A({message:s}){const t=Le();return e.jsxs(te.div,{role:"status",className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:t?!1:{opacity:0},animate:{opacity:1},"data-testid":"connect-progress",children:[e.jsx(de,{size:"xs",className:H("text-muted-foreground shrink-0",t&&"animate-none")}),e.jsx(es,{mode:"wait",children:e.jsx(te.span,{className:"truncate text-xs",initial:t?!1:{opacity:0},animate:{opacity:1},exit:t?void 0:{opacity:0},transition:{duration:.2},children:s},s)})]})}function z({message:s="Connected"}){return e.jsxs("div",{role:"status",className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"connect-connected",children:[e.jsx(ue,{className:"size-3.5"}),s]})}function Q({message:s,onRetry:t}){return e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:s}),e.jsx(O,{size:"sm",onClick:t,children:"Try again"})]})}function Ls({type:s,onConnected:t,asOtherWay:n=!1}){const i=Cs(s),a=Ss(s),[r,l]=u.useState(!1),o=u.useRef(!1);return u.useEffect(()=>{!a.isSuccess||o.current||(o.current=!0,t==null||t(Me(me(s).label)))},[a.isSuccess,t,s]),e.jsxs("div",{className:"space-y-4","data-testid":`login-connect-${s}`,children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:i.signInPending}):a.isSuccess?e.jsx(z,{message:"Signed in"}):a.isError?e.jsx(Q,{message:a.errorMessage??"Couldn’t sign in.",onRetry:a.login}):e.jsxs(e.Fragment,{children:[e.jsx(O,{size:"sm",variant:n?"outline":"default",className:"w-full",onClick:a.login,children:n?i.otherWayLabel:i.signInLabel}),e.jsx("p",{className:"text-muted-foreground text-xs",children:i.signInHint})]})}),r?e.jsxs("div",{className:"space-y-3","data-testid":`login-connect-key-${s}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),e.jsx(As,{type:s,copy:i,onConnected:t}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Back to sign in"})]}):n?e.jsx(O,{size:"sm",variant:"outline",className:"w-full",onClick:()=>l(!0),"data-testid":`login-connect-use-key-${s}`,children:"Paste a key"}):e.jsx("button",{type:"button",onClick:()=>l(!0),className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors","data-testid":`login-connect-use-key-${s}`,children:"Use an API key instead"})]})}function As({type:s,copy:t,onConnected:n}){var f,h;const[i,a]=u.useState(""),r=Ns(s),l=js(s),o=ks(s),c=u.useRef(!1),d=u.useRef(null);if(u.useEffect(()=>{!r.isSuccess||c.current||(c.current=!0,n==null||n(Me(me(s).label)))},[r.isSuccess,n,s]),u.useEffect(()=>{var k;r.isError&&((k=d.current)==null||k.focus())},[r.isError]),r.isSuccess)return e.jsx(z,{});const m=(f=l.data)!=null&&f.key.saved?l.data.key:null,x=i.trim().length>0,p=r.isPending||o.isPending,y=()=>{o.reset(),r.reset()};return e.jsxs("form",{className:"space-y-2",onSubmit:k=>{k.preventDefault(),o.reset(),r.store(i)},children:[e.jsx(C,{htmlFor:`api-key-${s}`,className:"text-xs",children:t.keyLabel}),e.jsx(ne,{id:`api-key-${s}`,ref:d,value:i,disabled:p,onChange:k=>{a(k.target.value),y()},placeholder:m?`Saved key ends in ${m.last4}. Paste to replace.`:t.keyPlaceholder,autoComplete:"off",spellCheck:!1}),r.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:r.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.getKeyUrl?e.jsxs("a",{href:t.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(V,{className:"size-3"})]}):e.jsx("span",{}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"ghost",disabled:!x&&m===null||p,"data-testid":`api-key-test-${s}`,onClick:()=>{r.reset(),o.reset(),o.check(i)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:!x||p,children:"Save key"})]})]}),p?e.jsx(A,{message:r.phase==="saving"?"Saving…":"Checking your key…"}):((h=o.result)==null?void 0:h.ok)===!0?e.jsx(z,{message:o.checkedSavedKey?"Your saved key works":"Key works"}):o.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:o.result.message}):null]})}function Ks(s){const t=b(),n=B({queryKey:["doe-inference"],queryFn:()=>t.getDoeInference()});return n.isPending?e.jsx(de,{"aria-label":"Loading model settings"}):n.isError?e.jsx("p",{role:"alert",children:"Couldn’t load model settings. Try again."}):e.jsx(Ds,{saved:n.data,...s},JSON.stringify(n.data))}function Ds({saved:s,onConnected:t,onSave:n}){var D,X,W,Z,v,$,fe,ge,pe,ye,ve,je;const i=b(),a=T(),r=u.useId(),l=((D=s.inference)==null?void 0:D.source)??"api-key",[o,c]=u.useState(n&&l==="dorkos-credits"?"api-key":l),[d,m]=u.useState(((X=s.inference)==null?void 0:X.protocol)??"openai-chat-completions"),[x,p]=u.useState(((W=s.inference)==null?void 0:W.endpoint)??""),[y,f]=u.useState(((Z=s.inference)==null?void 0:Z.provider)??""),[h,k]=u.useState(((v=s.inference)==null?void 0:v.model)??""),[w,F]=u.useState(String((($=s.inference)==null?void 0:$.contextWindow)??8192)),[R,P]=u.useState(String(((fe=s.inference)==null?void 0:fe.maxOutputTokens)??1024)),[E,K]=u.useState(""),[L,S]=u.useState(null),j=B({queryKey:["doe-credits-models",d],queryFn:()=>i.getDoeCreditsModels(d),enabled:o==="dorkos-credits"}),N=o==="dorkos-credits"?(ge=j.data)==null?void 0:ge.models.find(g=>g.id===h):void 0,_=s.hasKey&&((pe=s.inference)==null?void 0:pe.endpoint)===x&&s.inference.source==="api-key",J=I({mutationFn:async g=>{if(n)return n(g,E.trim()||null);o==="api-key"&&E.trim()?await i.storeDoeCredential(g,E.trim()):await i.setDoeInference(g),(await i.getCloudCredits()).linked&&await i.setCloudCreditsDefault("doe",o==="dorkos-credits")},onSuccess:()=>{K("");for(const g of[["doe-inference"],q,M,ss.all,ts.status()])a.invalidateQueries({queryKey:g});t==null||t({title:"DorkOS model settings saved",body:"New chats use this source and model."})},onError:g=>S(n&&g instanceof Error&&g.message?g.message:"Couldn’t save model settings. Try again.")});function re(g){var ke,Ne;if(g.preventDefault(),S(null),E.trim().startsWith("sk-ant-oat")){S("Anthropic subscription tokens cannot run DorkOS agents. Use an API key.");return}if(o==="api-key"&&!E.trim()&&!_){S("Enter an API key.");return}if(o==="dorkos-credits"&&(!N||!((ke=j.data)!=null&&ke.endpoint))){S("Link DorkOS credits and choose an available model.");return}const ae=ns.safeParse({source:o,protocol:d,provider:o==="dorkos-credits"?"dorkos":y,endpoint:o==="dorkos-credits"?(Ne=j.data)==null?void 0:Ne.endpoint:x,model:h,contextWindow:(N==null?void 0:N.contextWindow)??Number(w),maxOutputTokens:(N==null?void 0:N.maxOutputTokens)??Number(R)});if(!ae.success){S("Check the model, endpoint, and token limits.");return}J.mutate(ae.data)}const G="bg-background border-input focus-visible:ring-ring h-11 w-full rounded-md md:h-9 border px-3 text-sm focus-visible:ring-2";return e.jsxs("form",{onSubmit:re,className:"space-y-3","aria-label":"DorkOS model settings",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-source`,children:"Runs on"}),e.jsxs("select",{id:`${r}-source`,className:G,value:o,onChange:g=>{c(g.target.value),k("")},children:[e.jsx("option",{value:"api-key",children:"My API key"}),e.jsx("option",{value:"local",children:"Local model"}),!n&&e.jsx("option",{value:"dorkos-credits",children:"DorkOS credits"})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-protocol`,children:"Model protocol"}),e.jsxs("select",{id:`${r}-protocol`,className:G,value:d,onChange:g=>{m(g.target.value),o==="dorkos-credits"&&k("")},children:[e.jsx("option",{value:"openai-chat-completions",children:"OpenAI Chat Completions"}),e.jsx("option",{value:"openai-responses",children:"OpenAI Responses"}),e.jsx("option",{value:"anthropic-messages",children:"Anthropic Messages"})]})]}),o==="dorkos-credits"?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-model`,children:"Model"}),e.jsxs("select",{id:`${r}-model`,className:G,value:h,onChange:g=>k(g.target.value),disabled:j.isPending||!((ye=j.data)!=null&&ye.endpoint),children:[e.jsx("option",{value:"",children:"Choose a model"}),(ve=j.data)==null?void 0:ve.models.map(g=>e.jsx("option",{value:g.id,children:g.displayName},g.id))]}),!((je=j.data)!=null&&je.endpoint)&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Link DorkOS credits in Settings to choose a model."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-service`,children:"Service name"}),e.jsx(U,{id:`${r}-service`,value:y,onChange:g=>f(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-endpoint`,children:"Model endpoint"}),e.jsx(U,{id:`${r}-endpoint`,type:"url",value:x,onChange:g=>p(g.target.value),required:!0}),o==="local"&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"Use a loopback address. No API key is needed."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-model`,children:"Model ID"}),e.jsx(U,{id:`${r}-model`,value:h,onChange:g=>k(g.target.value),required:!0})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-context`,children:"Context tokens"}),e.jsx(U,{id:`${r}-context`,type:"number",min:1,value:w,onChange:g=>F(g.target.value),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-output`,children:"Output tokens"}),e.jsx(U,{id:`${r}-output`,type:"number",min:1,value:R,onChange:g=>P(g.target.value),required:!0})]})]}),o==="api-key"&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:`${r}-key`,children:"API key"}),e.jsx(ne,{id:`${r}-key`,value:E,onChange:g=>K(g.target.value),autoComplete:"off"}),_&&e.jsx("p",{className:"text-muted-foreground text-xs",children:"API key saved. Leave blank to keep it."})]})]}),L&&e.jsx("p",{role:"alert",className:"text-destructive text-xs",children:L}),e.jsx(O,{type:"submit",disabled:J.isPending,children:J.isPending?"Saving…":n?"Save":"Save model settings"})]})}const Ts={openai:"OpenAI",anthropic:"Anthropic"};function Ms(s){return Ts[s]??s}function qs(s){switch(s){case"ollama":return"On your computer (Ollama)";case"openrouter":return"Cloud via OpenRouter";default:return`Your own API key (${Ms(s)})`}}const qe="ollama",Fe=["runtime-connect","ollama"];function Fs(s){const t=b();return B({queryKey:Fe,queryFn:()=>t.detectOllama(),enabled:s,staleTime:3e4})}function $s(){const s=b(),t=T(),n=I({mutationFn:i=>s.updateConfig({runtimes:{opencode:{provider:qe}}}),onSuccess:()=>{t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]})}});return{connect:i=>n.mutate(i),isPending:n.isPending,isSuccess:n.isSuccess,isError:n.isError,errorMessage:n.isError?n.error.message??"Couldn’t connect to Ollama.":null}}const $e=["runtime-connect","opencode","direct"];function _s(){const s=b();return B({queryKey:$e,queryFn:()=>s.getOpenCodeDirectSetup(),staleTime:3e4})}function Us(){var i;const s=b(),t=I({mutationFn:({providerId:a,key:r,baseURL:l})=>s.checkProviderCredential(a,r.trim().length>0?r:null,(l==null?void 0:l.trim())||null),meta:{suppressErrorToast:!0}}),n=t.data??(t.isError?{ok:!1,reason:"unexpected",message:t.error.message||"Couldn’t check the key."}:null);return{check:a=>t.mutate(a),isPending:t.isPending,result:n,checkedSavedKey:n!==null&&(((i=t.variables)==null?void 0:i.key)??"").trim().length===0,reset:t.reset}}function zs(){var l,o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async({providerId:d,key:m,baseURL:x})=>{const p=(x==null?void 0:x.trim())||null;i("checking");const y=await s.checkProviderCredential(d,m.trim().length>0?m:null,p);return y.ok?(i("saving"),await s.storeProviderCredential(d,m,p),{saved:!0,message:null}):{saved:!1,message:y.message}},onSettled:()=>i(null),meta:{suppressErrorToast:!0},onSuccess:d=>{d.saved&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}),t.invalidateQueries({queryKey:[...$e]}))}}),r=((l=a.data)==null?void 0:l.saved)===!1;return{connect:d=>{d.providerId.trim().length!==0&&a.mutate(d)},isPending:a.isPending,phase:n,isSuccess:((o=a.data)==null?void 0:o.saved)===!0,isError:a.isError||r,errorMessage:r?((c=a.data)==null?void 0:c.message)??null:a.isError?a.error.message??"Couldn’t save your key.":null,reset:a.reset}}function Bs(s){const t=b();return B({queryKey:["runtime-connect","ollama","catalog"],queryFn:()=>t.getOllamaModelCatalog(),enabled:s,staleTime:6e4})}function Qs(){var o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:async d=>{i(null);const m=await s.pullOllamaModel(d,x=>i(x));return m.ok&&await s.updateConfig({runtimes:{opencode:{provider:qe}}}),m},onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{pull:d=>a.mutate(d),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t download the model.":null,progress:n,result:a.data}}function Gs(){var o,c;const s=b(),t=T(),[n,i]=u.useState(null),a=I({mutationFn:()=>(i(null),s.provisionOllama(d=>i(d))),onSuccess:d=>{d.ok&&(t.invalidateQueries({queryKey:Fe}),t.invalidateQueries({queryKey:[...M]}))}}),r=a.isError||((o=a.data)==null?void 0:o.ok)===!1,l=a.isError?a.error.message:((c=a.data)==null?void 0:c.error)??null;return{provision:()=>a.mutate(),isPending:a.isPending,isError:r,errorMessage:r?l??"Couldn’t install Ollama.":null,progress:n,result:a.data}}const Ws="https://ollama.com/download",Ys="curl -fsSL https://ollama.com/install.sh | sh";function Vs({installMethod:s}){const t=Gs(),n=s==="brew"||s==="winget";return e.jsxs("div",{className:"space-y-3","data-testid":"ollama-absent",children:[e.jsx(Hs,{}),n?e.jsx(Js,{provision:t}):e.jsx(Xs,{}),e.jsx(Zs,{})]})}function Hs(){const s=Ae();return e.jsxs("div",{className:"space-y-1.5","data-testid":"ollama-explainer",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Run AI models on ",s]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Ollama is a free app that runs AI models on ",s,"."]}),e.jsxs("p",{className:"text-muted-foreground text-xs leading-relaxed",children:["Nothing you type leaves ",s,"."]})]})}function Js({provision:s}){var t,n,i;return s.isPending?e.jsx(A,{message:((t=s.progress)==null?void 0:t.message)??"Installing Ollama…"}):(n=s.result)!=null&&n.ok?(i=s.result.status)!=null&&i.running?e.jsx(A,{message:"Ollama is ready…"}):e.jsx("p",{className:"text-xs","data-testid":"ollama-installed-not-running",children:"Ollama isn’t running. Open the Ollama app to start it."}):s.isError?e.jsx(Q,{message:s.errorMessage??"Couldn’t install Ollama.",onRetry:s.provision}):e.jsx(O,{size:"sm",onClick:s.provision,"data-testid":"ollama-install-oneclick",children:"Install Ollama"})}function Xs(){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-manual-install",children:[e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:"Installing Ollama needs administrator access. Run this in a terminal:"}),e.jsx(Os,{command:Ys,copyLabel:"Copy the Ollama install command"})]})}function Zs(){return e.jsxs("a",{href:Ws,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Or download Ollama from ollama.com ",e.jsx(V,{className:"size-3"})]})}const et="https://ollama.com/library",st={"runs-well":{label:"Runs well on your machine",tone:"text-status-success-fg"},"may-be-slow":{label:"May be slow on your machine",tone:"text-status-warning-fg"},"too-large":{label:"Too large for your machine",tone:"text-destructive"}},tt={frontier:"Frontier","solid-coder":"Solid coder","quick-helper":"Quick helper"};function nt({active:s,onConnected:t,onConnectDirectly:n}){var R,P,E,K,L,S;const i=Fs(s),a=$s(),r=Qs(),l=((R=i.data)==null?void 0:R.running)??!1,o=Bs(l),[c,d]=u.useState(null),[m,x]=u.useState(null);u.useEffect(()=>{a.isSuccess&&(t==null||t(Pe))},[a.isSuccess,t]),u.useEffect(()=>{var j;(j=r.result)!=null&&j.ok&&(t==null||t(Pe))},[(P=r.result)==null?void 0:P.ok,t]);const p=j=>{d(j),a.connect(j)},y=j=>{x(j),r.pull(j)};if(i.isPending)return e.jsx(A,{message:"Looking for Ollama on your machine…"});if(!l)return e.jsx(Vs,{installMethod:(E=i.data)==null?void 0:E.installMethod});if(a.isSuccess)return t?null:e.jsx(z,{message:"Connected to Ollama"});if((K=r.result)!=null&&K.ok)return t?null:e.jsxs("div",{className:"text-status-success-fg flex items-center gap-2 rounded-lg px-3 py-2.5 text-xs","data-testid":"guided-pull-connected",children:[e.jsx(ue,{className:"size-3.5 shrink-0"}),e.jsx("span",{children:"Connected:"}),e.jsx(rs,{runtime:"opencode",model:r.result.model,className:"text-xs"})]});const f=i.data,h=(f==null?void 0:f.installed)??[],k=((L=f==null?void 0:f.installed)==null?void 0:L.length)??(f==null?void 0:f.models.length)??0,w=((S=o.data)==null?void 0:S.models.some(j=>j.model.id===m))??!1,F=m!==null&&!w?m:null;return e.jsxs("div",{className:"space-y-4","data-testid":"ollama-running",children:[e.jsx(rt,{count:k}),h.length>0&&e.jsx(at,{installed:h,connect:a,connectingId:c,onUse:p}),e.jsx(it,{catalogQuery:o,pull:r,pullingId:m,onGet:y}),e.jsx(ot,{pull:r,activePull:F,onSubmit:y}),e.jsx(lt,{}),n&&e.jsxs("button",{type:"button",onClick:n,"data-testid":"local-connect-directly",className:"focus-ring text-muted-foreground hover:text-foreground block rounded-md text-left text-xs transition-colors",children:["Using LM Studio or another server? ",e.jsx("span",{className:"underline",children:"Connect it directly"})]})]})}function rt({count:s}){return e.jsxs("p",{className:"flex items-center gap-1.5 text-xs","data-testid":"ollama-status-line",children:[e.jsx("span",{className:"size-1.5 shrink-0 rounded-full bg-emerald-500","aria-hidden":!0}),e.jsxs("span",{children:["Ollama is running · ",s," ",s===1?"model":"models"," installed"]})]})}function _e({verdict:s,explanation:t}){const n=st[s];return e.jsxs("div",{"data-testid":"ollama-verdict","data-verdict":s,children:[e.jsx("p",{className:H("text-xs font-medium",n.tone),children:n.label}),e.jsx("p",{className:"text-muted-foreground/80 text-2xs leading-snug",children:t})]})}function Ue({tier:s}){return e.jsx(Ke,{size:"xs",variant:"outline",className:"font-normal",children:tt[s]})}function at({installed:s,connect:t,connectingId:n,onUse:i}){return e.jsxs("div",{className:"space-y-2","data-testid":"ollama-installed",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Installed"}),e.jsx("ul",{className:"space-y-1.5",children:s.map(a=>{const r=n===a.id&&t.isPending,l=n===a.id&&t.isError,o=()=>i(a.id);let c=e.jsx(O,{size:"sm",onClick:o,children:"Use"});return r?c=e.jsx(A,{message:"Connecting…"}):l&&(c=e.jsx(Q,{message:t.errorMessage??"Couldn’t connect to Ollama.",onRetry:o})),e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"ollama-installed-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:a.id}),a.assessment.model.tier&&e.jsx(Ue,{tier:a.assessment.model.tier})]}),e.jsx(_e,{verdict:a.assessment.verdict,explanation:a.assessment.explanation})]}),c]},a.id)})})]})}function it({catalogQuery:s,pull:t,pullingId:n,onGet:i}){var r;if(s.isPending)return e.jsx(A,{message:"Checking which models fit your machine…"});const a=((r=s.data)==null?void 0:r.models)??[];return s.isError||a.length===0?null:e.jsxs("div",{className:"space-y-2","data-testid":"ollama-shelf",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add a model"}),e.jsx("ul",{className:"space-y-1.5",children:a.map(({model:l,verdict:o,explanation:c})=>{const d=n===l.id,m=()=>i(l.id);return d&&(t.isPending||t.isError)?e.jsxs("li",{className:"border-border rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:l.label}),t.isPending?e.jsx(ze,{progress:t.progress}):e.jsx(Q,{message:t.errorMessage??"Couldn’t download the model.",onRetry:m})]},l.id):e.jsxs("li",{className:"border-border flex items-center justify-between gap-3 rounded-lg border p-3","data-testid":"shelf-item",children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:l.label}),l.tier&&e.jsx(Ue,{tier:l.tier}),e.jsx("span",{className:"text-muted-foreground text-xs",children:l.sizeLabel})]}),e.jsx(_e,{verdict:o,explanation:c})]}),e.jsx(O,{size:"sm",variant:"outline",disabled:o==="too-large"||t.isPending,onClick:m,children:"Get"})]},l.id)})})]})}function ot({pull:s,activePull:t,onSubmit:n}){const[i,a]=u.useState(""),r=i.trim(),l=ys.test(r);if(t&&s.isPending)return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("p",{className:"text-sm font-medium",children:["Downloading ",t,"…"]}),e.jsx(ze,{progress:s.progress})]});const o=c=>{c.preventDefault(),l&&n(r)};return e.jsxs("form",{onSubmit:o,className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"ollama-pull-tag",className:"text-xs font-normal",children:"Download any model by name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(U,{id:"ollama-pull-tag","data-testid":"ollama-pull-by-name",value:i,onChange:c=>a(c.target.value),placeholder:"qwen2.5-coder:32b","aria-invalid":r.length>0&&!l}),e.jsx(O,{type:"submit",size:"sm",disabled:!l||s.isPending,children:"Download"})]}),r.length>0&&!l&&e.jsxs("p",{className:"text-muted-foreground text-2xs",children:["Use a tag like ",e.jsx("code",{className:"text-2xs",children:"qwen2.5-coder:32b"}),"."]}),t&&s.isError&&e.jsx(Q,{message:s.errorMessage??"Couldn’t download the model.",onRetry:()=>n(t)})]})}function lt(){return e.jsxs("a",{href:et,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Browse the library ",e.jsx(V,{className:"size-3"})]})}function ze({progress:s}){const t=Le(),n=s==null?void 0:s.percent,i=(s==null?void 0:s.status)??"Starting download…";return e.jsxs("div",{className:"space-y-2","data-testid":"guided-pull-progress",children:[e.jsx("div",{className:"bg-muted h-2 w-full overflow-hidden rounded-full",children:n===void 0?e.jsx(te.div,{className:"bg-primary/70 h-full w-1/3 rounded-full",animate:t?{}:{x:["-100%","300%"]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"}}):e.jsx(te.div,{className:"bg-primary h-full rounded-full",initial:!1,animate:{width:`${Math.min(100,Math.max(0,n))}%`},transition:t?{duration:0}:{duration:.3,ease:"easeOut"},"data-testid":"guided-pull-bar"})}),e.jsxs("div",{className:"text-muted-foreground flex items-center gap-2 text-xs",children:[e.jsx(de,{size:"xs",className:H("shrink-0",t&&"animate-none")}),e.jsxs("span",{className:"truncate",children:[i,n!==void 0?` · ${Math.round(n)}%`:""]})]})]})}function ct(){var r,l,o;const s=b(),t=T(),n=I({mutationFn:c=>s.storeOpenRouterKey(c),onSuccess:c=>{c.ok&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))}}),i=n.isError||((r=n.data)==null?void 0:r.ok)===!1,a=n.isError?n.error.message:((l=n.data)==null?void 0:l.error)??null;return{store:c=>{c.trim().length!==0&&n.mutate(c)},isPending:n.isPending,isSuccess:((o=n.data)==null?void 0:o.ok)===!0,isError:i,errorMessage:i?a??"Couldn’t save the OpenRouter key.":null}}function dt(){var p,y;const s=b(),t=T(),[n,i]=u.useState(null),[a,r]=u.useState(null),l=I({mutationFn:()=>s.startOpenRouterOAuth(),onMutate:()=>r(null),onSuccess:({authorizeUrl:f,state:h})=>{if(!as(f)){r("Couldn’t open the OpenRouter sign-in page.");return}i(h)},onError:f=>r(f.message??"Couldn’t start OpenRouter sign-in.")}),o=B({queryKey:["runtime-connect","openrouter","oauth",n],queryFn:()=>s.getOpenRouterOAuthStatus(n),enabled:n!==null,refetchInterval:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="pending"?1500:!1},refetchOnWindowFocus:f=>{var h;return((h=f.state.data)==null?void 0:h.status)==="error"}}),c=(p=o.data)==null?void 0:p.status;u.useEffect(()=>{c==="connected"&&(t.invalidateQueries({queryKey:[...q]}),t.invalidateQueries({queryKey:[...M]}))},[c,t]);const d=l.isPending||n!==null&&c==="pending",m=!!a||c==="error",x=m?a??((y=o.data)==null?void 0:y.error)??"Couldn’t sign in to OpenRouter. Try again.":null;return{begin:()=>l.mutate(),isPending:d,isSuccess:c==="connected",isError:m,errorMessage:x}}const ut="https://openrouter.ai/keys";function mt({onConnected:s}){const[t,n]=u.useState(""),i=ct(),a=dt(),r=i.isSuccess||a.isSuccess;return u.useEffect(()=>{r&&(s==null||s(ws))},[r,s]),r?e.jsx(z,{message:"Connected to OpenRouter"}):e.jsxs("div",{className:"space-y-4","data-testid":"openrouter-gateway",children:[e.jsx("div",{className:"space-y-2",children:a.isPending?e.jsx(A,{message:"Sign in to OpenRouter in the new tab…"}):a.isError?e.jsx(Q,{message:a.errorMessage??"Couldn’t sign in to OpenRouter.",onRetry:a.begin}):e.jsxs(e.Fragment,{children:[e.jsx(O,{size:"sm",className:"w-full",onClick:a.begin,children:"Connect OpenRouter"}),e.jsx("p",{className:"text-muted-foreground text-xs",children:"Makes a limited key for you."})]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"bg-border h-px flex-1"}),e.jsx("span",{className:"text-muted-foreground text-2xs tracking-wide uppercase",children:"or"}),e.jsx("span",{className:"bg-border h-px flex-1"})]}),i.isPending?e.jsx(A,{message:"Checking your OpenRouter key…"}):e.jsxs("form",{className:"space-y-2",onSubmit:l=>{l.preventDefault(),i.store(t)},children:[e.jsx(C,{htmlFor:"openrouter-key",className:"text-xs",children:"OpenRouter key"}),e.jsx(ne,{id:"openrouter-key",value:t,onChange:l=>n(l.target.value),placeholder:"sk-or-…",autoComplete:"off",spellCheck:!1}),i.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:i.errorMessage}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("a",{href:ut,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an OpenRouter key ",e.jsx(V,{className:"size-3"})]}),e.jsx(O,{type:"submit",size:"sm",variant:"outline",disabled:t.trim().length===0,children:"Save key"})]})]})]})}const se="other";function ee(s){return Y.find(t=>t.id===s)}function xt(s){var t;return((t=ee(s))==null?void 0:t.id)??"openai"}function ce(s){var t;return((t=Y.find(n=>n.id===s))==null?void 0:t.defaultBaseURL)??Y[0].defaultBaseURL}function Be(s){return Y.some(t=>t.id===s.providerId)}function ie(s){return Be(s)?s.providerId==="anthropic"?"anthropic":s.baseURL===null||s.baseURL===ce(s.providerId)?s.providerId:se:"openai"}function ht({onConnected:s}){const t=_s();return t.isError&&!t.data?e.jsx(Q,{message:"Couldn’t load your saved settings.",onRetry:()=>void t.refetch()}):t.data?e.jsx(ft,{setup:t.data,onConnected:s},`${t.data.providerId??""}|${t.data.baseURL??""}`):e.jsx(A,{message:"Loading what you saved…"})}function ft({setup:s,onConnected:t}){var Z;const n=Be(s)?s:null,[i,a]=u.useState(()=>ie(s)),[r,l]=u.useState(""),[o,c]=u.useState(()=>{var v;return(n==null?void 0:n.baseURL)??((v=ee(ie(s)))==null?void 0:v.defaultBaseURL)??""}),[d,m]=u.useState(()=>{var $;const v=ie(s);return v!==se&&n!==null&&n.baseURL!==null&&n.baseURL!==(($=ee(v))==null?void 0:$.defaultBaseURL)}),x=zs(),p=Us(),y=ee(i),f=xt(i),h=n!=null&&n.key.saved&&n.providerId===f?n.key.last4:null,k=o.trim(),w=i===se,F=!w||k.length>0,R=ce(f),P=k||R,E=P===R?"":P,K=n===null?null:n.baseURL??ce(n.providerId),L=f!==((n==null?void 0:n.providerId)??null)||P!==K,S=r.trim().length>0,N=(S||h!==null&&!L)&&F,_=S&&F,J=!S&&h!==null&&L,re=P.startsWith("http://"),G={providerId:f,key:r,baseURL:E},D=x.isPending||p.isPending,X=u.useRef(null),W=()=>{p.reset(),x.reset()};return u.useEffect(()=>{x.isSuccess&&(t==null||t(Rs))},[x.isSuccess,t]),u.useEffect(()=>{var v;x.isError&&((v=X.current)==null||v.focus())},[x.isError]),x.isSuccess?e.jsx(z,{}):e.jsxs("form",{className:"space-y-3","data-testid":"direct-provider",onSubmit:v=>{v.preventDefault(),p.reset(),x.connect(G)},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"direct-provider-source",className:"text-xs",children:"Power source"}),e.jsxs(is,{value:i,disabled:D,onValueChange:v=>{var $;a(v),c((($=ee(v))==null?void 0:$.defaultBaseURL)??""),W()},children:[e.jsx(os,{id:"direct-provider-source","data-testid":"direct-provider-source",children:e.jsx(ls,{})}),e.jsxs(cs,{children:[Y.map(v=>e.jsx(be,{value:v.id,children:v.label},v.id)),e.jsx(be,{value:se,children:"Other (OpenAI-compatible)"})]})]})]}),(w||d)&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(C,{htmlFor:"direct-provider-base-url",className:"text-xs",children:["Base URL ",!w&&e.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e.jsx(U,{id:"direct-provider-base-url",value:o,disabled:D,onChange:v=>{c(v.target.value),W()},placeholder:"https://api.example.com/v1",autoComplete:"off",spellCheck:!1})]}),!w&&!d&&e.jsx("button",{type:"button",onClick:()=>m(!0),disabled:D,"data-testid":"direct-provider-advanced",className:"text-muted-foreground hover:text-foreground text-xs underline decoration-dotted underline-offset-2 transition-colors",children:"Advanced"}),re&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-insecure",children:"This address isn’t encrypted. Your key travels in the open."}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(C,{htmlFor:"direct-provider-key",className:"text-xs",children:"API key"}),e.jsx(ne,{id:"direct-provider-key",ref:X,value:r,disabled:D,onChange:v=>{l(v.target.value),W()},placeholder:h===null?(y==null?void 0:y.keyPlaceholder)??Y[0].keyPlaceholder:`Saved key ends in ${h}. Paste to replace.`,autoComplete:"off",spellCheck:!1})]}),x.isError&&e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:x.errorMessage}),J&&e.jsx("p",{className:"text-muted-foreground text-xs","data-testid":"direct-provider-repaste",children:"Paste your key again to change the address."}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y===void 0?e.jsx("span",{}):e.jsxs("a",{href:y.getKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:["Get an API key ",e.jsx(V,{className:"size-3"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{type:"button",size:"sm",variant:"outline",disabled:!N||D,"data-testid":"direct-provider-test",onClick:()=>{x.reset(),p.reset(),p.check(G)},children:"Test key"}),e.jsx(O,{type:"submit",size:"sm",disabled:!_||D,children:"Save & connect"})]})]}),D?e.jsx(A,{message:x.phase==="saving"?"Saving…":"Checking your key…"}):((Z=p.result)==null?void 0:Z.ok)===!0?e.jsx(z,{message:p.checkedSavedKey?"Your saved key works":"Key works"}):p.result?e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:p.result.message}):null]})}function gt({currentProvider:s,onConnected:t}){const[n,i]=u.useState("choose"),a=pt();if(n==="choose")return e.jsx(yt,{sources:a,onChoose:i,currentProvider:s});const r=()=>i("choose");return n==="cloud"?e.jsx(oe,{source:a.cloud,onBack:r,children:e.jsx(mt,{onConnected:t})}):n==="local"?e.jsx(oe,{source:a.local,onBack:r,children:e.jsx(nt,{active:!0,onConnected:t,onConnectDirectly:()=>i("direct")})}):e.jsx(oe,{source:a.direct,onBack:r,children:e.jsx(ht,{onConnected:t})})}function pt(){return{cloud:{step:"cloud",title:"Best models, zero setup",description:"Claude, GPT, Gemini and 300+ more, in the cloud.",sub:"One OpenRouter account covers them all. Pay for what you use.",tradeOff:"Your prompts and code are sent to the model’s provider.",recommended:!0},local:{step:"local",title:"Private and free, on your computer",description:`Models run on ${Ae()}. Nothing you type ever leaves it.`,sub:"Runs Quick helpers and Solid coders. Frontier models stay cloud-only.",tradeOff:"Smaller models: good for edits and quick help."},direct:{step:"direct",title:"Use your own API key",stepTitle:"Your own API key",description:"Anthropic, OpenAI, or any OpenAI-compatible server, like LM Studio.",sub:"",quiet:!0}}}function yt({sources:s,onChoose:t,currentProvider:n}){return e.jsxs("div",{className:"space-y-2","data-testid":"opencode-power-sources",children:[n&&e.jsxs("p",{className:"text-muted-foreground text-xs","data-testid":"opencode-current-source",children:["Currently: ",qs(n)]}),Object.values(s).map(i=>e.jsx(vt,{source:i,onChoose:t},i.step))]})}function vt({source:s,onChoose:t}){return e.jsxs("button",{type:"button",onClick:()=>t(s.step),"data-testid":`power-source-${s.step}`,className:H("card-interactive focus-ring group flex w-full items-start gap-3 rounded-lg border p-3 text-left",s.recommended?"border-primary/40 bg-card shadow-soft":"border-border bg-card shadow-soft",s.quiet&&"shadow-none"),children:[e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:s.title}),s.recommended&&e.jsx(Ke,{size:"xs",variant:"secondary",children:"Recommended"})]}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:s.description})]}),e.jsx(us,{className:"text-muted-foreground/60 mt-0.5 size-4 shrink-0"})]})}function oe({source:s,onBack:t,children:n}){const i=!!(s.sub||s.tradeOff);return e.jsxs("div",{className:"space-y-3","data-testid":"opencode-connect-step",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs("button",{type:"button",onClick:t,className:"focus-ring text-muted-foreground hover:text-foreground -ml-1 inline-flex items-center gap-1 rounded-md px-1 py-0.5 text-xs transition-colors","data-testid":"connect-step-back",children:[e.jsx(ds,{className:"size-3.5"}),"Back"]}),e.jsx("span",{className:"text-muted-foreground/40",children:"·"}),e.jsx("span",{className:"text-sm font-medium",children:s.stepTitle??s.title})]}),i&&e.jsxs("div",{className:"space-y-1","data-testid":"connect-step-details",children:[s.sub&&e.jsx("p",{className:"text-muted-foreground/80 text-xs",children:s.sub}),s.tradeOff&&e.jsxs("p",{className:"text-muted-foreground/70 text-2xs leading-snug",children:[e.jsx("span",{className:"font-medium",children:"Trade-off:"})," ",s.tradeOff]})]}),n]})}function jt({type:s,connect:t,currentProvider:n,onConnected:i}){const a=vs(),r=Es(s),l=ms(),o=xs(),c=hs([s]);if(s==="doe")return a?e.jsx(Ks,{onConnected:i}):e.jsx(Oe,{});const d=r==="lead"&&l!==null,m=a?t.kind==="provider-picker"?e.jsx(gt,{currentProvider:n,onConnected:i}):t.kind==="login"?e.jsx(Ls,{type:s,onConnected:i,asOtherWay:d}):null:e.jsx(Oe,{});if(m===null)return null;const x=me(s).label,p=t.kind==="provider-picker";if(r==="on-credits")return e.jsxs("div",{className:"space-y-3","data-testid":`credits-ready-${s}`,children:[e.jsxs("div",{role:"status",children:[e.jsxs("p",{className:"text-status-success-fg flex items-center gap-1.5 text-sm font-medium",children:[e.jsx(ue,{className:"size-3.5","aria-hidden":!0}),"You’re ready"]}),e.jsxs("p",{className:"text-muted-foreground mt-1 text-xs",children:["New work on ",x," runs on your DorkOS credits.",c.map(f=>` ${f}`).join("")]})]}),e.jsx(le,{collapsed:!0,children:m})]});const y=f=>l==null?void 0:l({runtime:s,origin:`runtime-connect:${s}`,fullWidth:f,onChoose:async()=>{await o.mutateAsync({runtime:s,useCredits:!0}),i==null||i(Is(x))}});return d?e.jsxs("div",{className:"space-y-4","data-testid":`default-first-${s}`,children:[y(!0),e.jsx(le,{children:m}),e.jsx(Ps,{ollama:p,remote:!a})]}):r==="other-way"&&l!==null?e.jsxs("div",{className:"space-y-4","data-testid":`credits-other-way-${s}`,children:[m,e.jsx(le,{children:y(!1)})]}):m}function le({collapsed:s=!1,children:t}){const[n,i]=u.useState(!s);return s?e.jsxs(we,{open:n,onOpenChange:i,children:[e.jsxs(Re,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(fs,{className:H("size-3.5 transition-transform",n&&"rotate-180")}),"Other ways"]}),e.jsx(Ie,{className:"mt-3",children:t})]}):e.jsxs("section",{className:"space-y-2","aria-label":"Other ways",children:[e.jsx("p",{className:"text-muted-foreground text-2xs font-medium tracking-wide uppercase",children:"Other ways"}),t]})}const wt=s=>e.jsx(jt,{...s});export{Et as C,Os as D,Ps as K,Oe as R,Ss as a,vs as b,Ot as c,qs as d,Es as e,Ks as f,Cs as g,wt as r,Pt as u};
|
package/dist/client/assets/{RuntimeSetupDialog-w90VGjJ4.js → RuntimeSetupDialog-DTO5v0dP.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,bs as Y,eX as A,bI as G,j as e,eY as W,eZ as Q,br as V,bp as C,bo as U,e_ as X,bq as Z,e$ as J,f0 as q,f1 as ee,bx as te,f2 as ne,f3 as se,f4 as re,f5 as ae,aK as oe,ab as ie,f6 as ce,eq as le,f7 as F,d3 as de,d4 as ue,d6 as fe,d7 as xe,d8 as me,eT as pe,ev as E,J as k,B as S,ek as M,f8 as ve,G as D,Q as he,T as ge,U as Ce,V as je,c1 as be,_ as $,x as Re,Z as Ne}from"./index-BwTGkJbK.js";import{I as Pe}from"./inline-code-DyTKSC5b.js";import{l as Se}from"./list-runtime-types-VNj1C8TB.js";import{D as O,u as Te,C as we}from"./RuntimeConnectFlow-Dc5a8dlJ.js";var He=Object.defineProperty,j=(t,n)=>He(t,"name",{value:n,configurable:!0}),H,_="HoverCard",[z,tt]=Y(_,[A]),L=A(),[ye,w]=z(_),Ee=j(t=>{const{__scopeHoverCard:n,children:s,open:o,defaultOpen:r,onOpenChange:i,openDelay:a=700,closeDelay:f=300}=t,m=L(n),c=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,x]=G({prop:o,defaultProp:r??!1,onChange:i,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),c.current=window.setTimeout(()=>x(!0),a)},[a,x]),b=l.useCallback(()=>{clearTimeout(c.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>x(!1),f))},[f,x]),h=l.useCallback(()=>x(!1),[x]);return l.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(p.current)},[]),e.jsx(ye,{scope:n,open:u,onOpenChange:x,onOpen:d,onClose:b,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(W,{...m,children:s})})},"HoverCard"),ke="HoverCardTrigger",De=l.forwardRef(j(function(n,s){const{__scopeHoverCard:o,...r}=n,i=w(ke,o),a=L(o);return e.jsx(Q,{asChild:!0,...a,children:e.jsx(V.a,{"data-state":i.open?"open":"closed",...r,ref:s,onPointerEnter:C(n.onPointerEnter,T(i.onOpen)),onPointerLeave:C(n.onPointerLeave,T(i.onClose)),onFocus:C(n.onFocus,i.onOpen),onBlur:C(n.onBlur,i.onClose),onTouchStart:C(n.onTouchStart,f=>f.preventDefault())})})},"HoverCardTrigger")),B="HoverCardPortal",[Oe,_e]=z(B,{forceMount:void 0}),Le=j(t=>{const{__scopeHoverCard:n,forceMount:s,children:o,container:r}=t,i=w(B,n);return e.jsx(Oe,{scope:n,forceMount:s,children:e.jsx(U,{present:s||i.open,children:e.jsx(X,{asChild:!0,container:r,children:o})})})},"HoverCardPortal"),y="HoverCardContent",Ie=l.forwardRef(j(function(n,s){const o=_e(y,n.__scopeHoverCard),{forceMount:r=o.forceMount,...i}=n,a=w(y,n.__scopeHoverCard);return e.jsx(U,{present:r||a.open,children:e.jsx($e,{"data-state":a.open?"open":"closed",...i,onPointerEnter:C(n.onPointerEnter,T(a.onOpen)),onPointerLeave:C(n.onPointerLeave,T(a.onClose)),ref:s})})},"HoverCardContent")),$e=l.forwardRef(j(function(n,s){const{__scopeHoverCard:o,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:f,...m}=n,c=w(y,o),p=L(o),v=l.useRef(null),g=Z(s,v),[u,x]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return H=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=H,d.style.webkitUserSelect=H}}},[u]),l.useEffect(()=>{if(v.current){const d=j(()=>{x(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(c.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),l.useEffect(()=>{v.current&&K(v.current).forEach(b=>b.setAttribute("tabindex","-1"))}),e.jsx(J,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:C(a,d=>{d.preventDefault()}),onDismiss:c.onDismiss,children:e.jsx(q,{...p,...m,onPointerDown:C(m.onPointerDown,d=>{d.currentTarget.contains(d.target)&&x(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:g,style:{...m.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function T(t){return n=>n.pointerType==="touch"?void 0:t()}j(T,"excludeTouch");function K(t){const n=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:j(o=>o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;s.nextNode();)n.push(s.currentNode);return n}j(K,"getTabbableNodes");var Ae=Ee,Ue=De,Fe=Le,Me=Ie;function nt({openDelay:t=500,closeDelay:n=150,...s}){return e.jsx(Ae,{"data-slot":"hover-card",openDelay:t,closeDelay:n,...s})}function st({...t}){return e.jsx(Ue,{"data-slot":"hover-card-trigger",...t})}function rt({className:t,align:n="center",sideOffset:s=6,collisionPadding:o=8,...r}){const i=ee();return e.jsx(Fe,{"data-slot":"hover-card-portal",container:i,children:e.jsx(Me,{"data-slot":"hover-card-content",align:n,sideOffset:s,collisionPadding:o,className:te(re,se,ne,"w-64 origin-(--radix-hover-card-content-transform-origin) p-3 outline-hidden",t),...r})})}function ze(t,n,s){return s?ae(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:oe.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${ie(t)}`}}:null:null}function Be(t,n,s){return t?[t]:n||Se(s)}function Ke({runtime:t,types:n,requirements:s,registeredTypes:o=[],onRecheck:r,isRechecking:i=!1,renderConnect:a}){const f=M(),m=Be(t,n,o);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[m.map(c=>e.jsx(Ye,{type:c,requirements:s,registered:o.includes(c),renderConnect:a},c)),r&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:r,disabled:i,children:[e.jsx(ve,{className:D("size-3.5",i&&!f&&"animate-spin")}),"Check again"]})]})]})}function Ye({type:t,requirements:n,registered:s,renderConnect:o}){var N,P,I;const r=E(t),i=r.icon,a=n==null?void 0:n.runtimes[t],f=F(n,t,s),m=f.state==="ready",[c,p]=l.useState(!1),[v,g]=l.useState(!1);!m&&v&&g(!1);const u=m?ze(t,a==null?void 0:a.provider,!!o):null,x=a==null?void 0:a.dependencies.find(R=>R.status!=="satisfied"&&R.installHint),d=(x==null?void 0:x.installHint)??((N=r.setup)==null?void 0:N.installCommand),b=(x==null?void 0:x.infoUrl)??((P=r.setup)==null?void 0:P.infoUrl),h=!!a||!!r.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(i,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:r.label})]}),m&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(k,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[o==null?void 0:o({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),f.state==="unknown"&&e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:(I=a==null?void 0:a.dependencies.find(R=>R.status==="unknown"))==null?void 0:I.description}),!m&&f.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Ge,{type:t,connect:f.connect,renderConnect:o,installCommand:d,installInfoUrl:b,onShowDetails:()=>p(!0)})}),h&&e.jsxs(he,{open:c,onOpenChange:p,className:"mt-3",children:[e.jsxs(ge,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(Ce,{className:D("size-3.5 transition-transform",c&&"rotate-180")}),"Setup details"]}),e.jsx(je,{className:"mt-3 space-y-3",children:a?a.dependencies.map(R=>e.jsx(Ve,{dep:R},R.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(Pe,{children:["runtimes.",t]})," in your DorkOS config."]}),r.setup&&e.jsx(O,{command:r.setup.installCommand,infoUrl:r.setup.infoUrl,copyLabel:`Copy install command for ${r.label}`})]})})]})]})}function Ge({type:t,connect:n,renderConnect:s,installCommand:o,installInfoUrl:r,onShowDetails:i}){return n.kind==="install"?e.jsx(We,{type:t,label:n.label,installCommand:o,installInfoUrl:r}):s&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:s({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:i,children:n.label})}function We({type:t,label:n,installCommand:s,installInfoUrl:o}){const r=E(t),{provision:i,isPending:a,isError:f,errorMessage:m,progress:c,result:p}=Te(t);return a||p!=null&&p.ok?e.jsx(Qe,{message:(c==null?void 0:c.message)??`Installing ${r.label}…`}):f?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:m}),s&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:s,infoUrl:o,copyLabel:`Copy install command for ${r.label}`})]}),e.jsx(S,{size:"sm",onClick:i,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:i,children:n}),s&&e.jsx(we,{command:s,runtimeLabel:r.label})]})}function Qe({message:t}){const n=M();return e.jsxs($.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(Re,{size:"xs",className:D("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(Ne,{mode:"wait",children:e.jsx($.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ve({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(k,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(be,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function at({runtime:t,open:n,onOpenChange:s,renderConnect:o,onRuntimeReady:r,showConnectSuccess:i=!1}){const a=ce(),{data:f}=le(),m=t?E(t):null,c=F(a.data,t??"",f?t!==void 0&&t in f.capabilities:!0),p=a.data!==void 0,v=m!==null&&p&&c.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(r==null||r(t))},[n,p,v,t,r]);const[u,x]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&x(null),d.current=n},[n]);const b=o&&(i?h=>o({...h,onConnected:N=>{var P;(P=h.onConnected)==null||P.call(h,N),x(N)}}):o);return e.jsx(de,{open:n,onOpenChange:s,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(fe,{children:[e.jsx(xe,{children:m?m.label:"Your runtimes"}),e.jsx(me,{children:u?"Connected.":m?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(pe,{children:u?e.jsx(Xe,{success:u,onDone:()=>s(!1)}):e.jsx(Ke,{runtime:t,requirements:a.data,registeredTypes:f?Object.keys(f.capabilities):void 0,onRecheck:()=>void a.refetch(),isRechecking:a.isFetching,renderConnect:b})})]})})}function Xe({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(k,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{nt as H,at as R,st as a,rt as b,Ke as c};
|
|
1
|
+
import{r as l,br as G,f2 as $,bH as Y,j as e,f3 as W,f4 as Q,bq as V,bo as C,bn as U,f5 as J,bp as X,f6 as Z,f7 as q,f8 as ee,bw as te,f9 as ne,fa as se,fb as re,fc as ae,aK as oe,ab as ie,fd as ce,ep as le,fe as F,d2 as de,d3 as ue,d5 as fe,d6 as xe,d7 as me,e_ as pe,eu as E,J as D,B as S,ej as M,ff as ve,G as k,Q as he,T as ge,U as Ce,V as je,c0 as be,_ as I,x as Re,Z as Ne}from"./index-BR1m9FON.js";import{I as Pe}from"./inline-code-mh48Uhbi.js";import{l as Se}from"./list-runtime-types-DLmjtBMq.js";import{D as O,u as Te,C as we}from"./RuntimeConnectFlow-BYQnY5vv.js";var He=Object.defineProperty,j=(t,n)=>He(t,"name",{value:n,configurable:!0}),H,_="HoverCard",[z,tt]=G(_,[$]),L=$(),[ye,w]=z(_),Ee=j(t=>{const{__scopeHoverCard:n,children:s,open:o,defaultOpen:r,onOpenChange:i,openDelay:a=700,closeDelay:f=300}=t,m=L(n),c=l.useRef(0),p=l.useRef(0),v=l.useRef(!1),g=l.useRef(!1),[u,x]=Y({prop:o,defaultProp:r??!1,onChange:i,caller:_}),d=l.useCallback(()=>{clearTimeout(p.current),c.current=window.setTimeout(()=>x(!0),a)},[a,x]),b=l.useCallback(()=>{clearTimeout(c.current),!v.current&&!g.current&&(p.current=window.setTimeout(()=>x(!1),f))},[f,x]),h=l.useCallback(()=>x(!1),[x]);return l.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(p.current)},[]),e.jsx(ye,{scope:n,open:u,onOpenChange:x,onOpen:d,onClose:b,onDismiss:h,hasSelectionRef:v,isPointerDownOnContentRef:g,children:e.jsx(W,{...m,children:s})})},"HoverCard"),De="HoverCardTrigger",ke=l.forwardRef(j(function(n,s){const{__scopeHoverCard:o,...r}=n,i=w(De,o),a=L(o);return e.jsx(Q,{asChild:!0,...a,children:e.jsx(V.a,{"data-state":i.open?"open":"closed",...r,ref:s,onPointerEnter:C(n.onPointerEnter,T(i.onOpen)),onPointerLeave:C(n.onPointerLeave,T(i.onClose)),onFocus:C(n.onFocus,i.onOpen),onBlur:C(n.onBlur,i.onClose),onTouchStart:C(n.onTouchStart,f=>f.preventDefault())})})},"HoverCardTrigger")),B="HoverCardPortal",[Oe,_e]=z(B,{forceMount:void 0}),Le=j(t=>{const{__scopeHoverCard:n,forceMount:s,children:o,container:r}=t,i=w(B,n);return e.jsx(Oe,{scope:n,forceMount:s,children:e.jsx(U,{present:s||i.open,children:e.jsx(J,{asChild:!0,container:r,children:o})})})},"HoverCardPortal"),y="HoverCardContent",Ae=l.forwardRef(j(function(n,s){const o=_e(y,n.__scopeHoverCard),{forceMount:r=o.forceMount,...i}=n,a=w(y,n.__scopeHoverCard);return e.jsx(U,{present:r||a.open,children:e.jsx(Ie,{"data-state":a.open?"open":"closed",...i,onPointerEnter:C(n.onPointerEnter,T(a.onOpen)),onPointerLeave:C(n.onPointerLeave,T(a.onClose)),ref:s})})},"HoverCardContent")),Ie=l.forwardRef(j(function(n,s){const{__scopeHoverCard:o,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:f,...m}=n,c=w(y,o),p=L(o),v=l.useRef(null),g=X(s,v),[u,x]=l.useState(!1);return l.useEffect(()=>{if(u){const d=document.body;return H=d.style.userSelect||d.style.webkitUserSelect,d.style.userSelect="none",d.style.webkitUserSelect="none",()=>{d.style.userSelect=H,d.style.webkitUserSelect=H}}},[u]),l.useEffect(()=>{if(v.current){const d=j(()=>{x(!1),c.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var h;((h=document.getSelection())==null?void 0:h.toString())!==""&&(c.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",d),()=>{document.removeEventListener("pointerup",d),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!1}}},[c.isPointerDownOnContentRef,c.hasSelectionRef]),l.useEffect(()=>{v.current&&K(v.current).forEach(b=>b.setAttribute("tabindex","-1"))}),e.jsx(Z,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:f,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:C(a,d=>{d.preventDefault()}),onDismiss:c.onDismiss,children:e.jsx(q,{...p,...m,onPointerDown:C(m.onPointerDown,d=>{d.currentTarget.contains(d.target)&&x(!0),c.hasSelectionRef.current=!1,c.isPointerDownOnContentRef.current=!0}),ref:g,style:{...m.style,userSelect:u?"text":void 0,WebkitUserSelect:u?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function T(t){return n=>n.pointerType==="touch"?void 0:t()}j(T,"excludeTouch");function K(t){const n=[],s=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:j(o=>o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;s.nextNode();)n.push(s.currentNode);return n}j(K,"getTabbableNodes");var $e=Ee,Ue=ke,Fe=Le,Me=Ae;function nt({openDelay:t=500,closeDelay:n=150,...s}){return e.jsx($e,{"data-slot":"hover-card",openDelay:t,closeDelay:n,...s})}function st({...t}){return e.jsx(Ue,{"data-slot":"hover-card-trigger",...t})}function rt({className:t,align:n="center",sideOffset:s=6,collisionPadding:o=8,...r}){const i=ee();return e.jsx(Fe,{"data-slot":"hover-card-portal",container:i,children:e.jsx(Me,{"data-slot":"hover-card-content",align:n,sideOffset:s,collisionPadding:o,className:te(re,se,ne,"w-64 origin-(--radix-hover-card-content-transform-origin) p-3 outline-hidden",t),...r})})}function ze(t,n,s){return s?ae(t)==="provider-picker"?n?{idPrefix:"change",triggerLabel:"Change",cancelLabel:"Keep current source",connect:{kind:"provider-picker",label:"Change power source"},currentProvider:n}:null:oe.includes(t)?{idPrefix:"reconnect",triggerLabel:"Fix sign-in",cancelLabel:"Keep current sign-in",connect:{kind:"login",label:`Reconnect ${ie(t)}`}}:null:null}function Be(t,n,s){return t?[t]:n||Se(s)}function Ke({runtime:t,types:n,requirements:s,registeredTypes:o=[],onRecheck:r,isRechecking:i=!1,renderConnect:a}){const f=M(),m=Be(t,n,o);return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-setup-panel",children:[m.map(c=>e.jsx(Ge,{type:c,requirements:s,registered:o.includes(c),renderConnect:a},c)),r&&e.jsxs("div",{className:"flex items-center justify-end gap-3 pt-1",children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"Refresh after connecting."}),e.jsxs(S,{variant:"outline",size:"sm",className:"gap-2",onClick:r,disabled:i,children:[e.jsx(ve,{className:k("size-3.5",i&&!f&&"animate-spin")}),"Check again"]})]})]})}function Ge({type:t,requirements:n,registered:s,renderConnect:o}){var N,P,A;const r=E(t),i=r.icon,a=n==null?void 0:n.runtimes[t],f=F(n,t,s),m=f.state==="ready",[c,p]=l.useState(!1),[v,g]=l.useState(!1);!m&&v&&g(!1);const u=m?ze(t,a==null?void 0:a.provider,!!o):null,x=a==null?void 0:a.dependencies.find(R=>R.status!=="satisfied"&&R.installHint),d=(x==null?void 0:x.installHint)??((N=r.setup)==null?void 0:N.installCommand),b=(x==null?void 0:x.infoUrl)??((P=r.setup)==null?void 0:P.infoUrl),h=!!a||!!r.setup;return e.jsxs("section",{className:"border-border rounded-xl border p-4","data-testid":`runtime-section-${t}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(i,{className:"size-4"}),e.jsx("span",{className:"text-sm font-medium",children:r.label})]}),m&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-status-success-fg inline-flex items-center gap-1 text-xs","data-testid":`runtime-ready-${t}`,children:[e.jsx(D,{className:"size-3.5"})," Ready"]}),u&&!v&&e.jsx("button",{type:"button",onClick:()=>g(!0),className:"text-muted-foreground hover:text-foreground text-xs underline-offset-2 transition-colors hover:underline","data-testid":`runtime-${u.idPrefix}-${t}`,children:u.triggerLabel})]})]}),u&&v&&e.jsxs("div",{className:"mt-3 space-y-2","data-testid":`runtime-${u.idPrefix}-panel-${t}`,children:[o==null?void 0:o({type:t,connect:u.connect,...u.currentProvider?{currentProvider:u.currentProvider}:{},onConnected:()=>g(!1)}),e.jsx("button",{type:"button",onClick:()=>g(!1),className:"text-muted-foreground hover:text-foreground text-xs transition-colors","data-testid":`runtime-${u.idPrefix}-cancel-${t}`,children:u.cancelLabel})]}),f.state==="unknown"&&e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:(A=a==null?void 0:a.dependencies.find(R=>R.status==="unknown"))==null?void 0:A.description}),!m&&f.connect&&e.jsx("div",{className:"mt-3",children:e.jsx(Ye,{type:t,connect:f.connect,renderConnect:o,installCommand:d,installInfoUrl:b,onShowDetails:()=>p(!0)})}),h&&e.jsxs(he,{open:c,onOpenChange:p,className:"mt-3",children:[e.jsxs(ge,{className:"text-muted-foreground hover:text-foreground inline-flex items-center gap-1 text-xs transition-colors",children:[e.jsx(Ce,{className:k("size-3.5 transition-transform",c&&"rotate-180")}),"Setup details"]}),e.jsx(je,{className:"mt-3 space-y-3",children:a?a.dependencies.map(R=>e.jsx(Ve,{dep:R},R.name)):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not registered with this server. Install it, then enable"," ",e.jsxs(Pe,{children:["runtimes.",t]})," in your DorkOS config."]}),r.setup&&e.jsx(O,{command:r.setup.installCommand,infoUrl:r.setup.infoUrl,copyLabel:`Copy install command for ${r.label}`})]})})]})]})}function Ye({type:t,connect:n,renderConnect:s,installCommand:o,installInfoUrl:r,onShowDetails:i}){return n.kind==="install"?e.jsx(We,{type:t,label:n.label,installCommand:o,installInfoUrl:r}):s&&(n.kind==="login"||n.kind==="provider-picker")?e.jsx(e.Fragment,{children:s({type:t,connect:n})}):e.jsx(S,{size:"sm",onClick:i,children:n.label})}function We({type:t,label:n,installCommand:s,installInfoUrl:o}){const r=E(t),{provision:i,isPending:a,isError:f,errorMessage:m,progress:c,result:p}=Te(t);return a||p!=null&&p.ok?e.jsx(Qe,{message:(c==null?void 0:c.message)??`Installing ${r.label}…`}):f?e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-destructive text-xs",role:"alert",children:m}),s&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-muted-foreground text-xs",children:"You can install it yourself instead:"}),e.jsx(O,{command:s,infoUrl:o,copyLabel:`Copy install command for ${r.label}`})]}),e.jsx(S,{size:"sm",onClick:i,children:"Try again"})]}):e.jsxs("div",{children:[e.jsx(S,{size:"sm",onClick:i,children:n}),s&&e.jsx(we,{command:s,runtimeLabel:r.label})]})}function Qe({message:t}){const n=M();return e.jsxs(I.div,{className:"bg-muted flex items-center gap-2 rounded-lg px-3 py-2.5",initial:n?!1:{opacity:0},animate:{opacity:1},"data-testid":"provision-progress",children:[e.jsx(Re,{size:"xs",className:k("text-muted-foreground shrink-0",n&&"animate-none")}),e.jsx(Ne,{mode:"wait",children:e.jsx(I.span,{className:"truncate text-xs",initial:n?!1:{opacity:0},animate:{opacity:1},exit:n?void 0:{opacity:0},transition:{duration:.2},children:t},t)})]})}function Ve({dep:t}){const n=t.status==="satisfied";return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-center gap-x-2",children:[n?e.jsx(D,{className:"text-status-success size-3.5 shrink-0"}):e.jsx(be,{className:"text-status-warning-dot size-3.5 shrink-0"}),e.jsx("span",{className:"text-sm",children:t.name}),e.jsx("p",{className:"text-muted-foreground col-start-2 mt-1 text-xs",children:n&&t.version?`v${t.version}`:t.description})]}),!n&&(t.installHint||t.infoUrl)&&e.jsx(O,{command:t.installHint,infoUrl:t.infoUrl,copyLabel:`Copy install command for ${t.name}`})]})}function at({runtime:t,open:n,onOpenChange:s,renderConnect:o,onRuntimeReady:r,showConnectSuccess:i=!1}){const a=ce(),{data:f}=le(),m=t?E(t):null,c=F(a.data,t??"",f?t!==void 0&&t in f.capabilities:!0),p=a.data!==void 0,v=m!==null&&p&&c.state==="ready",g=l.useRef(null);l.useEffect(()=>{if(!n){g.current=null;return}if(t===void 0||!p)return;const h=g.current;g.current={runtime:t,ready:v},h!==null&&h.runtime===t&&!h.ready&&v&&(r==null||r(t))},[n,p,v,t,r]);const[u,x]=l.useState(null),d=l.useRef(n);l.useEffect(()=>{d.current&&!n&&x(null),d.current=n},[n]);const b=o&&(i?h=>o({...h,onConnected:N=>{var P;(P=h.onConnected)==null||P.call(h,N),x(N)}}):o);return e.jsx(de,{open:n,onOpenChange:s,children:e.jsxs(ue,{className:"sm:max-w-md",children:[e.jsxs(fe,{children:[e.jsx(xe,{children:m?m.label:"Your runtimes"}),e.jsx(me,{children:u?"Connected.":m?v?"Ready to use.":"Connect it to start a chat.":"Connect one to start a chat."})]}),e.jsx(pe,{children:u?e.jsx(Je,{success:u,onDone:()=>s(!1)}):e.jsx(Ke,{runtime:t,requirements:a.data,registeredTypes:f?Object.keys(f.capabilities):void 0,onRecheck:()=>void a.refetch(),isRechecking:a.isFetching,renderConnect:b})})]})})}function Je({success:t,onDone:n}){return e.jsxs("div",{className:"space-y-4","data-testid":"runtime-connected-panel",children:[e.jsxs("div",{className:"flex items-start gap-2.5",children:[e.jsx(D,{className:"text-status-success mt-0.5 size-4 shrink-0"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-xs leading-relaxed",children:t.body})]})]}),e.jsx(S,{size:"sm",className:"w-full",onClick:n,"data-testid":"runtime-connected-done",children:"Done"})]})}export{nt as H,at as R,st as a,rt as b,Ke as c};
|