openpond 0.2.69 → 0.2.70
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/api/client-context.d.ts +4 -0
- package/dist/app-server.js +1 -1
- package/dist/chunks/{account-context-V3KLSNKS.js → account-context-LEZDNYMR.js} +1 -1
- package/dist/chunks/{acp-ER6CUXG2.js → acp-QTA6IU6W.js} +1 -1
- package/dist/chunks/{acp-agent-AYJ5RPVF.js → acp-agent-N77HPAYQ.js} +1 -1
- package/dist/chunks/{actions-command-BBUS3HDK.js → actions-command-BZQCUDMD.js} +1 -1
- package/dist/chunks/{app-layer-JCEWGUDH.js → app-layer-YQQNLIXA.js} +1 -1
- package/dist/chunks/{app-server-connected-apps-ILXBFD3S.js → app-server-connected-apps-NH4667QJ.js} +1 -1
- package/dist/chunks/{app-server-runtime-43MCH5SY.js → app-server-runtime-B7AMBGQZ.js} +1 -1
- package/dist/chunks/apps-WG7WY5CB.js +2 -0
- package/dist/chunks/{chunk-RY46UPBO.js → chunk-2ACX7IW5.js} +1 -1
- package/dist/chunks/{chunk-LSKMALD6.js → chunk-54755JYM.js} +2 -2
- package/dist/chunks/{chunk-HKVFU3B3.js → chunk-5FSPDSAO.js} +1 -1
- package/dist/chunks/{chunk-R4EEGWXB.js → chunk-67U7PAMU.js} +1 -1
- package/dist/chunks/{chunk-2TGHZXJE.js → chunk-6C6ZCYTL.js} +1 -1
- package/dist/chunks/{chunk-7RSQOC5M.js → chunk-7TM25J6S.js} +1 -1
- package/dist/chunks/{chunk-M5X7XKXY.js → chunk-BGMAWETL.js} +7 -7
- package/dist/chunks/{chunk-7EQLW2KM.js → chunk-BLNEHU62.js} +1 -1
- package/dist/chunks/{chunk-R6I623SZ.js → chunk-CUB6PWAJ.js} +6 -6
- package/dist/chunks/chunk-DFZTRMTL.js +2 -0
- package/dist/chunks/{chunk-4N4EH3RJ.js → chunk-EJOV6Z6F.js} +1 -1
- package/dist/chunks/{chunk-RCRZXHAI.js → chunk-EWH64WRR.js} +1 -1
- package/dist/chunks/{chunk-WNXUSELC.js → chunk-EXAJ2B4I.js} +1 -1
- package/dist/chunks/{chunk-TB5P3FWM.js → chunk-FHDH4OUA.js} +1 -1
- package/dist/chunks/chunk-HES4VP3D.js +2 -0
- package/dist/chunks/{chunk-AYOMVI7J.js → chunk-HIMG7S5E.js} +1 -1
- package/dist/chunks/{chunk-2LJCJOJ7.js → chunk-HLJJAOI2.js} +1 -1
- package/dist/chunks/{chunk-NZDLL6JN.js → chunk-HYUTDZ3N.js} +1 -1
- package/dist/chunks/chunk-J7X72QUY.js +2 -0
- package/dist/chunks/chunk-JF7WWLNW.js +2 -0
- package/dist/chunks/{chunk-4KNPCJR4.js → chunk-JVNKSU27.js} +1 -1
- package/dist/chunks/{chunk-XT4CSKHM.js → chunk-JZKTBYNB.js} +1 -1
- package/dist/chunks/{chunk-JEMECEQH.js → chunk-KHDCMVEJ.js} +1 -1
- package/dist/chunks/{chunk-BDZDWHBJ.js → chunk-KURL76NW.js} +1 -1
- package/dist/chunks/chunk-MZKCW6CB.js +2 -0
- package/dist/chunks/{chunk-UMAVVMXL.js → chunk-OL3L3U36.js} +1 -1
- package/dist/chunks/{chunk-IIT66347.js → chunk-OXQ2WFIH.js} +1 -1
- package/dist/chunks/{chunk-Z5CQXPIS.js → chunk-PPF6EBTQ.js} +1 -1
- package/dist/chunks/{chunk-V24VHT76.js → chunk-REGKOCDO.js} +1 -1
- package/dist/chunks/{chunk-PSY6IRJE.js → chunk-TAXCMCYZ.js} +1 -1
- package/dist/chunks/{chunk-NW6WGGSL.js → chunk-TCTBCAI6.js} +1 -1
- package/dist/chunks/{chunk-EWDDDHJN.js → chunk-UZNRH6I3.js} +1 -1
- package/dist/chunks/{chunk-22RLEU3Q.js → chunk-Y4E5AAI7.js} +1 -1
- package/dist/chunks/chunk-YAA7F5LI.js +2 -0
- package/dist/chunks/{chunk-G4FRBT7G.js → chunk-ZK3ET5EP.js} +2 -2
- package/dist/chunks/{cli-R7TAP6Z2.js → cli-ALEEFAJ7.js} +1 -1
- package/dist/chunks/{command-LNOVZQSK.js → command-5AXJMFYC.js} +11 -11
- package/dist/chunks/{configuration-command-C3QBDFND.js → configuration-command-5LUNWPOL.js} +1 -1
- package/dist/chunks/{connected-app-executor-LAEAQUJS.js → connected-app-executor-DHXZE4X3.js} +1 -1
- package/dist/chunks/connected-evidence-NWMPICKJ.js +2 -0
- package/dist/chunks/{connected-starting-assets-5LAJ7CZY.js → connected-starting-assets-NRVXIKQ2.js} +1 -1
- package/dist/chunks/{continual-FVOLGGOE.js → continual-UCKQ2QLH.js} +1 -1
- package/dist/chunks/core-commands-ZPBX35M2.js +2 -0
- package/dist/chunks/datasets-6K3ZANIV.js +2 -0
- package/dist/chunks/desktop-test-57INNJ76.js +3 -0
- package/dist/chunks/evaluation-coordination-B7CN4R2D.js +2 -0
- package/dist/chunks/experiment-improvements-G357VLDB.js +2 -0
- package/dist/chunks/experiments-BHQO26LJ.js +2 -0
- package/dist/chunks/experiments-signal-BI6NKETB.js +2 -0
- package/dist/chunks/{help-PLQJOP4P.js → help-UQN5RUPA.js} +1 -1
- package/dist/chunks/{hosted-app-server-composition-GZES7QXJ.js → hosted-app-server-composition-WDDO6F23.js} +1 -1
- package/dist/chunks/{hosted-experiment-improvement-VG2WE7XZ.js → hosted-experiment-improvement-VVYXQ65K.js} +1 -1
- package/dist/chunks/{hosted-tasksets-V24IBVJX.js → hosted-tasksets-KCLNMPG5.js} +1 -1
- package/dist/chunks/human-review-PX6DBIFT.js +2 -0
- package/dist/chunks/{import-SI24Z7EF.js → import-2HEYPHPW.js} +1 -1
- package/dist/chunks/learning-LSXBL5DB.js +2 -0
- package/dist/chunks/{local-harness-taskset-review-XQHQ6JCR.js → local-harness-taskset-review-E5GN5LTR.js} +1 -1
- package/dist/chunks/opchat-66BCRKEZ.js +3 -0
- package/dist/chunks/opchat-bounded-chat-KQWXZVFN.js +2 -0
- package/dist/chunks/organizations-IOYWDOCC.js +2 -0
- package/dist/chunks/{profile-TD5U3INY.js → profile-YH6G3ZTD.js} +1 -1
- package/dist/chunks/{project-action-payload-TK6G4VMC.js → project-action-payload-53OH6WDH.js} +1 -1
- package/dist/chunks/project-agent-RYVMKW2F.js +2 -0
- package/dist/chunks/{runtime-Q7JUJO4D.js → runtime-ISLJIGWC.js} +1 -1
- package/dist/chunks/sandbox-command-DI45NRTV.js +2 -0
- package/dist/chunks/{sandbox-template-GOY7QQUY.js → sandbox-template-T42MDUSR.js} +1 -1
- package/dist/chunks/{saved-work-M6PUHKCC.js → saved-work-54I5ZJTC.js} +1 -1
- package/dist/chunks/setup-D6TY2GWV.js +2 -0
- package/dist/chunks/{src-MT4B43TD.js → src-7RN7BF4W.js} +1 -1
- package/dist/chunks/{src-C3ZUESMK.js → src-LF5X4RNQ.js} +1 -1
- package/dist/chunks/{store-model-configuration-6L3OYXF4.js → store-model-configuration-AYFGMC5D.js} +1 -1
- package/dist/chunks/{store-model-project-preparation-AAEKCF6V.js → store-model-project-preparation-5DEIS7TB.js} +1 -1
- package/dist/chunks/{store-taskset-drafts-FRFL6ITK.js → store-taskset-drafts-EAOOY6CR.js} +1 -1
- package/dist/chunks/{taskset-UDDLFYKV.js → taskset-HNDIGYQG.js} +1 -1
- package/dist/chunks/{teams-bot-YCUTDDDC.js → teams-bot-Z5CZLWE4.js} +1 -1
- package/dist/chunks/{training-5UMT45UL.js → training-JTYQA7GA.js} +1 -1
- package/dist/chunks/training-hardware-MR4FUC4U.js +3 -0
- package/dist/chunks/training-hosted-36SZFS4U.js +2 -0
- package/dist/chunks/{web-search-ZEKJHZW4.js → web-search-FTVNZ7PH.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/skills/manifest.json +1 -1
- package/dist/web/assets/{App-CCuh99JW.js → App-CXhxya9x.js} +4 -4
- package/dist/web/assets/{AppDialog-CxjDHVk9.js → AppDialog-x1HU1uLv.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-CKJIVpKa.js → AppTerminalPanel-CNIKmqKc.js} +2 -2
- package/dist/web/assets/{AppToastContext-EpiT1dHs.js → AppToastContext-DNWd43HS.js} +1 -1
- package/dist/web/assets/{AppsView-BsMyPX_3.js → AppsView-BvOD83Z1.js} +1 -1
- package/dist/web/assets/{AttachmentTypeIcon-BXvZy5gB.js → AttachmentTypeIcon-BLdDr3JZ.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-BIIV4aq4.js → BrowserSidebar-Ar0FlFKg.js} +1 -1
- package/dist/web/assets/{CartesianChart-brqLBqnF.js → CartesianChart-tS7f1HZv.js} +1 -1
- package/dist/web/assets/{ChatTimelineEntry-CwZbn16X.js → ChatTimelineEntry-z7_kur3h.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-BU4uc4tZ.js → CollaborationTabs-CaiFEKrv.js} +1 -1
- package/dist/web/assets/{CommandMenu-DkWpXR55.js → CommandMenu-BpubEqaA.js} +1 -1
- package/dist/web/assets/{CommunityView-CsSxJZGn.js → CommunityView-TGR4s99l.js} +1 -1
- package/dist/web/assets/{ComposerAttachments-BdJGCYzI.js → ComposerAttachments-DPWCjKXz.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-CWy0j1vv.js → ComposerCreateImproveStrip-Drji01_6.js} +1 -1
- package/dist/web/assets/{ConversationImportsSettings-DCmiakbZ.js → ConversationImportsSettings-B_oW0cz7.js} +1 -1
- package/dist/web/assets/{DatasetReviewImport-DEnF_pGu.js → DatasetReviewImport-Dr3unJSY.js} +1 -1
- package/dist/web/assets/{ExperimentTrainingDataWorkspace-WhwQ0QBi.js → ExperimentTrainingDataWorkspace-DObvpJAw.js} +2 -2
- package/dist/web/assets/{FilePagePreview-BRhhz99q.js → FilePagePreview-9kkXbARN.js} +2 -2
- package/dist/web/assets/{GetStartedView-CLVD-qEi.js → GetStartedView-Dv2b_SlH.js} +1 -1
- package/dist/web/assets/{GettingStartedDialog-CMxaAMg-.js → GettingStartedDialog-sPaPMc61.js} +1 -1
- package/dist/web/assets/{HostedModelLearningReview-Cn-j-rDo.js → HostedModelLearningReview-BlwhGxS6.js} +1 -1
- package/dist/web/assets/HostedModelLearningSettings-B5ahk3je.js +1 -0
- package/dist/web/assets/{HtmlVisual-D5y2WG9L.js → HtmlVisual-rGsClq0p.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-BxRmYD6h.js → LabModelVersionDetailPage-Da7AwZWV.js} +1 -1
- package/dist/web/assets/{LabModelWorkspace-u2Ulm_z4.js → LabModelWorkspace-DTeYViWH.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-C7IceJTJ.js → LabSkillSidebar-BieHbNl6.js} +1 -1
- package/dist/web/assets/{LabsRoute-CbztQaEf.js → LabsRoute-D3XqPB0-.js} +4 -4
- package/dist/web/assets/{LearningBatchesPage-CJqgZNvM.js → LearningBatchesPage-CCBuf2u4.js} +1 -1
- package/dist/web/assets/{MainChatThread-DNMfrrRq.js → MainChatThread-B6BQJfcq.js} +2 -2
- package/dist/web/assets/{MainPane-CQQxSDPS.js → MainPane-D3fQou29.js} +6 -6
- package/dist/web/assets/{ModelProjectPageHeader-Dge19aE1.js → ModelProjectPageHeader-BZn9Lu_J.js} +1 -1
- package/dist/web/assets/{NativeSetupTerminal-D4JnbpyD.js → NativeSetupTerminal-Bglqab_g.js} +2 -2
- package/dist/web/assets/{NativeSkillSidebar-Jzx1BeKV.js → NativeSkillSidebar-pUGRdnV_.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-DcnGzEd9.js → NewProjectDialog-BpHN38MA.js} +1 -1
- package/dist/web/assets/{OutputsPage-Cmk15Vt_.js → OutputsPage-LunDCQ6w.js} +1 -1
- package/dist/web/assets/{PageChrome-Cz_fCqtn.js → PageChrome-DThEcWAx.js} +1 -1
- package/dist/web/assets/{ProjectsPage-BZ3Eo3Mz.js → ProjectsPage-vct_TQgL.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-C6H2vU9N.js → RightChatPanelStack-CgFK7DY0.js} +1 -1
- package/dist/web/assets/RightSidebarHomePanel-BJmzUcmy.js +1 -0
- package/dist/web/assets/{ScheduledWorkPage-CAkSwM0T.js → ScheduledWorkPage-mmaZfybl.js} +1 -1
- package/dist/web/assets/{SettingsView-DvQXGw3_.js → SettingsView-CJfeRsWR.js} +3 -3
- package/dist/web/assets/{TasksetDraftEditorPrimitives-JuU1k8vr.js → TasksetDraftEditorPrimitives-CuimAfkv.js} +1 -1
- package/dist/web/assets/{TeamChatView-DmHjr8W9.js → TeamChatView-BcK0lF1b.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-DlaM9d8F.js → TerminalOverlay-0pzEvy-C.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-ClpylNsr.js → TrainingCreationPanel-CcyzFz7l.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-6tH2xSDj.js → TrainingDraftPanel-DSLZXdLz.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-CzDqxOYM.js → UsageSettingsSection-BT9pcnCn.js} +1 -1
- package/dist/web/assets/WorkSidebarPanel-CP-nHAsJ.js +1 -0
- package/dist/web/assets/{WorkspaceDiffPanel-B4e0lyF7.js → WorkspaceDiffPanel-Bbz5qrVA.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-D01ZkZZF.js → WorkspaceEnvironmentMenu-6hXpvMTl.js} +1 -1
- package/dist/web/assets/{WorkspaceFileLocation-C5s_njZb.js → WorkspaceFileLocation-BijVemBl.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-DjPZ6KIh.js → WorkspaceGitDialogs-BOO0E5i9.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-CC4sfOiU.js → WorkspaceMonacoEditor-B_YzK7Do.js} +3 -3
- package/dist/web/assets/{WorkspacePdfPreview-vszQqFa4.js → WorkspacePdfPreview-CFti1fvu.js} +2 -2
- package/dist/web/assets/{WorkspacePresentationPreview-DQTvhaRD.js → WorkspacePresentationPreview-DPAhNaV6.js} +1 -1
- package/dist/web/assets/{bot-Doyx3T4j.js → bot-BE2rL_qv.js} +1 -1
- package/dist/web/assets/chevron-down-Bn8yph2O.js +1 -0
- package/dist/web/assets/chevron-right-BU-jUmb2.js +1 -0
- package/dist/web/assets/chevron-up-DacwuDJZ.js +1 -0
- package/dist/web/assets/{chunk-C3TS766N-ppRhs95p.js → chunk-C3TS766N-j1MK0e3c.js} +1 -1
- package/dist/web/assets/{client-DwZ92xtu.js → client-BnJhN-14.js} +1 -1
- package/dist/web/assets/{client-choice-storage-DitqKiIT.js → client-choice-storage-CQ0CNkzG.js} +1 -1
- package/dist/web/assets/{cloud-upload-HdzNTgr2.js → cloud-upload-DFjZE4O4.js} +1 -1
- package/dist/web/assets/{copy-DTQhoBNg.js → copy-CGrLUtw5.js} +1 -1
- package/dist/web/assets/{cssMode-BRTtfXxU.js → cssMode-DvRw2fUx.js} +1 -1
- package/dist/web/assets/{external-link-H1629UU6.js → external-link-3ZnEFUXd.js} +1 -1
- package/dist/web/assets/{folder-open-CAGdWOrr.js → folder-open-i9n8450i.js} +1 -1
- package/dist/web/assets/{folder-plus-C14cs2mE.js → folder-plus-cu8Md_ej.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-DFUfuVvF.js → git-commit-horizontal-CwckmC09.js} +1 -1
- package/dist/web/assets/{htmlMode-BVaCcL76.js → htmlMode-8VF4Ovtw.js} +1 -1
- package/dist/web/assets/{icons-Bk2b68aC.js → icons-4yRSxBZj.js} +1 -1
- package/dist/web/assets/{image-0DPVY6Ev.js → image-D-umhyyK.js} +1 -1
- package/dist/web/assets/{index-B6XX_0h3.js → index-DiVhx1GM.js} +2 -2
- package/dist/web/assets/{info-C8b_tafZ.js → info-Dq2RsPDJ.js} +1 -1
- package/dist/web/assets/{jsonMode-BCKKQmmV.js → jsonMode-CvCYQHkB.js} +1 -1
- package/dist/web/assets/loader-circle-DBl6qqtR.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-DozmNUOx.js → lspLanguageFeatures-CjufNNFF.js} +1 -1
- package/dist/web/assets/{maximize-2-CByk9-zN.js → maximize-2-CKY8dua6.js} +1 -1
- package/dist/web/assets/{message-square-C889vRqm.js → message-square-CVDgKlKX.js} +1 -1
- package/dist/web/assets/{monaco.contribution-BITdsRbn.js → monaco.contribution-BYAgjZbj.js} +2 -2
- package/dist/web/assets/{monaco.contribution-DxAV1oS5.js → monaco.contribution-BYY3-y9l.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BqA-XZ44.js → monaco.contribution-Bh0CKj9i.js} +2 -2
- package/dist/web/assets/{monaco.contribution-B9q6qbbo.js → monaco.contribution-PjJ1258q.js} +2 -2
- package/dist/web/assets/{monitor-BtxlcLuI.js → monitor-UYe42gew.js} +1 -1
- package/dist/web/assets/{paperclip-BeIdaspf.js → paperclip-DrlSVUoz.js} +1 -1
- package/dist/web/assets/{pdf-perlzwEB.js → pdf-BMhday2W.js} +1 -1
- package/dist/web/assets/play-DIqZnaNf.js +1 -0
- package/dist/web/assets/plus-CFNxAPMK.js +1 -0
- package/dist/web/assets/{presentation-0bzvu6_u.js → presentation-DcZKqH7w.js} +1 -1
- package/dist/web/assets/{python-B9hOnkOI.js → python-CiA01i07.js} +1 -1
- package/dist/web/assets/{refresh-cw-D61-Ozk3.js → refresh-cw-00D-GDnF.js} +1 -1
- package/dist/web/assets/{save-iEMNZoPe.js → save-CXe7bqR7.js} +1 -1
- package/dist/web/assets/{settings-lists-C84qxFmP.js → settings-lists-B5J40WM6.js} +1 -1
- package/dist/web/assets/square-DJEaBefe.js +1 -0
- package/dist/web/assets/{square-terminal-Djpzo2Qs.js → square-terminal-DxC7TTds.js} +1 -1
- package/dist/web/assets/{submit-issue-command-HfKzyxg5.js → submit-issue-command-Dq3TqJLV.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-ClsXu39R.js → toggleHighContrast-BH3Jckfo.js} +1 -1
- package/dist/web/assets/{training-model-data-CIysl8wH.js → training-model-data-B6IZ3x-t.js} +1 -1
- package/dist/web/assets/{tsMode-nbmaMc-D.js → tsMode-DXkj4bqC.js} +1 -1
- package/dist/web/assets/{upload-C6ug8RD-.js → upload-B3KRHVHl.js} +1 -1
- package/dist/web/assets/{useAccountSettings-Dr9h4Qz_.js → useAccountSettings-BGRkTRrp.js} +1 -1
- package/dist/web/assets/{useAgentInventory-ByCk2JAv.js → useAgentInventory-D_1AlAZJ.js} +1 -1
- package/dist/web/assets/{useChatContextSelection-C0eMm2g6.js → useChatContextSelection-hoMSuUSE.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-Do0y_leJ.js → useLocalAgentSchedules-DxTER7Ow.js} +1 -1
- package/dist/web/assets/{useQuery-D2MQ7e5U.js → useQuery-DkPec_9x.js} +1 -1
- package/dist/web/assets/{wifi-off-Dr-CapyW.js → wifi-off-CMzpvbWl.js} +1 -1
- package/dist/web/assets/{workers-DKvM2NdM.js → workers-ziY_bTv2.js} +1 -1
- package/dist/web/assets/x-omjwMPbJ.js +1 -0
- package/dist/web/assets/{yaml-C02vq4ar.js → yaml-mSvqVSko.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunks/apps-VNFGMQFG.js +0 -2
- package/dist/chunks/chunk-APKXXAUF.js +0 -2
- package/dist/chunks/chunk-JCLTFDVW.js +0 -2
- package/dist/chunks/chunk-KTIBXRWQ.js +0 -2
- package/dist/chunks/chunk-YDZBX4XQ.js +0 -2
- package/dist/chunks/connected-evidence-VKY6O2JW.js +0 -2
- package/dist/chunks/core-commands-5TNBVR72.js +0 -2
- package/dist/chunks/datasets-BIDZJYDC.js +0 -2
- package/dist/chunks/desktop-test-BY2MS3UL.js +0 -3
- package/dist/chunks/evaluation-coordination-FXB4DXZA.js +0 -2
- package/dist/chunks/experiment-improvements-JPDLKZXD.js +0 -2
- package/dist/chunks/experiments-IEN7RXLX.js +0 -2
- package/dist/chunks/experiments-signal-L32D36NH.js +0 -2
- package/dist/chunks/human-review-6V6EMNVN.js +0 -2
- package/dist/chunks/learning-LAXMGWSQ.js +0 -2
- package/dist/chunks/opchat-SV67HVMX.js +0 -3
- package/dist/chunks/opchat-bounded-chat-KLMIYSZZ.js +0 -2
- package/dist/chunks/organizations-OZZFX7RG.js +0 -2
- package/dist/chunks/project-agent-FFXPNXCO.js +0 -2
- package/dist/chunks/sandbox-command-4BCUDAED.js +0 -2
- package/dist/chunks/setup-RMZ2BHLM.js +0 -2
- package/dist/chunks/training-hardware-UWQCRDMV.js +0 -3
- package/dist/chunks/training-hosted-CKSDRVL6.js +0 -2
- package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +0 -1
- package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +0 -1
- package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +0 -1
- package/dist/web/assets/chevron-down-DX1hzujj.js +0 -1
- package/dist/web/assets/chevron-right-DHN0y3KC.js +0 -1
- package/dist/web/assets/chevron-up-_QrW88NF.js +0 -1
- package/dist/web/assets/loader-circle-y-SSPwpk.js +0 -1
- package/dist/web/assets/play-CHXXdkuO.js +0 -1
- package/dist/web/assets/plus-DFFWjhPw.js +0 -1
- package/dist/web/assets/square-BE_4JMR3.js +0 -1
- package/dist/web/assets/x-Jx2jlP9u.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ConversationImportsSettings-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,h as n,m as r,t as i}from"./index-B6XX_0h3.js";import{m as a,o,p as s,r as c,v as l}from"./schemas-Brv9Vmnk.js";import{v as u}from"./settings-BC-bzgk6.js";import{i as d,o as f,t as p}from"./client-choice-storage-DitqKiIT.js";import{r as m,t as h}from"./WorkspaceDiffPanel-B4e0lyF7.js";import{n as g}from"./ponder-desktop-Ca-9KggQ.js";import{C as _,D as v,O as y,S as b,a as x,c as S,i as C,r as w,s as T,u as E,v as D,x as O,y as k}from"./app-models-BUdzQbXo.js";import{n as A}from"./api-client-DJRVOFzS.js";import{t as j}from"./icons-Bk2b68aC.js";import{F as M,H as N,I as P,N as F,P as I,z as L}from"./training-model-data-CIysl8wH.js";import{i as R,n as ee,r as te,t as ne}from"./wifi-off-Dr-CapyW.js";import{t as z}from"./bot-Doyx3T4j.js";import{t as B}from"./chevron-down-DX1hzujj.js";import{t as V}from"./chevron-right-DHN0y3KC.js";import{t as re}from"./chevron-up-_QrW88NF.js";import{t as H}from"./cloud-upload-HdzNTgr2.js";import{t as U}from"./external-link-H1629UU6.js";import{t as W}from"./folder-open-CAGdWOrr.js";import{t as G}from"./folder-plus-C14cs2mE.js";import{t as ie}from"./git-commit-horizontal-DFUfuVvF.js";import{i as ae,o as K,r as oe,t as se}from"./settings-lists-C84qxFmP.js";import{t as ce}from"./loader-circle-y-SSPwpk.js";import{t as le}from"./message-square-C889vRqm.js";import{t as ue}from"./play-CHXXdkuO.js";import{t as q}from"./plus-DFFWjhPw.js";import{t as J}from"./refresh-cw-D61-Ozk3.js";import{t as de}from"./save-iEMNZoPe.js";import{t as Y}from"./x-Jx2jlP9u.js";import{r as fe}from"./AppToastContext-EpiT1dHs.js";import{t as pe}from"./AppDialog-CxjDHVk9.js";import{n as me,r as he}from"./organization-types-PP-yuR2J.js";import{Cn as ge,Ct as _e,Dn as ve,Gt as X,Nt as ye,Qt as be,S as xe,St as Se,Tn as Z,Ut as Ce,X as we,Y as Te,Yt as Ee,Z as De,Zt as Oe,_n as ke,_t as Ae,an as je,bn as Me,cn as Ne,dn as Pe,dt as Fe,et as Ie,fr as Le,gn as Re,hr as ze,mn as Be,n as Ve,nt as He,on as Ue,qt as We,tn as Ge,tt as Ke,un as qe,ut as Je,xt as Ye,yt as Xe}from"./App-CCuh99JW.js";/* empty css */import{t as Ze}from"./useAccountSettings-Dr9h4Qz_.js";import{t as Qe}from"./useLocalAgentSchedules-Do0y_leJ.js";var $e=a({scope:g,authorizationRevision:s().int().positive()}).strict(),et=a({id:l().min(1).max(200),name:l().min(1).max(300),cwd:l().min(1).max(8192).nullable(),revision:l().regex(/^[a-f0-9]{64}$/).nullable(),available:o(),previouslyShared:o(),shared:o()}).strict(),tt=a({authority:$e.nullable(),projects:et.array().max(100),nextCursor:l().min(1).max(200).nullable()}).strict();a({projectId:l().min(1).max(200),shared:o(),expectedRevision:l().regex(/^[a-f0-9]{64}$/).nullable(),expectedAuthority:$e}).strict();var nt=a({projectId:l().min(1).max(200),shared:o(),discovery:c([`current`,`pending`])}).strict(),rt=j(`clipboard-copy`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]),it=j(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),at=j(`hard-drive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),ot=j(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),st=j(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),ct=j(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),lt=j(`circle-user`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`path`,{d:`M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662`,key:`154egf`}]]),Q=e(t(),1);function ut(e){let t=e instanceof Error?e.message:String(e);return t===`ponder_desktop_project_authority_changed`?`Desktop access changed. Refresh before sharing a project.`:t===`ponder_desktop_project_changed`?`The project folders changed. Refresh and review the project before sharing.`:t.length>240||/<(?:!doctype|html|body|head)\b/i.test(t)?`Pal desktop access is temporarily unavailable. Please refresh to try again.`:t}function dt(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useRef)(!1);fe(a);let d=(0,Q.useCallback)(async t=>{if(!e)throw Error(`Connect to the desktop app to share a project.`);let n=await A(e,`/v1/ponder/desktop`,{signal:t}),r=[],i=new Set,a=null,o=null;do{let n=tt.parse(await A(e,`/v1/ponder/desktop/projects${a?`?after=${encodeURIComponent(a)}`:``}`,{signal:t}));if(a&&JSON.stringify(o)!==JSON.stringify(n.authority))throw Error(`Desktop access changed. Refresh the projects before sharing.`);if(o=n.authority,r.push(...n.projects),a=n.nextCursor,a&&i.has(a))throw Error(`Unable to load the complete project list.`);a&&i.add(a)}while(a);return{desktop:n,projects:r,authority:o}},[e]),f=(0,Q.useCallback)(async()=>{if(u.current||!e)return;let t=l.current;u.current=!0,i(!0),o(null),n(null);try{let e=await d();l.current===t&&n(e)}catch(e){l.current===t&&o(ut(e))}finally{l.current===t&&(u.current=!1,i(!1))}},[e,d]);(0,Q.useEffect)(()=>{let t=++l.current,r=new AbortController;return u.current=!0,n(null),o(null),c(null),i(!0),e?d(r.signal).then(e=>{l.current===t&&n(e)}).catch(e=>{!r.signal.aborted&&l.current===t&&o(ut(e))}).finally(()=>{l.current===t&&(u.current=!1,i(!1))}):(u.current=!1,i(!1)),()=>{++l.current,r.abort(),u.current=!1}},[e,d]);async function p(r,a){if(!e||!t?.authority||u.current)return;let s=l.current;u.current=!0,i(!0),o(null),c(null);try{let i=nt.parse(await A(e,`/v1/ponder/desktop/share-project`,{method:`POST`,body:JSON.stringify({projectId:r.id,shared:a,expectedRevision:r.revision,expectedAuthority:t.authority})}));if(l.current!==s)return;n(null),c(i.discovery===`pending`?`Project access was saved. Refresh to check whether Pal has received the updated targets.`:a?`${r.name} is shared with Pal.`:`${r.name} is no longer shared with Pal.`);let o=await d();l.current===s&&n(o)}catch(e){l.current===s&&(n(null),o(ut(e)))}finally{l.current===s&&(u.current=!1,i(!1))}}return{access:t,busy:r,error:a,notice:s,refresh:f,change:p}}var $=r();function ft({connection:e}){let{access:t,busy:n,error:r,notice:i,refresh:a,change:o}=dt(e),[s,c]=(0,Q.useState)(``),l=t?.projects.find(e=>e.id===s),u=!!t?.authority,d=[{value:``,label:`Choose a local project`},...(t?.projects??[]).map(e=>({value:e.id,label:e.name,description:e.shared?`Shared with Pal`:e.available?e.cwd??void 0:`Folder unavailable`}))];return(0,$.jsxs)(`section`,{className:`remote-access-settings`,"aria-label":`Pal desktop access`,children:[(0,$.jsx)(`h2`,{children:`Desktop access`}),(0,$.jsx)(`p`,{children:`Share a local project so Pal can start tasks with the agents configured on this computer.`}),(0,$.jsxs)(`div`,{className:`account-summary remote-access-summary`,children:[(0,$.jsx)(`div`,{className:`account-summary-main`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`This computer`}),(0,$.jsx)(`small`,{role:`status`,children:n?`Checking desktop access…`:u?`Connected to Pal`:t?.desktop.ownerScope?`Desktop connection unavailable`:r?`Unable to load desktop access`:`Sign in and select a workspace`})]})}),(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:n||!e,onClick:()=>void a(),children:`Refresh desktop access`})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Local project`}),(0,$.jsx)(`small`,{children:`Current account and workspace`})]}),(0,$.jsxs)(`div`,{className:`account-summary`,children:[(0,$.jsx)(`div`,{className:`account-summary-main`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Ce,{value:l?s:``,options:d,label:`Local project for Pal`,disabled:n||!u,searchable:!0,onChange:c}),l?.cwd&&(0,$.jsx)(`small`,{children:l.cwd}),l&&(0,$.jsx)(`small`,{children:l.shared?`Shared with Pal`:l.previouslyShared?`Share again for this connection`:`Not shared with Pal`})]})}),(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:n||!l||!u||!l.shared&&(!l.available||!l.revision),onClick:()=>l&&void o(l,!l.shared),children:l?.shared?`Stop sharing`:`Share with Pal`})]})]}),(0,$.jsx)(`p`,{children:`Sharing lets Pal request local work in this project and receive the requested results. Tasks use your existing agent permissions. Stop sharing here to remove it from discovery.`}),u&&t?.projects.length===0&&(0,$.jsx)(`p`,{children:`No saved local projects are available. Add a project in the app, then refresh.`}),i&&(0,$.jsx)(`p`,{role:`status`,children:i}),r&&(0,$.jsx)(`p`,{children:`Desktop access could not be loaded. Refresh to try again.`})]})}function pt({connection:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)({model:null,watchHostedThreads:!0,watchLocalThreads:!0,watchWorkflows:!0,notifications:`attention`,supervision:{mode:`off`,intervalMinutes:5}}),[a,o]=(0,Q.useState)(0),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1);ae(e,t?null:s,()=>o(e=>e+1));let[d,f]=(0,Q.useState)(()=>localStorage.getItem(`openpond:ponder-notifications`)===`on`);(0,Q.useEffect)(()=>{if(!e)return;let t=new AbortController;return n(null),i({model:null,watchHostedThreads:!0,watchLocalThreads:!0,watchWorkflows:!0,notifications:`attention`,supervision:{mode:`off`,intervalMinutes:5}}),c(null),A(e,`/v1/ponder/settings`,{signal:t.signal}).then(e=>{n(e),i(e.settings)}).catch(e=>{t.signal.aborted||c(e instanceof Error?e.message:String(e))}),()=>t.abort()},[e,a]);async function p(){if(e&&t&&!l){u(!0);try{let t=await A(e,`/v1/ponder/settings`,{method:`POST`,body:JSON.stringify(r)});i(t.settings),c(null),window.dispatchEvent(new Event(`ponder-settings-changed`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function m(){if(!d&&!window.openpond?.notify){if(!(`Notification`in window)){c(`Notifications are unavailable in this browser.`);return}if(await Notification.requestPermission()!==`granted`){c(`Allow notifications in your browser settings to enable them.`);return}}let e=!d;f(e),localStorage.setItem(`openpond:ponder-notifications`,e?`on`:`off`)}let h=t?.models.find(e=>e.modelId===r?.model?.modelId&&e.providerId===r?.model?.providerId);return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsxs)(`header`,{className:`section-heading`,children:[(0,$.jsx)(`h2`,{children:`Pal`}),(0,$.jsx)(`p`,{children:`Pal stands for Ponder Assisted Learning. Use your deployed model and keep track of your conversations and workflows.`})]}),(0,$.jsx)(ft,{connection:e}),s&&(0,$.jsx)(X,{error:s}),s&&!t&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e=>e+1),children:`Retry`}),!t&&!s&&(0,$.jsx)(`p`,{role:`status`,children:`Fetching model choices and saved preferences…`}),(0,$.jsxs)(`fieldset`,{disabled:!t||l,className:`account-list`,children:[(0,$.jsxs)(`label`,{children:[`Model`,(0,$.jsxs)(`select`,{value:r.model?`${r.model.providerId}|${r.model.modelId}`:`default`,onChange:e=>{let n=t?.models.find(t=>`${t.providerId}|${t.modelId}`===e.target.value);i({...r,model:n?{providerId:n.providerId,modelId:n.modelId,reasoningEffort:n.defaultReasoningEffort}:null})},children:[(0,$.jsx)(`option`,{value:`default`,children:`Pal model — shared Qwen, then your accepted version`}),t?.models.map(e=>(0,$.jsx)(`option`,{value:`${e.providerId}|${e.modelId}`,children:e.displayName},`${e.providerId}|${e.modelId}`)),r.model&&!h&&(0,$.jsx)(`option`,{value:`${r.model.providerId}|${r.model.modelId}`,children:`Selected model is unavailable`})]})]}),h&&h.reasoningOptions.length>0&&(0,$.jsxs)(`label`,{children:[`Reasoning`,(0,$.jsx)(`select`,{value:r.model?.reasoningEffort,onChange:e=>i({...r,model:{...r.model,reasoningEffort:e.target.value}}),children:h.reasoningOptions.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsx)(`p`,{children:`Your trained model appears here once it is deployed and available to your account.`}),[[`watchHostedThreads`,`Follow hosted conversations`],[`watchLocalThreads`,`Share local thread titles and run status`],[`watchWorkflows`,`Follow workflows and their runs`]].map(([e,t])=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:r[e],onChange:t=>i({...r,[e]:t.target.checked})}),t]},e)),(0,$.jsx)(`p`,{children:`Activity gives Pal context. It does not automatically message or change your tasks.`}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:r.supervision.mode===`recommend`,onChange:e=>i({...r,supervision:{...r.supervision,mode:e.target.checked?`recommend`:`off`}})}),`Recommend changes when hosted work needs attention`]}),(0,$.jsxs)(`label`,{children:[`Check for missed updates`,(0,$.jsxs)(`select`,{value:r.supervision.intervalMinutes,onChange:e=>i({...r,supervision:{...r.supervision,intervalMinutes:Number(e.target.value)}}),children:[(0,$.jsx)(`option`,{value:5,children:`Every 5 minutes`}),(0,$.jsx)(`option`,{value:10,children:`Every 10 minutes`})]})]}),(0,$.jsx)(`p`,{children:`Task updates trigger reviews. Unchanged work is skipped. You review and send each proposed message.`}),(0,$.jsxs)(`label`,{children:[`Notifications`,(0,$.jsxs)(`select`,{value:r.notifications,onChange:e=>i({...r,notifications:e.target.value}),children:[(0,$.jsx)(`option`,{value:`off`,children:`Off`}),(0,$.jsx)(`option`,{value:`attention`,children:`Completions and things that need attention`}),(0,$.jsx)(`option`,{value:`all`,children:`All activity`})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void m(),children:d?`Disable notifications on this device`:`Enable notifications on this device`}),(0,$.jsx)(`button`,{type:`button`,disabled:!t||l,onClick:()=>void p(),children:l?`Saving…`:`Save`})]})]})}var mt=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function ht(){let e=Xe(),[t,n]=(0,Q.useState)(null);return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h1`,{children:`Appearance`}),(0,$.jsx)(`div`,{className:`provider-settings-form`,children:(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`div`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Color theme`}),(0,$.jsx)(Ce,{label:`Color theme`,value:e,options:mt,onChange:e=>{if(e===`dark`||e===`light`||e===`system`)try{Ae(e),n(null)}catch{n(`This browser could not save your appearance preference.`)}}}),(0,$.jsx)(`small`,{children:`System follows your device’s appearance. Your choice is saved on this device.`}),t&&(0,$.jsx)(X,{error:t})]})})})]})}function gt({connection:e,bannerOnly:t=!1,onOpen:n,onSaved:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(p);f(()=>S(p()));let C=(0,Q.useRef)(0),w=(0,Q.useCallback)(async t=>{if(!e)return;let n=++C.current,r=await A(e,`/v1/configuration`,{signal:t});!t?.aborted&&n===C.current&&a(r)},[e]);(0,Q.useEffect)(()=>{a(null),s(null),l(null),g(null);let e=new AbortController,t=()=>{w(e.signal).then(()=>{e.signal.aborted||v(null)}).catch(t=>{e.signal.aborted||v(String(t))})};t();let n=window.setInterval(t,3e3);return()=>{C.current+=1,e.abort(),window.clearInterval(n)}},[w]);async function T(t,n){if(e&&i){b(!0),g(null),v(null);try{let a=t===`restore`?{action:t,revision:n,expectedRevision:i.rawRevision}:t===`validate`?{action:t,text:o??i.text??`schema_version = 1
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ConversationImportsSettings-B_oW0cz7.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/index-DiVhx1GM.js","assets/index-g7UqJhnX.css","assets/api-client-DJRVOFzS.js","assets/NativeSetupTerminal-Bglqab_g.js","assets/AppDialog-x1HU1uLv.js","assets/PageChrome-DThEcWAx.js","assets/NativeSetupTerminal-3eR9D_R3.css","assets/App-CXhxya9x.js","assets/useQuery-DkPec_9x.js","assets/schemas-Brv9Vmnk.js","assets/common-BWVSBnpX.js","assets/settings-BC-bzgk6.js","assets/client-choice-storage-CQ0CNkzG.js","assets/requests-DmeUYik4.js","assets/create-pipeline-DsZzNkt9.js","assets/profile-ref-D8lxL7dW.js","assets/chunk-H3JZ3P5T-DolwEJXo.js","assets/work-outputs-D_8TovAK.js","assets/chunk-GS5HEE4M-C0RLeIsy.js","assets/chunk-GCUWJUUM-Dy6oUNJ6.js","assets/reward-checks-DJJZYgf8.js","assets/intake-contracts-B8JZKYwb.js","assets/training-DWfghwfZ.js","assets/chunk-Q4RGCEOI-Cr-dg4Nk.js","assets/ponder-desktop-Ca-9KggQ.js","assets/chat-resources-Beh5lB36.js","assets/app-models-BUdzQbXo.js","assets/model-display-zPvC4L2B.js","assets/submit-issue-command-Dq3TqJLV.js","assets/connected-app-mentions-D3wRZLwI.js","assets/profile-agent-labels-Duh96b8x.js","assets/browser-sidebar-links-PVPCrsDJ.js","assets/browser-url-LACq2Ngu.js","assets/query-scope-BRpcgljO.js","assets/icons-4yRSxBZj.js","assets/bot-BE2rL_qv.js","assets/chevron-down-Bn8yph2O.js","assets/chevron-right-BU-jUmb2.js","assets/copy-CGrLUtw5.js","assets/external-link-3ZnEFUXd.js","assets/loader-circle-DBl6qqtR.js","assets/maximize-2-CKY8dua6.js","assets/message-square-CVDgKlKX.js","assets/plus-CFNxAPMK.js","assets/refresh-cw-00D-GDnF.js","assets/square-terminal-DxC7TTds.js","assets/x-omjwMPbJ.js","assets/AppToastContext-DNWd43HS.js","assets/organization-types-PP-yuR2J.js","assets/ui-theme.generated-D-mc26qt.js","assets/App-DpFKLxuA.css","assets/useAgentInventory-D_1AlAZJ.js","assets/ConversationImportsSettings-DHaNVkBk.css","assets/UsageSettingsSection-BT9pcnCn.js","assets/CartesianChart-tS7f1HZv.js","assets/UsageSettingsSection-CIaM5hRq.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{g as t,h as n,m as r,t as i}from"./index-DiVhx1GM.js";import{m as a,o,p as s,r as c,v as l}from"./schemas-Brv9Vmnk.js";import{v as u}from"./settings-BC-bzgk6.js";import{i as d,o as f,t as p}from"./client-choice-storage-CQ0CNkzG.js";import{r as m,t as h}from"./WorkspaceDiffPanel-Bbz5qrVA.js";import{n as g}from"./ponder-desktop-Ca-9KggQ.js";import{C as _,D as v,O as y,S as b,a as x,c as S,i as C,r as w,s as T,u as E,v as D,x as O,y as k}from"./app-models-BUdzQbXo.js";import{n as A}from"./api-client-DJRVOFzS.js";import{t as j}from"./icons-4yRSxBZj.js";import{F as M,H as N,I as P,N as F,P as I,z as L}from"./training-model-data-B6IZ3x-t.js";import{i as R,n as ee,r as te,t as ne}from"./wifi-off-CMzpvbWl.js";import{t as z}from"./bot-BE2rL_qv.js";import{t as B}from"./chevron-down-Bn8yph2O.js";import{t as V}from"./chevron-right-BU-jUmb2.js";import{t as re}from"./chevron-up-DacwuDJZ.js";import{t as H}from"./cloud-upload-DFjZE4O4.js";import{t as U}from"./external-link-3ZnEFUXd.js";import{t as W}from"./folder-open-i9n8450i.js";import{t as G}from"./folder-plus-cu8Md_ej.js";import{t as ie}from"./git-commit-horizontal-CwckmC09.js";import{i as ae,o as K,r as oe,t as se}from"./settings-lists-B5J40WM6.js";import{t as ce}from"./loader-circle-DBl6qqtR.js";import{t as le}from"./message-square-CVDgKlKX.js";import{t as ue}from"./play-DIqZnaNf.js";import{t as q}from"./plus-CFNxAPMK.js";import{t as J}from"./refresh-cw-00D-GDnF.js";import{t as de}from"./save-CXe7bqR7.js";import{t as Y}from"./x-omjwMPbJ.js";import{r as fe}from"./AppToastContext-DNWd43HS.js";import{t as pe}from"./AppDialog-x1HU1uLv.js";import{n as me,r as he}from"./organization-types-PP-yuR2J.js";import{Cn as ge,Ct as _e,Dn as ve,Gt as X,Nt as ye,Qt as be,S as xe,St as Se,Tn as Z,Ut as Ce,X as we,Y as Te,Yt as Ee,Z as De,Zt as Oe,_n as ke,_t as Ae,an as je,bn as Me,cn as Ne,dn as Pe,dt as Fe,et as Ie,fr as Le,gn as Re,hr as ze,mn as Be,n as Ve,nt as He,on as Ue,qt as We,tn as Ge,tt as Ke,un as qe,ut as Je,xt as Ye,yt as Xe}from"./App-CXhxya9x.js";/* empty css */import{t as Ze}from"./useAccountSettings-BGRkTRrp.js";import{t as Qe}from"./useLocalAgentSchedules-DxTER7Ow.js";var $e=a({scope:g,authorizationRevision:s().int().positive()}).strict(),et=a({id:l().min(1).max(200),name:l().min(1).max(300),cwd:l().min(1).max(8192).nullable(),revision:l().regex(/^[a-f0-9]{64}$/).nullable(),available:o(),previouslyShared:o(),shared:o()}).strict(),tt=a({authority:$e.nullable(),projects:et.array().max(100),nextCursor:l().min(1).max(200).nullable()}).strict();a({projectId:l().min(1).max(200),shared:o(),expectedRevision:l().regex(/^[a-f0-9]{64}$/).nullable(),expectedAuthority:$e}).strict();var nt=a({projectId:l().min(1).max(200),shared:o(),discovery:c([`current`,`pending`])}).strict(),rt=j(`clipboard-copy`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]),it=j(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),at=j(`hard-drive`,[[`line`,{x1:`22`,x2:`2`,y1:`12`,y2:`12`,key:`1y58io`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}],[`line`,{x1:`6`,x2:`6.01`,y1:`16`,y2:`16`,key:`sgf278`}],[`line`,{x1:`10`,x2:`10.01`,y1:`16`,y2:`16`,key:`1l4acy`}]]),ot=j(`radio-tower`,[[`path`,{d:`M4.9 16.1C1 12.2 1 5.8 4.9 1.9`,key:`s0qx1y`}],[`path`,{d:`M7.8 4.7a6.14 6.14 0 0 0-.8 7.5`,key:`1idnkw`}],[`circle`,{cx:`12`,cy:`9`,r:`2`,key:`1092wv`}],[`path`,{d:`M16.2 4.8c2 2 2.26 5.11.8 7.47`,key:`ojru2q`}],[`path`,{d:`M19.1 1.9a9.96 9.96 0 0 1 0 14.1`,key:`rhi7fg`}],[`path`,{d:`M9.5 18h5`,key:`mfy3pd`}],[`path`,{d:`m8 22 4-11 4 11`,key:`25yftu`}]]),st=j(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),ct=j(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),lt=j(`circle-user`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`path`,{d:`M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662`,key:`154egf`}]]),Q=e(t(),1);function ut(e){let t=e instanceof Error?e.message:String(e);return t===`ponder_desktop_project_authority_changed`?`Desktop access changed. Refresh before sharing a project.`:t===`ponder_desktop_project_changed`?`The project folders changed. Refresh and review the project before sharing.`:t.length>240||/<(?:!doctype|html|body|head)\b/i.test(t)?`Pal desktop access is temporarily unavailable. Please refresh to try again.`:t}function dt(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useRef)(!1);fe(a);let d=(0,Q.useCallback)(async t=>{if(!e)throw Error(`Connect to the desktop app to share a project.`);let n=await A(e,`/v1/ponder/desktop`,{signal:t}),r=[],i=new Set,a=null,o=null;do{let n=tt.parse(await A(e,`/v1/ponder/desktop/projects${a?`?after=${encodeURIComponent(a)}`:``}`,{signal:t}));if(a&&JSON.stringify(o)!==JSON.stringify(n.authority))throw Error(`Desktop access changed. Refresh the projects before sharing.`);if(o=n.authority,r.push(...n.projects),a=n.nextCursor,a&&i.has(a))throw Error(`Unable to load the complete project list.`);a&&i.add(a)}while(a);return{desktop:n,projects:r,authority:o}},[e]),f=(0,Q.useCallback)(async()=>{if(u.current||!e)return;let t=l.current;u.current=!0,i(!0),o(null),n(null);try{let e=await d();l.current===t&&n(e)}catch(e){l.current===t&&o(ut(e))}finally{l.current===t&&(u.current=!1,i(!1))}},[e,d]);(0,Q.useEffect)(()=>{let t=++l.current,r=new AbortController;return u.current=!0,n(null),o(null),c(null),i(!0),e?d(r.signal).then(e=>{l.current===t&&n(e)}).catch(e=>{!r.signal.aborted&&l.current===t&&o(ut(e))}).finally(()=>{l.current===t&&(u.current=!1,i(!1))}):(u.current=!1,i(!1)),()=>{++l.current,r.abort(),u.current=!1}},[e,d]);async function p(r,a){if(!e||!t?.authority||u.current)return;let s=l.current;u.current=!0,i(!0),o(null),c(null);try{let i=nt.parse(await A(e,`/v1/ponder/desktop/share-project`,{method:`POST`,body:JSON.stringify({projectId:r.id,shared:a,expectedRevision:r.revision,expectedAuthority:t.authority})}));if(l.current!==s)return;n(null),c(i.discovery===`pending`?`Project access was saved. Refresh to check whether Pal has received the updated targets.`:a?`${r.name} is shared with Pal.`:`${r.name} is no longer shared with Pal.`);let o=await d();l.current===s&&n(o)}catch(e){l.current===s&&(n(null),o(ut(e)))}finally{l.current===s&&(u.current=!1,i(!1))}}return{access:t,busy:r,error:a,notice:s,refresh:f,change:p}}var $=r();function ft({connection:e}){let{access:t,busy:n,error:r,notice:i,refresh:a,change:o}=dt(e),[s,c]=(0,Q.useState)(``),l=t?.projects.find(e=>e.id===s),u=!!t?.authority,d=[{value:``,label:`Choose a local project`},...(t?.projects??[]).map(e=>({value:e.id,label:e.name,description:e.shared?`Shared with Pal`:e.available?e.cwd??void 0:`Folder unavailable`}))];return(0,$.jsxs)(`section`,{className:`remote-access-settings`,"aria-label":`Pal desktop access`,children:[(0,$.jsx)(`h2`,{children:`Desktop access`}),(0,$.jsx)(`p`,{children:`Share a local project so Pal can start tasks with the agents configured on this computer.`}),(0,$.jsxs)(`div`,{className:`account-summary remote-access-summary`,children:[(0,$.jsx)(`div`,{className:`account-summary-main`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`This computer`}),(0,$.jsx)(`small`,{role:`status`,children:n?`Checking desktop access…`:u?`Connected to Pal`:t?.desktop.ownerScope?`Desktop connection unavailable`:r?`Unable to load desktop access`:`Sign in and select a workspace`})]})}),(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:n||!e,onClick:()=>void a(),children:`Refresh desktop access`})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Local project`}),(0,$.jsx)(`small`,{children:`Current account and workspace`})]}),(0,$.jsxs)(`div`,{className:`account-summary`,children:[(0,$.jsx)(`div`,{className:`account-summary-main`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(Ce,{value:l?s:``,options:d,label:`Local project for Pal`,disabled:n||!u,searchable:!0,onChange:c}),l?.cwd&&(0,$.jsx)(`small`,{children:l.cwd}),l&&(0,$.jsx)(`small`,{children:l.shared?`Shared with Pal`:l.previouslyShared?`Share again for this connection`:`Not shared with Pal`})]})}),(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:n||!l||!u||!l.shared&&(!l.available||!l.revision),onClick:()=>l&&void o(l,!l.shared),children:l?.shared?`Stop sharing`:`Share with Pal`})]})]}),(0,$.jsx)(`p`,{children:`Sharing lets Pal request local work in this project and receive the requested results. Tasks use your existing agent permissions. Stop sharing here to remove it from discovery.`}),u&&t?.projects.length===0&&(0,$.jsx)(`p`,{children:`No saved local projects are available. Add a project in the app, then refresh.`}),i&&(0,$.jsx)(`p`,{role:`status`,children:i}),r&&(0,$.jsx)(`p`,{children:`Desktop access could not be loaded. Refresh to try again.`})]})}function pt({connection:e}){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)({model:null,watchHostedThreads:!0,watchLocalThreads:!0,watchWorkflows:!0,notifications:`attention`,supervision:{mode:`off`,intervalMinutes:5}}),[a,o]=(0,Q.useState)(0),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1);ae(e,t?null:s,()=>o(e=>e+1));let[d,f]=(0,Q.useState)(()=>localStorage.getItem(`openpond:ponder-notifications`)===`on`);(0,Q.useEffect)(()=>{if(!e)return;let t=new AbortController;return n(null),i({model:null,watchHostedThreads:!0,watchLocalThreads:!0,watchWorkflows:!0,notifications:`attention`,supervision:{mode:`off`,intervalMinutes:5}}),c(null),A(e,`/v1/ponder/settings`,{signal:t.signal}).then(e=>{n(e),i(e.settings)}).catch(e=>{t.signal.aborted||c(e instanceof Error?e.message:String(e))}),()=>t.abort()},[e,a]);async function p(){if(e&&t&&!l){u(!0);try{let t=await A(e,`/v1/ponder/settings`,{method:`POST`,body:JSON.stringify(r)});i(t.settings),c(null),window.dispatchEvent(new Event(`ponder-settings-changed`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function m(){if(!d&&!window.openpond?.notify){if(!(`Notification`in window)){c(`Notifications are unavailable in this browser.`);return}if(await Notification.requestPermission()!==`granted`){c(`Allow notifications in your browser settings to enable them.`);return}}let e=!d;f(e),localStorage.setItem(`openpond:ponder-notifications`,e?`on`:`off`)}let h=t?.models.find(e=>e.modelId===r?.model?.modelId&&e.providerId===r?.model?.providerId);return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsxs)(`header`,{className:`section-heading`,children:[(0,$.jsx)(`h2`,{children:`Pal`}),(0,$.jsx)(`p`,{children:`Pal stands for Ponder Assisted Learning. Use your deployed model and keep track of your conversations and workflows.`})]}),(0,$.jsx)(ft,{connection:e}),s&&(0,$.jsx)(X,{error:s}),s&&!t&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(e=>e+1),children:`Retry`}),!t&&!s&&(0,$.jsx)(`p`,{role:`status`,children:`Fetching model choices and saved preferences…`}),(0,$.jsxs)(`fieldset`,{disabled:!t||l,className:`account-list`,children:[(0,$.jsxs)(`label`,{children:[`Model`,(0,$.jsxs)(`select`,{value:r.model?`${r.model.providerId}|${r.model.modelId}`:`default`,onChange:e=>{let n=t?.models.find(t=>`${t.providerId}|${t.modelId}`===e.target.value);i({...r,model:n?{providerId:n.providerId,modelId:n.modelId,reasoningEffort:n.defaultReasoningEffort}:null})},children:[(0,$.jsx)(`option`,{value:`default`,children:`Pal model — shared Qwen, then your accepted version`}),t?.models.map(e=>(0,$.jsx)(`option`,{value:`${e.providerId}|${e.modelId}`,children:e.displayName},`${e.providerId}|${e.modelId}`)),r.model&&!h&&(0,$.jsx)(`option`,{value:`${r.model.providerId}|${r.model.modelId}`,children:`Selected model is unavailable`})]})]}),h&&h.reasoningOptions.length>0&&(0,$.jsxs)(`label`,{children:[`Reasoning`,(0,$.jsx)(`select`,{value:r.model?.reasoningEffort,onChange:e=>i({...r,model:{...r.model,reasoningEffort:e.target.value}}),children:h.reasoningOptions.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsx)(`p`,{children:`Your trained model appears here once it is deployed and available to your account.`}),[[`watchHostedThreads`,`Follow hosted conversations`],[`watchLocalThreads`,`Share local thread titles and run status`],[`watchWorkflows`,`Follow workflows and their runs`]].map(([e,t])=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:r[e],onChange:t=>i({...r,[e]:t.target.checked})}),t]},e)),(0,$.jsx)(`p`,{children:`Activity gives Pal context. It does not automatically message or change your tasks.`}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:r.supervision.mode===`recommend`,onChange:e=>i({...r,supervision:{...r.supervision,mode:e.target.checked?`recommend`:`off`}})}),`Recommend changes when hosted work needs attention`]}),(0,$.jsxs)(`label`,{children:[`Check for missed updates`,(0,$.jsxs)(`select`,{value:r.supervision.intervalMinutes,onChange:e=>i({...r,supervision:{...r.supervision,intervalMinutes:Number(e.target.value)}}),children:[(0,$.jsx)(`option`,{value:5,children:`Every 5 minutes`}),(0,$.jsx)(`option`,{value:10,children:`Every 10 minutes`})]})]}),(0,$.jsx)(`p`,{children:`Task updates trigger reviews. Unchanged work is skipped. You review and send each proposed message.`}),(0,$.jsxs)(`label`,{children:[`Notifications`,(0,$.jsxs)(`select`,{value:r.notifications,onChange:e=>i({...r,notifications:e.target.value}),children:[(0,$.jsx)(`option`,{value:`off`,children:`Off`}),(0,$.jsx)(`option`,{value:`attention`,children:`Completions and things that need attention`}),(0,$.jsx)(`option`,{value:`all`,children:`All activity`})]})]}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>void m(),children:d?`Disable notifications on this device`:`Enable notifications on this device`}),(0,$.jsx)(`button`,{type:`button`,disabled:!t||l,onClick:()=>void p(),children:l?`Saving…`:`Save`})]})]})}var mt=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}];function ht(){let e=Xe(),[t,n]=(0,Q.useState)(null);return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h1`,{children:`Appearance`}),(0,$.jsx)(`div`,{className:`provider-settings-form`,children:(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`div`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Color theme`}),(0,$.jsx)(Ce,{label:`Color theme`,value:e,options:mt,onChange:e=>{if(e===`dark`||e===`light`||e===`system`)try{Ae(e),n(null)}catch{n(`This browser could not save your appearance preference.`)}}}),(0,$.jsx)(`small`,{children:`System follows your device’s appearance. Your choice is saved on this device.`}),t&&(0,$.jsx)(X,{error:t})]})})})]})}function gt({connection:e,bannerOnly:t=!1,onOpen:n,onSaved:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(p);f(()=>S(p()));let C=(0,Q.useRef)(0),w=(0,Q.useCallback)(async t=>{if(!e)return;let n=++C.current,r=await A(e,`/v1/configuration`,{signal:t});!t?.aborted&&n===C.current&&a(r)},[e]);(0,Q.useEffect)(()=>{a(null),s(null),l(null),g(null);let e=new AbortController,t=()=>{w(e.signal).then(()=>{e.signal.aborted||v(null)}).catch(t=>{e.signal.aborted||v(String(t))})};t();let n=window.setInterval(t,3e3);return()=>{C.current+=1,e.abort(),window.clearInterval(n)}},[w]);async function T(t,n){if(e&&i){b(!0),g(null),v(null);try{let a=t===`restore`?{action:t,revision:n,expectedRevision:i.rawRevision}:t===`validate`?{action:t,text:o??i.text??`schema_version = 1
|
|
3
3
|
`}:{action:t,text:o??i.text??`schema_version = 1
|
|
4
4
|
`,expectedRevision:c??i.rawRevision};await A(e,`/v1/configuration`,{method:`POST`,body:JSON.stringify(a)}),t!==`validate`&&(s(null),l(null),await w(),await r?.()),g(t===`validate`?`Configuration is valid.`:`Saved. Changes apply to the next turn.`)}catch(e){v(e instanceof Error?e.message:String(e))}finally{b(!1)}}}return!e||t&&!i?.issue&&!x?null:(0,$.jsxs)(`section`,{className:`account-settings configuration-settings ${t?`configuration-banner`:``}`,"aria-label":`Configuration`,children:[t?null:(0,$.jsxs)(`header`,{children:[(0,$.jsx)(`h1`,{children:`Configuration`}),(0,$.jsx)(`p`,{children:`Manage your settings in one TOML file. The controls below save to the same file; unset an override to inherit its default.`})]}),x?(0,$.jsx)(X,{error:x,children:(0,$.jsx)(`button`,{type:`button`,onClick:d,children:`Retry saving preferences`})}):null,(0,$.jsx)(X,{error:_}),i?.issue?(0,$.jsx)(X,{error:`${i.issue.message} (${i.issue.path}${i.issue.line?`:${i.issue.line}:${i.issue.column??1}`:``}). ${i.issue.action}`,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>{t?n?.():m(!0)},children:`Open configuration`})}):null,t?null:(0,$.jsxs)(`details`,{open:u,onToggle:e=>m(e.currentTarget.open),children:[(0,$.jsx)(`summary`,{children:`Configuration file and sources`}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{children:i?.path??`Loading…`})}),(0,$.jsx)(`p`,{children:`Unset an override to inherit its default. Changes apply to the next turn; current turns retain their model settings.`}),(0,$.jsx)(`textarea`,{"aria-label":`TOML configuration`,spellCheck:!1,rows:18,style:{width:`100%`,fontFamily:`monospace`},value:o??i?.text??`schema_version = 1
|
|
5
|
-
`,onChange:e=>{o===null&&l(i?.rawRevision??null),s(e.target.value)}}),o!==null&&i?.rawRevision!==c?(0,$.jsx)(X,{error:`The file changed elsewhere. Reload before saving your edits.`}):null,(0,$.jsxs)(`div`,{className:`configuration-actions`,children:[(0,$.jsx)(`button`,{type:`button`,disabled:y||!i,onClick:()=>void T(`validate`),children:`Validate`}),(0,$.jsx)(`button`,{type:`button`,disabled:y||!i||o!==null&&i.rawRevision!==c,onClick:()=>void T(`replace`),children:`Save config`}),(0,$.jsx)(`button`,{type:`button`,disabled:y,onClick:()=>{s(null),l(null),v(null),w().catch(e=>v(String(e)))},children:`Reload file`})]}),i?.recoverableRevisions.length?(0,$.jsxs)(`label`,{children:[`Restore a verified revision `,(0,$.jsxs)(`select`,{value:``,disabled:y,onChange:e=>{e.target.value&&T(`restore`,e.target.value)},children:[(0,$.jsx)(`option`,{value:``,children:`Choose a revision…`}),i.recoverableRevisions.map(e=>(0,$.jsxs)(`option`,{value:e.revision,children:[new Date(e.createdAt).toLocaleString(),` · `,e.revision.slice(0,12)]},e.revision))]})]}):null,i?.effective?(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Effective values and sources`}),(0,$.jsxs)(`table`,{children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Setting`}),(0,$.jsx)(`th`,{children:`Source`}),(0,$.jsx)(`th`,{children:`Location`})]})}),(0,$.jsx)(`tbody`,{children:Object.entries(i.effective.provenance).map(([e,t])=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:JSON.parse(e).join(`.`)}),(0,$.jsx)(`td`,{children:t.layer===`user`?`Set here`:`Inherited from ${t.layer}`}),(0,$.jsx)(`td`,{children:t.path})]},e))})]}),(0,$.jsx)(`pre`,{children:JSON.stringify(i.effective.document,null,2)})]}):null]}),h?(0,$.jsx)(`p`,{role:`status`,children:h}):null]})}function _t({handle:e,image:t}){let n=e?.trim().slice(0,1).toUpperCase()||`+`;return(0,$.jsx)(`div`,{className:`account-avatar`,children:t?(0,$.jsx)(`img`,{src:t,alt:``}):(0,$.jsx)(`span`,{children:n})})}function vt({state:e,label:t}){return(0,$.jsx)(`span`,{className:`account-state ${e}`,children:t??e.replace(`_`,` `)})}var yt=`https://www.openpond.ai`,bt=`https://api.openpond.ai`;function xt(e){try{let t=new URL(e).hostname.toLowerCase();if(t===`openpond.ai`||t===`www.openpond.ai`)return bt}catch{}return``}function St(e,t){try{let t=new URL(e);if(t.protocol===`https:`||t.protocol===`http:`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname))return null}catch{}return`${t} must be an https:// URL (or http:// for localhost).`}function Ct({account:e,busy:t,mode:n=`update`,onClose:r,onSave:i,onRemove:a}){let o=(0,Q.useId)(),s=(0,Q.useRef)(null),c=n===`connect`,l=e?.baseUrl??yt,u=e?.apiBaseUrl??xt(l),[d,f]=(0,Q.useState)(l),[p,m]=(0,Q.useState)(u),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null);fe(y);function x(e){f(e),m(e.trim().replace(/\/+$/,``)===l?u:xt(e))}async function S(t){t.preventDefault(),v(null),b(null);let n=h.trim(),r=d.trim().replace(/\/+$/,``),a=p.trim().replace(/\/+$/,``),o=(c&&!n?`API key is required.`:null)??St(r,`Environment URL`)??St(a,`API URL`);if(o)v(o),(o.startsWith(`Environment URL`)||o.startsWith(`API URL`))&&s.current&&(s.current.open=!0);else try{await i({handle:c?void 0:e?.handle,currentBaseUrl:c?null:e?.baseUrl??null,baseUrl:r,apiBaseUrl:a,chatApiBaseUrl:c||a!==u?null:e?.chatApiBaseUrl,apiKey:n||void 0,environment:new URL(r).hostname.replace(/^www\./,``)===`openpond.ai`?`production`:`custom`})}catch(e){b(e instanceof Error?e.message:String(e))}}async function C(){a&&await a()&&r()}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop account-endpoint-dialog-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&!t&&r()},children:(0,$.jsxs)(`form`,{className:`git-dialog account-endpoint-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":o,onSubmit:e=>void S(e),children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:t,type:`button`,title:`Close`,"aria-label":`Close`,onClick:r,children:(0,$.jsx)(Y,{size:16})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:c?(0,$.jsx)(K,{size:18}):(0,$.jsx)(Ee,{size:18})}),(0,$.jsx)(`h2`,{id:o,children:c?`Add account`:`Account settings`}),(0,$.jsx)(`p`,{children:c?`Connect an OpenPond account with an API key.`:`Review this account and its verified key access.`}),!c&&e?(0,$.jsxs)(`div`,{className:`account-dialog-details`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Account`}),(0,$.jsx)(`strong`,{children:e.displayLabel||e.handle})]}),e.email?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Email`}),(0,$.jsx)(`strong`,{children:e.email})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Handle`}),(0,$.jsx)(`strong`,{children:e.handle})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`API key`}),(0,$.jsx)(`strong`,{children:e.apiKeyHint??(e.authHealth===`signed_in`?`Connected with a session`:`No saved API key`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Access`}),(0,$.jsx)(`strong`,{children:e.apiKeyAccess?e.apiKeyAccess.teamId?`This workspace`:e.apiKeyAccess.ownerType===`user`?`All my workspaces`:`Account access`:`Not verified`})]}),e.apiKeyAccess?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Scopes`}),(0,$.jsx)(`strong`,{children:e.apiKeyAccess.scopes.join(`, `)||`No scopes`})]}):null]}):null,c?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`API key`}),(0,$.jsx)(`input`,{autoComplete:`off`,disabled:t,placeholder:`opk_...`,type:`password`,value:h,onChange:e=>g(e.target.value)})]}):null,(0,$.jsxs)(`details`,{className:`account-dialog-advanced`,ref:s,children:[(0,$.jsx)(`summary`,{children:`Advanced`}),(0,$.jsxs)(`div`,{className:`account-dialog-advanced-fields`,children:[c?null:(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Replace API key`}),(0,$.jsx)(`input`,{autoComplete:`off`,disabled:t,placeholder:`Leave blank to keep the current key`,type:`password`,value:h,onChange:e=>g(e.target.value)}),(0,$.jsx)(`small`,{children:`Enter a new key to replace the saved credential.`})]}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Environment URL`}),(0,$.jsx)(`input`,{disabled:t,inputMode:`url`,spellCheck:!1,type:`url`,value:d,onChange:e=>x(e.target.value)}),(0,$.jsx)(`small`,{children:`Change this URL to connect this account to another environment.`})]}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`API URL`}),(0,$.jsx)(`input`,{disabled:t,inputMode:`url`,spellCheck:!1,type:`url`,value:p,onChange:e=>m(e.target.value)}),(0,$.jsx)(`small`,{children:`Enter the API URL for a custom environment.`})]})]})]}),_?(0,$.jsx)(X,{error:_}):null,(0,$.jsx)(`div`,{className:`git-dialog-footer account-dialog-footer`,children:(0,$.jsxs)(`div`,{className:`account-dialog-save-actions`,children:[!c&&a?(0,$.jsxs)(`button`,{className:`git-dialog-secondary account-dialog-remove`,disabled:t,type:`button`,onClick:()=>void C(),children:[(0,$.jsx)(M,{size:14}),` Remove account`]}):null,(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:t,type:`button`,onClick:r,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`git-dialog-primary`,disabled:t,type:`submit`,children:[(0,$.jsx)(de,{size:14}),(0,$.jsx)(`span`,{children:t?`Saving`:c?`Connect account`:`Save changes`})]})]})})]})})}var wt=`Changing the active OpenPond account rechecks cloud projects, hosted agents, default team, and profile sync for that account. Local projects stay on this machine; projects uploaded from another account will need to be synced again for this account.`;function Tt({payload:e,connection:t,saving:n,refreshingAccounts:r,saveAccount:i,refreshAccounts:a,switchAccount:o,removeAccount:s,onPayload:c,onPreferences:l,onError:u,onToast:d}){let f=e?.account,p=f?.state??`loading`,m=p===`signed_in`,h=p===`signed_out`,g=p===`auth_error`,_=f?.email?.trim()||null,v=f?.accounts??[],[y,b]=(0,Q.useState)([]),[,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(void 0),O=(0,Q.useRef)(0),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),{confirmAction:ee,confirmDialog:te,resolveConfirmDialog:ne}=Fe(),z=v.find(e=>e.isActive)??v[0]??null,B=e?.preferences.defaultTeamId?.trim()||null,V=E===void 0?B:E,re=Te(f),H=e?.accountMeta.asOf??``,W=Dt(f?.environment,z?.environment),G=m?Dt(z?.displayLabel,z?.handle,f?.label,f?.activeProfile?.handle,`Signed in`):g?`Account needs attention`:h?`No account connected`:`Loading account`,ie=m?_??kt(z?.baseUrl??f?.baseUrl,W):g?`Not connected`:h?`Cloud projects, hosted agents, and team defaults are disabled until you sign in.`:`Checking account status.`,ae=v.length>0,K=g?Ot(f?.error):null,oe=(0,Q.useMemo)(()=>y.filter(e=>e.status===`active`),[y]),se=(0,Q.useMemo)(()=>{let e=[{value:``,label:`Personal account`,description:`Your personal tasks and computers`},...oe.map(e=>({value:e.teamId,label:Dt(e.displayName,e.name,e.slug,`Team`),description:me(e.role)}))];return V&&!e.some(e=>e.value===V)&&e.push({value:V,label:`Selected workspace`,description:V}),e},[oe,V]),ce=V??``,le=!t||w,ue=k?Et(k):null,de=!!(ue&&N===ue),Y=m||g,fe=Dt(F?.version,e?.server.version,`Loading`),pe=F?F.devMode?`Dev mode`:F.packaged?`${Mt(F.releaseChannel)} build`:`Local build`:null,ge=At(Dt(z?.baseUrl,f?.activeProfile?.baseUrl,f?.baseUrl,`https://openpond.ai`));(0,Q.useEffect)(()=>{let e=window.openpond?.getDesktopRuntimeInfo;if(!e)return;let t=!1;return e().then(e=>{t||I(e)}).catch(()=>{t||I(null)}),()=>{t=!0}},[]),(0,Q.useEffect)(()=>{if(!t||!re){b([]),C(null),x(!1);return}let e=!1,n=De(re);return n?(b(n),x(!1)):(b([]),x(!0)),C(null),we({accountKey:re,force:!!H,fetchOrganizations:async()=>(await Z.organizations(t)).organizations.map(he).filter(e=>!!e).filter(e=>e.status===`active`)}).then(t=>{e||b(t)}).catch(t=>{e||(n||b([]),C(t instanceof Error?t.message:String(t)))}).finally(()=>{e||x(!1)}),()=>{e=!0}},[H,t,re]),(0,Q.useEffect)(()=>(++O.current,D(void 0),T(!1),()=>{++O.current}),[t,re]),(0,Q.useEffect)(()=>{E!==void 0&&B===E&&D(void 0)},[B,E]);async function _e(e,n={notify:!0}){let r=e||null,i=oe.find(e=>e.teamId===r)??null;if(!t||r!==null&&!i||w||V===r)return;D(r),T(!0);let a=O.current;u(null),r&&xe({teamId:r,accountKey:re,force:!0,fetchAgents:async e=>(await Z.listSandboxAgents(t,{teamId:e})).agents}).catch(()=>void 0);try{let e=await Z.savePreferences(t,{defaultTeamId:r});if(a!==O.current)return;l(e),n.notify&&d?.(r?`Workspace selected`:`Personal account selected`,`success`)}catch(e){if(a!==O.current)return;D(void 0),u(e instanceof Error?e.message:String(e))}finally{a===O.current&&T(!1)}}async function ve(e=`Continue`){return!Y||ee({title:`Change active OpenPond account?`,body:wt,confirmLabel:e,cancelLabel:`Cancel`})}async function ye(e){await ve(`Save account`)&&(await i({apiKey:e.apiKey??``,handle:e.handle,baseUrl:e.baseUrl,apiBaseUrl:e.apiBaseUrl,environment:e.environment}),M(!1))}async function be(e){if(!t||!k)throw Error(`OpenPond server connection is not ready.`);if(k.isActive&&!await ve(`Save endpoints`))return;let n=Et(k);P(n),u(null);try{c(await Z.updateOpenPondAccountConfig(t,{handle:e.handle??k.handle,currentBaseUrl:e.currentBaseUrl,apiKey:e.apiKey,baseUrl:e.baseUrl,apiBaseUrl:e.apiBaseUrl,chatApiBaseUrl:e.chatApiBaseUrl,environment:e.environment,setActive:k.isActive})),d?.(`Account updated`,`success`),A(null)}catch(e){throw u(e instanceof Error?e.message:String(e)),e}finally{P(null)}}async function Se(e){let t=e.handle?.trim()||``;t&&await ve(`Switch account`)&&await o(t,e.baseUrl)}async function Oe(e){let t=e.handle?.trim()||``;if(!t)return!1;let n=Dt(e.displayLabel,e.email,e.handle,`this account`);return await ee({title:`Remove saved account?`,body:`Remove ${n} from this device? Its saved credential and endpoint settings will be deleted. This does not delete any OpenPond cloud data.`,confirmLabel:`Remove account`,cancelLabel:`Cancel`,tone:`danger`})&&await s(t,e.baseUrl)?(d?.(`Account removed`,`success`),!0):!1}async function ke(){let e=window.openpond?.reloadDesktopApp;if(e&&!L){R(!0),u(null);try{let t=await e();if(!t.ok)throw Error(t.error??`OpenPond could not refresh the app.`)}catch(e){R(!1),u(e instanceof Error?e.message:String(e))}}}async function Ae(){let e=window.openpond?.browser;e?.openExternal&&(await e.openExternal({conversationId:`openpond-account-sign-up`,url:ge})).ok||window.open(ge,`_blank`,`noopener,noreferrer`)}return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsxs)(`div`,{className:`account-settings-title`,children:[(0,$.jsx)(`h1`,{children:`Account`}),(0,$.jsxs)(`div`,{className:`account-settings-title-actions`,children:[(0,$.jsx)(`button`,{className:`settings-secondary compact`,disabled:!t||n,type:`button`,onClick:Ve,children:`Get started`}),(0,$.jsxs)(`button`,{className:`settings-secondary compact account-add-action`,disabled:!t||n,type:`button`,onClick:()=>M(!0),children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:`Add account`})]}),(0,$.jsx)(`button`,{className:`settings-icon-button ghost`,disabled:!t||n||r,title:`Refresh accounts and team data`,"aria-label":`Refresh accounts and team data`,type:`button`,onClick:()=>void a(),children:(0,$.jsx)(J,{size:15,className:r?`settings-spin`:void 0})})]})]}),(0,$.jsxs)(`div`,{className:`account-summary`,children:[(0,$.jsxs)(`div`,{className:`account-summary-main`,children:[(0,$.jsx)(_t,{handle:G,image:m?f?.avatarUrl??z?.avatarUrl??null:null}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Active account`}),(0,$.jsx)(`strong`,{children:G}),(0,$.jsxs)(`div`,{className:`account-summary-meta`,children:[(0,$.jsx)(`small`,{className:m&&_?`private-account-email`:m?void 0:`account-summary-copy`,tabIndex:m&&_?0:void 0,children:ie}),m?(0,$.jsx)(Ce,{className:`account-team-dropdown`,compact:!0,disabled:le,label:`Workspace`,options:se,value:ce,onChange:e=>void _e(e)}):null,m&&S?(0,$.jsx)(`small`,{role:`status`,children:`Workspaces could not be loaded. Personal access remains available.`}):null]})]})]}),(0,$.jsx)(`div`,{className:`account-summary-actions`,children:(0,$.jsx)(vt,{state:p,label:h?`not signed in`:void 0})})]}),ae?(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`OpenPond accounts`}),(0,$.jsxs)(`small`,{children:[v.length,` account`,v.length===1?``:`s`]})]}),v.map(e=>{let r=e.handle?.trim()||``,i=Dt(e.displayLabel,e.handle,`Unknown account`),a=e.email?.trim()||null,o=Et(e);return(0,$.jsxs)(`div`,{className:`account-row`,children:[(0,$.jsx)(_t,{handle:i,image:e.avatarUrl??null}),(0,$.jsxs)(`div`,{className:`account-details`,children:[(0,$.jsx)(`strong`,{children:i}),a?(0,$.jsx)(`span`,{className:`private-account-email`,tabIndex:0,children:a}):null,(0,$.jsx)(`span`,{children:kt(e.baseUrl,e.environment)}),e.apiKeyHint?(0,$.jsxs)(`span`,{children:[`API key `,e.apiKeyHint]}):null]}),(0,$.jsxs)(`div`,{className:`account-row-actions`,children:[e.isActive?(0,$.jsx)(`span`,{className:`active-pill`,children:`Active`}):null,e.isActive?null:(0,$.jsx)(`button`,{className:`inline-action`,disabled:n||!r,type:`button`,onClick:()=>void Se(e),children:`Use`}),(0,$.jsx)(`button`,{className:`settings-icon-button ghost account-endpoint-action`,disabled:!t||n||!!N||!r,type:`button`,"aria-label":`Settings for ${i}`,title:`Account settings`,onClick:()=>A(e),children:(0,$.jsx)(Ee,{size:15})})]})]},o)})]}):null,f?.products&&f.products.length>0&&(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Products`}),(0,$.jsxs)(`small`,{children:[f.products.length,` active`]})]}),f.products.map(e=>(0,$.jsxs)(`div`,{className:`product-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{children:e.type})]}),(0,$.jsx)(vt,{state:e.status})]},e.id))]}),(0,$.jsxs)(`div`,{className:`settings-footnote account-build-footnote`,children:[(0,$.jsxs)(`div`,{className:`account-build-details`,children:[(0,$.jsx)(`span`,{children:`Build version`}),(0,$.jsxs)(`div`,{className:`account-build-version`,children:[(0,$.jsx)(`strong`,{children:jt(fe)}),pe?(0,$.jsx)(`span`,{className:`account-build-context${F?.devMode?` development`:``}`,children:pe}):null]})]}),(0,$.jsxs)(`div`,{className:`account-build-actions`,children:[F?.canReload?(0,$.jsxs)(`button`,{className:`settings-secondary compact`,disabled:L,type:`button`,title:`Reload the local Electron app`,onClick:()=>void ke(),children:[(0,$.jsx)(J,{className:L?`settings-spin`:void 0,size:14}),(0,$.jsx)(`span`,{children:L?`Refreshing`:`Refresh app`})]}):null,m?null:(0,$.jsxs)(`button`,{className:`settings-primary compact account-sign-up-action`,type:`button`,onClick:()=>void Ae(),children:[(0,$.jsx)(`span`,{children:`Sign up`}),(0,$.jsx)(U,{size:13})]})]})]}),K?(0,$.jsx)(X,{error:K}):null,k?(0,$.jsx)(Ct,{account:k,busy:de||n,onClose:()=>{de||A(null)},onSave:be,onRemove:()=>Oe(k)},ue):null,j?(0,$.jsx)(Ct,{busy:n,mode:`connect`,onClose:()=>{n||M(!1)},onSave:ye}):null,(0,$.jsx)(Je,{state:te,onResolve:ne})]})}function Et(e){return`${e.handle.trim().toLowerCase()}|${e.baseUrl??`default`}`}function Dt(...e){for(let t of e){let e=t?.trim();if(e)return e}return``}function Ot(e){let t=e?.trim();if(!t)return null;let n=t.toLowerCase();return n.includes(`protected deployment`)?`OpenPond could not reach the account service. Restart and try again.`:n.includes(`unexpected token '<'`)||n.includes(`<!doctype`)?`OpenPond received a web login page instead of account data. Restart and try again.`:n.includes(`401`)||n.includes(`unauthorized`)||n.includes(`could not authenticate`)?`The API key could not authenticate. Check the key and account environment, then try again.`:t.length>220?`${t.slice(0,217)}...`:t}function kt(e,t){try{if(e)return new URL(e).host}catch{}return t?.trim()||`openpond.ai`}function At(e){try{return new URL(`/login`,e).toString()}catch{return`https://openpond.ai/login`}}function jt(e){let t=e.trim();return!t||t===`Loading`?`Loading`:t.startsWith(`v`)?t:`v${t}`}function Mt(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function Nt({advancedWorkspaceControls:e,defaultBranchPrefix:t,defaultNewProjectDirectory:n,preferences:r,saving:i,steerActiveResponses:a,chooseDefaultProjectDirectory:o,saveDefaults:s,setAdvancedWorkspaceControls:c,setSteerActiveResponses:l,setDefaultBranchPrefix:u,setDefaultNewProjectDirectory:d}){let f=O(t)===r.defaultBranchPrefix&&n.trim()===r.defaultNewProjectDirectory&&e===r.advancedWorkspaceControls&&a===r.steerActiveResponses;return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h2`,{children:`General`}),(0,$.jsxs)(`form`,{className:`provider-settings-form`,onSubmit:e=>void s(e),children:[(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:a,disabled:i,onChange:e=>l(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Steer active responses`}),(0,$.jsx)(`small`,{children:`Send a new message into the active response immediately. Turn this off to queue it instead.`})]})]}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,disabled:i,onChange:e=>c(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Show advanced Git controls`}),(0,$.jsx)(`small`,{children:`Show branch, commit, and push controls for local project workflows.`})]})]}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Git branches`}),(0,$.jsx)(`small`,{children:`Used for advanced and non-managed branch creation`})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Branch prefix`}),(0,$.jsx)(`input`,{value:t,disabled:i,placeholder:`feat/`,onChange:e=>u(e.target.value)})]})}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Projects`}),(0,$.jsx)(`small`,{children:`Used when starting a new local project from scratch`})]}),(0,$.jsxs)(`div`,{className:`settings-path-row`,children:[(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`New project directory`}),(0,$.jsx)(`input`,{value:n,disabled:i,placeholder:`~/Documents/OpenPond Projects`,onChange:e=>d(e.target.value)})]}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:i,onClick:()=>void o(),children:[(0,$.jsx)(W,{size:14}),(0,$.jsx)(`span`,{children:`Browse`})]})]}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:i||f,children:(0,$.jsx)(`span`,{children:i?`Saving`:`Save settings`})})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`Initial branch name`}),(0,$.jsxs)(`strong`,{children:[O(t),`example-project`]})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`New projects`}),(0,$.jsx)(`strong`,{children:n||r.defaultNewProjectDirectory})]})]})}function Pt({diagnostics:e,diagnosticsAvailable:t,diagnosticsBusy:n,diagnosticsStatus:r,logDir:i,logLineLimit:a,logLines:o,logViewBusy:s,logViewSummary:c,logViewportRef:l,tailLogs:u,copyRecentLogs:d,exportDiagnosticsBundle:f,loadOlderLogs:p,openLogsFolder:m,refreshLogView:h,toggleTailLogs:g}){let _=e.filter(e=>e.name===`diagnostic`&&e.status===`failed`).slice().reverse().map(Ft),v=typeof window>`u`?void 0:window.openpond;return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h1`,{children:`Diagnostics`}),(0,$.jsxs)(`div`,{className:`diagnostics-log-panel`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Recent errors`}),(0,$.jsxs)(`small`,{children:[_.length,` saved`]})]}),(0,$.jsx)(`div`,{className:`diagnostics-error-list`,role:`list`,children:_.length===0?(0,$.jsx)(`div`,{className:`diagnostics-error-empty`,children:`No saved errors`}):_.map(e=>(0,$.jsxs)(`article`,{className:`diagnostics-error-entry`,role:`listitem`,children:[(0,$.jsx)(Be,{size:15}),(0,$.jsxs)(`div`,{className:`diagnostics-error-body`,children:[(0,$.jsxs)(`div`,{className:`diagnostics-error-title`,children:[(0,$.jsx)(`strong`,{children:e.message}),(0,$.jsx)(`time`,{dateTime:e.timestamp,children:e.timeLabel})]}),(0,$.jsxs)(`div`,{className:`diagnostics-error-meta`,children:[(0,$.jsx)(`span`,{children:e.surface}),e.status?(0,$.jsx)(`span`,{children:e.status}):null,e.sequence?(0,$.jsxs)(`span`,{children:[`#`,e.sequence]}):null]}),e.detail?(0,$.jsxs)(`details`,{className:`diagnostics-error-detail`,children:[(0,$.jsx)(`summary`,{children:`Details`}),(0,$.jsx)(`pre`,{children:e.detail})]}):null]})]},e.id))})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Logs`}),(0,$.jsx)(`small`,{children:t?`Desktop`:`Unavailable`})]}),(0,$.jsxs)(`div`,{className:`product-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Logs folder`}),(0,$.jsx)(`span`,{children:`Desktop and server logs`})]}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:n!==null||!v?.openLogsFolder,onClick:()=>void m(),children:[(0,$.jsx)(W,{size:15}),(0,$.jsx)(`span`,{children:n===`logs`?`Opening`:`Open`})]})]}),(0,$.jsxs)(`div`,{className:`product-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Diagnostics export`}),(0,$.jsx)(`span`,{children:`Support folder with diagnostics.txt`})]}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:n!==null||!v?.exportDiagnostics,onClick:()=>void f(),children:[(0,$.jsx)(Pe,{size:15}),(0,$.jsx)(`span`,{children:n===`export`?`Exporting`:`Export`})]})]}),(0,$.jsxs)(`div`,{className:`product-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Recent logs`}),(0,$.jsx)(`span`,{children:`Last 1000 lines to clipboard`})]}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:n!==null||!v?.copyRecentLogs,onClick:()=>void d(),children:[(0,$.jsx)(rt,{size:15}),(0,$.jsx)(`span`,{children:n===`copy`?`Copying`:`Copy`})]})]})]}),(0,$.jsxs)(`div`,{className:`diagnostics-log-panel`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Log view`}),(0,$.jsxs)(`div`,{className:`settings-heading-actions diagnostics-log-actions`,children:[(0,$.jsx)(`small`,{children:c}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button ${u?`active`:``}`,title:u?`Pause tail`:`Tail logs`,"aria-label":u?`Pause tail`:`Tail logs`,disabled:!v?.readRecentLogs,onClick:g,children:u?(0,$.jsx)(P,{size:15}):(0,$.jsx)(ue,{size:15})}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Refresh logs`,"aria-label":`Refresh logs`,disabled:s!==null||!v?.readRecentLogs,onClick:()=>void h(a,`refresh`),children:(0,$.jsx)(J,{size:15})}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:s!==null||!v?.readRecentLogs,onClick:p,children:[(0,$.jsx)(re,{size:15}),(0,$.jsx)(`span`,{children:s===`older`?`Loading`:`Older`})]})]})]}),(0,$.jsx)(`div`,{ref:l,className:`diagnostics-log-viewer`,role:`log`,"aria-live":u?`polite`:`off`,children:o.length===0?(0,$.jsx)(`div`,{className:`diagnostics-log-empty`,children:s?`Loading logs`:`No log lines`}):o.map((e,t)=>(0,$.jsxs)(`div`,{className:`diagnostics-log-entry`,children:[(0,$.jsx)(`span`,{className:`diagnostics-log-source`,children:e.file}),(0,$.jsx)(`code`,{children:e.line})]},`${e.file}:${e.timestamp}:${e.index}:${t}`))}),i&&(0,$.jsxs)(`div`,{className:`diagnostics-log-dir`,children:[(0,$.jsx)(`span`,{children:`Source`}),(0,$.jsx)(`strong`,{children:i})]})]}),r&&(0,$.jsxs)(`div`,{className:`settings-footnote ${r.warning?`warning`:``}`,children:[(0,$.jsx)(`span`,{children:r.label}),(0,$.jsx)(`strong`,{children:r.value})]})]})}function Ft(e){let t=Rt(e.data),n=Rt(t.context),r=zt(t.stack)??zt(t.detail)??zt(n.detail)??null;return{id:e.id,timestamp:e.timestamp,timeLabel:Lt(e.timestamp),message:It(e,t),surface:zt(t.surface)??e.source??`diagnostic`,status:e.status??null,sequence:e.sequence??null,detail:r}}function It(e,t){return zt(e.error)??zt(e.output)??zt(t.message)??zt(t.error)??`Diagnostic event`}function Lt(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Rt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function zt(e){return typeof e==`string`&&e.trim()?e.trim():null}var Bt=[{id:`typescript`,label:`TypeScript`,placeholder:`typescript-language-server`},{id:`python`,label:`Python`,placeholder:`pyright-langserver`},{id:`rust`,label:`Rust`,placeholder:`rust-analyzer`}];function Vt({editorPreferences:e,lspStatus:t,preferences:n,restarting:r,saving:i,statusLoading:a,refreshLspStatus:o,restartLanguageServers:s,saveEditorSettings:c,setEditorPreferences:l,setLanguageCustomCommand:u,setLanguageMode:d}){let f=JSON.stringify(e)!==JSON.stringify(n.editor),p=new Map(t?.languages.map(e=>[e.language,e])??[]);return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h1`,{children:`Editor`}),(0,$.jsxs)(`form`,{className:`provider-settings-form editor-settings-form`,onSubmit:e=>void c(e),children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Language servers`}),(0,$.jsx)(`small`,{children:`Local tools`})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`div`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Language servers`}),(0,$.jsx)(Ce,{value:e.languageServers,disabled:i,label:`Language servers`,options:C,onChange:e=>l(t=>({...t,languageServers:e}))})]})}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.diagnosticsWhileEditing,disabled:i||e.languageServers===`off`,onChange:e=>l(t=>({...t,diagnosticsWhileEditing:e.target.checked}))}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Diagnostics while editing`}),(0,$.jsx)(`small`,{children:`Update Monaco markers as the local buffer changes.`})]})]}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.checkOnSave,disabled:i||e.languageServers===`off`,onChange:e=>l(t=>({...t,checkOnSave:e.target.checked}))}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Check on save`}),(0,$.jsx)(`small`,{children:`Refresh diagnostics after writing a file.`})]})]}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Languages`}),(0,$.jsx)(`small`,{children:`Auto, disabled, or custom executable`})]}),(0,$.jsx)(`div`,{className:`lsp-language-list`,children:Bt.map(t=>{let n=e.languages[t.id];return(0,$.jsxs)(`div`,{className:`lsp-language-row`,children:[(0,$.jsxs)(`div`,{className:`lsp-language-label`,children:[(0,$.jsx)(`strong`,{children:t.label}),(0,$.jsx)(`span`,{children:Ht(p.get(t.id),a)})]}),(0,$.jsxs)(`div`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Mode`}),(0,$.jsx)(Ce,{value:n.mode,disabled:i||e.languageServers===`off`,label:`${t.label} language server mode`,options:x,onChange:e=>d(t.id,e)})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Custom executable`}),(0,$.jsx)(`input`,{value:n.customCommand,disabled:i||e.languageServers===`off`||n.mode!==`custom`,placeholder:t.placeholder,onChange:e=>u(t.id,e.target.value)})]})]},t.id)})}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:i||!f,children:(0,$.jsx)(`span`,{children:i?`Saving`:`Save editor settings`})})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`LSP status`}),(0,$.jsxs)(`div`,{className:`settings-heading-actions`,children:[(0,$.jsx)(`small`,{children:a?`Checking`:t?`Current`:`Not checked`}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Refresh LSP status`,"aria-label":`Refresh LSP status`,disabled:a||r,onClick:()=>void o(),children:(0,$.jsx)(J,{className:a?`settings-spin`:void 0,size:15})}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:a||r,onClick:()=>void s(),children:[(0,$.jsx)(st,{className:r?`settings-spin`:void 0,size:15}),(0,$.jsx)(`span`,{children:r?`Restarting`:`Restart`})]})]})]}),Bt.map(e=>{let t=p.get(e.id);return(0,$.jsxs)(`div`,{className:`product-row lsp-status-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsx)(`span`,{title:t?.command??t?.message??void 0,children:t?.command??t?.message??`Not checked`})]}),(0,$.jsx)(`span`,{className:`lsp-status-pill ${t?.status??`missing`}`,children:Ht(t,a)})]},e.id)})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`Project config`}),(0,$.jsx)(`strong`,{children:`Uses tsconfig, pyrightconfig, pyproject, and Cargo files when present`})]})]})}function Ht(e,t){return t&&!e?`Checking`:e?e.status===`found`?`Found`:e.status===`disabled`?`Disabled`:e.status===`error`?`Error`:`Missing`:`Not checked`}function Ut({contextCompactionAutoEnabled:e,embedded:t=!1,preferences:n,saving:r,saveDefaults:i,setContextCompactionAutoEnabled:a}){return(0,$.jsxs)(`section`,{className:`account-settings${t?` account-settings-embedded`:``}`,children:[t?(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Context`}),(0,$.jsx)(`small`,{children:`Compaction defaults for long chats`})]}):(0,$.jsx)(`h1`,{children:`Context`}),(0,$.jsxs)(`form`,{className:`provider-settings-form`,onSubmit:e=>void i(e),children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Compaction`}),(0,$.jsx)(`small`,{children:`Controls automatic compaction for long OpenPond and BYOK chats`})]}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,disabled:r,onChange:e=>a(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Auto compact long chats`}),(0,$.jsx)(`small`,{children:`Summarize older turns at 85% context before the selected model runs out. The transcript stays visible.`})]})]}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:r||e===n.contextCompaction.autoEnabled,children:(0,$.jsx)(`span`,{children:r?`Saving`:`Save context`})})]})]})}function Wt({subagentsEnabled:e,subagentDelegationMode:t,subagentsUseDefaultModel:n,subagentsProvider:r,subagentsModel:i,subagentRoles:a,subagentsMaxConcurrentRuns:o,subagentsMaxConcurrentRunsPerProvider:s,subagentsMaxConcurrentRunsPerWorkspaceTarget:c,preferences:l,providers:d,saving:f,saveDefaults:p,changeSubagentsProvider:m,setSubagentsEnabled:h,setSubagentDelegationMode:g,setSubagentsUseDefaultModel:_,setSubagentsModel:v,setSubagentsMaxConcurrentRuns:b,setSubagentsMaxConcurrentRunsPerProvider:x,setSubagentsMaxConcurrentRunsPerWorkspaceTarget:S,setSubagentRoleEnabled:C,setSubagentRoleIsolationMode:w,setSubagentRoleMaxConcurrentRuns:T,setSubagentRoleModel:O,setSubagentRolePeerMessages:k,setSubagentRoleToolPolicy:A,changeSubagentRoleProvider:j}){let M=y(d,{enabledOnly:!0}),N=n?l.defaultChatProvider:r,P=n?l.defaultChatModel:i,F=Jt(D(N,d),P),I=$t({enabled:e,delegationMode:t,defaultModelRef:n?null:{providerId:r,modelId:i.trim()},roles:a,maxConcurrentRuns:o,maxConcurrentRunsPerProvider:s,maxConcurrentRunsPerWorkspaceTarget:c},l);return(0,$.jsx)(`section`,{className:`account-settings subagents-settings`,children:(0,$.jsxs)(`form`,{className:`subagent-settings-form`,onSubmit:e=>void p(e),children:[(0,$.jsxs)(`div`,{className:`subagent-settings-title-row`,children:[(0,$.jsx)(`h1`,{children:`Agents`}),(0,$.jsxs)(`div`,{className:`subagent-settings-actions`,children:[(0,$.jsx)(`button`,{className:`settings-primary subagent-save-button${I?``:` dirty`}`,disabled:f||I,children:(0,$.jsx)(`span`,{children:f?`Saving`:`Save agents`})}),(0,$.jsxs)(`label`,{className:`provider-toggle subagent-card-toggle`,"aria-label":`Allow subagents`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,disabled:f,onChange:e=>h(e.target.checked)}),(0,$.jsx)(`span`,{})]})]})]}),(0,$.jsxs)(`section`,{className:`subagent-settings-section`,children:[(0,$.jsx)(`div`,{className:`subagent-settings-card-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Default delegation`}),(0,$.jsx)(`small`,{children:`Used unless a task overrides it from the composer.`})]})}),(0,$.jsx)(`div`,{className:`subagent-field-grid two`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Subagent use`}),(0,$.jsxs)(`select`,{value:t,disabled:f||!e,onChange:e=>g(e.target.value),children:[(0,$.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,$.jsx)(`option`,{value:`balanced`,children:`Balanced`}),(0,$.jsx)(`option`,{value:`proactive`,children:`Proactive`})]})]})})]}),(0,$.jsxs)(`section`,{className:`subagent-settings-section`,children:[(0,$.jsx)(`div`,{className:`subagent-settings-card-header`,children:(0,$.jsx)(`div`,{children:(0,$.jsx)(`span`,{children:`Default model`})})}),(0,$.jsxs)(`div`,{className:`subagent-field-grid two`,children:[(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Provider`}),(0,$.jsx)(`select`,{value:N,disabled:f||!e,onChange:e=>{_(!1),m(e.target.value)},children:M.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Model`}),(0,$.jsx)(`select`,{value:P,disabled:f||!e,onChange:e=>{_(!1),v(e.target.value)},children:F.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]}),(0,$.jsx)(`div`,{className:`subagent-role-list`,children:a.map(t=>{let n=u.find(e=>e.id===t.id),r=t.modelRef?.providerId??N,i=t.modelRef?.modelId||E(r,d)||P,a=Xt(M,d,{providerId:r,modelId:i}),o=Yt(r,i),s=f||!e||!t.enabled;return(0,$.jsxs)(`section`,{className:`subagent-role-row${t.enabled?``:` disabled`}`,children:[(0,$.jsxs)(`div`,{className:`subagent-settings-card-header subagent-role-header`,children:[(0,$.jsxs)(`div`,{className:`subagent-role-title`,children:[(0,$.jsx)(`span`,{children:n?.label??t.id}),(0,$.jsx)(`small`,{children:n?.description??`Custom subagent role.`})]}),(0,$.jsxs)(`label`,{className:`provider-toggle subagent-card-toggle`,"aria-label":`${n?.label??t.id} enabled`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:t.enabled,disabled:f||!e,onChange:e=>C(t.id,e.target.checked)}),(0,$.jsx)(`span`,{})]})]}),(0,$.jsxs)(`div`,{className:`subagent-role-controls`,children:[(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Model`}),(0,$.jsx)(`select`,{value:o,disabled:s,onChange:e=>{let n=a.find(t=>t.value===e.target.value);n&&(j(t.id,n.providerId),O(t.id,n.modelId))},children:a.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Isolation`}),(0,$.jsx)(`select`,{value:t.isolationMode,disabled:s,onChange:e=>w(t.id,e.target.value),children:Gt.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Tools`}),(0,$.jsx)(`select`,{value:t.toolPolicy,disabled:s,onChange:e=>A(t.id,e.target.value),children:Kt.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Peer messages`}),(0,$.jsx)(`select`,{value:t.peerMessages,disabled:s,onChange:e=>k(t.id,e.target.value),children:qt.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]}),(0,$.jsx)(`div`,{className:`subagent-role-budget-grid`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Role concurrency`}),(0,$.jsx)(`input`,{type:`number`,min:1,max:16,value:t.maxConcurrentRuns,disabled:s,onChange:e=>T(t.id,Qt(e.target.value,1))})]})})]},t.id)})}),(0,$.jsxs)(`section`,{className:`subagent-settings-section`,children:[(0,$.jsx)(`div`,{className:`subagent-settings-card-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Limits`}),(0,$.jsx)(`small`,{children:`Controls child worker concurrency.`})]})}),(0,$.jsxs)(`div`,{className:`subagent-field-grid four`,children:[(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Total concurrency`}),(0,$.jsx)(`input`,{type:`number`,min:1,max:32,value:o,disabled:f||!e,onChange:e=>b(Qt(e.target.value,1))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Per provider`}),(0,$.jsx)(`input`,{type:`number`,min:1,max:32,value:s??``,placeholder:`No cap`,disabled:f||!e,onChange:e=>x(Zt(e.target.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Per workspace`}),(0,$.jsx)(`input`,{type:`number`,min:1,max:32,value:c??``,placeholder:`No cap`,disabled:f||!e,onChange:e=>S(Zt(e.target.value))})]})]})]})]})})}var Gt=[{value:`none`,label:`Direct workspace`},{value:`copy_on_write`,label:`Copy-on-write`},{value:`worktree`,label:`Worktree`}],Kt=[{value:`read_only`,label:`Read only`},{value:`workspace_write`,label:`Workspace write`},{value:`full_tools`,label:`Full tools`}],qt=[{value:`parent_scoped`,label:`Parent-scoped handoffs`},{value:`disabled`,label:`Disabled`}];function Jt(e,t){let n=t.trim();return!n||e.some(e=>e.value===n)?e:[{value:n,label:n},...e]}function Yt(e,t){return JSON.stringify([e,t])}function Xt(e,t,n){let r=[];for(let i of e){let e=Jt(D(i.value,t),i.value===n.providerId?n.modelId:``);for(let t of e)r.push({value:Yt(i.value,t.value),label:`${i.label} / ${t.label}`,providerId:i.value,modelId:t.value})}return n.modelId&&!r.some(e=>e.value===Yt(n.providerId,n.modelId))&&r.unshift({value:Yt(n.providerId,n.modelId),label:`${S(n.providerId,t)} / ${n.modelId}`,providerId:n.providerId,modelId:n.modelId}),r}function Zt(e){let t=e.trim();if(!t)return null;let n=Number(t);return Number.isFinite(n)?n:null}function Qt(e,t){return Zt(e)??t}function $t(e,t){let n=t.subagents;return e.enabled===n.enabled&&e.delegationMode===n.delegationMode&&en(e.defaultModelRef,n.defaultModelRef)&&e.maxConcurrentRuns===n.maxConcurrentRuns&&e.maxConcurrentRunsPerProvider===n.maxConcurrentRunsPerProvider&&e.maxConcurrentRunsPerWorkspaceTarget===n.maxConcurrentRunsPerWorkspaceTarget&&JSON.stringify(e.roles)===JSON.stringify(n.roles)}function en(e,t){return(e?.providerId??null)===(t?.providerId??null)&&(e?.modelId??null)===(t?.modelId??null)}var tn=[{mode:`all`,label:`All new messages`,detail:`Show an in-app alert for every Team Chat message.`},{mode:`direct_mentions`,label:`Direct messages and mentions`,detail:`Show alerts for direct messages and messages that mention you.`},{mode:`none`,label:`Nothing`,detail:`Keep unread counts without showing message alerts.`}];function nn({currentUserId:e,enabled:t,mode:n,threads:r,onModeChange:i,onThreadMuteChange:a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null);fe(c);let u=(0,Q.useMemo)(()=>r.filter(e=>e.archivedAt===null).map(t=>({thread:t,label:rn(t,e)})).sort((e,t)=>{let n=Number(!!t.thread.mutedAt)-Number(!!e.thread.mutedAt);return n===0?e.label.localeCompare(t.label):n}),[e,r]),d=u.filter(({thread:e})=>!!e.mutedAt).length,f=(0,Q.useCallback)(async e=>{s(e.id),l(null),await a(e.id,!e.mutedAt)||l(`Could not update this conversation. Try again.`),s(null)},[a]);return(0,$.jsxs)(`section`,{className:`account-settings notifications-settings`,children:[(0,$.jsx)(`h1`,{children:`Notifications`}),(0,$.jsxs)(`div`,{className:`account-list notification-settings-card`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Team chat notifications`}),(0,$.jsx)(`small`,{children:`In-app alerts`})]}),(0,$.jsx)(`div`,{className:`notification-mode-list`,role:`radiogroup`,"aria-label":`Notify me about`,children:tn.map(e=>(0,$.jsxs)(`label`,{className:`notification-mode-option${n===e.mode?` selected`:``}`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`team-chat-notification-mode`,checked:n===e.mode,onChange:()=>i(e.mode)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsx)(`small`,{children:e.detail})]})]},e.mode))})]}),(0,$.jsxs)(`div`,{className:`account-list notification-settings-card`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Conversation overrides`}),(0,$.jsx)(`small`,{children:d===1?`1 muted`:`${d} muted`})]}),t?u.length===0?(0,$.jsx)(`div`,{className:`empty-account-list`,children:(0,$.jsx)(`span`,{children:`Open a Team Chat conversation to manage it here.`})}):u.map(({thread:e,label:t})=>{let n=!!e.mutedAt,r=o===e.id;return(0,$.jsxs)(`div`,{className:`notification-thread-row`,children:[(0,$.jsx)(`span`,{className:`notification-thread-icon${n?` muted`:``}`,children:n?(0,$.jsx)(te,{size:15}):(0,$.jsx)(R,{size:15})}),(0,$.jsxs)(`span`,{className:`notification-thread-copy`,children:[(0,$.jsx)(`strong`,{children:t}),(0,$.jsx)(`small`,{children:n?`Muted`:`Uses the team chat setting`})]}),(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:o!==null,onClick:()=>void f(e),children:r?`Saving`:n?`Unmute`:`Mute`})]},e.id)}):(0,$.jsx)(`div`,{className:`empty-account-list`,children:(0,$.jsx)(`span`,{children:`Connect a team to manage conversation overrides.`})})]}),(0,$.jsx)(`div`,{className:`settings-footnote`,children:(0,$.jsx)(`span`,{children:`Muted conversations never show alerts. Unread counts remain available.`})})]})}function rn(e,t){return e.kind===`general`||e.kind===`channel`?`#${e.title?.trim()||`general`}`:e.kind===`dm`?e.participants.find(e=>e.userId!==t)?.name??e.title?.trim()??`Direct message`:e.title?.trim()||e.participants.filter(e=>e.userId!==t).map(e=>e.name).join(`, `)||`Group conversation`}function an({canSaveCurrentTemplate:e,personalizationTemplateId:t,personalizationTemplateOptions:n,saveAsNewOpen:r,saving:i,selectedPersonalizationTemplate:a,selectedTemplateIsCustom:o,soulDraft:s,templateNameDraft:c,changePersonalizationTemplate:l,changeSoulDraft:u,openSaveAsNew:d,resetPersonalizationDraft:f,savePersonalization:p,setSaveAsNewOpen:m,setTemplateNameDraft:h}){function g(e){e.preventDefault(),p(r)}return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h1`,{children:`Personalization`}),(0,$.jsxs)(`form`,{className:`provider-settings-form personalization-form`,onSubmit:g,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Agent style`}),(0,$.jsx)(`div`,{className:`settings-heading-actions`,children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{className:`settings-heading-input`,value:c,onChange:e=>h(e.target.value),placeholder:`Name`,"aria-label":`Template name`}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Cancel`,"aria-label":`Cancel`,disabled:i,onClick:()=>m(!1),children:(0,$.jsx)(Y,{size:15})}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button primary`,title:`Save new template`,"aria-label":`Save new template`,disabled:i||!s.trim()||!c.trim(),onClick:()=>void p(!0),children:(0,$.jsx)(Re,{size:15})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`small`,{children:o?`Custom template`:`Built-in template`}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Save as new`,"aria-label":`Save as new`,disabled:i||!a||!s.trim(),onClick:d,children:(0,$.jsx)(q,{size:15})})]})})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`div`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Template`}),(0,$.jsx)(Ce,{value:t,disabled:i||n.length===0,label:`Personalization template`,options:n,onChange:e=>void l(e)})]})}),(0,$.jsxs)(`label`,{className:`settings-select-field personalization-editor`,children:[(0,$.jsx)(`span`,{children:`SOUL.md`}),(0,$.jsx)(`textarea`,{value:s,onChange:e=>u(e.target.value),spellCheck:!1})]}),(0,$.jsxs)(`div`,{className:`settings-button-row`,children:[(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Reset to template`,"aria-label":`Reset to template`,disabled:i||!a,onClick:f,children:(0,$.jsx)(Oe,{size:15})}),o&&(0,$.jsx)(`button`,{className:`settings-icon-button primary`,title:`Save template`,"aria-label":`Save template`,disabled:i||!e,children:(0,$.jsx)(de,{size:15})})]})]})]})}function on({connection:e,profile:t,selectedDefaultTeamId:n}){let r=Qe(e),i=dn(r.schedules);return fe(r.error,{prefix:`Local schedules`}),(0,$.jsxs)(`div`,{className:`account-list profile-agent-list`,"aria-label":`Profile agents`,children:[(0,$.jsx)(`div`,{className:`account-list-heading profile-agent-list-heading`,children:(0,$.jsx)(`span`,{children:`Agents`})}),(0,$.jsx)(`div`,{className:`profile-table-frame`,children:(0,$.jsxs)(`table`,{className:`profile-data-table profile-agent-table`,"aria-label":`Profile agents table`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`profile-agent-column`}),(0,$.jsx)(`col`,{className:`profile-action-column`}),(0,$.jsx)(`col`,{className:`profile-check-column`}),(0,$.jsx)(`col`,{className:`profile-sync-column`})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Agent`}),(0,$.jsx)(`th`,{scope:`col`,children:`Action`}),(0,$.jsx)(`th`,{scope:`col`,children:`Check`}),(0,$.jsx)(`th`,{scope:`col`,children:`Sync`})]})}),(0,$.jsxs)(`tbody`,{children:[i.active.map(e=>(0,$.jsx)(ln,{pending:r.pendingScheduleIds.has(e.id),schedule:e,refreshing:r.loading,onRefresh:()=>void r.refresh(),onRun:()=>void r.run(e),onToggle:()=>void r.toggle(e)},e.id)),(0,$.jsx)(sn,{}),t.agents.map(e=>(0,$.jsx)(cn,{agent:e,defaultAction:t.summary.defaultAction,profile:t,selectedDefaultTeamId:n},e.id)),i.paused.map(e=>(0,$.jsx)(ln,{pending:r.pendingScheduleIds.has(e.id),schedule:e,refreshing:r.loading,onRefresh:()=>void r.refresh(),onRun:()=>void r.run(e),onToggle:()=>void r.toggle(e)},e.id))]})]})})]})}function sn(){return(0,$.jsxs)(`tr`,{className:`profile-agent-row`,children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(z,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Dataset Builder`}),(0,$.jsx)(`span`,{children:`Built in · every Profile`})]})]})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`div`,{className:`profile-agent-action`,children:(0,$.jsx)(`span`,{children:`Design · Materialize · Test`})})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:{state:`ready`,label:`Ready`}})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:{state:`ready`,label:`Built in`}})})]})}function cn({agent:e,defaultAction:t,profile:n,selectedDefaultTeamId:r}){let i=gn(n,e,r);return(0,$.jsxs)(`tr`,{className:`profile-agent-row`,children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(z,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{title:e.path,children:e.path})]})]})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`div`,{className:`profile-agent-action`,children:(0,$.jsx)(`span`,{children:t??`None`})})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:i.check})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:i.sync})})]})}function ln({pending:e,refreshing:t,schedule:n,onRefresh:r,onRun:i,onToggle:a}){let o=pn(n),s=n.enabled?`Pause schedule`:`Resume schedule`;return(0,$.jsxs)(`tr`,{className:`profile-agent-row profile-schedule-agent-row`,children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(z,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:n.localProjectName}),(0,$.jsxs)(`span`,{title:n.scheduleName,children:[`schedule: `,n.scheduleName]})]})]})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`div`,{className:`profile-agent-action`,children:(0,$.jsx)(`span`,{title:n.targetAction,children:n.targetAction})})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:o})}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-schedule-actions`,children:[(0,$.jsx)(`span`,{className:`profile-schedule-expression`,title:mn(n),children:n.enabled?n.scheduleExpression:`Paused`}),(0,$.jsxs)(`div`,{className:`profile-schedule-controls`,"aria-label":`${n.scheduleName} schedule controls`,children:[(0,$.jsx)(`button`,{className:`settings-icon-button profile-schedule-button`,disabled:t,type:`button`,title:`Refresh local schedules`,"aria-label":`Refresh local schedules`,onClick:r,children:(0,$.jsx)(J,{size:14,className:t?`settings-spin`:void 0})}),(0,$.jsx)(`button`,{className:`settings-icon-button profile-schedule-button`,disabled:e,type:`button`,title:`Run now`,"aria-label":`Run ${n.scheduleName} now`,onClick:i,children:(0,$.jsx)(Oe,{size:14})}),(0,$.jsx)(`button`,{className:`settings-icon-button profile-schedule-button`,disabled:e,type:`button`,title:s,"aria-label":`${s}: ${n.scheduleName}`,onClick:a,children:n.enabled?(0,$.jsx)(P,{size:14}):(0,$.jsx)(ue,{size:14})})]})]})})]})}function un({status:e}){return(0,$.jsx)(`span`,{className:`profile-status-text ${e.state}`,children:e.label})}function dn(e){let t=[],n=[];for(let r of e)r.enabled?t.push(r):n.push(r);return t.sort((e,t)=>fn(e)-fn(t)),{active:t,paused:n}}function fn(e){return e.lastRunStatus===`running`?0:e.lastRunStatus===`queued`?1:2}function pn(e){return e.enabled?e.lastError||e.lastRunStatus===`failed`?{state:`warning`,label:`Failed`}:e.lastRunStatus===`running`?{state:`loading`,label:`Running`}:e.lastRunStatus===`queued`?{state:`loading`,label:`Queued`}:e.lastRunStatus===`skipped`?{state:`warning`,label:`Skipped`}:e.lastRunStatus===`succeeded`?{state:`ready`,label:`Succeeded`}:{state:`loading`,label:`Scheduled`}:{state:`disabled`,label:`Paused`}}function mn(e){let t=[`${e.scheduleType}: ${e.scheduleExpression}`];return e.nextRunAt&&t.push(`next ${hn(e.nextRunAt)}`),e.lastRunAt&&t.push(`last ${hn(e.lastRunAt)}`),t.join(` - `)}function hn(e){let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}):e}function gn(e,t,n){if(!t.enabled)return{check:{state:`disabled`,label:`Disabled`},sync:{state:`disabled`,label:`Disabled`}};if(e.error)return{check:{state:`warning`,label:`Error`},sync:{state:`warning`,label:`Blocked`}};if(e.setupGate.blockingCount>0)return{check:{state:`warning`,label:`Setup`},sync:{state:`warning`,label:`Blocked`}};if(e.git?.dirty||vn(e,t)>0)return{check:{state:`loading`,label:`Pending`},sync:{state:`warning`,label:`Changed`}};if(e.catalog.stale)return{check:{state:`loading`,label:`Stale`},sync:{state:`loading`,label:`Waiting`}};if(!e.lastCheck)return{check:{state:`loading`,label:`Unchecked`},sync:{state:`loading`,label:`Waiting`}};if(e.lastCheck.status===`failed`)return{check:{state:`warning`,label:`Failed`},sync:{state:`warning`,label:`Blocked`}};if(!e.summary.checkFresh)return{check:{state:`loading`,label:`Stale`},sync:{state:`loading`,label:`Waiting`}};if(_n(e,n))return{check:{state:`ready`,label:`Passed`},sync:{state:`warning`,label:`Sync acct`}};let r=e.summary.localHead??e.git?.head??null,i=e.hosted?.lastPushedLocalHead??null;return!(e.summary.hostedHead??e.hosted?.sourceCommitSha??null)&&!i?{check:{state:`ready`,label:`Passed`},sync:{state:`loading`,label:`Not synced`}}:r&&i&&r!==i?{check:{state:`ready`,label:`Passed`},sync:{state:`loading`,label:`Needed`}}:{check:{state:`ready`,label:`Passed`},sync:{state:`ready`,label:`Synced`}}}function _n(e,t){let n=e.hosted?.teamId?.trim()??``;return!!(n&&t&&n!==t)}function vn(e,t){let n=0;e.diff.changedAgents.includes(t.id)&&(n+=1),e.diff.newAgents.includes(t.id)&&(n+=1),e.diff.deletedAgents.includes(t.id)&&(n+=1);let r=t.path.replace(/^profiles\/[^/]+\//,``);for(let i of e.diff.files){let e=i.path.replace(/^profiles\/[^/]+\//,``);(e===r||e.startsWith(`${r}/`)||e.startsWith(`agents/${t.id}/`))&&(n+=1)}return n}function yn(e){return e.policy.kind===`model`?`${e.policy.model.provider}/${e.policy.model.model}`:`Fixture`}function bn({comparison:e}){let t=[...new Set(e.members.map(e=>e.source.sourceRevision))],n=[...new Set(e.members.map(yn))];return(0,$.jsxs)(`table`,{className:`profile-evaluations-comparison-matrix`,children:[(0,$.jsxs)(`caption`,{children:[`Same frozen Taskset `,e.tasksetRelease.id,` across Profile source and model choices`]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Profile source`}),n.map(e=>(0,$.jsx)(`th`,{scope:`col`,children:e},e))]})}),(0,$.jsx)(`tbody`,{children:t.map(t=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`row`,title:t,children:t.slice(0,12)}),n.map(n=>{let r=e.members.filter(e=>e.source.sourceRevision===t&&yn(e)===n);return(0,$.jsx)(`td`,{children:r.length?r.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.score===null?`No score`:`${Math.round(e.score*100)}%`}),(0,$.jsxs)(`small`,{children:[` · Run `,e.runManifest.id]})]},e.runManifest.id)):`—`},n)})]},t))})]})}function xn(e){switch(e.kind){case`profile`:return`Complete Profile`;case`workflow`:return`Workflow · ${e.workflowId}`;case`skill`:return`Skill · ${e.skillPath}`;case`agent_action`:return`Agent action · ${e.actionId}`}}function Sn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Cn(e){return e===null?`No score`:`${Math.round(e*100)}%`}function wn(e){return e.manifest.policy.kind===`model`?`${e.manifest.policy.model.provider}/${e.manifest.policy.model.model}`:`Fixture`}function Tn({catalog:e,evaluations:t,onEvaluate:n,onOpenRun:r,busy:i}){let[a,o]=(0,Q.useState)(null);return(0,$.jsxs)(`section`,{className:`profile-workflows`,"aria-label":`Profile workflows`,children:[(0,$.jsxs)(`div`,{className:`profile-workflows-header`,children:[(0,$.jsx)(`h3`,{children:`Workflows`}),(0,$.jsx)(`p`,{children:`Open a workflow to review its instructions and linked evaluations.`})]}),e.workflows.length?(0,$.jsx)(`div`,{className:`profile-table-scroll`,children:(0,$.jsxs)(`table`,{className:`profile-evaluation-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Workflow`}),(0,$.jsx)(`th`,{scope:`col`,children:`Evaluations`}),(0,$.jsx)(`th`,{scope:`col`,children:`Runs`}),(0,$.jsx)(`th`,{scope:`col`,children:`Latest result`}),(0,$.jsx)(`th`,{scope:`col`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:e.workflows.map(({workflow:e,binding:s})=>{let c=t?.definitions.filter(t=>t.target.kind===`workflow`&&t.target.workflowId===e.id)??[],l=t?.runs.filter(t=>t.manifest.profileEvaluation?.target.kind===`workflow`&&t.manifest.profileEvaluation.target.workflowId===e.id)??[],u=l[0];return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`th`,{scope:`row`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":a===e.id,onClick:()=>o(t=>t===e.id?null:e.id),children:e.label}),(0,$.jsx)(`small`,{children:e.description})]}),(0,$.jsx)(`td`,{children:t?c.length:`—`}),(0,$.jsx)(`td`,{children:t?l.length:`—`}),(0,$.jsx)(`td`,{children:u?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(u),children:[u.passed?`Passed`:`Did not pass`,` · `,Cn(u.metric.value),(0,$.jsx)(`small`,{children:Sn(u.completedAt)})]}):`Not run`}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`button`,{type:`button`,disabled:i||!t,onClick:()=>n(e.id),children:c.length?`Run Evaluation`:`View evaluations`})})]}),a===e.id?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsxs)(`p`,{children:[`Revision `,s.sourceRevision.slice(0,12),` · Release `,s.harnessRelease.contentHash.slice(0,12)]}),e.skillPaths.length?(0,$.jsxs)(`p`,{children:[`Skills: `,e.skillPaths.join(`, `)]}):null,(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:e.invocation.kind===`instructions`?`Instructions`:`Action configuration`}),(0,$.jsx)(`pre`,{children:e.invocation.kind===`instructions`?e.invocation.instructions:JSON.stringify(e.invocation,null,2)})]}),(0,$.jsx)(`strong`,{children:`Linked evaluations`}),c.length?(0,$.jsx)(`ul`,{children:c.map(e=>(0,$.jsxs)(`li`,{children:[e.label,` · `,e.taskIds.length,` tasks · `,e.seeds.length,` seeds`]},e.id))}):(0,$.jsx)(`p`,{children:t?`No evaluation definition targets this workflow. Add one in the Profile’s evals catalog to run it.`:`Evaluation catalog unavailable.`}),(0,$.jsx)(`button`,{type:`button`,disabled:i||!t,onClick:()=>n(e.id),children:c.length?`Run Evaluation`:`View evaluation history`})]})})}):null]},e.id)})})]})}):(0,$.jsx)(`p`,{children:`No workflows in this Profile yet.`})]})}function En({runs:e,definitions:t,sourceRevision:n,onOpen:r,onSave:i,savingReportId:a}){let[o,s]=(0,Q.useState)(20);return(0,$.jsxs)(`div`,{className:`profile-evaluations-history`,children:[(0,$.jsx)(`h4`,{children:`Run history`}),e.length?(0,$.jsx)(`div`,{className:`profile-table-scroll`,children:(0,$.jsxs)(`table`,{className:`profile-evaluation-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Evaluation / target`}),(0,$.jsx)(`th`,{scope:`col`,children:`Completed`}),(0,$.jsx)(`th`,{scope:`col`,children:`Model`}),(0,$.jsx)(`th`,{scope:`col`,children:`Result`}),(0,$.jsx)(`th`,{scope:`col`,children:`Score`}),(0,$.jsx)(`th`,{scope:`col`,children:`Attempts`}),(0,$.jsx)(`th`,{scope:`col`,children:`Source`}),(0,$.jsx)(`th`,{scope:`col`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:e.slice(0,o).map(e=>{let o=e.manifest.profileEvaluation,s=o?.sourceRevision===n?t.find(e=>e.id===o.definitionId):null;return(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`th`,{scope:`row`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),children:s?.label??o?.definitionId??e.manifest.id}),o?(0,$.jsx)(`small`,{children:xn(o.target)}):null]}),(0,$.jsx)(`td`,{children:Sn(e.completedAt)}),(0,$.jsx)(`td`,{children:wn(e)}),(0,$.jsx)(`td`,{children:e.passed?`Passed`:`Did not pass`}),(0,$.jsx)(`td`,{children:Cn(e.metric.value)}),(0,$.jsx)(`td`,{children:e.receiptRefs.length}),(0,$.jsx)(`td`,{title:o?.sourceRevision,children:o?.sourceRevision.slice(0,10)??`—`}),(0,$.jsxs)(`td`,{children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),children:`View results`}),` `,(0,$.jsx)(`button`,{type:`button`,disabled:!!a,onClick:()=>i(e.manifest.id),children:a===e.manifest.id?`Saving…`:`Save report`})]})]},e.manifest.id)})})]})}):(0,$.jsx)(`p`,{children:`No evaluation runs yet.`}),e.length>o?(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(e=>e+20),children:`Show more runs`}):null]})}function Dn(e){return A(e,`/v1/profile/evaluations/discover`,{method:`POST`,body:JSON.stringify({view:`history`})})}function On(e,t,n){return A(e,`/v1/profile/evaluations/discover`,{method:`POST`,body:JSON.stringify(t),signal:n})}function kn({connection:e,run:t,onClose:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!0),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(50),[S,C]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{r.current?.showModal()},[]),(0,Q.useEffect)(()=>{let n=new AbortController;return d(!0),h(null),On(e,{runId:t.manifest.id},n.signal).then(e=>{n.signal.aborted||a(e.cases)}).catch(e=>{n.signal.aborted||h(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||d(!1)}),()=>n.abort()},[e,t.manifest.id,v]),(0,Q.useEffect)(()=>{if(!o)return;let n=new AbortController;return p(!0),_(null),On(e,{runId:t.manifest.id,receiptId:o,...S?{eventAfterId:S}:{}},n.signal).then(e=>{n.signal.aborted||l(e.cases[0]??null)}).catch(e=>{n.signal.aborted||_(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||p(!1)}),()=>n.abort()},[e,t.manifest.id,o,S,v]);let w=t.manifest.profileEvaluation;return(0,$.jsx)(`dialog`,{ref:r,className:`profile-evaluation-dialog`,"aria-labelledby":`profile-run-title`,onCancel:n,onClick:e=>{if(e.target===e.currentTarget){let t=e.currentTarget.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&n()}},children:(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,children:[(0,$.jsxs)(`header`,{className:`profile-evaluation-dialog-header`,children:[(0,$.jsx)(`h2`,{id:`profile-run-title`,children:`Evaluation results`}),(0,$.jsx)(`button`,{type:`button`,autoFocus:!0,onClick:n,children:`Close`})]}),(0,$.jsxs)(`strong`,{children:[w?.definitionId??t.manifest.id,` · `,t.passed?`Passed`:`Did not pass`,` · `,Cn(t.metric.value)]}),(0,$.jsxs)(`p`,{children:[w?xn(w.target):`Profile evaluation`,` · `,wn(t),` · `,Sn(t.completedAt)]}),(0,$.jsxs)(`p`,{children:[`Pass rate `,Cn(t.passRate),` · Source `,w?.sourceRevision,` · Run `,t.manifest.id]}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Frozen run configuration`}),(0,$.jsx)(`pre`,{children:JSON.stringify(t.manifest,null,2)})]}),u?(0,$.jsx)(`p`,{role:`status`,children:`Loading case results…`}):null,m?(0,$.jsx)(X,{error:m,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>y(e=>e+1),children:`Retry`})}):null,(0,$.jsx)(`div`,{className:`profile-table-scroll`,children:(0,$.jsxs)(`table`,{className:`profile-evaluation-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Task`}),(0,$.jsx)(`th`,{scope:`col`,children:`Seed`}),(0,$.jsx)(`th`,{scope:`col`,children:`Result`}),(0,$.jsx)(`th`,{scope:`col`,children:`Score`}),(0,$.jsx)(`th`,{scope:`col`,children:`Grading`}),(0,$.jsx)(`th`,{scope:`col`,children:`Latency`}),(0,$.jsx)(`th`,{scope:`col`,children:`Cost`})]})}),(0,$.jsx)(`tbody`,{children:i.slice(0,b).map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`row`,children:(0,$.jsx)(`button`,{type:`button`,"aria-pressed":o===e.receiptId,onClick:()=>{(o!==e.receiptId||S)&&(s(e.receiptId),l(null),C(null))},children:e.taskId})}),(0,$.jsx)(`td`,{children:e.seed}),(0,$.jsx)(`td`,{children:e.passed?`Passed`:`Did not pass`}),(0,$.jsx)(`td`,{children:Cn(e.score)}),(0,$.jsxs)(`td`,{children:[e.gradingStatus,e.failureClass?` · ${e.failureClass}`:``]}),(0,$.jsxs)(`td`,{children:[e.latencyMs.toLocaleString(),` ms`]}),(0,$.jsx)(`td`,{children:e.costUsd===null?`Unknown`:`$${e.costUsd.toFixed(4)}`})]},e.receiptId))})]})}),i.length>b?(0,$.jsx)(`button`,{type:`button`,onClick:()=>x(e=>e+50),children:`Show more cases`}):null,f?(0,$.jsx)(`p`,{role:`status`,children:`Loading case evidence…`}):null,g?(0,$.jsx)(X,{error:g,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>y(e=>e+1),children:`Retry`})}):null,c?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,"aria-label":`Case evidence`,children:[(0,$.jsxs)(`h3`,{children:[c.taskId,` · Seed `,c.seed]}),(0,$.jsx)(`h4`,{children:`Grader feedback`}),(0,$.jsx)(`p`,{children:`Evaluations use the graders pinned by their Taskset. Each result below identifies the grader and version used for this case.`}),c.feedback.length?c.feedback.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[e.graderId,` · `,e.graderVersion,` · `,Cn(e.score),` · `,e.passed?`Passed`:`Did not pass`]}),(0,$.jsx)(`ul`,{children:e.feedback.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]},`${e.graderId}:${e.graderVersion}`)):(0,$.jsx)(`p`,{children:`No grader feedback retained for this case.`}),c.evidence?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h4`,{children:`Input`}),(0,$.jsx)(`pre`,{children:c.evidence.prompt}),(0,$.jsx)(`h4`,{children:`Output`}),(0,$.jsx)(`pre`,{children:c.evidence.output?.text??c.evidence.partialOutput?.text??`No output retained.`}),c.evidence.error?(0,$.jsx)(`p`,{role:`alert`,children:c.evidence.error}):null,(0,$.jsxs)(`details`,{children:[(0,$.jsxs)(`summary`,{children:[`Trace · `,c.evidence.eventCount,` events`]}),(0,$.jsx)(`pre`,{children:JSON.stringify(c.evidence.events,null,2)}),S?(0,$.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>C(null),children:`First trace page`}):null,c.evidence.nextEventCursor?(0,$.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>C(c.evidence.nextEventCursor),children:`Next trace page`}):null]})]}):(0,$.jsx)(`p`,{children:`No policy trace retained for this case. Scores and grader feedback are available above.`}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Case receipt`}),(0,$.jsx)(`pre`,{children:JSON.stringify(c.receipt,null,2)})]})]}):null]})})}function An(e,t){return e.kind===t.kind&&(t.kind===`profile`||e.kind===`workflow`&&e.workflowId===t.id||e.kind===`skill`&&e.skillPath===t.id)}function jn(e){return Object.values(e.statuses).flatMap(t=>{if(!t.enabled||!t.available||!t.credential.connected)return[];let n=e.providers[t.id];return[...new Set([...t.modelIds,...e.modelCaches[t.id]?.models.map(e=>e.id)??[],...n?.modelOverrides??[],t.defaultModel,n?.defaultModel].filter(e=>!!e))].map(e=>({key:JSON.stringify([t.id,e]),providerId:t.id,modelId:e,label:`${t.displayName} · ${e}`}))})}function Mn({connection:e,selectedProfileKey:t,focusTarget:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(50),[x,S]=(0,Q.useState)(20),[C,w]=(0,Q.useState)([]),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)([]),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(null),[ne,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(!1),[re,H]=(0,Q.useState)(null);if((0,Q.useEffect)(()=>{if(!e||!t){g(null),s(null),a(null),p(null),A([]),P(null);return}let n=!0;return V(!0),g(null),s(null),a(null),l(null),d(null),p(null),m.current=null,v(null),b(50),S(20),w([]),A([]),M(``),P(null),z(null),H(null),Dn(e).then(e=>{n&&s(e)}).catch(e=>{n&&H(e instanceof Error?e.message:String(e))}),Z.profileWorkflows(e).then(e=>{n&&a(e)}).catch(e=>{n&&l(e instanceof Error?e.message:String(e))}),Z.profileEvaluations(e).then(e=>{n&&g(e)}).catch(e=>{n&&H(e instanceof Error?e.message:String(e))}).finally(()=>{n&&V(!1)}),Z.providerSettings(e).then(e=>{if(!n)return;let t=jn(e);A(t),M(t[0]?.key??``)}).catch(e=>{n&&H(e instanceof Error?e.message:String(e))}),()=>{n=!1}},[e,t]),(0,Q.useEffect)(()=>{if(!n||!h||m.current===n)return;m.current=n;let e=h.definitions.find(e=>An(e.target,n));d(n),v(e?.id??null),P(null),b(50),z(e?null:`No evaluation definition is saved for this Profile component.`),r.current?.scrollIntoView({behavior:`smooth`,block:`start`})},[h,n]),!t)return null;let U=h?.definitions.find(e=>e.id===_),W=h?.definitions.filter(e=>!u||An(e.target,u))??[],G=o??h,ie=h?{...h,runs:G?.runs??[],suiteRuns:G?.suiteRuns??[]}:null,ae=G?.runs.filter(e=>u?!!(e.manifest.profileEvaluation&&An(e.manifest.profileEvaluation.target,u)):!U||e.manifest.profileEvaluation?.definitionId===U.id)??[],K=F||L||!!ee,oe=e=>{let t={kind:`workflow`,id:e};d(t),v(h?.definitions.find(e=>An(e.target,t))?.id??null),P(null),z(null),b(50),r.current?.scrollIntoView({behavior:`smooth`,block:`start`})},se=async()=>{let t=k.find(e=>e.key===j);if(!e||!U||!t||F)return;let n={id:`evaluation-${crypto.randomUUID()}`,createdAt:new Date().toISOString(),definitionId:U.id,modelRef:{providerId:t.providerId,modelId:t.modelId}};I(!0),P(null),z(null),H(null);try{P({request:n,prepared:await Z.profileEvaluationPrepare(e,n)})}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(!1)}},ce=async()=>{if(e&&N&&!L){R(!0),H(null);try{let t=await Z.profileEvaluationRun(e,{...N.request,expectedManifestHash:N.prepared.manifest.contentHash});P(null),p(t),z(`Run ${t.manifest.id} ${t.passed?`passed`:`did not pass`}.`),s(await Dn(e))}catch(e){H(e instanceof Error?e.message:String(e))}finally{R(!1)}}},le=async t=>{let n=k.find(e=>e.key===j);if(e&&n&&!ee){te(t),z(null),H(null);try{let r=await Z.profileEvaluationRunSuite(e,{id:`suite-${crypto.randomUUID()}`,createdAt:new Date().toISOString(),suiteId:t,modelRef:{providerId:n.providerId,modelId:n.modelId}});s(await Dn(e)),z(`Suite ${r.id} ${r.passed?`passed`:`did not pass`}.`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{te(null)}}},ue=e=>{w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},q=async()=>{if(!(!e||C.length<2||T)){E(!0),H(null);try{await Z.profileEvaluationCompare(e,C),s(await Dn(e)),w([])}catch(e){H(e instanceof Error?e.message:String(e))}finally{E(!1)}}},J=async(t,n)=>{if(e&&!D){O(n),H(null);try{let r=await Z.profileEvaluationSaveReport(e,t,n);s(await Dn(e)),z(`Report ${r.id} saved to Profile source. Commit and publish the Profile when ready.`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{O(null)}}};return(0,$.jsxs)($.Fragment,{children:[i?(0,$.jsx)(Tn,{catalog:i,evaluations:ie,onEvaluate:oe,onOpenRun:p,busy:K}):null,c?(0,$.jsx)(X,{error:c}):null,(0,$.jsxs)(`section`,{ref:r,"aria-label":`Profile evaluations`,className:`profile-evaluations`,children:[(0,$.jsxs)(`div`,{className:`profile-workflows-header`,children:[(0,$.jsx)(`h3`,{children:`Evaluations`}),(0,$.jsx)(`p`,{children:`Checks and retained results for this Profile’s released components.`})]}),B?(0,$.jsx)(`p`,{children:`Loading evaluations…`}):null,re?(0,$.jsx)(X,{error:re}):null,ne?(0,$.jsx)(`p`,{role:`status`,children:ne}):null,u?(0,$.jsxs)(`div`,{className:`profile-evaluation-scope`,children:[(0,$.jsx)(`strong`,{children:u.kind===`workflow`?`Workflow · ${u.id}`:u.kind===`skill`?`Skill · ${u.id}`:`Complete Profile`}),(0,$.jsx)(`button`,{type:`button`,disabled:K,onClick:()=>{d(null),v(null),P(null),z(null)},children:`Show all evaluations`})]}):null,h&&!W.length?(0,$.jsx)(`p`,{children:u?`No evaluation definitions target this component. Add a definition in the Profile’s evals catalog to run it. Retained runs are shown below.`:`No evaluations in this Profile yet.`}):null,h?.suites.length?(0,$.jsxs)(`div`,{className:`profile-evaluations-suites`,"aria-label":`Evaluation suites`,children:[(0,$.jsx)(`label`,{htmlFor:`profile-evaluation-suite-model`,children:`Suite model`}),(0,$.jsx)(`select`,{id:`profile-evaluation-suite-model`,value:j,disabled:K,onChange:e=>{M(e.target.value),P(null)},children:k.map(e=>(0,$.jsx)(`option`,{value:e.key,children:e.label},e.key))}),k.length===0?(0,$.jsx)(`p`,{children:`Connect a provider and load its models in Providers settings to run a suite.`}):null,h.suites.map(e=>(0,$.jsxs)(`div`,{className:`profile-evaluations-suite`,children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsxs)(`span`,{children:[e.scope===`profile`?`Profile suite`:`Component suite`,` · `,e.definitionIds.length,` checks`]}),(0,$.jsx)(`button`,{type:`button`,disabled:!j||K,onClick:()=>void le(e.id),children:ee===e.id?`Running suite…`:`Run suite`}),(G?.suiteRuns??[]).filter(t=>t.suiteId===e.id).slice(0,5).map(e=>(0,$.jsxs)(`details`,{className:`profile-evaluations-suite-run`,children:[(0,$.jsxs)(`summary`,{children:[Sn(e.completedAt),` · `,e.passed?`Passed`:`Did not pass`,` · `,e.members.length,` checks`]}),(0,$.jsxs)(`small`,{children:[`Profile source `,e.sourceRevision.slice(0,12),` · Suite run `,e.id]}),(0,$.jsx)(`button`,{type:`button`,disabled:!!D,onClick:()=>void J(`suite`,e.id),children:D===e.id?`Saving report…`:`Save report to Profile`}),(0,$.jsx)(`ul`,{children:e.members.map(t=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`strong`,{children:e.sourceRevision===h.sourceRevision?h.definitions.find(e=>e.id===t.definitionId)?.label??t.definitionId:t.definitionId}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{let e=G?.runs.find(e=>e.manifest.id===t.runManifest.id);e&&p(e)},disabled:!G?.runs.some(e=>e.manifest.id===t.runManifest.id),children:`View results`}),(0,$.jsxs)(`span`,{children:[t.passed?`Passed`:`Did not pass`,` · `,t.score===null?`No score`:`${Math.round(t.score*100)}%`,` · Run `,t.runManifest.id]})]},t.runManifest.id))})]},e.id))]},e.id))]}):null,W.length?(0,$.jsx)(`div`,{className:`profile-table-scroll`,children:(0,$.jsxs)(`table`,{className:`profile-evaluation-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Evaluation`}),(0,$.jsx)(`th`,{scope:`col`,children:`Target`}),(0,$.jsx)(`th`,{scope:`col`,children:`Tasks / seeds`}),(0,$.jsx)(`th`,{scope:`col`,children:`Latest result`}),(0,$.jsx)(`th`,{scope:`col`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:W.map(e=>{let t=G?.runs.find(t=>t.manifest.profileEvaluation?.definitionId===e.id);return(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`th`,{scope:`row`,children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsx)(`small`,{children:e.description})]}),(0,$.jsx)(`td`,{children:xn(e.target)}),(0,$.jsxs)(`td`,{children:[e.taskIds.length,` / `,e.seeds.length]}),(0,$.jsx)(`td`,{children:t?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>p(t),children:[t.passed?`Passed`:`Did not pass`,` · `,Cn(t.metric.value),(0,$.jsx)(`small`,{children:Sn(t.completedAt)})]}):`Not run`}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`button`,{type:`button`,disabled:K,"aria-expanded":_===e.id,onClick:()=>{v(t=>t===e.id?null:e.id),b(50),P(null),z(null)},children:_===e.id?`Hide details`:`View / Run Evaluation`})})]},e.id)})})]})}):null,U?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,children:[(0,$.jsx)(`h4`,{children:U.label}),(0,$.jsxs)(`p`,{children:[`Taskset `,U.tasksetRelease.id,` · `,U.tasksetRelease.contentHash.slice(0,12)]}),(0,$.jsxs)(`p`,{children:[`Frozen split: `,U.split,` · Minimum pass rate: `,Math.round(U.criterion.minimumPassRate*100),`% · `,U.criterion.requireComplete?`All attempts required`:`Incomplete runs allowed`]}),(0,$.jsx)(`p`,{children:`This evaluation runs the selected component against its Taskset’s frozen cases and graders.`}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Evaluation definition`}),(0,$.jsx)(`pre`,{children:JSON.stringify(U,null,2)})]}),(0,$.jsxs)(`div`,{className:`profile-evaluations-run-form`,children:[(0,$.jsx)(`label`,{htmlFor:`profile-evaluation-model`,children:`Model`}),(0,$.jsx)(`select`,{id:`profile-evaluation-model`,value:j,disabled:K,onChange:e=>{M(e.target.value),P(null)},children:k.map(e=>(0,$.jsx)(`option`,{value:e.key,children:e.label},e.key))}),k.length===0?(0,$.jsx)(`p`,{children:`Connect a provider and load its models in Providers settings to run this check.`}):null,(0,$.jsx)(`button`,{type:`button`,disabled:!j||K,onClick:()=>void se(),children:F?`Checking run…`:`Check run setup`}),N?(0,$.jsxs)(`div`,{className:`profile-evaluations-run-plan`,children:[(0,$.jsx)(`strong`,{children:`Run setup`}),(0,$.jsxs)(`small`,{children:[`Profile source `,N.prepared.manifest.profileEvaluation?.sourceRevision.slice(0,12),` · Harness `,N.prepared.manifest.execution.kind===`harness`?N.prepared.manifest.execution.harnessRelease.id:``]}),(0,$.jsxs)(`small`,{children:[`Taskset `,N.prepared.taskset.id,` · `,N.prepared.manifest.population.length,` attempts · `,N.prepared.manifest.limits.timeoutMs/1e3,`s per attempt`]}),(0,$.jsxs)(`small`,{children:[`Connected app scopes: `,N.prepared.taskset.connectedAppScopes.join(`, `)||`none declared`]}),(0,$.jsx)(`button`,{type:`button`,disabled:L,onClick:()=>void ce(),children:L?`Running evaluation…`:`Run evaluation`})]}):null]}),(0,$.jsxs)(`div`,{className:`profile-evaluations-cases`,children:[(0,$.jsx)(`strong`,{children:`Task cases`}),(0,$.jsx)(`ul`,{children:U.taskIds.slice(0,y).map(e=>(0,$.jsx)(`li`,{children:e},e))}),U.taskIds.length>y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>b(e=>e+50),children:`Show more cases`}):null,(0,$.jsxs)(`span`,{children:[`Seeds: `,U.seeds.join(`, `)]})]})]}):null,G?(0,$.jsx)(En,{runs:ae,definitions:h?.definitions??[],sourceRevision:h?.sourceRevision??``,onOpen:p,onSave:e=>void J(`run`,e),savingReportId:D},_??JSON.stringify(u)):null,G&&G.runs.length>1?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,"aria-label":`Compare evaluation runs`,children:[(0,$.jsx)(`h4`,{children:`Compare runs`}),(0,$.jsx)(`p`,{children:`Select two or more runs. Comparisons require the same Taskset, cases, environment, grading policy, limits, and runtime.`}),(0,$.jsx)(`div`,{className:`profile-evaluations-comparison-runs`,children:G.runs.slice(0,x).map(e=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:C.includes(e.manifest.id),onChange:()=>ue(e.manifest.id),disabled:T}),(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`strong`,{children:[e.manifest.profileEvaluation?.definitionId??`Profile evaluation`,` · `,e.metric.value===null?`No score`:`${Math.round(e.metric.value*100)}%`]}),(0,$.jsxs)(`small`,{children:[Sn(e.completedAt),` · `,e.manifest.policy.kind===`model`?`${e.manifest.policy.model.provider}/${e.manifest.policy.model.model}`:`fixture`,` · Source `,e.manifest.profileEvaluation?.sourceRevision.slice(0,10),` · `,e.manifest.id]})]})]},e.manifest.id))}),G.runs.length>x?(0,$.jsx)(`button`,{type:`button`,onClick:()=>S(e=>e+20),children:`Show more runs`}):null,(0,$.jsx)(`button`,{type:`button`,disabled:C.length<2||T,onClick:()=>void q(),children:T?`Comparing…`:`Save comparison of ${C.length} runs`})]}):null,G&&G.comparisons.length>0?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,"aria-label":`Saved evaluation comparisons`,children:[(0,$.jsx)(`h4`,{children:`Saved comparisons`}),(0,$.jsx)(`ul`,{children:G.comparisons.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`strong`,{children:[Sn(e.createdAt),` · `,e.members.length,` runs`]}),(0,$.jsx)(`button`,{type:`button`,disabled:!!D,onClick:()=>void J(`comparison`,e.id),children:D===e.id?`Saving report…`:`Save report to Profile`}),(0,$.jsx)(`ul`,{children:e.members.map(e=>(0,$.jsxs)(`li`,{children:[e.source.definitionId,` · `,e.policy.kind===`model`?`${e.policy.model.provider}/${e.policy.model.model}`:`fixture`,` · Source `,e.source.sourceRevision.slice(0,10),` · `,e.score===null?`No score`:`${Math.round(e.score*100)}%`]},e.runManifest.id))}),(0,$.jsx)(bn,{comparison:e})]},e.id))})]}):null,G?.reports.length?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,"aria-label":`Profile evaluation reports`,children:[(0,$.jsx)(`h4`,{children:`Reports saved in Profile source`}),(0,$.jsx)(`ul`,{children:G.reports.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`strong`,{children:[Sn(e.createdAt),` · `,e.summary.passedChecks,`/`,e.summary.totalChecks,` checks passed`]}),(0,$.jsxs)(`small`,{children:[`Tested source `,e.testedSources.map(e=>e.sourceRevision.slice(0,10)).join(`, `),` · Evidence `,e.evidence.map(e=>e.id).join(`, `)]})]},e.id))})]}):null]}),e&&f?(0,$.jsx)(kn,{connection:e,run:f,onClose:()=>p(null)},f.manifest.id):null]})}function Nn({actions:e,busy:t,library:n,onSelect:r}){let i=n.profiles.find(e=>He(e.ref,n.lastUsed))??n.profiles[0]??null,a=i?Ke(i.ref):``;return(0,$.jsxs)(`div`,{className:`profile-selector-bar`,children:[(0,$.jsxs)(`label`,{className:`profile-selector-control`,children:[(0,$.jsx)(`select`,{"aria-label":`Active profile`,disabled:t||n.profiles.length===0,value:a,onChange:e=>{let t=Ie(n,e.currentTarget.value),i=n.profiles.find(e=>He(e.ref,t));i&&r(i)},children:n.profiles.length?n.profiles.map(e=>(0,$.jsx)(`option`,{value:Ke(e.ref),children:e.name},Ke(e.ref))):(0,$.jsx)(`option`,{value:``,children:`No profiles`})}),(0,$.jsx)(B,{"aria-hidden":`true`,size:14})]}),e]})}function Pn({addDisabled:e,commitDisabled:t,commitLabel:n,refreshDisabled:r,repoDisabled:i,syncDisabled:a,syncLabel:o,syncStatus:s,onAdd:c,onCommit:l,onRefresh:u,onRepo:d,onSync:f}){let[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!p)return;function e(e){h.current?.contains(e.target)||m(!1)}function t(e){e.key===`Escape`&&m(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[p]);function g(e){m(!1),e()}return(0,$.jsx)(`div`,{className:`profile-selector-actions`,children:(0,$.jsxs)(`div`,{className:`profile-settings-menu-root`,ref:h,children:[(0,$.jsx)(`button`,{"aria-expanded":p,"aria-haspopup":`menu`,"aria-label":`Profile settings`,className:`settings-icon-button ghost profile-settings-menu-trigger`,type:`button`,onClick:()=>m(e=>!e),children:(0,$.jsx)(Ee,{size:15})}),p?(0,$.jsxs)(`div`,{className:`profile-settings-menu`,role:`menu`,children:[(0,$.jsxs)(`button`,{disabled:t,role:`menuitem`,type:`button`,onClick:()=>g(l),children:[(0,$.jsx)(ie,{size:14}),(0,$.jsx)(`span`,{children:n})]}),(0,$.jsxs)(`button`,{disabled:a,role:`menuitem`,type:`button`,onClick:()=>g(f),children:[(0,$.jsx)(H,{size:14}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:o}),s?(0,$.jsx)(`small`,{children:s}):null]})]}),(0,$.jsxs)(`button`,{disabled:i,role:`menuitem`,type:`button`,onClick:()=>g(d),children:[(0,$.jsx)(Ne,{size:14}),(0,$.jsx)(`span`,{children:`Repository`})]}),(0,$.jsx)(`div`,{className:`profile-settings-menu-separator`,role:`separator`}),(0,$.jsxs)(`button`,{disabled:r,role:`menuitem`,type:`button`,onClick:()=>g(u),children:[(0,$.jsx)(J,{size:14}),(0,$.jsx)(`span`,{children:`Refresh profiles`})]}),(0,$.jsxs)(`button`,{disabled:e,role:`menuitem`,type:`button`,onClick:()=>g(c),children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:`Add profile`})]})]}):null]})})}var Fn=[{id:`actions`,label:`Actions`,detail:`Profile-level reusable actions`},{id:`workflows`,label:`Workflows`,detail:`Workflow definitions and actions`},{id:`instructions`,label:`Instructions`,detail:`Profile instructions used by evaluations`},{id:`prompts`,label:`Prompts`,detail:`Shared prompt files`},{id:`goals`,label:`Goals`,detail:`Goal definitions; never started automatically`},{id:`evals`,label:`Evals`,detail:`Evaluation definitions and fixtures`},{id:`examples`,label:`Examples`,detail:`Example inputs and usage`},{id:`tasksets`,label:`Tasksets`,detail:`Training and evaluation tasksets`},{id:`extensions`,label:`Extension declarations`,detail:`Third-party extension metadata`}];function In({connection:e,entry:t,onClose:n,onPublished:r}){let[i,a]=(0,Q.useState)(`github`),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(`${t.name}-profile`),[u,d]=(0,Q.useState)(`public`),[f,p]=(0,Q.useState)(()=>t.state.agents.filter(e=>e.enabled).map(e=>e.id)),[m,h]=(0,Q.useState)(()=>t.state.skills.filter(e=>e.enabled).map(e=>e.name)),[g,_]=(0,Q.useState)([]),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),w=(0,Q.useMemo)(()=>({ref:t.ref,selection:{agentIds:f,skillNames:m,optionalContent:g},target:{provider:i,owner:o.trim()||null,repository:c.trim(),visibility:i===`github`?`public`:u}}),[f,t.ref,g,o,i,c,m,u]);function T(e,t,n){return n?[...new Set([...e,t])]:e.filter(e=>e!==t)}async function E(t){if(t.preventDefault(),c.trim()&&!b){x(`preview`),C(null);try{y(await Z.profilePublicationPreview(e,w))}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(null)}}}async function D(){if(!(!v||v.blockedReasons.length>0||b)){x(`publish`),C(null);try{let i=await Z.profilePublicationPublish(e,{...w,expectedSourceHash:v.sourceHash,confirmed:!0});r(`Published ${t.name} to ${i.owner}/${i.repository}`),n()}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(null)}}}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:n,children:(0,$.jsxs)(`form`,{className:`git-dialog profile-publication-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`profile-publication-title`,onMouseDown:e=>e.stopPropagation(),onSubmit:E,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:!!b,type:`button`,"aria-label":`Close`,onClick:n,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(H,{size:18})}),(0,$.jsxs)(`h2`,{id:`profile-publication-title`,children:[`Publish `,t.name]}),(0,$.jsx)(`p`,{children:`Choose the exact Agents, Skills, workflows, and optional files to share. OpenPond will show the complete file list before it pushes anything.`}),v?(0,$.jsx)(zn,{preview:v}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`fieldset`,{className:`profile-publication-fieldset`,children:[(0,$.jsx)(`legend`,{children:`Destination`}),(0,$.jsxs)(`label`,{className:`profile-publication-provider`,children:[(0,$.jsx)(`input`,{type:`radio`,checked:i===`github`,onChange:()=>{a(`github`),d(`public`)}}),(0,$.jsx)(Ue,{size:16}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`GitHub`}),(0,$.jsx)(`small`,{children:`Published publicly with your signed-in gh CLI`})]})]}),(0,$.jsxs)(`label`,{className:`profile-publication-provider`,children:[(0,$.jsx)(`input`,{type:`radio`,checked:i===`openpond_git`,onChange:()=>{a(`openpond_git`),d(`private`)}}),(0,$.jsx)(je,{size:16}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`OpenPond Git`}),(0,$.jsx)(`small`,{children:`Private by default; uses the same repository format`})]})]})]}),(0,$.jsxs)(`div`,{className:`profile-publication-target-fields`,children:[i===`github`?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`GitHub owner (optional)`}),(0,$.jsx)(`input`,{value:o,placeholder:`Uses gh account`,onChange:e=>s(e.currentTarget.value)})]}):null,(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Repository`}),(0,$.jsx)(`input`,{value:c,onChange:e=>l(e.currentTarget.value)})]}),i===`openpond_git`?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Visibility`}),(0,$.jsxs)(`select`,{value:u,onChange:e=>d(e.currentTarget.value),children:[(0,$.jsx)(`option`,{value:`private`,children:`Private`}),(0,$.jsx)(`option`,{value:`public`,children:`Public`})]})]}):null]}),(0,$.jsx)(Ln,{title:`Agents`,empty:`No Agents in this Profile`,children:t.state.agents.map(e=>(0,$.jsx)(Rn,{checked:f.includes(e.id),label:e.name,detail:e.path,onChange:t=>p(n=>T(n,e.id,t))},e.id))}),(0,$.jsx)(Ln,{title:`Skills`,empty:`No Skills in this Profile`,children:t.state.skills.map(e=>(0,$.jsx)(Rn,{checked:m.includes(e.name),label:e.name,detail:e.description||e.path,onChange:t=>h(n=>T(n,e.name,t))},e.name))}),(0,$.jsx)(Ln,{title:`Optional content`,empty:``,children:Fn.map(e=>(0,$.jsx)(Rn,{checked:g.includes(e.id),label:e.label,detail:e.detail,onChange:t=>_(n=>T(n,e.id,t))},e.id))})]}),S?(0,$.jsx)(X,{error:S}):null,(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:!!b,type:`button`,onClick:v?()=>y(null):n,children:v?`Back`:`Cancel`}),v?(0,$.jsxs)(`button`,{className:`git-dialog-primary`,disabled:!!b||v.blockedReasons.length>0,type:`button`,onClick:()=>void D(),children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:b===`publish`?`Publishing`:v.replacesExisting?`Confirm and replace`:`Confirm and publish`})]}):(0,$.jsx)(`button`,{className:`git-dialog-primary`,disabled:!!b||!c.trim(),type:`submit`,children:b===`preview`?`Building preview`:`Review exact files`})]})]})})}function Ln({title:e,empty:t,children:n}){let r=Array.isArray(n)?n.length:+!!n;return(0,$.jsxs)(`fieldset`,{className:`profile-publication-fieldset`,children:[(0,$.jsx)(`legend`,{children:e}),r?n:(0,$.jsx)(`span`,{className:`profile-publication-empty`,children:t})]})}function Rn({checked:e,label:t,detail:n,onChange:r}){return(0,$.jsxs)(`label`,{className:`profile-publication-selection`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>r(e.currentTarget.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:t}),(0,$.jsx)(`small`,{children:n})]})]})}function zn({preview:e}){let t=e.files.reduce((e,t)=>e+t.sizeBytes,0);return(0,$.jsxs)(`div`,{className:`profile-publication-preview`,children:[(0,$.jsxs)(`div`,{className:`profile-dialog-summary`,children:[(0,$.jsxs)(`strong`,{children:[e.files.length,` files · `,Bn(t)]}),(0,$.jsx)(`span`,{children:e.sourceRevision?.slice(0,10)??`No source revision`})]}),e.blockedReasons.map(e=>(0,$.jsx)(`div`,{className:`profile-dialog-warning`,children:e},e)),e.warnings.map(e=>(0,$.jsx)(`div`,{className:`profile-publication-warning`,children:e},e)),(0,$.jsx)(`div`,{className:`profile-publication-file-list`,"aria-label":`Exact files to publish`,children:e.files.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{title:e.path,children:e.path}),(0,$.jsxs)(`small`,{children:[e.category,` · `,Bn(e.sizeBytes)]})]},e.path))}),e.excludedFiles.length?(0,$.jsxs)(`details`,{children:[(0,$.jsxs)(`summary`,{children:[e.excludedFiles.length,` excluded sensitive/runtime files`]}),e.excludedFiles.map(e=>(0,$.jsx)(`code`,{children:e},e))]}):null]})}function Bn(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Vn({section:e=`all`,catalogPresentation:t=`list`,payload:n,connection:r,onPayload:i,onError:a,onToast:o,onSkillCommand:s,overviewContent:c}){let[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),x=n?.profile??null,S=n?.preferences.defaultTeamId?.trim()||``,C=e===`all`||e===`profile`||e===`controls`,w=e===`all`||e===`profile`,T=e===`all`||e===`agents`,E=e===`all`||e===`profile`;async function D(e){r&&(i(await Z.bootstrap(r)),o?.(e,`success`))}async function O(e,t){if(r&&!d){f(e),a(null);try{await t()}catch(e){a(e instanceof Error?e.message:String(e))}finally{f(null)}}}function k(){O(`init`,async()=>{await Z.profileInit(r,{}),await D(`Profile initialized`)})}function A(){O(`commit`,async()=>{await Z.profileCommit(r,{message:l.trim()||null}),u(``),await D(`Profile commit complete`)})}function j(){O(`push`,async()=>{if(!S)throw Error(`Select a default team before syncing a hosted profile.`);await Z.profileCheck(r,{kind:`all`}),await Z.profilePush(r,{teamId:S,ensureHosted:!0,message:null}),await D(`Profile synced to hosted profile repo`)})}function M(e){O(`select:${e.ref.profileId}`,async()=>{await Z.profileSelect(r,e.ref),await D(`Using ${e.name}`)})}function N(e){O(`add`,async()=>{e.source===`blank`?await Z.profileInit(r,{path:e.path,profile:e.profile,template:`blank-profile`}):e.source===`local`?await Z.profileLoad(r,e):await Z.profileInstall(r,e),m(!1),await D(e.source===`blank`?`${e.profile} created`:`Profile added`)})}function P(e){O(`update`,async()=>{await Z.profileUpdate(r,e.ref),await D(`${e.name} updated`)})}function F(e){O(`remove`,async()=>{await Z.profileRemove(r,e.ref),g(null),await D(`Profile removed from this device`)})}function I(){O(`refresh`,async()=>{await D(`Profiles refreshed`)})}return(0,$.jsxs)(`section`,{className:`account-settings profile-settings`,children:[x?.mode===`local`?(0,$.jsxs)($.Fragment,{children:[C?(0,$.jsxs)($.Fragment,{children:[w&&t===`select`?(0,$.jsx)(Nn,{actions:(0,$.jsx)(Gn,{connection:r,onAdd:()=>m(!0),onRefresh:I,presentation:`menu`,profile:x,profileBusy:d,profileCommitMessage:l,selectedDefaultTeamId:S,syncDisabledReason:er(x,S),setProfileCommitMessage:u,submitProfileCommit:A,submitProfilePush:j}),busy:!!d,library:n?.profileLibrary??{lastUsed:null,profiles:[]},onSelect:M}):(0,$.jsxs)($.Fragment,{children:[w?(0,$.jsx)(Hn,{busy:!!d,library:n?.profileLibrary??{lastUsed:null,profiles:[]},onAdd:()=>m(!0),onRefresh:I,onRemove:g,onPublish:v,onUpdate:P,onSelect:M}):null,(0,$.jsx)(Gn,{connection:r,profile:x,profileBusy:d,profileCommitMessage:l,selectedDefaultTeamId:S,syncDisabledReason:er(x,S),setProfileCommitMessage:u,submitProfileCommit:A,submitProfilePush:j})]}),c]}):null,T?(0,$.jsx)(on,{connection:r,profile:x,selectedDefaultTeamId:S}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Yn,{onSkillCommand:s,onEvaluate:e=>b({kind:`skill`,id:e}),profile:x}),(0,$.jsx)(Mn,{connection:r,focusTarget:y,selectedProfileKey:n?.profileLibrary?.lastUsed?JSON.stringify(n.profileLibrary.lastUsed):null},JSON.stringify(n?.profileLibrary?.lastUsed??null))]}):null]}):e===`agents`?(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Agents`}),(0,$.jsx)(`small`,{children:`Profile required`})]}),(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`No local Profile loaded`}),(0,$.jsx)(`span`,{children:`Open Profile to create or load a Profile before managing agents.`})]})]}):(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Summary`}),(0,$.jsx)(`small`,{children:`Not loaded`})]}),(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`No local Profile loaded`}),(0,$.jsx)(`span`,{children:`Create an empty Profile, start with an Agent template, or add an existing repository.`}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:!r||!!d,type:`button`,onClick:()=>m(!0),children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:`Create or add Profile`})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:!r||!!d,type:`button`,onClick:k,children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:d===`init`?`Creating`:`Create starter Profile`})]})]})]}),p?(0,$.jsx)(Un,{busy:!!d,onClose:()=>m(!1),onSubmit:N}):null,h?(0,$.jsx)(Wn,{busy:!!d,entry:h,onClose:()=>g(null),onConfirm:()=>F(h)}):null,_&&r?(0,$.jsx)(In,{connection:r,entry:_,onClose:()=>v(null),onPublished:e=>o?.(e,`success`)}):null]})}function Hn({busy:e,library:t,onAdd:n,onRefresh:r,onRemove:i,onPublish:a,onSelect:o,onUpdate:s}){return(0,$.jsxs)(`div`,{className:`account-list profile-catalog-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading profile-agent-list-heading`,children:[(0,$.jsx)(`span`,{children:`Profiles`}),(0,$.jsxs)(`div`,{className:`profile-skill-heading-actions`,children:[(0,$.jsxs)(`small`,{children:[t.profiles.length,` installed`]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:e,type:`button`,onClick:r,children:[(0,$.jsx)(J,{size:14}),(0,$.jsx)(`span`,{children:`Refresh`})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:e,type:`button`,onClick:n,children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:`Add`})]})]})]}),t.profiles.map(n=>{let r=He(n.ref,t.lastUsed);return(0,$.jsxs)(`div`,{className:`product-row profile-catalog-row ${r?`selected`:``}`,role:`button`,tabIndex:e?-1:0,"aria-disabled":e,onClick:()=>{e||o(n)},onKeyDown:t=>{e||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),o(n))},children:[(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(Ne,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:n.name}),(0,$.jsx)(`span`,{title:n.repoPath,children:n.repoPath})]})]}),(0,$.jsx)(Zn,{status:{state:n.state.error?`warning`:`ready`,label:n.state.error?`error`:r?`current`:`ready`}}),(0,$.jsx)(`span`,{className:`profile-catalog-source`,children:n.ref.source.replace(`_`,` `)}),(0,$.jsx)(`span`,{className:`profile-catalog-summary`,children:n.state.summary.message}),(0,$.jsxs)(`span`,{className:`profile-catalog-actions`,children:[n.ref.source===`local`?null:(0,$.jsxs)(`span`,{className:`settings-secondary compact`,role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),s(n)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),s(n))},children:[(0,$.jsx)(J,{size:14}),(0,$.jsx)(`span`,{children:`Update`})]}),(0,$.jsxs)(`span`,{className:`settings-secondary compact`,role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),a(n)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),a(n))},children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:`Publish`})]}),(0,$.jsxs)(`span`,{className:`settings-secondary compact profile-remove-button`,role:`button`,tabIndex:0,"aria-label":`Remove ${n.name}`,onClick:e=>{e.stopPropagation(),i(n)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),i(n))},children:[(0,$.jsx)(M,{size:14}),(0,$.jsx)(`span`,{children:`Remove`})]})]})]},`${n.ref.source}:${n.ref.repositoryId}:${n.ref.profileId}`)})]})}function Un({busy:e,onClose:t,onSubmit:n}){let[r,i]=(0,Q.useState)(`blank`),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``);function d(t){if(t.preventDefault(),e)return;if(r===`blank`){let e=l.trim();if(!e)return;n({source:r,path:a.trim()||null,profile:e});return}if(r===`local`){let e=a.trim();if(!e)return;n({source:r,path:e,profile:l.trim()||null});return}let i=s.trim();i&&n({source:r,repositoryId:i,profile:l.trim()||null})}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:t,children:(0,$.jsxs)(`form`,{className:`git-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`add-profile-title`,onMouseDown:e=>e.stopPropagation(),onSubmit:d,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:e,type:`button`,"aria-label":`Close`,onClick:t,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(Ne,{size:18})}),(0,$.jsx)(`h2`,{id:`add-profile-title`,children:`Add Profile`}),(0,$.jsx)(`p`,{children:`Create a blank Profile, add a local repository, or install a shareable Profile from Git.`}),(0,$.jsxs)(`div`,{className:`profile-add-source-options`,children:[(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,checked:r===`blank`,onChange:()=>i(`blank`)}),`New blank`]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,checked:r===`local`,onChange:()=>i(`local`)}),`Local`]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,checked:r===`github`,onChange:()=>i(`github`)}),`GitHub`]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,checked:r===`openpond_git`,onChange:()=>i(`openpond_git`)}),`OpenPond Git`]})]}),r===`blank`?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Repository path (optional)`}),(0,$.jsx)(`input`,{disabled:e,value:a,placeholder:`Uses the default local Profile repository`,onChange:e=>o(e.currentTarget.value)})]}):r===`local`?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Repository path`}),(0,$.jsx)(`input`,{autoFocus:!0,disabled:e,value:a,placeholder:`/path/to/profile-repo`,onChange:e=>o(e.currentTarget.value)})]}):(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsxs)(`span`,{children:[r===`github`?`GitHub`:`OpenPond Git`,` repository`]}),(0,$.jsx)(`input`,{autoFocus:!0,disabled:e,value:s,placeholder:`owner/repository`,onChange:e=>c(e.currentTarget.value)})]}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:r===`blank`?`Profile name`:`Profile name (optional)`}),(0,$.jsx)(`input`,{autoFocus:r===`blank`,disabled:e,value:l,placeholder:r===`blank`?`research`:`Uses repository default`,onChange:e=>u(e.currentTarget.value)})]}),(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:e,type:`button`,onClick:t,children:`Cancel`}),(0,$.jsx)(`button`,{className:`git-dialog-primary`,disabled:e||!(r===`blank`?l:r===`local`?a:s).trim(),type:`submit`,children:r===`blank`?`Create Profile`:`Add Profile`})]})]})})}function Wn({busy:e,entry:t,onClose:n,onConfirm:r}){return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:n,children:(0,$.jsxs)(`div`,{className:`git-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`remove-profile-title`,onMouseDown:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:e,type:`button`,"aria-label":`Close`,onClick:n,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(M,{size:18})}),(0,$.jsxs)(`h2`,{id:`remove-profile-title`,children:[`Remove `,t.name,`?`]}),(0,$.jsx)(`p`,{children:`This removes the Profile from OpenPond on this device. It does not delete the repository or any source files.`}),(0,$.jsxs)(`div`,{className:`profile-dialog-summary`,children:[(0,$.jsx)(`strong`,{children:t.name}),(0,$.jsx)(`span`,{children:t.repoPath})]}),(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:e,type:`button`,onClick:n,children:`Cancel`}),(0,$.jsx)(`button`,{className:`git-dialog-primary danger`,disabled:e,type:`button`,onClick:r,children:`Remove`})]})]})})}function Gn({connection:e,onAdd:t,onRefresh:n,presentation:r=`toolbar`,profile:i,profileBusy:a,profileCommitMessage:o,selectedDefaultTeamId:s,syncDisabledReason:c,setProfileCommitMessage:l,submitProfileCommit:u,submitProfilePush:d}){let[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=!e||!!a;return(0,$.jsxs)($.Fragment,{children:[r===`menu`&&t&&n?(0,$.jsx)(Pn,{addDisabled:!!a,commitDisabled:v,commitLabel:a===`commit`?`Committing`:`Commit`,refreshDisabled:v,repoDisabled:!!a||!i,syncDisabled:v||!i,syncLabel:a===`push`?`Syncing`:`Sync`,syncStatus:i?$n(i,s):null,onAdd:t,onCommit:()=>h(!0),onRefresh:n,onRepo:()=>p(!0),onSync:()=>_(!0)}):(0,$.jsx)(`div`,{className:`profile-control-panel`,children:(0,$.jsxs)(`div`,{className:`profile-control-toolbar`,children:[(0,$.jsxs)(`div`,{className:`profile-control-actions`,children:[(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:v,type:`button`,onClick:()=>h(!0),children:[(0,$.jsx)(ie,{size:14}),(0,$.jsx)(`span`,{children:a===`commit`?`Committing`:`Commit`})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:v||!i,type:`button`,onClick:()=>_(!0),children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:a===`push`?`Syncing`:`Sync`})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:!!a||!i,type:`button`,onClick:()=>p(!0),children:[(0,$.jsx)(Ne,{size:14}),(0,$.jsx)(`span`,{children:`Repo`})]}),i?(0,$.jsxs)(`span`,{className:`profile-hosted-status`,title:`Profile sync status: ${$n(i,s)}`,children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:`Profile sync`}),(0,$.jsx)(`strong`,{children:$n(i,s)})]}):null]}),i?(0,$.jsx)(`span`,{className:`profile-local-status ${i.summary.state}`,title:i.summary.message,children:i.summary.message}):null]})}),f&&i?(0,$.jsx)(Jn,{profile:i,profileBusy:a,onClose:()=>p(!1)}):null,m?(0,$.jsx)(Kn,{disabled:v,profileBusy:a,profileCommitMessage:o,setProfileCommitMessage:l,submitProfileCommit:u,onClose:()=>h(!1)}):null,g&&i?(0,$.jsx)(qn,{disabled:v,profile:i,profileBusy:a,selectedDefaultTeamId:s,syncDisabledReason:c,submitProfilePush:d,onClose:()=>_(!1)}):null]})}function Kn({disabled:e,profileBusy:t,profileCommitMessage:n,setProfileCommitMessage:r,submitProfileCommit:i,onClose:a}){function o(t){t.preventDefault(),!e&&(i(),a())}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:a,children:(0,$.jsxs)(`form`,{className:`git-dialog profile-commit-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`profile-commit-dialog-title`,onMouseDown:e=>e.stopPropagation(),onSubmit:o,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:!!t,type:`button`,title:`Close`,"aria-label":`Close`,onClick:a,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(ie,{size:18})}),(0,$.jsx)(`h2`,{id:`profile-commit-dialog-title`,children:`Commit profile`}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Commit message`}),(0,$.jsx)(`input`,{autoFocus:!0,value:n,disabled:!!t,placeholder:`Update OpenPond profile`,onChange:e=>r(e.target.value)})]}),(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:!!t,type:`button`,onClick:a,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`git-dialog-primary`,disabled:e,type:`submit`,children:[(0,$.jsx)(ie,{size:14}),(0,$.jsx)(`span`,{children:t===`commit`?`Committing`:`Commit`})]})]})]})})}function qn({disabled:e,profile:t,profileBusy:n,selectedDefaultTeamId:r,syncDisabledReason:i,submitProfilePush:a,onClose:o}){let s=tr(t,r),c=s.reduce((e,t)=>e+t.count,0),l=!e&&!i;function u(e){e.preventDefault(),l&&(a(),o())}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:o,children:(0,$.jsxs)(`form`,{className:`git-dialog profile-sync-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`profile-sync-dialog-title`,onMouseDown:e=>e.stopPropagation(),onSubmit:u,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:!!n,type:`button`,title:`Close`,"aria-label":`Close`,onClick:o,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(H,{size:18})}),(0,$.jsx)(`h2`,{id:`profile-sync-dialog-title`,children:`Sync profile`}),(0,$.jsx)(`p`,{className:`profile-sync-explainer`,children:`Sync publishes this committed Profile source for your team, so its Agents can be shared in team chat and attached to hosted sandboxes.`}),(0,$.jsxs)(`div`,{className:`profile-dialog-summary`,children:[(0,$.jsxs)(`strong`,{children:[c,` `,c===1?`item`:`items`,` out of sync`]}),(0,$.jsxs)(`span`,{children:[`Local `,Qn(t.summary.localHead??t.git?.head),` - Last pushed`,` `,Qn(t.hosted?.lastPushedLocalHead)]})]}),s.length?(0,$.jsx)(`div`,{className:`profile-dialog-diff-list`,"aria-label":`Profile sync differences`,children:s.map(e=>(0,$.jsxs)(`div`,{className:`profile-dialog-diff-row ${e.tone??``}`,children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsx)(`span`,{children:e.detail})]},e.label))}):(0,$.jsx)(`div`,{className:`profile-dialog-diff-list`,"aria-label":`Profile sync differences`,children:(0,$.jsxs)(`div`,{className:`profile-dialog-diff-row`,children:[(0,$.jsx)(`strong`,{children:`Aligned`}),(0,$.jsx)(`span`,{children:`Current local profile source has already been pushed.`})]})}),i?(0,$.jsx)(`div`,{className:`profile-dialog-warning`,children:i}):null,(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:!!n,type:`button`,onClick:o,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`git-dialog-primary`,disabled:!l,type:`submit`,children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:n===`push`?`Syncing`:`Confirm sync`})]})]})]})})}function Jn({profile:e,profileBusy:t,onClose:n}){return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:n,children:(0,$.jsxs)(`div`,{className:`git-dialog profile-path-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`profile-path-dialog-title`,onMouseDown:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:!!t,type:`button`,title:`Close`,"aria-label":`Close`,onClick:n,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(Ne,{size:18})}),(0,$.jsx)(`h2`,{id:`profile-path-dialog-title`,children:`Profile repo`}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Profile repo path`}),(0,$.jsx)(`input`,{"aria-label":`Profile repo path`,readOnly:!0,value:e.repoPath??``})]}),(0,$.jsxs)(`div`,{className:`profile-dialog-summary`,children:[(0,$.jsx)(`strong`,{children:e.git?.isRepo?`Git-backed`:`Git setup required`}),(0,$.jsxs)(`span`,{children:[e.git?.branch??`No branch`,` · `,Qn(e.git?.head)]})]}),(0,$.jsx)(`div`,{className:`git-dialog-footer`,children:(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:!!t,type:`button`,onClick:n,children:`Close`})})]})})}function Yn({onSkillCommand:e,onEvaluate:t,profile:n}){let r=n.skills.slice().sort((e,t)=>e.name.localeCompare(t.name)),i=!e;function a(t){e?.(t)}return(0,$.jsxs)(`div`,{className:`account-list profile-skill-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading profile-agent-list-heading`,children:[(0,$.jsx)(`span`,{children:`Skills`}),(0,$.jsx)(`div`,{className:`profile-skill-heading-actions`,children:(0,$.jsxs)(`small`,{children:[n.skillCatalog.skillCount,` tracked`]})})]}),r.length?(0,$.jsx)(`div`,{className:`profile-table-frame`,children:(0,$.jsxs)(`table`,{className:`profile-data-table profile-skill-table`,"aria-label":`Profile skills table`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`profile-skill-name-column`}),(0,$.jsx)(`col`,{className:`profile-skill-trigger-column`}),(0,$.jsx)(`col`,{className:`profile-skill-status-column`}),(0,$.jsx)(`col`,{className:`profile-skill-source-column`}),(0,$.jsx)(`col`,{className:`profile-skill-actions-column`})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Skill`}),(0,$.jsx)(`th`,{scope:`col`,children:`Trigger`}),(0,$.jsx)(`th`,{scope:`col`,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,children:`Source`}),(0,$.jsx)(`th`,{scope:`col`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:r.map(e=>(0,$.jsx)(Xn,{commandDisabled:i,onSkillCommand:a,onEvaluate:t,skill:e},e.name))})]})}):(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`No profile skills found`}),(0,$.jsx)(`span`,{children:`Use /skill create to add reusable profile instructions.`})]})]})}function Xn({commandDisabled:e,onSkillCommand:t,onEvaluate:n,skill:r}){let i=r.validationStatus===`valid`?{state:`ready`,label:`valid`}:{state:`warning`,label:r.validationStatus};return(0,$.jsxs)(`tr`,{className:`profile-skill-row`,children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(qe,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:r.name}),(0,$.jsx)(`span`,{title:r.path,children:r.path})]})]})}),(0,$.jsx)(`td`,{className:`profile-skill-description`,title:r.description,children:r.description||`No description`}),(0,$.jsx)(`td`,{children:(0,$.jsx)(Zn,{status:i})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`div`,{className:`profile-agent-action`,children:(0,$.jsx)(`span`,{className:`profile-skill-source`,title:r.sourcePath,children:r.sourcePath})})}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-skill-actions`,children:[n?(0,$.jsx)(`button`,{className:`settings-secondary compact`,type:`button`,onClick:()=>n(r.path),children:`Evaluate`}):null,(0,$.jsx)(`button`,{className:`settings-secondary compact`,disabled:e||!r.enabled,type:`button`,title:`Use ${r.name}`,onClick:()=>t(`$${r.name} `),children:(0,$.jsx)(`span`,{children:`Use`})}),(0,$.jsx)(`button`,{className:`settings-secondary compact`,disabled:e,type:`button`,title:`Edit ${r.name}`,onClick:()=>t(`/skill edit ${r.name} `),children:(0,$.jsx)(`span`,{children:`Edit`})})]})})]})}function Zn({status:e}){return(0,$.jsx)(`span`,{className:`profile-status-text ${e.state}`,children:e.label})}function Qn(e){return e?e.slice(0,10):`None`}function $n(e,t){return rr(e,t)?`Sync this account`:e.hosted?.sourceCommitSha?`${e.hosted.promotionStatus??`uploaded`} ${Qn(e.hosted.sourceCommitSha)}`:`Not pushed`}function er(e,t){return t?e.git?.head?e.git.dirty?`Commit local profile changes before syncing.`:null:`Commit the profile before syncing.`:`Select a default team before syncing.`}function tr(e,t){let n=[],r=e.summary.localHead??e.git?.head??null,i=e.hosted?.lastPushedLocalHead??null,a=e.summary.hostedHead??e.hosted?.sourceCommitSha??null;if(rr(e,t)&&n.push({label:`Account`,detail:`Hosted profile metadata was synced under a different default team.`,count:1,tone:`warning`}),!a&&!i?n.push({label:`Hosted source`,detail:`No hosted profile commit has been recorded.`,count:1}):r&&i&&r!==i&&n.push({label:`Commit`,detail:`Local ${Qn(r)} has not been pushed since ${Qn(i)}.`,count:1}),e.git?.dirty){let t=(e.git.fileCount??e.git.files.length)||(e.diff.fileCount??e.diff.files.length)||1;n.push({label:`Uncommitted files`,detail:`${t} local ${t===1?`file`:`files`} changed.`,count:t,tone:`warning`})}let o=e.diff.changedAgents.length+e.diff.newAgents.length+e.diff.deletedAgents.length+e.diff.changedSkills.length+e.diff.changedActions.length+e.diff.changedExtensions.length+e.diff.setupChanges.length+e.diff.envRequirementChanges.length;return o>0&&n.push({label:`Profile changes`,detail:nr(e),count:o,tone:e.git?.dirty?`warning`:void 0}),e.catalog.stale&&n.push({label:`Catalog`,detail:`Action catalog artifacts are stale or missing.`,count:1,tone:`warning`}),e.setupGate.blockingCount>0&&n.push({label:`Setup`,detail:`${e.setupGate.blockingCount} blocking setup ${e.setupGate.blockingCount===1?`requirement`:`requirements`}.`,count:e.setupGate.blockingCount,tone:`warning`}),n}function nr(e){let t=[],n=e.diff.changedAgents.length+e.diff.newAgents.length+e.diff.deletedAgents.length;return n&&t.push(`${n} agent ${n===1?`change`:`changes`}`),e.diff.changedActions.length&&t.push(`${e.diff.changedActions.length} action ${e.diff.changedActions.length===1?`change`:`changes`}`),e.diff.changedSkills.length&&t.push(`${e.diff.changedSkills.length} skill ${e.diff.changedSkills.length===1?`change`:`changes`}`),e.diff.changedExtensions.length&&t.push(`${e.diff.changedExtensions.length} extension ${e.diff.changedExtensions.length===1?`change`:`changes`}`),e.diff.setupChanges.length&&t.push(`${e.diff.setupChanges.length} setup ${e.diff.setupChanges.length===1?`change`:`changes`}`),e.diff.envRequirementChanges.length&&t.push(`${e.diff.envRequirementChanges.length} env ${e.diff.envRequirementChanges.length===1?`change`:`changes`}`),t.join(`, `)||`Profile source has local changes.`}function rr(e,t){let n=e.hosted?.teamId?.trim()??``;return!!(n&&t&&n!==t)}function ir({status:e,busy:t,flashTailscaleUp:n,refresh:r,enableRemoteAccess:i,disableRemoteAccess:a,copyRemoteLink:o,copyTailscaleUpCommand:s,copyServeCommand:c,copyServeSetupUrl:l,copyOperatorCommand:u,createRemoteLink:d}){let f=e?.tailscale.installed??!1,p=e?.serve.enabled??!1,m=e?.serve.reachable??!1,h=!!(e?.webUiAvailable&&f),g=p?!!e?.remoteWebUrl:h,_=(e?.tailscale.peers??[]).filter(e=>!e.isSelf),v=!!e?.tailscale.error?.includes(`set --operator`),y=!!(p&&e?.remoteWebUrl);return(0,$.jsxs)(`section`,{className:`account-settings remote-access-settings`,children:[(0,$.jsx)(`h1`,{children:`Remote access`}),(0,$.jsxs)(`div`,{className:`account-summary remote-access-summary`,children:[(0,$.jsxs)(`div`,{className:`account-summary-main`,children:[(0,$.jsx)(`div`,{className:`remote-access-icon ${m?`online`:p?`configured`:``}`,children:f?(0,$.jsx)(ot,{size:18}):(0,$.jsx)(ne,{size:18})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:m?`Tailscale Serve is reachable`:p?`Tailscale Serve is configured`:`Tailscale Serve is off`}),(0,$.jsx)(`small`,{children:e?lr(e):`Checking Tailscale`})]})]}),(0,$.jsxs)(`div`,{className:`account-summary-actions`,children:[(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Refresh remote access`,"aria-label":`Refresh remote access`,disabled:t!==null,onClick:()=>void r(),children:(0,$.jsx)(J,{className:t===`refresh`?`settings-spin`:``,size:15})}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:t!==null||!f||!p&&!h,onClick:()=>void(p?a():i()),children:[(0,$.jsx)(be,{size:15}),(0,$.jsx)(`span`,{children:p?t===`disable`?`Turning off`:`Turn off`:t===`enable`?`Turning on`:`Turn on`})]})]})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsx)(`div`,{className:`account-list-heading remote-access-link-heading`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`OpenPond link`}),(0,$.jsx)(`small`,{children:y?`Browser UI`:`Tailscale + Serve`})]})}),y&&(0,$.jsx)(ar,{label:`Remote URL`,value:e?.remoteWebUrl??null,actionLabel:t===`copy-link`?`Copying`:`Copy`,disabled:!e?.remoteWebUrl||t!==null,onAction:o}),(0,$.jsx)(ar,{label:`Tailscale up`,value:e?.tailscaleUpCommand??null,flash:n,actionLabel:t===`copy-up-command`?`Copying`:`Copy`,disabled:!e?.tailscaleUpCommand||t!==null,onAction:s}),(0,$.jsx)(ar,{label:`Serve command`,value:e?.serveCommand??null,actionLabel:t===`copy-command`?`Copying`:`Copy`,disabled:!e?.serveCommand||t!==null,onAction:c}),e?.serve.setupUrl&&(0,$.jsx)(ar,{label:`Enable Serve`,value:e.serve.setupUrl,actionLabel:t===`copy-serve-setup`?`Copying`:`Copy`,disabled:t!==null,onAction:l}),v&&(0,$.jsx)(ar,{label:`One-time setup`,value:e?.operatorCommand??null,actionLabel:t===`copy-operator`?`Copying`:`Copy`,disabled:!e?.operatorCommand||t!==null,onAction:u}),(0,$.jsx)(ar,{label:`Local target`,value:e?.localUrl??null}),e?.tailscale.authUrl&&(0,$.jsx)(ar,{label:`Tailscale login`,value:e.tailscale.authUrl}),(0,$.jsx)(ar,{label:`Disable command`,value:e?.disableCommand??null})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading remote-access-link-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Authorized clients`}),(0,$.jsxs)(`small`,{children:[_.length,` devices`]})]}),(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:t!==null||!g,onClick:()=>void d(),children:(0,$.jsx)(`span`,{children:p?`Copy link`:`Create link`})})]}),e?_.length===0?(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`No clients reported`}),(0,$.jsx)(`span`,{children:e?.tailscale.running?`Tailscale did not return peer devices.`:`Tailscale is not running.`})]}):_.map(e=>(0,$.jsx)(cr,{peer:e},e.id)):(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`Checking clients`}),(0,$.jsx)(`span`,{children:`Loading tailnet devices.`})]})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Remote environment`}),(0,$.jsx)(`small`,{children:e?.tailscale.tailnetName??`Tailnet`})]}),(0,$.jsx)(or,{status:e})]}),e?.serve.configText&&(0,$.jsxs)(`div`,{className:`remote-access-config`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Tailscale config`}),(0,$.jsx)(`small`,{children:e.serve.enabled?`OpenPond target found`:`No OpenPond target`})]}),(0,$.jsx)(`pre`,{children:e.serve.configText})]})]})}function ar({actionLabel:e,disabled:t,flash:n,label:r,onAction:i,value:a}){return(0,$.jsxs)(`div`,{className:`product-row remote-access-value-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{className:n?`flash`:void 0,children:r}),(0,$.jsx)(`code`,{children:a??`Not available`})]}),i&&(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:t,onClick:()=>void i(),children:(0,$.jsx)(`span`,{children:e??`Copy`})})]})}function or({status:e}){let t=[{label:`State`,value:e?.tailscale.backendState??`Unknown`},{label:`Machine`,value:e?.tailscale.machineName??`Unknown`},{label:`Tailnet`,value:e?.tailscale.tailnetName??`Unknown`}],n=[{label:`Tailscale IP`,value:e?.tailscale.tailscaleIps.join(`, `)||`Unknown`},{label:`HTTPS host`,value:e?.serve.httpsHost??e?.tailscale.dnsName??`Unknown`}];return(0,$.jsxs)(`div`,{className:`remote-access-environment`,children:[(0,$.jsx)(`div`,{className:`remote-access-environment-row three`,children:t.map(e=>(0,$.jsx)(sr,{label:e.label,value:e.value},e.label))}),(0,$.jsx)(`div`,{className:`remote-access-environment-row two`,children:n.map(e=>(0,$.jsx)(sr,{label:e.label,value:e.value},e.label))})]})}function sr({label:e,value:t}){return(0,$.jsxs)(`div`,{className:`remote-access-environment-cell`,children:[(0,$.jsx)(`strong`,{children:e}),(0,$.jsx)(`span`,{children:t})]})}function cr({peer:e}){return(0,$.jsxs)(`div`,{className:`account-row remote-access-peer-row`,children:[(0,$.jsx)(`div`,{className:`remote-access-peer-dot ${e.online?`online`:``}`}),(0,$.jsxs)(`div`,{className:`account-details`,children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{children:e.dnsName??e.tailscaleIps[0]??`No address`})]}),(0,$.jsx)(`span`,{className:`account-state ${e.online?`signed_in`:``}`,children:e.online?`Online`:`Offline`}),(0,$.jsx)(`span`,{className:`account-state`,children:e.os??`Unknown`})]})}function lr(e){return e.tailscale.installed?e.tailscale.running?e.webUiAvailable?e.serve.reachable?e.remoteUrl??`Tailnet link ready`:e.remoteUrl?`${e.remoteUrl} ready to configure`:`Tailnet DNS unavailable`:`Browser UI is not served by this process`:e.tailscale.authUrl?`Tailscale needs sign-in`:`Tailscale is not running`:`Tailscale is not installed`}function ur({device:e,self:t,busy:n,webBaseUrl:r,teamId:i,act:a}){let[o,s]=(0,Q.useState)(e.name);(0,Q.useEffect)(()=>s(e.name),[e.name]);let c=i===null?`remoteScope=personal`:`remoteTeam=${encodeURIComponent(i)}`,l=r?`${r}/?remoteDevice=${encodeURIComponent(e.id)}&${c}`:null;return(0,$.jsxs)(`div`,{className:`account-summary remote-access-summary`,children:[(0,$.jsxs)(`div`,{className:`remote-access-device-details`,children:[(0,$.jsxs)(`strong`,{children:[e.name,t?` · This computer`:``]}),(0,$.jsxs)(`small`,{children:[e.status.replaceAll(`_`,` `),` · `,e.taskCount,` tasks at last sync`]}),(0,$.jsxs)(`small`,{children:[`Last seen`,` `,e.lastSeenAt?new Date(e.lastSeenAt).toLocaleString():`never`,` `,`· Catalog synced`,` `,e.lastCatalogSyncAt?new Date(e.lastCatalogSyncAt).toLocaleString():`never`]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Computer name`}),(0,$.jsx)(`input`,{value:o,maxLength:200,disabled:n,onChange:e=>s(e.target.value)})]})]}),(0,$.jsxs)(`div`,{className:`account-summary-actions`,children:[l&&(0,$.jsx)(`a`,{className:`settings-secondary`,href:l,target:`_blank`,rel:`noreferrer`,children:`Open tasks`}),(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:n||!o.trim()||o.trim()===e.name,onClick:()=>void a(`rename`,{deviceId:e.id,revision:e.revision,name:o.trim()}),children:`Save name`}),(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:n||!e.enabled,onClick:()=>void a(t?`disable`:`disable-device`,t?{}:{deviceId:e.id,revision:e.revision}),children:`Turn off`}),(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:n,onClick:()=>void a(`remove`,{deviceId:e.id,revision:e.revision}),children:`Remove`})]})]})}var dr={signed_out:`Sign in required`,connecting:`Connecting`,connected:`Connected`,reconnecting:`Reconnecting`,offline:`Offline`,off:`Off`,update_required:`Update required`},fr={protocol_unsupported:`Install the latest OpenPond desktop app to connect to this relay.`,authentication_timeout:`The relay did not confirm authentication. Retry the connection.`,authentication_expired:`Relay authentication expired. Retry the connection.`,relay_backpressure:`The relay is busy. OpenPond will retry automatically.`,connection_lost:`The relay connection was lost. OpenPond will retry automatically.`,connection_failed:`Unable to reach the relay. Check your network connection and retry.`};function pr(e,t){return e instanceof Error?e.message===`remote_account_changing`?`Your account settings are being updated. Try again shortly.`:e.message:t}function mr({connection:e,onError:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(0),d=(0,Q.useRef)(n),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(null),m=(0,Q.useCallback)(async()=>{if(p.current)return;let t=++u.current;if(!e){d.current=null,r(null);return}let n=new AbortController;p.current=n,l(null);try{let i=await A(e,`/v1/account-remote-access`,{signal:AbortSignal.any([n.signal,AbortSignal.timeout(15e3)])});u.current===t&&(d.current=i,r(i))}catch(e){!n.signal.aborted&&u.current===t&&l(e instanceof Error&&e.name===`TimeoutError`?`Loading your computers timed out. Retry to load their current status.`:pr(e,`Unable to load your computers.`))}finally{p.current===n&&(p.current=null)}},[e]);(0,Q.useEffect)(()=>{d.current=null,r(null),l(null),m();let e=Date.now(),t=window.setInterval(()=>{f.current||([`connecting`,`reconnecting`].includes(d.current?.state??``)||Date.now()-e>=15e3)&&(e=Date.now(),m())},1e3);return()=>{++u.current,p.current?.abort(),p.current=null,window.clearInterval(t)}},[m]),(0,Q.useEffect)(()=>{a(null);let t=n?.team?.id;if(!e||!n?.account||!t)return;let r=!0;return ve.organizations(e).then(e=>{let n=e.organizations.map(he).find(e=>e?.teamId===t);r&&n&&a(n.displayName||n.name||n.slug)}).catch(()=>{}),()=>{r=!1}},[e,n?.account?.id,n?.team?.id]);async function h(n,i={}){if(!e||f.current)return;p.current?.abort(),p.current=null;let a=++u.current;f.current=!0,s(!0),t(null);try{let t=await A(e,`/v1/account-remote-access/${n}`,{method:`POST`,body:JSON.stringify(i)});u.current===a&&(d.current=t,r(t))}catch(e){u.current===a&&(t(pr(e,`Unable to update remote access.`)),await m())}finally{f.current=!1,s(!1)}}let g=!!n?.account;return(0,$.jsxs)(`section`,{className:`account-settings remote-access-settings`,children:[(0,$.jsx)(`h1`,{children:`Remote access`}),(0,$.jsx)(`p`,{children:`View this computer’s tasks and send instructions from your signed-in OpenPond account. Tasks run on this computer.`}),n?.account&&(0,$.jsxs)(`p`,{children:[`Account: `,n.account.label,` · `,n.team?`Workspace: ${i??n.team.id}`:`Personal account`]}),(0,$.jsxs)(`div`,{className:`account-summary remote-access-summary`,children:[(0,$.jsx)(`div`,{className:`account-summary-main`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[`This computer`,n?.device?.name?` · ${n.device.name}`:``]}),(0,$.jsx)(`small`,{role:`status`,children:n?dr[n.state]:c?`Unable to load`:`Checking connection…`}),n?.device&&(0,$.jsxs)(`small`,{children:[`Catalog synced`,` `,n.device.lastCatalogSyncAt?new Date(n.device.lastCatalogSyncAt).toLocaleString():`never`]})]})}),(0,$.jsxs)(`div`,{className:`account-summary-actions`,children:[(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:o||!g,onClick:()=>void h(n?.enabled?`disable`:`enable`),children:o?`Updating…`:n?.enabled?`Turn off`:`Turn on`}),(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:o||(n?!g||!n.enabled:!e||!c),onClick:()=>n?void h(`retry`):void m(),children:n?`Retry connection`:`Retry loading`})]})]}),c&&(0,$.jsx)(X,{error:c}),n?.state===`signed_out`&&(0,$.jsx)(`p`,{children:`Sign in from Settings → Account to connect this computer.`}),n?.account&&!n.team&&(0,$.jsx)(`p`,{children:`Personal access includes tasks owned by your OpenPond account. To use workspace tasks, select that workspace in Settings → Account.`}),n?.team&&(0,$.jsx)(`p`,{children:`This connection includes tasks owned by the selected workspace. Choose Personal account in Settings → Account to use your personal tasks.`}),n?.reason&&fr[n.reason]&&(0,$.jsxs)(`p`,{role:`status`,children:[fr[n.reason],n.state===`update_required`&&n.minimumSupportedProtocolVersion?` This relay requires protocol ${n.minimumSupportedProtocolVersion}; this app uses protocol ${n.supportedProtocolVersion}.`:``]}),n?.device?.removed&&(0,$.jsx)(`p`,{children:`This computer was removed. Turn on remote access here to enroll it again.`}),(0,$.jsx)(`p`,{children:`Turning off remote access applies to your personal account and its workspaces on this computer. It stays off after restart and sign-in until you turn it on here. Sleeping or closing the app makes this computer unavailable.`}),(0,$.jsx)(`p`,{children:`History fetched through OpenPond may be cached for 24 hours. Turning off or removing a computer blocks remote history and controls; its local history stays on that computer.`}),(0,$.jsx)(`h2`,{children:`Your computers`}),n?.devices.length===0&&(0,$.jsx)(`p`,{children:`No computers are enrolled.`}),n?.devices.map(e=>(0,$.jsx)(ur,{device:e,self:e.id===n.device?.id,busy:o,webBaseUrl:n.webBaseUrl,teamId:n.team?.id??null,act:h},e.id))]})}var hr=[{items:[{section:`account`,label:`Account`,Icon:lt},{section:`ponder`,label:`Pal`,Icon:z},{section:`notifications`,label:`Notifications`,Icon:R},{section:`providers`,label:`Providers`,Icon:le},{section:`conversation-imports`,label:`Conversation imports`,Icon:J},{section:`usage`,label:`Activity`,Icon:ke}]},{label:`Harness`,items:[{section:`harness`,label:`Overview`,Icon:I},{section:`harness-refiner`,label:`Refiner`,Icon:We},{section:`harness-continuous-review`,label:`Continuous Review`,Icon:J},{section:`harness-contents`,label:`Contents`,Icon:Me},{section:`harness-releases`,label:`Releases`,Icon:N}]},{label:`Customization`,items:[{section:`appearance`,label:`Appearance`,Icon:ct},{section:`configuration`,label:`Configuration`,Icon:ct},{section:`personalization`,label:`Personalization`,Icon:We},{section:`editor`,label:`Editor`,Icon:L},{section:`skills`,label:`Skills`,Icon:qe}]},{label:`Agents`,items:[{section:`profile`,label:`Profiles`,Icon:lt},{section:`subagents`,label:`Agents`,Icon:z}]},{label:`System`,items:[{section:`dataset-storage`,label:`Dataset Storage`,Icon:at},{section:`remote`,label:`Remote Access`,Icon:ot},{section:`diagnostics`,label:`Diagnostics`,Icon:ee}]}];function gr({section:e,onBack:t,onSectionChange:n}){return(0,$.jsxs)(`aside`,{className:`settings-sidebar`,children:[(0,$.jsxs)(`button`,{className:`settings-back`,"aria-label":`Back to app`,onClick:t,children:[(0,$.jsx)(ge,{size:15}),(0,$.jsx)(`span`,{children:`Back to app`})]}),(0,$.jsx)(`nav`,{className:`settings-nav`,"aria-label":`Settings`,children:hr.map((t,r)=>(0,$.jsxs)(`div`,{className:`settings-nav-group`,children:[t.label?(0,$.jsx)(`div`,{className:`settings-nav-heading`,children:t.label}):null,t.items.map(({section:t,label:r,Icon:i})=>(0,$.jsxs)(`button`,{className:`settings-nav-item ${e===t?`active`:``}`,onClick:()=>n(t),children:[(0,$.jsx)(i,{size:16}),(0,$.jsx)(`span`,{children:r})]},t))]},t.label??`settings-${r}`))})]})}function _r({skills:e,connection:t,onOpenSkill:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(0);fe(a),(0,Q.useEffect)(()=>(s.current++,i(null),()=>{s.current++}),[t]);async function c(e){if(!t||r)return;let a=++s.current;i(e.name),o(null);try{let r=await Promise.all([`SKILL.md`,...e.resourceFiles].map(async n=>{let r=await Z.skillSourceFile(t,`builtin`,e.name,n);if(r.isBinary||r.content===null)throw Error(`This skill file cannot be displayed as text.`);return{path:n,body:r.content}}));s.current===a&&n({name:e.name,description:e.description,path:e.path,body:r[0].body,files:r})}catch(e){s.current===a&&o(e instanceof Error?e.message:`Could not open this skill.`)}finally{s.current===a&&i(null)}}return(0,$.jsxs)(`div`,{className:`account-list native-skills-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`OpenPond skills`}),(0,$.jsx)(`small`,{children:`Included and enabled automatically with Desktop`})]}),(0,$.jsx)(`div`,{className:`profile-table-frame`,children:(0,$.jsxs)(`table`,{className:`profile-data-table built-in-skills-table`,"aria-label":`Built-in OpenPond skills`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Skill`}),(0,$.jsx)(`th`,{scope:`col`,children:`Purpose`}),(0,$.jsx)(`th`,{scope:`col`,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,children:`Source`})]})}),(0,$.jsx)(`tbody`,{children:e.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`strong`,{children:e.name})}),(0,$.jsx)(`td`,{children:e.description}),(0,$.jsx)(`td`,{children:e.enabled&&e.validationStatus===`valid`?`Ready · Built in`:`Needs repair`}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`button`,{className:`settings-secondary compact`,type:`button`,disabled:!t||!!r||e.validationStatus!==`valid`,onClick:()=>void c(e),"aria-label":`Open ${e.name} instructions`,children:r===e.name?`Opening…`:`Open`})})]},e.name))})]})})]})}function vr({catalog:e,connection:t,onCatalog:n,onError:r,onOpenExtension:i,onToast:a}){let[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(e=>{let t=e instanceof Error?e.message:String(e);h(t),r(t),a?.(t,`error`)},[r,a]),_=(0,Q.useCallback)(()=>{h(null),r(null)},[r]),v=(0,Q.useCallback)(async e=>{if(e?.preventDefault(),t&&o.trim()&&!f){_(),p(`preview`);try{let e=await Z.extensionPreview(t,{source:o.trim(),...c.trim()?{ref:c.trim()}:{}});d(e)}catch(e){d(null),g(e)}finally{p(null)}}},[f,_,t,g,c,o]),y=(0,Q.useCallback)(async()=>{if(t&&u&&!f){_(),p(`install`);try{let e=await Z.extensionAdd(t,{source:u.repositoryUrl,ref:u.requestedRef});n(e.catalog),s(``),l(``),d(null),a?.(`Installed ${e.extension.owner}/${e.extension.repo}.`,`success`)}catch(e){g(e)}finally{p(null)}}},[f,_,t,n,a,u,g]),b=(0,Q.useCallback)(async e=>{if(t&&!f){_(),p(`update:${e.id}`);try{let r=await Z.extensionUpdate(t,e);n(r.catalog);let i=r.extension.resolvedCommit===e.resolvedCommit&&r.extension.packageHash===e.packageHash;a?.(i?`${e.owner}/${e.repo} is already current.`:`Updated ${e.owner}/${e.repo}.`,`success`)}catch(e){g(e)}finally{p(null)}}},[f,_,t,n,a,g]),x=(0,Q.useCallback)(async()=>{if(t&&!f&&e.extensions.length!==0){_(),p(`update-all`);try{let e=await Z.extensionUpdateAll(t);n(e.catalog);let r=`Updated ${e.updated.length}; ${e.unchanged.length} already current${e.failed.length?`; ${e.failed.length} failed`:``}.`;a?.(r,e.failed.length?`error`:`success`),e.failed.length&&h(e.failed.map(e=>e.error).join(` `))}catch(e){g(e)}finally{p(null)}}},[f,e.extensions.length,_,t,n,a,g]),S=(0,Q.useCallback)(async e=>{if(t&&!f&&window.confirm(`Remove ${e.owner}/${e.repo} and its ${e.skills.length} installed skill${e.skills.length===1?``:`s`}? Profile and built-in skills will not be changed.`)){_(),p(`remove:${e.id}`);try{n((await Z.extensionRemove(t,e)).catalog),a?.(`Removed ${e.owner}/${e.repo}.`,`success`)}catch(e){g(e)}finally{p(null)}}},[f,_,t,n,a,g]),C=(0,Q.useCallback)(e=>{s(e),d(null),h(null)},[]),w=(0,Q.useCallback)(e=>{l(e),d(null),h(null)},[]);return(0,$.jsxs)(`div`,{className:`account-list native-skills-list github-extensions-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading github-extensions-heading`,children:[(0,$.jsx)(`span`,{children:`Third-party extensions`}),(0,$.jsxs)(`div`,{className:`github-extensions-heading-actions`,children:[(0,$.jsxs)(`small`,{children:[e.extensions.length,` installed from GitHub`]}),(0,$.jsxs)(`button`,{className:`settings-secondary compact`,disabled:!t||f!==null||e.extensions.length===0,type:`button`,onClick:()=>void x(),children:[f===`update-all`?(0,$.jsx)(ce,{className:`settings-spin`,size:13}):(0,$.jsx)(J,{size:13}),`Update all`]})]})]}),(0,$.jsxs)(`form`,{className:`github-extension-add`,onSubmit:e=>void v(e),children:[(0,$.jsxs)(`div`,{className:`github-extension-add-copy`,children:[(0,$.jsx)(`strong`,{children:`Add a GitHub skill pack`}),(0,$.jsx)(`span`,{children:`Use a skills-CLI-compatible owner/repo or GitHub URL. OpenPond installs it locally without running setup code.`})]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`span`,{children:`Repository`}),(0,$.jsx)(`input`,{disabled:!t||f!==null,placeholder:`owner/repo`,value:o,onChange:e=>C(e.target.value)})]}),(0,$.jsxs)(`label`,{className:`github-extension-ref-input`,children:[(0,$.jsx)(`span`,{children:`Branch, tag, or SHA`}),(0,$.jsx)(`input`,{disabled:!t||f!==null,placeholder:`Default branch`,value:c,onChange:e=>w(e.target.value)})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:!t||!o.trim()||f!==null,type:`submit`,children:[f===`preview`?(0,$.jsx)(ce,{className:`settings-spin`,size:14}):(0,$.jsx)(Ue,{size:14}),f===`preview`?`Checking`:`Preview`]})]}),m??e.error?(0,$.jsx)(X,{error:m??e.error}):null,u?(0,$.jsxs)(`div`,{className:`github-extension-preview`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[u.owner,`/`,u.repo]}),(0,$.jsxs)(`span`,{children:[u.skills.length,` skill`,u.skills.length===1?``:`s`,` at `,u.resolvedCommit.slice(0,12)]})]}),(0,$.jsx)(`div`,{className:`github-extension-preview-skills`,children:u.skills.map(e=>(0,$.jsx)(`span`,{children:e.name},e.relativePath))}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:f!==null,type:`button`,onClick:()=>void y(),children:[f===`install`?(0,$.jsx)(ce,{className:`settings-spin`,size:14}):(0,$.jsx)(q,{size:14}),f===`install`?`Installing`:`Install extension`]})]}):null,e.extensions.length?e.extensions.map(e=>{let n=f===`update:${e.id}`,r=f===`remove:${e.id}`;return(0,$.jsxs)(`div`,{className:`github-extension-row`,children:[(0,$.jsxs)(`button`,{"aria-label":`Open ${e.owner}/${e.repo} extension source`,className:`github-extension-open`,disabled:!t||f!==null,type:`button`,onClick:()=>i(e),children:[(0,$.jsx)(`span`,{className:`native-skill-icon`,"aria-hidden":`true`,children:(0,$.jsx)(Ue,{size:17})}),(0,$.jsxs)(`span`,{className:`native-skill-identity`,children:[(0,$.jsxs)(`strong`,{children:[e.owner,`/`,e.repo]}),(0,$.jsx)(`span`,{children:e.skills.map(e=>e.name).join(`, `)})]}),(0,$.jsxs)(`span`,{className:`native-skill-provider`,children:[(0,$.jsxs)(`strong`,{children:[e.skills.length,` skill`,e.skills.length===1?``:`s`]}),(0,$.jsxs)(`span`,{children:[e.requestedRef,` · `,e.resolvedCommit.slice(0,12)]})]}),(0,$.jsx)(`span`,{className:`native-skill-status ${e.validationStatus===`valid`?``:`invalid`}`,children:e.validationStatus===`valid`?`Ready`:`Needs attention`}),(0,$.jsx)(V,{size:16,"aria-hidden":`true`})]}),(0,$.jsxs)(`span`,{className:`github-extension-row-actions`,children:[(0,$.jsx)(`button`,{"aria-label":`Update ${e.owner}/${e.repo}`,className:`settings-icon-button ghost`,disabled:f!==null,title:`Update extension`,type:`button`,onClick:()=>void b(e),children:n?(0,$.jsx)(ce,{className:`settings-spin`,size:14}):(0,$.jsx)(J,{size:14})}),(0,$.jsx)(`button`,{"aria-label":`Remove ${e.owner}/${e.repo}`,className:`settings-icon-button ghost danger`,disabled:f!==null,title:`Remove extension`,type:`button`,onClick:()=>void S(e),children:r?(0,$.jsx)(ce,{className:`settings-spin`,size:14}):(0,$.jsx)(M,{size:14})})]})]},e.id)}):(0,$.jsx)(`div`,{className:`skills-settings-empty`,children:`No third-party extensions installed.`})]})}function yr({onOpenSkill:e,onOpenExtension:t,personalSkills:n,builtInSkills:r,extensionCatalog:i,connection:a,onExtensionCatalog:o,onError:s,onToast:c}){return(0,$.jsxs)(`section`,{className:`account-settings skills-settings`,"aria-labelledby":`skills-settings-title`,children:[(0,$.jsx)(`header`,{className:`skills-settings-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{id:`skills-settings-title`,children:`Skills`}),(0,$.jsx)(`p`,{children:`Install third-party GitHub packs, inspect personal Codex skills, and view instructions bundled with OpenPond.`})]})}),(0,$.jsx)(_r,{skills:r,connection:a,onOpenSkill:e}),(0,$.jsx)(vr,{catalog:i,connection:a,onCatalog:o,onError:s,onOpenExtension:t,onToast:c}),(0,$.jsxs)(`div`,{className:`account-list native-skills-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Personal Codex skills`}),(0,$.jsx)(`small`,{children:`Discovered from your local Codex skills folder`})]}),n.length?n.map(e=>(0,$.jsxs)(`div`,{className:`native-skill-row personal-skill-row`,children:[(0,$.jsx)(`span`,{className:`native-skill-icon`,"aria-hidden":`true`,children:(0,$.jsx)(qe,{size:17})}),(0,$.jsxs)(`span`,{className:`native-skill-identity`,children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{children:e.description||`Packaged Codex skill`})]}),(0,$.jsxs)(`span`,{className:`native-skill-provider`,children:[(0,$.jsx)(`strong`,{children:e.resourceFiles.length?`${e.resourceFiles.length} packaged resource${e.resourceFiles.length===1?``:`s`}`:`Instructions only`}),(0,$.jsx)(`span`,{children:e.sourcePath})]}),(0,$.jsx)(`span`,{className:`native-skill-status ${e.validationStatus===`valid`?``:`invalid`}`,children:e.validationStatus===`valid`?`Ready`:`Needs attention`}),(0,$.jsx)(`span`,{"aria-hidden":`true`})]},e.sourcePath)):(0,$.jsx)(`div`,{className:`skills-settings-empty`,children:`No personal Codex skills found.`})]}),(0,$.jsxs)(`div`,{className:`account-list native-skills-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`App integration skills`}),(0,$.jsx)(`small`,{children:`Bundled with this OpenPond build`})]}),Le.map(t=>{let n=ze(t.provider)?.label??t.provider;return(0,$.jsxs)(`button`,{className:`native-skill-row`,type:`button`,onClick:()=>e(t),children:[(0,$.jsx)(`span`,{className:`native-skill-icon`,"aria-hidden":`true`,children:(0,$.jsx)(qe,{size:17})}),(0,$.jsxs)(`span`,{className:`native-skill-identity`,children:[(0,$.jsx)(`strong`,{children:t.name}),(0,$.jsx)(`span`,{children:t.description})]}),(0,$.jsxs)(`span`,{className:`native-skill-provider`,children:[(0,$.jsx)(`strong`,{children:n}),(0,$.jsx)(`span`,{children:t.path})]}),(0,$.jsx)(`span`,{className:`native-skill-status`,children:`Built in`}),(0,$.jsx)(V,{size:16,"aria-hidden":`true`})]},t.name)})]})]})}var br=`default`;function xr({connection:e,embedded:t=!1,onError:n,onPreferences:r,preferences:i,providers:a}){let o=i.training,[s,c]=(0,Q.useState)(Sr(o.defaultModelRef)),[l,u]=(0,Q.useState)(o.creationMode),[d,f]=(0,Q.useState)(o.autoApproveEvidence),[p,m]=(0,Q.useState)(!1),h=(0,Q.useMemo)(()=>y(a,{includeUnavailable:!0}),[a]),g=(0,Q.useMemo)(()=>h.map(e=>({provider:e,models:D(e.value,a)})).filter(e=>e.models.length>0),[h,a]),_=Cr(s),b=v(i.defaultChatProvider,i.defaultChatModel,a)?` · ${wr(i.codexReasoningEffort)} reasoning`:``,x=Tr(_,o.defaultModelRef??null)&&l===o.creationMode&&d===o.autoApproveEvidence;(0,Q.useEffect)(()=>{c(Sr(o.defaultModelRef)),u(o.creationMode),f(o.autoApproveEvidence)},[i.defaultChatModel,i.defaultChatProvider,o.autoApproveEvidence,o.creationMode,o.defaultModelRef]);async function C(t){if(t.preventDefault(),e){m(!0),n(null);try{r(await Z.savePreferences(e,{training:{defaultModelRef:_,creationMode:l,autoApproveEvidence:d}}))}catch(e){n(e instanceof Error?e.message:String(e))}finally{m(!1)}}}return(0,$.jsxs)(`section`,{className:`account-settings training-settings${t?` embedded`:``}`,children:[t?null:(0,$.jsx)(`h1`,{children:`Ponder settings`}),(0,$.jsxs)(`form`,{className:`provider-settings-form`,onSubmit:e=>void C(e),children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Taskset authoring`}),(0,$.jsx)(`small`,{children:`The coding model that proposes tasks, graders, fixtures, and policy boundaries`})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Authoring model`}),(0,$.jsxs)(`select`,{value:s,disabled:p,onChange:e=>c(e.target.value),children:[(0,$.jsxs)(`option`,{value:br,children:[`Use chat default — `,S(i.defaultChatProvider,a),` · `,T(i.defaultChatModel,a,i.defaultChatProvider),b]}),g.map(e=>(0,$.jsx)(`optgroup`,{label:e.provider.label,children:e.models.map(t=>(0,$.jsx)(`option`,{value:Sr({providerId:e.provider.value,modelId:t.value}),children:t.label},t.value))},e.provider.value))]}),(0,$.jsx)(`small`,{children:`By default, /train follows the same provider, model, and reasoning level selected for chat.`})]})}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Default flow`}),(0,$.jsx)(`small`,{children:`Used by /train and Task Creator unless you choose another mode`})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Task Creator mode`}),(0,$.jsxs)(`select`,{value:l,disabled:p,onChange:e=>u(e.target.value),children:[(0,$.jsx)(`option`,{value:`customize`,children:`Guided plan — review and revise before materializing`}),(0,$.jsx)(`option`,{value:`defaults`,children:`Fast draft — use reversible defaults`})]})]})}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Evidence confirmation`}),(0,$.jsx)(`small`,{children:`Controls the first authoring gate; materialization and training remain separate`})]}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:d,disabled:p,onChange:e=>f(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Skip evidence confirmation`}),(0,$.jsx)(`small`,{children:`Immediately send excerpts from explicitly selected chats to the authoring model. This never approves Taskset materialization or training spend.`})]})]}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:p||x,children:(0,$.jsx)(`span`,{children:p?`Saving`:`Save training settings`})})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`Authoring model`}),(0,$.jsx)(`strong`,{children:_?`${S(_.providerId,a)} / ${T(_.modelId,a,_.providerId)}`:`Chat default`})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`Safety boundary`}),(0,$.jsx)(`strong`,{children:`Taskset and training approvals always required`})]})]})}function Sr(e){return e?JSON.stringify([e.providerId,e.modelId]):br}function Cr(e){if(e===br)return null;try{let t=JSON.parse(e);return!Array.isArray(t)||t.length!==2||typeof t[0]!=`string`||typeof t[1]!=`string`?null:{providerId:t[0],modelId:t[1]}}catch{return null}}function wr(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Tr(e,t){return e?.providerId===t?.providerId&&e?.modelId===t?.modelId}var Er=n();function Dr({disabled:e,onChange:t,storageRoots:n,value:r}){let i=(0,Q.useId)(),[a,o]=(0,Q.useState)(!1),s=Nr(r),c=e=>e.datasetStorePath,l=`Dataset`,u=n.find(e=>Nr(c(e))===s)??null;return(0,$.jsxs)(`div`,{className:`model-storage-picker`,children:[(0,$.jsxs)(`label`,{className:`model-storage-label`,htmlFor:i,children:[l,` storage`]}),(0,$.jsxs)(`div`,{className:`model-storage-control-row`,children:[(0,$.jsxs)(`select`,{"aria-label":`${l} storage drive`,className:`model-storage-select`,disabled:e,id:i,title:r??`No Dataset storage configured`,value:r??``,onChange:e=>t(e.target.value||null),children:[(0,$.jsx)(`option`,{value:``,children:`Not configured`}),r&&!u?(0,$.jsx)(`option`,{value:r,children:`Manual location`}):null,n.map(e=>(0,$.jsxs)(`option`,{disabled:!e.mounted||!e.writable,title:c(e),value:c(e),children:[e.label,` · `,jr(e.kind),` · `,Mr(e)]},e.id))]}),(0,$.jsx)(`button`,{className:`settings-icon-button model-storage-add`,disabled:e,type:`button`,title:`Add manual location`,"aria-label":`Add manual Dataset storage location`,onClick:()=>o(!0),children:(0,$.jsx)(q,{size:15})})]}),a?Or((0,$.jsx)(kr,{initialPath:r??``,purpose:`dataset`,onClose:()=>o(!1),onUse:e=>{t(e),o(!1)}})):null]})}function Or(e){return typeof document>`u`?e:(0,Er.createPortal)(e,document.body)}function kr({initialPath:e,onClose:t,onUse:n,purpose:r=`model`}){let i=(0,Q.useId)(),[a,o]=(0,Q.useState)(e),s=Ar(a);(0,Q.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);function c(e){e.preventDefault(),e.stopPropagation(),!s&&n(a.trim())}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,$.jsxs)(`form`,{className:`git-dialog model-storage-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":i,onSubmit:c,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,type:`button`,title:`Close`,"aria-label":`Close manual ${r} storage`,onClick:t,children:(0,$.jsx)(Y,{size:15})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(G,{size:18})}),(0,$.jsxs)(`h2`,{id:i,children:[`Manual `,r,` storage`]}),(0,$.jsx)(`p`,{children:`Enter an absolute path to a folder mounted on this machine.`}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Mounted folder path`}),(0,$.jsx)(`input`,{autoFocus:!0,spellCheck:!1,value:a,placeholder:r===`dataset`?`/mnt/OpenPond/datasets`:`/mnt/models or /run/user/…/gvfs/…`,onChange:e=>o(e.target.value)})]}),(0,$.jsx)(`div`,{className:`model-storage-dialog-note`,children:`For SMB, connect the share in Files or Finder first, then paste its mounted folder path. OpenPond uses your operating system’s existing connection and credentials.`}),a.trim()&&s?(0,$.jsx)(X,{error:s}):null,(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,type:`button`,onClick:t,children:`Cancel`}),(0,$.jsx)(`button`,{className:`git-dialog-primary`,disabled:!!s,type:`submit`,children:`Use location`})]})]})})}function Ar(e){let t=e.trim();return t?/^[a-z][a-z\d+.-]*:\/\//i.test(t)?`Use the mounted folder path, not an smb:// or other network URL.`:t===`~`||t.startsWith(`~/`)||t.startsWith(`/`)||t.startsWith(`\\\\`)||/^[a-z]:[\\/]/i.test(t)?null:`Enter an absolute mounted folder path.`:`Enter a mounted folder path.`}function jr(e){return e===`network`?`Network`:e===`removable`?`Removable`:e===`cache`?`Cache`:`Local`}function Mr(e){return e.mounted?e.writable?`${Pr(e.freeBytes)} free`:`Read only`:`Not mounted`}function Nr(e){let t=(e??``).trim().replace(/[\\/]+$/,``);return/^(?:[a-z]:[\\/]|\\\\)/i.test(t)?t.toLowerCase():t}function Pr(e){if(e==null)return`Unknown`;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e,r=-1;do n/=1024,r+=1;while(n>=1024&&r<t.length-1);return`${n>=10?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function Fr({state:e,catalog:t,busy:n,catalogLoading:r,onRefresh:i,onSave:a}){let[o,s]=(0,Q.useState)(e?.settings.datasetStorePath??null);(0,Q.useEffect)(()=>{s(e?.settings.datasetStorePath??null)},[e?.settings.datasetStorePath]);let c=(0,Q.useMemo)(()=>e?.storageRoots.find(e=>Br(e.datasetStorePath)===Br(o))??null,[o,e?.storageRoots]),l=o===(e?.settings.datasetStorePath??null),u=t?.datasets??[];async function d(e){e.preventDefault(),await a(o)}return(0,$.jsxs)(`section`,{className:`account-settings compute-settings dataset-storage-settings`,children:[(0,$.jsxs)(`div`,{className:`compute-title-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{children:`Dataset Storage`}),(0,$.jsx)(`p`,{className:`dataset-storage-intro`,children:`Choose where Dataset artifacts are saved and review registered Datasets without loading their rows.`})]}),(0,$.jsx)(`button`,{"aria-label":`Refresh Dataset storage`,className:`settings-icon-button`,disabled:n!==null||r,onClick:()=>void i(),title:`Refresh Dataset storage`,type:`button`,children:(0,$.jsx)(J,{className:r?`settings-spin`:void 0,size:15})})]}),(0,$.jsx)(`div`,{className:`account-summary`,children:(0,$.jsx)(`div`,{className:`account-summary-main compute-summary-main`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:c?.label??(o?`Manual location`:`Not configured`)}),(0,$.jsx)(`small`,{children:o??`Choose a writable local or mounted location before importing a Dataset.`}),c?(0,$.jsxs)(`small`,{children:[Hr(c.kind),` · `,c.freeBytes==null?`Free space unknown`:`${Rr(c.freeBytes)} free`]}):null]})})}),(0,$.jsxs)(`form`,{className:`provider-settings-form`,onSubmit:e=>void d(e),children:[(0,$.jsx)(`div`,{className:`account-list-heading`,children:(0,$.jsx)(`span`,{children:`Location`})}),(0,$.jsx)(Dr,{disabled:n!==null,onChange:s,storageRoots:e?.storageRoots??[],value:o}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:n!==null||l,children:n===`save`?`Saving`:`Save Dataset storage`})]}),(0,$.jsxs)(`div`,{className:`account-list dataset-storage-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Registered Datasets`}),(0,$.jsx)(`small`,{children:u.length})]}),u.length?u.map(e=>(0,$.jsx)(Ir,{dataset:e},e.tasksetId)):(0,$.jsx)(`div`,{className:`empty-account-list`,children:(0,$.jsx)(`span`,{children:r?`Loading registered Datasets`:`No registered Datasets`})})]})]})}function Ir({dataset:e}){let t=e.storageKind===`parquet`?`Parquet`:`Inline Taskset`;return(0,$.jsxs)(`div`,{className:`compute-row dataset-storage-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsxs)(`small`,{children:[zr(e.rowCount),` rows`,` · `,Lr(e),` · `,t,` · `,e.sizeBytes==null?`Size unavailable`:Rr(e.sizeBytes)]}),!e.available&&e.unavailableReason?(0,$.jsx)(`small`,{className:`dataset-storage-error`,children:e.unavailableReason}):null]}),(0,$.jsx)(`span`,{children:e.available?Vr(e.status):`Unavailable`})]})}function Lr(e){return[[`train`,e.splitCounts.train],[`validation`,e.splitCounts.validation],[`test`,e.splitCounts.test],[`frozen eval`,e.splitCounts.frozen_eval]].filter(([,e])=>Number(e)>0).map(([e,t])=>`${zr(Number(t))} ${e}`).join(` · `)||`No split rows`}function Rr(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e,r=-1;do n/=1024,r+=1;while(n>=1024&&r<t.length-1);return`${n>=10?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function zr(e){return new Intl.NumberFormat().format(e)}function Br(e){return e?.replace(/[\\/]+$/,``)??``}function Vr(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Hr(e){return e.replace(/^./,e=>e.toUpperCase())}function Ur(e){if(!e)return`Not yet`;let t=new Date(e);return Number.isNaN(t.valueOf())?e:t.toLocaleString()}function Wr(e){return e?e.slice(0,10):`none`}function Gr(e){let t=e.replaceAll(`_`,` `);return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function Kr(e){return e===`unresolved`?`Watching`:e===`confirmed`?`Ready for Refiner`:Gr(e)}function qr({review:e}){let t=[[`Taskset`,e.tasksetProposal],[`Baseline evaluation`,e.evaluation],[`Training qualification`,e.trainingQualification]];return(0,$.jsx)(`div`,{className:`harness-review-lineage`,"aria-label":`Review lineage`,children:t.map(([e,t])=>(0,$.jsxs)(`div`,{className:t?`linked`:`pending`,children:[(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`code`,{children:t?Wr(t.contentHash):`Not created`})]},e))})}function Jr({candidate:e}){return(0,$.jsxs)(`details`,{className:`harness-disclosure-row`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-${e.status}`,children:Kr(e.status)}),(0,$.jsx)(`strong`,{children:e.statement}),(0,$.jsxs)(`small`,{children:[e.occurrences.length,` occurrence`,e.occurrences.length===1?``:`s`]}),(0,$.jsx)(`time`,{children:Ur(e.updatedAt)})]}),(0,$.jsxs)(`div`,{className:`harness-disclosure-body`,children:[(0,$.jsx)(`p`,{children:e.resolution?.reason??e.recurrenceFamily}),(0,$.jsxs)(`dl`,{className:`harness-compact-metadata`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Pattern`}),(0,$.jsx)(`dd`,{children:e.recurrenceFamily})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Fingerprint`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{children:Wr(e.fingerprint)})})]})]}),e.occurrences.length?(0,$.jsxs)(`details`,{className:`harness-history-details`,children:[(0,$.jsx)(`summary`,{children:`Evidence receipts`}),(0,$.jsx)(`ul`,{className:`harness-evidence-list`,children:e.occurrences.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{children:Gr(e.kind)}),(0,$.jsx)(`code`,{children:Wr(e.evidence.contentHash)}),(0,$.jsx)(`time`,{children:Ur(e.occurredAt)})]},`${e.evidence.id}:${e.evidence.contentHash}`))})]}):null]})]})}function Yr({accepting:e,onAcceptTasksetReview:t,review:n}){let r=n.classification===`taskset`&&n.nextAuthority===`human_review`&&n.tasksetProposal===null;return(0,$.jsxs)(`details`,{className:`harness-disclosure-row`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-${n.classification}`,children:Gr(n.classification)}),(0,$.jsx)(`strong`,{children:n.claim?.statement??n.reason}),(0,$.jsxs)(`small`,{children:[n.selectedEvidence.length,` selected`]}),(0,$.jsx)(`time`,{children:Ur(n.createdAt)})]}),(0,$.jsxs)(`div`,{className:`harness-disclosure-body`,children:[(0,$.jsx)(`p`,{children:n.reason}),(0,$.jsxs)(`div`,{className:`harness-review-metrics`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:n.selectedEvidence.length}),` selected`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:n.excludedEvidence.length}),` excluded`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:n.claim?.independentOccurrences??0}),` independent occurrences`]}),(0,$.jsxs)(`span`,{children:[`Next: `,(0,$.jsx)(`strong`,{children:Gr(n.nextAuthority)})]})]}),(0,$.jsx)(qr,{review:n}),r?(0,$.jsx)(`div`,{className:`harness-history-actions`,children:(0,$.jsx)(`button`,{className:`settings-primary compact`,disabled:e,onClick:()=>t(n),type:`button`,children:e?`Opening Taskset review…`:`Build training Taskset`})}):null]})]})}function Xr({receipt:e}){return(0,$.jsxs)(`details`,{className:`harness-disclosure-row`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-${e.decision}`,children:Gr(e.decision)}),(0,$.jsxs)(`strong`,{children:[e.model.provider,`/`,e.model.model]}),(0,$.jsxs)(`small`,{children:[Gr(e.signal.strength),` signal`]}),(0,$.jsx)(`time`,{children:Ur(e.createdAt)})]}),(0,$.jsxs)(`div`,{className:`harness-disclosure-body`,children:[(0,$.jsx)(`p`,{children:e.reasons.join(` `)}),(0,$.jsxs)(`dl`,{className:`harness-compact-metadata`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Review`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{children:Wr(e.review.contentHash)})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Taskset`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{children:Wr(e.tasksetRelease?.contentHash)})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Baseline`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{children:Wr(e.baselineEvaluation?.contentHash)})})]})]})]})]})}function Zr({acceptingReviewId:e,candidates:t,onAcceptTasksetReview:n,qualifications:r,reviews:i,schedule:a}){let o=a.activityEnabled||a.enabled;return(0,$.jsxs)(`div`,{className:`harness-page-sections`,children:[(0,$.jsx)(`section`,{className:`harness-history-section`,"aria-label":`Continuous Review status`,children:(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table harness-review-status-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Status`}),(0,$.jsx)(`th`,{children:`Trigger`}),(0,$.jsx)(`th`,{children:`Last review`}),(0,$.jsx)(`th`,{children:`Last result`})]})}),(0,$.jsx)(`tbody`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status ${o?`harness-status-advanced`:``}`,children:o?`On`:`Off`})}),(0,$.jsx)(`td`,{children:a.activityEnabled?`${a.activityBatchSize} new outcomes`:`Manual only`}),(0,$.jsx)(`td`,{children:Ur(a.lastRunAt)}),(0,$.jsx)(`td`,{children:a.lastResult?Gr(a.lastResult.classification):`No completed review`})]})})]})})}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Patterns`}),(0,$.jsx)(`p`,{children:`Recurring evidence being watched or ready for the Refiner.`})]}),(0,$.jsx)(`span`,{children:t.length})]}),(0,$.jsx)(`div`,{className:`harness-disclosure-list`,children:t.length?t.map(e=>(0,$.jsx)(Jr,{candidate:e},`${e.id}:${e.contentHash}`)):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No recurring patterns are being tracked.`})})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Review history`}),(0,$.jsx)(`p`,{children:`Receipts stay compact; expand one for evidence and downstream lineage.`})]}),(0,$.jsx)(`span`,{children:i.length})]}),(0,$.jsx)(`div`,{className:`harness-disclosure-list`,children:i.length?i.map(t=>(0,$.jsx)(Yr,{accepting:e===t.id,onAcceptTasksetReview:n,review:t},`${t.id}:${t.contentHash}`)):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Continuous Review receipts yet.`})})]}),r.length?(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Training handoffs`}),(0,$.jsx)(`p`,{children:`Evidence-bound qualification receipts created for Models.`})]}),(0,$.jsx)(`span`,{children:r.length})]}),(0,$.jsx)(`div`,{className:`harness-disclosure-list`,children:r.map(e=>(0,$.jsx)(Xr,{receipt:e},`${e.id}:${e.contentHash}`))})]}):null]})}var Qr=`Update the Refiner Review Profile. Inspect the current profile first, ask what should change if it is not already clear, and show the exact release transition.`;function $r(e){let t=new Date(e);return Number.isNaN(t.valueOf())?e:t.toLocaleString()}function ei(e){return e?e.slice(0,10):`none`}function ti({busyReleaseHash:e,history:t,onRequestRelease:n,onStartAuthoring:r}){let i=(0,Q.useMemo)(()=>{let e=new Map;for(let n of t.transitions)e.has(n.nextRelease.contentHash)||e.set(n.nextRelease.contentHash,n);return e},[t.transitions]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Review Profile`}),(0,$.jsx)(`p`,{children:`Separately versioned policy composed with the immutable Refiner Core.`})]}),r?(0,$.jsx)(`button`,{className:`settings-primary compact`,onClick:()=>r(Qr),type:`button`,children:`Edit with Work`}):null]}),(0,$.jsxs)(`div`,{className:`harness-summary-grid`,children:[(0,$.jsxs)(`article`,{children:[(0,$.jsx)(`span`,{children:`Active release`}),(0,$.jsx)(`strong`,{children:ei(t.binding.release.contentHash)}),(0,$.jsxs)(`small`,{children:[`Binding revision `,t.binding.revision]})]}),(0,$.jsxs)(`article`,{children:[(0,$.jsx)(`span`,{children:`Profile`}),(0,$.jsx)(`strong`,{children:t.currentRelease.profile.name}),(0,$.jsxs)(`small`,{children:[t.currentRelease.profile.id,`@`,t.currentRelease.profile.version]})]}),(0,$.jsxs)(`article`,{children:[(0,$.jsx)(`span`,{children:`Core`}),(0,$.jsx)(`strong`,{children:t.currentRelease.coreVersion}),(0,$.jsx)(`small`,{children:ei(t.currentRelease.coreHash)})]})]}),(0,$.jsx)(`p`,{children:t.currentRelease.profile.objective}),t.currentRelease.profile.instructions.length?(0,$.jsx)(`div`,{className:`harness-edit-list`,children:t.currentRelease.profile.instructions.map(e=>(0,$.jsx)(`section`,{className:`harness-edit`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.id}),(0,$.jsx)(`span`,{children:e.text})]})},e.id))}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`The default profile adds no instructions beyond the Refiner Core.`})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Profile releases`}),(0,$.jsx)(`p`,{children:`Immutable definition history. Rollback changes future reviews only.`})]}),(0,$.jsx)(`span`,{children:t.releases.length})]}),(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Profile`}),(0,$.jsx)(`th`,{children:`Release`}),(0,$.jsx)(`th`,{children:`Created`}),(0,$.jsx)(`th`,{children:`Status`}),(0,$.jsx)(`th`,{children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:t.releases.map(r=>{let a=r.contentHash===t.binding.release.contentHash,o=!a&&i.get(r.contentHash)?.bindingChanged===!1,s=o?`activate`:`rollback`;return(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`td`,{children:[(0,$.jsx)(`strong`,{children:r.profile.name}),(0,$.jsxs)(`small`,{children:[r.profile.id,`@`,r.profile.version,` · `,r.profile.instructions.length,` instructions`]})]}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:ei(r.contentHash)})}),(0,$.jsx)(`td`,{children:$r(r.createdAt)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status`,children:a?`active`:o?`draft`:`immutable`})}),(0,$.jsx)(`td`,{children:a?null:(0,$.jsx)(`button`,{"aria-label":`${o?`Activate`:`Roll back`} Refiner release`,className:`harness-table-icon-action`,disabled:e!==null,onClick:()=>n(r,s),title:`${o?`Activate`:`Roll back`} Refiner release`,type:`button`,children:o?(0,$.jsx)(Re,{size:14}):(0,$.jsx)(Oe,{size:14})})})]},r.contentHash)})})]})})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Definition changes`}),(0,$.jsx)(`p`,{children:`Receipts record which release changed, why, and which authoring Skill produced it.`})]}),(0,$.jsx)(`span`,{children:t.transitions.length})]}),(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Operation`}),(0,$.jsx)(`th`,{children:`Change`}),(0,$.jsx)(`th`,{children:`Release transition`}),(0,$.jsx)(`th`,{children:`Validation`}),(0,$.jsx)(`th`,{children:`Created`})]})}),(0,$.jsx)(`tbody`,{children:t.transitions.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`span`,{className:`harness-status`,children:[e.operation,e.bindingChanged?` · active`:` · draft`]})}),(0,$.jsxs)(`td`,{children:[(0,$.jsx)(`strong`,{children:e.reason}),(0,$.jsx)(`small`,{children:e.authoringSkillHash?`Skill ${ei(e.authoringSkillHash)}`:e.actor})]}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`code`,{children:[ei(e.previousRelease?.contentHash),` → `,ei(e.nextRelease.contentHash)]})}),(0,$.jsx)(`td`,{children:e.validation.valid?`Passed`:e.validation.messages.join(`; `)}),(0,$.jsx)(`td`,{children:$r(e.createdAt)})]},e.contentHash))})]})})]})]})}var ni={enabled:!1,activityEnabled:!1,activityBatchSize:10,cadence:`manual`,maxEstimatedCostUsd:.1,nextRunAt:null,lastRunAt:null,lastResult:null,lastError:null,updatedAt:null},ri={overview:{title:`Harness overview`,description:`Current state, items needing attention, and recent learning activity.`},refiner:{title:`Refiner`,description:`Validated per-turn improvements and recommendations routed outside the Harness.`},"continuous-review":{title:`Continuous Review`,description:`Recurring patterns found across completed work and their immutable review receipts.`},contents:{title:`Harness contents`,description:`The instructions, skills, agents, and memory available in the current release.`},releases:{title:`Harness releases`,description:`Immutable versions, diffs, and rollback controls.`}};function ii(e){if(!e)return`Not yet`;let t=new Date(e);return Number.isNaN(t.valueOf())?e:t.toLocaleString()}function ai(e){return e?e.slice(0,10):`none`}function oi(e,t,n){return{workspaceId:e,baseRelease:t?{id:t.id,contentHash:t.contentHash}:null,targetRelease:{id:n.id,contentHash:n.contentHash},title:n.current?`Current Harness release`:`Harness release ${ai(n.contentHash)}`}}function si({review:e,busy:t,onReview:n}){return(0,$.jsxs)(`article`,{className:`harness-history-card harness-review-card`,children:[(0,$.jsxs)(`header`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`harness-history-kicker`,children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-retained`,children:`review required`}),(0,$.jsxs)(`span`,{children:[e.proposal.route,` · `,e.proposal.edits[0]?.operation??`change`]})]}),(0,$.jsx)(`h2`,{children:e.proposal.expectedOutcome})]}),(0,$.jsx)(`time`,{children:ii(e.proposal.createdAt)})]}),(0,$.jsx)(`p`,{children:e.proposal.edits.map(e=>e.summary).join(` `)}),(0,$.jsxs)(`details`,{className:`harness-history-details`,children:[(0,$.jsxs)(`summary`,{children:[`Exact edits (`,e.proposal.edits.length,`)`]}),(0,$.jsx)(`div`,{className:`harness-edit-list`,children:e.proposal.edits.map(e=>(0,$.jsxs)(`section`,{className:`harness-edit`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[e.operation,` · `,e.target]}),(0,$.jsx)(`span`,{children:e.summary})]}),e.content===null?(0,$.jsx)(`p`,{children:`File deleted.`}):(0,$.jsx)(`pre`,{children:e.content})]},e.id))})]}),e.validations.length?(0,$.jsxs)(`details`,{className:`harness-history-details`,children:[(0,$.jsxs)(`summary`,{children:[`Validation receipts (`,e.validations.length,`)`]}),(0,$.jsx)(`div`,{className:`harness-validation-list`,children:e.validations.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`harness-validation-status ${e.status}`,children:e.status}),(0,$.jsx)(`strong`,{children:e.kind.replaceAll(`_`,` `)}),(0,$.jsx)(`span`,{children:e.summary})]},e.id))})]}):null,(0,$.jsxs)(`footer`,{className:`harness-review-actions`,children:[(0,$.jsxs)(`button`,{className:`settings-secondary compact`,disabled:t,onClick:()=>n(e,`decline`),type:`button`,children:[(0,$.jsx)(Y,{size:13}),` Decline`]}),(0,$.jsxs)(`button`,{className:`settings-primary compact`,disabled:t||e.validations.some(e=>e.status!==`passed`),onClick:()=>n(e,`approve`),type:`button`,children:[(0,$.jsx)(Re,{size:13}),` Approve and release`]})]})]})}function ci({change:e,onClose:t}){let n=e.proposal;return(0,$.jsxs)(pe,{ariaLabel:`Refiner change details`,backdropClassName:`harness-details-dialog-backdrop`,className:`harness-details-dialog`,onClose:t,children:[(0,$.jsxs)(`header`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-${e.receipt.decision}`,children:e.receipt.decision.replaceAll(`_`,` `)}),(0,$.jsx)(`h2`,{children:n?.expectedOutcome??e.receipt.reason}),(0,$.jsx)(`p`,{children:e.receipt.reason})]}),(0,$.jsx)(`button`,{"aria-label":`Close change details`,onClick:t,type:`button`,children:(0,$.jsx)(Y,{size:16})})]}),(0,$.jsxs)(`div`,{className:`harness-details-dialog-body`,children:[n?.edits.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{children:`Exact edits`}),(0,$.jsx)(`div`,{className:`harness-edit-list`,children:n.edits.map(e=>(0,$.jsxs)(`article`,{className:`harness-edit`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[e.operation,` · `,e.target]}),(0,$.jsx)(`span`,{children:e.summary})]}),e.content===null?(0,$.jsx)(`p`,{children:`File deleted.`}):(0,$.jsx)(`pre`,{children:e.content})]},e.id))})]}):null,e.validations.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{children:`Validation`}),(0,$.jsx)(`div`,{className:`harness-validation-list`,children:e.validations.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`harness-validation-status ${e.status}`,children:e.status}),(0,$.jsx)(`strong`,{children:e.kind.replaceAll(`_`,` `)}),(0,$.jsx)(`span`,{children:e.summary})]},e.id))})]}):null]})]})}function li({history:e,reviewingProposalId:t,onReviewProposal:n}){let r=(0,Q.useMemo)(()=>[...e.changes.map(e=>({id:`change:${e.receipt.id}`,at:e.receipt.createdAt,kind:`Refiner`,title:e.proposal?.expectedOutcome??e.receipt.reason,detail:e.receipt.decision.replaceAll(`_`,` `)})),...e.routes.map(e=>({id:`route:${e.decision.id}`,at:e.decision.createdAt,kind:`Routed`,title:e.decision.reason,detail:e.decision.route})),...e.evaluationReviews.map(e=>({id:`review:${e.id}`,at:e.createdAt,kind:`Continuous Review`,title:e.claim?.statement??e.reason,detail:e.classification.replaceAll(`_`,` `)}))].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6),[e]);return(0,$.jsxs)(`div`,{className:`harness-page-sections`,children:[e.pendingReviews.length?(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Needs review`}),(0,$.jsx)(`p`,{children:`Sensitive or high-impact proposals require your approval.`})]}),(0,$.jsx)(`span`,{children:e.pendingReviews.length})]}),e.pendingReviews.map(e=>(0,$.jsx)(si,{busy:t!==null,onReview:n,review:e},`${e.proposal.id}:${e.proposal.contentHash}`))]}):null,(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Recent activity`}),(0,$.jsx)(`p`,{children:`The latest events from both learning loops.`})]}),(0,$.jsx)(`span`,{children:r.length})]}),r.length?(0,$.jsx)(`div`,{className:`harness-activity-list`,children:r.map(e=>(0,$.jsxs)(`article`,{children:[(0,$.jsx)(`span`,{children:e.kind}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.title}),(0,$.jsx)(`small`,{children:e.detail})]}),(0,$.jsx)(`time`,{children:ii(e.at)})]},e.id))}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Harness learning activity yet.`})]})]})}function ui({history:e,refiner:t,busyReleaseHash:n,onRequestRefinerRelease:r,onStartRefinerAuthoring:i,onOpenChangeDiff:a,onOpenSourceSession:o}){let[s,c]=(0,Q.useState)(null);return(0,$.jsxs)(`div`,{className:`harness-page-sections`,children:[(0,$.jsx)(ti,{busyReleaseHash:n,history:t,onRequestRelease:r,onStartAuthoring:i}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Applied changes`}),(0,$.jsx)(`p`,{children:`Every release transition with exact edits and validation receipts.`})]}),(0,$.jsx)(`span`,{children:e.changes.length})]}),e.changes.length?(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table harness-refiner-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Change`}),(0,$.jsx)(`th`,{children:`Target`}),(0,$.jsx)(`th`,{children:`Release`}),(0,$.jsx)(`th`,{children:`Created`}),(0,$.jsx)(`th`,{children:`Result`}),(0,$.jsx)(`th`,{children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:e.changes.map(e=>{let t=e.trigger?.runRef??null,n=e.proposal;return(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`strong`,{children:n?.expectedOutcome??e.receipt.reason})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:n?.edits[0]?.target??n?.route??`workspace`})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:ai(e.receipt.nextRelease?.contentHash)})}),(0,$.jsx)(`td`,{children:ii(e.receipt.createdAt)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status harness-status-${e.receipt.decision}`,children:e.receipt.decision.replaceAll(`_`,` `)})}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`harness-inline-actions`,children:[(0,$.jsx)(`button`,{"aria-label":`View evidence and exact edits`,className:`harness-table-icon-action`,onClick:()=>c(e),title:`View evidence and exact edits`,type:`button`,children:(0,$.jsx)(it,{size:14})}),e.receipt.nextRelease?(0,$.jsx)(`button`,{"aria-label":`View release diff`,className:`harness-table-icon-action`,onClick:()=>a(e),title:`View release diff`,type:`button`,children:(0,$.jsx)(m,{size:14})}):null,t&&o?(0,$.jsx)(`button`,{"aria-label":`Open source conversation`,className:`harness-table-icon-action`,onClick:()=>o(t),title:`Open source conversation`,type:`button`,children:(0,$.jsx)(le,{size:14})}):null]})})]},`${e.receipt.id}:${e.receipt.contentHash}`)})})]})}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Harness changes have been applied.`})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Routed recommendations`}),(0,$.jsx)(`p`,{children:`Observations sent to runtime, product, Tasksets, or training without mutating the Harness.`})]}),(0,$.jsx)(`span`,{children:e.routes.length})]}),e.routes.length?(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table harness-route-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Recommendation`}),(0,$.jsx)(`th`,{children:`Source evidence`}),(0,$.jsx)(`th`,{children:`Created`}),(0,$.jsx)(`th`,{children:`Route`})]})}),(0,$.jsx)(`tbody`,{children:e.routes.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`p`,{children:e.decision.reason})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`p`,{children:e.trigger?.reason??`Completed work`})}),(0,$.jsx)(`td`,{children:ii(e.decision.createdAt)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status`,children:e.decision.route})})]},`${e.decision.id}:${e.decision.contentHash}`))})]})}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No recommendations have been routed.`})]}),s?(0,$.jsx)(ci,{change:s,onClose:()=>c(null)}):null]})}function di(e){return e.includes(`/skills/`)||e.startsWith(`skills/`)?`Skill`:e.includes(`/agents/`)||e.startsWith(`agents/`)?`Agent`:e.includes(`memory`)?`Memory`:e.endsWith(`.md`)?`Instruction`:`File`}function fi(e){return e<1024?`${e} B`:`${(e/1024).toFixed(+(e<10240))} KB`}function pi({history:e,onOpenCurrentRelease:t}){let n=e.releases.find(e=>e.current)??e.releases[0]??null;return(0,$.jsxs)(`div`,{className:`harness-page-sections`,children:[(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Current release`}),(0,$.jsx)(`p`,{children:`Read-only source contents currently supplied by the Personal Harness.`})]}),n?(0,$.jsx)(`button`,{className:`settings-secondary compact`,onClick:t,type:`button`,children:`View release diff`}):null]}),n?.files.length?(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Type`}),(0,$.jsx)(`th`,{children:`Source`}),(0,$.jsx)(`th`,{children:`Size`}),(0,$.jsx)(`th`,{children:`Revision`})]})}),(0,$.jsx)(`tbody`,{children:n.files.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status`,children:di(e.path)})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:e.path})}),(0,$.jsx)(`td`,{children:fi(e.sizeBytes)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:ai(e.contentHash)})})]},e.id))})]})}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`The current release has no source files.`})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Memory`}),(0,$.jsx)(`p`,{children:`Bounded memory available through search; it is not copied into every prompt.`})]}),(0,$.jsx)(`span`,{children:e.memories.length})]}),(0,$.jsx)(`div`,{className:`harness-disclosure-list`,children:e.memories.length?e.memories.map(e=>(0,$.jsxs)(`details`,{className:`harness-disclosure-row`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(`span`,{className:`harness-status`,children:`Memory`}),(0,$.jsx)(`strong`,{children:e.key}),(0,$.jsxs)(`small`,{children:[`revision `,e.revision]}),(0,$.jsx)(`time`,{children:ii(e.updatedAt)})]}),(0,$.jsxs)(`div`,{className:`harness-disclosure-body`,children:[(0,$.jsx)(`p`,{children:e.content}),e.tags.length?(0,$.jsx)(`small`,{children:e.tags.join(` · `)}):null]})]},`${e.id}:${e.revision}`)):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Harness memory has been saved.`})})]})]})}function mi({busy:e,history:t,onOpenDiff:n,onRequestRollback:r}){return(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Release history`}),(0,$.jsx)(`p`,{children:`New work uses the current release; active runs stay pinned to the version they started with.`})]}),(0,$.jsx)(`span`,{children:t.releases.length})]}),t.releases.length?(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table harness-release-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Release`}),(0,$.jsx)(`th`,{children:`Contents`}),(0,$.jsx)(`th`,{children:`Created`}),(0,$.jsx)(`th`,{children:`Status`}),(0,$.jsx)(`th`,{children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:t.releases.map((i,a)=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`harness-release-identity`,children:[(0,$.jsx)(`strong`,{children:i.id}),(0,$.jsx)(`code`,{children:ai(i.contentHash)})]})}),(0,$.jsxs)(`td`,{children:[i.files.length,` files`]}),(0,$.jsx)(`td`,{children:ii(i.createdAt)}),(0,$.jsx)(`td`,{children:i.current?(0,$.jsx)(`span`,{className:`harness-current-pill`,children:`Current`}):(0,$.jsx)(`span`,{className:`harness-status`,children:`Previous`})}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`harness-inline-actions`,children:[(0,$.jsx)(`button`,{"aria-label":`View release changes`,className:`harness-table-icon-action`,onClick:()=>n(t.releases[a+1]??null,i),title:`View release changes`,type:`button`,children:(0,$.jsx)(m,{size:14})}),i.current?null:(0,$.jsx)(`button`,{"aria-label":`Roll back to release`,className:`harness-table-icon-action`,disabled:e,onClick:()=>r(i),title:`Roll back to release`,type:`button`,children:(0,$.jsx)(Oe,{size:14})})]})})]},`${i.id}:${i.contentHash}`))})]})}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Harness releases exist yet.`})]})}function hi({connection:e,enabled:t,onAcceptEvaluationReview:n,onError:r,onDefaultReleaseDiff:i,onOpenReleaseDiff:a,onOpenSourceSession:o,onStartRefinerAuthoring:s,onToast:c,page:l}){let[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),{confirmAction:O,confirmDialog:k,resolveConfirmDialog:A}=Fe(),j=!!(u?.evaluationReviewSchedule.activityEnabled||u?.evaluationReviewSchedule.enabled),[M,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{u&&N(u.backgroundReview.enabled)},[u?.backgroundReview.enabled]),(0,Q.useEffect)(()=>{F(j)},[j]);let I=(0,Q.useCallback)(async()=>{if(e){_(!0);try{let[t,n]=await Promise.all([Z.harnessHistory(e),Z.refinerHistory(e)]);d(t),p(n);let a=t.releases.findIndex(e=>e.current),o=a>=0?t.releases[a]:null;t.workspace&&o&&i(oi(t.workspace.id,t.releases[a+1]??null,o)),r(null)}catch(e){r(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[e,i,r]);(0,Q.useEffect)(()=>{t&&I()},[t,l,I]);let L=(0,Q.useCallback)(async t=>{if(e&&u?.workspace){T(!0);try{let n=await Z.reviewHarnessEvaluation(e,{workspaceId:u.workspace.id,maxEstimatedCostUsd:t});d(n.history),r(null),c?.(`Continuous Review completed: ${n.receipt.classification.replaceAll(`_`,` `)}.`,`success`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{T(!1)}}},[e,u,r,c]),R=(0,Q.useCallback)(async(t,n,i)=>{if(e&&u?.workspace){C(!0);try{let a=u;t===`refiner`&&n!==u.backgroundReview.enabled&&(a=(await Z.updateHarnessBackgroundReview(e,{workspaceId:u.workspace.id,enabled:n})).history);let o=u.evaluationReviewSchedule.activityEnabled||u.evaluationReviewSchedule.enabled;if(t===`continuous-review`&&(i!==o||u.evaluationReviewSchedule.enabled)){let t=u.evaluationReviewSchedule;a=(await Z.updateHarnessEvaluationReviewSchedule(e,{workspaceId:u.workspace.id,enabled:!1,activityEnabled:i,activityBatchSize:t.activityBatchSize,cadence:`manual`,maxEstimatedCostUsd:t.maxEstimatedCostUsd})).history}d(a),r(null),c?.(`${t===`refiner`?`Refiner`:`Continuous Review`} settings applied.`,`success`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{C(!1)}}},[e,u,r,c]),ee=(0,Q.useCallback)(async e=>{if(u?.workspace){D(e.id);try{await n(u.workspace.id,{id:e.id,contentHash:e.contentHash})&&(r(null),c?.(`Taskset review opened in Models.`,`success`))}catch(e){r(e instanceof Error?e.message:String(e))}finally{D(null)}}},[u?.workspace,n,r,c]),te=(0,Q.useCallback)((e,t)=>{u?.workspace&&a(oi(u.workspace.id,e,t))},[u?.workspace,a]),ne=(0,Q.useCallback)(e=>{u?.workspace&&e.receipt.nextRelease&&a({workspaceId:u.workspace.id,baseRelease:e.receipt.previousRelease,targetRelease:e.receipt.nextRelease,title:e.proposal?.expectedOutcome??e.receipt.reason})},[u?.workspace,a]),z=(0,Q.useCallback)(async t=>{if(e&&u?.workspace){y(t.contentHash);try{let n=await Z.rollbackHarness(e,{workspaceId:u.workspace.id,targetRelease:{id:t.id,contentHash:t.contentHash}});d(n.history),r(null),c?.(`Personal Harness rolled back. Existing runs remain pinned.`,`success`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{y(null)}}},[e,u?.workspace,r,c]),B=(0,Q.useCallback)(async e=>{await O({title:`Roll back Harness release?`,body:`New work will use ${ai(e.contentHash)}. Active runs remain pinned to their current release.`,confirmLabel:`Roll back`})&&await z(e)},[O,z]),V=(0,Q.useCallback)(async(t,n)=>{if(e&&await O({title:n===`activate`?`Activate Refiner release?`:`Roll back Refiner release?`,body:`Future reviews will use ${t.profile.name} at ${ai(t.contentHash)}. Existing work remains pinned.`,confirmLabel:n===`activate`?`Activate`:`Roll back`})){h(t.contentHash);try{let i={release:{id:t.id,contentHash:t.contentHash},reason:`${n===`activate`?`Activate`:`Rollback`} from Settings to ${t.profile.id}@${t.profile.version}.`,actor:`settings-user`};p(await(n===`activate`?Z.activateRefinerRelease(e,i):Z.rollbackRefinerRelease(e,i))),r(null),c?.(`Refiner ${n===`activate`?`activated`:`rolled back`}. Existing work remains pinned.`,`success`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{h(null)}}},[O,e,r,c]),re=(0,Q.useCallback)(async(t,n)=>{if(e&&u?.workspace){x(t.proposal.id);try{let i=await Z.reviewHarnessProposal(e,{workspaceId:u.workspace.id,proposal:{id:t.proposal.id,contentHash:t.proposal.contentHash},decision:n});d(i.history),r(null),c?.(n===`approve`?`Harness proposal approved and released.`:`Harness proposal declined.`,n===`approve`?`success`:`info`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{x(null)}}},[e,u?.workspace,r,c]),H=u?.releases.find(e=>e.current)??u?.releases[0]??null,U=H?u?.releases.indexOf(H)??-1:-1,W=ri[l],G=u?l===`refiner`?M!==u.backgroundReview.enabled:P!==j||u.evaluationReviewSchedule.enabled:!1,ie=l===`refiner`||l===`continuous-review`;return(0,$.jsxs)(`section`,{className:`account-settings harness-history-settings`,"aria-labelledby":`harness-history-title`,children:[(0,$.jsxs)(`div`,{className:`account-settings-title harness-page-title`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{id:`harness-history-title`,children:W.title}),(0,$.jsx)(`p`,{children:W.description})]}),u?.workspace&&ie?(0,$.jsxs)(`div`,{className:`harness-page-header-actions`,children:[l===`continuous-review`?(0,$.jsx)(`button`,{className:`settings-secondary compact`,disabled:w,onClick:()=>void L(u.evaluationReviewSchedule.maxEstimatedCostUsd),type:`button`,children:w?`Reviewing…`:`Review now`}):null,(0,$.jsxs)(`label`,{className:`harness-page-toggle`,children:[(0,$.jsx)(`span`,{children:l===`refiner`?M?`On`:`Off`:P?`On`:`Off`}),(0,$.jsxs)(`span`,{className:`provider-toggle`,children:[(0,$.jsx)(`input`,{"aria-label":l===`refiner`?`Enable Refiner`:`Enable Continuous Review`,checked:l===`refiner`?M:P,disabled:S,onChange:e=>l===`refiner`?N(e.target.checked):F(e.target.checked),type:`checkbox`}),(0,$.jsx)(`span`,{"aria-hidden":`true`})]})]}),(0,$.jsx)(`button`,{className:`settings-primary compact`,disabled:S||!G,onClick:()=>void R(l,M,P),type:`button`,children:S?`Applying…`:`Apply changes`})]}):null]}),e?null:(0,$.jsx)(`div`,{className:`harness-empty`,children:`Connect to the Local OpenPond server to inspect the Harness.`}),e&&g&&!u?(0,$.jsx)(`div`,{className:`harness-empty`,children:`Loading Harness history…`}):null,u&&!u.workspace?(0,$.jsx)(`div`,{className:`harness-empty`,children:`No Personal Harness workspace has been created yet.`}):null,u?.workspace&&l===`overview`?(0,$.jsx)(li,{history:u,onReviewProposal:re,reviewingProposalId:b}):null,u&&f&&l===`refiner`?(0,$.jsx)(ui,{busyReleaseHash:m,history:u,refiner:f,onOpenChangeDiff:ne,onOpenSourceSession:o,onRequestRefinerRelease:(e,t)=>void V(e,t),onStartRefinerAuthoring:s}):null,u?.workspace&&l===`continuous-review`?(0,$.jsx)(Zr,{acceptingReviewId:E,candidates:u.refinementCandidates,onAcceptTasksetReview:e=>void ee(e),qualifications:u.modelImprovementQualifications,reviews:u.evaluationReviews,schedule:u.evaluationReviewSchedule??ni}):null,u?.workspace&&l===`contents`?(0,$.jsx)(pi,{history:u,onOpenCurrentRelease:()=>{H&&te(U>=0?u.releases[U+1]??null:null,H)}}):null,u?.workspace&&l===`releases`?(0,$.jsx)(mi,{busy:v!==null,history:u,onOpenDiff:te,onRequestRollback:e=>void B(e)}):null,(0,$.jsx)(Je,{onResolve:A,state:k})]})}function gi(e){return e?e.slice(0,10):`initial`}function _i({connection:e,expanded:t,onResizeStart:n,onToggleExpanded:r,selection:i}){let[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!0),d=(0,Q.useCallback)(async()=>{c(null),u(!0);try{o(await Z.harnessReleaseDiff(e,i))}catch(e){o(null),c(e instanceof Error?e.message:String(e))}finally{u(!1)}},[e,i]);(0,Q.useEffect)(()=>{d()},[d]);let f=(0,Q.useMemo)(()=>a?{appId:`harness:${i.workspaceId}`,repoPath:i.title,initialized:!0,dirty:a.filesChanged>0,filesChanged:a.filesChanged,additions:a.additions,deletions:a.deletions,repoFiles:a.files.map(e=>e.path),files:a.files,error:null,updatedAt:``}:null,[a,i.title,i.workspaceId]),p=`${i.title} · ${gi(i.baseRelease?.contentHash)} → ${gi(i.targetRelease.contentHash)}`;return(0,$.jsx)(h,{appId:`harness:${i.workspaceId}`,workspaceId:`harness:${i.targetRelease.contentHash}`,workspaceKind:`local_project`,connection:e,diff:f,editorPreferences:null,expanded:t,filesWithPreview:!0,loading:l,onOpenBrowserUrl:()=>void 0,onRefresh:d,onResizeStart:n,onToggleExpanded:r,readOnly:!0,workspaceError:s,workspaceInitialized:!0,workspaceName:p})}function vi({connection:e,onError:t,onPreferences:n,preferences:r,providers:i}){let[a,o]=(0,Q.useState)(r.defaultBranchPrefix),[s,c]=(0,Q.useState)(r.defaultNewProjectDirectory),[l,u]=(0,Q.useState)(r.advancedWorkspaceControls),[d,f]=(0,Q.useState)(r.steerActiveResponses),[p,m]=(0,Q.useState)(r.contextCompaction.autoEnabled),[h,g]=(0,Q.useState)(r.subagents.enabled),[_,v]=(0,Q.useState)(r.subagents.delegationMode),[y,x]=(0,Q.useState)(!r.subagents.defaultModelRef),[S,C]=(0,Q.useState)(r.subagents.defaultModelRef?.providerId??r.defaultChatProvider),[w,T]=(0,Q.useState)(r.subagents.defaultModelRef?.modelId??r.defaultChatModel),[E,D]=(0,Q.useState)(r.subagents.roles),[A,j]=(0,Q.useState)(r.subagents.maxConcurrentRuns),[M,N]=(0,Q.useState)(r.subagents.maxConcurrentRunsPerProvider),[P,F]=(0,Q.useState)(r.subagents.maxConcurrentRunsPerWorkspaceTarget),[I,L]=(0,Q.useState)(!1),R=y?null:{providerId:S,modelId:w.trim()},ee=h!==r.subagents.enabled||_!==r.subagents.delegationMode||!bi(R,r.subagents.defaultModelRef)||A!==r.subagents.maxConcurrentRuns||M!==r.subagents.maxConcurrentRunsPerProvider||P!==r.subagents.maxConcurrentRunsPerWorkspaceTarget||JSON.stringify(E)!==JSON.stringify(r.subagents.roles);(0,Q.useEffect)(()=>{o(r.defaultBranchPrefix),c(r.defaultNewProjectDirectory),u(r.advancedWorkspaceControls),f(r.steerActiveResponses),m(r.contextCompaction.autoEnabled),g(r.subagents.enabled),v(r.subagents.delegationMode),x(!r.subagents.defaultModelRef),C(r.subagents.defaultModelRef?.providerId??r.defaultChatProvider),T(r.subagents.defaultModelRef?.modelId??r.defaultChatModel),D(r.subagents.roles),j(r.subagents.maxConcurrentRuns),N(r.subagents.maxConcurrentRunsPerProvider),F(r.subagents.maxConcurrentRunsPerWorkspaceTarget)},[r.defaultChatProvider,r.defaultChatModel,r.defaultBranchPrefix,r.defaultNewProjectDirectory,r.advancedWorkspaceControls,r.steerActiveResponses,r.contextCompaction.autoEnabled,r.subagents]);function te(e){C(e),T(t=>b(e,t,i))}function ne(){return y?r.defaultChatProvider:S}function z(){return y?r.defaultChatModel:w}function B(e,t){D(n=>n.map(n=>n.id===e?t(n):n))}function V(e,t){B(e,e=>({...e,enabled:t}))}function re(e,t){B(e,e=>({...e,background:t}))}function H(e,t){B(e,e=>{if(t)return{...e,modelRef:null};let n=e.modelRef?.providerId??ne(),r=e.modelRef?.modelId??z();return{...e,modelRef:k(n,r,i)??null}})}function U(e,t){B(e,e=>({...e,modelRef:k(t,e.modelRef?.modelId??z(),i)??null}))}function W(e,t){B(e,e=>{let n=e.modelRef?.providerId??ne(),r=t.trim();return{...e,modelRef:r?{providerId:n,modelId:r}:null}})}function G(e,t){B(e,e=>({...e,isolationMode:t}))}function ie(e,t){B(e,e=>({...e,toolPolicy:t}))}function ae(e,t){B(e,e=>({...e,peerMessages:t}))}function K(e,t){B(e,e=>({...e,maxConcurrentRuns:yi(t,1,16)}))}async function oe(){let e=null;if(window.openpond?.selectFolder){let t=await window.openpond.selectFolder();if(t.canceled)return;e=t.path}else e=window.prompt(`Default new project directory`,s);e?.trim()&&c(e.trim())}async function se(o){if(o.preventDefault(),e){L(!0),t(null);try{n(await Z.savePreferences(e,{defaultBranchPrefix:O(a),defaultNewProjectDirectory:s.trim(),advancedWorkspaceControls:l,steerActiveResponses:d,contextCompaction:{...r.contextCompaction,autoEnabled:p},subagents:{enabled:h,workspaceDefaultsVersion:r.subagents.workspaceDefaultsVersion,toolDefaultsVersion:r.subagents.toolDefaultsVersion,delegationMode:_,defaultModelRef:y?null:k(S,w,i)??null,roles:E,maxConcurrentRuns:yi(A,1,32),maxConcurrentRunsPerProvider:M===null?null:yi(M,1,32),maxConcurrentRunsPerWorkspaceTarget:P===null?null:yi(P,1,32)}}))}catch(e){t(e instanceof Error?e.message:String(e))}finally{L(!1)}}}return{advancedWorkspaceControls:l,steerActiveResponses:d,contextCompactionAutoEnabled:p,defaultBranchPrefix:a,defaultNewProjectDirectory:s,subagentsEnabled:h,subagentDelegationMode:_,subagentsUseDefaultModel:y,subagentsProvider:S,subagentsModel:w,subagentRoles:E,subagentsMaxConcurrentRuns:A,subagentsMaxConcurrentRunsPerProvider:M,subagentsMaxConcurrentRunsPerWorkspaceTarget:P,subagentsDirty:ee,saving:I,chooseDefaultProjectDirectory:oe,saveDefaults:se,changeSubagentsProvider:te,changeSubagentRoleProvider:U,setAdvancedWorkspaceControls:u,setSteerActiveResponses:f,setContextCompactionAutoEnabled:m,setDefaultBranchPrefix:o,setDefaultNewProjectDirectory:c,setSubagentsUseDefaultModel:x,setSubagentsModel:T,setSubagentsEnabled:g,setSubagentDelegationMode:e=>v(e),setSubagentsMaxConcurrentRuns:e=>j(yi(e,1,32)),setSubagentsMaxConcurrentRunsPerProvider:e=>N(e===null?null:yi(e,1,32)),setSubagentsMaxConcurrentRunsPerWorkspaceTarget:e=>F(e===null?null:yi(e,1,32)),setSubagentRoleBackground:re,setSubagentRoleEnabled:V,setSubagentRoleIsolationMode:G,setSubagentRoleMaxConcurrentRuns:K,setSubagentRoleModel:W,setSubagentRolePeerMessages:ae,setSubagentRoleToolPolicy:ie,setSubagentRoleUseDefaultModel:H}}function yi(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,Math.trunc(e))):t}function bi(e,t){return(e?.providerId??null)===(t?.providerId??null)&&(e?.modelId??null)===(t?.modelId??null)}var xi=15e3,Si=100,Ci=100,wi=2500;function Ti({onError:e,section:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(Si),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!0),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(null),_=!!(window.openpond?.openLogsFolder||window.openpond?.readRecentLogs||window.openpond?.copyRecentLogs||window.openpond?.exportDiagnostics),v=window.openpond?.readRecentLogs?`${c.length} of ${o} line${o===1?``:`s`}${f?` tailing`:``}`:`Unavailable`;(0,Q.useEffect)(()=>{t===`diagnostics`&&y(o,`refresh`,{quiet:!0})},[t]),(0,Q.useEffect)(()=>{if(t!==`diagnostics`||!f||!window.openpond?.readRecentLogs)return;let e=!1,n=window.setInterval(()=>{e||(e=!0,y(o,`refresh`,{quiet:!0}).finally(()=>{e=!1}))},wi);return()=>window.clearInterval(n)},[t,f,o]),(0,Q.useEffect)(()=>{if(t!==`diagnostics`||!f)return;let e=m.current;e&&(e.scrollTop=e.scrollHeight)},[t,f,c]);async function y(t=o,n=`refresh`,r={}){let i=window.openpond?.readRecentLogs;if(i){r.quiet||a(n);try{let e=await Ei(i(t),`Read logs`);if(!e.ok)throw Error(e.error);s(e.lineLimit),d(e.logDir),l(e.lines),r.quiet?g(e=>e?.label===`Logs`?null:e):g(null)}catch(t){let n=t instanceof Error?t.message:String(t);g({label:`Logs`,value:n,warning:!0}),r.quiet||e(n)}finally{r.quiet||a(null)}}else{let t=`Log view is not available in this runtime.`;r.quiet||(g({label:`Logs`,value:t,warning:!0}),e(t))}}function b(){p(!1),y(o+Ci,`older`)}function x(){let e=!f;p(e),e&&y(o,`refresh`,{quiet:!0})}async function S(){let t=window.openpond?.openLogsFolder;if(t){r(`logs`),e(null);try{let e=await Ei(t(),`Open logs`);if(!e.ok)throw Error(e.error??`Could not open the logs folder.`);g(null)}catch(t){let n=t instanceof Error?t.message:String(t);g({label:`Logs`,value:n,warning:!0}),e(n)}finally{r(null)}}else{let t=`Desktop logs are not available in this runtime.`;g({label:`Logs`,value:t,warning:!0}),e(t)}}async function C(){let t=window.openpond?.copyRecentLogs;if(t){r(`copy`),e(null);try{let e=await Ei(t(1e3),`Copy recent logs`);if(!e.ok)throw Error(e.error??`Could not copy recent logs.`);g({label:`Copy`,value:e.lines?`Copied ${e.lines} recent log lines.`:`Copied recent logs.`})}catch(t){let n=t instanceof Error?t.message:String(t);g({label:`Copy`,value:n,warning:!0}),e(n)}finally{r(null)}}else{let t=`Recent log copy is not available in this runtime.`;g({label:`Copy`,value:t,warning:!0}),e(t)}}async function w(){let t=window.openpond?.exportDiagnostics;if(t){r(`export`),e(null);try{let e=await Ei(t(),`Export diagnostics`);if(!e.ok)throw Error(e.error??`Could not export diagnostics.`);g({label:`Export`,value:e.path?`Saved to ${e.path}`:`Diagnostics exported.`})}catch(t){let n=t instanceof Error?t.message:String(t);g({label:`Export`,value:n,warning:!0}),e(n)}finally{r(null)}}else{let t=`Diagnostics export is not available in this runtime.`;g({label:`Export`,value:t,warning:!0}),e(t)}}return{diagnosticsAvailable:_,diagnosticsBusy:n,diagnosticsStatus:h,logDir:u,logLineLimit:o,logLines:c,logViewBusy:i,logViewSummary:v,logViewportRef:m,tailLogs:f,copyRecentLogs:C,exportDiagnosticsBundle:w,loadOlderLogs:b,openLogsFolder:S,refreshLogView:y,toggleTailLogs:x}}async function Ei(e,t){let n;try{return await Promise.race([e,new Promise((e,r)=>{n=window.setTimeout(()=>{r(Error(`${t} did not receive a desktop response.`))},xi)})])}finally{n!==void 0&&window.clearTimeout(n)}}function Di({connection:e,enabled:t,onError:n,onPreferences:r,onToast:i,preferences:a}){let[o,s]=(0,Q.useState)(a.editor),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{s(a.editor)},[a.editor]);let g=(0,Q.useCallback)(async()=>{if(e){p(!0);try{l(await Z.workspaceLspSettingsStatus(e))}catch(e){n(e instanceof Error?e.message:String(e))}finally{p(!1)}}},[e,n]);(0,Q.useEffect)(()=>{t&&e&&g()},[e,t,g]);function _(e,t){s(n=>({...n,languages:{...n.languages,[e]:{...n.languages[e],mode:t}}}))}function v(e,t){s(n=>({...n,languages:{...n.languages,[e]:{...n.languages[e],customCommand:t}}}))}async function y(t){if(t.preventDefault(),e){d(!0),n(null);try{r(await Z.savePreferences(e,{editor:o})),l(await Z.workspaceLspSettingsStatus(e))}catch(e){n(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function b(){if(e){h(!0),n(null);try{await Z.restartWorkspaceLsp(e),l(await Z.workspaceLspSettingsStatus(e)),i?.(`Language servers restarted.`,`success`)}catch(e){n(e instanceof Error?e.message:String(e))}finally{h(!1)}}}return{editorPreferences:o,lspStatus:c,restarting:m,saving:u,statusLoading:f,refreshLspStatus:g,restartLanguageServers:b,saveEditorSettings:y,setEditorPreferences:s,setLanguageCustomCommand:v,setLanguageMode:_}}function Oi({connection:e,onError:t,onPayload:n,personalization:r}){let i=(0,Q.useMemo)(()=>r.templates.map(e=>({value:e.id,label:e.name,description:e.id===r.activeTemplateId?`Selected`:e.source===`built_in`?e.description:void 0})),[r.activeTemplateId,r.templates]),[a,o]=(0,Q.useState)(r.activeTemplateId),[s,c]=(0,Q.useState)(r.soul),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=r.templates.find(e=>e.id===a)??r.templates[0],g=h?.source===`custom`,_=!h||s!==h.content,v=a!==r.activeTemplateId||s!==r.soul||_,y=!!(g&&s.trim()&&h&&v);(0,Q.useEffect)(()=>{o(r.activeTemplateId),c(r.soul);let e=r.templates.find(e=>e.id===r.activeTemplateId);u(e?`${e.name} Copy`:``),f(!1)},[r.activeTemplateId,r.soul,r.templates]);async function b(r=!1){if(!r&&!g)return;let i=r?l:h?.name;if(e&&s.trim()&&i?.trim()){m(!0),t(null);try{n(await Z.savePersonalization(e,{activeTemplateId:a,templateName:i,soul:s,saveAsNew:r})),f(!1)}catch(e){t(e instanceof Error?e.message:String(e))}finally{m(!1)}}}async function x(i){let a=r.templates.find(e=>e.id===i);if(a&&(o(a.id),u(`${a.name} Copy`),c(a.content),f(!1),e)){m(!0),t(null);try{n(await Z.savePersonalization(e,{activeTemplateId:a.id,templateName:a.name,soul:a.content,saveAsNew:!1}))}catch(e){t(e instanceof Error?e.message:String(e))}finally{m(!1)}}}function S(){h&&(u(`${h.name} Copy`),c(h.content),f(!1))}function C(e){c(e),h&&!g&&e!==h.content&&f(!0)}function w(){h&&(u(`${h.name} Copy`),f(!0))}return{canSaveCurrentTemplate:y,personalizationTemplateId:a,personalizationTemplateOptions:i,saveAsNewOpen:d,saving:p,selectedPersonalizationTemplate:h,selectedTemplateIsCustom:g,soulDraft:s,templateNameDraft:l,changePersonalizationTemplate:x,changeSoulDraft:C,openSaveAsNew:w,resetPersonalizationDraft:S,savePersonalization:b,setSaveAsNewOpen:f,setTemplateNameDraft:u}}function ki({connection:e,enabled:t,onError:n,onToast:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(null),d=(0,Q.useCallback)(async(t={})=>{if(e){t.quiet||s(`refresh`);try{let t=await Z.remoteAccess(e);a(t),n(null)}catch(e){n(e instanceof Error?e.message:String(e))}finally{t.quiet||s(null)}}},[e,n]);(0,Q.useEffect)(()=>{t&&e&&d({quiet:!0})},[e,t,d]),(0,Q.useEffect)(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]);function f(){u.current!==null&&window.clearTimeout(u.current),l(!1),window.setTimeout(()=>{l(!0),u.current=window.setTimeout(()=>{l(!1),u.current=null},1500)},0)}async function p(){if(n(null),e)try{a(await Z.remoteAccess(e))}catch{}}async function m(){if(!e)return null;i&&!i.tailscale.running&&f(),s(`enable`);try{let t=await Z.enableRemoteAccess(e);return a(t.status),n(null),t.status.tailscale.running?!t.status.serve.enabled&&t.status.serve.error&&r?.(t.status.serve.setupUrl?`Tailscale Serve needs to be enabled for this tailnet. Copy the Enable Serve link.`:t.message||t.status.serve.error,`error`):(f(),r?.(t.message||`Tailscale is not running. Run Tailscale up first.`,`error`)),t.status}catch{return await p(),f(),r?.(`Unable to turn on remote access. Run Tailscale up first.`,`error`),null}finally{s(null)}}async function h(){if(e&&window.confirm(`Turn off remote access? This runs tailscale serve reset and clears Tailscale Serve config on this device.`)){s(`disable`);try{let t=await Z.disableRemoteAccess(e);a(t.status),n(null)}catch{await p()}finally{s(null)}}}async function g(){i?.remoteWebUrl&&(s(`copy-link`),await F(i.remoteWebUrl),s(null))}async function _(){i?.serveCommand&&(s(`copy-command`),await F(i.serveCommand),s(null))}async function v(){i?.serve.setupUrl&&(s(`copy-serve-setup`),await F(i.serve.setupUrl),s(null))}async function y(){i?.tailscaleUpCommand&&(s(`copy-up-command`),await F(i.tailscaleUpCommand),s(null))}async function b(){i?.operatorCommand&&(s(`copy-operator`),await F(i.operatorCommand),s(null))}async function x(){if(i?.serve.enabled)await g();else{let e=await m();e?.serve.enabled&&e.remoteWebUrl&&await F(e.remoteWebUrl)}}return{status:i,busy:o,flashTailscaleUp:c,refresh:d,enableRemoteAccess:m,disableRemoteAccess:h,copyRemoteLink:g,copyTailscaleUpCommand:y,copyServeCommand:_,copyServeSetupUrl:v,copyOperatorCommand:b,createRemoteLink:x}}function Ai(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),a=(0,Q.useCallback)(async()=>{if(e.connection){i(`load`);try{n(await Z.datasetStorageState(e.connection)),e.onError(null)}catch(t){e.onError(t instanceof Error?t.message:String(t))}finally{i(null)}}},[e.connection,e.onError]),o=(0,Q.useCallback)(async t=>{if(!e.connection||!t)return!1;i(`save`);try{return n(await Z.updateDatasetStorage(e.connection,t)),e.onError(null),!0}catch(t){return e.onError(t instanceof Error?t.message:String(t)),!1}finally{i(null)}},[e.connection,e.onError]);return(0,Q.useEffect)(()=>{e.enabled&&a()},[e.enabled,a]),{state:t,busy:r,refresh:a,save:o}}function ji(e){let{connection:t,enabled:n,onError:r,profileId:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=(0,Q.useCallback)(async()=>{if(t){c(!0);try{o(await Z.datasetCatalog(t,i)),r(null)}catch(e){r(Mi(e))}finally{c(!1)}}},[t,r,i]);return(0,Q.useEffect)(()=>{n&&l()},[n,l]),{catalog:a,loading:s,refresh:l}}function Mi(e){return e instanceof Error?e.message:String(e)}var Ni=new Set([`harness`,`harness-refiner`,`harness-continuous-review`,`harness-contents`,`harness-releases`]);function Pi(e){return e===`harness-refiner`?`refiner`:e===`harness-continuous-review`?`continuous-review`:e===`harness-contents`?`contents`:e===`harness-releases`?`releases`:`overview`}var Fi=(0,Q.lazy)(()=>i(()=>import(`./ConversationImportsSettings-DCmiakbZ.js`).then(e=>({default:e.ConversationImportsSettings})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54]))),Ii=(0,Q.lazy)(()=>i(()=>import(`./UsageSettingsSection-CzDqxOYM.js`).then(e=>({default:e.UsageSettingsSection})),__vite__mapDeps([55,1,2,3,29,36,56,42,49,9,10,11,12,13,14,4,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30,31,32,33,34,35,37,38,39,40,41,43,44,45,46,47,48,5,6,7,8,50,51,52,57])));function Li({payload:e,connection:t,diagnostics:n,onPayload:r,onError:i,onToast:a,onBack:o,onOpenSourceSession:s,onStartRefinerAuthoring:c,onAcceptEvaluationReview:l,onOpenSkill:u,onOpenExtension:d,teamChatCurrentUserId:f,teamChatEnabled:p,teamChatNotificationMode:m,teamChatThreads:h,onTeamChatNotificationModeChange:g,onTeamChatThreadMuteChange:v,diffPanelWidth:y,diffPanelResizing:b,diffPanelExpanded:x,onDiffPanelResizeStart:S,onDiffPanelExpandedChange:C,initialSection:T=`account`}){let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),M=e?.codex??null,N=(0,Q.useMemo)(()=>_(e?.preferences),[e?.preferences]),P=e?.personalization??w,F=n??e?.diagnostics??[],I=Se()&&_e(t?.platform),L=(0,Q.useCallback)(t=>{e&&r({...e,providers:t})},[r,e]),R=(0,Q.useCallback)(t=>{e&&r({...e,preferences:t.preferences})},[r,e]),ee=(0,Q.useCallback)(t=>{e&&r({...e,extensionCatalog:t})},[r,e]),te=Ze({connection:t,onError:i,onPayload:r}),ne=se({connection:t,onError:i,onPayload:r,onPreferences:R,onProviders:L,preferences:N,providers:e?.providers??null}),z=vi({connection:t,onError:i,onPayload:r,onPreferences:R,preferences:N,providers:e?.providers??null}),B=Di({connection:t,enabled:E===`editor`,onError:i,onPayload:r,onPreferences:R,onToast:a,preferences:N}),V=Oi({connection:t,onError:i,onPayload:r,personalization:P}),re=Ti({onError:i,section:E}),H=ki({connection:t,enabled:E===`remote`,onError:i,onToast:a}),U=E===`dataset-storage`,W=Ai({connection:t,enabled:U,onError:i}),G=ji({connection:t,enabled:U,onError:i,profileId:e?.profile.activeProfile??`default`}),ie=W.save,ae=(0,Q.useCallback)(async()=>{await Promise.all([W.refresh(),G.refresh()])},[W.refresh,G.refresh]),K=(0,Q.useCallback)(()=>E!==`subagents`||!z.subagentsDirty||window.confirm(`You have unsaved changes. Leave Subagents without saving?`),[z.subagentsDirty,E]),ce=(0,Q.useCallback)(e=>{e!==E&&K()&&(j(!1),C(!1),D(e),ye({kind:`settings`,section:e}))},[K,C,E]),le=(0,Q.useCallback)(()=>{K()&&(j(!1),C(!1),o())},[K,o,C]);(0,Q.useEffect)(()=>{D(T)},[T]),(0,Q.useEffect)(()=>{if(E!==`subagents`||!z.subagentsDirty)return;let e=e=>{e.preventDefault(),e.returnValue=`You have unsaved changes.`};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[z.subagentsDirty,E]);let ue={"--diff-panel-width":`${y}px`},q=Ni.has(E),J=q&&A&&O,de=JSON.stringify([e?.profile.activeProfile,e?.account.activeProfile,e?.account.baseUrl,e?.account.apiBaseUrl,e?.account.profile?.id,e?.account.state,e?.preferences.defaultTeamId??null]);return(0,$.jsxs)(`div`,{className:`settings-shell ${I?`platform-macos`:``} ${J?`harness-diff-open`:``} ${x?`harness-diff-expanded`:``} ${b?`diff-panel-resizing`:``}`,style:ue,children:[(0,$.jsx)(`div`,{className:`settings-drag-region`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`settings-window-controls`,children:[q?(0,$.jsx)(`button`,{type:`button`,className:`topbar-diff-button ${J?`active`:``}`,title:`${J?`Hide`:`Show`} sidebar`,"aria-label":`${J?`Hide`:`Show`} sidebar`,"aria-pressed":!!J,disabled:!O,onClick:()=>j(e=>!e),children:(0,$.jsx)(Ge,{size:16})}):null,(0,$.jsx)(Ye,{platform:t?.platform})]}),(0,$.jsx)(gr,{section:E,onBack:le,onSectionChange:ce}),(0,$.jsxs)(`main`,{className:`settings-content ${E===`profile`||q?`settings-content-wide`:``}`,children:[E===`configuration`?null:(0,$.jsx)(gt,{connection:t,bannerOnly:!0,onOpen:()=>ce(`configuration`)}),E===`appearance`?(0,$.jsx)(ht,{}):E===`account`?(0,$.jsx)(Tt,{payload:e,connection:t,onPayload:r,onPreferences:R,onError:i,onToast:a,...te}):E===`ponder`?(0,$.jsx)(pt,{connection:t},JSON.stringify([e?.account.activeProfile,e?.account.baseUrl,e?.account.profile?.id,e?.account.state,e?.preferences.defaultTeamId])):E===`notifications`?(0,$.jsx)(nn,{currentUserId:f,enabled:p,mode:m,threads:h,onModeChange:g,onThreadMuteChange:v}):q?(0,$.jsx)(hi,{connection:t,enabled:q,onAcceptEvaluationReview:l,onError:i,onDefaultReleaseDiff:k,onOpenSourceSession:s,onStartRefinerAuthoring:c,onOpenReleaseDiff:e=>{k(e),j(!0)},onToast:a,page:Pi(E)}):E===`profile`?(0,$.jsx)(Vn,{payload:e,connection:t,onPayload:r,onError:i,onToast:a,onOpenSession:s}):E===`skills`?(0,$.jsx)(yr,{personalSkills:e?.codexPersonalSkills??[],builtInSkills:e?.builtInSkills??[],extensionCatalog:e?.extensionCatalog??{rootPath:``,registryPath:``,extensions:[],error:null},connection:t,onExtensionCatalog:ee,onError:i,onToast:a,onOpenSkill:u,onOpenExtension:d}):E===`providers`?(0,$.jsx)(oe,{onProvidersChanged:L,connection:t,account:e?.account??null,codex:M,providers:e?.providers??null,...ne}):E===`conversation-imports`?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`p`,{role:`status`,children:`Loading conversation imports…`}),children:(0,$.jsx)(Fi,{connection:t})}):E===`dataset-storage`?(0,$.jsx)(Fr,{state:W.state,catalog:G.catalog,busy:W.busy,catalogLoading:G.loading,onRefresh:ae,onSave:ie}):E===`configuration`?(0,$.jsxs)(`div`,{className:`settings-stacked-sections configuration-page`,children:[(0,$.jsx)(gt,{connection:t,onSaved:async()=>{t&&r(await Z.bootstrap(t))}}),(0,$.jsx)(Nt,{preferences:N,...z}),(0,$.jsx)(Ut,{embedded:!0,preferences:N,...z})]}):E===`context`?(0,$.jsx)(Ut,{preferences:N,...z}):E===`training`?(0,$.jsx)(xr,{connection:t,onError:i,onPreferences:R,preferences:N,providers:e?.providers??null}):E===`subagents`?(0,$.jsx)(Wt,{preferences:N,providers:e?.providers??null,...z}):E===`editor`?(0,$.jsx)(Vt,{preferences:N,...B}):E===`remote`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mr,{connection:t,onError:i},de),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Direct Tailscale access`}),(0,$.jsx)(ir,{...H})]})]}):E===`usage`?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`usage-load-state`,children:`Loading activity…`}),children:(0,$.jsx)(Ii,{account:e?.account??null,connection:t,enabled:E===`usage`,onError:i,onOpenSourceSession:s})}):E===`personalization`?(0,$.jsx)(an,{...V}):(0,$.jsx)(Pt,{diagnostics:F,...re})]}),q&&t&&J?(0,$.jsx)(_i,{connection:t,expanded:x,onResizeStart:S,onToggleExpanded:()=>C(!x),selection:J}):null]})}export{Li as SettingsView};
|
|
5
|
+
`,onChange:e=>{o===null&&l(i?.rawRevision??null),s(e.target.value)}}),o!==null&&i?.rawRevision!==c?(0,$.jsx)(X,{error:`The file changed elsewhere. Reload before saving your edits.`}):null,(0,$.jsxs)(`div`,{className:`configuration-actions`,children:[(0,$.jsx)(`button`,{type:`button`,disabled:y||!i,onClick:()=>void T(`validate`),children:`Validate`}),(0,$.jsx)(`button`,{type:`button`,disabled:y||!i||o!==null&&i.rawRevision!==c,onClick:()=>void T(`replace`),children:`Save config`}),(0,$.jsx)(`button`,{type:`button`,disabled:y,onClick:()=>{s(null),l(null),v(null),w().catch(e=>v(String(e)))},children:`Reload file`})]}),i?.recoverableRevisions.length?(0,$.jsxs)(`label`,{children:[`Restore a verified revision `,(0,$.jsxs)(`select`,{value:``,disabled:y,onChange:e=>{e.target.value&&T(`restore`,e.target.value)},children:[(0,$.jsx)(`option`,{value:``,children:`Choose a revision…`}),i.recoverableRevisions.map(e=>(0,$.jsxs)(`option`,{value:e.revision,children:[new Date(e.createdAt).toLocaleString(),` · `,e.revision.slice(0,12)]},e.revision))]})]}):null,i?.effective?(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Effective values and sources`}),(0,$.jsxs)(`table`,{children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Setting`}),(0,$.jsx)(`th`,{children:`Source`}),(0,$.jsx)(`th`,{children:`Location`})]})}),(0,$.jsx)(`tbody`,{children:Object.entries(i.effective.provenance).map(([e,t])=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:JSON.parse(e).join(`.`)}),(0,$.jsx)(`td`,{children:t.layer===`user`?`Set here`:`Inherited from ${t.layer}`}),(0,$.jsx)(`td`,{children:t.path})]},e))})]}),(0,$.jsx)(`pre`,{children:JSON.stringify(i.effective.document,null,2)})]}):null]}),h?(0,$.jsx)(`p`,{role:`status`,children:h}):null]})}function _t({handle:e,image:t}){let n=e?.trim().slice(0,1).toUpperCase()||`+`;return(0,$.jsx)(`div`,{className:`account-avatar`,children:t?(0,$.jsx)(`img`,{src:t,alt:``}):(0,$.jsx)(`span`,{children:n})})}function vt({state:e,label:t}){return(0,$.jsx)(`span`,{className:`account-state ${e}`,children:t??e.replace(`_`,` `)})}var yt=`https://www.openpond.ai`,bt=`https://api.openpond.ai`;function xt(e){try{let t=new URL(e).hostname.toLowerCase();if(t===`openpond.ai`||t===`www.openpond.ai`)return bt}catch{}return``}function St(e,t){try{let t=new URL(e);if(t.protocol===`https:`||t.protocol===`http:`&&[`localhost`,`127.0.0.1`,`[::1]`].includes(t.hostname))return null}catch{}return`${t} must be an https:// URL (or http:// for localhost).`}function Ct({account:e,busy:t,mode:n=`update`,onClose:r,onSave:i,onRemove:a}){let o=(0,Q.useId)(),s=(0,Q.useRef)(null),c=n===`connect`,l=e?.baseUrl??yt,u=e?.apiBaseUrl??xt(l),[d,f]=(0,Q.useState)(l),[p,m]=(0,Q.useState)(u),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null);fe(y);function x(e){f(e),m(e.trim().replace(/\/+$/,``)===l?u:xt(e))}async function S(t){t.preventDefault(),v(null),b(null);let n=h.trim(),r=d.trim().replace(/\/+$/,``),a=p.trim().replace(/\/+$/,``),o=(c&&!n?`API key is required.`:null)??St(r,`Environment URL`)??St(a,`API URL`);if(o)v(o),(o.startsWith(`Environment URL`)||o.startsWith(`API URL`))&&s.current&&(s.current.open=!0);else try{await i({handle:c?void 0:e?.handle,currentBaseUrl:c?null:e?.baseUrl??null,baseUrl:r,apiBaseUrl:a,chatApiBaseUrl:c||a!==u?null:e?.chatApiBaseUrl,apiKey:n||void 0,environment:new URL(r).hostname.replace(/^www\./,``)===`openpond.ai`?`production`:`custom`})}catch(e){b(e instanceof Error?e.message:String(e))}}async function C(){a&&await a()&&r()}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop account-endpoint-dialog-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&!t&&r()},children:(0,$.jsxs)(`form`,{className:`git-dialog account-endpoint-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":o,onSubmit:e=>void S(e),children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:t,type:`button`,title:`Close`,"aria-label":`Close`,onClick:r,children:(0,$.jsx)(Y,{size:16})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:c?(0,$.jsx)(K,{size:18}):(0,$.jsx)(Ee,{size:18})}),(0,$.jsx)(`h2`,{id:o,children:c?`Add account`:`Account settings`}),(0,$.jsx)(`p`,{children:c?`Connect an OpenPond account with an API key.`:`Review this account and its verified key access.`}),!c&&e?(0,$.jsxs)(`div`,{className:`account-dialog-details`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Account`}),(0,$.jsx)(`strong`,{children:e.displayLabel||e.handle})]}),e.email?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Email`}),(0,$.jsx)(`strong`,{children:e.email})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Handle`}),(0,$.jsx)(`strong`,{children:e.handle})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`API key`}),(0,$.jsx)(`strong`,{children:e.apiKeyHint??(e.authHealth===`signed_in`?`Connected with a session`:`No saved API key`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Access`}),(0,$.jsx)(`strong`,{children:e.apiKeyAccess?e.apiKeyAccess.teamId?`This workspace`:e.apiKeyAccess.ownerType===`user`?`All my workspaces`:`Account access`:`Not verified`})]}),e.apiKeyAccess?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Scopes`}),(0,$.jsx)(`strong`,{children:e.apiKeyAccess.scopes.join(`, `)||`No scopes`})]}):null]}):null,c?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`API key`}),(0,$.jsx)(`input`,{autoComplete:`off`,disabled:t,placeholder:`opk_...`,type:`password`,value:h,onChange:e=>g(e.target.value)})]}):null,(0,$.jsxs)(`details`,{className:`account-dialog-advanced`,ref:s,children:[(0,$.jsx)(`summary`,{children:`Advanced`}),(0,$.jsxs)(`div`,{className:`account-dialog-advanced-fields`,children:[c?null:(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Replace API key`}),(0,$.jsx)(`input`,{autoComplete:`off`,disabled:t,placeholder:`Leave blank to keep the current key`,type:`password`,value:h,onChange:e=>g(e.target.value)}),(0,$.jsx)(`small`,{children:`Enter a new key to replace the saved credential.`})]}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Environment URL`}),(0,$.jsx)(`input`,{disabled:t,inputMode:`url`,spellCheck:!1,type:`url`,value:d,onChange:e=>x(e.target.value)}),(0,$.jsx)(`small`,{children:`Change this URL to connect this account to another environment.`})]}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`API URL`}),(0,$.jsx)(`input`,{disabled:t,inputMode:`url`,spellCheck:!1,type:`url`,value:p,onChange:e=>m(e.target.value)}),(0,$.jsx)(`small`,{children:`Enter the API URL for a custom environment.`})]})]})]}),_?(0,$.jsx)(X,{error:_}):null,(0,$.jsx)(`div`,{className:`git-dialog-footer account-dialog-footer`,children:(0,$.jsxs)(`div`,{className:`account-dialog-save-actions`,children:[!c&&a?(0,$.jsxs)(`button`,{className:`git-dialog-secondary account-dialog-remove`,disabled:t,type:`button`,onClick:()=>void C(),children:[(0,$.jsx)(M,{size:14}),` Remove account`]}):null,(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:t,type:`button`,onClick:r,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`git-dialog-primary`,disabled:t,type:`submit`,children:[(0,$.jsx)(de,{size:14}),(0,$.jsx)(`span`,{children:t?`Saving`:c?`Connect account`:`Save changes`})]})]})})]})})}var wt=`Changing the active OpenPond account rechecks cloud projects, hosted agents, default team, and profile sync for that account. Local projects stay on this machine; projects uploaded from another account will need to be synced again for this account.`;function Tt({payload:e,connection:t,saving:n,refreshingAccounts:r,saveAccount:i,refreshAccounts:a,switchAccount:o,removeAccount:s,onPayload:c,onPreferences:l,onError:u,onToast:d}){let f=e?.account,p=f?.state??`loading`,m=p===`signed_in`,h=p===`signed_out`,g=p===`auth_error`,_=f?.email?.trim()||null,v=f?.accounts??[],[y,b]=(0,Q.useState)([]),[,x]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(void 0),O=(0,Q.useRef)(0),[k,A]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),{confirmAction:ee,confirmDialog:te,resolveConfirmDialog:ne}=Fe(),z=v.find(e=>e.isActive)??v[0]??null,B=e?.preferences.defaultTeamId?.trim()||null,V=E===void 0?B:E,re=Te(f),H=e?.accountMeta.asOf??``,W=Dt(f?.environment,z?.environment),G=m?Dt(z?.displayLabel,z?.handle,f?.label,f?.activeProfile?.handle,`Signed in`):g?`Account needs attention`:h?`No account connected`:`Loading account`,ie=m?_??kt(z?.baseUrl??f?.baseUrl,W):g?`Not connected`:h?`Cloud projects, hosted agents, and team defaults are disabled until you sign in.`:`Checking account status.`,ae=v.length>0,K=g?Ot(f?.error):null,oe=(0,Q.useMemo)(()=>y.filter(e=>e.status===`active`),[y]),se=(0,Q.useMemo)(()=>{let e=[{value:``,label:`Personal account`,description:`Your personal tasks and computers`},...oe.map(e=>({value:e.teamId,label:Dt(e.displayName,e.name,e.slug,`Team`),description:me(e.role)}))];return V&&!e.some(e=>e.value===V)&&e.push({value:V,label:`Selected workspace`,description:V}),e},[oe,V]),ce=V??``,le=!t||w,ue=k?Et(k):null,de=!!(ue&&N===ue),Y=m||g,fe=Dt(F?.version,e?.server.version,`Loading`),pe=F?F.devMode?`Dev mode`:F.packaged?`${Mt(F.releaseChannel)} build`:`Local build`:null,ge=At(Dt(z?.baseUrl,f?.activeProfile?.baseUrl,f?.baseUrl,`https://openpond.ai`));(0,Q.useEffect)(()=>{let e=window.openpond?.getDesktopRuntimeInfo;if(!e)return;let t=!1;return e().then(e=>{t||I(e)}).catch(()=>{t||I(null)}),()=>{t=!0}},[]),(0,Q.useEffect)(()=>{if(!t||!re){b([]),C(null),x(!1);return}let e=!1,n=De(re);return n?(b(n),x(!1)):(b([]),x(!0)),C(null),we({accountKey:re,force:!!H,fetchOrganizations:async()=>(await Z.organizations(t)).organizations.map(he).filter(e=>!!e).filter(e=>e.status===`active`)}).then(t=>{e||b(t)}).catch(t=>{e||(n||b([]),C(t instanceof Error?t.message:String(t)))}).finally(()=>{e||x(!1)}),()=>{e=!0}},[H,t,re]),(0,Q.useEffect)(()=>(++O.current,D(void 0),T(!1),()=>{++O.current}),[t,re]),(0,Q.useEffect)(()=>{E!==void 0&&B===E&&D(void 0)},[B,E]);async function _e(e,n={notify:!0}){let r=e||null,i=oe.find(e=>e.teamId===r)??null;if(!t||r!==null&&!i||w||V===r)return;D(r),T(!0);let a=O.current;u(null),r&&xe({teamId:r,accountKey:re,force:!0,fetchAgents:async e=>(await Z.listSandboxAgents(t,{teamId:e})).agents}).catch(()=>void 0);try{let e=await Z.savePreferences(t,{defaultTeamId:r});if(a!==O.current)return;l(e),n.notify&&d?.(r?`Workspace selected`:`Personal account selected`,`success`)}catch(e){if(a!==O.current)return;D(void 0),u(e instanceof Error?e.message:String(e))}finally{a===O.current&&T(!1)}}async function ve(e=`Continue`){return!Y||ee({title:`Change active OpenPond account?`,body:wt,confirmLabel:e,cancelLabel:`Cancel`})}async function ye(e){await ve(`Save account`)&&(await i({apiKey:e.apiKey??``,handle:e.handle,baseUrl:e.baseUrl,apiBaseUrl:e.apiBaseUrl,environment:e.environment}),M(!1))}async function be(e){if(!t||!k)throw Error(`OpenPond server connection is not ready.`);if(k.isActive&&!await ve(`Save endpoints`))return;let n=Et(k);P(n),u(null);try{c(await Z.updateOpenPondAccountConfig(t,{handle:e.handle??k.handle,currentBaseUrl:e.currentBaseUrl,apiKey:e.apiKey,baseUrl:e.baseUrl,apiBaseUrl:e.apiBaseUrl,chatApiBaseUrl:e.chatApiBaseUrl,environment:e.environment,setActive:k.isActive})),d?.(`Account updated`,`success`),A(null)}catch(e){throw u(e instanceof Error?e.message:String(e)),e}finally{P(null)}}async function Se(e){let t=e.handle?.trim()||``;t&&await ve(`Switch account`)&&await o(t,e.baseUrl)}async function Oe(e){let t=e.handle?.trim()||``;if(!t)return!1;let n=Dt(e.displayLabel,e.email,e.handle,`this account`);return await ee({title:`Remove saved account?`,body:`Remove ${n} from this device? Its saved credential and endpoint settings will be deleted. This does not delete any OpenPond cloud data.`,confirmLabel:`Remove account`,cancelLabel:`Cancel`,tone:`danger`})&&await s(t,e.baseUrl)?(d?.(`Account removed`,`success`),!0):!1}async function ke(){let e=window.openpond?.reloadDesktopApp;if(e&&!L){R(!0),u(null);try{let t=await e();if(!t.ok)throw Error(t.error??`OpenPond could not refresh the app.`)}catch(e){R(!1),u(e instanceof Error?e.message:String(e))}}}async function Ae(){let e=window.openpond?.browser;e?.openExternal&&(await e.openExternal({conversationId:`openpond-account-sign-up`,url:ge})).ok||window.open(ge,`_blank`,`noopener,noreferrer`)}return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsxs)(`div`,{className:`account-settings-title`,children:[(0,$.jsx)(`h1`,{children:`Account`}),(0,$.jsxs)(`div`,{className:`account-settings-title-actions`,children:[(0,$.jsx)(`button`,{className:`settings-secondary compact`,disabled:!t||n,type:`button`,onClick:Ve,children:`Get started`}),(0,$.jsxs)(`button`,{className:`settings-secondary compact account-add-action`,disabled:!t||n,type:`button`,onClick:()=>M(!0),children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:`Add account`})]}),(0,$.jsx)(`button`,{className:`settings-icon-button ghost`,disabled:!t||n||r,title:`Refresh accounts and team data`,"aria-label":`Refresh accounts and team data`,type:`button`,onClick:()=>void a(),children:(0,$.jsx)(J,{size:15,className:r?`settings-spin`:void 0})})]})]}),(0,$.jsxs)(`div`,{className:`account-summary`,children:[(0,$.jsxs)(`div`,{className:`account-summary-main`,children:[(0,$.jsx)(_t,{handle:G,image:m?f?.avatarUrl??z?.avatarUrl??null:null}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Active account`}),(0,$.jsx)(`strong`,{children:G}),(0,$.jsxs)(`div`,{className:`account-summary-meta`,children:[(0,$.jsx)(`small`,{className:m&&_?`private-account-email`:m?void 0:`account-summary-copy`,tabIndex:m&&_?0:void 0,children:ie}),m?(0,$.jsx)(Ce,{className:`account-team-dropdown`,compact:!0,disabled:le,label:`Workspace`,options:se,value:ce,onChange:e=>void _e(e)}):null,m&&S?(0,$.jsx)(`small`,{role:`status`,children:`Workspaces could not be loaded. Personal access remains available.`}):null]})]})]}),(0,$.jsx)(`div`,{className:`account-summary-actions`,children:(0,$.jsx)(vt,{state:p,label:h?`not signed in`:void 0})})]}),ae?(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`OpenPond accounts`}),(0,$.jsxs)(`small`,{children:[v.length,` account`,v.length===1?``:`s`]})]}),v.map(e=>{let r=e.handle?.trim()||``,i=Dt(e.displayLabel,e.handle,`Unknown account`),a=e.email?.trim()||null,o=Et(e);return(0,$.jsxs)(`div`,{className:`account-row`,children:[(0,$.jsx)(_t,{handle:i,image:e.avatarUrl??null}),(0,$.jsxs)(`div`,{className:`account-details`,children:[(0,$.jsx)(`strong`,{children:i}),a?(0,$.jsx)(`span`,{className:`private-account-email`,tabIndex:0,children:a}):null,(0,$.jsx)(`span`,{children:kt(e.baseUrl,e.environment)}),e.apiKeyHint?(0,$.jsxs)(`span`,{children:[`API key `,e.apiKeyHint]}):null]}),(0,$.jsxs)(`div`,{className:`account-row-actions`,children:[e.isActive?(0,$.jsx)(`span`,{className:`active-pill`,children:`Active`}):null,e.isActive?null:(0,$.jsx)(`button`,{className:`inline-action`,disabled:n||!r,type:`button`,onClick:()=>void Se(e),children:`Use`}),(0,$.jsx)(`button`,{className:`settings-icon-button ghost account-endpoint-action`,disabled:!t||n||!!N||!r,type:`button`,"aria-label":`Settings for ${i}`,title:`Account settings`,onClick:()=>A(e),children:(0,$.jsx)(Ee,{size:15})})]})]},o)})]}):null,f?.products&&f.products.length>0&&(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Products`}),(0,$.jsxs)(`small`,{children:[f.products.length,` active`]})]}),f.products.map(e=>(0,$.jsxs)(`div`,{className:`product-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{children:e.type})]}),(0,$.jsx)(vt,{state:e.status})]},e.id))]}),(0,$.jsxs)(`div`,{className:`settings-footnote account-build-footnote`,children:[(0,$.jsxs)(`div`,{className:`account-build-details`,children:[(0,$.jsx)(`span`,{children:`Build version`}),(0,$.jsxs)(`div`,{className:`account-build-version`,children:[(0,$.jsx)(`strong`,{children:jt(fe)}),pe?(0,$.jsx)(`span`,{className:`account-build-context${F?.devMode?` development`:``}`,children:pe}):null]})]}),(0,$.jsxs)(`div`,{className:`account-build-actions`,children:[F?.canReload?(0,$.jsxs)(`button`,{className:`settings-secondary compact`,disabled:L,type:`button`,title:`Reload the local Electron app`,onClick:()=>void ke(),children:[(0,$.jsx)(J,{className:L?`settings-spin`:void 0,size:14}),(0,$.jsx)(`span`,{children:L?`Refreshing`:`Refresh app`})]}):null,m?null:(0,$.jsxs)(`button`,{className:`settings-primary compact account-sign-up-action`,type:`button`,onClick:()=>void Ae(),children:[(0,$.jsx)(`span`,{children:`Sign up`}),(0,$.jsx)(U,{size:13})]})]})]}),K?(0,$.jsx)(X,{error:K}):null,k?(0,$.jsx)(Ct,{account:k,busy:de||n,onClose:()=>{de||A(null)},onSave:be,onRemove:()=>Oe(k)},ue):null,j?(0,$.jsx)(Ct,{busy:n,mode:`connect`,onClose:()=>{n||M(!1)},onSave:ye}):null,(0,$.jsx)(Je,{state:te,onResolve:ne})]})}function Et(e){return`${e.handle.trim().toLowerCase()}|${e.baseUrl??`default`}`}function Dt(...e){for(let t of e){let e=t?.trim();if(e)return e}return``}function Ot(e){let t=e?.trim();if(!t)return null;let n=t.toLowerCase();return n.includes(`protected deployment`)?`OpenPond could not reach the account service. Restart and try again.`:n.includes(`unexpected token '<'`)||n.includes(`<!doctype`)?`OpenPond received a web login page instead of account data. Restart and try again.`:n.includes(`401`)||n.includes(`unauthorized`)||n.includes(`could not authenticate`)?`The API key could not authenticate. Check the key and account environment, then try again.`:t.length>220?`${t.slice(0,217)}...`:t}function kt(e,t){try{if(e)return new URL(e).host}catch{}return t?.trim()||`openpond.ai`}function At(e){try{return new URL(`/login`,e).toString()}catch{return`https://openpond.ai/login`}}function jt(e){let t=e.trim();return!t||t===`Loading`?`Loading`:t.startsWith(`v`)?t:`v${t}`}function Mt(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function Nt({advancedWorkspaceControls:e,defaultBranchPrefix:t,defaultNewProjectDirectory:n,preferences:r,saving:i,steerActiveResponses:a,chooseDefaultProjectDirectory:o,saveDefaults:s,setAdvancedWorkspaceControls:c,setSteerActiveResponses:l,setDefaultBranchPrefix:u,setDefaultNewProjectDirectory:d}){let f=O(t)===r.defaultBranchPrefix&&n.trim()===r.defaultNewProjectDirectory&&e===r.advancedWorkspaceControls&&a===r.steerActiveResponses;return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h2`,{children:`General`}),(0,$.jsxs)(`form`,{className:`provider-settings-form`,onSubmit:e=>void s(e),children:[(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:a,disabled:i,onChange:e=>l(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Steer active responses`}),(0,$.jsx)(`small`,{children:`Send a new message into the active response immediately. Turn this off to queue it instead.`})]})]}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,disabled:i,onChange:e=>c(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Show advanced Git controls`}),(0,$.jsx)(`small`,{children:`Show branch, commit, and push controls for local project workflows.`})]})]}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Git branches`}),(0,$.jsx)(`small`,{children:`Used for advanced and non-managed branch creation`})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Branch prefix`}),(0,$.jsx)(`input`,{value:t,disabled:i,placeholder:`feat/`,onChange:e=>u(e.target.value)})]})}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Projects`}),(0,$.jsx)(`small`,{children:`Used when starting a new local project from scratch`})]}),(0,$.jsxs)(`div`,{className:`settings-path-row`,children:[(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`New project directory`}),(0,$.jsx)(`input`,{value:n,disabled:i,placeholder:`~/Documents/OpenPond Projects`,onChange:e=>d(e.target.value)})]}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:i,onClick:()=>void o(),children:[(0,$.jsx)(W,{size:14}),(0,$.jsx)(`span`,{children:`Browse`})]})]}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:i||f,children:(0,$.jsx)(`span`,{children:i?`Saving`:`Save settings`})})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`Initial branch name`}),(0,$.jsxs)(`strong`,{children:[O(t),`example-project`]})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`New projects`}),(0,$.jsx)(`strong`,{children:n||r.defaultNewProjectDirectory})]})]})}function Pt({diagnostics:e,diagnosticsAvailable:t,diagnosticsBusy:n,diagnosticsStatus:r,logDir:i,logLineLimit:a,logLines:o,logViewBusy:s,logViewSummary:c,logViewportRef:l,tailLogs:u,copyRecentLogs:d,exportDiagnosticsBundle:f,loadOlderLogs:p,openLogsFolder:m,refreshLogView:h,toggleTailLogs:g}){let _=e.filter(e=>e.name===`diagnostic`&&e.status===`failed`).slice().reverse().map(Ft),v=typeof window>`u`?void 0:window.openpond;return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h1`,{children:`Diagnostics`}),(0,$.jsxs)(`div`,{className:`diagnostics-log-panel`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Recent errors`}),(0,$.jsxs)(`small`,{children:[_.length,` saved`]})]}),(0,$.jsx)(`div`,{className:`diagnostics-error-list`,role:`list`,children:_.length===0?(0,$.jsx)(`div`,{className:`diagnostics-error-empty`,children:`No saved errors`}):_.map(e=>(0,$.jsxs)(`article`,{className:`diagnostics-error-entry`,role:`listitem`,children:[(0,$.jsx)(Be,{size:15}),(0,$.jsxs)(`div`,{className:`diagnostics-error-body`,children:[(0,$.jsxs)(`div`,{className:`diagnostics-error-title`,children:[(0,$.jsx)(`strong`,{children:e.message}),(0,$.jsx)(`time`,{dateTime:e.timestamp,children:e.timeLabel})]}),(0,$.jsxs)(`div`,{className:`diagnostics-error-meta`,children:[(0,$.jsx)(`span`,{children:e.surface}),e.status?(0,$.jsx)(`span`,{children:e.status}):null,e.sequence?(0,$.jsxs)(`span`,{children:[`#`,e.sequence]}):null]}),e.detail?(0,$.jsxs)(`details`,{className:`diagnostics-error-detail`,children:[(0,$.jsx)(`summary`,{children:`Details`}),(0,$.jsx)(`pre`,{children:e.detail})]}):null]})]},e.id))})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Logs`}),(0,$.jsx)(`small`,{children:t?`Desktop`:`Unavailable`})]}),(0,$.jsxs)(`div`,{className:`product-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Logs folder`}),(0,$.jsx)(`span`,{children:`Desktop and server logs`})]}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:n!==null||!v?.openLogsFolder,onClick:()=>void m(),children:[(0,$.jsx)(W,{size:15}),(0,$.jsx)(`span`,{children:n===`logs`?`Opening`:`Open`})]})]}),(0,$.jsxs)(`div`,{className:`product-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Diagnostics export`}),(0,$.jsx)(`span`,{children:`Support folder with diagnostics.txt`})]}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:n!==null||!v?.exportDiagnostics,onClick:()=>void f(),children:[(0,$.jsx)(Pe,{size:15}),(0,$.jsx)(`span`,{children:n===`export`?`Exporting`:`Export`})]})]}),(0,$.jsxs)(`div`,{className:`product-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Recent logs`}),(0,$.jsx)(`span`,{children:`Last 1000 lines to clipboard`})]}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:n!==null||!v?.copyRecentLogs,onClick:()=>void d(),children:[(0,$.jsx)(rt,{size:15}),(0,$.jsx)(`span`,{children:n===`copy`?`Copying`:`Copy`})]})]})]}),(0,$.jsxs)(`div`,{className:`diagnostics-log-panel`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Log view`}),(0,$.jsxs)(`div`,{className:`settings-heading-actions diagnostics-log-actions`,children:[(0,$.jsx)(`small`,{children:c}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button ${u?`active`:``}`,title:u?`Pause tail`:`Tail logs`,"aria-label":u?`Pause tail`:`Tail logs`,disabled:!v?.readRecentLogs,onClick:g,children:u?(0,$.jsx)(P,{size:15}):(0,$.jsx)(ue,{size:15})}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Refresh logs`,"aria-label":`Refresh logs`,disabled:s!==null||!v?.readRecentLogs,onClick:()=>void h(a,`refresh`),children:(0,$.jsx)(J,{size:15})}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:s!==null||!v?.readRecentLogs,onClick:p,children:[(0,$.jsx)(re,{size:15}),(0,$.jsx)(`span`,{children:s===`older`?`Loading`:`Older`})]})]})]}),(0,$.jsx)(`div`,{ref:l,className:`diagnostics-log-viewer`,role:`log`,"aria-live":u?`polite`:`off`,children:o.length===0?(0,$.jsx)(`div`,{className:`diagnostics-log-empty`,children:s?`Loading logs`:`No log lines`}):o.map((e,t)=>(0,$.jsxs)(`div`,{className:`diagnostics-log-entry`,children:[(0,$.jsx)(`span`,{className:`diagnostics-log-source`,children:e.file}),(0,$.jsx)(`code`,{children:e.line})]},`${e.file}:${e.timestamp}:${e.index}:${t}`))}),i&&(0,$.jsxs)(`div`,{className:`diagnostics-log-dir`,children:[(0,$.jsx)(`span`,{children:`Source`}),(0,$.jsx)(`strong`,{children:i})]})]}),r&&(0,$.jsxs)(`div`,{className:`settings-footnote ${r.warning?`warning`:``}`,children:[(0,$.jsx)(`span`,{children:r.label}),(0,$.jsx)(`strong`,{children:r.value})]})]})}function Ft(e){let t=Rt(e.data),n=Rt(t.context),r=zt(t.stack)??zt(t.detail)??zt(n.detail)??null;return{id:e.id,timestamp:e.timestamp,timeLabel:Lt(e.timestamp),message:It(e,t),surface:zt(t.surface)??e.source??`diagnostic`,status:e.status??null,sequence:e.sequence??null,detail:r}}function It(e,t){return zt(e.error)??zt(e.output)??zt(t.message)??zt(t.error)??`Diagnostic event`}function Lt(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Rt(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function zt(e){return typeof e==`string`&&e.trim()?e.trim():null}var Bt=[{id:`typescript`,label:`TypeScript`,placeholder:`typescript-language-server`},{id:`python`,label:`Python`,placeholder:`pyright-langserver`},{id:`rust`,label:`Rust`,placeholder:`rust-analyzer`}];function Vt({editorPreferences:e,lspStatus:t,preferences:n,restarting:r,saving:i,statusLoading:a,refreshLspStatus:o,restartLanguageServers:s,saveEditorSettings:c,setEditorPreferences:l,setLanguageCustomCommand:u,setLanguageMode:d}){let f=JSON.stringify(e)!==JSON.stringify(n.editor),p=new Map(t?.languages.map(e=>[e.language,e])??[]);return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h1`,{children:`Editor`}),(0,$.jsxs)(`form`,{className:`provider-settings-form editor-settings-form`,onSubmit:e=>void c(e),children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Language servers`}),(0,$.jsx)(`small`,{children:`Local tools`})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`div`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Language servers`}),(0,$.jsx)(Ce,{value:e.languageServers,disabled:i,label:`Language servers`,options:C,onChange:e=>l(t=>({...t,languageServers:e}))})]})}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.diagnosticsWhileEditing,disabled:i||e.languageServers===`off`,onChange:e=>l(t=>({...t,diagnosticsWhileEditing:e.target.checked}))}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Diagnostics while editing`}),(0,$.jsx)(`small`,{children:`Update Monaco markers as the local buffer changes.`})]})]}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e.checkOnSave,disabled:i||e.languageServers===`off`,onChange:e=>l(t=>({...t,checkOnSave:e.target.checked}))}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Check on save`}),(0,$.jsx)(`small`,{children:`Refresh diagnostics after writing a file.`})]})]}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Languages`}),(0,$.jsx)(`small`,{children:`Auto, disabled, or custom executable`})]}),(0,$.jsx)(`div`,{className:`lsp-language-list`,children:Bt.map(t=>{let n=e.languages[t.id];return(0,$.jsxs)(`div`,{className:`lsp-language-row`,children:[(0,$.jsxs)(`div`,{className:`lsp-language-label`,children:[(0,$.jsx)(`strong`,{children:t.label}),(0,$.jsx)(`span`,{children:Ht(p.get(t.id),a)})]}),(0,$.jsxs)(`div`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Mode`}),(0,$.jsx)(Ce,{value:n.mode,disabled:i||e.languageServers===`off`,label:`${t.label} language server mode`,options:x,onChange:e=>d(t.id,e)})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Custom executable`}),(0,$.jsx)(`input`,{value:n.customCommand,disabled:i||e.languageServers===`off`||n.mode!==`custom`,placeholder:t.placeholder,onChange:e=>u(t.id,e.target.value)})]})]},t.id)})}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:i||!f,children:(0,$.jsx)(`span`,{children:i?`Saving`:`Save editor settings`})})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`LSP status`}),(0,$.jsxs)(`div`,{className:`settings-heading-actions`,children:[(0,$.jsx)(`small`,{children:a?`Checking`:t?`Current`:`Not checked`}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Refresh LSP status`,"aria-label":`Refresh LSP status`,disabled:a||r,onClick:()=>void o(),children:(0,$.jsx)(J,{className:a?`settings-spin`:void 0,size:15})}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:a||r,onClick:()=>void s(),children:[(0,$.jsx)(st,{className:r?`settings-spin`:void 0,size:15}),(0,$.jsx)(`span`,{children:r?`Restarting`:`Restart`})]})]})]}),Bt.map(e=>{let t=p.get(e.id);return(0,$.jsxs)(`div`,{className:`product-row lsp-status-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsx)(`span`,{title:t?.command??t?.message??void 0,children:t?.command??t?.message??`Not checked`})]}),(0,$.jsx)(`span`,{className:`lsp-status-pill ${t?.status??`missing`}`,children:Ht(t,a)})]},e.id)})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`Project config`}),(0,$.jsx)(`strong`,{children:`Uses tsconfig, pyrightconfig, pyproject, and Cargo files when present`})]})]})}function Ht(e,t){return t&&!e?`Checking`:e?e.status===`found`?`Found`:e.status===`disabled`?`Disabled`:e.status===`error`?`Error`:`Missing`:`Not checked`}function Ut({contextCompactionAutoEnabled:e,embedded:t=!1,preferences:n,saving:r,saveDefaults:i,setContextCompactionAutoEnabled:a}){return(0,$.jsxs)(`section`,{className:`account-settings${t?` account-settings-embedded`:``}`,children:[t?(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Context`}),(0,$.jsx)(`small`,{children:`Compaction defaults for long chats`})]}):(0,$.jsx)(`h1`,{children:`Context`}),(0,$.jsxs)(`form`,{className:`provider-settings-form`,onSubmit:e=>void i(e),children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Compaction`}),(0,$.jsx)(`small`,{children:`Controls automatic compaction for long OpenPond and BYOK chats`})]}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,disabled:r,onChange:e=>a(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Auto compact long chats`}),(0,$.jsx)(`small`,{children:`Summarize older turns at 85% context before the selected model runs out. The transcript stays visible.`})]})]}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:r||e===n.contextCompaction.autoEnabled,children:(0,$.jsx)(`span`,{children:r?`Saving`:`Save context`})})]})]})}function Wt({subagentsEnabled:e,subagentDelegationMode:t,subagentsUseDefaultModel:n,subagentsProvider:r,subagentsModel:i,subagentRoles:a,subagentsMaxConcurrentRuns:o,subagentsMaxConcurrentRunsPerProvider:s,subagentsMaxConcurrentRunsPerWorkspaceTarget:c,preferences:l,providers:d,saving:f,saveDefaults:p,changeSubagentsProvider:m,setSubagentsEnabled:h,setSubagentDelegationMode:g,setSubagentsUseDefaultModel:_,setSubagentsModel:v,setSubagentsMaxConcurrentRuns:b,setSubagentsMaxConcurrentRunsPerProvider:x,setSubagentsMaxConcurrentRunsPerWorkspaceTarget:S,setSubagentRoleEnabled:C,setSubagentRoleIsolationMode:w,setSubagentRoleMaxConcurrentRuns:T,setSubagentRoleModel:O,setSubagentRolePeerMessages:k,setSubagentRoleToolPolicy:A,changeSubagentRoleProvider:j}){let M=y(d,{enabledOnly:!0}),N=n?l.defaultChatProvider:r,P=n?l.defaultChatModel:i,F=Jt(D(N,d),P),I=$t({enabled:e,delegationMode:t,defaultModelRef:n?null:{providerId:r,modelId:i.trim()},roles:a,maxConcurrentRuns:o,maxConcurrentRunsPerProvider:s,maxConcurrentRunsPerWorkspaceTarget:c},l);return(0,$.jsx)(`section`,{className:`account-settings subagents-settings`,children:(0,$.jsxs)(`form`,{className:`subagent-settings-form`,onSubmit:e=>void p(e),children:[(0,$.jsxs)(`div`,{className:`subagent-settings-title-row`,children:[(0,$.jsx)(`h1`,{children:`Agents`}),(0,$.jsxs)(`div`,{className:`subagent-settings-actions`,children:[(0,$.jsx)(`button`,{className:`settings-primary subagent-save-button${I?``:` dirty`}`,disabled:f||I,children:(0,$.jsx)(`span`,{children:f?`Saving`:`Save agents`})}),(0,$.jsxs)(`label`,{className:`provider-toggle subagent-card-toggle`,"aria-label":`Allow subagents`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,disabled:f,onChange:e=>h(e.target.checked)}),(0,$.jsx)(`span`,{})]})]})]}),(0,$.jsxs)(`section`,{className:`subagent-settings-section`,children:[(0,$.jsx)(`div`,{className:`subagent-settings-card-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Default delegation`}),(0,$.jsx)(`small`,{children:`Used unless a task overrides it from the composer.`})]})}),(0,$.jsx)(`div`,{className:`subagent-field-grid two`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Subagent use`}),(0,$.jsxs)(`select`,{value:t,disabled:f||!e,onChange:e=>g(e.target.value),children:[(0,$.jsx)(`option`,{value:`manual`,children:`Manual`}),(0,$.jsx)(`option`,{value:`balanced`,children:`Balanced`}),(0,$.jsx)(`option`,{value:`proactive`,children:`Proactive`})]})]})})]}),(0,$.jsxs)(`section`,{className:`subagent-settings-section`,children:[(0,$.jsx)(`div`,{className:`subagent-settings-card-header`,children:(0,$.jsx)(`div`,{children:(0,$.jsx)(`span`,{children:`Default model`})})}),(0,$.jsxs)(`div`,{className:`subagent-field-grid two`,children:[(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Provider`}),(0,$.jsx)(`select`,{value:N,disabled:f||!e,onChange:e=>{_(!1),m(e.target.value)},children:M.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Model`}),(0,$.jsx)(`select`,{value:P,disabled:f||!e,onChange:e=>{_(!1),v(e.target.value)},children:F.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]}),(0,$.jsx)(`div`,{className:`subagent-role-list`,children:a.map(t=>{let n=u.find(e=>e.id===t.id),r=t.modelRef?.providerId??N,i=t.modelRef?.modelId||E(r,d)||P,a=Xt(M,d,{providerId:r,modelId:i}),o=Yt(r,i),s=f||!e||!t.enabled;return(0,$.jsxs)(`section`,{className:`subagent-role-row${t.enabled?``:` disabled`}`,children:[(0,$.jsxs)(`div`,{className:`subagent-settings-card-header subagent-role-header`,children:[(0,$.jsxs)(`div`,{className:`subagent-role-title`,children:[(0,$.jsx)(`span`,{children:n?.label??t.id}),(0,$.jsx)(`small`,{children:n?.description??`Custom subagent role.`})]}),(0,$.jsxs)(`label`,{className:`provider-toggle subagent-card-toggle`,"aria-label":`${n?.label??t.id} enabled`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:t.enabled,disabled:f||!e,onChange:e=>C(t.id,e.target.checked)}),(0,$.jsx)(`span`,{})]})]}),(0,$.jsxs)(`div`,{className:`subagent-role-controls`,children:[(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Model`}),(0,$.jsx)(`select`,{value:o,disabled:s,onChange:e=>{let n=a.find(t=>t.value===e.target.value);n&&(j(t.id,n.providerId),O(t.id,n.modelId))},children:a.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Isolation`}),(0,$.jsx)(`select`,{value:t.isolationMode,disabled:s,onChange:e=>w(t.id,e.target.value),children:Gt.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Tools`}),(0,$.jsx)(`select`,{value:t.toolPolicy,disabled:s,onChange:e=>A(t.id,e.target.value),children:Kt.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Peer messages`}),(0,$.jsx)(`select`,{value:t.peerMessages,disabled:s,onChange:e=>k(t.id,e.target.value),children:qt.map(e=>(0,$.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]}),(0,$.jsx)(`div`,{className:`subagent-role-budget-grid`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Role concurrency`}),(0,$.jsx)(`input`,{type:`number`,min:1,max:16,value:t.maxConcurrentRuns,disabled:s,onChange:e=>T(t.id,Qt(e.target.value,1))})]})})]},t.id)})}),(0,$.jsxs)(`section`,{className:`subagent-settings-section`,children:[(0,$.jsx)(`div`,{className:`subagent-settings-card-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Limits`}),(0,$.jsx)(`small`,{children:`Controls child worker concurrency.`})]})}),(0,$.jsxs)(`div`,{className:`subagent-field-grid four`,children:[(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Total concurrency`}),(0,$.jsx)(`input`,{type:`number`,min:1,max:32,value:o,disabled:f||!e,onChange:e=>b(Qt(e.target.value,1))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Per provider`}),(0,$.jsx)(`input`,{type:`number`,min:1,max:32,value:s??``,placeholder:`No cap`,disabled:f||!e,onChange:e=>x(Zt(e.target.value))})]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Per workspace`}),(0,$.jsx)(`input`,{type:`number`,min:1,max:32,value:c??``,placeholder:`No cap`,disabled:f||!e,onChange:e=>S(Zt(e.target.value))})]})]})]})]})})}var Gt=[{value:`none`,label:`Direct workspace`},{value:`copy_on_write`,label:`Copy-on-write`},{value:`worktree`,label:`Worktree`}],Kt=[{value:`read_only`,label:`Read only`},{value:`workspace_write`,label:`Workspace write`},{value:`full_tools`,label:`Full tools`}],qt=[{value:`parent_scoped`,label:`Parent-scoped handoffs`},{value:`disabled`,label:`Disabled`}];function Jt(e,t){let n=t.trim();return!n||e.some(e=>e.value===n)?e:[{value:n,label:n},...e]}function Yt(e,t){return JSON.stringify([e,t])}function Xt(e,t,n){let r=[];for(let i of e){let e=Jt(D(i.value,t),i.value===n.providerId?n.modelId:``);for(let t of e)r.push({value:Yt(i.value,t.value),label:`${i.label} / ${t.label}`,providerId:i.value,modelId:t.value})}return n.modelId&&!r.some(e=>e.value===Yt(n.providerId,n.modelId))&&r.unshift({value:Yt(n.providerId,n.modelId),label:`${S(n.providerId,t)} / ${n.modelId}`,providerId:n.providerId,modelId:n.modelId}),r}function Zt(e){let t=e.trim();if(!t)return null;let n=Number(t);return Number.isFinite(n)?n:null}function Qt(e,t){return Zt(e)??t}function $t(e,t){let n=t.subagents;return e.enabled===n.enabled&&e.delegationMode===n.delegationMode&&en(e.defaultModelRef,n.defaultModelRef)&&e.maxConcurrentRuns===n.maxConcurrentRuns&&e.maxConcurrentRunsPerProvider===n.maxConcurrentRunsPerProvider&&e.maxConcurrentRunsPerWorkspaceTarget===n.maxConcurrentRunsPerWorkspaceTarget&&JSON.stringify(e.roles)===JSON.stringify(n.roles)}function en(e,t){return(e?.providerId??null)===(t?.providerId??null)&&(e?.modelId??null)===(t?.modelId??null)}var tn=[{mode:`all`,label:`All new messages`,detail:`Show an in-app alert for every Team Chat message.`},{mode:`direct_mentions`,label:`Direct messages and mentions`,detail:`Show alerts for direct messages and messages that mention you.`},{mode:`none`,label:`Nothing`,detail:`Keep unread counts without showing message alerts.`}];function nn({currentUserId:e,enabled:t,mode:n,threads:r,onModeChange:i,onThreadMuteChange:a}){let[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null);fe(c);let u=(0,Q.useMemo)(()=>r.filter(e=>e.archivedAt===null).map(t=>({thread:t,label:rn(t,e)})).sort((e,t)=>{let n=Number(!!t.thread.mutedAt)-Number(!!e.thread.mutedAt);return n===0?e.label.localeCompare(t.label):n}),[e,r]),d=u.filter(({thread:e})=>!!e.mutedAt).length,f=(0,Q.useCallback)(async e=>{s(e.id),l(null),await a(e.id,!e.mutedAt)||l(`Could not update this conversation. Try again.`),s(null)},[a]);return(0,$.jsxs)(`section`,{className:`account-settings notifications-settings`,children:[(0,$.jsx)(`h1`,{children:`Notifications`}),(0,$.jsxs)(`div`,{className:`account-list notification-settings-card`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Team chat notifications`}),(0,$.jsx)(`small`,{children:`In-app alerts`})]}),(0,$.jsx)(`div`,{className:`notification-mode-list`,role:`radiogroup`,"aria-label":`Notify me about`,children:tn.map(e=>(0,$.jsxs)(`label`,{className:`notification-mode-option${n===e.mode?` selected`:``}`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`team-chat-notification-mode`,checked:n===e.mode,onChange:()=>i(e.mode)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsx)(`small`,{children:e.detail})]})]},e.mode))})]}),(0,$.jsxs)(`div`,{className:`account-list notification-settings-card`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Conversation overrides`}),(0,$.jsx)(`small`,{children:d===1?`1 muted`:`${d} muted`})]}),t?u.length===0?(0,$.jsx)(`div`,{className:`empty-account-list`,children:(0,$.jsx)(`span`,{children:`Open a Team Chat conversation to manage it here.`})}):u.map(({thread:e,label:t})=>{let n=!!e.mutedAt,r=o===e.id;return(0,$.jsxs)(`div`,{className:`notification-thread-row`,children:[(0,$.jsx)(`span`,{className:`notification-thread-icon${n?` muted`:``}`,children:n?(0,$.jsx)(te,{size:15}):(0,$.jsx)(R,{size:15})}),(0,$.jsxs)(`span`,{className:`notification-thread-copy`,children:[(0,$.jsx)(`strong`,{children:t}),(0,$.jsx)(`small`,{children:n?`Muted`:`Uses the team chat setting`})]}),(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:o!==null,onClick:()=>void f(e),children:r?`Saving`:n?`Unmute`:`Mute`})]},e.id)}):(0,$.jsx)(`div`,{className:`empty-account-list`,children:(0,$.jsx)(`span`,{children:`Connect a team to manage conversation overrides.`})})]}),(0,$.jsx)(`div`,{className:`settings-footnote`,children:(0,$.jsx)(`span`,{children:`Muted conversations never show alerts. Unread counts remain available.`})})]})}function rn(e,t){return e.kind===`general`||e.kind===`channel`?`#${e.title?.trim()||`general`}`:e.kind===`dm`?e.participants.find(e=>e.userId!==t)?.name??e.title?.trim()??`Direct message`:e.title?.trim()||e.participants.filter(e=>e.userId!==t).map(e=>e.name).join(`, `)||`Group conversation`}function an({canSaveCurrentTemplate:e,personalizationTemplateId:t,personalizationTemplateOptions:n,saveAsNewOpen:r,saving:i,selectedPersonalizationTemplate:a,selectedTemplateIsCustom:o,soulDraft:s,templateNameDraft:c,changePersonalizationTemplate:l,changeSoulDraft:u,openSaveAsNew:d,resetPersonalizationDraft:f,savePersonalization:p,setSaveAsNewOpen:m,setTemplateNameDraft:h}){function g(e){e.preventDefault(),p(r)}return(0,$.jsxs)(`section`,{className:`account-settings`,children:[(0,$.jsx)(`h1`,{children:`Personalization`}),(0,$.jsxs)(`form`,{className:`provider-settings-form personalization-form`,onSubmit:g,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Agent style`}),(0,$.jsx)(`div`,{className:`settings-heading-actions`,children:r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{className:`settings-heading-input`,value:c,onChange:e=>h(e.target.value),placeholder:`Name`,"aria-label":`Template name`}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Cancel`,"aria-label":`Cancel`,disabled:i,onClick:()=>m(!1),children:(0,$.jsx)(Y,{size:15})}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button primary`,title:`Save new template`,"aria-label":`Save new template`,disabled:i||!s.trim()||!c.trim(),onClick:()=>void p(!0),children:(0,$.jsx)(Re,{size:15})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`small`,{children:o?`Custom template`:`Built-in template`}),(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Save as new`,"aria-label":`Save as new`,disabled:i||!a||!s.trim(),onClick:d,children:(0,$.jsx)(q,{size:15})})]})})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`div`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Template`}),(0,$.jsx)(Ce,{value:t,disabled:i||n.length===0,label:`Personalization template`,options:n,onChange:e=>void l(e)})]})}),(0,$.jsxs)(`label`,{className:`settings-select-field personalization-editor`,children:[(0,$.jsx)(`span`,{children:`SOUL.md`}),(0,$.jsx)(`textarea`,{value:s,onChange:e=>u(e.target.value),spellCheck:!1})]}),(0,$.jsxs)(`div`,{className:`settings-button-row`,children:[(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Reset to template`,"aria-label":`Reset to template`,disabled:i||!a,onClick:f,children:(0,$.jsx)(Oe,{size:15})}),o&&(0,$.jsx)(`button`,{className:`settings-icon-button primary`,title:`Save template`,"aria-label":`Save template`,disabled:i||!e,children:(0,$.jsx)(de,{size:15})})]})]})]})}function on({connection:e,profile:t,selectedDefaultTeamId:n}){let r=Qe(e),i=dn(r.schedules);return fe(r.error,{prefix:`Local schedules`}),(0,$.jsxs)(`div`,{className:`account-list profile-agent-list`,"aria-label":`Profile agents`,children:[(0,$.jsx)(`div`,{className:`account-list-heading profile-agent-list-heading`,children:(0,$.jsx)(`span`,{children:`Agents`})}),(0,$.jsx)(`div`,{className:`profile-table-frame`,children:(0,$.jsxs)(`table`,{className:`profile-data-table profile-agent-table`,"aria-label":`Profile agents table`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`profile-agent-column`}),(0,$.jsx)(`col`,{className:`profile-action-column`}),(0,$.jsx)(`col`,{className:`profile-check-column`}),(0,$.jsx)(`col`,{className:`profile-sync-column`})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Agent`}),(0,$.jsx)(`th`,{scope:`col`,children:`Action`}),(0,$.jsx)(`th`,{scope:`col`,children:`Check`}),(0,$.jsx)(`th`,{scope:`col`,children:`Sync`})]})}),(0,$.jsxs)(`tbody`,{children:[i.active.map(e=>(0,$.jsx)(ln,{pending:r.pendingScheduleIds.has(e.id),schedule:e,refreshing:r.loading,onRefresh:()=>void r.refresh(),onRun:()=>void r.run(e),onToggle:()=>void r.toggle(e)},e.id)),(0,$.jsx)(sn,{}),t.agents.map(e=>(0,$.jsx)(cn,{agent:e,defaultAction:t.summary.defaultAction,profile:t,selectedDefaultTeamId:n},e.id)),i.paused.map(e=>(0,$.jsx)(ln,{pending:r.pendingScheduleIds.has(e.id),schedule:e,refreshing:r.loading,onRefresh:()=>void r.refresh(),onRun:()=>void r.run(e),onToggle:()=>void r.toggle(e)},e.id))]})]})})]})}function sn(){return(0,$.jsxs)(`tr`,{className:`profile-agent-row`,children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(z,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:`Dataset Builder`}),(0,$.jsx)(`span`,{children:`Built in · every Profile`})]})]})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`div`,{className:`profile-agent-action`,children:(0,$.jsx)(`span`,{children:`Design · Materialize · Test`})})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:{state:`ready`,label:`Ready`}})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:{state:`ready`,label:`Built in`}})})]})}function cn({agent:e,defaultAction:t,profile:n,selectedDefaultTeamId:r}){let i=gn(n,e,r);return(0,$.jsxs)(`tr`,{className:`profile-agent-row`,children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(z,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{title:e.path,children:e.path})]})]})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`div`,{className:`profile-agent-action`,children:(0,$.jsx)(`span`,{children:t??`None`})})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:i.check})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:i.sync})})]})}function ln({pending:e,refreshing:t,schedule:n,onRefresh:r,onRun:i,onToggle:a}){let o=pn(n),s=n.enabled?`Pause schedule`:`Resume schedule`;return(0,$.jsxs)(`tr`,{className:`profile-agent-row profile-schedule-agent-row`,children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(z,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:n.localProjectName}),(0,$.jsxs)(`span`,{title:n.scheduleName,children:[`schedule: `,n.scheduleName]})]})]})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`div`,{className:`profile-agent-action`,children:(0,$.jsx)(`span`,{title:n.targetAction,children:n.targetAction})})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(un,{status:o})}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-schedule-actions`,children:[(0,$.jsx)(`span`,{className:`profile-schedule-expression`,title:mn(n),children:n.enabled?n.scheduleExpression:`Paused`}),(0,$.jsxs)(`div`,{className:`profile-schedule-controls`,"aria-label":`${n.scheduleName} schedule controls`,children:[(0,$.jsx)(`button`,{className:`settings-icon-button profile-schedule-button`,disabled:t,type:`button`,title:`Refresh local schedules`,"aria-label":`Refresh local schedules`,onClick:r,children:(0,$.jsx)(J,{size:14,className:t?`settings-spin`:void 0})}),(0,$.jsx)(`button`,{className:`settings-icon-button profile-schedule-button`,disabled:e,type:`button`,title:`Run now`,"aria-label":`Run ${n.scheduleName} now`,onClick:i,children:(0,$.jsx)(Oe,{size:14})}),(0,$.jsx)(`button`,{className:`settings-icon-button profile-schedule-button`,disabled:e,type:`button`,title:s,"aria-label":`${s}: ${n.scheduleName}`,onClick:a,children:n.enabled?(0,$.jsx)(P,{size:14}):(0,$.jsx)(ue,{size:14})})]})]})})]})}function un({status:e}){return(0,$.jsx)(`span`,{className:`profile-status-text ${e.state}`,children:e.label})}function dn(e){let t=[],n=[];for(let r of e)r.enabled?t.push(r):n.push(r);return t.sort((e,t)=>fn(e)-fn(t)),{active:t,paused:n}}function fn(e){return e.lastRunStatus===`running`?0:e.lastRunStatus===`queued`?1:2}function pn(e){return e.enabled?e.lastError||e.lastRunStatus===`failed`?{state:`warning`,label:`Failed`}:e.lastRunStatus===`running`?{state:`loading`,label:`Running`}:e.lastRunStatus===`queued`?{state:`loading`,label:`Queued`}:e.lastRunStatus===`skipped`?{state:`warning`,label:`Skipped`}:e.lastRunStatus===`succeeded`?{state:`ready`,label:`Succeeded`}:{state:`loading`,label:`Scheduled`}:{state:`disabled`,label:`Paused`}}function mn(e){let t=[`${e.scheduleType}: ${e.scheduleExpression}`];return e.nextRunAt&&t.push(`next ${hn(e.nextRunAt)}`),e.lastRunAt&&t.push(`last ${hn(e.lastRunAt)}`),t.join(` - `)}function hn(e){let t=new Date(e);return Number.isFinite(t.getTime())?t.toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}):e}function gn(e,t,n){if(!t.enabled)return{check:{state:`disabled`,label:`Disabled`},sync:{state:`disabled`,label:`Disabled`}};if(e.error)return{check:{state:`warning`,label:`Error`},sync:{state:`warning`,label:`Blocked`}};if(e.setupGate.blockingCount>0)return{check:{state:`warning`,label:`Setup`},sync:{state:`warning`,label:`Blocked`}};if(e.git?.dirty||vn(e,t)>0)return{check:{state:`loading`,label:`Pending`},sync:{state:`warning`,label:`Changed`}};if(e.catalog.stale)return{check:{state:`loading`,label:`Stale`},sync:{state:`loading`,label:`Waiting`}};if(!e.lastCheck)return{check:{state:`loading`,label:`Unchecked`},sync:{state:`loading`,label:`Waiting`}};if(e.lastCheck.status===`failed`)return{check:{state:`warning`,label:`Failed`},sync:{state:`warning`,label:`Blocked`}};if(!e.summary.checkFresh)return{check:{state:`loading`,label:`Stale`},sync:{state:`loading`,label:`Waiting`}};if(_n(e,n))return{check:{state:`ready`,label:`Passed`},sync:{state:`warning`,label:`Sync acct`}};let r=e.summary.localHead??e.git?.head??null,i=e.hosted?.lastPushedLocalHead??null;return!(e.summary.hostedHead??e.hosted?.sourceCommitSha??null)&&!i?{check:{state:`ready`,label:`Passed`},sync:{state:`loading`,label:`Not synced`}}:r&&i&&r!==i?{check:{state:`ready`,label:`Passed`},sync:{state:`loading`,label:`Needed`}}:{check:{state:`ready`,label:`Passed`},sync:{state:`ready`,label:`Synced`}}}function _n(e,t){let n=e.hosted?.teamId?.trim()??``;return!!(n&&t&&n!==t)}function vn(e,t){let n=0;e.diff.changedAgents.includes(t.id)&&(n+=1),e.diff.newAgents.includes(t.id)&&(n+=1),e.diff.deletedAgents.includes(t.id)&&(n+=1);let r=t.path.replace(/^profiles\/[^/]+\//,``);for(let i of e.diff.files){let e=i.path.replace(/^profiles\/[^/]+\//,``);(e===r||e.startsWith(`${r}/`)||e.startsWith(`agents/${t.id}/`))&&(n+=1)}return n}function yn(e){return e.policy.kind===`model`?`${e.policy.model.provider}/${e.policy.model.model}`:`Fixture`}function bn({comparison:e}){let t=[...new Set(e.members.map(e=>e.source.sourceRevision))],n=[...new Set(e.members.map(yn))];return(0,$.jsxs)(`table`,{className:`profile-evaluations-comparison-matrix`,children:[(0,$.jsxs)(`caption`,{children:[`Same frozen Taskset `,e.tasksetRelease.id,` across Profile source and model choices`]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Profile source`}),n.map(e=>(0,$.jsx)(`th`,{scope:`col`,children:e},e))]})}),(0,$.jsx)(`tbody`,{children:t.map(t=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`row`,title:t,children:t.slice(0,12)}),n.map(n=>{let r=e.members.filter(e=>e.source.sourceRevision===t&&yn(e)===n);return(0,$.jsx)(`td`,{children:r.length?r.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.score===null?`No score`:`${Math.round(e.score*100)}%`}),(0,$.jsxs)(`small`,{children:[` · Run `,e.runManifest.id]})]},e.runManifest.id)):`—`},n)})]},t))})]})}function xn(e){switch(e.kind){case`profile`:return`Complete Profile`;case`workflow`:return`Workflow · ${e.workflowId}`;case`skill`:return`Skill · ${e.skillPath}`;case`agent_action`:return`Agent action · ${e.actionId}`}}function Sn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Cn(e){return e===null?`No score`:`${Math.round(e*100)}%`}function wn(e){return e.manifest.policy.kind===`model`?`${e.manifest.policy.model.provider}/${e.manifest.policy.model.model}`:`Fixture`}function Tn({catalog:e,evaluations:t,onEvaluate:n,onOpenRun:r,busy:i}){let[a,o]=(0,Q.useState)(null);return(0,$.jsxs)(`section`,{className:`profile-workflows`,"aria-label":`Profile workflows`,children:[(0,$.jsxs)(`div`,{className:`profile-workflows-header`,children:[(0,$.jsx)(`h3`,{children:`Workflows`}),(0,$.jsx)(`p`,{children:`Open a workflow to review its instructions and linked evaluations.`})]}),e.workflows.length?(0,$.jsx)(`div`,{className:`profile-table-scroll`,children:(0,$.jsxs)(`table`,{className:`profile-evaluation-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Workflow`}),(0,$.jsx)(`th`,{scope:`col`,children:`Evaluations`}),(0,$.jsx)(`th`,{scope:`col`,children:`Runs`}),(0,$.jsx)(`th`,{scope:`col`,children:`Latest result`}),(0,$.jsx)(`th`,{scope:`col`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:e.workflows.map(({workflow:e,binding:s})=>{let c=t?.definitions.filter(t=>t.target.kind===`workflow`&&t.target.workflowId===e.id)??[],l=t?.runs.filter(t=>t.manifest.profileEvaluation?.target.kind===`workflow`&&t.manifest.profileEvaluation.target.workflowId===e.id)??[],u=l[0];return(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`th`,{scope:`row`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-expanded":a===e.id,onClick:()=>o(t=>t===e.id?null:e.id),children:e.label}),(0,$.jsx)(`small`,{children:e.description})]}),(0,$.jsx)(`td`,{children:t?c.length:`—`}),(0,$.jsx)(`td`,{children:t?l.length:`—`}),(0,$.jsx)(`td`,{children:u?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(u),children:[u.passed?`Passed`:`Did not pass`,` · `,Cn(u.metric.value),(0,$.jsx)(`small`,{children:Sn(u.completedAt)})]}):`Not run`}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`button`,{type:`button`,disabled:i||!t,onClick:()=>n(e.id),children:c.length?`Run Evaluation`:`View evaluations`})})]}),a===e.id?(0,$.jsx)(`tr`,{children:(0,$.jsx)(`td`,{colSpan:5,children:(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsxs)(`p`,{children:[`Revision `,s.sourceRevision.slice(0,12),` · Release `,s.harnessRelease.contentHash.slice(0,12)]}),e.skillPaths.length?(0,$.jsxs)(`p`,{children:[`Skills: `,e.skillPaths.join(`, `)]}):null,(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:e.invocation.kind===`instructions`?`Instructions`:`Action configuration`}),(0,$.jsx)(`pre`,{children:e.invocation.kind===`instructions`?e.invocation.instructions:JSON.stringify(e.invocation,null,2)})]}),(0,$.jsx)(`strong`,{children:`Linked evaluations`}),c.length?(0,$.jsx)(`ul`,{children:c.map(e=>(0,$.jsxs)(`li`,{children:[e.label,` · `,e.taskIds.length,` tasks · `,e.seeds.length,` seeds`]},e.id))}):(0,$.jsx)(`p`,{children:t?`No evaluation definition targets this workflow. Add one in the Profile’s evals catalog to run it.`:`Evaluation catalog unavailable.`}),(0,$.jsx)(`button`,{type:`button`,disabled:i||!t,onClick:()=>n(e.id),children:c.length?`Run Evaluation`:`View evaluation history`})]})})}):null]},e.id)})})]})}):(0,$.jsx)(`p`,{children:`No workflows in this Profile yet.`})]})}function En({runs:e,definitions:t,sourceRevision:n,onOpen:r,onSave:i,savingReportId:a}){let[o,s]=(0,Q.useState)(20);return(0,$.jsxs)(`div`,{className:`profile-evaluations-history`,children:[(0,$.jsx)(`h4`,{children:`Run history`}),e.length?(0,$.jsx)(`div`,{className:`profile-table-scroll`,children:(0,$.jsxs)(`table`,{className:`profile-evaluation-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Evaluation / target`}),(0,$.jsx)(`th`,{scope:`col`,children:`Completed`}),(0,$.jsx)(`th`,{scope:`col`,children:`Model`}),(0,$.jsx)(`th`,{scope:`col`,children:`Result`}),(0,$.jsx)(`th`,{scope:`col`,children:`Score`}),(0,$.jsx)(`th`,{scope:`col`,children:`Attempts`}),(0,$.jsx)(`th`,{scope:`col`,children:`Source`}),(0,$.jsx)(`th`,{scope:`col`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:e.slice(0,o).map(e=>{let o=e.manifest.profileEvaluation,s=o?.sourceRevision===n?t.find(e=>e.id===o.definitionId):null;return(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`th`,{scope:`row`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),children:s?.label??o?.definitionId??e.manifest.id}),o?(0,$.jsx)(`small`,{children:xn(o.target)}):null]}),(0,$.jsx)(`td`,{children:Sn(e.completedAt)}),(0,$.jsx)(`td`,{children:wn(e)}),(0,$.jsx)(`td`,{children:e.passed?`Passed`:`Did not pass`}),(0,$.jsx)(`td`,{children:Cn(e.metric.value)}),(0,$.jsx)(`td`,{children:e.receiptRefs.length}),(0,$.jsx)(`td`,{title:o?.sourceRevision,children:o?.sourceRevision.slice(0,10)??`—`}),(0,$.jsxs)(`td`,{children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(e),children:`View results`}),` `,(0,$.jsx)(`button`,{type:`button`,disabled:!!a,onClick:()=>i(e.manifest.id),children:a===e.manifest.id?`Saving…`:`Save report`})]})]},e.manifest.id)})})]})}):(0,$.jsx)(`p`,{children:`No evaluation runs yet.`}),e.length>o?(0,$.jsx)(`button`,{type:`button`,onClick:()=>s(e=>e+20),children:`Show more runs`}):null]})}function Dn(e){return A(e,`/v1/profile/evaluations/discover`,{method:`POST`,body:JSON.stringify({view:`history`})})}function On(e,t,n){return A(e,`/v1/profile/evaluations/discover`,{method:`POST`,body:JSON.stringify(t),signal:n})}function kn({connection:e,run:t,onClose:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)([]),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!0),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(0),[b,x]=(0,Q.useState)(50),[S,C]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{r.current?.showModal()},[]),(0,Q.useEffect)(()=>{let n=new AbortController;return d(!0),h(null),On(e,{runId:t.manifest.id},n.signal).then(e=>{n.signal.aborted||a(e.cases)}).catch(e=>{n.signal.aborted||h(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||d(!1)}),()=>n.abort()},[e,t.manifest.id,v]),(0,Q.useEffect)(()=>{if(!o)return;let n=new AbortController;return p(!0),_(null),On(e,{runId:t.manifest.id,receiptId:o,...S?{eventAfterId:S}:{}},n.signal).then(e=>{n.signal.aborted||l(e.cases[0]??null)}).catch(e=>{n.signal.aborted||_(e instanceof Error?e.message:String(e))}).finally(()=>{n.signal.aborted||p(!1)}),()=>n.abort()},[e,t.manifest.id,o,S,v]);let w=t.manifest.profileEvaluation;return(0,$.jsx)(`dialog`,{ref:r,className:`profile-evaluation-dialog`,"aria-labelledby":`profile-run-title`,onCancel:n,onClick:e=>{if(e.target===e.currentTarget){let t=e.currentTarget.getBoundingClientRect();(e.clientX<t.left||e.clientX>t.right||e.clientY<t.top||e.clientY>t.bottom)&&n()}},children:(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,children:[(0,$.jsxs)(`header`,{className:`profile-evaluation-dialog-header`,children:[(0,$.jsx)(`h2`,{id:`profile-run-title`,children:`Evaluation results`}),(0,$.jsx)(`button`,{type:`button`,autoFocus:!0,onClick:n,children:`Close`})]}),(0,$.jsxs)(`strong`,{children:[w?.definitionId??t.manifest.id,` · `,t.passed?`Passed`:`Did not pass`,` · `,Cn(t.metric.value)]}),(0,$.jsxs)(`p`,{children:[w?xn(w.target):`Profile evaluation`,` · `,wn(t),` · `,Sn(t.completedAt)]}),(0,$.jsxs)(`p`,{children:[`Pass rate `,Cn(t.passRate),` · Source `,w?.sourceRevision,` · Run `,t.manifest.id]}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Frozen run configuration`}),(0,$.jsx)(`pre`,{children:JSON.stringify(t.manifest,null,2)})]}),u?(0,$.jsx)(`p`,{role:`status`,children:`Loading case results…`}):null,m?(0,$.jsx)(X,{error:m,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>y(e=>e+1),children:`Retry`})}):null,(0,$.jsx)(`div`,{className:`profile-table-scroll`,children:(0,$.jsxs)(`table`,{className:`profile-evaluation-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Task`}),(0,$.jsx)(`th`,{scope:`col`,children:`Seed`}),(0,$.jsx)(`th`,{scope:`col`,children:`Result`}),(0,$.jsx)(`th`,{scope:`col`,children:`Score`}),(0,$.jsx)(`th`,{scope:`col`,children:`Grading`}),(0,$.jsx)(`th`,{scope:`col`,children:`Latency`}),(0,$.jsx)(`th`,{scope:`col`,children:`Cost`})]})}),(0,$.jsx)(`tbody`,{children:i.slice(0,b).map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`row`,children:(0,$.jsx)(`button`,{type:`button`,"aria-pressed":o===e.receiptId,onClick:()=>{(o!==e.receiptId||S)&&(s(e.receiptId),l(null),C(null))},children:e.taskId})}),(0,$.jsx)(`td`,{children:e.seed}),(0,$.jsx)(`td`,{children:e.passed?`Passed`:`Did not pass`}),(0,$.jsx)(`td`,{children:Cn(e.score)}),(0,$.jsxs)(`td`,{children:[e.gradingStatus,e.failureClass?` · ${e.failureClass}`:``]}),(0,$.jsxs)(`td`,{children:[e.latencyMs.toLocaleString(),` ms`]}),(0,$.jsx)(`td`,{children:e.costUsd===null?`Unknown`:`$${e.costUsd.toFixed(4)}`})]},e.receiptId))})]})}),i.length>b?(0,$.jsx)(`button`,{type:`button`,onClick:()=>x(e=>e+50),children:`Show more cases`}):null,f?(0,$.jsx)(`p`,{role:`status`,children:`Loading case evidence…`}):null,g?(0,$.jsx)(X,{error:g,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>y(e=>e+1),children:`Retry`})}):null,c?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,"aria-label":`Case evidence`,children:[(0,$.jsxs)(`h3`,{children:[c.taskId,` · Seed `,c.seed]}),(0,$.jsx)(`h4`,{children:`Grader feedback`}),(0,$.jsx)(`p`,{children:`Evaluations use the graders pinned by their Taskset. Each result below identifies the grader and version used for this case.`}),c.feedback.length?c.feedback.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[e.graderId,` · `,e.graderVersion,` · `,Cn(e.score),` · `,e.passed?`Passed`:`Did not pass`]}),(0,$.jsx)(`ul`,{children:e.feedback.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]},`${e.graderId}:${e.graderVersion}`)):(0,$.jsx)(`p`,{children:`No grader feedback retained for this case.`}),c.evidence?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`h4`,{children:`Input`}),(0,$.jsx)(`pre`,{children:c.evidence.prompt}),(0,$.jsx)(`h4`,{children:`Output`}),(0,$.jsx)(`pre`,{children:c.evidence.output?.text??c.evidence.partialOutput?.text??`No output retained.`}),c.evidence.error?(0,$.jsx)(`p`,{role:`alert`,children:c.evidence.error}):null,(0,$.jsxs)(`details`,{children:[(0,$.jsxs)(`summary`,{children:[`Trace · `,c.evidence.eventCount,` events`]}),(0,$.jsx)(`pre`,{children:JSON.stringify(c.evidence.events,null,2)}),S?(0,$.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>C(null),children:`First trace page`}):null,c.evidence.nextEventCursor?(0,$.jsx)(`button`,{type:`button`,disabled:f,onClick:()=>C(c.evidence.nextEventCursor),children:`Next trace page`}):null]})]}):(0,$.jsx)(`p`,{children:`No policy trace retained for this case. Scores and grader feedback are available above.`}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Case receipt`}),(0,$.jsx)(`pre`,{children:JSON.stringify(c.receipt,null,2)})]})]}):null]})})}function An(e,t){return e.kind===t.kind&&(t.kind===`profile`||e.kind===`workflow`&&e.workflowId===t.id||e.kind===`skill`&&e.skillPath===t.id)}function jn(e){return Object.values(e.statuses).flatMap(t=>{if(!t.enabled||!t.available||!t.credential.connected)return[];let n=e.providers[t.id];return[...new Set([...t.modelIds,...e.modelCaches[t.id]?.models.map(e=>e.id)??[],...n?.modelOverrides??[],t.defaultModel,n?.defaultModel].filter(e=>!!e))].map(e=>({key:JSON.stringify([t.id,e]),providerId:t.id,modelId:e,label:`${t.displayName} · ${e}`}))})}function Mn({connection:e,selectedProfileKey:t,focusTarget:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(50),[x,S]=(0,Q.useState)(20),[C,w]=(0,Q.useState)([]),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)([]),[j,M]=(0,Q.useState)(``),[N,P]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),[L,R]=(0,Q.useState)(!1),[ee,te]=(0,Q.useState)(null),[ne,z]=(0,Q.useState)(null),[B,V]=(0,Q.useState)(!1),[re,H]=(0,Q.useState)(null);if((0,Q.useEffect)(()=>{if(!e||!t){g(null),s(null),a(null),p(null),A([]),P(null);return}let n=!0;return V(!0),g(null),s(null),a(null),l(null),d(null),p(null),m.current=null,v(null),b(50),S(20),w([]),A([]),M(``),P(null),z(null),H(null),Dn(e).then(e=>{n&&s(e)}).catch(e=>{n&&H(e instanceof Error?e.message:String(e))}),Z.profileWorkflows(e).then(e=>{n&&a(e)}).catch(e=>{n&&l(e instanceof Error?e.message:String(e))}),Z.profileEvaluations(e).then(e=>{n&&g(e)}).catch(e=>{n&&H(e instanceof Error?e.message:String(e))}).finally(()=>{n&&V(!1)}),Z.providerSettings(e).then(e=>{if(!n)return;let t=jn(e);A(t),M(t[0]?.key??``)}).catch(e=>{n&&H(e instanceof Error?e.message:String(e))}),()=>{n=!1}},[e,t]),(0,Q.useEffect)(()=>{if(!n||!h||m.current===n)return;m.current=n;let e=h.definitions.find(e=>An(e.target,n));d(n),v(e?.id??null),P(null),b(50),z(e?null:`No evaluation definition is saved for this Profile component.`),r.current?.scrollIntoView({behavior:`smooth`,block:`start`})},[h,n]),!t)return null;let U=h?.definitions.find(e=>e.id===_),W=h?.definitions.filter(e=>!u||An(e.target,u))??[],G=o??h,ie=h?{...h,runs:G?.runs??[],suiteRuns:G?.suiteRuns??[]}:null,ae=G?.runs.filter(e=>u?!!(e.manifest.profileEvaluation&&An(e.manifest.profileEvaluation.target,u)):!U||e.manifest.profileEvaluation?.definitionId===U.id)??[],K=F||L||!!ee,oe=e=>{let t={kind:`workflow`,id:e};d(t),v(h?.definitions.find(e=>An(e.target,t))?.id??null),P(null),z(null),b(50),r.current?.scrollIntoView({behavior:`smooth`,block:`start`})},se=async()=>{let t=k.find(e=>e.key===j);if(!e||!U||!t||F)return;let n={id:`evaluation-${crypto.randomUUID()}`,createdAt:new Date().toISOString(),definitionId:U.id,modelRef:{providerId:t.providerId,modelId:t.modelId}};I(!0),P(null),z(null),H(null);try{P({request:n,prepared:await Z.profileEvaluationPrepare(e,n)})}catch(e){H(e instanceof Error?e.message:String(e))}finally{I(!1)}},ce=async()=>{if(e&&N&&!L){R(!0),H(null);try{let t=await Z.profileEvaluationRun(e,{...N.request,expectedManifestHash:N.prepared.manifest.contentHash});P(null),p(t),z(`Run ${t.manifest.id} ${t.passed?`passed`:`did not pass`}.`),s(await Dn(e))}catch(e){H(e instanceof Error?e.message:String(e))}finally{R(!1)}}},le=async t=>{let n=k.find(e=>e.key===j);if(e&&n&&!ee){te(t),z(null),H(null);try{let r=await Z.profileEvaluationRunSuite(e,{id:`suite-${crypto.randomUUID()}`,createdAt:new Date().toISOString(),suiteId:t,modelRef:{providerId:n.providerId,modelId:n.modelId}});s(await Dn(e)),z(`Suite ${r.id} ${r.passed?`passed`:`did not pass`}.`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{te(null)}}},ue=e=>{w(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},q=async()=>{if(!(!e||C.length<2||T)){E(!0),H(null);try{await Z.profileEvaluationCompare(e,C),s(await Dn(e)),w([])}catch(e){H(e instanceof Error?e.message:String(e))}finally{E(!1)}}},J=async(t,n)=>{if(e&&!D){O(n),H(null);try{let r=await Z.profileEvaluationSaveReport(e,t,n);s(await Dn(e)),z(`Report ${r.id} saved to Profile source. Commit and publish the Profile when ready.`)}catch(e){H(e instanceof Error?e.message:String(e))}finally{O(null)}}};return(0,$.jsxs)($.Fragment,{children:[i?(0,$.jsx)(Tn,{catalog:i,evaluations:ie,onEvaluate:oe,onOpenRun:p,busy:K}):null,c?(0,$.jsx)(X,{error:c}):null,(0,$.jsxs)(`section`,{ref:r,"aria-label":`Profile evaluations`,className:`profile-evaluations`,children:[(0,$.jsxs)(`div`,{className:`profile-workflows-header`,children:[(0,$.jsx)(`h3`,{children:`Evaluations`}),(0,$.jsx)(`p`,{children:`Checks and retained results for this Profile’s released components.`})]}),B?(0,$.jsx)(`p`,{children:`Loading evaluations…`}):null,re?(0,$.jsx)(X,{error:re}):null,ne?(0,$.jsx)(`p`,{role:`status`,children:ne}):null,u?(0,$.jsxs)(`div`,{className:`profile-evaluation-scope`,children:[(0,$.jsx)(`strong`,{children:u.kind===`workflow`?`Workflow · ${u.id}`:u.kind===`skill`?`Skill · ${u.id}`:`Complete Profile`}),(0,$.jsx)(`button`,{type:`button`,disabled:K,onClick:()=>{d(null),v(null),P(null),z(null)},children:`Show all evaluations`})]}):null,h&&!W.length?(0,$.jsx)(`p`,{children:u?`No evaluation definitions target this component. Add a definition in the Profile’s evals catalog to run it. Retained runs are shown below.`:`No evaluations in this Profile yet.`}):null,h?.suites.length?(0,$.jsxs)(`div`,{className:`profile-evaluations-suites`,"aria-label":`Evaluation suites`,children:[(0,$.jsx)(`label`,{htmlFor:`profile-evaluation-suite-model`,children:`Suite model`}),(0,$.jsx)(`select`,{id:`profile-evaluation-suite-model`,value:j,disabled:K,onChange:e=>{M(e.target.value),P(null)},children:k.map(e=>(0,$.jsx)(`option`,{value:e.key,children:e.label},e.key))}),k.length===0?(0,$.jsx)(`p`,{children:`Connect a provider and load its models in Providers settings to run a suite.`}):null,h.suites.map(e=>(0,$.jsxs)(`div`,{className:`profile-evaluations-suite`,children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsxs)(`span`,{children:[e.scope===`profile`?`Profile suite`:`Component suite`,` · `,e.definitionIds.length,` checks`]}),(0,$.jsx)(`button`,{type:`button`,disabled:!j||K,onClick:()=>void le(e.id),children:ee===e.id?`Running suite…`:`Run suite`}),(G?.suiteRuns??[]).filter(t=>t.suiteId===e.id).slice(0,5).map(e=>(0,$.jsxs)(`details`,{className:`profile-evaluations-suite-run`,children:[(0,$.jsxs)(`summary`,{children:[Sn(e.completedAt),` · `,e.passed?`Passed`:`Did not pass`,` · `,e.members.length,` checks`]}),(0,$.jsxs)(`small`,{children:[`Profile source `,e.sourceRevision.slice(0,12),` · Suite run `,e.id]}),(0,$.jsx)(`button`,{type:`button`,disabled:!!D,onClick:()=>void J(`suite`,e.id),children:D===e.id?`Saving report…`:`Save report to Profile`}),(0,$.jsx)(`ul`,{children:e.members.map(t=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`strong`,{children:e.sourceRevision===h.sourceRevision?h.definitions.find(e=>e.id===t.definitionId)?.label??t.definitionId:t.definitionId}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{let e=G?.runs.find(e=>e.manifest.id===t.runManifest.id);e&&p(e)},disabled:!G?.runs.some(e=>e.manifest.id===t.runManifest.id),children:`View results`}),(0,$.jsxs)(`span`,{children:[t.passed?`Passed`:`Did not pass`,` · `,t.score===null?`No score`:`${Math.round(t.score*100)}%`,` · Run `,t.runManifest.id]})]},t.runManifest.id))})]},e.id))]},e.id))]}):null,W.length?(0,$.jsx)(`div`,{className:`profile-table-scroll`,children:(0,$.jsxs)(`table`,{className:`profile-evaluation-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Evaluation`}),(0,$.jsx)(`th`,{scope:`col`,children:`Target`}),(0,$.jsx)(`th`,{scope:`col`,children:`Tasks / seeds`}),(0,$.jsx)(`th`,{scope:`col`,children:`Latest result`}),(0,$.jsx)(`th`,{scope:`col`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:W.map(e=>{let t=G?.runs.find(t=>t.manifest.profileEvaluation?.definitionId===e.id);return(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`th`,{scope:`row`,children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsx)(`small`,{children:e.description})]}),(0,$.jsx)(`td`,{children:xn(e.target)}),(0,$.jsxs)(`td`,{children:[e.taskIds.length,` / `,e.seeds.length]}),(0,$.jsx)(`td`,{children:t?(0,$.jsxs)(`button`,{type:`button`,onClick:()=>p(t),children:[t.passed?`Passed`:`Did not pass`,` · `,Cn(t.metric.value),(0,$.jsx)(`small`,{children:Sn(t.completedAt)})]}):`Not run`}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`button`,{type:`button`,disabled:K,"aria-expanded":_===e.id,onClick:()=>{v(t=>t===e.id?null:e.id),b(50),P(null),z(null)},children:_===e.id?`Hide details`:`View / Run Evaluation`})})]},e.id)})})]})}):null,U?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,children:[(0,$.jsx)(`h4`,{children:U.label}),(0,$.jsxs)(`p`,{children:[`Taskset `,U.tasksetRelease.id,` · `,U.tasksetRelease.contentHash.slice(0,12)]}),(0,$.jsxs)(`p`,{children:[`Frozen split: `,U.split,` · Minimum pass rate: `,Math.round(U.criterion.minimumPassRate*100),`% · `,U.criterion.requireComplete?`All attempts required`:`Incomplete runs allowed`]}),(0,$.jsx)(`p`,{children:`This evaluation runs the selected component against its Taskset’s frozen cases and graders.`}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Evaluation definition`}),(0,$.jsx)(`pre`,{children:JSON.stringify(U,null,2)})]}),(0,$.jsxs)(`div`,{className:`profile-evaluations-run-form`,children:[(0,$.jsx)(`label`,{htmlFor:`profile-evaluation-model`,children:`Model`}),(0,$.jsx)(`select`,{id:`profile-evaluation-model`,value:j,disabled:K,onChange:e=>{M(e.target.value),P(null)},children:k.map(e=>(0,$.jsx)(`option`,{value:e.key,children:e.label},e.key))}),k.length===0?(0,$.jsx)(`p`,{children:`Connect a provider and load its models in Providers settings to run this check.`}):null,(0,$.jsx)(`button`,{type:`button`,disabled:!j||K,onClick:()=>void se(),children:F?`Checking run…`:`Check run setup`}),N?(0,$.jsxs)(`div`,{className:`profile-evaluations-run-plan`,children:[(0,$.jsx)(`strong`,{children:`Run setup`}),(0,$.jsxs)(`small`,{children:[`Profile source `,N.prepared.manifest.profileEvaluation?.sourceRevision.slice(0,12),` · Harness `,N.prepared.manifest.execution.kind===`harness`?N.prepared.manifest.execution.harnessRelease.id:``]}),(0,$.jsxs)(`small`,{children:[`Taskset `,N.prepared.taskset.id,` · `,N.prepared.manifest.population.length,` attempts · `,N.prepared.manifest.limits.timeoutMs/1e3,`s per attempt`]}),(0,$.jsxs)(`small`,{children:[`Connected app scopes: `,N.prepared.taskset.connectedAppScopes.join(`, `)||`none declared`]}),(0,$.jsx)(`button`,{type:`button`,disabled:L,onClick:()=>void ce(),children:L?`Running evaluation…`:`Run evaluation`})]}):null]}),(0,$.jsxs)(`div`,{className:`profile-evaluations-cases`,children:[(0,$.jsx)(`strong`,{children:`Task cases`}),(0,$.jsx)(`ul`,{children:U.taskIds.slice(0,y).map(e=>(0,$.jsx)(`li`,{children:e},e))}),U.taskIds.length>y?(0,$.jsx)(`button`,{type:`button`,onClick:()=>b(e=>e+50),children:`Show more cases`}):null,(0,$.jsxs)(`span`,{children:[`Seeds: `,U.seeds.join(`, `)]})]})]}):null,G?(0,$.jsx)(En,{runs:ae,definitions:h?.definitions??[],sourceRevision:h?.sourceRevision??``,onOpen:p,onSave:e=>void J(`run`,e),savingReportId:D},_??JSON.stringify(u)):null,G&&G.runs.length>1?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,"aria-label":`Compare evaluation runs`,children:[(0,$.jsx)(`h4`,{children:`Compare runs`}),(0,$.jsx)(`p`,{children:`Select two or more runs. Comparisons require the same Taskset, cases, environment, grading policy, limits, and runtime.`}),(0,$.jsx)(`div`,{className:`profile-evaluations-comparison-runs`,children:G.runs.slice(0,x).map(e=>(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:C.includes(e.manifest.id),onChange:()=>ue(e.manifest.id),disabled:T}),(0,$.jsxs)(`span`,{children:[(0,$.jsxs)(`strong`,{children:[e.manifest.profileEvaluation?.definitionId??`Profile evaluation`,` · `,e.metric.value===null?`No score`:`${Math.round(e.metric.value*100)}%`]}),(0,$.jsxs)(`small`,{children:[Sn(e.completedAt),` · `,e.manifest.policy.kind===`model`?`${e.manifest.policy.model.provider}/${e.manifest.policy.model.model}`:`fixture`,` · Source `,e.manifest.profileEvaluation?.sourceRevision.slice(0,10),` · `,e.manifest.id]})]})]},e.manifest.id))}),G.runs.length>x?(0,$.jsx)(`button`,{type:`button`,onClick:()=>S(e=>e+20),children:`Show more runs`}):null,(0,$.jsx)(`button`,{type:`button`,disabled:C.length<2||T,onClick:()=>void q(),children:T?`Comparing…`:`Save comparison of ${C.length} runs`})]}):null,G&&G.comparisons.length>0?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,"aria-label":`Saved evaluation comparisons`,children:[(0,$.jsx)(`h4`,{children:`Saved comparisons`}),(0,$.jsx)(`ul`,{children:G.comparisons.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`strong`,{children:[Sn(e.createdAt),` · `,e.members.length,` runs`]}),(0,$.jsx)(`button`,{type:`button`,disabled:!!D,onClick:()=>void J(`comparison`,e.id),children:D===e.id?`Saving report…`:`Save report to Profile`}),(0,$.jsx)(`ul`,{children:e.members.map(e=>(0,$.jsxs)(`li`,{children:[e.source.definitionId,` · `,e.policy.kind===`model`?`${e.policy.model.provider}/${e.policy.model.model}`:`fixture`,` · Source `,e.source.sourceRevision.slice(0,10),` · `,e.score===null?`No score`:`${Math.round(e.score*100)}%`]},e.runManifest.id))}),(0,$.jsx)(bn,{comparison:e})]},e.id))})]}):null,G?.reports.length?(0,$.jsxs)(`div`,{className:`profile-evaluations-detail`,"aria-label":`Profile evaluation reports`,children:[(0,$.jsx)(`h4`,{children:`Reports saved in Profile source`}),(0,$.jsx)(`ul`,{children:G.reports.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsxs)(`strong`,{children:[Sn(e.createdAt),` · `,e.summary.passedChecks,`/`,e.summary.totalChecks,` checks passed`]}),(0,$.jsxs)(`small`,{children:[`Tested source `,e.testedSources.map(e=>e.sourceRevision.slice(0,10)).join(`, `),` · Evidence `,e.evidence.map(e=>e.id).join(`, `)]})]},e.id))})]}):null]}),e&&f?(0,$.jsx)(kn,{connection:e,run:f,onClose:()=>p(null)},f.manifest.id):null]})}function Nn({actions:e,busy:t,library:n,onSelect:r}){let i=n.profiles.find(e=>He(e.ref,n.lastUsed))??n.profiles[0]??null,a=i?Ke(i.ref):``;return(0,$.jsxs)(`div`,{className:`profile-selector-bar`,children:[(0,$.jsxs)(`label`,{className:`profile-selector-control`,children:[(0,$.jsx)(`select`,{"aria-label":`Active profile`,disabled:t||n.profiles.length===0,value:a,onChange:e=>{let t=Ie(n,e.currentTarget.value),i=n.profiles.find(e=>He(e.ref,t));i&&r(i)},children:n.profiles.length?n.profiles.map(e=>(0,$.jsx)(`option`,{value:Ke(e.ref),children:e.name},Ke(e.ref))):(0,$.jsx)(`option`,{value:``,children:`No profiles`})}),(0,$.jsx)(B,{"aria-hidden":`true`,size:14})]}),e]})}function Pn({addDisabled:e,commitDisabled:t,commitLabel:n,refreshDisabled:r,repoDisabled:i,syncDisabled:a,syncLabel:o,syncStatus:s,onAdd:c,onCommit:l,onRefresh:u,onRepo:d,onSync:f}){let[p,m]=(0,Q.useState)(!1),h=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!p)return;function e(e){h.current?.contains(e.target)||m(!1)}function t(e){e.key===`Escape`&&m(!1)}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[p]);function g(e){m(!1),e()}return(0,$.jsx)(`div`,{className:`profile-selector-actions`,children:(0,$.jsxs)(`div`,{className:`profile-settings-menu-root`,ref:h,children:[(0,$.jsx)(`button`,{"aria-expanded":p,"aria-haspopup":`menu`,"aria-label":`Profile settings`,className:`settings-icon-button ghost profile-settings-menu-trigger`,type:`button`,onClick:()=>m(e=>!e),children:(0,$.jsx)(Ee,{size:15})}),p?(0,$.jsxs)(`div`,{className:`profile-settings-menu`,role:`menu`,children:[(0,$.jsxs)(`button`,{disabled:t,role:`menuitem`,type:`button`,onClick:()=>g(l),children:[(0,$.jsx)(ie,{size:14}),(0,$.jsx)(`span`,{children:n})]}),(0,$.jsxs)(`button`,{disabled:a,role:`menuitem`,type:`button`,onClick:()=>g(f),children:[(0,$.jsx)(H,{size:14}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:o}),s?(0,$.jsx)(`small`,{children:s}):null]})]}),(0,$.jsxs)(`button`,{disabled:i,role:`menuitem`,type:`button`,onClick:()=>g(d),children:[(0,$.jsx)(Ne,{size:14}),(0,$.jsx)(`span`,{children:`Repository`})]}),(0,$.jsx)(`div`,{className:`profile-settings-menu-separator`,role:`separator`}),(0,$.jsxs)(`button`,{disabled:r,role:`menuitem`,type:`button`,onClick:()=>g(u),children:[(0,$.jsx)(J,{size:14}),(0,$.jsx)(`span`,{children:`Refresh profiles`})]}),(0,$.jsxs)(`button`,{disabled:e,role:`menuitem`,type:`button`,onClick:()=>g(c),children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:`Add profile`})]})]}):null]})})}var Fn=[{id:`actions`,label:`Actions`,detail:`Profile-level reusable actions`},{id:`workflows`,label:`Workflows`,detail:`Workflow definitions and actions`},{id:`instructions`,label:`Instructions`,detail:`Profile instructions used by evaluations`},{id:`prompts`,label:`Prompts`,detail:`Shared prompt files`},{id:`goals`,label:`Goals`,detail:`Goal definitions; never started automatically`},{id:`evals`,label:`Evals`,detail:`Evaluation definitions and fixtures`},{id:`examples`,label:`Examples`,detail:`Example inputs and usage`},{id:`tasksets`,label:`Tasksets`,detail:`Training and evaluation tasksets`},{id:`extensions`,label:`Extension declarations`,detail:`Third-party extension metadata`}];function In({connection:e,entry:t,onClose:n,onPublished:r}){let[i,a]=(0,Q.useState)(`github`),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(`${t.name}-profile`),[u,d]=(0,Q.useState)(`public`),[f,p]=(0,Q.useState)(()=>t.state.agents.filter(e=>e.enabled).map(e=>e.id)),[m,h]=(0,Q.useState)(()=>t.state.skills.filter(e=>e.enabled).map(e=>e.name)),[g,_]=(0,Q.useState)([]),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(null),w=(0,Q.useMemo)(()=>({ref:t.ref,selection:{agentIds:f,skillNames:m,optionalContent:g},target:{provider:i,owner:o.trim()||null,repository:c.trim(),visibility:i===`github`?`public`:u}}),[f,t.ref,g,o,i,c,m,u]);function T(e,t,n){return n?[...new Set([...e,t])]:e.filter(e=>e!==t)}async function E(t){if(t.preventDefault(),c.trim()&&!b){x(`preview`),C(null);try{y(await Z.profilePublicationPreview(e,w))}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(null)}}}async function D(){if(!(!v||v.blockedReasons.length>0||b)){x(`publish`),C(null);try{let i=await Z.profilePublicationPublish(e,{...w,expectedSourceHash:v.sourceHash,confirmed:!0});r(`Published ${t.name} to ${i.owner}/${i.repository}`),n()}catch(e){C(e instanceof Error?e.message:String(e))}finally{x(null)}}}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:n,children:(0,$.jsxs)(`form`,{className:`git-dialog profile-publication-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`profile-publication-title`,onMouseDown:e=>e.stopPropagation(),onSubmit:E,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:!!b,type:`button`,"aria-label":`Close`,onClick:n,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(H,{size:18})}),(0,$.jsxs)(`h2`,{id:`profile-publication-title`,children:[`Publish `,t.name]}),(0,$.jsx)(`p`,{children:`Choose the exact Agents, Skills, workflows, and optional files to share. OpenPond will show the complete file list before it pushes anything.`}),v?(0,$.jsx)(zn,{preview:v}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`fieldset`,{className:`profile-publication-fieldset`,children:[(0,$.jsx)(`legend`,{children:`Destination`}),(0,$.jsxs)(`label`,{className:`profile-publication-provider`,children:[(0,$.jsx)(`input`,{type:`radio`,checked:i===`github`,onChange:()=>{a(`github`),d(`public`)}}),(0,$.jsx)(Ue,{size:16}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`GitHub`}),(0,$.jsx)(`small`,{children:`Published publicly with your signed-in gh CLI`})]})]}),(0,$.jsxs)(`label`,{className:`profile-publication-provider`,children:[(0,$.jsx)(`input`,{type:`radio`,checked:i===`openpond_git`,onChange:()=>{a(`openpond_git`),d(`private`)}}),(0,$.jsx)(je,{size:16}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`OpenPond Git`}),(0,$.jsx)(`small`,{children:`Private by default; uses the same repository format`})]})]})]}),(0,$.jsxs)(`div`,{className:`profile-publication-target-fields`,children:[i===`github`?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`GitHub owner (optional)`}),(0,$.jsx)(`input`,{value:o,placeholder:`Uses gh account`,onChange:e=>s(e.currentTarget.value)})]}):null,(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Repository`}),(0,$.jsx)(`input`,{value:c,onChange:e=>l(e.currentTarget.value)})]}),i===`openpond_git`?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Visibility`}),(0,$.jsxs)(`select`,{value:u,onChange:e=>d(e.currentTarget.value),children:[(0,$.jsx)(`option`,{value:`private`,children:`Private`}),(0,$.jsx)(`option`,{value:`public`,children:`Public`})]})]}):null]}),(0,$.jsx)(Ln,{title:`Agents`,empty:`No Agents in this Profile`,children:t.state.agents.map(e=>(0,$.jsx)(Rn,{checked:f.includes(e.id),label:e.name,detail:e.path,onChange:t=>p(n=>T(n,e.id,t))},e.id))}),(0,$.jsx)(Ln,{title:`Skills`,empty:`No Skills in this Profile`,children:t.state.skills.map(e=>(0,$.jsx)(Rn,{checked:m.includes(e.name),label:e.name,detail:e.description||e.path,onChange:t=>h(n=>T(n,e.name,t))},e.name))}),(0,$.jsx)(Ln,{title:`Optional content`,empty:``,children:Fn.map(e=>(0,$.jsx)(Rn,{checked:g.includes(e.id),label:e.label,detail:e.detail,onChange:t=>_(n=>T(n,e.id,t))},e.id))})]}),S?(0,$.jsx)(X,{error:S}):null,(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:!!b,type:`button`,onClick:v?()=>y(null):n,children:v?`Back`:`Cancel`}),v?(0,$.jsxs)(`button`,{className:`git-dialog-primary`,disabled:!!b||v.blockedReasons.length>0,type:`button`,onClick:()=>void D(),children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:b===`publish`?`Publishing`:v.replacesExisting?`Confirm and replace`:`Confirm and publish`})]}):(0,$.jsx)(`button`,{className:`git-dialog-primary`,disabled:!!b||!c.trim(),type:`submit`,children:b===`preview`?`Building preview`:`Review exact files`})]})]})})}function Ln({title:e,empty:t,children:n}){let r=Array.isArray(n)?n.length:+!!n;return(0,$.jsxs)(`fieldset`,{className:`profile-publication-fieldset`,children:[(0,$.jsx)(`legend`,{children:e}),r?n:(0,$.jsx)(`span`,{className:`profile-publication-empty`,children:t})]})}function Rn({checked:e,label:t,detail:n,onChange:r}){return(0,$.jsxs)(`label`,{className:`profile-publication-selection`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:e,onChange:e=>r(e.currentTarget.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:t}),(0,$.jsx)(`small`,{children:n})]})]})}function zn({preview:e}){let t=e.files.reduce((e,t)=>e+t.sizeBytes,0);return(0,$.jsxs)(`div`,{className:`profile-publication-preview`,children:[(0,$.jsxs)(`div`,{className:`profile-dialog-summary`,children:[(0,$.jsxs)(`strong`,{children:[e.files.length,` files · `,Bn(t)]}),(0,$.jsx)(`span`,{children:e.sourceRevision?.slice(0,10)??`No source revision`})]}),e.blockedReasons.map(e=>(0,$.jsx)(`div`,{className:`profile-dialog-warning`,children:e},e)),e.warnings.map(e=>(0,$.jsx)(`div`,{className:`profile-publication-warning`,children:e},e)),(0,$.jsx)(`div`,{className:`profile-publication-file-list`,"aria-label":`Exact files to publish`,children:e.files.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{title:e.path,children:e.path}),(0,$.jsxs)(`small`,{children:[e.category,` · `,Bn(e.sizeBytes)]})]},e.path))}),e.excludedFiles.length?(0,$.jsxs)(`details`,{children:[(0,$.jsxs)(`summary`,{children:[e.excludedFiles.length,` excluded sensitive/runtime files`]}),e.excludedFiles.map(e=>(0,$.jsx)(`code`,{children:e},e))]}):null]})}function Bn(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}function Vn({section:e=`all`,catalogPresentation:t=`list`,payload:n,connection:r,onPayload:i,onError:a,onToast:o,onSkillCommand:s,overviewContent:c}){let[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(null),x=n?.profile??null,S=n?.preferences.defaultTeamId?.trim()||``,C=e===`all`||e===`profile`||e===`controls`,w=e===`all`||e===`profile`,T=e===`all`||e===`agents`,E=e===`all`||e===`profile`;async function D(e){r&&(i(await Z.bootstrap(r)),o?.(e,`success`))}async function O(e,t){if(r&&!d){f(e),a(null);try{await t()}catch(e){a(e instanceof Error?e.message:String(e))}finally{f(null)}}}function k(){O(`init`,async()=>{await Z.profileInit(r,{}),await D(`Profile initialized`)})}function A(){O(`commit`,async()=>{await Z.profileCommit(r,{message:l.trim()||null}),u(``),await D(`Profile commit complete`)})}function j(){O(`push`,async()=>{if(!S)throw Error(`Select a default team before syncing a hosted profile.`);await Z.profileCheck(r,{kind:`all`}),await Z.profilePush(r,{teamId:S,ensureHosted:!0,message:null}),await D(`Profile synced to hosted profile repo`)})}function M(e){O(`select:${e.ref.profileId}`,async()=>{await Z.profileSelect(r,e.ref),await D(`Using ${e.name}`)})}function N(e){O(`add`,async()=>{e.source===`blank`?await Z.profileInit(r,{path:e.path,profile:e.profile,template:`blank-profile`}):e.source===`local`?await Z.profileLoad(r,e):await Z.profileInstall(r,e),m(!1),await D(e.source===`blank`?`${e.profile} created`:`Profile added`)})}function P(e){O(`update`,async()=>{await Z.profileUpdate(r,e.ref),await D(`${e.name} updated`)})}function F(e){O(`remove`,async()=>{await Z.profileRemove(r,e.ref),g(null),await D(`Profile removed from this device`)})}function I(){O(`refresh`,async()=>{await D(`Profiles refreshed`)})}return(0,$.jsxs)(`section`,{className:`account-settings profile-settings`,children:[x?.mode===`local`?(0,$.jsxs)($.Fragment,{children:[C?(0,$.jsxs)($.Fragment,{children:[w&&t===`select`?(0,$.jsx)(Nn,{actions:(0,$.jsx)(Gn,{connection:r,onAdd:()=>m(!0),onRefresh:I,presentation:`menu`,profile:x,profileBusy:d,profileCommitMessage:l,selectedDefaultTeamId:S,syncDisabledReason:er(x,S),setProfileCommitMessage:u,submitProfileCommit:A,submitProfilePush:j}),busy:!!d,library:n?.profileLibrary??{lastUsed:null,profiles:[]},onSelect:M}):(0,$.jsxs)($.Fragment,{children:[w?(0,$.jsx)(Hn,{busy:!!d,library:n?.profileLibrary??{lastUsed:null,profiles:[]},onAdd:()=>m(!0),onRefresh:I,onRemove:g,onPublish:v,onUpdate:P,onSelect:M}):null,(0,$.jsx)(Gn,{connection:r,profile:x,profileBusy:d,profileCommitMessage:l,selectedDefaultTeamId:S,syncDisabledReason:er(x,S),setProfileCommitMessage:u,submitProfileCommit:A,submitProfilePush:j})]}),c]}):null,T?(0,$.jsx)(on,{connection:r,profile:x,selectedDefaultTeamId:S}):null,E?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Yn,{onSkillCommand:s,onEvaluate:e=>b({kind:`skill`,id:e}),profile:x}),(0,$.jsx)(Mn,{connection:r,focusTarget:y,selectedProfileKey:n?.profileLibrary?.lastUsed?JSON.stringify(n.profileLibrary.lastUsed):null},JSON.stringify(n?.profileLibrary?.lastUsed??null))]}):null]}):e===`agents`?(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Agents`}),(0,$.jsx)(`small`,{children:`Profile required`})]}),(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`No local Profile loaded`}),(0,$.jsx)(`span`,{children:`Open Profile to create or load a Profile before managing agents.`})]})]}):(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Summary`}),(0,$.jsx)(`small`,{children:`Not loaded`})]}),(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`No local Profile loaded`}),(0,$.jsx)(`span`,{children:`Create an empty Profile, start with an Agent template, or add an existing repository.`}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:!r||!!d,type:`button`,onClick:()=>m(!0),children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:`Create or add Profile`})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:!r||!!d,type:`button`,onClick:k,children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:d===`init`?`Creating`:`Create starter Profile`})]})]})]}),p?(0,$.jsx)(Un,{busy:!!d,onClose:()=>m(!1),onSubmit:N}):null,h?(0,$.jsx)(Wn,{busy:!!d,entry:h,onClose:()=>g(null),onConfirm:()=>F(h)}):null,_&&r?(0,$.jsx)(In,{connection:r,entry:_,onClose:()=>v(null),onPublished:e=>o?.(e,`success`)}):null]})}function Hn({busy:e,library:t,onAdd:n,onRefresh:r,onRemove:i,onPublish:a,onSelect:o,onUpdate:s}){return(0,$.jsxs)(`div`,{className:`account-list profile-catalog-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading profile-agent-list-heading`,children:[(0,$.jsx)(`span`,{children:`Profiles`}),(0,$.jsxs)(`div`,{className:`profile-skill-heading-actions`,children:[(0,$.jsxs)(`small`,{children:[t.profiles.length,` installed`]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:e,type:`button`,onClick:r,children:[(0,$.jsx)(J,{size:14}),(0,$.jsx)(`span`,{children:`Refresh`})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:e,type:`button`,onClick:n,children:[(0,$.jsx)(q,{size:14}),(0,$.jsx)(`span`,{children:`Add`})]})]})]}),t.profiles.map(n=>{let r=He(n.ref,t.lastUsed);return(0,$.jsxs)(`div`,{className:`product-row profile-catalog-row ${r?`selected`:``}`,role:`button`,tabIndex:e?-1:0,"aria-disabled":e,onClick:()=>{e||o(n)},onKeyDown:t=>{e||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),o(n))},children:[(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(Ne,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:n.name}),(0,$.jsx)(`span`,{title:n.repoPath,children:n.repoPath})]})]}),(0,$.jsx)(Zn,{status:{state:n.state.error?`warning`:`ready`,label:n.state.error?`error`:r?`current`:`ready`}}),(0,$.jsx)(`span`,{className:`profile-catalog-source`,children:n.ref.source.replace(`_`,` `)}),(0,$.jsx)(`span`,{className:`profile-catalog-summary`,children:n.state.summary.message}),(0,$.jsxs)(`span`,{className:`profile-catalog-actions`,children:[n.ref.source===`local`?null:(0,$.jsxs)(`span`,{className:`settings-secondary compact`,role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),s(n)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),s(n))},children:[(0,$.jsx)(J,{size:14}),(0,$.jsx)(`span`,{children:`Update`})]}),(0,$.jsxs)(`span`,{className:`settings-secondary compact`,role:`button`,tabIndex:0,onClick:e=>{e.stopPropagation(),a(n)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),a(n))},children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:`Publish`})]}),(0,$.jsxs)(`span`,{className:`settings-secondary compact profile-remove-button`,role:`button`,tabIndex:0,"aria-label":`Remove ${n.name}`,onClick:e=>{e.stopPropagation(),i(n)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),i(n))},children:[(0,$.jsx)(M,{size:14}),(0,$.jsx)(`span`,{children:`Remove`})]})]})]},`${n.ref.source}:${n.ref.repositoryId}:${n.ref.profileId}`)})]})}function Un({busy:e,onClose:t,onSubmit:n}){let[r,i]=(0,Q.useState)(`blank`),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``);function d(t){if(t.preventDefault(),e)return;if(r===`blank`){let e=l.trim();if(!e)return;n({source:r,path:a.trim()||null,profile:e});return}if(r===`local`){let e=a.trim();if(!e)return;n({source:r,path:e,profile:l.trim()||null});return}let i=s.trim();i&&n({source:r,repositoryId:i,profile:l.trim()||null})}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:t,children:(0,$.jsxs)(`form`,{className:`git-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`add-profile-title`,onMouseDown:e=>e.stopPropagation(),onSubmit:d,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:e,type:`button`,"aria-label":`Close`,onClick:t,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(Ne,{size:18})}),(0,$.jsx)(`h2`,{id:`add-profile-title`,children:`Add Profile`}),(0,$.jsx)(`p`,{children:`Create a blank Profile, add a local repository, or install a shareable Profile from Git.`}),(0,$.jsxs)(`div`,{className:`profile-add-source-options`,children:[(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,checked:r===`blank`,onChange:()=>i(`blank`)}),`New blank`]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,checked:r===`local`,onChange:()=>i(`local`)}),`Local`]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,checked:r===`github`,onChange:()=>i(`github`)}),`GitHub`]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`input`,{type:`radio`,checked:r===`openpond_git`,onChange:()=>i(`openpond_git`)}),`OpenPond Git`]})]}),r===`blank`?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Repository path (optional)`}),(0,$.jsx)(`input`,{disabled:e,value:a,placeholder:`Uses the default local Profile repository`,onChange:e=>o(e.currentTarget.value)})]}):r===`local`?(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Repository path`}),(0,$.jsx)(`input`,{autoFocus:!0,disabled:e,value:a,placeholder:`/path/to/profile-repo`,onChange:e=>o(e.currentTarget.value)})]}):(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsxs)(`span`,{children:[r===`github`?`GitHub`:`OpenPond Git`,` repository`]}),(0,$.jsx)(`input`,{autoFocus:!0,disabled:e,value:s,placeholder:`owner/repository`,onChange:e=>c(e.currentTarget.value)})]}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:r===`blank`?`Profile name`:`Profile name (optional)`}),(0,$.jsx)(`input`,{autoFocus:r===`blank`,disabled:e,value:l,placeholder:r===`blank`?`research`:`Uses repository default`,onChange:e=>u(e.currentTarget.value)})]}),(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:e,type:`button`,onClick:t,children:`Cancel`}),(0,$.jsx)(`button`,{className:`git-dialog-primary`,disabled:e||!(r===`blank`?l:r===`local`?a:s).trim(),type:`submit`,children:r===`blank`?`Create Profile`:`Add Profile`})]})]})})}function Wn({busy:e,entry:t,onClose:n,onConfirm:r}){return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:n,children:(0,$.jsxs)(`div`,{className:`git-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`remove-profile-title`,onMouseDown:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:e,type:`button`,"aria-label":`Close`,onClick:n,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(M,{size:18})}),(0,$.jsxs)(`h2`,{id:`remove-profile-title`,children:[`Remove `,t.name,`?`]}),(0,$.jsx)(`p`,{children:`This removes the Profile from OpenPond on this device. It does not delete the repository or any source files.`}),(0,$.jsxs)(`div`,{className:`profile-dialog-summary`,children:[(0,$.jsx)(`strong`,{children:t.name}),(0,$.jsx)(`span`,{children:t.repoPath})]}),(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:e,type:`button`,onClick:n,children:`Cancel`}),(0,$.jsx)(`button`,{className:`git-dialog-primary danger`,disabled:e,type:`button`,onClick:r,children:`Remove`})]})]})})}function Gn({connection:e,onAdd:t,onRefresh:n,presentation:r=`toolbar`,profile:i,profileBusy:a,profileCommitMessage:o,selectedDefaultTeamId:s,syncDisabledReason:c,setProfileCommitMessage:l,submitProfileCommit:u,submitProfilePush:d}){let[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),v=!e||!!a;return(0,$.jsxs)($.Fragment,{children:[r===`menu`&&t&&n?(0,$.jsx)(Pn,{addDisabled:!!a,commitDisabled:v,commitLabel:a===`commit`?`Committing`:`Commit`,refreshDisabled:v,repoDisabled:!!a||!i,syncDisabled:v||!i,syncLabel:a===`push`?`Syncing`:`Sync`,syncStatus:i?$n(i,s):null,onAdd:t,onCommit:()=>h(!0),onRefresh:n,onRepo:()=>p(!0),onSync:()=>_(!0)}):(0,$.jsx)(`div`,{className:`profile-control-panel`,children:(0,$.jsxs)(`div`,{className:`profile-control-toolbar`,children:[(0,$.jsxs)(`div`,{className:`profile-control-actions`,children:[(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:v,type:`button`,onClick:()=>h(!0),children:[(0,$.jsx)(ie,{size:14}),(0,$.jsx)(`span`,{children:a===`commit`?`Committing`:`Commit`})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:v||!i,type:`button`,onClick:()=>_(!0),children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:a===`push`?`Syncing`:`Sync`})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:!!a||!i,type:`button`,onClick:()=>p(!0),children:[(0,$.jsx)(Ne,{size:14}),(0,$.jsx)(`span`,{children:`Repo`})]}),i?(0,$.jsxs)(`span`,{className:`profile-hosted-status`,title:`Profile sync status: ${$n(i,s)}`,children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:`Profile sync`}),(0,$.jsx)(`strong`,{children:$n(i,s)})]}):null]}),i?(0,$.jsx)(`span`,{className:`profile-local-status ${i.summary.state}`,title:i.summary.message,children:i.summary.message}):null]})}),f&&i?(0,$.jsx)(Jn,{profile:i,profileBusy:a,onClose:()=>p(!1)}):null,m?(0,$.jsx)(Kn,{disabled:v,profileBusy:a,profileCommitMessage:o,setProfileCommitMessage:l,submitProfileCommit:u,onClose:()=>h(!1)}):null,g&&i?(0,$.jsx)(qn,{disabled:v,profile:i,profileBusy:a,selectedDefaultTeamId:s,syncDisabledReason:c,submitProfilePush:d,onClose:()=>_(!1)}):null]})}function Kn({disabled:e,profileBusy:t,profileCommitMessage:n,setProfileCommitMessage:r,submitProfileCommit:i,onClose:a}){function o(t){t.preventDefault(),!e&&(i(),a())}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:a,children:(0,$.jsxs)(`form`,{className:`git-dialog profile-commit-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`profile-commit-dialog-title`,onMouseDown:e=>e.stopPropagation(),onSubmit:o,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:!!t,type:`button`,title:`Close`,"aria-label":`Close`,onClick:a,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(ie,{size:18})}),(0,$.jsx)(`h2`,{id:`profile-commit-dialog-title`,children:`Commit profile`}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Commit message`}),(0,$.jsx)(`input`,{autoFocus:!0,value:n,disabled:!!t,placeholder:`Update OpenPond profile`,onChange:e=>r(e.target.value)})]}),(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:!!t,type:`button`,onClick:a,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`git-dialog-primary`,disabled:e,type:`submit`,children:[(0,$.jsx)(ie,{size:14}),(0,$.jsx)(`span`,{children:t===`commit`?`Committing`:`Commit`})]})]})]})})}function qn({disabled:e,profile:t,profileBusy:n,selectedDefaultTeamId:r,syncDisabledReason:i,submitProfilePush:a,onClose:o}){let s=tr(t,r),c=s.reduce((e,t)=>e+t.count,0),l=!e&&!i;function u(e){e.preventDefault(),l&&(a(),o())}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:o,children:(0,$.jsxs)(`form`,{className:`git-dialog profile-sync-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`profile-sync-dialog-title`,onMouseDown:e=>e.stopPropagation(),onSubmit:u,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:!!n,type:`button`,title:`Close`,"aria-label":`Close`,onClick:o,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(H,{size:18})}),(0,$.jsx)(`h2`,{id:`profile-sync-dialog-title`,children:`Sync profile`}),(0,$.jsx)(`p`,{className:`profile-sync-explainer`,children:`Sync publishes this committed Profile source for your team, so its Agents can be shared in team chat and attached to hosted sandboxes.`}),(0,$.jsxs)(`div`,{className:`profile-dialog-summary`,children:[(0,$.jsxs)(`strong`,{children:[c,` `,c===1?`item`:`items`,` out of sync`]}),(0,$.jsxs)(`span`,{children:[`Local `,Qn(t.summary.localHead??t.git?.head),` - Last pushed`,` `,Qn(t.hosted?.lastPushedLocalHead)]})]}),s.length?(0,$.jsx)(`div`,{className:`profile-dialog-diff-list`,"aria-label":`Profile sync differences`,children:s.map(e=>(0,$.jsxs)(`div`,{className:`profile-dialog-diff-row ${e.tone??``}`,children:[(0,$.jsx)(`strong`,{children:e.label}),(0,$.jsx)(`span`,{children:e.detail})]},e.label))}):(0,$.jsx)(`div`,{className:`profile-dialog-diff-list`,"aria-label":`Profile sync differences`,children:(0,$.jsxs)(`div`,{className:`profile-dialog-diff-row`,children:[(0,$.jsx)(`strong`,{children:`Aligned`}),(0,$.jsx)(`span`,{children:`Current local profile source has already been pushed.`})]})}),i?(0,$.jsx)(`div`,{className:`profile-dialog-warning`,children:i}):null,(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:!!n,type:`button`,onClick:o,children:`Cancel`}),(0,$.jsxs)(`button`,{className:`git-dialog-primary`,disabled:!l,type:`submit`,children:[(0,$.jsx)(H,{size:14}),(0,$.jsx)(`span`,{children:n===`push`?`Syncing`:`Confirm sync`})]})]})]})})}function Jn({profile:e,profileBusy:t,onClose:n}){return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:n,children:(0,$.jsxs)(`div`,{className:`git-dialog profile-path-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`profile-path-dialog-title`,onMouseDown:e=>e.stopPropagation(),children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,disabled:!!t,type:`button`,title:`Close`,"aria-label":`Close`,onClick:n,children:(0,$.jsx)(Y,{size:14})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(Ne,{size:18})}),(0,$.jsx)(`h2`,{id:`profile-path-dialog-title`,children:`Profile repo`}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Profile repo path`}),(0,$.jsx)(`input`,{"aria-label":`Profile repo path`,readOnly:!0,value:e.repoPath??``})]}),(0,$.jsxs)(`div`,{className:`profile-dialog-summary`,children:[(0,$.jsx)(`strong`,{children:e.git?.isRepo?`Git-backed`:`Git setup required`}),(0,$.jsxs)(`span`,{children:[e.git?.branch??`No branch`,` · `,Qn(e.git?.head)]})]}),(0,$.jsx)(`div`,{className:`git-dialog-footer`,children:(0,$.jsx)(`button`,{className:`git-dialog-secondary`,disabled:!!t,type:`button`,onClick:n,children:`Close`})})]})})}function Yn({onSkillCommand:e,onEvaluate:t,profile:n}){let r=n.skills.slice().sort((e,t)=>e.name.localeCompare(t.name)),i=!e;function a(t){e?.(t)}return(0,$.jsxs)(`div`,{className:`account-list profile-skill-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading profile-agent-list-heading`,children:[(0,$.jsx)(`span`,{children:`Skills`}),(0,$.jsx)(`div`,{className:`profile-skill-heading-actions`,children:(0,$.jsxs)(`small`,{children:[n.skillCatalog.skillCount,` tracked`]})})]}),r.length?(0,$.jsx)(`div`,{className:`profile-table-frame`,children:(0,$.jsxs)(`table`,{className:`profile-data-table profile-skill-table`,"aria-label":`Profile skills table`,children:[(0,$.jsxs)(`colgroup`,{children:[(0,$.jsx)(`col`,{className:`profile-skill-name-column`}),(0,$.jsx)(`col`,{className:`profile-skill-trigger-column`}),(0,$.jsx)(`col`,{className:`profile-skill-status-column`}),(0,$.jsx)(`col`,{className:`profile-skill-source-column`}),(0,$.jsx)(`col`,{className:`profile-skill-actions-column`})]}),(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Skill`}),(0,$.jsx)(`th`,{scope:`col`,children:`Trigger`}),(0,$.jsx)(`th`,{scope:`col`,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,children:`Source`}),(0,$.jsx)(`th`,{scope:`col`,children:`Actions`})]})}),(0,$.jsx)(`tbody`,{children:r.map(e=>(0,$.jsx)(Xn,{commandDisabled:i,onSkillCommand:a,onEvaluate:t,skill:e},e.name))})]})}):(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`No profile skills found`}),(0,$.jsx)(`span`,{children:`Use /skill create to add reusable profile instructions.`})]})]})}function Xn({commandDisabled:e,onSkillCommand:t,onEvaluate:n,skill:r}){let i=r.validationStatus===`valid`?{state:`ready`,label:`valid`}:{state:`warning`,label:r.validationStatus};return(0,$.jsxs)(`tr`,{className:`profile-skill-row`,children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-agent-identity`,children:[(0,$.jsx)(qe,{size:18}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:r.name}),(0,$.jsx)(`span`,{title:r.path,children:r.path})]})]})}),(0,$.jsx)(`td`,{className:`profile-skill-description`,title:r.description,children:r.description||`No description`}),(0,$.jsx)(`td`,{children:(0,$.jsx)(Zn,{status:i})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`div`,{className:`profile-agent-action`,children:(0,$.jsx)(`span`,{className:`profile-skill-source`,title:r.sourcePath,children:r.sourcePath})})}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`profile-skill-actions`,children:[n?(0,$.jsx)(`button`,{className:`settings-secondary compact`,type:`button`,onClick:()=>n(r.path),children:`Evaluate`}):null,(0,$.jsx)(`button`,{className:`settings-secondary compact`,disabled:e||!r.enabled,type:`button`,title:`Use ${r.name}`,onClick:()=>t(`$${r.name} `),children:(0,$.jsx)(`span`,{children:`Use`})}),(0,$.jsx)(`button`,{className:`settings-secondary compact`,disabled:e,type:`button`,title:`Edit ${r.name}`,onClick:()=>t(`/skill edit ${r.name} `),children:(0,$.jsx)(`span`,{children:`Edit`})})]})})]})}function Zn({status:e}){return(0,$.jsx)(`span`,{className:`profile-status-text ${e.state}`,children:e.label})}function Qn(e){return e?e.slice(0,10):`None`}function $n(e,t){return rr(e,t)?`Sync this account`:e.hosted?.sourceCommitSha?`${e.hosted.promotionStatus??`uploaded`} ${Qn(e.hosted.sourceCommitSha)}`:`Not pushed`}function er(e,t){return t?e.git?.head?e.git.dirty?`Commit local profile changes before syncing.`:null:`Commit the profile before syncing.`:`Select a default team before syncing.`}function tr(e,t){let n=[],r=e.summary.localHead??e.git?.head??null,i=e.hosted?.lastPushedLocalHead??null,a=e.summary.hostedHead??e.hosted?.sourceCommitSha??null;if(rr(e,t)&&n.push({label:`Account`,detail:`Hosted profile metadata was synced under a different default team.`,count:1,tone:`warning`}),!a&&!i?n.push({label:`Hosted source`,detail:`No hosted profile commit has been recorded.`,count:1}):r&&i&&r!==i&&n.push({label:`Commit`,detail:`Local ${Qn(r)} has not been pushed since ${Qn(i)}.`,count:1}),e.git?.dirty){let t=(e.git.fileCount??e.git.files.length)||(e.diff.fileCount??e.diff.files.length)||1;n.push({label:`Uncommitted files`,detail:`${t} local ${t===1?`file`:`files`} changed.`,count:t,tone:`warning`})}let o=e.diff.changedAgents.length+e.diff.newAgents.length+e.diff.deletedAgents.length+e.diff.changedSkills.length+e.diff.changedActions.length+e.diff.changedExtensions.length+e.diff.setupChanges.length+e.diff.envRequirementChanges.length;return o>0&&n.push({label:`Profile changes`,detail:nr(e),count:o,tone:e.git?.dirty?`warning`:void 0}),e.catalog.stale&&n.push({label:`Catalog`,detail:`Action catalog artifacts are stale or missing.`,count:1,tone:`warning`}),e.setupGate.blockingCount>0&&n.push({label:`Setup`,detail:`${e.setupGate.blockingCount} blocking setup ${e.setupGate.blockingCount===1?`requirement`:`requirements`}.`,count:e.setupGate.blockingCount,tone:`warning`}),n}function nr(e){let t=[],n=e.diff.changedAgents.length+e.diff.newAgents.length+e.diff.deletedAgents.length;return n&&t.push(`${n} agent ${n===1?`change`:`changes`}`),e.diff.changedActions.length&&t.push(`${e.diff.changedActions.length} action ${e.diff.changedActions.length===1?`change`:`changes`}`),e.diff.changedSkills.length&&t.push(`${e.diff.changedSkills.length} skill ${e.diff.changedSkills.length===1?`change`:`changes`}`),e.diff.changedExtensions.length&&t.push(`${e.diff.changedExtensions.length} extension ${e.diff.changedExtensions.length===1?`change`:`changes`}`),e.diff.setupChanges.length&&t.push(`${e.diff.setupChanges.length} setup ${e.diff.setupChanges.length===1?`change`:`changes`}`),e.diff.envRequirementChanges.length&&t.push(`${e.diff.envRequirementChanges.length} env ${e.diff.envRequirementChanges.length===1?`change`:`changes`}`),t.join(`, `)||`Profile source has local changes.`}function rr(e,t){let n=e.hosted?.teamId?.trim()??``;return!!(n&&t&&n!==t)}function ir({status:e,busy:t,flashTailscaleUp:n,refresh:r,enableRemoteAccess:i,disableRemoteAccess:a,copyRemoteLink:o,copyTailscaleUpCommand:s,copyServeCommand:c,copyServeSetupUrl:l,copyOperatorCommand:u,createRemoteLink:d}){let f=e?.tailscale.installed??!1,p=e?.serve.enabled??!1,m=e?.serve.reachable??!1,h=!!(e?.webUiAvailable&&f),g=p?!!e?.remoteWebUrl:h,_=(e?.tailscale.peers??[]).filter(e=>!e.isSelf),v=!!e?.tailscale.error?.includes(`set --operator`),y=!!(p&&e?.remoteWebUrl);return(0,$.jsxs)(`section`,{className:`account-settings remote-access-settings`,children:[(0,$.jsx)(`h1`,{children:`Remote access`}),(0,$.jsxs)(`div`,{className:`account-summary remote-access-summary`,children:[(0,$.jsxs)(`div`,{className:`account-summary-main`,children:[(0,$.jsx)(`div`,{className:`remote-access-icon ${m?`online`:p?`configured`:``}`,children:f?(0,$.jsx)(ot,{size:18}):(0,$.jsx)(ne,{size:18})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:m?`Tailscale Serve is reachable`:p?`Tailscale Serve is configured`:`Tailscale Serve is off`}),(0,$.jsx)(`small`,{children:e?lr(e):`Checking Tailscale`})]})]}),(0,$.jsxs)(`div`,{className:`account-summary-actions`,children:[(0,$.jsx)(`button`,{type:`button`,className:`settings-icon-button`,title:`Refresh remote access`,"aria-label":`Refresh remote access`,disabled:t!==null,onClick:()=>void r(),children:(0,$.jsx)(J,{className:t===`refresh`?`settings-spin`:``,size:15})}),(0,$.jsxs)(`button`,{type:`button`,className:`settings-secondary`,disabled:t!==null||!f||!p&&!h,onClick:()=>void(p?a():i()),children:[(0,$.jsx)(be,{size:15}),(0,$.jsx)(`span`,{children:p?t===`disable`?`Turning off`:`Turn off`:t===`enable`?`Turning on`:`Turn on`})]})]})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsx)(`div`,{className:`account-list-heading remote-access-link-heading`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`OpenPond link`}),(0,$.jsx)(`small`,{children:y?`Browser UI`:`Tailscale + Serve`})]})}),y&&(0,$.jsx)(ar,{label:`Remote URL`,value:e?.remoteWebUrl??null,actionLabel:t===`copy-link`?`Copying`:`Copy`,disabled:!e?.remoteWebUrl||t!==null,onAction:o}),(0,$.jsx)(ar,{label:`Tailscale up`,value:e?.tailscaleUpCommand??null,flash:n,actionLabel:t===`copy-up-command`?`Copying`:`Copy`,disabled:!e?.tailscaleUpCommand||t!==null,onAction:s}),(0,$.jsx)(ar,{label:`Serve command`,value:e?.serveCommand??null,actionLabel:t===`copy-command`?`Copying`:`Copy`,disabled:!e?.serveCommand||t!==null,onAction:c}),e?.serve.setupUrl&&(0,$.jsx)(ar,{label:`Enable Serve`,value:e.serve.setupUrl,actionLabel:t===`copy-serve-setup`?`Copying`:`Copy`,disabled:t!==null,onAction:l}),v&&(0,$.jsx)(ar,{label:`One-time setup`,value:e?.operatorCommand??null,actionLabel:t===`copy-operator`?`Copying`:`Copy`,disabled:!e?.operatorCommand||t!==null,onAction:u}),(0,$.jsx)(ar,{label:`Local target`,value:e?.localUrl??null}),e?.tailscale.authUrl&&(0,$.jsx)(ar,{label:`Tailscale login`,value:e.tailscale.authUrl}),(0,$.jsx)(ar,{label:`Disable command`,value:e?.disableCommand??null})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading remote-access-link-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{children:`Authorized clients`}),(0,$.jsxs)(`small`,{children:[_.length,` devices`]})]}),(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:t!==null||!g,onClick:()=>void d(),children:(0,$.jsx)(`span`,{children:p?`Copy link`:`Create link`})})]}),e?_.length===0?(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`No clients reported`}),(0,$.jsx)(`span`,{children:e?.tailscale.running?`Tailscale did not return peer devices.`:`Tailscale is not running.`})]}):_.map(e=>(0,$.jsx)(cr,{peer:e},e.id)):(0,$.jsxs)(`div`,{className:`empty-account-list`,children:[(0,$.jsx)(`strong`,{children:`Checking clients`}),(0,$.jsx)(`span`,{children:`Loading tailnet devices.`})]})]}),(0,$.jsxs)(`div`,{className:`account-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Remote environment`}),(0,$.jsx)(`small`,{children:e?.tailscale.tailnetName??`Tailnet`})]}),(0,$.jsx)(or,{status:e})]}),e?.serve.configText&&(0,$.jsxs)(`div`,{className:`remote-access-config`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Tailscale config`}),(0,$.jsx)(`small`,{children:e.serve.enabled?`OpenPond target found`:`No OpenPond target`})]}),(0,$.jsx)(`pre`,{children:e.serve.configText})]})]})}function ar({actionLabel:e,disabled:t,flash:n,label:r,onAction:i,value:a}){return(0,$.jsxs)(`div`,{className:`product-row remote-access-value-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{className:n?`flash`:void 0,children:r}),(0,$.jsx)(`code`,{children:a??`Not available`})]}),i&&(0,$.jsx)(`button`,{type:`button`,className:`settings-secondary`,disabled:t,onClick:()=>void i(),children:(0,$.jsx)(`span`,{children:e??`Copy`})})]})}function or({status:e}){let t=[{label:`State`,value:e?.tailscale.backendState??`Unknown`},{label:`Machine`,value:e?.tailscale.machineName??`Unknown`},{label:`Tailnet`,value:e?.tailscale.tailnetName??`Unknown`}],n=[{label:`Tailscale IP`,value:e?.tailscale.tailscaleIps.join(`, `)||`Unknown`},{label:`HTTPS host`,value:e?.serve.httpsHost??e?.tailscale.dnsName??`Unknown`}];return(0,$.jsxs)(`div`,{className:`remote-access-environment`,children:[(0,$.jsx)(`div`,{className:`remote-access-environment-row three`,children:t.map(e=>(0,$.jsx)(sr,{label:e.label,value:e.value},e.label))}),(0,$.jsx)(`div`,{className:`remote-access-environment-row two`,children:n.map(e=>(0,$.jsx)(sr,{label:e.label,value:e.value},e.label))})]})}function sr({label:e,value:t}){return(0,$.jsxs)(`div`,{className:`remote-access-environment-cell`,children:[(0,$.jsx)(`strong`,{children:e}),(0,$.jsx)(`span`,{children:t})]})}function cr({peer:e}){return(0,$.jsxs)(`div`,{className:`account-row remote-access-peer-row`,children:[(0,$.jsx)(`div`,{className:`remote-access-peer-dot ${e.online?`online`:``}`}),(0,$.jsxs)(`div`,{className:`account-details`,children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{children:e.dnsName??e.tailscaleIps[0]??`No address`})]}),(0,$.jsx)(`span`,{className:`account-state ${e.online?`signed_in`:``}`,children:e.online?`Online`:`Offline`}),(0,$.jsx)(`span`,{className:`account-state`,children:e.os??`Unknown`})]})}function lr(e){return e.tailscale.installed?e.tailscale.running?e.webUiAvailable?e.serve.reachable?e.remoteUrl??`Tailnet link ready`:e.remoteUrl?`${e.remoteUrl} ready to configure`:`Tailnet DNS unavailable`:`Browser UI is not served by this process`:e.tailscale.authUrl?`Tailscale needs sign-in`:`Tailscale is not running`:`Tailscale is not installed`}function ur({device:e,self:t,busy:n,webBaseUrl:r,teamId:i,act:a}){let[o,s]=(0,Q.useState)(e.name);(0,Q.useEffect)(()=>s(e.name),[e.name]);let c=i===null?`remoteScope=personal`:`remoteTeam=${encodeURIComponent(i)}`,l=r?`${r}/?remoteDevice=${encodeURIComponent(e.id)}&${c}`:null;return(0,$.jsxs)(`div`,{className:`account-summary remote-access-summary`,children:[(0,$.jsxs)(`div`,{className:`remote-access-device-details`,children:[(0,$.jsxs)(`strong`,{children:[e.name,t?` · This computer`:``]}),(0,$.jsxs)(`small`,{children:[e.status.replaceAll(`_`,` `),` · `,e.taskCount,` tasks at last sync`]}),(0,$.jsxs)(`small`,{children:[`Last seen`,` `,e.lastSeenAt?new Date(e.lastSeenAt).toLocaleString():`never`,` `,`· Catalog synced`,` `,e.lastCatalogSyncAt?new Date(e.lastCatalogSyncAt).toLocaleString():`never`]}),(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Computer name`}),(0,$.jsx)(`input`,{value:o,maxLength:200,disabled:n,onChange:e=>s(e.target.value)})]})]}),(0,$.jsxs)(`div`,{className:`account-summary-actions`,children:[l&&(0,$.jsx)(`a`,{className:`settings-secondary`,href:l,target:`_blank`,rel:`noreferrer`,children:`Open tasks`}),(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:n||!o.trim()||o.trim()===e.name,onClick:()=>void a(`rename`,{deviceId:e.id,revision:e.revision,name:o.trim()}),children:`Save name`}),(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:n||!e.enabled,onClick:()=>void a(t?`disable`:`disable-device`,t?{}:{deviceId:e.id,revision:e.revision}),children:`Turn off`}),(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:n,onClick:()=>void a(`remove`,{deviceId:e.id,revision:e.revision}),children:`Remove`})]})]})}var dr={signed_out:`Sign in required`,connecting:`Connecting`,connected:`Connected`,reconnecting:`Reconnecting`,offline:`Offline`,off:`Off`,update_required:`Update required`},fr={protocol_unsupported:`Install the latest OpenPond desktop app to connect to this relay.`,authentication_timeout:`The relay did not confirm authentication. Retry the connection.`,authentication_expired:`Relay authentication expired. Retry the connection.`,relay_backpressure:`The relay is busy. OpenPond will retry automatically.`,connection_lost:`The relay connection was lost. OpenPond will retry automatically.`,connection_failed:`Unable to reach the relay. Check your network connection and retry.`};function pr(e,t){return e instanceof Error?e.message===`remote_account_changing`?`Your account settings are being updated. Try again shortly.`:e.message:t}function mr({connection:e,onError:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(0),d=(0,Q.useRef)(n),f=(0,Q.useRef)(!1),p=(0,Q.useRef)(null),m=(0,Q.useCallback)(async()=>{if(p.current)return;let t=++u.current;if(!e){d.current=null,r(null);return}let n=new AbortController;p.current=n,l(null);try{let i=await A(e,`/v1/account-remote-access`,{signal:AbortSignal.any([n.signal,AbortSignal.timeout(15e3)])});u.current===t&&(d.current=i,r(i))}catch(e){!n.signal.aborted&&u.current===t&&l(e instanceof Error&&e.name===`TimeoutError`?`Loading your computers timed out. Retry to load their current status.`:pr(e,`Unable to load your computers.`))}finally{p.current===n&&(p.current=null)}},[e]);(0,Q.useEffect)(()=>{d.current=null,r(null),l(null),m();let e=Date.now(),t=window.setInterval(()=>{f.current||([`connecting`,`reconnecting`].includes(d.current?.state??``)||Date.now()-e>=15e3)&&(e=Date.now(),m())},1e3);return()=>{++u.current,p.current?.abort(),p.current=null,window.clearInterval(t)}},[m]),(0,Q.useEffect)(()=>{a(null);let t=n?.team?.id;if(!e||!n?.account||!t)return;let r=!0;return ve.organizations(e).then(e=>{let n=e.organizations.map(he).find(e=>e?.teamId===t);r&&n&&a(n.displayName||n.name||n.slug)}).catch(()=>{}),()=>{r=!1}},[e,n?.account?.id,n?.team?.id]);async function h(n,i={}){if(!e||f.current)return;p.current?.abort(),p.current=null;let a=++u.current;f.current=!0,s(!0),t(null);try{let t=await A(e,`/v1/account-remote-access/${n}`,{method:`POST`,body:JSON.stringify(i)});u.current===a&&(d.current=t,r(t))}catch(e){u.current===a&&(t(pr(e,`Unable to update remote access.`)),await m())}finally{f.current=!1,s(!1)}}let g=!!n?.account;return(0,$.jsxs)(`section`,{className:`account-settings remote-access-settings`,children:[(0,$.jsx)(`h1`,{children:`Remote access`}),(0,$.jsx)(`p`,{children:`View this computer’s tasks and send instructions from your signed-in OpenPond account. Tasks run on this computer.`}),n?.account&&(0,$.jsxs)(`p`,{children:[`Account: `,n.account.label,` · `,n.team?`Workspace: ${i??n.team.id}`:`Personal account`]}),(0,$.jsxs)(`div`,{className:`account-summary remote-access-summary`,children:[(0,$.jsx)(`div`,{className:`account-summary-main`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[`This computer`,n?.device?.name?` · ${n.device.name}`:``]}),(0,$.jsx)(`small`,{role:`status`,children:n?dr[n.state]:c?`Unable to load`:`Checking connection…`}),n?.device&&(0,$.jsxs)(`small`,{children:[`Catalog synced`,` `,n.device.lastCatalogSyncAt?new Date(n.device.lastCatalogSyncAt).toLocaleString():`never`]})]})}),(0,$.jsxs)(`div`,{className:`account-summary-actions`,children:[(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:o||!g,onClick:()=>void h(n?.enabled?`disable`:`enable`),children:o?`Updating…`:n?.enabled?`Turn off`:`Turn on`}),(0,$.jsx)(`button`,{className:`settings-secondary`,type:`button`,disabled:o||(n?!g||!n.enabled:!e||!c),onClick:()=>n?void h(`retry`):void m(),children:n?`Retry connection`:`Retry loading`})]})]}),c&&(0,$.jsx)(X,{error:c}),n?.state===`signed_out`&&(0,$.jsx)(`p`,{children:`Sign in from Settings → Account to connect this computer.`}),n?.account&&!n.team&&(0,$.jsx)(`p`,{children:`Personal access includes tasks owned by your OpenPond account. To use workspace tasks, select that workspace in Settings → Account.`}),n?.team&&(0,$.jsx)(`p`,{children:`This connection includes tasks owned by the selected workspace. Choose Personal account in Settings → Account to use your personal tasks.`}),n?.reason&&fr[n.reason]&&(0,$.jsxs)(`p`,{role:`status`,children:[fr[n.reason],n.state===`update_required`&&n.minimumSupportedProtocolVersion?` This relay requires protocol ${n.minimumSupportedProtocolVersion}; this app uses protocol ${n.supportedProtocolVersion}.`:``]}),n?.device?.removed&&(0,$.jsx)(`p`,{children:`This computer was removed. Turn on remote access here to enroll it again.`}),(0,$.jsx)(`p`,{children:`Turning off remote access applies to your personal account and its workspaces on this computer. It stays off after restart and sign-in until you turn it on here. Sleeping or closing the app makes this computer unavailable.`}),(0,$.jsx)(`p`,{children:`History fetched through OpenPond may be cached for 24 hours. Turning off or removing a computer blocks remote history and controls; its local history stays on that computer.`}),(0,$.jsx)(`h2`,{children:`Your computers`}),n?.devices.length===0&&(0,$.jsx)(`p`,{children:`No computers are enrolled.`}),n?.devices.map(e=>(0,$.jsx)(ur,{device:e,self:e.id===n.device?.id,busy:o,webBaseUrl:n.webBaseUrl,teamId:n.team?.id??null,act:h},e.id))]})}var hr=[{items:[{section:`account`,label:`Account`,Icon:lt},{section:`ponder`,label:`Pal`,Icon:z},{section:`notifications`,label:`Notifications`,Icon:R},{section:`providers`,label:`Providers`,Icon:le},{section:`conversation-imports`,label:`Conversation imports`,Icon:J},{section:`usage`,label:`Activity`,Icon:ke}]},{label:`Harness`,items:[{section:`harness`,label:`Overview`,Icon:I},{section:`harness-refiner`,label:`Refiner`,Icon:We},{section:`harness-continuous-review`,label:`Continuous Review`,Icon:J},{section:`harness-contents`,label:`Contents`,Icon:Me},{section:`harness-releases`,label:`Releases`,Icon:N}]},{label:`Customization`,items:[{section:`appearance`,label:`Appearance`,Icon:ct},{section:`configuration`,label:`Configuration`,Icon:ct},{section:`personalization`,label:`Personalization`,Icon:We},{section:`editor`,label:`Editor`,Icon:L},{section:`skills`,label:`Skills`,Icon:qe}]},{label:`Agents`,items:[{section:`profile`,label:`Profiles`,Icon:lt},{section:`subagents`,label:`Agents`,Icon:z}]},{label:`System`,items:[{section:`dataset-storage`,label:`Dataset Storage`,Icon:at},{section:`remote`,label:`Remote Access`,Icon:ot},{section:`diagnostics`,label:`Diagnostics`,Icon:ee}]}];function gr({section:e,onBack:t,onSectionChange:n}){return(0,$.jsxs)(`aside`,{className:`settings-sidebar`,children:[(0,$.jsxs)(`button`,{className:`settings-back`,"aria-label":`Back to app`,onClick:t,children:[(0,$.jsx)(ge,{size:15}),(0,$.jsx)(`span`,{children:`Back to app`})]}),(0,$.jsx)(`nav`,{className:`settings-nav`,"aria-label":`Settings`,children:hr.map((t,r)=>(0,$.jsxs)(`div`,{className:`settings-nav-group`,children:[t.label?(0,$.jsx)(`div`,{className:`settings-nav-heading`,children:t.label}):null,t.items.map(({section:t,label:r,Icon:i})=>(0,$.jsxs)(`button`,{className:`settings-nav-item ${e===t?`active`:``}`,onClick:()=>n(t),children:[(0,$.jsx)(i,{size:16}),(0,$.jsx)(`span`,{children:r})]},t))]},t.label??`settings-${r}`))})]})}function _r({skills:e,connection:t,onOpenSkill:n}){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(null),s=(0,Q.useRef)(0);fe(a),(0,Q.useEffect)(()=>(s.current++,i(null),()=>{s.current++}),[t]);async function c(e){if(!t||r)return;let a=++s.current;i(e.name),o(null);try{let r=await Promise.all([`SKILL.md`,...e.resourceFiles].map(async n=>{let r=await Z.skillSourceFile(t,`builtin`,e.name,n);if(r.isBinary||r.content===null)throw Error(`This skill file cannot be displayed as text.`);return{path:n,body:r.content}}));s.current===a&&n({name:e.name,description:e.description,path:e.path,body:r[0].body,files:r})}catch(e){s.current===a&&o(e instanceof Error?e.message:`Could not open this skill.`)}finally{s.current===a&&i(null)}}return(0,$.jsxs)(`div`,{className:`account-list native-skills-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`OpenPond skills`}),(0,$.jsx)(`small`,{children:`Included and enabled automatically with Desktop`})]}),(0,$.jsx)(`div`,{className:`profile-table-frame`,children:(0,$.jsxs)(`table`,{className:`profile-data-table built-in-skills-table`,"aria-label":`Built-in OpenPond skills`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{scope:`col`,children:`Skill`}),(0,$.jsx)(`th`,{scope:`col`,children:`Purpose`}),(0,$.jsx)(`th`,{scope:`col`,children:`Status`}),(0,$.jsx)(`th`,{scope:`col`,children:`Source`})]})}),(0,$.jsx)(`tbody`,{children:e.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`strong`,{children:e.name})}),(0,$.jsx)(`td`,{children:e.description}),(0,$.jsx)(`td`,{children:e.enabled&&e.validationStatus===`valid`?`Ready · Built in`:`Needs repair`}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`button`,{className:`settings-secondary compact`,type:`button`,disabled:!t||!!r||e.validationStatus!==`valid`,onClick:()=>void c(e),"aria-label":`Open ${e.name} instructions`,children:r===e.name?`Opening…`:`Open`})})]},e.name))})]})})]})}function vr({catalog:e,connection:t,onCatalog:n,onError:r,onOpenExtension:i,onToast:a}){let[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),g=(0,Q.useCallback)(e=>{let t=e instanceof Error?e.message:String(e);h(t),r(t),a?.(t,`error`)},[r,a]),_=(0,Q.useCallback)(()=>{h(null),r(null)},[r]),v=(0,Q.useCallback)(async e=>{if(e?.preventDefault(),t&&o.trim()&&!f){_(),p(`preview`);try{let e=await Z.extensionPreview(t,{source:o.trim(),...c.trim()?{ref:c.trim()}:{}});d(e)}catch(e){d(null),g(e)}finally{p(null)}}},[f,_,t,g,c,o]),y=(0,Q.useCallback)(async()=>{if(t&&u&&!f){_(),p(`install`);try{let e=await Z.extensionAdd(t,{source:u.repositoryUrl,ref:u.requestedRef});n(e.catalog),s(``),l(``),d(null),a?.(`Installed ${e.extension.owner}/${e.extension.repo}.`,`success`)}catch(e){g(e)}finally{p(null)}}},[f,_,t,n,a,u,g]),b=(0,Q.useCallback)(async e=>{if(t&&!f){_(),p(`update:${e.id}`);try{let r=await Z.extensionUpdate(t,e);n(r.catalog);let i=r.extension.resolvedCommit===e.resolvedCommit&&r.extension.packageHash===e.packageHash;a?.(i?`${e.owner}/${e.repo} is already current.`:`Updated ${e.owner}/${e.repo}.`,`success`)}catch(e){g(e)}finally{p(null)}}},[f,_,t,n,a,g]),x=(0,Q.useCallback)(async()=>{if(t&&!f&&e.extensions.length!==0){_(),p(`update-all`);try{let e=await Z.extensionUpdateAll(t);n(e.catalog);let r=`Updated ${e.updated.length}; ${e.unchanged.length} already current${e.failed.length?`; ${e.failed.length} failed`:``}.`;a?.(r,e.failed.length?`error`:`success`),e.failed.length&&h(e.failed.map(e=>e.error).join(` `))}catch(e){g(e)}finally{p(null)}}},[f,e.extensions.length,_,t,n,a,g]),S=(0,Q.useCallback)(async e=>{if(t&&!f&&window.confirm(`Remove ${e.owner}/${e.repo} and its ${e.skills.length} installed skill${e.skills.length===1?``:`s`}? Profile and built-in skills will not be changed.`)){_(),p(`remove:${e.id}`);try{n((await Z.extensionRemove(t,e)).catalog),a?.(`Removed ${e.owner}/${e.repo}.`,`success`)}catch(e){g(e)}finally{p(null)}}},[f,_,t,n,a,g]),C=(0,Q.useCallback)(e=>{s(e),d(null),h(null)},[]),w=(0,Q.useCallback)(e=>{l(e),d(null),h(null)},[]);return(0,$.jsxs)(`div`,{className:`account-list native-skills-list github-extensions-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading github-extensions-heading`,children:[(0,$.jsx)(`span`,{children:`Third-party extensions`}),(0,$.jsxs)(`div`,{className:`github-extensions-heading-actions`,children:[(0,$.jsxs)(`small`,{children:[e.extensions.length,` installed from GitHub`]}),(0,$.jsxs)(`button`,{className:`settings-secondary compact`,disabled:!t||f!==null||e.extensions.length===0,type:`button`,onClick:()=>void x(),children:[f===`update-all`?(0,$.jsx)(ce,{className:`settings-spin`,size:13}):(0,$.jsx)(J,{size:13}),`Update all`]})]})]}),(0,$.jsxs)(`form`,{className:`github-extension-add`,onSubmit:e=>void v(e),children:[(0,$.jsxs)(`div`,{className:`github-extension-add-copy`,children:[(0,$.jsx)(`strong`,{children:`Add a GitHub skill pack`}),(0,$.jsx)(`span`,{children:`Use a skills-CLI-compatible owner/repo or GitHub URL. OpenPond installs it locally without running setup code.`})]}),(0,$.jsxs)(`label`,{children:[(0,$.jsx)(`span`,{children:`Repository`}),(0,$.jsx)(`input`,{disabled:!t||f!==null,placeholder:`owner/repo`,value:o,onChange:e=>C(e.target.value)})]}),(0,$.jsxs)(`label`,{className:`github-extension-ref-input`,children:[(0,$.jsx)(`span`,{children:`Branch, tag, or SHA`}),(0,$.jsx)(`input`,{disabled:!t||f!==null,placeholder:`Default branch`,value:c,onChange:e=>w(e.target.value)})]}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:!t||!o.trim()||f!==null,type:`submit`,children:[f===`preview`?(0,$.jsx)(ce,{className:`settings-spin`,size:14}):(0,$.jsx)(Ue,{size:14}),f===`preview`?`Checking`:`Preview`]})]}),m??e.error?(0,$.jsx)(X,{error:m??e.error}):null,u?(0,$.jsxs)(`div`,{className:`github-extension-preview`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[u.owner,`/`,u.repo]}),(0,$.jsxs)(`span`,{children:[u.skills.length,` skill`,u.skills.length===1?``:`s`,` at `,u.resolvedCommit.slice(0,12)]})]}),(0,$.jsx)(`div`,{className:`github-extension-preview-skills`,children:u.skills.map(e=>(0,$.jsx)(`span`,{children:e.name},e.relativePath))}),(0,$.jsxs)(`button`,{className:`settings-secondary`,disabled:f!==null,type:`button`,onClick:()=>void y(),children:[f===`install`?(0,$.jsx)(ce,{className:`settings-spin`,size:14}):(0,$.jsx)(q,{size:14}),f===`install`?`Installing`:`Install extension`]})]}):null,e.extensions.length?e.extensions.map(e=>{let n=f===`update:${e.id}`,r=f===`remove:${e.id}`;return(0,$.jsxs)(`div`,{className:`github-extension-row`,children:[(0,$.jsxs)(`button`,{"aria-label":`Open ${e.owner}/${e.repo} extension source`,className:`github-extension-open`,disabled:!t||f!==null,type:`button`,onClick:()=>i(e),children:[(0,$.jsx)(`span`,{className:`native-skill-icon`,"aria-hidden":`true`,children:(0,$.jsx)(Ue,{size:17})}),(0,$.jsxs)(`span`,{className:`native-skill-identity`,children:[(0,$.jsxs)(`strong`,{children:[e.owner,`/`,e.repo]}),(0,$.jsx)(`span`,{children:e.skills.map(e=>e.name).join(`, `)})]}),(0,$.jsxs)(`span`,{className:`native-skill-provider`,children:[(0,$.jsxs)(`strong`,{children:[e.skills.length,` skill`,e.skills.length===1?``:`s`]}),(0,$.jsxs)(`span`,{children:[e.requestedRef,` · `,e.resolvedCommit.slice(0,12)]})]}),(0,$.jsx)(`span`,{className:`native-skill-status ${e.validationStatus===`valid`?``:`invalid`}`,children:e.validationStatus===`valid`?`Ready`:`Needs attention`}),(0,$.jsx)(V,{size:16,"aria-hidden":`true`})]}),(0,$.jsxs)(`span`,{className:`github-extension-row-actions`,children:[(0,$.jsx)(`button`,{"aria-label":`Update ${e.owner}/${e.repo}`,className:`settings-icon-button ghost`,disabled:f!==null,title:`Update extension`,type:`button`,onClick:()=>void b(e),children:n?(0,$.jsx)(ce,{className:`settings-spin`,size:14}):(0,$.jsx)(J,{size:14})}),(0,$.jsx)(`button`,{"aria-label":`Remove ${e.owner}/${e.repo}`,className:`settings-icon-button ghost danger`,disabled:f!==null,title:`Remove extension`,type:`button`,onClick:()=>void S(e),children:r?(0,$.jsx)(ce,{className:`settings-spin`,size:14}):(0,$.jsx)(M,{size:14})})]})]},e.id)}):(0,$.jsx)(`div`,{className:`skills-settings-empty`,children:`No third-party extensions installed.`})]})}function yr({onOpenSkill:e,onOpenExtension:t,personalSkills:n,builtInSkills:r,extensionCatalog:i,connection:a,onExtensionCatalog:o,onError:s,onToast:c}){return(0,$.jsxs)(`section`,{className:`account-settings skills-settings`,"aria-labelledby":`skills-settings-title`,children:[(0,$.jsx)(`header`,{className:`skills-settings-header`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{id:`skills-settings-title`,children:`Skills`}),(0,$.jsx)(`p`,{children:`Install third-party GitHub packs, inspect personal Codex skills, and view instructions bundled with OpenPond.`})]})}),(0,$.jsx)(_r,{skills:r,connection:a,onOpenSkill:e}),(0,$.jsx)(vr,{catalog:i,connection:a,onCatalog:o,onError:s,onOpenExtension:t,onToast:c}),(0,$.jsxs)(`div`,{className:`account-list native-skills-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Personal Codex skills`}),(0,$.jsx)(`small`,{children:`Discovered from your local Codex skills folder`})]}),n.length?n.map(e=>(0,$.jsxs)(`div`,{className:`native-skill-row personal-skill-row`,children:[(0,$.jsx)(`span`,{className:`native-skill-icon`,"aria-hidden":`true`,children:(0,$.jsx)(qe,{size:17})}),(0,$.jsxs)(`span`,{className:`native-skill-identity`,children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsx)(`span`,{children:e.description||`Packaged Codex skill`})]}),(0,$.jsxs)(`span`,{className:`native-skill-provider`,children:[(0,$.jsx)(`strong`,{children:e.resourceFiles.length?`${e.resourceFiles.length} packaged resource${e.resourceFiles.length===1?``:`s`}`:`Instructions only`}),(0,$.jsx)(`span`,{children:e.sourcePath})]}),(0,$.jsx)(`span`,{className:`native-skill-status ${e.validationStatus===`valid`?``:`invalid`}`,children:e.validationStatus===`valid`?`Ready`:`Needs attention`}),(0,$.jsx)(`span`,{"aria-hidden":`true`})]},e.sourcePath)):(0,$.jsx)(`div`,{className:`skills-settings-empty`,children:`No personal Codex skills found.`})]}),(0,$.jsxs)(`div`,{className:`account-list native-skills-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`App integration skills`}),(0,$.jsx)(`small`,{children:`Bundled with this OpenPond build`})]}),Le.map(t=>{let n=ze(t.provider)?.label??t.provider;return(0,$.jsxs)(`button`,{className:`native-skill-row`,type:`button`,onClick:()=>e(t),children:[(0,$.jsx)(`span`,{className:`native-skill-icon`,"aria-hidden":`true`,children:(0,$.jsx)(qe,{size:17})}),(0,$.jsxs)(`span`,{className:`native-skill-identity`,children:[(0,$.jsx)(`strong`,{children:t.name}),(0,$.jsx)(`span`,{children:t.description})]}),(0,$.jsxs)(`span`,{className:`native-skill-provider`,children:[(0,$.jsx)(`strong`,{children:n}),(0,$.jsx)(`span`,{children:t.path})]}),(0,$.jsx)(`span`,{className:`native-skill-status`,children:`Built in`}),(0,$.jsx)(V,{size:16,"aria-hidden":`true`})]},t.name)})]})]})}var br=`default`;function xr({connection:e,embedded:t=!1,onError:n,onPreferences:r,preferences:i,providers:a}){let o=i.training,[s,c]=(0,Q.useState)(Sr(o.defaultModelRef)),[l,u]=(0,Q.useState)(o.creationMode),[d,f]=(0,Q.useState)(o.autoApproveEvidence),[p,m]=(0,Q.useState)(!1),h=(0,Q.useMemo)(()=>y(a,{includeUnavailable:!0}),[a]),g=(0,Q.useMemo)(()=>h.map(e=>({provider:e,models:D(e.value,a)})).filter(e=>e.models.length>0),[h,a]),_=Cr(s),b=v(i.defaultChatProvider,i.defaultChatModel,a)?` · ${wr(i.codexReasoningEffort)} reasoning`:``,x=Tr(_,o.defaultModelRef??null)&&l===o.creationMode&&d===o.autoApproveEvidence;(0,Q.useEffect)(()=>{c(Sr(o.defaultModelRef)),u(o.creationMode),f(o.autoApproveEvidence)},[i.defaultChatModel,i.defaultChatProvider,o.autoApproveEvidence,o.creationMode,o.defaultModelRef]);async function C(t){if(t.preventDefault(),e){m(!0),n(null);try{r(await Z.savePreferences(e,{training:{defaultModelRef:_,creationMode:l,autoApproveEvidence:d}}))}catch(e){n(e instanceof Error?e.message:String(e))}finally{m(!1)}}}return(0,$.jsxs)(`section`,{className:`account-settings training-settings${t?` embedded`:``}`,children:[t?null:(0,$.jsx)(`h1`,{children:`Ponder settings`}),(0,$.jsxs)(`form`,{className:`provider-settings-form`,onSubmit:e=>void C(e),children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Taskset authoring`}),(0,$.jsx)(`small`,{children:`The coding model that proposes tasks, graders, fixtures, and policy boundaries`})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Authoring model`}),(0,$.jsxs)(`select`,{value:s,disabled:p,onChange:e=>c(e.target.value),children:[(0,$.jsxs)(`option`,{value:br,children:[`Use chat default — `,S(i.defaultChatProvider,a),` · `,T(i.defaultChatModel,a,i.defaultChatProvider),b]}),g.map(e=>(0,$.jsx)(`optgroup`,{label:e.provider.label,children:e.models.map(t=>(0,$.jsx)(`option`,{value:Sr({providerId:e.provider.value,modelId:t.value}),children:t.label},t.value))},e.provider.value))]}),(0,$.jsx)(`small`,{children:`By default, /train follows the same provider, model, and reasoning level selected for chat.`})]})}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Default flow`}),(0,$.jsx)(`small`,{children:`Used by /train and Task Creator unless you choose another mode`})]}),(0,$.jsx)(`div`,{className:`provider-settings-grid single`,children:(0,$.jsxs)(`label`,{className:`settings-select-field`,children:[(0,$.jsx)(`span`,{children:`Task Creator mode`}),(0,$.jsxs)(`select`,{value:l,disabled:p,onChange:e=>u(e.target.value),children:[(0,$.jsx)(`option`,{value:`customize`,children:`Guided plan — review and revise before materializing`}),(0,$.jsx)(`option`,{value:`defaults`,children:`Fast draft — use reversible defaults`})]})]})}),(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Evidence confirmation`}),(0,$.jsx)(`small`,{children:`Controls the first authoring gate; materialization and training remain separate`})]}),(0,$.jsxs)(`label`,{className:`settings-check-row`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:d,disabled:p,onChange:e=>f(e.target.checked)}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:`Skip evidence confirmation`}),(0,$.jsx)(`small`,{children:`Immediately send excerpts from explicitly selected chats to the authoring model. This never approves Taskset materialization or training spend.`})]})]}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:p||x,children:(0,$.jsx)(`span`,{children:p?`Saving`:`Save training settings`})})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`Authoring model`}),(0,$.jsx)(`strong`,{children:_?`${S(_.providerId,a)} / ${T(_.modelId,a,_.providerId)}`:`Chat default`})]}),(0,$.jsxs)(`div`,{className:`settings-footnote`,children:[(0,$.jsx)(`span`,{children:`Safety boundary`}),(0,$.jsx)(`strong`,{children:`Taskset and training approvals always required`})]})]})}function Sr(e){return e?JSON.stringify([e.providerId,e.modelId]):br}function Cr(e){if(e===br)return null;try{let t=JSON.parse(e);return!Array.isArray(t)||t.length!==2||typeof t[0]!=`string`||typeof t[1]!=`string`?null:{providerId:t[0],modelId:t[1]}}catch{return null}}function wr(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Tr(e,t){return e?.providerId===t?.providerId&&e?.modelId===t?.modelId}var Er=n();function Dr({disabled:e,onChange:t,storageRoots:n,value:r}){let i=(0,Q.useId)(),[a,o]=(0,Q.useState)(!1),s=Nr(r),c=e=>e.datasetStorePath,l=`Dataset`,u=n.find(e=>Nr(c(e))===s)??null;return(0,$.jsxs)(`div`,{className:`model-storage-picker`,children:[(0,$.jsxs)(`label`,{className:`model-storage-label`,htmlFor:i,children:[l,` storage`]}),(0,$.jsxs)(`div`,{className:`model-storage-control-row`,children:[(0,$.jsxs)(`select`,{"aria-label":`${l} storage drive`,className:`model-storage-select`,disabled:e,id:i,title:r??`No Dataset storage configured`,value:r??``,onChange:e=>t(e.target.value||null),children:[(0,$.jsx)(`option`,{value:``,children:`Not configured`}),r&&!u?(0,$.jsx)(`option`,{value:r,children:`Manual location`}):null,n.map(e=>(0,$.jsxs)(`option`,{disabled:!e.mounted||!e.writable,title:c(e),value:c(e),children:[e.label,` · `,jr(e.kind),` · `,Mr(e)]},e.id))]}),(0,$.jsx)(`button`,{className:`settings-icon-button model-storage-add`,disabled:e,type:`button`,title:`Add manual location`,"aria-label":`Add manual Dataset storage location`,onClick:()=>o(!0),children:(0,$.jsx)(q,{size:15})})]}),a?Or((0,$.jsx)(kr,{initialPath:r??``,purpose:`dataset`,onClose:()=>o(!1),onUse:e=>{t(e),o(!1)}})):null]})}function Or(e){return typeof document>`u`?e:(0,Er.createPortal)(e,document.body)}function kr({initialPath:e,onClose:t,onUse:n,purpose:r=`model`}){let i=(0,Q.useId)(),[a,o]=(0,Q.useState)(e),s=Ar(a);(0,Q.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]);function c(e){e.preventDefault(),e.stopPropagation(),!s&&n(a.trim())}return(0,$.jsx)(`div`,{className:`git-dialog-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:(0,$.jsxs)(`form`,{className:`git-dialog model-storage-dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":i,onSubmit:c,children:[(0,$.jsx)(`button`,{className:`git-dialog-close`,type:`button`,title:`Close`,"aria-label":`Close manual ${r} storage`,onClick:t,children:(0,$.jsx)(Y,{size:15})}),(0,$.jsx)(`div`,{className:`git-dialog-icon`,children:(0,$.jsx)(G,{size:18})}),(0,$.jsxs)(`h2`,{id:i,children:[`Manual `,r,` storage`]}),(0,$.jsx)(`p`,{children:`Enter an absolute path to a folder mounted on this machine.`}),(0,$.jsxs)(`label`,{className:`git-dialog-field`,children:[(0,$.jsx)(`span`,{children:`Mounted folder path`}),(0,$.jsx)(`input`,{autoFocus:!0,spellCheck:!1,value:a,placeholder:r===`dataset`?`/mnt/OpenPond/datasets`:`/mnt/models or /run/user/…/gvfs/…`,onChange:e=>o(e.target.value)})]}),(0,$.jsx)(`div`,{className:`model-storage-dialog-note`,children:`For SMB, connect the share in Files or Finder first, then paste its mounted folder path. OpenPond uses your operating system’s existing connection and credentials.`}),a.trim()&&s?(0,$.jsx)(X,{error:s}):null,(0,$.jsxs)(`div`,{className:`git-dialog-footer`,children:[(0,$.jsx)(`button`,{className:`git-dialog-secondary`,type:`button`,onClick:t,children:`Cancel`}),(0,$.jsx)(`button`,{className:`git-dialog-primary`,disabled:!!s,type:`submit`,children:`Use location`})]})]})})}function Ar(e){let t=e.trim();return t?/^[a-z][a-z\d+.-]*:\/\//i.test(t)?`Use the mounted folder path, not an smb:// or other network URL.`:t===`~`||t.startsWith(`~/`)||t.startsWith(`/`)||t.startsWith(`\\\\`)||/^[a-z]:[\\/]/i.test(t)?null:`Enter an absolute mounted folder path.`:`Enter a mounted folder path.`}function jr(e){return e===`network`?`Network`:e===`removable`?`Removable`:e===`cache`?`Cache`:`Local`}function Mr(e){return e.mounted?e.writable?`${Pr(e.freeBytes)} free`:`Read only`:`Not mounted`}function Nr(e){let t=(e??``).trim().replace(/[\\/]+$/,``);return/^(?:[a-z]:[\\/]|\\\\)/i.test(t)?t.toLowerCase():t}function Pr(e){if(e==null)return`Unknown`;if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e,r=-1;do n/=1024,r+=1;while(n>=1024&&r<t.length-1);return`${n>=10?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function Fr({state:e,catalog:t,busy:n,catalogLoading:r,onRefresh:i,onSave:a}){let[o,s]=(0,Q.useState)(e?.settings.datasetStorePath??null);(0,Q.useEffect)(()=>{s(e?.settings.datasetStorePath??null)},[e?.settings.datasetStorePath]);let c=(0,Q.useMemo)(()=>e?.storageRoots.find(e=>Br(e.datasetStorePath)===Br(o))??null,[o,e?.storageRoots]),l=o===(e?.settings.datasetStorePath??null),u=t?.datasets??[];async function d(e){e.preventDefault(),await a(o)}return(0,$.jsxs)(`section`,{className:`account-settings compute-settings dataset-storage-settings`,children:[(0,$.jsxs)(`div`,{className:`compute-title-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{children:`Dataset Storage`}),(0,$.jsx)(`p`,{className:`dataset-storage-intro`,children:`Choose where Dataset artifacts are saved and review registered Datasets without loading their rows.`})]}),(0,$.jsx)(`button`,{"aria-label":`Refresh Dataset storage`,className:`settings-icon-button`,disabled:n!==null||r,onClick:()=>void i(),title:`Refresh Dataset storage`,type:`button`,children:(0,$.jsx)(J,{className:r?`settings-spin`:void 0,size:15})})]}),(0,$.jsx)(`div`,{className:`account-summary`,children:(0,$.jsx)(`div`,{className:`account-summary-main compute-summary-main`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:c?.label??(o?`Manual location`:`Not configured`)}),(0,$.jsx)(`small`,{children:o??`Choose a writable local or mounted location before importing a Dataset.`}),c?(0,$.jsxs)(`small`,{children:[Hr(c.kind),` · `,c.freeBytes==null?`Free space unknown`:`${Rr(c.freeBytes)} free`]}):null]})})}),(0,$.jsxs)(`form`,{className:`provider-settings-form`,onSubmit:e=>void d(e),children:[(0,$.jsx)(`div`,{className:`account-list-heading`,children:(0,$.jsx)(`span`,{children:`Location`})}),(0,$.jsx)(Dr,{disabled:n!==null,onChange:s,storageRoots:e?.storageRoots??[],value:o}),(0,$.jsx)(`button`,{className:`settings-primary`,disabled:n!==null||l,children:n===`save`?`Saving`:`Save Dataset storage`})]}),(0,$.jsxs)(`div`,{className:`account-list dataset-storage-list`,children:[(0,$.jsxs)(`div`,{className:`account-list-heading`,children:[(0,$.jsx)(`span`,{children:`Registered Datasets`}),(0,$.jsx)(`small`,{children:u.length})]}),u.length?u.map(e=>(0,$.jsx)(Ir,{dataset:e},e.tasksetId)):(0,$.jsx)(`div`,{className:`empty-account-list`,children:(0,$.jsx)(`span`,{children:r?`Loading registered Datasets`:`No registered Datasets`})})]})]})}function Ir({dataset:e}){let t=e.storageKind===`parquet`?`Parquet`:`Inline Taskset`;return(0,$.jsxs)(`div`,{className:`compute-row dataset-storage-row`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.name}),(0,$.jsxs)(`small`,{children:[zr(e.rowCount),` rows`,` · `,Lr(e),` · `,t,` · `,e.sizeBytes==null?`Size unavailable`:Rr(e.sizeBytes)]}),!e.available&&e.unavailableReason?(0,$.jsx)(`small`,{className:`dataset-storage-error`,children:e.unavailableReason}):null]}),(0,$.jsx)(`span`,{children:e.available?Vr(e.status):`Unavailable`})]})}function Lr(e){return[[`train`,e.splitCounts.train],[`validation`,e.splitCounts.validation],[`test`,e.splitCounts.test],[`frozen eval`,e.splitCounts.frozen_eval]].filter(([,e])=>Number(e)>0).map(([e,t])=>`${zr(Number(t))} ${e}`).join(` · `)||`No split rows`}function Rr(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`,`TB`],n=e,r=-1;do n/=1024,r+=1;while(n>=1024&&r<t.length-1);return`${n>=10?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function zr(e){return new Intl.NumberFormat().format(e)}function Br(e){return e?.replace(/[\\/]+$/,``)??``}function Vr(e){return e.replaceAll(`_`,` `).replace(/^./,e=>e.toUpperCase())}function Hr(e){return e.replace(/^./,e=>e.toUpperCase())}function Ur(e){if(!e)return`Not yet`;let t=new Date(e);return Number.isNaN(t.valueOf())?e:t.toLocaleString()}function Wr(e){return e?e.slice(0,10):`none`}function Gr(e){let t=e.replaceAll(`_`,` `);return`${t.charAt(0).toUpperCase()}${t.slice(1)}`}function Kr(e){return e===`unresolved`?`Watching`:e===`confirmed`?`Ready for Refiner`:Gr(e)}function qr({review:e}){let t=[[`Taskset`,e.tasksetProposal],[`Baseline evaluation`,e.evaluation],[`Training qualification`,e.trainingQualification]];return(0,$.jsx)(`div`,{className:`harness-review-lineage`,"aria-label":`Review lineage`,children:t.map(([e,t])=>(0,$.jsxs)(`div`,{className:t?`linked`:`pending`,children:[(0,$.jsx)(`span`,{children:e}),(0,$.jsx)(`code`,{children:t?Wr(t.contentHash):`Not created`})]},e))})}function Jr({candidate:e}){return(0,$.jsxs)(`details`,{className:`harness-disclosure-row`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-${e.status}`,children:Kr(e.status)}),(0,$.jsx)(`strong`,{children:e.statement}),(0,$.jsxs)(`small`,{children:[e.occurrences.length,` occurrence`,e.occurrences.length===1?``:`s`]}),(0,$.jsx)(`time`,{children:Ur(e.updatedAt)})]}),(0,$.jsxs)(`div`,{className:`harness-disclosure-body`,children:[(0,$.jsx)(`p`,{children:e.resolution?.reason??e.recurrenceFamily}),(0,$.jsxs)(`dl`,{className:`harness-compact-metadata`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Pattern`}),(0,$.jsx)(`dd`,{children:e.recurrenceFamily})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Fingerprint`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{children:Wr(e.fingerprint)})})]})]}),e.occurrences.length?(0,$.jsxs)(`details`,{className:`harness-history-details`,children:[(0,$.jsx)(`summary`,{children:`Evidence receipts`}),(0,$.jsx)(`ul`,{className:`harness-evidence-list`,children:e.occurrences.map(e=>(0,$.jsxs)(`li`,{children:[(0,$.jsx)(`span`,{children:Gr(e.kind)}),(0,$.jsx)(`code`,{children:Wr(e.evidence.contentHash)}),(0,$.jsx)(`time`,{children:Ur(e.occurredAt)})]},`${e.evidence.id}:${e.evidence.contentHash}`))})]}):null]})]})}function Yr({accepting:e,onAcceptTasksetReview:t,review:n}){let r=n.classification===`taskset`&&n.nextAuthority===`human_review`&&n.tasksetProposal===null;return(0,$.jsxs)(`details`,{className:`harness-disclosure-row`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-${n.classification}`,children:Gr(n.classification)}),(0,$.jsx)(`strong`,{children:n.claim?.statement??n.reason}),(0,$.jsxs)(`small`,{children:[n.selectedEvidence.length,` selected`]}),(0,$.jsx)(`time`,{children:Ur(n.createdAt)})]}),(0,$.jsxs)(`div`,{className:`harness-disclosure-body`,children:[(0,$.jsx)(`p`,{children:n.reason}),(0,$.jsxs)(`div`,{className:`harness-review-metrics`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:n.selectedEvidence.length}),` selected`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:n.excludedEvidence.length}),` excluded`]}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{children:n.claim?.independentOccurrences??0}),` independent occurrences`]}),(0,$.jsxs)(`span`,{children:[`Next: `,(0,$.jsx)(`strong`,{children:Gr(n.nextAuthority)})]})]}),(0,$.jsx)(qr,{review:n}),r?(0,$.jsx)(`div`,{className:`harness-history-actions`,children:(0,$.jsx)(`button`,{className:`settings-primary compact`,disabled:e,onClick:()=>t(n),type:`button`,children:e?`Opening Taskset review…`:`Build training Taskset`})}):null]})]})}function Xr({receipt:e}){return(0,$.jsxs)(`details`,{className:`harness-disclosure-row`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-${e.decision}`,children:Gr(e.decision)}),(0,$.jsxs)(`strong`,{children:[e.model.provider,`/`,e.model.model]}),(0,$.jsxs)(`small`,{children:[Gr(e.signal.strength),` signal`]}),(0,$.jsx)(`time`,{children:Ur(e.createdAt)})]}),(0,$.jsxs)(`div`,{className:`harness-disclosure-body`,children:[(0,$.jsx)(`p`,{children:e.reasons.join(` `)}),(0,$.jsxs)(`dl`,{className:`harness-compact-metadata`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Review`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{children:Wr(e.review.contentHash)})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Taskset`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{children:Wr(e.tasksetRelease?.contentHash)})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{children:`Baseline`}),(0,$.jsx)(`dd`,{children:(0,$.jsx)(`code`,{children:Wr(e.baselineEvaluation?.contentHash)})})]})]})]})]})}function Zr({acceptingReviewId:e,candidates:t,onAcceptTasksetReview:n,qualifications:r,reviews:i,schedule:a}){let o=a.activityEnabled||a.enabled;return(0,$.jsxs)(`div`,{className:`harness-page-sections`,children:[(0,$.jsx)(`section`,{className:`harness-history-section`,"aria-label":`Continuous Review status`,children:(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table harness-review-status-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Status`}),(0,$.jsx)(`th`,{children:`Trigger`}),(0,$.jsx)(`th`,{children:`Last review`}),(0,$.jsx)(`th`,{children:`Last result`})]})}),(0,$.jsx)(`tbody`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status ${o?`harness-status-advanced`:``}`,children:o?`On`:`Off`})}),(0,$.jsx)(`td`,{children:a.activityEnabled?`${a.activityBatchSize} new outcomes`:`Manual only`}),(0,$.jsx)(`td`,{children:Ur(a.lastRunAt)}),(0,$.jsx)(`td`,{children:a.lastResult?Gr(a.lastResult.classification):`No completed review`})]})})]})})}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Patterns`}),(0,$.jsx)(`p`,{children:`Recurring evidence being watched or ready for the Refiner.`})]}),(0,$.jsx)(`span`,{children:t.length})]}),(0,$.jsx)(`div`,{className:`harness-disclosure-list`,children:t.length?t.map(e=>(0,$.jsx)(Jr,{candidate:e},`${e.id}:${e.contentHash}`)):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No recurring patterns are being tracked.`})})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Review history`}),(0,$.jsx)(`p`,{children:`Receipts stay compact; expand one for evidence and downstream lineage.`})]}),(0,$.jsx)(`span`,{children:i.length})]}),(0,$.jsx)(`div`,{className:`harness-disclosure-list`,children:i.length?i.map(t=>(0,$.jsx)(Yr,{accepting:e===t.id,onAcceptTasksetReview:n,review:t},`${t.id}:${t.contentHash}`)):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Continuous Review receipts yet.`})})]}),r.length?(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Training handoffs`}),(0,$.jsx)(`p`,{children:`Evidence-bound qualification receipts created for Models.`})]}),(0,$.jsx)(`span`,{children:r.length})]}),(0,$.jsx)(`div`,{className:`harness-disclosure-list`,children:r.map(e=>(0,$.jsx)(Xr,{receipt:e},`${e.id}:${e.contentHash}`))})]}):null]})}var Qr=`Update the Refiner Review Profile. Inspect the current profile first, ask what should change if it is not already clear, and show the exact release transition.`;function $r(e){let t=new Date(e);return Number.isNaN(t.valueOf())?e:t.toLocaleString()}function ei(e){return e?e.slice(0,10):`none`}function ti({busyReleaseHash:e,history:t,onRequestRelease:n,onStartAuthoring:r}){let i=(0,Q.useMemo)(()=>{let e=new Map;for(let n of t.transitions)e.has(n.nextRelease.contentHash)||e.set(n.nextRelease.contentHash,n);return e},[t.transitions]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Review Profile`}),(0,$.jsx)(`p`,{children:`Separately versioned policy composed with the immutable Refiner Core.`})]}),r?(0,$.jsx)(`button`,{className:`settings-primary compact`,onClick:()=>r(Qr),type:`button`,children:`Edit with Work`}):null]}),(0,$.jsxs)(`div`,{className:`harness-summary-grid`,children:[(0,$.jsxs)(`article`,{children:[(0,$.jsx)(`span`,{children:`Active release`}),(0,$.jsx)(`strong`,{children:ei(t.binding.release.contentHash)}),(0,$.jsxs)(`small`,{children:[`Binding revision `,t.binding.revision]})]}),(0,$.jsxs)(`article`,{children:[(0,$.jsx)(`span`,{children:`Profile`}),(0,$.jsx)(`strong`,{children:t.currentRelease.profile.name}),(0,$.jsxs)(`small`,{children:[t.currentRelease.profile.id,`@`,t.currentRelease.profile.version]})]}),(0,$.jsxs)(`article`,{children:[(0,$.jsx)(`span`,{children:`Core`}),(0,$.jsx)(`strong`,{children:t.currentRelease.coreVersion}),(0,$.jsx)(`small`,{children:ei(t.currentRelease.coreHash)})]})]}),(0,$.jsx)(`p`,{children:t.currentRelease.profile.objective}),t.currentRelease.profile.instructions.length?(0,$.jsx)(`div`,{className:`harness-edit-list`,children:t.currentRelease.profile.instructions.map(e=>(0,$.jsx)(`section`,{className:`harness-edit`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.id}),(0,$.jsx)(`span`,{children:e.text})]})},e.id))}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`The default profile adds no instructions beyond the Refiner Core.`})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Profile releases`}),(0,$.jsx)(`p`,{children:`Immutable definition history. Rollback changes future reviews only.`})]}),(0,$.jsx)(`span`,{children:t.releases.length})]}),(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Profile`}),(0,$.jsx)(`th`,{children:`Release`}),(0,$.jsx)(`th`,{children:`Created`}),(0,$.jsx)(`th`,{children:`Status`}),(0,$.jsx)(`th`,{children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:t.releases.map(r=>{let a=r.contentHash===t.binding.release.contentHash,o=!a&&i.get(r.contentHash)?.bindingChanged===!1,s=o?`activate`:`rollback`;return(0,$.jsxs)(`tr`,{children:[(0,$.jsxs)(`td`,{children:[(0,$.jsx)(`strong`,{children:r.profile.name}),(0,$.jsxs)(`small`,{children:[r.profile.id,`@`,r.profile.version,` · `,r.profile.instructions.length,` instructions`]})]}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:ei(r.contentHash)})}),(0,$.jsx)(`td`,{children:$r(r.createdAt)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status`,children:a?`active`:o?`draft`:`immutable`})}),(0,$.jsx)(`td`,{children:a?null:(0,$.jsx)(`button`,{"aria-label":`${o?`Activate`:`Roll back`} Refiner release`,className:`harness-table-icon-action`,disabled:e!==null,onClick:()=>n(r,s),title:`${o?`Activate`:`Roll back`} Refiner release`,type:`button`,children:o?(0,$.jsx)(Re,{size:14}):(0,$.jsx)(Oe,{size:14})})})]},r.contentHash)})})]})})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Definition changes`}),(0,$.jsx)(`p`,{children:`Receipts record which release changed, why, and which authoring Skill produced it.`})]}),(0,$.jsx)(`span`,{children:t.transitions.length})]}),(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Operation`}),(0,$.jsx)(`th`,{children:`Change`}),(0,$.jsx)(`th`,{children:`Release transition`}),(0,$.jsx)(`th`,{children:`Validation`}),(0,$.jsx)(`th`,{children:`Created`})]})}),(0,$.jsx)(`tbody`,{children:t.transitions.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`span`,{className:`harness-status`,children:[e.operation,e.bindingChanged?` · active`:` · draft`]})}),(0,$.jsxs)(`td`,{children:[(0,$.jsx)(`strong`,{children:e.reason}),(0,$.jsx)(`small`,{children:e.authoringSkillHash?`Skill ${ei(e.authoringSkillHash)}`:e.actor})]}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`code`,{children:[ei(e.previousRelease?.contentHash),` → `,ei(e.nextRelease.contentHash)]})}),(0,$.jsx)(`td`,{children:e.validation.valid?`Passed`:e.validation.messages.join(`; `)}),(0,$.jsx)(`td`,{children:$r(e.createdAt)})]},e.contentHash))})]})})]})]})}var ni={enabled:!1,activityEnabled:!1,activityBatchSize:10,cadence:`manual`,maxEstimatedCostUsd:.1,nextRunAt:null,lastRunAt:null,lastResult:null,lastError:null,updatedAt:null},ri={overview:{title:`Harness overview`,description:`Current state, items needing attention, and recent learning activity.`},refiner:{title:`Refiner`,description:`Validated per-turn improvements and recommendations routed outside the Harness.`},"continuous-review":{title:`Continuous Review`,description:`Recurring patterns found across completed work and their immutable review receipts.`},contents:{title:`Harness contents`,description:`The instructions, skills, agents, and memory available in the current release.`},releases:{title:`Harness releases`,description:`Immutable versions, diffs, and rollback controls.`}};function ii(e){if(!e)return`Not yet`;let t=new Date(e);return Number.isNaN(t.valueOf())?e:t.toLocaleString()}function ai(e){return e?e.slice(0,10):`none`}function oi(e,t,n){return{workspaceId:e,baseRelease:t?{id:t.id,contentHash:t.contentHash}:null,targetRelease:{id:n.id,contentHash:n.contentHash},title:n.current?`Current Harness release`:`Harness release ${ai(n.contentHash)}`}}function si({review:e,busy:t,onReview:n}){return(0,$.jsxs)(`article`,{className:`harness-history-card harness-review-card`,children:[(0,$.jsxs)(`header`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`harness-history-kicker`,children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-retained`,children:`review required`}),(0,$.jsxs)(`span`,{children:[e.proposal.route,` · `,e.proposal.edits[0]?.operation??`change`]})]}),(0,$.jsx)(`h2`,{children:e.proposal.expectedOutcome})]}),(0,$.jsx)(`time`,{children:ii(e.proposal.createdAt)})]}),(0,$.jsx)(`p`,{children:e.proposal.edits.map(e=>e.summary).join(` `)}),(0,$.jsxs)(`details`,{className:`harness-history-details`,children:[(0,$.jsxs)(`summary`,{children:[`Exact edits (`,e.proposal.edits.length,`)`]}),(0,$.jsx)(`div`,{className:`harness-edit-list`,children:e.proposal.edits.map(e=>(0,$.jsxs)(`section`,{className:`harness-edit`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[e.operation,` · `,e.target]}),(0,$.jsx)(`span`,{children:e.summary})]}),e.content===null?(0,$.jsx)(`p`,{children:`File deleted.`}):(0,$.jsx)(`pre`,{children:e.content})]},e.id))})]}),e.validations.length?(0,$.jsxs)(`details`,{className:`harness-history-details`,children:[(0,$.jsxs)(`summary`,{children:[`Validation receipts (`,e.validations.length,`)`]}),(0,$.jsx)(`div`,{className:`harness-validation-list`,children:e.validations.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`harness-validation-status ${e.status}`,children:e.status}),(0,$.jsx)(`strong`,{children:e.kind.replaceAll(`_`,` `)}),(0,$.jsx)(`span`,{children:e.summary})]},e.id))})]}):null,(0,$.jsxs)(`footer`,{className:`harness-review-actions`,children:[(0,$.jsxs)(`button`,{className:`settings-secondary compact`,disabled:t,onClick:()=>n(e,`decline`),type:`button`,children:[(0,$.jsx)(Y,{size:13}),` Decline`]}),(0,$.jsxs)(`button`,{className:`settings-primary compact`,disabled:t||e.validations.some(e=>e.status!==`passed`),onClick:()=>n(e,`approve`),type:`button`,children:[(0,$.jsx)(Re,{size:13}),` Approve and release`]})]})]})}function ci({change:e,onClose:t}){let n=e.proposal;return(0,$.jsxs)(pe,{ariaLabel:`Refiner change details`,backdropClassName:`harness-details-dialog-backdrop`,className:`harness-details-dialog`,onClose:t,children:[(0,$.jsxs)(`header`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`harness-status harness-status-${e.receipt.decision}`,children:e.receipt.decision.replaceAll(`_`,` `)}),(0,$.jsx)(`h2`,{children:n?.expectedOutcome??e.receipt.reason}),(0,$.jsx)(`p`,{children:e.receipt.reason})]}),(0,$.jsx)(`button`,{"aria-label":`Close change details`,onClick:t,type:`button`,children:(0,$.jsx)(Y,{size:16})})]}),(0,$.jsxs)(`div`,{className:`harness-details-dialog-body`,children:[n?.edits.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{children:`Exact edits`}),(0,$.jsx)(`div`,{className:`harness-edit-list`,children:n.edits.map(e=>(0,$.jsxs)(`article`,{className:`harness-edit`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`strong`,{children:[e.operation,` · `,e.target]}),(0,$.jsx)(`span`,{children:e.summary})]}),e.content===null?(0,$.jsx)(`p`,{children:`File deleted.`}):(0,$.jsx)(`pre`,{children:e.content})]},e.id))})]}):null,e.validations.length?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{children:`Validation`}),(0,$.jsx)(`div`,{className:`harness-validation-list`,children:e.validations.map(e=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`span`,{className:`harness-validation-status ${e.status}`,children:e.status}),(0,$.jsx)(`strong`,{children:e.kind.replaceAll(`_`,` `)}),(0,$.jsx)(`span`,{children:e.summary})]},e.id))})]}):null]})]})}function li({history:e,reviewingProposalId:t,onReviewProposal:n}){let r=(0,Q.useMemo)(()=>[...e.changes.map(e=>({id:`change:${e.receipt.id}`,at:e.receipt.createdAt,kind:`Refiner`,title:e.proposal?.expectedOutcome??e.receipt.reason,detail:e.receipt.decision.replaceAll(`_`,` `)})),...e.routes.map(e=>({id:`route:${e.decision.id}`,at:e.decision.createdAt,kind:`Routed`,title:e.decision.reason,detail:e.decision.route})),...e.evaluationReviews.map(e=>({id:`review:${e.id}`,at:e.createdAt,kind:`Continuous Review`,title:e.claim?.statement??e.reason,detail:e.classification.replaceAll(`_`,` `)}))].sort((e,t)=>t.at.localeCompare(e.at)).slice(0,6),[e]);return(0,$.jsxs)(`div`,{className:`harness-page-sections`,children:[e.pendingReviews.length?(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Needs review`}),(0,$.jsx)(`p`,{children:`Sensitive or high-impact proposals require your approval.`})]}),(0,$.jsx)(`span`,{children:e.pendingReviews.length})]}),e.pendingReviews.map(e=>(0,$.jsx)(si,{busy:t!==null,onReview:n,review:e},`${e.proposal.id}:${e.proposal.contentHash}`))]}):null,(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Recent activity`}),(0,$.jsx)(`p`,{children:`The latest events from both learning loops.`})]}),(0,$.jsx)(`span`,{children:r.length})]}),r.length?(0,$.jsx)(`div`,{className:`harness-activity-list`,children:r.map(e=>(0,$.jsxs)(`article`,{children:[(0,$.jsx)(`span`,{children:e.kind}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`strong`,{children:e.title}),(0,$.jsx)(`small`,{children:e.detail})]}),(0,$.jsx)(`time`,{children:ii(e.at)})]},e.id))}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Harness learning activity yet.`})]})]})}function ui({history:e,refiner:t,busyReleaseHash:n,onRequestRefinerRelease:r,onStartRefinerAuthoring:i,onOpenChangeDiff:a,onOpenSourceSession:o}){let[s,c]=(0,Q.useState)(null);return(0,$.jsxs)(`div`,{className:`harness-page-sections`,children:[(0,$.jsx)(ti,{busyReleaseHash:n,history:t,onRequestRelease:r,onStartAuthoring:i}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Applied changes`}),(0,$.jsx)(`p`,{children:`Every release transition with exact edits and validation receipts.`})]}),(0,$.jsx)(`span`,{children:e.changes.length})]}),e.changes.length?(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table harness-refiner-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Change`}),(0,$.jsx)(`th`,{children:`Target`}),(0,$.jsx)(`th`,{children:`Release`}),(0,$.jsx)(`th`,{children:`Created`}),(0,$.jsx)(`th`,{children:`Result`}),(0,$.jsx)(`th`,{children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:e.changes.map(e=>{let t=e.trigger?.runRef??null,n=e.proposal;return(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`strong`,{children:n?.expectedOutcome??e.receipt.reason})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:n?.edits[0]?.target??n?.route??`workspace`})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:ai(e.receipt.nextRelease?.contentHash)})}),(0,$.jsx)(`td`,{children:ii(e.receipt.createdAt)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status harness-status-${e.receipt.decision}`,children:e.receipt.decision.replaceAll(`_`,` `)})}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`harness-inline-actions`,children:[(0,$.jsx)(`button`,{"aria-label":`View evidence and exact edits`,className:`harness-table-icon-action`,onClick:()=>c(e),title:`View evidence and exact edits`,type:`button`,children:(0,$.jsx)(it,{size:14})}),e.receipt.nextRelease?(0,$.jsx)(`button`,{"aria-label":`View release diff`,className:`harness-table-icon-action`,onClick:()=>a(e),title:`View release diff`,type:`button`,children:(0,$.jsx)(m,{size:14})}):null,t&&o?(0,$.jsx)(`button`,{"aria-label":`Open source conversation`,className:`harness-table-icon-action`,onClick:()=>o(t),title:`Open source conversation`,type:`button`,children:(0,$.jsx)(le,{size:14})}):null]})})]},`${e.receipt.id}:${e.receipt.contentHash}`)})})]})}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Harness changes have been applied.`})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Routed recommendations`}),(0,$.jsx)(`p`,{children:`Observations sent to runtime, product, Tasksets, or training without mutating the Harness.`})]}),(0,$.jsx)(`span`,{children:e.routes.length})]}),e.routes.length?(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table harness-route-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Recommendation`}),(0,$.jsx)(`th`,{children:`Source evidence`}),(0,$.jsx)(`th`,{children:`Created`}),(0,$.jsx)(`th`,{children:`Route`})]})}),(0,$.jsx)(`tbody`,{children:e.routes.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`p`,{children:e.decision.reason})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`p`,{children:e.trigger?.reason??`Completed work`})}),(0,$.jsx)(`td`,{children:ii(e.decision.createdAt)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status`,children:e.decision.route})})]},`${e.decision.id}:${e.decision.contentHash}`))})]})}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No recommendations have been routed.`})]}),s?(0,$.jsx)(ci,{change:s,onClose:()=>c(null)}):null]})}function di(e){return e.includes(`/skills/`)||e.startsWith(`skills/`)?`Skill`:e.includes(`/agents/`)||e.startsWith(`agents/`)?`Agent`:e.includes(`memory`)?`Memory`:e.endsWith(`.md`)?`Instruction`:`File`}function fi(e){return e<1024?`${e} B`:`${(e/1024).toFixed(+(e<10240))} KB`}function pi({history:e,onOpenCurrentRelease:t}){let n=e.releases.find(e=>e.current)??e.releases[0]??null;return(0,$.jsxs)(`div`,{className:`harness-page-sections`,children:[(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Current release`}),(0,$.jsx)(`p`,{children:`Read-only source contents currently supplied by the Personal Harness.`})]}),n?(0,$.jsx)(`button`,{className:`settings-secondary compact`,onClick:t,type:`button`,children:`View release diff`}):null]}),n?.files.length?(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Type`}),(0,$.jsx)(`th`,{children:`Source`}),(0,$.jsx)(`th`,{children:`Size`}),(0,$.jsx)(`th`,{children:`Revision`})]})}),(0,$.jsx)(`tbody`,{children:n.files.map(e=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsx)(`span`,{className:`harness-status`,children:di(e.path)})}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:e.path})}),(0,$.jsx)(`td`,{children:fi(e.sizeBytes)}),(0,$.jsx)(`td`,{children:(0,$.jsx)(`code`,{children:ai(e.contentHash)})})]},e.id))})]})}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`The current release has no source files.`})]}),(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Memory`}),(0,$.jsx)(`p`,{children:`Bounded memory available through search; it is not copied into every prompt.`})]}),(0,$.jsx)(`span`,{children:e.memories.length})]}),(0,$.jsx)(`div`,{className:`harness-disclosure-list`,children:e.memories.length?e.memories.map(e=>(0,$.jsxs)(`details`,{className:`harness-disclosure-row`,children:[(0,$.jsxs)(`summary`,{children:[(0,$.jsx)(`span`,{className:`harness-status`,children:`Memory`}),(0,$.jsx)(`strong`,{children:e.key}),(0,$.jsxs)(`small`,{children:[`revision `,e.revision]}),(0,$.jsx)(`time`,{children:ii(e.updatedAt)})]}),(0,$.jsxs)(`div`,{className:`harness-disclosure-body`,children:[(0,$.jsx)(`p`,{children:e.content}),e.tags.length?(0,$.jsx)(`small`,{children:e.tags.join(` · `)}):null]})]},`${e.id}:${e.revision}`)):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Harness memory has been saved.`})})]})]})}function mi({busy:e,history:t,onOpenDiff:n,onRequestRollback:r}){return(0,$.jsxs)(`section`,{className:`harness-history-section`,children:[(0,$.jsxs)(`div`,{className:`harness-section-heading`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{children:`Release history`}),(0,$.jsx)(`p`,{children:`New work uses the current release; active runs stay pinned to the version they started with.`})]}),(0,$.jsx)(`span`,{children:t.releases.length})]}),t.releases.length?(0,$.jsx)(`div`,{className:`harness-table-wrap`,children:(0,$.jsxs)(`table`,{className:`harness-table harness-release-table`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`th`,{children:`Release`}),(0,$.jsx)(`th`,{children:`Contents`}),(0,$.jsx)(`th`,{children:`Created`}),(0,$.jsx)(`th`,{children:`Status`}),(0,$.jsx)(`th`,{children:(0,$.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,$.jsx)(`tbody`,{children:t.releases.map((i,a)=>(0,$.jsxs)(`tr`,{children:[(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`harness-release-identity`,children:[(0,$.jsx)(`strong`,{children:i.id}),(0,$.jsx)(`code`,{children:ai(i.contentHash)})]})}),(0,$.jsxs)(`td`,{children:[i.files.length,` files`]}),(0,$.jsx)(`td`,{children:ii(i.createdAt)}),(0,$.jsx)(`td`,{children:i.current?(0,$.jsx)(`span`,{className:`harness-current-pill`,children:`Current`}):(0,$.jsx)(`span`,{className:`harness-status`,children:`Previous`})}),(0,$.jsx)(`td`,{children:(0,$.jsxs)(`div`,{className:`harness-inline-actions`,children:[(0,$.jsx)(`button`,{"aria-label":`View release changes`,className:`harness-table-icon-action`,onClick:()=>n(t.releases[a+1]??null,i),title:`View release changes`,type:`button`,children:(0,$.jsx)(m,{size:14})}),i.current?null:(0,$.jsx)(`button`,{"aria-label":`Roll back to release`,className:`harness-table-icon-action`,disabled:e,onClick:()=>r(i),title:`Roll back to release`,type:`button`,children:(0,$.jsx)(Oe,{size:14})})]})})]},`${i.id}:${i.contentHash}`))})]})}):(0,$.jsx)(`div`,{className:`harness-empty compact`,children:`No Harness releases exist yet.`})]})}function hi({connection:e,enabled:t,onAcceptEvaluationReview:n,onError:r,onDefaultReleaseDiff:i,onOpenReleaseDiff:a,onOpenSourceSession:o,onStartRefinerAuthoring:s,onToast:c,page:l}){let[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(!1),[E,D]=(0,Q.useState)(null),{confirmAction:O,confirmDialog:k,resolveConfirmDialog:A}=Fe(),j=!!(u?.evaluationReviewSchedule.activityEnabled||u?.evaluationReviewSchedule.enabled),[M,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{u&&N(u.backgroundReview.enabled)},[u?.backgroundReview.enabled]),(0,Q.useEffect)(()=>{F(j)},[j]);let I=(0,Q.useCallback)(async()=>{if(e){_(!0);try{let[t,n]=await Promise.all([Z.harnessHistory(e),Z.refinerHistory(e)]);d(t),p(n);let a=t.releases.findIndex(e=>e.current),o=a>=0?t.releases[a]:null;t.workspace&&o&&i(oi(t.workspace.id,t.releases[a+1]??null,o)),r(null)}catch(e){r(e instanceof Error?e.message:String(e))}finally{_(!1)}}},[e,i,r]);(0,Q.useEffect)(()=>{t&&I()},[t,l,I]);let L=(0,Q.useCallback)(async t=>{if(e&&u?.workspace){T(!0);try{let n=await Z.reviewHarnessEvaluation(e,{workspaceId:u.workspace.id,maxEstimatedCostUsd:t});d(n.history),r(null),c?.(`Continuous Review completed: ${n.receipt.classification.replaceAll(`_`,` `)}.`,`success`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{T(!1)}}},[e,u,r,c]),R=(0,Q.useCallback)(async(t,n,i)=>{if(e&&u?.workspace){C(!0);try{let a=u;t===`refiner`&&n!==u.backgroundReview.enabled&&(a=(await Z.updateHarnessBackgroundReview(e,{workspaceId:u.workspace.id,enabled:n})).history);let o=u.evaluationReviewSchedule.activityEnabled||u.evaluationReviewSchedule.enabled;if(t===`continuous-review`&&(i!==o||u.evaluationReviewSchedule.enabled)){let t=u.evaluationReviewSchedule;a=(await Z.updateHarnessEvaluationReviewSchedule(e,{workspaceId:u.workspace.id,enabled:!1,activityEnabled:i,activityBatchSize:t.activityBatchSize,cadence:`manual`,maxEstimatedCostUsd:t.maxEstimatedCostUsd})).history}d(a),r(null),c?.(`${t===`refiner`?`Refiner`:`Continuous Review`} settings applied.`,`success`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{C(!1)}}},[e,u,r,c]),ee=(0,Q.useCallback)(async e=>{if(u?.workspace){D(e.id);try{await n(u.workspace.id,{id:e.id,contentHash:e.contentHash})&&(r(null),c?.(`Taskset review opened in Models.`,`success`))}catch(e){r(e instanceof Error?e.message:String(e))}finally{D(null)}}},[u?.workspace,n,r,c]),te=(0,Q.useCallback)((e,t)=>{u?.workspace&&a(oi(u.workspace.id,e,t))},[u?.workspace,a]),ne=(0,Q.useCallback)(e=>{u?.workspace&&e.receipt.nextRelease&&a({workspaceId:u.workspace.id,baseRelease:e.receipt.previousRelease,targetRelease:e.receipt.nextRelease,title:e.proposal?.expectedOutcome??e.receipt.reason})},[u?.workspace,a]),z=(0,Q.useCallback)(async t=>{if(e&&u?.workspace){y(t.contentHash);try{let n=await Z.rollbackHarness(e,{workspaceId:u.workspace.id,targetRelease:{id:t.id,contentHash:t.contentHash}});d(n.history),r(null),c?.(`Personal Harness rolled back. Existing runs remain pinned.`,`success`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{y(null)}}},[e,u?.workspace,r,c]),B=(0,Q.useCallback)(async e=>{await O({title:`Roll back Harness release?`,body:`New work will use ${ai(e.contentHash)}. Active runs remain pinned to their current release.`,confirmLabel:`Roll back`})&&await z(e)},[O,z]),V=(0,Q.useCallback)(async(t,n)=>{if(e&&await O({title:n===`activate`?`Activate Refiner release?`:`Roll back Refiner release?`,body:`Future reviews will use ${t.profile.name} at ${ai(t.contentHash)}. Existing work remains pinned.`,confirmLabel:n===`activate`?`Activate`:`Roll back`})){h(t.contentHash);try{let i={release:{id:t.id,contentHash:t.contentHash},reason:`${n===`activate`?`Activate`:`Rollback`} from Settings to ${t.profile.id}@${t.profile.version}.`,actor:`settings-user`};p(await(n===`activate`?Z.activateRefinerRelease(e,i):Z.rollbackRefinerRelease(e,i))),r(null),c?.(`Refiner ${n===`activate`?`activated`:`rolled back`}. Existing work remains pinned.`,`success`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{h(null)}}},[O,e,r,c]),re=(0,Q.useCallback)(async(t,n)=>{if(e&&u?.workspace){x(t.proposal.id);try{let i=await Z.reviewHarnessProposal(e,{workspaceId:u.workspace.id,proposal:{id:t.proposal.id,contentHash:t.proposal.contentHash},decision:n});d(i.history),r(null),c?.(n===`approve`?`Harness proposal approved and released.`:`Harness proposal declined.`,n===`approve`?`success`:`info`)}catch(e){r(e instanceof Error?e.message:String(e))}finally{x(null)}}},[e,u?.workspace,r,c]),H=u?.releases.find(e=>e.current)??u?.releases[0]??null,U=H?u?.releases.indexOf(H)??-1:-1,W=ri[l],G=u?l===`refiner`?M!==u.backgroundReview.enabled:P!==j||u.evaluationReviewSchedule.enabled:!1,ie=l===`refiner`||l===`continuous-review`;return(0,$.jsxs)(`section`,{className:`account-settings harness-history-settings`,"aria-labelledby":`harness-history-title`,children:[(0,$.jsxs)(`div`,{className:`account-settings-title harness-page-title`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{id:`harness-history-title`,children:W.title}),(0,$.jsx)(`p`,{children:W.description})]}),u?.workspace&&ie?(0,$.jsxs)(`div`,{className:`harness-page-header-actions`,children:[l===`continuous-review`?(0,$.jsx)(`button`,{className:`settings-secondary compact`,disabled:w,onClick:()=>void L(u.evaluationReviewSchedule.maxEstimatedCostUsd),type:`button`,children:w?`Reviewing…`:`Review now`}):null,(0,$.jsxs)(`label`,{className:`harness-page-toggle`,children:[(0,$.jsx)(`span`,{children:l===`refiner`?M?`On`:`Off`:P?`On`:`Off`}),(0,$.jsxs)(`span`,{className:`provider-toggle`,children:[(0,$.jsx)(`input`,{"aria-label":l===`refiner`?`Enable Refiner`:`Enable Continuous Review`,checked:l===`refiner`?M:P,disabled:S,onChange:e=>l===`refiner`?N(e.target.checked):F(e.target.checked),type:`checkbox`}),(0,$.jsx)(`span`,{"aria-hidden":`true`})]})]}),(0,$.jsx)(`button`,{className:`settings-primary compact`,disabled:S||!G,onClick:()=>void R(l,M,P),type:`button`,children:S?`Applying…`:`Apply changes`})]}):null]}),e?null:(0,$.jsx)(`div`,{className:`harness-empty`,children:`Connect to the Local OpenPond server to inspect the Harness.`}),e&&g&&!u?(0,$.jsx)(`div`,{className:`harness-empty`,children:`Loading Harness history…`}):null,u&&!u.workspace?(0,$.jsx)(`div`,{className:`harness-empty`,children:`No Personal Harness workspace has been created yet.`}):null,u?.workspace&&l===`overview`?(0,$.jsx)(li,{history:u,onReviewProposal:re,reviewingProposalId:b}):null,u&&f&&l===`refiner`?(0,$.jsx)(ui,{busyReleaseHash:m,history:u,refiner:f,onOpenChangeDiff:ne,onOpenSourceSession:o,onRequestRefinerRelease:(e,t)=>void V(e,t),onStartRefinerAuthoring:s}):null,u?.workspace&&l===`continuous-review`?(0,$.jsx)(Zr,{acceptingReviewId:E,candidates:u.refinementCandidates,onAcceptTasksetReview:e=>void ee(e),qualifications:u.modelImprovementQualifications,reviews:u.evaluationReviews,schedule:u.evaluationReviewSchedule??ni}):null,u?.workspace&&l===`contents`?(0,$.jsx)(pi,{history:u,onOpenCurrentRelease:()=>{H&&te(U>=0?u.releases[U+1]??null:null,H)}}):null,u?.workspace&&l===`releases`?(0,$.jsx)(mi,{busy:v!==null,history:u,onOpenDiff:te,onRequestRollback:e=>void B(e)}):null,(0,$.jsx)(Je,{onResolve:A,state:k})]})}function gi(e){return e?e.slice(0,10):`initial`}function _i({connection:e,expanded:t,onResizeStart:n,onToggleExpanded:r,selection:i}){let[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!0),d=(0,Q.useCallback)(async()=>{c(null),u(!0);try{o(await Z.harnessReleaseDiff(e,i))}catch(e){o(null),c(e instanceof Error?e.message:String(e))}finally{u(!1)}},[e,i]);(0,Q.useEffect)(()=>{d()},[d]);let f=(0,Q.useMemo)(()=>a?{appId:`harness:${i.workspaceId}`,repoPath:i.title,initialized:!0,dirty:a.filesChanged>0,filesChanged:a.filesChanged,additions:a.additions,deletions:a.deletions,repoFiles:a.files.map(e=>e.path),files:a.files,error:null,updatedAt:``}:null,[a,i.title,i.workspaceId]),p=`${i.title} · ${gi(i.baseRelease?.contentHash)} → ${gi(i.targetRelease.contentHash)}`;return(0,$.jsx)(h,{appId:`harness:${i.workspaceId}`,workspaceId:`harness:${i.targetRelease.contentHash}`,workspaceKind:`local_project`,connection:e,diff:f,editorPreferences:null,expanded:t,filesWithPreview:!0,loading:l,onOpenBrowserUrl:()=>void 0,onRefresh:d,onResizeStart:n,onToggleExpanded:r,readOnly:!0,workspaceError:s,workspaceInitialized:!0,workspaceName:p})}function vi({connection:e,onError:t,onPreferences:n,preferences:r,providers:i}){let[a,o]=(0,Q.useState)(r.defaultBranchPrefix),[s,c]=(0,Q.useState)(r.defaultNewProjectDirectory),[l,u]=(0,Q.useState)(r.advancedWorkspaceControls),[d,f]=(0,Q.useState)(r.steerActiveResponses),[p,m]=(0,Q.useState)(r.contextCompaction.autoEnabled),[h,g]=(0,Q.useState)(r.subagents.enabled),[_,v]=(0,Q.useState)(r.subagents.delegationMode),[y,x]=(0,Q.useState)(!r.subagents.defaultModelRef),[S,C]=(0,Q.useState)(r.subagents.defaultModelRef?.providerId??r.defaultChatProvider),[w,T]=(0,Q.useState)(r.subagents.defaultModelRef?.modelId??r.defaultChatModel),[E,D]=(0,Q.useState)(r.subagents.roles),[A,j]=(0,Q.useState)(r.subagents.maxConcurrentRuns),[M,N]=(0,Q.useState)(r.subagents.maxConcurrentRunsPerProvider),[P,F]=(0,Q.useState)(r.subagents.maxConcurrentRunsPerWorkspaceTarget),[I,L]=(0,Q.useState)(!1),R=y?null:{providerId:S,modelId:w.trim()},ee=h!==r.subagents.enabled||_!==r.subagents.delegationMode||!bi(R,r.subagents.defaultModelRef)||A!==r.subagents.maxConcurrentRuns||M!==r.subagents.maxConcurrentRunsPerProvider||P!==r.subagents.maxConcurrentRunsPerWorkspaceTarget||JSON.stringify(E)!==JSON.stringify(r.subagents.roles);(0,Q.useEffect)(()=>{o(r.defaultBranchPrefix),c(r.defaultNewProjectDirectory),u(r.advancedWorkspaceControls),f(r.steerActiveResponses),m(r.contextCompaction.autoEnabled),g(r.subagents.enabled),v(r.subagents.delegationMode),x(!r.subagents.defaultModelRef),C(r.subagents.defaultModelRef?.providerId??r.defaultChatProvider),T(r.subagents.defaultModelRef?.modelId??r.defaultChatModel),D(r.subagents.roles),j(r.subagents.maxConcurrentRuns),N(r.subagents.maxConcurrentRunsPerProvider),F(r.subagents.maxConcurrentRunsPerWorkspaceTarget)},[r.defaultChatProvider,r.defaultChatModel,r.defaultBranchPrefix,r.defaultNewProjectDirectory,r.advancedWorkspaceControls,r.steerActiveResponses,r.contextCompaction.autoEnabled,r.subagents]);function te(e){C(e),T(t=>b(e,t,i))}function ne(){return y?r.defaultChatProvider:S}function z(){return y?r.defaultChatModel:w}function B(e,t){D(n=>n.map(n=>n.id===e?t(n):n))}function V(e,t){B(e,e=>({...e,enabled:t}))}function re(e,t){B(e,e=>({...e,background:t}))}function H(e,t){B(e,e=>{if(t)return{...e,modelRef:null};let n=e.modelRef?.providerId??ne(),r=e.modelRef?.modelId??z();return{...e,modelRef:k(n,r,i)??null}})}function U(e,t){B(e,e=>({...e,modelRef:k(t,e.modelRef?.modelId??z(),i)??null}))}function W(e,t){B(e,e=>{let n=e.modelRef?.providerId??ne(),r=t.trim();return{...e,modelRef:r?{providerId:n,modelId:r}:null}})}function G(e,t){B(e,e=>({...e,isolationMode:t}))}function ie(e,t){B(e,e=>({...e,toolPolicy:t}))}function ae(e,t){B(e,e=>({...e,peerMessages:t}))}function K(e,t){B(e,e=>({...e,maxConcurrentRuns:yi(t,1,16)}))}async function oe(){let e=null;if(window.openpond?.selectFolder){let t=await window.openpond.selectFolder();if(t.canceled)return;e=t.path}else e=window.prompt(`Default new project directory`,s);e?.trim()&&c(e.trim())}async function se(o){if(o.preventDefault(),e){L(!0),t(null);try{n(await Z.savePreferences(e,{defaultBranchPrefix:O(a),defaultNewProjectDirectory:s.trim(),advancedWorkspaceControls:l,steerActiveResponses:d,contextCompaction:{...r.contextCompaction,autoEnabled:p},subagents:{enabled:h,workspaceDefaultsVersion:r.subagents.workspaceDefaultsVersion,toolDefaultsVersion:r.subagents.toolDefaultsVersion,delegationMode:_,defaultModelRef:y?null:k(S,w,i)??null,roles:E,maxConcurrentRuns:yi(A,1,32),maxConcurrentRunsPerProvider:M===null?null:yi(M,1,32),maxConcurrentRunsPerWorkspaceTarget:P===null?null:yi(P,1,32)}}))}catch(e){t(e instanceof Error?e.message:String(e))}finally{L(!1)}}}return{advancedWorkspaceControls:l,steerActiveResponses:d,contextCompactionAutoEnabled:p,defaultBranchPrefix:a,defaultNewProjectDirectory:s,subagentsEnabled:h,subagentDelegationMode:_,subagentsUseDefaultModel:y,subagentsProvider:S,subagentsModel:w,subagentRoles:E,subagentsMaxConcurrentRuns:A,subagentsMaxConcurrentRunsPerProvider:M,subagentsMaxConcurrentRunsPerWorkspaceTarget:P,subagentsDirty:ee,saving:I,chooseDefaultProjectDirectory:oe,saveDefaults:se,changeSubagentsProvider:te,changeSubagentRoleProvider:U,setAdvancedWorkspaceControls:u,setSteerActiveResponses:f,setContextCompactionAutoEnabled:m,setDefaultBranchPrefix:o,setDefaultNewProjectDirectory:c,setSubagentsUseDefaultModel:x,setSubagentsModel:T,setSubagentsEnabled:g,setSubagentDelegationMode:e=>v(e),setSubagentsMaxConcurrentRuns:e=>j(yi(e,1,32)),setSubagentsMaxConcurrentRunsPerProvider:e=>N(e===null?null:yi(e,1,32)),setSubagentsMaxConcurrentRunsPerWorkspaceTarget:e=>F(e===null?null:yi(e,1,32)),setSubagentRoleBackground:re,setSubagentRoleEnabled:V,setSubagentRoleIsolationMode:G,setSubagentRoleMaxConcurrentRuns:K,setSubagentRoleModel:W,setSubagentRolePeerMessages:ae,setSubagentRoleToolPolicy:ie,setSubagentRoleUseDefaultModel:H}}function yi(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,Math.trunc(e))):t}function bi(e,t){return(e?.providerId??null)===(t?.providerId??null)&&(e?.modelId??null)===(t?.modelId??null)}var xi=15e3,Si=100,Ci=100,wi=2500;function Ti({onError:e,section:t}){let[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(Si),[c,l]=(0,Q.useState)([]),[u,d]=(0,Q.useState)(null),[f,p]=(0,Q.useState)(!0),m=(0,Q.useRef)(null),[h,g]=(0,Q.useState)(null),_=!!(window.openpond?.openLogsFolder||window.openpond?.readRecentLogs||window.openpond?.copyRecentLogs||window.openpond?.exportDiagnostics),v=window.openpond?.readRecentLogs?`${c.length} of ${o} line${o===1?``:`s`}${f?` tailing`:``}`:`Unavailable`;(0,Q.useEffect)(()=>{t===`diagnostics`&&y(o,`refresh`,{quiet:!0})},[t]),(0,Q.useEffect)(()=>{if(t!==`diagnostics`||!f||!window.openpond?.readRecentLogs)return;let e=!1,n=window.setInterval(()=>{e||(e=!0,y(o,`refresh`,{quiet:!0}).finally(()=>{e=!1}))},wi);return()=>window.clearInterval(n)},[t,f,o]),(0,Q.useEffect)(()=>{if(t!==`diagnostics`||!f)return;let e=m.current;e&&(e.scrollTop=e.scrollHeight)},[t,f,c]);async function y(t=o,n=`refresh`,r={}){let i=window.openpond?.readRecentLogs;if(i){r.quiet||a(n);try{let e=await Ei(i(t),`Read logs`);if(!e.ok)throw Error(e.error);s(e.lineLimit),d(e.logDir),l(e.lines),r.quiet?g(e=>e?.label===`Logs`?null:e):g(null)}catch(t){let n=t instanceof Error?t.message:String(t);g({label:`Logs`,value:n,warning:!0}),r.quiet||e(n)}finally{r.quiet||a(null)}}else{let t=`Log view is not available in this runtime.`;r.quiet||(g({label:`Logs`,value:t,warning:!0}),e(t))}}function b(){p(!1),y(o+Ci,`older`)}function x(){let e=!f;p(e),e&&y(o,`refresh`,{quiet:!0})}async function S(){let t=window.openpond?.openLogsFolder;if(t){r(`logs`),e(null);try{let e=await Ei(t(),`Open logs`);if(!e.ok)throw Error(e.error??`Could not open the logs folder.`);g(null)}catch(t){let n=t instanceof Error?t.message:String(t);g({label:`Logs`,value:n,warning:!0}),e(n)}finally{r(null)}}else{let t=`Desktop logs are not available in this runtime.`;g({label:`Logs`,value:t,warning:!0}),e(t)}}async function C(){let t=window.openpond?.copyRecentLogs;if(t){r(`copy`),e(null);try{let e=await Ei(t(1e3),`Copy recent logs`);if(!e.ok)throw Error(e.error??`Could not copy recent logs.`);g({label:`Copy`,value:e.lines?`Copied ${e.lines} recent log lines.`:`Copied recent logs.`})}catch(t){let n=t instanceof Error?t.message:String(t);g({label:`Copy`,value:n,warning:!0}),e(n)}finally{r(null)}}else{let t=`Recent log copy is not available in this runtime.`;g({label:`Copy`,value:t,warning:!0}),e(t)}}async function w(){let t=window.openpond?.exportDiagnostics;if(t){r(`export`),e(null);try{let e=await Ei(t(),`Export diagnostics`);if(!e.ok)throw Error(e.error??`Could not export diagnostics.`);g({label:`Export`,value:e.path?`Saved to ${e.path}`:`Diagnostics exported.`})}catch(t){let n=t instanceof Error?t.message:String(t);g({label:`Export`,value:n,warning:!0}),e(n)}finally{r(null)}}else{let t=`Diagnostics export is not available in this runtime.`;g({label:`Export`,value:t,warning:!0}),e(t)}}return{diagnosticsAvailable:_,diagnosticsBusy:n,diagnosticsStatus:h,logDir:u,logLineLimit:o,logLines:c,logViewBusy:i,logViewSummary:v,logViewportRef:m,tailLogs:f,copyRecentLogs:C,exportDiagnosticsBundle:w,loadOlderLogs:b,openLogsFolder:S,refreshLogView:y,toggleTailLogs:x}}async function Ei(e,t){let n;try{return await Promise.race([e,new Promise((e,r)=>{n=window.setTimeout(()=>{r(Error(`${t} did not receive a desktop response.`))},xi)})])}finally{n!==void 0&&window.clearTimeout(n)}}function Di({connection:e,enabled:t,onError:n,onPreferences:r,onToast:i,preferences:a}){let[o,s]=(0,Q.useState)(a.editor),[c,l]=(0,Q.useState)(null),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{s(a.editor)},[a.editor]);let g=(0,Q.useCallback)(async()=>{if(e){p(!0);try{l(await Z.workspaceLspSettingsStatus(e))}catch(e){n(e instanceof Error?e.message:String(e))}finally{p(!1)}}},[e,n]);(0,Q.useEffect)(()=>{t&&e&&g()},[e,t,g]);function _(e,t){s(n=>({...n,languages:{...n.languages,[e]:{...n.languages[e],mode:t}}}))}function v(e,t){s(n=>({...n,languages:{...n.languages,[e]:{...n.languages[e],customCommand:t}}}))}async function y(t){if(t.preventDefault(),e){d(!0),n(null);try{r(await Z.savePreferences(e,{editor:o})),l(await Z.workspaceLspSettingsStatus(e))}catch(e){n(e instanceof Error?e.message:String(e))}finally{d(!1)}}}async function b(){if(e){h(!0),n(null);try{await Z.restartWorkspaceLsp(e),l(await Z.workspaceLspSettingsStatus(e)),i?.(`Language servers restarted.`,`success`)}catch(e){n(e instanceof Error?e.message:String(e))}finally{h(!1)}}}return{editorPreferences:o,lspStatus:c,restarting:m,saving:u,statusLoading:f,refreshLspStatus:g,restartLanguageServers:b,saveEditorSettings:y,setEditorPreferences:s,setLanguageCustomCommand:v,setLanguageMode:_}}function Oi({connection:e,onError:t,onPayload:n,personalization:r}){let i=(0,Q.useMemo)(()=>r.templates.map(e=>({value:e.id,label:e.name,description:e.id===r.activeTemplateId?`Selected`:e.source===`built_in`?e.description:void 0})),[r.activeTemplateId,r.templates]),[a,o]=(0,Q.useState)(r.activeTemplateId),[s,c]=(0,Q.useState)(r.soul),[l,u]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(!1),h=r.templates.find(e=>e.id===a)??r.templates[0],g=h?.source===`custom`,_=!h||s!==h.content,v=a!==r.activeTemplateId||s!==r.soul||_,y=!!(g&&s.trim()&&h&&v);(0,Q.useEffect)(()=>{o(r.activeTemplateId),c(r.soul);let e=r.templates.find(e=>e.id===r.activeTemplateId);u(e?`${e.name} Copy`:``),f(!1)},[r.activeTemplateId,r.soul,r.templates]);async function b(r=!1){if(!r&&!g)return;let i=r?l:h?.name;if(e&&s.trim()&&i?.trim()){m(!0),t(null);try{n(await Z.savePersonalization(e,{activeTemplateId:a,templateName:i,soul:s,saveAsNew:r})),f(!1)}catch(e){t(e instanceof Error?e.message:String(e))}finally{m(!1)}}}async function x(i){let a=r.templates.find(e=>e.id===i);if(a&&(o(a.id),u(`${a.name} Copy`),c(a.content),f(!1),e)){m(!0),t(null);try{n(await Z.savePersonalization(e,{activeTemplateId:a.id,templateName:a.name,soul:a.content,saveAsNew:!1}))}catch(e){t(e instanceof Error?e.message:String(e))}finally{m(!1)}}}function S(){h&&(u(`${h.name} Copy`),c(h.content),f(!1))}function C(e){c(e),h&&!g&&e!==h.content&&f(!0)}function w(){h&&(u(`${h.name} Copy`),f(!0))}return{canSaveCurrentTemplate:y,personalizationTemplateId:a,personalizationTemplateOptions:i,saveAsNewOpen:d,saving:p,selectedPersonalizationTemplate:h,selectedTemplateIsCustom:g,soulDraft:s,templateNameDraft:l,changePersonalizationTemplate:x,changeSoulDraft:C,openSaveAsNew:w,resetPersonalizationDraft:S,savePersonalization:b,setSaveAsNewOpen:f,setTemplateNameDraft:u}}function ki({connection:e,enabled:t,onError:n,onToast:r}){let[i,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(!1),u=(0,Q.useRef)(null),d=(0,Q.useCallback)(async(t={})=>{if(e){t.quiet||s(`refresh`);try{let t=await Z.remoteAccess(e);a(t),n(null)}catch(e){n(e instanceof Error?e.message:String(e))}finally{t.quiet||s(null)}}},[e,n]);(0,Q.useEffect)(()=>{t&&e&&d({quiet:!0})},[e,t,d]),(0,Q.useEffect)(()=>()=>{u.current!==null&&window.clearTimeout(u.current)},[]);function f(){u.current!==null&&window.clearTimeout(u.current),l(!1),window.setTimeout(()=>{l(!0),u.current=window.setTimeout(()=>{l(!1),u.current=null},1500)},0)}async function p(){if(n(null),e)try{a(await Z.remoteAccess(e))}catch{}}async function m(){if(!e)return null;i&&!i.tailscale.running&&f(),s(`enable`);try{let t=await Z.enableRemoteAccess(e);return a(t.status),n(null),t.status.tailscale.running?!t.status.serve.enabled&&t.status.serve.error&&r?.(t.status.serve.setupUrl?`Tailscale Serve needs to be enabled for this tailnet. Copy the Enable Serve link.`:t.message||t.status.serve.error,`error`):(f(),r?.(t.message||`Tailscale is not running. Run Tailscale up first.`,`error`)),t.status}catch{return await p(),f(),r?.(`Unable to turn on remote access. Run Tailscale up first.`,`error`),null}finally{s(null)}}async function h(){if(e&&window.confirm(`Turn off remote access? This runs tailscale serve reset and clears Tailscale Serve config on this device.`)){s(`disable`);try{let t=await Z.disableRemoteAccess(e);a(t.status),n(null)}catch{await p()}finally{s(null)}}}async function g(){i?.remoteWebUrl&&(s(`copy-link`),await F(i.remoteWebUrl),s(null))}async function _(){i?.serveCommand&&(s(`copy-command`),await F(i.serveCommand),s(null))}async function v(){i?.serve.setupUrl&&(s(`copy-serve-setup`),await F(i.serve.setupUrl),s(null))}async function y(){i?.tailscaleUpCommand&&(s(`copy-up-command`),await F(i.tailscaleUpCommand),s(null))}async function b(){i?.operatorCommand&&(s(`copy-operator`),await F(i.operatorCommand),s(null))}async function x(){if(i?.serve.enabled)await g();else{let e=await m();e?.serve.enabled&&e.remoteWebUrl&&await F(e.remoteWebUrl)}}return{status:i,busy:o,flashTailscaleUp:c,refresh:d,enableRemoteAccess:m,disableRemoteAccess:h,copyRemoteLink:g,copyTailscaleUpCommand:y,copyServeCommand:_,copyServeSetupUrl:v,copyOperatorCommand:b,createRemoteLink:x}}function Ai(e){let[t,n]=(0,Q.useState)(null),[r,i]=(0,Q.useState)(null),a=(0,Q.useCallback)(async()=>{if(e.connection){i(`load`);try{n(await Z.datasetStorageState(e.connection)),e.onError(null)}catch(t){e.onError(t instanceof Error?t.message:String(t))}finally{i(null)}}},[e.connection,e.onError]),o=(0,Q.useCallback)(async t=>{if(!e.connection||!t)return!1;i(`save`);try{return n(await Z.updateDatasetStorage(e.connection,t)),e.onError(null),!0}catch(t){return e.onError(t instanceof Error?t.message:String(t)),!1}finally{i(null)}},[e.connection,e.onError]);return(0,Q.useEffect)(()=>{e.enabled&&a()},[e.enabled,a]),{state:t,busy:r,refresh:a,save:o}}function ji(e){let{connection:t,enabled:n,onError:r,profileId:i}=e,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l=(0,Q.useCallback)(async()=>{if(t){c(!0);try{o(await Z.datasetCatalog(t,i)),r(null)}catch(e){r(Mi(e))}finally{c(!1)}}},[t,r,i]);return(0,Q.useEffect)(()=>{n&&l()},[n,l]),{catalog:a,loading:s,refresh:l}}function Mi(e){return e instanceof Error?e.message:String(e)}var Ni=new Set([`harness`,`harness-refiner`,`harness-continuous-review`,`harness-contents`,`harness-releases`]);function Pi(e){return e===`harness-refiner`?`refiner`:e===`harness-continuous-review`?`continuous-review`:e===`harness-contents`?`contents`:e===`harness-releases`?`releases`:`overview`}var Fi=(0,Q.lazy)(()=>i(()=>import(`./ConversationImportsSettings-B_oW0cz7.js`).then(e=>({default:e.ConversationImportsSettings})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54]))),Ii=(0,Q.lazy)(()=>i(()=>import(`./UsageSettingsSection-BT9pcnCn.js`).then(e=>({default:e.UsageSettingsSection})),__vite__mapDeps([55,1,2,3,29,36,56,42,49,9,10,11,12,13,14,4,15,16,17,18,19,20,21,22,23,24,25,26,27,28,30,31,32,33,34,35,37,38,39,40,41,43,44,45,46,47,48,5,6,7,8,50,51,52,57])));function Li({payload:e,connection:t,diagnostics:n,onPayload:r,onError:i,onToast:a,onBack:o,onOpenSourceSession:s,onStartRefinerAuthoring:c,onAcceptEvaluationReview:l,onOpenSkill:u,onOpenExtension:d,teamChatCurrentUserId:f,teamChatEnabled:p,teamChatNotificationMode:m,teamChatThreads:h,onTeamChatNotificationModeChange:g,onTeamChatThreadMuteChange:v,diffPanelWidth:y,diffPanelResizing:b,diffPanelExpanded:x,onDiffPanelResizeStart:S,onDiffPanelExpandedChange:C,initialSection:T=`account`}){let[E,D]=(0,Q.useState)(T),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),M=e?.codex??null,N=(0,Q.useMemo)(()=>_(e?.preferences),[e?.preferences]),P=e?.personalization??w,F=n??e?.diagnostics??[],I=Se()&&_e(t?.platform),L=(0,Q.useCallback)(t=>{e&&r({...e,providers:t})},[r,e]),R=(0,Q.useCallback)(t=>{e&&r({...e,preferences:t.preferences})},[r,e]),ee=(0,Q.useCallback)(t=>{e&&r({...e,extensionCatalog:t})},[r,e]),te=Ze({connection:t,onError:i,onPayload:r}),ne=se({connection:t,onError:i,onPayload:r,onPreferences:R,onProviders:L,preferences:N,providers:e?.providers??null}),z=vi({connection:t,onError:i,onPayload:r,onPreferences:R,preferences:N,providers:e?.providers??null}),B=Di({connection:t,enabled:E===`editor`,onError:i,onPayload:r,onPreferences:R,onToast:a,preferences:N}),V=Oi({connection:t,onError:i,onPayload:r,personalization:P}),re=Ti({onError:i,section:E}),H=ki({connection:t,enabled:E===`remote`,onError:i,onToast:a}),U=E===`dataset-storage`,W=Ai({connection:t,enabled:U,onError:i}),G=ji({connection:t,enabled:U,onError:i,profileId:e?.profile.activeProfile??`default`}),ie=W.save,ae=(0,Q.useCallback)(async()=>{await Promise.all([W.refresh(),G.refresh()])},[W.refresh,G.refresh]),K=(0,Q.useCallback)(()=>E!==`subagents`||!z.subagentsDirty||window.confirm(`You have unsaved changes. Leave Subagents without saving?`),[z.subagentsDirty,E]),ce=(0,Q.useCallback)(e=>{e!==E&&K()&&(j(!1),C(!1),D(e),ye({kind:`settings`,section:e}))},[K,C,E]),le=(0,Q.useCallback)(()=>{K()&&(j(!1),C(!1),o())},[K,o,C]);(0,Q.useEffect)(()=>{D(T)},[T]),(0,Q.useEffect)(()=>{if(E!==`subagents`||!z.subagentsDirty)return;let e=e=>{e.preventDefault(),e.returnValue=`You have unsaved changes.`};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[z.subagentsDirty,E]);let ue={"--diff-panel-width":`${y}px`},q=Ni.has(E),J=q&&A&&O,de=JSON.stringify([e?.profile.activeProfile,e?.account.activeProfile,e?.account.baseUrl,e?.account.apiBaseUrl,e?.account.profile?.id,e?.account.state,e?.preferences.defaultTeamId??null]);return(0,$.jsxs)(`div`,{className:`settings-shell ${I?`platform-macos`:``} ${J?`harness-diff-open`:``} ${x?`harness-diff-expanded`:``} ${b?`diff-panel-resizing`:``}`,style:ue,children:[(0,$.jsx)(`div`,{className:`settings-drag-region`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`settings-window-controls`,children:[q?(0,$.jsx)(`button`,{type:`button`,className:`topbar-diff-button ${J?`active`:``}`,title:`${J?`Hide`:`Show`} sidebar`,"aria-label":`${J?`Hide`:`Show`} sidebar`,"aria-pressed":!!J,disabled:!O,onClick:()=>j(e=>!e),children:(0,$.jsx)(Ge,{size:16})}):null,(0,$.jsx)(Ye,{platform:t?.platform})]}),(0,$.jsx)(gr,{section:E,onBack:le,onSectionChange:ce}),(0,$.jsxs)(`main`,{className:`settings-content ${E===`profile`||q?`settings-content-wide`:``}`,children:[E===`configuration`?null:(0,$.jsx)(gt,{connection:t,bannerOnly:!0,onOpen:()=>ce(`configuration`)}),E===`appearance`?(0,$.jsx)(ht,{}):E===`account`?(0,$.jsx)(Tt,{payload:e,connection:t,onPayload:r,onPreferences:R,onError:i,onToast:a,...te}):E===`ponder`?(0,$.jsx)(pt,{connection:t},JSON.stringify([e?.account.activeProfile,e?.account.baseUrl,e?.account.profile?.id,e?.account.state,e?.preferences.defaultTeamId])):E===`notifications`?(0,$.jsx)(nn,{currentUserId:f,enabled:p,mode:m,threads:h,onModeChange:g,onThreadMuteChange:v}):q?(0,$.jsx)(hi,{connection:t,enabled:q,onAcceptEvaluationReview:l,onError:i,onDefaultReleaseDiff:k,onOpenSourceSession:s,onStartRefinerAuthoring:c,onOpenReleaseDiff:e=>{k(e),j(!0)},onToast:a,page:Pi(E)}):E===`profile`?(0,$.jsx)(Vn,{payload:e,connection:t,onPayload:r,onError:i,onToast:a,onOpenSession:s}):E===`skills`?(0,$.jsx)(yr,{personalSkills:e?.codexPersonalSkills??[],builtInSkills:e?.builtInSkills??[],extensionCatalog:e?.extensionCatalog??{rootPath:``,registryPath:``,extensions:[],error:null},connection:t,onExtensionCatalog:ee,onError:i,onToast:a,onOpenSkill:u,onOpenExtension:d}):E===`providers`?(0,$.jsx)(oe,{onProvidersChanged:L,connection:t,account:e?.account??null,codex:M,providers:e?.providers??null,...ne}):E===`conversation-imports`?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`p`,{role:`status`,children:`Loading conversation imports…`}),children:(0,$.jsx)(Fi,{connection:t})}):E===`dataset-storage`?(0,$.jsx)(Fr,{state:W.state,catalog:G.catalog,busy:W.busy,catalogLoading:G.loading,onRefresh:ae,onSave:ie}):E===`configuration`?(0,$.jsxs)(`div`,{className:`settings-stacked-sections configuration-page`,children:[(0,$.jsx)(gt,{connection:t,onSaved:async()=>{t&&r(await Z.bootstrap(t))}}),(0,$.jsx)(Nt,{preferences:N,...z}),(0,$.jsx)(Ut,{embedded:!0,preferences:N,...z})]}):E===`context`?(0,$.jsx)(Ut,{preferences:N,...z}):E===`training`?(0,$.jsx)(xr,{connection:t,onError:i,onPreferences:R,preferences:N,providers:e?.providers??null}):E===`subagents`?(0,$.jsx)(Wt,{preferences:N,providers:e?.providers??null,...z}):E===`editor`?(0,$.jsx)(Vt,{preferences:N,...B}):E===`remote`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(mr,{connection:t,onError:i},de),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{children:`Direct Tailscale access`}),(0,$.jsx)(ir,{...H})]})]}):E===`usage`?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`usage-load-state`,children:`Loading activity…`}),children:(0,$.jsx)(Ii,{account:e?.account??null,connection:t,enabled:E===`usage`,onError:i,onOpenSourceSession:s})}):E===`personalization`?(0,$.jsx)(an,{...V}):(0,$.jsx)(Pt,{diagnostics:F,...re})]}),q&&t&&J?(0,$.jsx)(_i,{connection:t,expanded:x,onResizeStart:S,onToggleExpanded:()=>C(!x),selection:J}):null]})}export{Li as SettingsView};
|